I use this all the time, might as well check it in.
Created attachment 308917 [details] Patch
Created attachment 308919 [details] Patch
Attachment 308919 [details] did not pass style-queue: ERROR: Source/WTF/wtf/DebugUtilities.h:26: Use #pragma once instead of #ifndef for header guard. [build/header_guard] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 308919 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308919&action=review > Source/WTF/wtf/Assertions.h:197 > -#if defined(NDEBUG) && OS(DARWIN) > #if CPU(X86_64) || CPU(X86) > #define WTFBreakpointTrap() __asm__ volatile ("int3") > #elif CPU(ARM_THUMB2) > #define WTFBreakpointTrap() __asm__ volatile ("bkpt #0") > #elif CPU(ARM64) > #define WTFBreakpointTrap() __asm__ volatile ("brk #0") I've only validated these asm statements on OS(DARWIN). Are you sure they work for non-Darwin ports?
Created attachment 308932 [details] Patch
Attachment 308932 [details] did not pass style-queue: ERROR: Source/WTF/wtf/DebugUtilities.h:26: Use #pragma once instead of #ifndef for header guard. [build/header_guard] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
(In reply to Mark Lam from comment #4) > Comment on attachment 308919 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308919&action=review > > > Source/WTF/wtf/Assertions.h:197 > > -#if defined(NDEBUG) && OS(DARWIN) > > #if CPU(X86_64) || CPU(X86) > > #define WTFBreakpointTrap() __asm__ volatile ("int3") > > #elif CPU(ARM_THUMB2) > > #define WTFBreakpointTrap() __asm__ volatile ("bkpt #0") > > #elif CPU(ARM64) > > #define WTFBreakpointTrap() __asm__ volatile ("brk #0") > > I've only validated these asm statements on OS(DARWIN). Are you sure they > work for non-Darwin ports? I am unsure how they would differ. Software breakpoint instructions are a detail of the ISA, not the OS. Right?
(In reply to Brian Burg from comment #7) > (In reply to Mark Lam from comment #4) > > Comment on attachment 308919 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=308919&action=review > > > > > Source/WTF/wtf/Assertions.h:197 > > > -#if defined(NDEBUG) && OS(DARWIN) > > > #if CPU(X86_64) || CPU(X86) > > > #define WTFBreakpointTrap() __asm__ volatile ("int3") > > > #elif CPU(ARM_THUMB2) > > > #define WTFBreakpointTrap() __asm__ volatile ("bkpt #0") > > > #elif CPU(ARM64) > > > #define WTFBreakpointTrap() __asm__ volatile ("brk #0") > > > > I've only validated these asm statements on OS(DARWIN). Are you sure they > > work for non-Darwin ports? > > I am unsure how they would differ. Software breakpoint instructions are a > detail of the ISA, not the OS. Right? Yes, but inline asm statement syntax?
(In reply to Mark Lam from comment #8) > (In reply to Brian Burg from comment #7) > > (In reply to Mark Lam from comment #4) > > > Comment on attachment 308919 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=308919&action=review > > > > > > > Source/WTF/wtf/Assertions.h:197 > > > > -#if defined(NDEBUG) && OS(DARWIN) > > > > #if CPU(X86_64) || CPU(X86) > > > > #define WTFBreakpointTrap() __asm__ volatile ("int3") > > > > #elif CPU(ARM_THUMB2) > > > > #define WTFBreakpointTrap() __asm__ volatile ("bkpt #0") > > > > #elif CPU(ARM64) > > > > #define WTFBreakpointTrap() __asm__ volatile ("brk #0") > > > > > > I've only validated these asm statements on OS(DARWIN). Are you sure they > > > work for non-Darwin ports? > > > > I am unsure how they would differ. Software breakpoint instructions are a > > detail of the ISA, not the OS. Right? > > Yes, but inline asm statement syntax? Oh, yeah, I have no idea. We seem to use the same macros in bmalloc (BAssert.h) and those are not specific to OS(DARWIN). Some of the 3rd-party libraries we use for WebRTC also use __asm__ volatile ("...") syntax. My understanding is that those build for GTK port as well. In any case, this patch does not add new clients of these macros. If it is indeed broken with another compiler – something I can't verify myself – then the macros can be generalized in a later patch if it does not fail EWS.
Comment on attachment 308932 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308932&action=review r=me with suggested improvement. > Source/WTF/wtf/Assertions.h:202 > +#define WTFBreakpointTrap() Hmmm. If we want to make WTFBreakpointTrap() an API for more general use, I question whether it's wise to allow it to fail silently like this if it's not defined. Instead, how about defining it as: #define WTFBreakpointTrap() WTFCrash() // Not implemented If someone tries to use it, they will crash and the trail will lead to the "Not implemented" comment.
(In reply to Mark Lam from comment #10) > Comment on attachment 308932 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308932&action=review > > r=me with suggested improvement. > > > Source/WTF/wtf/Assertions.h:202 > > +#define WTFBreakpointTrap() > > Hmmm. If we want to make WTFBreakpointTrap() an API for more general use, I > question whether it's wise to allow it to fail silently like this if it's > not defined. Instead, how about defining it as: > > #define WTFBreakpointTrap() WTFCrash() // Not implemented > > If someone tries to use it, they will crash and the trail will lead to the > "Not implemented" comment. OK
Created attachment 309093 [details] For Landing
Attachment 309093 [details] did not pass style-queue: ERROR: Source/WTF/wtf/DebugUtilities.h:26: Use #pragma once instead of #ifndef for header guard. [build/header_guard] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Committed r217233: <http://trac.webkit.org/changeset/217233>
Comment on attachment 309093 [details] For Landing Landed manually.