Bug 13018

Summary: allow embedders to override the definition of CRASH()
Product: WebKit Reporter: Darin Fisher (:fishd, Google) <fishd>
Component: PlatformAssignee: Darin Fisher (:fishd, Google) <fishd>
Status: RESOLVED FIXED    
Severity: Enhancement    
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch darin: review+

Description Darin Fisher (:fishd, Google) 2007-03-08 17:37:31 PST
allow embedders to override the definition of CRASH()

on some platforms, dereferencing 0xbbadbeef and writing 0 is really not the most ideal way to get attention in response to an assertion failure.

for example, __asm {int 3} is much nicer on the windows platform where JIT debugging can present the user with the option to continue past the assertion with the click of a button, and if you are already running in the debugger, the instruction will be treated like an ordinary breakpoint.  other platforms may have other preferred ways as well.
Comment 1 Darin Fisher (:fishd, Google) 2007-03-08 17:42:58 PST
Created attachment 13551 [details]
patch

simple patch to make it possible for the embedder to override the meaning of CRASH()
Comment 2 Darin Adler 2007-03-08 17:46:02 PST
Comment on attachment 13551 [details]
patch

Do you have a better implementation for any particular platform? The 0xbbadbeef thing is really sorta Mac-OS-X-specific.

r=me
Comment 3 Darin Fisher (:fishd, Google) 2007-03-08 18:29:04 PST
yes, PLATFORM(WIN_OS) should call DebugBreak() or __asm {int 3}.  the latter is good for x86-Linux too.
Comment 4 Mark Rowe (bdash) 2007-03-08 19:25:19 PST
Landed in r20079.