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 "vm/debugger.h" | 5 #include "vm/debugger.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 } | 396 } |
397 return bpt; | 397 return bpt; |
398 } | 398 } |
399 | 399 |
400 | 400 |
401 const char* Debugger::QualifiedFunctionName(const Function& func) { | 401 const char* Debugger::QualifiedFunctionName(const Function& func) { |
402 const String& func_name = String::Handle(func.name()); | 402 const String& func_name = String::Handle(func.name()); |
403 Class& func_class = Class::Handle(func.Owner()); | 403 Class& func_class = Class::Handle(func.Owner()); |
404 String& class_name = String::Handle(func_class.Name()); | 404 String& class_name = String::Handle(func_class.Name()); |
405 | 405 |
406 const char* kFormat = "%s%s%s"; | 406 char* chars = NULL; |
407 intptr_t len = OS::SNPrint(NULL, 0, kFormat, | 407 SNPRINT(chars, Thread::Current()->zone()->Alloc<char>, "%s%s%s", |
408 func_class.IsTopLevel() ? "" : class_name.ToCString(), | 408 func_class.IsTopLevel() ? "" : class_name.ToCString(), |
409 func_class.IsTopLevel() ? "" : ".", | 409 func_class.IsTopLevel() ? "" : ".", |
410 func_name.ToCString()); | 410 func_name.ToCString()); |
411 len++; // String terminator. | |
412 char* chars = Thread::Current()->zone()->Alloc<char>(len); | |
413 OS::SNPrint(chars, len, kFormat, | |
414 func_class.IsTopLevel() ? "" : class_name.ToCString(), | |
415 func_class.IsTopLevel() ? "" : ".", | |
416 func_name.ToCString()); | |
417 return chars; | 411 return chars; |
418 } | 412 } |
419 | 413 |
420 | 414 |
421 // Returns true if function contains the token position in the given script. | 415 // Returns true if function contains the token position in the given script. |
422 static bool FunctionContains(const Function& func, | 416 static bool FunctionContains(const Function& func, |
423 const Script& script, | 417 const Script& script, |
424 intptr_t token_pos) { | 418 intptr_t token_pos) { |
425 if ((func.token_pos() <= token_pos) && (token_pos <= func.end_token_pos())) { | 419 if ((func.token_pos() <= token_pos) && (token_pos <= func.end_token_pos())) { |
426 // Check script equality second because it allocates | 420 // Check script equality second because it allocates |
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3024 } | 3018 } |
3025 | 3019 |
3026 | 3020 |
3027 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3021 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3028 ASSERT(bpt->next() == NULL); | 3022 ASSERT(bpt->next() == NULL); |
3029 bpt->set_next(code_breakpoints_); | 3023 bpt->set_next(code_breakpoints_); |
3030 code_breakpoints_ = bpt; | 3024 code_breakpoints_ = bpt; |
3031 } | 3025 } |
3032 | 3026 |
3033 } // namespace dart | 3027 } // namespace dart |
OLD | NEW |