ctx subcommand
The ctx subcommand is used to switch between cpu contexts when viewing a system memory dump.
Note: This subcommand is only available within the kdb command. It cannot be used with the KDB kernel debugger.
Format
ctx [cpu number]
Parameters
Item | Description |
---|---|
cpu number | decimal value or expression indicating a CPU number. If the CPU number is not given as an parameter, the initial context is restored. |
Note: You can select KDB context to see more information
through the stack trace subcommand. For example, you could see a complete
stack of a kernel panic. However, KDB context is available only if
the running kernel is booted with KDB kernel debugger.
Other
context
Examples
The following is an example of how to use the ctx subcommand:
$ kdb dump unix //dump analysis
Preserving 628325 bytes of symbol table
First symbol sys_resource
Component Names:
1) proc
2) thrd
3) errlg
4) bos
5) vmm
6) bscsi
7) scdisk
8) lvm
9) tty
10) netstat
11) lent_dd
PFT:
id....................0007
raddr.....0000000001000000 eaddr.....0000000001000000
size..............00800000 align.............00800000
valid..1 ros....0 holes..0 io.....0 seg....1 wimg...2
PVT:
id....................0008
raddr.....00000000004B8000 eaddr.....00000000004B8000
size..............000FFD60 align.............00001000
valid..1 ros....0 holes..0 io.....0 seg....1 wimg...2
Dump analysis on POWER_PC POWER_604 machine with 8 cpu(s)
Processing symbol table...
.......................done
(0)> stat //machine status
RS6K_SMP_MCA POWER_PC POWER_604 machine with 8 cpu(s)
.......... SYSTEM STATUS
sysname... AIX nodename.. jumbo32
release... 3 version... 4
machine... 00920312A0 nid....... 920312A0
time of crash: Tue Jul 22 09:46:22 1997
age of system: 1 day, 0 min., 35 sec.
.......... PANIC STRING
assert(v_lookup(sid,pno) == -1)
.......... SYSTEM MESSAGES
AIX 6.1
Starting physical processor #1 as logical #1... done.
Starting physical processor #2 as logical #2... done.
Starting physical processor #3 as logical #3... done.
Starting physical processor #4 as logical #4... done.
Starting physical processor #5 as logical #5... done.
Starting physical processor #6 as logical #6... done.
Starting physical processor #7 as logical #7... done.
[v_lists.c #727]
<- end_of_buffer
(0)> ctx 0 //KDB context of CPU 0
Switch to KDB context of cpu 0
(0)> dr iar //current instruction
iar : 00009414
.unlock_enable+000110 lwz r0,8(stkp) r0=0,8(stkp)=mststack+00AD18
(0)> ctx 1 //KDB context of CPU 1
Switch to KDB context of cpu 1
(1)> dr iar //current instruction
iar : 000BDB68
.kunlockl+000118 blr <.ld_usecount+0005BC> r3=0000000B
(1)> ctx 2 //KDB context of CPU 2
Switch to KDB context of cpu 2
(2)> dr iar //current instruction
iar : 00027634
.tstart+000284 blr <.sys_timer+000964> r3=00000005
(2)> ctx 3 //KDB context of CPU 3
Switch to KDB context of cpu 3
(3)> dr iar //current instruction
iar : 01B6A580
01B6A580 ori r3,r31,0 <00000089> r3=50001000,r31=00000089
(3)> ctx 4 //KDB context of CPU 4
Switch to KDB context of cpu 4
(4)> dr iar //current instruction
iar : 00014BFC
.panic_trap+000004 bl <.panic_dump> r3=_$STATIC+000294
(4)> f //current stack
__kdb_thread+0002F0 STACK:
[00014BFC].panic_trap+000004 ()
[0003ACAC]v_inspft+000104 (??, ??, ??)
[00048DA8]v_inherit+0004A0 (??, ??, ??)
[000A7ECC]v_preinherit+000058 (??, ??, ??)
[00027BFC]begbt_603_patch_2+000008 (??, ??)
Machine State Save Area [2FF3B400]
iar : 00027AEC msr : 000010B0 cr : 22222222 lr : 00243E58
ctr : 00000000 xer : 00000000 mq : 00000000
r0 : 000A7E74 r1 : 2FF3B220 r2 : 002EBC70 r3 : 00013350 r4 : 00000000
r5 : 00000100 r6 : 00009030 r7 : 2FF3B400 r8 : 00000106 r9 : 00000000
r10 : 00243E58 r11 : 2FF3B400 r12 : 000010B0 r13 : 000C1C80 r14 : 2FF22A88
r15 : 20022DB8 r16 : 20006A98 r17 : 20033128 r18 : 00000000 r19 : 0008AD56
r20 : B02A6038 r21 : 0000006A r22 : 00000000 r23 : 0000FFFF r24 : 00000100
r25 : 00003262 r26 : 00000000 r27 : B02B8AEC r28 : B02A9F70 r29 : 00000001
r30 : 00003350 r31 : 00013350
s0 : 00000000 s1 : 007FFFFF s2 : 0000864B s3 : 007FFFFF s4 : 007FFFFF
s5 : 007FFFFF s6 : 007FFFFF s7 : 007FFFFF s8 : 007FFFFF s9 : 007FFFFF
s10 : 007FFFFF s11 : 00001001 s12 : 00002002 s13 : 6001F01F s14 : 00004004
s15 : 007FFFFF
prev 00000000 kjmpbuf 00000000 stackfix 00000000 intpri 0B
curid 0008AD56 sralloc E01E0000 ioalloc 00000000 backt 00
flags 00 tid 00000000 excp_type 00000000
fpscr 00000000 fpeu 01 fpinfo 00 fpscrx 00000000
o_iar 00000000 o_toc 00000000 o_arg1 00000000
excbranch 00000000 o_vaddr 00000000 mstext 00000000
Except :
csr 00000000 dsisr 40000000 bit set: DSISR_PFT
srval 6000864B dar 2FF22FF8 dsirr 00000106
[00027AEC].backt+000000 (00013350, 00000000 [??])
[00243E54]vms_delete+0004DC (??)
[00256838]shmfreews+0000B0 ()
[000732B4]freeuspace+000010 ()
[00072EAC]kexitx+000688 (??)
(4)> ctx //AIX context of CPU 4
Restore initial context
(4)> f //current stack
thread+031920 STACK:
[00027AEC].backt+000000 (00013350, 00000000 [??])
[00243E54]vms_delete+0004DC (??)
[00256838]shmfreews+0000B0 ()
[000732B4]freeuspace+000010 ()
[00072EAC]kexitx+000688 (??)
(4)>