Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
inspector: assert when clearing breakpoints
Browse files Browse the repository at this point in the history
If the debugger attempts to set a breakpoint that gets resolved to an
existing breakpoint, then when we go to clear the same breakpoint will
be removed twice. On the second removal the API returns
JsErrorInvalidArgument which is a no-op for this function.

PR-URL: #244
Reviewed-By: Kunal Pathak <Kunal.Pathak@microsoft.com>
Reviewed-By: Sandeep Agarwal <saagarwa@microsoft.com>
  • Loading branch information
kfarnung committed May 17, 2017
1 parent 28cdc33 commit af912e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 2 additions & 3 deletions deps/chakrashim/src/inspector/v8-debugger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,11 @@ void V8Debugger::removeBreakpoint(const String16& breakpointId) {
return;
}

JsErrorCode err = JsDiagRemoveBreakpoint(bpId);
assert(err == JsNoError || err == JsErrorInvalidArgument);
jsrt::Inspector::RemoveBreakpoint(bpId);
}

void V8Debugger::setBreakpointsActivated(bool activated) {

// CHAKRA-TODO - Figure out what to do here
}

V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() {
Expand Down
12 changes: 11 additions & 1 deletion deps/chakrashim/src/jsrtinspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ namespace jsrt {
}
}

void Inspector::RemoveBreakpoint(unsigned int breakpointId) {
JsErrorCode err = JsDiagRemoveBreakpoint(breakpointId);

// Ignore invalid argument as the breakpoint may have overlapped with an
// existing one.
if (err != JsErrorInvalidArgument) {
CHAKRA_VERIFY_NOERROR(err);
}
}

void Inspector::ClearBreakpoints() {
JsValueRef breakpoints;
CHAKRA_VERIFY_NOERROR(JsDiagGetBreakpoints(&breakpoints));
Expand All @@ -226,7 +236,7 @@ namespace jsrt {
CHAKRA_VERIFY_NOERROR(jsrt::InspectorHelpers::GetIntProperty(
breakpoint, "breakpointId", &breakpointId));

CHAKRA_VERIFY_NOERROR(JsDiagRemoveBreakpoint(breakpointId));
RemoveBreakpoint(breakpointId);
}
}

Expand Down
1 change: 1 addition & 0 deletions deps/chakrashim/src/jsrtinspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Inspector {
static void SetChakraDebugObject(JsValueRef chakraDebugObject);
static void SetDebugEventHandler(JsDiagDebugEventCallback callback,
void* callbackState);
static void RemoveBreakpoint(unsigned int breakpointId);
static void ClearBreakpoints();

private:
Expand Down

0 comments on commit af912e8

Please sign in to comment.