aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-03-08 07:45:49 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-03-08 07:45:49 +0000
commit08597104eb26d23340f42ccd610ce6d24015e501 (patch)
tree246ea61d5e64dfa9395c376c85fe227661fea009
parentec6dbf37039f379951bcd79d7ddc9e9bd6708524 (diff)
downloadgdb-08597104eb26d23340f42ccd610ce6d24015e501.zip
gdb-08597104eb26d23340f42ccd610ce6d24015e501.tar.gz
gdb-08597104eb26d23340f42ccd610ce6d24015e501.tar.bz2
Memory error when reading wrong core file.
* solib-svr4.c (solib_svr4_r_map): catch and print all exception errors while reading the inferior memory, and return zero if an exception was raised.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/solib-svr4.c11
2 files changed, 16 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 911fcd1..39c0c78 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2010-03-08 Joel Brobecker <brobecker@adacore.com>
+
+ Memory error when reading wrong core file.
+ * solib-svr4.c (solib_svr4_r_map): catch and print all exception
+ errors while reading the inferior memory, and return zero if
+ an exception was raised.
+
2010-03-07 Michael Snyder <msnyder@vmware.com>
* record.c (record_restore): Rename tmpu8 to rectype.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 4317283..0c6654f 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -868,9 +868,16 @@ solib_svr4_r_map (struct svr4_info *info)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+ CORE_ADDR addr = 0;
+ volatile struct gdb_exception ex;
- return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
- ptr_type);
+ TRY_CATCH (ex, RETURN_MASK_ERROR)
+ {
+ addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
+ ptr_type);
+ }
+ exception_print (gdb_stderr, ex);
+ return addr;
}
/* Find r_brk from the inferior's debug base. */