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/dartutils.h" | 6 #include "bin/dartutils.h" |
7 #include "bin/socket.h" | 7 #include "bin/socket.h" |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
10 | 10 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 } | 316 } |
317 | 317 |
318 | 318 |
319 void DebuggerConnectionHandler::HandleStepOverCmd(const char* json_msg) { | 319 void DebuggerConnectionHandler::HandleStepOverCmd(const char* json_msg) { |
320 Dart_Handle res = Dart_SetStepOver(); | 320 Dart_Handle res = Dart_SetStepOver(); |
321 ASSERT_NOT_ERROR(res); | 321 ASSERT_NOT_ERROR(res); |
322 HandleResumeCmd(json_msg); | 322 HandleResumeCmd(json_msg); |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 static void FormatEncodedString32(dart::TextBuffer* buf, Dart_Handle str) { | |
327 intptr_t str_len = 0; | |
328 Dart_Handle res = Dart_StringLength(str, &str_len); | |
329 ASSERT_NOT_ERROR(res); | |
330 uint32_t* codepoints = | |
331 reinterpret_cast<uint32_t*>(malloc(str_len * sizeof(uint32_t))); | |
332 ASSERT(codepoints != NULL); | |
333 intptr_t actual_len = str_len; | |
334 res = Dart_StringGet32(str, codepoints, &actual_len); | |
siva
2012/07/18 17:11:31
ASSERT_NOT_ERROR(res);
hausner
2012/07/18 22:20:36
Done.
| |
335 ASSERT(str_len == actual_len); | |
336 buf->Printf("\""); | |
337 buf->PrintJsonString32(codepoints, str_len); | |
338 buf->Printf("\""); | |
339 free(codepoints); | |
340 } | |
341 | |
342 | |
326 static void FormatEncodedString(dart::TextBuffer* buf, Dart_Handle str) { | 343 static void FormatEncodedString(dart::TextBuffer* buf, Dart_Handle str) { |
344 if (!Dart_IsString8(str)) { | |
345 return FormatEncodedString32(buf, str); | |
346 } | |
327 ASSERT(Dart_IsString8(str)); | 347 ASSERT(Dart_IsString8(str)); |
328 intptr_t str_len = 0; | 348 intptr_t str_len = 0; |
329 Dart_Handle res = Dart_StringLength(str, &str_len); | 349 Dart_Handle res = Dart_StringLength(str, &str_len); |
330 ASSERT_NOT_ERROR(res); | 350 ASSERT_NOT_ERROR(res); |
331 uint8_t* codepoints = reinterpret_cast<uint8_t*>(malloc(str_len)); | 351 uint8_t* codepoints = reinterpret_cast<uint8_t*>(malloc(str_len)); |
332 ASSERT(codepoints != NULL); | 352 ASSERT(codepoints != NULL); |
333 intptr_t actual_len = str_len; | 353 intptr_t actual_len = str_len; |
334 res = Dart_StringGet8(str, codepoints, &actual_len); | 354 res = Dart_StringGet8(str, codepoints, &actual_len); |
335 ASSERT(str_len == actual_len); | 355 ASSERT(str_len == actual_len); |
336 buf->Printf("\""); | 356 buf->Printf("\""); |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1024 DebuggerConnectionImpl::StartHandler(port_number); | 1044 DebuggerConnectionImpl::StartHandler(port_number); |
1025 Dart_SetBreakpointHandler(BreakpointHandler); | 1045 Dart_SetBreakpointHandler(BreakpointHandler); |
1026 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); | 1046 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); |
1027 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); | 1047 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); |
1028 } | 1048 } |
1029 | 1049 |
1030 | 1050 |
1031 DebuggerConnectionHandler::~DebuggerConnectionHandler() { | 1051 DebuggerConnectionHandler::~DebuggerConnectionHandler() { |
1032 CloseDbgConnection(); | 1052 CloseDbgConnection(); |
1033 } | 1053 } |
OLD | NEW |