More logging for pause tests

BUG=

Review URL: https://codereview.chromium.org//1310863004 .
This commit is contained in:
John McCutchan 2015-08-26 16:45:36 -07:00
parent 62e9d05668
commit c9a4013553
6 changed files with 33 additions and 7 deletions

View file

@ -514,6 +514,9 @@ abstract class VM extends ServiceObjectOwner {
// TODO(turnidge): The connection should not be stored in the VM object.
bool get isDisconnected;
// Used for verbose logging.
bool verbose = false;
// TODO(johnmccutchan): Ensure that isolates do not end up in _cache.
Map<String,ServiceObject> _cache = new Map<String,ServiceObject>();
final ObservableMap<String,Isolate> _isolateCache =
@ -1281,6 +1284,9 @@ class Isolate extends ServiceObjectOwner with Coverage {
exceptionsPauseInfo = map['_debuggerSettings']['_exceptions'];
pauseEvent = map['pauseEvent'];
if (vm.verbose) {
print('VM-VERBOSE: $name reloaded. pause event= $pauseEvent');
}
_updateRunState();
error = map['error'];
@ -1332,6 +1338,9 @@ class Isolate extends ServiceObjectOwner with Coverage {
}
void _onEvent(ServiceEvent event) {
if (vm.verbose) {
print('VM-VERBOSE: $name _onEvent $event');
}
switch(event.kind) {
case ServiceEvent.kIsolateStart:
case ServiceEvent.kIsolateRunnable:
@ -1361,6 +1370,7 @@ class Isolate extends ServiceObjectOwner with Coverage {
case ServiceEvent.kPauseException:
case ServiceEvent.kResume:
pauseEvent = event;
print('VM-VERBOSE: $name pause event $pauseEvent');
_updateRunState();
break;

View file

@ -85,4 +85,5 @@ main(args) => runIsolateTests(args, tests,
testeeConcurrent: testMain,
pause_on_start: true,
pause_on_exit: true,
trace_service: true);
trace_service: true,
verbose_vm: true);

View file

@ -88,4 +88,5 @@ main(args) => runIsolateTests(args, tests,
testeeConcurrent: testMain,
pause_on_start: true,
pause_on_exit: true,
trace_service: true);
trace_service: true,
verbose_vm: true);

View file

@ -109,7 +109,8 @@ void runIsolateTests(List<String> mainArgs,
void testeeConcurrent(),
bool pause_on_start: false,
bool pause_on_exit: false,
bool trace_service: false}) {
bool trace_service: false,
bool verbose_vm: false}) {
assert(!pause_on_start || testeeBefore == null);
if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
if (!pause_on_start) {
@ -140,6 +141,7 @@ void runIsolateTests(List<String> mainArgs,
new WebSocketVM(new WebSocketVMTarget(addr)).load()
.then((VM vm) => vm.isolates.first.load())
.then((Isolate isolate) => Future.forEach(tests, (test) {
isolate.vm.verbose = verbose_vm;
print('Running $name [$testIndex/$totalTests]');
testIndex++;
return test(isolate);
@ -285,7 +287,8 @@ Future runVMTests(List<String> mainArgs,
Future testeeConcurrent(),
bool pause_on_start: false,
bool pause_on_exit: false,
bool trace_service: false}) async {
bool trace_service: false,
bool verbose_vm: false}) async {
if (mainArgs.contains(_TESTEE_MODE_FLAG)) {
if (!pause_on_start) {
if (testeeBefore != null) {
@ -316,6 +319,7 @@ Future runVMTests(List<String> mainArgs,
runZoned(() {
new WebSocketVM(new WebSocketVMTarget(addr)).load()
.then((VM vm) => Future.forEach(tests, (test) {
vm.verbose = verbose_vm;
print('Running $name [$testIndex/$totalTests]');
testIndex++;
return test(vm);

View file

@ -45,6 +45,7 @@
namespace dart {
DECLARE_FLAG(bool, print_metrics);
DECLARE_FLAG(bool, trace_service);
DEFINE_FLAG(bool, trace_isolates, false,
"Trace isolate creation and shut down.");
@ -503,6 +504,9 @@ void IsolateMessageHandler::NotifyPauseOnStart() {
HandleScope handle_scope(I);
ServiceEvent pause_event(isolate(), ServiceEvent::kPauseStart);
Service::HandleEvent(&pause_event);
} else if (FLAG_trace_service) {
OS::Print("vm-service: Dropping event of type PauseStart (%s)\n",
isolate()->name());
}
}
@ -514,6 +518,9 @@ void IsolateMessageHandler::NotifyPauseOnExit() {
HandleScope handle_scope(I);
ServiceEvent pause_event(isolate(), ServiceEvent::kPauseExit);
Service::HandleEvent(&pause_event);
} else if (FLAG_trace_service) {
OS::Print("vm-service: Dropping event of type PauseExit (%s)\n",
isolate()->name());
}
}

View file

@ -644,8 +644,8 @@ void Service::SendEvent(const char* stream_id,
intptr_t len = writer.BytesWritten();
if (FLAG_trace_service) {
OS::Print(
"vm-service: Pushing event of type %s to stream %s, len %" Pd "\n",
event_type, stream_id, len);
"vm-service: Pushing event of type %s to stream %s (%s), len %" Pd "\n",
event_type, stream_id, isolate->name(), len);
}
// TODO(turnidge): For now we ignore failure to send an event. Revisit?
PortMap::PostMessage(
@ -736,8 +736,11 @@ void Service::PostEvent(const char* stream_id,
list_values[1] = &json_cobj;
if (FLAG_trace_service) {
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
OS::Print(
"vm-service: Pushing event of type %s to stream %s\n", kind, stream_id);
"vm-service: Pushing event of type %s to stream %s (%s)\n",
kind, stream_id, isolate->name());
}
Dart_PostCObject(ServiceIsolate::Port(), &list_cobj);