Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2023 03:42:00 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 275322] Improper handling of mxcsr register during debug (gdb/lldb)
Message-ID:  <bug-275322-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275322

            Bug ID: 275322
           Summary: Improper handling of mxcsr register during debug
                    (gdb/lldb)
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: cheyenne.wills@gmail.com
 Attachment #246554 text/plain
         mime type:

Created attachment 246554
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D246554&action=
=3Dedit
C code to demonstrate the problem

There is improper handling of the mxcsr register when debugging.  It appears
that the current mxcsr register is not being given to the debugger.

The attached program illustrates the problem.

compile the attached program:lang -mfpmath=3Dsse -mlong-double-64 -g -lm -o=
 {x}
{x.c}

Run the following debug session:

gdb ./{x}
break main
run
** program should run to end with the following output:

ra=3D7.01209994486364354e-310 reatt=3D10000000000 ra * reatt-> result =3D0 =
savemxcsr
00001f80 mxcsr_set 00009fc0 showmxcsr 00009fc0 mxcsr 00001f80

disassemble main
** set a break at the mulsd instruction (should be around offset +81)
run
** should now be at the mulsd instruction
continue
** output should be the same as above

run
** should now be at the mulsd instruction
info register mxcsr
** output should be:
mxcsr          0x1f80              [ IM DM ZM OM UM PM ]
** which is incorrect since it there was a ldmxcsr instruction around offset
+39 and the result should be:
mxcsr          0x9fc0              [ DAZ IM DM ZM OM UM PM FZ ]

continue
** output shows incorrect output:
ra=3D7.01209994486364354e-310 reatt=3D10000000000 ra * reatt-> result
=3D7.01209994486364403e-300 savemxcsr 00001f80 mxcsr_set 00009fc0 showmxcsr
00009fc0 mxcsr 00001fa2
** since it appears that the mxcsr register is being reset back to the 0x1f=
80
value after it was displayed

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275322-227>