[PATCH 0/2] scripts/gdb/symbols: make BPF debug info available to GDB

Ilya Leoshkevich posted 2 patches 2 months, 4 weeks ago
scripts/gdb/linux/bpf.py          | 253 ++++++++++++++++++++++++++++++
scripts/gdb/linux/constants.py.in |   3 +
scripts/gdb/linux/radixtree.py    | 139 +++++++++++++++-
scripts/gdb/linux/symbols.py      |  77 ++++++++-
4 files changed, 462 insertions(+), 10 deletions(-)
create mode 100644 scripts/gdb/linux/bpf.py
[PATCH 0/2] scripts/gdb/symbols: make BPF debug info available to GDB
Posted by Ilya Leoshkevich 2 months, 4 weeks ago
Hi,

This series greatly simplifies debugging BPF progs when using QEMU
gdbstub by providing symbol names, sizes, and line numbers to GDB.

Patch 1 adds radix tree iteration, which is necessary for parsing
prog_idr. Patch 2 is the actual implementation; its description
contains some details on how to use this.

Best regards,
Ilya

Ilya Leoshkevich (2):
  scripts/gdb/radix-tree: add lx-radix-tree-command
  scripts/gdb/symbols: make BPF debug info available to GDB

 scripts/gdb/linux/bpf.py          | 253 ++++++++++++++++++++++++++++++
 scripts/gdb/linux/constants.py.in |   3 +
 scripts/gdb/linux/radixtree.py    | 139 +++++++++++++++-
 scripts/gdb/linux/symbols.py      |  77 ++++++++-
 4 files changed, 462 insertions(+), 10 deletions(-)
 create mode 100644 scripts/gdb/linux/bpf.py

-- 
2.50.0
Re: [PATCH 0/2] scripts/gdb/symbols: make BPF debug info available to GDB
Posted by Ilya Leoshkevich 2 months ago
On Thu, 2025-07-10 at 13:53 +0200, Ilya Leoshkevich wrote:
> Hi,
> 
> This series greatly simplifies debugging BPF progs when using QEMU
> gdbstub by providing symbol names, sizes, and line numbers to GDB.
> 
> Patch 1 adds radix tree iteration, which is necessary for parsing
> prog_idr. Patch 2 is the actual implementation; its description
> contains some details on how to use this.
> 
> Best regards,
> Ilya
> 
> Ilya Leoshkevich (2):
>   scripts/gdb/radix-tree: add lx-radix-tree-command
>   scripts/gdb/symbols: make BPF debug info available to GDB
> 
>  scripts/gdb/linux/bpf.py          | 253
> ++++++++++++++++++++++++++++++
>  scripts/gdb/linux/constants.py.in |   3 +
>  scripts/gdb/linux/radixtree.py    | 139 +++++++++++++++-
>  scripts/gdb/linux/symbols.py      |  77 ++++++++-
>  4 files changed, 462 insertions(+), 10 deletions(-)
>  create mode 100644 scripts/gdb/linux/bpf.py

Gentle ping. Any opinions on whether this is valuable? Personally I've
been using this for quite some time, and having source level debugging
for BPF progs (even if variables can't be inspected) feels really nice.
Re: [PATCH 0/2] scripts/gdb/symbols: make BPF debug info available to GDB
Posted by Alexei Starovoitov 2 months ago
On Tue, Aug 5, 2025 at 6:23 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> On Thu, 2025-07-10 at 13:53 +0200, Ilya Leoshkevich wrote:
> > Hi,
> >
> > This series greatly simplifies debugging BPF progs when using QEMU
> > gdbstub by providing symbol names, sizes, and line numbers to GDB.
> >
> > Patch 1 adds radix tree iteration, which is necessary for parsing
> > prog_idr. Patch 2 is the actual implementation; its description
> > contains some details on how to use this.
> >
> > Best regards,
> > Ilya
> >
> > Ilya Leoshkevich (2):
> >   scripts/gdb/radix-tree: add lx-radix-tree-command
> >   scripts/gdb/symbols: make BPF debug info available to GDB
> >
> >  scripts/gdb/linux/bpf.py          | 253
> > ++++++++++++++++++++++++++++++
> >  scripts/gdb/linux/constants.py.in |   3 +
> >  scripts/gdb/linux/radixtree.py    | 139 +++++++++++++++-
> >  scripts/gdb/linux/symbols.py      |  77 ++++++++-
> >  4 files changed, 462 insertions(+), 10 deletions(-)
> >  create mode 100644 scripts/gdb/linux/bpf.py
>
> Gentle ping. Any opinions on whether this is valuable? Personally I've
> been using this for quite some time, and having source level debugging
> for BPF progs (even if variables can't be inspected) feels really nice.

Looks very useful to me.
Not sure which git tree it should be routed to.
Re: [PATCH 0/2] scripts/gdb/symbols: make BPF debug info available to GDB
Posted by Ilya Leoshkevich 1 month, 1 week ago
On Tue, 2025-08-05 at 09:48 -0700, Alexei Starovoitov wrote:
> On Tue, Aug 5, 2025 at 6:23 AM Ilya Leoshkevich <iii@linux.ibm.com>
> wrote:
> > 
> > On Thu, 2025-07-10 at 13:53 +0200, Ilya Leoshkevich wrote:
> > > Hi,
> > > 
> > > This series greatly simplifies debugging BPF progs when using
> > > QEMU
> > > gdbstub by providing symbol names, sizes, and line numbers to
> > > GDB.
> > > 
> > > Patch 1 adds radix tree iteration, which is necessary for parsing
> > > prog_idr. Patch 2 is the actual implementation; its description
> > > contains some details on how to use this.
> > > 
> > > Best regards,
> > > Ilya
> > > 
> > > Ilya Leoshkevich (2):
> > >   scripts/gdb/radix-tree: add lx-radix-tree-command
> > >   scripts/gdb/symbols: make BPF debug info available to GDB
> > > 
> > >  scripts/gdb/linux/bpf.py          | 253
> > > ++++++++++++++++++++++++++++++
> > >  scripts/gdb/linux/constants.py.in |   3 +
> > >  scripts/gdb/linux/radixtree.py    | 139 +++++++++++++++-
> > >  scripts/gdb/linux/symbols.py      |  77 ++++++++-
> > >  4 files changed, 462 insertions(+), 10 deletions(-)
> > >  create mode 100644 scripts/gdb/linux/bpf.py
> > 
> > Gentle ping. Any opinions on whether this is valuable? Personally
> > I've
> > been using this for quite some time, and having source level
> > debugging
> > for BPF progs (even if variables can't be inspected) feels really
> > nice.
> 
> Looks very useful to me.
> Not sure which git tree it should be routed to.

Thanks, glad to hear that!

I think it makes sense to route it via the Andrew Morton's tree, like
all the other GDB patches. IIUC the proposal to ask subsystems to
maintain GDB scripts relevant to them [1] didn't go anywhere.

[1]
https://lore.kernel.org/all/20250625231053.1134589-1-florian.fainelli@broadcom.com/