-
-
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
allow getting task dump backtraces in a programmatic format #6975
base: master
Are you sure you want to change the base?
Conversation
df04fc7
to
ede6e06
Compare
What is this waiting for? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I left high level questions about suggested apis.
/// Return the raw name of the symbol. | ||
pub fn name_raw(&self) -> Option<&[u8]> { | ||
self.name.as_deref() | ||
} | ||
|
||
/// Return the demangled name of the symbol. | ||
pub fn name_demangled(&self) -> Option<&str> { | ||
self.name_demangled.as_deref() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both? I think users can construct demangled one by using name_raw
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had it since backtrace
had that, and for some reason I thought the API was somewhat private. Apparently rustc_demangle
is a perfectly fine public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, Never mind ... I missed you were using the Display
impl of SymbolName
to get a demangle name in 991434a. (I left comment above just because it looked like similar two fields were being added for the same already demangled data.)
To be clear, I think it's fine (or even better) to provide a name
API that returns the demangled name, as the backtrace crate already does. (If users request a mangle API, which is probably unlikely, we can add it later.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would you rather have the PR this way or with the name_raw
and name_demangled
functions?
I definitely don't want to have a version of the code that exposes only the demangled name, since AFAICT if it's a C symbol rather than a Rust symbol the demangling is lossy.
283eea6
to
dd3f267
Compare
dd3f267
to
d96b28a
Compare
This PR creates structs that allow dumping backtraces in a programmatic format, for example JSON. A JSON serializer is not natively included to avoid creating a Tokio dependency on one, but serialization can be done by customers.
Fixes #6309.