invalid xml from `xctrace`
I suppose it's not flamegraph's fault, but still...
I get (on macos)
Starting recording with the Time Profiler template. Launching process: .
Ctrl-C to stop the recording
test result: ok. 0 passed; 0 failed; 7 ignored; 1 measured; 0 filtered out; finished in 4.21s
Target app exited, ending recording...
Recording completed. Saving output file...
Output file saved as: cargo-flamegraph.trace
Error: unable to collapse generated profile data
Caused by:
Invalid xml text from xctrace, which is not expected: UnterminatedEntity(72..77)
I don't think this is actionable in the context of this project. The XML is generated by xctrace (I guess) and consumed by inferno.
@djc symbols in the XML generated by xctrace are demangled by flamegraph without applying the necessary XML escaping, causing the generated XML to be invalid
Pretty sure that part happens in inferno, though, not in flamegraph -- as I already explained.
@friedrich you may want to ask the inferfno devs I understand
The call to demangle_stream is clearly part of flamegraph: https://github.com/flamegraph-rs/flamegraph/blob/5c5129d8e1206b3be78b0a86cae12873d3587012/src/lib.rs#L533
Here is a fix that works for me: https://github.com/flamegraph-rs/flamegraph/commit/f82bc924e9e614d0b15203f01b9d2770ea74c373. I only tested it with xctrace, if other formats do not use XML it will break them.
Ah, sorry, I forgot that demangling is done in this crate.
Pretty sure the other platforms do not use XML-based platforms, so your fix will need to be adapted. Additionally I'd prefer not to take on quick-xml as a dependency as it seems pretty heavyweight for what needs to be done here. Suggest using the xmlparser crate instead.
quick-xml is already a dependency of flamegraph since it is used by inferno.
Aahh, sorry, also didn't know about that. In that case, would be happy to review a PR.