Skip to content

Commit 30dc2de

Browse files
derekxu16Commit Queue
authored and
Commit Queue
committed
[VM/Service] Report the requested column in the error messages of CannotAddBreakpoint errors
TEST=CI Change-Id: Ia74bd61ef0b166275d5828fb21cfa9c92c5f00cf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389280 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Derek Xu <[email protected]>
1 parent cdacfd8 commit 30dc2de

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

pkg/vm_service/test/add_breakpoint_rpc_kernel_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ final tests = <IsolateTest>[
139139
expect(e.code, RPCErrorKind.kCannotAddBreakpoint.code);
140140
expect(
141141
e.details,
142-
'addBreakpoint: Cannot add breakpoint at line $LINE_A. Error occurred '
142+
'addBreakpoint: Cannot add breakpoint at $LINE_A:37. Error occurred '
143143
'when resolving breakpoint location: No debuggable code where '
144144
'breakpoint was requested.',
145145
);

runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var tests = <IsolateTest>[
9898
expect(e.code, equals(ServerRpcException.kCannotAddBreakpoint));
9999
expect(
100100
e.message,
101-
'addBreakpoint: Cannot add breakpoint at line $LINE_A. Error occurred '
101+
'addBreakpoint: Cannot add breakpoint at $LINE_A:37. Error occurred '
102102
'when resolving breakpoint location: No debuggable code where '
103103
'breakpoint was requested.',
104104
);

runtime/vm/service.cc

+12-4
Original file line numberDiff line numberDiff line change
@@ -4042,10 +4042,18 @@ static void AddBreakpointCommon(Thread* thread,
40424042
Error::Handle(thread->isolate()->debugger()->SetBreakpointAtLineCol(
40434043
script_uri, line, col, &bpt));
40444044
if (!error.IsNull()) {
4045-
js->PrintError(kCannotAddBreakpoint,
4046-
"%s: Cannot add breakpoint at line %s. Error occurred "
4047-
"when resolving breakpoint location: %s.",
4048-
js->method(), line_param, error.ToErrorCString());
4045+
if (col_param != nullptr) {
4046+
js->PrintError(
4047+
kCannotAddBreakpoint,
4048+
"%s: Cannot add breakpoint at %s:%s. Error occurred when resolving "
4049+
"breakpoint location: %s.",
4050+
js->method(), line_param, col_param, error.ToErrorCString());
4051+
} else {
4052+
js->PrintError(kCannotAddBreakpoint,
4053+
"%s: Cannot add breakpoint at line %s. Error occurred "
4054+
"when resolving breakpoint location: %s.",
4055+
js->method(), line_param, error.ToErrorCString());
4056+
}
40494057
return;
40504058
}
40514059
ASSERT(bpt != nullptr);

0 commit comments

Comments
 (0)