From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 7E02C3858D39 for ; Fri, 12 Aug 2022 07:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7E02C3858D39 Received: by mail-pl1-x62e.google.com with SMTP id x23so44891pll.7 for ; Fri, 12 Aug 2022 00:17:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=qoNcZzIxrID23wl6qLLcbdzzGSOOZLiG5tqsZZC0rxo=; b=zJjEN5NqJ87foP22vIh1PDZSalk5eUnAJyKqd0jXQ1+jcwEnSy3wZHf8XWDKp1dctv KMlJNqGVfHdFi7D7Ivbxr3qfmRTuFB1BqFV3Rbil+REKIcrxk1guhurW7WUVmZdDWswU KmTPcL41jwFNEpEk/5WraLBRiRDYR/obJ91gIgMVh97BmN6f3PbThcVDfLNNBftmq/iN Tft3LVid35R6sKNZvbN0QOsfhmmo79lQjbdkRTexZaJXWGhC+kfUt3Rt6A7/lUHY32cu qTAl4kquOPD8+uyXjXGxgv94bl1k81TQIz67r+ykNA2hgrb24UqHQMsO62mCVSGSUjEI ezGg== X-Gm-Message-State: ACgBeo0ryCez6RJBh2Ph6pcMW7nuDyJvVNfarJO3j+S8iJWe+vj6fj0K c2eHFOE0dvuGIlDiBGl878sGVboKfenSNsymGqE= X-Google-Smtp-Source: AA6agR4iCoeFKufzWq5d33PHkHL/KkvG7ejqJbiPmvgcVnv/qkhr/YgLiVsEkbG5Qbn+F+vRmePwYdlOoBCDGBQLkns= X-Received: by 2002:a17:902:da81:b0:16e:fdf4:ea79 with SMTP id j1-20020a170902da8100b0016efdf4ea79mr2784868plx.166.1660288625459; Fri, 12 Aug 2022 00:17:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yeshpal Jain Date: Fri, 12 Aug 2022 12:46:54 +0530 Message-ID: Subject: Re: Run system tap with a user defined function To: "Bryn M. Reeves" Cc: systemtap@sourceware.org X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Fri, 12 Aug 2022 07:17:09 -0000 I mean,is there a way i can include my project header path while running stap to avoid compilation error related to header inclusion. Regards, Yeshpal. On Tue, Aug 9, 2022 at 10:47 AM Yeshpal Jain wrote: > Thanks for your reply, > Is there a way i can add my header path in stap common so that it looks i= n > my header path, when i try to add a header it is erroring out because oth= er > files in myheader.h are not accessible, if somehow i can include the head= er > path in compilation command then that should resolve this problem. > Below is the command which stap will execute. > > gcc -Wp,-MD,/tmp/stap0qTelA/.stap_symbols.o.d -nostdinc -isystem > /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include > -I./arch/x86/include/generated -I./include/drm-backport -I./include > -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi > -I./include/uapi -I./include/generated/uapi -include > ./include/linux/kconfig.h -include ./include/linux/compiler_types.h > -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs > -fno-strict-aliasing -fno-common -fshort-wchar > -Werror-implicit-function-declaration -Wno-format-security -std=3Dgnu89 > -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-a= vx > -m64 -falign-jumps=3D1 -falign-loops=3D1 -mno-80387 -mno-fp-ret-in-387 > -mpreferred-stack-boundary=3D3 -mskip-rax-setup -mtune=3Dgeneric -mno-red= -zone > -mcmodel=3Dkernel -funit-at-a-time -DCONFIG_AS_CFI=3D1 > -DCONFIG_AS_CFI_SIGNAL_FRAME=3D1 -DCONFIG_AS_CFI_SECTIONS=3D1 > -DCONFIG_AS_FXSAVEQ=3D1 -DCONFIG_AS_SSSE3=3D1 -DCONFIG_AS_CRC32=3D1 > -DCONFIG_AS_AVX=3D1 -DCONFIG_AS_AVX2=3D1 -DCONFIG_AS_AVX512=3D1 > -DCONFIG_AS_SHA1_NI=3D1 -DCONFIG_AS_SHA256_NI=3D1 -DCONFIG_TPAUSE=3D1 -pi= pe > -Wno-sign-compare -fno-asynchronous-unwind-tables > -mindirect-branch=3Dthunk-extern -mindirect-branch-register -fno-jump-tab= les > -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation > -Wno-format-overflow -Wno-int-in-bool-context -O2 > --param=3Dallow-store-data-races=3D0 -Wframe-larger-than=3D2048 > -fstack-protector-strong -Wno-unused-but-set-variable > -Wno-unused-const-variable -gdwarf-4 -pg -mrecord-mcount -mfentry > -DCC_USING_FENTRY -fno-inline-functions-called-once > -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation > -fno-strict-overflow -fno-merge-all-constants -fmerge-constants > -fno-stack-check -fconserve-stack -Werror=3Dimplicit-int > -Werror=3Dstrict-prototypes -Werror=3Ddate-time > -Werror=3Dincompatible-pointer-types -Werror=3Ddesignated-init > -fmacro-prefix-map=3D./=3D -Wno-packed-not-aligned -Iinclude2/asm/mach-de= fault > -I/lib/modules/4.18.0-305.3.1.el8_4.x86_64/build -include > /tmp/stap0qTelA/stapconf_ee8a8c12ef5d50607466e03c8831c981_784.h > -freorder-blocks -fasynchronous-unwind-tables -fno-ipa-icf -Wno-unused > -Werror -Wno-pragmas -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast > -I/usr/share/systemtap/runtime -DMODULE > -DKBUILD_BASENAME=3D'"stap_symbols"' -DKBUILD_MODNAME=3D'"stap_3268232"'= -c -o > /tmp/stap0qTelA/stap_symbols.o /tmp/stap0qTelA/stap_symbols.c > > Regards, > Yeshpal. > > On Mon, Aug 8, 2022 at 3:00 PM Bryn M. Reeves wrote: > >> 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 probe= s. >> > for ex : >> > #! /usr/bin/env stap >> > >> > >> > function __read_phase:long(phase:long) %{ /* pure */ >> > struct phase *phase_s =3D (struct phase *)((long)STAP_ARG_phas= e); >> > int phase_st =3D 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 =3D %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 =E2=80=98struct phase= =E2=80=99 >> > 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. >> >> > > -- > Thanks and Regards, > Yeshpal Jain. > --=20 Thanks and Regards, Yeshpal Jain.