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]

New @var language construct


Hi,

To fix PR13784 - Cannot find a defining variable location in different CU
I introduced a new language construct @var("varname[@src/file]") with
which you can select such a variable from a DWARF based probe handler.

Attached you will find the documentation for this new language construct
(we have way too many places to document new stuf...). Hopefully that is
precise enough to be helpful. If not, please yell and scream. Also please
review the implementation to see if it makes sense and matches what you
would expect. See below for the relevant commits.

Now that we do have @var we can use it to solve some other bugs/enhancement
requests. In particular PR11096 - Getting global module vars in functions
could be implemented by adding an extra argument to @var that describes
the module. So you can access DWARF target variables from any probe
context (including functions) as long as you explicitly describe CU and
module. And since @var takes the target variable name as string we can
allow "natural" C++ variable descriptions instead of names. This is
PR11008 - Support c++ namespace like syntax $foo::bar. I am not currently
planning to work on either of these, so please jump in if you want.

Cheers,

Mark

commit 179a00c3efb5ceac52a70debb17a91ee0c07722d
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon Mar 12 13:00:40 2012 +0100

    Document new @var construct in NEWS, langref, beginners and stapprobes.

commit acf4b3b10e9d70cbf8a0a681ae3c17c9681bdfbe
Author: Mark Wielaard <mjw@redhat.com>
Date:   Sat Mar 10 19:15:35 2012 +0100

    global_var_kernel.exp: tz_minuteswest can be negative.

commit 3965e105b73e196ec4f9b15c0b192c59bb14a2f8
Author: Mark Wielaard <mjw@redhat.com>
Date:   Fri Mar 9 15:57:31 2012 +0100

    Global vars don't need (cannot use) frame base in location descriptor.
    
    And so they also don't need cfa_ops (CFI) to calculate the frame base.

commit 3d9381fc814162b914288d45ff52017bf0a83fb4
Author: Mark Wielaard <mjw@redhat.com>
Date:   Fri Mar 9 15:19:12 2012 +0100

    Update verbose log and semantic exception messages for local vs global vars.
    
    Global @vars (with @cu/src_name.c) have a fixed scope/CU and don't depend
    on location/PC. Make that clean in verbose log and semantic error messages.

commit 8fa5f2719e4ec115486e69364e110a5048c7dfd7
Author: Mark Wielaard <mjw@redhat.com>
Date:   Fri Mar 9 00:10:52 2012 +0100

    Cannot use @var DWARF variables in tracepoints, warn, but don't crash.

commit 49131a6df3a031f0011256cfa33130afc63c001c
Author: Mark Wielaard <mjw@redhat.com>
Date:   Thu Mar 8 23:32:49 2012 +0100

    Make sure @var works for process.mark probes.

commit 54e9f0623713e7f32c9870baad5a5d5c06c2fd22
Author: Mark Wielaard <mjw@redhat.com>
Date:   Thu Mar 8 15:20:08 2012 +0100

    Select most specific CU srcfile that matches @var("var@src") specification.
    
    dwarf_var_expanding_visitor::getcuscope: If there is a perfect match
    select that CU, otherwise, select the CU srcfile that is most specific
    (matching path/src file lenght is shortest).

commit bfa7e523ab8cd891a2a3f24c1540021665947b5d
Author: Mark Wielaard <mjw@redhat.com>
Date:   Wed Mar 7 19:58:12 2012 +0100

    PR13784 Allow defining a diffent CU source in @var.
    
    Add cu_name to struct target_symbol. Set it in parse_target_symbol
    to the string after @ in @var("somevar@some/src/file.c"). Make
    target_symbol::sym_name() aware of @cu_name postfix (don't return it).
    Add dwarf_var_expanding_visitor::getcuscope() which figures out the
    CU DIE to use as scope if target_symbol has cu_name part. Extend
    global_var.exp test to show new capability.

commit cc9001af0a5fa811ddf0e44439c7cddf465db945
Author: Mark Wielaard <mjw@redhat.com>
Date:   Tue Mar 6 17:34:36 2012 +0100

    Introduce @var("varname") as alternative syntax for $varname.
    
    Adds a field target_name and a method sym_name() to struct target_symbol
    to be used by the parser and tapsets translator so $name and @var("name")
    can be used interchanably. Adds a testcase at_var.exp to test this for
    various combinations of uprobes, kprobes, parameters, variables, arrays,
    fields access, pretty printing and taking addresses.

Attachment: at_var_docs.patch
Description: Text document


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