public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Yeshpal Jain <jainyeshpal@gmail.com>
To: systemtap@sourceware.org
Subject: Run system tap with a user defined function
Date: Sun, 7 Aug 2022 21:39:23 +0530	[thread overview]
Message-ID: <CAH67PmMAQjodRctsCo+V1t83oyNnmJ+AgqpeWsoRVS8DCszSwA@mail.gmail.com> (raw)

I want to run a user defined function inside one of the function probes.
for ex :
#! /usr/bin/env stap


function __read_phase:long(phase:long) %{ /* pure */
        struct phase *phase_s = (struct phase *)((long)STAP_ARG_phase);
        int phase_st = phase->p_state;
        STAP_RETURN(phase_st);
%} /* <-- function body */

function trace_phase(entry_p, extra) {
  %( $# > 1 %? if (tid() in trace) %)
                  printf("%s%s%s %s phase = %d\n",
                                  thread_indent (entry_p),
                                  (entry_p>0?"->":"<-"),
                                  ppfunc (),
                                  extra, __read_phase($fom))

}

probe process("/root/test/.libs/mylib.so").function("*_test_func").call   {
trace_phase(1, $$parms) }

i am running stap with -g option,
when i compile i am getting error,
error: dereferencing pointer to incomplete type ‘struct phase’
struct phase is a structure defined in mylibrary,
Is there a way to include custom directory/headers while generating system
tap.

-- 
Thanks and Regards,
Yeshpal Jain.

             reply	other threads:[~2022-08-07 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 16:09 Yeshpal Jain [this message]
2022-08-08  9:30 ` Bryn M. Reeves
2022-08-09  5:17   ` Yeshpal Jain
2022-08-12  7:16     ` Yeshpal Jain
2022-08-16 17:53 ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH67PmMAQjodRctsCo+V1t83oyNnmJ+AgqpeWsoRVS8DCszSwA@mail.gmail.com \
    --to=jainyeshpal@gmail.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).