This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug corefiles/10439] New: AIX/Power registers incorrectly represented as 32-bits instead of 64-bits
- From: "andrew at ishiboo dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 23 Jul 2009 20:28:03 -0000
- Subject: [Bug corefiles/10439] New: AIX/Power registers incorrectly represented as 32-bits instead of 64-bits
- Reply-to: sourceware-bugzilla at sourceware dot org
GDB currently treats r* registers under AIX/Power 64-bit CPU as uint32_t:
(gdb) maintenance print registers
Name Nr Rel Offset Size Type
r0 0 0 0 4 uint32_t
This is incorrect because the registers themselves are 64-bit wide even though a
32-bit program is running on them. The IBM xlc compiler takes advantage of this
fact and actually outputs 64-bit assembler instructions when the "-qarch=pwr4
-qtune=pwr5" optimizations are used when compiling a 32-bit binary.
Since GDB treats the registers as 32-bits, GDB can modify runtime program
behavior by truncating the high 32 bits of a register in certain cases. In order
to properly debug binaries on this system, GDB needs to treat registers as
64-bit so that values are not modified.
I've created a contrived example which shows GDB modifying the runtime behavior:
$ ./gdb_reg_clobber
before: space[0..1]=0x0000000000000000
after: space[0..1]=0x000020ffffffffff
$ gdb ./gdb_reg_clobber
(gdb) break atomic_set_int64
Breakpoint 1 at 0x100004e4
(gdb) run
Starting program: /home8/apaprock/aix_gdb/gdb_reg_clobber
before: space[0..1]=0x0000000000000000
Breakpoint 1, 0x100004e4 in atomic_set_int64 ()
(gdb) cont
Continuing.
after: space[0..1]=0x00000000ffffffff
In the GDB case, the "after:" printf shows different behavior due to the fact
that a breakpoint was set on the atomic function which uses 64-bit instructions
to atomically set 64-bits. If a breakpoint is not set on that function, the
correct output is seen when running inside GDB.
--
Summary: AIX/Power registers incorrectly represented as 32-bits
instead of 64-bits
Product: gdb
Version: 6.8
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: corefiles
AssignedTo: unassigned at sourceware dot org
ReportedBy: andrew at ishiboo dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: powerpc-ibm-aix5.3.0.0
GCC host triplet: powerpc-ibm-aix5.3.0.0
GCC target triplet: powerpc-ibm-aix5.3.0.0
http://sourceware.org/bugzilla/show_bug.cgi?id=10439
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.