diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 18 | ||||
-rw-r--r-- | gdb/dbxread.c | 31 | ||||
-rw-r--r-- | gdb/dwarfread.c | 102 | ||||
-rw-r--r-- | gdb/ieee-float.c | 2 | ||||
-rw-r--r-- | gdb/partial-stab.h | 16 | ||||
-rw-r--r-- | gdb/symmisc.c | 58 |
6 files changed, 100 insertions, 127 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 31eb0ff..01bd5e4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +Thu Dec 26 19:52:01 1991 Fred Fish (fnf at cygnus.com) + + * dbxread.c, symmisc.c: Move add_psymbol_to_plist() from + dbxread.c to symmisc and change name to add_psymbol_to_list. + Ditto for add_psymbol_addr_to_plist(). Also expand their + body to not use ADD_PSYMBOL_VT_TO_LIST. + + * dwarfread.c: Remove add_psymbol_to_list() and convert usages + to the ADD_PSYMBOL_TO_LIST macro. + + * ieee-float.c: Change "#ifdef DEBUG" to "#ifdef IEEE_DEBUG" + to avoid collision with the DEBUG for ADD_PSYMBOL_VT_TO_LIST. + + * partial-stab.h, symfile.h: Move definitions of the macros + ADD_PSYMBOL_TO_LIST and ADD_PSYMBOL_ADDR_TO_LIST from + partial-stab.h to symfile.h. They aren't stab specific. + Change ADD_PSYMBOL_VT_TO_LIST to use memcpy rather than strncpy. + Tue Dec 24 11:38:08 1991 John Gilmore (gnu at cygnus.com) * Makefile.in: Roll VERSION to 4.3.2. diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 482f12c..c80ff16 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -660,37 +660,6 @@ free_bincl_list () bincls_allocated = 0; } -#ifdef DEBUG -/* This is normally a macro defined in read_dbx_symtab, but this - is a lot easier to debug. */ - -void -add_psymbol_to_plist(name, namelength, namespace, class, plist, value) - char *name; - int namelength; - enum namespace namespace; - enum address_class class; - struct psymbol_allocation_list *plist; - unsigned long value; -{ - ADD_PSYMBOL_VT_TO_LIST(name, namelength, namespace, - class, *plist, value, SYMBOL_VALUE); -} - -void -add_psymbol_addr_to_plist(name, namelength, namespace, class, plist, value) - char *name; - int namelength; - enum namespace namespace; - enum address_class class; - struct psymbol_allocation_list *plist; - CORE_ADDR value; -{ - ADD_PSYMBOL_VT_TO_LIST(name, namelength, namespace, - class, *plist, value, SYMBOL_VALUE_ADDRESS); -} -#endif /* DEBUG */ - /* Given pointers to an a.out symbol table in core containing dbx style data, setup partial_symtab's describing each source file for which debugging information is available. NLISTLEN is the number diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index e0c286b..780e0c3 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -331,25 +331,6 @@ EXFUN(start_psymtab, (struct objfile *objfile AND CORE_ADDR addr static void EXFUN(add_partial_symbol, (struct dieinfo *dip)); -#ifdef DEBUG -static void -DEFUN(add_psymbol_to_list, - (listp, name, space, class, value), - struct psymbol_allocation_list *listp AND - char *name AND - enum namespace space AND - enum address_class class AND - CORE_ADDR value) -{ - ADD_PSYMBOL_VT_TO_LIST(name, strlen(name), space, class, - listp, value, SYMBOL_VALUE); -} -#else -#define add_psymbol_to_list(listp, name, space, class, value) \ - ADD_PSYMBOL_VT_TO_LIST(name, strlen(name), space, class, \ - *(listp), value, SYMBOL_VALUE) -#endif - static void EXFUN(init_psymbol_list, (int total_symbols)); @@ -2665,50 +2646,6 @@ DEFUN(start_psymtab, return result; } -#if 0 -/* - -LOCAL FUNCTION - - add_psymbol_to_list -- add a partial symbol to given list - -DESCRIPTION - - Add a partial symbol to one of the partial symbol vectors (pointed to - by listp). The vector is grown as necessary. - - */ - -static void -DEFUN(add_psymbol_to_list, - (listp, name, space, class, value), - struct psymbol_allocation_list *listp AND - char *name AND - enum namespace space AND - enum address_class class AND - CORE_ADDR value) -{ - struct partial_symbol *psym; - int newsize; - - if (listp -> next >= listp -> list + listp -> size) - { - newsize = listp -> size * 2; - listp -> list = (struct partial_symbol *) - xrealloc (listp -> list, (newsize * sizeof (struct partial_symbol))); - /* Next assumes we only went one over. Should be good if program works - correctly */ - listp -> next = listp -> list + listp -> size; - listp -> size = newsize; - } - psym = listp -> next++; - SYMBOL_NAME (psym) = create_name (name, psymbol_obstack); - SYMBOL_NAMESPACE (psym) = space; - SYMBOL_CLASS (psym) = class; - SYMBOL_VALUE (psym) = value; -} -#endif - /* LOCAL FUNCTION @@ -2747,8 +2684,8 @@ DEFUN(add_enum_psymbol, (dip), struct dieinfo *dip) while (scan < listend) { scan += sizeof (long); - add_psymbol_to_list (&static_psymbols, scan, VAR_NAMESPACE, - LOC_CONST, 0); + ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST, + static_psymbols, 0); scan += strlen (scan) + 1; } } @@ -2775,37 +2712,44 @@ DEFUN(add_partial_symbol, (dip), struct dieinfo *dip) { case TAG_global_subroutine: record_misc_function (dip -> at_name, dip -> at_low_pc, mf_text); - add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE, - LOC_BLOCK, dip -> at_low_pc); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + VAR_NAMESPACE, LOC_BLOCK, global_psymbols, + dip -> at_low_pc); break; case TAG_global_variable: record_misc_function (dip -> at_name, locval (dip -> at_location), mf_data); - add_psymbol_to_list (&global_psymbols, dip -> at_name, VAR_NAMESPACE, - LOC_STATIC, 0); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + VAR_NAMESPACE, LOC_STATIC, global_psymbols, + 0); break; case TAG_subroutine: - add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE, - LOC_BLOCK, dip -> at_low_pc); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + VAR_NAMESPACE, LOC_BLOCK, static_psymbols, + dip -> at_low_pc); break; case TAG_local_variable: - add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE, - LOC_STATIC, 0); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + VAR_NAMESPACE, LOC_STATIC, static_psymbols, + 0); break; case TAG_typedef: - add_psymbol_to_list (&static_psymbols, dip -> at_name, VAR_NAMESPACE, - LOC_TYPEDEF, 0); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + VAR_NAMESPACE, LOC_TYPEDEF, static_psymbols, + 0); break; case TAG_structure_type: case TAG_union_type: - add_psymbol_to_list (&static_psymbols, dip -> at_name, STRUCT_NAMESPACE, - LOC_TYPEDEF, 0); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + STRUCT_NAMESPACE, LOC_TYPEDEF, static_psymbols, + 0); break; case TAG_enumeration_type: if (dip -> at_name) { - add_psymbol_to_list (&static_psymbols, dip -> at_name, - STRUCT_NAMESPACE, LOC_TYPEDEF, 0); + ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name), + STRUCT_NAMESPACE, LOC_TYPEDEF, static_psymbols, + 0); } add_enum_psymbol (dip); break; diff --git a/gdb/ieee-float.c b/gdb/ieee-float.c index f1e503b2..9ab3d48 100644 --- a/gdb/ieee-float.c +++ b/gdb/ieee-float.c @@ -123,7 +123,7 @@ double_to_ieee_extended (ext_format, from, to) } -#ifdef DEBUG +#ifdef IEEE_DEBUG /* Test some numbers to see that extended/double conversion works for them. */ diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index d901795..d4b3dea 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -23,22 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ CUR_SYMBOL_VALUE --Value field of current symbol. May be adjusted here. */ -#ifdef DEBUG -/* Since one arg is a struct, we have to pass in a ptr and deref it (sigh) */ -#define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \ - add_psymbol_to_plist(NAME, NAMELENGTH, NAMESPACE, CLASS, &LIST, VALUE) -#define ADD_PSYMBOL_ADDR_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \ - add_psymbol_to_plist(NAME, NAMELENGTH, NAMESPACE, CLASS, &LIST, VALUE) -#else -/* Add a symbol with an integer value to a psymtab. */ -#define ADD_PSYMBOL_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE) \ - ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, SYMBOL_VALUE) - -/* Add a symbol with a CORE_ADDR value to a psymtab. */ -#define ADD_PSYMBOL_ADDR_TO_LIST(NAME,NAMELENGTH, NAMESPACE,CLASS, LIST,VALUE)\ - ADD_PSYMBOL_VT_TO_LIST(NAME, NAMELENGTH, NAMESPACE, CLASS, LIST, VALUE, SYMBOL_VALUE_ADDRESS) -#endif - /* End of macro definitions, now let's handle them symbols! */ switch (CUR_SYMBOL_TYPE) diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 507ec18..3c1df3e 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -567,6 +567,64 @@ extend_psymbol_list(listp) listp->size = new_size; } +#ifdef DEBUG + +/* The work performed by this function is normally done by the macro + ADD_PSYMBOL_TO_LIST defined in symfile.h. When debugging gdb, this + function makes things easier. */ + +void +add_psymbol_to_list (name, namelength, namespace, class, listp, psymval) + char *name; + int namelength; + enum namespace namespace; + enum address_class class; + struct psymbol_allocation_list *listp; + unsigned long psymval; +{ + register struct partial_symbol *psym; + + if (listp -> next >= listp -> list + listp -> size) + extend_psymbol_list (listp); + psym = listp -> next++; + SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack, + namelength + 1); + memcpy (SYMBOL_NAME (psym), name, namelength); + SYMBOL_NAME (psym)[namelength] = '\0'; + SYMBOL_NAMESPACE (psym) = namespace; + SYMBOL_CLASS (psym) = class; + SYMBOL_VALUE (psym) = psymval; +} + +/* The work performed by this function is normally done by the macro + ADD_PSYMBOL_ADDR_TO_LIST defined in symfile.h. When debugging gdb, this + function makes things easier. */ + +void +add_psymbol_addr_to_list (name, namelength, namespace, class, listp, psymval) + char *name; + int namelength; + enum namespace namespace; + enum address_class class; + struct psymbol_allocation_list *listp; + CORE_ADDR psymval; +{ + register struct partial_symbol *psym; + + if (listp -> next >= listp -> list + listp -> size) + extend_psymbol_list (listp); + psym = listp -> next++; + SYMBOL_NAME (psym) = (char *) obstack_alloc (psymbol_obstack, + namelength + 1); + memcpy (SYMBOL_NAME (psym), name, namelength); + SYMBOL_NAME (psym)[namelength] = '\0'; + SYMBOL_NAMESPACE (psym) = namespace; + SYMBOL_CLASS (psym) = class; + SYMBOL_VALUE_ADDRESS (psym) = psymval; +} + +#endif /* DEBUG */ + void _initialize_symmisc () { |