The following dtrace
invocation used to work on MacOS 11.6.2 but after upgrading to MacOS 12.2.1 it stopped working
sudo --non-interactive dtrace -l -b 16m -x mangled -x disallow_dsym -x strip -x evaltime=preinit -x preallocate=256m -n 'oneshot$target:a.out::entry { hdr_vm_addr = ((thread_t)curthread)->task->mach_header_vm_address; }' -w -p 4557
dtrace: invalid probe specifier oneshot$target:a.out::entry { hdr_vm_addr = ((thread_t)curthread)->task->mach_header_vm_address; }: in action list: task is not a member of struct thread
How do I get task
from thread_t
now?
CodePudding user response:
It looks like it may be t_task
. Here's how you can view the type of a built-in variable such as curthread
:
$ sudo dtrace -n 'BEGIN { print(*curthread); exit(0); }'
dtrace: description 'BEGIN ' matched 1 probe
CPU ID FUNCTION:NAME
4 1 :BEGIN struct thread {
union {
queue_chain_t runq_links = {
struct queue_entry *next = 0
struct queue_entry *prev = 0
}
...
struct task *t_task = 0xffffff8bd07859f0
...
}