Skip to content

fix(macos): drop Event::Empty arm in demangle_stream that corrupted x…#446

Merged
djc merged 1 commit intoflamegraph-rs:mainfrom
boguscoder:fix/macos-xctrace-xml-corruption
Apr 20, 2026
Merged

fix(macos): drop Event::Empty arm in demangle_stream that corrupted x…#446
djc merged 1 commit intoflamegraph-rs:mainfrom
boguscoder:fix/macos-xctrace-xml-corruption

Conversation

@boguscoder
Copy link
Copy Markdown
Contributor

The Event::Empty arm (self-closing tags like <binary .../>) was matched to 'start' and then written as Event::Start without a corresponding closing tag, producing malformed XML that broke inferno's xctrace collapser with IllFormed(MismatchedEndTag).

This broke profiling of C++ binaries on macOS.

This should fix #445

Ive tested this with c++ and rust binaries but please lmk if more coverage would help

…ctrace XML

The Event::Empty arm (self-closing tags like <binary .../>) was matched
to 'start' and then written as Event::Start without a corresponding
closing tag, producing malformed XML that broke inferno's xctrace
collapser with IllFormed(MismatchedEndTag).

This broke profiling of C++ binaries on macOS.
@djc djc merged commit f3283a7 into flamegraph-rs:main Apr 20, 2026
5 checks passed
@djc
Copy link
Copy Markdown
Contributor

djc commented Apr 20, 2026

Sounds good, thanks. How hard would it be to have a (smallish) sample XML file in the repo to exercise this code against?

@boguscoder
Copy link
Copy Markdown
Contributor Author

Should be easy, i'll provide file soon but whether it needs some CI hooking into is a mystery to me

@djc
Copy link
Copy Markdown
Contributor

djc commented Apr 21, 2026

Should be easy, i'll provide file soon but whether it needs some CI hooking into is a mystery to me

If you can just submit a PR with a unit test that would be great.

@nixpulvis
Copy link
Copy Markdown

Thanks, seems to have fixed things for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read xml event failed: IllFormed

3 participants