diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index f340631..0e5ab5a 100644 --- a/contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/contrib/llvm/tools/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -16,6 +16,7 @@ // Other libraries and framework includes #include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/State.h" #include "lldb/Host/FileSpec.h" @@ -28,7 +29,7 @@ #include "ProcessPOSIX.h" #include "ProcessPOSIXLog.h" #include "Plugins/Process/Utility/InferiorCallPOSIX.h" -#include "ProcessMonitor.h" +#include "Plugins/Process/Linux/ProcessMonitor.h" #include "POSIXThread.h" using namespace lldb; @@ -140,8 +141,8 @@ ProcessPOSIX::DoAttachToProcessWithID(lldb::pid_t pid) // Resolve the executable module ModuleSP exe_module_sp; FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths()); - error = platform_sp->ResolveExecutable(process_info.GetExecutableFile(), - m_target.GetArchitecture(), + ModuleSpec exe_module_spec(process_info.GetExecutableFile(), m_target.GetArchitecture()); + error = platform_sp->ResolveExecutable(exe_module_spec, exe_module_sp, executable_search_paths.GetSize() ? &executable_search_paths : NULL); if (!error.Success()) @@ -176,9 +177,9 @@ ProcessPOSIX::WillLaunch(Module* module) } const char * -ProcessPOSIX::GetFilePath(const lldb_private::FileAction *file_action, const char *default_path) +ProcessPOSIX::GetFilePath(const lldb_private::FileAction *file_action, const char *default_path, + const char *dbg_pts_path) { - const char *pts_name = "/dev/pts/"; const char *path = NULL; if (file_action) @@ -190,11 +191,11 @@ ProcessPOSIX::GetFilePath(const lldb_private::FileAction *file_action, const cha // (/dev/pts). If so, convert to using a different default path // instead to redirect I/O to the debugger console. This should // also handle user overrides to /dev/null or a different file. - if (!path || ::strncmp(path, pts_name, ::strlen(pts_name)) == 0) + if (!path || (dbg_pts_path && + ::strncmp(path, dbg_pts_path, ::strlen(dbg_pts_path)) == 0)) path = default_path; } } - return path; } @@ -224,14 +225,16 @@ ProcessPOSIX::DoLaunch (Module *module, const char *stdout_path = NULL; const char *stderr_path = NULL; + const char * dbg_pts_path = launch_info.GetPTY().GetSlaveName(NULL,0); + file_action = launch_info.GetFileActionForFD (STDIN_FILENO); - stdin_path = GetFilePath(file_action, stdin_path); + stdin_path = GetFilePath(file_action, stdin_path, dbg_pts_path); file_action = launch_info.GetFileActionForFD (STDOUT_FILENO); - stdout_path = GetFilePath(file_action, stdout_path); + stdout_path = GetFilePath(file_action, stdout_path, dbg_pts_path); file_action = launch_info.GetFileActionForFD (STDERR_FILENO); - stderr_path = GetFilePath(file_action, stderr_path); + stderr_path = GetFilePath(file_action, stderr_path, dbg_pts_path); m_monitor = new ProcessMonitor (this, module, @@ -338,6 +341,11 @@ ProcessPOSIX::DoDestroy() { assert(m_monitor); m_exit_now = true; + if (GetID() == LLDB_INVALID_PROCESS_ID) + { + error.SetErrorString("invalid process id"); + return error; + } if (!m_monitor->Kill()) { error.SetErrorToErrno(); @@ -363,11 +371,11 @@ ProcessPOSIX::DoDidExec() ProcessInstanceInfo process_info; platform_sp->GetProcessInfo(GetID(), process_info); ModuleSP exe_module_sp; + ModuleSpec exe_module_spec(process_info.GetExecutableFile(), target->GetArchitecture()); FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths()); - Error error = platform_sp->ResolveExecutable(process_info.GetExecutableFile(), - target->GetArchitecture(), - exe_module_sp, - executable_search_paths.GetSize() ? &executable_search_paths : NULL); + Error error = platform_sp->ResolveExecutable(exe_module_spec, + exe_module_sp, + executable_search_paths.GetSize() ? &executable_search_paths : NULL); if (!error.Success()) return; target->SetExecutableModule(exe_module_sp, true); @@ -432,8 +440,7 @@ ProcessPOSIX::SendMessage(const ProcessMessage &message) // FIXME: I'm not sure we need to do this. if (message.GetTID() == GetID()) { - m_exit_status = message.GetExitStatus(); - SetExitStatus(m_exit_status, NULL); + SetExitStatus(message.GetExitStatus(), NULL); } else if (!IsAThreadRunning()) SetPrivateState(eStateStopped); |