|
|
50a6238 |
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=181390
|
|
|
50a6238 |
|
|
|
50a6238 |
|
|
|
50a6238 |
2006-09-28 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
50a6238 |
|
|
|
50a6238 |
* gdb/utils.c (paddress): Disable cutting of the printed addresses
|
|
|
50a6238 |
to the target's address bit size; user wants to see everything.
|
|
|
50a6238 |
* gdb/value.c (value_as_address_core): Original `value_as_address'.
|
|
|
50a6238 |
(value_as_address): New `value_as_address' wrapper - cut memory address
|
|
|
50a6238 |
to the target's address bit size, bugreport by John Reiser.
|
|
|
50a6238 |
|
|
|
50a6238 |
|
|
|
50a6238 |
Index: gdb-6.5/gdb/utils.c
|
|
|
50a6238 |
===================================================================
|
|
|
50a6238 |
RCS file: /cvs/src/src/gdb/utils.c,v
|
|
|
50a6238 |
retrieving revision 1.169
|
|
|
50a6238 |
diff -u -p -r1.169 utils.c
|
|
|
50a6238 |
--- gdb-6.5.orig/gdb/utils.c 21 Sep 2006 13:50:51 -0000 1.169
|
|
|
50a6238 |
+++ gdb-6.5/gdb/utils.c 28 Sep 2006 17:06:03 -0000
|
|
|
50a6238 |
@@ -2596,6 +2596,14 @@ paddr_nz (CORE_ADDR addr)
|
|
|
50a6238 |
const char *
|
|
|
50a6238 |
paddress (CORE_ADDR addr)
|
|
|
50a6238 |
{
|
|
|
50a6238 |
+ /* Do not cut the address as the user should see all the information
|
|
|
50a6238 |
+ available. Otherwise 64-bit gdb debugging 32-bit inferior would
|
|
|
50a6238 |
+ report for `x/x 0xffffffffffffce70' error
|
|
|
50a6238 |
+ `Cannot access memory at 0xffffce70' while the error occured just
|
|
|
50a6238 |
+ because of the higher order bits 0xffffffff00000000 there.
|
|
|
50a6238 |
+ This specific error no longer occurs as the address is now cut
|
|
|
50a6238 |
+ during execution by `value_as_address'. */
|
|
|
50a6238 |
+#if 0
|
|
|
50a6238 |
/* Truncate address to the size of a target address, avoiding shifts
|
|
|
50a6238 |
larger or equal than the width of a CORE_ADDR. The local
|
|
|
50a6238 |
variable ADDR_BIT stops the compiler reporting a shift overflow
|
|
|
50a6238 |
@@ -2609,6 +2617,8 @@ paddress (CORE_ADDR addr)
|
|
|
50a6238 |
|
|
|
50a6238 |
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
|
|
|
50a6238 |
addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
|
|
|
50a6238 |
+#endif
|
|
|
50a6238 |
+
|
|
|
50a6238 |
return hex_string (addr);
|
|
|
50a6238 |
}
|
|
|
50a6238 |
|
|
|
50a6238 |
Index: gdb-6.5/gdb/value.c
|
|
|
50a6238 |
===================================================================
|
|
|
50a6238 |
RCS file: /cvs/src/src/gdb/value.c,v
|
|
|
50a6238 |
retrieving revision 1.36
|
|
|
50a6238 |
diff -u -p -r1.36 value.c
|
|
|
50a6238 |
--- gdb-6.5.orig/gdb/value.c 31 Mar 2006 10:36:18 -0000 1.36
|
|
|
50a6238 |
+++ gdb-6.5/gdb/value.c 28 Sep 2006 17:06:03 -0000
|
|
|
50a6238 |
@@ -950,11 +950,10 @@ value_as_double (struct value *val)
|
|
|
50a6238 |
error (_("Invalid floating value found in program."));
|
|
|
50a6238 |
return foo;
|
|
|
50a6238 |
}
|
|
|
50a6238 |
-/* Extract a value as a C pointer. Does not deallocate the value.
|
|
|
50a6238 |
- Note that val's type may not actually be a pointer; value_as_long
|
|
|
50a6238 |
- handles all the cases. */
|
|
|
50a6238 |
-CORE_ADDR
|
|
|
50a6238 |
-value_as_address (struct value *val)
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+/* See `value_as_address' below - core of value to C pointer extraction. */
|
|
|
50a6238 |
+static CORE_ADDR
|
|
|
50a6238 |
+value_as_address_core (struct value *val)
|
|
|
50a6238 |
{
|
|
|
50a6238 |
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
|
|
|
50a6238 |
whether we want this to be true eventually. */
|
|
|
eb9d945 |
@@ -1054,6 +1053,34 @@ value_as_address (struct value *val)
|
|
|
50a6238 |
return unpack_long (value_type (val), value_contents (val));
|
|
|
50a6238 |
#endif
|
|
|
50a6238 |
}
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+/* Extract a value as a C pointer. Does not deallocate the value.
|
|
|
50a6238 |
+ Note that val's type may not actually be a pointer; value_as_long
|
|
|
50a6238 |
+ handles all the cases. */
|
|
|
50a6238 |
+CORE_ADDR
|
|
|
50a6238 |
+value_as_address (struct value *val)
|
|
|
50a6238 |
+{
|
|
|
50a6238 |
+ CORE_ADDR addr;
|
|
|
eb9d945 |
+ int addr_bit;
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+ addr = value_as_address_core (val);
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+ /* Truncate address to the size of a target address, avoiding shifts
|
|
|
50a6238 |
+ larger or equal than the width of a CORE_ADDR. The local
|
|
|
50a6238 |
+ variable ADDR_BIT stops the compiler reporting a shift overflow
|
|
|
50a6238 |
+ when it won't occur. */
|
|
|
50a6238 |
+ /* NOTE: This assumes that the significant address information is
|
|
|
50a6238 |
+ kept in the least significant bits of ADDR - the upper bits were
|
|
|
50a6238 |
+ either zero or sign extended. Should ADDRESS_TO_POINTER() or
|
|
|
50a6238 |
+ some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
|
|
|
50a6238 |
+
|
|
|
eb9d945 |
+ addr_bit = gdbarch_addr_bit (current_gdbarch);
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
|
|
|
50a6238 |
+ addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
|
|
|
50a6238 |
+
|
|
|
50a6238 |
+ return addr;
|
|
|
50a6238 |
+}
|
|
|
50a6238 |
|
|
|
50a6238 |
/* Unpack raw data (copied from debugee, target byte order) at VALADDR
|
|
|
50a6238 |
as a long, or as a double, assuming the raw data is described
|