Commit 75c3a4b
committed
scripts/gdb/symbols: Fix BPF debug on older GDB
The GDB python script for BPF uses the recently added '.bytes' method [0],
which is only available with GDB 14+ and otherwise leads to failures:
(gdb) lx-symbols
loading vmlinux
scanning for modules in /home/kodidev/linux
loading @0xbf008000: .../tools/testing/selftests/bpf/bpf_testmod.ko
loading @0xbf000000: .../kernel/bpf/preload/bpf_preload.ko
Traceback (most recent call last):
File "/home/kodidev/linux/scripts/gdb/linux/symbols.py", line 321, in invoke
self.bpf_ksym_monitor = bpf.KsymMonitor(self.add_bpf_ksym,
File "/home/kodidev/linux/scripts/gdb/linux/bpf.py", line 67, in __init__
self.notify_initial()
File "/home/kodidev/linux/scripts/gdb/linux/bpf.py", line 71, in notify_initial
self.add(ksym)
File "/home/kodidev/linux/scripts/gdb/linux/symbols.py", line 217, in add_bpf_ksym
name = bpf.get_ksym_name(ksym)
File "/home/kodidev/linux/scripts/gdb/linux/bpf.py", line 19, in get_ksym_name
name = ksym["name"].bytes
AttributeError: 'gdb.Value' object has no attribute 'bytes'
Error occurred in Python: 'gdb.Value' object has no attribute 'bytes'
Implement '.bytes' method equivalents to make wonderful BPF debugging work
on less recent systems (e.g. GDB 12.1 on Ubuntu 22 LTS):
(gdb) lx-symbols
loading vmlinux
scanning for modules in /home/kodidev/linux
loading @0xbf008000: .../tools/testing/selftests/bpf/bpf_testmod.ko
loading @0xbf000000: .../kernel/bpf/preload/bpf_preload.ko
loading @0xbf00ea0c: bpf_prog_1e1c76c33a07abcc_dump_bpf_map
loading @0xbf010630: bpf_prog_bee9db790ebbd5a6_dump_bpf_prog
loading @0xbf01e70c: bpf_prog_24c071e52e49653a___tld_fetch_key
loading @0xbf01c4c8: bpf_prog_89487142fd0ba34f_task_main
(gdb) list bpf_prog_89487142fd0ba34f_task_main
30 struct tld_object tld_obj;
31 struct test_tld_struct *struct_p;
32 struct task_struct *task;
33 int err, *int_p;
34
35 task = bpf_get_current_task_btf();
36 err = tld_object_init(task, &tld_obj);
37 if (err)
38 return 1;
Link 0: https://sourceware.org/bugzilla/show_bug.cgi?id=13267
Fixes: XXXXXXXXXX ("scripts/gdb/symbols: make BPF debug info available to GDB")
Signed-off-by: Tony Ambardar <[email protected]>1 parent 252565d commit 75c3a4b
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
213 | 214 | | |
214 | | - | |
215 | | - | |
| 215 | + | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | | - | |
| 231 | + | |
| 232 | + | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
| |||
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
240 | | - | |
241 | | - | |
| 242 | + | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
0 commit comments