From 610a7e7458b46449c5cdedd48079ed974dd5683a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 21 Sep 1993 21:21:35 +0000 Subject: [PATCH] * elfread.c (record_minimal_symbol_and_info): Guess the section to use from the type. * objfiles.c: Include gdb-stabs.h for SECT_* macros. (objfile_relocate): Relocate textlow and texthigh in psymtabs. Relocate partial symbols. Check that minimal SYMBOL_SECTION is nonnegative before using it. * symtab.h: Adjust section field comment. --- gdb/ChangeLog | 18 ++++++++++++++++++ gdb/elfread.c | 25 ++++++++++++++++++++++++- gdb/objfiles.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aa3fe96c295..df51c8b3ed2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +Tue Sep 21 17:06:19 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + + * elfread.c (record_minimal_symbol_and_info): Guess the section to + use from the type. + * objfiles.c: Include gdb-stabs.h for SECT_* macros. + (objfile_relocate): Relocate textlow and texthigh in psymtabs. + Relocate partial symbols. Check that minimal SYMBOL_SECTION is + nonnegative before using it. + * symtab.h: Adjust section field comment. + + * remote.c (interrupt_query): New function. + (remote_interrupt_twice): Call interrupt_query. + (putpkt, getpkt): If quit_flag is set, call interrupt_query. + (remote_wait): Don't bother with objfile_relocate if the addresses + haven't changed. + (remote_fetch_registers): If we see a packet that doesn't start + with a hex character, fetch a new one. + Tue Sep 21 11:44:00 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * remote.c, remote-utils.c: Use SERIAL_FLUSH_INPUT after opening it. diff --git a/gdb/elfread.c b/gdb/elfread.c index fc74813fb2b..5112e51eadd 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -173,8 +173,31 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile) char *info; /* FIXME, is this really char *? */ struct objfile *objfile; { + int section; + + /* Guess the section from the type. This is likely to be wrong in + some cases. */ + switch (ms_type) + { + case mst_text: + case mst_file_text: + section = SECT_OFF_TEXT; + break; + case mst_data: + case mst_file_data: + section = SECT_OFF_DATA; + break; + case mst_bss: + case mst_file_bss: + section = SECT_OFF_BSS; + break; + default: + section = -1; + break; + } + name = obsavestring (name, strlen (name), &objfile -> symbol_obstack); - prim_record_minimal_symbol_and_info (name, address, ms_type, info, -1); + prim_record_minimal_symbol_and_info (name, address, ms_type, info, section); } /* diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 060409d7033..30a0aadc8b4 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "symfile.h" #include "objfiles.h" +#include "gdb-stabs.h" #include #include @@ -473,10 +474,36 @@ objfile_relocate (objfile, new_offsets) } } + { + struct partial_symtab *p; + + ALL_OBJFILE_PSYMTABS (objfile, p) + { + p->textlow += ANOFFSET (delta, SECT_OFF_TEXT); + p->texthigh += ANOFFSET (delta, SECT_OFF_TEXT); + } + } + + { + struct partial_symbol *psym; + + for (psym = objfile->global_psymbols.list; + psym < objfile->global_psymbols.next; + psym++) + if (SYMBOL_SECTION (psym) >= 0) + SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym)); + for (psym = objfile->static_psymbols.list; + psym < objfile->static_psymbols.next; + psym++) + if (SYMBOL_SECTION (psym) >= 0) + SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym)); + } + { struct minimal_symbol *msym; ALL_OBJFILE_MSYMBOLS (objfile, msym) - SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym)); + if (SYMBOL_SECTION (msym) >= 0) + SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym)); } { -- 2.30.2