[Bug 278489] dtrace; pid probe; unable to match constructor functions
Date: Sun, 21 Apr 2024 18:03:00 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278489 --- Comment #2 from martin <martin@bxlr.sk> --- Indeed evaltime works in that scenario. The issue was originally shared on forums here: https://forums.freebsd.org/threads/tracing-shared-library-functions-using-dtrace.93172/ I tried to simplified is as much as possible before opening PR. I didn't test it with the evaltime for my simplified version. Original issue is that these constructors are not matched on custom libraries. Simple "mylib" demo lib: #include <stdio.h> #include "mylib.h" static int rc; void __attribute__((constructor)) mysetup(void) { printf("*** %s exec\n", __func__); rc = 666; } void __attribute__((destructor)) leave(void) { rc = 0; } int hello(char* s) { printf("%s: %s\n", __func__, s); return rc; } Still lists the functions as expected: # dtrace -ln 'pid$target:mylib.so::entry' -c ./test *** mysetup exec hidden stuff ID PROVIDER MODULE FUNCTION NAME 82966 pid1096 mylib.so __do_global_dtors_aux entry 82967 pid1096 mylib.so register_classes entry 82968 pid1096 mylib.so __do_global_ctors_aux entry 82969 pid1096 mylib.so mysetup entry 82970 pid1096 mylib.so leave entry 82971 pid1096 mylib.so hello entry But doesn't match it: # dtrace -n 'pid$target:mylib.so::entry' -c ./test *** mysetup exec hidden stuff dtrace: description 'pid$target:mylib.so::entry' matched 6 probes hello: my hello program return value: 666 dtrace: pid 1098 has exited CPU ID FUNCTION:NAME 7 82971 hello:entry 7 82970 leave:entry 7 82966 __do_global_dtors_aux:entry Specifying evaltime fails to match any probes: # dtrace -x evaltime=exec -n 'pid$target:mylib.so::entry' -c ./test dtrace: invalid probe specifier pid$target:mylib.so::entry: probe description pid1100:mylib.so::entry does not match any probes -- You are receiving this mail because: You are the assignee for the bug.