From: "Bryn M. Reeves" <breeves@redhat.com>
To: Yeshpal Jain <jainyeshpal@gmail.com>
Cc: systemtap@sourceware.org
Subject: Re: Run system tap with a user defined function
Date: Mon, 8 Aug 2022 10:30:27 +0100 [thread overview]
Message-ID: <YvDXs3yywR8jkZkC@redhat.com> (raw)
In-Reply-To: <CAH67PmMAQjodRctsCo+V1t83oyNnmJ+AgqpeWsoRVS8DCszSwA@mail.gmail.com>
On Sun, Aug 07, 2022 at 09:39:23PM +0530, Yeshpal Jain via Systemtap wrote:
> 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.
Just put the include directives inside %{..%} at file level, e.g.:
%{
#include <myheader.h>
%}
... rest of script
Regards,
Bryn.
next prev parent reply other threads:[~2022-08-08 9:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-07 16:09 Yeshpal Jain
2022-08-08 9:30 ` Bryn M. Reeves [this message]
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=YvDXs3yywR8jkZkC@redhat.com \
--to=breeves@redhat.com \
--cc=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).