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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 static void FormatLocationFromTrace(dart::TextBuffer* msg, | 408 static void FormatLocationFromTrace(dart::TextBuffer* msg, |
409 Dart_StackTrace trace, | 409 Dart_StackTrace trace, |
410 const char* prefix) { | 410 const char* prefix) { |
411 intptr_t trace_len = 0; | 411 intptr_t trace_len = 0; |
412 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); | 412 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
413 ASSERT_NOT_ERROR(res); | 413 ASSERT_NOT_ERROR(res); |
414 Dart_ActivationFrame frame; | 414 Dart_ActivationFrame frame; |
415 res = Dart_GetActivationFrame(trace, 0, &frame); | 415 res = Dart_GetActivationFrame(trace, 0, &frame); |
416 ASSERT_NOT_ERROR(res); | 416 ASSERT_NOT_ERROR(res); |
417 Dart_CodeLocation location; | 417 Dart_CodeLocation location; |
418 res = Dart_ActivationFrameGetLocation(frame, NULL, &location); | 418 res = Dart_ActivationFrameGetLocation(frame, NULL, NULL, &location); |
419 ASSERT_NOT_ERROR(res); | 419 ASSERT_NOT_ERROR(res); |
420 if (!Dart_IsNull(location.script_url)) { | 420 if (!Dart_IsNull(location.script_url)) { |
421 ASSERT(Dart_IsString(location.script_url)); | 421 ASSERT(Dart_IsString(location.script_url)); |
422 msg->Printf("%s\"location\": { \"url\":", prefix); | 422 msg->Printf("%s\"location\": { \"url\":", prefix); |
423 FormatEncodedString(msg, location.script_url); | 423 FormatEncodedString(msg, location.script_url); |
424 msg->Printf(",\"libraryId\":%d,", location.library_id); | 424 msg->Printf(",\"libraryId\":%d,", location.library_id); |
425 msg->Printf("\"tokenOffset\":%d}", location.token_pos); | 425 msg->Printf("\"tokenOffset\":%d}", location.token_pos); |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 | 429 |
430 static void FormatCallFrames(dart::TextBuffer* msg, Dart_StackTrace trace) { | 430 static void FormatCallFrames(dart::TextBuffer* msg, Dart_StackTrace trace) { |
431 intptr_t trace_len = 0; | 431 intptr_t trace_len = 0; |
432 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); | 432 Dart_Handle res = Dart_StackTraceLength(trace, &trace_len); |
433 ASSERT_NOT_ERROR(res); | 433 ASSERT_NOT_ERROR(res); |
434 msg->Printf("\"callFrames\" : [ "); | 434 msg->Printf("\"callFrames\" : [ "); |
435 for (int i = 0; i < trace_len; i++) { | 435 for (int i = 0; i < trace_len; i++) { |
436 Dart_ActivationFrame frame; | 436 Dart_ActivationFrame frame; |
437 res = Dart_GetActivationFrame(trace, i, &frame); | 437 res = Dart_GetActivationFrame(trace, i, &frame); |
438 ASSERT_NOT_ERROR(res); | 438 ASSERT_NOT_ERROR(res); |
439 Dart_Handle func_name; | 439 Dart_Handle func_name; |
440 Dart_CodeLocation location; | 440 Dart_CodeLocation location; |
441 res = Dart_ActivationFrameGetLocation(frame, &func_name, &location); | 441 res = Dart_ActivationFrameGetLocation(frame, &func_name, NULL, &location); |
442 ASSERT_NOT_ERROR(res); | 442 ASSERT_NOT_ERROR(res); |
443 ASSERT(Dart_IsString(func_name)); | 443 ASSERT(Dart_IsString(func_name)); |
444 msg->Printf("%s{\"functionName\":", (i > 0) ? "," : ""); | 444 msg->Printf("%s{\"functionName\":", (i > 0) ? "," : ""); |
445 FormatEncodedString(msg, func_name); | 445 FormatEncodedString(msg, func_name); |
446 if (!Dart_IsNull(location.script_url)) { | 446 if (!Dart_IsNull(location.script_url)) { |
447 ASSERT(Dart_IsString(location.script_url)); | 447 ASSERT(Dart_IsString(location.script_url)); |
448 msg->Printf(",\"location\": { \"url\":"); | 448 msg->Printf(",\"location\": { \"url\":"); |
449 FormatEncodedString(msg, location.script_url); | 449 FormatEncodedString(msg, location.script_url); |
450 msg->Printf(",\"libraryId\":%d,", location.library_id); | 450 msg->Printf(",\"libraryId\":%d,", location.library_id); |
451 msg->Printf("\"tokenOffset\":%d}", location.token_pos); | 451 msg->Printf("\"tokenOffset\":%d}", location.token_pos); |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } else { | 1300 } else { |
1301 ASSERT(kind == kShutdown); | 1301 ASSERT(kind == kShutdown); |
1302 RemoveIsolateMsgQueue(isolate_id); | 1302 RemoveIsolateMsgQueue(isolate_id); |
1303 } | 1303 } |
1304 } | 1304 } |
1305 Dart_ExitScope(); | 1305 Dart_ExitScope(); |
1306 } | 1306 } |
1307 | 1307 |
1308 } // namespace bin | 1308 } // namespace bin |
1309 } // namespace dart | 1309 } // namespace dart |
OLD | NEW |