The MASM Forum

Projects => Rarely Used Projects => RadAsm IDE Support => Topic started by: Grincheux on December 19, 2015, 06:07:09 AM

Title: Debugging with RADASM
Post by: Grincheux on December 19, 2015, 06:07:09 AM
I use version 3 of RadAsm and found a menu "Debug".
Does it mean that we can debug our program with RadAsm?
How do I use it?
Title: Re: Debugging with RADASM
Post by: ragdog on December 19, 2015, 09:56:36 PM
Quote
Does it mean that we can debug our program with RadAsm?

Yes you can set a Breakpoint in your source to debug your source
its very usefull.

Try it
Title: Re: Debugging with RADASM
Post by: Grincheux on December 19, 2015, 10:49:40 PM
I have seen breakpoints but how do I debug?
Title: Re: Debugging with RADASM
Post by: jj2007 on December 20, 2015, 02:37:58 AM
.code
start:
  mov eax, 123
  invoke whatever
  int 3    ; <------- breakpoint


Your assembler commandline should contain /Zi
Your linker commandline should contain /debug

- open the executable in OllyDbg (http://www.ollydbg.de/version2.html)
- hit F9 to let the program execute until the breakpoint
- hit F7 or F8 to go forward step by step (F8 does not dive into calls)
Title: Re: Debugging with RADASM
Post by: ragdog on December 20, 2015, 03:19:49 AM
1.Set a Breakpoint with "Toggle breakpoint CTRL+T" on any line in your source
2.Run the Radasm debugger "Debug>>Run shift+7"
3. is your Breakpoint reached in your source can you Trace it with Step into or step Over

And you can Trace step by Step your Source code.
Title: Re: Debugging with RADASM
Post by: dedndave on December 20, 2015, 03:31:04 AM
in windows, there is something called "Just In Time" exception handler
normally, this points to the "Dr Watson" message box that gives you error information when a program crashes
i'm sure you've seen it - for example, if you try to access protected memory, you get error 0x80000005

well, by changing a registry setting, you can change what happens when a program crashes
Jochen gave you a link to Olly Debugger
versions 1.1 and 2 are available
version 1.1 allows source symbols
version 2 has newer features, but he is still working on symbol support

at any rate, when you install Olly - there is a menu item that allows you to set the JIT exception handler to Olly
once you do that, Olly will come up instead of the windows error messages

INT 3 generates an "invalid opcode" exception, causing the JIT handler to come up
so, to debug at a specific spot, we temporarily insert an INT 3 into the code
Title: Re: Debugging with RADASM
Post by: ragdog on December 20, 2015, 06:03:45 AM
@Dave

Grincheux mean the Radasm source code debugger not Olly
Title: Re: Debugging with RADASM
Post by: Grincheux on December 20, 2015, 08:12:13 AM
RagDog, you are right.
I have tested this possibility.
My program opens a file for reading (*.exe). Into visual community 2015 debugger I have no problem but using RadAsm I cannot read the file.
My breakpoint is set far from this point.

Title: Re: Debugging with RADASM
Post by: ragdog on December 20, 2015, 07:15:13 PM
Can you make a small Project for testing?
Title: Re: Debugging with RADASM
Post by: Grincheux on December 21, 2015, 03:35:42 AM
Yes I will do
Title: Re: Debugging with RADASM
Post by: HSE on December 21, 2015, 03:55:15 AM
Hi Grincheux!

What compiler are you using? Apparently the RadAsm Debugger only work with ML. (for sure, in Jwasm the options for debugging don't work)
Title: Re: Debugging with RADASM
Post by: jj2007 on December 21, 2015, 05:58:10 AM
Quote from: HSE on December 21, 2015, 03:55:15 AM(for sure, in Jwasm the options for debugging don't work)

They work perfectly, I use them every day.
Title: Re: Debugging with RADASM
Post by: HSE on December 21, 2015, 06:17:49 AM
Very funny jj!

You can't delete the context.

In that case the expression is:
    (for sure, in Jwasm the options for debugging with RadAsm Debugger don't work)
Title: Re: Debugging with RADASM
Post by: Grincheux on December 21, 2015, 07:00:30 AM
JWAsm
Title: Re: Debugging with RADASM
Post by: ragdog on December 21, 2015, 07:10:32 AM
The Radasm source code debugger works fine
Title: Re: Debugging with RADASM
Post by: HSE on December 21, 2015, 01:37:46 PM
Grincheaux:

I'm also using JWAsm (v2.13). Not very often, I use OllyDbg for debugging small programs (not RadAsm debugger). Perhaps I have a bad RadAsm configuration, but I think there is some misanderstanding between compiler and debugger (Japhet say JWAsm and JWlink was thinked for Open Watcom Debugger).
My debug result in RadAsm is:
DbgHelp.dll version 6.1.7601.17514 (win7sp1_rtm.101119-1850)
No debug info found. Use the /Zd, /Zi and /DEBUG command line options.


RagDog:

What compiler are you using?


   
Title: Re: Debugging with RADASM
Post by: Grincheux on December 21, 2015, 02:45:36 PM
When running the debugger program to debug does not do what they are for. Trying to run the program after the debug session gives bad results, I have to exit RadAsm and to launch it

It is not the main goal of RadAsm.
Its real job is to edit files, and it does this very well.


Title: Re: Debugging with RADASM
Post by: ragdog on December 21, 2015, 05:07:08 PM
Quote
RagDog:

What compiler are you using?

It works with Masm and Jwasm very nice
You ust make a debug build /ZI /ZD

1 Build your project in Debug build (Radasm toolbar change Combobox Release/Debug)
2. set a Breakpoint on any Line in the source
3. run the debugger Debug>>Run

Now break Radasm on this line and you can trace it Step into or Over..

A other option is Load your exe in Ollydbg go on Menu View source files select your asm file and you can to trace your source code in Olly.

Regards,
Title: Re: Debugging with RADASM
Post by: TWell on December 21, 2015, 06:11:12 PM
Modified/created special ini-file for JWasm + MS link may help.
...
[Make]
...
Make=rc,jwasm,link,lib
...
Title: Re: Debugging with RADASM
Post by: HSE on December 21, 2015, 10:51:23 PM
Ragdog:
You are absolutely right: work fine with JWAsm v2.11

Thanks Tim! Your configuration is similar to my configuration, but I realize that I'm using JWAsm13 (is v2.13).

With v2.13 the debug building generate the output:

pr3.obj : error : Internal error during Pass2

  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 65B01DA0
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = 362935A9

CONTEXT:
  Eax    = 362935A1  Esp    = 0012F054
  Ebx    = 00000204  Ebp    = 0012F0B0
  Ecx    = 00000E00  Esi    = 0012F070
  Edx    = 0035D828  Edi    = 00000002
  Eip    = 65B01DA0  EFlags = 00010202
  SegCs  = 0000001B  SegDs  = 00000023
  SegSs  = 00000023  SegEs  = 00000023
  SegFs  = 0000003B  SegGs  = 00000000
  Dr0    = 0012F054  Dr3    = 00000204
  Dr1    = 0012F0B0  Dr6    = 00000E00
  Dr2    = 00000000  Dr7    = 00000000


Some "improvement" in JWAsm13 don't work well for debugging (at least in console programs).
Title: Re: Debugging with RADASM
Post by: jj2007 on December 21, 2015, 11:31:26 PM
Quote from: HSE on December 21, 2015, 10:51:23 PM
You are absolutely right: work fine with JWAsm v2.11

Congrats :t
Title: Re: Debugging with RADASM
Post by: ragdog on December 22, 2015, 04:52:46 PM
QuoteModified/created special ini-file for JWasm + MS link may help.
Code: [Select]

...
[Make]
...
Make=rc,jwasm,link,lib
...

You dont need change the ini.

Radasm has a Jwasm config (Jwasm.ini)

Or other way use Jwasm is Jochen“s solution

Rename in the Masm bin package ml.exe > ml_.exe and copy Jwasm.exe in this folder and rename it to ml.exe. :t
Title: Re: Debugging with RADASM
Post by: HSE on December 23, 2015, 01:08:06 AM
Oops! JWasm v2.13 also work fine!

Apparently the linker running in debug mode is detecting an exception (I guess related to my own long lines JWasm "improvement"  to support big SmplMath equations  :biggrin:). No fault at all from RadAsm.