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 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.
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)
#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
/**/
xfree ((void *) next);
}
global_symbols = NULL;
+
+ if (pending_macros)
+ free_macro_table (pending_macros);
}
/* This function is called to discard any pending blocks. */
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. */
/* Fill in its components. */
symtab->blockvector = blockvector;
+ symtab->macro_table = pending_macros;
if (subfile->line_vector)
{
/* Reallocate the line table on the symbol obstack */
last_source_file = NULL;
current_subfile = NULL;
+ pending_macros = NULL;
return symtab;
}
file_symbols = NULL;
global_symbols = NULL;
pending_blocks = NULL;
+ pending_macros = NULL;
}
/* Initialize anything that needs initializing when a completely new
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) */
/* 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);
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);
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,
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);
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. */
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,
/* 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);
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,
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",
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;