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

Expand RE_BREAKPOINT macro on ARM64 #961

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

larsimmisch
Copy link
Contributor

Works as expected on MacOS with clang

@@ -81,6 +81,8 @@ typedef SSIZE_T ssize_t;
/** Defines a soft breakpoint */
#if (defined(__i386__) || defined(__x86_64__))
#define RE_BREAKPOINT __asm__("int $0x03")
#elif defined(__aarch64__)
#define RE_BREAKPOINT __builtin_debugtrap()
Copy link
Member

@sreimers sreimers Sep 25, 2023

Choose a reason for hiding this comment

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

I think we can make this more generic with:

#elif defined(__has_builtin) && __has_builtin(__builtin_debugtrap)
#define RE_BREAKPOINT __builtin_debugtrap()

Since __builtin_debugtrap() is clang only I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's much better. I've changed it accordingly.

Copy link
Member

@sreimers sreimers Sep 26, 2023

Choose a reason for hiding this comment

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

Looks like MSVC does not like this, can you try:

#if (defined(__i386__) || defined(__x86_64__))
#define RE_BREAKPOINT __asm__("int $0x03")
#elif defined(__has_builtin) 
#if __has_builtin(__builtin_debugtrap)
#define RE_BREAKPOINT __builtin_debugtrap()
#endif
#endif

#ifndef RE_BREAKPOINT
#define RE_BREAKPOINT
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll have an eye on the validation run

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good

@sreimers sreimers merged commit b840130 into baresip:main Sep 26, 2023
35 checks passed
@sreimers
Copy link
Member

Thanks!

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.

2 participants