aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorRon Unrau <runrau@cygnus>1998-07-17 15:29:11 +0000
committerRon Unrau <runrau@cygnus>1998-07-17 15:29:11 +0000
commit36297ff31d80a029ea0e27f8946f74354a881a62 (patch)
tree36787a2a58781eb64e3b36fa964c6477e97a01c2 /gdb
parent4c4a5de54375655787f9e9851f6ba028572d140d (diff)
downloadgdb-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')
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/parse.c10
-rw-r--r--gdb/symtab.c52
3 files changed, 59 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bea52a3..cb5c27e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,19 @@
+Fri Jul 17 9:26:50 1998 Ron Unrau <runrau@cygnus.com>
+
+ * 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.
+start-sanitize-sky
+ * tm-txvu.h: include tm-mips64.h instead of starting from scratch.
+end-sanitize-sky
+
Wed Jul 15 11:51:33 1998 Keith Seitz <keiths@cygnus.com>
* main.c (main): Fix violations of GNU coding standard.
diff --git a/gdb/parse.c b/gdb/parse.c
index edb374c..1cb6217 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "command.h"
#include "language.h"
#include "parser-defs.h"
+#include "symfile.h" /* for overlay functions */
/* Global variables declared in parser-defs.h (and commented there). */
struct expression *expout;
@@ -406,9 +407,16 @@ write_exp_msymbol (msymbol, text_symbol_type, data_symbol_type)
struct type *text_symbol_type;
struct type *data_symbol_type;
{
+ CORE_ADDR addr;
+
write_exp_elt_opcode (OP_LONG);
write_exp_elt_type (lookup_pointer_type (builtin_type_void));
- write_exp_elt_longcst ((LONGEST) SYMBOL_VALUE_ADDRESS (msymbol));
+
+ addr = SYMBOL_VALUE_ADDRESS (msymbol);
+ if (overlay_debugging)
+ addr = symbol_overlayed_address (addr, SYMBOL_BFD_SECTION (msymbol));
+ write_exp_elt_longcst ((LONGEST) addr);
+
write_exp_elt_opcode (OP_LONG);
write_exp_elt_opcode (UNOP_MEMVAL);
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));