microsoft / DTrace-on-Windows

Code for the cross platform, single source, OpenDTrace implementation
Other
473 stars 42 forks source link

Ustack call yield enexpected result #19

Open benoitgillet opened 2 years ago

benoitgillet commented 2 years ago

Trying to use a prob with a ustack() call, i encounter the following behavior :

I would expect a stack trace with multiple lines

Following, i put the prob i use

$dtrace -s this_file -c your_program

#pragma D option quiet

BEGIN {
 printf("\n======================================================================\n");
 printf("                    Function Stack Count Statistics\n");
 printf("======================================================================\n");
}
pid$target:::entry
{
 @all_calls[stack(100)] = count();
}

END {
 printa(@all_calls);
}

syscall::NtTerminateProcess:return
/pid == $target/
{
 exit(0)
}
OlivierLi commented 1 year ago

Hello,

If anyone sees this I'd like to try and understand if we could ever expect something here.

I'm a very frequent user of DTrace on macOS and bringing my scripts that rely on ustack() over is completely impossible since 99% of the stacks end up not displaying.

Some of them do so I know that pdb downloading and loading is wired correctly which makes it all the more frustrating.

Thanks for your time.

CodeMaxx commented 1 year ago

@benoitgillet Looks like you're using stack() in that script instead of ustack()

@OlivierLi Could you give me a sample script and what possible output you see?

CodeMaxx commented 1 year ago

The issue has been recognized. I will start working on a fix soon.

OlivierLi commented 1 year ago

Great to hear! Thanks for looking into this.

For reference for now the two scripts I'm looking to adapt are here with one more to come that I haven't pushed.

https://source.chromium.org/chromium/chromium/src/+/main:tools/mac/power/dtrace_scripts/