From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id B3010385735F for ; Mon, 8 Aug 2022 09:30:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B3010385735F Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-452-zp0S8e1RNrypsNpv_JnkcA-1; Mon, 08 Aug 2022 05:30:31 -0400 X-MC-Unique: zp0S8e1RNrypsNpv_JnkcA-1 Received: by mail-wm1-f70.google.com with SMTP id c189-20020a1c35c6000000b003a4bfb16d86so4531750wma.3 for ; Mon, 08 Aug 2022 02:30:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=k46sMkOncUcCcbJrHMS5GmKGPa+9YavZ+xk+VwTlaNQ=; b=uM2vgd4ZBnrT7VIF1F6BWmkFzjzETjDP6V8nxoVm9W7Bjx5iAroXvmIQh+RO0eKpBd ANZYlUBgobnnwdvcdO8Er7RPtCCovHy3DvEZKTstdsxgNjDiqwMXmVTLz3aKwLSDkprt z1erNUnbnPLmpb5nG1swhqeIVoWw+a2IGaeGJpwTA3jhAQnaz4OXZJ2uutMrR6ZixET8 eJ22nD7UgPpySzj3mwtPvEwFu5TQk6fYqykBIwNA4Ep0DOEawYkx1eGusQF7unD9ito1 YSWxdZp06Ly8UfU7af/nlsYa8iugqgNwk7JH79JLPh3RHZ33r2jyMfk7ypjIHQ3K1oRB uMOw== X-Gm-Message-State: ACgBeo0oYEr6dYbLL0G1WmSJXUZ2x+ax6zS8XY61VbFQ7JOmxrNTZyuW m9imlM5m9zGUcBa8Zxf6D3s27A++YVe6b47MBtdJPEu72Uvr7QybfwO0hu9K2KnktI7TQSfJPnM Jff/fihU3BBbzsLEzOqc= X-Received: by 2002:a05:6000:1011:b0:220:5a7d:9cd6 with SMTP id a17-20020a056000101100b002205a7d9cd6mr10184202wrx.504.1659951029604; Mon, 08 Aug 2022 02:30:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jMW4Ns9JJtFcc+I71kKqCaF4H/5d3cTnaV7Mqmmg/XuLnenVv/syX7kxCZdnie2oohxoswg== X-Received: by 2002:a05:6000:1011:b0:220:5a7d:9cd6 with SMTP id a17-20020a056000101100b002205a7d9cd6mr10184196wrx.504.1659951029422; Mon, 08 Aug 2022 02:30:29 -0700 (PDT) Received: from redhat.com (128.19.187.81.in-addr.arpa. [81.187.19.128]) by smtp.gmail.com with ESMTPSA id n66-20020a1ca445000000b003a513ee7830sm15438417wme.27.2022.08.08.02.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 02:30:28 -0700 (PDT) Date: Mon, 8 Aug 2022 10:30:27 +0100 From: "Bryn M. Reeves" To: Yeshpal Jain Cc: systemtap@sourceware.org Subject: Re: Run system tap with a user defined function Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: systemtap@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Systemtap mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Aug 2022 09:30:34 -0000 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 %} ... rest of script Regards, Bryn.