+2001-12-19 Elena Zannoni <ezannoni@redhat.com>
+
+ * corefile.c (do_captured_read_memory_integer,
+ safe_read_memory_integer): New functions.
+ * gdbcore.h (safe_read_memory_integer): Export.
+ * arm-tdep.c (arm_scan_prologue): Use safe_read_memory_integer,
+ to read the frame value, to capture calls to error().
+
2001-12-19 Jim Blandy <jimb@redhat.com>
* s390-tdep.c (s390_register_name): S390_LAST_REGNUM is, in fact,
arm_scan_prologue (struct frame_info *fi)
{
int regno, sp_offset, fp_offset;
+ LONGEST return_value;
CORE_ADDR prologue_start, prologue_end, current_pc;
/* Check if this function is already in the cache of frame information. */
{
/* Get address of the stmfd in the prologue of the callee; the saved
PC is the address of the stmfd + 8. */
- prologue_start = ADDR_BITS_REMOVE (read_memory_integer (fi->frame, 4))
- - 8;
- prologue_end = prologue_start + 64; /* See above. */
+ if (!safe_read_memory_integer (fi->frame, 4, &return_value))
+ return;
+ else
+ {
+ prologue_start = ADDR_BITS_REMOVE (return_value) - 8;
+ prologue_end = prologue_start + 64; /* See above. */
+ }
}
/* Now search the prologue looking for instructions that set up the
/* Read an integer from debugged memory, given address and number of bytes. */
+struct captured_read_memory_integer_arguments
+{
+ CORE_ADDR memaddr;
+ int len;
+ LONGEST result;
+};
+
+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;
+
+ args->result = read_memory_integer (memaddr, len);
+
+ return 0;
+}
+
+int
+safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value)
+{
+ int status;
+ struct captured_read_memory_integer_arguments args;
+ args.memaddr = memaddr;
+ args.len = len;
+
+ status = catch_errors (do_captured_read_memory_integer, &args,
+ "", RETURN_MASK_ALL);
+ if (!status)
+ *return_value = args.result;
+
+ return status;
+}
+
LONGEST
read_memory_integer (CORE_ADDR memaddr, int len)
{
bytes. */
extern LONGEST read_memory_integer (CORE_ADDR memaddr, int len);
+extern int safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value);
/* Read an unsigned integer from debugged memory, given address and
number of bytes. */