| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FormatEncodedString(dart::TextBuffer* buf, Dart_Handle str) { | 326 static void FormatEncodedString(dart::TextBuffer* buf, Dart_Handle str) { |
| 327 ASSERT(Dart_IsString8(str)); | |
| 328 intptr_t str_len = 0; | 327 intptr_t str_len = 0; |
| 329 Dart_Handle res = Dart_StringLength(str, &str_len); | 328 Dart_Handle res = Dart_StringLength(str, &str_len); |
| 330 ASSERT_NOT_ERROR(res); | 329 ASSERT_NOT_ERROR(res); |
| 331 uint8_t* codepoints = reinterpret_cast<uint8_t*>(malloc(str_len)); | 330 uint32_t* codepoints = |
| 331 reinterpret_cast<uint32_t*>(malloc(str_len * sizeof(uint32_t))); |
| 332 ASSERT(codepoints != NULL); | 332 ASSERT(codepoints != NULL); |
| 333 intptr_t actual_len = str_len; | 333 intptr_t actual_len = str_len; |
| 334 res = Dart_StringGet8(str, codepoints, &actual_len); | 334 res = Dart_StringGet32(str, codepoints, &actual_len); |
| 335 ASSERT_NOT_ERROR(res); |
| 335 ASSERT(str_len == actual_len); | 336 ASSERT(str_len == actual_len); |
| 336 buf->Printf("\""); | 337 buf->AddChar('\"'); |
| 337 buf->PrintJsonString8(codepoints, str_len); | 338 for (int i = 0; i < str_len; i++) { |
| 338 buf->Printf("\""); | 339 buf->AddEscapedChar(codepoints[i]); |
| 340 } |
| 341 buf->AddChar('\"'); |
| 339 free(codepoints); | 342 free(codepoints); |
| 340 } | 343 } |
| 341 | 344 |
| 342 | 345 |
| 343 static void FormatErrorMsg(dart::TextBuffer* buf, Dart_Handle err) { | 346 static void FormatErrorMsg(dart::TextBuffer* buf, Dart_Handle err) { |
| 344 // TODO(hausner): Turn message into Dart string and | 347 // TODO(hausner): Turn message into Dart string and |
| 345 // properly encode the message. | 348 // properly encode the message. |
| 346 ASSERT(Dart_IsError(err)); | 349 ASSERT(Dart_IsError(err)); |
| 347 const char* msg = Dart_GetError(err); | 350 const char* msg = Dart_GetError(err); |
| 348 buf->Printf("\"%s\"", msg); | 351 buf->Printf("\"%s\"", msg); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 DebuggerConnectionImpl::StartHandler(port_number); | 1027 DebuggerConnectionImpl::StartHandler(port_number); |
| 1025 Dart_SetBreakpointHandler(BreakpointHandler); | 1028 Dart_SetBreakpointHandler(BreakpointHandler); |
| 1026 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); | 1029 Dart_SetBreakpointResolvedHandler(BptResolvedHandler); |
| 1027 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); | 1030 Dart_SetExceptionThrownHandler(ExceptionThrownHandler); |
| 1028 } | 1031 } |
| 1029 | 1032 |
| 1030 | 1033 |
| 1031 DebuggerConnectionHandler::~DebuggerConnectionHandler() { | 1034 DebuggerConnectionHandler::~DebuggerConnectionHandler() { |
| 1032 CloseDbgConnection(); | 1035 CloseDbgConnection(); |
| 1033 } | 1036 } |
| OLD | NEW |