* [PATCH v2 3/6] Simplify references to dtp
@ 2024-12-20 23:25 eugene.loh
2024-12-20 23:25 ` [PATCH v2 5/6] test: Move disassembly and extracting PCs earlier eugene.loh
0 siblings, 1 reply; 3+ messages in thread
From: eugene.loh @ 2024-12-20 23:25 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
libdtrace/dt_pid.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 940cce38e..a8a5050d0 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -231,7 +231,7 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
psp->pps_nameoff = off;
psp->pps_off = symp->st_value - pp->dpp_vaddr + off;
- if (dt_pid_create_one_probe(pp->dpp_pr, pp->dpp_dtp,
+ if (dt_pid_create_one_probe(pp->dpp_pr, dtp,
psp, symp, DTPPT_OFFSETS) < 0) {
rc = dt_pid_error(
dtp, pcb, dpr, D_PROC_CREATEFAIL,
@@ -362,7 +362,7 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
psp->pps_nameoff = off;
psp->pps_off = symp->st_value - pp->dpp_vaddr + off;
- if (dt_pid_create_one_probe(pp->dpp_pr, pp->dpp_dtp,
+ if (dt_pid_create_one_probe(pp->dpp_pr, dtp,
psp, symp, DTPPT_OFFSETS) >= 0)
nmatches++;
}
@@ -434,7 +434,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
if (obj == NULL)
return 0;
- dt_Plmid(pp->dpp_dtp, pid, pmp->pr_vaddr, &pp->dpp_lmid);
+ dt_Plmid(dtp, pid, pmp->pr_vaddr, &pp->dpp_lmid);
pp->dpp_dev = pmp->pr_dev;
pp->dpp_inum = pmp->pr_inum;
@@ -466,7 +466,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
* just fail silently in the hopes that some other object will
* contain the desired symbol.
*/
- if (dt_Pxlookup_by_name(pp->dpp_dtp, pid, pp->dpp_lmid, obj,
+ if (dt_Pxlookup_by_name(dtp, pid, pp->dpp_lmid, obj,
pp->dpp_func, &sym, NULL) != 0) {
if (strcmp("-", pp->dpp_func) == 0) {
sym.st_name = 0;
@@ -496,17 +496,17 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
* dynamically rewritten, and, so, inherently dicey to
* instrument.
*/
- if (dt_Pwritable_mapping(pp->dpp_dtp, pid, sym.st_value))
+ if (dt_Pwritable_mapping(dtp, pid, sym.st_value))
return 0;
- dt_Plookup_by_addr(pp->dpp_dtp, pid, sym.st_value,
+ dt_Plookup_by_addr(dtp, pid, sym.st_value,
&pp->dpp_func, &sym);
return dt_pid_per_sym(pp, &sym, pp->dpp_func);
} else {
uint_t nmatches = pp->dpp_nmatches;
- if (dt_Psymbol_iter_by_addr(pp->dpp_dtp, pid, obj, PR_SYMTAB,
+ if (dt_Psymbol_iter_by_addr(dtp, pid, obj, PR_SYMTAB,
BIND_ANY | TYPE_FUNC,
dt_pid_sym_filt, pp) == 1)
return 1;
@@ -516,8 +516,7 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
* If we didn't match anything in the PR_SYMTAB, try
* the PR_DYNSYM.
*/
- if (dt_Psymbol_iter_by_addr(
- pp->dpp_dtp, pid, obj,
+ if (dt_Psymbol_iter_by_addr(dtp, pid, obj,
PR_DYNSYM, BIND_ANY | TYPE_FUNC,
dt_pid_sym_filt, pp) == 1)
return 1;
--
2.43.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 5/6] test: Move disassembly and extracting PCs earlier
2024-12-20 23:25 [PATCH v2 3/6] Simplify references to dtp eugene.loh
@ 2024-12-20 23:25 ` eugene.loh
2025-02-25 21:52 ` Kris Van Hees
0 siblings, 1 reply; 3+ messages in thread
From: eugene.loh @ 2024-12-20 23:25 UTC (permalink / raw)
To: dtrace, dtrace-devel
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 5/6] test: Move disassembly and extracting PCs earlier
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
0 siblings, 0 replies; 3+ messages in thread
From: Kris Van Hees @ 2025-02-25 21:52 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-25 21:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox