[CoreCLR] Fix macOS jitdump discovery by Samply#130513
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR adjusts CoreCLR’s jitdump file creation path on macOS to ensure the jitdump file is opened via the plain open symbol (rather than the $NOCANCEL-aliased variant), improving external profiler/tool discovery of jitdump output on macOS without affecting Linux or Apple mobile targets.
Changes:
- Introduces a
JitDumpOpenbinding onTARGET_OSXthat links directly to the_opensymbol. - Switches jitdump file creation to use
JitDumpOpen(...)instead ofopen(...).
|
@jkotas @janvorli @davidwrighton opinions? I assume Perfmap is effectively unused today for macos and this PR at least makes it work with samply. My end-goal is to use samply on egorbot for |
|
Should this be fixed in Samply instead? This change is introducing a subtle bug. |
|
NOCANCEL is not even the only possible suffix: https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/cdefs.h#L878-L909 - no doubt apple will make more in the future too - and on intel macOS, in a default setup these days, you will actually get Definitely should not be on .NET to potentially leak memory to make it work, imo (although, maybe it's not the end of the world for a one-off allocation as a stopgap solution, but imo ideally it is not like this long-term). |
|
Ok, I'll see if I can fix that on the Samply side |
On macOS, the runtime-wide
__DARWIN_NON_CANCELABLEsetting mapsopentoopen$NOCANCEL. Samply discovers jitdump files by interposing regularopen, so it stopped seeing CoreCLR jitdump output after #117330.Bind only jitdump creation to plain
_openon macOS. Linux and Apple mobile are unchanged.Example usage of Samply:
This restores mixed native/managed stacks and annotated managed assembly, for example:
Validated with a Release CoreCLR build and Samply 0.13.1 on macOS arm64.