Skip to content
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

Enable frame pointers on macOS x86_64 #13163

Merged
merged 1 commit into from
May 16, 2024

Conversation

tmcgilchrist
Copy link
Contributor

Enables frame pointers on macOS x86_64 reusing the existing code for Linux x86_64 frame pointers.

@tmcgilchrist tmcgilchrist force-pushed the frame_pointers_macos branch 4 times, most recently from a8052fd to fdf5f5d Compare May 14, 2024 21:25
@gasche
Copy link
Member

gasche commented May 15, 2024

@fabbing would you by chance be available to have a look at the PR?

@gasche gasche added the portabilty Hardware and operating system support label May 15, 2024
@fabbing
Copy link
Contributor

fabbing commented May 15, 2024

Yes, I have already started looking into this.
It looks fine, but I still need to convince myself that the removal of is_from_executable is also correct.

Copy link
Contributor

@fabbing fabbing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty convinced now that it should be fine!

@shindere
Copy link
Contributor

This looks good to me, thanks.

Can you please add Fabrice as a reviewer in the Changes entry?

@gasche
Copy link
Member

gasche commented May 15, 2024

Out of curiosity, can someone explain why the removal of is_from_executable is fine? (I can make a guess but it helps to have this reasoning about the code written out loud, it helps build a shared body of knowledge about the codebase.)

@tmcgilchrist
Copy link
Contributor Author

The original intent for that code was to filter out parts of the backtrace that were not from the executable under test. I noticed when modifying the regex to support macOS symbols that it was not hitting that code and so wasn't excluding any frames from the backtrace. Running it again on Linux without is_from_executable was also fine.

I guess that @fabbing was originally running these tests under gdb during development and was getting elements of the backtrace from there.

Changes to testsuite to modify backtrace printing for macOS symbols.
@shindere shindere merged commit 5ad004d into ocaml:trunk May 16, 2024
15 checks passed
@shindere
Copy link
Contributor

@gasche: if you think you should have been added as a reviewer, do not
hesitate to either push a commit directly or to ask me to do so. I was
unsure but wanted to move on.

@tmcgilchrist tmcgilchrist deleted the frame_pointers_macos branch May 16, 2024 06:17
@gasche
Copy link
Member

gasche commented May 16, 2024

No need, I did not do a full review of the change. Thanks!

@shindere
Copy link
Contributor

shindere commented May 16, 2024 via email

@fabbing
Copy link
Contributor

fabbing commented May 21, 2024

Out of curiosity, can someone explain why the removal of is_from_executable is fine? (I can make a guess but it helps to have this reasoning about the code written out loud, it helps build a shared body of knowledge about the codebase.)

This is_from_executable function was introduced by 6a0a0a4, as a way to ignore external libraries and to stop frame-pointer based unwinding to unwind further than the main function. On some systems, it was actually possible to unwind functions up to the dynamic loader.
If this test is removed, and we were to cross into another binary, the regex will probably fail and filter it. If the function name would still match the regex, the reference will flag anyway the unexpected function.

And as I writing this, I realised that we should also have updated the OCaml side of the code to discard this no longer required argument, and the left over in the C code (argv0 and execname). Should I open a new PR for this?

@shindere
Copy link
Contributor

shindere commented May 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
portabilty Hardware and operating system support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants