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.
This commit is contained in:
parent
52019e89e2
commit
0d540cdfe7
5 changed files with 36 additions and 14 deletions
|
@ -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>
|
2002-10-11 Martin M. Hunt <hunt@redhat.com>
|
||||||
|
|
||||||
* utils.c (string_to_core_addr): After turning string into
|
* utils.c (string_to_core_addr): After turning string into
|
||||||
|
|
|
@ -1035,19 +1035,17 @@ sigtramp_saved_pc (struct frame_info *frame)
|
||||||
buf = alloca (ptrbytes);
|
buf = alloca (ptrbytes);
|
||||||
/* Get sigcontext address, it is the third parameter on the stack. */
|
/* Get sigcontext address, it is the third parameter on the stack. */
|
||||||
if (frame->next)
|
if (frame->next)
|
||||||
sigcontext_addr = read_memory_integer (FRAME_ARGS_ADDRESS (frame->next)
|
sigcontext_addr = read_memory_typed_address
|
||||||
+ FRAME_ARGS_SKIP
|
(FRAME_ARGS_ADDRESS (frame->next) + FRAME_ARGS_SKIP + sigcontext_offs,
|
||||||
+ sigcontext_offs,
|
builtin_type_void_data_ptr);
|
||||||
ptrbytes);
|
|
||||||
else
|
else
|
||||||
sigcontext_addr = read_memory_integer (read_register (SP_REGNUM)
|
sigcontext_addr = read_memory_typed_address
|
||||||
+ sigcontext_offs,
|
(read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr);
|
||||||
ptrbytes);
|
|
||||||
|
|
||||||
/* Don't cause a memory_error when accessing sigcontext in case the stack
|
/* Don't cause a memory_error when accessing sigcontext in case the stack
|
||||||
layout has changed or the stack is corrupt. */
|
layout has changed or the stack is corrupt. */
|
||||||
target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes);
|
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 */
|
#endif /* SIGCONTEXT_PC_OFFSET */
|
||||||
|
|
||||||
|
|
|
@ -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. */
|
/* Same as target_write_memory, but report an error if can't write. */
|
||||||
void
|
void
|
||||||
write_memory (CORE_ADDR memaddr, char *myaddr, int len)
|
write_memory (CORE_ADDR memaddr, char *myaddr, int len)
|
||||||
|
|
|
@ -102,9 +102,9 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
|
||||||
if (current_frame_addr > 0)
|
if (current_frame_addr > 0)
|
||||||
{
|
{
|
||||||
ptr_to_lower_bound =
|
ptr_to_lower_bound =
|
||||||
read_memory_integer (current_frame_addr +
|
read_memory_typed_address (current_frame_addr +
|
||||||
TYPE_ARRAY_LOWER_BOUND_VALUE (type),
|
TYPE_ARRAY_LOWER_BOUND_VALUE (type),
|
||||||
4);
|
builtin_type_void_data_ptr);
|
||||||
*lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
|
*lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -165,9 +165,9 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
|
||||||
if (current_frame_addr > 0)
|
if (current_frame_addr > 0)
|
||||||
{
|
{
|
||||||
ptr_to_upper_bound =
|
ptr_to_upper_bound =
|
||||||
read_memory_integer (current_frame_addr +
|
read_memory_typed_address (current_frame_addr +
|
||||||
TYPE_ARRAY_UPPER_BOUND_VALUE (type),
|
TYPE_ARRAY_UPPER_BOUND_VALUE (type),
|
||||||
4);
|
builtin_type_void_data_ptr);
|
||||||
*upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
|
*upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -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,
|
/* 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 */
|
* a buffer into which to place the string, and the maximum available space */
|
||||||
|
|
||||||
extern void read_memory_string (CORE_ADDR, char *, int);
|
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
|
/* This takes a char *, not void *. This is probably right, because
|
||||||
passing in an int * or whatever is wrong with respect to
|
passing in an int * or whatever is wrong with respect to
|
||||||
byteswapping, alignment, different sizes for host vs. target types,
|
byteswapping, alignment, different sizes for host vs. target types,
|
||||||
|
|
Loading…
Reference in a new issue