diff options
author | Klee Dienes <kdienes@apple.com> | 2002-10-12 01:48:17 +0000 |
---|---|---|
committer | Klee Dienes <kdienes@apple.com> | 2002-10-12 01:48:17 +0000 |
commit | 6f5e71f99ef44799596bd8b335dfd96d838a3cf2 (patch) | |
tree | 9fbf31c7837b15c26a62405b35198d29b12e9246 /gdb | |
parent | d955eeb4806bed701d541d495f706cf73d6cb2a1 (diff) | |
download | gdb-6f5e71f99ef44799596bd8b335dfd96d838a3cf2.tar.gz |
2002-10-11 Klee Dienes <kdienes@apple.com>
* findvar.c (read_memory_typed_address): New function.
* gdbcore.h (read_memory_typed_address): Add prototype.
* blockframe.c (sigtramp_saved_pc): Use read_memory_typed_address
to read a value destined for a CORE_ADDR, not read_memory_integer.
* f-valprint.c (f77_get_dynamic_upperbound): Ditto.
(f77_get_dynamic_lowerbound): Ditto.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/blockframe.c | 14 | ||||
-rw-r--r-- | gdb/corefile.c | 8 | ||||
-rw-r--r-- | gdb/f-valprint.c | 12 | ||||
-rw-r--r-- | gdb/gdbcore.h | 7 |
5 files changed, 36 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8a7710991a0..e0edadd4e4e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2002-10-11 Klee Dienes <kdienes@apple.com> + + * findvar.c (read_memory_typed_address): New function. + * gdbcore.h (read_memory_typed_address): Add prototype. + * blockframe.c (sigtramp_saved_pc): Use read_memory_typed_address + to read a value destined for a CORE_ADDR, not read_memory_integer. + * f-valprint.c (f77_get_dynamic_upperbound): Ditto. + (f77_get_dynamic_lowerbound): Ditto. + 2002-10-11 Martin M. Hunt <hunt@redhat.com> * utils.c (string_to_core_addr): After turning string into diff --git a/gdb/blockframe.c b/gdb/blockframe.c index eba45a377d9..4eb22acba68 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -1035,19 +1035,17 @@ sigtramp_saved_pc (struct frame_info *frame) buf = alloca (ptrbytes); /* Get sigcontext address, it is the third parameter on the stack. */ if (frame->next) - sigcontext_addr = read_memory_integer (FRAME_ARGS_ADDRESS (frame->next) - + FRAME_ARGS_SKIP - + sigcontext_offs, - ptrbytes); + sigcontext_addr = read_memory_typed_address + (FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs, + builtin_type_void_data_ptr); else - sigcontext_addr = read_memory_integer (read_register (SP_REGNUM) - + sigcontext_offs, - ptrbytes); + sigcontext_addr = read_memory_typed_address + (read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr); /* Don't cause a memory_error when accessing sigcontext in case the stack layout has changed or the stack is corrupt. */ target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes); - return extract_unsigned_integer (buf, ptrbytes); + return extract_typed_address (buf, builtin_type_void_data_ptr); } #endif /* SIGCONTEXT_PC_OFFSET */ diff --git a/gdb/corefile.c b/gdb/corefile.c index 4f6eef2ce72..be0ecf0e3b0 100644 --- a/gdb/corefile.c +++ b/gdb/corefile.c @@ -356,6 +356,14 @@ read_memory_string (CORE_ADDR memaddr, char *buffer, int max_len) } } +CORE_ADDR +read_memory_typed_address (CORE_ADDR addr, struct type *type) +{ + char *buf = alloca (TYPE_LENGTH (type)); + read_memory (addr, buf, TYPE_LENGTH (type)); + return extract_typed_address (buf, type); +} + /* Same as target_write_memory, but report an error if can't write. */ void write_memory (CORE_ADDR memaddr, char *myaddr, int len) diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 48c511377e8..4bd01cc9ab2 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -102,9 +102,9 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) if (current_frame_addr > 0) { ptr_to_lower_bound = - read_memory_integer (current_frame_addr + - TYPE_ARRAY_LOWER_BOUND_VALUE (type), - 4); + read_memory_typed_address (current_frame_addr + + TYPE_ARRAY_LOWER_BOUND_VALUE (type), + builtin_type_void_data_ptr); *lower_bound = read_memory_integer (ptr_to_lower_bound, 4); } else @@ -165,9 +165,9 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound) if (current_frame_addr > 0) { ptr_to_upper_bound = - read_memory_integer (current_frame_addr + - TYPE_ARRAY_UPPER_BOUND_VALUE (type), - 4); + read_memory_typed_address (current_frame_addr + + TYPE_ARRAY_UPPER_BOUND_VALUE (type), + builtin_type_void_data_ptr); *upper_bound = read_memory_integer (ptr_to_upper_bound, 4); } else diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 88594554080..5c10c589e50 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -64,8 +64,15 @@ extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr, int len); /* Read a null-terminated string from the debuggee's memory, given address, * a buffer into which to place the string, and the maximum available space */ + extern void read_memory_string (CORE_ADDR, char *, int); +/* Read the pointer of type TYPE at ADDR, and return the address it + represents. */ + +CORE_ADDR +read_memory_typed_address (CORE_ADDR addr, struct type *type); + /* This takes a char *, not void *. This is probably right, because passing in an int * or whatever is wrong with respect to byteswapping, alignment, different sizes for host vs. target types, |