Skip to content

Use eBPF files for debugging instead of executable created from tests#38

Merged
failfmi merged 3 commits intoLimeChain:mainfrom
ERoydev:bpf-debugging-with-agave
Jul 30, 2025
Merged

Use eBPF files for debugging instead of executable created from tests#38
failfmi merged 3 commits intoLimeChain:mainfrom
ERoydev:bpf-debugging-with-agave

Conversation

@ERoydev
Copy link
Copy Markdown
Collaborator

@ERoydev ERoydev commented Jul 29, 2025

What

  • I have implemented a debugging workflow using agave-ledger-tool and solana-lldb to debug the eBPF compiled files directly.

  • The previous approach relied on running a binary executable created with cargo test --no-run ..., which only allowed debugging in a Rust environment.

Why

  • Our goal is to build a debugger that can debug Solana programs "on-chain"—that is, running on a local ledger—so we can inspect the actual deployed program behavior rather than just the Rust code.

  • This approach provides a more accurate and realistic debugging experience, closer to production conditions.

Here is what is happening

User first starts his solana-local-validator
Then:

  1. It will compile his program using cargo build-sbf --debug to create sBPF .so and .debug stripped files.
  2. Run the compiled .so file on a local ledger using agave-ledger-tool in debug mode, starting a GDB remote server (usually on port 9001) for solana-lldb to attach and control execution.
  3. Launch solana-lldb and attach it to that GDB remote port, loading the .debug file for debugging.

Now, the user can observe what is actually happening on-chain by reading the executed opcodes and instructions.

Limitations / Next steps:

  • Currently supports only local ledger debugging using native solana programs.
  • We need to figure it out how to map breakpoints to their compiled sBPF instructions

@ERoydev ERoydev requested review from WyzaXX and failfmi and removed request for WyzaXX July 29, 2025 14:16
failfmi
failfmi previously approved these changes Jul 30, 2025
@ERoydev ERoydev force-pushed the bpf-debugging-with-agave branch from 5442ec1 to 5097b5c Compare July 30, 2025 07:14
@failfmi failfmi self-requested a review July 30, 2025 07:18
@ERoydev ERoydev force-pushed the bpf-debugging-with-agave branch 2 times, most recently from a3e3e2a to 453617b Compare July 30, 2025 08:10
ERoydev added 3 commits July 30, 2025 11:18
…ad of cargo test executable ones

Signed-off-by: ERoydev <e.roydev@gmail.com>
Signed-off-by: ERoydev <e.roydev@gmail.com>
Signed-off-by: ERoydev <e.roydev@gmail.com>
@ERoydev ERoydev force-pushed the bpf-debugging-with-agave branch from 453617b to 1e22b9d Compare July 30, 2025 08:18
@failfmi failfmi merged commit 1b5e4b9 into LimeChain:main Jul 30, 2025
@ERoydev ERoydev deleted the bpf-debugging-with-agave branch October 6, 2025 10:04
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

Successfully merging this pull request may close these issues.

2 participants