I’d like to force a coredump from a program (or see its memory at a specific time in some other way). There are a couple of problems though:
- I’m running it under wine (cannot run via winedbg, because the application detects it)
- The application uses exceptions / SEH / other handlers, which capture non-standard events
- Even attaching strace stops the program from working
- I’d like to poke around, so there are no specific areas that I could print
- Well… I don’t have the source
I’ve tried changing the code to both:
xor eax, eax
call eax
and some random stuff which wasn’t a real instruction – both time SEH kicked in and rescued the application.
How can I get the information? I need the memory image from a specific time and can patch the exact place where it occurs.
Since you have access to the source code of wine, I’d suggest just altering the wine SEH code, and/or the implementation of the
IsDebuggerPresent()function.Another option would be to modify the application to suspend itself by raising a SIGSTOP signal. Windows applications in Wine can still access linux APIs by invoking
int $0x80, so you could inject some code like the following:Then you can
mmapranges from/proc/(pid)/memto read out the process’s memory, or even attachgdband use itsgenerate-core-filecommand. Alternately, you could change this to simply raiseSIGQUITor something to trigger a core dump right then and there (assuming wine hasn’t installed aSIGQUIThandler – but with the right syscalls that can be overcome as well).