diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2001-12-19 23:54:27 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2001-12-19 23:54:27 +0000 |
commit | 16a0f3e75ec06dd9d4ff578c2ae5273c364f165c (patch) | |
tree | 76bf6c3dc271a1e5a6b541049b927b39124ac562 /gdb/corefile.c | |
parent | 47a70901841dedf5a3067a6798e29da42fb14fbe (diff) | |
download | binutils-gdb-16a0f3e75ec06dd9d4ff578c2ae5273c364f165c.tar.gz |
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().
Diffstat (limited to 'gdb/corefile.c')
-rw-r--r-- | gdb/corefile.c | 35 |
1 files changed, 35 insertions, 0 deletions
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) { |