xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

AltD()

Activates and/or invokes the "classic" debugger.

Syntax

AltD( [<nAction>] ) --> NIL

Arguments

<nAction>
If no parameter is passed, the debugger is invoked, when it is activated. Passing numeric 1 activates the debugger and numeric zero deactivates it.

Return

The return value is always NIL.

Description

Function AltD() toggles the activity of the "classic" debugger which runs in text mode only. To activate the debugger, AltD(1) must be called in a program. A subsequent call to AltD() with no parameter invokes the debugger and displays the PRG source code file with the current line being executed. A programmer can then inspect variables or execute a program step by step. Calling AltD(0) disables the debugger.

When the debugger is activated, the key combination Alt+D invokes the debugger as well. This way, a program can run until a certain situation is reached that must be debugged.

Info

See also:Set()
Category: Debug functions
Source:debug\dbgaltd.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates how to invoke the "classic" debugger.
// To run the example, create the executable with "classic" debug
// information or call xbuild on the command line:
//
// --> xbuild -B -CLASSIC test.prg

   PROCEDURE Main
      LOCAL dDate := Date()
      LOCAL nKey

      AltD(1)                // activates debugger
      AltD()                 // invokes debugger unconditionally

      ? "Today is:", dDate

      IF Day( dDate ) == 1
         AltD()              // invokes debugger conditionally
      ENDIF

      nKey := Inkey(0)       // debugger is invoked by pressing Alt+D

      ? "Last key:", nKey
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe