+2014-09-17 Ulrich Weigand <uweigand@de.ibm.com>
+
+ PR gdb/17384
+ * corefile.c (struct captured_read_memory_integer_arguments): Remove.
+ (do_captured_read_memory_integer): Remove.
+ (safe_read_memory_integer): Use target_read_memory directly instead
+ of catching errors in do_captured_read_memory_integer.
+
2014-09-16 Maciej W. Rozycki <macro@codesourcery.com>
* CONTRIBUTE (Coding Standards): For internals refer to wiki,
memory_error (status, memaddr);
}
-/* Argument / return result struct for use with
- do_captured_read_memory_integer(). MEMADDR and LEN are filled in
- by gdb_read_memory_integer(). RESULT is the contents that were
- successfully read from MEMADDR of length LEN. */
-
-struct captured_read_memory_integer_arguments
-{
- CORE_ADDR memaddr;
- int len;
- enum bfd_endian byte_order;
- LONGEST result;
-};
-
-/* Helper function for gdb_read_memory_integer(). DATA must be a
- pointer to a captured_read_memory_integer_arguments struct.
- Return 1 if successful. Note that the catch_errors() interface
- will return 0 if an error occurred while reading memory. This
- choice of return code is so that we can distinguish between
- success and failure. */
-
-static int
-do_captured_read_memory_integer (void *data)
-{
- struct captured_read_memory_integer_arguments *args
- = (struct captured_read_memory_integer_arguments*) data;
- CORE_ADDR memaddr = args->memaddr;
- int len = args->len;
- enum bfd_endian byte_order = args->byte_order;
-
- args->result = read_memory_integer (memaddr, len, byte_order);
-
- return 1;
-}
-
/* Read memory at MEMADDR of length LEN and put the contents in
RETURN_VALUE. Return 0 if MEMADDR couldn't be read and non-zero
if successful. */
enum bfd_endian byte_order,
LONGEST *return_value)
{
- int status;
- struct captured_read_memory_integer_arguments args;
-
- args.memaddr = memaddr;
- args.len = len;
- args.byte_order = byte_order;
+ gdb_byte buf[sizeof (LONGEST)];
- status = catch_errors (do_captured_read_memory_integer, &args,
- "", RETURN_MASK_ALL);
- if (status)
- *return_value = args.result;
+ if (target_read_memory (memaddr, buf, len))
+ return 0;
- return status;
+ *return_value = extract_signed_integer (buf, len, byte_order);
+ return 1;
}
LONGEST