The MASM Forum Archive 2004 to 2012

Project Support Forums => IDE Development and Support => RadAsm Support Forum => Topic started by: KetilO on June 09, 2009, 08:55:32 AM

Title: RADebug. RadASM source code debugger.
Post by: KetilO on June 09, 2009, 08:55:32 AM
Here is an addin that adds debugging capabilities to RadASM.
Currently only masm is supported.

RadASM source code debug addin.

The goal for this debugger.
-----------------------------------------------------------------------------
o The debugged program must run at full speed until a breakpoint is reached.
o Procs that are not debugged must run at full speed.
o It must be possible to use other assemblers / compilers than masm.
- These goals exclude the use of hardware breakpoints.
- The use of dbghelp must be minimized.

NOTE! DbgHelp.dll hell.
-----------------------------------------------------------------------------
Windows Vista:
My Vista came with version 6.0.6001.18000. It works OK.
Windows XP:
Download and install http://msdl.microsoft.com/download/symbols/debuggers/dbg_x86_6.11.1.404.msi
The only thing you need is DbgHelp.dll in C:\Program Files\Debugging Tools for Windows (x86)\srcsrv
Copy it to RadASM root (C:\RadASM).
Windows 2000:
Not tested.
Windows 9x and Me:
Not tested.

Links:
http://msdn.microsoft.com/en-us/library/ms679294.aspx
http://www.microsoft.com/whdc/devtools/debugging/default.mspx

How to install:
-----------------------------------------------------------------------------
o Copy RADebug.dll to C:\RadASM\Addins
o Copy RADebug.txt to C:\RadASM\Addins\Help
o Start RadASM and use Options/Addin Manager to activate addin.
  - There is an option to show DbgHelp output.

How to make (masm):
-----------------------------------------------------------------------------
o Assemble with the /Zd and /Zi options.
o Link with the /DEBUG option.

How to debug:
-----------------------------------------------------------------------------
o Set a breakpoint in your source using Make/Debug/Toggle Breakpoint
0 Select Make/Debug/Run
  - You will get a warning on unhandled breakpoints if you set a breakpoint
    on a line that does not produce any code.
  - You will get an error if there are unsaved source files.
  - You will get an error if any source files are newer than the exe.
  - Execution will halt when a breakpoint is reached.
    Output window #1 will show some debug info.
    Output window #2 will show registers.
  - Use Step Into, Step Over, Run To Caret or Run to continue execution.
  - Use Toggle Breakpoint to set a new breakpoint or use Clear Breakpoints
    to clear all breakpoints.
  - Use Stop to stop execution.
  - Multithreading is supported. Each thread gets to execute one line
    at a time, very confusing.
  - Use Do Not Debug to select procs that you dont want to debug. Typically
    you dont want to debug the WndProc and the messageloop (WinMain) in a GUI
    application.
o NOTE!
  - The debug menu will be disabled if no project is open or the debugger
    can not find any debug info.
  - The addin will only work with RadASM 2.2.1.6 or higher.

Whats new:
-----------------------------------------------------------------------------
o Released version 1.0.0.1
  - Step Over is enabled.
  - Do Not Debug is enabled.
  - Added tooltip to show register value when mouse is over a register.
  - Added tooltip to show a global variables value when mouse is over a variable.
  - Fixed bugs.
  - Speed optimized breakpoint handling.
o Uploaded version 1.0.0.0
  - Step Over is disabled (Needs size of proc).
  - Do Not Debug is disabled (Needs size of proc).

To do:
-----------------------------------------------------------------------------
o Immediate window to inspect variables, proc parameters and locals.
o Tooltip on mouse over a proc parameter or local.
o Support for other assemblers / compilers besides masm.

Known bugs:
-----------------------------------------------------------------------------
When a thread is created the debugger skips a line.
A proc without a stack frame will skip the first code line.
Examples:
MyProc proc

   mov      eax,1
   ret               ; Wrong. The debugger will stop here

MyProc endp

MyProc proc uses ebx

   mov      eax,1      ; OK. The debugger will stop here
   ret

MyProc endp

MyProc proc hWin:HWND

   mov      eax,1      ; OK. The debugger will stop here
   ret

MyProc endp

KetilO

[attachment deleted by admin]
Title: Re: RADebug. RadASM source code debugger.
Post by: fearless on June 09, 2009, 11:22:21 AM
Good stuff :D

Will you be adding watch variable type capabilities at a future point? and view of register values?
Title: Re: RADebug. RadASM source code debugger.
Post by: KetilO on June 09, 2009, 01:48:46 PM
Hi fearless

Watch variable will be part of the immediate window.
View of register values are there already, look at output window #2.
Also there is a code view tooltip showing register value if you hold the mouse over a register.

KetilO
Title: Re: RADebug. RadASM source code debugger.
Post by: fearless on June 09, 2009, 04:01:44 PM
Excellent stuff. Is there a way to pin the output window so that is always open? or a way for it to autoselect the 2nd  output window when debugging?