mxmssh / drltrace

Drltrace is a library calls tracer for Windows and Linux applications.
BSD 3-Clause "New" or "Revised" License
388 stars 68 forks source link

Add '-grepable' option to make output easier to grep #17

Closed jtesta closed 4 years ago

jtesta commented 4 years ago

The default format isn't easy to grep through. Functions are split up on multiple lines like this:

~~3636~~ KERNELBASE.dll!CreateFileW
    arg 0: C:\Windows\Fonts\staticcache.dat (type=wchar_t*, size=0x0)
    arg 1: 0x80000000 (type=DWORD, size=0x4)
    arg 2: 0x5 (type=DWORD, size=0x4)
    arg 3: <null> (type=<unknown>*, size=0x0)
    arg 4: 0x3 (type=DWORD, size=0x4)
    arg 5: 0x0 (type=DWORD, size=0x4)

Notice that if the user wants to find all calls to CreateFileW with C:\Windows\ included, grep simply won't work. With this new -grepable option, however, the function and arguments are outputted on the same line like this:

~~4824~~ KERNELBASE.dll!CreateFileW {0: C:\Windows\Fonts\staticcache.dat (type=wchar_t*, size=0x0)} {1: 0x80000000 (type=DWORD, size=0x4)} {2: 0x3 (type=DWORD, size=0x4)} {3: 0x005cde8c (type=<unknown>*, size=0x0)} {4: 0x3 (type=DWORD, size=0x4)} {5: 0x80 (type=DWORD, size=0x4)}

Now the user can do grep CreateFileW logfile.log | grep C:\\Windows

mxmssh commented 4 years ago

Very usefull feature! Thanks for adding that. Everything looks good. Could you also please add grepable parameter description in README.md, so everyone can see on github that this functionality is now offered by drltrace.

jtesta commented 4 years ago

Done!