-
Notifications
You must be signed in to change notification settings - Fork 84
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
Conversation
@@ -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() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Thanks! |
Works as expected on MacOS with clang