This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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]

[Bug translator/12135] New: field search is wrong when inheritance masks names


http://sourceware.org/bugzilla/show_bug.cgi?id=12135

           Summary: field search is wrong when inheritance masks names
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sources.redhat.com
        ReportedBy: jistone@redhat.com


When a class/struct has a field with the same name as a field in its inherited
types, stap picks the wrong field to display.

$ cat inherit.cxx 
#include <sys/sdt.h>
struct A {
    struct { int x, y; } foo;
};
struct B : A {
    int foo;
};
int main()
{
    B b;
    STAP_PROBE1(test, inherit, &b);
    return 0;
}

$ stap -ve 'probe process("./inherit").mark("inherit") { println($b->foo) }'
-p2
Pass 1: parsed user script and 72 library script(s) using
94208virt/21740res/2512shr kb, in 140usr/20sys/158real ms.
semantic error: 'struct {...}' is being accessed instead of a member:
identifier '$b' at <input>:1:54
        source: probe process("./inherit").mark("inherit") { println($b->foo) }
                                                                     ^
Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s)
using 96716virt/22864res/2996shr kb, in 10usr/0sys/6real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.


It fails because we can't read A::foo as a scalar, when we ought to be
accessing B::foo instead.  I believe this happens because
dwflpp::find_struct_member is traversing depth-first with respect to
inheritance, whereas breadth-first should do the right thing.

We also need to account for this in dwarf_pretty_print::recurse_struct_members.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


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