Bug 2061892 - gdb: Unable to parse values in xmm registers for sdt probes.
Summary: gdb: Unable to parse values in xmm registers for sdt probes.
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: gdb
Version: 9.0
Hardware: x86_64
OS: Linux
low
high
Target Milestone: rc
: ---
Assignee: Andrew Burgess
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-08 17:05 UTC by Carlos O'Donell
Modified: 2023-08-09 07:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-114829 0 None None None 2022-03-08 17:16:33 UTC

Description Carlos O'Donell 2022-03-08 17:05:55 UTC
Description of problem:
gdb is unable to parse sdt probe arguments in xmm registers.


Version-Release number of selected component (if applicable):
gdb 10.2-9.el9

How reproducible:

Always reproducible. Use a simple pthread_create/pthread_join example and then:

break main
start
info probes stap libc
break *[address of probe for pthread_start]
continue
show convenience
...
$_probe_arg11 = <error: Invalid probe argument 11 -- probe has 3 arguments available>
$_probe_arg10 = <error: Invalid probe argument 10 -- probe has 3 arguments available>
$_probe_arg9 = <error: Invalid probe argument 9 -- probe has 3 arguments available>
$_probe_arg8 = <error: Invalid probe argument 8 -- probe has 3 arguments available>
$_probe_arg7 = <error: Invalid probe argument 7 -- probe has 3 arguments available>
$_probe_arg6 = <error: Invalid probe argument 6 -- probe has 3 arguments available>
$_probe_arg5 = <error: Invalid probe argument 5 -- probe has 3 arguments available>
$_probe_arg4 = <error: Invalid probe argument 4 -- probe has 3 arguments available>
$_probe_arg3 = <error: Invalid probe argument 3 -- probe has 3 arguments available>
$_probe_arg2 = 0
$_probe_arg1 = 4198902
$_probe_arg0 = <error: Invalid cast.>
               ^^^^^^^^^^^^^^^^^^^^^^ Broken due to xmmo0 usage.
$_probe_argc = 3

$_probe_arg2 is 0 because NULL was passed as the arg to pthread_create().
-- Works because it's 8@1608(%rbx) 
$_probe_arg1 is the correct address of the start function e.g. 0x4011f6 <worker>
-- Works because it's 8@1600(%rbx) 
$_probe_arg0 is broken in gdb because of the use of xmm0.
-- Doesn't work because 8@%xmm0 uses %xmm0.

This is a blocker IMO since probes using xmm0 looks broken in gdb too.

Actual results:
- Prints <erro: Invalid cast.>

Expected results:
- Prints the value.

Comment 1 Carlos O'Donell 2022-03-08 17:07:39 UTC
We have two probes that use xmm registers in libc:

  stapsdt              0x0000004d       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: pthread_start
    Location: 0x00000000000a456b, Base: 0x00000000001c8658, Semaphore: 0x0000000000000000
    Arguments: 8@%xmm0 8@1600(%rbx) 8@1608(%rbx)
  stapsdt              0x00000054       NT_STAPSDT (SystemTap probe descriptors)            Provider: libc
    Name: pthread_create
    Location: 0x00000000000a4d28, Base: 0x00000000001c8658, Semaphore: 0x0000000000000000
    Arguments: 8@%xmm1 8@8(%rsp) 8@16(%rsp) 8@24(%rsp)

Comment 3 Andrew Burgess 2022-03-15 17:36:31 UTC
I've posted this patch to the upstream gdb mailing list:

  https://sourceware.org/pipermail/gdb-patches/2022-March/186632.html

This patch allows a user to stop at a probe and view the argument in an xmm register.

What's missing in this patch is GDB's agent expression support (used for the fast tracepoints), so a user can't place a tracepoint at a probe (that uses xmm registers) and collect the arguments.  I want to see how the approach I'm proposing in that patch goes down before I start worrying about agent expression support.


Note You need to log in before you can comment on or make changes to this bug.