* [PATCH] utils: add args output to showUSDT.c
@ 2024-11-01 15:22 Kris Van Hees
2024-11-01 15:27 ` [DTrace-devel] " Nick Alcock
0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2024-11-01 15:22 UTC (permalink / raw)
To: dtrace, dtrace-devel
The showUSDT utility now reports argument type (native and translated)
and mapping data for probes.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
---
test/utils/showUSDT.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/test/utils/showUSDT.c b/test/utils/showUSDT.c
index f42aaa21..a1116bbf 100644
--- a/test/utils/showUSDT.c
+++ b/test/utils/showUSDT.c
@@ -104,15 +104,32 @@ static void processECB(dof_hdr_t *dof, int size) {
static void processProbe(int id, dof_probe_t *probe, const char *name,
const char *strtab, unsigned int *offtab,
- unsigned int *enotab, unsigned char *argtab) {
+ unsigned int *enotab, const unsigned char *argtab) {
int i;
+ const char *str;
unsigned int *offs;
+ const unsigned char *map;
printf(" Probe %d: %s:%s:%s:%s\n",
id, name, "",
strtab + probe->dofpr_func, strtab + probe->dofpr_name);
printf(" argc %d noffs %d nenoffs %d\n",
- probe->dofpr_nargc, probe->dofpr_noffs, probe->dofpr_nenoffs);
+ probe->dofpr_xargc, probe->dofpr_noffs, probe->dofpr_nenoffs);
+
+ str = strtab + probe->dofpr_nargv;
+ for (i = 0; i < probe->dofpr_nargc; i++) {
+ printf(" (native) argv[%d]: %s\n",
+ i, str);
+ str += strlen(str) + 1;
+ }
+
+ str = strtab + probe->dofpr_xargv;
+ map = argtab + probe->dofpr_argidx;
+ for (i = 0; i < probe->dofpr_xargc; i++) {
+ printf(" (translated) argv[%d] (from native argv[%hhd]): %s\n",
+ i, map[i], str);
+ str += strlen(str) + 1;
+ }
offs = &offtab[probe->dofpr_offidx];
for (i = 0; i < probe->dofpr_noffs; i++)
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [DTrace-devel] [PATCH] utils: add args output to showUSDT.c
2024-11-01 15:22 [PATCH] utils: add args output to showUSDT.c Kris Van Hees
@ 2024-11-01 15:27 ` Nick Alcock
0 siblings, 0 replies; 2+ messages in thread
From: Nick Alcock @ 2024-11-01 15:27 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 1 Nov 2024, Kris Van Hees via DTrace-devel verbalised:
> The showUSDT utility now reports argument type (native and translated)
> and mapping data for probes.
>
> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Nice! Dropped my corresponding one.
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
One caveat:
> printf(" Probe %d: %s:%s:%s:%s\n",
> id, name, "",
> strtab + probe->dofpr_func, strtab + probe->dofpr_name);
> printf(" argc %d noffs %d nenoffs %d\n",
> - probe->dofpr_nargc, probe->dofpr_noffs, probe->dofpr_nenoffs);
> + probe->dofpr_xargc, probe->dofpr_noffs, probe->dofpr_nenoffs);
I think you shuld still print dofpr_nargc here too, because if it's
wrong we don't want the loop beyond to overrun and crash without any
previous indication of why :)
--
NULL && (void)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-01 15:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01 15:22 [PATCH] utils: add args output to showUSDT.c Kris Van Hees
2024-11-01 15:27 ` [DTrace-devel] " Nick Alcock
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox