Skip to content

Conversation

@procdump
Copy link

@procdump procdump commented Oct 10, 2025

Currently on each program execution the debugger starts listening on $VM_DEBUG_PORT.
This is particularly a problem when there are CPIs as on each CPI another VM is instantiated attempting to reuse $VM_DEBUG_PORT.
This PR aims to address this so that the debugger around the CPI will start listening on $VM_DEBUG_PORT + the nesting level of the current instruction. The idea is to provide predictability at the other end.

The runtime is tightly coupled with SBPF so changes are also needed there. Here are the proposed changes: anza-xyz/agave@8d752f7

While this PR provides a possible fix it is also for provoking a discussion about this problem if there's a more potential solution.

EDIT: Here's another approach that basically allows passing an offset to the debug_port from runtime directly when executing a program:
anza-xyz/agave@e241209
Then add this value to the debug_port:
main...procdump:sbpf:debugger_port_offset

@procdump procdump marked this pull request as ready for review October 10, 2025 12:39
@LucasSte LucasSte requested a review from Lichtso October 10, 2025 18:00
call_frames: vec![CallFrame::default(); config.max_call_depth],
loader,
#[cfg(feature = "debugger")]
debug_port: std::env::var("VM_DEBUG_PORT")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of pulling program runtime concepts down here just for debugging. So I would be in favor of instead setting debug_port selectively in the agave repo.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: Here's another approach that basically allows passing an offset to the debug_port from runtime directly when executing a program:
anza-xyz/agave@e241209
Then add this value to the debug_port:
main...procdump:sbpf:debugger_port_offset

Something in this direction? A CPI just needs another debug port to listen on as it takes place in the middle of the ongoing debugging session. If this is in place CPIs can be happily step-debugged.

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