The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RHL on April 23, 2012, 02:47:31 AM

Title: Use the Debugger VC 2010 without IDE?
Post by: RHL on April 23, 2012, 02:47:31 AM
Hello all!, i want know if is possible use the debugger VC 2010 in another IDE? as a simple text editor like notepad++
is possible ? :|
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: BogdanOntanu on April 23, 2012, 09:50:38 PM
NO you can not :D

But you could somehow use WinDBG ... in very complicated ways I guess

Why do you ask?
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: P1 on April 23, 2012, 11:21:19 PM
Quote from: RHL on April 23, 2012, 02:47:31 AM
Hello all!, i want know if is possible use the debugger VC 2010 in another IDE? as a simple text editor like notepad++
is possible ? :|
It is possible to build a MASM project, so that it can be used inside VS to debug.  To use features like step into, step over, register watch, variable watch.
Quote from:  add to menus.iniBuild All &Debug,\MASM32\BIN\Bldalld.bat "{b}"
@echo off
REM Bldalld.bat file

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "%1.obj" del "%1.obj"
if exist "%1.exe" del "%1.exe"

\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj" rsrc.obj
if errorlevel 1 goto errlink

dir "%1.*"
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj"
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause
This builds the necessary files to step through the source code in the VS Debugger.

Regards,  P1   :8)
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: NoCforMe on April 23, 2012, 11:24:39 PM
If you don't mind my hijacking this thread a little bit, since it's a related matter and you seem to know something about this, what's the formula for building executables with MASM32 so you can debug with OllyDbg with symbols? I tried a number of ML flags, but nothing seemed to work.
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: jj2007 on April 23, 2012, 11:56:46 PM
Symbolic debugging with OllyDbg version 2.01 (http://www.masm32.com/board/index.php?topic=15444.0)

Note that you need ml 6.14, 6.15 or JWasm; higher versions of Masm may not work.
Olly displays also args and local vars, e.g.

TheTest proc Arg1, Arg2, Arg3
LOCAL Loc1, Loc2
mov eax, Arg1
mov ebx, Arg2
mov ecx, Loc1
mov edx, Loc2

TheTest      ³$ À55                  push ebp                             ; ArraySort.TheTest(Arg1,Arg2,Arg3)
00401011     ³.  8BEC                mov ebp, esp
00401013     ³.  83C4 F8             add esp, -8
00401016     |.  8B45 08             mov eax, [arg.Arg1]
00401019     |.  8B5D 0C             mov ebx, [arg.Arg2]
0040101C     |.  8B4D FC             mov ecx, [local.Loc1]
0040101F     |.  8B55 F8             mov edx, [local.Loc2]


Title: Re: Use the Debugger VC 2010 without IDE?
Post by: P1 on April 24, 2012, 01:15:15 AM
Quote from: NoCforMe on April 23, 2012, 11:24:39 PM
If you don't mind my hijacking this thread a little bit, since it's a related matter and you seem to know something about this, what's the formula for building executables with MASM32 so you can debug with OllyDbg with symbols? I tried a number of ML flags, but nothing seemed to work.
Unless you have it setup otherwise, the pdb file can go into exe location or \ollydbg folder for debugging.

Regards,  P1  :8)
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: NoCforMe on April 24, 2012, 01:16:30 AM
Quote from: jj2007 on April 23, 2012, 11:56:46 PM
Symbolic debugging with OllyDbg version 2.01 (http://www.masm32.com/board/index.php?topic=15444.0)

Note that you need ml 6.14, 6.15 or JWasm; higher versions of Masm may not work.
Olly displays also args and local vars, e.g.

(snip)

Thanks. But it sorta works, sorta doesn't.

Olly shows subroutine names (mine as well as Win32 ones) and global variables. However, it doesn't show any local variables.

I'm using Olly version 1.1. I put all the switches into the make file that you gave in that other message (/Zi, /debug).

It's a lot better than nothing. But it would sure be nice to be able to see all my variable names ...
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: P1 on April 24, 2012, 01:25:05 AM
Quote from: NoCforMe on April 24, 2012, 01:16:30 AMI'm using Olly version 1.1. I put all the switches into the make file that you gave in that other message (/Zi, /debug).
Try the Debug build batch file below.  Let me know how it works for you.

I debug in VS, not Olly.   I use it for all my debugging for all my software projects.

Regards,  P1   :8)
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: shlomok on April 24, 2012, 07:16:53 AM
Quote from: P1 on April 24, 2012, 01:25:05 AM
Quote from: NoCforMe on April 24, 2012, 01:16:30 AMI'm using Olly version 1.1. I put all the switches into the make file that you gave in that other message (/Zi, /debug).
Try the Debug build batch file below.  Let me know how it works for you.

I debug in VS, not Olly.   I use it for all my debugging for all my software projects.

Regards,  P1   :8)

P1,
Thanks for the info,
I saw that you are using the /DEBUGTYPE:CV format rather than the COFF one, will VC interpret those differently?
Can you also please share your SLN?

And while we are here, have you had any success in adding syntax highlighting and code completion for .asm files under VC?

Thanks,

S.
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: dedndave on April 24, 2012, 11:13:23 AM
the CV switch stands for "CodeView" - an old debugger by microsoft
it is a different file format - a neccessity, i suppose, if you want to use VC

the "SUN" is a forum smiley, just above the reply window
i sometimes steal smileys from yahoo...
http://messenger.yahoo.com/features/emoticons/
http://messenger.yahoo.com/features/hiddenemoticons/

(http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/24.gif)
Title: Re: Use the Debugger VC 2010 without IDE?
Post by: RHL on April 24, 2012, 05:33:42 PM
Quote from: RHL on April 23, 2012, 02:47:31 AM
Hello all!, i want know if is possible use the debugger VC 2010 in another IDE? as a simple text editor like notepad++
is possible ? :|
thanks man, I tried with WINDBG but... is very complicated :S who debugged with it? :S


Quote from: P1 on April 23, 2012, 11:21:19 PM
if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "%1.obj" del "%1.obj"
if exist "%1.exe" del "%1.exe"

\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj" rsrc.obj
if errorlevel 1 goto errlink

dir "%1.*"
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj"
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause
This builds the necessary files to step through the source code in the VS Debugger.
Regards,  P1   :8)


@P1: thanks i am trying create one , i think need make a project solution right? : P