Changeset 266534 in webkit for trunk/Source/JavaScriptCore/debugger
- Timestamp:
- Sep 3, 2020, 10:53:21 AM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore/debugger
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/debugger/Breakpoint.h
r266074 r266534 60 60 using ActionsVector = Vector<Action>; 61 61 62 static Ref<Breakpoint> create(BreakpointID, const String& condition = nullString(), ActionsVector&& = { }, bool autoContinue = false, size_t ignoreCount = 0);62 JS_EXPORT_PRIVATE static Ref<Breakpoint> create(BreakpointID, const String& condition = nullString(), ActionsVector&& = { }, bool autoContinue = false, size_t ignoreCount = 0); 63 63 64 64 BreakpointID id() const { return m_id; } -
trunk/Source/JavaScriptCore/debugger/Debugger.cpp
r266074 r266534 78 78 }; 79 79 80 Debugger::TemporarilyDisableExceptionBreakpoints::TemporarilyDisableExceptionBreakpoints(Debugger& debugger) 81 : m_debugger(debugger) 82 { 83 } 84 85 Debugger::TemporarilyDisableExceptionBreakpoints::~TemporarilyDisableExceptionBreakpoints() 86 { 87 restore(); 88 } 89 90 void Debugger::TemporarilyDisableExceptionBreakpoints::replace() 91 { 92 if (m_debugger.m_pauseOnAllExceptionsBreakpoint) 93 m_pauseOnAllExceptionsBreakpoint = WTFMove(m_debugger.m_pauseOnAllExceptionsBreakpoint); 94 95 if (m_debugger.m_pauseOnUncaughtExceptionsBreakpoint) 96 m_pauseOnUncaughtExceptionsBreakpoint = WTFMove(m_debugger.m_pauseOnUncaughtExceptionsBreakpoint); 97 } 98 99 void Debugger::TemporarilyDisableExceptionBreakpoints::restore() 100 { 101 if (m_pauseOnAllExceptionsBreakpoint) 102 m_debugger.m_pauseOnAllExceptionsBreakpoint = WTFMove(m_pauseOnAllExceptionsBreakpoint); 103 104 if (m_pauseOnUncaughtExceptionsBreakpoint) 105 m_debugger.m_pauseOnUncaughtExceptionsBreakpoint = WTFMove(m_pauseOnUncaughtExceptionsBreakpoint); 106 } 107 80 108 81 109 Debugger::ProfilingClient::~ProfilingClient() … … 85 113 Debugger::Debugger(VM& vm) 86 114 : m_vm(vm) 87 , m_pauseOnExceptionsState(DontPauseOnExceptions)88 115 , m_pauseAtNextOpportunity(false) 89 116 , m_pastFirstExpressionInStatement(false) … … 689 716 } 690 717 691 void Debugger::setPauseOnExceptionsState(PauseOnExceptionsState pause)692 {693 m_pauseOnExceptionsState = pause;694 }695 696 718 void Debugger::schedulePauseAtNextOpportunity() 697 719 { … … 725 747 } 726 748 727 void Debugger::breakProgram( )749 void Debugger::breakProgram(RefPtr<Breakpoint>&& specialBreakpoint) 728 750 { 729 751 if (m_isPaused) … … 733 755 return; 734 756 735 m_pauseAtNextOpportunity = true; 757 if (specialBreakpoint) { 758 ASSERT(!m_specialBreakpoint); 759 m_specialBreakpoint = WTFMove(specialBreakpoint); 760 } else 761 m_pauseAtNextOpportunity = true; 762 736 763 setSteppingMode(SteppingModeEnabled); 737 764 m_currentCallFrame = m_vm.topCallFrame; … … 981 1008 982 1009 PauseReasonDeclaration reason(*this, PausedForException); 983 if (m_pauseOn ExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions&& !hasCatchHandler)) {984 m_ pauseAtNextOpportunity = true;1010 if (m_pauseOnAllExceptionsBreakpoint || (m_pauseOnUncaughtExceptionsBreakpoint && !hasCatchHandler)) { 1011 m_specialBreakpoint = m_pauseOnAllExceptionsBreakpoint ? m_pauseOnAllExceptionsBreakpoint.copyRef() : m_pauseOnUncaughtExceptionsBreakpoint.copyRef(); 985 1012 setSteppingMode(SteppingModeEnabled); 986 1013 } … … 1133 1160 return; 1134 1161 1135 if (!m_pauseOnDebuggerStatements )1162 if (!m_pauseOnDebuggerStatementsBreakpoint) 1136 1163 return; 1137 1164 1138 1165 PauseReasonDeclaration reason(*this, PausedForDebuggerStatement); 1139 m_ pauseAtNextOpportunity = true;1166 m_specialBreakpoint = m_pauseOnDebuggerStatementsBreakpoint.copyRef(); 1140 1167 setSteppingMode(SteppingModeEnabled); 1141 1168 updateCallFrame(lexicalGlobalObjectForCallFrame(m_vm, callFrame), callFrame, AttemptPause); -
trunk/Source/JavaScriptCore/debugger/Debugger.h
r266074 r266534 47 47 VM& vm() { return m_vm; } 48 48 49 bool needsExceptionCallbacks() const { return m_breakpointsActivated && m_pauseOnExceptionsState != DontPauseOnExceptions; }49 bool needsExceptionCallbacks() const { return m_breakpointsActivated && (m_pauseOnAllExceptionsBreakpoint || m_pauseOnUncaughtExceptionsBreakpoint); } 50 50 bool isInteractivelyDebugging() const { return m_breakpointsActivated; } 51 51 … … 71 71 void evaluateBreakpointActions(Breakpoint&, JSGlobalObject*); 72 72 73 enum PauseOnExceptionsState { 74 DontPauseOnExceptions, 75 PauseOnAllExceptions, 76 PauseOnUncaughtExceptions 77 }; 78 PauseOnExceptionsState pauseOnExceptionsState() const { return m_pauseOnExceptionsState; } 79 JS_EXPORT_PRIVATE void setPauseOnExceptionsState(PauseOnExceptionsState); 80 81 void setPauseOnDebuggerStatements(bool enabled) { m_pauseOnDebuggerStatements = enabled; } 73 void setPauseOnDebuggerStatementsBreakpoint(RefPtr<Breakpoint>&& breakpoint) { m_pauseOnDebuggerStatementsBreakpoint = WTFMove(breakpoint); } 74 75 class TemporarilyDisableExceptionBreakpoints { 76 public: 77 TemporarilyDisableExceptionBreakpoints(Debugger&); 78 ~TemporarilyDisableExceptionBreakpoints(); 79 80 void replace(); 81 void restore(); 82 83 private: 84 Debugger& m_debugger; 85 RefPtr<Breakpoint> m_pauseOnAllExceptionsBreakpoint; 86 RefPtr<Breakpoint> m_pauseOnUncaughtExceptionsBreakpoint; 87 }; 88 void setPauseOnAllExceptionsBreakpoint(RefPtr<Breakpoint>&& breakpoint) { m_pauseOnAllExceptionsBreakpoint = WTFMove(breakpoint); } 89 void setPauseOnUncaughtExceptionsBreakpoint(RefPtr<Breakpoint>&& breakpoint) { m_pauseOnUncaughtExceptionsBreakpoint = WTFMove(breakpoint); } 82 90 83 91 enum ReasonForPause { … … 99 107 bool schedulePauseForSpecialBreakpoint(Breakpoint&); 100 108 bool cancelPauseForSpecialBreakpoint(Breakpoint&); 101 void breakProgram( );109 void breakProgram(RefPtr<Breakpoint>&& specialBreakpoint = nullptr); 102 110 void continueProgram(); 103 111 void stepNextExpression(); … … 282 290 HashMap<SourceID, BlackboxType, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> m_blackboxedScripts; 283 291 284 PauseOnExceptionsState m_pauseOnExceptionsState;285 bool m_pauseOnDebuggerStatements : 1;286 292 bool m_pauseAtNextOpportunity : 1; 287 293 bool m_pauseOnStepNext : 1; … … 308 314 BreakpointID m_pausingBreakpointID; 309 315 316 RefPtr<Breakpoint> m_pauseOnAllExceptionsBreakpoint; 317 RefPtr<Breakpoint> m_pauseOnUncaughtExceptionsBreakpoint; 318 RefPtr<Breakpoint> m_pauseOnDebuggerStatementsBreakpoint; 319 310 320 unsigned m_nextProbeSampleId { 1 }; 311 321 unsigned m_currentProbeBatchId { 0 }; -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp
r261755 r266534 219 219 JSValue DebuggerCallFrame::evaluateWithScopeExtension(const String& script, JSObject* scopeExtensionObject, NakedPtr<Exception>& exception) 220 220 { 221 ASSERT(isValid()); 222 CallFrame* callFrame = m_validMachineFrame; 223 if (!callFrame) 221 CallFrame* callFrame = nullptr; 222 CodeBlock* codeBlock = nullptr; 223 224 auto* debuggerCallFrame = this; 225 while (debuggerCallFrame) { 226 ASSERT(debuggerCallFrame->isValid()); 227 228 callFrame = debuggerCallFrame->m_validMachineFrame; 229 if (callFrame) { 230 if (debuggerCallFrame->isTailDeleted()) 231 codeBlock = debuggerCallFrame->m_shadowChickenFrame.codeBlock; 232 else 233 codeBlock = callFrame->codeBlock(); 234 } 235 236 if (callFrame && codeBlock) 237 break; 238 239 debuggerCallFrame = debuggerCallFrame->m_caller.get(); 240 } 241 242 if (!callFrame || !codeBlock) 224 243 return jsUndefined(); 225 244 … … 227 246 JSLockHolder lock(vm); 228 247 auto catchScope = DECLARE_CATCH_SCOPE(vm); 229 230 CodeBlock* codeBlock = nullptr;231 if (isTailDeleted())232 codeBlock = m_shadowChickenFrame.codeBlock;233 else234 codeBlock = callFrame->codeBlock();235 if (!codeBlock)236 return jsUndefined();237 248 238 249 JSGlobalObject* globalObject = codeBlock->globalObject(); … … 264 275 } 265 276 266 JSValue thisValue = this->thisValue(vm); 267 JSValue result = vm.interpreter->execute(eval, globalObject, thisValue, scope()->jsScope()); 277 JSValue result = vm.interpreter->execute(eval, globalObject, debuggerCallFrame->thisValue(vm), debuggerCallFrame->scope()->jsScope()); 268 278 if (UNLIKELY(catchScope.exception())) { 269 279 exception = catchScope.exception(); -
trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.h
r251529 r266534 62 62 JS_EXPORT_PRIVATE Type type() const; 63 63 JS_EXPORT_PRIVATE JSValue thisValue(VM&) const; 64 64 65 JSValue evaluateWithScopeExtension(const String&, JSObject* scopeExtensionObject, NakedPtr<Exception>&); 65 66
Note:
See TracChangeset
for help on using the changeset viewer.