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

Commit af912e8

Browse files
committed
inspector: assert when clearing breakpoints
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>
1 parent 28cdc33 commit af912e8

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

deps/chakrashim/src/inspector/v8-debugger.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,11 @@ void V8Debugger::removeBreakpoint(const String16& breakpointId) {
147147
return;
148148
}
149149

150-
JsErrorCode err = JsDiagRemoveBreakpoint(bpId);
151-
assert(err == JsNoError || err == JsErrorInvalidArgument);
150+
jsrt::Inspector::RemoveBreakpoint(bpId);
152151
}
153152

154153
void V8Debugger::setBreakpointsActivated(bool activated) {
155-
154+
// CHAKRA-TODO - Figure out what to do here
156155
}
157156

158157
V8Debugger::PauseOnExceptionsState V8Debugger::getPauseOnExceptionsState() {

deps/chakrashim/src/jsrtinspector.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ namespace jsrt {
205205
}
206206
}
207207

208+
void Inspector::RemoveBreakpoint(unsigned int breakpointId) {
209+
JsErrorCode err = JsDiagRemoveBreakpoint(breakpointId);
210+
211+
// Ignore invalid argument as the breakpoint may have overlapped with an
212+
// existing one.
213+
if (err != JsErrorInvalidArgument) {
214+
CHAKRA_VERIFY_NOERROR(err);
215+
}
216+
}
217+
208218
void Inspector::ClearBreakpoints() {
209219
JsValueRef breakpoints;
210220
CHAKRA_VERIFY_NOERROR(JsDiagGetBreakpoints(&breakpoints));
@@ -226,7 +236,7 @@ namespace jsrt {
226236
CHAKRA_VERIFY_NOERROR(jsrt::InspectorHelpers::GetIntProperty(
227237
breakpoint, "breakpointId", &breakpointId));
228238

229-
CHAKRA_VERIFY_NOERROR(JsDiagRemoveBreakpoint(breakpointId));
239+
RemoveBreakpoint(breakpointId);
230240
}
231241
}
232242

deps/chakrashim/src/jsrtinspector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Inspector {
3737
static void SetChakraDebugObject(JsValueRef chakraDebugObject);
3838
static void SetDebugEventHandler(JsDiagDebugEventCallback callback,
3939
void* callbackState);
40+
static void RemoveBreakpoint(unsigned int breakpointId);
4041
static void ClearBreakpoints();
4142

4243
private:

0 commit comments

Comments
 (0)