summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
authorMatt Kopec <Matt.Kopec@intel.com>2013-10-09 19:39:55 +0000
committerMatt Kopec <Matt.Kopec@intel.com>2013-10-09 19:39:55 +0000
commit718be877f88fa2fba5fb4f207d110177cf0d2eea (patch)
tree794968bbb4d1702c5c3a095e449259840a8afa3c /lldb/source/Plugins/Process
parentdc7c73c604e08bf165504fd4dd7d71d0a4eb32a6 (diff)
downloadbcm5719-llvm-718be877f88fa2fba5fb4f207d110177cf0d2eea.tar.gz
bcm5719-llvm-718be877f88fa2fba5fb4f207d110177cf0d2eea.zip
Add exec support for Linux including common support for POSIX.
llvm-svn: 192319
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp6
-rw-r--r--lldb/source/Plugins/Process/POSIX/POSIXThread.cpp10
-rw-r--r--lldb/source/Plugins/Process/POSIX/POSIXThread.h1
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessMessage.h8
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp39
-rw-r--r--lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h3
6 files changed, 62 insertions, 5 deletions
diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
index b69030b22a8..a0cda3485c6 100644
--- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
+++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
@@ -1487,8 +1487,10 @@ ProcessMonitor::MonitorSIGTRAP(ProcessMonitor *monitor,
}
case (SIGTRAP | (PTRACE_EVENT_EXEC << 8)):
- // Don't follow the child by default and resume
- monitor->Resume(pid, SIGCONT);
+ if (log)
+ log->Printf ("ProcessMonitor::%s() received exec event, code = %d", __FUNCTION__, info->si_code ^ SIGTRAP);
+
+ message = ProcessMessage::Exec(pid);
break;
case (SIGTRAP | (PTRACE_EVENT_EXIT << 8)):
diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
index 54d0fa50303..794fd71e0ff 100644
--- a/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
+++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
@@ -352,6 +352,10 @@ POSIXThread::Notify(const ProcessMessage &message)
case ProcessMessage::eNewThreadMessage:
ThreadNotify(message);
break;
+
+ case ProcessMessage::eExecMessage:
+ ExecNotify(message);
+ break;
}
}
@@ -574,6 +578,12 @@ POSIXThread::GetRegisterIndexFromOffset(unsigned offset)
return reg;
}
+void
+POSIXThread::ExecNotify(const ProcessMessage &message)
+{
+ SetStopInfo (StopInfo::CreateStopReasonWithExec(*this));
+}
+
const char *
POSIXThread::GetRegisterName(unsigned reg)
{
diff --git a/lldb/source/Plugins/Process/POSIX/POSIXThread.h b/lldb/source/Plugins/Process/POSIX/POSIXThread.h
index 66104c7332e..5490f1f1ea5 100644
--- a/lldb/source/Plugins/Process/POSIX/POSIXThread.h
+++ b/lldb/source/Plugins/Process/POSIX/POSIXThread.h
@@ -123,6 +123,7 @@ protected:
void CrashNotify(const ProcessMessage &message);
void ThreadNotify(const ProcessMessage &message);
void ExitNotify(const ProcessMessage &message);
+ void ExecNotify(const ProcessMessage &message);
lldb_private::Unwind *
GetUnwinder();
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessMessage.h b/lldb/source/Plugins/Process/POSIX/ProcessMessage.h
index 720c9e76939..40462d0f0e1 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessMessage.h
+++ b/lldb/source/Plugins/Process/POSIX/ProcessMessage.h
@@ -32,7 +32,8 @@ public:
eBreakpointMessage,
eWatchpointMessage,
eCrashMessage,
- eNewThreadMessage
+ eNewThreadMessage,
+ eExecMessage
};
enum CrashReason
@@ -133,6 +134,11 @@ public:
return ProcessMessage(tid, eExitMessage, status);
}
+ /// Indicates that the thread @p pid has exec'd.
+ static ProcessMessage Exec(lldb::tid_t tid) {
+ return ProcessMessage(tid, eExecMessage);
+ }
+
int GetExitStatus() const {
assert(GetKind() == eExitMessage || GetKind() == eLimboMessage);
return m_status;
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
index 5e6604458ad..b46c9375802 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp
@@ -353,6 +353,31 @@ ProcessPOSIX::DoDestroy()
}
void
+ProcessPOSIX::DoDidExec()
+{
+ Target *target = &GetTarget();
+ if (target)
+ {
+ PlatformSP platform_sp (target->GetPlatform());
+ assert (platform_sp.get());
+ if (platform_sp)
+ {
+ ProcessInstanceInfo process_info;
+ platform_sp->GetProcessInfo(GetID(), process_info);
+ ModuleSP exe_module_sp;
+ 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);
+ if (!error.Success())
+ return;
+ target->SetExecutableModule(exe_module_sp, true);
+ }
+ }
+}
+
+void
ProcessPOSIX::SendMessage(const ProcessMessage &message)
{
Mutex::Locker lock(m_message_mutex);
@@ -426,7 +451,7 @@ ProcessPOSIX::SendMessage(const ProcessMessage &message)
break;
case ProcessMessage::eNewThreadMessage:
- {
+ {
lldb::tid_t new_tid = message.GetChildTID();
if (WaitingForInitialStop(new_tid))
{
@@ -437,9 +462,19 @@ ProcessPOSIX::SendMessage(const ProcessMessage &message)
StopAllThreads(message.GetTID());
SetPrivateState(eStateStopped);
break;
- }
}
+ case ProcessMessage::eExecMessage:
+ {
+ assert(thread);
+ thread->SetState(eStateStopped);
+ StopAllThreads(message.GetTID());
+ SetPrivateState(eStateStopped);
+ break;
+ }
+ }
+
+
m_message_queue.push(message);
}
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h
index 080b089243e..790041be321 100644
--- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h
+++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h
@@ -79,6 +79,9 @@ public:
DoDestroy();
virtual void
+ DoDidExec();
+
+ virtual void
RefreshStateAfterStop();
virtual bool
OpenPOWER on IntegriCloud