keiths / rpms / gdb

Forked from rpms/gdb 4 months ago
Clone
Blob Blame History Raw
[RFC/ia64] memory error when reading wrong core file
http://sourceware.org/ml/gdb-patches/2010-01/msg00645.html
http://sourceware.org/ml/gdb-patches/2010-02/msg00001.html
http://sourceware.org/ml/gdb-patches/2010-03/msg00298.html
http://sourceware.org/ml/gdb-cvs/2010-03/msg00065.html
c961a8da422283662e09ee498c0598d48fc9d70f

--- src/gdb/solib-svr4.c	2010/02/24 00:29:02	1.125
+++ src/gdb/solib-svr4.c	2010/03/08 07:45:49	1.126
@@ -868,9 +868,16 @@
 {
   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.  */
### src/gdb/ChangeLog	2010/03/08 01:49:30	1.11441
### src/gdb/ChangeLog	2010/03/08 07:45:49	1.11442
## -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.