Some notes on C++ clients for DynamoRIO

From Practical Software Verification

Jump to: navigation, search

DynamoRIO supports clients written in C++ but there are a few issues you have to be mindful of. First check out the C++ section on this page. Notably you must statically link your client to the gcc libraries mentioned and those libraries must be compiled with the -fPIC flag. Chances are your gcc toolchain won't have been compiled with this flag so you'll need to get the source and use the flag BOOT_CFLAGS="-fPIC" when compiling.

The C++ client functionality of DR doesn't seem to have been tested that extensively so you might run into some issues. I've logged this bug which occurs when you try to specify the size of a vector in its declaration. Other issues I've run into include the addresses of variables changing between the dr_init() function (which I used to initialise the aforementioned vector once I discovered the other bug) and the call to my analysis function registered with dr_clean_call(), and it appears that the memory allocated by the new operator in libstdc++ from gcc 4.4.0 isn't wrapped as it should be.

(I should mention that due to the above issues I decided to use Pin to perform my instrumentation instead as it is built primarily in C++)

Personal tools