Index: runtime/bin/main.cc |
=================================================================== |
--- runtime/bin/main.cc (revision 23778) |
+++ runtime/bin/main.cc (working copy) |
@@ -112,6 +112,9 @@ |
static bool ProcessBreakpointOption(const char* funcname) { |
ASSERT(funcname != NULL); |
+ if (*funcname == '\0') { |
+ return false; |
+ } |
breakpoint_at = funcname; |
return true; |
} |
@@ -119,6 +122,9 @@ |
static bool ProcessPackageRootOption(const char* arg) { |
ASSERT(arg != NULL); |
+ if (*arg == '\0' || *arg == '-') { |
+ return false; |
+ } |
package_root = arg; |
return true; |
} |
@@ -197,6 +203,9 @@ |
static bool ProcessVmStatsRootOption(const char* arg) { |
ASSERT(arg != NULL); |
+ if (*arg == '\0') { |
+ return false; |
+ } |
vmstats_root = arg; |
return true; |
} |
@@ -217,8 +226,9 @@ |
return false; |
} |
generate_script_snapshot = true; |
+ return true; |
} |
- return true; |
+ return false; |
} |
@@ -233,12 +243,11 @@ |
{ "--verbose", ProcessVerboseOption }, |
{ "-v", ProcessVerboseOption }, |
{ "--package-root=", ProcessPackageRootOption }, |
- { "-p", ProcessPackageRootOption }, |
// VM specific options to the standalone dart program. |
- { "--break_at=", ProcessBreakpointOption }, |
+ { "--break-at=", ProcessBreakpointOption }, |
{ "--compile_all", ProcessCompileAllOption }, |
{ "--debug", ProcessDebugOption }, |
- { "--generate-script-snapshot=", ProcessGenScriptSnapshotOption }, |
+ { "--snapshot=", ProcessGenScriptSnapshotOption }, |
{ "--stats-root=", ProcessVmStatsRootOption }, |
{ "--stats", ProcessVmStatsOption }, |
{ "--print-script", ProcessPrintScriptOption }, |
@@ -250,10 +259,14 @@ |
static bool ProcessMainOptions(const char* option) { |
int i = 0; |
const char* name = main_options[0].option_name; |
+ int option_length = strlen(option); |
while (name != NULL) { |
int length = strlen(name); |
- if (strncmp(option, name, length) == 0) { |
- return main_options[i].process(option + length); |
+ if ((option_length >= length) && (strncmp(option, name, length) == 0)) { |
+ if (!main_options[i].process(option + length)) { |
+ Log::PrintErr("Invalid option specification : '%s'\n", option); |
+ } |
+ return true; |
} |
i += 1; |
name = main_options[i].option_name; |
@@ -305,7 +318,20 @@ |
i++; |
} else { |
// Check if this flag is a potentially valid VM flag. |
- if (!IsValidFlag(argv[i], kPrefix, kPrefixLen)) { |
+ const char* kChecked = "-c"; |
+ const char* kPackageRoot = "-p"; |
+ if (strncmp(argv[i], kPackageRoot, strlen(kPackageRoot)) == 0) { |
+ if (!ProcessPackageRootOption(argv[i] + strlen(kPackageRoot))) { |
+ i++; |
+ if (!ProcessPackageRootOption(argv[i])) { |
+ Log::PrintErr("Invalid option specification : '%s'\n", argv[i - 1]); |
+ i++; |
+ break; |
+ } |
+ } |
+ } else if (strncmp(argv[i], kChecked, strlen(kChecked)) == 0) { |
+ vm_options->AddArgument("--checked"); |
+ } else if (!IsValidFlag(argv[i], kPrefix, kPrefixLen)) { |
break; |
} |
const char* kPrintFlags1 = "--print-flags"; |
@@ -539,12 +565,12 @@ |
" enables debugging and listens on specified port for debugger connections\n" |
" (default port number is 5858)\n" |
"\n" |
-"--break_at=<location>\n" |
+"--break-at=<location>\n" |
" sets a breakpoint at specified location where <location> is one of :\n" |
" url:<line_num> e.g. test.dart:10\n" |
" [<class_name>.]<function_name> e.g. B.foo\n" |
"\n" |
-"--generate-script-snapshot=<file_name>\n" |
+"--snapshot=<file_name>\n" |
" loads Dart script and generates a snapshot in the specified file\n" |
"\n" |
"--print-script\n" |