You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
On Android adeb env, if use bpftrace trace uprobe pthread_create, the path should be uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create,
not uprobe:/system/lib/bootstrap/libc.so:pthread_create, uprobe:/system/lib64/bootstrap/libc.so:pthread_create.
Is that right?
All these paths could list the function path:
root@localhost:/# bpftrace -l 'uprobe:/system/lib/bootstrap/libc.so:pthread*'
uprobe:/system/lib/bootstrap/libc.so:pthread_setspecific
uprobe:/system/lib/bootstrap/libc.so:pthread_barrierattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_exit
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_gettype
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_getscope
uprobe:/system/lib/bootstrap/libc.so:pthread_cond_timedwait_monotonic_np
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setguardsize
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setschedpolicy
uprobe:/system/lib/bootstrap/libc.so:pthread_getschedparam
uprobe:/system/lib/bootstrap/libc.so:pthread_rwlock_timedwrlock
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setinheritsched
...
I write a test program that calls pthread_create, built under adeb env, could trace the output result:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create{ printf("%-10u %-6d %-16s %s\n", elapsed /1000000, pid, comm, usym(arg2));}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
181 4669 pthread_test ChildThreadFunction
457 4669 pthread_test ChildThreadFunction
764 4669 pthread_test ChildThreadFunction
1065 4669 pthread_test ChildThreadFunction
1366 4669 pthread_test ChildThreadFunction
1666 4669 pthread_test ChildThreadFunction
1966 4669 pthread_test ChildThreadFunction
2266 4669 pthread_test ChildThreadFunction
2566 4669 pthread_test ChildThreadFunction
2866 4669 pthread_test ChildThreadFunction
3165 4669 pthread_test ChildThreadFunction
3466 4669 pthread_test ChildThreadFunction
3765 4669 pthread_test ChildThreadFunction
^C
but for test program built for android which execute under adb env, there is no trace result output:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/system/lib/bootstrap/libc.so:pthread_create{ printf("%-6d %-16s\n", pid, comm);}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
^C
On Android adeb env, if use bpftrace trace uprobe pthread_create, the path should be uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create,
not uprobe:/system/lib/bootstrap/libc.so:pthread_create, uprobe:/system/lib64/bootstrap/libc.so:pthread_create.
Is that right?
All these paths could list the function path:
root@localhost:/# bpftrace -l 'uprobe:/system/lib/bootstrap/libc.so:pthread*'
uprobe:/system/lib/bootstrap/libc.so:pthread_setspecific
uprobe:/system/lib/bootstrap/libc.so:pthread_barrierattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_exit
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_gettype
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_getscope
uprobe:/system/lib/bootstrap/libc.so:pthread_cond_timedwait_monotonic_np
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setguardsize
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setschedpolicy
uprobe:/system/lib/bootstrap/libc.so:pthread_getschedparam
uprobe:/system/lib/bootstrap/libc.so:pthread_rwlock_timedwrlock
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setinheritsched
...
root@localhost:/# bpftrace -l 'uprobe:/system/lib64/bootstrap/libc.so:pthread*'
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutex_lock
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutexattr_destroy
uprobe:/system/lib64/bootstrap/libc.so:pthread_cond_signal
uprobe:/system/lib64/bootstrap/libc.so:pthread_cond_timedwait
uprobe:/system/lib64/bootstrap/libc.so:pthread_rwlockattr_setpshared
uprobe:/system/lib64/bootstrap/libc.so:pthread_create
uprobe:/system/lib64/bootstrap/libc.so:pthread_attr_setstacksize
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutexattr_gettype
uprobe:/system/lib64/bootstrap/libc.so:pthread_attr_destroy
uprobe:/system/lib64/bootstrap/libc.so:pthread_gettid_np
...
root@localhost:/# bpftrace -l 'uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread*'
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_getattr_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_getpshared
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setaffinity_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_rwlockattr_init
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_timedjoin_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setguardsize
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_getstackaddr
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_setclock
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_sigqueue
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setscope
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_barrierattr_setpshared
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_setpshared
...
I write a test program that calls pthread_create, built under adeb env, could trace the output result:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create{ printf("%-10u %-6d %-16s %s\n", elapsed /1000000, pid, comm, usym(arg2));}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
181 4669 pthread_test ChildThreadFunction
457 4669 pthread_test ChildThreadFunction
764 4669 pthread_test ChildThreadFunction
1065 4669 pthread_test ChildThreadFunction
1366 4669 pthread_test ChildThreadFunction
1666 4669 pthread_test ChildThreadFunction
1966 4669 pthread_test ChildThreadFunction
2266 4669 pthread_test ChildThreadFunction
2566 4669 pthread_test ChildThreadFunction
2866 4669 pthread_test ChildThreadFunction
3165 4669 pthread_test ChildThreadFunction
3466 4669 pthread_test ChildThreadFunction
3765 4669 pthread_test ChildThreadFunction
^C
but for test program built for android which execute under adb env, there is no trace result output:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/system/lib/bootstrap/libc.so:pthread_create{ printf("%-6d %-16s\n", pid, comm);}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
^C
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/system/lib64/bootstrap/libc.so:pthread_create{ printf("%-10u %-6d %-16s %s\n", elapsed /1000000, pid, comm, usym(arg2));}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
^C
So, my problem is that under adeb env, no ability to trace the function caller to bionic library?
The text was updated successfully, but these errors were encountered: