diff options
author | Jeff Law <law@redhat.com> | 1996-01-08 17:55:25 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 1996-01-08 17:55:25 +0000 |
commit | 436d4143274d6bb3c32632f7ae1bd82cda5128b5 (patch) | |
tree | 1b03454d0f21a99f7d5f601c3f7d023edfea7e8f /gdb | |
parent | 01082eaf1926a56afc7b4cb51a25d3560ee31f5b (diff) | |
download | gdb-436d4143274d6bb3c32632f7ae1bd82cda5128b5.zip gdb-436d4143274d6bb3c32632f7ae1bd82cda5128b5.tar.gz gdb-436d4143274d6bb3c32632f7ae1bd82cda5128b5.tar.bz2 |
* buildsym.c (end_symtab): Remove sort_pending and sort_linevec
arguments. Sorting is now dependent on OBJF_REORDERED. All
callers/references changed.
* dbxread.c (read_ofile_symtab): Correctly determine value for
last_source_start_addr for reordered executables.
(process_one_symbol): Handle N_FUN with no name as an end of
function marker.
* partial-stab.h (case N_FN, N_TEXT): Don't assume CUR_SYMBOL_VALUE
is the high text address for a psymtab.
(case N_SO): Likewise.
(case N_FUN): Handle N_FUN with no name as an end of function
marker.
* minsyms.c (lookup_minimal_symbol_by_pc): Examine all symbols
at the same address rather than a random subset of them.
* coffread.c (coff_symfile_init): Set OBJF_REORDERED.
* elfread.c (elf_symfile_init): Similarly.
* somread.c (som_symfile_init): Similarly.
* xcoffread.c (xcoff_symfile_init): Similarly.
Support for debugging reordered executables. Remaining mentor vm
changes.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/buildsym.c | 27 | ||||
-rw-r--r-- | gdb/buildsym.h | 4 | ||||
-rw-r--r-- | gdb/dwarfread.c | 5 | ||||
-rw-r--r-- | gdb/elfread.c | 10 | ||||
-rw-r--r-- | gdb/hpread.c | 6 | ||||
-rw-r--r-- | gdb/mdebugread.c | 4 | ||||
-rw-r--r-- | gdb/minsyms.c | 12 | ||||
-rw-r--r-- | gdb/os9kread.c | 7 | ||||
-rw-r--r-- | gdb/partial-stab.h | 44 | ||||
-rw-r--r-- | gdb/somread.c | 9 | ||||
-rw-r--r-- | gdb/xcoffread.c | 17 |
12 files changed, 120 insertions, 46 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0bd8350..759a6b5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +Mon Jan 8 10:20:14 1996 Jeffrey A Law (law@cygnus.com) + + * buildsym.c (end_symtab): Remove sort_pending and sort_linevec + arguments. Sorting is now dependent on OBJF_REORDERED. All + callers/references changed. + * dbxread.c (read_ofile_symtab): Correctly determine value for + last_source_start_addr for reordered executables. + (process_one_symbol): Handle N_FUN with no name as an end of + function marker. + * partial-stab.h (case N_FN, N_TEXT): Don't assume CUR_SYMBOL_VALUE + is the high text address for a psymtab. + (case N_SO): Likewise. + (case N_FUN): Handle N_FUN with no name as an end of function + marker. + * minsyms.c (lookup_minimal_symbol_by_pc): Examine all symbols + at the same address rather than a random subset of them. + * coffread.c (coff_symfile_init): Set OBJF_REORDERED. + * elfread.c (elf_symfile_init): Similarly. + * somread.c (som_symfile_init): Similarly. + * xcoffread.c (xcoff_symfile_init): Similarly. + Fri Jan 5 17:46:01 1996 Stu Grossman (grossman@cygnus.com) * stack.c (print_stack_frame print_frame_info) symmisc.c diff --git a/gdb/buildsym.c b/gdb/buildsym.c index c9c30b0..5a5847a 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1,5 +1,5 @@ /* Support routines for building symbol tables in GDB's internal format. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -737,10 +737,8 @@ start_symtab (name, dirname, start_addr) because then gdb will never know about this empty file (FIXME). */ struct symtab * -end_symtab (end_addr, sort_pending, sort_linevec, objfile, section) +end_symtab (end_addr, objfile, section) CORE_ADDR end_addr; - int sort_pending; - int sort_linevec; struct objfile *objfile; int section; { @@ -774,14 +772,12 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section) } } - /* It is unfortunate that in xcoff, pending blocks might not be ordered - in this stage. Especially, blocks for static functions will show up at - the end. We need to sort them, so tools like `find_pc_function' and - `find_pc_block' can work reliably. */ - - if (sort_pending && pending_blocks) + /* Reordered executables may have out of order pending blocks; if + OBJF_REORDERED is true, then sort the pending blocks. */ + if ((objfile->flags & OBJF_REORDERED) && pending_blocks) { - /* FIXME! Remove this horrid bubble sort and use qsort!!! */ + /* FIXME! Remove this horrid bubble sort and use qsort!!! + It'd be a whole lot easier if they weren't in a linked list!!! */ int swapped; do { @@ -865,12 +861,11 @@ end_symtab (end_addr, sort_pending, sort_linevec, objfile, section) subfile->line_vector = (struct linetable *) xrealloc ((char *) subfile->line_vector, linetablesize); #endif - /* If sort_linevec is false, we might want just check to make - sure they are sorted and complain() if not, as a way of - tracking down compilers/symbol readers which don't get - them sorted right. */ - if (sort_linevec) + /* Like the pending blocks, the line table may be scrambled + in reordered executables. Sort it if OBJF_REORDERED is + true. */ + if (objfile->flags & OBJF_REORDERED) qsort (subfile->line_vector->item, subfile->line_vector->nitems, sizeof (struct linetable_entry), compare_line_numbers); diff --git a/gdb/buildsym.h b/gdb/buildsym.h index 36732f0..58529c7 100644 --- a/gdb/buildsym.h +++ b/gdb/buildsym.h @@ -1,5 +1,5 @@ /* Build symbol tables in GDB's internal format. - Copyright (C) 1986-1995 Free Software Foundation, Inc. + Copyright (C) 1986-1996 Free Software Foundation, Inc. This file is part of GDB. @@ -231,7 +231,7 @@ extern char * pop_subfile PARAMS ((void)); extern struct symtab * -end_symtab PARAMS ((CORE_ADDR, int, int, struct objfile *, int)); +end_symtab PARAMS ((CORE_ADDR, struct objfile *, int)); extern void scan_file_globals PARAMS ((struct objfile *)); diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 41f2a6c..fa7c9a2 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1,5 +1,6 @@ /* DWARF debugging format support for GDB. - Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 + Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. Portions based on dbxread.c, mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port. @@ -1926,7 +1927,7 @@ read_file_scope (dip, thisdie, enddie, objfile) decode_line_numbers (lnbase); process_dies (thisdie + dip -> die_length, enddie, objfile); - symtab = end_symtab (dip -> at_high_pc, 0, 0, objfile, 0); + symtab = end_symtab (dip -> at_high_pc, objfile, 0); if (symtab != NULL) { symtab -> language = cu_language; diff --git a/gdb/elfread.c b/gdb/elfread.c index 0372abb..9a7a0fe 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1,5 +1,5 @@ /* Read ELF (Executable and Linking Format) object files for GDB. - Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. This file is part of GDB. @@ -705,9 +705,13 @@ elf_symfile_finish (objfile) just a stub. */ static void -elf_symfile_init (ignore) - struct objfile *ignore; +elf_symfile_init (objfile) + struct objfile *objfile; { + /* ELF objects may be reordered, so set OBJF_REORDERED. If we + find this causes a significant slowdown in gdb then we could + set it in the debug symbol readers only when necessary. */ + objfile->flags |= OBJF_REORDERED; } /* ELF specific parsing routine for section offsets. diff --git a/gdb/hpread.c b/gdb/hpread.c index 79d5ee4..bfd7330 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -1,5 +1,5 @@ /* Read hp debug symbols and convert to internal format, for GDB. - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -1116,7 +1116,7 @@ hpread_expand_symtab (objfile, sym_offset, sym_size, text_offset, text_size, current_objfile = NULL; - return end_symtab (text_offset + text_size, 0, 0, objfile, 0); + return end_symtab (text_offset + text_size, objfile, 0); } @@ -1896,7 +1896,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile, case DNTT_TYPE_MODULE: /* Ending a module ends the symbol table for that module. */ valu = text_offset + text_size + offset; - (void) end_symtab (valu, 0, 0, objfile, 0); + (void) end_symtab (valu, objfile, 0); break; case DNTT_TYPE_FUNCTION: diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 1c88f51..07dca2b 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1,5 +1,5 @@ /* Read a symbol table in ECOFF format (Third-Eye). - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Original version contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor @@ -3271,7 +3271,7 @@ psymtab_to_symtab_1 (pst, filename) else complain (&stab_unknown_complaint, name); } - st = end_symtab (pst->texthigh, 0, 0, pst->objfile, SECT_OFF_TEXT); + st = end_symtab (pst->texthigh, pst->objfile, SECT_OFF_TEXT); end_stabs (); /* Sort the symbol table now, we are done adding symbols to it. diff --git a/gdb/minsyms.c b/gdb/minsyms.c index c020062..e36302e 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1,5 +1,5 @@ /* GDB routines for manipulating the minimal symbol tables. - Copyright 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. This file is part of GDB. @@ -253,7 +253,6 @@ lookup_minimal_symbol_text (name, sfile, objf) return NULL; } - /* Search through the minimal symbol table for each objfile and find the symbol whose address is the largest address that is still less than or equal to PC. Returns a pointer to the minimal symbol if such a symbol @@ -325,6 +324,15 @@ lookup_minimal_symbol_by_pc (pc) lo = new; } } + + /* If we have multiple symbols at the same address, we want + hi to point to the last one. That way we can find the + right symbol if it has an index greater than hi. */ + while (hi < objfile -> minimal_symbol_count - 1 + && (SYMBOL_VALUE_ADDRESS (&msymbol[hi]) + == SYMBOL_VALUE_ADDRESS (&msymbol[hi+1]))) + hi++; + /* The minimal symbol indexed by hi now is the best one in this objfile's minimal symbol table. See if it is the best one overall. */ diff --git a/gdb/os9kread.c b/gdb/os9kread.c index 110d4cf..bcdf308 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -1,5 +1,5 @@ /* Read os9/os9k symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -1409,8 +1409,7 @@ os9k_read_ofile_symtab (pst) which comes from pst->textlow is correct. */ if (last_source_start_addr == 0) last_source_start_addr = text_offset; - pst->symtab = end_symtab (text_offset + text_size, 0, 0, objfile, - SECT_OFF_TEXT); + pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT); end_stabs (); } @@ -1566,7 +1565,7 @@ os9k_process_one_symbol (type, desc, valu, name, section_offsets, objfile) *p = '\0'; if (symfile_depth++ == 0) { if (last_source_file) { - end_symtab (valu, 0, 0, objfile, SECT_OFF_TEXT); + end_symtab (valu, objfile, SECT_OFF_TEXT); end_stabs (); } start_stabs (); diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 1ea1eb0..b01eb1e 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -1,5 +1,5 @@ /* Shared code to pre-read a stab (dbx-style), when building a psymtab. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -103,7 +103,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ && CUR_SYMBOL_VALUE >= pst->textlow) { END_PSYMTAB (pst, psymtab_include_list, includes_used, - symnum * symbol_size, CUR_SYMBOL_VALUE, + symnum * symbol_size, + CUR_SYMBOL_VALUE > pst->texthigh + ? CUR_SYMBOL_VALUE : pst->texthigh, dependency_list, dependencies_used); pst = (struct partial_symtab *) 0; includes_used = 0; @@ -214,7 +216,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ if (pst) { END_PSYMTAB (pst, psymtab_include_list, includes_used, - symnum * symbol_size, valu, + symnum * symbol_size, + valu > pst->texthigh ? valu : pst->texthigh, dependency_list, dependencies_used); pst = (struct partial_symtab *) 0; includes_used = 0; @@ -365,6 +368,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ SET_NAMESTRING(); +#ifdef DBXREAD_ONLY + /* See if this is an end of function stab. */ + if (CUR_SYMBOL_TYPE == N_FUN && ! strcmp (namestring, "")) + { + unsigned long valu; + + /* It's value is the size (in bytes) of the function for + function relative stabs, or the address of the function's + end for old style stabs. */ + valu = CUR_SYMBOL_VALUE + last_function_start; + if (pst->texthigh == 0 || valu > pst->texthigh) + pst->texthigh = valu; + break; + } +#endif + p = (char *) strchr (namestring, ':'); if (!p) continue; /* Not a debugging symbol. */ @@ -527,6 +546,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ case 'f': CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT); #ifdef DBXREAD_ONLY + /* Keep track of the start of the last function so we + can handle end of function symbols. */ + last_function_start = CUR_SYMBOL_VALUE; /* Kludges for ELF/STABS with Sun ACC */ last_function_name = namestring; #ifdef SOFUN_ADDRESS_MAYBE_MISSING @@ -541,6 +563,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ startup_file_end = CUR_SYMBOL_VALUE; #endif /* End kludge. */ + + /* In reordered executables this function may lie outside + the bounds created by N_SO symbols. If that's the case + use the address of this function as the low bound for + the partial symbol table. */ + if (pst->textlow == 0 || CUR_SYMBOL_VALUE < pst->textlow) + pst->textlow = CUR_SYMBOL_VALUE; #endif /* DBXREAD_ONLY */ ADD_PSYMBOL_TO_LIST (namestring, p - namestring, VAR_NAMESPACE, LOC_BLOCK, @@ -554,6 +583,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ case 'F': CUR_SYMBOL_VALUE += ANOFFSET (section_offsets, SECT_OFF_TEXT); #ifdef DBXREAD_ONLY + /* Keep track of the start of the last function so we + can handle end of function symbols. */ + last_function_start = CUR_SYMBOL_VALUE; /* Kludges for ELF/STABS with Sun ACC */ last_function_name = namestring; #ifdef SOFUN_ADDRESS_MAYBE_MISSING @@ -568,6 +600,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ startup_file_end = CUR_SYMBOL_VALUE; #endif /* End kludge. */ + /* In reordered executables this function may lie outside + the bounds created by N_SO symbols. If that's the case + use the address of this function as the low bound for + the partial symbol table. */ + if (pst->textlow == 0 || CUR_SYMBOL_VALUE < pst->textlow) + pst->textlow = CUR_SYMBOL_VALUE; #endif /* DBXREAD_ONLY */ ADD_PSYMBOL_TO_LIST (namestring, p - namestring, VAR_NAMESPACE, LOC_BLOCK, diff --git a/gdb/somread.c b/gdb/somread.c index 522b6b5..ab8d531 100644 --- a/gdb/somread.c +++ b/gdb/somread.c @@ -1,5 +1,5 @@ /* Read HP PA/Risc object files for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. + Copyright 1991, 1992, 1996 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. This file is part of GDB. @@ -408,13 +408,16 @@ som_symfile_finish (objfile) hpread_symfile_finish (objfile); } -/* SOM specific initialization routine for reading symbols. +/* SOM specific initialization routine for reading symbols. */ - Nothing SOM specific left to do anymore. */ static void som_symfile_init (objfile) struct objfile *objfile; { + /* SOM objects may be reordered, so set OBJF_REORDERED. If we + find this causes a significant slowdown in gdb then we could + set it in the debug symbol readers only when necessary. */ + objfile->flags |= OBJF_REORDERED; hpread_symfile_init (objfile); } diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index c94cb76..b553102 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,5 +1,5 @@ /* Read AIX xcoff symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -1023,7 +1023,7 @@ read_xcoff_symtab (pst) if (last_source_file) { pst->symtab = - end_symtab (cur_src_end_addr, 1, 0, objfile, SECT_OFF_TEXT); + end_symtab (cur_src_end_addr, objfile, SECT_OFF_TEXT); end_stabs (); } @@ -1087,8 +1087,7 @@ read_xcoff_symtab (pst) { complete_symtab (filestring, file_start_addr); cur_src_end_addr = file_end_addr; - end_symtab (file_end_addr, 1, 0, objfile, - SECT_OFF_TEXT); + end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); end_stabs (); start_stabs (); /* Give all csects for this source file the same @@ -1203,7 +1202,7 @@ read_xcoff_symtab (pst) complete_symtab (filestring, file_start_addr); cur_src_end_addr = file_end_addr; - end_symtab (file_end_addr, 1, 0, objfile, SECT_OFF_TEXT); + end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); end_stabs (); /* XCOFF, according to the AIX 3.2 documentation, puts the filename @@ -1393,7 +1392,7 @@ read_xcoff_symtab (pst) complete_symtab (filestring, file_start_addr); cur_src_end_addr = file_end_addr; - s = end_symtab (file_end_addr, 1, 0, objfile, SECT_OFF_TEXT); + s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT); /* When reading symbols for the last C_FILE of the objfile, try to make sure that we set pst->symtab to the symtab for the file, not to the _globals_ symtab. I'm not sure whether this @@ -1844,6 +1843,12 @@ xcoff_symfile_init (objfile) /* Allocate struct to keep track of the symfile */ objfile -> sym_private = xmmalloc (objfile -> md, sizeof (struct coff_symfile_info)); + + /* XCOFF objects may be reordered, so set OBJF_REORDERED. If we + find this causes a significant slowdown in gdb then we could + set it in the debug symbol readers only when necessary. */ + objfile->flags |= OBJF_REORDERED; + init_entry_point_info (objfile); } |