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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 "The following options are only used for VM development and may\n" | 572 "The following options are only used for VM development and may\n" |
573 "be changed in any future version:\n"); | 573 "be changed in any future version:\n"); |
574 const char* print_flags = "--print_flags"; | 574 const char* print_flags = "--print_flags"; |
575 Dart_SetVMFlags(1, &print_flags); | 575 Dart_SetVMFlags(1, &print_flags); |
576 } | 576 } |
577 } | 577 } |
578 | 578 |
579 | 579 |
580 static Dart_Handle SetBreakpoint(const char* breakpoint_at, | 580 static Dart_Handle SetBreakpoint(const char* breakpoint_at, |
581 Dart_Handle library) { | 581 Dart_Handle library) { |
582 Dart_Handle result; | 582 char* bpt_function = strdup(breakpoint_at); |
583 if (strchr(breakpoint_at, ':')) { | 583 Dart_Handle class_name; |
584 char* bpt_line = strdup(breakpoint_at); | 584 Dart_Handle function_name; |
585 char* colon = strchr(bpt_line, ':'); | 585 char* dot = strchr(bpt_function, '.'); |
586 ASSERT(colon != NULL); | 586 if (dot == NULL) { |
587 *colon = '\0'; | 587 class_name = DartUtils::NewString(""); |
588 Dart_Handle url = DartUtils::NewString(bpt_line); | 588 function_name = DartUtils::NewString(breakpoint_at); |
589 Dart_Handle line_number = Dart_NewInteger(atoi(colon + 1)); | |
590 free(bpt_line); | |
591 Dart_Breakpoint bpt; | |
592 result = Dart_SetBreakpointAtLine(url, line_number, &bpt); | |
593 } else { | 589 } else { |
594 char* bpt_function = strdup(breakpoint_at); | 590 *dot = '\0'; |
595 Dart_Handle class_name; | 591 class_name = DartUtils::NewString(bpt_function); |
596 Dart_Handle function_name; | 592 function_name = DartUtils::NewString(dot + 1); |
597 char* dot = strchr(bpt_function, '.'); | |
598 if (dot == NULL) { | |
599 class_name = DartUtils::NewString(""); | |
600 function_name = DartUtils::NewString(breakpoint_at); | |
601 } else { | |
602 *dot = '\0'; | |
603 class_name = DartUtils::NewString(bpt_function); | |
604 function_name = DartUtils::NewString(dot + 1); | |
605 } | |
606 free(bpt_function); | |
607 result = Dart_OneTimeBreakAtEntry(library, class_name, function_name); | |
608 } | 593 } |
609 return result; | 594 free(bpt_function); |
| 595 return Dart_OneTimeBreakAtEntry(library, class_name, function_name); |
610 } | 596 } |
611 | 597 |
612 | 598 |
613 char* BuildIsolateName(const char* script_name, | 599 char* BuildIsolateName(const char* script_name, |
614 const char* func_name) { | 600 const char* func_name) { |
615 // Skip past any slashes in the script name. | 601 // Skip past any slashes in the script name. |
616 const char* last_slash = strrchr(script_name, '/'); | 602 const char* last_slash = strrchr(script_name, '/'); |
617 if (last_slash != NULL) { | 603 if (last_slash != NULL) { |
618 script_name = last_slash + 1; | 604 script_name = last_slash + 1; |
619 } | 605 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 Dart_ShutdownIsolate(); | 840 Dart_ShutdownIsolate(); |
855 // Terminate process exit-code handler. | 841 // Terminate process exit-code handler. |
856 Process::TerminateExitCodeHandler(); | 842 Process::TerminateExitCodeHandler(); |
857 // Free copied argument strings if converted. | 843 // Free copied argument strings if converted. |
858 if (argv_converted) { | 844 if (argv_converted) { |
859 for (int i = 0; i < argc; i++) free(argv[i]); | 845 for (int i = 0; i < argc; i++) free(argv[i]); |
860 } | 846 } |
861 | 847 |
862 return Process::GlobalExitCode(); | 848 return Process::GlobalExitCode(); |
863 } | 849 } |
OLD | NEW |