From: Kris Van Hees <kris.van.hees@oracle.com>
To: eugene.loh@oracle.com
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v2 5/6] test: Move disassembly and extracting PCs earlier
Date: Tue, 25 Feb 2025 16:52:04 -0500 [thread overview]
Message-ID: <Z747hBIvrPczBNcI@oracle.com> (raw)
In-Reply-To: <20241220232547.19043-2-eugene.loh@oracle.com>
On Fri, Dec 20, 2024 at 06:25:47PM -0500, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> This will allow a future patch to use the PCs earlier in the test.
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/usdt/tst.pidprobes.sh | 33 +++++++++++++++++------------
> 1 file changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/test/unittest/usdt/tst.pidprobes.sh b/test/unittest/usdt/tst.pidprobes.sh
> index 6fe6d752a..54444d49b 100755
> --- a/test/unittest/usdt/tst.pidprobes.sh
> +++ b/test/unittest/usdt/tst.pidprobes.sh
> @@ -102,6 +102,25 @@ if ! diff -q main.out main.out.expected > /dev/null; then
> exit 1
> fi
>
> +# Disassemble foo(). (simplify with --disassemble=foo)
> +
> +objdump -d main | awk '
> +BEGIN { use = 0 } # start by not printing lines
> +use == 1 && NF == 0 { exit } # if printing lines but hit a blank, then exit
> +use == 1 { print } # print lines
> +/<foo>:/ { use = 1 } # turn on printing when we hit "<foo>:" (without printing this line itself)
> +' > disasm_foo.txt
> +if [ $? -ne 0 ]; then
> + echo cannot objdump main
> + objdump -d main
> + exit 1
> +fi
> +
> +# From the disassembly, get the PCs for foo()'s instructions.
> +
> +pcs=`awk '{print strtonum("0x"$1)}' disasm_foo.txt`
> +pc0=`echo $pcs | awk '{print $1}'`
> +
> # Run dtrace.
>
> cat >> pidprobes.d <<'EOF'
> @@ -153,20 +172,6 @@ if [ `awk 'NF != 0 { print $1 }' dtrace.out | uniq | wc -l` -ne 1 ]; then
> fi
> pid=`awk 'NF != 0 { print $1 }' dtrace.out | uniq`
>
> -# Disassemble foo().
> -
> -objdump -d main | awk '
> -BEGIN { use = 0 } # start by not printing lines
> -use == 1 && NF == 0 { exit } # if printing lines but hit a blank, then exit
> -use == 1 { print } # print lines
> -/<foo>:/ { use = 1 } # turn on printing when we hit "<foo>:" (without printing this line itself)
> -' > disasm_foo.txt
> -
> -# From the disassembly, get the PCs for foo()'s instructions.
> -
> -pcs=`awk '{print strtonum("0x"$1)}' disasm_foo.txt`
> -pc0=`echo $pcs | awk '{print $1}'`
> -
> # From the disassembly, get the PCs for USDT probes.
> # Check libdtrace/dt_link.c's arch-dependent dt_modtext() to see
> # what sequence of instructions signal a USDT probe.
> --
> 2.43.5
>
prev parent reply other threads:[~2025-02-25 21:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-20 23:25 [PATCH v2 3/6] Simplify references to dtp eugene.loh
2024-12-20 23:25 ` [PATCH v2 5/6] test: Move disassembly and extracting PCs earlier eugene.loh
2025-02-25 21:52 ` Kris Van Hees [this message]
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=Z747hBIvrPczBNcI@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=eugene.loh@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.