Lines Matching full:state
89 static bool match_export_symbol(struct state *state, Dwarf_Die *die) in match_export_symbol() argument
98 state->sym = symbol_get(get_symbol_name(die)); in match_export_symbol()
101 if (!state->sym && source != die) in match_export_symbol()
102 state->sym = symbol_get(get_symbol_name(source)); in match_export_symbol()
104 state->die = *source; in match_export_symbol()
105 return !!state->sym; in match_export_symbol()
266 int process_die_container(struct state *state, struct die *cache, in process_die_container() argument
274 if (state) in process_die_container()
275 state->first_list_item = true; in process_die_container()
281 res = checkp(func(state, cache, ¤t)); in process_die_container()
291 if (state) in process_die_container()
292 state->first_list_item = false; in process_die_container()
297 static int process_type(struct state *state, struct die *parent,
300 static void process_type_attr(struct state *state, struct die *cache, in process_type_attr() argument
306 check(process_type(state, cache, &type)); in process_type_attr()
314 static void process_list_comma(struct state *state, struct die *cache) in process_list_comma() argument
316 if (state->first_list_item) { in process_list_comma()
317 state->first_list_item = false; in process_list_comma()
325 static void __process_list_type(struct state *state, struct die *cache, in __process_list_type() argument
333 state->kabi.orig_name = NULL; in __process_list_type()
336 process_list_comma(state, cache); in __process_list_type()
338 process_type_attr(state, cache, die); in __process_list_type()
340 if (stable && state->kabi.orig_name) in __process_list_type()
341 name = state->kabi.orig_name; in __process_list_type()
354 static void process_##type##_type(struct state *state, \
357 __process_list_type(state, cache, die, #type " "); \
364 static void __process_type(struct state *state, struct die *cache, in DEFINE_PROCESS_LIST_TYPE()
371 process_type_attr(state, cache, die); in DEFINE_PROCESS_LIST_TYPE()
379 static void process_##type##_type(struct state *state, \
382 __process_type(state, cache, die, #type "_type"); \
398 static void process_subrange_type(struct state *state, struct die *cache, in DEFINE_PROCESS_TYPE()
411 static void process_array_type(struct state *state, struct die *cache, in process_array_type() argument
416 check(process_die_container(state, cache, die, process_type, in process_array_type()
420 process_type_attr(state, cache, die); in process_array_type()
425 static void __process_subroutine_type(struct state *state, struct die *cache, in __process_subroutine_type() argument
432 check(process_die_container(state, cache, die, process_type, in __process_subroutine_type()
439 process_type_attr(state, cache, die); in __process_subroutine_type()
442 static void process_subroutine_type(struct state *state, struct die *cache, in process_subroutine_type() argument
445 __process_subroutine_type(state, cache, die, "subroutine_type"); in process_subroutine_type()
448 static void process_variant_type(struct state *state, struct die *cache, in process_variant_type() argument
451 process_list_comma(state, cache); in process_variant_type()
454 check(process_die_container(state, cache, die, process_type, in process_variant_type()
461 static void process_variant_part_type(struct state *state, struct die *cache, in process_variant_part_type() argument
464 process_list_comma(state, cache); in process_variant_part_type()
467 check(process_die_container(state, cache, die, process_type, in process_variant_part_type()
503 static int check_struct_member_kabi_status(struct state *state, in check_struct_member_kabi_status() argument
521 res = get_kabi_status(die, &state->kabi.orig_name); in check_struct_member_kabi_status()
524 !get_ref_die_attr(die, DW_AT_type, &state->kabi.placeholder)) in check_struct_member_kabi_status()
530 static int check_union_member_kabi_status(struct state *state, in check_union_member_kabi_status() argument
556 res = get_kabi_status(die, &state->kabi.orig_name); in check_union_member_kabi_status()
559 state->kabi.placeholder = type; in check_union_member_kabi_status()
565 state, NULL, &type, check_struct_member_kabi_status, in check_union_member_kabi_status()
568 if (res <= KABI_NORMAL && ++state->kabi.members < 2) in check_union_member_kabi_status()
577 struct state state; in get_union_kabi_status() local
637 memset(&state.kabi, 0, sizeof(state.kabi)); in get_union_kabi_status()
639 res = checkp(process_die_container(&state, NULL, die, in get_union_kabi_status()
645 *placeholder = state.kabi.placeholder; in get_union_kabi_status()
647 *orig_name = state.kabi.orig_name; in get_union_kabi_status()
667 static int ___process_structure_type(struct state *state, struct die *cache, in ___process_structure_type() argument
674 return check(process_type(state, cache, die)); in ___process_structure_type()
676 return check(process_type(state, cache, die)); in ___process_structure_type()
690 static void __process_structure_type(struct state *state, struct die *cache, in __process_structure_type() argument
702 expand = state->expand.expand && is_kabi_definition(cache, die); in __process_structure_type()
705 state->expand.current_fqn = cache->fqn; in __process_structure_type()
706 check(process_die_container(state, cache, die, process_func, in __process_structure_type()
721 struct state *state, struct die *cache, Dwarf_Die *die) \
723 __process_structure_type(state, cache, die, \
732 static void process_union_type(struct state *state, struct die *cache, in DEFINE_PROCESS_STRUCTURE_TYPE()
738 &state->kabi.orig_name)); in DEFINE_PROCESS_STRUCTURE_TYPE()
741 check(process_type(state, cache, &placeholder)); in DEFINE_PROCESS_STRUCTURE_TYPE()
745 __process_structure_type(state, cache, die, "union_type", in DEFINE_PROCESS_STRUCTURE_TYPE()
749 static void process_enumerator_type(struct state *state, struct die *cache, in process_enumerator_type() argument
759 if (kabi_is_enumerator_ignored(state->expand.current_fqn, in process_enumerator_type()
764 state->expand.current_fqn, cache->fqn, &value); in process_enumerator_type()
767 process_list_comma(state, cache); in process_enumerator_type()
777 static void process_enumeration_type(struct state *state, struct die *cache, in process_enumeration_type() argument
780 __process_structure_type(state, cache, die, "enumeration_type", in process_enumeration_type()
784 static void process_base_type(struct state *state, struct die *cache, in process_base_type() argument
794 static void process_unspecified_type(struct state *state, struct die *cache, in process_unspecified_type() argument
804 static void process_cached(struct state *state, struct die *cache, in process_cached() argument
826 check(process_type(state, NULL, &child)); in process_cached()
834 static void state_init(struct state *state) in state_init() argument
836 state->expand.expand = true; in state_init()
837 state->expand.current_fqn = NULL; in state_init()
838 cache_init(&state->expansion_cache); in state_init()
841 static void expansion_state_restore(struct expansion_state *state, in expansion_state_restore() argument
844 state->expand = saved->expand; in expansion_state_restore()
845 state->current_fqn = saved->current_fqn; in expansion_state_restore()
848 static void expansion_state_save(struct expansion_state *state, in expansion_state_save() argument
851 expansion_state_restore(saved, state); in expansion_state_save()
862 process_##type##_type(state, cache, die); \
865 static int process_type(struct state *state, struct die *parent, Dwarf_Die *die) in process_type() argument
872 expansion_state_save(&state->expand, &saved); in process_type()
880 if (cache_was_expanded(&state->expansion_cache, die->addr)) in process_type()
881 state->expand.expand = false; in process_type()
883 if (state->expand.expand) in process_type()
884 cache_mark_expanded(&state->expansion_cache, die->addr); in process_type()
895 if (cache->state == want_state) { in process_type()
897 die_state_name(cache->state)); in process_type()
899 process_cached(state, cache, die); in process_type()
902 expansion_state_restore(&state->expand, &saved); in process_type()
907 die_state_name(cache->state), die_state_name(want_state)); in process_type()
947 /* Update cache state and append to the parent (if any) */ in process_type()
949 cache->state = want_state; in process_type()
952 expansion_state_restore(&state->expand, &saved); in process_type()
959 static struct die *get_symbol_cache(struct state *state, Dwarf_Die *die) in get_symbol_cache() argument
965 if (cache->state != DIE_INCOMPLETE) in get_symbol_cache()
972 static void process_symbol(struct state *state, Dwarf_Die *die, in process_symbol() argument
977 symbol_set_die(state->sym, die); in process_symbol()
979 cache = get_symbol_cache(state, die); in process_symbol()
983 debug("%s", state->sym->name); in process_symbol()
984 check(process_func(state, cache, die)); in process_symbol()
985 cache->state = DIE_SYMBOL; in process_symbol()
990 static int __process_subprogram(struct state *state, struct die *cache, in __process_subprogram() argument
993 __process_subroutine_type(state, cache, die, "subprogram"); in __process_subprogram()
997 static void process_subprogram(struct state *state, Dwarf_Die *die) in process_subprogram() argument
999 process_symbol(state, die, __process_subprogram); in process_subprogram()
1002 static int __process_variable(struct state *state, struct die *cache, in __process_variable() argument
1006 process_type_attr(state, cache, die); in __process_variable()
1010 static void process_variable(struct state *state, Dwarf_Die *die) in process_variable() argument
1012 process_symbol(state, die, __process_variable); in process_variable()
1015 static void save_symbol_ptr(struct state *state) in save_symbol_ptr() argument
1020 if (!get_ref_die_attr(&state->die, DW_AT_type, &ptr_type) || in save_symbol_ptr()
1023 get_symbol_name(&state->die)); in save_symbol_ptr()
1027 get_symbol_name(&state->die)); in save_symbol_ptr()
1035 symbol_set_ptr(state->sym, &type); in save_symbol_ptr()
1037 symbol_set_ptr(state->sym, &ptr_type); in save_symbol_ptr()
1040 static int process_exported_symbols(struct state *unused, struct die *cache, in process_exported_symbols()
1056 struct state state; in process_exported_symbols() local
1058 if (!match_export_symbol(&state, die)) in process_exported_symbols()
1061 state_init(&state); in process_exported_symbols()
1063 if (is_symbol_ptr(get_symbol_name(&state.die))) in process_exported_symbols()
1064 save_symbol_ptr(&state); in process_exported_symbols()
1066 process_subprogram(&state, &state.die); in process_exported_symbols()
1068 process_variable(&state, &state.die); in process_exported_symbols()
1070 cache_free(&state.expansion_cache); in process_exported_symbols()
1080 struct state state; in process_symbol_ptr() local
1083 if (sym->state != SYMBOL_UNPROCESSED || !sym->ptr_die_addr) in process_symbol_ptr()
1087 state_init(&state); in process_symbol_ptr()
1088 state.sym = sym; in process_symbol_ptr()
1090 if (!dwarf_die_addr_die(dwarf, (void *)sym->ptr_die_addr, &state.die)) in process_symbol_ptr()
1094 if (dwarf_tag(&state.die) == DW_TAG_subroutine_type) in process_symbol_ptr()
1095 process_subprogram(&state, &state.die); in process_symbol_ptr()
1097 process_variable(&state, &state.die); in process_symbol_ptr()
1099 cache_free(&state.expansion_cache); in process_symbol_ptr()
1102 static int resolve_fqns(struct state *parent, struct die *unused, in resolve_fqns()
1105 struct state state; in resolve_fqns() local
1125 state.expand.current_fqn = NULL; in resolve_fqns()
1138 state.expand.current_fqn = prefix; in resolve_fqns()
1154 state.expand.current_fqn = fqn; in resolve_fqns()
1162 cache->state = DIE_FQN; in resolve_fqns()
1165 check(process_die_container(&state, NULL, die, resolve_fqns, in resolve_fqns()