For Sunos 4.x targets, enable gdb to set breakpoints in shared
library functions before the executable is run. Retrieve dynamic symbols from stripped executables. * symtab.h (minimal_symbol_type): Add mst_solib_trampoline type. * parse.c (write_exp_msymbol), symmisc.c (dump_msymbols), symtab.c (list_symbols): Handle mst_solib_trampoline. * minsyms.c (lookup_minimal_symbol): Handle mst_solib_trampoline for all targets, remove IBM6000_TARGET dependencies. * dbxread.c (read_dbx_dynamic_symtab): New function. * dbxread.c (dbx_symfile_read): Use it. * dbxread.c (SET_NAMESTRING): Set namestring to "<bad string table index>" instead of "foo" if the string index is corrupt. * xcoffread.c (read_xcoff_symtab): Use mst_solib_trampoline instead of mst_unknown. * symtab.c (list_symbols): Take from_tty as parameter and pass it to break_command. Handle mst_file_* minimal symbol types.
This commit is contained in:
parent
f1b4e13156
commit
ae6d035d28
5 changed files with 61 additions and 46 deletions
|
@ -1,3 +1,24 @@
|
|||
Tue Mar 15 13:39:23 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||
|
||||
For Sunos 4.x targets, enable gdb to set breakpoints in shared
|
||||
library functions before the executable is run. Retrieve dynamic
|
||||
symbols from stripped executables.
|
||||
* symtab.h (minimal_symbol_type): Add mst_solib_trampoline type.
|
||||
* parse.c (write_exp_msymbol), symmisc.c (dump_msymbols),
|
||||
symtab.c (list_symbols): Handle mst_solib_trampoline.
|
||||
* minsyms.c (lookup_minimal_symbol): Handle mst_solib_trampoline
|
||||
for all targets, remove IBM6000_TARGET dependencies.
|
||||
* dbxread.c (read_dbx_dynamic_symtab): New function.
|
||||
* dbxread.c (dbx_symfile_read): Use it.
|
||||
* dbxread.c (SET_NAMESTRING): Set namestring to
|
||||
"<bad string table index>" instead of "foo" if the string index is
|
||||
corrupt.
|
||||
* xcoffread.c (read_xcoff_symtab): Use mst_solib_trampoline instead
|
||||
of mst_unknown.
|
||||
* symtab.c (list_symbols): Take from_tty as parameter and pass it
|
||||
to break_command. Handle mst_file_* minimal symbol types.
|
||||
* config/i386/tm-i386bsd.h: Give just macro name, not args, to #undef.
|
||||
|
||||
Tue Mar 15 11:40:43 1994 Kung Hsu (kung@mexican.cygnus.com)
|
||||
|
||||
* c-exp.y(yylex): fix potential memory overflow.
|
||||
|
|
|
@ -97,9 +97,7 @@ lookup_minimal_symbol (name, objf)
|
|||
struct minimal_symbol *msymbol;
|
||||
struct minimal_symbol *found_symbol = NULL;
|
||||
struct minimal_symbol *found_file_symbol = NULL;
|
||||
#ifdef IBM6000_TARGET
|
||||
struct minimal_symbol *trampoline_symbol = NULL;
|
||||
#endif
|
||||
|
||||
for (objfile = object_files;
|
||||
objfile != NULL && found_symbol == NULL;
|
||||
|
@ -125,34 +123,17 @@ lookup_minimal_symbol (name, objf)
|
|||
found_file_symbol = msymbol;
|
||||
break;
|
||||
|
||||
case mst_unknown:
|
||||
#ifdef IBM6000_TARGET
|
||||
/* I *think* all platforms using shared
|
||||
libraries (and trampoline code) will suffer
|
||||
this problem. Consider a case where there are
|
||||
5 shared libraries, each referencing `foo'
|
||||
with a trampoline entry. When someone wants
|
||||
to put a breakpoint on `foo' and the only
|
||||
info we have is minimal symbol vector, we
|
||||
want to use the real `foo', rather than one
|
||||
of those trampoline entries. MGO */
|
||||
case mst_solib_trampoline:
|
||||
|
||||
/* If a trampoline symbol is found, we prefer to
|
||||
keep looking for the *real* symbol. If the
|
||||
actual symbol not found, then we'll use the
|
||||
trampoline entry. Sorry for the machine
|
||||
dependent code here, but I hope this will
|
||||
benefit other platforms as well. For
|
||||
trampoline entries, we used mst_unknown
|
||||
earlier. Perhaps we should define a
|
||||
`mst_trampoline' type?? */
|
||||
|
||||
actual symbol is not found, then we'll use the
|
||||
trampoline entry. */
|
||||
if (trampoline_symbol == NULL)
|
||||
trampoline_symbol = msymbol;
|
||||
break;
|
||||
#else
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
|
||||
case mst_unknown:
|
||||
default:
|
||||
found_symbol = msymbol;
|
||||
break;
|
||||
|
@ -169,11 +150,9 @@ lookup_minimal_symbol (name, objf)
|
|||
if (found_file_symbol)
|
||||
return found_file_symbol;
|
||||
|
||||
/* Symbols for IBM shared library trampolines are next best. */
|
||||
#ifdef IBM6000_TARGET
|
||||
/* Symbols for shared library trampolines are next best. */
|
||||
if (trampoline_symbol)
|
||||
return trampoline_symbol;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -378,6 +378,7 @@ write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
|
|||
{
|
||||
case mst_text:
|
||||
case mst_file_text:
|
||||
case mst_solib_trampoline:
|
||||
write_exp_elt_type (text_symbol_type);
|
||||
break;
|
||||
|
||||
|
|
33
gdb/symtab.c
33
gdb/symtab.c
|
@ -73,7 +73,7 @@ static void
|
|||
sources_info PARAMS ((char *, int));
|
||||
|
||||
static void
|
||||
list_symbols PARAMS ((char *, int, int));
|
||||
list_symbols PARAMS ((char *, int, int, int));
|
||||
|
||||
static void
|
||||
output_source_filename PARAMS ((char *, int *));
|
||||
|
@ -2517,10 +2517,11 @@ sources_info (ignore, from_tty)
|
|||
we find. */
|
||||
|
||||
static void
|
||||
list_symbols (regexp, class, bpt)
|
||||
list_symbols (regexp, class, bpt, from_tty)
|
||||
char *regexp;
|
||||
int class;
|
||||
int bpt;
|
||||
int from_tty;
|
||||
{
|
||||
register struct symtab *s;
|
||||
register struct partial_symtab *ps;
|
||||
|
@ -2540,9 +2541,15 @@ list_symbols (regexp, class, bpt)
|
|||
static enum minimal_symbol_type types[]
|
||||
= {mst_data, mst_text, mst_abs, mst_unknown};
|
||||
static enum minimal_symbol_type types2[]
|
||||
= {mst_bss, mst_text, mst_abs, mst_unknown};
|
||||
= {mst_bss, mst_file_text, mst_abs, mst_unknown};
|
||||
static enum minimal_symbol_type types3[]
|
||||
= {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
|
||||
static enum minimal_symbol_type types4[]
|
||||
= {mst_file_bss, mst_text, mst_abs, mst_unknown};
|
||||
enum minimal_symbol_type ourtype = types[class];
|
||||
enum minimal_symbol_type ourtype2 = types2[class];
|
||||
enum minimal_symbol_type ourtype3 = types3[class];
|
||||
enum minimal_symbol_type ourtype4 = types4[class];
|
||||
|
||||
if (regexp != NULL)
|
||||
{
|
||||
|
@ -2643,7 +2650,9 @@ list_symbols (regexp, class, bpt)
|
|||
ALL_MSYMBOLS (objfile, msymbol)
|
||||
{
|
||||
if (MSYMBOL_TYPE (msymbol) == ourtype ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype2)
|
||||
MSYMBOL_TYPE (msymbol) == ourtype2 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype3 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype4)
|
||||
{
|
||||
if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
|
||||
{
|
||||
|
@ -2710,7 +2719,7 @@ list_symbols (regexp, class, bpt)
|
|||
strcpy (string, s->filename);
|
||||
strcat (string, ":");
|
||||
strcat (string, SYMBOL_NAME(sym));
|
||||
break_command (string, 0);
|
||||
break_command (string, from_tty);
|
||||
}
|
||||
}
|
||||
else if (!found_in_file)
|
||||
|
@ -2768,7 +2777,9 @@ list_symbols (regexp, class, bpt)
|
|||
ALL_MSYMBOLS (objfile, msymbol)
|
||||
{
|
||||
if (MSYMBOL_TYPE (msymbol) == ourtype ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype2)
|
||||
MSYMBOL_TYPE (msymbol) == ourtype2 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype3 ||
|
||||
MSYMBOL_TYPE (msymbol) == ourtype4)
|
||||
{
|
||||
if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
|
||||
{
|
||||
|
@ -2802,7 +2813,7 @@ variables_info (regexp, from_tty)
|
|||
char *regexp;
|
||||
int from_tty;
|
||||
{
|
||||
list_symbols (regexp, 0, 0);
|
||||
list_symbols (regexp, 0, 0, from_tty);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2810,7 +2821,7 @@ functions_info (regexp, from_tty)
|
|||
char *regexp;
|
||||
int from_tty;
|
||||
{
|
||||
list_symbols (regexp, 1, 0);
|
||||
list_symbols (regexp, 1, 0, from_tty);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2818,7 +2829,7 @@ types_info (regexp, from_tty)
|
|||
char *regexp;
|
||||
int from_tty;
|
||||
{
|
||||
list_symbols (regexp, 2, 0);
|
||||
list_symbols (regexp, 2, 0, from_tty);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -2827,7 +2838,7 @@ static void
|
|||
methods_info (regexp)
|
||||
char *regexp;
|
||||
{
|
||||
list_symbols (regexp, 3, 0);
|
||||
list_symbols (regexp, 3, 0, from_tty);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
|
@ -2837,7 +2848,7 @@ rbreak_command (regexp, from_tty)
|
|||
char *regexp;
|
||||
int from_tty;
|
||||
{
|
||||
list_symbols (regexp, 1, 1);
|
||||
list_symbols (regexp, 1, 1, from_tty);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1311,8 +1311,9 @@ function_entry_point:
|
|||
/* shared library function trampoline code entry point. */
|
||||
else if (CSECT_SCLAS (&main_aux) == XMC_GL) {
|
||||
|
||||
/* record trampoline code entries as mst_unknown symbol. When we
|
||||
lookup mst symbols, we will choose mst_text over mst_unknown. */
|
||||
/* record trampoline code entries as mst_solib_trampoline symbol.
|
||||
When we lookup mst symbols, we will choose mst_text over
|
||||
mst_solib_trampoline. */
|
||||
|
||||
#if 1
|
||||
/* After the implementation of incremental loading of shared
|
||||
|
@ -1323,21 +1324,23 @@ function_entry_point:
|
|||
consistient with gdb's behaviour on a SUN platform. */
|
||||
|
||||
/* Trying to prefer *real* function entry over its trampoline,
|
||||
by assigning `mst_unknown' type to trampoline entries fails.
|
||||
Gdb treats those entries as chars. FIXME. */
|
||||
by assigning `mst_solib_trampoline' type to trampoline entries
|
||||
fails. Gdb treats those entries as chars. FIXME. */
|
||||
|
||||
/* Recording this entry is necessary. Single stepping relies on
|
||||
this vector to get an idea about function address boundaries. */
|
||||
|
||||
prim_record_minimal_symbol_and_info
|
||||
("<trampoline>", cs->c_value, mst_unknown,
|
||||
("<trampoline>", cs->c_value, mst_solib_trampoline,
|
||||
(char *)NULL, cs->c_secnum, objfile);
|
||||
#else
|
||||
|
||||
/* record trampoline code entries as mst_unknown symbol. When we
|
||||
lookup mst symbols, we will choose mst_text over mst_unknown. */
|
||||
/* record trampoline code entries as mst_solib_trampoline symbol.
|
||||
When we lookup mst symbols, we will choose mst_text over
|
||||
mst_solib_trampoline. */
|
||||
|
||||
RECORD_MINIMAL_SYMBOL (cs->c_name, cs->c_value, mst_unknown,
|
||||
RECORD_MINIMAL_SYMBOL (cs->c_name, cs->c_value,
|
||||
mst_solib_trampoline,
|
||||
symname_alloced, objfile);
|
||||
#endif
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue