News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

OllyDbg; Linking Source, Disassembly, and Execution.

Started by raleeper, August 25, 2011, 12:59:59 PM

Previous topic - Next topic

raleeper

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

clive

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.
It could be a random act of randomness. Those happen a lot as well.

hfheatherfox07

#2
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

hfheatherfox07

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

hfheatherfox07

Here is  static library crtmt.lib   :bg

dedndave


raleeper

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