History

scripts/gdb: update documentation for lx_per_cpu

Commit db08c53fdd542bb7f83b ("scripts/gdb: fix parameter handling in $lx_per_cpu") changed the parameter handling of lx_per_cpu to use GdbValue instead of parsing the variable name. Update the documentation to reflect the new lx_per_cpu usage. Update the hrtimer_bases example to use rb_tree instead of the timerqueue_head.next pointer removed in commit 511885d7061eda3eb1fa ("lib/timerqueue: Rely on rbtree semantics for next timer").

Illia Ostapyshyn committed 1 year ago

Commit 09e1d931 parent 6be70454 files · +47 −59Browse files

Unified · Split

4 files
  1. Documentation/process/debugging/gdb-kernel-debugging.rst +15 −19
  2. Documentation/translations/zh_CN/dev-tools/gdb-kernel-debugging.rst +15 −19
  3. Documentation/translations/zh_TW/dev-tools/gdb-kernel-debugging.rst +15 −19
  4. scripts/gdb/linux/cpus.py +2 −2
Documentation/process/debugging/gdb-kernel-debugging.rst+15−19
@@ -127,35 +127,31 @@ Examples of using the Linux-provided gdb helpers · 126 unmodified lines
127127
128128 - Make use of the per-cpu function for the current or a specified CPU::
129129
130− (gdb) p $lx_per_cpu("runqueues").nr_running
130+ (gdb) p $lx_per_cpu(runqueues).nr_running
131131 $3 = 1
132− (gdb) p $lx_per_cpu("runqueues", 2).nr_running
132+ (gdb) p $lx_per_cpu(runqueues, 2).nr_running
133133 $4 = 0
134134
135135 - Dig into hrtimers using the container_of helper::
136136
137− (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
138− (gdb) p *$container_of($next, "struct hrtimer", "node")
137+ (gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
138+ (gdb) p *$container_of($leftmost, "struct hrtimer", "node")
139139 $5 = {
140140 node = {
141141 node = {
142− __rb_parent_color = 18446612133355256072,
143− rb_right = 0x0 <irq_stack_union>,
144− rb_left = 0x0 <irq_stack_union>
142+ __rb_parent_color = 18446612686384860673,
143+ rb_right = 0xffff888231da8b00,
144+ rb_left = 0x0
145145 },
146− expires = {
147− tv64 = 1835268000000
148− }
146+ expires = 1228461000000
149147 },
150− _softexpires = {
151− tv64 = 1835268000000
152− },
153− function = 0xffffffff81078232 <tick_sched_timer>,
154− base = 0xffff88003fd0d6f0,
155− state = 1,
156− start_pid = 0,
157− start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
158− start_comm = "swapper/2\000\000\000\000\000\000"
148+ _softexpires = 1228461000000,
149+ function = 0xffffffff8137ab20 <tick_nohz_handler>,
150+ base = 0xffff888231d9b4c0,
151+ state = 1 '\001',
152+ is_rel = 0 '\000',
153+ is_soft = 0 '\000',
154+ is_hard = 1 '\001'
159155 }
160156
161157
Documentation/translations/zh_CN/dev-tools/gdb-kernel-debugging.rst+15−19
@@ -120,35 +120,31 @@ Kgdb内核调试器、QEMU等虚拟机管理程序或基于JTAG的硬件接口 · 119 unmodified lines
120120
121121 - 对当前或指定的CPU使用per-cpu函数::
122122
123− (gdb) p $lx_per_cpu("runqueues").nr_running
123+ (gdb) p $lx_per_cpu(runqueues).nr_running
124124 $3 = 1
125− (gdb) p $lx_per_cpu("runqueues", 2).nr_running
125+ (gdb) p $lx_per_cpu(runqueues, 2).nr_running
126126 $4 = 0
127127
128128 - 使用container_of查看更多hrtimers信息::
129129
130− (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
131− (gdb) p *$container_of($next, "struct hrtimer", "node")
130+ (gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
131+ (gdb) p *$container_of($leftmost, "struct hrtimer", "node")
132132 $5 = {
133133 node = {
134134 node = {
135− __rb_parent_color = 18446612133355256072,
136− rb_right = 0x0 <irq_stack_union>,
137− rb_left = 0x0 <irq_stack_union>
135+ __rb_parent_color = 18446612686384860673,
136+ rb_right = 0xffff888231da8b00,
137+ rb_left = 0x0
138138 },
139− expires = {
140− tv64 = 1835268000000
141− }
139+ expires = 1228461000000
142140 },
143− _softexpires = {
144− tv64 = 1835268000000
145− },
146− function = 0xffffffff81078232 <tick_sched_timer>,
147− base = 0xffff88003fd0d6f0,
148− state = 1,
149− start_pid = 0,
150− start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
151− start_comm = "swapper/2\000\000\000\000\000\000"
141+ _softexpires = 1228461000000,
142+ function = 0xffffffff8137ab20 <tick_nohz_handler>,
143+ base = 0xffff888231d9b4c0,
144+ state = 1 '\001',
145+ is_rel = 0 '\000',
146+ is_soft = 0 '\000',
147+ is_hard = 1 '\001'
152148 }
153149
154150
Documentation/translations/zh_TW/dev-tools/gdb-kernel-debugging.rst+15−19
@@ -116,35 +116,31 @@ Kgdb內核調試器、QEMU等虛擬機管理程序或基於JTAG的硬件接口 · 115 unmodified lines
116116
117117 - 對當前或指定的CPU使用per-cpu函數::
118118
119− (gdb) p $lx_per_cpu("runqueues").nr_running
119+ (gdb) p $lx_per_cpu(runqueues).nr_running
120120 $3 = 1
121− (gdb) p $lx_per_cpu("runqueues", 2).nr_running
121+ (gdb) p $lx_per_cpu(runqueues, 2).nr_running
122122 $4 = 0
123123
124124 - 使用container_of查看更多hrtimers信息::
125125
126− (gdb) set $next = $lx_per_cpu("hrtimer_bases").clock_base[0].active.next
127− (gdb) p *$container_of($next, "struct hrtimer", "node")
126+ (gdb) set $leftmost = $lx_per_cpu(hrtimer_bases).clock_base[0].active.rb_root.rb_leftmost
127+ (gdb) p *$container_of($leftmost, "struct hrtimer", "node")
128128 $5 = {
129129 node = {
130130 node = {
131− __rb_parent_color = 18446612133355256072,
132− rb_right = 0x0 <irq_stack_union>,
133− rb_left = 0x0 <irq_stack_union>
131+ __rb_parent_color = 18446612686384860673,
132+ rb_right = 0xffff888231da8b00,
133+ rb_left = 0x0
134134 },
135− expires = {
136− tv64 = 1835268000000
137− }
135+ expires = 1228461000000
138136 },
139− _softexpires = {
140− tv64 = 1835268000000
141− },
142− function = 0xffffffff81078232 <tick_sched_timer>,
143− base = 0xffff88003fd0d6f0,
144− state = 1,
145− start_pid = 0,
146− start_site = 0xffffffff81055c1f <hrtimer_start_range_ns+20>,
147− start_comm = "swapper/2\000\000\000\000\000\000"
137+ _softexpires = 1228461000000,
138+ function = 0xffffffff8137ab20 <tick_nohz_handler>,
139+ base = 0xffff888231d9b4c0,
140+ state = 1 '\001',
141+ is_rel = 0 '\000',
142+ is_soft = 0 '\000',
143+ is_hard = 1 '\001'
148144 }
149145
150146
scripts/gdb/linux/cpus.py+2−2
@@ -141,7 +141,7 @@ LxCpus() · 140 unmodified lines
141141 class PerCpu(gdb.Function):
142142 """Return per-cpu variable.
143143
144−$lx_per_cpu("VAR"[, CPU]): Return the per-cpu variable called VAR for the
144+$lx_per_cpu(VAR[, CPU]): Return the per-cpu variable called VAR for the
145145 given CPU number. If CPU is omitted, the CPU of the current context is used.
146146 Note that VAR has to be quoted as string."""
147147
@@ -158,7 +158,7 @@ PerCpu() · 10 unmodified lines
158158 class PerCpuPtr(gdb.Function):
159159 """Return per-cpu pointer.
160160
161−$lx_per_cpu_ptr("VAR"[, CPU]): Return the per-cpu pointer called VAR for the
161+$lx_per_cpu_ptr(VAR[, CPU]): Return the per-cpu pointer called VAR for the
162162 given CPU number. If CPU is omitted, the CPU of the current context is used.
163163 Note that VAR has to be quoted as string."""
164164

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t