News:

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

ollydbg

Started by ecube, October 07, 2006, 07:30:26 AM

Previous topic - Next topic

ecube

Does anyone know how to get ollydbg to beautifully debug your code by almost showing your exact source? I tried adding /debug to my build.bat and set select path for symbols in olly didn't do it. I did it along time ago after someone posted about it, forgot how to :(

BogdanOntanu

There are some flags that must be given to MASM command line and to the LINKER command line.
Both have to concur...research it a little.

Then you can load your new generated "debug" binary in Olly and you will see all variable manes and labels etc. Additionally you can load the source text file and syncronize it with the CPU  disassembly.

Works for TASM also ;)


Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

ecube

I tried researching and was unable to find the answer hence why I posted here...If anyone is willing to give me a real answer i'd appreciate it, thanks.

Vortex

E^cube,

Here are the command-line switches to build an executable with debug info :

\masm32\bin\ml /c /coff /Zi sourcefile.asm
\masm32\bin\link /SUBSYSTEM:CONSOLE /DEBUG /DEBUGTYPE:CV sourcefile.obj


Attached is an screenshot taken from an Ollydbg session, one of the panels displays the source code.

[attachment deleted by admin]

ecube

Thankyou very much Vortex, that's great.  :bg

GregL

#5
Yeah, thanks Vortex. I didn't realize you could do that with OllyDbg. It's not mentioned in the help, at least I never found it. It's not really intuitive either, it took me a while to figure out how to do it. Like they say, "A picture is worth a thousand words".


mitchi

Good thing this topic was here. I had forgotten how to do it :)

dedndave

Good thing this topic was here. I had no idea how to do it.  :bg

jj2007

Good thing this topic was here. I still have no idea how to do it. My source window is empty... ::)

mitchi

Go to the source files window before going to the source window.
In the source files window double-click on your .asm file.
The source code will appear.

jj2007

Quote from: mitchi on June 28, 2009, 08:44:09 AM
Go to the source files window before going to the source window.
In the source files window double-click on your .asm file.
The source code will appear.

I tried that already but my source files window is empty, too...

Mark Jones

IIRC, GoASM+GoLink = debugging data embedded inside exectuable. PoLink = similar.

Unsure of the results using the first two (think the latter will not work while the former does), but I know for certain Olly can read .PDB file data (MS LINK.EXE). Try the standard MASM32 package versions of ML and LINK, not the newer versions.

The /Zi switch is needed (/Zd possibly also), along with /debug IIRC.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Jimg

Also I have found that including the /Fl listing switch prevents the source from showing in Olly for some reason.

Vortex

Hi jj2007,

What's the version of your Olldbg copy?

jj2007

Quote from: Vortex on June 28, 2009, 03:55:23 PM
What's the version of your Olldbg copy?

23.05.2004 - and it works now, with /Zi /Zd for ml and /debug for link, both the versions that come with Masm32. Later versions of ml and link do not work with debug symbols.