73a059d406
Also add functionality for the tool to do offsets. Finally run in on the pkg/vm_service/test/ folder. Change-Id: Ifa4ca60ed0707e6211baf4b9df140802d5cecf6f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404881 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
70 lines
1.8 KiB
Dart
70 lines
1.8 KiB
Dart
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
// VMOptions=--verbose_debug
|
|
|
|
import 'dart:developer';
|
|
|
|
import 'package:test/test.dart';
|
|
import 'package:vm_service/vm_service.dart';
|
|
|
|
import 'common/service_test_common.dart';
|
|
import 'common/test_helper.dart';
|
|
|
|
// AUTOGENERATED START
|
|
//
|
|
// Update these constants by running:
|
|
//
|
|
// dart pkg/vm_service/test/update_line_numbers.dart pkg/vm_service/test/positive_token_pos_test.dart
|
|
//
|
|
const LINE_C = 29;
|
|
const LINE_A = 33;
|
|
const LINE_B = 34;
|
|
// AUTOGENERATED END
|
|
|
|
const LINE_B_COL = 3;
|
|
const LINE_C_COL = 1;
|
|
|
|
Future<void> helper() async {
|
|
// LINE_C
|
|
}
|
|
|
|
void testMain() {
|
|
debugger(); // LINE_A
|
|
helper(); // LINE_B
|
|
}
|
|
|
|
final tests = <IsolateTest>[
|
|
hasStoppedAtBreakpoint,
|
|
stoppedAtLine(LINE_A),
|
|
stepOver,
|
|
hasStoppedAtBreakpoint,
|
|
stoppedAtLine(LINE_B),
|
|
stepInto,
|
|
(VmService service, IsolateRef isolateRef) async {
|
|
final isolateId = isolateRef.id!;
|
|
final stack = await service.getStack(isolateId);
|
|
final frames = stack.frames!;
|
|
expect(frames.length, greaterThan(2));
|
|
|
|
// We used to return a negative token position for this frame.
|
|
// See issue #27128.
|
|
var frame = frames[0];
|
|
expect(frame.function!.name, 'helper');
|
|
expect(frame.location!.line, LINE_C + 1);
|
|
expect(frame.location!.column, LINE_C_COL);
|
|
|
|
frame = frames[1];
|
|
expect(frame.function!.name, 'testMain');
|
|
expect(frame.location!.line, LINE_B);
|
|
expect(frame.location!.column, LINE_B_COL);
|
|
}
|
|
];
|
|
|
|
void main([args = const <String>[]]) => runIsolateTests(
|
|
args,
|
|
tests,
|
|
'positive_token_pos_test.dart',
|
|
testeeConcurrent: testMain,
|
|
);
|