Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug info is missing #161

Closed
ikalchev opened this issue Dec 17, 2023 · 2 comments
Closed

Debug info is missing #161

ikalchev opened this issue Dec 17, 2023 · 2 comments

Comments

@ikalchev
Copy link

Hi everyone,

I am writing a perf_event probe and I am using aya-bpf and the bpf-linker. I've used the blueprint build "scripts" from Aya. When I was trying to debug some BPF verifier errors, I tried to get more info on the generated byte code using:

llvm-objdump-16 -S --no-show-raw-insn --section=perf_event target/bpfel-unknown-none/debug/my-bin

However, this does not print the source code, just the byte code:

$ llvm-objdump-16 --source --no-show-raw-insn --section=perf_event target/bpfel-unknown-none/debug/my-bin

target/bpfel-unknown-none/debug/my-bin:	file format elf64-bpf

Disassembly of section perf_event:

0000000000000000 <decode_frame>:
       0:	r6 = r1
       1:	r1 = 0x0
       2:	*(u32 *)(r10 - 0x4) = r1
       3:	r2 = r10
       4:	r2 += -0x4
       5:	r1 = 0x0 ll

I then checked if the binary has debug info at all. Since it didn't, I then changed the Cargo.toml for the ebpf code to have debug = true, but this didn't help as well.

file target/bpfel-unknown-none/debug/my-bin
target/bpfel-unknown-none/debug/my-bin: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), not stripped

This is happens on:

$ uname -a
Linux xdp-test 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 22:07:48 UTC 2 aarch64 aarch64 aarch64 GNU/Linux

(this is a VM running on a macOS on arm).

Cargo and rustc are on 1.73, Aya is pulled directly from github.

Any idea on what might be wrong?

@ikalchev
Copy link
Author

I guess this is why? aya-rs/aya#351

Can someone confirm so we can close this?

@dave-tucker
Copy link
Member

Sorry for the delay. Yes that's partially correct.
eBPF Debug Info is in the BTF.ext section.
Once #182 merges I believe verifier output should include source info - if you use the --btf option that is 🎉
We'll get that documented so it's easy to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants