67 symbol->
scope = scope;
115 if (child->
parent != parent)
125 if (child->
parent == parent)
135 struct scope *symbol_scope;
158 if (symbol->
scope == scope)
159 symbol->
scope = NULL;
161 RPUT(symbol,symbol,scope,trefcnt);
167 struct range *r, *lastr, *newr;
194 if (r->
start == start) {
197 " (new end 0x%"PRIxADDR"); updating!\n",
219 else if (r->
start > start) {
280 *numscopes = g_slist_length(scope->
subscopes);
291 ADDR *high_addr_saveptr,
int *is_noncontiguous) {
294 unsigned int len = 0;
302 range = scope->
range;
305 if (range->
start < lowaddr)
306 lowaddr = range->
start;
308 if (range->
end > highaddr)
309 highaddr = range->
end;
315 if (low_addr_saveptr)
316 *low_addr_saveptr = lowaddr;
317 if (high_addr_saveptr)
318 *high_addr_saveptr = highaddr;
319 if (len != (highaddr - lowaddr) && is_noncontiguous)
320 *is_noncontiguous = 1;
336 static void scope_symdict_symbol_dtor(
struct symbol *
symbol,
void *priv) {
339 RPUT(symbol,symbol,symbol->
scope,trefcnt);
346 if (symbol->
scope == scope)
347 symbol->
scope = NULL;
361 verror(
"cannot free (%d refs) ",retval);
366 vwarn(
"forced free (%d refs) ",retval);
387 RPUT(tmp,scope,scope,trefcnt);
393 range = scope->
range;
410 struct scope *cscope;
422 np =
malloc(strlen(p) + 1 + 2);
423 np2 =
malloc(strlen(p) + 1 + 4);
424 sprintf(np,
"%s%s",p,
" ");
425 sprintf(np2,
"%s%s",p,
" ");
443 "%sscope(INLINED(%s) @@ 0x%"PRIxADDR")",
451 fprintf(ud->
stream,
"%sscope(%s)",
455 fprintf(ud->
stream,
"%sscope()",p);
458 fprintf(ud->
stream,
" RANGES(");
460 range = scope->
range;
477 fprintf(ud->
stream,
"\n%s symbols: {\n",p);
479 fprintf(ud->
stream,
"%s }\n",p);
484 fprintf(ud->
stream,
"%s subscopes: {\n",p);
488 fprintf(ud->
stream,
"%s }\n",p);
491 fprintf(ud->
stream,
"%s}\n",p);
493 fprintf(ud->
stream,
" }\n");
496 fprintf(ud->
stream,
" { }");
512 range = scope->
range;
514 if (addr >= range->
start && addr < range->
end) {
530 struct scope *retval = NULL;
538 range = scope->
range;
540 if (addr >= range->
start && addr < range->end) {
574 const char *name,
const char *delim,
578 char *saveptr = NULL;
582 struct lsymbol *lsymbol_tmp = NULL;
583 struct symbol *symbol = NULL;
585 struct scope *subscope;
588 if (delim && strstr(name,delim)) {
589 lname = strdup(name);
590 next = strtok_r(!saveptr ? lname : NULL,delim,&saveptr);
591 chain = array_list_create(1);
605 "found top-level symtab type %s\n",symbol->
name);
608 "found top-level symtab definition %s\n",symbol->
name);
611 "found top-level symtab non-type, non-definition %s; saving\n",
623 "checking scope subscopes\n");
641 lsymbol = lsymbol_tmp;
643 "found anon symtab type %s\n",
651 lsymbol = lsymbol_tmp;
653 "found anon symtab definition %s\n",
658 lsymbol = lsymbol_tmp;
660 "found anon symtab non-type, non-definition %s; saving\n",
680 array_list_free(chain);
685 "returning best subtab symbol %s\n",
711 "found top-level %s; checking members\n",lsymbol->
symbol->
name);
721 while ((next = strtok_r(!saveptr ? lname : NULL,delim,&saveptr))) {
724 else if (anonchain && array_list_len(anonchain)) {
729 for (i = 0; i < array_list_len(anonchain); ++
i) {
731 (
struct symbol *)array_list_item(anonchain,i));
734 array_list_free(anonchain);
744 array_list_compact(chain);
759 const char *name,
const char *delim,
773 struct symbol *symbol = NULL;
774 struct scope *subscope;
char * symbol_get_name_inline(struct symbol *symbol)
struct symdict * symdict_create(void)
#define LOGDUMPSCOPE_NL(dl, lt, lf, s)
void scope_dump(struct scope *scope, struct dump_info *ud)
struct scope * symbol_read_owned_scope(struct symbol *symbol)
void symdict_dump(struct symdict *symdict, struct dump_info *ud)
static uint64_t unsigned int i
GSList * symdict_match_syms(struct symdict *symdict, struct rfilter *symbol_filter, symbol_type_flag_t flags)
int scope_remove_scope(struct scope *parent, struct scope *child)
int scope_hold_symbol(struct scope *scope, struct symbol *symbol)
#define v_g_slist_foreach(gslhead, gslcur, elm)
struct symbol * __symbol_get_one_member__int(struct symbol *symbol, char *member, struct array_list **chainptr)
int scope_get_sizes(struct scope *scope, int *named, int *duplicated, int *anon, int *numscopes)
ADDR symbol_get_addr(struct symbol *symbol)
#define ERRORDUMPSCOPE_NL(s)
REFCNT scope_free(struct scope *scope, int force)
#define verror(format,...)
struct lsymbol * scope_lookup_sym__int(struct scope *scope, const char *name, const char *delim, symbol_type_flag_t flags)
int scope_remove_symbol(struct scope *scope, struct symbol *symbol)
#define vwarn(format,...)
int scope_get_overall_range(struct scope *scope, ADDR *low_addr_saveptr, ADDR *high_addr_saveptr, int *is_noncontiguous)
struct scope * scope_lookup_addr(struct scope *scope, ADDR addr)
int symbol_has_addr(struct symbol *symbol)
int symdict_remove_symbol(struct symdict *symdict, struct symbol *symbol)
struct symbol * scope_get_sym(struct scope *scope, const char *name, symbol_type_flag_t flags)
int scope_contains_addr(struct scope *scope, ADDR addr)
#define DWDEBUG_DEF_DELIM
#define vdebug(devel, areas, flags, format,...)
char * scope_get_name(struct scope *scope)
#define WARNDUMPSCOPE_NL(s)
unsigned int isdeclaration
REFCNT lsymbol_free(struct lsymbol *lsymbol, int force)
#define SYMBOL_IS_TYPE(sym)
GSList * scope_match_syms(struct scope *scope, struct rfilter *symbol_filter, symbol_type_flag_t flags)
void scope_update_range(struct scope *scope, ADDR start, ADDR end, int *action)
int symdict_get_sizes(struct symdict *symdict, int *named, int *duplicated, int *anon)
void * calloc(size_t nmemb, size_t size)
void symdict_free(struct symdict *symdict, symdict_symbol_dtor_t ssd, void *priv)
struct scope * scope_create(struct symbol *symbol, SMOFFSET ref)
int symdict_get_size_named(struct symdict *symdict)
int scope_insert_scope(struct scope *parent, struct scope *child)
struct lsymbol * lsymbol_create(struct symbol *symbol, struct array_list *chain)
void lsymbol_append(struct lsymbol *lsymbol, struct symbol *symbol)
char * symbol_get_name(struct symbol *symbol)
#define RPUT(x, objtype, hx, rc)
void * malloc(size_t size)
unsigned int isinlineinstance
struct symbol * symdict_get_sym(struct symdict *symdict, const char *name, symbol_type_flag_t flags)
struct lsymbol * scope_lookup_sym(struct scope *scope, const char *name, const char *delim, symbol_type_flag_t flags)
int scope_insert_symbol(struct scope *scope, struct symbol *symbol)
int symdict_insert_symbol(struct symdict *symdict, struct symbol *symbol)