The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: raleeper on August 25, 2011, 12:59:59 PM

Title: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: raleeper on August 25, 2011, 12:59:59 PM
I am learning OllyDbg.  I have not been able to find a way to link the source code shown in one window with the disassembly shown in another, with execution poised to continue from the line highlighted in source and disassembly windows and numbered by eip.  For example.
--------
00401251 ff7508          push    dword ptr [ebp+8]
00401254 e8e7040000      call    testp!BeginPaint (00401740)
00401259 a3d0544000      mov     dword ptr [testp!hdc (004054d0)],eax
0040125e bf8a404000      mov     edi,offset testp!font1 (0040408a)              current position in disassembly window.
-------
dspl:   invoke   BeginPaint,wp_hWnd,ADDR ps      ;fills (ps) w/ defaults
   mov   [hdc], eax
   mov   edi, OFFSET font1                                                                          current position in source
-------
eip = 40125e
------

Is there a way to do this?

Thanks, Robert
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: clive on August 25, 2011, 02:54:24 PM
Don't have a specific answer for you, but you'll need to assemble with the /Zd (and perhaps /Zi) option, and link with debugging info, for it to be able convert source lines to specific addresses. Then it's a matter of Olly being able to pull that from the debug symbols.
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: hfheatherfox07 on August 26, 2011, 12:01:53 AM
I found this posted in another forum by a member that is a member here too

C:\Masm32\Bin\ML.EXE /c /Zi/coff /Cp /nologo /I"C:\Masm32\Include" "MyProg.asm"
C:\Masm32\Bin\LINK.EXE /SUBSYSTEM:WINDOWS /DEBUG /VERSION:4.0 /LIBPATH:"C:\Masm32\Lib" "MyProg.obj"


apparently it generates a PDB file


here is Donkey's original post http://www.asmcommunity.net/board/index.php?topic=15858.0
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: hfheatherfox07 on August 26, 2011, 12:15:15 AM
I found an example that shows how to integrate OllyDbg's assembler and disassembler library into your Masm programs.

Originaly from here: http://www.winasm.net/forum/index.php?showtopic=482

This Requires this static library crtmt.lib ...I will upload it in the next post due to the limit of attachments
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: hfheatherfox07 on August 26, 2011, 12:18:07 AM
Here is  static library crtmt.lib   :bg
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: dedndave on August 26, 2011, 01:13:25 AM
some help from JJ...
http://www.masm32.com/board/index.php?topic=12845.msg99217#msg99217

also, there is a recent update to Olly
you probably have it, but i will link it, anyways...
http://ollydbg.de/version2.html
Title: Re: OllyDbg; Linking Source, Disassembly, and Execution.
Post by: raleeper on August 26, 2011, 06:31:15 AM
Quote from: clive on August 25, 2011, 02:54:24 PM
Don't have a specific answer for you, but you'll need to assemble with the /Zd (and perhaps /Zi) option, and link with debugging info, for it to be able convert source lines to specific addresses. Then it's a matter of Olly being able to pull that from the debug symbols.

Thank you, clive.  I did omit /Zd  It might have taken me a while to realize that the problem might lie in the way I was assembling.

BEST wishes, Robert