What is 0xbbadbeef used for in Webkit?

China☆狼群 提交于 2019-12-22 10:25:14

问题


While working with Webkit I encountered an error with a pointer set to 0xbbadbeef. What is BadBeef used for in Webkit?


回答1:


It is a hexspeak used in WebKit and, it indicates a known, unrecoverable error such as out of memory.

As you can see from the link https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/wtf/Assertions.h&l=180

/* CRASH() - Raises a fatal error resulting in program termination and triggering either the debugger or the crash reporter.

   Use CRASH() in response to known, unrecoverable errors like out-of-memory.
   Macro is enabled in both debug and release mode.
   To test for unknown errors and verify assumptions, use ASSERT instead, to avoid impacting performance in release builds.

   Signals are ignored by the crash reporter on OS X so we must do better.
*/
#ifndef CRASH
#if COMPILER(MSVC)
#define CRASH() (__debugbreak(), IMMEDIATE_CRASH())
#else
#define CRASH() \
    (WTFReportBacktrace(), (*(int*)0xfbadbeef = 0), IMMEDIATE_CRASH())
#endif
#endif


来源:https://stackoverflow.com/questions/25365569/what-is-0xbbadbeef-used-for-in-webkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!