Part V Command Reference

This section explains the individual Ladebug commands.
 

41

ladebug-dxladebug

Name

ladebug - Invokes the command interface of the debugger.

dxladebug - Invokes the graphical user interface of the debugger.

Syntax (command-line)

ladebug [-I directory] [- c file] [-prompt string] [- nosharedobjs] [-pid process_id] [- rn node_or_address [,udp_port]] [- rfn remote_executable_file] [-ru remote_ username] [-rinsist] [-k] [-line serial_line] [-remote] [-rp remote_ debug_protocol] [-tty terminal_device] [executable_file [core_file]]

Syntax (window interface)

dxladebug [-iow ] [-k | -kernel] [- P program_arguments]

Description

Ladebug is a symbolic source code debugger that debugs programs compiled by the DEC C, ACC, DEC C++, DEC Ada, DEC COBOL, DEC Fortran 90 and DEC Fortran 77 compilers. For full source-level debugging, compile the source code with the compiler option that includes the symbol table information in the compiled executable file.

Options and Parameters

The following table describes the options and parameters for the Digital Ladebug debugger command line debugger:
-I  Specifies the directory containing the source code for the target program. Use multiple -I options to specify more than one directory. The debugger searches directories in the order in which they were specified on the command line. 
- c  Specifies an initialization command file. The default initialization file is .dbxinit. By default, Ladebug searches for this file during startup, first in the current directory; if it is not there, Ladebug searches your home directory for the file.  
-prompt  Specifies a debugger prompt. The default debugger prompt is (ladebug) . If the prompt argument contains spaces or special characters, enclose the argument in quotes (" "). 
-nosharedobjs  Prevents the reading of symbol table information for any shared objects that are loaded when the program executes. Later in the debug session, the user can enter the readsharedobj command to read in the symbol table information for a specified object. 
-pid  Specifies the process ID of the process to be debugged. Cannot be used with any remote or kernel debugging flags.  
- rn  Specifies the host name or Internet address of the machine on which the remote debugger server is running. Optionally, specifies the UDP port on which to connect the server. Depending on your shell, it may be necessary to use quotation marks to avoid shell command-line interpretation on the local system. With remote kernel debugging, the default is localhost.  
-rfn  Specifies the file name (or other identifier) of the executable file to be loaded on the remote system. This option defaults to the local executable file name and is passed uninterpreted to the remote system. When using this option, specify the remote executable file using the syntax of the remote file system; use quotation marks to avoid shell command-line interpretation on the local system. Use only with -rn; do not combine with -pid.  
-ru  Specifies the user name to be used on the remote target machine. If the -ru option is not specified, the default is the local user name. 
-rinsist  Connects to a running remote process using the insist protocol message instead of the connect protocol message. This option functions as a request to the server to connect to the client, even if another client is already connected. Use only with -rn and -pid.  
-k or -kernel  Enables local kernel debugging.  
-line  For use with remote kernel debugging; specifies the serial line. If used, -remote or -rp kdebug must also be used. The default is kdebug.  
-remote   Enables remote kernel debugging; for use with the kdebug kernel debugger. 
-rp   Specifies the remote debug protocol, either ladebug_preemptive or kdebug. -rp kdebug enables remote kernel debugging.  
-tty   For use with remote kernel debugging; specifies the terminal device. If used, -remote or -rp kdebug must also be used. 
executable_file  Specifies the program executable file. If the file is not in the current directory, specify the pathname. 
core_file  Specifies the core file. If the core file is not in the current directory, specify the pathname. 

The following table describes the options and parameters for the dxladebug command:
-iow  Invokes the window interface to the debugger and displays a separate user program I/O window. 
-k  Enables local kernel debugging. 
- P  Specifies the arguments used by the program you are debugging. 

General Instructions for Entering Ladebug Commands

Enter Ladebug commands at the debugger prompt (ladebug) . You can enter more than one command on the same line by separating each command with a semicolon (;). Commands are executed in the same order in which they are entered in the command line.

Continue command input to another line by entering a backslash (\) at the end of each line. The maximum command-line length is 255 characters.

In debugger commands, the keywords in the following list must be surrounded by parentheses in expressions that use them as variables or type names:


thread
in
at
state
if
policy
priority
with

For example, the commands print (thread) and print (thread* )t are valid. The parentheses enable the debugger to distinguish an identifier from a keyword.

Command Summary

Table 1 lists and describes the Ladebug commands, grouped in functionally related sets:

Table 1 Functionally Related Sets of Ladebug Commands

#   Enter a comment. 
alias, unalias   Define, view, or delete a debugger command alias. 
catch, ignore   Examine and change the list of operating system signals trapped by the debugger. 
history, !   Repeat and list previously used commands. 
file   Set the file scope. 
list, use, unuse, /, ?   Select and view program source code. 
listobj   List all loaded objects, including the main image and shared libraries. 
readsharedobj, delsharedobj   Read or delete symbol table information for the specified shared object. 
load, unload   Load an image file and, optionally, a core file; remove all related symbol table information associated with the process being debugged. 
stopi, tracei, wheni, nexti, stepi, printregs   Machine-code level commands. 
print, printf, dump, assign, whatis, which, whereis   Examine program expressions and change their values. 
quit, help   Exit and get help about the debugger. 
run, rerun, cont, next, step, return, call, goto, kill   Execute or terminate a program under debugger control. 
sh   Execute a Bourne shell command. 
set, unset   Define, view, or delete a debugger variable. 
source, playback input, record input, record output, record io   Read in or save a file containing debugger input data or output data. 
stop, when, trace, status, delete, enable, disable   Set, list, delete, enable, and disable program breakpoints and tracepoints. 
stop thread, when thread, wheni thread, trace thread, tracei thread   Control execution of one or more threads in a process. 
thread, show thread, show condition, show mutex   View information available from the debugger about threads in your application. 
process, show process   Display information for current process(es) and change the current process. 
where, where thread, up, down, func   Examine the stack trace and change the function scope. 
setenv, export, printenv, unsetenv   Manipulate subsequent debuggee environments with environment variables . 
class   Change or display the class scope. 
kps   Used to list all system processes; for local kernel debugging only.  
pop   Removes execution frame(s) from call stack.  

Table 2 gives a quick summary of the function of each individual Ladebug command:

Table 2 Ladebug Commands: Individual Summary

Command  Directly Manipulable in Window Interface+  Function 
#     Causes debugger to ignore all input until end of marked line. 
!     Without argument, repeats previous command line (use !! or !-1 ). With argument, repeats specified command line. 
/     Invokes forward search in source program. 
?     Invokes backward search in source program. 
alias     Without argument, displays all aliases and their definitions. With argument, displays definition for specified alias. 
assign   Yes   Changes value of variable, memory address, or expression. 
attach   Yes   Connects to a running process. 
call     Executes specified function. 
catch     Without argument, shows which operating system signals debugger currently traps. With argument, traps specified operating system signal. 
catch unaligned     Traps program immediately after unaligned data access occurs. 
class     For C++ only. Without argument, displays current class scope. With argument, changes class scope. 
cont   Yes   Resumes program execution. 
delete   Yes   Removes specified breakpoint or tracepoint. 
delsharedobj     Removes symbol table information for specified shared object. 
detach   Yes   Detaches from a running process specified from process ID list. 
disable   Yes   Disables specified breakpoint or tracepoint. 
down   Yes   Without argument, changes function one level down stack. With argument, changes function specified number of levels down stack. 
dump   Yes   Without argument, lists parameters and local variables in current function. With argument, lists parameters and local variables in specified active function. 
enable   Yes   Enables specified breakpoint or tracepoint. 
export     Synonym for setenv.  
file   Yes   Without argument, displays name of current file scope. With argument, changes specified file scope. 
func   Yes   Without argument, displays current function scope. With argument, changes function scope to function currently active on stack. 
goto   Yes   Branches to specified line in function where execution is suspended. 
help   Yes   Without argument, displays list of debugger commands. With argument, displays description of specified command. 
history     Without argument, displays default number of previously executed commands. (20). With argument, displays specified number of previously executed commands. 
ignore     With argument, shows which operating system signals debugger currently ignores. With argument, ignores specified operating system signal. 
ignore unaligned     Instructs debugger not to stop when unaligned access occurs (default). 
kill     Terminates program process while leaving debugger running. 
kps     Lists all system processes (valid for local kernel debugging only). 
list   Yes   Depending on argument, displays source code lines beginning with line corresponding to any of following:

  • Line designating position of program counter

  • Last line listed, if multiple list commands are entered

  • Line number specified as first argument
 
listobj   Yes   Lists all loaded objects, including main image and shared libraries. 
load   Yes   Loads image file or core file. 
next   Yes   When next line of code to be executed contains a function call, executes function and returns to line immediately after function call. 
nexti   Yes   When machine instruction contains a function call, executes function being called. 
patch     Corrects bad data or instructions in executable disk files. 
playback input     Executes debugger commands contained within a file. 
pop     Without argument, removes removes one execution frame from the call stack. With argument, removes the specified number of execution frames from the call stack. 
print   Yes   Displays current value of a variable or expression visible in current context. 
printenv     Without argument, displays values of all environment variables. With argument, displays value of specified environment variable. 
printf   Yes   Formats and displays a complex structure. 
printregs   Yes   Displays contents of all machine registers. 
process   Yes   Without argument, displays current process. With argument, switches to specified process. 
quit   Yes   Ends debugging session and returns to operating system prompt. 
readsharedobj     Reads in symbol table information for specified shared library or loadable kernel module. 
record input     Saves all debugger commands to a file. 
record io     Saves both debugger input and debugger output to a file. 
record output     Saves debugger output to a file. 
rerun   Yes   Restarts program execution. 
return   Yes   Without argument, continues execution of current function until control is returned to caller. With argument, execution continues until control is returned to specified function. 
run   Yes   Starts program execution. 
set     Without argument, examines definitions of all debugger variables. With argument, defines specified debugger variable. 
setenv     Without argument, displays values of all environment variables. With argument, sets value of specified environment variable. 
sh     Executes Bourne shell command. 
show condition     For DECthreads only. Without argument, displays information about all condition variables currently available. With argument, displays information about condition variables specified. 
show mutex     Lists information about currently available mutexes. 
show process   Yes   Displays information for current process. 
show thread   Yes   Without argument, lists all threads known to debugger. With argument, displays information about specified thread. 
source     Executes debugger commands contained within a file. 
status   Yes   Lists all breakpoints and tracepoints, reference number associated with each, and whether breakpoint is disabled. 
step   Yes   Steps into and executes first line of function. 
stepi   Yes   Steps into and executes next machine instruction. If function call, steps into and executes first instruction in function. 
stop     Without variable argument, suspends program execution and returns to prompt. With variable argument, suspends program execution when variable changes. 
stopi     Suspends program execution when specified variable value changes. 
thread   Yes   Identifies or sets current thread context. 
trace     Without argument, causes debugger to print message when each function is entered, but does not suspend program execution. With argument, causes debugger to print message when specified variable value changes, but does not suspend program execution. 
tracei     Without argument, prints message but does not suspend program execution. With argument, prints message when any of following occur, but does not suspend program execution:

  • Value of specified variable changes.

  • Specified expression evaluates to true.

  • Both.
 
unalias     Deletes specified alias. 
unload     Removes all related symbol table information that debugger associates with process being debugged, specified by either a process ID or image file. 
unset     Deletes debugger variable. 
unsetenv     Without argument, removes all environment variables. With argument, removes specified environment variable. 
unuse     Without argument, sets search list to default, home directory, current directory, or directory containing executable file. With argument, removes specified directory from search list. 
up   Yes   Without argument, changes function scope one level up stack. With argument, changes function scope specified number of levels up function scope. 
use     Without argument, lists directories searched for source-code files. With argument, makes source-code files in specified directory available. 
whatis   Yes   Prints type of specified expression. 
when   Yes   Executes specified command. 
wheni   Yes   Executes specified command without suspending program execution. 
where   Yes   Displays stack trace of currently active functions for current thread. 
whereis     Shows all declarations of expression. 
which     Shows fully qualified scope information when instance of specified expression occurs within current scope. 

+ "Yes" denotes commands with an exact mouse action equivalent in the window interface. To use any other command in the window interface, you must type the command at the command-entry prompt in the communications pane.

Command Descriptions

startaddress, endaddress / mode
startaddress / count mode

You can display stored values as character strings, machine instructions, or decimal, octal, hexadecimal, or real numbers. Specify the address and the number of words or bytes (count) information in hexadecimal, octal, or decimal. The display mode must be specified along with the address range.

The modes are:
d   Print a short word in decimal 
u   Print a short word in unsigned decimal 
D   Print a long word in decimal 
U   Print a long word in unsigned decimal 
o   Print a short word in octal 
O   Print a long word in octal 
x   Print a short word in hexadecimal 
X   Print a long word in hexadecimal 
b   Print a byte in hexadecimal 
c   Print a byte as a character 
s   Print a string of characters (a C-style string that ends in null) 
f   Print a single-precision real number 
g   Print a double-precision real number 
i   Disassemble machine instructions 

Note that you must enter a space between "count" and "mode" if the language of the program being debugged is COBOL.

# comment

When the debugger encounters the # command, it ignores all inputs until the end of the line.
!!
! integer
!- integer
! text

To repeat the last command line, enter two exclamation points or press the Return key. You can also enter !-1.

To repeat a command line entered during the current debugging session, enter an exclamation point followed by the integer associated with the command line. (Use the history command to see a list of commands used.) For example, to repeat the seventh command used in the current debugging session, enter !7. Enter !-3 to repeat the third-to- last command.

To repeat the most recent command starting with a string, use the last form of the command. For example, to repeat a command that started with bp, enter !bp.

/ string
? string

Use the string search commands / and ? to locate text in the source code. The / character invokes a forward search; the ? character invokes a backward search. Enter / or ? without an argument to find the next location of the previously specified text.

The search begins from the current position of the program counter. If no program counter exists for the current source file, the search begins after the last source line displayed by the debugger.

alias [aliasname]
alias aliasname [(argument)] "[aliasname] string"
unalias aliasname

Enter the alias command without an argument to display all aliases and their definitions. Specify an alias name to display the definition for that alias.

Use the second form to define a new alias or to redefine an existing alias. The definition can contain:

Note that in the first example there is a space between the last two quotation marks. In the second example there is a semicolon. The two quotation marks cannot be together; they must be separated by a space or character(s).

Invoke the alias by entering the alias name, including an argument if the alias definition specified an argument.

Use the unalias command to delete an alias.

Alias commands can contain no more than 56 arguments.

The following predefined aliases are included with the debugger:

S       next
Si      nexti
W       list $curline - 10:20
a       assign
b       stop at
bp      stop in
c       cont
d       delete
e       file
f       func
g       goto
h       history
j       status
l       list
li      ($curpc)/10 i; set $curpc = $curpc + 40
n       next
ni      nexti
p       print
pd      printf "%ld",
pi      playback input
po      printf "0%o",
pr      printregs
ps      printf "%s",
px      printf "0x%lx",
q       quit
r       rerun
ri      record input
ro      record output
s       step
si      stepi
t       where
tlist   show thread (only defined during kernel debugging)
tset    thread (only defined during kernel debugging)
u       list $curline - 9:10
w       list $curline - 5:10
wi      ($curpc - 20)/10 i
assign target = expression

Use the assign command to change the value of a variable, memory address, or expression that is accessible according to the scope and visibility rules of the language. The expression can be any expression that is valid in the current context.

For C++, use this syntax:

   assign [classname::]member = ["filename"] `expression
   assign [object.]member = ["filename"] `expression

For C++, use the assign command to modify static and object data members in a class, and variables declared as reference types, type const, or type static. The address referred to by a reference type cannot be changed, but the value at that address can be changed.

attach process_id image_file

Use the attach command to connect to a running process. Supply the process ID number and image file name.
call function([parameter])

Use the call command to execute a single function. Specify the function as if you were calling it from within the program. If the function has no parameters, specify empty parentheses.

You can nest called functions by setting a breakpoint in a function and executing it using the call command. When execution suspends at the breakpoint, use this command to execute the nested function.

For multithreaded applications, the call is made in the context of the current thread.

For C++: When you set the $overloadmenu debugger variable to 1 and call an overloaded function, the debugger will list the overloaded functions and call the function you specify.

catch [signal]

Enter the catch command or the ignore command without an argument to see which operating system signals the debugger currently traps or ignores. Use the catch command or the ignore command followed by an argument to trap or ignore, respectively, that signal.

Only one signal at a time can be added to, or removed from, the list of trapped or ignored signals.

The catch and ignore commands operate on a per program basis; you must first load a program (using the load command) or attach to a process (using the attach command).

catch unaligned

Enter the catch unaligned command to instruct the debugger to stop when unaligned data access occurs in the debuggee process. The debugger stops at the instruction following the instruction where the unaligned access occurs, and issues a message. The default is ignore unaligned.
class [classname]

For C++ only: Use the class command without an argument to display the current class scope. Specify an argument to change the class scope. After the class scope is set, refer to members of the class by omitting the class name prefix.

Setting the class scope nullifies the function scope.

cont [signal]

Use the cont command without a parameter value to resume program execution until a breakpoint, a signal, an error, or the end of the program is encountered. Specify a parameter value to send an operating system signal to the program continuing execution.

For multithreaded applications, use the cont command to resume execution of the current thread that was put on hold. As the current thread resumes, the other threads run freely.

The signal parameter value can be either a signal number or a string name (for example, SIGSEGV). The default is 0, which allows the program to continue execution without specifying a signal. If you specify a signal parameter value, the program continues execution with that signal.

delete integer [, . . . ]
delete all
delete *

Enter the delete command followed by the number or numbers associated with a breakpoint or trace (as listed by the status command) to remove the specified breakpoint or tracepoint.

Enter the delete all command or the delete * command to remove all breakpoints and tracepoints.

This command operates on a per program basis; you must first load a program (using the load command) or attach to a process (using the attach command).

delsharedobj shared_object

Use the delsharedobj command to remove the symbol table information for the specified shared object from the debugger.
detach [process_id_list]

Use the detach command to detach from a running process you specify from the process ID list. Specifying a process ID and detaching from the process disables your ability to debug the process. If you do not specify a process ID from the list, Ladebug detaches from the current process.
disable integer [, . . . ]
disable all
disable *

Enter the disable command followed by the number or numbers associated with a breakpoint or trace (as listed by the status command) to disable the breakpoint or trace. Enter the disable all command or the disable * command to disable all breakpoints and traces.

The disabled breakpoint is displayed in response to the status command but it is ignored during execution. Disabled breakpoints remain disabled until they are explicitly reactivated or deleted.

This command operates on a per program basis; you must first load a program (using the load command) or attach to a process (using the attach command).

down [number]

Use the up command or the down command without an argument to change the function scope to the function located one level up or down the stack. Enter a number argument to change the function scope to the function up or down the specified number of levels. If the number of levels exceeds the number of active functions on the stack, the function scope moves up or down as many levels as possible and the debugger issues a warning message.

When the function scope changes, the debugger displays the source line corresponding to the last point of execution in that function.

dump [function]
dump.

Use the dump command without an argument to list the parameters and local variables in the current function. To list the parameters and local variables in an active function, specify it as an argument.

Enter the dump. command (include the dot) to list the parameters and local variables for all functions active on the stack.

enable integer [, . . . ]
enable all
enable *

Enter the enable command followed by the number or numbers associated with a breakpoint or trace (as listed by the status command) to enable a breakpoint or trace.

Enter the enable all command or the enable * command to activate all previously disabled breakpoints and traces.

This command operates on a per program basis; you must first load a program (using the load command) or attach to a process (using the attach command).

export [env_variable [= value]]

Sets the value of the specified environment variable. If no variable is specified, the command displays the values of all environment variables. If a variable is specified but no value is specified, then the variable is set to NULL.

This command is not for the current debuggee's environment, but for the environment of any debuggees subsequently created with fork(2) or with subsequent run or rerun commands.

export and setenv are synonyms.

See Chapter 9 for more information on commands that manipulate the environment of subsequent debuggees.

file filename

Enter the file command without an argument to display the name of the current file scope. Include a file name as an argument to change the file scope. Change the file scope to set a breakpoint in a function not in the file currently being executed. To see source code for a function not in the file currently being executed, use the file command to set the file scope and the use command to direct the search for the sources of that file.
func [function]
func [integer]

Use the func command without an argument to display the current function scope. To change the function scope to a function currently active on the stack, specify either the name of the function or the number corresponding to the stack activation level. (Enter the where command to display the stack trace.)

When the function scope is changed, the debugger displays the source line corresponding to the last point of execution in that function.

goto linenumber

Use the goto command to branch to a line located in the function where execution is suspended. When you branch to a line, the source code between the line where execution suspended and the specified line is not executed.
help [command]

Enter the help command without an argument to display a list of debugger commands. Include a command argument to display a description of that command.
history [integer]

Enter the history command without an argument to display previously executed commands. The debugger displays the number of command lines defined for the $historylines debugger variable. (The default is 20 lines of user input.) Include an integer argument to display that number of previous commands.
ignore [signal]

Enter the catch command or the ignore command without an argument to see which operating system signals the debugger currently traps or ignores. Use the catch command or the ignore command followed by an argument to trap or ignore, respectively, that signal.

Only one signal at a time can be added to, or removed from, the list of trapped or ignored signals.

The catch and ignore commands operate on a per program basis; you must first load a program (using the load command or attach to a process (using the attach command).

ignore unaligned 

Enter the ignore unaligned command, which is the default, to instruct the debugger not to stop when unaligned access occurs. (Also see the catch unaligned command.)
kill

Use the kill command to terminate the program process leaving the debugger running. When a process terminates, any breakpoints and traces previously set are retained. You can later rerun the program.
kps

Use the kps command to list all system processes. (This command is valid for local kernel debugging only.)
list startline [,endline]
list startline[:count]
list function

The list command displays source-code lines beginning with the source line corresponding to the position of the program counter, the last line listed if multiple list commands are entered, or the line number specified as the first argument to the list command. Specify the exact range of source-code lines by including either the endline or the number of lines you want to display. The arguments can be expressions that evaluate to integer values.

To display the source code for a particular function, enter the function as an argument.

listobj

Use the listobj command to list all loaded objects, including the main image and the shared libraries. For each object, the information listed consists of the full object name (with pathname), the starting address for the text, the size of the text region, and whether the symbol table information has been read by the debugger.
load [image_file [core_file]]
unload process_id_list or image_file

The load command loads an image file and optionally a core file. After loading an image file, enter the run command to start program execution.

The unload command removes all related symbol table information that the debugger associated with the process being debugged, specified by either a process ID or image file.

next

Use the next and the step commands to execute a line of source code. When the next line to be executed contains a function call, the next command executes the function being called and returns to the line immediately after the function call. The step command steps into the function and executes only the first line of the function.

For multithreaded applications, use these commands to step the current thread while putting all other threads on hold.

nexti

Use the stepi command and the nexti command to execute a machine instruction. When the instruction contains a function call, the stepi command steps into the function being called, and the nexti command executes the function being called.

For multithreaded applications, use these commands to step the current thread while putting all other threads on hold.

patch expression1 = expression2

Use the patch command to correct bad data or instructions in executable disk files. The text, initialized data, or read-only data areas can be patched. The bss segment, as well as stack and register locations, cannot be patched because they do not exist on disk files.

Use this command exclusively when you need to change the ondisk binary. Use the assign command when you need only to modify debuggee memory.

If the image is executing when you issue the patch command, the corresponding location in the debuggee address space is updated as well. (The debuggee is updated regardless of whether the patch to disk succeeded, as long as the source and destination expressions can be processed by the assign command.) If the user program is loaded but not yet started, the patch to disk is performed without the corresponding assign to memory.

playback input filename

Use the source command or the playback input command to execute debugger commands contained within a file. (Note that you can also execute debugger commands when you invoke Ladebug by creating an initialization file named .dbxinit. By default, Ladebug searches for this file during startup, first in the current directory; if it is not there, Ladebug searches your home directory for the file.) Format the commands as if they were entered at the debugger prompt.

When a command file is executed the value of the $pimode debugger variable determines whether the commands are echoed. If the $pimode variable is set to 1, commands are echoed; if $pimode is set to 0 (the default), commands are not echoed. The debugger output resulting from the commands is always echoed.

pop [number_of_frames]

The pop command removes one or more execution frames from the call stack, undoing the work already done by the removed execution frames. The optional argument is the number of execution frames to remove from the call stack. If you do not specify the argument, one frame is removed. If specified, the number must be a positive integer less than or equal to the number of frames currently on the call stack.

See Chapter 9 for more information.

print expression [, . . . ]
print @expression

The print command displays the current value of a variable or expression that is visible in the current context, as defined by the scope and visibility rules of the program language. The expression can be any expression that is valid in the current context.

The print @line_number command displays the address of the specified line number. For example, print @10 displays the address of line number 10.

For C++:

   print *this
   print object
   print [object.]member
   print *( derived_class *) object

For C++, use the print command to display the value of an object, including inherited members and the value of data members in an object. Type casts can be used to interpret a base class object as a derived class object, or to interpret a derived class object as a base class object. To interpret a base class type object as the derived type, use the print * command.

printenv [env_variable]

Displays the value of the specified environment variable. If none is specified, the command displays the value of all environment variables.

This command is not for the current debuggee's environment, but for the environment of any debuggees subsequently created with fork(2) or with subsequent run or rerun commands.

See Chapter 9 for more information on commands that manipulate the environment of subsequent debuggees.

printf [format [,expression , . . . ]]

Use the printf command to format and display a complex structure. The format argument is a string expression of characters and conversion specifications using the same format specifiers as the printf C function.
printregs

Use the printregs command to display the contents of all machine registers for the current thread. Register values are displayed in decimal or hexadecimal, depending on the value of the $hexints variable. The list of registers displayed by the debugger is machine dependent.
process
process [process_id | image_file | debugger_variable]

Specify a specific process using the process ID number or the name of the image. Ladebug sets the current process context to the process ID or the process that runs the binary image. If there is more than one process running the same binary image, Ladebug warns you and leaves the process context unchanged. The debugger variables $childprocess and $parentprocess can also be specified in place of the process ID. (Ladebug automatically sets these variables when an application forks a child process.)
quit

Use the quit command to end the debugging session and return to the operating system prompt.
readsharedobj shared_object

Use the readsharedobj command to read in the symbol table information for the specified shared object. This object must be a shared library or loadable kernel module. The command can be used only when a debuggee program is specified; that is, either Ladebug has been invoked with it, or the debuggee was loaded by the load command.
record input filename
record output filename
record io filename

Use the record input command to save all the debugger commands to a file. The commands in the file can be executed by using the source command or the playback input command.

The record output command saves all debugger output to a file. The output is simultaneously echoed to the screen. (The program output is not saved.)

The record io command saves both input to and output from the debugger.

To stop recording debugger input or output, exit the debugger.

return [function]

Use the return command without an argument to continue execution of the current function until it returns to its caller. If you include a function name, execution continues until control is returned to the specified function. The function must be active on the call stack.
run [program_arguments] [io_redirection]
rerun [program_arguments] [io_redirections]

Use the run and rerun commands to start program execution. Enter program flags, options, and input and output redirections as arguments. If the rerun command is specified without arguments, the arguments entered with the previous run command are used.

If the last modification time and/or size of the binary file or any of the shared objects used by the binary file has changed since the last run command was issued, Ladebug automatically rereads the symbol table information. If this happens, the old breakpoint settings may no longer be valid after the new symbol table information is read.

set [variable = definition]
unset variable

To examine the definitions of all debugger variables, enter the set command without arguments. (Use the print command to display the definition of a single debugger variable.)

To define a debugger variable, enter the set command followed by a variable name, an equal sign, and a definition. Enclose string definitions in quotes. The definition can be any expression allowed by the language of the program being debugged.

Use the unset command to delete a variable.

If you want to remove an environment variable, or all environment variables, use the unsetenv command, not the unset command.

The debugger contains many predefined variables to describe the current state of the debugger, and to allow you to customize the debugger environment. You can delete and redefine the predefined debugger variables in the same way you define your own variables. If you delete a predefined debugger variable, the debugger uses the default value for that variable. The settings on the predefined variables apply to all debugging processes.

The debugger has the following predefined variables:
$ascii   With the default value of 1, allows the print command to print character-type data as ASCII characters, only when the bit value is that of a printable 7-bit subset ASCII character. (Other bit values are printed as octal numbers.) With a value of 0, this variable causes all printable ISO Latin- 1 characters to be printed as characters. 
$beep   With the default value of 1, causes a beep to sound when a user attempts to perform an illegal action while editing the debugger command line (for example, moving the cursor past the end of the line, or "yanking"-pasting - from an empty cut buffer). 
$childprocess   Can be specified in place of the process ID. (Ladebug automatically sets this variable when an application forks a child process.) 
$catchexecs   When set to 1, instructs the debugger to notify the user and stop the program when a program execs. The default is 0.  
$catchforks   When set to 1, instructs the debugger to notify the user when a program forks a child process. The child process stops and is brought under debugger control. (By default, the parent process is not stopped. See the $stopparentonfork description.) The default is 0.  
$curevent   Is set to the event number of the current event at the start of an event, allowing its use within the expression of an event. 
$curfile   Specifies the current source-code file. 
$curline   Specifies the current line in the source file. 
$curpc   Specifies the current point of program execution. This variable is used by the wi and li aliases. 
$cursrcline   Specifies the line number of the last line of source code listed plus one. 
$curthread   Indicates the thread ID of the current thread within the current process. You can change to a different thread by setting $curthread.  
$decints   When set to 1, all integers printed by the debugger are displayed as decimal numbers. The default is 0. 
$editline   With the default of 1, enables the command-line editing features. The command- line editing features are described in Chapter 7. For backward compatibility you can set this variable to 0.  
$eventecho   When set to 1, echoes events (such as breakpoints) with event numbers when executed. The default is 1. 
$hasmeta   For international users. When set to 1, causes any 8- bit character to be interpreted as the corresponding 7-bit character plus the Meta character (which is the ALT key whose MSB bit represents a Meta modifier). This could be used for binding editing functions to ALT plus key sequences. The default depends on several factors, including the locale and whether the terminal has Meta capability. In the United States, the default is usually 0. 
$hexints   When set to 1, all integers will be displayed as hexadecimal numbers. The default is 0. 
$historylines   Specifies the number of previously input commands listed in response to the history command. The default is 20. 
$indent   When set to 1, specifies that structures will be printed with added indentation to render them more readable. The default value is 1. 
$lang   Specifies the programming language used in the program being debugged. For mixed-language programs, $lang is set to the language corresponding to the current frame. The variable is updated when the program execution stops. 
$listwindow   Specifies how many lines the list command displays. The default is 20. 
$main   Specifies the name of the function that the debugger enters first. The default is main() , but this can be set to any function. This variable is useful when debugging languages whose primary function is called something other than main()
$maxstrlen   Specifies the maximum number of characters to print when the value of a string is printed. The default is 128. 
$octints   When set to 1, the debugger prints all integers as octal numbers. The default is 0. 
$overloadmenu   When debugging C++ programs only, if this variable is set to 1, a menu of overloaded functions is displayed so you can select the desired function from the list of type signatures of the function. When set to 0, no menu is displayed and you must disambiguate overloaded functions by providing the full type signature. The default is 1. 
$parentprocess   Can be specified in place of the process ID. (Ladebug automatically sets this variable when an application forks a child process.) 
$pid   Indicates the process ID of the current process. Only for use in kernel debugging (either local or remote).  
$pimode   Specifies whether the playback input command echoes input. If set to 1, commands from the script file are echoed. If set to 0, commands are not echoed. The default is 0. 
$prompt   Specifies the debugger prompt. The default is (ladebug).  
$repeatmode   When set to 1, causes the debugger to repeat the previous command if you press the Return key at the (ladebug) prompt. The default is 1.  
$stackargs   When set to 1, causes the values of arguments to be included in the output of the where, up, down , and dump commands. When large or complex values are passed by value, the output can be voluminous. You can set $stackargs to 0 to suppress the output of argument values. The default is 1.  
$stepg0   When set to 0, the debugger steps over calls to routines that are compiled without symbol information. When set to 1, the debugger steps into these calls. The default is 0. 
$stoponattach   When set to 1, causes the debugger to stop a running process right after attaching to it. When set to 0, causes the debugger to allow the process to run to completion; in this case, to interrupt the process, enter Ctrl/C. The default is 0. 
$stopparentonfork   When set to 1, instructs the debugger to stop the parent process when a program forks a child process. (Also see the $catchforks description.) The default is 0.  
$threadlevel   Enables Ladebug to determine whether you are working with DECthreads or native threads. The default is decthreads if the application is multithreaded and is using DECthreads. Otherwise, the default is native. You can switch from one mode to the other by setting $threadlevel. In kernel mode, $threadlevel is always native.  
$tid   Indicates the thread ID of the current thread within the current process. You can change to a different thread by setting $tid. Only for use in kernel debugging (either local or remote).  
$verbose   When set to 1, specifies whether debugger output should include all possible program information, including base pointers and virtual function pointers (for C++ programs only). The default is 0. 

setenv [env_variable [value]]

Sets the value of the specified environment variable. If no variable is specified, the command displays the values of all environment variables. If a variable is specified but no value is specified, then the variable is set to NULL.

This command is not for the current debuggee's environment, but for the environment of any debuggees subsequently created with fork(2) or with subsequent run or rerun commands.

export and setenv are synonyms.

See Chapter 9 for more information on commands that manipulate the environment of subsequent debuggees.

sh command [argument . . . ]

Use the sh command to execute a Bourne shell command. Do not enclose the shell command and its arguments in quotations.

Example:

(ladebug) sh ls -l sample.c  
show condition [condition_identifier_list]
show condition [condition_identifier_list] with state == wait

For DECthreads only. Use the show condition command to list information about currently available DECthreads condition variables. If you supply one or more condition identifiers, the debugger displays information about those condition variables that you specify, provided that the list matches the identity of currently available condition variables. If you omit the condition variable specification, the debugger displays information about all condition variables currently available.

Use the show condition with state == wait command to display information only for condition variables that have one or more threads waiting. If $verbose is set to 1, the sequence numbers of the threads waiting on the condition variables are displayed.

show mutex [mutex_identifier_list]
show mutex [mutex_identifier_list] with state == locked

For DECthreads only. Use the show mutex command to list information about currently available mutexes. If you specify one or more mutex identifiers, the debugger displays information about only those mutexes that you specify, provided that the list matches the identity of currently available mutexes. If you omit the mutex identifier specification, the debugger displays information about all mutexes currently available.

Use the show mutex with state == locked command to display information exclusively for locked mutexes. If $verbose is set to 1, the sequence numbers of the threads locking the mutexes are displayed.

show process
show process *
show process all

Use the show process command to display information for the current process. The show process * and show process all commands display information for all processes.
show thread [thread_identifier_list]
show thread [thread_identifier_list] with state == ready
show thread [thread_identifier_list] with state == blocked
show thread [thread_identifier_list] with state == running
show thread [thread_identifier_list] with state == terminated
show thread [thread_identifier_list] with state ==detached
show thread [thread_identifier_list] with state ==stopped

Use the show thread command to list all the threads known to the debugger. If you specify one or more thread identifiers, the debugger displays information about the threads that you specify, if the thread matches what you specified in the list. If you omit a thread specification, the debugger displays information for all threads.

Use the show thread with state command to list only the threads with a specific state (characteristic).

The valid state values for DECthreads are ready, blocked, running, terminated, and detached.

The valid state values for native theads are stopped, running, and terminated.

source filename

Use the source command or the playback input command to execute debugger commands contained within a file. (Note that you can also execute debugger commands when you invoke Ladebug by creating an initialization file named .dbxinit. By default, Ladebug searches for this file during startup, first in the current directory; if it is not there, Ladebug searches your home directory for the file.) Format the commands as if they were entered at the debugger prompt.

When a command file is executed, the value of the $pimode debugger variable determines whether the commands are echoed. If the $pimode variable is set to 1, commands are echoed; if $pimode is set to 0 (the default), commands are not echoed. The debugger output resulting from the commands is always echoed.

status

The status command lists all breakpoints and tracepoints, the reference number associated with each, and whether the breakpoint is disabled. All breakpoint settings are on a per process basis.
step

Use the next and the step commands to execute a line of source code. When the next line to be executed contains a function call, the next command executes the function being called and returns to the line immediately after the function call. The step command steps into the function and executes only the first line of the function.

For multithreaded applications, use these commands to step the current thread while putting all other threads on hold.

stepi

Use the stepi command and the nexti command to execute a machine instruction. When the instruction contains a function call, the stepi command steps into the function being called, and the nexti command executes the function being called.

For multithreaded applications, use these commands to step the current thread while putting all other threads on hold.

stop variable
stop [variable] if expression
stop [variable] at linenumber [if expression]
stop [variable] "filename":linenumber
stop [variable] in function [if expression]
stop [variable] "filename" `function [if expression]
stop [variable] [thread thread_identifier_list]
[at linenumber] [if expression]
stop [variable] [thread thread_identifier_list]
[in function] [if expression]

Enter the stop command without a variable argument to suspend program execution and return to the prompt. (All breakpoint settings are on a per process basis.)

Enter the stop command with a variable argument to suspend program execution when the variable changes.

Specify if with an expression to suspend execution when the expression evaluates to true. When you specify both an expression and a variable, execution suspends only if the specified expression evaluates to true and the variable has changed.

To suspend execution when a line or function is encountered, use the third, fourth, or fifth syntax form. If you specify a variable, execution suspends only if the variable has changed when the line or function is encountered.

If you specify an expression, execution suspends only if the expression evaluates to true when the line or function is encountered.

If you specify both a variable and an expression, execution suspends only if the variable has changed and the expression evaluates to true when the line or function is encountered.

Specify a filename and function to instruct Ladebug to stop in a particular function in the specified file, thus eliminating ambiguity.

Use the seventh and eighth forms of the syntax for multithreaded applications. The thread_identifier_list parameter identifies one or more threads of the current debugging level (native or DECthreads). If you specify one or more thread identifiers, the breakpoint is set only in those threads. If you do not specify any thread identifier, the breakpoint is set on all threads or at the process level.

The following example shows how to suspend program execution when line number 10 is encountered and the variable f equals 2:

(ladebug) stop at 10 if f==2 

For C++:

   stop in [classname::]function
   stop in object.function
   stop in objectptr->function
   stop in object.function if (& object == this)
   stop in [classname::]classname (type_signature)
   stop in [classname::]~classname
   stop in [classname::] function [(type_signature)] [(void)]
   stop in all function

For C++ only.

The first form of the stop command sets a breakpoint in a member function using the static class type information. This form presumes that run-time information from an object is needed to determine the address of the function at which to set the breakpoint.

If you need run-time information to determine the correct virtual function, use the second or third syntax form to qualify the function name with the object when you set the breakpoint. This way of setting the breakpoint causes the debugger to stop at the member function in all objects declared with the same class type as the specified object.

To set a breakpoint that stops only in the member function for this specific object and not all instances of the same class type, use the fourth form of the stop command.

The fifth and sixth syntax forms set breakpoints in a constructor and destructor, respectively.

To set a breakpoint in a specific version of an overloaded function, either set $overloadmenu to 1, enter the command stop in function , and choose the appropriate function from the menu, or specify the function and the type signature as arguments to the command. If the overloaded function has no parameters, void must be explicitly specified.

Use the last form to set a breakpoint in all versions of an overloaded function.

Example:

(ladebug) stop at 10 if f==2
stopi variable
stopi [variable] if expression
stopi [variable] at address [if expression]

Enter the stopi command with a variable to suspend execution when the variable value changes.

Specify if with an expression to suspend execution when the expression evaluates to true. When you specify both a variable and an expression, execution suspends only if the specified expression evaluates to true and the variable has changed.

To suspend execution when an address is encountered, use the third syntax form. If you specify a variable, execution suspends only if the variable has changed when the address is encountered. If you specify an expression, execution suspends only if the expression evaluates to true when the address is encountered. If you specify both a variable and an expression, execution suspends only if the variable has changed and the expression evaluates to true when the address is encountered.

The stopi command is different from the stop command because the debugger checks the breakpoint set with the stopi command after executing each machine instruction. Thus, the debugger performance is affected when you use the stopi command.

As of Version 4.0 of the debugger, the stopi in command is no longer valid, and results in an error message. Replace stopi in in your code with stopi at for an address or stop in for a routine.

thread [thread_identifier]

Use the thread command to identify or set the current thread context. If you supply a thread identifier, the debugger sets the current context to the thread you specify. If you omit the thread identifier, the debugger displays the current thread context.

The debugger interprets the thread identifier as a DECthreads or kernel thread identifier depending on the value of the debugger variable $threadlevel.

trace variable [if expression]
trace [variable] at line_number [if expression]
trace [variable] in function [if expression]
trace [variable] [thread thread_identifier_list]
[at line_number] [if expression]
trace [variable] [thread thread_identifier_list]
[in function] [if expression]

When you use the trace command without an argument, the debugger prints a message but does not suspend program execution when each function is entered. Specify a variable to print a message when the variable value changes. Specify if with an expression to print a message when an expression evaluates to true. When you specify both a variable and an expression, a message is printed only if the expression evaluates to true and the variable has changed.

To print a message when a line or function is encountered, use the second or third syntax form.

If you specify a variable, a message is printed only if the variable has changed when the line or function is encountered.

If you specify an expression, a message is printed only if the expression evaluates to true when the line or function is encountered.

If you specify both a variable and an expression, a message is printed only if the variable has changed and the expression evaluates to true when the line or function is encountered.

The following example traces the variable f when the program is executing the function main:

(ladebug) trace f in main 

Use the trace thread command to set tracepoints in specific threads. If you list one or more thread identifiers, the debugger sets a tracepoint only in those threads you specify. If you omit the thread identifier specification, the debugger sets a tracepoint in all the threads of the application.

tracei [variable] [if expression]
tracei [variable] at address [if expression]
tracei [variable] in function [if expression]
tracei [variable] [thread thread_identifier_list]
[at line_number] [if expression]
tracei [variable] [thread thread_identifier_list]
[in function] [if expression]

When you use the tracei command the debugger prints a message, but does not suspend program execution. Specify a variable to print a message when the variable value changes. Specify an expression to print a message when an expression evaluates to true. When you specify both a variable and an expression, a message is printed only if the expression evaluates to true and the variable has changed.

To print a message when an address or function is encountered, use the second or third syntax form.

If you specify a variable, a message is printed only if the variable has changed when the address or function is encountered.

If you specify an expression, a message is printed only if the expression evaluates to true when the address or function is encountered.

If you specify both a variable and an expression, a message is printed only if the variable has changed and the expression evaluates to true when the address or function is encountered.

The tracei command differs from the trace command in that the debugger evaluates the tracepoint set with the tracei command after the debugger executes each machine instruction. Thus, when you use the tracei command, the debugger performance is affected.

In the following example, a breakpoint is set to print a message every time the function factorial is entered:

(ladebug) tracei factorial

Use the tracei thread command to set tracepoints in specific threads. If you list one or more thread identifiers, the debugger sets a tracepoint only in those threads you specify. If you omit the thread identifier specification, the debugger sets a tracepoint in all the threads of the application.

unsetenv [env_variable]

Removes the specified environment variable. If no variable is specified, all environment variables are removed.

This command is not for the current debuggee's environment, but for the environment of any debuggees subsequently created with fork(2) or with subsequent run or rerun commands.

See Chapter 9 for more information on commands that manipulate the environment of subsequent debuggees.

up [number]

Use the up command or the down command without an argument to change the function scope to the function located one level up or down the stack. Enter a number argument to change the function scope to the function up or down the specified number of levels. If the number of levels exceeds the number of active functions on the stack, the function scope moves up or down as many levels as possible and the debugger issues a warning message.

When the function scope changes, the debugger displays the source line corresponding to the last point of execution in that function.

use [directory]
unuse [directory]
unuse *

Enter the use command without an argument to list the directories the debugger searches for source-code files. Specify a directory argument to make source-code files in that directory available to the debugger. (You can also use the ladebug command -I option to specify search directories.)

Enter the unuse command without an argument to set the search list to the default, the home directory, the current directory, and the directory containing the executable file. Include the name of a directory to remove it from the search list. The asterisk * argument removes all directories from the search list.

whatis expression

The whatis command prints the type of the specified expression. The expression can be any expression that follows the syntax, scope, and visibility rules of the program language.

For C++:

   whatis classname
   whatis [classname::]member
   whatis [classname::]function

The first syntax form of the whatis command for C++ displays the class type. The second form displays the type of a member function or data member. To display all versions of an overloaded function, use the third form.

when {command [, . . . ]}
when if expression {command [, . . . ]}
when at linenumber [if expression] {command
[, . . . ]}
when in function [if expression] {command
[, . . . ]}
when [thread thread_identifier_list] [at line_
number] [if expression] {command [; . . . ]}
when [thread thread_identifier_list] [in
function] [if expression] {command [; . . . ]}

Use the when command to execute the specified command. (The when command does not suspend program execution.) The debugger command must be enclosed in braces. Separate multiple commands with semicolons.

To execute a command when an expression evaluates to true, use the second syntax form. To execute commands when a line or function is encountered, use the third or fourth syntax form.

If you specify an expression, the command is executed only if the expression evaluates true when the line or function is encountered.

Example:

(ladebug) when at 5 {list;where} 

Use the when thread command to set tracepoints in specific threads. If you list one or more thread identifiers, the debugger sets a tracepoint only in those threads you specify. If you omit the thread identifier specification, the debugger sets a tracepoint in all the threads of the application.

wheni {command [, . . . ]}
wheni if expression {command [, . . . ]}
wheni at linenumber [if expression] {command
[, . . . ]}
wheni in function [if expression] {command
[, . . . ]}
wheni [thread thread_identifier_list] [at line_
number] [if expression] {command [; . . . ]}
wheni [thread thread_identifier_list] [in
function] [if expression] {command [; . . . ]}

Use the wheni command to execute the specified command. (The wheni command does not suspend program execution.) The debugger command must be enclosed in braces. Separate multiple commands with semicolons.

To execute a command when an expression evaluates to true, use the second syntax form. To execute a command when an address or function is encountered, use the third or fourth form.

If you specify an expression, the command is executed only if the expression evaluates to true when the address or function is encountered.

The wheni command differs from the when command in that the debugger evaluates the tracepoint set with the wheni command after each machine instruction is executed. Thus, using the wheni command affects performance.

For example, the following command stops program execution, lists ten lines of source code and displays the stack trace when the value of the variable i is equal to 3 in the function main:

(ladebug) wheni in main if i == 3 {wi;where}

Use the wheni thread command to set tracepoints in specific threads. If you list one or more thread identifiers, the debugger sets a tracepoint only in those threads you specify. If you omit the thread identifier specification, the debugger sets a tracepoint in all the threads of the application.

where [number]
where [number] thread thread_identifier_list
where [number] thread all
where [number] thread *

The where command displays the stack trace of currently active functions, for the current thread. The where thread thread_identifier_list command displays the stack trace(s) of the specified thread(s). The where thread all and the where thread * commands are equivalent; they display the stack traces of all threads.

Include the optional number argument to see a specified number of levels at the top of the stack. (Each active function is designated by a number, which can be used as an argument to the func command. The top level on the stack is 0; so if you enter the command where 3 , you will see levels 0, 1, and 2.) If you do not specify the number argument, you will see all levels.

whereis expression

The whereis command shows all declarations of the expression. Each declaration is fully qualified with scope information.
which expression

The which command shows the fully qualified scope information for the instance of the specified expression in the current scope. If available to the debugger, the name of the source file containing the function in which the expression is declared, the name of the function, and the name of the expression are included. The components of the qualification are separated by period (.) characters.

Restrictions

The maximum command-line length is 255 characters. Alias commands can contain no more than 56 arguments.

Related Information

ada(1) c89(1) cc(1) cxx(1) cobol(1) f77(1) f90(1) printf(1) signal(3) 31