__mvDbgInfo()

Template

Function

Name

__mvDbgInfo()

Category

API

Subcategory

Internal

Oneliner

This function returns the information about the variables for debugger

Syntax

      __mvDbgInfo( <nScope> [, <nPosition> [, @<cVarName>] ] )

Arguments

<nScope> = the scope of variables for which an information is asked Supported values (defined in hbmemvar.ch) HB_MV_PUBLIC HB_MV_PRIVATE (or any other value) <nPosition> = the position of asked variable on the list of variables with specified scope – it should start from position 1 <cVarName> = the value is filled with a variable name if passed by reference and <nPosition> is specified

Returns

The return value depends on the number of arguments passed

Description

This function retrieves the information about memvar variables. It returns either the number of variables with given scope (when the first argument is passed only) or a value of variable identified by its position in the variables’ list (when second argument is passed). It also returns the name of a variable if optional third argument is passed by reference.

If requested variable doesn’t exist (requested position is greater then the number of defined variables) then NIL value is returned and variable name is set to “?”

The dynamic symbols table is used to find a PUBLIC variable then the PUBLIC variables are always sorted alphabetically. The PRIVATE variables are sorted in the creation order.

Note:

Due to dynamic nature of memvar variables there is no guarantee that successive calls to retrieve the value of <Nth> PUBLIC variable will return the value of the same variable.

Examples

      #include "hbmemvar.ch"

      PROCEDURE Main()

         LOCAL nCount, i, xValue, cName

         nCount := __mvDbgInfo( HB_MV_PUBLIC )
         FOR i := 1 TO nCount
            xValue := __mvDbgInfo( HB_MV_PUBLIC, i, @cName )
            ? i, cName, xValue
         NEXT

         //

         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         PUBLIC cPublic := "cPublic in MAIN"

         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         PRIVATE cPrivate := "cPrivate in MAIN"

         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         CountMemvars()

         ? "Back in Main"
         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         RETURN

      PROCEDURE CountMemvars()
         LOCAL i, nCnt, xVal, cName
         PUBLIC ccPublic := "ccPublic"
         PRIVATE ccPrivate := "ccPrivate"

         ? "In CountMemvars"
         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         PRIVATE cPublic := "cPublic"

         ? "PUBLIC=", __mvDbgInfo( HB_MV_PUBLIC )
         ? "PRIVATE=", __mvDbgInfo( HB_MV_PRIVATE )

         nCnt := __mvDbgInfo( HB_MV_PRIVATE ) + 1
         FOR i := 1 TO nCnt
            xVal := __mvDbgInfo( HB_MV_PRIVATE, i, @cName )
            ? i, "=", cName, xVal
         NEXT

         nCnt := __mvDbgInfo( HB_MV_PUBLIC ) + 1
         FOR i := 1 TO nCnt
            xVal := __mvDbgInfo( HB_MV_PUBLIC, i, @cName )
            ? i, "=", cName, xVal
         NEXT

         RETURN

Compliance

This function should be called from the debugger only.

Files

Library is core

What a preprocessor is ?

What a preprocessor is, how will operate, and what benefits it will offer ?

Let’s Look at Clipper 5.0’s preprocessor

C5 Preprocessor

What a preprocessor is, how will operate, and what benefits  it will offer ?

Clipper 5.0’s Preprocessor

Debugger Terms

Active Window :

The window to which all keystrokes (except those valid in the Command Window) apply. An active window is indicated by a highlighted border. The Tab and Shift-Tab keys are used to select the next and previous window, respectively.

Animate Mode :

The mode of execution in which an application runs one line at a time until a Breakpoint or Tracepoint is reached, with the Execution Bar moving to each line as it is executed.

Breakpoint :

A point at which an application pauses execution and returns control to the debugger.

Callstack  :

A list containing the names of all pending activations at the current point in an application.

Callstack Window :

The window in which the Callstack is displayed.

Code Window :

The window in which source code is displayed.

Command Window :

The window in which commands are displayed and entered.

Cursor :

The cursor indicates the current line and/or column position in the active window or dialog box. Note that some windows, such as the Monitor Window, do not utilize the cursor. When a window that does not utilize the cursor is active, the cursor appears in the Code Window.

See Also: Highlight, Input Focus

Debugger :

A tool used to track down errors in a program.

Dialog Box :

A box displayed from within the debugger whenever further input is required.

Execution Bar :

The highlight bar which is positioned on the line of code to be executed next.

Help Window :

The window in which online help is displayed.

Inspecting :

The process of examining work areas, variables, expressions and activations inside the debugger.

Menu Bar :

The bar at the top of the debugger screen, on which the available menu choices are displayed.

Monitor Window :

The window in which monitored variables are displayed.

Monitored Variable :

A variable which is selected by the options on the Monitor Menu and displayed in the Monitor Window.

Run Mode :

The mode of execution in which an application executes without pausing, until a Breakpoint or Tracepoint is reached.

Script File :

A file in which frequently used debugger commands are stored and from which those commands can be executed.

Set Colors Window :

The window in which the Debugger color settings can be inspected.

Single Step Mode :

The mode of execution in which only the line of code highlighted by the Execution Bar is executed, and its output displayed.

Trace Mode :

A mode of execution similar to Single Step Mode, the difference being that Trace Mode traces over function and procedure calls.

Tracepoint :

A variable or expression whose value is displayed in the Watch Window, and which causes an application to pause whenever that value changes.

View Sets Window :

The window in which Clipper language status settings can be inspected.

View Workareas Window :

The window in which work area information is displayed.

Watch Window :

The window in which Watchpoints and Tracepoints are displayed.

Watchpoint :

A variable or expression whose value is displayed in the Watch Window and updated as an application executes.