diff options
author | Ron Unrau <runrau@cygnus> | 1998-07-17 15:29:11 +0000 |
---|---|---|
committer | Ron Unrau <runrau@cygnus> | 1998-07-17 15:29:11 +0000 |
commit | 36297ff31d80a029ea0e27f8946f74354a881a62 (patch) | |
tree | 36787a2a58781eb64e3b36fa964c6477e97a01c2 /gdb/symtab.c | |
parent | 4c4a5de54375655787f9e9851f6ba028572d140d (diff) | |
download | gdb-36297ff31d80a029ea0e27f8946f74354a881a62.zip gdb-36297ff31d80a029ea0e27f8946f74354a881a62.tar.gz gdb-36297ff31d80a029ea0e27f8946f74354a881a62.tar.bz2 |
* blockframe.c (find_pc_sect_partial_function): allow for the possi-
bility of multiple symbols at the same address when finding high.
* breakpoint.c (resolve_sal_pc): if the function based section lookup
fails, try getting the section from the minimal symbol table.
* parse.c (write_exp_msymbol): use symbol_overlayed_address to get
the LMA of a minimal symbol if unmapped.
* symtab.c (find_line_symtab): change interface to return symtab
containing the best linetable found.
(decode_line_1): use find_line_symtab to set val.symtab. This should
improve support for source files with multiple symtabs.
* tm-txvu.h: include tm-mips64.h instead of starting from scratch.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 9b0a996..a1a2c8e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -439,7 +439,8 @@ find_pc_sect_psymbol (psymtab, pc, section) if (!psymtab) return 0; - best_pc = psymtab->textlow - 1; + /* Cope with programs that start at address 0 */ + best_pc = (psymtab->textlow != 0) ? psymtab->textlow - 1 : 0; /* Search the global symbols as well as the static symbols, so that find_pc_partial_function doesn't use a minimal symbol and thus @@ -453,7 +454,9 @@ find_pc_sect_psymbol (psymtab, pc, section) if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE && SYMBOL_CLASS (p) == LOC_BLOCK && pc >= SYMBOL_VALUE_ADDRESS (p) - && SYMBOL_VALUE_ADDRESS (p) > best_pc) + && (SYMBOL_VALUE_ADDRESS (p) > best_pc + || (psymtab->textlow == 0 + && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0))) { if (section) /* match on a specific section */ { @@ -465,6 +468,7 @@ find_pc_sect_psymbol (psymtab, pc, section) best = p; } } + for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset; (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset) < psymtab->n_static_syms); @@ -474,7 +478,9 @@ find_pc_sect_psymbol (psymtab, pc, section) if (SYMBOL_NAMESPACE (p) == VAR_NAMESPACE && SYMBOL_CLASS (p) == LOC_BLOCK && pc >= SYMBOL_VALUE_ADDRESS (p) - && SYMBOL_VALUE_ADDRESS (p) > best_pc) + && (SYMBOL_VALUE_ADDRESS (p) > best_pc + || (psymtab->textlow == 0 + && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0))) { if (section) /* match on a specific section */ { @@ -486,8 +492,7 @@ find_pc_sect_psymbol (psymtab, pc, section) best = p; } } - if (best_pc == psymtab->textlow - 1) - return 0; + return best; } @@ -1466,24 +1471,23 @@ find_pc_line (pc, notcurrent) } -static int find_line_symtab PARAMS ((struct symtab *, int, struct linetable **, - int *, int *)); +static struct symtab* find_line_symtab PARAMS ((struct symtab *, int, + int *, int *)); /* Find line number LINE in any symtab whose name is the same as SYMTAB. - If found, return 1, set *LINETABLE to the linetable in which it was + If found, return the symtab that contains the linetable in which it was found, set *INDEX to the index in the linetable of the best entry found, and set *EXACT_MATCH nonzero if the value returned is an exact match. - If not found, return 0. */ + If not found, return NULL. */ -static int -find_line_symtab (symtab, line, linetable, index, exact_match) +static struct symtab* +find_line_symtab (symtab, line, index, exact_match) struct symtab *symtab; int line; - struct linetable **linetable; int *index; int *exact_match; { @@ -1494,9 +1498,11 @@ find_line_symtab (symtab, line, linetable, index, exact_match) int best_index; struct linetable *best_linetable; + struct symtab *best_symtab; /* First try looking it up in the given symtab. */ best_linetable = LINETABLE (symtab); + best_symtab = symtab; best_index = find_line_common (best_linetable, line, &exact); if (best_index < 0 || !exact) { @@ -1535,6 +1541,7 @@ find_line_symtab (symtab, line, linetable, index, exact_match) { best_index = ind; best_linetable = l; + best_symtab = s; goto done; } if (best == 0 || l->item[ind].line < best) @@ -1542,21 +1549,21 @@ find_line_symtab (symtab, line, linetable, index, exact_match) best = l->item[ind].line; best_index = ind; best_linetable = l; + best_symtab = s; } } } } done: if (best_index < 0) - return 0; + return NULL; if (index) *index = best_index; - if (linetable) - *linetable = best_linetable; if (exact_match) *exact_match = exact; - return 1; + + return best_symtab; } /* Set the PC value for a given source file and line number and return true. @@ -1576,8 +1583,10 @@ find_line_pc (symtab, line, pc) if (symtab == 0) return 0; - if (find_line_symtab (symtab, line, &l, &ind, NULL)) + symtab = find_line_symtab (symtab, line, &ind, NULL); + if (symtab != NULL) { + l = LINETABLE (symtab); *pc = l->item[ind].pc; return 1; } @@ -2427,7 +2436,14 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) *argptr = q; if (s == 0) s = default_symtab; - val.symtab = s; + + /* It is possible that this source file has more than one symtab, + and that the new line number specification has moved us from the + default (in s) to a new one. */ + val.symtab = find_line_symtab (s, val.line, NULL, NULL); + if (val.symtab == 0) + val.symtab = s; + val.pc = 0; values.sals = (struct symtab_and_line *) xmalloc (sizeof (struct symtab_and_line)); |