summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-12-03 18:46:09 +0000
committerCaroline Tice <ctice@apple.com>2010-12-03 18:46:09 +0000
commitf8da863196a173ed90c627e468d42381bf48675d (patch)
tree34388cc707538d81088cb19416da67689f3db8f3 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent6423c29e14fbde59ecee91d542f0cc3cab43b63a (diff)
downloadbcm5719-llvm-f8da863196a173ed90c627e468d42381bf48675d.tar.gz
bcm5719-llvm-f8da863196a173ed90c627e468d42381bf48675d.zip
Add '-no-stdio' option to 'process launch' command, which causes the
inferior to be launched without setting up terminal stdin/stdout for it (leaving the lldb command line accessible while the program is executing). Also add a user settings variable, 'target.process.disable-stdio' to allow the user to set this globally rather than having to use the command option each time the process is launched. llvm-svn: 120825
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 083ef95a1f6..4cc5382dca9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -404,7 +404,7 @@ ProcessGDBRemote::DoLaunch
launch_process,
LLDB_INVALID_PROCESS_ID,
NULL, false,
- (launch_flags & eLaunchFlagDisableASLR) != 0,
+ launch_flags,
inferior_arch);
if (error.Fail())
return error;
@@ -424,7 +424,7 @@ ProcessGDBRemote::DoLaunch
launch_process,
LLDB_INVALID_PROCESS_ID,
NULL, false,
- (launch_flags & eLaunchFlagDisableASLR) != 0,
+ launch_flags,
inferior_arch);
if (error.Fail())
return error;
@@ -647,7 +647,7 @@ ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid)
LLDB_INVALID_PROCESS_ID, // Don't send any attach to pid options to debugserver
NULL, // Don't send any attach by process name option to debugserver
false, // Don't send any attach wait_for_launch flag as an option to debugserver
- false, // disable_aslr
+ 0, // launch_flags
arch_spec);
if (error.Fail())
@@ -749,7 +749,7 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait
LLDB_INVALID_PROCESS_ID, // Don't send any attach to pid options to debugserver
NULL, // Don't send any attach by process name option to debugserver
false, // Don't send any attach wait_for_launch flag as an option to debugserver
- false, // disable_aslr
+ 0, // launch_flags
arch_spec);
if (error.Fail())
{
@@ -1659,11 +1659,13 @@ ProcessGDBRemote::StartDebugserverProcess
lldb::pid_t attach_pid, // If inferior inferior_argv == NULL, and attach_pid != LLDB_INVALID_PROCESS_ID send this pid as an argument to debugserver
const char *attach_name, // Wait for the next process to launch whose basename matches "attach_name"
bool wait_for_launch, // Wait for the process named "attach_name" to launch
- bool disable_aslr, // Disable ASLR
+ uint32_t launch_flags, // Launch flags
ArchSpec& inferior_arch // The arch of the inferior that we will launch
)
{
Error error;
+ bool disable_aslr = (launch_flags & eLaunchFlagDisableASLR) != 0;
+ bool no_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0;
if (m_debugserver_pid == LLDB_INVALID_PROCESS_ID)
{
// If we locate debugserver, keep that located version around
@@ -1744,7 +1746,7 @@ ProcessGDBRemote::StartDebugserverProcess
char arg_cstr[PATH_MAX];
lldb_utility::PseudoTerminal pty;
- if (launch_process && stdio_path == NULL && m_local_debugserver)
+ if (launch_process && stdio_path == NULL && m_local_debugserver && !no_stdio)
{
if (pty.OpenFirstAvailableMaster(O_RDWR|O_NOCTTY, NULL, 0))
stdio_path = pty.GetSlaveName (NULL, 0);
@@ -1768,6 +1770,10 @@ ProcessGDBRemote::StartDebugserverProcess
debugserver_args.AppendArgument("--stdio-path");
debugserver_args.AppendArgument(stdio_path);
}
+ else if (launch_process && no_stdio)
+ {
+ debugserver_args.AppendArgument("--no-stdio");
+ }
const char *env_debugserver_log_file = getenv("LLDB_DEBUGSERVER_LOG_FILE");
if (env_debugserver_log_file)
@@ -1859,7 +1865,7 @@ ProcessGDBRemote::StartDebugserverProcess
if (error.Fail() || log)
error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
- if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID)
+ if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID && !no_stdio)
{
if (pty.GetMasterFileDescriptor() != lldb_utility::PseudoTerminal::invalid_fd)
SetUpProcessInputReader (pty.ReleaseMasterFileDescriptor());
OpenPOWER on IntegriCloud