+Mon Jul 22 18:13:27 1996 Stu Grossman (grossman@critters.cygnus.com)
+
+ * Makefile.in (os9kread.o): Remove dependency on partial-stab.h.
+ * dbxread.c (read_dbx_symtab end_psymtab), partial-stab.h: Don't
+ use partial_symtab->textlow==0 as a flag, as 0 is a legitimate
+ text address. Use a seperate flag (textlow_not_set) instead.
+ This makes stabs in ELF .o files work a lot better.
+ * mdebugread.c xcoffread.c: Define textlow_not_set for
+ partial-stab.h.
+ * stabsread.h (end_psymtab): Add textlow_not_set arg to prototype.
+
Sat Jul 20 17:46:40 1996 Fred Fish <fnf@cygnus.com>
* gdbtk.tcl (files_command): Reorder the binding tags for
os9kread.o: os9kread.c buildsym.h complaints.h $(bfd_h) $(defs_h) \
$(expression_h) gdb-stabs.h $(gdbcore_h) $(gdbtypes_h) language.h \
- objfiles.h partial-stab.h stabsread.h symfile.h $(symtab_h) \
+ objfiles.h stabsread.h symfile.h $(symtab_h) \
target.h gdb_string.h
mem-break.o: mem-break.c $(defs_h)
CORE_ADDR last_function_start = 0;
struct cleanup *back_to;
bfd *abfd;
+ int textlow_not_set;
/* Current partial symtab */
struct partial_symtab *pst;
abfd = objfile->obfd;
symbuf_end = symbuf_idx = 0;
next_symbol_text_func = dbx_next_symbol_text;
+ textlow_not_set = 1;
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
{
#define DBXREAD_ONLY
#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
start_psymtab(ofile, secoff, fname, low, symoff, global_syms, static_syms)
-#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps)\
- end_psymtab(pst,ilist,ninc,c_off,c_text,dep_list,n_deps)
+#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)\
+ end_psymtab(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set)
#include "partial-stab.h"
}
? (text_addr + section_offsets->offsets[SECT_OFF_TEXT])
: lowest_text_address)
+ text_size,
- dependency_list, dependencies_used);
+ dependency_list, dependencies_used, textlow_not_set);
}
do_cleanups (back_to);
struct partial_symtab *
end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
- capping_text, dependency_list, number_dependencies)
+ capping_text, dependency_list, number_dependencies, textlow_not_set)
struct partial_symtab *pst;
char **include_list;
int num_includes;
CORE_ADDR capping_text;
struct partial_symtab **dependency_list;
int number_dependencies;
+ int textlow_not_set;
{
int i;
struct objfile *objfile = pst -> objfile;
if (capping_symbol_offset != -1)
- LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
+ LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
pst->texthigh = capping_text;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
we have to do some tricks to fill in texthigh and textlow.
The first trick is in partial-stab.h: if we see a static
or global function, and the textlow for the current pst
- is still 0, then we use that function's address for
- the textlow of the pst. */
+ is not set (ie: textlow_not_set), then we use that function's
+ address for the textlow of the pst. */
/* Now, to fill in texthigh, we remember the last function seen
in the .o file (also in partial-stab.h). Also, there's a hack in
a reliable texthigh by taking the address plus size of the
last function in the file. */
- if (pst->texthigh == 0 && last_function_name) {
- char *p;
- int n;
- struct minimal_symbol *minsym;
-
- p = strchr (last_function_name, ':');
- if (p == NULL)
- p = last_function_name;
- n = p - last_function_name;
- p = alloca (n + 1);
- strncpy (p, last_function_name, n);
- p[n] = 0;
+ if (pst->texthigh == 0 && last_function_name)
+ {
+ char *p;
+ int n;
+ struct minimal_symbol *minsym;
+
+ p = strchr (last_function_name, ':');
+ if (p == NULL)
+ p = last_function_name;
+ n = p - last_function_name;
+ p = alloca (n + 1);
+ strncpy (p, last_function_name, n);
+ p[n] = 0;
- minsym = lookup_minimal_symbol (p, pst->filename, objfile);
+ minsym = lookup_minimal_symbol (p, pst->filename, objfile);
- if (minsym)
- pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) +
- (long) MSYMBOL_INFO (minsym);
+ if (minsym)
+ pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym)
+ + (long) MSYMBOL_INFO (minsym);
- last_function_name = NULL;
- }
+ last_function_name = NULL;
+ }
/* this test will be true if the last .o file is only data */
- if (pst->textlow == 0)
- /* This loses if the text section really starts at address zero
- (generally true when we are debugging a .o file, for example).
- That is why this whole thing is inside SOFUN_ADDRESS_MAYBE_MISSING. */
+ if (textlow_not_set)
pst->textlow = pst->texthigh;
+ else
+ {
+ struct partial_symtab *p1;
- /* If we know our own starting text address, then walk through all other
- psymtabs for this objfile, and if any didn't know their ending text
- address, set it to our starting address. Take care to not set our
- own ending address to our starting address, nor to set addresses on
- `dependency' files that have both textlow and texthigh zero. */
- if (pst->textlow) {
- struct partial_symtab *p1;
-
- ALL_OBJFILE_PSYMTABS (objfile, p1) {
- if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst) {
- p1->texthigh = pst->textlow;
- /* if this file has only data, then make textlow match texthigh */
- if (p1->textlow == 0)
- p1->textlow = p1->texthigh;
- }
+ /* If we know our own starting text address, then walk through all other
+ psymtabs for this objfile, and if any didn't know their ending text
+ address, set it to our starting address. Take care to not set our
+ own ending address to our starting address, nor to set addresses on
+ `dependency' files that have both textlow and texthigh zero. */
+
+ ALL_OBJFILE_PSYMTABS (objfile, p1)
+ {
+ if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst)
+ {
+ p1->texthigh = pst->textlow;
+ /* if this file has only data, then make textlow match texthigh */
+ if (p1->textlow == 0)
+ p1->textlow = p1->texthigh;
+ }
+ }
}
- }
/* End of kludge for patching Solaris textlow and texthigh. */
#endif /* SOFUN_ADDRESS_MAYBE_MISSING. */
EXTR *ext_in_end;
SYMR sh;
struct partial_symtab *pst;
-
+ int textlow_not_set = 1;
int past_first_source_file = 0;
/* List of current psymtab's include files */
#define CUR_SYMBOL_VALUE sh.value
#define START_PSYMTAB(ofile,secoff,fname,low,symoff,global_syms,static_syms)\
pst = save_pst
-#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps) (void)0
+#define END_PSYMTAB(pst,ilist,ninc,c_off,c_text,dep_list,n_deps,textlow_not_set) (void)0
#define HANDLE_RBRAC(val) \
if ((val) > save_pst->texthigh) save_pst->texthigh = (val);
#include "partial-stab.h"
fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
psymtab_include_list, includes_used,
-1, save_pst->texthigh,
- dependency_list, dependencies_used);
+ dependency_list, dependencies_used, textlow_not_set);
includes_used = 0;
dependencies_used = 0;
symnum * symbol_size,
CUR_SYMBOL_VALUE > pst->texthigh
? CUR_SYMBOL_VALUE : pst->texthigh,
- dependency_list, dependencies_used);
+ dependency_list, dependencies_used, textlow_not_set);
pst = (struct partial_symtab *) 0;
includes_used = 0;
dependencies_used = 0;
static int prev_so_symnum = -10;
static int first_so_symnum;
char *p;
+ int prev_textlow_not_set;
valu = CUR_SYMBOL_VALUE + ANOFFSET (section_offsets, SECT_OFF_TEXT);
+
+ prev_textlow_not_set = textlow_not_set;
+
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
/* A zero value is probably an indication for the SunPRO 3.0
compiler. end_psymtab explicitly tests for zero, so
don't relocate it. */
+
if (CUR_SYMBOL_VALUE == 0)
- valu = 0;
+ {
+ textlow_not_set = 1;
+ valu = 0;
+ }
+ else
+ textlow_not_set = 0;
+#else
+ textlow_not_set = 0;
#endif
-
past_first_source_file = 1;
if (prev_so_symnum != symnum - 1)
END_PSYMTAB (pst, psymtab_include_list, includes_used,
symnum * symbol_size,
valu > pst->texthigh ? valu : pst->texthigh,
- dependency_list, dependencies_used);
+ dependency_list, dependencies_used,
+ prev_textlow_not_set);
pst = (struct partial_symtab *) 0;
includes_used = 0;
dependencies_used = 0;
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
/* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (pst && pst->textlow == 0 && !symfile_relocatable)
- pst->textlow =
- find_stab_function_addr (namestring, pst, objfile);
+ if (pst && textlow_not_set)
+ {
+ pst->textlow =
+ find_stab_function_addr (namestring, pst, objfile);
+ textlow_not_set = 0;
+ }
#endif
#if 0
if (startup_file_end == 0)
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
+ if (textlow_not_set
|| (CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
- pst->textlow = CUR_SYMBOL_VALUE;
+ {
+ pst->textlow = CUR_SYMBOL_VALUE;
+ textlow_not_set = 0;
+ }
#endif /* DBXREAD_ONLY */
add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_BLOCK,
#ifdef SOFUN_ADDRESS_MAYBE_MISSING
/* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (pst && pst->textlow == 0 && !symfile_relocatable)
- pst->textlow =
- find_stab_function_addr (namestring, pst, objfile);
+ if (pst && textlow_not_set)
+ {
+ pst->textlow =
+ find_stab_function_addr (namestring, pst, objfile);
+ textlow_not_set = 0;
+ }
#endif
#if 0
if (startup_file_end == 0)
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
+ if (textlow_not_set
|| (CUR_SYMBOL_VALUE < pst->textlow
&& CUR_SYMBOL_VALUE
!= ANOFFSET (section_offsets, SECT_OFF_TEXT)))
- pst->textlow = CUR_SYMBOL_VALUE;
+ {
+ pst->textlow = CUR_SYMBOL_VALUE;
+ textlow_not_set = 0;
+ }
#endif /* DBXREAD_ONLY */
add_psymbol_to_list (namestring, p - namestring,
VAR_NAMESPACE, LOC_BLOCK,
END_PSYMTAB (pst, psymtab_include_list, includes_used,
symnum * symbol_size,
(CORE_ADDR) 0,
- dependency_list, dependencies_used);
+ dependency_list, dependencies_used, textlow_not_set);
pst = (struct partial_symtab *) 0;
includes_used = 0;
dependencies_used = 0;
struct partial_symbol **));
extern struct partial_symtab *
-end_psymtab PARAMS ((struct partial_symtab *, char **, int, int, CORE_ADDR,
- struct partial_symtab **, int));
+end_psymtab PARAMS ((struct partial_symtab *pst,
+ char **include_list,
+ int num_includes,
+ int capping_symbol_offset,
+ CORE_ADDR capping_text,
+ struct partial_symtab **dependency_list,
+ int number_dependencies,
+ int textlow_not_set));
extern void
process_one_symbol PARAMS ((int, int, CORE_ADDR, char *,
CORE_ADDR last_csect_val = 0;
int last_csect_sec = 0;
int misc_func_recorded = 0; /* true if any misc. function */
+ int textlow_not_set = 1;
pst = (struct partial_symtab *) 0;