Use correct syntax markup for shell
Approved by: carlavilla
This commit is contained in:
parent
55c95407aa
commit
a9a9e66105
666 changed files with 17924 additions and 17924 deletions
|
|
@ -73,7 +73,7 @@ Check [.filename]#/etc/fstab# or man:swapinfo[8] for a list of swap devices.
|
|||
====
|
||||
Make sure the `dumpdir` specified in man:rc.conf[5] exists before a kernel crash!
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# mkdir /var/crash
|
||||
# chmod 700 /var/crash
|
||||
|
|
@ -96,7 +96,7 @@ The man:crashinfo[8] utility generates a text file containing a summary of infor
|
|||
|
||||
If you are testing a new kernel but need to boot a different one in order to get your system up and running again, boot it only into single user mode using the `-s` flag at the boot prompt, and then perform the following steps:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# fsck -p
|
||||
# mount -a -t ufs # make sure /var/crash is writable
|
||||
|
|
@ -111,7 +111,7 @@ This instructs man:savecore[8] to extract a kernel dump from [.filename]#/dev/ad
|
|||
|
||||
The kernel includes a man:sysctl[8] node that requests a kernel panic. This can be used to verify that your system is properly configured to save kernel crash dumps. You may wish to remount existing file systems as read-only in single user mode before triggering the crash to avoid data loss.
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# shutdown now
|
||||
...
|
||||
|
|
@ -134,21 +134,21 @@ This section covers man:kgdb[1]. The latest version is included in the package:d
|
|||
|
||||
To enter into the debugger and begin getting information from the dump, start kgdb:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# kgdb -n N
|
||||
....
|
||||
|
||||
Where _N_ is the suffix of the [.filename]#vmcore.N# to examine. To open the most recent dump use:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# kgdb -n last
|
||||
....
|
||||
|
||||
Normally, man:kgdb[1] should be able to locate the kernel running at the time the dump was generated. If it is not able to locate the correct kernel, pass the pathname of the kernel and dump as two arguments to kgdb:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# kgdb /boot/kernel/kernel /var/crash/vmcore.0
|
||||
....
|
||||
|
|
@ -157,7 +157,7 @@ You can debug the crash dump using the kernel sources just like you can for any
|
|||
|
||||
This dump is from a 5.2-BETA kernel and the crash comes from deep within the kernel. The output below has been modified to include line numbers on the left. This first trace inspects the instruction pointer and obtains a back trace. The address that is used on line 41 for the `list` command is the instruction pointer and can be found on line 17. Most developers will request having at least this information sent to them if you are unable to debug the problem yourself. If, however, you do solve the problem, make sure that your patch winds its way into the source tree via a problem report, mailing lists, or by being able to commit it!
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
1:# cd /usr/obj/usr/src/sys/KERNCONF
|
||||
2:# kgdb kernel.debug /var/crash/vmcore.0
|
||||
|
|
@ -281,7 +281,7 @@ Once your DDB kernel is running, there are several ways to enter DDB. The first,
|
|||
|
||||
The second scenario is to drop to the debugger once the system has booted. There are two simple ways to accomplish this. If you would like to break to the debugger from the command prompt, simply type the command:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# sysctl debug.kdb.enter=1
|
||||
....
|
||||
|
|
@ -301,7 +301,7 @@ to the kernel configuration file and rebuild/reinstall.
|
|||
|
||||
The DDB commands roughly resemble some `gdb` commands. The first thing you probably need to do is to set a breakpoint:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
break function-name address
|
||||
....
|
||||
|
|
@ -310,14 +310,14 @@ Numbers are taken hexadecimal by default, but to make them distinct from symbol
|
|||
|
||||
To exit the debugger and continue execution, type:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
continue
|
||||
....
|
||||
|
||||
To get a stack trace of the current thread, use:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
trace
|
||||
....
|
||||
|
|
@ -326,7 +326,7 @@ To get a stack trace of an arbitrary thread, specify a process ID or thread ID a
|
|||
|
||||
If you want to remove a breakpoint, use
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
del
|
||||
del address-expression
|
||||
|
|
@ -334,28 +334,28 @@ If you want to remove a breakpoint, use
|
|||
|
||||
The first form will be accepted immediately after a breakpoint hit, and deletes the current breakpoint. The second form can remove any breakpoint, but you need to specify the exact address; this can be obtained from:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
show b
|
||||
....
|
||||
|
||||
or:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
show break
|
||||
....
|
||||
|
||||
To single-step the kernel, try:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
s
|
||||
....
|
||||
|
||||
This will step into functions, but you can make DDB trace them until the matching return statement is reached by:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
n
|
||||
....
|
||||
|
|
@ -367,7 +367,7 @@ This is different from ``gdb``'s `next` statement; it is like ``gdb``'s `finish`
|
|||
|
||||
To examine data from memory, use (for example):
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
x/wx 0xf0133fe0,40
|
||||
x/hd db_symtab_space
|
||||
|
|
@ -377,14 +377,14 @@ To examine data from memory, use (for example):
|
|||
|
||||
for word/halfword/byte access, and hexadecimal/decimal/character/ string display. The number after the comma is the object count. To display the next 0x10 items, simply use:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
x ,10
|
||||
....
|
||||
|
||||
Similarly, use
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
x/ia foofunc,10
|
||||
....
|
||||
|
|
@ -393,7 +393,7 @@ to disassemble the first 0x10 instructions of `foofunc`, and display them along
|
|||
|
||||
To modify memory, use the write command:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
w/b termbuf 0xa 0xb 0
|
||||
w/w 0xf0010030 0 0
|
||||
|
|
@ -403,28 +403,28 @@ The command modifier (`b`/`h`/`w`) specifies the size of the data to be written,
|
|||
|
||||
If you need to know the current registers, use:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
show reg
|
||||
....
|
||||
|
||||
Alternatively, you can display a single register value by e.g.
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
p $eax
|
||||
....
|
||||
|
||||
and modify it by:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
set $eax new-value
|
||||
....
|
||||
|
||||
Should you need to call some kernel functions from DDB, simply say:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
call func(arg1, arg2, ...)
|
||||
....
|
||||
|
|
@ -433,28 +433,28 @@ The return value will be printed.
|
|||
|
||||
For a man:ps[1] style summary of all running processes, use:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
ps
|
||||
....
|
||||
|
||||
Now you have examined why your kernel failed, and you wish to reboot. Remember that, depending on the severity of previous malfunctioning, not all parts of the kernel might still be working as expected. Perform one of the following actions to shut down and reboot your system:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
panic
|
||||
....
|
||||
|
||||
This will cause your kernel to dump core and reboot, so you can later analyze the core on a higher level with man:kgdb[1].
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
call boot(0)
|
||||
....
|
||||
|
||||
Might be a good way to cleanly shut down the running system, `sync()` all disks, and finally, in some cases, reboot. As long as the disk and filesystem interfaces of the kernel are not damaged, this could be a good way for an almost clean shutdown.
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
reset
|
||||
....
|
||||
|
|
@ -463,7 +463,7 @@ This is the final way out of disaster and almost the same as hitting the Big Red
|
|||
|
||||
If you need a short command summary, simply type:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
help
|
||||
....
|
||||
|
|
@ -479,7 +479,7 @@ GDB has already supported _remote debugging_ for a long time. This is done using
|
|||
|
||||
You should configure the kernel in question with `config -g` if building the "traditional" way. If building the "new" way, make sure that `makeoptions DEBUG=-g` is in the configuration. In both cases, include `DDB` in the configuration, and compile it as usual. This gives a large binary, due to the debugging information. Copy this kernel to the target machine, strip the debugging symbols off with `strip -x`, and boot it using the `-d` boot option. Connect the serial line of the target machine that has "flags 080" set on its uart device to any serial line of the debugging host. See man:uart[4] for information on how to set the flags on an uart device. Now, on the debugging machine, go to the compile directory of the target kernel, and start `gdb`:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
% kgdb kernel
|
||||
GDB is free software and you are welcome to distribute copies of it
|
||||
|
|
@ -492,14 +492,14 @@ Copyright 1996 Free Software Foundation, Inc...
|
|||
|
||||
Initialize the remote debugging session (assuming the first serial port is being used) by:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
(kgdb) target remote /dev/cuau0
|
||||
....
|
||||
|
||||
Now, on the target host (the one that entered DDB right before even starting the device probe), type:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
Debugger("Boot flags requested debugger")
|
||||
Stopped at Debugger+0x35: movb $0, edata+0x51bc
|
||||
|
|
@ -508,14 +508,14 @@ db> gdb
|
|||
|
||||
DDB will respond with:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
Next trap will enter GDB remote protocol mode
|
||||
....
|
||||
|
||||
Every time you type `gdb`, the mode will be toggled between remote GDB and local DDB. In order to force a next trap immediately, simply type `s` (step). Your hosting GDB will now gain control over the target kernel:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
Remote debugging using /dev/cuau0
|
||||
Debugger (msg=0xf01b0383 "Boot flags requested debugger")
|
||||
|
|
@ -579,7 +579,7 @@ To enable FireWire(R) and Dcons support in man:loader[8] on i386 or amd64:
|
|||
|
||||
Add `LOADER_FIREWIRE_SUPPORT=YES` in [.filename]#/etc/make.conf# and rebuild man:loader[8]:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# cd /sys/boot/i386 && make clean && make && make install
|
||||
....
|
||||
|
|
@ -588,7 +588,7 @@ To enable man:dcons[4] as an active low-level console, add `boot_multicons="YES"
|
|||
|
||||
Here are a few configuration examples. A sample kernel configuration file would contain:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
device dcons
|
||||
device dcons_crom
|
||||
|
|
@ -600,7 +600,7 @@ options ALT_BREAK_TO_DEBUGGER
|
|||
|
||||
And a sample [.filename]#/boot/loader.conf# would contain:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
dcons_crom_load="YES"
|
||||
dcons_gdb=1
|
||||
|
|
@ -613,7 +613,7 @@ hw.firewire.dcons_crom.force_console=1
|
|||
|
||||
To enable FireWire(R) support in the kernel on the _host machine_:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# kldload firewire
|
||||
....
|
||||
|
|
@ -622,7 +622,7 @@ Find out the EUI64 (the unique 64 bit identifier) of the FireWire(R) host contro
|
|||
|
||||
Run man:dconschat[8], with:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# dconschat -e \# -br -G 12345 -t 00-11-22-33-44-55-66-77
|
||||
....
|
||||
|
|
@ -648,7 +648,7 @@ The following key combinations can be used once man:dconschat[8] is running:
|
|||
|
||||
Attach remote GDB by starting man:kgdb[1] with a remote debugging session:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
kgdb -r :12345 kernel
|
||||
....
|
||||
|
|
@ -659,7 +659,7 @@ Here are some general tips:
|
|||
|
||||
To take full advantage of the speed of FireWire(R), disable other slow console drivers:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# conscontrol delete ttyd0 # serial console
|
||||
# conscontrol delete consolectl # video/keyboard
|
||||
|
|
@ -667,7 +667,7 @@ To take full advantage of the speed of FireWire(R), disable other slow console d
|
|||
|
||||
There exists a GDB mode for man:emacs[1]; this is what you will need to add to your [.filename]#.emacs#:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
(setq gud-gdba-command-name "kgdb -a -a -a -r :12345")
|
||||
(setq gdb-many-windows t)
|
||||
|
|
@ -677,7 +677,7 @@ M-x gdba
|
|||
|
||||
And for DDD ([.filename]#devel/ddd#):
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# remote serial protocol
|
||||
LANG=C ddd --debugger kgdb -r :12345 kernel
|
||||
|
|
@ -695,21 +695,21 @@ To use man:dcons[4] with KVM:
|
|||
|
||||
Dump a man:dcons[4] buffer of a live system:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# dconschat -1
|
||||
....
|
||||
|
||||
Dump a man:dcons[4] buffer of a crash dump:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# dconschat -1 -M vmcore.XX
|
||||
....
|
||||
|
||||
Live core debugging can be done via:
|
||||
|
||||
[source,bash]
|
||||
[source,shell]
|
||||
....
|
||||
# fwcontrol -m target_eui64
|
||||
# kgdb kernel /dev/fwmem0.2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue