From: Peter Schauer Date: Tue, 15 Mar 1994 21:46:32 +0000 (+0000) Subject: For Sunos 4.x targets, enable gdb to set breakpoints in shared X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae6d035d284f36a654186f284ead34a246eb86de;p=binutils-gdb.git 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 "" 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 09130931fbd..549230af3b2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 + "" 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. diff --git a/gdb/minsyms.c b/gdb/minsyms.c index d517a9a27e2..ec724713f48 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -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; } diff --git a/gdb/parse.c b/gdb/parse.c index 5b18538f8fe..23de13c088f 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -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; diff --git a/gdb/symtab.c b/gdb/symtab.c index 357b34991d2..f9eaf86a9cd 100644 --- a/gdb/symtab.c +++ b/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); } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 795c901976a..06aa3c927d1 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -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 - ("", cs->c_value, mst_unknown, + ("", 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;