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]

How to access userspace c++ strings in systemtap script


Hi,

I would like to get a clearer picture about which sysetmtap scripts
take a long time to process.  The goal is to provide a little stacked
bar of the phases for each scripts that is run.  I would like to use
the the systemtap stap.pass* probe points to give that information.
Each of these stap.pass** probe points provide the session argument which should
provides a pointer to the internal information including the script_file.

The question is how to access c++ string script_file in struct systemtap_session.
The following snippet of code doesn't work:

  script_file = @cast(session, "struct systemtap_session")->script_file
  script = user_string2(script_file, "<unavailable>")

Ends up with giving the following error:

semantic error: while processing probe process("/usr/bin/stap").statement(0x7814e) from: process("/usr/bin/stap").mark("pass4__end") from: stap.pass4.end from: stap.pass4.end

semantic error: 'class basic_string<char, std::char_traits<char>, std::allocator<char> >' (/usr/include/c++/8/bits/basic_string.h:77) is being accessed instead of a member such as '->_M_allocated_capacity': operator '->' at ./stap_time.stp:24:59
        source:   script_file = @cast(session, "struct systemtap_session")->script_file
                                                                          ^

Pass 2: analysis failed.  [man error::pass2]


Attached is the WIP script.

-Will

Attachment: stap_time.stp
Description: Text document


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