summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-11-03 21:22:33 +0000
committerGreg Clayton <gclayton@apple.com>2011-11-03 21:22:33 +0000
commit982c9762a2fd81599f0826f4082b4c4fc5c6932f (patch)
treeaaa8ab0399fe89f1644c01905358b6c58d56910f /lldb/source/Plugins/Process
parent9f01a0db7dcd4d4a7877b6c9861b1fbf657af3c3 (diff)
downloadbcm5719-llvm-982c9762a2fd81599f0826f4082b4c4fc5c6932f.tar.gz
bcm5719-llvm-982c9762a2fd81599f0826f4082b4c4fc5c6932f.zip
Modified all Process::Launch() calls to use a ProcessLaunchInfo structure
on internal only (public API hasn't changed) to simplify the paramter list to the launch calls down into just one argument. Also all of the argument, envronment and stdio things are now handled in a much more centralized fashion. llvm-svn: 143656
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp10
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h10
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp59
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h10
4 files changed, 45 insertions, 44 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index d2d8dc6a1bd..df01e94cb14 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -230,14 +230,8 @@ ProcessKDP::DoConnectRemote (const char *remote_url)
// Process Control
//----------------------------------------------------------------------
Error
-ProcessKDP::DoLaunch (Module* module,
- char const *argv[],
- char const *envp[],
- uint32_t launch_flags,
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_dir)
+ProcessKDP::DoLaunch (Module *exe_module,
+ const ProcessLaunchInfo &launch_info)
{
Error error;
error.SetErrorString ("launching not supported in kdp-remote plug-in");
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
index 85ed7b3c73b..7ecd2fffef7 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
@@ -78,14 +78,8 @@ public:
WillLaunch (lldb_private::Module* module);
virtual lldb_private::Error
- DoLaunch (lldb_private::Module* module,
- char const *argv[], // Can be NULL
- char const *envp[], // Can be NULL
- uint32_t flags,
- const char *stdin_path, // Can be NULL
- const char *stdout_path, // Can be NULL
- const char *stderr_path, // Can be NULL
- const char *working_dir); // Can be NULL
+ DoLaunch (lldb_private::Module *exe_module,
+ const lldb_private::ProcessLaunchInfo &launch_info);
virtual lldb_private::Error
WillAttachToProcessWithID (lldb::pid_t pid);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 7f842c2ecc1..dbe81aea2ff 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -437,25 +437,42 @@ ProcessGDBRemote::WillLaunchOrAttach ()
// Process Control
//----------------------------------------------------------------------
Error
-ProcessGDBRemote::DoLaunch
-(
- Module* module,
- char const *argv[],
- char const *envp[],
- uint32_t launch_flags,
- const char *stdin_path,
- const char *stdout_path,
- const char *stderr_path,
- const char *working_dir
-)
+ProcessGDBRemote::DoLaunch (Module *exe_module, const ProcessLaunchInfo &launch_info)
{
Error error;
+
+ uint32_t launch_flags = launch_info.GetFlags().Get();
+ const char *stdin_path = NULL;
+ const char *stdout_path = NULL;
+ const char *stderr_path = NULL;
+ const char *working_dir = launch_info.GetWorkingDirectory();
+
+ const ProcessLaunchInfo::FileAction *file_action;
+ file_action = launch_info.GetFileActionForFD (STDIN_FILENO);
+ if (file_action)
+ {
+ if (file_action->GetAction () == ProcessLaunchInfo::FileAction::eFileActionOpen)
+ stdin_path = file_action->GetPath();
+ }
+ file_action = launch_info.GetFileActionForFD (STDOUT_FILENO);
+ if (file_action)
+ {
+ if (file_action->GetAction () == ProcessLaunchInfo::FileAction::eFileActionOpen)
+ stdout_path = file_action->GetPath();
+ }
+ file_action = launch_info.GetFileActionForFD (STDERR_FILENO);
+ if (file_action)
+ {
+ if (file_action->GetAction () == ProcessLaunchInfo::FileAction::eFileActionOpen)
+ stderr_path = file_action->GetPath();
+ }
+
// ::LogSetBitMask (GDBR_LOG_DEFAULT);
// ::LogSetOptions (LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD);
// ::LogSetLogFile ("/dev/stdout");
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
- ObjectFile * object_file = module->GetObjectFile();
+ ObjectFile * object_file = exe_module->GetObjectFile();
if (object_file)
{
char host_port[128];
@@ -537,18 +554,20 @@ ProcessGDBRemote::DoLaunch
}
// Send the environment and the program + arguments after we connect
- if (envp)
+ const Args &environment = launch_info.GetEnvironmentEntries();
+ if (environment.GetArgumentCount())
{
- const char *env_entry;
- for (int i=0; (env_entry = envp[i]); ++i)
+ size_t num_environment_entries = environment.GetArgumentCount();
+ for (size_t i=0; i<num_environment_entries; ++i)
{
- if (m_gdb_comm.SendEnvironmentPacket(env_entry) != 0)
+ const char *env_entry = environment.GetArgumentAtIndex(i);
+ if (env_entry == NULL || m_gdb_comm.SendEnvironmentPacket(env_entry) != 0)
break;
}
}
const uint32_t old_packet_timeout = m_gdb_comm.SetPacketTimeout (10);
- int arg_packet_err = m_gdb_comm.SendArgumentsPacket (argv);
+ int arg_packet_err = m_gdb_comm.SendArgumentsPacket (launch_info.GetArguments().GetConstArgumentVector());
if (arg_packet_err == 0)
{
std::string error_str;
@@ -597,9 +616,9 @@ ProcessGDBRemote::DoLaunch
{
// Set our user ID to an invalid process ID.
SetID(LLDB_INVALID_PROCESS_ID);
- error.SetErrorStringWithFormat("failed to get object file from '%s' for arch %s",
- module->GetFileSpec().GetFilename().AsCString(),
- module->GetArchitecture().GetArchitectureName());
+ error.SetErrorStringWithFormat ("failed to get object file from '%s' for arch %s",
+ exe_module->GetFileSpec().GetFilename().AsCString(),
+ exe_module->GetArchitecture().GetArchitectureName());
}
return error;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index ed3aeb80d94..be0f95a7dc9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -79,14 +79,8 @@ public:
WillLaunch (lldb_private::Module* module);
virtual lldb_private::Error
- DoLaunch (lldb_private::Module* module,
- char const *argv[], // Can be NULL
- char const *envp[], // Can be NULL
- uint32_t flags,
- const char *stdin_path, // Can be NULL
- const char *stdout_path, // Can be NULL
- const char *stderr_path, // Can be NULL
- const char *working_dir); // Can be NULL
+ DoLaunch (lldb_private::Module *exe_module,
+ const lldb_private::ProcessLaunchInfo &launch_info);
virtual void
DidLaunch ();
OpenPOWER on IntegriCloud