[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 <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
This commit is contained in:
Derek Xu
2024-10-15 16:57:36 +00:00
committed by Commit Queue
parent cdacfd80f1
commit 30dc2de34f
3 changed files with 14 additions and 6 deletions
@@ -139,7 +139,7 @@ final tests = <IsolateTest>[
expect(e.code, RPCErrorKind.kCannotAddBreakpoint.code);
expect(
e.details,
'addBreakpoint: Cannot add breakpoint at line $LINE_A. Error occurred '
'addBreakpoint: Cannot add breakpoint at $LINE_A:37. Error occurred '
'when resolving breakpoint location: No debuggable code where '
'breakpoint was requested.',
);
@@ -98,7 +98,7 @@ var tests = <IsolateTest>[
expect(e.code, equals(ServerRpcException.kCannotAddBreakpoint));
expect(
e.message,
'addBreakpoint: Cannot add breakpoint at line $LINE_A. Error occurred '
'addBreakpoint: Cannot add breakpoint at $LINE_A:37. Error occurred '
'when resolving breakpoint location: No debuggable code where '
'breakpoint was requested.',
);
+12 -4
View File
@@ -4042,10 +4042,18 @@ static void AddBreakpointCommon(Thread* thread,
Error::Handle(thread->isolate()->debugger()->SetBreakpointAtLineCol(
script_uri, line, col, &bpt));
if (!error.IsNull()) {
js->PrintError(kCannotAddBreakpoint,
"%s: Cannot add breakpoint at line %s. Error occurred "
"when resolving breakpoint location: %s.",
js->method(), line_param, error.ToErrorCString());
if (col_param != nullptr) {
js->PrintError(
kCannotAddBreakpoint,
"%s: Cannot add breakpoint at %s:%s. Error occurred when resolving "
"breakpoint location: %s.",
js->method(), line_param, col_param, error.ToErrorCString());
} else {
js->PrintError(kCannotAddBreakpoint,
"%s: Cannot add breakpoint at line %s. Error occurred "
"when resolving breakpoint location: %s.",
js->method(), line_param, error.ToErrorCString());
}
return;
}
ASSERT(bpt != nullptr);