summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/POSIX
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@intel.com>2013-01-08 14:49:22 +0000
committerDaniel Malea <daniel.malea@intel.com>2013-01-08 14:49:22 +0000
commit6217d2ae379b2c6b64bf558321eca40bf1368be4 (patch)
treee3fc2ed988becd900645745e4feb83936346e8ca /lldb/source/Plugins/Process/POSIX
parent7daa1a22014c9b5a400dba5e6cfb0ff7cc94b443 (diff)
downloadbcm5719-llvm-6217d2ae379b2c6b64bf558321eca40bf1368be4.tar.gz
bcm5719-llvm-6217d2ae379b2c6b64bf558321eca40bf1368be4.zip
Implement -w flag to process launch (allow launching inferior process in different working directory) on Linux/FreeBSD
- fixes test case TestProcessLaunch llvm-svn: 171854
Diffstat (limited to 'lldb/source/Plugins/Process/POSIX')
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
index f6b9270a366..a69486559b8 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
@@ -17,6 +17,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
+#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/DynamicLoader.h"
@@ -162,6 +163,16 @@ ProcessPOSIX::DoLaunch (Module *module,
Error error;
assert(m_monitor == NULL);
+ const char* working_dir = launch_info.GetWorkingDirectory();
+ if (working_dir) {
+ FileSpec WorkingDir(working_dir, true);
+ if (!WorkingDir || WorkingDir.GetFileType() != FileSpec::eFileTypeDirectory)
+ {
+ error.SetErrorStringWithFormat("No such file or directory: %s", working_dir);
+ return error;
+ }
+ }
+
SetPrivateState(eStateLaunching);
const lldb_private::ProcessLaunchInfo::FileAction *file_action;
@@ -170,7 +181,7 @@ ProcessPOSIX::DoLaunch (Module *module,
const char *stdin_path = NULL;
const char *stdout_path = NULL;
const char *stderr_path = NULL;
-
+
file_action = launch_info.GetFileActionForFD (STDIN_FILENO);
stdin_path = GetFilePath(file_action, stdin_path);
@@ -187,6 +198,7 @@ ProcessPOSIX::DoLaunch (Module *module,
stdin_path,
stdout_path,
stderr_path,
+ working_dir,
error);
m_module = module;
OpenPOWER on IntegriCloud