Added function caching and return value logging.
I incorporated the fixes for return value retrieval. That fixes most of the problems, yet some crashes on Windows still occur. Its gotten to the point where I'm not very effective at debugging this--not without spending a lot more time (which I don't have right now, unfortunately). I suspect its more issues with DynamoRIO on Windows. It seems to work fine on Linux.
Can you give this a try and see what the problem might be?
It seems for me like drltrace's bug rather than DynamoRIO's. This is the output from winDBG:
(1294.ec): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
drltracelib!_output_l+0x390:
00000000`900196b0 66443911 cmp word ptr [rcx],r10w ds:00000000`00000002=????
0:000> r
rax=000000007ffffffe rbx=0000000000000002 rcx=0000000000000002
rdx=0000000000000007 rsi=0000000000000005 rdi=000000009003e282
rip=00000000900196b0 rsp=00000000800ddfb0 rbp=00000000800de0b0
r8=00000000ffffffff r9=0000000090000000 r10=0000000000000000
r11=0000000000000200 r12=00000000ffffffff r13=00000000800de378
r14=0000000000000800 r15=00000000800de253
iopl=0 nv up ei pl nz na pe nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202
drltracelib!_output_l+0x390:
00000000`900196b0 66443911 cmp word ptr [rcx],r10w ds:00000000`00000002=????
Callstack (might be wrong):
0:000> k
Child-SP RetAddr Call Site
00000000`800ddfb0 00000000`90011afa drltracelib!_output_l+0x390 [f:\dd\vctools\crt\crtw32\stdio\output.c @ 1640]
00000000`800de2d0 00000000`90005cf7 drltracelib!_snprintf+0x86 [f:\dd\vctools\crt\crtw32\stdio\sprintf.c @ 130]
00000000`800de350 00000000`900057e6 drltracelib!get_module_and_function_name+0x247
00000000`800de490 00000000`90006461 drltracelib!std::basic_ostream<char,std::char_traits<char> >::flush+0x196
00000000`800de670 00000000`9002f634 drltracelib!std::basic_ios<char,std::char_traits<char> >::init+0x631
00000000`800deca0 00000000`8094cbc2 drltracelib!drwrap_in_callee+0x1c4 [e:\vb\drltrace\drltrace\drltrace_src\dynamorio\ext\drwrap\drwrap.c @ 1865]
00000000`800dee80 00000000`00000000 0x8094cbc2
So, we have a null-pointer dereference here but I have no idea where exactly it happens in drltracelib...
I think the problem happens in get_module_and_function_name