Menu

#84 How to run and debug upx source code ?

None
closed
2
2015-01-10
2014-02-24
Majid
No

How can i run upx source code with Microsoft visual studio 2012 on windows 7 x64 and what is the requirements needed ??? because i can not do it. that needed more tools for run and has many errors to run.

Thanks.

Discussion

  • John Reiser

    John Reiser - 2014-02-24

    Your request complains "needed more tools for run and has many errors to run", but you did not list any actual error messages or diagnostic messages. Therefore I can offer only general advice.

    The developers of UPX use the gdb debugger running on Linux. Perhaps gdb under cygwin running on Windows might help. The rxvt program under cygwin provides a more comfortable text terminal environment. Perhaps the eclipse IDE might work for you.

    The pre-compiled upx*.exe in upx391w.zip has been compressed by UPX. Most debuggers prefer a non-compressed executable. So make a copy, and run the original with the -d flag to decompress the copy. Then debug the decompressed copy. This will allow debugging the UPX program itself, although most of the symbol information has been stripped. Therefore download the source to UPX, make a Visual Studio project, and debug that.

    As for debugging a compressed executable, your debugger must be able to track execution in a "bare" environment: one that has no runtime libraries, no symbols, etc. Put a breakpoint at the first instruction (the entry address specified in the PE headers for the file), run, and single-step from there. In some cases the breakpoint should be on the second instruction. Or, go to the source for the "stub" file stub/src/i386-win32.pe.S, insert an "int3" instruction ahead of the actual first instruction, re-build the stub, re-build upx, compress your program, invoke the debugger on the compressed program. The "int3" is a compiled-in breakpoint. Use ".byte 0xcc" if the assembler does not like 'int3'.

     

    Last edit: John Reiser 2014-03-01
  • John Reiser

    John Reiser - 2015-01-10
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.

MongoDB Logo MongoDB