public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug tapsets/23738] New: c++ string access tapset
@ 2018-10-04 15:47 wcohen at redhat dot com
  2018-10-15 18:31 ` [Bug tapsets/23738] " wcohen at redhat dot com
  2018-10-18 16:38 ` fche at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: wcohen at redhat dot com @ 2018-10-04 15:47 UTC (permalink / raw)
  To: systemtap

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

            Bug ID: 23738
           Summary: c++ string access tapset
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

The systemtap example script stap_time.stp needed to access C++ strings
provided inside the session variable to get the script name.

$ stap -L "stap.pass*"
stap.pass0 session:long $arg1:long
stap.pass1a session:long $arg1:long
stap.pass1b session:long $arg1:long
stap.pass2 session:long $arg1:long
stap.pass3 session:long $arg1:long
stap.pass4 session:long $arg1:long
stap.pass5 session:long $arg1:long
stap.pass6 session:long $arg1:long

Ended up with some ugly code like the following snippet to implement this:

    len = @cast(session, "struct
systemtap_session")->script_file->_M_string_length
    if (len <= 15) {
      script_file = @cast(session, "struct
systemtap_session")->script_file->_M_local_buf
    } else {
      script_file = @cast(session, "struct
systemtap_session")->script_file->_M_dataplus->_M_p
    }

There should be c++ string tapset like the existing access to traditional C
strings user_string() et al.

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

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

* [Bug tapsets/23738] c++ string access tapset
  2018-10-04 15:47 [Bug tapsets/23738] New: c++ string access tapset wcohen at redhat dot com
@ 2018-10-15 18:31 ` wcohen at redhat dot com
  2018-10-18 16:38 ` fche at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: wcohen at redhat dot com @ 2018-10-15 18:31 UTC (permalink / raw)
  To: systemtap

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

--- Comment #1 from William Cohen <wcohen at redhat dot com> ---
There are differences between f28 and rhel7, so needed something like the
following on rhel7 for the code to work.

  // Dig through C++ string private fields to find the systemtap script name
  cmdline_script = @cast(session, "struct
systemtap_session")->cmdline_script->_M_dataplus->_M_p
  if (strlen(user_string2(cmdline_script, "<unavailable>"))){
    script = "<cmdline_script>"
  } else {
    script_file = @cast(session, "struct
systemtap_session")->script_file->_M_dataplus->_M_p
    script = user_string2(script_file, "<unavailable>")
  }

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

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

* [Bug tapsets/23738] c++ string access tapset
  2018-10-04 15:47 [Bug tapsets/23738] New: c++ string access tapset wcohen at redhat dot com
  2018-10-15 18:31 ` [Bug tapsets/23738] " wcohen at redhat dot com
@ 2018-10-18 16:38 ` fche at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: fche at redhat dot com @ 2018-10-18 16:38 UTC (permalink / raw)
  To: systemtap

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com
           Assignee|systemtap at sourceware dot org    |wcohen at redhat dot com

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

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

end of thread, other threads:[~2018-10-18 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 15:47 [Bug tapsets/23738] New: c++ string access tapset wcohen at redhat dot com
2018-10-15 18:31 ` [Bug tapsets/23738] " wcohen at redhat dot com
2018-10-18 16:38 ` fche 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).