Super Prev Next

Using the dialog mode


Super Prev Next

Introduction

XD is a text mode application and usually operates in a windowed OS/2 session or in a Win32 console window. It may also be started in fullscreen mode. In the following text, screen refers to either fullscreen or windowed session or console containing XD.

The different types of information displayed by the debugger are collected in separate windows. There are five kinds of windows in XD:

The top line of XD screen is occupied by the Main menu, which provides access to other menus. The rest of the screen is shared by the Program window and information windows. All those windows are overlapped and may be freely moved, resized, and placed above or beneath each other.

The Program window contains the source text and/or the disassembled code of the program being debugged (the debuggee). It is frameless and may not be closed or hidden.

Information windows are used to display various data about the current state of the debuggee, such as watch expressions, CPU registers, call stack, etc. They have frames and may be displayed, hidden, or closed at any time.

A dialog is a window which pops up when XD prompts you for an information it needs to complete a requested action, such as a name of a variable to examine, or an expression to watch. Dialog windows are modal: another window may not be activated while the dialog is displayed and you have to explicitly confirm or cancel the action you requested.

The debugger displays error, warning, and informational messages in message boxes. They are similar to dialogs, but the only action you may perform when a message box is displayed is to close it.


Super Prev Next

Using menus and shortcuts

To select an item from the Main menu, do one of the following:

This will cause one of the pulldown menus to be displayed. To select an item from a pulldown menu, do one of the following:

Finally, there are pop-up menus available in most information windows. To activate a pop-up menu, click an information window with the right mouse button or press Ctrl+F10. Then select an item as in a pulldown menu.

The most often used menu commands have shortcuts - key combinations which may be used to activate a menu command without selecting it from a menu. Shortcuts are shown to the right of menu items.


Super Prev Next

Using information windows

Most information windows contains lists of items, such as global variables or watch expressions. When a window becomes current, a cursor is displayed over one of its items. The following keys may be used to move the cursor:

Left/Right
scroll window contents horizontally
Up/Down
move the cursor one line up/down
PgUp/PgDn
move the cursor one page up/down
Ctrl+PgUp/PgDn
move the cursor to the first/last item of the list
Ctrl+Home/End
move the cursor to the top/bottom of the window

An item may also be selected by clicking it with the left or right mouse button. In the latter case, a pop-up menu will also be displayed.

Information windows which contain lists of program entities, for instance, a list of all modules or a list of local variables provide locators for quick cursor positioning.

To move the cursor to a certain item, start typing item's name on the keyboard. The characters you type will appear on the bottom line of a window frame (the locator), and the cursor will position on the first item which name begins with those characters. You may use the Tab key to quickly expand the current value of a locator.

Once the cursor appears near the desired item, you may use arrow keys again to complete positioning. Character case is ignored during search, and case of characters in a locator always match the currently selected item.


Super Prev Next

Using dialogs

A dialog is a modal window which pops up when you initiate a certain action which requires parameters, such as variable name or address.

XD dialogs behave very similar to OS/2 Presentation Manager and Windows dialogs.


Super Prev Next

Managing windows

At any moment during a debugging session, there is exaclty one window which accepts user input - the current window. It is the topmost and is displayed with a double frame instead of a singleThe frameless Program window is marked as current by changing its header colour..

To select a window to become current, click it or press Ctrl+Tab to cycle through windows. You may also select a window from the Windows menu, which always contains a list of all open windows. You may need to scroll it if there are too many windows open.

To move or resize the current window using the keyboard, press Ctrl+W. A bold frame will be drawn around the window. Use arrow keys to move the window. Holding down Ctrl while pressing arrow keys will force the window to change its size instead of position. To leave the move/resize mode, press Ctrl+W or Enter.

With the mouse, drag the top border of a window to move it or drag any other border or a corner to resize.

To close the current window, press Ctrl+F4 or click the [x] sign in its top right corner. It is also possible to close a window by selecting it in the Windows menu using arrow keys and pressing Del. The Program window may not be closed.


Super Prev Next

Refreshing the screen

If there is any garbage on XD screen, press Ctrl+E or select Refresh screen from the File menu to have all windows repainted.


Super Prev Next

Viewing batch mode output

If the debugger was invoked in the batch mode and then switched to the dialog mode with the help of the DIALOG command, you may wish to look at the last lines of the log. To do this, press "/" or select Show output from the File menu.


Super Prev Next

Smart session select

Your program is likely to require user interaction. It would be convenient to have the session in which it is executed automatically brought to foreground (selected) during execution, and XD session to be selected whenever the program is stopped. However, in case of step execution modes usage that would cause undesirable flickering.

XD uses a bit smarter approach: after resuming the debuggee execution, it waits for a small amount of time before selecting the debuggee session. If control returns to the debugger prior to timeout, its session remains selected. The Delay to select debuggee option allows you to adjust the timeout period.

When your program is stopped, you may temporarily bring it to foreground by pressing "\" or by selecting Show debuggee from the File menu. After a timeout, the XD session will be automatically selected again. A timeout does not occur if you select the debuggee using an operating system mechanism.


Super Prev Next

Files used by XD

The following files are used by the debugger:

xd.red redirection file
xd.cfg default session settings
xd.hlp on-line help
xd.msg debugger messages
*.ses session settings

The debugger uses a redirection file to search for all other files the same way the compiler does, except that source files are searched via redirection only if the Strip path from source name option is switched ON.

The xd.cfg, xd.hlp, and xd.msg files, if not found via redirection, are expected to be found in the directory in which XD executable file, xd.exe, resides. The xd.msg file is essential; the debugger will display an error message and terminate if it fails to locate it on startup.

The configuration file contains default values of options, window sizes, positions, and colors.

Upon termination of a dialog debugging session, the debugger stores its settings in a session file, provided that the Save debug session layout option is set ON. A session file name matches the debugged executable name, and has the extension .ses. Next time you debug that executable, XD will restore option values and window layout from the session file.

Watch expressions, if any, are also saved in session files.


Super Prev Next

Loading a program

To have a program which you want to debug automatically loaded when you invoke the debugger, pass its executable name and optional arguments on XD command line (see Starting XD). If you do not provide this information, XD will display the Load Program dialog upon startup.

To load a program via the Load Program dialog:

  1. Type the name of the executable in the Program name entry field or select the Browse button to select it using a file dialog.
  2. If you want any command line arguments to be passed to the debuggee, type them in the Arguments entry field.
  3. Select the OK pushbutton or press Enter.

If you decided not to load a program, select the Cancel pushbutton or press Esc.

To load another program during a debugging session, select Load Program from the File menu or press F3.


Super Prev Next

Navigating through your program

XD displays the program you are debugging in the Program window. This window is automatically opened upon program load and remains on the screen until you finish the debugging session.

The Program window is frameless. The top line is a header in which information about the current position in the code is displayed. The two leftmost columns are reserved for breakpoint marks and are not scrolled horizontally. The remaining area of the window is used to display the program source and/or the disassembled code.


Super Prev Next

Cursors

The Program window contains two cursors, displayed in different colors.

When the debuggee is stopped, the execution cursor is positioned over the line or instruction about to be executed. It may not be moved manually.

The user cursor is intended for navigation. You may freely move it through the source text or code, which is scrolled, if neccessary, so that the user cursor always stays visible. It is also used to specify a breakpoint position. See Using breakpoints and breaks for more information.

When the two cursors coincide, only the execution cursor is displayed. The user cursor is moved to the position of the execution cursor when the debuggee execution is interrupted, for instance, when a step command is executed or a breakpoint is hit. You may also quickly move the user cursor to the position of the execution cursor by pressing Ctrl+Home or selecting Home from the Search menu.


Super Prev Next

View modes

The Program window supports three view modes: Source, Disassembly, and Mixed.

In the Source mode, the Program window contains source code of one of the modules which constitute your program. Its name is displayed in the header along with the number of the source line currently selected by the user cursor.

Two different colors are used to display executable and non-executable lines, unless the Code highlight option is set to No. When the user cursor is positioned over an executable line, a corresponding address and a procedure name are displayed in the window header.

In the Disassembly mode, the code of your program is displayed as assembly instructions. A name of a procedure to which the instruction under the user cursor belongs and offset of this instruction from the procedure's entry point are shown in the window header. In this mode, you may scroll through the entire code segment, while in two other modes module boundaries may not be crossed.

The Mixed mode is similar to the Disassembly mode, with addition that the correspondent source line is displayed above each chunk of disassembled code. The source lines, however, are treated as comments; the user cursor jumps over them as you move it, so it is not possible to step execute an entire line or set a breakpoint on it.

Note: In the Source and Mixed modes, only one of the program's modules is displayed in the Program window. Use the Modules window to display another module.

After loading a program, XD always enters the Source mode, unless there is no debug info at the execution point. If a source file can not be found, the window is filled with lines containing the corresponding message.

To toggle view modes, select a corresponding item from the Code menu, from the pop-up menu, or use the following shortcuts:

Alt+1
switch to the Source mode
Alt+2
switch to the Disassembly mode
Alt+3
switch to the Mixed (source+disassembly) mode


Super Prev Next

Moving around in the Program window

The following keys move the user cursor through the contents of the Program window:

Left/Right
scroll window contents horizontally
Up/Down
move the user cursor one line up/down
PgUp/PgDn
move the user cursor one page up/down
Ctrl+PgUp/PgDn
move the user cursor to the top/bottom of the current module
Ctrl+Home/End
move the user cursor to the top/bottom of the window
Home/End
show the current line beginning/end
Ctrl+Up/Down
move the user cursor to the previous/next procedure in the current module
Ctrl+H
move the user cursor to the execution cursor position
Ctrl+G
move the user cursor to a source line by its number
Ctrl+A
move the user cursor to a certain address
Ctrl+F
find a string
Ctrl+N
repeat last find

Some of the key combinations listed above are shortcuts for the Search menu commands.

In addition, the following information windows may help you to quickly move to certain points in the code:

Window May be used to
Modules display another module
Procedures display a procedure in the current module
Publics display a public procedure
Call Stack display a call chain element
Breaks display code where a breakpoint is set
Components switch to another component
Threads switch to another thread


Super Prev Next

The Search menu

The Search menu commands may be used to quickly move to certain positions in windows. Most of them are available in the Program window only.

Find

Searches for a string in the currently displayed source module. Shortcut: Ctrl+F
Find next

Finds the nexts occurence of a string. Shortcut: Ctrl+N
Find prev

Finds the previous occurence of a string.
Next procedure

Moves the user cursor to the beginning of the next procedure. Shortcut: Ctrl+Down
Prev. procedure

Moves the user cursor to the beginning of the previous procedure. Shortcut: Ctrl+Up
Goto line

Moves the user cursor to a given line in the displayed module. Shortcut: Ctrl+G
Home

Moves the user cursor to the current execution cursor position. Shortcut: Alt+Home
Goto address

Moves the user cursor to a certain address. Shortcut: Ctrl+A


Super Prev Next

The Components window

In the Components window, the debugger displays the list of executable components (EXE and DLLs) of your program. It can be opened by selecting Components from the Code menu.

When your program is first loaded into the debugger, its EXE file becomes the current component. To choose another component, double-click it in the Components window, or select it and press Enter.

The Components window contains two marks similar to cursors: one for the currently displayed component and another for the component in which debuggee execution stopped.

Use the pop-up menu to toggle display of full paths to components on or off.


Super Prev Next

The Modules window

The Modules window contains the list of modules which constitute the current component. To open it, select Modules from the Code menu or press Ctrl+M. To display another module in the Program window, double-click its name, select it using arrow keys and press Enter, or select Show code from the pop-up menu.

By default, only modules for which debug information is available are displayed. Switch the Show all modules option ON or select Show all from the pop-up menu to display all modules.

The module that is currently displayed in the Program window and the module that contains the instruction pointer have marks in the first column. The color of each mark matches the color of the respective cursor.

To display global variables of a particular module in a separate window (see The Module variables window), press Ctrl+V or select Show variables from the pop-up menu.


Super Prev Next

The Procedures window

All procedures of the current module are listed in the Procedures window, which may be opened by selecting Procedures from the Code menu or by pressing Ctrl+L. To position the user cursor on a procedure, double-click its name or select it using arrow keys and press Enter.


Super Prev Next

The Publics window

The Publics window contains all public names belonging to your program's code. Double-clicking or pressing Enter on a name causes the correspondent source or disassembled code to be displayed in the Program window.


Super Prev Next

Executing your program

The debugger provides different methods to execute your program. You may use the continuous execution commands to quickly move the execution point to a certain position in the code, to watch execution flow, or to wait for an event, such as variable access. The step commands allow you to monitor your program execution.

If the Program window is in the Source mode, step commands are performed in terms of source lines, otherwise --- in terms of CPU instructions.

Note: Execution of your program may be interrupted earlier than implied by the command used to initiate it:

You may also explicitly interrupt your program and have control returned to XD.

The execution commands are collected in the Run menu:

Run

Start or resume program execution at full speed.
Execution trace

Start or resume line-by-line program execution.
Step into

Execute a single source or assembly line, stepping into a procedure call, if there is one.
Step over

Execute a single source or assembly line without stepping into procedure calls.
Step out

Execute until return from the current procedure.
Run to cursor

Execute until the current user cursor position is reached.
Run to epilogue

Execute until the current procedure's stack cleanup code.
Run until address

Execute until a given address is reached.
Restart

Restart the debuggee and stop at the main module body.
Restart at startup

Restart the debuggee and stop at the very beginning - the startup code.
Restart at entry point

Restart the debuggee and stop at the entry point.


Super Prev Next

Run

The Run command resumes execution of your program from the current position at full speed, provided that no condition breaks are installed and enabled.

Shortcut key: F5


Super Prev Next

Execution Trace

The Execution trace command executes the debuggee line by line or instruction by instruction, moving the execution cursor and updating all information windows after each step. This enables you to watch control and data flow. Execution continues until you press Esc and may also be interrupted by a breakpoint or a break.

You may control whether code, for which no debug information is available, is to be traced, by setting the Never fall into disassembler option.

The Delay in execution trace option allows you to specify a delay taken before execution of each line or instruction.

Shortcut key: Ctrl+F5


Super Prev Next

Step into

The Step into command executes the current line or instruction. If it contains a procedure call, execution stops at the first line or instruction of a called procedure.

The Never fall into disassembler option controls whether procedures for which no debug infomation is available are traced or executed in one step.

Shortcut key: F7


Super Prev Next

Step over

The Step over command executes the current line or instruction. If it contains any procedure calls, they are executed at once, unless a breakpoint is encountered or a break is activated.

Shortcut keys: Ctrl+F7, Space


Super Prev Next

Step out

The Step out command places a temporary breakpoint right after the call instruction which called the current procedure, and then resumes execution. If no other breakpoints or breaks are encountered, the debuggee will be executed until the current procedure finishes, and then control will be returned back to the debugger. You may use this command if you accidentally issued the Step into command instead of Step over.

Shortcut key: Ctrl+F6


Super Prev Next

Run to cursor

The Run to cursor command installs a temporary breakpoint at the current position of the user cursor, which has to be on an executable line, and then resumes execution of the debuggee. So execution will stop at that line, provided that no other breakpoints or breaks are encountered, no exception is raised and the debuggee is not terminated.

Shortcut key: F4


Super Prev Next

Run to epilogue

The Run to epilogue command executes the debuggee until the epilogue of the current procedure is reached. This allows you to examine its local variables just before the procedure returns.

This command is available only for procedures with debug information.


Super Prev Next

Run until address

The Run until address command installs a temporary breakpoint at an address you specify and then resumes execution of your program.

Warning: Do not use this command unless you know for sure that there is an instruction starting at that address, otherwise you will corrupt the code and execution will not stop.


Super Prev Next

Restart

The Restart command reloads the debuggee and exectues it up to the beginning of the main module body. All breakpoints, breaks, and watches are retained.

Note: Your program may load DLLs at run-time, which will be unavailable after restart. If there were any breakpoints set in that DLLs, they will be disabled and a warning message will be displayed.

Shortcut key: Ctrl+X


Super Prev Next

Restart at startup

The Restart at startup command is similar to the Restart command except that no debuggee instructions are executed after restart. This allows you to debug DLL statrup code.


Super Prev Next

Restart at entry point

The Restart at entry point command is similar to the Restart command except the debuggee is stopped at the EXE component's entry point, when all load-time DLLs are loaded and intialized.


Super Prev Next

The Call Stack window

The Call Stack window can be displayed by selecting the correspondent item from the Code menu. It contains the names of the procedures which formed the call chain that led to the current position in the code. The current procedure is the topmost in the window.

To have a certain procedure displayed in the Program window, double click its name, or select it using arrow keys and press Enter. A mark will appear in front of that procedure name in the Call Stack window, and the Local variables window, if open, will display local variables an parameters of that procedure.

Note: In some cases, the debugger may be unable to correctly trace back the call chain, so the Call Stack window may contain some garbage entries. Turn the GENFRAME compiler option ON to improve stack tracing accuracy.


Super Prev Next

The Threads window

The Threads window displays information about all threads started by the debuggee. It can be opened by selecting Threads from the Code menu.

One of the threads is marked as current. When the debuggee is stopped, you may switch to another thread by double-clicking it or selecting with arrow keys and pressing Enter.


Super Prev Next

Using breakpoints and breaks

A breakpoint is a mark in the debuggee's code which, once encountered (hit) during execution, causes it to stop and control to be trasferred to the debugger. The source line or instruction on which the hit breakpoint is set is not executed.

A break is a condition which is constantly checked during execution. Once it evaluates to true, the debuggee is immediately stopped.

The major difference between breakpoints and breaks is that a breakpoint is bound to a particular source line or instruction, while a break is activated regardless of the current execution point. Using breakpoints, you may transfer control to the debugger when a certain code is about to be executed. Using breaks, you may force the debuggee to be stopped right after a particular event, such as modification of a specific variable, happens in it.

To set a breakpoint, move the user cursor to the desired line or instruction, and select an appropriate command from the Breaks menu (or press a shortcut key). Note that optimizations may cause strange effects during debugging, for instance, some lines containing statements may be displayed as unexecutable. See General considerations for more information.

Note: Your program may load and unload DLLs at run-time. If there were any breakpoints set in such a DLL, and your program unloads it, the breakpoints are disabled and a warning message is displayed. The same happens in the case of a restart.

For historical reasons, XD supports only seven types of breakpoints which may not be combined together. This issue will be addressed in future releases.

To set a break, select an appropriate command from the Breaks menu (or press a shortcut key). Access breaks may also be set from pop-up menus in some of the windows.

The commands related to breakpoints and breaks are collected in the Breaks menu:

Sticky breakpoint

Set a sticky breakpoint at the current user cursor position.
Breakpoint

Set an automatically removable breakpoint.
Delayed sticky breakpoint

Set a sticky breakpoint with a countdown of hits.
Delayed breakpoint

Set a removable breakpoint with a countdown.
Expression breakpoint

Set a sticky breakpoint which triggers when a given expression is true.
Pass counter

Set a sticky breakpoint which only counts number of hits.
Watchpoint

Set a sticky breakpoint which automatically resumes execution.
Access break

Define an access break.
Condition break

Define a condition break.
Disable

Disable the breakpoint at the current user cursor position.
Enable

Enable a previously disabled breakpoint.
Delete

Remove the breakpoint at the current user cursor postiion.
View all breaks

Display the Breaks window.
Disable all breaks

Disable all breaks and breakpoints.
Enable all breaks

Enable all breaks and breakpoints.
Erase all breaks

Remove all breaks and breakpoints.


Super Prev Next

Sticky breakpoint

The Sticky breakpoint command sets a breakpoint at the line or instrution pointed to by the user cursor. It is called "sticky" because it is not removed when hit, unlike a simple breakpoint.

The ? symbol is displayed in the mark column for breakpoints in this type.

Shortcut key: F9


Super Prev Next

Breakpoint

The Breakpoint command sets a simple breakpoint which is automatically removed when it is hit.

The ? symbol in the mark column indicates a simple breakpoint.

Shortcut key: F8


Super Prev Next

Delayed sticky breakpoints

The Delayed sticky breakpoint command sets a sticky breakpoint which stops the debuggee only after the specified number of hits. This is very useful for debugging loops.

When you select this command, a dialog window is displayed, prompting you for an initial countdown value. Type the number of passes you wish the breakpoint to skip and press Enter.

In a typical debug scenario a delayed breakpoint is used in conjunction with a counter: you first use a counter to determine how many times a particular line has been executed before crash, then establish a delayed breakpoint at that line so that your program will be stopped on the last iteration before crash, and then restart your program. So if there is already a counter established at the current line/address, the initial countdown value in the dialog will be automatically set to the current value of the counter decremented by 1.

When the countdown reaches zero, the breakpoint turns into a regular sticky breakpoint.

For a delayed sticky breakpoint, XD displays the remaining number of passes (or the * symbol if it exceeds 9) and the ? symbol in the mark column.

Shortcut key: Ctrl+F9


Super Prev Next

Delayed breakpoint

The Delayed breakpoint command sets a delayed breakpoint which is automatically removed after final hit. See Delayed sticky breakpoints for more infomation about usage of delayed breakpoints.

A digit equal to the number of passes left (or the * symbol), followed by the ? symbol, is displayed in the mark column for a delayed breakpoint.

Shortcut key: Ctrl+F8


Super Prev Next

Expression breakpoint

The Expression breakpoint command installs a sticky breakpoint and associates a boolean expression with it. The expression is evaluated each time the breakpoint is hit, and execution is stopped only if the result is TRUE.

When the user cursor is positioned over a line containing an expression breakpoint, the associated expression is shown in the Program window header.

A question mark ("?") in the mark column indicates an expession breakpoint.

Shortcut key: Alt+F9


Super Prev Next

Pass counter

The Pass counter command establishes a sticky breakpoint which, however, does not cause execution to stop but just counts the number of hits. A pass counter initially has a value of zero which is incremented each time the line or instruction associated with it is executed.

Pass counters provide a method to determine how many times, if at all, a particular line or instruction is encountered during program execution. This information may be used, for instance, when setting delayed breakpoints.

When the user cursor is positioned over a pass counter, its value is shown in the Program window header. You may also use the Breaks window to examine pass counter values.

For a pass counter, its current value followed by the "." symbol is displayed in the mark column; values exceeding 9 are represented with the "*" symbol.

Shortcut key: .


Super Prev Next

Watchpoint

The Watchpoint command sets a sticky breakpoint, upon encountering which execution is resumed automatically. The effect is that all information windows are updated when a watchpoint is passed.

This approach is in many cases more efficient than execution trace in the sense that a program may be executed at full speed (for instance, using the Run command), and information about its current state will be updated at and only at the moments you specify.

The ? symbol in the mark column indicates a watchpoint.


Super Prev Next

Access break

The Access break command allows you to have execution of your program interrupted immediately after it accesses a certain block of memory.

Note: Since access breaks are implemented using CPU debug registers, they do not slow down execution of a debuggee, but also have certain restrictions:

When you activate this command, the Access break dialog is displayed. Select the desired access type and memory block length, type an address expression in the Location field, and select the OK pushbutton.

Note: If there are already four enabled access breaks, the new one will be created in disabled state and a warning message will be issued.

Shortcut key: Ins


Super Prev Next

Condition break

The Condition break command allows you to specify a boolean expression which will be constantly evaluated during execution of your program until it yields TRUE, causing execution to be stopped.

Note: if there is at least one enabled condition break, your program will be stopped after each CPU instruction, so its execution will slow down dramatically. Avoid using condition breaks whenever possible.


Super Prev Next

The Breaks window

The Breaks window contains a list of all breakpoints and breaks currently set. To display it, press Ctrl+B or select View all breaks from the Breaks menu.

For a breakpoint, the name of the corresponding module followed by the breakpoint mark and the source line is displayed. For an access break, access type and address range are displayed. Finally, for a conditional break, the associated expression is displayed.

Double-clicking or pressing Enter on a breakpoint moves the user cursor to the breakpoint position. You may also achieve this by selecting Go to from the pop-up menu.

Double-clicking or pressing Enter on a break displays a corrsponding dialog, allowing you to edit break parameters. The Modify command from the pop-up menu does the same.


Super Prev Next

Managing breaks and breakpoints

A break or breakpoint may be disabled at any time. A disabled breakpoint, once encountered, does not cause the debuggee to stop executing. The associated counter, if any, is not changed either. Marks corresponding to disabled breakpoints are displayed in different color.

To disable a breakpoint, move the user cursor to the line containing it or select it in the Breaks window and press "-" or select Disable from the Breaks menu. Press "+" or select Enable from the Breaks menu to re-enable a previously disabled breakpoint.

To delete a break or breakpoint, select it in the Program or Breaks window and press Del or select Delete from the Breaks menu.

You may disable, enable, or delete all breakpoints and breaks at once by selecting an appropriate item from the Breaks menu.


Super Prev Next

Examining your program data

The Data menu contains commands which open different kinds of information windows displaying the current state of your program's data: variables, stack, CPU registers, etc.:

Examine data

Display and/or modify value of a given variable, designator, or register.
Evaluate expression

Evaluate an expression.
Global variables

Display the Global variables window containing global variables of the current component.
Module variables

Display the automatic Module variables window containing global variables of the current module.
Local variables

Display the Local variables window containing local variables and parameters of a procedure
Memory dump

Open a new Dump window, displaying raw memory at a given address.
Registers

Display the Registers window containing CPU registers.
Float Registers

Display the Float Registers window containing FPU registers.
Stack

Display the Stack window, which contains memory at the stack pointer of the current thread.
Add watch

Add an expression to the Watches window.
Delete watch

Delete an item from the Watches window.
Show watch window

Display the Watches window.
Del all watches

Clears the Watches window.


Super Prev Next

Displaying and modifying values

The way a value of a variable or a watch expression is displayed depends on its type.

Values of elementary types immediately follow the correspondent variables and expressions in list windows. For variables of set and structured types (arrays and records), except character arrays, only type names are shown in list windows. Double-clicking or pressing Enter on such a variable causes a structured variable window to be displayed. Each line of those windows contains a single array element or record field.

Select Show address item from the pop-up menu of a structured variable window to toggle display of variable addresses in window headers on or off.

The Use single structure window option controls whether a new window is opened to display a structured variable element which, in turn, is of a structured or pointer type.

You may alter the display format of a particular element of data using the Type pop-up submenu. You may change radix for wholes, turn pointer dereference on/off, etc.

To modify a variable of a basic, range, or enumeration type displayed in a list window, double click it or select it using arrow keys and press Enter. Type a new value in a displayed dialog and press Enter or press Esc if you do not want to modify the current value.

Double-clicking or pressing Enter on a pointer variable or expression has the same effect as it would have on a pointed-to objectprovided that the pointer is not NIL.. Use the Ctrl+Enter key combination to modify value of a pointer variable itself.


Super Prev Next

Examine variable

The Examine variable command displays a dialog prompting you for a variable name. Type it and press Enter (in fact, you may type not just a variable name, but a designator, such as parr^[5].field). Depending on the type of an object denoted by the designator, either dialog containing the current value or structured variable view window will be displayed. See Displaying and modifying values for more information.

Shortcut key: ?


Super Prev Next

Evaluate expression

The Evaluate expression command allows you to evaluate an arbitrary expression using the current values of program objects. Type it in a displayed dialog and press Enter.

See also Displaying and modifying values.


Super Prev Next

The Global variables window

The Global variables window displays global variables of the current component, e.g. C extern variables. To open it, select Global variables from the Data menu.

See also Displaying and modifying values.


Super Prev Next

The Module variables window

The automatic Module variables window displays global variables of the module currently displayed in the Program window. To open it, select Module variables from the Data menu or press Ctrl+V.

To display global variables of a particular module in a separate window, select Show variables from the pop-up menu of the Modules window.

See also Displaying and modifying values.


Super Prev Next

The Local variables window

Select Local variables from the Data menu to open the Local variables window. That window displays parameters and local variables of the procedure currently selected in the Call Stack window. Name of that procedure is displayed in the window header.

A horizontal line separates parameters from locals. An exclamation mark is displayed in the first column for register variables.

If the selected procedure is nested, and the option DBGNESTEDPROC was set ON during complation of the module containing it, parameters and local variables of enclosing prodcures are also displayed in the Local variables window. Horizontal lines with procedure names are used as separators.

You may quickly traverse the call stack when the Local variables window is active. Press Ctrl+Down to display locals and parameters of the calling procedure, Ctrl+Up --- of the called procedure.

See also Displaying and modifying values.


Super Prev Next

Memory dump windows

You may use Memory dump windows to examine your program's code or data as raw memory. To open a dump window, press Ctrl+D or select Memory dump from the Data menu. A dialog will display, prompting you for a starting address. Type an address expression and press Enter.

If the current window contains a variable list or a structured variable and you are opening a dump window, the address of the currenly selected element will be substituted into the entry field.

Memory may be displayed in different formats. Select Type from the pop-up menu to switch between them.

To modify a dump element, double-click it, or select it using arrow keys and press Enter.

To change dump origin, click in the address column or select Change dump origin from the pop-up menu.

You can save a memory dump to file in text or raw form by selecting Save dump to file from the pop-up menu.


Super Prev Next

The Registers window

The Registers window displays names and values of the CPU registers. To open it, press Ctrl+R or select Registers from the Data menu.

Each time execution of a debuggee stops, register values which have been changed since previous stop are highlighted.

To modify a register value, double click it or select it with arrow keys and press Enter.


Super Prev Next

The Float Registers window

The Float Registers window displays names and values of the FPU registers. To open it, select Float Registers from the Data menu.

To modify a register value, double click it or select it with arrow keys and press Enter.


Super Prev Next

The Stack window

The Stack window displays stack of the current thread in raw form, starting from the current stack pointer position. It may be opened by selecting Stack from the Data menu.

You may change the format in which stack elements are displayed by selecting Type from the pop-up menu.

To change value of a stack element, double click it or select it with arrow keys and press Enter.


Super Prev Next

The Watches window

The Watches window contains arbitrary expressions along with their values. The expressions are re-evaluated in the current execution context each time the debuggee is stopped or program data is altered by the user. If an expression contains variables which are undefined or are not visible at the current execution point, an appropriate message is displayed instead of expression value.

Expression results are displayed according to their types. See Displaying and modifying values for more information.

Each time execution of a debuggee stops, expressions which results have changed since previous stop are highlighted.

To enter a new watch expression, select Add watch from the Data menu or press Ctrl+Ins. The Watches window will be automatically opened. To display it any time later, select Show watch window from the Data menu.

To delete a watch expression, select it and press Del or choose Del watch from the pop-up menu. To clear the Watches window, select Del all watches from the Data menu.


Super Prev Next

Saving scripts

When you find a suspicious place in your program, you may want to modify it slightly in order to prove or disprove your hypothesis. Then you will have to rebuild it and repeat the steps you took during the previous debugging session. You could save some time on the last stage by using the Save script command from the File menu before exitting the debugger. This command creates a control file that, if invoked, would restore all breakpoints, breaks, and watches currently set in the debugger.


Super Prev Next

Setting XD options

Selecting Options from the File menu causes an option sheet to be displayed. These options are used to control various aspects of XD behaviour in dialog mode.

Delay in execution trace

The delay in milliseconds used in Execution trace mode.
Exception raise on first chance

If this option is enabled, the debugger displays a dialog immediately after an exception is raised in the program, allowing you to examine its state.
Delay to select debuggee

Specifies delay in milliseconds before the debuggee session is selected (see Smart session select).
Never fall into disassembler

Check this box to disable automatic switching from the Source mode to the Disassembly mode during execution.
Code highlight

If enabled, XD displays executable lines in different color.
Full disasm mode

If enabled, XD tries to resolve addresses to publics and variable names in disassembly mode. Uncheck this box if you have a slow system, especially if you are running Windows 95.
Dump in disassembler mode

If enabled, bytes which constitute CPU instructions are displayed in Disassembly and Mixed modes.
Dereference pointers

If enabled, the debugger displays next to pointer variables values of objects to which they refer (if the base type is simple), base type name (if the base type is named compound type), or base type sort (if the base type is anonymous compound type).
Strip path from source name

If this option is enabled, the debugger uses its redirection file to locate source files. This may be useful if you debug a program which was compiled in a different environment.
Show all modules

Defines whether the Modules window lists all modules or only those for which debug information is available.
Auto detect actual type

Enables detection of the actual dynamic type of an Oberon-2 pointer or a Java object. If this option is disabled, actual type of a particular entity can still be determined using a pop-up menu.
Use single structure window

Controls whether a new window is opened when you select an array element or a record field of a structured or pointer type.
Warning bell

Enables or disables speaker beeping when an error message is displayed.
Save debug session layout

Enabling this option causes information about debugger options, window layout and colors, and watch expressions to be automatically stored in a .ses file upon debugging session termination.
Use keyboard layout

When enabled, forces XD to load keyboard shotcuts upon startup from the file specifed in the entry field; otherwise, the default layout is used (see Modifying keyboard shortcuts).

Use the Save config command from the File menu to store the current option settings, window layout, and colors as the default.


Super Prev Next

Changing window colors

To modify XD color schemes, select Palette from the File menu. A window containing a list of all window types will appear. Selecting a window type will cause its color sheet to be displayed. A color sheet consists of two columns, the left containing names of window areas, and the right containing current colors for each area.

The following keys may be used in a color sheet:

Up/Down
move the cursor one line up/down
Left/Right
change foreground color
Ctrl+Left/Right
change background color
Esc
close the color sheet

If you have the Save debug session layout option switched ON, the new color scheme will be stored in a session file upon debugging session termination. Otherwise, the changes you made will be lost unless you explicitly save the current configuration using the Save config command from the File menu.


Super Prev Next

Modifying keyboard shortcuts

If the option Use keyboard layout is enabled, upon startup the debugger attempts to load keyboard shortcuts from the file specified in the respective entry field. If that name does not contain directories, the file is sought via redirections, then is the current directory, and then in the directory where XD executable resides.

Default shortcuts are hard-wired into the debugger, so in order to modify them, you need to save the default layout to file using the Save keyboard layout command from the File menu. A keyboard shortcut file is a plain text file that looks similar to the following:

    [ Actions and keys ]
    Main pulldown                    = F10
    Main window                      = Ctrl-T
    Menu: File                       = Alt-F
    Load program                     = F3
    Refresh screen                   = Ctrl-E
    Show output                      = /
    Show debuggee                    = \
    Palette                          = 
    Options                          = 
       .  .  .

Edit the layout file in any text editor, then enable the Use keyboard layout and specify the name of that file in the respective entry field. described above.


Super Prev Next

Modifying frames

If the default window frames do not suite you, edit the FrameImageSingle, FrameImageDouble, and FrameImageMove items in the [ Options ] section of the debugger configuration file.