Skip to content

Commit 10892bd

Browse files
committed
Add JSC option to trigger a hardware breakpoint when debugger expressions are reached.
https://bugs.webkit.org/show_bug.cgi?id=217334 Reviewed by Yusuke Suzuki. * interpreter/Interpreter.cpp: (JSC::Interpreter::debug): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::defaultCodeGenerationMode const): * runtime/OptionsList.h: Canonical link: https://commits.webkit.org/230107@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b9b916f commit 10892bd

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

Source/JavaScriptCore/ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2020-10-05 Keith Miller <keith_miller@apple.com>
2+
3+
Add JSC option to trigger a hardware breakpoint when debugger expressions are reached.
4+
https://bugs.webkit.org/show_bug.cgi?id=217334
5+
6+
Reviewed by Yusuke Suzuki.
7+
8+
* interpreter/Interpreter.cpp:
9+
(JSC::Interpreter::debug):
10+
* runtime/JSGlobalObject.h:
11+
(JSC::JSGlobalObject::defaultCodeGenerationMode const):
12+
* runtime/OptionsList.h:
13+
114
2020-10-05 David Kilzer <ddkilzer@apple.com>
215

316
Build fix: Use JSC_DEFINE_HOST_FUNCTION_WITH_ATTRIBUTES() with SUPPRESS_ASAN

Source/JavaScriptCore/interpreter/Interpreter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,10 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookType debugHo
12651265
{
12661266
VM& vm = callFrame->deprecatedVM();
12671267
auto scope = DECLARE_CATCH_SCOPE(vm);
1268+
1269+
if (UNLIKELY(Options::debuggerTriggersBreakpointException()) && debugHookType == DidReachDebuggerStatement)
1270+
WTFBreakpointTrap();
1271+
12681272
Debugger* debugger = callFrame->lexicalGlobalObject(vm)->debugger();
12691273
if (!debugger)
12701274
return;

Source/JavaScriptCore/runtime/JSGlobalObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ inline JSObject* JSGlobalObject::globalThis() const
11641164
inline OptionSet<CodeGenerationMode> JSGlobalObject::defaultCodeGenerationMode() const
11651165
{
11661166
OptionSet<CodeGenerationMode> codeGenerationMode;
1167-
if (hasInteractiveDebugger() || Options::forceDebuggerBytecodeGeneration())
1167+
if (hasInteractiveDebugger() || Options::forceDebuggerBytecodeGeneration() || Options::debuggerTriggersBreakpointException())
11681168
codeGenerationMode.add(CodeGenerationMode::Debugger);
11691169
if (vm().typeProfiler())
11701170
codeGenerationMode.add(CodeGenerationMode::TypeProfiler);

Source/JavaScriptCore/runtime/OptionsList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ constexpr bool enableWebAssemblyStreamingApi = false;
110110
v(Bool, dumpBytecodeLivenessResults, false, Normal, nullptr) \
111111
v(Bool, validateBytecode, false, Normal, nullptr) \
112112
v(Bool, forceDebuggerBytecodeGeneration, false, Normal, nullptr) \
113+
v(Bool, debuggerTriggersBreakpointException, false, Normal, "Using the debugger statement will trigger an breakpoint exception (Useful when lldbing)") \
113114
v(Bool, dumpBytecodesBeforeGeneratorification, false, Normal, nullptr) \
114115
\
115116
v(Bool, useFunctionDotArguments, true, Normal, nullptr) \

0 commit comments

Comments
 (0)