【问题标题】:What is 0xbbadbeef used for in Webkit?0xbbadbeef 在 Webkit 中是做什么用的?
【发布时间】:2014-10-11 12:00:10
【问题描述】:

在使用 Webkit 时,我遇到了一个指针设置为 0xbbadbeef 的错误。 BadBeef 在 Webkit 中是做什么用的?

【问题讨论】:

  • AIX 调试器用于将未初始化的内存设置为 0xDEADBEEF 作为标记以指示内存未被触及...可能是类似的事情

标签: pointers memory webkit magic-numbers


【解决方案1】:

它是 WebKit 中使用的十六进制语言,它表示已知的、不可恢复的错误,例如内存不足。

从链接中可以看到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

【讨论】:

  • 感谢您的回答,它似乎是有效的,但我已经很久没有使用 webkit 了,我不记得我需要它来做什么了 :)
  • 哈哈,我知道那种感觉 :) 希望答案对未来的访客有所帮助
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-09
  • 2011-09-15
  • 2021-09-17
  • 1970-01-01
  • 2021-12-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多