drrun ignores instrumentation client for executables with whitespaces in their absolute paths
Created by: atrosinenko
When I use drrun
6.2.0-2 on an executable file with a space character in its absolute path, drrun
silently drops some default options including client library name. It was very strange when I tried to run my client and nothing happened -- not even dr_printf
was called from dr_client_main
that was written as the first line of this function. I cd
ed to my draft version's build directory and it just worked. I compared nm -D
output on both clients and they both contained dr_client_main
symbol. After some time I realized that my QtCreator created build directory without spaces for my draft version. It is not so awful that drrun
cannot handle spaces in absolute paths of executables, but it is very frustrating when it even runs the examined binary but silently drops instrumentation library. :)
System details
Ubuntu 17.04 64 bit, DynamoRIO 6.2.0-2.
How to reproduce
$ cd /tmp
$ wget https://github.com/DynamoRIO/dynamorio/releases/download/release_6_2_0/DynamoRIO-Linux-6.2.0-2.tar.gz
... some wget output ...
$ tar -axf DynamoRIO-Linux-6.2.0-2.tar.gz
$ mkdir ab
$ mkdir a\ b
$ cp /bin/echo ab
$ cp /bin/echo a\ b
$ cd ab
$ /tmp/DynamoRIO-Linux-6.2.0-2/bin64/drrun -verbose -debug -c /tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so -- ./echo 123
INFO: client 0 path: /tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so
INFO: targeting application: "/tmp/ab/echo"
INFO: app cmdline: "./echo" "123"
INFO: configuration directory is "/home/trosinenko/.dynamorio"
INFO: will exec /tmp/ab/echo
INFO: registering client with id=0 path=|/tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so| ops=||
<Starting application /tmp/ab/echo (31905)>
<Paste into GDB to debug DynamoRIO clients:
set confirm off
add-symbol-file '/tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so' 0x00007f11f2ba1da0
add-symbol-file '/tmp/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so' 0x000000007102d808
add-symbol-file '/tmp/DynamoRIO-Linux-6.2.0-2/ext/lib64/debug/libdrreg.so' 0x00007f11fabab720
add-symbol-file '/tmp/DynamoRIO-Linux-6.2.0-2/ext/lib64/debug/libdrmgr.so' 0x00007f11fabb5980
add-symbol-file '/lib/x86_64-linux-gnu/libc.so.6' 0x00007f12725c89c0
add-symbol-file '/lib64/ld-linux-x86-64.so.2' 0x00007f1272380aa0
>
<Initial options = -no_dynamic_options -client_lib '/tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so;0;' -code_api -stack_size 56K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
Client bbcount is running
<(1+x) Handling our fault in a TRY at 0x000055ae9c3b5d5b>
<spurious rep/repne prefix @0x00007f1272989260 (f2 41 ff e3): >
123
<Stopping application /tmp/ab/echo (31905)>
Instrumentation results:
46472 basic block executions
471 basic blocks needed flag saving
2051 basic blocks did not
trosinenko@tro-notebook:/tmp/ab$ cd ../a\ b/
trosinenko@tro-notebook:/tmp/a b$ /tmp/DynamoRIO-Linux-6.2.0-2/bin64/drrun -verbose -debug -c /tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so -- ./echo 123
INFO: client 0 path: /tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so
INFO: targeting application: "/tmp/a b/echo"
INFO: app cmdline: "./echo" "123"
INFO: configuration directory is "/home/trosinenko/.dynamorio"
INFO: will exec /tmp/a b/echo
INFO: registering client with id=0 path=|/tmp/DynamoRIO-Linux-6.2.0-2/samples/bin64/libbbcount.so| ops=||
<Starting application /tmp/a (31908)>
<Paste into GDB to debug DynamoRIO clients:
set confirm off
add-symbol-file '/tmp/DynamoRIO-Linux-6.2.0-2/lib64/debug/libdynamorio.so' 0x000000007102d808
>
<Initial options = -early_inject -emulate_brk >
<(1+x) Handling our fault in a TRY at 0x0000556766177d5b>
<spurious rep/repne prefix @0x00007fd4c9566260 (f2 41 ff e3): >
123
<Stopping application /tmp/a (31908)>