TDbg - FiveWin Debugger
Fuente: source/classes/fwdbg.prg
Standalone class
TDbg is a full-featured source-level debugger for FiveWin applications. It provides a graphical debug window (oDlg) containing up to nine XBrowse panels for inspecting source code, call stack, local/private variables, arrays, objects, breakpoints, work areas, SET commands, and profiler data. The debugger is activated by compiling with #pragma /b+ or passing the /b command-line flag.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
oDlg | TDialog | The debugger dialog window |
oBrw | TXBrowse | Array or object for 9 browse panels (source, stack, vars, arrays, objects, breakpoints, areas, SETs, profiler) |
aStack | Array | Current call stack entries |
aModules | Array | Loaded source modules |
aBreak | Array | Breakpoint definitions |
aTrace | Array | Trace log entries |
Methods
| Method | Description |
|---|---|
New() | Create the debugger instance |
Activate() | Open and display the debugger dialog window |
Exec() | Execute the debugger main loop |
DbgNext() | Step to the next source line |
DbgGo() | Continue execution until the next breakpoint |
DbgNextRoutine() | Step over (execute subroutine calls without stepping into them) |
DbgSetBreak( cMod, nLine ) | Set a breakpoint at a specific module and line |
DbgSetTrace( lOn ) | Enable or disable trace logging |
DbgEditVar( cVarName ) | Open an editor to modify a variable's value |
DbgEditObj( oObj ) | Open an object inspector for a given object |
Example: Debug Session
// Add this pragma to modules you want to debug:
#pragma /b+
#include "FiveWin.ch"
function Main()
local cName := "FiveWin"
local nCount := 0
// The debugger opens automatically when the program
// is compiled with /b+ and FWDbg.lib is linked.
// Use F5 to continue, F8 to step, F9 for breakpoints
for nCount := 1 to 5
? "Iteration:", nCount
ProcessItem( cName )
next
return nil
function ProcessItem( cItem )
? "Processing:", cItem
return nil
Notes
- To enable debugging, add
#pragma /b+at the top of each source module you want to debug, and linkFWDbg.lib(or ensure it is part of your FWH library set). - The debugger can also be triggered at runtime by passing the
/bflag on the command line when launching your application. - The nine browser panels display: source code (with current-line highlight), call stack, local/private variables, arrays, objects, breakpoints, database work areas, SET command states, and profiler statistics.
- Written by Carles Aubia.