How to use bpftrace uprobe access C++ object field

with bpftrace set uprobe to trace c++ function, I want to see the argument’s content.

the argument is a C++ object, so how can i access its member/field in bpftrace ?

as a example:

sudo bpftrace -e 'uprobe:/home/yunxing.cyx/ob2.obs0/bin/observer:"ob:transaction::ObTransService::start_trans" { printf("trans_service start_trans : %d\n", sarg7->trans_id_); }'

You’ll need to #include the right headers or declare the struct layout. See for an example.

Since you’re tracing C++, #includeing the header probably won’t work b/c bpftrace can’t handle C++ headers yet. So you’ll most likely need to declare a struct and then cast the function argument to that type.