dr_get_main_module() and get_application_base() fail for early inject across execve with relative path
This shows up as a CRASH in Dr. Memory's execve test:
#7 0xf72742f6 in master_signal_handler () at /work/dr/git/src/core/arch/x86/x86.asm:1444
#8 0x49de2afc in ?? ()
#9 0x7395063c in report_thread_init (drcontext=0x49d61480) at /work/drmemory/git/src/drmemory/report.c:2030
#10 0x73815106 in event_thread_init (drcontext=0x49d61480) at /work/drmemory/git/src/drmemory/drmemory.c:556
it's in callstack_thread_init():
module_data_t *data = dr_get_main_module();
instr_t inst;
byte *pc = data->entry_point;
dr_get_main_module() returned NULL.
(gdb) p executable_start $1 = (app_pc) 0x0 (gdb) p get_application_name() $2 = 0xf73c9460 <executable_path> "tests/malloc"
The app to run is passed to tests/execve as either "./malloc" or here "tests/malloc".
08048000-08049000 r-xp 00000000 fd:03 15236022 /work/drmemory/git/build_x86_dbg/tests/malloc
get_application_base() wants the full path: if (strcmp(iter.comment, name) == 0) {
The execve test works just fine if I pass in the full path as the arg.
DR test suite didn't catch this b/c the test apps are all invoked directly by drrun, who makes the path absolute.