public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Andrew Burgess <aburgess@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] gdb/x86: handle stap probe arguments in xmm registers
Date: Tue, 15 Mar 2022 13:53:17 +0000	[thread overview]
Message-ID: <DM8PR11MB574934CBD585A7FFF1E9FF2DDE109@DM8PR11MB5749.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220315105446.3348835-1-aburgess@redhat.com>

Hello Andrew,

>On x86 machines with xmm register, and with recent versions of
>systemtap (and gcc?), it can occur that stap probe arguments will be
>placed into xmm registers.

I ran into the same problem with solib probes

  stapsdt              0x00000042       NT_STAPSDT (SystemTap probe descriptors)
    Provider: rtld
    Name: unmap_complete
    Location: 0x0000000000002d88, Base: 0x000000000002ecdb, Semaphore: 0x0000000000000000
    Arguments: -8@-112(%rbp) 8@%xmm1

which results in

	Invalid cast.
	warning: Probes-based dynamic linker interface failed.
	Reverting to original interface.

on dlclose() and can be observed with gdb.base/unload.exp.  It doesn't lead
to a FAIL but the test could easily be extended to catch this.

I extended gdb_continue_to_breakpoint to catch this case for another test I
wrote for linker namespaces.

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index a35d08a05de..ab7058121e5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -729,6 +729,12 @@ proc gdb_continue_to_breakpoint {name {location_pattern .*}} {
 
     set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
     gdb_test_multiple "continue" $full_name {
+       -re "Corrupted shared library list.*$gdb_prompt $" {
+           fail "$full_name: shared library list corrupted"
+       }
+       -re "Invalid cast\.\r\nwarning: Probes-based dynamic linker interface failed.*$gdb_prompt $" {
+           fail "$full_name: probes interface failure"
+       }
        -re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" {
            pass $full_name
        }


>My second plan involves adding a new expression type to GDB called
>unop_extract_operation.  This new expression takes a value and a type,
>during evaluation the value contents are fetched, and then a new value
>is extracted from the value contents (based on type).  This is similar
>to the following C expression:
>
>  result_value = *((output_type *) &input_value);
>
>Obviously we can't actually build this expression in this case, as the
>input_value is in a register, but hopefully the above makes it clearer
>what I'm trying to do.

The extract approach looks good to me and I can confirm that your patch
fixes the issue I've seen with dlclose() and the probe interface.

I was about to try changing the register operator to provide the
expected type but then I started wondering why we would want to
assign a type to registers, at all.  A register provides storage but
the actual interpretation of that storage is left to the instructions
that operate on the register and, as we can see here, compilers
may use that storage in novel ways.

I see how it might be nice to have some default display type for
printing values in 'info reg'.  But also that has become a challenge
with vector registers where we interpret the bits as vectors of
different length and element type.

Maybe we should leave it completely to the command that prints
register values (e.g. 'info reg') to define the type in which to interpret
the bits (e.g. via a set of options) and leave register values themselves
untyped.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  reply	other threads:[~2022-03-15 13:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 10:54 Andrew Burgess
2022-03-15 13:53 ` Metzger, Markus T [this message]
2022-03-15 17:28   ` Andrew Burgess
2022-03-16  9:36     ` Metzger, Markus T
2022-03-16 10:03       ` Andrew Burgess
2022-03-16 10:29         ` Metzger, Markus T
2022-03-16 14:13 ` [PATCHv2] " Andrew Burgess
2022-03-16 17:23   ` Tom Tromey
2022-03-17 15:54     ` Pedro Alves
2022-03-21 14:41       ` Andrew Burgess
2022-03-16 17:42   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM8PR11MB574934CBD585A7FFF1E9FF2DDE109@DM8PR11MB5749.namprd11.prod.outlook.com \
    --to=markus.t.metzger@intel.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).