The filed bug is about raw2trace_directory using the DR API without initializing DR, but I expanded this to clean up the whole code base:
Adds dr_standalone_init() and _exit() to raw2trace_directory_t. This fixes an assert when calling dr_open_file() due to uninitialized state.
Adds {dr_,}standalone_exit() calls to all cases where _init() is called, except where we can't do that (drdecode heap usage).
For the C++ view and opcode_mix tools, uses a first-field destructor to ensure dr_standalone_exit() is called after any DR heap used by other fields is freed.
Fixes several bugs where IR cleanup calls were missing in the api.ir test, revealed by dr_standalone_exit's unfreed-memory check.
Fixes #4117 (closed)