From 699daa9c10e2b47afee4b80f87ce85f22fd6ca4d Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 11 Apr 1994 16:19:03 +0000 Subject: [PATCH] * paread.c (pa_symtab_read): Handle ST_STUB symbols and symbols with scope SS_EXTERNAL. ST_ENTRY symbols in dynamic executables are type mst_solib_trampoline. --- gdb/ChangeLog | 6 +++++ gdb/paread.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8822c296164..70237935178 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Mon Apr 11 09:18:24 1994 Jeffrey A. Law (law@snake.cs.utah.edu) + + * paread.c (pa_symtab_read): Handle ST_STUB symbols and symbols + with scope SS_EXTERNAL. ST_ENTRY symbols in dynamic executables + are type mst_solib_trampoline. + Fri Apr 8 17:14:37 1994 Jim Kingdon (kingdon@deneb.cygnus.com) * config/m68k/es1800.mt: Change comments. diff --git a/gdb/paread.c b/gdb/paread.c index fab2e4d45ce..35ab4a3b78e 100644 --- a/gdb/paread.c +++ b/gdb/paread.c @@ -115,8 +115,9 @@ pa_symtab_read (abfd, addr, objfile) { unsigned int number_of_symbols; unsigned int i; - int val; + int val, dynamic; char *stringtab; + asection *shlib_info; struct symbol_dictionary_record *buf, *bufp, *endbufp; char *symname; CONST int symsize = sizeof (struct symbol_dictionary_record); @@ -135,6 +136,18 @@ pa_symtab_read (abfd, addr, objfile) if (val != obj_som_stringtab_size (abfd)) error ("Can't read in HP string table."); + /* We need to determine if objfile is a dynamic executable (so we + can do the right thing for ST_ENTRY vs ST_CODE symbols). + + There's nothing in the header which easily allows us to do + this. The only reliable way I know of is to check for the + existance of a $SHLIB_INFO$ section with a non-zero size. */ + shlib_info = bfd_get_section_by_name (objfile->obfd, "$SHLIB_INFO$"); + if (shlib_info) + dynamic = (bfd_section_size (objfile->obfd, shlib_info) != 0); + else + dynamic = 0; + endbufp = buf + number_of_symbols; for (bufp = buf; bufp < endbufp; ++bufp) { @@ -145,6 +158,7 @@ pa_symtab_read (abfd, addr, objfile) switch (bufp->symbol_scope) { case SS_UNIVERSAL: + case SS_EXTERNAL: switch (bufp->symbol_type) { case ST_SYM_EXT: @@ -154,7 +168,6 @@ pa_symtab_read (abfd, addr, objfile) case ST_CODE: case ST_PRI_PROG: case ST_SEC_PROG: - case ST_ENTRY: case ST_MILLICODE: symname = bufp->name.n_strx + stringtab; ms_type = mst_text; @@ -162,6 +175,29 @@ pa_symtab_read (abfd, addr, objfile) SMASH_TEXT_ADDRESS (bufp->symbol_value); #endif break; + + case ST_ENTRY: + symname = bufp->name.n_strx + stringtab; + /* For a dynamic executable, ST_ENTRY symbols are + the stubs, while the ST_CODE symbol is the real + function. */ + if (dynamic) + ms_type = mst_solib_trampoline; + else + ms_type = mst_text; +#ifdef SMASH_TEXT_ADDRESS + SMASH_TEXT_ADDRESS (bufp->symbol_value); +#endif + break; + + case ST_STUB: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_solib_trampoline; +#ifdef SMASH_TEXT_ADDRESS + SMASH_TEXT_ADDRESS (bufp->symbol_value); +#endif + break; + case ST_DATA: symname = bufp->name.n_strx + stringtab; ms_type = mst_data; @@ -207,7 +243,6 @@ pa_symtab_read (abfd, addr, objfile) case ST_PRI_PROG: case ST_SEC_PROG: - case ST_ENTRY: case ST_MILLICODE: symname = bufp->name.n_strx + stringtab; ms_type = mst_file_text; @@ -216,6 +251,29 @@ pa_symtab_read (abfd, addr, objfile) #endif break; + case ST_ENTRY: + symname = bufp->name.n_strx + stringtab; + /* For a dynamic executable, ST_ENTRY symbols are + the stubs, while the ST_CODE symbol is the real + function. */ + if (dynamic) + ms_type = mst_solib_trampoline; + else + ms_type = mst_file_text; +#ifdef SMASH_TEXT_ADDRESS + SMASH_TEXT_ADDRESS (bufp->symbol_value); +#endif + break; + + case ST_STUB: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_solib_trampoline; +#ifdef SMASH_TEXT_ADDRESS + SMASH_TEXT_ADDRESS (bufp->symbol_value); +#endif + break; + + case ST_DATA: symname = bufp->name.n_strx + stringtab; ms_type = mst_file_data; -- 2.30.2