| Previous | Contents | Index |
When the operating system crashes, the dump function copies core memory into swap partitions. Then at system reboot time, this copy of core memory is copied into the crash dump file, which you can analyze.
When the operating system hangs, you may need to force a crash dump.
17.4 Debugging Loadable Drivers
The procedure for debugging loadable drivers depends on whether you are doing local or remote kernel debugging.
Loadable Drivers and Local Kernel Debugging
For local kernel debugging, any loadable drivers already present in the kernel are automatically loaded into the debugger once when the debugger is started. Since the kernel is running, additional drivers can be loaded at any time. If you wish to obtain the most current list of loaded drivers, you can manually load any new driver information with the following command:
(ladebug) readsharedobj /driver-directory/driver.mod |
The list of drivers currently known to ladebug can be displayed as follows:
(ladebug) listobj
ObjectName Start Addr Size Symbols
(bytes) Loaded
----------------------------------------------------------------------------
/vmunix 0xfffffc0000230000 2442992 Yes
/var/subsys/dna_netman.mod
0xffffffff90ce0000 49152 Yes
/var/subsys/dna_dli.mod
0xffffffff90cf0000 57344 Yes
/var/subsys/dna_base.mod
0xffffffff90d04000 393216 Yes
/var/subsys/dna_xti.mod
0xffffffff90b0a000 8192 Yes
|
Loadable Drivers and Remote Kernel Debugging
For remote kernel debugging, you can debug loadable drivers as follows:
/usr/opt/TMU100 |
tmux: Subsystem_Description = TMUX device driver Module_Config_Name = tmux Module_Config1 = controller tmux0 at * Module_Type = Dynamic Module_Path = /usr/opt/TMU100/tmux.mod Device_Dir = /dev/streams Device_Char_Major = Any Device_Char_Minor = 0 Device_Char_Files = tmux0 |
sysconfigdb -a -f /usr/opt/TMU100/stanza.loadable tmux sysconfigdb -s cp /usr/opt/TMU100/tmux.mod /subsys/tmux.mod cd /subsys ln -s device.mth tmux.mth |
(ladebug) stop in subsys_preconfigure
[#1: stop in void subsys_preconfigure(caddr_t) ]
(ladebug) run
|
(ladebug) print subsys
0xfffffc0000620cd4="generic"
|
# sysconfig -c tmux
|
(ladebug) print subsys
0xfffffc0000620cd4="tmux"
(ladebug) readsharedobj /subsys/tmux.mod
|
(ladebug) stop in tmux_configure
[#2: stop in int tmux_configure(cfg_op_t, caddr_t, ulong, caddr_t, ulong) ]
(ladebug) cont
[2] stopped at [int tmux_configure(cfg_op_t, caddr_t, ulong, caddr_t,
ulong):933 0xffffffff89a14028]
933 sa.sa_version = OSF_STREAMS_11;
(ladebug) next
stopped at [int tmux_configure(cfg_op_t, caddr_t, ulong, caddr_t,
ulong):934 0xffffffff89a14034]
934 sa.sa_flags = STR_IS_DEVICE | STR_SYSV4_OPEN;
(ladebug) print sa.sa_version
84107547
|
If you use sysconfig to unload and then subsequently reload a driver in a kernel actively being debugged by ladebug, any breakpoints previously present in that driver will be lost. To reestablish those breakpoints in the newly loaded subsystem, issue the following ladebug commands prior to continuing:
|
ladebug --- Invokes the command interface of the debugger.dxladebug --- Invokes the graphical user interface of the debugger.
ladebug [-I directory] [-c file]
[-prompt string]
[-nosharedobjs]
[-pid process_id executable_file]
[-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]]
dxladebug [-iow ] [-k | -kernel] [-P program_arguments]
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.
The following table describes the options and parameters for the DIGITAL Ladebug debugger command line debugger:The following table describes the options and parameters for the dxladebug command:
-iow Invokes the graphical user 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.
1 General Instructions for Using Debugger Commands
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 on 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 100,000 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:
For example, the commands print (thread) and print (thread* )t are valid. The parentheses enable the debugger to distinguish an identifier from a keyword. Example REF-1 shows how to enter multiple commands on a single line.
| Example REF-1 Entering Multiple Commands on a Single Line |
|---|
(ladebug) stop in main;run
[#1: stop in main ]
[1] stopped at [main:4 0x120000a40]
4 for (i=1 ; i<3 ; i++) {
(ladebug) where
>0 0x120000a40 in main() sample.c:4
(ladebug)
|
The debugger lets you use abbreviations for frequently used commands. These abbreviations are called aliases.
Several aliases are predefined by the debugger. A complete list of predefined aliases is in the description of the alias command in Part 5, Command Reference, and is also displayed by the debugger in response to the alias command with no arguments.
You can also create your own aliases. Example REF-2 creates an alias that sets a breakpoint, runs your program, and performs a stack trace.
| Example REF-2 Creating an Alias |
|---|
(ladebug) alias cs
alias cs is not defined
(ladebug) alias cs "stop at 5; run; where"
(ladebug) alias cs
cs stop at 5; run; where
(ladebug) cs
.oS
[#1: stop at "sample.c":5 ]
[1] stopped at [main:5 0x120000b1c]
5 f = factorial(i);
>0 0x120000b1c in main() sample.c:5
(ladebug)
|
Aliases may also contain parameters. In Example REF-3, the alias defined in Example REF-2 is modified to specify the breakpoint's line number when you enter the abbreviated alias command.
| Example REF-3 Defining an Alias with a Parameter |
|---|
(ladebug) alias cs(x) "stop at x; run; where"
(ladebug) alias cs
cs(x) stop at x; run; where
(ladebug) cs(5)
[#1: stop at "sample.c":5 ]
[1] stopped at [main:5 0x120000b1c]
5 f = factorial(i);
>0 0x120000b1c in main() sample.c:5
(ladebug)
|
You can nest aliases. You can define one alias and use that alias in the definition of another alias. In Example REF-4, such an alias is defined and then used in the definition of another alias.
| Example REF-4 Nesting Aliases |
|---|
(ladebug) alias begin "bp main; run"
(ladebug) alias sp(x,v) ""begin; stop at x; p v""
(ladebug) alias sp
sp(x, v) begin; stop at x; print v
(ladebug) sp(10,i)
[#4: stop in main ]
[4] stopped at [main:4 0x120001180]
4 for (i=1 ; i<=3 ; i++) {
0
(ladebug)
|
The debugger maintains a list of the commands you enter. Using an abbreviated command sequence, you can reenter a command without retyping the entire command (a history feature). Pressing the Return key at the debugger prompt repeats the last command, provided the $repeatmode variable is set to 1, which is the default. Entering two exclamation points (!!) at the debugger prompt also repeats the last command (regardless of the setting of the $repeatmode variable).
You can examine the list of recently entered commands by entering the history command at the debugger prompt.
You can also reenter a command by entering an exclamation point
followed by the beginning of the command string. For example, to
reenter the command deactivate 3, enter
the command !dea. You can also use the
arrow keys to reenter commands if $editline is set to 1, which is the default.
1.1 Executing System Commands from the Command Interface
The sh command allows you to execute Bourne shell commands without exiting the debugger.
Example REF-5 uses the shell command sh to list information about a file.
In Example REF-6 the grep shell command displays the lines containing PROGRAM in the Fortran source file data2.f90.
| Example REF-5 Executing an Operating System Command |
|---|
(ladebug) sh ls -l sample.c -rw-r----- 1 Ladebug 259 May 15 13:08 sample.c (ladebug) |
| Example REF-6 Displaying an Identifier Using an Operating System Command |
|---|
(ladebug) sh grep PROGRAM data2.f90
PROGRAM DATA
END PROGRAM DATA
|
You can also spawn the Bourne shell from the debugger by issuing:
(ladebug) sh sh |
You can specify a debugger prompt when you start the debugger from the shell with the ladebug -prompt command. The default prompt is (ladebug) .
For example, in Example REF-7, the argument to the -prompt option is enclosed in quotes so that spaces at the end of the prompt will visually separate the prompt from the debugger commands.
| Example REF-7 Specifying a Debugger Prompt |
|---|
% ladebug -prompt ""debug "" sample Welcome to the Ladebug Debugger Version 4.0 ------------------ object file name: sample Reading symbolic information ...done debug stop in main;r [#1: stop in main ] debug |
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. dd Print a 32-bit (4 byte) decimal display. uu Print a 32-bit (4 byte) unsigned decimal display. o Print a short word in octal. O Print a long word in octal. oo Print a 32-bit (4 byte) octal display. x Print a short word in hexadecimal. X Print a long word in hexadecimal. xx Print a 32-bit (4 byte) unsigned hexadecimal display. 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. The # command must be the first identifier on the command line. (White space can precede this command.)
!!
! 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)] "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:
- The name of another alias, if the nested alias is the first identifier in the definition; for example, you can define a nested alias and invoke the alias as follows:
(ladebug) alias begin "stop in main; run" (ladebug) alias pv(x) "begin; print(x)" (ladebug) pv(i)- A string in quotation marks, specified with backslashes before the quotation marks, as in the following two examples:
Previous Next Contents Index