-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support an API to extract backtrace information from taskdump #6309
Comments
cc @jswrenn |
It's not hard to provide an API here, but it might be hard to provide the right API. The current |
Thanks for clarifying the context! |
Is there a strong reason we don't just export an API that is of the form: pub struct TokioBacktraceFrame {
name: Option<Vec<u8>>,
name_demangled: Option<String>,
addr: Option<*mut c_void>,
filename: Option<PathBuf>,
lineno: Option<u32>,
colno: Option<u32>,
}
impl TokioBacktraceFrame {
pub fn name_raw(&self) -> Option<&[u8]> { /* .. */ }
pub fn name_demangled(&self) -> Option<&str> { /* ... */ }
pub fn addr(&self) -> Option<*mut c_void> { /* ... */ }
pub fn filename(&self) -> Option<&Path> { /* ... */ }
pub fn lineno(&self) -> Option<u32> { /* ... */ }
pub fn colno(&self) -> Option<u32> { /* ... */ }
}
impl Trace {
pub fn dump(&self) -> Vec<Vec<TokioBacktraceFrame>>;
} I believe that this will work with every form of taking backtraces (especially given that all fields are options). Possibly it will require some inefficiency, but we can always expose a more efficient API later. |
Tokio does not and will not depend on serde. |
K, so without the derive(Serialize) but with exposing accessors. People will have to do another map if they want to turn it to a JSON which will have some negative performance implications, but I think this is acceptable. |
We can probably expose some accessors. |
So are you positive for a function returning a |
Yes, we can add it. |
Is your feature request related to a problem? Please describe.
Currently, the only supported output for taskdump is logging, as shown in the examples here. However, I would like to add a public API that can extract this backtrace information. By adding such an API, it will become possible to handle taskdump data programmatically, making it useful for various purposes.
Describe the solution you'd like
I would like to add a public API something like this:
We already have an internal struct named Tree, so I believe it's not too hard to provide such an API.
Additional context
related issue: #5638
The text was updated successfully, but these errors were encountered: