* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype. * dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ and STREQN defined in defs.h. * dwarfread.c (set_cu_language): For completely unknown languages, try to deduce the language from the filename. Retain behavior that for known languages we don't know how to handle, we use language_unknown. * dwarfread.c (enum_type, symthesize_typedef): Initialize language and demangled name fields in symbol. * dwarfread.c, mipsread.c, partial-stab.h: For all usages of ADD_PSYMBOL_TO_LIST, add language and objfile parameters. * dwarfread.c (new_symbol): Attempt to demangle C++ symbol names and cache the results in SYMBOL_DEMANGLED_NAME for the symbol. * elfread.c (STREQ): Remove macro, use STREQ defined in defs.h. Replace usages throughout. * elfread.c (demangle.h): Include. * elfread.c (record_minimal_symbol): Remove prototype and function. * gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES, B_CLRALL): Moved from symtab.h to gdbtypes.h. * infcmd.c (jump_command): Remove code to demangle name and add it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME. * minsyms.c (demangle.h): Include. * minsyms.c (lookup_minimal_symbol): Indent comment to match code. * minsyms.c (install_minimal_symbols): Attempt to demangle symbol names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME. * mipsread.c (psymtab_language): Add static variable. * stabsread.c (demangle.h): Include. * stabsread.c (define_symbol): Attempt to demangle C++ symbol names and cache them in the SYMBOL_DEMANGLED_NAME field. * stack.c (return_command): Remove explicit demangling of name and use of cleanups. Just use SYMBOL_DEMANGLED_NAME. * symfile.c (demangle.h): Include. * symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix to match macros in symfile.h and allow them to be compiled if INLINE_ADD_PSYMBOL is not true. * symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set. * symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters. Add code to demangle and cache C++ symbol names. Use macro form if INLINE_ADD_PSYMBOL is true, otherwise use C function form. * symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list): Remove, also defined in symfile.c, which we already fixed. * symtab.c (expensive_mangler): Remove prototype and function. * symtab.c (find_methods): Remove physnames parameter and fix prototype to match. * symtab.c (completion_list_add_symbol): Name changed to completion_list_add_name. * symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both the normal symbol name and the cached C++ demangled name. * symtab.c (lookup_demangled_partial_symbol, lookup_demangled_block_symbol): Remove prototypes and functions. * symtab.c (lookup_symbol): Remove use of expensive_mangler, use lookup_block_symbol instead of lookup_demangled_block_symbol. Remove code to try demangling names and matching them. * symtab.c (lookup_partial_symbol, lookup_block_symbol): Fix to try matching the cached demangled name if no match is found using the regular symbol name. * symtab.c (find_methods): Remove unused physnames array. * symtab.c (name_match, NAME_MATCH): Remove function and macro, replaced with SYMBOL_MATCHES_REGEXP from symtab.h. * symtab.c (completion_list_add_symbol): Rewrite to use cached C++ demangled symbol names. * symtab.h: Much reformatting of structures and such to add whitespace to make them more readable, and make them more consistent with other gdb structure definitions. * symtab.h (general_symbol_info): New struct containing fields common to all symbols. * symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME, SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME, SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros. * symtab. (struct minimal_symbol, struct partial_symbol, struct symbol): Use general_symbol_info struct. * utils.c (demangle_and_match): Remove, no longer used. * valops.c (demangle.h): Include. * xcoffexec.c (eq): Remove macro, replace usages with STREQ. * blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c, infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c, symmisc.c, symtab.c, valops.c: Replace references to minimal symbol fields with appropriate macros. * breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c, coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c, demangle.c, elfread.c, energize.c, environ.c, exec.c, gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c, main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c, remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c, sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c, symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h, tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp and strncmp usages with STREQ, STREQN, or STRCMP as appropriate. * breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c, mipsread.c, printcmd.c, source.c, stabsread.c, stack.c, symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as appropriate. * buildsym.c (start_subfile, patch_subfile_names): Default the source language to what can be deduced from the filename. * buildsym.c (end_symtab): Update the source language in the allocated symtab to match what we have been using. * buildsym.h (struct subfile): Add a language field. * c-typeprint.c (c_print_type): Remove code to do explicit demangling. * dbxread.c (psymtab_language): Add static variable. * dbxread.c (start_psymtab): Initialize psymtab_language using deduce_language_from_filename.
This commit is contained in:
parent
eeece52d14
commit
2e4964adfc
52 changed files with 1355 additions and 1125 deletions
107
gdb/ChangeLog
107
gdb/ChangeLog
|
@ -1,3 +1,110 @@
|
||||||
|
Tue Dec 22 20:33:38 1992 Fred Fish (fnf@cygnus.com)
|
||||||
|
|
||||||
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
|
||||||
|
* defs.h (demangle_and_match): Remove prototype.
|
||||||
|
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
|
||||||
|
and STREQN defined in defs.h.
|
||||||
|
* dwarfread.c (set_cu_language): For completely unknown languages,
|
||||||
|
try to deduce the language from the filename. Retain behavior
|
||||||
|
that for known languages we don't know how to handle, we use
|
||||||
|
language_unknown.
|
||||||
|
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
|
||||||
|
and demangled name fields in symbol.
|
||||||
|
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
|
||||||
|
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
|
||||||
|
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
|
||||||
|
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
|
||||||
|
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
|
||||||
|
Replace usages throughout.
|
||||||
|
* elfread.c (demangle.h): Include.
|
||||||
|
* elfread.c (record_minimal_symbol): Remove prototype and function.
|
||||||
|
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
|
||||||
|
B_CLRALL): Moved from symtab.h to gdbtypes.h.
|
||||||
|
* infcmd.c (jump_command): Remove code to demangle name and add
|
||||||
|
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
|
||||||
|
* minsyms.c (demangle.h): Include.
|
||||||
|
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
|
||||||
|
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
|
||||||
|
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
|
||||||
|
* mipsread.c (psymtab_language): Add static variable.
|
||||||
|
* stabsread.c (demangle.h): Include.
|
||||||
|
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
|
||||||
|
names and cache them in the SYMBOL_DEMANGLED_NAME field.
|
||||||
|
* stack.c (return_command): Remove explicit demangling of name
|
||||||
|
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
|
||||||
|
* symfile.c (demangle.h): Include.
|
||||||
|
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
|
||||||
|
to match macros in symfile.h and allow them to be compiled
|
||||||
|
if INLINE_ADD_PSYMBOL is not true.
|
||||||
|
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
|
||||||
|
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
|
||||||
|
Add code to demangle and cache C++ symbol names. Use macro form
|
||||||
|
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
|
||||||
|
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
|
||||||
|
Remove, also defined in symfile.c, which we already fixed.
|
||||||
|
* symtab.c (expensive_mangler): Remove prototype and function.
|
||||||
|
* symtab.c (find_methods): Remove physnames parameter and fix
|
||||||
|
prototype to match.
|
||||||
|
* symtab.c (completion_list_add_symbol): Name changed to
|
||||||
|
completion_list_add_name.
|
||||||
|
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
|
||||||
|
the normal symbol name and the cached C++ demangled name.
|
||||||
|
* symtab.c (lookup_demangled_partial_symbol,
|
||||||
|
lookup_demangled_block_symbol): Remove prototypes and functions.
|
||||||
|
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
|
||||||
|
use lookup_block_symbol instead of lookup_demangled_block_symbol.
|
||||||
|
Remove code to try demangling names and matching them.
|
||||||
|
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
|
||||||
|
Fix to try matching the cached demangled name if no match is
|
||||||
|
found using the regular symbol name.
|
||||||
|
* symtab.c (find_methods): Remove unused physnames array.
|
||||||
|
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
|
||||||
|
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
|
||||||
|
* symtab.c (completion_list_add_symbol): Rewrite to use cached
|
||||||
|
C++ demangled symbol names.
|
||||||
|
* symtab.h: Much reformatting of structures and such to add
|
||||||
|
whitespace to make them more readable, and make them more
|
||||||
|
consistent with other gdb structure definitions.
|
||||||
|
* symtab.h (general_symbol_info): New struct containing fields
|
||||||
|
common to all symbols.
|
||||||
|
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
|
||||||
|
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
|
||||||
|
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
|
||||||
|
* symtab. (struct minimal_symbol, struct partial_symbol, struct
|
||||||
|
symbol): Use general_symbol_info struct.
|
||||||
|
* utils.c (demangle_and_match): Remove, no longer used.
|
||||||
|
* valops.c (demangle.h): Include.
|
||||||
|
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
|
||||||
|
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
|
||||||
|
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
|
||||||
|
symmisc.c, symtab.c, valops.c: Replace references to minimal
|
||||||
|
symbol fields with appropriate macros.
|
||||||
|
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
|
||||||
|
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
|
||||||
|
demangle.c, elfread.c, energize.c, environ.c, exec.c,
|
||||||
|
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
|
||||||
|
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
|
||||||
|
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
|
||||||
|
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
|
||||||
|
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
|
||||||
|
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
|
||||||
|
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
|
||||||
|
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
|
||||||
|
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
|
||||||
|
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
|
||||||
|
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
|
||||||
|
appropriate.
|
||||||
|
* buildsym.c (start_subfile, patch_subfile_names): Default the
|
||||||
|
source language to what can be deduced from the filename.
|
||||||
|
* buildsym.c (end_symtab): Update the source language in the
|
||||||
|
allocated symtab to match what we have been using.
|
||||||
|
* buildsym.h (struct subfile): Add a language field.
|
||||||
|
* c-typeprint.c (c_print_type): Remove code to do explicit
|
||||||
|
demangling.
|
||||||
|
* dbxread.c (psymtab_language): Add static variable.
|
||||||
|
* dbxread.c (start_psymtab): Initialize psymtab_language using
|
||||||
|
deduce_language_from_filename.
|
||||||
|
|
||||||
Mon Dec 21 22:24:33 1992 Fred Fish (fnf@cygnus.com)
|
Mon Dec 21 22:24:33 1992 Fred Fish (fnf@cygnus.com)
|
||||||
|
|
||||||
* valprint.c (val_print): Reorganize comment and add note
|
* valprint.c (val_print): Reorganize comment and add note
|
||||||
|
|
|
@ -257,7 +257,8 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile)
|
||||||
{
|
{
|
||||||
if (symbol)
|
if (symbol)
|
||||||
{
|
{
|
||||||
complain (&innerblock_complaint, SYMBOL_NAME (symbol));
|
complain (&innerblock_complaint,
|
||||||
|
SYMBOL_SOURCE_NAME (symbol));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -371,7 +372,7 @@ start_subfile (name, dirname)
|
||||||
|
|
||||||
for (subfile = subfiles; subfile; subfile = subfile->next)
|
for (subfile = subfiles; subfile; subfile = subfile->next)
|
||||||
{
|
{
|
||||||
if (!strcmp (subfile->name, name))
|
if (STREQ (subfile->name, name))
|
||||||
{
|
{
|
||||||
current_subfile = subfile;
|
current_subfile = subfile;
|
||||||
return;
|
return;
|
||||||
|
@ -393,6 +394,24 @@ start_subfile (name, dirname)
|
||||||
|
|
||||||
/* Initialize line-number recording for this subfile. */
|
/* Initialize line-number recording for this subfile. */
|
||||||
subfile->line_vector = NULL;
|
subfile->line_vector = NULL;
|
||||||
|
|
||||||
|
/* Default the source language to whatever can be deduced from
|
||||||
|
the filename. If nothing can be deduced (such as for a C/C++
|
||||||
|
include file with a ".h" extension), then inherit whatever
|
||||||
|
language the previous subfile had. This kludgery is necessary
|
||||||
|
because there is no standard way in some object formats to
|
||||||
|
record the source language. Also, when symtabs are allocated
|
||||||
|
we try to deduce a language then as well, but it is too late
|
||||||
|
for us to use that information while reading symbols, since
|
||||||
|
symtabs aren't allocated until after all the symbols have
|
||||||
|
been processed for a given source file. */
|
||||||
|
|
||||||
|
subfile->language = deduce_language_from_filename (subfile->name);
|
||||||
|
if (subfile->language == language_unknown &&
|
||||||
|
subfile->next != NULL)
|
||||||
|
{
|
||||||
|
subfile->language = subfile->next->language;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For stabs readers, the first N_SO symbol is assumed to be the source
|
/* For stabs readers, the first N_SO symbol is assumed to be the source
|
||||||
|
@ -417,6 +436,24 @@ patch_subfile_names (subfile, name)
|
||||||
{
|
{
|
||||||
subfile->dirname = subfile->name;
|
subfile->dirname = subfile->name;
|
||||||
subfile->name = strdup (name);
|
subfile->name = strdup (name);
|
||||||
|
|
||||||
|
/* Default the source language to whatever can be deduced from
|
||||||
|
the filename. If nothing can be deduced (such as for a C/C++
|
||||||
|
include file with a ".h" extension), then inherit whatever
|
||||||
|
language the previous subfile had. This kludgery is necessary
|
||||||
|
because there is no standard way in some object formats to
|
||||||
|
record the source language. Also, when symtabs are allocated
|
||||||
|
we try to deduce a language then as well, but it is too late
|
||||||
|
for us to use that information while reading symbols, since
|
||||||
|
symtabs aren't allocated until after all the symbols have
|
||||||
|
been processed for a given source file. */
|
||||||
|
|
||||||
|
subfile->language = deduce_language_from_filename (subfile->name);
|
||||||
|
if (subfile->language == language_unknown &&
|
||||||
|
subfile->next != NULL)
|
||||||
|
{
|
||||||
|
subfile->language = subfile->next->language;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,6 +746,13 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile)
|
||||||
symtab->free_code = free_linetable;
|
symtab->free_code = free_linetable;
|
||||||
symtab->free_ptr = NULL;
|
symtab->free_ptr = NULL;
|
||||||
|
|
||||||
|
/* Use whatever language we have been using for this subfile,
|
||||||
|
not the one that was deduced in allocate_symtab from the
|
||||||
|
filename. We already did our own deducing when we created
|
||||||
|
the subfile, and we may have altered our opinion of what
|
||||||
|
language it is from things we found in the symbols. */
|
||||||
|
symtab->language = subfile->language;
|
||||||
|
|
||||||
#ifdef IBM6000_TARGET
|
#ifdef IBM6000_TARGET
|
||||||
/* In case we need to duplicate symbol tables (to represent include
|
/* In case we need to duplicate symbol tables (to represent include
|
||||||
files), and in case our system needs relocation, we want to
|
files), and in case our system needs relocation, we want to
|
||||||
|
|
|
@ -59,6 +59,7 @@ struct subfile
|
||||||
char *dirname;
|
char *dirname;
|
||||||
struct linetable *line_vector;
|
struct linetable *line_vector;
|
||||||
int line_vector_length;
|
int line_vector_length;
|
||||||
|
enum language language;
|
||||||
};
|
};
|
||||||
|
|
||||||
EXTERN struct subfile *subfiles;
|
EXTERN struct subfile *subfiles;
|
||||||
|
|
|
@ -552,7 +552,7 @@ qualified_name: typebase COLONCOLON name
|
||||||
error ("`%s' is not defined as an aggregate type.",
|
error ("`%s' is not defined as an aggregate type.",
|
||||||
TYPE_NAME (type));
|
TYPE_NAME (type));
|
||||||
|
|
||||||
if (strcmp (type_name_no_tag (type), $4.ptr))
|
if (!STREQ (type_name_no_tag (type), $4.ptr))
|
||||||
error ("invalid destructor `%s::~%s'",
|
error ("invalid destructor `%s::~%s'",
|
||||||
type_name_no_tag (type), $4.ptr);
|
type_name_no_tag (type), $4.ptr);
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ variable: qualified_name
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_type (builtin_type_int);
|
write_exp_elt_type (builtin_type_int);
|
||||||
write_exp_elt_longcst ((LONGEST) msymbol -> address);
|
write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL);
|
write_exp_elt_opcode (UNOP_MEMVAL);
|
||||||
if (msymbol -> type == mst_data ||
|
if (msymbol -> type == mst_data ||
|
||||||
|
@ -676,7 +676,7 @@ variable: name_not_typename
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_type (builtin_type_int);
|
write_exp_elt_type (builtin_type_int);
|
||||||
write_exp_elt_longcst ((LONGEST) msymbol -> address);
|
write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL);
|
write_exp_elt_opcode (UNOP_MEMVAL);
|
||||||
if (msymbol -> type == mst_data ||
|
if (msymbol -> type == mst_data ||
|
||||||
|
|
|
@ -72,18 +72,16 @@ c_typedef_print (type, new, stream)
|
||||||
fprintf_filtered(stream, "typedef ");
|
fprintf_filtered(stream, "typedef ");
|
||||||
type_print(type,"",stream,0);
|
type_print(type,"",stream,0);
|
||||||
if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
|
if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
|
||||||
|| 0 != strcmp (TYPE_NAME ((SYMBOL_TYPE (new))),
|
|| !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
|
||||||
SYMBOL_NAME (new)))
|
fprintf_filtered(stream, " %s", SYMBOL_SOURCE_NAME(new));
|
||||||
fprintf_filtered(stream, " %s", SYMBOL_NAME(new));
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef _LANG_m2
|
#ifdef _LANG_m2
|
||||||
case language_m2:
|
case language_m2:
|
||||||
fprintf_filtered(stream, "TYPE ");
|
fprintf_filtered(stream, "TYPE ");
|
||||||
if(!TYPE_NAME(SYMBOL_TYPE(new)) ||
|
if(!TYPE_NAME(SYMBOL_TYPE(new)) ||
|
||||||
strcmp (TYPE_NAME(SYMBOL_TYPE(new)),
|
!STREQ (TYPE_NAME(SYMBOL_TYPE(new)), SYMBOL_NAME(new)))
|
||||||
SYMBOL_NAME(new)))
|
fprintf_filtered(stream, "%s = ", SYMBOL_SOURCE_NAME(new));
|
||||||
fprintf_filtered(stream, "%s = ", SYMBOL_NAME(new));
|
|
||||||
else
|
else
|
||||||
fprintf_filtered(stream, "<builtin> = ");
|
fprintf_filtered(stream, "<builtin> = ");
|
||||||
type_print(type,"",stream,0);
|
type_print(type,"",stream,0);
|
||||||
|
@ -113,7 +111,6 @@ c_print_type (type, varstring, stream, show, level)
|
||||||
int level;
|
int level;
|
||||||
{
|
{
|
||||||
register enum type_code code;
|
register enum type_code code;
|
||||||
char *demangled = NULL;
|
|
||||||
int demangled_args;
|
int demangled_args;
|
||||||
|
|
||||||
c_type_print_base (type, stream, show, level);
|
c_type_print_base (type, stream, show, level);
|
||||||
|
@ -132,25 +129,14 @@ c_print_type (type, varstring, stream, show, level)
|
||||||
fputs_filtered (" ", stream);
|
fputs_filtered (" ", stream);
|
||||||
c_type_print_varspec_prefix (type, stream, show, 0);
|
c_type_print_varspec_prefix (type, stream, show, 0);
|
||||||
|
|
||||||
/* See if the name has a C++ demangled equivalent, and if so, print that
|
fputs_filtered (varstring, stream);
|
||||||
instead. */
|
|
||||||
|
|
||||||
if (demangle)
|
|
||||||
{
|
|
||||||
demangled = cplus_demangle (varstring, DMGL_ANSI | DMGL_PARAMS);
|
|
||||||
}
|
|
||||||
fputs_filtered ((demangled != NULL) ? demangled : varstring, stream);
|
|
||||||
|
|
||||||
/* For demangled function names, we have the arglist as part of the name,
|
/* For demangled function names, we have the arglist as part of the name,
|
||||||
so don't print an additional pair of ()'s */
|
so don't print an additional pair of ()'s */
|
||||||
|
|
||||||
demangled_args = (demangled != NULL) && (code == TYPE_CODE_FUNC);
|
demangled_args = varstring[strlen(varstring) - 1] == ')';
|
||||||
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
|
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
|
||||||
|
|
||||||
if (demangled != NULL)
|
|
||||||
{
|
|
||||||
free (demangled);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the C++ method arguments ARGS to the file STREAM. */
|
/* Print the C++ method arguments ARGS to the file STREAM. */
|
||||||
|
@ -622,7 +608,7 @@ c_type_print_base (type, stream, show, level)
|
||||||
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
||||||
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
|
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
|
||||||
char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
||||||
int is_constructor = name && strcmp(method_name, name) == 0;
|
int is_constructor = name && STREQ(method_name, name);
|
||||||
for (j = 0; j < len2; j++)
|
for (j = 0; j < len2; j++)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
|
@ -186,7 +186,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
|
||||||
for (j = 0; j < len2; j++)
|
for (j = 0; j < len2; j++)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
if (!strcmp (SYMBOL_NAME (sym),
|
if (STREQ (SYMBOL_NAME (sym),
|
||||||
TYPE_FN_FIELD_PHYSNAME (f, j)))
|
TYPE_FN_FIELD_PHYSNAME (f, j)))
|
||||||
{
|
{
|
||||||
goto common;
|
goto common;
|
||||||
|
@ -333,11 +333,11 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
|
||||||
|
|
||||||
struct minimal_symbol *msymbol =
|
struct minimal_symbol *msymbol =
|
||||||
lookup_minimal_symbol_by_pc (vt_address);
|
lookup_minimal_symbol_by_pc (vt_address);
|
||||||
if ((msymbol != NULL) && (vt_address == msymbol -> address))
|
if ((msymbol != NULL) &&
|
||||||
|
(vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
|
||||||
{
|
{
|
||||||
fputs_filtered (" <", stream);
|
fputs_filtered (" <", stream);
|
||||||
fputs_demangled (msymbol -> name, stream,
|
fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
|
||||||
DMGL_ANSI | DMGL_PARAMS);
|
|
||||||
fputs_filtered (">", stream);
|
fputs_filtered (">", stream);
|
||||||
}
|
}
|
||||||
if (vtblprint)
|
if (vtblprint)
|
||||||
|
|
|
@ -260,7 +260,7 @@ delete_cmd (name, list)
|
||||||
register struct cmd_list_element *c;
|
register struct cmd_list_element *c;
|
||||||
struct cmd_list_element *p;
|
struct cmd_list_element *p;
|
||||||
|
|
||||||
while (*list && !strcmp ((*list)->name, name))
|
while (*list && STREQ ((*list)->name, name))
|
||||||
{
|
{
|
||||||
if ((*list)->hookee)
|
if ((*list)->hookee)
|
||||||
(*list)->hookee->hook = 0; /* Hook slips out of its mouth */
|
(*list)->hookee->hook = 0; /* Hook slips out of its mouth */
|
||||||
|
@ -272,7 +272,7 @@ delete_cmd (name, list)
|
||||||
if (*list)
|
if (*list)
|
||||||
for (c = *list; c->next;)
|
for (c = *list; c->next;)
|
||||||
{
|
{
|
||||||
if (!strcmp (c->next->name, name))
|
if (STREQ (c->next->name, name))
|
||||||
{
|
{
|
||||||
if (c->next->hookee)
|
if (c->next->hookee)
|
||||||
c->next->hookee->hook = 0; /* hooked cmd gets away. */
|
c->next->hookee->hook = 0; /* hooked cmd gets away. */
|
||||||
|
|
|
@ -316,9 +316,9 @@ is_trapped_internalvar (name)
|
||||||
|
|
||||||
if ((name[0] == 'v' || name[0] == 'V')
|
if ((name[0] == 'v' || name[0] == 'V')
|
||||||
&& (((name[1] & -8) == '0' && name[2] == '\0')
|
&& (((name[1] & -8) == '0' && name[2] == '\0')
|
||||||
|| !strcmp (name, "vl")
|
|| STREQ (name, "vl")
|
||||||
|| !strcmp (name, "vs")
|
|| STREQ (name, "vs")
|
||||||
|| !strcmp (name, "vm")))
|
|| STREQ (name, "vm")))
|
||||||
return 1;
|
return 1;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
@ -336,17 +336,17 @@ value_of_trapped_internalvar (var)
|
||||||
long len = *read_vector_register (VL_REGNUM);
|
long len = *read_vector_register (VL_REGNUM);
|
||||||
if (len <= 0 || len > 128) len = 128;
|
if (len <= 0 || len > 128) len = 128;
|
||||||
|
|
||||||
if (!strcmp (name, "vl"))
|
if (STREQ (name, "vl"))
|
||||||
{
|
{
|
||||||
val = value_from_longest (builtin_type_int,
|
val = value_from_longest (builtin_type_int,
|
||||||
(LONGEST) *read_vector_register_1 (VL_REGNUM));
|
(LONGEST) *read_vector_register_1 (VL_REGNUM));
|
||||||
}
|
}
|
||||||
else if (!strcmp (name, "vs"))
|
else if (STREQ (name, "vs"))
|
||||||
{
|
{
|
||||||
val = value_from_longest (builtin_type_int,
|
val = value_from_longest (builtin_type_int,
|
||||||
(LONGEST) *read_vector_register_1 (VS_REGNUM));
|
(LONGEST) *read_vector_register_1 (VS_REGNUM));
|
||||||
}
|
}
|
||||||
else if (!strcmp (name, "vm"))
|
else if (STREQ (name, "vm"))
|
||||||
{
|
{
|
||||||
long vm[4];
|
long vm[4];
|
||||||
long i, *p;
|
long i, *p;
|
||||||
|
@ -408,13 +408,13 @@ set_trapped_internalvar (var, val, bitpos, bitsize, offset)
|
||||||
char *name = var->name;
|
char *name = var->name;
|
||||||
long long newval = value_as_long (val);
|
long long newval = value_as_long (val);
|
||||||
|
|
||||||
if (!strcmp (name, "vl"))
|
if (STREQ (name, "vl"))
|
||||||
write_vector_register (VL_REGNUM, 0, newval);
|
write_vector_register (VL_REGNUM, 0, newval);
|
||||||
else if (!strcmp (name, "vs"))
|
else if (STREQ (name, "vs"))
|
||||||
write_vector_register (VS_REGNUM, 0, newval);
|
write_vector_register (VS_REGNUM, 0, newval);
|
||||||
else if (name[0] == 'c' || name[0] == 'C')
|
else if (name[0] == 'c' || name[0] == 'C')
|
||||||
write_comm_register (atoi (&name[1]), newval);
|
write_comm_register (atoi (&name[1]), newval);
|
||||||
else if (!strcmp (name, "vm"))
|
else if (STREQ (name, "vm"))
|
||||||
error ("can't assign to $vm");
|
error ("can't assign to $vm");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -498,9 +498,9 @@ set_pipelining_command (arg)
|
||||||
sequential = !sequential;
|
sequential = !sequential;
|
||||||
printf_filtered ("%s\n", sequential ? "off" : "on");
|
printf_filtered ("%s\n", sequential ? "off" : "on");
|
||||||
}
|
}
|
||||||
else if (!strcmp (arg, "on"))
|
else if (STREQ (arg, "on"))
|
||||||
sequential = 0;
|
sequential = 0;
|
||||||
else if (!strcmp (arg, "off"))
|
else if (STREQ (arg, "off"))
|
||||||
sequential = 1;
|
sequential = 1;
|
||||||
else error ("valid args are `on', to allow instructions to overlap, or\n\
|
else error ("valid args are `on', to allow instructions to overlap, or\n\
|
||||||
`off', to prevent it and thereby pinpoint exceptions.");
|
`off', to prevent it and thereby pinpoint exceptions.");
|
||||||
|
@ -517,9 +517,9 @@ set_parallel_command (arg)
|
||||||
|
|
||||||
if (!strncmp (arg, "fixed", strlen (arg)))
|
if (!strncmp (arg, "fixed", strlen (arg)))
|
||||||
parallel = 2;
|
parallel = 2;
|
||||||
else if (!strcmp (arg, "on"))
|
else if (STREQ (arg, "on"))
|
||||||
parallel = 1;
|
parallel = 1;
|
||||||
else if (!strcmp (arg, "off"))
|
else if (STREQ (arg, "off"))
|
||||||
parallel = 0;
|
parallel = 0;
|
||||||
else error ("valid args are `on', to allow multiple threads, or\n\
|
else error ("valid args are `on', to allow multiple threads, or\n\
|
||||||
`fixed', to force multiple threads, or\n\
|
`fixed', to force multiple threads, or\n\
|
||||||
|
|
|
@ -71,7 +71,7 @@ cp_is_vtbl_ptr_type(type)
|
||||||
static const char vtbl_ptr_name[] =
|
static const char vtbl_ptr_name[] =
|
||||||
{ CPLUS_MARKER,'v','t','b','l','_','p','t','r','_','t','y','p','e', 0 };
|
{ CPLUS_MARKER,'v','t','b','l','_','p','t','r','_','t','y','p','e', 0 };
|
||||||
|
|
||||||
return (typename != NULL && !strcmp(typename, vtbl_ptr_name));
|
return (typename != NULL && STREQ(typename, vtbl_ptr_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return truth value for the assertion that TYPE is of the type
|
/* Return truth value for the assertion that TYPE is of the type
|
||||||
|
|
|
@ -133,6 +133,10 @@ struct symloc {
|
||||||
#define BELIEVE_PCC_PROMOTION 0
|
#define BELIEVE_PCC_PROMOTION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Remember what we deduced to be the source language of this psymtab. */
|
||||||
|
|
||||||
|
static enum language psymtab_language = language_unknown;
|
||||||
|
|
||||||
/* Nonzero means give verbose info on gdb action. From main.c. */
|
/* Nonzero means give verbose info on gdb action. From main.c. */
|
||||||
extern int info_verbose;
|
extern int info_verbose;
|
||||||
|
|
||||||
|
@ -345,7 +349,7 @@ add_old_header_file (name, instance)
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
for (i = 0; i < n_header_files; i++)
|
for (i = 0; i < n_header_files; i++)
|
||||||
if (!strcmp (p[i].name, name) && instance == p[i].instance)
|
if (STREQ (p[i].name, name) && instance == p[i].instance)
|
||||||
{
|
{
|
||||||
add_this_object_header_file (i);
|
add_this_object_header_file (i);
|
||||||
return;
|
return;
|
||||||
|
@ -811,7 +815,7 @@ find_corresponding_bincl_psymtab (name, instance)
|
||||||
|
|
||||||
for (bincl = bincl_list; bincl < next_bincl; bincl++)
|
for (bincl = bincl_list; bincl < next_bincl; bincl++)
|
||||||
if (bincl->instance == instance
|
if (bincl->instance == instance
|
||||||
&& !strcmp (name, bincl->name))
|
&& STREQ (name, bincl->name))
|
||||||
return bincl->pst;
|
return bincl->pst;
|
||||||
|
|
||||||
return (struct partial_symtab *) 0;
|
return (struct partial_symtab *) 0;
|
||||||
|
@ -963,7 +967,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
|
||||||
/* Use the address of dbsubc to finish the last psymtab. */
|
/* Use the address of dbsubc to finish the last psymtab. */
|
||||||
if (hp_bufp->symbol_type == ST_CODE &&
|
if (hp_bufp->symbol_type == ST_CODE &&
|
||||||
HP_STRINGTAB (objfile)[hp_bufp->name.n_strx] == '_' &&
|
HP_STRINGTAB (objfile)[hp_bufp->name.n_strx] == '_' &&
|
||||||
!strcmp (HP_STRINGTAB (objfile) + hp_bufp->name.n_strx, "_dbsubc"))
|
STREQ (HP_STRINGTAB (objfile) + hp_bufp->name.n_strx, "_dbsubc"))
|
||||||
dbsubc_addr = hp_bufp->symbol_value;
|
dbsubc_addr = hp_bufp->symbol_value;
|
||||||
if (hp_bufp->symbol_scope == SS_UNIVERSAL)
|
if (hp_bufp->symbol_scope == SS_UNIVERSAL)
|
||||||
{
|
{
|
||||||
|
@ -971,10 +975,10 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size)
|
||||||
error ("Invalid symbol data; bad HP string table offset: %d",
|
error ("Invalid symbol data; bad HP string table offset: %d",
|
||||||
hp_bufp->name.n_strx);
|
hp_bufp->name.n_strx);
|
||||||
/* A hack, but gets the job done. */
|
/* A hack, but gets the job done. */
|
||||||
if (!strcmp (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
if (STREQ (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
||||||
"$START$"))
|
"$START$"))
|
||||||
objfile -> ei.entry_file_lowpc = hp_bufp->symbol_value;
|
objfile -> ei.entry_file_lowpc = hp_bufp->symbol_value;
|
||||||
if (!strcmp (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
if (STREQ (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
||||||
"_sr4export"))
|
"_sr4export"))
|
||||||
objfile -> ei.entry_file_highpc = hp_bufp->symbol_value;
|
objfile -> ei.entry_file_highpc = hp_bufp->symbol_value;
|
||||||
record_minimal_symbol (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
record_minimal_symbol (hp_bufp->name.n_strx + HP_STRINGTAB (objfile),
|
||||||
|
@ -1105,6 +1109,9 @@ start_psymtab (objfile, section_offsets,
|
||||||
if successful. */
|
if successful. */
|
||||||
elfstab_offset_sections (objfile, result);
|
elfstab_offset_sections (objfile, result);
|
||||||
|
|
||||||
|
/* Deduce the source language from the filename for this psymtab. */
|
||||||
|
psymtab_language = deduce_language_from_filename (filename);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1179,7 +1186,8 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
|
||||||
minsym = lookup_minimal_symbol (p, objfile);
|
minsym = lookup_minimal_symbol (p, objfile);
|
||||||
|
|
||||||
if (minsym) {
|
if (minsym) {
|
||||||
pst->texthigh = minsym->address + (int)minsym->info;
|
pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) +
|
||||||
|
(int) MSYMBOL_INFO (minsym);
|
||||||
} else {
|
} else {
|
||||||
/* This file ends with a static function, and it's
|
/* This file ends with a static function, and it's
|
||||||
difficult to imagine how hard it would be to track down
|
difficult to imagine how hard it would be to track down
|
||||||
|
@ -1473,9 +1481,9 @@ read_ofile_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
|
||||||
processing_gcc_compilation = 0;
|
processing_gcc_compilation = 0;
|
||||||
if (bufp->n_type == N_TEXT)
|
if (bufp->n_type == N_TEXT)
|
||||||
{
|
{
|
||||||
if (strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL) == 0)
|
if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
|
||||||
processing_gcc_compilation = 1;
|
processing_gcc_compilation = 1;
|
||||||
else if (strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0)
|
else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
|
||||||
processing_gcc_compilation = 2;
|
processing_gcc_compilation = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,9 +1545,9 @@ read_ofile_symtab (objfile, sym_offset, sym_size, text_offset, text_size,
|
||||||
However, there is no reason not to accept
|
However, there is no reason not to accept
|
||||||
the GCC_COMPILED_FLAG_SYMBOL anywhere. */
|
the GCC_COMPILED_FLAG_SYMBOL anywhere. */
|
||||||
|
|
||||||
if (strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL) == 0)
|
if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
|
||||||
processing_gcc_compilation = 1;
|
processing_gcc_compilation = 1;
|
||||||
else if (strcmp (namestring, GCC2_COMPILED_FLAG_SYMBOL) == 0)
|
else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
|
||||||
processing_gcc_compilation = 2;
|
processing_gcc_compilation = 2;
|
||||||
|
|
||||||
#if 1 /* Works, but is experimental. -fnf */
|
#if 1 /* Works, but is experimental. -fnf */
|
||||||
|
@ -1970,7 +1978,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
|
||||||
case N_OPT: /* Solaris 2: Compiler options */
|
case N_OPT: /* Solaris 2: Compiler options */
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
if (strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)
|
if (STREQ (name, GCC2_COMPILED_FLAG_SYMBOL))
|
||||||
{
|
{
|
||||||
processing_gcc_compilation = 2;
|
processing_gcc_compilation = 2;
|
||||||
#if 1 /* Works, but is experimental. -fnf */
|
#if 1 /* Works, but is experimental. -fnf */
|
||||||
|
|
12
gdb/defs.h
12
gdb/defs.h
|
@ -33,6 +33,13 @@ typedef unsigned int CORE_ADDR;
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#define max(a, b) ((a) > (b) ? (a) : (b))
|
#define max(a, b) ((a) > (b) ? (a) : (b))
|
||||||
|
|
||||||
|
/* Gdb does *lots* of string compares. Use macros to speed them up by
|
||||||
|
avoiding function calls if the first characters are not the same. */
|
||||||
|
|
||||||
|
#define STRCMP(a,b) (*(a) == *(b) ? strcmp ((a), (b)) : *(a) - *(b))
|
||||||
|
#define STREQ(a,b) (*(a) == *(b) ? !strcmp ((a), (b)) : 0)
|
||||||
|
#define STREQN(a,b,c) (*(a) == *(b) ? !strncmp ((a), (b), (c)) : 0)
|
||||||
|
|
||||||
/* The character C++ uses to build identifiers that must be unique from
|
/* The character C++ uses to build identifiers that must be unique from
|
||||||
the program's identifiers (such as $this and $$vptr). */
|
the program's identifiers (such as $this and $$vptr). */
|
||||||
#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
|
#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
|
||||||
|
@ -93,7 +100,7 @@ inside_entry_file PARAMS ((CORE_ADDR addr));
|
||||||
extern int
|
extern int
|
||||||
inside_main_func PARAMS ((CORE_ADDR pc));
|
inside_main_func PARAMS ((CORE_ADDR pc));
|
||||||
|
|
||||||
/* From cplus-dem.c */
|
/* From libiberty.a */
|
||||||
|
|
||||||
extern char *
|
extern char *
|
||||||
cplus_demangle PARAMS ((const char *, int));
|
cplus_demangle PARAMS ((const char *, int));
|
||||||
|
@ -126,9 +133,6 @@ mmalloc_getkey PARAMS ((PTR, int));
|
||||||
|
|
||||||
/* From utils.c */
|
/* From utils.c */
|
||||||
|
|
||||||
extern char *
|
|
||||||
demangle_and_match PARAMS ((const char *, const char *, int));
|
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
strcmp_iw PARAMS ((const char *, const char *));
|
strcmp_iw PARAMS ((const char *, const char *));
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,8 @@ set_demangling_command (ignore, from_tty)
|
||||||
|
|
||||||
for (dem = demanglers; dem -> demangling_style_name != NULL; dem++)
|
for (dem = demanglers; dem -> demangling_style_name != NULL; dem++)
|
||||||
{
|
{
|
||||||
if (strcmp (current_demangling_style_string,
|
if (STREQ (current_demangling_style_string,
|
||||||
dem -> demangling_style_name) == 0)
|
dem -> demangling_style_name))
|
||||||
{
|
{
|
||||||
current_demangling_style = dem -> demangling_style;
|
current_demangling_style = dem -> demangling_style;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -207,9 +207,6 @@ typedef unsigned int DIE_REF; /* Reference to a DIE */
|
||||||
#endif
|
#endif
|
||||||
/* end-sanitize-chill */
|
/* end-sanitize-chill */
|
||||||
|
|
||||||
#define STREQ(a,b) (strcmp(a,b)==0)
|
|
||||||
#define STREQN(a,b,n) (strncmp(a,b,n)==0)
|
|
||||||
|
|
||||||
/* Flags to target_to_host() that tell whether or not the data object is
|
/* Flags to target_to_host() that tell whether or not the data object is
|
||||||
expected to be signed. Used, for example, when fetching a signed
|
expected to be signed. Used, for example, when fetching a signed
|
||||||
integer in the target environment which is used as a signed integer
|
integer in the target environment which is used as a signed integer
|
||||||
|
@ -691,9 +688,13 @@ set_cu_language (dip)
|
||||||
case LANG_FORTRAN77:
|
case LANG_FORTRAN77:
|
||||||
case LANG_FORTRAN90:
|
case LANG_FORTRAN90:
|
||||||
case LANG_PASCAL83:
|
case LANG_PASCAL83:
|
||||||
default:
|
/* We don't know anything special about these yet. */
|
||||||
cu_language = language_unknown;
|
cu_language = language_unknown;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
/* If no at_language, try to deduce one from the filename */
|
||||||
|
cu_language = deduce_language_from_filename (dip -> at_name);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cu_language_defn = language_def (cu_language);
|
cu_language_defn = language_def (cu_language);
|
||||||
}
|
}
|
||||||
|
@ -1736,6 +1737,8 @@ enum_type (dip, objfile)
|
||||||
memset (sym, 0, sizeof (struct symbol));
|
memset (sym, 0, sizeof (struct symbol));
|
||||||
SYMBOL_NAME (sym) = create_name (list -> field.name,
|
SYMBOL_NAME (sym) = create_name (list -> field.name,
|
||||||
&objfile->symbol_obstack);
|
&objfile->symbol_obstack);
|
||||||
|
SYMBOL_LANGUAGE (sym) = cu_language;
|
||||||
|
SYMBOL_DEMANGLED_NAME (sym) = NULL;
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
SYMBOL_CLASS (sym) = LOC_CONST;
|
SYMBOL_CLASS (sym) = LOC_CONST;
|
||||||
SYMBOL_TYPE (sym) = type;
|
SYMBOL_TYPE (sym) = type;
|
||||||
|
@ -2543,7 +2546,8 @@ add_enum_psymbol (dip, objfile)
|
||||||
{
|
{
|
||||||
scan += TARGET_FT_LONG_SIZE (objfile);
|
scan += TARGET_FT_LONG_SIZE (objfile);
|
||||||
ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
|
ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
|
||||||
objfile -> static_psymbols, 0);
|
objfile -> static_psymbols, 0, cu_language,
|
||||||
|
objfile);
|
||||||
scan += strlen (scan) + 1;
|
scan += strlen (scan) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2579,7 +2583,7 @@ add_partial_symbol (dip, objfile)
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_BLOCK,
|
VAR_NAMESPACE, LOC_BLOCK,
|
||||||
objfile -> global_psymbols,
|
objfile -> global_psymbols,
|
||||||
dip -> at_low_pc);
|
dip -> at_low_pc, cu_language, objfile);
|
||||||
break;
|
break;
|
||||||
case TAG_global_variable:
|
case TAG_global_variable:
|
||||||
record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
|
record_minimal_symbol (dip -> at_name, locval (dip -> at_location),
|
||||||
|
@ -2587,25 +2591,25 @@ add_partial_symbol (dip, objfile)
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_STATIC,
|
VAR_NAMESPACE, LOC_STATIC,
|
||||||
objfile -> global_psymbols,
|
objfile -> global_psymbols,
|
||||||
0);
|
0, cu_language, objfile);
|
||||||
break;
|
break;
|
||||||
case TAG_subroutine:
|
case TAG_subroutine:
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_BLOCK,
|
VAR_NAMESPACE, LOC_BLOCK,
|
||||||
objfile -> static_psymbols,
|
objfile -> static_psymbols,
|
||||||
dip -> at_low_pc);
|
dip -> at_low_pc, cu_language, objfile);
|
||||||
break;
|
break;
|
||||||
case TAG_local_variable:
|
case TAG_local_variable:
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_STATIC,
|
VAR_NAMESPACE, LOC_STATIC,
|
||||||
objfile -> static_psymbols,
|
objfile -> static_psymbols,
|
||||||
0);
|
0, cu_language, objfile);
|
||||||
break;
|
break;
|
||||||
case TAG_typedef:
|
case TAG_typedef:
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_TYPEDEF,
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile -> static_psymbols,
|
objfile -> static_psymbols,
|
||||||
0);
|
0, cu_language, objfile);
|
||||||
break;
|
break;
|
||||||
case TAG_class_type:
|
case TAG_class_type:
|
||||||
case TAG_structure_type:
|
case TAG_structure_type:
|
||||||
|
@ -2614,14 +2618,14 @@ add_partial_symbol (dip, objfile)
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
STRUCT_NAMESPACE, LOC_TYPEDEF,
|
STRUCT_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile -> static_psymbols,
|
objfile -> static_psymbols,
|
||||||
0);
|
0, cu_language, objfile);
|
||||||
if (cu_language == language_cplus)
|
if (cu_language == language_cplus)
|
||||||
{
|
{
|
||||||
/* For C++, these implicitly act as typedefs as well. */
|
/* For C++, these implicitly act as typedefs as well. */
|
||||||
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
||||||
VAR_NAMESPACE, LOC_TYPEDEF,
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile -> static_psymbols,
|
objfile -> static_psymbols,
|
||||||
0);
|
0, cu_language, objfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2928,6 +2932,26 @@ new_symbol (dip, objfile)
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
SYMBOL_CLASS (sym) = LOC_STATIC;
|
SYMBOL_CLASS (sym) = LOC_STATIC;
|
||||||
SYMBOL_TYPE (sym) = decode_die_type (dip);
|
SYMBOL_TYPE (sym) = decode_die_type (dip);
|
||||||
|
|
||||||
|
/* If this symbol is from a C++ compilation, then attempt to cache the
|
||||||
|
demangled form for future reference. This is a typical time versus
|
||||||
|
space tradeoff, that was decided in favor of time because it sped up
|
||||||
|
C++ symbol lookups by a factor of about 20. */
|
||||||
|
|
||||||
|
SYMBOL_LANGUAGE (sym) = cu_language;
|
||||||
|
if (SYMBOL_LANGUAGE (sym) == language_cplus)
|
||||||
|
{
|
||||||
|
char *demangled =
|
||||||
|
cplus_demangle (SYMBOL_NAME (sym), DMGL_PARAMS | DMGL_ANSI);
|
||||||
|
if (demangled != NULL)
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (sym) =
|
||||||
|
obsavestring (demangled, strlen (demangled),
|
||||||
|
&objfile -> symbol_obstack);
|
||||||
|
free (demangled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (dip -> die_tag)
|
switch (dip -> die_tag)
|
||||||
{
|
{
|
||||||
case TAG_label:
|
case TAG_label:
|
||||||
|
@ -3056,6 +3080,8 @@ synthesize_typedef (dip, objfile, type)
|
||||||
memset (sym, 0, sizeof (struct symbol));
|
memset (sym, 0, sizeof (struct symbol));
|
||||||
SYMBOL_NAME (sym) = create_name (dip -> at_name,
|
SYMBOL_NAME (sym) = create_name (dip -> at_name,
|
||||||
&objfile->symbol_obstack);
|
&objfile->symbol_obstack);
|
||||||
|
SYMBOL_LANGUAGE (sym) = cu_language;
|
||||||
|
SYMBOL_DEMANGLED_NAME (sym) = NULL;
|
||||||
SYMBOL_TYPE (sym) = type;
|
SYMBOL_TYPE (sym) = type;
|
||||||
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
|
|
|
@ -45,8 +45,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "gdb-stabs.h"
|
#include "gdb-stabs.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "demangle.h"
|
||||||
#define STREQ(a,b) (strcmp((a),(b))==0)
|
|
||||||
|
|
||||||
/* The struct elfinfo is available only during ELF symbol table and
|
/* The struct elfinfo is available only during ELF symbol table and
|
||||||
psymtab reading. It is destroyed at the complation of psymtab-reading.
|
psymtab reading. It is destroyed at the complation of psymtab-reading.
|
||||||
|
@ -96,12 +95,6 @@ free_elfinfo PARAMS ((PTR));
|
||||||
static struct section_offsets *
|
static struct section_offsets *
|
||||||
elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
|
elf_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void
|
|
||||||
record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
|
|
||||||
struct objfile *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
|
record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
|
||||||
enum minimal_symbol_type, char *,
|
enum minimal_symbol_type, char *,
|
||||||
|
@ -185,39 +178,6 @@ elf_interpreter (abfd)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
record_minimal_symbol -- add entry to minimal symbol table
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static void record_minimal_symbol (char *name, CORE_ADDR address)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Given a pointer to the name of a symbol that should be added to the
|
|
||||||
minimal symbol table and the address associated with that symbol, records
|
|
||||||
this information for later use in building the minimal symbol table.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if 0 /* FIXME: Unused */
|
|
||||||
|
|
||||||
static void
|
|
||||||
record_minimal_symbol (name, address, ms_type, objfile)
|
|
||||||
char *name;
|
|
||||||
CORE_ADDR address;
|
|
||||||
enum minimal_symbol_type ms_type;
|
|
||||||
struct objfile *objfile;
|
|
||||||
{
|
|
||||||
name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
|
|
||||||
prim_record_minimal_symbol (name, address, ms_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
|
record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -351,15 +311,15 @@ elf_symtab_read (abfd, addr, objfile)
|
||||||
switch (sym->name[1])
|
switch (sym->name[1])
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
if (!strcmp ("Bbss.bss", sym->name))
|
if (STREQ ("Bbss.bss", sym->name))
|
||||||
index = SECT_OFF_BSS;
|
index = SECT_OFF_BSS;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (!strcmp ("Ddata.data", sym->name))
|
if (STREQ ("Ddata.data", sym->name))
|
||||||
index = SECT_OFF_DATA;
|
index = SECT_OFF_DATA;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!strcmp ("Drodata.rodata", sym->name))
|
if (STREQ ("Drodata.rodata", sym->name))
|
||||||
index = SECT_OFF_RODATA;
|
index = SECT_OFF_RODATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -628,7 +588,7 @@ elfstab_offset_sections (objfile, pst)
|
||||||
for (; maybe; maybe = maybe->next)
|
for (; maybe; maybe = maybe->next)
|
||||||
{
|
{
|
||||||
if (filename[0] == maybe->filename[0]
|
if (filename[0] == maybe->filename[0]
|
||||||
&& !strcmp (filename, maybe->filename))
|
&& STREQ (filename, maybe->filename))
|
||||||
{
|
{
|
||||||
/* We found a match. But there might be several source files
|
/* We found a match. But there might be several source files
|
||||||
(from different directories) with the same name. */
|
(from different directories) with the same name. */
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ kernel_dispatch(queue)
|
||||||
|
|
||||||
while (*text == ' ' || *text == '\t') text++;
|
while (*text == ' ' || *text == '\t') text++;
|
||||||
|
|
||||||
if (strcmp(text, "]*[") == 0) /* XXX - What does this mean??? */
|
if (STREQ(text, "]*[")) /* XXX - What does this mean??? */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*text != '\000')
|
if (*text != '\000')
|
||||||
|
@ -1576,9 +1576,9 @@ energize_call_command(cmdblk, arg, from_tty)
|
||||||
else
|
else
|
||||||
(*cmdblk->function.cfunc)(arg, from_tty);
|
(*cmdblk->function.cfunc)(arg, from_tty);
|
||||||
|
|
||||||
if (strcmp(cmdblk->name, "up") == 0
|
if (STREQ(cmdblk->name, "up")
|
||||||
|| strcmp(cmdblk->name, "down") == 0
|
|| STREQ(cmdblk->name, "down")
|
||||||
|| strcmp(cmdblk->name, "frame") == 0)
|
|| STREQ(cmdblk->name, "frame"))
|
||||||
send_location(get_frame_info(selected_frame)->pc,
|
send_location(get_frame_info(selected_frame)->pc,
|
||||||
selected_frame_level);
|
selected_frame_level);
|
||||||
print_prompt();
|
print_prompt();
|
||||||
|
|
|
@ -102,7 +102,7 @@ print_subexp (exp, pos, stream, prec)
|
||||||
|
|
||||||
case OP_VAR_VALUE:
|
case OP_VAR_VALUE:
|
||||||
(*pos) += 2;
|
(*pos) += 2;
|
||||||
fputs_filtered (SYMBOL_NAME (exp->elts[pc + 1].symbol), stream);
|
fputs_filtered (SYMBOL_SOURCE_NAME (exp->elts[pc + 1].symbol), stream);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OP_LAST:
|
case OP_LAST:
|
||||||
|
|
|
@ -476,7 +476,7 @@ lookup_primitive_typename (name)
|
||||||
|
|
||||||
for (p = current_language -> la_builtin_type_vector; *p != NULL; p++)
|
for (p = current_language -> la_builtin_type_vector; *p != NULL; p++)
|
||||||
{
|
{
|
||||||
if (!strcmp ((**p) -> name, name))
|
if (STREQ ((**p) -> name, name))
|
||||||
{
|
{
|
||||||
return (**p);
|
return (**p);
|
||||||
}
|
}
|
||||||
|
@ -676,7 +676,7 @@ lookup_struct_elt_type (type, name, noerr)
|
||||||
{
|
{
|
||||||
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
||||||
|
|
||||||
if (t_field_name && !strcmp (t_field_name, name))
|
if (t_field_name && STREQ (t_field_name, name))
|
||||||
{
|
{
|
||||||
return TYPE_FIELD_TYPE (type, i);
|
return TYPE_FIELD_TYPE (type, i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#define FT_NUM_MEMBERS 28 /* Highest FT_* above, plus one. */
|
#define FT_NUM_MEMBERS 28 /* Highest FT_* above, plus one. */
|
||||||
|
|
||||||
|
/* Some macros for char-based bitfields. */
|
||||||
|
|
||||||
|
#define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
|
||||||
|
#define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
|
||||||
|
#define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
|
||||||
|
#define B_TYPE unsigned char
|
||||||
|
#define B_BYTES(x) ( 1 + ((x)>>3) )
|
||||||
|
#define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
|
||||||
|
|
||||||
/* Different kinds of data types are distinguished by the `code' field. */
|
/* Different kinds of data types are distinguished by the `code' field. */
|
||||||
|
|
||||||
enum type_code
|
enum type_code
|
||||||
|
|
|
@ -472,7 +472,7 @@ leafproc_return (ip)
|
||||||
|
|
||||||
if ((msymbol = lookup_minimal_symbol_by_pc (ip)) != NULL)
|
if ((msymbol = lookup_minimal_symbol_by_pc (ip)) != NULL)
|
||||||
{
|
{
|
||||||
if ((p = index (msymbol -> name, '.')) && !strcmp (p, ".lf"))
|
if ((p = index (msymbol -> name, '.')) && STREQ (p, ".lf"))
|
||||||
{
|
{
|
||||||
if (next_insn (msymbol -> address, &insn1, &insn2)
|
if (next_insn (msymbol -> address, &insn1, &insn2)
|
||||||
&& (insn1 & 0xff87ffff) == 0x5c80161e /* mov g14, gx */
|
&& (insn1 & 0xff87ffff) == 0x5c80161e /* mov g14, gx */
|
||||||
|
|
16
gdb/infcmd.c
16
gdb/infcmd.c
|
@ -371,14 +371,14 @@ step_1 (skip_subroutines, single_inst, count_string)
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
||||||
/* No info or after _etext ("Can't happen") */
|
/* No info or after _etext ("Can't happen") */
|
||||||
if (msymbol == NULL || (msymbol + 1) -> name == NULL)
|
if (msymbol == NULL || SYMBOL_NAME (msymbol + 1) == NULL)
|
||||||
error ("No data available on pc function.");
|
error ("No data available on pc function.");
|
||||||
|
|
||||||
printf_filtered ("Single stepping until function exit.\n");
|
printf_filtered ("Single stepping until function exit.\n");
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
||||||
step_range_start = msymbol -> address;
|
step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
step_range_end = (msymbol + 1) -> address;
|
step_range_end = SYMBOL_VALUE_ADDRESS (msymbol + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -420,8 +420,6 @@ jump_command (arg, from_tty)
|
||||||
struct symtab_and_line sal;
|
struct symtab_and_line sal;
|
||||||
struct symbol *fn;
|
struct symbol *fn;
|
||||||
struct symbol *sfn;
|
struct symbol *sfn;
|
||||||
char *fname;
|
|
||||||
struct cleanup *back_to;
|
|
||||||
|
|
||||||
ERROR_NO_INFERIOR;
|
ERROR_NO_INFERIOR;
|
||||||
|
|
||||||
|
@ -447,14 +445,12 @@ jump_command (arg, from_tty)
|
||||||
sfn = find_pc_function (sal.pc);
|
sfn = find_pc_function (sal.pc);
|
||||||
if (fn != NULL && sfn != fn)
|
if (fn != NULL && sfn != fn)
|
||||||
{
|
{
|
||||||
fname = strdup_demangled (SYMBOL_NAME (fn));
|
if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line,
|
||||||
back_to = make_cleanup (free, fname);
|
SYMBOL_SOURCE_NAME (fn)))
|
||||||
if (!query ("Line %d is not in `%s'. Jump anyway? ", sal.line, fname))
|
|
||||||
{
|
{
|
||||||
error ("Not confirmed.");
|
error ("Not confirmed.");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
do_cleanups (back_to);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = ADDR_BITS_SET (sal.pc);
|
addr = ADDR_BITS_SET (sal.pc);
|
||||||
|
@ -572,7 +568,7 @@ until_next_command (from_tty)
|
||||||
if (msymbol == NULL)
|
if (msymbol == NULL)
|
||||||
error ("Execution is not within a known function.");
|
error ("Execution is not within a known function.");
|
||||||
|
|
||||||
step_range_start = msymbol -> address;
|
step_range_start = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
step_range_end = pc;
|
step_range_end = pc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -174,7 +174,7 @@ extern char *inferior_thisrun_terminal;
|
||||||
no name, assume we are not in sigtramp). */
|
no name, assume we are not in sigtramp). */
|
||||||
#if !defined (IN_SIGTRAMP)
|
#if !defined (IN_SIGTRAMP)
|
||||||
#define IN_SIGTRAMP(pc, name) \
|
#define IN_SIGTRAMP(pc, name) \
|
||||||
name && !strcmp ("_sigtramp", name)
|
name && STREQ ("_sigtramp", name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Tables of how to react to signals; the user sets them. */
|
/* Tables of how to react to signals; the user sets them. */
|
||||||
|
|
|
@ -176,7 +176,7 @@ set_language_command (ignore, from_tty)
|
||||||
|
|
||||||
/* Search the list of languages for a match. */
|
/* Search the list of languages for a match. */
|
||||||
for (i = 0; i < languages_size; i++) {
|
for (i = 0; i < languages_size; i++) {
|
||||||
if (!strcmp (languages[i]->la_name, language)) {
|
if (STREQ (languages[i]->la_name, language)) {
|
||||||
/* Found it! Go into manual mode, and use this language. */
|
/* Found it! Go into manual mode, and use this language. */
|
||||||
if (languages[i]->la_language == language_auto) {
|
if (languages[i]->la_language == language_auto) {
|
||||||
/* Enter auto mode. Set to the current frame's language, if known. */
|
/* Enter auto mode. Set to the current frame's language, if known. */
|
||||||
|
@ -224,22 +224,22 @@ set_type_command(ignore, from_tty)
|
||||||
char *ignore;
|
char *ignore;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
if (!strcmp(type,"on"))
|
if (STREQ(type,"on"))
|
||||||
{
|
{
|
||||||
type_check = type_check_on;
|
type_check = type_check_on;
|
||||||
type_mode = type_mode_manual;
|
type_mode = type_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(type,"warn"))
|
else if (STREQ(type,"warn"))
|
||||||
{
|
{
|
||||||
type_check = type_check_warn;
|
type_check = type_check_warn;
|
||||||
type_mode = type_mode_manual;
|
type_mode = type_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(type,"off"))
|
else if (STREQ(type,"off"))
|
||||||
{
|
{
|
||||||
type_check = type_check_off;
|
type_check = type_check_off;
|
||||||
type_mode = type_mode_manual;
|
type_mode = type_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(type,"auto"))
|
else if (STREQ(type,"auto"))
|
||||||
{
|
{
|
||||||
type_mode = type_mode_auto;
|
type_mode = type_mode_auto;
|
||||||
set_type_range();
|
set_type_range();
|
||||||
|
@ -270,22 +270,22 @@ set_range_command(ignore, from_tty)
|
||||||
char *ignore;
|
char *ignore;
|
||||||
int from_tty;
|
int from_tty;
|
||||||
{
|
{
|
||||||
if (!strcmp(range,"on"))
|
if (STREQ(range,"on"))
|
||||||
{
|
{
|
||||||
range_check = range_check_on;
|
range_check = range_check_on;
|
||||||
range_mode = range_mode_manual;
|
range_mode = range_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(range,"warn"))
|
else if (STREQ(range,"warn"))
|
||||||
{
|
{
|
||||||
range_check = range_check_warn;
|
range_check = range_check_warn;
|
||||||
range_mode = range_mode_manual;
|
range_mode = range_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(range,"off"))
|
else if (STREQ(range,"off"))
|
||||||
{
|
{
|
||||||
range_check = range_check_off;
|
range_check = range_check_off;
|
||||||
range_mode = range_mode_manual;
|
range_mode = range_mode_manual;
|
||||||
}
|
}
|
||||||
else if (!strcmp(range,"auto"))
|
else if (STREQ(range,"auto"))
|
||||||
{
|
{
|
||||||
range_mode = range_mode_auto;
|
range_mode = range_mode_auto;
|
||||||
set_type_range();
|
set_type_range();
|
||||||
|
@ -762,7 +762,7 @@ value_true(val)
|
||||||
}
|
}
|
||||||
if (i >= len)
|
if (i >= len)
|
||||||
return 0; /* Not a valid BOOLEAN value */
|
return 0; /* Not a valid BOOLEAN value */
|
||||||
if (!strcmp ("TRUE", TYPE_FIELD_NAME(VALUE_TYPE(val), i)))
|
if (STREQ ("TRUE", TYPE_FIELD_NAME(VALUE_TYPE(val), i)))
|
||||||
return 1; /* BOOLEAN with value TRUE */
|
return 1; /* BOOLEAN with value TRUE */
|
||||||
else
|
else
|
||||||
return 0; /* BOOLEAN with value FALSE */
|
return 0; /* BOOLEAN with value FALSE */
|
||||||
|
|
|
@ -631,7 +631,7 @@ variable: NAME
|
||||||
{
|
{
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_type (builtin_type_int);
|
write_exp_elt_type (builtin_type_int);
|
||||||
write_exp_elt_longcst ((LONGEST) msymbol -> address);
|
write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
|
||||||
write_exp_elt_opcode (OP_LONG);
|
write_exp_elt_opcode (OP_LONG);
|
||||||
write_exp_elt_opcode (UNOP_MEMVAL);
|
write_exp_elt_opcode (UNOP_MEMVAL);
|
||||||
if (msymbol -> type == mst_data ||
|
if (msymbol -> type == mst_data ||
|
||||||
|
|
|
@ -757,7 +757,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
|
||||||
|
|
||||||
if (execarg != NULL
|
if (execarg != NULL
|
||||||
&& symarg != NULL
|
&& symarg != NULL
|
||||||
&& strcmp (execarg, symarg) == 0)
|
&& STREQ (execarg, symarg))
|
||||||
{
|
{
|
||||||
/* The exec file and the symbol-file are the same. If we can't open
|
/* The exec file and the symbol-file are the same. If we can't open
|
||||||
it, better only print one error message. */
|
it, better only print one error message. */
|
||||||
|
@ -1767,7 +1767,7 @@ define_command (comname, from_tty)
|
||||||
|
|
||||||
/* Look it up, and verify that we got an exact match. */
|
/* Look it up, and verify that we got an exact match. */
|
||||||
c = lookup_cmd (&tem, cmdlist, "", -1, 1);
|
c = lookup_cmd (&tem, cmdlist, "", -1, 1);
|
||||||
if (c && 0 != strcmp (comname, c->name))
|
if (c && !STREQ (comname, c->name))
|
||||||
c = 0;
|
c = 0;
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
|
@ -1789,7 +1789,7 @@ define_command (comname, from_tty)
|
||||||
/* Look up cmd it hooks, and verify that we got an exact match. */
|
/* Look up cmd it hooks, and verify that we got an exact match. */
|
||||||
tem = comname+HOOK_LEN;
|
tem = comname+HOOK_LEN;
|
||||||
hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
|
hookc = lookup_cmd (&tem, cmdlist, "", -1, 0);
|
||||||
if (hookc && 0 != strcmp (comname+HOOK_LEN, hookc->name))
|
if (hookc && !STREQ (comname+HOOK_LEN, hookc->name))
|
||||||
hookc = 0;
|
hookc = 0;
|
||||||
if (!hookc)
|
if (!hookc)
|
||||||
{
|
{
|
||||||
|
@ -1960,7 +1960,7 @@ pwd_command (args, from_tty)
|
||||||
if (args) error ("The \"pwd\" command does not take an argument: %s", args);
|
if (args) error ("The \"pwd\" command does not take an argument: %s", args);
|
||||||
getcwd (dirbuf, sizeof (dirbuf));
|
getcwd (dirbuf, sizeof (dirbuf));
|
||||||
|
|
||||||
if (strcmp (dirbuf, current_directory))
|
if (!STREQ (dirbuf, current_directory))
|
||||||
printf ("Working directory %s\n (canonically %s).\n",
|
printf ("Working directory %s\n (canonically %s).\n",
|
||||||
current_directory, dirbuf);
|
current_directory, dirbuf);
|
||||||
else
|
else
|
||||||
|
|
171
gdb/minsyms.c
171
gdb/minsyms.c
|
@ -42,6 +42,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
/* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE.
|
/* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE.
|
||||||
At the end, copy them all into one newly allocated location on an objfile's
|
At the end, copy them all into one newly allocated location on an objfile's
|
||||||
|
@ -105,29 +106,32 @@ lookup_minimal_symbol (name, objf)
|
||||||
if (objf == NULL || objf == objfile)
|
if (objf == NULL || objf == objfile)
|
||||||
{
|
{
|
||||||
for (msymbol = objfile -> msymbols;
|
for (msymbol = objfile -> msymbols;
|
||||||
msymbol != NULL && msymbol -> name != NULL &&
|
msymbol != NULL && SYMBOL_NAME (msymbol) != NULL &&
|
||||||
found_symbol == NULL;
|
found_symbol == NULL;
|
||||||
msymbol++)
|
msymbol++)
|
||||||
{
|
{
|
||||||
if (strcmp (msymbol -> name, name) == 0)
|
if (SYMBOL_MATCHES_NAME (msymbol, name))
|
||||||
{
|
{
|
||||||
#ifdef IBM6000_TARGET
|
#ifdef IBM6000_TARGET
|
||||||
/* I *think* all platforms using shared libraries (and trampoline code)
|
/* I *think* all platforms using shared libraries (and
|
||||||
* will suffer this problem. Consider a case where there are 5 shared
|
trampoline code) will suffer this problem. Consider a
|
||||||
* libraries, each referencing `foo' with a trampoline entry. When someone
|
case where there are 5 shared libraries, each referencing
|
||||||
* wants to put a breakpoint on `foo' and the only info we have is minimal
|
`foo' with a trampoline entry. When someone wants to put
|
||||||
* symbol vector, we want to use the real `foo', rather than one of those
|
a breakpoint on `foo' and the only info we have is minimal
|
||||||
* trampoline entries. MGO */
|
symbol vector, we want to use the real `foo', rather than
|
||||||
|
one of those trampoline entries. MGO */
|
||||||
/* If a trampoline symbol is found, we prefer to keep looking
|
/* If a trampoline symbol is found, we prefer to keep looking
|
||||||
for the *real* symbol. If the actual symbol not found,
|
for the *real* symbol. If the actual symbol not found,
|
||||||
then we'll use the trampoline entry. Sorry for the machine
|
then we'll use the trampoline entry. Sorry for the machine
|
||||||
dependent code here, but I hope this will benefit other
|
dependent code here, but I hope this will benefit other
|
||||||
platforms as well. For trampoline entries, we used mst_unknown
|
platforms as well. For trampoline entries, we used
|
||||||
earlier. Perhaps we should define a `mst_trampoline' type?? */
|
mst_unknown earlier. Perhaps we should define a
|
||||||
|
`mst_trampoline' type?? */
|
||||||
|
|
||||||
if (msymbol->type != mst_unknown)
|
if (MSYMBOL_TYPE (msymbol) != mst_unknown)
|
||||||
found_symbol = msymbol;
|
found_symbol = msymbol;
|
||||||
else if (msymbol->type == mst_unknown && !trampoline_symbol)
|
else if (MSYMBOL_TYPE (msymbol) == mst_unknown &&
|
||||||
|
!trampoline_symbol)
|
||||||
trampoline_symbol = msymbol;
|
trampoline_symbol = msymbol;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -197,14 +201,15 @@ lookup_minimal_symbol_by_pc (pc)
|
||||||
Warning: this code is trickier than it would appear at first. */
|
Warning: this code is trickier than it would appear at first. */
|
||||||
|
|
||||||
/* Should also requires that pc is <= end of objfile. FIXME! */
|
/* Should also requires that pc is <= end of objfile. FIXME! */
|
||||||
if (pc >= msymbol[lo].address)
|
if (pc >= SYMBOL_VALUE_ADDRESS (&msymbol[lo]))
|
||||||
{
|
{
|
||||||
while (msymbol[hi].address > pc)
|
while (SYMBOL_VALUE_ADDRESS (&msymbol[hi]) > pc)
|
||||||
{
|
{
|
||||||
/* pc is still strictly less than highest address */
|
/* pc is still strictly less than highest address */
|
||||||
/* Note "new" will always be >= lo */
|
/* Note "new" will always be >= lo */
|
||||||
new = (lo + hi) / 2;
|
new = (lo + hi) / 2;
|
||||||
if ((msymbol[new].address >= pc) || (lo == new))
|
if ((SYMBOL_VALUE_ADDRESS (&msymbol[new]) >= pc) ||
|
||||||
|
(lo == new))
|
||||||
{
|
{
|
||||||
hi = new;
|
hi = new;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +223,8 @@ lookup_minimal_symbol_by_pc (pc)
|
||||||
overall. */
|
overall. */
|
||||||
|
|
||||||
if ((best_symbol == NULL) ||
|
if ((best_symbol == NULL) ||
|
||||||
(best_symbol -> address < msymbol[hi].address))
|
(SYMBOL_VALUE_ADDRESS (best_symbol) <
|
||||||
|
SYMBOL_VALUE_ADDRESS (&msymbol[hi])))
|
||||||
{
|
{
|
||||||
best_symbol = &msymbol[hi];
|
best_symbol = &msymbol[hi];
|
||||||
}
|
}
|
||||||
|
@ -247,6 +253,7 @@ prim_record_minimal_symbol (name, address, ms_type)
|
||||||
enum minimal_symbol_type ms_type;
|
enum minimal_symbol_type ms_type;
|
||||||
{
|
{
|
||||||
register struct msym_bunch *new;
|
register struct msym_bunch *new;
|
||||||
|
register struct minimal_symbol *msymbol;
|
||||||
|
|
||||||
if (msym_bunch_index == BUNCH_SIZE)
|
if (msym_bunch_index == BUNCH_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -255,14 +262,25 @@ prim_record_minimal_symbol (name, address, ms_type)
|
||||||
new -> next = msym_bunch;
|
new -> next = msym_bunch;
|
||||||
msym_bunch = new;
|
msym_bunch = new;
|
||||||
}
|
}
|
||||||
msym_bunch -> contents[msym_bunch_index].name = (char *) name;
|
msymbol = &msym_bunch -> contents[msym_bunch_index];
|
||||||
msym_bunch -> contents[msym_bunch_index].address = address;
|
SYMBOL_NAME (msymbol) = (char *) name;
|
||||||
msym_bunch -> contents[msym_bunch_index].info = NULL;
|
/* Note that SYMBOL_LANGUAGE and SYMBOL_DEMANGLED_NAME are not initialized
|
||||||
msym_bunch -> contents[msym_bunch_index].type = ms_type;
|
to their final values until the minimal symbols are actually added to
|
||||||
|
the minimal symbol table. We just set them to a known state here so
|
||||||
|
random values won't confuse anyone debugging the debugger. */
|
||||||
|
SYMBOL_LANGUAGE (msymbol) = language_unknown;
|
||||||
|
SYMBOL_DEMANGLED_NAME (msymbol) = NULL;
|
||||||
|
SYMBOL_VALUE_ADDRESS (msymbol) = address;
|
||||||
|
MSYMBOL_TYPE (msymbol) = ms_type;
|
||||||
|
/* FIXME: This info, if it remains, needs its own field. */
|
||||||
|
MSYMBOL_INFO (msymbol) = NULL; /* FIXME! */
|
||||||
msym_bunch_index++;
|
msym_bunch_index++;
|
||||||
msym_count++;
|
msym_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: Why don't we just combine this function with the one above
|
||||||
|
and pass it a NULL info pointer value if info is not needed? */
|
||||||
|
|
||||||
void
|
void
|
||||||
prim_record_minimal_symbol_and_info (name, address, ms_type, info)
|
prim_record_minimal_symbol_and_info (name, address, ms_type, info)
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -271,6 +289,7 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info)
|
||||||
char *info;
|
char *info;
|
||||||
{
|
{
|
||||||
register struct msym_bunch *new;
|
register struct msym_bunch *new;
|
||||||
|
register struct minimal_symbol *msymbol;
|
||||||
|
|
||||||
if (msym_bunch_index == BUNCH_SIZE)
|
if (msym_bunch_index == BUNCH_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -279,12 +298,18 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info)
|
||||||
new -> next = msym_bunch;
|
new -> next = msym_bunch;
|
||||||
msym_bunch = new;
|
msym_bunch = new;
|
||||||
}
|
}
|
||||||
msym_bunch -> contents[msym_bunch_index].name = (char *) name;
|
msymbol = &msym_bunch -> contents[msym_bunch_index];
|
||||||
msym_bunch -> contents[msym_bunch_index].address = address;
|
SYMBOL_NAME (msymbol) = (char *) name;
|
||||||
msym_bunch -> contents[msym_bunch_index].info = NULL;
|
/* Note that SYMBOL_LANGUAGE and SYMBOL_DEMANGLED_NAME are not initialized
|
||||||
msym_bunch -> contents[msym_bunch_index].type = ms_type;
|
to their final values until the minimal symbols are actually added to
|
||||||
|
the minimal symbol table. We just set them to a known state here so
|
||||||
|
random values won't confuse anyone debugging the debugger. */
|
||||||
|
SYMBOL_LANGUAGE (msymbol) = language_unknown;
|
||||||
|
SYMBOL_DEMANGLED_NAME (msymbol) = NULL;
|
||||||
|
SYMBOL_VALUE_ADDRESS (msymbol) = address;
|
||||||
|
MSYMBOL_TYPE (msymbol) = ms_type;
|
||||||
/* FIXME: This info, if it remains, needs its own field. */
|
/* FIXME: This info, if it remains, needs its own field. */
|
||||||
msym_bunch -> contents[msym_bunch_index].info = info; /* FIXME! */
|
MSYMBOL_INFO (msymbol) = info; /* FIXME! */
|
||||||
msym_bunch_index++;
|
msym_bunch_index++;
|
||||||
msym_count++;
|
msym_count++;
|
||||||
}
|
}
|
||||||
|
@ -303,11 +328,11 @@ compare_minimal_symbols (fn1p, fn2p)
|
||||||
fn1 = (const struct minimal_symbol *) fn1p;
|
fn1 = (const struct minimal_symbol *) fn1p;
|
||||||
fn2 = (const struct minimal_symbol *) fn2p;
|
fn2 = (const struct minimal_symbol *) fn2p;
|
||||||
|
|
||||||
if (fn1 -> address < fn2 -> address)
|
if (SYMBOL_VALUE_ADDRESS (fn1) < SYMBOL_VALUE_ADDRESS (fn2))
|
||||||
{
|
{
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else if (fn1 -> address > fn2 -> address)
|
else if (SYMBOL_VALUE_ADDRESS (fn1) > SYMBOL_VALUE_ADDRESS (fn2))
|
||||||
{
|
{
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -389,12 +414,13 @@ compact_minimal_symbols (msymbol, mcount)
|
||||||
copyfrom = copyto = msymbol;
|
copyfrom = copyto = msymbol;
|
||||||
while (copyfrom < msymbol + mcount - 1)
|
while (copyfrom < msymbol + mcount - 1)
|
||||||
{
|
{
|
||||||
if (copyfrom -> address == (copyfrom + 1) -> address
|
if (SYMBOL_VALUE_ADDRESS (copyfrom) ==
|
||||||
&& (strcmp (copyfrom -> name, (copyfrom + 1) -> name) == 0))
|
SYMBOL_VALUE_ADDRESS ((copyfrom + 1)) &&
|
||||||
|
(STREQ (SYMBOL_NAME (copyfrom), SYMBOL_NAME ((copyfrom + 1)))))
|
||||||
{
|
{
|
||||||
if ((copyfrom + 1) -> type == mst_unknown)
|
if (MSYMBOL_TYPE((copyfrom + 1)) == mst_unknown)
|
||||||
{
|
{
|
||||||
(copyfrom + 1) -> type = copyfrom -> type;
|
MSYMBOL_TYPE ((copyfrom + 1)) = MSYMBOL_TYPE (copyfrom);
|
||||||
}
|
}
|
||||||
copyfrom++;
|
copyfrom++;
|
||||||
}
|
}
|
||||||
|
@ -409,11 +435,28 @@ compact_minimal_symbols (msymbol, mcount)
|
||||||
return (mcount);
|
return (mcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the minimal symbols in the existing bunches to the objfile's
|
/* Add the minimal symbols in the existing bunches to the objfile's official
|
||||||
official minimal symbol table. 99% of the time, this adds the
|
minimal symbol table. In most cases there is no minimal symbol table yet
|
||||||
bunches to NO existing symbols. Once in a while for shared
|
for this objfile, and the existing bunches are used to create one. Once
|
||||||
libraries, we add symbols (e.g. common symbols) to an existing
|
in a while (for shared libraries for example), we add symbols (e.g. common
|
||||||
objfile. */
|
symbols) to an existing objfile.
|
||||||
|
|
||||||
|
Because of the way minimal symbols are collected, we generally have no way
|
||||||
|
of knowing what source language applies to any particular minimal symbol.
|
||||||
|
Specifically, we have no way of knowing if the minimal symbol comes from a
|
||||||
|
C++ compilation unit or not. So for the sake of supporting cached
|
||||||
|
demangled C++ names, we have no choice but to try and demangle each new one
|
||||||
|
that comes in. If the demangling succeeds, then we assume it is a C++
|
||||||
|
symbol and set the symbol's language and demangled name fields
|
||||||
|
appropriately. Note that in order to avoid unnecessary demanglings, and
|
||||||
|
allocating obstack space that subsequently can't be freed for the demangled
|
||||||
|
names, we mark all newly added symbols with language_auto. After
|
||||||
|
compaction of the minimal symbols, we go back and scan the entire minimal
|
||||||
|
symbol table looking for these new symbols. For each new symbol we attempt
|
||||||
|
to demangle it, and if successful, record it as a language_cplus symbol
|
||||||
|
and cache the demangled form on the symbol obstack. Symbols which don't
|
||||||
|
demangle are marked as language_unknown symbols, which inhibits future
|
||||||
|
attempts to demangle them if we later add more minimal symbols. */
|
||||||
|
|
||||||
void
|
void
|
||||||
install_minimal_symbols (objfile)
|
install_minimal_symbols (objfile)
|
||||||
|
@ -425,6 +468,7 @@ install_minimal_symbols (objfile)
|
||||||
register struct minimal_symbol *msymbols;
|
register struct minimal_symbol *msymbols;
|
||||||
int alloc_count;
|
int alloc_count;
|
||||||
register char leading_char;
|
register char leading_char;
|
||||||
|
char *demangled_name;
|
||||||
|
|
||||||
if (msym_count > 0)
|
if (msym_count > 0)
|
||||||
{
|
{
|
||||||
|
@ -459,9 +503,10 @@ install_minimal_symbols (objfile)
|
||||||
for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++)
|
for (bindex = 0; bindex < msym_bunch_index; bindex++, mcount++)
|
||||||
{
|
{
|
||||||
msymbols[mcount] = bunch -> contents[bindex];
|
msymbols[mcount] = bunch -> contents[bindex];
|
||||||
if (msymbols[mcount].name[0] == leading_char)
|
SYMBOL_LANGUAGE (&msymbols[mcount]) = language_auto;
|
||||||
|
if (SYMBOL_NAME (&msymbols[mcount])[0] == leading_char)
|
||||||
{
|
{
|
||||||
msymbols[mcount].name++;
|
SYMBOL_NAME(&msymbols[mcount])++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msym_bunch_index = BUNCH_SIZE;
|
msym_bunch_index = BUNCH_SIZE;
|
||||||
|
@ -482,19 +527,20 @@ install_minimal_symbols (objfile)
|
||||||
msymbols = (struct minimal_symbol *)
|
msymbols = (struct minimal_symbol *)
|
||||||
obstack_finish (&objfile->symbol_obstack);
|
obstack_finish (&objfile->symbol_obstack);
|
||||||
|
|
||||||
/* We also terminate the minimal symbol table
|
/* We also terminate the minimal symbol table with a "null symbol",
|
||||||
with a "null symbol", which is *not* included in the size of
|
which is *not* included in the size of the table. This makes it
|
||||||
the table. This makes it easier to find the end of the table
|
easier to find the end of the table when we are handed a pointer
|
||||||
when we are handed a pointer to some symbol in the middle of it.
|
to some symbol in the middle of it. Zero out the fields in the
|
||||||
Zero out the fields in the "null symbol" allocated at the end
|
"null symbol" allocated at the end of the array. Note that the
|
||||||
of the array. Note that the symbol count does *not* include
|
symbol count does *not* include this null symbol, which is why it
|
||||||
this null symbol, which is why it is indexed by mcount and not
|
is indexed by mcount and not mcount-1. */
|
||||||
mcount-1. */
|
|
||||||
|
|
||||||
msymbols[mcount].name = NULL;
|
SYMBOL_NAME (&msymbols[mcount]) = NULL;
|
||||||
msymbols[mcount].address = 0;
|
SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0;
|
||||||
msymbols[mcount].info = NULL;
|
MSYMBOL_INFO (&msymbols[mcount]) = NULL;
|
||||||
msymbols[mcount].type = mst_unknown;
|
MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
|
||||||
|
SYMBOL_LANGUAGE (&msymbols[mcount]) = language_unknown;
|
||||||
|
SYMBOL_DEMANGLED_NAME (&msymbols[mcount]) = NULL;
|
||||||
|
|
||||||
/* Attach the minimal symbol table to the specified objfile.
|
/* Attach the minimal symbol table to the specified objfile.
|
||||||
The strings themselves are also located in the symbol_obstack
|
The strings themselves are also located in the symbol_obstack
|
||||||
|
@ -502,6 +548,31 @@ install_minimal_symbols (objfile)
|
||||||
|
|
||||||
objfile -> minimal_symbol_count = mcount;
|
objfile -> minimal_symbol_count = mcount;
|
||||||
objfile -> msymbols = msymbols;
|
objfile -> msymbols = msymbols;
|
||||||
|
|
||||||
|
/* Now walk through all the minimal symbols, selecting the newly added
|
||||||
|
ones and attempting to cache their C++ demangled names. */
|
||||||
|
|
||||||
|
for ( ; mcount-- > 0 ; msymbols++)
|
||||||
|
{
|
||||||
|
if (SYMBOL_LANGUAGE (msymbols) == language_auto)
|
||||||
|
{
|
||||||
|
demangled_name = cplus_demangle (SYMBOL_NAME (msymbols),
|
||||||
|
DMGL_PARAMS | DMGL_ANSI);
|
||||||
|
if (demangled_name == NULL)
|
||||||
|
{
|
||||||
|
SYMBOL_LANGUAGE (msymbols) = language_unknown;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SYMBOL_LANGUAGE (msymbols) = language_cplus;
|
||||||
|
SYMBOL_DEMANGLED_NAME (msymbols) =
|
||||||
|
obsavestring (demangled_name, strlen (demangled_name),
|
||||||
|
&objfile->symbol_obstack);
|
||||||
|
|
||||||
|
free (demangled_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ have_minimal_symbols PARAMS ((void));
|
||||||
/* Traverse all minimal symbols in one objfile. */
|
/* Traverse all minimal symbols in one objfile. */
|
||||||
|
|
||||||
#define ALL_OBJFILE_MSYMBOLS(objfile, m) \
|
#define ALL_OBJFILE_MSYMBOLS(objfile, m) \
|
||||||
for ((m) = (objfile) -> msymbols; (m)->name != NULL; (m)++)
|
for ((m) = (objfile) -> msymbols; SYMBOL_NAME(m) != NULL; (m)++)
|
||||||
|
|
||||||
|
|
||||||
/* Traverse all symtabs in all objfiles. */
|
/* Traverse all symtabs in all objfiles. */
|
||||||
|
|
|
@ -80,7 +80,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
&& namestring [nsl - 2] == '.')
|
&& namestring [nsl - 2] == '.')
|
||||||
#ifdef GDB_TARGET_IS_HPPA
|
#ifdef GDB_TARGET_IS_HPPA
|
||||||
/* some cooperation from gcc to get around ld stupidity */
|
/* some cooperation from gcc to get around ld stupidity */
|
||||||
|| (namestring[0] == 'e' && !strcmp (namestring, "end_file."))
|
|| (namestring[0] == 'e' && STREQ (namestring, "end_file."))
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
Record it even if it's local, not global, so we can find it.
|
Record it even if it's local, not global, so we can find it.
|
||||||
FIXME: this might want to check for _DYNAMIC and the current
|
FIXME: this might want to check for _DYNAMIC and the current
|
||||||
symbol_leading_char. */
|
symbol_leading_char. */
|
||||||
if (namestring[8] == 'C' && !strcmp ("__DYNAMIC", namestring))
|
if (namestring[8] == 'C' && STREQ ("__DYNAMIC", namestring))
|
||||||
goto record_it;
|
goto record_it;
|
||||||
|
|
||||||
/* Same with virtual function tables, both global and static. */
|
/* Same with virtual function tables, both global and static. */
|
||||||
|
@ -297,12 +297,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
things like "break c-exp.y:435" need to work (I
|
things like "break c-exp.y:435" need to work (I
|
||||||
suppose the psymtab_include_list could be hashed or put
|
suppose the psymtab_include_list could be hashed or put
|
||||||
in a binary tree, if profiling shows this is a major hog). */
|
in a binary tree, if profiling shows this is a major hog). */
|
||||||
if (pst && !strcmp (namestring, pst->filename))
|
if (pst && STREQ (namestring, pst->filename))
|
||||||
continue;
|
continue;
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
for (i = 0; i < includes_used; i++)
|
for (i = 0; i < includes_used; i++)
|
||||||
if (!strcmp (namestring, psymtab_include_list[i]))
|
if (STREQ (namestring, psymtab_include_list[i]))
|
||||||
{
|
{
|
||||||
i = -1;
|
i = -1;
|
||||||
break;
|
break;
|
||||||
|
@ -345,13 +345,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
{
|
{
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
STRUCT_NAMESPACE, LOC_TYPEDEF,
|
STRUCT_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols,
|
||||||
|
CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
if (p[2] == 't')
|
if (p[2] == 't')
|
||||||
{
|
{
|
||||||
/* Also a typedef with the same name. */
|
/* Also a typedef with the same name. */
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_TYPEDEF,
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols,
|
||||||
|
CUR_SYMBOL_VALUE, psymtab_language,
|
||||||
|
objfile);
|
||||||
p += 1;
|
p += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,7 +365,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
{
|
{
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_TYPEDEF,
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols,
|
||||||
|
CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
}
|
}
|
||||||
check_enum:
|
check_enum:
|
||||||
/* If this is an enumerated type, we need to
|
/* If this is an enumerated type, we need to
|
||||||
|
@ -411,7 +417,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
enum constants in psymtabs, just in symtabs. */
|
enum constants in psymtabs, just in symtabs. */
|
||||||
ADD_PSYMBOL_TO_LIST (p, q - p,
|
ADD_PSYMBOL_TO_LIST (p, q - p,
|
||||||
VAR_NAMESPACE, LOC_CONST,
|
VAR_NAMESPACE, LOC_CONST,
|
||||||
objfile->static_psymbols, 0);
|
objfile->static_psymbols, 0,
|
||||||
|
psymtab_language, objfile);
|
||||||
/* Point past the name. */
|
/* Point past the name. */
|
||||||
p = q;
|
p = q;
|
||||||
/* Skip over the value. */
|
/* Skip over the value. */
|
||||||
|
@ -427,7 +434,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
/* Constant, e.g. from "const" in Pascal. */
|
/* Constant, e.g. from "const" in Pascal. */
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_CONST,
|
VAR_NAMESPACE, LOC_CONST,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols, CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
/* Skip if the thing following the : is
|
/* Skip if the thing following the : is
|
||||||
|
@ -468,13 +476,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
case 'c':
|
case 'c':
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_CONST,
|
VAR_NAMESPACE, LOC_CONST,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols, CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
case 'S':
|
case 'S':
|
||||||
CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_DATA);
|
CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_DATA);
|
||||||
ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_STATIC,
|
VAR_NAMESPACE, LOC_STATIC,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols,
|
||||||
|
CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
case 'G':
|
case 'G':
|
||||||
CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_DATA);
|
CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_DATA);
|
||||||
|
@ -482,13 +493,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
wrong. See the code that reads 'G's for symtabs. */
|
wrong. See the code that reads 'G's for symtabs. */
|
||||||
ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_ADDR_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_STATIC,
|
VAR_NAMESPACE, LOC_STATIC,
|
||||||
objfile->global_psymbols, CUR_SYMBOL_VALUE);
|
objfile->global_psymbols,
|
||||||
|
CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_TYPEDEF,
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols, CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
|
@ -505,7 +519,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#endif /* DBXREAD_ONLY */
|
#endif /* DBXREAD_ONLY */
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_BLOCK,
|
VAR_NAMESPACE, LOC_BLOCK,
|
||||||
objfile->static_psymbols, CUR_SYMBOL_VALUE);
|
objfile->static_psymbols, CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Global functions were ignored here, but now they
|
/* Global functions were ignored here, but now they
|
||||||
|
@ -527,7 +542,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#endif /* DBXREAD_ONLY */
|
#endif /* DBXREAD_ONLY */
|
||||||
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
ADD_PSYMBOL_TO_LIST (namestring, p - namestring,
|
||||||
VAR_NAMESPACE, LOC_BLOCK,
|
VAR_NAMESPACE, LOC_BLOCK,
|
||||||
objfile->global_psymbols, CUR_SYMBOL_VALUE);
|
objfile->global_psymbols, CUR_SYMBOL_VALUE,
|
||||||
|
psymtab_language, objfile);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Two things show up here (hopefully); static symbols of
|
/* Two things show up here (hopefully); static symbols of
|
||||||
|
|
|
@ -549,7 +549,8 @@ set_next_address (addr)
|
||||||
after LEADIN. Print nothing if no symbolic name is found nearby.
|
after LEADIN. Print nothing if no symbolic name is found nearby.
|
||||||
DO_DEMANGLE controls whether to print a symbol in its native "raw" form,
|
DO_DEMANGLE controls whether to print a symbol in its native "raw" form,
|
||||||
or to interpret it as a possible C++ name and convert it back to source
|
or to interpret it as a possible C++ name and convert it back to source
|
||||||
form. */
|
form. However note that DO_DEMANGLE can be overridden by the specific
|
||||||
|
settings of the demangle and asm_demangle variables. */
|
||||||
|
|
||||||
void
|
void
|
||||||
print_address_symbolic (addr, stream, do_demangle, leadin)
|
print_address_symbolic (addr, stream, do_demangle, leadin)
|
||||||
|
@ -569,10 +570,10 @@ print_address_symbolic (addr, stream, do_demangle, leadin)
|
||||||
fputs_filtered (leadin, stream);
|
fputs_filtered (leadin, stream);
|
||||||
fputs_filtered ("<", stream);
|
fputs_filtered ("<", stream);
|
||||||
if (do_demangle)
|
if (do_demangle)
|
||||||
fputs_demangled (msymbol -> name, stream, DMGL_ANSI | DMGL_PARAMS);
|
fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
|
||||||
else
|
else
|
||||||
fputs_filtered (msymbol -> name, stream);
|
fputs_filtered (SYMBOL_LINKAGE_NAME (msymbol), stream);
|
||||||
name_location = msymbol -> address;
|
name_location = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
if (addr - name_location)
|
if (addr - name_location)
|
||||||
fprintf_filtered (stream, "+%d>", addr - name_location);
|
fprintf_filtered (stream, "+%d>", addr - name_location);
|
||||||
else
|
else
|
||||||
|
@ -876,7 +877,7 @@ address_info (exp, from_tty)
|
||||||
|
|
||||||
sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE,
|
sym = lookup_symbol (exp, get_selected_block (), VAR_NAMESPACE,
|
||||||
&is_a_field_of_this, (struct symtab **)NULL);
|
&is_a_field_of_this, (struct symtab **)NULL);
|
||||||
if (sym == 0)
|
if (sym == NULL)
|
||||||
{
|
{
|
||||||
if (is_a_field_of_this)
|
if (is_a_field_of_this)
|
||||||
{
|
{
|
||||||
|
@ -888,7 +889,7 @@ address_info (exp, from_tty)
|
||||||
|
|
||||||
if (msymbol != NULL)
|
if (msymbol != NULL)
|
||||||
printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
|
printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
|
||||||
exp, local_hex_string(msymbol -> address));
|
exp, local_hex_string(SYMBOL_VALUE_ADDRESS (msymbol)));
|
||||||
else
|
else
|
||||||
error ("No symbol \"%s\" in current context.", exp);
|
error ("No symbol \"%s\" in current context.", exp);
|
||||||
return;
|
return;
|
||||||
|
@ -1503,7 +1504,7 @@ print_frame_args (func, fi, num, stream)
|
||||||
if (! first)
|
if (! first)
|
||||||
fprintf_filtered (stream, ", ");
|
fprintf_filtered (stream, ", ");
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
fprint_symbol (stream, SYMBOL_NAME (sym));
|
fprint_symbol (stream, SYMBOL_SOURCE_NAME (sym));
|
||||||
fputs_filtered ("=", stream);
|
fputs_filtered ("=", stream);
|
||||||
|
|
||||||
/* Avoid value_print because it will deref ref parameters. We just
|
/* Avoid value_print because it will deref ref parameters. We just
|
||||||
|
|
|
@ -595,7 +595,7 @@ damn_b (rate)
|
||||||
|
|
||||||
for (i = 0; baudtab[i].rate != 0; i++)
|
for (i = 0; baudtab[i].rate != 0; i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (rate, baudtab[i].rate))
|
if (STREQ (rate, baudtab[i].rate))
|
||||||
{
|
{
|
||||||
return (baudtab[i].damn_b);
|
return (baudtab[i].damn_b);
|
||||||
}
|
}
|
||||||
|
@ -1307,7 +1307,7 @@ verify_break (vec)
|
||||||
{
|
{
|
||||||
memory_error (status, memaddress);
|
memory_error (status, memaddress);
|
||||||
}
|
}
|
||||||
return (strcmp (instr, buf));
|
return (STRCMP (instr, buf));
|
||||||
}
|
}
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,7 +921,7 @@ nindy_before_main_loop ()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
*p2= '\0';
|
*p2= '\0';
|
||||||
if ( !strcmp("quit",p) ){
|
if ( STREQ("quit",p) ){
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1035,9 +1035,9 @@ download(load_arg_string, from_tty)
|
||||||
{
|
{
|
||||||
token++;
|
token++;
|
||||||
|
|
||||||
if (strcmp (token, "ms") == 0)
|
if (STREQ (token, "ms"))
|
||||||
stack_sizes[1] = atol (strtok (NULL, " \t"));
|
stack_sizes[1] = atol (strtok (NULL, " \t"));
|
||||||
else if (strcmp (token, "rs") == 0)
|
else if (STREQ (token, "rs"))
|
||||||
stack_sizes[0] = atol (strtok (NULL, " \t"));
|
stack_sizes[0] = atol (strtok (NULL, " \t"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1094,13 +1094,13 @@ download(load_arg_string, from_tty)
|
||||||
const char *section_name;
|
const char *section_name;
|
||||||
|
|
||||||
section_name = bfd_get_section_name (pbfd, section);
|
section_name = bfd_get_section_name (pbfd, section);
|
||||||
if (strcmp (section_name, ".text") == 0 && !load_text)
|
if (STREQ (section_name, ".text") && !load_text)
|
||||||
continue;
|
continue;
|
||||||
else if (strcmp (section_name, ".data") == 0 && !load_data)
|
else if (STREQ (section_name, ".data") && !load_data)
|
||||||
continue;
|
continue;
|
||||||
else if (strcmp (section_name, ".bss") == 0 && !load_bss)
|
else if (STREQ (section_name, ".bss") && !load_bss)
|
||||||
continue;
|
continue;
|
||||||
else if (strcmp (section_name, ".lit") == 0 && !load_lit)
|
else if (STREQ (section_name, ".lit") && !load_lit)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
To.Offset = bfd_get_section_vma (pbfd, section);
|
To.Offset = bfd_get_section_vma (pbfd, section);
|
||||||
|
|
|
@ -276,7 +276,7 @@ CORE_ADDR pc;
|
||||||
function as well. */
|
function as well. */
|
||||||
|
|
||||||
tmp = find_pc_misc_function (pc);
|
tmp = find_pc_misc_function (pc);
|
||||||
if (tmp >= 0 && !strcmp (misc_function_vector [tmp].name, "main"))
|
if (tmp >= 0 && STREQ (misc_function_vector [tmp].name, "main"))
|
||||||
return pc + 8;
|
return pc + 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
gdb/solib.c
12
gdb/solib.c
|
@ -233,7 +233,7 @@ solib_map_sections (so)
|
||||||
p -> addr += (CORE_ADDR) LM_ADDR (so);
|
p -> addr += (CORE_ADDR) LM_ADDR (so);
|
||||||
p -> endaddr += (CORE_ADDR) LM_ADDR (so);
|
p -> endaddr += (CORE_ADDR) LM_ADDR (so);
|
||||||
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
|
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
|
||||||
if (strcmp (p -> sec_ptr -> name, ".text") == 0)
|
if (STREQ (p -> sec_ptr -> name, ".text"))
|
||||||
{
|
{
|
||||||
so -> textsection = p;
|
so -> textsection = p;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ bfd_lookup_symbol (abfd, symname)
|
||||||
for (i = 0; i < number_of_symbols; i++)
|
for (i = 0; i < number_of_symbols; i++)
|
||||||
{
|
{
|
||||||
sym = *symbol_table++;
|
sym = *symbol_table++;
|
||||||
if (strcmp (sym -> name, symname) == 0)
|
if (STREQ (sym -> name, symname))
|
||||||
{
|
{
|
||||||
symaddr = sym -> value;
|
symaddr = sym -> value;
|
||||||
break;
|
break;
|
||||||
|
@ -516,9 +516,9 @@ locate_base ()
|
||||||
library. We don't want the shared library versions. */
|
library. We don't want the shared library versions. */
|
||||||
|
|
||||||
msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
|
msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
|
||||||
if ((msymbol != NULL) && (msymbol -> address != 0))
|
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
||||||
{
|
{
|
||||||
address = msymbol -> address;
|
address = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
}
|
}
|
||||||
return (address);
|
return (address);
|
||||||
|
|
||||||
|
@ -1056,9 +1056,9 @@ enable_break ()
|
||||||
struct minimal_symbol *msymbol;
|
struct minimal_symbol *msymbol;
|
||||||
|
|
||||||
msymbol = lookup_minimal_symbol ("main", symfile_objfile);
|
msymbol = lookup_minimal_symbol ("main", symfile_objfile);
|
||||||
if ((msymbol != NULL) && (msymbol -> address != 0))
|
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
||||||
{
|
{
|
||||||
breakpoint_addr = msymbol -> address;
|
breakpoint_addr = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
10
gdb/source.c
10
gdb/source.c
|
@ -154,7 +154,7 @@ select_source_symtab (s)
|
||||||
{
|
{
|
||||||
char *name = s -> filename;
|
char *name = s -> filename;
|
||||||
int len = strlen (name);
|
int len = strlen (name);
|
||||||
if (! (len > 2 && (strcmp (&name[len - 2], ".h") == 0)))
|
if (! (len > 2 && (STREQ (&name[len - 2], ".h"))))
|
||||||
{
|
{
|
||||||
current_source_symtab = s;
|
current_source_symtab = s;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ select_source_symtab (s)
|
||||||
{
|
{
|
||||||
char *name = ps -> filename;
|
char *name = ps -> filename;
|
||||||
int len = strlen (name);
|
int len = strlen (name);
|
||||||
if (! (len > 2 && (strcmp (&name[len - 2], ".h") == 0)))
|
if (! (len > 2 && (STREQ (&name[len - 2], ".h"))))
|
||||||
{
|
{
|
||||||
cs_pst = ps;
|
cs_pst = ps;
|
||||||
}
|
}
|
||||||
|
@ -910,7 +910,7 @@ list_command (arg, from_tty)
|
||||||
|
|
||||||
/* "l" or "l +" lists next ten lines. */
|
/* "l" or "l +" lists next ten lines. */
|
||||||
|
|
||||||
if (arg == 0 || !strcmp (arg, "+"))
|
if (arg == 0 || STREQ (arg, "+"))
|
||||||
{
|
{
|
||||||
if (current_source_symtab == 0)
|
if (current_source_symtab == 0)
|
||||||
error ("No default source file yet. Do \"help list\".");
|
error ("No default source file yet. Do \"help list\".");
|
||||||
|
@ -920,7 +920,7 @@ list_command (arg, from_tty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "l -" lists previous ten lines, the ones before the ten just listed. */
|
/* "l -" lists previous ten lines, the ones before the ten just listed. */
|
||||||
if (!strcmp (arg, "-"))
|
if (STREQ (arg, "-"))
|
||||||
{
|
{
|
||||||
if (current_source_symtab == 0)
|
if (current_source_symtab == 0)
|
||||||
error ("No default source file yet. Do \"help list\".");
|
error ("No default source file yet. Do \"help list\".");
|
||||||
|
@ -1010,7 +1010,7 @@ list_command (arg, from_tty)
|
||||||
if (sym)
|
if (sym)
|
||||||
{
|
{
|
||||||
printf_filtered ("%s is in ", local_hex_string(sal.pc));
|
printf_filtered ("%s is in ", local_hex_string(sal.pc));
|
||||||
fprint_symbol (stdout, SYMBOL_NAME (sym));
|
fputs_filtered (SYMBOL_SOURCE_NAME (sym), stdout);
|
||||||
printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
|
printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -433,7 +433,7 @@ compare_opcodes (a, b)
|
||||||
|
|
||||||
/* Except for aliases, two "identical" instructions had
|
/* Except for aliases, two "identical" instructions had
|
||||||
better have the same opcode. This is a sanity check on the table. */
|
better have the same opcode. This is a sanity check on the table. */
|
||||||
i = strcmp (op0->name, op1->name);
|
i = STRCMP (op0->name, op1->name);
|
||||||
if (i)
|
if (i)
|
||||||
if (op0->flags & F_ALIAS) /* If they're both aliases, be arbitrary. */
|
if (op0->flags & F_ALIAS) /* If they're both aliases, be arbitrary. */
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -34,6 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native */
|
#include "aout/stab_gnu.h" /* We always use GNU stabs, not native */
|
||||||
#include "buildsym.h"
|
#include "buildsym.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
/* Ask stabsread.h to define the vars it normally declares `extern'. */
|
/* Ask stabsread.h to define the vars it normally declares `extern'. */
|
||||||
#define EXTERN /**/
|
#define EXTERN /**/
|
||||||
|
@ -491,9 +492,12 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
normal:
|
normal:
|
||||||
|
SYMBOL_LANGUAGE (sym) = current_subfile -> language;
|
||||||
SYMBOL_NAME (sym) = (char *)
|
SYMBOL_NAME (sym) = (char *)
|
||||||
obstack_alloc (&objfile -> symbol_obstack, ((p - string) + 1));
|
obstack_alloc (&objfile -> symbol_obstack, ((p - string) + 1));
|
||||||
/* Open-coded bcopy--saves function call time. */
|
/* Open-coded bcopy--saves function call time. */
|
||||||
|
/* FIXME: Does it really? Try replacing with simple strcpy and
|
||||||
|
try it on an executable with a large symbol table. */
|
||||||
{
|
{
|
||||||
register char *p1 = string;
|
register char *p1 = string;
|
||||||
register char *p2 = SYMBOL_NAME (sym);
|
register char *p2 = SYMBOL_NAME (sym);
|
||||||
|
@ -503,6 +507,24 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
}
|
}
|
||||||
*p2++ = '\0';
|
*p2++ = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this symbol is from a C++ compilation, then attempt to cache the
|
||||||
|
demangled form for future reference. This is a typical time versus
|
||||||
|
space tradeoff, that was decided in favor of time because it sped up
|
||||||
|
C++ symbol lookups by a factor of about 20. */
|
||||||
|
|
||||||
|
if (SYMBOL_LANGUAGE (sym) == language_cplus)
|
||||||
|
{
|
||||||
|
char *demangled =
|
||||||
|
cplus_demangle (SYMBOL_NAME (sym), DMGL_PARAMS | DMGL_ANSI);
|
||||||
|
if (demangled != NULL)
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (sym) =
|
||||||
|
obsavestring (demangled, strlen (demangled),
|
||||||
|
&objfile -> symbol_obstack);
|
||||||
|
free (demangled);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
|
@ -785,7 +807,7 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
|
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
|
||||||
if (SYMBOL_VALUE (sym) >= NUM_REGS)
|
if (SYMBOL_VALUE (sym) >= NUM_REGS)
|
||||||
{
|
{
|
||||||
complain (®_value_complaint, SYMBOL_NAME (sym));
|
complain (®_value_complaint, SYMBOL_SOURCE_NAME (sym));
|
||||||
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
|
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
|
||||||
}
|
}
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
|
@ -799,7 +821,7 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
|
SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu);
|
||||||
if (SYMBOL_VALUE (sym) >= NUM_REGS)
|
if (SYMBOL_VALUE (sym) >= NUM_REGS)
|
||||||
{
|
{
|
||||||
complain (®_value_complaint, SYMBOL_NAME (sym));
|
complain (®_value_complaint, SYMBOL_SOURCE_NAME (sym));
|
||||||
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
|
SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */
|
||||||
}
|
}
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
|
@ -864,12 +886,10 @@ define_symbol (valu, string, desc, type, objfile)
|
||||||
|
|
||||||
if (synonym)
|
if (synonym)
|
||||||
{
|
{
|
||||||
|
/* Clone the sym and then modify it. */
|
||||||
register struct symbol *typedef_sym = (struct symbol *)
|
register struct symbol *typedef_sym = (struct symbol *)
|
||||||
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
|
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
|
||||||
memset (typedef_sym, 0, sizeof (struct symbol));
|
*typedef_sym = *sym;
|
||||||
SYMBOL_NAME (typedef_sym) = SYMBOL_NAME (sym);
|
|
||||||
SYMBOL_TYPE (typedef_sym) = SYMBOL_TYPE (sym);
|
|
||||||
|
|
||||||
SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF;
|
SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF;
|
||||||
SYMBOL_VALUE (typedef_sym) = valu;
|
SYMBOL_VALUE (typedef_sym) = valu;
|
||||||
SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
|
||||||
|
@ -1121,7 +1141,7 @@ read_type (pp, objfile)
|
||||||
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
|
||||||
&& SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
|
&& SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
|
||||||
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
|
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
|
||||||
&& !strcmp (SYMBOL_NAME (sym), type_name_only))
|
&& STREQ (SYMBOL_NAME (sym), type_name_only))
|
||||||
{
|
{
|
||||||
obstack_free (&objfile -> type_obstack, type_name);
|
obstack_free (&objfile -> type_obstack, type_name);
|
||||||
type = SYMBOL_TYPE (sym);
|
type = SYMBOL_TYPE (sym);
|
||||||
|
@ -2435,6 +2455,7 @@ read_enum_type (pp, type, objfile)
|
||||||
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
|
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
|
||||||
memset (sym, 0, sizeof (struct symbol));
|
memset (sym, 0, sizeof (struct symbol));
|
||||||
SYMBOL_NAME (sym) = name;
|
SYMBOL_NAME (sym) = name;
|
||||||
|
SYMBOL_LANGUAGE (sym) = current_subfile -> language;
|
||||||
SYMBOL_CLASS (sym) = LOC_CONST;
|
SYMBOL_CLASS (sym) = LOC_CONST;
|
||||||
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
||||||
SYMBOL_VALUE (sym) = n;
|
SYMBOL_VALUE (sym) = n;
|
||||||
|
@ -2485,10 +2506,10 @@ read_enum_type (pp, type, objfile)
|
||||||
/* This screws up perfectly good C programs with enums. FIXME. */
|
/* This screws up perfectly good C programs with enums. FIXME. */
|
||||||
/* Is this Modula-2's BOOLEAN type? Flag it as such if so. */
|
/* Is this Modula-2's BOOLEAN type? Flag it as such if so. */
|
||||||
if(TYPE_NFIELDS(type) == 2 &&
|
if(TYPE_NFIELDS(type) == 2 &&
|
||||||
((!strcmp(TYPE_FIELD_NAME(type,0),"TRUE") &&
|
((STREQ(TYPE_FIELD_NAME(type,0),"TRUE") &&
|
||||||
!strcmp(TYPE_FIELD_NAME(type,1),"FALSE")) ||
|
STREQ(TYPE_FIELD_NAME(type,1),"FALSE")) ||
|
||||||
(!strcmp(TYPE_FIELD_NAME(type,1),"TRUE") &&
|
(STREQ(TYPE_FIELD_NAME(type,1),"TRUE") &&
|
||||||
!strcmp(TYPE_FIELD_NAME(type,0),"FALSE"))))
|
STREQ(TYPE_FIELD_NAME(type,0),"FALSE"))))
|
||||||
TYPE_CODE(type) = TYPE_CODE_BOOL;
|
TYPE_CODE(type) = TYPE_CODE_BOOL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3090,7 +3111,7 @@ cleanup_undefined_types ()
|
||||||
&& SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
|
&& SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
|
||||||
&& (TYPE_CODE (SYMBOL_TYPE (sym)) ==
|
&& (TYPE_CODE (SYMBOL_TYPE (sym)) ==
|
||||||
TYPE_CODE (*type))
|
TYPE_CODE (*type))
|
||||||
&& !strcmp (SYMBOL_NAME (sym), typename))
|
&& STREQ (SYMBOL_NAME (sym), typename))
|
||||||
{
|
{
|
||||||
memcpy (*type, SYMBOL_TYPE (sym),
|
memcpy (*type, SYMBOL_TYPE (sym),
|
||||||
sizeof (struct type));
|
sizeof (struct type));
|
||||||
|
@ -3147,7 +3168,7 @@ scan_file_globals (objfile)
|
||||||
if (objfile->msymbols == 0) /* Beware the null file. */
|
if (objfile->msymbols == 0) /* Beware the null file. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (msymbol = objfile -> msymbols; msymbol -> name != NULL; msymbol++)
|
for (msymbol = objfile -> msymbols; SYMBOL_NAME (msymbol) != NULL; msymbol++)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
|
@ -3156,12 +3177,12 @@ scan_file_globals (objfile)
|
||||||
/* Get the hash index and check all the symbols
|
/* Get the hash index and check all the symbols
|
||||||
under that hash index. */
|
under that hash index. */
|
||||||
|
|
||||||
hash = hashname (msymbol -> name);
|
hash = hashname (SYMBOL_NAME (msymbol));
|
||||||
|
|
||||||
for (sym = global_sym_chain[hash]; sym;)
|
for (sym = global_sym_chain[hash]; sym;)
|
||||||
{
|
{
|
||||||
if (*(msymbol -> name) == SYMBOL_NAME (sym)[0]
|
if (SYMBOL_NAME (msymbol)[0] == SYMBOL_NAME (sym)[0] &&
|
||||||
&& !strcmp(msymbol -> name + 1, SYMBOL_NAME (sym) + 1))
|
STREQ(SYMBOL_NAME (msymbol) + 1, SYMBOL_NAME (sym) + 1))
|
||||||
{
|
{
|
||||||
/* Splice this symbol out of the hash chain and
|
/* Splice this symbol out of the hash chain and
|
||||||
assign the value we have to it. */
|
assign the value we have to it. */
|
||||||
|
@ -3180,11 +3201,11 @@ scan_file_globals (objfile)
|
||||||
|
|
||||||
if (SYMBOL_CLASS (sym) == LOC_BLOCK)
|
if (SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||||
{
|
{
|
||||||
fix_common_block (sym, msymbol -> address);
|
fix_common_block (sym, SYMBOL_VALUE_ADDRESS (msymbol));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SYMBOL_VALUE_ADDRESS (sym) = msymbol -> address;
|
SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev)
|
if (prev)
|
||||||
|
|
|
@ -144,7 +144,7 @@ open (filename, modes)
|
||||||
for (next - files_start; * (int *) next;
|
for (next - files_start; * (int *) next;
|
||||||
next += * (int *) next)
|
next += * (int *) next)
|
||||||
{
|
{
|
||||||
if (!strcmp (next + 4, filename))
|
if (!STRCMP (next + 4, filename))
|
||||||
{
|
{
|
||||||
sourcebeg = next + 4 + strlen (next + 4) + 1;
|
sourcebeg = next + 4 + strlen (next + 4) + 1;
|
||||||
sourcebeg = (char *) (((int) sourcebeg + 3) & (-4));
|
sourcebeg = (char *) (((int) sourcebeg + 3) & (-4));
|
||||||
|
|
|
@ -470,7 +470,7 @@ load_state_command (arg_string, from_tty)
|
||||||
|
|
||||||
while (*++argv != NULL)
|
while (*++argv != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp (*argv, "symbols") == 0)
|
if (STREQ (*argv, "symbols"))
|
||||||
{
|
{
|
||||||
if (from_tty
|
if (from_tty
|
||||||
&& !query ("load symbol table state from file \"%s\"? ",
|
&& !query ("load symbol table state from file \"%s\"? ",
|
||||||
|
@ -533,7 +533,7 @@ dump_state_command (arg_string, from_tty)
|
||||||
fseek (asfd -> fp, sizeof (sf_hdr), SEEK_SET);
|
fseek (asfd -> fp, sizeof (sf_hdr), SEEK_SET);
|
||||||
while (*++argv != NULL)
|
while (*++argv != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp (*argv, "objfile") == 0)
|
if (STREQ (*argv, "objfile"))
|
||||||
{
|
{
|
||||||
write_objfile_state (asfd);
|
write_objfile_state (asfd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ main (argc, argv)
|
||||||
outfile = 0;
|
outfile = 0;
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (strcmp (argv[i], "-o") == 0)
|
if (STREQ (argv[i], "-o"))
|
||||||
outfile = argv[++i];
|
outfile = argv[++i];
|
||||||
}
|
}
|
||||||
if (outfile == 0)
|
if (outfile == 0)
|
||||||
|
@ -66,7 +66,7 @@ main (argc, argv)
|
||||||
* that name the output file. */
|
* that name the output file. */
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (strcmp (argv[i], "-o") == 0)
|
if (STREQ (argv[i], "-o"))
|
||||||
continue;
|
continue;
|
||||||
if ((in_fd = open (argv[i], O_RDONLY)) < 0)
|
if ((in_fd = open (argv[i], O_RDONLY)) < 0)
|
||||||
err ("Error opening %s for read: %s\n", argv[i],
|
err ("Error opening %s for read: %s\n", argv[i],
|
||||||
|
@ -152,7 +152,7 @@ find_symbol (sym_name, symbol_table, length, strings)
|
||||||
{
|
{
|
||||||
if ((sym->n_type & N_TYPE) != N_DATA) continue;
|
if ((sym->n_type & N_TYPE) != N_DATA) continue;
|
||||||
if (sym->n_un.n_strx == 0) continue;
|
if (sym->n_un.n_strx == 0) continue;
|
||||||
if (strcmp (sym_name, strings + sym->n_un.n_strx - 4) == 0)
|
if (STREQ (sym_name, strings + sym->n_un.n_strx - 4))
|
||||||
return sym->n_value;
|
return sym->n_value;
|
||||||
}
|
}
|
||||||
err ("Data symbol %s not found in %s\n", sym_name, file);
|
err ("Data symbol %s not found in %s\n", sym_name, file);
|
||||||
|
|
112
gdb/symfile.c
112
gdb/symfile.c
|
@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "breakpoint.h"
|
#include "breakpoint.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "complaints.h"
|
#include "complaints.h"
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
#include <obstack.h>
|
#include <obstack.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -131,7 +132,7 @@ compare_symbols (s1p, s2p)
|
||||||
if (namediff != 0) return namediff;
|
if (namediff != 0) return namediff;
|
||||||
|
|
||||||
/* If they match, compare the rest of the names. */
|
/* If they match, compare the rest of the names. */
|
||||||
namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
|
namediff = STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
|
||||||
if (namediff != 0) return namediff;
|
if (namediff != 0) return namediff;
|
||||||
|
|
||||||
/* For symbols of the same name, registers should come first. */
|
/* For symbols of the same name, registers should come first. */
|
||||||
|
@ -179,7 +180,7 @@ compare_psymbols (s1p, s2p)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (strcmp (st1 + 2, st2 + 2));
|
return (STRCMP (st1 + 2, st2 + 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +429,7 @@ syms_from_objfile (objfile, addr, mainline, verbo)
|
||||||
warning ("no loadable sections found in added symbol-file %s",
|
warning ("no loadable sections found in added symbol-file %s",
|
||||||
objfile->name);
|
objfile->name);
|
||||||
else if (0 == bfd_get_section_name (objfile->obfd, lowest_sect)
|
else if (0 == bfd_get_section_name (objfile->obfd, lowest_sect)
|
||||||
|| 0 != strcmp(".text",
|
|| !STREQ (".text",
|
||||||
bfd_get_section_name (objfile->obfd, lowest_sect)))
|
bfd_get_section_name (objfile->obfd, lowest_sect)))
|
||||||
warning ("Lowest section in %s is %s at 0x%x",
|
warning ("Lowest section in %s is %s at 0x%x",
|
||||||
objfile->name,
|
objfile->name,
|
||||||
|
@ -670,11 +671,11 @@ symbol_file_command (args, from_tty)
|
||||||
cleanups = make_cleanup (freeargv, (char *) argv);
|
cleanups = make_cleanup (freeargv, (char *) argv);
|
||||||
while (*argv != NULL)
|
while (*argv != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp (*argv, "-mapped") == 0)
|
if (STREQ (*argv, "-mapped"))
|
||||||
{
|
{
|
||||||
mapped = 1;
|
mapped = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (*argv, "-readnow") == 0)
|
else if (STREQ (*argv, "-readnow"))
|
||||||
{
|
{
|
||||||
readnow = 1;
|
readnow = 1;
|
||||||
}
|
}
|
||||||
|
@ -872,11 +873,11 @@ add_symbol_file_command (args, from_tty)
|
||||||
{
|
{
|
||||||
name = arg;
|
name = arg;
|
||||||
}
|
}
|
||||||
else if (strcmp (arg, "-mapped") == 0)
|
else if (STREQ (arg, "-mapped"))
|
||||||
{
|
{
|
||||||
mapped = 1;
|
mapped = 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (arg, "-readnow") == 0)
|
else if (STREQ (arg, "-readnow"))
|
||||||
{
|
{
|
||||||
readnow = 1;
|
readnow = 1;
|
||||||
}
|
}
|
||||||
|
@ -969,14 +970,14 @@ deduce_language_from_filename (filename)
|
||||||
char *c = strrchr (filename, '.');
|
char *c = strrchr (filename, '.');
|
||||||
|
|
||||||
if (!c) ; /* Get default. */
|
if (!c) ; /* Get default. */
|
||||||
else if(!strcmp(c,".mod"))
|
else if(STREQ(c,".mod"))
|
||||||
return language_m2;
|
return language_m2;
|
||||||
else if(!strcmp(c,".c"))
|
else if(STREQ(c,".c"))
|
||||||
return language_c;
|
return language_c;
|
||||||
else if(!strcmp(c,".cc") || !strcmp(c,".C"))
|
else if(STREQ(c,".cc") || STREQ(c,".C"))
|
||||||
return language_cplus;
|
return language_cplus;
|
||||||
/* start-sanitize-chill */
|
/* start-sanitize-chill */
|
||||||
else if(!strcmp(c,".chill") || !strcmp(c,".c186") || !strcmp(c,".c286"))
|
else if(STREQ(c,".ch") || STREQ(c,".c186") || STREQ(c,".c286"))
|
||||||
return language_chill;
|
return language_chill;
|
||||||
/* end-sanitize-chill */
|
/* end-sanitize-chill */
|
||||||
|
|
||||||
|
@ -1193,7 +1194,7 @@ free_named_symtabs (name)
|
||||||
|
|
||||||
again2:
|
again2:
|
||||||
for (ps = partial_symtab_list; ps; ps = ps->next) {
|
for (ps = partial_symtab_list; ps; ps = ps->next) {
|
||||||
if (!strcmp (name, ps->filename)) {
|
if (STREQ (name, ps->filename)) {
|
||||||
cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
|
cashier_psymtab (ps); /* Blow it away...and its little dog, too. */
|
||||||
goto again2; /* Must restart, chain has been munged */
|
goto again2; /* Must restart, chain has been munged */
|
||||||
}
|
}
|
||||||
|
@ -1203,7 +1204,7 @@ again2:
|
||||||
|
|
||||||
for (s = symtab_list; s; s = s->next)
|
for (s = symtab_list; s; s = s->next)
|
||||||
{
|
{
|
||||||
if (!strcmp (name, s->filename))
|
if (STREQ (name, s->filename))
|
||||||
break;
|
break;
|
||||||
prev = s;
|
prev = s;
|
||||||
}
|
}
|
||||||
|
@ -1291,40 +1292,109 @@ start_psymtab_common (objfile, section_offsets,
|
||||||
/* Debugging versions of functions that are usually inline macros
|
/* Debugging versions of functions that are usually inline macros
|
||||||
(see symfile.h). */
|
(see symfile.h). */
|
||||||
|
|
||||||
#if 0 /* Don't quite work nowadays... */
|
#if !INLINE_ADD_PSYMBOL
|
||||||
|
|
||||||
/* Add a symbol with a long value to a psymtab.
|
/* Add a symbol with a long value to a psymtab.
|
||||||
Since one arg is a struct, we pass in a ptr and deref it (sigh). */
|
Since one arg is a struct, we pass in a ptr and deref it (sigh). */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_psymbol_to_list (name, namelength, namespace, class, list, val)
|
add_psymbol_to_list (name, namelength, namespace, class, list, val, language,
|
||||||
|
objfile)
|
||||||
char *name;
|
char *name;
|
||||||
int namelength;
|
int namelength;
|
||||||
enum namespace namespace;
|
enum namespace namespace;
|
||||||
enum address_class class;
|
enum address_class class;
|
||||||
struct psymbol_allocation_list *list;
|
struct psymbol_allocation_list *list;
|
||||||
long val;
|
long val;
|
||||||
|
enum language language;
|
||||||
|
struct objfile *objfile;
|
||||||
{
|
{
|
||||||
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
|
register struct partial_symbol *psym;
|
||||||
SYMBOL_VALUE);
|
register char *demangled_name;
|
||||||
|
|
||||||
|
if (list->next >= list->list + list->size)
|
||||||
|
{
|
||||||
|
extend_psymbol_list (list,objfile);
|
||||||
|
}
|
||||||
|
psym = list->next++;
|
||||||
|
|
||||||
|
SYMBOL_NAME (psym) =
|
||||||
|
(char *) obstack_alloc (&objfile->psymbol_obstack, namelength + 1);
|
||||||
|
memcpy (SYMBOL_NAME (psym), name, namelength);
|
||||||
|
SYMBOL_NAME (psym)[namelength] = '\0';
|
||||||
|
SYMBOL_VALUE (psym) = val;
|
||||||
|
SYMBOL_LANGUAGE (psym) = language;
|
||||||
|
PSYMBOL_NAMESPACE (psym) = namespace;
|
||||||
|
PSYMBOL_CLASS (psym) = class;
|
||||||
|
if (language == language_cplus)
|
||||||
|
{
|
||||||
|
demangled_name =
|
||||||
|
cplus_demangle (SYMBOL_NAME (psym), DMGL_PARAMS | DMGL_ANSI);
|
||||||
|
if (demangled_name == NULL)
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) =
|
||||||
|
obsavestring (demangled_name, strlen (demangled_name),
|
||||||
|
&objfile->psymbol_obstack);
|
||||||
|
free (demangled_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a symbol with a CORE_ADDR value to a psymtab. */
|
/* Add a symbol with a CORE_ADDR value to a psymtab. */
|
||||||
|
|
||||||
void
|
void
|
||||||
add_psymbol_addr_to_list (name, namelength, namespace, class, list, val)
|
add_psymbol_addr_to_list (name, namelength, namespace, class, list, val,
|
||||||
|
language, objfile)
|
||||||
char *name;
|
char *name;
|
||||||
int namelength;
|
int namelength;
|
||||||
enum namespace namespace;
|
enum namespace namespace;
|
||||||
enum address_class class;
|
enum address_class class;
|
||||||
struct psymbol_allocation_list *list;
|
struct psymbol_allocation_list *list;
|
||||||
CORE_ADDR val;
|
CORE_ADDR val;
|
||||||
|
enum language language;
|
||||||
|
struct objfile *objfile;
|
||||||
{
|
{
|
||||||
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, (*list), val,
|
register struct partial_symbol *psym;
|
||||||
SYMBOL_VALUE_ADDRESS);
|
register char *demangled_name;
|
||||||
|
|
||||||
|
if (list->next >= list->list + list->size)
|
||||||
|
{
|
||||||
|
extend_psymbol_list (list,objfile);
|
||||||
|
}
|
||||||
|
psym = list->next++;
|
||||||
|
|
||||||
|
SYMBOL_NAME (psym) =
|
||||||
|
(char *) obstack_alloc (&objfile->psymbol_obstack, namelength + 1);
|
||||||
|
memcpy (SYMBOL_NAME (psym), name, namelength);
|
||||||
|
SYMBOL_NAME (psym)[namelength] = '\0';
|
||||||
|
SYMBOL_VALUE_ADDRESS (psym) = val;
|
||||||
|
SYMBOL_LANGUAGE (psym) = language;
|
||||||
|
PSYMBOL_NAMESPACE (psym) = namespace;
|
||||||
|
PSYMBOL_CLASS (psym) = class;
|
||||||
|
if (language == language_cplus)
|
||||||
|
{
|
||||||
|
demangled_name =
|
||||||
|
cplus_demangle (SYMBOL_NAME (psym), DMGL_PARAMS | DMGL_ANSI);
|
||||||
|
if (demangled_name == NULL)
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) =
|
||||||
|
obsavestring (demangled_name, strlen (demangled_name),
|
||||||
|
&objfile->psymbol_obstack);
|
||||||
|
free (demangled_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* 0 */
|
#endif /* !INLINE_ADD_PSYMBOL */
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_symfile ()
|
_initialize_symfile ()
|
||||||
|
|
|
@ -99,45 +99,69 @@ extend_psymbol_list PARAMS ((struct psymbol_allocation_list *,
|
||||||
|
|
||||||
/* Add any kind of symbol to a psymbol_allocation_list. */
|
/* Add any kind of symbol to a psymbol_allocation_list. */
|
||||||
|
|
||||||
#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT) \
|
#ifndef INLINE_ADD_PSYMBOL
|
||||||
|
#define INLINE_ADD_PSYMBOL 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !INLINE_ADD_PSYMBOL
|
||||||
|
|
||||||
|
/* 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, language, objfile) \
|
||||||
|
add_psymbol_to_list (name, namelength, namespace, class, &list, value, language, objfile)
|
||||||
|
|
||||||
|
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
|
||||||
|
add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value, language, objfile)
|
||||||
|
|
||||||
|
#else /* !INLINE_ADD_PSYMBOL */
|
||||||
|
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
|
#define ADD_PSYMBOL_VT_TO_LIST(NAME,NAMELENGTH,NAMESPACE,CLASS,LIST,VALUE,VT,LANGUAGE, OBJFILE) \
|
||||||
do { \
|
do { \
|
||||||
register struct partial_symbol *psym; \
|
register struct partial_symbol *psym; \
|
||||||
|
register char *demangled_name; \
|
||||||
if ((LIST).next >= (LIST).list + (LIST).size) \
|
if ((LIST).next >= (LIST).list + (LIST).size) \
|
||||||
extend_psymbol_list (&(LIST),objfile); \
|
extend_psymbol_list (&(LIST),(OBJFILE)); \
|
||||||
psym = (LIST).next++; \
|
psym = (LIST).next++; \
|
||||||
\
|
SYMBOL_NAME (psym) = \
|
||||||
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->psymbol_obstack, \
|
(char *) obstack_alloc (&objfile->psymbol_obstack, \
|
||||||
(NAMELENGTH) + 1); \
|
(NAMELENGTH) + 1); \
|
||||||
memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
|
memcpy (SYMBOL_NAME (psym), (NAME), (NAMELENGTH)); \
|
||||||
SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
|
SYMBOL_NAME (psym)[(NAMELENGTH)] = '\0'; \
|
||||||
SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
|
SYMBOL_NAMESPACE (psym) = (NAMESPACE); \
|
||||||
SYMBOL_CLASS (psym) = (CLASS); \
|
PSYMBOL_CLASS (psym) = (CLASS); \
|
||||||
VT (psym) = (VALUE); \
|
VT (psym) = (VALUE); \
|
||||||
|
SYMBOL_LANGUAGE (psym) = (LANGUAGE); \
|
||||||
|
if ((LANGUAGE) == language_cplus) \
|
||||||
|
{ \
|
||||||
|
demangled_name = \
|
||||||
|
cplus_demangle (SYMBOL_NAME (psym), DMGL_PARAMS | DMGL_ANSI); \
|
||||||
|
if (demangled_name == NULL) \
|
||||||
|
{ \
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) = NULL; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
SYMBOL_DEMANGLED_NAME (psym) = \
|
||||||
|
obsavestring (demangled_name, strlen (demangled_name), \
|
||||||
|
&objfile->psymbol_obstack); \
|
||||||
|
free (demangled_name); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#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_list (name, namelength, namespace, class, &list, value)
|
|
||||||
|
|
||||||
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value) \
|
|
||||||
add_psymbol_addr_to_list (name, namelength, namespace, class, &list, value)
|
|
||||||
|
|
||||||
#else /* !DEBUG */
|
|
||||||
|
|
||||||
/* Add a symbol with an integer value to a psymtab. */
|
/* Add a symbol with an integer value to a psymtab. */
|
||||||
|
|
||||||
#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value) \
|
#define ADD_PSYMBOL_TO_LIST(name, namelength, namespace, class, list, value, language, objfile) \
|
||||||
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE)
|
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE, language, objfile)
|
||||||
|
|
||||||
/* Add a symbol with a CORE_ADDR value to a psymtab. */
|
/* Add a symbol with a CORE_ADDR value to a psymtab. */
|
||||||
|
|
||||||
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value)\
|
#define ADD_PSYMBOL_ADDR_TO_LIST(name, namelength, namespace, class, list, value, language, objfile)\
|
||||||
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS)
|
ADD_PSYMBOL_VT_TO_LIST (name, namelength, namespace, class, list, value, SYMBOL_VALUE_ADDRESS, language, objfile)
|
||||||
|
|
||||||
#endif /* DEBUG */
|
#endif /* INLINE_ADD_PSYMBOL */
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ dump_msymbols (objfile, outfile)
|
||||||
|
|
||||||
fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile -> name);
|
fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile -> name);
|
||||||
for (index = 0, msymbol = objfile -> msymbols;
|
for (index = 0, msymbol = objfile -> msymbols;
|
||||||
msymbol -> name != NULL; msymbol++, index++)
|
SYMBOL_NAME (msymbol) != NULL; msymbol++, index++)
|
||||||
{
|
{
|
||||||
switch (msymbol -> type)
|
switch (msymbol -> type)
|
||||||
{
|
{
|
||||||
|
@ -225,8 +225,14 @@ dump_msymbols (objfile, outfile)
|
||||||
ms_type = '?';
|
ms_type = '?';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf_filtered (outfile, "[%2d] %c %#10x %s\n", index, ms_type,
|
fprintf_filtered (outfile, "[%2d] %c %#10x %s", index, ms_type,
|
||||||
msymbol -> address, msymbol -> name);
|
SYMBOL_VALUE_ADDRESS (msymbol), SYMBOL_NAME (msymbol));
|
||||||
|
if (SYMBOL_LANGUAGE (msymbol) == language_cplus &&
|
||||||
|
SYMBOL_DEMANGLED_NAME (msymbol) != NULL)
|
||||||
|
{
|
||||||
|
fprintf_filtered (outfile, " %s", SYMBOL_DEMANGLED_NAME (msymbol));
|
||||||
|
}
|
||||||
|
fputs_filtered ("\n", outfile);
|
||||||
}
|
}
|
||||||
if (objfile -> minimal_symbol_count != index)
|
if (objfile -> minimal_symbol_count != index)
|
||||||
{
|
{
|
||||||
|
@ -325,7 +331,15 @@ dump_symtab (objfile, symtab, outfile)
|
||||||
if (BLOCK_SUPERBLOCK (b))
|
if (BLOCK_SUPERBLOCK (b))
|
||||||
fprintf (outfile, " (under 0x%x)", (unsigned int) BLOCK_SUPERBLOCK (b));
|
fprintf (outfile, " (under 0x%x)", (unsigned int) BLOCK_SUPERBLOCK (b));
|
||||||
if (BLOCK_FUNCTION (b))
|
if (BLOCK_FUNCTION (b))
|
||||||
|
{
|
||||||
fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
|
fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
|
||||||
|
if (SYMBOL_LANGUAGE (BLOCK_FUNCTION (b)) == language_cplus &&
|
||||||
|
SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)) != NULL)
|
||||||
|
{
|
||||||
|
fprintf (outfile, " %s",
|
||||||
|
SYMBOL_DEMANGLED_NAME (BLOCK_FUNCTION (b)));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (BLOCK_GCC_COMPILED(b))
|
if (BLOCK_GCC_COMPILED(b))
|
||||||
fprintf (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
|
fprintf (outfile, " gcc%d compiled", BLOCK_GCC_COMPILED(b));
|
||||||
fputc ('\n', outfile);
|
fputc ('\n', outfile);
|
||||||
|
@ -383,7 +397,7 @@ maintenance_print_symbols (args, from_tty)
|
||||||
|
|
||||||
immediate_quit++;
|
immediate_quit++;
|
||||||
ALL_SYMTABS (objfile, s)
|
ALL_SYMTABS (objfile, s)
|
||||||
if (symname == NULL || (strcmp (symname, s -> filename) == 0))
|
if (symname == NULL || (STREQ (symname, s -> filename)))
|
||||||
dump_symtab (objfile, s, outfile);
|
dump_symtab (objfile, s, outfile);
|
||||||
immediate_quit--;
|
immediate_quit--;
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
|
@ -398,7 +412,7 @@ print_symbol (symbol, depth, outfile)
|
||||||
print_spaces (depth, outfile);
|
print_spaces (depth, outfile);
|
||||||
if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
|
if (SYMBOL_NAMESPACE (symbol) == LABEL_NAMESPACE)
|
||||||
{
|
{
|
||||||
fprintf (outfile, "label %s at 0x%x\n", SYMBOL_NAME (symbol),
|
fprintf (outfile, "label %s at 0x%x\n", SYMBOL_SOURCE_NAME (symbol),
|
||||||
SYMBOL_VALUE_ADDRESS (symbol));
|
SYMBOL_VALUE_ADDRESS (symbol));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -433,7 +447,7 @@ print_symbol (symbol, depth, outfile)
|
||||||
fprintf (outfile, "; ");
|
fprintf (outfile, "; ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (outfile, "%s ", SYMBOL_NAME (symbol));
|
fprintf (outfile, "%s ", SYMBOL_SOURCE_NAME (symbol));
|
||||||
|
|
||||||
switch (SYMBOL_CLASS (symbol))
|
switch (SYMBOL_CLASS (symbol))
|
||||||
{
|
{
|
||||||
|
@ -572,7 +586,7 @@ maintenance_print_psymbols (args, from_tty)
|
||||||
|
|
||||||
immediate_quit++;
|
immediate_quit++;
|
||||||
ALL_PSYMTABS (objfile, ps)
|
ALL_PSYMTABS (objfile, ps)
|
||||||
if (symname == NULL || (strcmp (symname, ps -> filename) == 0))
|
if (symname == NULL || (STREQ (symname, ps -> filename)))
|
||||||
dump_psymtab (objfile, ps, outfile);
|
dump_psymtab (objfile, ps, outfile);
|
||||||
immediate_quit--;
|
immediate_quit--;
|
||||||
do_cleanups (cleanups);
|
do_cleanups (cleanups);
|
||||||
|
@ -589,7 +603,13 @@ print_partial_symbol (p, count, what, outfile)
|
||||||
fprintf_filtered (outfile, " %s partial symbols:\n", what);
|
fprintf_filtered (outfile, " %s partial symbols:\n", what);
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
fprintf_filtered (outfile, " `%s', ", SYMBOL_NAME(p));
|
fprintf_filtered (outfile, " `%s'", SYMBOL_NAME(p));
|
||||||
|
if (SYMBOL_LANGUAGE (p) == language_cplus &&
|
||||||
|
SYMBOL_DEMANGLED_NAME (p) != NULL)
|
||||||
|
{
|
||||||
|
fprintf_filtered (outfile, " `%s'", SYMBOL_DEMANGLED_NAME (p));
|
||||||
|
}
|
||||||
|
fputs_filtered (", ", outfile);
|
||||||
switch (SYMBOL_NAMESPACE (p))
|
switch (SYMBOL_NAMESPACE (p))
|
||||||
{
|
{
|
||||||
case UNDEF_NAMESPACE:
|
case UNDEF_NAMESPACE:
|
||||||
|
@ -703,7 +723,7 @@ maintenance_print_msymbols (args, from_tty)
|
||||||
|
|
||||||
immediate_quit++;
|
immediate_quit++;
|
||||||
ALL_OBJFILES (objfile)
|
ALL_OBJFILES (objfile)
|
||||||
if (symname == NULL || (strcmp (symname, objfile -> name) == 0))
|
if (symname == NULL || (STREQ (symname, objfile -> name)))
|
||||||
dump_msymbols (objfile, outfile);
|
dump_msymbols (objfile, outfile);
|
||||||
immediate_quit--;
|
immediate_quit--;
|
||||||
fprintf_filtered (outfile, "\n\n");
|
fprintf_filtered (outfile, "\n\n");
|
||||||
|
@ -771,61 +791,3 @@ extend_psymbol_list (listp, objfile)
|
||||||
listp->next = listp->list + listp->size;
|
listp->next = listp->list + listp->size;
|
||||||
listp->size = new_size;
|
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, objfile);
|
|
||||||
psym = listp -> next++;
|
|
||||||
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->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, objfile);
|
|
||||||
psym = listp -> next++;
|
|
||||||
SYMBOL_NAME (psym) = (char *) obstack_alloc (&objfile->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 */
|
|
||||||
|
|
644
gdb/symtab.c
644
gdb/symtab.c
File diff suppressed because it is too large
Load diff
590
gdb/symtab.h
590
gdb/symtab.h
|
@ -19,48 +19,156 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#if !defined (SYMTAB_H)
|
#if !defined (SYMTAB_H)
|
||||||
#define SYMTAB_H 1
|
#define SYMTAB_H 1
|
||||||
#include "obstack.h"
|
|
||||||
|
|
||||||
/* See the comment in symfile.c about how current_objfile is used. */
|
|
||||||
|
|
||||||
extern struct objfile *current_objfile;
|
|
||||||
|
|
||||||
/* Some definitions and declarations to go with use of obstacks. */
|
/* Some definitions and declarations to go with use of obstacks. */
|
||||||
|
|
||||||
|
#include "obstack.h"
|
||||||
#define obstack_chunk_alloc xmalloc
|
#define obstack_chunk_alloc xmalloc
|
||||||
#define obstack_chunk_free free
|
#define obstack_chunk_free free
|
||||||
|
|
||||||
/* Some macros for char-based bitfields. */
|
/* Define a structure for the information that is common to all symbol types,
|
||||||
#define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
|
including minimal symbols, partial symbols, and full symbols. */
|
||||||
#define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
|
|
||||||
#define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
|
|
||||||
#define B_TYPE unsigned char
|
|
||||||
#define B_BYTES(x) ( 1 + ((x)>>3) )
|
|
||||||
#define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
|
|
||||||
|
|
||||||
|
struct general_symbol_info
|
||||||
|
{
|
||||||
|
/* Name of the symbol. This is a required field. Storage for the name is
|
||||||
|
allocated on the psymbol_obstack or symbol_obstack for the associated
|
||||||
|
objfile. */
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
/* Constant value, or address if static, or register number,
|
||||||
|
or offset in arguments, or offset in stack frame. All of
|
||||||
|
these are in host byte order (though what they point to might
|
||||||
|
be in target byte order, e.g. LOC_CONST_BYTES).
|
||||||
|
|
||||||
|
Note that the address of a function is SYMBOL_VALUE_ADDRESS (pst)
|
||||||
|
in a partial symbol table, but BLOCK_START (SYMBOL_BLOCK_VALUE (st))
|
||||||
|
in a symbol table. */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
/* for LOC_CONST, LOC_REGISTER, LOC_ARG, LOC_REF_ARG, LOC_REGPARM,
|
||||||
|
LOC_LOCAL */
|
||||||
|
|
||||||
|
long value;
|
||||||
|
|
||||||
|
/* for LOC_BLOCK */
|
||||||
|
|
||||||
|
struct block *block;
|
||||||
|
|
||||||
|
/* for LOC_CONST_BYTES */
|
||||||
|
|
||||||
|
char *bytes;
|
||||||
|
|
||||||
|
/* for LOC_STATIC, LOC_LABEL */
|
||||||
|
|
||||||
|
CORE_ADDR address;
|
||||||
|
|
||||||
|
/* for opaque typedef struct chain */
|
||||||
|
|
||||||
|
struct symbol *chain;
|
||||||
|
}
|
||||||
|
value;
|
||||||
|
|
||||||
|
/* In a multilanguage environment, some language specific information may
|
||||||
|
need to be recorded along with each symbol. */
|
||||||
|
|
||||||
|
struct language_dependent_info
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Record the language that this information applies to. */
|
||||||
|
|
||||||
|
enum language language;
|
||||||
|
|
||||||
|
/* Since one and only one language can apply, wrap the information inside
|
||||||
|
a union. */
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
/* For C++ */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char *demangled_name;
|
||||||
|
} cplus_specific;
|
||||||
|
} lang_u;
|
||||||
|
} lang_specific;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SYMBOL_NAME(symbol) (symbol)->ginfo.name
|
||||||
|
#define SYMBOL_VALUE(symbol) (symbol)->ginfo.value.value
|
||||||
|
#define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->ginfo.value.address
|
||||||
|
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->ginfo.value.bytes
|
||||||
|
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->ginfo.value.block
|
||||||
|
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
|
||||||
|
#define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.lang_specific.language
|
||||||
|
#define SYMBOL_DEMANGLED_NAME(symbol) \
|
||||||
|
(symbol)->ginfo.lang_specific.lang_u.cplus_specific.demangled_name
|
||||||
|
|
||||||
|
extern int demangle; /* We reference it, so go ahead and declare it. */
|
||||||
|
|
||||||
|
/* Macro that returns the "natural source name" of a symbol. In C++ this is
|
||||||
|
the "demangled" form of the name if demangle is on and the "mangled" form
|
||||||
|
of the name if demangle is off. In other languages this is just the
|
||||||
|
symbol name. */
|
||||||
|
|
||||||
|
#define SYMBOL_SOURCE_NAME(symbol) \
|
||||||
|
((demangle && (SYMBOL_LANGUAGE(symbol) == language_cplus) && \
|
||||||
|
(SYMBOL_DEMANGLED_NAME(symbol) != NULL)) ? \
|
||||||
|
SYMBOL_DEMANGLED_NAME (symbol) : SYMBOL_NAME (symbol))
|
||||||
|
|
||||||
|
/* Macro that returns the "natural assembly name" of a symbol. In C++ this is
|
||||||
|
the "mangled" form of the name if demangle is off, or if demangle is on and
|
||||||
|
asm_demangle is off. Otherwise if asm_demangle is on it is the "demangled"
|
||||||
|
form. In other languages this is just the symbol name. */
|
||||||
|
|
||||||
|
#define SYMBOL_LINKAGE_NAME(symbol) \
|
||||||
|
((demangle && asm_demangle && (SYMBOL_LANGUAGE(symbol) == language_cplus) &&\
|
||||||
|
(SYMBOL_DEMANGLED_NAME(symbol) != NULL)) ? \
|
||||||
|
SYMBOL_DEMANGLED_NAME (symbol) : SYMBOL_NAME (symbol))
|
||||||
|
|
||||||
|
/* Macro that tests a symbol for a match against a specified name string.
|
||||||
|
First test the unencoded name, then looks for and test a C++ encoded
|
||||||
|
name if it exists. Note that whitespace is ignored while attempting to
|
||||||
|
match a C++ encoded name, so that "foo::bar(int,long)" is the same as
|
||||||
|
"foo :: bar (int, long)".
|
||||||
|
Evaluates to zero if the match fails, or nonzero if it succeeds. */
|
||||||
|
|
||||||
|
#define SYMBOL_MATCHES_NAME(symbol, name) \
|
||||||
|
(STREQ (SYMBOL_NAME (symbol), (name)) || \
|
||||||
|
(SYMBOL_LANGUAGE (symbol) == language_cplus && \
|
||||||
|
SYMBOL_DEMANGLED_NAME (symbol) != NULL && \
|
||||||
|
strcmp_iw (SYMBOL_DEMANGLED_NAME (symbol), (name)) == 0))
|
||||||
|
|
||||||
|
/* Macro that tests a symbol for an re-match against the last compiled regular
|
||||||
|
expression. First test the unencoded name, then look for and test a C++
|
||||||
|
encoded name if it exists.
|
||||||
|
Evaluates to zero if the match fails, or nonzero if it succeeds. */
|
||||||
|
|
||||||
|
#define SYMBOL_MATCHES_REGEXP(symbol) \
|
||||||
|
(re_exec (SYMBOL_NAME (symbol)) != 0 || \
|
||||||
|
(SYMBOL_LANGUAGE (symbol) == language_cplus && \
|
||||||
|
SYMBOL_DEMANGLED_NAME (symbol) != NULL && \
|
||||||
|
re_exec (SYMBOL_DEMANGLED_NAME (symbol)) != 0))
|
||||||
|
|
||||||
/* Define a simple structure used to hold some very basic information about
|
/* Define a simple structure used to hold some very basic information about
|
||||||
all defined global symbols (text, data, bss, abs, etc). The only two
|
all defined global symbols (text, data, bss, abs, etc). The only required
|
||||||
required pieces of information are the symbol's name and the address
|
information is the general_symbol_info.
|
||||||
associated with that symbol. In many cases, even if a file was compiled
|
|
||||||
with no special options for debugging at all, as long as was not stripped
|
In many cases, even if a file was compiled with no special options for
|
||||||
it will contain sufficient information to build a useful minimal symbol
|
debugging at all, as long as was not stripped it will contain sufficient
|
||||||
table using this structure. Even when a file contains enough debugging
|
information to build a useful minimal symbol table using this structure.
|
||||||
information to build a full symbol table, these minimal symbols are still
|
Even when a file contains enough debugging information to build a full
|
||||||
useful for quickly mapping between names and addresses, and vice versa.
|
symbol table, these minimal symbols are still useful for quickly mapping
|
||||||
They are also sometimes used to figure out what full symbol table entries
|
between names and addresses, and vice versa. They are also sometimes
|
||||||
need to be read in. */
|
used to figure out what full symbol table entries need to be read in. */
|
||||||
|
|
||||||
struct minimal_symbol
|
struct minimal_symbol
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Name of the symbol. This is a required field. Storage for the name is
|
/* The general symbol info required for all types of symbols. */
|
||||||
allocated on the symbol_obstack for the associated objfile. */
|
|
||||||
|
|
||||||
char *name;
|
struct general_symbol_info ginfo;
|
||||||
|
|
||||||
/* Address of the symbol. This is a required field. */
|
|
||||||
|
|
||||||
CORE_ADDR address;
|
|
||||||
|
|
||||||
/* The info field is available for caching machine-specific information that
|
/* The info field is available for caching machine-specific information that
|
||||||
The AMD 29000 tdep.c uses it to remember things it has decoded from the
|
The AMD 29000 tdep.c uses it to remember things it has decoded from the
|
||||||
|
@ -92,6 +200,9 @@ struct minimal_symbol
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MSYMBOL_INFO(msymbol) (msymbol)->info
|
||||||
|
#define MSYMBOL_TYPE(msymbol) (msymbol)->type
|
||||||
|
|
||||||
|
|
||||||
/* All of the name-scope contours of the program
|
/* All of the name-scope contours of the program
|
||||||
are represented by `struct block' objects.
|
are represented by `struct block' objects.
|
||||||
|
@ -127,18 +238,26 @@ struct blockvector
|
||||||
struct block *block[1];
|
struct block *block[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
|
||||||
|
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
|
||||||
|
|
||||||
/* Special block numbers */
|
/* Special block numbers */
|
||||||
|
|
||||||
#define GLOBAL_BLOCK 0
|
#define GLOBAL_BLOCK 0
|
||||||
#define STATIC_BLOCK 1
|
#define STATIC_BLOCK 1
|
||||||
#define FIRST_LOCAL_BLOCK 2
|
#define FIRST_LOCAL_BLOCK 2
|
||||||
|
|
||||||
struct block
|
struct block
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Addresses in the executable code that are in this block.
|
/* Addresses in the executable code that are in this block.
|
||||||
Note: in an unrelocated symbol segment in a file,
|
Note: in an unrelocated symbol segment in a file,
|
||||||
these are always zero. They can be filled in from the
|
these are always zero. They can be filled in from the
|
||||||
N_LBRAC and N_RBRAC symbols in the loader symbol table. */
|
N_LBRAC and N_RBRAC symbols in the loader symbol table. */
|
||||||
CORE_ADDR startaddr, endaddr;
|
|
||||||
|
CORE_ADDR startaddr;
|
||||||
|
CORE_ADDR endaddr;
|
||||||
|
|
||||||
/* The symbol that names this block,
|
/* The symbol that names this block,
|
||||||
if the block is the body of a function;
|
if the block is the body of a function;
|
||||||
otherwise, zero.
|
otherwise, zero.
|
||||||
|
@ -148,124 +267,208 @@ struct block
|
||||||
(since the name resides in a higher block).
|
(since the name resides in a higher block).
|
||||||
Since the symbol does point to the block (as its value),
|
Since the symbol does point to the block (as its value),
|
||||||
it is possible to find the block and set its name properly. */
|
it is possible to find the block and set its name properly. */
|
||||||
|
|
||||||
struct symbol *function;
|
struct symbol *function;
|
||||||
/* The `struct block' for the containing block, or 0 if none. */
|
|
||||||
/* Note that in an unrelocated symbol segment in an object file
|
/* The `struct block' for the containing block, or 0 if none.
|
||||||
|
Note that in an unrelocated symbol segment in an object file
|
||||||
this pointer may be zero when the correct value should be
|
this pointer may be zero when the correct value should be
|
||||||
the second special block (for symbols whose scope is one compilation).
|
the second special block (for symbols whose scope is one compilation).
|
||||||
This is because the compiler outputs the special blocks at the
|
This is because the compiler outputs the special blocks at the
|
||||||
very end, after the other blocks. */
|
very end, after the other blocks. */
|
||||||
|
|
||||||
struct block *superblock;
|
struct block *superblock;
|
||||||
|
|
||||||
/* A flag indicating whether or not the function corresponding
|
/* A flag indicating whether or not the function corresponding
|
||||||
to this block was compiled with gcc or not. If there is no
|
to this block was compiled with gcc or not. If there is no
|
||||||
function corresponding to this block, this meaning of this flag
|
function corresponding to this block, this meaning of this flag
|
||||||
is undefined. (In practice it will be 1 if the block was created
|
is undefined. (In practice it will be 1 if the block was created
|
||||||
while processing a file compiled with gcc and 0 when not). */
|
while processing a file compiled with gcc and 0 when not). */
|
||||||
|
|
||||||
unsigned char gcc_compile_flag;
|
unsigned char gcc_compile_flag;
|
||||||
|
|
||||||
/* Number of local symbols. */
|
/* Number of local symbols. */
|
||||||
|
|
||||||
int nsyms;
|
int nsyms;
|
||||||
|
|
||||||
/* The symbols. */
|
/* The symbols. */
|
||||||
|
|
||||||
struct symbol *sym[1];
|
struct symbol *sym[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BLOCK_START(bl) (bl)->startaddr
|
||||||
|
#define BLOCK_END(bl) (bl)->endaddr
|
||||||
|
#define BLOCK_NSYMS(bl) (bl)->nsyms
|
||||||
|
#define BLOCK_SYM(bl, n) (bl)->sym[n]
|
||||||
|
#define BLOCK_FUNCTION(bl) (bl)->function
|
||||||
|
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
|
||||||
|
#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
|
||||||
|
|
||||||
|
/* Nonzero if symbols of block BL should be sorted alphabetically. */
|
||||||
|
|
||||||
|
#define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40)
|
||||||
|
|
||||||
|
|
||||||
/* Represent one symbol name; a variable, constant, function or typedef. */
|
/* Represent one symbol name; a variable, constant, function or typedef. */
|
||||||
|
|
||||||
/* Different name spaces for symbols. Looking up a symbol specifies
|
|
||||||
a namespace and ignores symbol definitions in other name spaces.
|
|
||||||
|
|
||||||
VAR_NAMESPACE is the usual namespace.
|
|
||||||
In C, this contains variables, function names, typedef names
|
|
||||||
and enum type values.
|
|
||||||
|
|
||||||
STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
|
|
||||||
Thus, if `struct foo' is used in a C program,
|
|
||||||
it produces a symbol named `foo' in the STRUCT_NAMESPACE.
|
|
||||||
|
|
||||||
LABEL_NAMESPACE may be used for names of labels (for gotos);
|
|
||||||
currently it is not used and labels are not recorded at all. */
|
|
||||||
|
|
||||||
/* For a non-global symbol allocated statically,
|
/* For a non-global symbol allocated statically,
|
||||||
the correct core address cannot be determined by the compiler.
|
the correct core address cannot be determined by the compiler.
|
||||||
The compiler puts an index number into the symbol's value field.
|
The compiler puts an index number into the symbol's value field.
|
||||||
This index number can be matched with the "desc" field of
|
This index number can be matched with the "desc" field of
|
||||||
an entry in the loader symbol table. */
|
an entry in the loader symbol table. */
|
||||||
|
|
||||||
|
/* Different name spaces for symbols. Looking up a symbol specifies a
|
||||||
|
namespace and ignores symbol definitions in other name spaces. */
|
||||||
|
|
||||||
enum namespace
|
enum namespace
|
||||||
{
|
{
|
||||||
UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE, LABEL_NAMESPACE
|
/* UNDEF_NAMESPACE is used when a namespace has not been discovered or
|
||||||
|
none of the following apply. This usually indicates an error either
|
||||||
|
in the symbol information or in gdb's handling of symbols. */
|
||||||
|
|
||||||
|
UNDEF_NAMESPACE,
|
||||||
|
|
||||||
|
/* VAR_NAMESPACE is the usual namespace. In C, this contains variables,
|
||||||
|
function names, typedef names and enum type values. */
|
||||||
|
|
||||||
|
VAR_NAMESPACE,
|
||||||
|
|
||||||
|
/* STRUCT_NAMESPACE is used in C to hold struct, union and enum type names.
|
||||||
|
Thus, if `struct foo' is used in a C program, it produces a symbol named
|
||||||
|
`foo' in the STRUCT_NAMESPACE. */
|
||||||
|
|
||||||
|
STRUCT_NAMESPACE,
|
||||||
|
|
||||||
|
/* LABEL_NAMESPACE may be used for names of labels (for gotos);
|
||||||
|
currently it is not used and labels are not recorded at all. */
|
||||||
|
|
||||||
|
LABEL_NAMESPACE
|
||||||
};
|
};
|
||||||
|
|
||||||
/* An address-class says where to find the value of a symbol. */
|
/* An address-class says where to find the value of a symbol. */
|
||||||
|
|
||||||
enum address_class
|
enum address_class
|
||||||
{
|
{
|
||||||
LOC_UNDEF, /* Not used; catches errors */
|
/* Not used; catches errors */
|
||||||
LOC_CONST, /* Value is constant int SYMBOL_VALUE, host byteorder */
|
|
||||||
LOC_STATIC, /* Value is at fixed address SYMBOL_VALUE_ADDRESS */
|
LOC_UNDEF,
|
||||||
LOC_REGISTER, /* Value is in register */
|
|
||||||
LOC_ARG, /* Value is at spec'd offset in arglist */
|
/* Value is constant int SYMBOL_VALUE, host byteorder */
|
||||||
LOC_REF_ARG, /* Value address is at spec'd offset in arglist. */
|
|
||||||
LOC_REGPARM, /* Value is at spec'd offset in register window */
|
LOC_CONST,
|
||||||
LOC_LOCAL, /* Value is at spec'd offset in stack frame */
|
|
||||||
LOC_TYPEDEF, /* Value not used; definition in SYMBOL_TYPE
|
/* Value is at fixed address SYMBOL_VALUE_ADDRESS */
|
||||||
Symbols in the namespace STRUCT_NAMESPACE
|
|
||||||
all have this class. */
|
LOC_STATIC,
|
||||||
LOC_LABEL, /* Value is address SYMBOL_VALUE_ADDRESS in the code */
|
|
||||||
LOC_BLOCK, /* Value is address SYMBOL_VALUE_BLOCK of a
|
/* Value is in register */
|
||||||
`struct block'. Function names have this class. */
|
|
||||||
LOC_CONST_BYTES, /* Value is a constant byte-sequence pointed to by
|
LOC_REGISTER,
|
||||||
SYMBOL_VALUE_ADDRESS, in target byte order. */
|
|
||||||
LOC_LOCAL_ARG /* Value is arg at spec'd offset in stack frame.
|
/* Value is at spec'd offset in arglist */
|
||||||
Differs from LOC_LOCAL in that symbol is an
|
|
||||||
argument; differs from LOC_ARG in that we find it
|
LOC_ARG,
|
||||||
in the frame (FRAME_LOCALS_ADDRESS), not in the
|
|
||||||
arglist (FRAME_ARGS_ADDRESS). Added for i960,
|
/* Value address is at spec'd offset in arglist. */
|
||||||
which passes args in regs then copies to frame. */
|
|
||||||
|
LOC_REF_ARG,
|
||||||
|
|
||||||
|
/* Value is at spec'd offset in register window */
|
||||||
|
|
||||||
|
LOC_REGPARM,
|
||||||
|
|
||||||
|
/* Value is at spec'd offset in stack frame */
|
||||||
|
|
||||||
|
LOC_LOCAL,
|
||||||
|
|
||||||
|
/* Value not used; definition in SYMBOL_TYPE. Symbols in the namespace
|
||||||
|
STRUCT_NAMESPACE all have this class. */
|
||||||
|
|
||||||
|
LOC_TYPEDEF,
|
||||||
|
|
||||||
|
/* Value is address SYMBOL_VALUE_ADDRESS in the code */
|
||||||
|
|
||||||
|
LOC_LABEL,
|
||||||
|
|
||||||
|
/* Value is address SYMBOL_VALUE_BLOCK of a `struct block'. Function names
|
||||||
|
have this class. */
|
||||||
|
|
||||||
|
LOC_BLOCK,
|
||||||
|
|
||||||
|
/* Value is a constant byte-sequence pointed to by SYMBOL_VALUE_ADDRESS, in
|
||||||
|
target byte order. */
|
||||||
|
|
||||||
|
LOC_CONST_BYTES,
|
||||||
|
|
||||||
|
/* Value is arg at spec'd offset in stack frame. Differs from LOC_LOCAL in
|
||||||
|
that symbol is an argument; differs from LOC_ARG in that we find it
|
||||||
|
in the frame (FRAME_LOCALS_ADDRESS), not in the arglist
|
||||||
|
(FRAME_ARGS_ADDRESS). Added for i960, which passes args in regs then
|
||||||
|
copies to frame. */
|
||||||
|
|
||||||
|
LOC_LOCAL_ARG
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbol
|
struct symbol
|
||||||
{
|
{
|
||||||
/* Symbol name */
|
|
||||||
char *name;
|
/* The general symbol info required for all types of symbols. */
|
||||||
|
|
||||||
|
struct general_symbol_info ginfo;
|
||||||
|
|
||||||
/* Name space code. */
|
/* Name space code. */
|
||||||
|
|
||||||
enum namespace namespace;
|
enum namespace namespace;
|
||||||
|
|
||||||
/* Address class */
|
/* Address class */
|
||||||
|
|
||||||
enum address_class class;
|
enum address_class class;
|
||||||
|
|
||||||
/* Data type of value */
|
/* Data type of value */
|
||||||
|
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
/* Line number of definition. */
|
/* Line number of definition. FIXME: Should we really make the assumption
|
||||||
unsigned short line;
|
that nobody will try to debug files longer than 64K lines? What about
|
||||||
|
machine generated programs? */
|
||||||
|
|
||||||
/* constant value, or address if static, or register number,
|
unsigned short line;
|
||||||
or offset in arguments, or offset in stack frame. All of
|
|
||||||
these are in host byte order (though what they point to might
|
|
||||||
be in target byte order, e.g. LOC_CONST_BYTES). */
|
|
||||||
union
|
|
||||||
{
|
|
||||||
long value; /* for LOC_CONST, LOC_REGISTER, LOC_ARG,
|
|
||||||
LOC_REF_ARG, LOC_REGPARM, LOC_LOCAL */
|
|
||||||
struct block *block; /* for LOC_BLOCK */
|
|
||||||
char *bytes; /* for LOC_CONST_BYTES */
|
|
||||||
CORE_ADDR address; /* for LOC_STATIC, LOC_LABEL */
|
|
||||||
struct symbol *chain; /* for opaque typedef struct chain */
|
|
||||||
}
|
|
||||||
value;
|
|
||||||
|
|
||||||
/* Some symbols require an additional value to be recorded on a per-
|
/* Some symbols require an additional value to be recorded on a per-
|
||||||
symbol basis. Stash those values here. */
|
symbol basis. Stash those values here. */
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct /* for OP_BASEREG in DWARF location specs */
|
/* for OP_BASEREG in DWARF location specs */
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
short regno_valid; /* 0 == regno invalid; !0 == regno valid */
|
short regno_valid; /* 0 == regno invalid; !0 == regno valid */
|
||||||
short regno; /* base register number {0, 1, 2, ...} */
|
short regno; /* base register number {0, 1, 2, ...} */
|
||||||
} basereg;
|
} basereg;
|
||||||
}
|
}
|
||||||
aux_value;
|
aux_value;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
|
||||||
|
#define SYMBOL_CLASS(symbol) (symbol)->class
|
||||||
|
#define SYMBOL_TYPE(symbol) (symbol)->type
|
||||||
|
#define SYMBOL_LINE(symbol) (symbol)->line
|
||||||
|
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno
|
||||||
|
|
||||||
|
/* This currently fails because some symbols are not being initialized
|
||||||
|
to zero on allocation, and no code is currently setting this value.
|
||||||
|
Basereg handling will probably change significantly in the next release.
|
||||||
|
FIXME -fnf */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid
|
||||||
|
#else
|
||||||
|
#define SYMBOL_BASEREG_VALID(symbol) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* A partial_symbol records the name, namespace, and address class of
|
/* A partial_symbol records the name, namespace, and address class of
|
||||||
symbols whose types we have not parsed yet. For functions, it also
|
symbols whose types we have not parsed yet. For functions, it also
|
||||||
contains their memory address, so we can find them from a PC value.
|
contains their memory address, so we can find them from a PC value.
|
||||||
|
@ -275,28 +478,27 @@ struct symbol
|
||||||
|
|
||||||
struct partial_symbol
|
struct partial_symbol
|
||||||
{
|
{
|
||||||
/* Symbol name */
|
|
||||||
char *name;
|
/* The general symbol info required for all types of symbols. */
|
||||||
|
|
||||||
|
struct general_symbol_info ginfo;
|
||||||
|
|
||||||
/* Name space code. */
|
/* Name space code. */
|
||||||
|
|
||||||
enum namespace namespace;
|
enum namespace namespace;
|
||||||
|
|
||||||
/* Address class (for info_symbols) */
|
/* Address class (for info_symbols) */
|
||||||
|
|
||||||
enum address_class class;
|
enum address_class class;
|
||||||
/* Value (only used for static functions currently). Done this
|
|
||||||
way so that we can use the struct symbol macros.
|
|
||||||
Note that the address of a function is SYMBOL_VALUE_ADDRESS (pst)
|
|
||||||
in a partial symbol table, but BLOCK_START (SYMBOL_BLOCK_VALUE (st))
|
|
||||||
in a symbol table. */
|
|
||||||
union
|
|
||||||
{
|
|
||||||
long value;
|
|
||||||
CORE_ADDR address;
|
|
||||||
}
|
|
||||||
value;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PSYMBOL_NAMESPACE(psymbol) (psymbol)->namespace
|
||||||
|
#define PSYMBOL_CLASS(psymbol) (psymbol)->class
|
||||||
|
|
||||||
|
|
||||||
/* Source-file information.
|
/* Source-file information. This describes the relation between source files,
|
||||||
This describes the relation between source files and line numbers
|
ine numbers and addresses in the program text. */
|
||||||
and addresses in the program text. */
|
|
||||||
|
|
||||||
struct sourcevector
|
struct sourcevector
|
||||||
{
|
{
|
||||||
|
@ -356,50 +558,84 @@ struct section_offsets
|
||||||
|
|
||||||
struct symtab
|
struct symtab
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Chain of all existing symtabs. */
|
/* Chain of all existing symtabs. */
|
||||||
|
|
||||||
struct symtab *next;
|
struct symtab *next;
|
||||||
|
|
||||||
/* List of all symbol scope blocks for this symtab. */
|
/* List of all symbol scope blocks for this symtab. */
|
||||||
|
|
||||||
struct blockvector *blockvector;
|
struct blockvector *blockvector;
|
||||||
|
|
||||||
/* Table mapping core addresses to line numbers for this file.
|
/* Table mapping core addresses to line numbers for this file.
|
||||||
Can be NULL if none. */
|
Can be NULL if none. */
|
||||||
|
|
||||||
struct linetable *linetable;
|
struct linetable *linetable;
|
||||||
|
|
||||||
/* Name of this source file. */
|
/* Name of this source file. */
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
/* Directory in which it was compiled, or NULL if we don't know. */
|
/* Directory in which it was compiled, or NULL if we don't know. */
|
||||||
|
|
||||||
char *dirname;
|
char *dirname;
|
||||||
|
|
||||||
/* This component says how to free the data we point to:
|
/* This component says how to free the data we point to:
|
||||||
free_contents => do a tree walk and free each object.
|
free_contents => do a tree walk and free each object.
|
||||||
free_nothing => do nothing; some other symtab will free
|
free_nothing => do nothing; some other symtab will free
|
||||||
the data this one uses.
|
the data this one uses.
|
||||||
free_linetable => free just the linetable. */
|
free_linetable => free just the linetable. */
|
||||||
enum free_code {free_nothing, free_contents, free_linetable}
|
|
||||||
|
enum free_code
|
||||||
|
{
|
||||||
|
free_nothing, free_contents, free_linetable
|
||||||
|
}
|
||||||
free_code;
|
free_code;
|
||||||
|
|
||||||
/* Pointer to one block of storage to be freed, if nonzero. */
|
/* Pointer to one block of storage to be freed, if nonzero. */
|
||||||
/* This is IN ADDITION to the action indicated by free_code. */
|
/* This is IN ADDITION to the action indicated by free_code. */
|
||||||
|
|
||||||
char *free_ptr;
|
char *free_ptr;
|
||||||
|
|
||||||
/* Total number of lines found in source file. */
|
/* Total number of lines found in source file. */
|
||||||
|
|
||||||
int nlines;
|
int nlines;
|
||||||
|
|
||||||
/* Array mapping line number to character position. */
|
/* Array mapping line number to character position. */
|
||||||
|
|
||||||
int *line_charpos;
|
int *line_charpos;
|
||||||
|
|
||||||
/* Language of this source file. */
|
/* Language of this source file. */
|
||||||
|
|
||||||
enum language language;
|
enum language language;
|
||||||
|
|
||||||
/* String of version information. May be zero. */
|
/* String of version information. May be zero. */
|
||||||
|
|
||||||
char *version;
|
char *version;
|
||||||
|
|
||||||
/* Full name of file as found by searching the source path.
|
/* Full name of file as found by searching the source path.
|
||||||
0 if not yet known. */
|
NULL if not yet known. */
|
||||||
|
|
||||||
char *fullname;
|
char *fullname;
|
||||||
|
|
||||||
/* Object file from which this symbol information was read. */
|
/* Object file from which this symbol information was read. */
|
||||||
|
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
|
|
||||||
/* Anything extra for this symtab. This is for target machines
|
/* Anything extra for this symtab. This is for target machines
|
||||||
with special debugging info of some sort (which cannot just
|
with special debugging info of some sort (which cannot just
|
||||||
be represented in a normal symtab). */
|
be represented in a normal symtab). */
|
||||||
|
|
||||||
#if defined (EXTRA_SYMTAB_INFO)
|
#if defined (EXTRA_SYMTAB_INFO)
|
||||||
EXTRA_SYMTAB_INFO
|
EXTRA_SYMTAB_INFO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define BLOCKVECTOR(symtab) (symtab)->blockvector
|
||||||
|
#define LINETABLE(symtab) (symtab)->linetable
|
||||||
|
|
||||||
|
|
||||||
/* Each source file that has not been fully read in is represented by
|
/* Each source file that has not been fully read in is represented by
|
||||||
a partial_symtab. This contains the information on where in the
|
a partial_symtab. This contains the information on where in the
|
||||||
executable the debugging symbols for a specific file are, and a
|
executable the debugging symbols for a specific file are, and a
|
||||||
|
@ -413,31 +649,46 @@ struct symtab
|
||||||
|
|
||||||
struct partial_symtab
|
struct partial_symtab
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Chain of all existing partial symtabs. */
|
/* Chain of all existing partial symtabs. */
|
||||||
|
|
||||||
struct partial_symtab *next;
|
struct partial_symtab *next;
|
||||||
|
|
||||||
/* Name of the source file which this partial_symtab defines */
|
/* Name of the source file which this partial_symtab defines */
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
/* Information about the object file from which symbols should be read. */
|
/* Information about the object file from which symbols should be read. */
|
||||||
|
|
||||||
struct objfile *objfile;
|
struct objfile *objfile;
|
||||||
|
|
||||||
/* Set of relocation offsets to apply to each section. */
|
/* Set of relocation offsets to apply to each section. */
|
||||||
|
|
||||||
struct section_offsets *section_offsets;
|
struct section_offsets *section_offsets;
|
||||||
|
|
||||||
/* Range of text addresses covered by this file; texthigh is the
|
/* Range of text addresses covered by this file; texthigh is the
|
||||||
beginning of the next section. */
|
beginning of the next section. */
|
||||||
CORE_ADDR textlow, texthigh;
|
|
||||||
|
CORE_ADDR textlow;
|
||||||
|
CORE_ADDR texthigh;
|
||||||
|
|
||||||
/* Array of pointers to all of the partial_symtab's which this one
|
/* Array of pointers to all of the partial_symtab's which this one
|
||||||
depends on. Since this array can only be set to previous or
|
depends on. Since this array can only be set to previous or
|
||||||
the current (?) psymtab, this dependency tree is guaranteed not
|
the current (?) psymtab, this dependency tree is guaranteed not
|
||||||
to have any loops. */
|
to have any loops. */
|
||||||
|
|
||||||
struct partial_symtab **dependencies;
|
struct partial_symtab **dependencies;
|
||||||
|
|
||||||
int number_of_dependencies;
|
int number_of_dependencies;
|
||||||
|
|
||||||
/* Global symbol list. This list will be sorted after readin to
|
/* Global symbol list. This list will be sorted after readin to
|
||||||
improve access. Binary search will be the usual method of
|
improve access. Binary search will be the usual method of
|
||||||
finding a symbol within it. globals_offset is an integer offset
|
finding a symbol within it. globals_offset is an integer offset
|
||||||
within global_psymbols[]. */
|
within global_psymbols[]. */
|
||||||
int globals_offset, n_global_syms;
|
|
||||||
|
int globals_offset;
|
||||||
|
int n_global_syms;
|
||||||
|
|
||||||
/* Static symbol list. This list will *not* be sorted after readin;
|
/* Static symbol list. This list will *not* be sorted after readin;
|
||||||
to find a symbol in it, exhaustive search must be used. This is
|
to find a symbol in it, exhaustive search must be used. This is
|
||||||
reasonable because searches through this list will eventually
|
reasonable because searches through this list will eventually
|
||||||
|
@ -445,80 +696,40 @@ struct partial_symtab
|
||||||
to take a *lot* of time; check) or an error (and we don't care
|
to take a *lot* of time; check) or an error (and we don't care
|
||||||
how long errors take). This is an offset and size within
|
how long errors take). This is an offset and size within
|
||||||
static_psymbols[]. */
|
static_psymbols[]. */
|
||||||
int statics_offset, n_static_syms;
|
|
||||||
|
int statics_offset;
|
||||||
|
int n_static_syms;
|
||||||
|
|
||||||
/* Pointer to symtab eventually allocated for this source file, 0 if
|
/* Pointer to symtab eventually allocated for this source file, 0 if
|
||||||
!readin or if we haven't looked for the symtab after it was readin. */
|
!readin or if we haven't looked for the symtab after it was readin. */
|
||||||
|
|
||||||
struct symtab *symtab;
|
struct symtab *symtab;
|
||||||
|
|
||||||
/* Pointer to function which will read in the symtab corresponding to
|
/* Pointer to function which will read in the symtab corresponding to
|
||||||
this psymtab. */
|
this psymtab. */
|
||||||
|
|
||||||
void (*read_symtab) PARAMS ((struct partial_symtab *));
|
void (*read_symtab) PARAMS ((struct partial_symtab *));
|
||||||
|
|
||||||
/* Information that lets read_symtab() locate the part of the symbol table
|
/* Information that lets read_symtab() locate the part of the symbol table
|
||||||
that this psymtab corresponds to. This information is private to the
|
that this psymtab corresponds to. This information is private to the
|
||||||
format-dependent symbol reading routines. For further detail examine
|
format-dependent symbol reading routines. For further detail examine
|
||||||
the various symbol reading modules. Should really be (void *) but is
|
the various symbol reading modules. Should really be (void *) but is
|
||||||
(char *) as with other such gdb variables. (FIXME) */
|
(char *) as with other such gdb variables. (FIXME) */
|
||||||
|
|
||||||
char *read_symtab_private;
|
char *read_symtab_private;
|
||||||
/* Non-zero if the symtab corresponding to this psymtab has been
|
|
||||||
readin */
|
/* Non-zero if the symtab corresponding to this psymtab has been readin */
|
||||||
|
|
||||||
unsigned char readin;
|
unsigned char readin;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A fast way to get from a psymtab to its symtab (after the first time). */
|
/* A fast way to get from a psymtab to its symtab (after the first time). */
|
||||||
#define PSYMTAB_TO_SYMTAB(pst) ((pst)->symtab? \
|
#define PSYMTAB_TO_SYMTAB(pst) \
|
||||||
(pst)->symtab: \
|
((pst) -> symtab != NULL ? (pst) -> symtab : psymtab_to_symtab (pst))
|
||||||
psymtab_to_symtab (pst) )
|
|
||||||
|
|
||||||
/* This symtab variable specifies the current file for printing source lines */
|
|
||||||
|
|
||||||
extern struct symtab *current_source_symtab;
|
|
||||||
|
|
||||||
/* This is the next line to print for listing source lines. */
|
|
||||||
|
|
||||||
extern int current_source_line;
|
|
||||||
|
|
||||||
#define BLOCKVECTOR(symtab) (symtab)->blockvector
|
|
||||||
|
|
||||||
#define LINETABLE(symtab) (symtab)->linetable
|
|
||||||
|
|
||||||
/* Macros normally used to access components of symbol table structures. */
|
/* The virtual function table is now an array of structures which have the
|
||||||
|
form { int16 offset, delta; void *pfn; }.
|
||||||
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
|
|
||||||
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
|
|
||||||
|
|
||||||
#define BLOCK_START(bl) (bl)->startaddr
|
|
||||||
#define BLOCK_END(bl) (bl)->endaddr
|
|
||||||
#define BLOCK_NSYMS(bl) (bl)->nsyms
|
|
||||||
#define BLOCK_SYM(bl, n) (bl)->sym[n]
|
|
||||||
#define BLOCK_FUNCTION(bl) (bl)->function
|
|
||||||
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
|
|
||||||
#define BLOCK_GCC_COMPILED(bl) (bl)->gcc_compile_flag
|
|
||||||
|
|
||||||
/* Nonzero if symbols of block BL should be sorted alphabetically. */
|
|
||||||
#define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40)
|
|
||||||
|
|
||||||
#define SYMBOL_NAME(symbol) (symbol)->name
|
|
||||||
#define SYMBOL_NAMESPACE(symbol) (symbol)->namespace
|
|
||||||
#define SYMBOL_CLASS(symbol) (symbol)->class
|
|
||||||
#define SYMBOL_VALUE(symbol) (symbol)->value.value
|
|
||||||
#define SYMBOL_VALUE_ADDRESS(symbol) (symbol)->value.address
|
|
||||||
#define SYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes
|
|
||||||
#define SYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block
|
|
||||||
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
|
|
||||||
#define SYMBOL_TYPE(symbol) (symbol)->type
|
|
||||||
#define SYMBOL_LINE(symbol) (symbol)->line
|
|
||||||
#if 0
|
|
||||||
/* This currently fails because some symbols are not being initialized
|
|
||||||
to zero on allocation, and no code is currently setting this value.
|
|
||||||
Basereg handling will probably change significantly in the next release.
|
|
||||||
FIXME -fnf */
|
|
||||||
#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid
|
|
||||||
#else
|
|
||||||
#define SYMBOL_BASEREG_VALID(symbol) 0
|
|
||||||
#endif
|
|
||||||
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno
|
|
||||||
|
|
||||||
/* The virtual function table is now an array of structures
|
|
||||||
which have the form { int16 offset, delta; void *pfn; }.
|
|
||||||
|
|
||||||
In normal virtual function tables, OFFSET is unused.
|
In normal virtual function tables, OFFSET is unused.
|
||||||
DELTA is the amount which is added to the apparent object's base
|
DELTA is the amount which is added to the apparent object's base
|
||||||
|
@ -528,19 +739,31 @@ extern int current_source_line;
|
||||||
|
|
||||||
#define VTBL_FNADDR_OFFSET 2
|
#define VTBL_FNADDR_OFFSET 2
|
||||||
|
|
||||||
/* Macro that yields non-zero value iff NAME is the prefix
|
/* Macro that yields non-zero value iff NAME is the prefix for C++ operator
|
||||||
for C++ operator names. If you leave out the parenthesis
|
names. If you leave out the parenthesis here you will lose!
|
||||||
here you will lose!
|
|
||||||
|
|
||||||
Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
|
Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
|
||||||
symbol-file and the names in gdb's symbol table. */
|
symbol-file and the names in gdb's symbol table. */
|
||||||
#define OPNAME_PREFIX_P(NAME) ((NAME)[0] == 'o' && (NAME)[1] == 'p' \
|
|
||||||
&& (NAME)[2] == CPLUS_MARKER)
|
|
||||||
|
|
||||||
#define VTBL_PREFIX_P(NAME) ((NAME)[3] == CPLUS_MARKER \
|
#define OPNAME_PREFIX_P(NAME) \
|
||||||
&& !strncmp ((NAME), "_vt", 3))
|
((NAME)[0] == 'o' && (NAME)[1] == 'p' && (NAME)[2] == CPLUS_MARKER)
|
||||||
|
|
||||||
|
#define VTBL_PREFIX_P(NAME) \
|
||||||
|
((NAME)[3] == CPLUS_MARKER && !strncmp ((NAME), "_vt", 3))
|
||||||
|
|
||||||
|
|
||||||
/* Functions that work on the objects described above */
|
/* External variables and functions for the objects described above. */
|
||||||
|
|
||||||
|
/* This symtab variable specifies the current file for printing source lines */
|
||||||
|
|
||||||
|
extern struct symtab *current_source_symtab;
|
||||||
|
|
||||||
|
/* This is the next line to print for listing source lines. */
|
||||||
|
|
||||||
|
extern int current_source_line;
|
||||||
|
|
||||||
|
/* See the comment in symfile.c about how current_objfile is used. */
|
||||||
|
|
||||||
|
extern struct objfile *current_objfile;
|
||||||
|
|
||||||
extern struct symtab *
|
extern struct symtab *
|
||||||
lookup_symtab PARAMS ((char *));
|
lookup_symtab PARAMS ((char *));
|
||||||
|
@ -562,15 +785,6 @@ lookup_union PARAMS ((char *, struct block *));
|
||||||
extern struct type *
|
extern struct type *
|
||||||
lookup_enum PARAMS ((char *, struct block *));
|
lookup_enum PARAMS ((char *, struct block *));
|
||||||
|
|
||||||
extern struct type *
|
|
||||||
check_struct PARAMS ((struct type *));
|
|
||||||
|
|
||||||
extern struct type *
|
|
||||||
check_union PARAMS ((struct type *));
|
|
||||||
|
|
||||||
extern struct type *
|
|
||||||
check_enum PARAMS ((struct type *));
|
|
||||||
|
|
||||||
extern struct symbol *
|
extern struct symbol *
|
||||||
block_function PARAMS ((struct block *));
|
block_function PARAMS ((struct block *));
|
||||||
|
|
||||||
|
@ -645,9 +859,8 @@ struct symtabs_and_lines
|
||||||
int nelts;
|
int nelts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Given a pc value, return line number it is in.
|
/* Given a pc value, return line number it is in. Second arg nonzero means
|
||||||
Second arg nonzero means if pc is on the boundary
|
if pc is on the boundary use the previous statement's line number. */
|
||||||
use the previous statement's line number. */
|
|
||||||
|
|
||||||
extern struct symtab_and_line
|
extern struct symtab_and_line
|
||||||
find_pc_line PARAMS ((CORE_ADDR, int));
|
find_pc_line PARAMS ((CORE_ADDR, int));
|
||||||
|
@ -663,8 +876,8 @@ find_line_pc_range PARAMS ((struct symtab *, int, CORE_ADDR *, CORE_ADDR *));
|
||||||
extern void
|
extern void
|
||||||
resolve_sal_pc PARAMS ((struct symtab_and_line *));
|
resolve_sal_pc PARAMS ((struct symtab_and_line *));
|
||||||
|
|
||||||
/* Given a string, return the line specified by it.
|
/* Given a string, return the line specified by it. For commands like "list"
|
||||||
For commands like "list" and "breakpoint". */
|
and "breakpoint". */
|
||||||
|
|
||||||
extern struct symtabs_and_lines
|
extern struct symtabs_and_lines
|
||||||
decode_line_spec PARAMS ((char *, int));
|
decode_line_spec PARAMS ((char *, int));
|
||||||
|
@ -732,9 +945,6 @@ clear_symtab_users_once PARAMS ((void));
|
||||||
extern struct partial_symtab *
|
extern struct partial_symtab *
|
||||||
find_main_psymtab PARAMS ((void));
|
find_main_psymtab PARAMS ((void));
|
||||||
|
|
||||||
extern struct type *
|
|
||||||
find_nested_type PARAMS ((struct type *, char*));
|
|
||||||
|
|
||||||
/* blockframe.c */
|
/* blockframe.c */
|
||||||
|
|
||||||
extern struct blockvector *
|
extern struct blockvector *
|
||||||
|
|
|
@ -710,5 +710,5 @@ extern void pop_frame ();
|
||||||
(((num) > LR0_REGNUM + 127) \
|
(((num) > LR0_REGNUM + 127) \
|
||||||
? fprintf(stderr, \
|
? fprintf(stderr, \
|
||||||
"Invalid register number %d in symbol table entry for %s\n", \
|
"Invalid register number %d in symbol table entry for %s\n", \
|
||||||
(num), SYMBOL_NAME (sym)), (num) \
|
(num), SYMBOL_SOURCE_NAME (sym)), (num) \
|
||||||
: (num))
|
: (num))
|
||||||
|
|
|
@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
The horribly ugly wait_for_inferior() routine uses this macro to detect
|
The horribly ugly wait_for_inferior() routine uses this macro to detect
|
||||||
when we have stepped into one of these fragments. */
|
when we have stepped into one of these fragments. */
|
||||||
|
|
||||||
#define IN_SOLIB_TRAMPOLINE(pc,name) ((name) && (strcmp ("_init", name) == 0))
|
#define IN_SOLIB_TRAMPOLINE(pc,name) ((name) && (STREQ ("_init", name)))
|
||||||
|
|
||||||
/* In SVR4 ELF files, the ABI defines (pg. 4-25) that "External C symbols
|
/* In SVR4 ELF files, the ABI defines (pg. 4-25) that "External C symbols
|
||||||
have the same names in C, assembly code, and object files' symbol
|
have the same names in C, assembly code, and object files' symbol
|
||||||
|
|
|
@ -177,7 +177,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
*/
|
*/
|
||||||
#if !defined(KERNEL_DEBUGGING)
|
#if !defined(KERNEL_DEBUGGING)
|
||||||
#ifdef SYM1
|
#ifdef SYM1
|
||||||
# define IN_SIGTRAMP(pc, name) (name && !strcmp ("sigtramp", name))
|
# define IN_SIGTRAMP(pc, name) (name && STREQ ("sigtramp", name))
|
||||||
#else
|
#else
|
||||||
Need to define IN_SIGTRAMP() for sym2.
|
Need to define IN_SIGTRAMP() for sym2.
|
||||||
#endif
|
#endif
|
||||||
|
|
40
gdb/utils.c
40
gdb/utils.c
|
@ -1401,9 +1401,9 @@ fprint_symbol (stream, name)
|
||||||
don't (slightly different than strcmp()'s range of return values).
|
don't (slightly different than strcmp()'s range of return values).
|
||||||
|
|
||||||
As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
|
As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
|
||||||
This "feature" is useful for demangle_and_match(), which is used
|
This "feature" is useful when searching for matching C++ function names
|
||||||
when searching for matching C++ function names (such as if the
|
(such as if the user types 'break FOO', where FOO is a mangled C++
|
||||||
user types 'break FOO', where FOO is a mangled C++ function). */
|
function). */
|
||||||
|
|
||||||
int
|
int
|
||||||
strcmp_iw (string1, string2)
|
strcmp_iw (string1, string2)
|
||||||
|
@ -1433,40 +1433,6 @@ strcmp_iw (string1, string2)
|
||||||
return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0');
|
return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Demangle NAME and compare the result with LOOKFOR, ignoring any differences
|
|
||||||
in whitespace.
|
|
||||||
|
|
||||||
If a match is found, returns a pointer to the demangled version of NAME
|
|
||||||
in malloc'd memory, which needs to be freed by the caller after use.
|
|
||||||
If a match is not found, returns NULL.
|
|
||||||
|
|
||||||
OPTIONS is a flags word that controls the demangling process and is just
|
|
||||||
passed on to the demangler.
|
|
||||||
|
|
||||||
When the caller sees a non-NULL result, it knows that NAME is the mangled
|
|
||||||
equivalent of LOOKFOR, and it can use either NAME, the "official demangled"
|
|
||||||
version of NAME (the return value) or the "unofficial demangled" version
|
|
||||||
of NAME (LOOKFOR, which it already knows). */
|
|
||||||
|
|
||||||
char *
|
|
||||||
demangle_and_match (name, lookfor, options)
|
|
||||||
const char *name;
|
|
||||||
const char *lookfor;
|
|
||||||
int options;
|
|
||||||
{
|
|
||||||
char *demangled;
|
|
||||||
|
|
||||||
if ((demangled = cplus_demangle (name, options)) != NULL)
|
|
||||||
{
|
|
||||||
if (strcmp_iw (demangled, lookfor) != 0)
|
|
||||||
{
|
|
||||||
free (demangled);
|
|
||||||
demangled = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (demangled);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_utils ()
|
_initialize_utils ()
|
||||||
|
|
30
gdb/valops.c
30
gdb/valops.c
|
@ -25,6 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -420,7 +421,7 @@ value_of_variable (var)
|
||||||
|
|
||||||
val = read_var_value (var, (FRAME) 0);
|
val = read_var_value (var, (FRAME) 0);
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
error ("Address of symbol \"%s\" is unknown.", SYMBOL_NAME (var));
|
error ("Address of symbol \"%s\" is unknown.", SYMBOL_SOURCE_NAME (var));
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +951,7 @@ value_string (ptr, len)
|
||||||
val =
|
val =
|
||||||
value_from_longest (lookup_pointer_type (lookup_function_type (
|
value_from_longest (lookup_pointer_type (lookup_function_type (
|
||||||
lookup_pointer_type (builtin_type_char))),
|
lookup_pointer_type (builtin_type_char))),
|
||||||
(LONGEST) msymbol -> address);
|
(LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
|
||||||
else
|
else
|
||||||
error ("String constants require the program to have a function \"malloc\".");
|
error ("String constants require the program to have a function \"malloc\".");
|
||||||
}
|
}
|
||||||
|
@ -989,7 +990,7 @@ search_struct_field (name, arg1, offset, type, looking_for_baseclass)
|
||||||
{
|
{
|
||||||
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
||||||
|
|
||||||
if (t_field_name && !strcmp (t_field_name, name))
|
if (t_field_name && STREQ (t_field_name, name))
|
||||||
{
|
{
|
||||||
value v;
|
value v;
|
||||||
if (TYPE_FIELD_STATIC (type, i))
|
if (TYPE_FIELD_STATIC (type, i))
|
||||||
|
@ -997,8 +998,8 @@ search_struct_field (name, arg1, offset, type, looking_for_baseclass)
|
||||||
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, i);
|
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, i);
|
||||||
struct symbol *sym =
|
struct symbol *sym =
|
||||||
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
||||||
if (! sym) error (
|
if (sym == NULL)
|
||||||
"Internal error: could not find physical static variable named %s",
|
error ("Internal error: could not find physical static variable named %s",
|
||||||
phys_name);
|
phys_name);
|
||||||
v = value_at (TYPE_FIELD_TYPE (type, i),
|
v = value_at (TYPE_FIELD_TYPE (type, i),
|
||||||
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
||||||
|
@ -1017,7 +1018,7 @@ search_struct_field (name, arg1, offset, type, looking_for_baseclass)
|
||||||
/* If we are looking for baseclasses, this is what we get when we
|
/* If we are looking for baseclasses, this is what we get when we
|
||||||
hit them. */
|
hit them. */
|
||||||
int found_baseclass = (looking_for_baseclass
|
int found_baseclass = (looking_for_baseclass
|
||||||
&& !strcmp (name, TYPE_BASECLASS_NAME (type, i)));
|
&& STREQ (name, TYPE_BASECLASS_NAME (type, i)));
|
||||||
|
|
||||||
if (BASETYPE_VIA_VIRTUAL (type, i))
|
if (BASETYPE_VIA_VIRTUAL (type, i))
|
||||||
{
|
{
|
||||||
|
@ -1062,7 +1063,7 @@ search_struct_method (name, arg1p, args, offset, static_memfuncp, type)
|
||||||
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
|
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
||||||
if (t_field_name && !strcmp (t_field_name, name))
|
if (t_field_name && STREQ (t_field_name, name))
|
||||||
{
|
{
|
||||||
int j = TYPE_FN_FIELDLIST_LENGTH (type, i) - 1;
|
int j = TYPE_FN_FIELDLIST_LENGTH (type, i) - 1;
|
||||||
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
||||||
|
@ -1235,7 +1236,7 @@ destructor_name_p (name, type)
|
||||||
if (name[0] == '~')
|
if (name[0] == '~')
|
||||||
{
|
{
|
||||||
char *dname = type_name_no_tag (type);
|
char *dname = type_name_no_tag (type);
|
||||||
if (strcmp (dname, name+1))
|
if (!STREQ (dname, name+1))
|
||||||
error ("name of destructor must equal name of class");
|
error ("name of destructor must equal name of class");
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1257,7 +1258,7 @@ check_field_in (type, name)
|
||||||
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
|
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
|
||||||
{
|
{
|
||||||
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
char *t_field_name = TYPE_FIELD_NAME (type, i);
|
||||||
if (t_field_name && !strcmp (t_field_name, name))
|
if (t_field_name && STREQ (t_field_name, name))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1270,7 +1271,7 @@ check_field_in (type, name)
|
||||||
|
|
||||||
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
|
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (!strcmp (TYPE_FN_FIELDLIST_NAME (type, i), name))
|
if (STREQ (TYPE_FN_FIELDLIST_NAME (type, i), name))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1337,16 +1338,15 @@ value_struct_elt_for_reference (domain, offset, curtype, name, intype)
|
||||||
{
|
{
|
||||||
char *t_field_name = TYPE_FIELD_NAME (t, i);
|
char *t_field_name = TYPE_FIELD_NAME (t, i);
|
||||||
|
|
||||||
if (t_field_name && !strcmp (t_field_name, name))
|
if (t_field_name && STREQ (t_field_name, name))
|
||||||
{
|
{
|
||||||
if (TYPE_FIELD_STATIC (t, i))
|
if (TYPE_FIELD_STATIC (t, i))
|
||||||
{
|
{
|
||||||
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (t, i);
|
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (t, i);
|
||||||
struct symbol *sym =
|
struct symbol *sym =
|
||||||
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
||||||
if (! sym)
|
if (sym == NULL)
|
||||||
error (
|
error ("Internal error: could not find physical static variable named %s",
|
||||||
"Internal error: could not find physical static variable named %s",
|
|
||||||
phys_name);
|
phys_name);
|
||||||
return value_at (SYMBOL_TYPE (sym),
|
return value_at (SYMBOL_TYPE (sym),
|
||||||
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
|
||||||
|
@ -1376,7 +1376,7 @@ value_struct_elt_for_reference (domain, offset, curtype, name, intype)
|
||||||
|
|
||||||
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
|
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
|
||||||
{
|
{
|
||||||
if (!strcmp (TYPE_FN_FIELDLIST_NAME (t, i), name))
|
if (STREQ (TYPE_FN_FIELDLIST_NAME (t, i), name))
|
||||||
{
|
{
|
||||||
int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
|
int j = TYPE_FN_FIELDLIST_LENGTH (t, i);
|
||||||
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
|
||||||
|
|
12
gdb/values.c
12
gdb/values.c
|
@ -391,7 +391,7 @@ lookup_internalvar (name)
|
||||||
register struct internalvar *var;
|
register struct internalvar *var;
|
||||||
|
|
||||||
for (var = internalvars; var; var = var->next)
|
for (var = internalvars; var; var = var->next)
|
||||||
if (!strcmp (var->name, name))
|
if (STREQ (var->name, name))
|
||||||
return var;
|
return var;
|
||||||
|
|
||||||
var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
|
var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
|
||||||
|
@ -1045,7 +1045,7 @@ value_headof (arg, btype, dtype)
|
||||||
/* Check that VTBL looks like it points to a virtual function table. */
|
/* Check that VTBL looks like it points to a virtual function table. */
|
||||||
msymbol = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtbl));
|
msymbol = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtbl));
|
||||||
if (msymbol == NULL
|
if (msymbol == NULL
|
||||||
|| !VTBL_PREFIX_P (demangled_name = msymbol -> name))
|
|| !VTBL_PREFIX_P (demangled_name = SYMBOL_NAME (msymbol)))
|
||||||
{
|
{
|
||||||
/* If we expected to find a vtable, but did not, let the user
|
/* If we expected to find a vtable, but did not, let the user
|
||||||
know that we aren't happy, but don't throw an error.
|
know that we aren't happy, but don't throw an error.
|
||||||
|
@ -1091,8 +1091,8 @@ value_headof (arg, btype, dtype)
|
||||||
*(strchr (demangled_name, ':')) = '\0';
|
*(strchr (demangled_name, ':')) = '\0';
|
||||||
}
|
}
|
||||||
sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
|
sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
|
||||||
if (sym == 0)
|
if (sym == NULL)
|
||||||
error ("could not find type declaration for `%s'", SYMBOL_NAME (sym));
|
error ("could not find type declaration for `%s'", demangled_name);
|
||||||
if (best_entry)
|
if (best_entry)
|
||||||
{
|
{
|
||||||
free (demangled_name);
|
free (demangled_name);
|
||||||
|
@ -1152,7 +1152,7 @@ baseclass_offset (type, index, arg, offset)
|
||||||
in the fields. */
|
in the fields. */
|
||||||
for (i = n_baseclasses; i < len; i++)
|
for (i = n_baseclasses; i < len; i++)
|
||||||
{
|
{
|
||||||
if (! strcmp (vbase_name, TYPE_FIELD_NAME (type, i)))
|
if (STREQ (vbase_name, TYPE_FIELD_NAME (type, i)))
|
||||||
{
|
{
|
||||||
CORE_ADDR addr
|
CORE_ADDR addr
|
||||||
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
|
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
|
||||||
|
@ -1220,7 +1220,7 @@ baseclass_addr (type, index, valaddr, valuep, errp)
|
||||||
in the fields. */
|
in the fields. */
|
||||||
for (i = n_baseclasses; i < len; i++)
|
for (i = n_baseclasses; i < len; i++)
|
||||||
{
|
{
|
||||||
if (! strcmp (vbase_name, TYPE_FIELD_NAME (type, i)))
|
if (STREQ (vbase_name, TYPE_FIELD_NAME (type, i)))
|
||||||
{
|
{
|
||||||
value val = allocate_value (basetype);
|
value val = allocate_value (basetype);
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
|
|
@ -52,8 +52,6 @@ exec_close PARAMS ((int));
|
||||||
|
|
||||||
struct section_table *exec_sections, *exec_sections_end;
|
struct section_table *exec_sections, *exec_sections_end;
|
||||||
|
|
||||||
#define eq(s0, s1) !strcmp(s0, s1)
|
|
||||||
|
|
||||||
/* Whether to open exec and core files read-only or read-write. */
|
/* Whether to open exec and core files read-only or read-write. */
|
||||||
|
|
||||||
int write_files = 0;
|
int write_files = 0;
|
||||||
|
@ -293,7 +291,7 @@ sex_to_vmap(bfd *bf, sec_ptr sex, struct vmap_and_bfd *vmap_bfd)
|
||||||
if ((bfd_get_section_flags(bf, sex) & SEC_LOAD) == 0)
|
if ((bfd_get_section_flags(bf, sex) & SEC_LOAD) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!strcmp(bfd_section_name(bf, sex), ".text")) {
|
if (STREQ(bfd_section_name(bf, sex), ".text")) {
|
||||||
vp->tstart = 0;
|
vp->tstart = 0;
|
||||||
vp->tend = vp->tstart + bfd_section_size(bf, sex);
|
vp->tend = vp->tstart + bfd_section_size(bf, sex);
|
||||||
|
|
||||||
|
@ -305,12 +303,12 @@ sex_to_vmap(bfd *bf, sec_ptr sex, struct vmap_and_bfd *vmap_bfd)
|
||||||
vp->tadj = sex->filepos - bfd_section_vma(bf, sex);
|
vp->tadj = sex->filepos - bfd_section_vma(bf, sex);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strcmp(bfd_section_name(bf, sex), ".data")) {
|
else if (STREQ(bfd_section_name(bf, sex), ".data")) {
|
||||||
vp->dstart = 0;
|
vp->dstart = 0;
|
||||||
vp->dend = vp->dstart + bfd_section_size(bf, sex);
|
vp->dend = vp->dstart + bfd_section_size(bf, sex);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strcmp(bfd_section_name(bf, sex), ".bss")) /* FIXMEmgo */
|
else if (STREQ(bfd_section_name(bf, sex), ".bss")) /* FIXMEmgo */
|
||||||
printf ("bss section in exec! Don't know what the heck to do!\n");
|
printf ("bss section in exec! Don't know what the heck to do!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +577,7 @@ register struct ld_info *ldi; {
|
||||||
* FIXME??? am I tossing BFDs? bfd?
|
* FIXME??? am I tossing BFDs? bfd?
|
||||||
*/
|
*/
|
||||||
while (last = bfd_openr_next_archived_file(bfd, last))
|
while (last = bfd_openr_next_archived_file(bfd, last))
|
||||||
if (eq(mem, last->filename))
|
if (STREQ(mem, last->filename))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!last) {
|
if (!last) {
|
||||||
|
@ -631,12 +629,12 @@ vmap_exec ()
|
||||||
|
|
||||||
for (i=0; &exec_ops.to_sections[i] < exec_ops.to_sections_end; i++)
|
for (i=0; &exec_ops.to_sections[i] < exec_ops.to_sections_end; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(".text", exec_ops.to_sections[i].sec_ptr->name) == 0)
|
if (STREQ(".text", exec_ops.to_sections[i].sec_ptr->name))
|
||||||
{
|
{
|
||||||
exec_ops.to_sections[i].addr += vmap->tstart;
|
exec_ops.to_sections[i].addr += vmap->tstart;
|
||||||
exec_ops.to_sections[i].endaddr += vmap->tstart;
|
exec_ops.to_sections[i].endaddr += vmap->tstart;
|
||||||
}
|
}
|
||||||
else if (strcmp(".data", exec_ops.to_sections[i].sec_ptr->name) == 0)
|
else if (STREQ(".data", exec_ops.to_sections[i].sec_ptr->name))
|
||||||
{
|
{
|
||||||
exec_ops.to_sections[i].addr += vmap->dstart;
|
exec_ops.to_sections[i].addr += vmap->dstart;
|
||||||
exec_ops.to_sections[i].endaddr += vmap->dstart;
|
exec_ops.to_sections[i].endaddr += vmap->dstart;
|
||||||
|
@ -707,8 +705,8 @@ retry:
|
||||||
|
|
||||||
/* The filenames are not always sufficient to match on. */
|
/* The filenames are not always sufficient to match on. */
|
||||||
|
|
||||||
if ((name[0] == "/" && !eq(name, vp->name))
|
if ((name[0] == "/" && !STREQ(name, vp->name))
|
||||||
|| (memb[0] && !eq(memb, vp->member)))
|
|| (memb[0] && !STREQ(memb, vp->member)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
io = bfd_cache_lookup(vp->bfd); /* totally opaque! */
|
io = bfd_cache_lookup(vp->bfd); /* totally opaque! */
|
||||||
|
|
|
@ -233,7 +233,7 @@ compare_symbols (s1p, s2p)
|
||||||
/* Names that are less should come first. */
|
/* Names that are less should come first. */
|
||||||
register struct symbol **s1 = (struct symbol **) s1p;
|
register struct symbol **s1 = (struct symbol **) s1p;
|
||||||
register struct symbol **s2 = (struct symbol **) s2p;
|
register struct symbol **s2 = (struct symbol **) s2p;
|
||||||
register int namediff = strcmp (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
|
register int namediff = STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
|
||||||
if (namediff != 0)
|
if (namediff != 0)
|
||||||
return namediff;
|
return namediff;
|
||||||
|
|
||||||
|
@ -1419,7 +1419,7 @@ function_entry_point:
|
||||||
|
|
||||||
|
|
||||||
case C_FCN:
|
case C_FCN:
|
||||||
if (strcmp (cs->c_name, ".bf") == 0) {
|
if (STREQ (cs->c_name, ".bf")) {
|
||||||
|
|
||||||
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
||||||
main_aux);
|
main_aux);
|
||||||
|
@ -1503,7 +1503,7 @@ function_entry_point:
|
||||||
(fcn_cs_saved.c_value, fcn_stab_saved.c_name, 0, 0, objfile);
|
(fcn_cs_saved.c_value, fcn_stab_saved.c_name, 0, 0, objfile);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (strcmp (cs->c_name, ".ef") == 0) {
|
else if (STREQ (cs->c_name, ".ef")) {
|
||||||
|
|
||||||
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
||||||
main_aux);
|
main_aux);
|
||||||
|
@ -1565,11 +1565,11 @@ function_entry_point:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case C_BLOCK :
|
case C_BLOCK :
|
||||||
if (strcmp (cs->c_name, ".bb") == 0) {
|
if (STREQ (cs->c_name, ".bb")) {
|
||||||
depth++;
|
depth++;
|
||||||
new = push_context (depth, cs->c_value);
|
new = push_context (depth, cs->c_value);
|
||||||
}
|
}
|
||||||
else if (strcmp (cs->c_name, ".eb") == 0) {
|
else if (STREQ (cs->c_name, ".eb")) {
|
||||||
new = pop_context ();
|
new = pop_context ();
|
||||||
if (depth != new->depth)
|
if (depth != new->depth)
|
||||||
error ("Invalid symbol data: .bb/.eb symbol mismatch at symbol %d.",
|
error ("Invalid symbol data: .bb/.eb symbol mismatch at symbol %d.",
|
||||||
|
@ -1951,7 +1951,7 @@ read_symbol_lineno (symtable, symno)
|
||||||
for (ii = 0; ii < 50; ii++) {
|
for (ii = 0; ii < 50; ii++) {
|
||||||
bfd_coff_swap_sym_in (symfile_bfd,
|
bfd_coff_swap_sym_in (symfile_bfd,
|
||||||
symtable + (symno*local_symesz), symbol);
|
symtable + (symno*local_symesz), symbol);
|
||||||
if (symbol->n_sclass == C_FCN && 0 == strcmp (symbol->n_name, ".bf"))
|
if (symbol->n_sclass == C_FCN && STREQ (symbol->n_name, ".bf"))
|
||||||
goto gotit;
|
goto gotit;
|
||||||
symno += symbol->n_numaux+1;
|
symno += symbol->n_numaux+1;
|
||||||
}
|
}
|
||||||
|
@ -1986,7 +1986,7 @@ PTR vpinfo;
|
||||||
|
|
||||||
count = asect->lineno_count;
|
count = asect->lineno_count;
|
||||||
|
|
||||||
if (strcmp (asect->name, ".text") || count == 0)
|
if (!STREQ (asect->name, ".text") || count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size = count * coff_data (symfile_bfd)->local_linesz;
|
size = count * coff_data (symfile_bfd)->local_linesz;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue