From: Joel Brobecker Date: Mon, 8 Mar 2010 07:45:49 +0000 (+0000) Subject: Memory error when reading wrong core file. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=08597104eb26d23340f42ccd610ce6d24015e501;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 911fcd1eb33..39c0c789c37 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2010-03-08 Joel Brobecker + + 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 * record.c (record_restore): Rename tmpu8 to rectype. diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 43172834488..0c6654f9112 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. */