This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
print/a ... (again!)
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: print/a ... (again!)
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 04 Jul 2000 18:41:23 +1000
Hello,
I'm looking at a 64 bit MIPS debugging a 32 bit ISA (-mips2 -EB) and am
seeing:
(gdb) p/a main+4
$1 = 0xa0020290
(gdb) print main + 4
$5 = (int (*)()) 0xffffffffa0020290 <main+4>
notice how ``print/a'' doesn't know where main is. Grubbing around in
printcmd.c I find:
case 'a':
{
/* Truncate address to the size of a target pointer, avoiding
shifts larger or equal than the width of a CORE_ADDR. The
local variable PTR_BIT stops the compiler reporting a shift
overflow when it won't occure. */
CORE_ADDR addr = unpack_pointer (type, valaddr);
int ptr_bit = TARGET_PTR_BIT;
if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
print_address (addr, stream);
}
break;
the problem is that the mask strips off a significant part of the
address. Commenting out that mask I get the behavour:
(gdb) print main+4
$2 = (int (*)()) 0xffffffffa0020290 <main+4>
(gdb) print/a main+4
$3 = 0xffffffffa0020290 <main+4>
which is definitly an improvement. I'm going to have to go diging
around in the e-mail archives. Anyone care to try to summarize the
rationale behind the mask?
enjoy,
Andrew