This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tdep/2561: MMX register number to register value mapping is incorrect


>Number:         2561
>Category:       tdep
>Synopsis:       MMX register number to register value mapping is incorrect
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 08 05:58:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Tom Honermann
>Release:        gdb-6.8
>Organization:
>Environment:
Linux 2.6.9 - Oracle Enterprise Linux 4u4 (Equiv to RedHat 4u4)
>Description:
Intel MMX registers (mm0-mm7) are aliased to the x87 floating point registers (st0-st7).  The x87 floating point registers comprise a register stack that revolves as values are pushed onto it.  The MMX registers however are directly mapped to the backing store for the floating point registers (r0-r7).  Thus, mm0==r0, mm1==r1, ...mm7=r7 but st0 is not necessarily equal to r0.  When displaying MMX registers, gdb computes the association between the MMX and x87 data registers incorrectly.
>How-To-Repeat:
Compile the attached program as a 32bit x86 Linux program  (Makefile included).  Run it and it will display what the MMX register values should be.  The program will then generate a SIGSEGV to break into gdb at a good point for analyzing the x87 and MMX registers.  Run the program in GDB and when the SIGSEGV is received, run 'info all-reg' to see all registers.  Compare the GDB mm0-mm7 register values to those displayed by the program.  The values to register number mapping will be off.
>Fix:
The problem is in 'i386_mmx_regnum_to_fp_regnum' in gdb-6.8/gdb/i386-tdep.c.  The current code for computing the association is:

    fpreg = (mmxreg + tos) % 8;

This should be:

    fpreg = ((8 + mmxreg) - tos) % 8;
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-tar; name="test-gdb-mmx-bug.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test-gdb-mmx-bug.tar.gz"

H4sIACqDPEkAA+1XTW/jNhDNdfUrBi5SWO5aISVS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npXF7DOnlOQVLX82mrNwMDAwMDAwMDAwMDAwMDAwMDA
wMDAwMDgHPgH15VZ9QAoAAA=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]