summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2014-08-19 17:40:43 +0000
committerTodd Fiala <todd.fiala@gmail.com>2014-08-19 17:40:43 +0000
commit5163792b7bcfeb3578c1b0b735ab7b6790e5b3dc (patch)
tree1be16b6cf00486701de821ceea2d8c6facb72231 /lldb/source/Target/Process.cpp
parent34ac9b5e25d3a00197ad30238d4e213f7811ebfe (diff)
downloadbcm5719-llvm-5163792b7bcfeb3578c1b0b735ab7b6790e5b3dc.tar.gz
bcm5719-llvm-5163792b7bcfeb3578c1b0b735ab7b6790e5b3dc.zip
Adjust process launch --disable-aslr to take true/false value.
This change modifies the 'process launch' --disable-aslr option to take a boolean argument. If the user directly specifies --disable-aslr {true,false}, that setting will control whether the process is launched with ASLR disabled accordingly. In the event that the setting is not explicitly made on the process launch command line, then the value is retrieved from the target.disable-aslr setting (i.e. settings show target.disable-aslr). llvm-svn: 215996
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 3d44b240735..4092aa7f80b 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -454,11 +454,18 @@ ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *op
launch_info.GetArchitecture().SetTriple (option_arg);
break;
- case 'A':
- launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
+ case 'A': // Disable ASLR.
+ {
+ bool success;
+ const bool disable_aslr_arg = Args::StringToBoolean (option_arg, true, &success);
+ if (success)
+ disable_aslr = disable_aslr_arg ? eLazyBoolYes : eLazyBoolNo;
+ else
+ error.SetErrorStringWithFormat ("Invalid boolean value for disable-aslr option: '%s'", option_arg ? option_arg : "<null>");
break;
-
- case 'c':
+ }
+
+ case 'c':
if (option_arg && option_arg[0])
launch_info.SetShell (option_arg);
else
@@ -480,7 +487,7 @@ OptionDefinition
ProcessLaunchCommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "stop-at-entry", 's', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Stop at the entry point of the program when launching a process."},
-{ LLDB_OPT_SET_ALL, false, "disable-aslr", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Disable address space layout randomization when launching a process."},
+{ LLDB_OPT_SET_ALL, false, "disable-aslr", 'A', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Set whether to disable address space layout randomization when launching a process."},
{ LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
{ LLDB_OPT_SET_ALL, false, "working-dir", 'w', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."},
{ LLDB_OPT_SET_ALL, false, "arch", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeArchitecture, "Set the architecture for the process to launch when ambiguous."},
OpenPOWER on IntegriCloud