From: Kris Van Hees <kris.van.hees@oracle.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH v4 5/5] selftests/usdt: add test covering different forms of stapsdt note args
Date: Tue, 1 Jul 2025 12:42:02 -0400 [thread overview]
Message-ID: <aGQP2lajd+kAjj5s@oracle.com> (raw)
In-Reply-To: <20250623101310.1649756-6-alan.maguire@oracle.com>
This test does not pass on Debian, or any other system that compiles with
PIE enbaled by default as far as I can see because it fails to resolve the
function name (even though it is in the symbol table since that is not
stripped). So there must be something wrong with the logic of the
implementing patch to get the function name from the address information.
On Mon, Jun 23, 2025 at 11:13:10AM +0100, Alan Maguire wrote:
> Add a test exercising various arg types supported by stapsdt notes;
> register values, register + offset and constants. The test generates
> a binary with probes represented as follows on x86_64:
>
> Displaying notes found in: .note.stapsdt
> Owner Data size Description
> stapsdt 0x00000048 NT_STAPSDT (SystemTap probe descriptors)
> Provider: test_prov
> Name: args
> Location: 0x0000000000400557, Base: 0x00000000004005f8, Semaphore: 0x0000000000000000
> Arguments: -4@-4(%rbp) 8@%rax 8@%rdx -4@$18
>
> Verify we get expected data for the probe arguments.
>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> test/unittest/usdt/tst.stapsdt-notes-args.r | 2 +
> test/unittest/usdt/tst.stapsdt-notes-args.sh | 50 ++++++++++++++++++++
> 2 files changed, 52 insertions(+)
> create mode 100644 test/unittest/usdt/tst.stapsdt-notes-args.r
> create mode 100755 test/unittest/usdt/tst.stapsdt-notes-args.sh
>
> diff --git a/test/unittest/usdt/tst.stapsdt-notes-args.r b/test/unittest/usdt/tst.stapsdt-notes-args.r
> new file mode 100644
> index 00000000..42bca19f
> --- /dev/null
> +++ b/test/unittest/usdt/tst.stapsdt-notes-args.r
> @@ -0,0 +1,2 @@
> +test:main:args:2:./test:val:18
> +
> diff --git a/test/unittest/usdt/tst.stapsdt-notes-args.sh b/test/unittest/usdt/tst.stapsdt-notes-args.sh
> new file mode 100755
> index 00000000..82097808
> --- /dev/null
> +++ b/test/unittest/usdt/tst.stapsdt-notes-args.sh
> @@ -0,0 +1,50 @@
> +#!/bin/bash
> +#
> +# Oracle Linux DTrace.
> +# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
> +# Licensed under the Universal Permissive License v 1.0 as shown at
> +# http://oss.oracle.com/licenses/upl.
> +
> +# This test covers stapsdt probes fired by the STAP_PROBEn macros,
> +# testing various argument forms (constant, register, deref etc).
> +
> +if [ $# != 1 ]; then
> + echo expected one argument: '<'dtrace-path'>'
> + exit 2
> +fi
> +
> +dtrace=$1
> +CC=/usr/bin/gcc
> +CFLAGS="-I${PWD}/test/unittest/usdt"
> +
> +DIRNAME="$tmpdir/usdt-notes.$$.$RANDOM"
> +mkdir -p $DIRNAME
> +cd $DIRNAME
> +
> +cat > test.c <<EOF
> +#include <sdt_notes.h>
> +
> +int
> +main(int argc, char **argv)
> +{
> + STAP_PROBE4(test_prov, args, argc, argv[0], argv[1] + 4, 18);
> +}
> +EOF
> +
> +${CC} ${CFLAGS} -o test test.c
> +if [ $? -ne 0 ]; then
> + echo "failed to compile test.c" >& 2
> + exit 1
> +fi
> +
> +$dtrace -c './test arg1val' -qs /dev/stdin <<EOF
> +test_prov\$target:::args
> +{
> + printf("%s:%s:%s:%li:%s:%s:%li\n", probemod, probefunc, probename,
> + arg0, copyinstr(arg1), copyinstr(arg2), arg3);
> +}
> +
> +EOF
> +status=$?
> +
> +exit $status
> --
> 2.43.5
>
prev parent reply other threads:[~2025-07-01 16:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 10:13 [PATCH v4 0/5] add support for stapsdt probes Alan Maguire
2025-06-23 10:13 ` [PATCH v4 1/5] usdt: have copy_args() count args while parsing them Alan Maguire
2025-06-23 10:13 ` [PATCH v4 2/5] support stapsdt ELF-note-defined static probes Alan Maguire
2025-07-01 19:42 ` Kris Van Hees
2025-06-23 10:13 ` [PATCH v4 3/5] selftests/usdt: add test for stapsdt note-defined probe firing, args Alan Maguire
2025-06-23 10:13 ` [PATCH v4 4/5] selftests/usdt: add test for stapsdt notes in shared library Alan Maguire
2025-06-23 10:13 ` [PATCH v4 5/5] selftests/usdt: add test covering different forms of stapsdt note args Alan Maguire
2025-07-01 16:42 ` 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=aGQP2lajd+kAjj5s@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=alan.maguire@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/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