#1071233 bpftrace: Debug symbols are stripped, and not usable

Package:
bpftrace
Source:
bpftrace
Description:
high-level tracing language for Linux eBPF
Submitter:
Dima Kogan
Date:
2025-06-26 08:36:01 UTC
Severity:
normal
#1071233#5
Date:
2024-05-16 19:16:56 UTC
From:
To:
Hi. This happens with "bpftrace" and "bpftrace-dbgsym" installed:

  dima@shorty:~$ gdb /usr/bin/bpftrace
  GNU gdb (Debian 13.2-1) 13.2

  ...

  Reading symbols from /usr/bin/bpftrace...
  (No debugging symbols found in /usr/bin/bpftrace)

  (gdb) b main
  Function "main" not defined.

I.e. there are no useful debugging symbols. The bpftrace-dbgsym package
has some stuff, but whatever that is, it doesn't know about the 'main'
symbol, so it's not right:

  dima@shorty:~$ dpkg -L bpftrace-dbgsym
  /.
  /usr
  /usr/lib
  /usr/lib/debug
  /usr/lib/debug/.dwz
  /usr/lib/debug/.dwz/x86_64-linux-gnu
  /usr/lib/debug/.dwz/x86_64-linux-gnu/bpftrace.debug
  /usr/share
  /usr/share/doc
  /usr/share/doc/bpftrace-dbgsym

  dima@shorty:~$ readelf -w /usr/lib/debug/.dwz/x86_64-linux-gnu/bpftrace.debug | grep 'DW_AT_name.* main$'
  [ no output ]

If I rebuild the package, the non-stripped executable that comes out of
the build knows about 'main' and is debuggable:

  dima@shorty:~/debianstuff/bpftrace$ readelf -w obj-x86_64-linux-gnu/src/bpftrace | grep 'DW_AT_name.* main$'
      <21f287>   DW_AT_name        : (indirect string, offset: 0x42426a): main


  dima@shorty:~/debianstuff/bpftrace$ gdb obj-x86_64-linux-gnu/src/bpftrace
  ...
  Reading symbols from obj-x86_64-linux-gnu/src/bpftrace...

  (gdb) b main
  Breakpoint 1 at 0x5b3e0: file ./src/main.cpp, line 756.

Looking at the debian/rules, it looks like there's some custom logic for
stripping off the debug symbols. Perhaps that logic is wrong? There are
no comments or version control notes about the rationale behind that
logic, other than the need to preserve SOME of the DWARF info. A comment
about that would be good.

Thanks.

#1071233#10
Date:
2025-06-26 08:29:02 UTC
From:
To:
Hello!

Please find attached the patch we have in Ubuntu to fix that issue.