Author Topic: Make.bat, debug & pdb info  (Read 600 times)

LordAdef

  • Member
  • ****
  • Posts: 604
Make.bat, debug & pdb info
« on: May 01, 2018, 06:33:57 AM »
Hi,

I'm trying to have a debug build as detailed as possible, so I could have my asm code in the debugger.
I'm on win10 and cannot read the help file.

since this is a simple thing for you guys, I wondered if you could show me a make.bat that does this.. and I thank you in advance for that.

I'm currently using a modified version of Hutch's make.bat:
Code: [Select]
@echo off

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

if exist "main.obj" del "main.obj"
if exist "main.exe" del "main.exe"

\Masm32\bin\UAsm64 /c /coff "main.asm"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\Masm32\bin\polink /SUBSYSTEM:CONSOLE /OPT:NOREF "main.obj" rsrc.res
 if errorlevel 1 goto errlink

dir "main.*"
goto TheEnd

:nores
\Masm32\bin\polink /SUBSYSTEM:console /OPT:NOREF "main.obj"
 if errorlevel 1 goto errlink
dir "main.*"
goto TheEnd

:errlink
 echo _
echo Link error
goto TheEnd

:errasm
 echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause

My prog is a 32bit one.
Either debugging in Olly or Visual Studio (Do I Have to export a pdb file for that?)

Thanks
Alex

fearless

  • Member
  • ***
  • Posts: 362
    • LetTheLightIn
Re: Make.bat, debug & pdb info
« Reply #1 on: May 01, 2018, 10:08:53 AM »
for debug and pdb output the linker needs, as an example:

Code: [Select]
/DEBUG /DEBUGTYPE:CV /PDB:"main.pdb"
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI

www.LetTheLight.in  My Github  Twitter

LordAdef

  • Member
  • ****
  • Posts: 604
Re: Make.bat, debug & pdb info
« Reply #2 on: May 01, 2018, 02:24:26 PM »
for debug and pdb output the linker needs, as an example:

Code: [Select]
/DEBUG /DEBUGTYPE:CV /PDB:"main.pdb"


thanks Fearless, I tried that but it didn’t work..

johnsa

  • Member
  • ****
  • Posts: 710
    • Uasm
Re: Make.bat, debug & pdb info
« Reply #3 on: May 01, 2018, 06:03:09 PM »
For the assembly portion don't forget to include debugging output with -Zi, -Zd
For the linker (assuming MS Link) just /debug should be sufficient.

I use this for 32 and  64bit inside Visual Studio for full source-level debugging. As I mentioned in another post I've started using AsmDude plugin for Visual Studio to provide intellisense, completion, timings and syntax highlighting so it makes the whole experience quite pleasant. Combined with an integrated shell plugin in VS you can do everything from the IDE without ever leaving, even if you still use batch files for building (as I do).


LordAdef

  • Member
  • ****
  • Posts: 604
Re: Make.bat, debug & pdb info
« Reply #4 on: May 02, 2018, 07:59:50 AM »
For the assembly portion don't forget to include debugging output with -Zi, -Zd
For the linker (assuming MS Link) just /debug should be sufficient.

I use this for 32 and  64bit inside Visual Studio for full source-level debugging. As I mentioned in another post I've started using AsmDude plugin for Visual Studio to provide intellisense, completion, timings and syntax highlighting so it makes the whole experience quite pleasant. Combined with an integrated shell plugin in VS you can do everything from the IDE without ever leaving, even if you still use batch files for building (as I do).

I'm using Polink.
Yes, I saw your post about AsmDude and had it already installed. It's nice. Do you have any special settings for Visual Studio (mine is community) in order to work with masm and Uasm?

johnsa

  • Member
  • ****
  • Posts: 710
    • Uasm
Re: Make.bat, debug & pdb info
« Reply #5 on: May 02, 2018, 06:01:55 PM »
Nope nothing specific, just a plain installation of asmDude, I think i customised the style/colours etc a bit and I added a proper terminal window extension to VS too (so it's like VSCode with a terminal at the bottom).