+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
/* 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.
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;
{
}
}
- /* 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
{
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);
/* 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.
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 *));
/* 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.
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;
/* 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.
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.
/* 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.
current_objfile = NULL;
- return end_symtab (text_offset + text_size, 0, 0, objfile, 0);
+ return end_symtab (text_offset + text_size, objfile, 0);
}
\f
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:
/* 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
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.
/* 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.
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
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. */
/* 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.
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 ();
}
*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 ();
/* 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.
&& 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;
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;
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. */
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
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,
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
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,
/* 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.
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);
}
/* 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.
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 ();
}
{
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
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
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
/* 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);
}