diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2014-08-19 17:40:43 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2014-08-19 17:40:43 +0000 |
commit | 5163792b7bcfeb3578c1b0b735ab7b6790e5b3dc (patch) | |
tree | 1be16b6cf00486701de821ceea2d8c6facb72231 /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 34ac9b5e25d3a00197ad30238d4e213f7811ebfe (diff) | |
download | bcm5719-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/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 5678ae40464..6536c6ef169 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -205,8 +205,25 @@ protected: const char *target_settings_argv0 = target->GetArg0(); - if (target->GetDisableASLR()) + // Determine whether we will disable ASLR or leave it in the default state (i.e. enabled if the platform supports it). + // First check if the process launch options explicitly turn on/off disabling ASLR. If so, use that setting; + // otherwise, use the 'settings target.disable-aslr' setting. + bool disable_aslr = false; + if (m_options.disable_aslr != eLazyBoolCalculate) + { + // The user specified an explicit setting on the process launch line. Use it. + disable_aslr = (m_options.disable_aslr == eLazyBoolYes); + } + else + { + // The user did not explicitly specify whether to disable ASLR. Fall back to the target.disable-aslr setting. + disable_aslr = target->GetDisableASLR (); + } + + if (disable_aslr) m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR); + else + m_options.launch_info.GetFlags().Clear (eLaunchFlagDisableASLR); if (target->GetDetachOnError()) m_options.launch_info.GetFlags().Set (eLaunchFlagDetachOnError); |