Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scope.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, 2012, 2013 The University of Utah
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include <stdlib.h>
20 #include <errno.h>
21 #include <glib.h>
22 
23 #include "config.h"
24 #include "common.h"
25 #include "log.h"
26 #include "list.h"
27 #include "alist.h"
28 
29 #include "dwdebug_priv.h"
30 #include "dwdebug.h"
31 
32 #include "glib_wrapper.h"
33 
38  struct scope *retval;
39 
40  retval = (struct scope *)calloc(1,sizeof(*retval));
41  if (!retval)
42  return NULL;
43 
44  retval->symbol = symbol;
45  retval->ref = ref;
46 
47  return retval;
48 }
49 
50 char *scope_get_name(struct scope *scope) {
51  if (scope->symbol)
52  return symbol_get_name(scope->symbol);
53  else
54  return NULL;
55 }
56 
58  int rc;
59 
60  if (!scope->symdict)
61  scope->symdict = symdict_create();
62 
63  rc = symdict_insert_symbol(scope->symdict,symbol);
64  if (rc)
65  return rc;
66 
67  symbol->scope = scope;
68  RHOLD(symbol,scope);
69 
70  return 0;
71 }
72 
73 int scope_hold_symbol(struct scope *scope,struct symbol *symbol) {
74  int rc;
75 
76  if (!scope->symdict)
77  scope->symdict = symdict_create();
78 
79  rc = symdict_insert_symbol(scope->symdict,symbol);
80  if (rc)
81  return rc;
82 
83  RHOLD(symbol,scope);
84 
85  return 0;
86 }
87 
88 int scope_insert_scope(struct scope *parent,struct scope *child) {
89  if (parent->subscopes && g_slist_find(parent->subscopes,child))
90  return -1;
91 
92  /*
93  * If this is a type scope inside a non-type scope, don't add it as
94  * a subscope! Scope hierarchies should be pure -- only types
95  * should have searchabl
96  */
97  /*
98  if (child->symbol && SYMBOL_IS_TYPE(child->symbol))
99  return -1;
100  */
101 
102  parent->subscopes = g_slist_append(parent->subscopes,child);
103 
104  child->parent = parent;
105  RHOLD(child,parent);
106 
107  return 0;
108 }
109 
110 int scope_remove_scope(struct scope *parent,struct scope *child) {
111  REFCNT trefcnt;
112 
113  if (!parent->subscopes)
114  return -1;
115  if (child->parent != parent)
116  return -1;
117 
118  parent->subscopes = g_slist_remove(parent->subscopes,child);
119 
120  /*
121  * NB: since the same symbol can be on more than one scope, only
122  * undo the parent link if the parent is the one removing this
123  * symbol.
124  */
125  if (child->parent == parent)
126  child->parent = NULL;
127  RPUT(child,scope,parent,trefcnt);
128 
129  return 0;
130 }
131 
133  int rc;
134  REFCNT trefcnt;
135  struct scope *symbol_scope;
136 
137  /*
138  * NB: if we delete a symbol that we had placed into our scope, and
139  * if that symbol owned a scope, remove that scope from our
140  * hierarchy!
141  */
142  symbol_scope = symbol_read_owned_scope(symbol);
143  if (symbol_scope)
144  scope_remove_scope(scope,symbol_scope);
145 
146  if (!scope->symdict)
147  return -1;
148 
149  rc = symdict_remove_symbol(scope->symdict,symbol);
150  if (rc)
151  return rc;
152 
153  /*
154  * NB: since the same symbol can be on more than one scope, only
155  * undo the parent link if the parent is the one removing this
156  * symbol.
157  */
158  if (symbol->scope == scope)
159  symbol->scope = NULL;
160 
161  RPUT(symbol,symbol,scope,trefcnt);
162 
163  return 0;
164 }
165 
166 void scope_update_range(struct scope *scope,ADDR start,ADDR end,int *action) {
167  struct range *r, *lastr, *newr;
168 
169  /*
170  * We maintain scope->range as a sorted list by start.
171  *
172  * So we look for any items that have @start, and update end if
173  * necessary; else we insert a new range at the right place.
174  */
175  if (!scope->range) {
176  scope->range = (struct range *)calloc(1,sizeof(*scope->range));
177  scope->range->start = start;
178  scope->range->end = end;
179  scope->range->next = NULL;
180 
181  if (action)
182  *action = 1;
183 
185  "init scope RANGE(0x%"PRIxADDR",0x%"PRIxADDR")\n",
186  start,end);
187 
188  return;
189  }
190  else {
191  lastr = NULL;
192  r = scope->range;
193  while (r) {
194  if (r->start == start) {
195  if (r->end != end) {
196  vwarn("inconsistent scope range(0x%"PRIxADDR",0x%"PRIxADDR")"
197  " (new end 0x%"PRIxADDR"); updating!\n",
198  start,r->end,end);
199 
200  r->end = end;
201 
202  if (action)
203  *action = 2;
204 
205  return;
206  }
207  else {
209  "scope range(0x%"PRIxADDR",0x%"PRIxADDR") matched;"
210  " not updating\n",
211  start,end);
212 
213  if (action)
214  *action = 0;
215 
216  return;
217  }
218  }
219  else if (r->start > start) {
220  /* Insert a new one between lastr and r */
221  newr = (struct range *)calloc(1,sizeof(*newr));
222  newr->start = start;
223  newr->end = end;
224  newr->next = r;
225  if (lastr)
226  lastr->next = newr;
227  else
228  scope->range = newr;
229 
230  if (action)
231  *action = 1;
232 
234  "added scope range (0x%"PRIxADDR",0x%"PRIxADDR")\n",
235  start,end);
236 
237  return;
238  }
239  else {
240  lastr = r;
241  r = r->next;
242  }
243  }
244 
245  /* If we get here, we need to add one at the tail. */
246  newr = (struct range *)calloc(1,sizeof(*newr));
247  newr->start = start;
248  newr->end = end;
249  newr->next = NULL;
250  lastr->next = newr;
251 
252  if (action)
253  *action = 1;
254 
256  "added scope range (0x%"PRIxADDR",0x%"PRIxADDR")\n",
257  start,end);
258 
259  return;
260  }
261 }
262 
263 int scope_get_sizes(struct scope *scope,int *named,int *duplicated,int *anon,
264  int *numscopes) {
265  int rc = 0;
266 
267  if (scope->symdict)
268  rc = symdict_get_sizes(scope->symdict,named,duplicated,anon);
269  else {
270  if (named)
271  *named = 0;
272  if (duplicated)
273  *duplicated = 0;
274  if (anon)
275  *anon = 0;
276  }
277 
278  if (scope->subscopes) {
279  if (numscopes)
280  *numscopes = g_slist_length(scope->subscopes);
281  }
282  else {
283  if (numscopes)
284  *numscopes = 0;
285  }
286 
287  return rc;
288 }
289 
290 int scope_get_overall_range(struct scope *scope,ADDR *low_addr_saveptr,
291  ADDR *high_addr_saveptr,int *is_noncontiguous) {
292  ADDR lowaddr = ADDRMAX;
293  ADDR highaddr = 0;
294  unsigned int len = 0;
295  struct range *range;
296 
297  /*
298  * We keep an ordered range list, so this is easy. But just in case
299  * there is a bug in the sort, and because we have to traverse the
300  * whole list anyway, check it all.
301  */
302  range = scope->range;
303  if (range) {
304  while (range) {
305  if (range->start < lowaddr)
306  lowaddr = range->start;
307 
308  if (range->end > highaddr)
309  highaddr = range->end;
310 
311  len += range->end - range->start;
312  range = range->next;
313  }
314 
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;
321 
322  return 0;
323  }
324  else {
325  errno = EINVAL;
326  return -1;
327  }
328 }
329 
330 /*
331  * Since we held on symbols inserted into this scope, we now must RPUT
332  * them. BUT -- if we RPUT and it is not freed, we must clear the
333  * symbol->scope field, because scope is being destroyed. This function
334  * must only be called from scope_free().
335  */
336 static void scope_symdict_symbol_dtor(struct symbol *symbol,void *priv) {
337  struct scope *scope = (struct scope *)priv;
338  REFCNT trefcnt;
339  RPUT(symbol,symbol,symbol->scope,trefcnt);
340  if (trefcnt > 0) {
341  /*
342  * NB: since the same symbol can be on more than one scope, only
343  * undo the parent link if the parent is the one removing this
344  * symbol.
345  */
346  if (symbol->scope == scope)
347  symbol->scope = NULL;
348  }
349  return;
350 }
351 
352 REFCNT scope_free(struct scope *scope,int force) {
353  REFCNT retval = scope->refcnt;
354  struct scope *tmp;
355  struct range *range, *lastrange;
356  REFCNT trefcnt;
357  GSList *gsltmp;
358 
359  if (retval) {
360  if (!force) {
361  verror("cannot free (%d refs) ",retval);
362  ERRORDUMPSCOPE_NL(scope);
363  return retval;
364  }
365  else {
366  vwarn("forced free (%d refs) ",retval);
367  WARNDUMPSCOPE_NL(scope);
368  }
369  }
370 
371  vdebug(5,LA_DEBUG,LF_SCOPE,"freeing ");
373 
374  /*
375  * RPUT on all our subscopes. If the subscope was not associated
376  * with a symbol, this will free that scope, because we'll be the
377  * only ones holding it. If it is associated with a symbol, it
378  * won't be freed until that symbol is, when we RPUT on the
379  * symdict.
380  *
381  * One thing we need to do, though, is unset symbol->scope when we
382  * release symbols from our dict! This means that if the symbol is
383  * not freed when we RPUT it, we have to unset symbol->scope. Careful.
384  */
385  if (scope->subscopes) {
386  v_g_slist_foreach(scope->subscopes,gsltmp,tmp) {
387  RPUT(tmp,scope,scope,trefcnt);
388  }
389  g_slist_free(scope->subscopes);
390  scope->subscopes = NULL;
391  }
392 
393  range = scope->range;
394  while (range) {
395  lastrange = range;
396  range = range->next;
397  free(lastrange);
398  }
399  scope->range = NULL;
400 
401  if (scope->symdict)
402  symdict_free(scope->symdict,scope_symdict_symbol_dtor,scope);
403 
404  free(scope);
405 
406  return retval;
407 }
408 
409 void scope_dump(struct scope *scope,struct dump_info *ud) {
410  struct scope *cscope;
411  GSList *gsltmp;
412  int i;
413  struct range *range;
414  char *p = "";
415  char *np;
416  char *np2;
417  struct dump_info udn;
418  struct dump_info udn2;
419 
420  if (ud->prefix) {
421  p = ud->prefix;
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," ");
426  }
427  else {
428  np = " ";
429  np2 = " ";
430  }
431  udn.prefix = np;
432  udn.stream = ud->stream;
433  udn.meta = ud->meta;
434  udn.detail = ud->detail;
435  udn2.prefix = np2;
436  udn2.stream = ud->stream;
437  udn2.meta = ud->meta;
438  udn2.detail = ud->detail;
439 
440  if (scope->symbol) {
441  if (scope->symbol->isinlineinstance)
442  fprintf(ud->stream,
443  "%sscope(INLINED(%s) @@ 0x%"PRIxADDR")",
444  p,symbol_get_name_inline(scope->symbol),
445  symbol_get_addr(scope->symbol));
446  else if (symbol_has_addr(scope->symbol))
447  fprintf(ud->stream,"%sscope(%s @@ 0x%"PRIxADDR")",
448  p,symbol_get_name(scope->symbol),
449  symbol_get_addr(scope->symbol));
450  else
451  fprintf(ud->stream,"%sscope(%s)",
452  p,symbol_get_name(scope->symbol));
453  }
454  else
455  fprintf(ud->stream,"%sscope()",p);
456 
457  if (scope->range)
458  fprintf(ud->stream," RANGES(");
459  i = 0;
460  range = scope->range;
461  while (range) {
462  if (i > 0)
463  fprintf(ud->stream,",");
464 
465  fprintf(ud->stream,"[0x%"PRIxADDR",0x%"PRIxADDR"]",
466  range->start,range->end);
467  range = range->next;
468  }
469  if (scope->range)
470  fprintf(ud->stream,")");
471 
472  if (ud->detail) {
473  int didnl = 0;
474  fprintf(ud->stream," {");
475  if (scope->symdict && symdict_get_size_named(scope->symdict)) {
476  didnl = 1;
477  fprintf(ud->stream,"\n%s symbols: {\n",p);
478  symdict_dump(scope->symdict,&udn2);
479  fprintf(ud->stream,"%s }\n",p);
480  }
481  if (scope->subscopes) {
482  if (!didnl)
483  fprintf(ud->stream,"\n");
484  fprintf(ud->stream,"%s subscopes: {\n",p);
485  v_g_slist_foreach(scope->subscopes,gsltmp,cscope) {
486  scope_dump(cscope,&udn2);
487  }
488  fprintf(ud->stream,"%s }\n",p);
489  }
490  if (didnl)
491  fprintf(ud->stream,"%s}\n",p);
492  else
493  fprintf(ud->stream," }\n");
494  }
495  else
496  fprintf(ud->stream," { }");
497 
498  if (ud->prefix) {
499  free(np);
500  free(np2);
501  }
502 }
503 
504 int scope_contains_addr(struct scope *scope,ADDR addr) {
505  struct range *range;
506  int found = 0;
507 
508  /*
509  * Check to see if the addr is in our scope; if not, return NULL
510  * without searching subtabs.
511  */
512  range = scope->range;
513  while (range) {
514  if (addr >= range->start && addr < range->end) {
515  found = 1;
516  break;
517  }
518  range = range->next;
519  }
520 
521  return found;
522 }
523 
524 /*
525  * NOTE: this function returns the tightest bounding scope -- which may
526  * be the scope that was passed in!!
527  */
528 struct scope *scope_lookup_addr(struct scope *scope,ADDR addr) {
529  struct range *range;
530  struct scope *retval = NULL;
531  struct scope *tmp;
532  GSList *gsltmp;
533 
534  /*
535  * Check to see if the addr is in our scope; if not, return NULL
536  * without searching subtabs.
537  */
538  range = scope->range;
539  while (range) {
540  if (addr >= range->start && addr < range->end) {
541  retval = scope;
542  break;
543  }
544  range = range->next;
545  }
546 
547  if (!retval)
548  return NULL;
549 
550  /*
551  * It is tempting to think we can just check the start and
552  * end vals for this scope before checking its children, but
553  * we can't do that. Some scopes may have children whose
554  * ranges are outside the parent -- i.e., a function defined in
555  * another. So we can't even check the parent ranges before doing
556  * DFS!
557  *
558  * In other words, we need the tightest bound.
559  */
560  v_g_slist_foreach(scope->subscopes,gsltmp,tmp) {
561  retval = scope_lookup_addr(tmp,addr);
562  if (retval)
563  return retval;
564  }
565 
566  /*
567  * If we didn't find a deeper tab containing the addr, return
568  * ourself.
569  */
570  return scope;
571 }
572 
573 struct lsymbol *scope_lookup_sym__int(struct scope *scope,
574  const char *name,const char *delim,
575  symbol_type_flag_t flags) {
576  char *next = NULL;
577  char *lname = NULL;
578  char *saveptr = NULL;
579  struct array_list *anonchain = NULL;
580  int i;
581  struct lsymbol *lsymbol = NULL;
582  struct lsymbol *lsymbol_tmp = NULL;
583  struct symbol *symbol = NULL;
584  struct array_list *chain = NULL;
585  struct scope *subscope;
586  GSList *gsltmp;
587 
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);
592  }
593  else
594  next = (char *)name;
595 
596  /*
597  * Do the first token by looking up in this scope's symdict.
598  */
599  if (scope->symdict)
600  symbol = symdict_get_sym(scope->symdict,next,flags);
601 
602  if (symbol) {
603  if (SYMBOL_IS_TYPE(symbol))
605  "found top-level symtab type %s\n",symbol->name);
606  else if (!symbol->isdeclaration)
608  "found top-level symtab definition %s\n",symbol->name);
609  else
611  "found top-level symtab non-type, non-definition %s; saving\n",
612  symbol->name);
613  }
614 
615  /*
616  * If we didn't find a match in our symdict, OR if the symbol was
617  * a non-type declaration, keep looking for a type or definition in our
618  * subtabs.
619  */
620  if ((!symbol || (symbol && !SYMBOL_IS_TYPE(symbol)
621  && symbol->isdeclaration))) {
623  "checking scope subscopes\n");
624  v_g_slist_foreach(scope->subscopes,gsltmp,subscope) {
625  /*
626  * We only search anonymous subtabs, because if the user is
627  * looking for something nested, we need them to actually
628  * specify a fully-qualified string.
629  *
630  * We could relax this constraint later on, but only if they
631  * give us a flag, because otherwise if you look for `i',
632  * your result will have very little meaning.
633  *
634  * XXX: what about inlined instances of variables or
635  * functions? How can we let users search for these?
636  */
637  if (!subscope->symbol) {
638  lsymbol_tmp = scope_lookup_sym__int(subscope,name,delim,flags);
639  if (lsymbol_tmp) {
640  if (SYMBOL_IS_TYPE(lsymbol_tmp->symbol)) {
641  lsymbol = lsymbol_tmp;
643  "found anon symtab type %s\n",
644  lsymbol->symbol->name);
645  goto recout;
646  }
647  else if (!lsymbol_tmp->symbol->isdeclaration) {
648  //SYMBOL_IS_FULL(lsymbol_tmp->symbol)
649  // && lsymbol_tmp->symbol->s.ii->l.loctype
650  // != LOCTYPE_UNKNOWN) {
651  lsymbol = lsymbol_tmp;
653  "found anon symtab definition %s\n",
654  lsymbol->symbol->name);
655  goto recout;
656  }
657  else if (!lsymbol) {
658  lsymbol = lsymbol_tmp;
660  "found anon symtab non-type, non-definition %s; saving\n",
661  lsymbol->symbol->name);
662  }
663  else {
664  /* Don't force free; somebody else might be
665  * holding a ref!
666  */
667  lsymbol_free(lsymbol_tmp,0);
668  }
669  }
670  }
671  }
672 
673  recout:
674  if (lsymbol) {
675  if (lname) {
676  free(lname);
677  lname = NULL;
678  }
679  if (chain) {
680  array_list_free(chain);
681  chain = NULL;
682  }
683 
685  "returning best subtab symbol %s\n",
686  lsymbol->symbol->name);
687 
688  return lsymbol;
689  }
690  }
691 
692  if (!symbol)
693  goto errout;
694 
695  lsymbol = lsymbol_create(symbol,chain);
696 
697  /* If it's not a delimited string, stop now, successfully. */
698  if (!lname) {
699  vdebug(3,LA_DEBUG,LF_DLOOKUP,"found plain %s\n",
700  lsymbol->symbol->name);
701 
702  /* Make sure the chain is not NULL and that we take a ref to
703  * symbol.
704  */
705  lsymbol_append(lsymbol,symbol);
706 
707  return lsymbol;
708  }
709 
711  "found top-level %s; checking members\n",lsymbol->symbol->name);
712 
713  /* Otherwise, add the first one to our chain and start looking up
714  * members.
715  */
716  lsymbol_append(lsymbol,symbol);
717 
718  if (!delim)
719  delim = DWDEBUG_DEF_DELIM;
720 
721  while ((next = strtok_r(!saveptr ? lname : NULL,delim,&saveptr))) {
722  if (!(symbol = __symbol_get_one_member__int(symbol,next,&anonchain)))
723  goto errout;
724  else if (anonchain && array_list_len(anonchain)) {
725  /* If anonchain has any members, we now have to glue those
726  * members into our overall chain, BEFORE gluing the actual
727  * found symbol onto the tail end of the chain.
728  */
729  for (i = 0; i < array_list_len(anonchain); ++i) {
730  lsymbol_append(lsymbol,
731  (struct symbol *)array_list_item(anonchain,i));
732  }
733  /* free the anonchain (and its members!) and reset our pointer */
734  array_list_free(anonchain);
735  anonchain = NULL;
736  }
737  /* now slap the retval on, too! */
738  lsymbol_append(lsymbol,symbol);
739  }
740 
741  free(lname);
742 
743  /* downsize */
744  array_list_compact(chain);
745 
746  return lsymbol;
747 
748  errout:
749  if (lname)
750  free(lname);
751  if (lsymbol)
752  /* Don't force free; somebody else might have a ref! */
753  lsymbol_free(lsymbol,0);
754 
755  return NULL;
756 }
757 
758 struct lsymbol *scope_lookup_sym(struct scope *scope,
759  const char *name,const char *delim,
760  symbol_type_flag_t flags) {
761  struct lsymbol *ls = scope_lookup_sym__int(scope,name,delim,flags);
762 
763  /* __scope_lookup_sym already held refs to all the symbols on our
764  * chain.
765  */
766  if (ls)
767  RHOLD(ls,ls);
768 
769  return ls;
770 }
771 struct symbol *scope_get_sym(struct scope *scope,const char *name,
772  symbol_type_flag_t flags) {
773  struct symbol *symbol = NULL;
774  struct scope *subscope;
775  GSList *gsltmp;
776 
777  /*
778  * Lookup in this scope first.
779  */
780  if (scope->symdict) {
781  symbol = symdict_get_sym(scope->symdict,name,flags);
782  if (symbol)
783  return symbol;
784  }
785 
786  /*
787  * If we didn't find a match in our symtab, keep looking in our subtabs.
788  */
789  v_g_slist_foreach(scope->subscopes,gsltmp,subscope) {
790  /*
791  * We only search anonymous subscopes, because if the user is
792  * looking for something nested, we need them to actually
793  * specify a fully-qualified string.
794  *
795  * We could relax this constraint later on, but only if they
796  * give us a flag, because otherwise if you look for `i',
797  * your result will have very little meaning.
798  *
799  * XXX: what about inlined instances of variables or
800  * functions? How can we let users search for these?
801  */
802  if (!subscope->symbol) {
803  if ((symbol = scope_get_sym(subscope,name,flags)))
804  return symbol;
805  }
806  }
807 
808  return NULL;
809 }
810 
811 GSList *scope_match_syms(struct scope *scope,
812  struct rfilter *symbol_filter,
813  symbol_type_flag_t flags) {
814  if (!scope->symdict)
815  return NULL;
816 
817  return symdict_match_syms(scope->symdict,symbol_filter,flags);
818 }
char * symbol_get_name_inline(struct symbol *symbol)
Definition: debug.c:2600
struct symdict * symdict_create(void)
Definition: symdict.c:35
#define LOGDUMPSCOPE_NL(dl, lt, lf, s)
Definition: dwdebug_priv.h:68
void scope_dump(struct scope *scope, struct dump_info *ud)
Definition: scope.c:409
ADDR end
Definition: dwdebug_priv.h:438
struct symbol * symbol
Definition: dwdebug.h:1010
Definition: probe.h:392
struct scope * symbol_read_owned_scope(struct symbol *symbol)
Definition: debug.c:2674
void symdict_dump(struct symdict *symdict, struct dump_info *ud)
Definition: symdict.c:317
void * p
static uint64_t unsigned int i
GSList * symdict_match_syms(struct symdict *symdict, struct rfilter *symbol_filter, symbol_type_flag_t flags)
Definition: symdict.c:481
int scope_remove_scope(struct scope *parent, struct scope *child)
Definition: scope.c:110
struct symdict * symdict
Definition: dwdebug_priv.h:466
int scope_hold_symbol(struct scope *scope, struct symbol *symbol)
Definition: scope.c:73
#define v_g_slist_foreach(gslhead, gslcur, elm)
Definition: glib_wrapper.h:60
struct symbol * __symbol_get_one_member__int(struct symbol *symbol, char *member, struct array_list **chainptr)
Definition: debug.c:3815
int scope_get_sizes(struct scope *scope, int *named, int *duplicated, int *anon, int *numscopes)
Definition: scope.c:263
int32_t SMOFFSET
Definition: common.h:100
ADDR symbol_get_addr(struct symbol *symbol)
Definition: debug.c:3096
#define ERRORDUMPSCOPE_NL(s)
Definition: dwdebug_priv.h:80
ADDR start
Definition: dwdebug_priv.h:437
REFCNT scope_free(struct scope *scope, int force)
Definition: scope.c:352
#define verror(format,...)
Definition: log.h:30
struct lsymbol * scope_lookup_sym__int(struct scope *scope, const char *name, const char *delim, symbol_type_flag_t flags)
Definition: scope.c:573
int scope_remove_symbol(struct scope *scope, struct symbol *symbol)
Definition: scope.c:132
#define vwarn(format,...)
Definition: log.h:33
int scope_get_overall_range(struct scope *scope, ADDR *low_addr_saveptr, ADDR *high_addr_saveptr, int *is_noncontiguous)
Definition: scope.c:290
#define ADDRMAX
Definition: common.h:74
void free(void *ptr)
Definition: debugserver.c:207
struct range * range
Definition: dwdebug_priv.h:471
Definition: log.h:69
struct scope * scope_lookup_addr(struct scope *scope, ADDR addr)
Definition: scope.c:528
char * prefix
Definition: output.h:25
int symbol_has_addr(struct symbol *symbol)
Definition: debug.c:3047
int symdict_remove_symbol(struct symdict *symdict, struct symbol *symbol)
Definition: symdict.c:223
struct range * next
Definition: dwdebug_priv.h:439
struct symbol * scope_get_sym(struct scope *scope, const char *name, symbol_type_flag_t flags)
Definition: scope.c:771
REFCNT refcnt
Definition: dwdebug_priv.h:455
int scope_contains_addr(struct scope *scope, ADDR addr)
Definition: scope.c:504
char * name
Definition: dwdebug_priv.h:788
SMOFFSET ref
Definition: dwdebug_priv.h:460
#define DWDEBUG_DEF_DELIM
Definition: dwdebug.h:50
int len
Definition: dumptarget.c:52
#define RHOLD(x, hx)
Definition: common.h:622
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
char * scope_get_name(struct scope *scope)
Definition: scope.c:50
#define WARNDUMPSCOPE_NL(s)
Definition: dwdebug_priv.h:92
struct scope * parent
Definition: dwdebug_priv.h:476
FILE * stream
Definition: output.h:26
unsigned int isdeclaration
Definition: dwdebug_priv.h:839
REFCNT lsymbol_free(struct lsymbol *lsymbol, int force)
Definition: debug.c:4811
#define SYMBOL_IS_TYPE(sym)
GSList * scope_match_syms(struct scope *scope, struct rfilter *symbol_filter, symbol_type_flag_t flags)
Definition: scope.c:811
void scope_update_range(struct scope *scope, ADDR start, ADDR end, int *action)
Definition: scope.c:166
int symdict_get_sizes(struct symdict *symdict, int *named, int *duplicated, int *anon)
Definition: symdict.c:108
void * calloc(size_t nmemb, size_t size)
Definition: debugserver.c:200
Definition: log.h:129
void symdict_free(struct symdict *symdict, symdict_symbol_dtor_t ssd, void *priv)
Definition: symdict.c:271
struct scope * scope_create(struct symbol *symbol, SMOFFSET ref)
Definition: scope.c:37
Definition: log.h:126
struct scope * scope
Definition: dwdebug_priv.h:806
uint32_t ADDR
Definition: common.h:64
int symdict_get_size_named(struct symdict *symdict)
Definition: symdict.c:89
int scope_insert_scope(struct scope *parent, struct scope *child)
Definition: scope.c:88
struct lsymbol * lsymbol_create(struct symbol *symbol, struct array_list *chain)
Definition: debug.c:4595
GSList * subscopes
Definition: dwdebug_priv.h:484
uint32_t REFCNT
Definition: common.h:124
#define PRIxADDR
Definition: common.h:67
int detail
Definition: output.h:28
void lsymbol_append(struct lsymbol *lsymbol, struct symbol *symbol)
Definition: debug.c:4610
char * symbol_get_name(struct symbol *symbol)
Definition: debug.c:2587
#define RPUT(x, objtype, hx, rc)
Definition: common.h:624
void * malloc(size_t size)
Definition: debugserver.c:214
symbol_type_flag_t
Definition: dwdebug.h:190
unsigned int isinlineinstance
Definition: dwdebug_priv.h:839
int meta
Definition: output.h:27
struct symbol * symdict_get_sym(struct symdict *symdict, const char *name, symbol_type_flag_t flags)
Definition: symdict.c:348
struct lsymbol * scope_lookup_sym(struct scope *scope, const char *name, const char *delim, symbol_type_flag_t flags)
Definition: scope.c:758
int scope_insert_symbol(struct scope *scope, struct symbol *symbol)
Definition: scope.c:57
int symdict_insert_symbol(struct symdict *symdict, struct symbol *symbol)
Definition: symdict.c:141
struct symbol * symbol
Definition: dwdebug_priv.h:463