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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 411 } |
412 return bpt; | 412 return bpt; |
413 } | 413 } |
414 | 414 |
415 | 415 |
416 const char* Debugger::QualifiedFunctionName(const Function& func) { | 416 const char* Debugger::QualifiedFunctionName(const Function& func) { |
417 const String& func_name = String::Handle(func.name()); | 417 const String& func_name = String::Handle(func.name()); |
418 Class& func_class = Class::Handle(func.Owner()); | 418 Class& func_class = Class::Handle(func.Owner()); |
419 String& class_name = String::Handle(func_class.Name()); | 419 String& class_name = String::Handle(func_class.Name()); |
420 | 420 |
421 const char* kFormat = "%s%s%s"; | 421 return OS::SCreate(Thread::Current()->zone(), |
422 intptr_t len = OS::SNPrint(NULL, 0, kFormat, | 422 "%s%s%s", func_class.IsTopLevel() ? "" : class_name.ToCString(), |
423 func_class.IsTopLevel() ? "" : class_name.ToCString(), | |
424 func_class.IsTopLevel() ? "" : ".", | |
425 func_name.ToCString()); | |
426 len++; // String terminator. | |
427 char* chars = Thread::Current()->zone()->Alloc<char>(len); | |
428 OS::SNPrint(chars, len, kFormat, | |
429 func_class.IsTopLevel() ? "" : class_name.ToCString(), | |
430 func_class.IsTopLevel() ? "" : ".", | 423 func_class.IsTopLevel() ? "" : ".", |
431 func_name.ToCString()); | 424 func_name.ToCString()); |
432 return chars; | |
433 } | 425 } |
434 | 426 |
435 | 427 |
436 // Returns true if function contains the token position in the given script. | 428 // Returns true if function contains the token position in the given script. |
437 static bool FunctionContains(const Function& func, | 429 static bool FunctionContains(const Function& func, |
438 const Script& script, | 430 const Script& script, |
439 intptr_t token_pos) { | 431 intptr_t token_pos) { |
440 if ((func.token_pos() <= token_pos) && (token_pos <= func.end_token_pos())) { | 432 if ((func.token_pos() <= token_pos) && (token_pos <= func.end_token_pos())) { |
441 // Check script equality second because it allocates | 433 // Check script equality second because it allocates |
442 // handles as a side effect. | 434 // handles as a side effect. |
(...skipping 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3181 } | 3173 } |
3182 | 3174 |
3183 | 3175 |
3184 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3176 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3185 ASSERT(bpt->next() == NULL); | 3177 ASSERT(bpt->next() == NULL); |
3186 bpt->set_next(code_breakpoints_); | 3178 bpt->set_next(code_breakpoints_); |
3187 code_breakpoints_ = bpt; | 3179 code_breakpoints_ = bpt; |
3188 } | 3180 } |
3189 | 3181 |
3190 } // namespace dart | 3182 } // namespace dart |
OLD | NEW |