summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2001-11-14 21:55:21 +0000
committerJim Blandy <jimb@codesourcery.com>2001-11-14 21:55:21 +0000
commite41c7918e9217d912df6bcccb8e6024d92859ebb (patch)
tree39d3da62bb19d9acbd63b86786c7e864dd0736e0
parentf372788a903326d6f9f489e150d854bb50d707b4 (diff)
downloadgdb-e41c7918e9217d912df6bcccb8e6024d92859ebb.tar.gz
* symfile.c (simple_read_overlay_table): Make sure we can find
both `_novlys' and `_ovly_table' before we try anything else; print a helpful error message. (simple_overlay_update): No need to print error message here.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/symfile.c53
2 files changed, 35 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a6a01950a1e..4fd08d738e8 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2001-11-14 Jim Blandy <jimb@redhat.com>
+
+ * symfile.c (simple_read_overlay_table): Make sure we can find
+ both `_novlys' and `_ovly_table' before we try anything else;
+ print a helpful error message.
+ (simple_overlay_update): No need to print error message here.
+
2001-11-14 Michael Snyder <msnyder@redhat.com>
* Makefile.in (doublest.o): Add dependency on gdbtypes.h.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index b4608623750..d5aeba3a1f3 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3023,30 +3023,35 @@ read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, int len)
static int
simple_read_overlay_table (void)
{
- struct minimal_symbol *msym;
+ struct minimal_symbol *novlys_msym, *ovly_table_msym;
simple_free_overlay_table ();
- msym = lookup_minimal_symbol ("_novlys", 0, 0);
- if (msym != NULL)
- cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (msym), 4);
- else
- return 0; /* failure */
- cache_ovly_table = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
- if (cache_ovly_table != NULL)
+ novlys_msym = lookup_minimal_symbol ("_novlys", 0, 0);
+ if (! novlys_msym)
{
- msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
- if (msym != NULL)
- {
- cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (msym);
- read_target_long_array (cache_ovly_table_base,
- (int *) cache_ovly_table,
- cache_novlys * 4);
- }
- else
- return 0; /* failure */
+ error ("Error reading inferior's overlay table: "
+ "couldn't find `_novlys' variable\n"
+ "in inferior. Use `overlay manual' mode.");
+ return 0;
}
- else
- return 0; /* failure */
+
+ ovly_table_msym = lookup_minimal_symbol ("_ovly_table", 0, 0);
+ if (! ovly_table_msym)
+ {
+ error ("Error reading inferior's overlay table: couldn't find "
+ "`_ovly_table' array\n"
+ "in inferior. Use `overlay manual' mode.");
+ return 0;
+ }
+
+ cache_novlys = read_memory_integer (SYMBOL_VALUE_ADDRESS (novlys_msym), 4);
+ cache_ovly_table
+ = (void *) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
+ cache_ovly_table_base = SYMBOL_VALUE_ADDRESS (ovly_table_msym);
+ read_target_long_array (cache_ovly_table_base,
+ (int *) cache_ovly_table,
+ cache_novlys * 4);
+
return 1; /* SUCCESS */
}
@@ -3147,11 +3152,9 @@ simple_overlay_update (struct obj_section *osect)
Or else we want all the sections, in which case it's actually
more efficient to read the whole table in one block anyway. */
- if (simple_read_overlay_table () == 0) /* read failed? No table? */
- {
- warning ("Failed to read the target overlay mapping table.");
- return;
- }
+ if (! simple_read_overlay_table ())
+ return;
+
/* Now may as well update all sections, even if only one was requested. */
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect->the_bfd_section))