RadASM 2.2.1.7 / RADebug 1.0.0.5 bugtest

Started by KetilO, June 25, 2009, 09:44:53 AM

Previous topic - Next topic

KetilO

RadASM 2.2.1.7
--------------
2.2.1.7
o The code parser for masm has been enhanced to include datatypes and array sizes.
o The code parser for VC6 C/C++ (cppparse.dll) has been enhanced to include datatypes and array sizes.
o The code parser for FreePASCAL has been enhanced to include datatypes and array sizes.
o The code parser for FreeBASIC has been enhanced to include datatypes and array sizes.
o Included RADebug addin. It adds sourcecode debugging capabilities to masm, VC6 C/C++,
  FreePASCAL and FreeBASIC projects. See the RADebug.txt for more info.
o Added masmArray.api file. It contains constants often used to specify array sizes.
  Currently it only contains MAX_PATH and MAXIMUM_WAIT_OBJECTS.
o Updated masmType.api file to include the size of each data type.
o Added cppArray.api file. It contains constants often used to specify array sizes.
  Currently it only contains MAX_PATH and MAXIMUM_WAIT_OBJECTS.
o Updated cppType.api file to include the size of each data type.
o Updated fpType.api file to include the size of each data type.
o Updated fbType.api file to include the size of each data type.
o The size of the code complet list is now saved to the ini file.
o Fixed a minor bug in RAEdit. REM_GETCURSORWORD did not include the size of the
  line number bar.
o Fixed a minor bug in RAEdit. Bracematching caused wrong selection on EM_SCROLLCARET.

KetilO

EDIT:
2009.06.30 41 dl, New upload. All files are updated.
2009.07.07 36 dl. New upload. All files are updated
2009-07-16 23 dl, New upload. All files are updated
2009-08-14, 56 dl, Attachment deleted. RadASM 2.2.1.7 Released

KetilO

#1
NOTE!
Included in this post is what you need to debug VC6 C/C++, FreeBASIC and FreePASCAL projects.

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 and VC6.
- 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 Optional: Copy dbghelp.dll to RadASM root (C:\RadASM).
o Start RadASM and use Options/Addin Manager to activate addin.
  - Option to show DbgHelp output.
    NOTE! This option slows down debug startup considerably.
  - Option to show debug events.
  - Option to pin output window.
  - Option to by default show register window.

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

How to make (VC6 C/C++):
-----------------------------------------------------------------------------
o Compile 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 if the option is enabled.
    Output window #2 will show registers.
    Output window #3 is the immediate window.
  - 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 end 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.7 or higher.

Immediate window (Output window #3):
-----------------------------------------------------------------------------
NOTE!
Commands ,registers, hex values and predefined datatypes are case insensitive.
Variables, datatypes and constants are case sensitive.
To inspect or change a proc parameter or local variable the variable must
be in the current scope.

o Simple math.
  - Functions: +, -, *, /, SHL, SHR, AND, OR, XOR, ADDR() and SIZEOF().
  - An expression can contain any register, variable, datatype or constant.
  - Example: ?((((eax+1) SHL 2)*4) AND 0FFFFh)+MAX_PATH
  - Example: Memdump Addr(MyArray),Sizeof(MyArray),DWORD
o Inspect variable, register, datatype, constant or a hex / dec value.
  - ?MyVar to show info about a variable local or parameter.
  - ?MyVar(inx) to show an array element. Index is zero based and single
    dimension. (inx) can be any expression.
  - ?Z:MyZString to show a ZString. Use Z:MyZString(inx) to start
    at an offset. (inx) can be any expression.
  - ?S:MyString to show a String.
  - ?reg To show a register (reg: eax, ebx ...).
  - ?123 or ?0A5Fh to convert a number to hex and decimal.
o Change variable or register.
  - MyVar=ebx+2 to change the variable MyVar.
  - reg=4AB0h to change a register (reg: eax, ebx ...).
o Commands.
  - Help, /H or /?
    Shows this help screen.
  - Dump
    Shows a hex dump of the exe.
  - Dump Var[,Size]
    Shows a hex dump of an array, structure or union.
    Size is optional and can be BYTE, WORD, DWORD or QWORD.
  - Memdump Address,Count[,Size]
    Shows a memory dump. Address and Count can be any expression.
    Size is optional and can be BYTE, WORD, DWORD or QWORD.
  - Vars
    Shows a list of all variables.
  - Types
    Show a list of all datatypes and constants.
  - Watch var1,Z:MyZStr,....,var8
    Adds a watch to specified variables.
    To clear the watch list, type Watch without any variable list.
  - Cls
    Clears the immediate window.

Whats new:
-----------------------------------------------------------------------------
o Released version 1.0.0.5
  - Added ?S:MyString command to immediate window to show strings.
  - Added support for FreeBASIC.
  - Added support for multi dimension arrays.
o Released version 1.0.0.4
  - Fixed bug with showing local ZString.
  - Added support for FreePASCAL.
o Released version 1.0.0.3
  - Improved array size calculations.
  - The line numbers array is now sorted.
    This adds suport for multimodule projects.
  - Fixed a bug in the linenumbers seach algo.
    The bug could cause the debugger to freeze.
  - Added support for VC6 C/C++.
o Released version 1.0.0.2
  - Added option to show debug events.
  - Added option to pin output window.
  - Added option to by default show register window.
  - Added tooltip to show a local variables value when mouse is over a local.
    The local must be in current scope.
  - Added tooltip to show a proc parameters value when mouse is over a parameter.
    The parameter must be in current scope.
  - Added immediate window (output window #3).
  - Fixed bugs.
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 Support for other assemblers / compilers besides masm and VC6.

Known bugs:
-----------------------------------------------------------------------------
o In multimodule projects global variables can have the same name.
  Currently the debugger can not distinguish between them.
o 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

Edit:
Attachment deleted. RadASM 2.2.1.7 Released

KetilO

#2
Here is what you need to debug VC6 C/C++ projects.
NOTE!
You also need to get the files from the first post.

KetilO

EDIT:
Deleted attachment. See 2'nd post in this thread.

ramguru

You sure have lots of motivation with this .. next to no feedback  :U

fearless

Good stuff, although i couldnt figure out using ?Z:MyZString. Do you have to place a number in the place of Z, like '?1:MyDataBuffer'
ƒearless

KetilO

Hi ramguru

Feedback is nice and helpful, but it is not the source of my motivation.
Lerning and creating a useful tool for myself is my motivation.

KetilO

KetilO

Hi fearless

Some examples might explain:

Global ZString:

.data
szTest db 'Test',0

And you should get this:
>?z:szTest
GLOBAL szTest[5]:BYTE Address 00404008h Size 1 ZString "Test"

Local ZString:

MyProc1 proc uses esi edi,var:DWORD
  LOCAL  buffer[256]:BYTE

  invoke lstrcpy,addr buffer,addr szTest
  ret

MyProc1 endp

And you get this:
>?z:buffer
LOCAL buffer[256]:BYTE Address 0012FE80h Size 1 ZString ""

Obviously a bug.
An alternative is to use memdump until the bug is fixed:
>memdump addr(buffer),sizeof(buffer)
0012FE80 54 65 73 74 00 00 00 00-00 00 00 00 00 00 00 00 Test............
0012FE90 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................

KetilO

fearless

ƒearless

KetilO

#8
Hi all

New upload.

RADebug version 1.0.0.4
-----------------------------------
  - Fixed bug with showing local ZString.
  - Added support for FreePASCAL.

Included here is what you need to debug FreePASCAL projects.
NOTE!
You also need to get the files from the first post.

KetilO

EDIT:
Deleted attachment. See 2'nd post in this thread.

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

BogdanOntanu

Thank you for your great work on RadASM ;)

One minimal request:
- If possible please add an option in the ini file to setup the default width of the code completion Listbox.

I have in my programs very long procedure names and because of this the listbox only shows the start of the procedure name and sometimes the prefix is the same and I can not guess what function to choose :D

For example:
Encode_SSE_Mem_Br_Xmm_64
Encode_SSE_Mem_Br_Xmm_32
Encode_SSE_Mem_Br_Xmm_16

And I can not see the 64/32/16 suffix in order to choose.



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

KetilO

Hi BogdanOntanu

Did you know that you can size the list by using the mouse?
It will then keep its new size during the session.

In next upload it will save its size to the ini file.

KetilO

BogdanOntanu

Quote from: KetilO on July 07, 2009, 10:12:24 PM
Did you know that you can size the list by using the mouse?

No I did not know. Mea culpa... Thank you for the info!
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

KetilO

Hi all

New upload.

Whats new:
-----------------------------------------------------------------------------
o Released version 1.0.0.5
  - Added ?S:MyString command to immediate window to show strings.
  - Added support for FreeBASIC.
  - Added support for multi dimension arrays.

KetilO

S_Alex

QuoteOutput window *1 will show some debug info if the option is enabled.
    Output window *2 will show registers.
    Output window *3 is the immediate window.
At viewing one of them vanishes keys of sampling Output window.
How to be switched between them using the keyboard?