diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 27 | ||||
-rw-r--r-- | gdb/Makefile.in | 3 | ||||
-rw-r--r-- | gdb/buildsym.c | 10 | ||||
-rw-r--r-- | gdb/buildsym.h | 4 | ||||
-rw-r--r-- | gdb/objfiles.c | 8 | ||||
-rw-r--r-- | gdb/objfiles.h | 1 | ||||
-rw-r--r-- | gdb/solib-sunos.c | 2 | ||||
-rw-r--r-- | gdb/symfile.c | 3 | ||||
-rw-r--r-- | gdb/symmisc.c | 2 | ||||
-rw-r--r-- | gdb/symtab.h | 5 |
10 files changed, 63 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 01a0b3b..106373c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,30 @@ +2002-05-15 Jim Blandy <jimb@redhat.com> + + Add macro structures to GDB's symbol tables. Nobody puts anything + in them yet. + * symtab.h (struct symtab): New member: `macro_table'. + * buildsym.h (pending_macros): New global variable. + * buildsym.c: #include "macrotab.h". + (buildsym_init): Initialize `pending_macros'. + (end_symtab): If we found macro information while reading a CU's + debugging info, do build a symtab structure for it. Make the + symtab point to the macro information, and clear the + `pending_macros' pointer which held it while we were reading the + debug info. + (really_free_pendings): Free any pending macro table. + * objfiles.h (struct objfile): New member: `macro_cache'. + * objfiles.c (allocate_objfile): Set allocate and free functions + for the macro cache's objstack. + (free_objfile): Empty the macro cache's obstack. + * symfile.c (reread_symbols): Empty the macro cache's obstack, and + set new allocate and free functions for it. + * solib-sunos.c (allocate_rt_common_objfile): Set allocate and + free functions for the macro cache's objstack. (Why is this + function building its own objfile?) + * symmisc.c (print_objfile_statistics): Print statistics on the + macro bcache. + * Makefile.in: Note that buildsym.o depends on macrotab.h. + 2002-05-15 Richard Earnshaw <rearnsha@arm.com> * config/arm/nm-nbsd.h: Use <> for include of config/nm-nbsd.h. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 04cc0ce..e6d43ad 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1309,7 +1309,8 @@ breakpoint.o: breakpoint.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ buildsym.o: buildsym.c $(bfd_h) $(buildsym_h) $(complaints_h) $(defs_h) \ $(objfiles_h) $(symfile_h) $(symtab_h) $(gdb_string_h) \ $(obstack_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \ - $(language_h) $(bcache_h) $(filenames_h) $(stabsread_h) + $(language_h) $(bcache_h) $(filenames_h) $(stabsread_h) \ + $(macrotab_h) builtin-regs.o: builtin-regs.c $(defs.h) $(builtin_regs_h) $(gdbtypes_h) \ $(gdb_string_h) $(value_h) $(frame_h) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index d7e99c0..5078935 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -39,6 +39,7 @@ #include "language.h" /* For "local_hex_string" */ #include "bcache.h" #include "filenames.h" /* For DOSish file names */ +#include "macrotab.h" /* Ask buildsym.h to define the vars it normally declares `extern'. */ #define EXTERN /**/ @@ -192,6 +193,9 @@ really_free_pendings (PTR dummy) xfree ((void *) next); } global_symbols = NULL; + + if (pending_macros) + free_macro_table (pending_macros); } /* This function is called to discard any pending blocks. */ @@ -883,7 +887,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) if (pending_blocks == NULL && file_symbols == NULL && global_symbols == NULL - && have_line_numbers == 0) + && have_line_numbers == 0 + && pending_macros == NULL) { /* Ignore symtabs that have no functions with real debugging info. */ @@ -944,6 +949,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) /* Fill in its components. */ symtab->blockvector = blockvector; + symtab->macro_table = pending_macros; if (subfile->line_vector) { /* Reallocate the line table on the symbol obstack */ @@ -1022,6 +1028,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) last_source_file = NULL; current_subfile = NULL; + pending_macros = NULL; return symtab; } @@ -1112,6 +1119,7 @@ buildsym_init (void) file_symbols = NULL; global_symbols = NULL; pending_blocks = NULL; + pending_macros = NULL; } /* Initialize anything that needs initializing when a completely new diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 40a339d..d023aa3 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -296,6 +296,10 @@ extern void record_debugformat (char *format); extern void merge_symbol_lists (struct pending **srclist, struct pending **targetlist); +/* The macro table for the compilation unit whose symbols we're + currently reading. All the symtabs for this CU will point to this. */ +EXTERN struct macro_table *pending_macros; + #undef EXTERN #endif /* defined (BUILDSYM_H) */ diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e2a6f85..32bda87 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -190,6 +190,8 @@ allocate_objfile (bfd *abfd, int flags) /* Update pointers to functions to *our* copies */ obstack_chunkfun (&objfile->psymbol_cache.cache, xmmalloc); obstack_freefun (&objfile->psymbol_cache.cache, xmfree); + obstack_chunkfun (&objfile->macro_cache.cache, xmmalloc); + obstack_freefun (&objfile->macro_cache.cache, xmfree); obstack_chunkfun (&objfile->psymbol_obstack, xmmalloc); obstack_freefun (&objfile->psymbol_obstack, xmfree); obstack_chunkfun (&objfile->symbol_obstack, xmmalloc); @@ -220,6 +222,9 @@ allocate_objfile (bfd *abfd, int flags) obstack_specify_allocation_with_arg (&objfile->psymbol_cache.cache, 0, 0, xmmalloc, xmfree, objfile->md); + obstack_specify_allocation_with_arg (&objfile->macro_cache.cache, + 0, 0, xmmalloc, xmfree, + objfile->md); obstack_specify_allocation_with_arg (&objfile->psymbol_obstack, 0, 0, xmmalloc, xmfree, objfile->md); @@ -266,6 +271,8 @@ allocate_objfile (bfd *abfd, int flags) objfile->md = NULL; obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, @@ -477,6 +484,7 @@ free_objfile (struct objfile *objfile) xmfree (objfile->md, objfile->static_psymbols.list); /* Free the obstacks for non-reusable objfiles */ free_bcache (&objfile->psymbol_cache); + free_bcache (&objfile->macro_cache); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->type_obstack, 0); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 992ae71..ed4e6b7 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -277,6 +277,7 @@ struct objfile will not change. */ struct bcache psymbol_cache; /* Byte cache for partial syms */ + struct bcache macro_cache; /* Byte cache for macros */ /* Vectors of all partial symbols read in from file. The actual data is stored in the psymbol_obstack. */ diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index 0f81d05..374ec25 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -137,6 +137,8 @@ allocate_rt_common_objfile (void) objfile->md = NULL; obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, diff --git a/gdb/symfile.c b/gdb/symfile.c index 8303f3c..d087b1f 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1741,6 +1741,7 @@ reread_symbols (void) /* Free the obstacks for non-reusable objfiles */ free_bcache (&objfile->psymbol_cache); + free_bcache (&objfile->macro_cache); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->type_obstack, 0); @@ -1766,6 +1767,8 @@ reread_symbols (void) it is empty. */ obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0, xmalloc, xfree); + obstack_specify_allocation (&objfile->macro_cache.cache, 0, 0, + xmalloc, xfree); obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 2f1bb72..39b10a6 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -197,6 +197,8 @@ print_objfile_statistics (void) obstack_memory_used (&objfile->psymbol_obstack)); printf_filtered (" Total memory used for psymbol cache: %d\n", obstack_memory_used (&objfile->psymbol_cache.cache)); + printf_filtered (" Total memory used for macro cache: %d\n", + obstack_memory_used (&objfile->macro_cache.cache)); printf_filtered (" Total memory used for symbol obstack: %d\n", obstack_memory_used (&objfile->symbol_obstack)); printf_filtered (" Total memory used for type obstack: %d\n", diff --git a/gdb/symtab.h b/gdb/symtab.h index 231364e..bb22d0d 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -824,6 +824,11 @@ struct symtab int primary; + /* The macro table for this symtab. Like the blockvector, this + may be shared between different symtabs --- and normally is for + all the symtabs in a given compilation unit. */ + struct macro_table *macro_table; + /* Name of this source file. */ char *filename; |