public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/28334] New: cannot handle offset into register
@ 2021-09-13 10:20 913495245 at qq dot com
  2022-05-19 20:25 ` [Bug translator/28334] " scox at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: 913495245 at qq dot com @ 2021-09-13 10:20 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

            Bug ID: 28334
           Summary: cannot handle offset into register
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: 913495245 at qq dot com
  Target Milestone: ---

Hi team

I had a function trace demo with Struct parameter and Struct return, but got
the "cannot handle offset into register" error.

my environments:
  os: Ubuntu 16.04 LTS
  gcc 8.3
  systemtap 4.5
  elfutils 0.185


# func.h
struct DataPackage {
    int len;
    float width;
    // float width2; // uncomment this line will work :)
    double angle;
};

struct DataPackage func_complex_v2(struct DataPackage input_data, int page);

# func.c

struct DataPackage func_complex_v2(struct DataPackage input_data, int page) {
    struct DataPackage d;
    d.len = 19;
    d.width = 115.33;
    d.angle = 6.66;

    return d;
}

# main.c
int main(int argc, char const *argv[])
{

    struct DataPackage d;
    d.len = 997;
    d.width = 10;
    d.angle = 0.777;

    struct DataPackage r =func_complex_v2(d, 789);

    return 0;
}

# cc_stap_test_complex.stp
probe
process("/home/xyz/vs_workspace/CacheLab/build/test").function("func_complex_v2").return
{
    printf("func_complex_v2 return: %s\n", fp_to_string($return->width, 6))
}


Here is the console output:

Debug translate_offsetsemantic error: cannot handle offset into register:
identifier '$return' at 
/home/xyz/cc_stap_test_complex.stp:73:57
        source:     printf("func_complex_v2 return: %s\n",
fp_to_string($return->width, 6))
                                                                        ^

semantic error: unresolved type : identifier '$return' at :73:57
        source:     printf("func_complex_v2 return: %s\n",
fp_to_string($return->width, 6))


Any advice is appreciate, thanks!

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug translator/28334] cannot handle offset into register
  2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
@ 2022-05-19 20:25 ` scox at redhat dot com
  2022-05-19 20:31 ` fche at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: scox at redhat dot com @ 2022-05-19 20:25 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

Stan Cox <scox at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |scox at redhat dot com
         Resolution|---                         |FIXED

--- Comment #1 from Stan Cox <scox at redhat dot com> ---
This is due to the x8664 abi which specifies how structures are passed.  The
structure in the example is returned by value, which will return the struct
members in successive registers as specified by the x8664 abi.  In this
particular case members are packed into a single register and systemtap is thus
not able to pry it apart.  Thus the error "cannot handle offset into register"

The abi says:
 The classification of aggregate (structures and arrays) and union types works
as follows:
1. If the size of an object is larger than four eightbytes, or it contains
unaligned
fields, it has class MEMORY

So if the example is changed to be double width; double angle; then the abi
threshold is hit, the struct is passed by reference and systemtap can then
access individual members.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug translator/28334] cannot handle offset into register
  2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
  2022-05-19 20:25 ` [Bug translator/28334] " scox at redhat dot com
@ 2022-05-19 20:31 ` fche at redhat dot com
  2022-05-19 20:50 ` scox at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: fche at redhat dot com @ 2022-05-19 20:31 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> ---
>  In this particular case members are packed into a single register and systemtap is thus not able to pry it apart.  Thus the error "cannot handle offset into register"

Why can systemtap not handle this though?  I believe the code knows about
larger values being split across memory words or registers.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug translator/28334] cannot handle offset into register
  2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
  2022-05-19 20:25 ` [Bug translator/28334] " scox at redhat dot com
  2022-05-19 20:31 ` fche at redhat dot com
@ 2022-05-19 20:50 ` scox at redhat dot com
  2022-07-01 17:39 ` wcohen at redhat dot com
  2022-07-01 17:44 ` wcohen at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: scox at redhat dot com @ 2022-05-19 20:50 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

Stan Cox <scox at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-05-19
         Resolution|FIXED                       |---

--- Comment #3 from Stan Cox <scox at redhat dot com> ---
It is hitting this case:
dwflpp::translate_base_ref

    case loc_register:
      if (loc->offset != 0)
        throw SEMANTIC_ERROR (_("cannot handle offset into register"),
ctx.e->tok);
      // The existing program is the value.
      break;

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug translator/28334] cannot handle offset into register
  2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
                   ` (2 preceding siblings ...)
  2022-05-19 20:50 ` scox at redhat dot com
@ 2022-07-01 17:39 ` wcohen at redhat dot com
  2022-07-01 17:44 ` wcohen at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: wcohen at redhat dot com @ 2022-07-01 17:39 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |29037


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=29037
[Bug 29037] Systemtap unable to find struct bitfield members for gcc11 compiled
code
-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug translator/28334] cannot handle offset into register
  2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
                   ` (3 preceding siblings ...)
  2022-07-01 17:39 ` wcohen at redhat dot com
@ 2022-07-01 17:44 ` wcohen at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: wcohen at redhat dot com @ 2022-07-01 17:44 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=28334

William Cohen <wcohen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wcohen at redhat dot com

--- Comment #4 from William Cohen <wcohen at redhat dot com> ---
Been working on PR29037. For bitfields there is some logic that handles to
extract the bitfield of interest.  It doesn't look like there is similar code
to extract other members of a struct:

https://sourceware.org/git/?p=systemtap.git;a=blob;f=dwflpp.cxx;h=ae06933df865fe1c6070327e72d103a14b0039d0;hb=refs/heads/master#l4000

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-01 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 10:20 [Bug translator/28334] New: cannot handle offset into register 913495245 at qq dot com
2022-05-19 20:25 ` [Bug translator/28334] " scox at redhat dot com
2022-05-19 20:31 ` fche at redhat dot com
2022-05-19 20:50 ` scox at redhat dot com
2022-07-01 17:39 ` wcohen at redhat dot com
2022-07-01 17:44 ` wcohen at redhat dot com

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).