The nm subcommand translates symbols to addresses.
The ts subcommand translates addresses to symbolic representations.
nm symbol
ts EffectiveAddress
KDB(0)> nm __ublock print symbol value Symbol Address : 2FF3B400 KDB(0)> ts E3000000 print symbol name proc+000000
The ns subcommand toggles symbolic name translation on and off.
ns
KDB(0)> set 2 do not print context mst_wanted is false KDB(0)> f print stack frame thread+00D080 STACK: [000095A4].simple_lock+0000A4 () [0007F4A0]v_prefreescb+000038 (??, ??) [00017AC4]isync_vcs3+000004 (??, ??) ____ Exception (2FF40000) ____ [00009414].unlock_enable+000110 () [00009410].unlock_enable+00010C () [0000CDD0]as_det+0000A8 (??, ??) [001B33F8]shm_freespace+000080 (??, ??) [001F6A04]rmmapseg+0000D0 (??) [001E41DC]vm_map_entry_delete+00023C (??, ??) [001E4828]vm_map_delete+000158 (??, ??, ??) [001E5034]vm_map_remove+000064 (??, ??, ??) [001E6514]munmap+0000C0 (??, ??) [000036FC].sys_call+000000 () KDB(0)> ns enable no symbol printing Symbolic name translation off KDB(0)> f print stack frame E600D080 STACK: 000095A4 () 0007F4A0 (??, ??) 00017AC4 (??, ??) ____ Exception (2FF40000) ____ 00009414 () 00009410 () 0000CDD0 (??, ??) 001B33F8 (??, ??) 001F6A04 (??) 001E41DC (??, ??) 001E4828 (??, ??, ??) 001E5034 (??, ??, ??) 001E6514 (??, ??) 000036FC () KDB(0)> ns disable no symbol printing Symbolic name translation on KDB(0)>
The which subcommand displays the name of the kernel source file containing symbol or addr.
which symbol | addr
Alias: wf
> which main Addr: 0022A700 Symbol: .main Name: ../../../../../src/bos/kernel/si/main.c
Helps to interprete a dump of memory by formatting it into a given C language data structure and displaying it. The print subcommand prints arrays, follows link lists, and displays the lists of loaded symbols. It also draws the data structure information from a debug object file that has been built using the -g -qdbxextra flags. For example, a symbol file to print the LFS structures can be built as follows:
$ echo '#include <sys/vnode.h>' > symbols.c $ echo 'main() { ; }' >> symbols.c $ cc -g -o symbols symbols.c -qdbxextra /* for 32 bit kernel */ $ cc -g -q64 -o symbols symbols.c -qdbxextra /* for 64 bit kernel */
Although the usage is same, the method for loading this symbol file is different for kdb command and KDB debugger. For the kdb command, the symbol file is passed by setting the KDBSYM environmental variable as follows:
$ KDBSYM=`/bin/pwd`/symbols ; export KDBSYM $ kdb dump unix (0)> print vnode 012345
For the kdb command, the symbol file can be generated automatically when KDB is run using -i flag. For example, the vnode structure at 0x012345 can also be printed, as follows:
$ kdb -i /usr/include/sys/vnode.h (0)> print vnode 0x012345
For the KDB debugger, the symbol file must be created and loaded into the kernel ahead of time, that is, before breaking into the KDB debugger. Use the bosdebug command to create the symbol file, as follows:
$ bosdebug -l symbols Now you may break into kdb debugger and print structures (0)> print vnode 0x012345
In the KDB debugger, multiple symbol files can be loaded, but it is responsibility of the user to ensure that the symbols are consistent. Symbols can be flushed out from the kernel memory as follows:
$ bosdebug -f
print [-l offset | name [-e end_val][type] address] [ [-a count] [type] address ] [ -d default_type ] [ -p pattern_type]
(0)> print -e 1F800000 -l i_forw inode 134D43D8
(0)> print -a 2 pvthread pvthread
(0)> print -p *node (0)> print -p node* (0)> print -p *
> print pathlook 0x010000 struct pathlook { uint hash = 0x48002569; uint length = 0x880f0008; struct pathlook *next = 0x2c000001; struct file *fp = 0x2c800005; time_t pl_timestamp = 0x418200bc; uint64 pl_filesize = 0x7c8e7008888f008b; unsigned char type = 0x88; unsigned char pl_flags = 0xaf ' '; unsigned char name[0] = 00; } foo;
Displays the symptom string for a dump. The symptom subcommand is not valid on a running system. The optional -e flag will create an error log entry containing the symptom string, and is normally only used by the system and not entered manually. The symptom string can be used to identify duplicate problems.
symptom [-e]
The following example demonstrates the kdb command running on a dump:
<0> symptom PIDS/5765C3403 LVLS/430 PCSS/SPI1 MS/300 FLDS/uiocopyin VALU/7ce621ae FLDS/uiomove VALU/13c
The following example demontrates the kdb command running on a dump with symptom invoked with -e flag.
<0> symptom -e PIDS/5765C3403 LVLS/430 PCSS/SPI1 MS/300 FLDS/uiocopyin VALU/7ce621ae FLDS/uiomove VALU/13c
The corresponding system errlog entry is similar to the following:
LABEL: SYSDUMP_SYMP .... Detail Data DUMP STATUS LED:300 csa:2ff3b400 uiocopyin_ppc 1c4 uiomove 13c ....