7.4   CrossWind in Detail

This section describes the debugger commands and controls in detail. 7.4.1 Graphical Controls is a complete discussion of all graphical debugger controls. 7.4.2 Debugger Command Panel: GDB discusses when to use the command panel rather than graphical controls, and what commands are particularly useful because of their effects on the graphical context.

7.4.1   Graphical Controls

The debugger provides three kinds of graphical controls: menus, buttons, and mouse-based manipulation of other display elements.

Display Manipulation

scrollbars
Whenever the amount of text in either main panel exceeds the available space, the debugger displays scrollbars to allow you to view whatever portion of either display you are interested in. As shown in Figure 7-1, you can scroll the command panel either vertically or horizontally, and you can scroll the program-display panel vertically. (Make the window wider if you need to see wider lines in your source program.)

sash  
If you refer again to Figure 7-1, you can see that the two major portions of the debugger display are the program-display panel (3) and the command panel (4). As in other Tornado tools, the separator line between these two panels includes a sash ( ). The sash allows you to allocate space between the two panels. To change the amount of space each panel takes up in the overall display, drag the small square up or down with your mouse.

left click
Clicking the left mouse button selects the entire word under the pointer in the program-display panel (but not in the command panel). This is often useful for selecting a symbol as an argument to one of the debugger buttons.

right click
Clicking the right mouse button anywhere in the program-display panel sets a breakpoint on the line under the pointer.

A right click on any line with an existing breakpoint (marked in the margin of the program-display panel) removes that breakpoint.

left drag
As with other X applications, you can drag the left mouse button over any displayed text to select it (whether as an argument to another control in the debugger, or to copy into another window).

middle drag
Use the middle mouse button to drag certain controls and symbols between the button bar and the program-display panel. For example, drag the pencil (using the middle button) to a particular source line, to edit that line; or drag the program-counter symbol to another source line to continue executing until that line is reached.

context  
The debugger displays this icon in the program-display panel, at the left of the next line to be executed, each time your program stops. Drag the context pointer (using the middle mouse button) to another line to allow execution to continue until the program reaches the line you indicate. The shading of the context pointer becomes gray if the program is running, or if the stack level displayed is not the current stack level. (For another way of doing this, see the discussion of the continue button in CrossWind Buttons.)

CrossWind Menus

The menu bar at the top of the debugger display provides commands for overall control of the debugger display or debugging session (Figure 7-2).

The following paragraphs describe the effect of each debugger-specific menu command.

File Menu
File>Quit
Ends the debugging session. If a target is attached, Quit also kills any suspended routines from the debugging session.

(If you want to leave the target undisturbed when you quit, first use the Detach Task command under Targets, or type the GDB command detach in the command panel.)

File>Download
Load an object module into target memory, link it dynamically into the run-time, and load its symbols into the debugger. This command displays a file selector, as shown in Figure 7-3, to choose the object module.

In the file selector, choose files or directories from the two scrolling lists by clicking on a name. You can type directly in the Filter text box to change the selection criteria. The Filter button redisplays the scrolling lists for a new directory or a new file-name expansion constraint; click the Load button when the file you want to download is selected. Double-clicking on a directory is equivalent to selecting the directory and then pressing Filter; double-clicking on a file is equivalent to Load.


*

CAUTION: Because the download is controlled by the target server, a download can fail when the server and CrossWind have different views of the file system. See Extended Debugger Variables.

In the command panel, you can use a form of the load command to get around this problem. See What Modules to Debug.

Targets Menu

The commands in the Targets menu allow you to select or change debugging targets.


*

CAUTION: If you select a command from the Targets menu while the debugger is attached to a running task, the command does not take effect until the next time the task stops. You can force the task to stop by pressing the interrupt button.

Targets>Attach Task
Attach the debugging session to a task that is already running. This command displays a scrolling list of the tasks that are running on the target (Figure 7-4). When you select one, the debugger stops the task.

Usually, a newly-attached task stops in a system routine; thus, the debugger displays an assembly listing in its program-display panel. Use the up-stack button to view a stack level where source code is visible, or use the finish button to allow the system routine to return to its caller.

Targets>Attach System
Switches the target connection into system mode (if supported by the target agent) and stops the entire target system.

Targets>Detach Task/System
If the debugger is currently attached to a task, it releases the current task from debugger control. This allows exiting the debugger, or switching to system mode, without killing the task that was being debugged. If the debugger is currently attached to the target system, it sets the agent to tasking mode (if supported) and the target system resumes operation.

Targets>Kill Task
Delete the current task from the target system without exiting the debugger.

Targets>Connect Target Servers
Connect the debugger to a target. This command displays a scrolling list of all targets available through the Tornado registry (Figure 7-4). If the debugger is already connected to a target, selecting a new target releases the current target from debugger control.

Source Menu

The commands in the Source menu control how your program is displayed.

Source>C/C++
Displays the original high-level language source code (usually C or C++). This style of display is only available for modules compiled with debugging information (the -g option, for the GNU compiler). When this display is available, it is also the default style of program display.

Source>Assembly
Displays only assembly-level code (a symbolic disassembly of your program's object code). This style of display is the default for routines compiled without debugging information (such as VxWorks system routines supplied as object code only).

Source>Mixed
Displays both high-level source and a symbolic disassembly, with the assembly-level code shown as close as possible to the source code that generates the corresponding object code. This display style is only available for modules compiled with debugging information.

Figure 7-6 shows the debugger using mixed-mode code display. (Notice also that the sash was dragged all the way down for this figure, thus devoting the maximum available area to the program-display panel.)


*

NOTE: For some source lines, compilers can generate code that is not contiguous, because it is sometimes more efficient to interleave the object code from separate lines of source.

In this situation, the mixed-mode display rearranges the assembly listing to group all object code below the line that generates it. The debugger indicates any rearranged chunks of the assembly with an asterisk at the start of each non-contiguous segment in the mixed-mode display.

Tcl Menu

The Tcl menu provides a way to re-initialize the debugger. Because the debugger can be customized on the fly (see 7.7 Tcl: CrossWind Customization), this provides a way to restore the environment after experiments with custom modifications.

Tcl>Reread Home
Re-initializes the definitions from.wind/crosswind.tcl in your home directory (see 7.7.1 Tcl: Debugger Initialization Files).

Tcl>Reread All
Re-initializes the complete graphical environment defined in Tcl resource files, including both the basic CrossWind definitions and the definitions from ~/.wind/crosswind.tcl.

Windows Menu

The Windows menu controls auxiliary debugger displays. All such displays are automatically updated whenever the control of execution passes to the debugger--for example, at each breakpoint, or after single-stepping.

Windows>Backtrace
Displays an auxiliary window with the current stack trace, like the one in Figure 7-7.

Windows>Registers
Displays an auxiliary window that shows the machine registers for the task you are debugging. Because registers are different for each architecture, the precise contents of this window differ depending on your target. Figure 7-8 shows a register-display window for a SPARC target. As with the register displays in task browsers (see 6.6.1 The Task Browser), registers are grouped by category, and you can control the level of detail by clicking on the folder icons that head each category.

Help Menu

The Help menu has the standard entries On CrossWind (the debugger's reference entry), Manuals Index (the online search tool), and Manuals Contents (the start of the Tornado online manuals). It also has one additional entry. The GDB Online command brings up an auxiliary viewer for the command-language usage summaries built into GDB.

CrossWind Buttons

Just below the menu bar is a row of buttons called the button bar. These buttons provide quick access to the most important debugger functionality. The following paragraphs describe each button:

Sets a breakpoint on the current line, or on a selected symbol. For example, if you have just single-stepped through a portion of your program, press this button to stop execution the next time your program executes this line. Alternately, to stop at the beginning of a routine, click on the routine name (either where it is defined, or anywhere that the subroutine is called), then press this button.

The debugger uses the same symbol that appears on the breakpoint button to indicate the breakpoint location in the program-display panel's left margin.

You can also set a breakpoint on any particular line by right-clicking on that line, or by dragging the breakpoint symbol from the button-bar (with the middle mouse button) down to the line where you want to break.

To delete a breakpoint, click with the right mouse button anywhere on a line that is already marked with the breakpoint icon, or drag the breakpoint icon back to the break button. You can also use the debugger delete command with the breakpoint number (as originally shown in the command panel, or as displayed with info break). The delete command with no arguments deletes all breakpoints.

To disable a breakpoint, drag the breakpoint icon to the hollow breakpoint symbol in the button bar (the temporary-breakpoint button), or use the disable command with the breakpoint number.

Sets a temporary breakpoint. This button works almost the same way as the breakpoint button above; the difference is that a temporary breakpoint stops the program only once. The debugger deletes it automatically as soon as the program stops there. The hollow breakpoint symbol on the button marks temporary breakpoints in the program-display panel, so that you can readily distinguish the two kinds of breakpoints there.

You can delete or disable temporary breakpoints in the same ways as other breakpoints--delete by right-clicking on a line displaying a breakpoint symbol, by dragging the breakpoint symbol up to the solid breakpoint symbol in the button bar, or by using the delete command; disable by dragging to the hollow breakpoint symbol, or by invoking the disable command.

Launches a hardware breakpoint window that allows you to set and delete hardware breakpoints, if they are supported by the target (Figure 7-9).

The hardware breakpoint window lists all hardware breakpoints currently set on the target. Hardware breakpoints set during the current CrossWind session are marked with an asterisk (*).1

To add a hardware breakpoint, click on the Add button to display the Set Hardware Breakpoint window (Figure 7-10). If you had previously selected a symbol in the source window, the Address or Symbol Name field would be filled automatically with the symbol. Otherwise, you can enter information about where the breakpoint should be set using standard GDB syntax. For example, enter "value" to set the breakpoint on the symbol value; enter "'testHwBp.c'::value" to set the breakpoint on symbol value in file testHwBp.c; enter "*ptr" to set the breakpoint on the address pointed to by ptr; enter "0x10000" to set the breakpoint at address 0x10000; and so on.

Then select the breakpoint type from the Breakpoint Type list, and click the OK button.

To delete a breakpoint, click on its name in the Hardware Breakpoints window, and then the Delete button. You can only delete hardware breakpoints set during the current CrossWind session.

If the target agent is running in task mode, a hardware breakpoint is set on all the system tasks. If the agent is running in system mode, a hardware breakpoint is set on the system context.


*

NOTE: CrossWind does not manage hardware breakpoints in the same manner as standard GDB breakpoints. The hardware breakpoint interface is provided as a simple means of setting hardware breakpoints on the target (which is why it is only possible to set hardware breakpoints on all the tasks or on the system context, and not only on the task to which the debugger is attached).

When a data access hardware breakpoint stops the program, the context icon indicates the line of code that has been executed. However, on some processors (such as the I960), a data access exception is generated only after the data has been accessed and the program counter has been incremented. For those processors, CrossWind marks the line after the one that has been executed when data hardware breakpoint was hit.

Interrupt. Sends an interrupt to the task that the debugger is controlling. For example, if your program keeps running instead of following an expected path to a breakpoint, press this button to regain control and investigate. Pressing this button is equivalent to keying the interrupt character (usually CTRL+C).

Steps to the next line of code. The precise effect depends on the style of program display you have selected. If the program-display area shows high-level source code only (the default), this button advances execution to the next line of source, like the step command. On the other hand, if the program-display panel shows assembler instructions (when either Assembly or Mixed selected from the Source menu, or execution is in a routine compiled with no debugging symbols), this button advances execution to the next instruction--the equivalent of the stepi or si command.

Steps over a function call. This is a variant of the button: instead of stepping to the very next statement executed (which, in the case of a function call, is typically not the next statement displayed), this button steps to the next line on the screen. If there is no intervening function call, this is the same thing as the button. But if there is a function call, the button executes that function in its entirety, then stops at the line after the function call.

The display style has the same effect as with the button: thus, the button steps to either the next machine instruction or the next source statement, if necessary completing a subroutine call first.

Continues program execution. Click this button to return control to the task you are debugging, rather than operating it manually from the debugger after a suspension. If there are no remaining breakpoints, interrupts, or signals, the task runs to completion.

To continue only until the program reaches a particular line in your program, drag this icon (using the middle mouse button) from the button bar to the line in the display panel where the program is to suspend once more. This has the same effect as dragging the context pointer, but is more convenient when you scroll the program-display window away from the current point of suspension.

This button issues the continue command.

Finishes the current subroutine. While stepping through a program, you may conclude that the problem you are interested in lies in the current subroutine's caller, rather than at the stack level where your task is suspended. Use this button in that situation: execution will continue until the current subroutine completes, then return control to the debugger in the calling statement.

This button issues the finish command.

Moves one level up the subroutine stack. The debugger usually has the same point of view as the executing program: in particular, what variable definitions are visible depends on the current subroutine. This button changes the context to the current subroutine's caller; press it again to get to that subroutine's caller, and so on.

This button does not change the location of the program counter; it only affects what data and symbols are visible to you. If you continue or step the program, it still takes up where it left off, regardless of whether you have used this button.

This button issues the up command, and has the same effect on a following finish or until command as up. The location of the temporary breakpoint that is set for finish or until depends on the selected frame, which is changed by up.

Moves one level down the stack. This is the converse of the button, and like it, affects the data you can see but not the state of your program.

This button issues the down command, and has the same effect on a following finish or until command as down. The location of the temporary breakpoint that is set for finish or until depends on the selected frame, which is changed by down.

Calls up an editor (specified by your EDITOR environment variable--or vi if EDITOR is not defined) on the current source file. To specify the starting context, drag the editor button to a line in the region you wish to edit, using the middle button on your mouse.

Prints a symbol's value in the command panel. Begin by left-clicking on the symbol of interest, in the program-display panel; the debugger highlights the symbol. Then press this button to display its value.

This button issues the print command, and echoes the command and its output--the symbol value--to the command panel.

Prints the value at a pointer location. This button has a similar effect to the print button above, except that it de-references the selected symbol. Use this button to inspect data when you have a pointer to the data, rather than the data itself.

This button issues the print * command, and echoes the command and its output--the value at the selected pointer location--to the command panel.

Launches an inspection window that monitors a symbol's current value. This auxiliary display is automatically updated each time control returns to the debugger.

Several different kinds of data-inspection windows are available, depending on data structure; the debugger chooses the right one automatically.

Figure 7-11 shows the two simplest displays: for ordinary numeric data, and for a pointer. In both cases, the numeric value of the variable is displayed in a small independent window. The name of the variable being displayed appears next to the numeric value. The window's title bar also shows the name of the variable displayed, preceded by a parenthesized display number.2

The debugger indicates whether the displayed variable is a pointer, by placing an asterisk to its left (as with pNode in Figure 7-11). To follow a pointer variable, click on its name in the display window; a new display pops up with the selected value.

If the displayed variable is a C struct (or a C++ class object), the debugger uses a special structure browser that exhibits the data structure graphically, using a folder icon to group nested structures. Figure 7-12 shows an example of a structure browser.

You can click on any folder in a structure browser to hide data that is not of current interest (or to reveal it, once a folder is closed). You can also click on pointers (highlighted in bold type) to follow them; this provides a convenient way of exploring list values interactively.

Launches an inspection window on the value at a pointer location. When you want to see the contents of a pointer immediately, rather than going through a display of the pointer address, click this button rather than the previous one. the debugger displays one of the same set of windows described above.

Both this button and the previous one issue the display /W command. (The /W display format is a CrossWind enhancement. See Graphically Enhanced Commands for more information.)

Defines a new button, or delete an existing one. You can add your own buttons (with text labels) to the button bar by clicking this button. The debugger displays a form where you can specify the name of the button, as well as one or more debugger commands to execute when the button is pressed.

To delete a button (whether a standard one, or a user-defined one), drag it (using the middle mouse button, as usual) to the button icon. Standard buttons come back the next time you start the debugger; user-defined buttons are similarly persistent if their definitions are recorded in your ~/.wind/crosswind.tcl initialization file.

Figure 7-13 shows the new-button form. In this example, a button labeled Home is defined to execute the GDB frame command. Because the frame command controls context in the program-display panel, a button with this definition is a convenient way to get the display panel back to the location where your program is suspended, after scrolling elsewhere. After completing the form, press the OK box at the bottom; your new button appears at the right of the menu bar.

CrossWind automatically saves your button definition by writing Tcl code at the end of your ~/.wind/crosswind.tcl initialization file. For example, the button definition above writes the following there:

toolBarItemCreate Home button {ttySend "frame\n"}
For buttons with more elaborate effects, consider first defining a new debugger command as described in 7.6 Tcl: Debugger Automation; then you can hook up the new command to a new button. You can also attach buttons to commands resulting from the GDB define command (see Debugging with GDB: Canned Sequences of Commands).

For examples of how to record your own button definitions in a CrossWind initialization file, see Tcl: "This" Buttons for C++.

7.4.2   Debugger Command Panel: GDB

CrossWind is designed to provide graphical access to those debugger actions that are best controlled graphically, but also to exploit the command-line GDB interface when that is the best way to perform some particular action. For example, the housekeeping of getting subroutines started necessarily involves typing subroutine names and argument lists. So that you do not have to switch back and forth between menus, buttons, and dialogs or forms for commands of this sort, the debugger exploits the command panel, which is inherently best suited to commands with typed arguments. The command panel provides full access to the GDB command language described in the GDB manual, Debugging with GDB.


*

NOTE: As a convenience, the GDB command interpreter repeats the previous command when you press ENTER (or RETURN) on an empty line, except for a few commands where it would be dangerous or pointless. See Debugging with GDB: GDB Commands for more information. Press ENTER in the debugger only when you want to execute or repeat a command.

The following sections summarize some particularly useful commands, and describe commands added by Wind River Systems that are not part of other versions of GDB.

GDB Initialization Files

One use of the command panel is to experiment with text-based commands for debugger actions that you might want to perform automatically.

When the debugger first executes GDB,3 it looks for a file named .gdbinit: first in your home directory, then in your current working directory. If it finds the file in either directory, the debugger commands in it are executed; if it finds the file in both directories, the commands in both are executed.

A related initialization file under your home directory, called .wind/gdb.tcl, is specifically intended for Tcl code to customize GDB with your own extensions written in Tcl. The Tcl code in this file executes before .gdbinit. See 7.6 Tcl: Debugger Automation for a discussion of extending GDB through Tcl. See also 7.7.1 Tcl: Debugger Initialization Files for a discussion of how the various CrossWind initialization files interact.

What Modules to Debug

You can use the following commands to establish the debugging context:

add-symbol-file filename
Specifies an object file on the host for the debugging session.

When the module you want to debug is already on the target (whether linked there statically, or downloaded by another Tornado tool), the debugger attempts to locate the corresponding object code on the host by querying the target server for the original file name and location. However, many factors (such as differing mount points on host and target, symbolic links, virtual file systems, or simply moving a file after downloading it) often make it necessary to specify the object file explicitly; you can do so with the add-symbol-file command.

The debugger recognizes the abbreviation add for this command.

load filename
This command is equivalent to the Download command in the File menu. You may sometimes find it preferable to invoke the command from the command panel--for example, when you can use your window manager to cut and paste a complex pathname instead of iteratively applying a file selector.

load filename serverFilename
Use this version of the load command when the target server you are using is on a host with a different view of the file system from your CrossWind session. For example, in some complex networks different hosts may mount the same file at different points: you may want to download a file /usr/fred/applic.o which your target server on another host sees as /fredshost/fred/applic.o.4

Use the serverFilename argument to specify what file to download from the server's point of view. (You must also specify the filename argument from the local point of view for the benefit of the debugger itself.)

See 5.6 Object Module Load Path for a more extended discussion of the same problem in the context of the shell.

unload filename
Undo the effect of load: remove a dynamically linked file from the target, and delete its symbols from the debugger session.

The load and unload commands both request confirmation if the debugger is attached to an active task. You can disable this confirmation request, as well as all other debugger confirmation requests, with set confirm. See Debugging with GDB: Controlling GDB.

What Code to Display

After a debugging session is underway, the program-display panel keeps pace with execution: when the program hits a breakpoint, the corresponding source is centered on the display panel, and each time you step or continue program execution, the display scrolls accordingly.

When you begin your debugging session by attaching to an existing task, the display panel is filled immediately as a side effect of stopping the task. In other situations, it may be convenient to use one of the commands in this section for an initial display.

list linespec
Displays source code immediately in the program-display panel, with the display centered around the line you specify with the linespec argument. The most common forms for linespec are a routine name (which identifies the place where that subroutine begins executing) or a source-file line number in the form filename:num (the source file name, a colon, and a line number). For a full description of linespec formats, see Debugging with GDB: Printing Source Lines.

search regexp
Displays code centered around the first line (in the current source file) that contains the regular expression regexp, instead of specifying what line to display. The command rev is similar, but searches backwards from the current context. See Debugging with GDB: Searching Source Files.

break fn
Sets a breakpoint at fn. Instead of first displaying source code, then setting breakpoints using the graphical interface, you can set a breakpoint directly (if you know where to go!). The argument fn can be a function name or a line number. See Debugging with GDB: Setting Breakpoints.

The break command does not produce a display directly, but sets things up so that there is at least one place where your program suspends. You can use run to start the program (except in system mode); when the program suspends at the breakpoint, the display panel shows the context.

Executing Your Program

Just as with the Tornado shell, you can execute any subroutine in your application from the debugger. Use the following commands:

run routine args
This is the principal command used to begin execution under debugger control. Execution begins at routine; you can specify an argument list after the routine name, with the arguments separated by spaces. The argument list may not contain floating-point or double-precision values. (This command is not available in system mode; use the shell to get tasks started in that mode. See 5.2.6 Using the Shell for System Mode Debugging.)

call expr
If a task is already running (and suspended, so that the debugger has control), you can evaluate any source-language expression (including subroutine calls) with the call command. This provides a way of exploring the effects of other subroutines without abandoning the suspended call. Subroutine arguments in the expression expr may be of any type, including floating point or double precision.

When you run a routine from the debugger using one of these commands, the routine runs until it encounters a breakpoint or a signal, or until it completes execution. The normal practice is to set one or more breakpoints in contexts of interest before starting a routine. However, you can interrupt the running task by clicking on the interrupt button or by keying the interrupt character (as set on your host with stty intr; usually CTRL+C) from the debugger window.

Application I/O

By default, any tasks you start with the run command use the standard I/O channels assigned globally in VxWorks. However, the debugger has the following mechanisms to specify input and output channels:

  • Redirection with < and >
  • Each time you use the run command, you can redirect I/O explicitly for that particular task by using < to redirect input and > to redirect output. For both input and output, ordinary pathnames refer to files or devices on the host where the debugger is running, and pathnames preceded by an @ character refer to files or devices on the target. For example, the following command starts the routine appMain( ) in a task that gets input from target device /tyCo/0 and writes output to host device /dev/ttyp2:

    (gdb) run appMain > /dev/ttyp2 < @/tyCo/0
  • New Default I/O with tty Command
  • The debugger command tty sets a new default input and output device for all future run commands in the debugging session. The same conventions used with explicit redirection on the run line allow you to specify host or target devices for I/O. For example, the following command sets the default input and output channels to host device /dev/ttyp2:

    (gdb) tty /dev/ttyp2
  • Tcl: Redirection of Global or Task-Specific I/O
  • Tcl extensions are available within the debugger's Tcl interpreter to redirect either all target I/O, or the I/O channels of any running task. See 7.6.3 Tcl: Invoking GDB Facilities for details.

    Graphically Enhanced Commands

    Certain GDB commands, even though typed in the command panel, are especially useful due to the CrossWind graphical presentation. Among these are list, search, and rev, discussed already in What Code to Display. The following commands are also especially useful because of CrossWind graphical extensions:

    display /W expr
    The and buttons provide a convenient way to generate active displays of symbol and pointer values, allowing you to monitor important data as your application executes under debugger control. However, sometimes the most useful data to monitor is the result of an expression--something that does not appear in your program, and hence cannot be selected before clicking a button.

    In this situation, you can use the CrossWind /W format with the GDB display command to request an inspection window from the command panel. Because you type the expression argument directly, you can use any source-language expression to specify the value to monitor. An inspection window appears, which behaves just like those generated with buttons (CrossWind Buttons).

    frame n
    Displays a summary of a stack frame, in the command panel. But it also has a useful side effect: it re-displays the code in the program-display panel, centered around the line of code corresponding to that stack frame.

    Used without any arguments, this command provides a quick way of restoring the program-display panel context for the current stack frame, after you scroll to inspect some other region of code. Used with an argument n (a stack-frame number, or a stack-frame address), this command provides a quick way of looking at the source-code context elsewhere in the calling stack. For more information about stack frames in GDB and about the GDB frame command, see Debugging with GDB: Examining the Stack.

    Managing Targets

    Instead of using the Targets menu (CrossWind Menus), you can select a target from the command panel with the target wtx command. The two methods of selecting a target are interchangeable; however, it may sometimes be more convenient to use the GDB command language--for example, you might specify a target this way in your .gdbinit initialization file or in other debugger scripts.

    target wtx servername
    Connects to a target managed by the target server registered as servername in the Tornado registry, using the WTX protocol. Use this command regardless of whether your target is attached through a serial line or through an Ethernet connection; the target server subsumes such communication details. (See 2.7 Connecting a Tornado Target Server.) There is no need to specify the full registered name as servername; any unique abbreviation (or any regular expression that uniquely specifies a server name) will do.

    Command-Interaction Facilities

    The following GDB facilities are designed to streamline command-line interaction:

    set editing-mode vi

    Extended Debugger Commands

    The command area also provides two kinds of extended commands:

  • Shell Commands
  • You can run any of the WindSh primitive facilities described in 5.2.3 Invoking Built-In Shell Routines in the command panel, by inserting the prefix "wind-" before the shell command name. For example, to run the shell td( ) command from the debugger, enter wind-td in the command panel.

    Because of GDB naming conventions, mixed-case command names cannot be used; if the shell command you need has upper case characters, use lower case and insert a hyphen before the capital letter. For example, to run the semShow( ) command, enter wind-sem-show.


    *

    CAUTION: The debugger does not include the shell's C interpreter; thus, the "wind-" commands are interfaces only to the underlying Tcl implementations of the shell primitives. For shell primitives that take no arguments, this makes no difference; but for shell primitives that require an argument, you must use the shell Tcl command shSymAddr to translate C symbols to the Tcl form. For example, to call the shell built-in show( ) on a semaphore ID mySemID, use the following:

    (gdb)
    wind-show [shSymAddr mySemId]

  • Server Protocol Requests
  • The Tornado tools use a protocol called WTX to communicate with the target server. You can send WTX protocol requests directly from the GDB command area as well, by using a family of commands beginning with the prefix "wtx-". See Tornado API Guide: WTX Protocol for descriptions of WTX protocol requests. Convert protocol message names to lower case, and use hyphens in place of underbars; for example, issue the message WTX_CONSOLE_CREATE as the command wtx-console-create.

    Extended Debugger Variables

    You can change many details of the debugger's behavior by using the set command to establish alternative values for internal parameters. (The show command displays these values; you can list the full set interactively with help set.)

    The following additional set/show parameters are available in CrossWind beyond those described in Debugging with GDB:

    inhibit-gdbinit
    Do not read the GDB-language initialization files ~/.gdbinit and ${PWD}/.gdbinit, discussed in 7.7.1 Tcl: Debugger Initialization Files. Default: no (that is, read initialization files).

    wtx-ignore-exit-status
    Whether or not to report the explicit exit status of a routine that exits under debugger control. When this parameter is on (the default), the debugger always reports completion of a routine with the message "Program terminated normally." If your application's routines use the exit status to convey information, set this parameter to off to see the explicit exit status as part of the termination message.

    wtx-load-flags
    Specifies the option flags for the dynamic loader (Download in the File menu, or load in the command panel). These flags are described in the discussion of ld( ) in VxWorks Programmer's Guide: Configuration and Build. Default: LOAD_GLOBAL_SYMBOLS (4).

    wtx-load-path-qualify
    Controls whether the debugger translates a relative path specified in the load argument to an absolute path when instructing the target server to download a file. By default, this value is set to yes: this instructs the debugger to perform this translation, so that the target server can locate the file even if the server and the debugger have different working directories.

    However, in some networks where the debugger and target server have different views of the file system, a relative pathname can be interpreted correctly by both programs even though the absolute pathname is different for the two. In this case, you may wish to set wtx-load-path-qualify to no.

    wtx-load-timeout
    As a safeguard against losing contact with the target during a download, the debugger uses a timeout controlled by this parameter. If a download does no complete in less time than is specified here (in seconds), the debugger reports an error. Default: 30 seconds.

    wtx-task-priority
    Priority for transient VxWorks tasks spawned by the run command. Default: 100.

    wtx-task-stack-size
    Stack size for transient tasks spawned by the run command. Default: 20,000.

    wtx-tool-name
    The name supplied for the debugger session to the target server. This is the name reported in the launcher's list of tools attached to a target. Default: crosswind. If you often run multiple debugger sessions, you can use this parameter to give each session a distinct name.


    1:  The hardware breakpoint list is refreshed at a regular interval (five seconds by default). It allows you to see the hardware breakpoints set or removed by other tools (such as the shell, WindSh). To change the polling interval or simply suppress polling, edit your ~/.wind/crosswind.tcl file (set hwBpPollInterval to 0 to suppress polling). If polling is suppressed, the hardware breakpoint list is only updated when the Add or Delete buttons are used.

    2:  Display numbers are useful with the GDB commands delete display, disable display, and info display, which you can execute in the command panel. See Debugging with GDB for details.

    3:  The graphical interface to the debugger has a separate initialization file .wind/crosswind.tcl, which runs after .gdbinit.

    4:  See also the description of wtx-load-path-qualify in Extended Debugger Variables for another way of managing how the debugger reports load pathnames to the target server.

    5:  There is one exception: the Meta key is not available, because it is reserved for keyboard shortcuts that select items from menus. Instead, use the ESC key as a Meta prefix, as usual in Emacs and related programs when no Meta key is available.