-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add support for custom demanglers #119
base: main
Are you sure you want to change the base?
Conversation
5257794
to
3665595
Compare
// > It is expected that it will be internally reused. | ||
// > When a call to ___tracy_demangle is made, previous contents of the string memory | ||
// > do not need to be preserved. | ||
static mut BUFFER: Buffer = Buffer::new(); |
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.
This won't work right in MT contexts, will it? Don't we need at least a buffer for each thread?
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.
Don't think it has to be MT-safe, the cpp implementation uses a global malloc'd pointer that's reused like we do here and it's worked fine
@@ -44,6 +44,9 @@ mod plot; | |||
mod span; | |||
mod state; | |||
|
|||
#[cfg(feature = "demangle")] | |||
pub mod demangle; |
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 would also pub use crate::demangle::register_demangler
(see a similar thing done with frame
above.)
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.
It's already exported through macro_export, do you want to do this regardless?
Co-authored-by: Simonas Kazlauskas <github@kazlauskas.me>
Adds support for custom demangler functions with the signature
fn(&str, &mut Buffer) -> std::fmt::Result
whereBuffer
is an opaque type that only exposes an implementation ofstd::fmt::Write
.The default implementation is moved to a standalone function, and the buffer is now cleared before any demangling is done as tracy guarantees:
Follow-up to #102.