From: Elena Zannoni Date: Wed, 19 Dec 2001 23:54:27 +0000 (+0000) Subject: 2001-12-19 Elena Zannoni X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16a0f3e75ec06dd9d4ff578c2ae5273c364f165c;p=binutils-gdb.git 2001-12-19 Elena Zannoni * 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(). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 92daea9de13..c37f973f877 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2001-12-19 Elena Zannoni + + * 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 * s390-tdep.c (s390_register_name): S390_LAST_REGNUM is, in fact, diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 434b26fce0d..d3e8b944c60 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -727,6 +727,7 @@ static void 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. */ @@ -791,9 +792,13 @@ arm_scan_prologue (struct frame_info *fi) { /* 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 diff --git a/gdb/corefile.c b/gdb/corefile.c index 4e096f05908..facd2dae83b 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -262,6 +262,41 @@ dis_asm_print_address (bfd_vma addr, struct disassemble_info *info) /* 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) { diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 03ac7991dcb..88594554080 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -55,6 +55,7 @@ extern void read_memory (CORE_ADDR memaddr, char *myaddr, 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. */