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

Debugging tokio async application #6950

Open
godzie44 opened this issue Nov 2, 2024 · 0 comments
Open

Debugging tokio async application #6950

godzie44 opened this issue Nov 2, 2024 · 0 comments
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.

Comments

@godzie44
Copy link

godzie44 commented Nov 2, 2024

Discussion about this future started here #6939.

Hi! I'm interested in improving the debugging process for asynchronous applications. Also i'm a developer of the OS debugger for rust named bugstalker (bs). Recently bs have some new (and working, but currently in develop branch) functions for async debugging. See this issue with implementation notes, and this or this for example of working.

Is your feature request related to a problem? Please describe.

The problem is that to get information about workers, tasks, etc., the debugger relies on the details of tokio internal implementation (the names of structure fields, the names of global variables, some types, etc.). It is clear that these details can change from version to version of tokio. Therefore, the implementation in the debugger is currently locked to tokio version 1.41. If you are interested, I see two ways to solve this problem: the least invasive but complicating the implementation on the debugger side, and the more inconvenient for tokio, but more robust from the debugger's point of view.

Describe the solution you'd like

1. Add tokio version into ELF .note section

I think this a simple way for tokio, but it assumes that the debugger complements the implementation with each new version of tokio runtime (if internal structures is changed). But I think this may be a good point of start.

This information may be added only for debug builds. POC of implementation may be found here.

2. Add some specific, debugging information in tokio

This is a harder way. Tokio can add some global data with information needed for debugger. This data can be managed by tokio in debug mode and annotated with #[cfg(feature = "debug")]. What debugger needs is described in this issue. Also this debug data should have a stable types (from debugger point of view).

For example

#[cfg(feature = "debug")]
static OWNED_TASKS_DEBUG: LinkedList<RawTask> = ...

And tokio should manage this list in debug builds.

Additional context

I think that such a solution will be very useful for any debugger that will support asynchronous rust, not only bs.

@godzie44 godzie44 added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.
Projects
None yet
Development

No branches or pull requests

1 participant