public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Run system tap with a user defined function
@ 2022-08-07 16:09 Yeshpal Jain
  2022-08-08  9:30 ` Bryn M. Reeves
  2022-08-16 17:53 ` Frank Ch. Eigler
  0 siblings, 2 replies; 5+ messages in thread
From: Yeshpal Jain @ 2022-08-07 16:09 UTC (permalink / raw)
  To: systemtap

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.

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

end of thread, other threads:[~2022-08-16 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 16:09 Run system tap with a user defined function Yeshpal Jain
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

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).