microsoft / DTrace-on-Windows

Code for the cross platform, single source, OpenDTrace implementation
Other
485 stars 43 forks source link

sizeof() on locals crashes dtrace #22

Closed taviso closed 1 year ago

taviso commented 2 years ago

Trying to take the sizeof() an automatic variable crashes dtrace.

Reproduce: dtrace -n 'BEGIN { a = sizeof(a); }'

$ cdb -c 'g;k;q' dtrace -n 'BEGIN { a = sizeof(a); }'
Microsoft (R) Windows Debugger Version 10.0.18362.1 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: dtrace -n "BEGIN { a = sizeof(a); }"

************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*c:\symbols*https://msdl.microsoft.com/download/sy
mbols
Symbol search path is: srv*c:\symbols*https://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00007ff6`baf20000 00007ff6`baf2e000   dtrace.exe
ModLoad: 00007ffd`528d0000 00007ffd`52ac5000   ntdll.dll
ModLoad: 00007ffd`50fe0000 00007ffd`5109e000   C:\WINDOWS\System32\KERNEL32.DLL
ModLoad: 00007ffd`50170000 00007ffd`50438000   C:\WINDOWS\System32\KERNELBASE.dll
ModLoad: 00007ffd`50070000 00007ffd`50170000   C:\WINDOWS\System32\ucrtbase.dll
ModLoad: 00007ffd`15550000 00007ffd`15633000   C:\Program Files\DTrace\dtrace.dll
ModLoad: 00007ffd`51590000 00007ffd`516ba000   C:\WINDOWS\System32\RPCRT4.dll
ModLoad: 00007ffc`f1960000 00007ffc`f1b45000   C:\Program Files\DTrace\dbghelp.dll
(192c.3a1c): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00007ffd`529a06b0 cc              int     3
0:000> cdb: Reading initial command 'g;k;q'
ModLoad: 00007ffd`4ffe0000 00007ffd`50062000   C:\WINDOWS\System32\bcryptPrimitives.dll
(192c.3a1c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
Child-SP          RetAddr           Call Site
000000f5`9431f228 00007ffd`1559403a dtrace!ctf_lookup_by_id+0x9
000000f5`9431f230 00007ffd`1557dd53 dtrace!ctf_type_resolve+0x62
000000f5`9431f270 00007ffd`1557ff7c dtrace!dt_cook_op2+0x993
000000f5`9431f460 00007ffd`1557ef02 dtrace!dt_node_cook+0x30
000000f5`9431f490 00007ffd`1557ff7c dtrace!dt_cook_statement+0x12
000000f5`9431f4d0 00007ffd`1557fff0 dtrace!dt_node_cook+0x30
000000f5`9431f500 00007ffd`1557f26c dtrace!dt_node_list_cook+0x44
000000f5`9431f550 00007ffd`1557ff7c dtrace!dt_cook_clause+0x21c
000000f5`9431f740 00007ffd`15575c3e dtrace!dt_node_cook+0x30
000000f5`9431f770 00007ffd`155775f1 dtrace!dt_compile_one_clause+0x42
000000f5`9431f7c0 00007ffd`15577723 dtrace!dt_compile+0x82d
000000f5`9431fb20 00007ff6`baf22081 dtrace!dtrace_program_strcompile+0x43
000000f5`9431fb80 00007ff6`baf23cf5 dtrace_exe!com
CodeMaxx commented 1 year ago

I am no longer able to reproduce this error. This is the output I get:

PS C:\Users\Akash> dtrace -n "BEGIN { a = sizeof(a); }"
dtrace: invalid probe specifier BEGIN { a = sizeof(a); }: in action list: operator = may not be applied to operand of type "<none>"

Let me know if you still face this issue with the latest DTrace. Closing for now.