Open derekbruening opened 9 years ago
Actually what I pasted here is simply gdb running the wrong application: our lib directly instead of drrun.
For running the wrong app, perhaps we can have tools/libdynamorio.so-gdb.py use an exec wrapper or something?
For the ARM bug about env vars not being propagated: once we fix the wrong-app issue we'll see if it reproduces.
If we come up with a solution we should update intro.dox which says:
Because the executable changes from drrun to the app, the app cannot be re-run from gdb's prompt.
Closer inspection shows that it is indeed the env var issue:
(gdb) bt
#0 report_dynamorio_problem (dcontext=0x0, dumpcore_flag=8, exception_addr=0x0, report_ebp=0x0,
fmt=0x71339b30 "DynamoRIO debug check failure: %s:%d %s\n(Error occurred @%d frags)") at /work/dr/git/src/core/utils.c:2153
#1 0x0000000071116717 in internal_error (file=0x71388470 "/work/dr/git/src/core/unix/os.c", line=928,
expr=0x71388740 "executable_path[0] != '\\0' && \"i#907: Can't read /proc/self/exe for early injection\"")
at /work/dr/git/src/core/utils.c:174
#2 0x00000000712cb427 in get_application_name_helper (ignore_cache=false, full_path=true) at /work/dr/git/src/core/unix/os.c:927
#3 0x00000000712cb502 in get_application_name () at /work/dr/git/src/core/unix/os.c:984
#4 0x00000000711167b4 in external_error (file=0x71390460 "/work/dr/git/src/core/unix/loader.c", line=1660,
msg=0x71390ba8 "DYNAMORIO_EXE_PATH env var is not set.") at /work/dr/git/src/core/utils.c:197
#5 0x00000000712f9418 in privload_early_inject (sp=0x7fff452fa3d0, old_libdr_base=0x0, old_libdr_size=0)
at /work/dr/git/src/core/unix/loader.c:1660
#6 0x00000000712b257f in _start () at /work/dr/git/src/core/arch/x86/x86.asm:1181
I'm going to tweak things so we get a better error message:
% lib64/debug/libdynamorio.so suite/tests/bin/linux.execve-null suite/tests/bin/linux.execve-sub
<Application UNKNOWN (18273) DynamoRIO usage error : DYNAMORIO_EXE_PATH env var is not set. Are you re-launching within gdb?>
<Usage error: DYNAMORIO_EXE_PATH env var is not set. Are you re-launching within gdb? (/work/dr/git/src/core/unix/loader.c, line 1665)
version 5.0.16535, custom build
-early_inject
0x00007fff329ef5e0 0x0000000071116839
0x00007fff329ef640 0x00000000712f942b
0x00007fff329f0080 0x00000000712b257f>
With early injection, re-launching within gdb fails with:
I first observed this on ARM where I debugged by looking at environ, and it seemed like under gdb the new env vars just weren't propagated across the execve.