OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "bin/dbg_connection.h" | 5 #include "bin/dbg_connection.h" |
6 #include "bin/dbg_message.h" | 6 #include "bin/dbg_message.h" |
7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
10 | 10 |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1059 |
1060 | 1060 |
1061 void DbgMsgQueue::SendQueuedMsgs() { | 1061 void DbgMsgQueue::SendQueuedMsgs() { |
1062 if (queued_output_messages_.length() > 0) { | 1062 if (queued_output_messages_.length() > 0) { |
1063 DebuggerConnectionHandler::BroadcastMsg(&queued_output_messages_); | 1063 DebuggerConnectionHandler::BroadcastMsg(&queued_output_messages_); |
1064 queued_output_messages_.Clear(); | 1064 queued_output_messages_.Clear(); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 void DbgMsgQueue::SendBreakpointEvent(const Dart_CodeLocation& location) { | 1069 void DbgMsgQueue::SendBreakpointEvent(intptr_t bp_id, |
| 1070 const Dart_CodeLocation& location) { |
1070 dart::TextBuffer msg(128); | 1071 dart::TextBuffer msg(128); |
1071 msg.Printf("{ \"event\": \"paused\", \"params\": { "); | 1072 msg.Printf("{ \"event\": \"paused\", \"params\": { "); |
1072 msg.Printf("\"reason\": \"breakpoint\", "); | 1073 msg.Printf("\"reason\": \"breakpoint\", "); |
1073 msg.Printf("\"isolateId\": %" Pd64 "", isolate_id_); | 1074 msg.Printf("\"isolateId\": %" Pd64 "", isolate_id_); |
| 1075 if (bp_id != ILLEGAL_BREAKPOINT_ID) { |
| 1076 msg.Printf(",\"breakpointId\": %" Pd "", bp_id); |
| 1077 } |
1074 if (!Dart_IsNull(location.script_url)) { | 1078 if (!Dart_IsNull(location.script_url)) { |
1075 ASSERT(Dart_IsString(location.script_url)); | 1079 ASSERT(Dart_IsString(location.script_url)); |
1076 msg.Printf(",\"location\": { \"url\":"); | 1080 msg.Printf(",\"location\": { \"url\":"); |
1077 FormatEncodedString(&msg, location.script_url); | 1081 FormatEncodedString(&msg, location.script_url); |
1078 msg.Printf(",\"libraryId\":%d,", location.library_id); | 1082 msg.Printf(",\"libraryId\":%d,", location.library_id); |
1079 msg.Printf("\"tokenOffset\":%d}", location.token_pos); | 1083 msg.Printf("\"tokenOffset\":%d}", location.token_pos); |
1080 } | 1084 } |
1081 msg.Printf("}}"); | 1085 msg.Printf("}}"); |
1082 DebuggerConnectionHandler::BroadcastMsg(&msg); | 1086 DebuggerConnectionHandler::BroadcastMsg(&msg); |
1083 } | 1087 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 msg.Printf(",\"tokenOffset\":%d}}}", location.token_pos); | 1278 msg.Printf(",\"tokenOffset\":%d}}}", location.token_pos); |
1275 | 1279 |
1276 DbgMsgQueue* msg_queue = GetIsolateMsgQueue(isolate_id); | 1280 DbgMsgQueue* msg_queue = GetIsolateMsgQueue(isolate_id); |
1277 ASSERT(msg_queue != NULL); | 1281 ASSERT(msg_queue != NULL); |
1278 msg_queue->QueueOutputMsg(&msg); | 1282 msg_queue->QueueOutputMsg(&msg); |
1279 Dart_ExitScope(); | 1283 Dart_ExitScope(); |
1280 } | 1284 } |
1281 | 1285 |
1282 | 1286 |
1283 void DbgMsgQueueList::PausedEventHandler(Dart_IsolateId isolate_id, | 1287 void DbgMsgQueueList::PausedEventHandler(Dart_IsolateId isolate_id, |
| 1288 intptr_t bp_id, |
1284 const Dart_CodeLocation& loc) { | 1289 const Dart_CodeLocation& loc) { |
1285 DebuggerConnectionHandler::WaitForConnection(); | 1290 DebuggerConnectionHandler::WaitForConnection(); |
1286 Dart_EnterScope(); | 1291 Dart_EnterScope(); |
1287 DbgMsgQueue* msg_queue = GetIsolateMsgQueue(isolate_id); | 1292 DbgMsgQueue* msg_queue = GetIsolateMsgQueue(isolate_id); |
1288 ASSERT(msg_queue != NULL); | 1293 ASSERT(msg_queue != NULL); |
1289 msg_queue->SendQueuedMsgs(); | 1294 msg_queue->SendQueuedMsgs(); |
1290 msg_queue->SendBreakpointEvent(loc); | 1295 msg_queue->SendBreakpointEvent(bp_id, loc); |
1291 msg_queue->HandleMessages(); | 1296 msg_queue->HandleMessages(); |
1292 Dart_ExitScope(); | 1297 Dart_ExitScope(); |
1293 } | 1298 } |
1294 | 1299 |
1295 | 1300 |
1296 void DbgMsgQueueList::ExceptionThrownHandler(Dart_IsolateId isolate_id, | 1301 void DbgMsgQueueList::ExceptionThrownHandler(Dart_IsolateId isolate_id, |
1297 Dart_Handle exception, | 1302 Dart_Handle exception, |
1298 Dart_StackTrace stack_trace) { | 1303 Dart_StackTrace stack_trace) { |
1299 DebuggerConnectionHandler::WaitForConnection(); | 1304 DebuggerConnectionHandler::WaitForConnection(); |
1300 Dart_EnterScope(); | 1305 Dart_EnterScope(); |
(...skipping 23 matching lines...) Expand all Loading... |
1324 } else { | 1329 } else { |
1325 ASSERT(kind == kShutdown); | 1330 ASSERT(kind == kShutdown); |
1326 RemoveIsolateMsgQueue(isolate_id); | 1331 RemoveIsolateMsgQueue(isolate_id); |
1327 } | 1332 } |
1328 } | 1333 } |
1329 Dart_ExitScope(); | 1334 Dart_ExitScope(); |
1330 } | 1335 } |
1331 | 1336 |
1332 } // namespace bin | 1337 } // namespace bin |
1333 } // namespace dart | 1338 } // namespace dart |
OLD | NEW |