summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-05-21 21:55:59 +0000
committerGreg Clayton <gclayton@apple.com>2013-05-21 21:55:59 +0000
commit8cda7f083069d4cc1c8e5c8e658bbdbac0eea249 (patch)
treeea5530993e794203cb173e87ed617ab1651acde1 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent4df05caadbbf588406f99ef74342db49a647c1e2 (diff)
downloadbcm5719-llvm-8cda7f083069d4cc1c8e5c8e658bbdbac0eea249.tar.gz
bcm5719-llvm-8cda7f083069d4cc1c8e5c8e658bbdbac0eea249.zip
Added a test case that verifies that LLDB can debug across a process exec'ing itself into a new program. This currently is only enabled for Darwin since we exec from 64 bit to 32 bit and vice versa for 'x86_64' targets.
This can easily be adapted for linux and other platforms, but I didn't want to break any buildbots by assuming it will work. llvm-svn: 182428
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index ce1fd8dcae1..fb539b1ea37 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1005,15 +1005,6 @@ ProcessGDBRemote::DidAttach ()
DidLaunchOrAttach ();
}
-void
-ProcessGDBRemote::DoDidExec ()
-{
- // The process exec'ed itself, figure out the dynamic loader, etc...
- BuildDynamicRegisterInfo (true);
- m_gdb_comm.ResetDiscoverableSettings();
-}
-
-
Error
ProcessGDBRemote::WillResume ()
@@ -1354,15 +1345,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
// register info before we lookup and threads and populate the expedited
// register values so we need to know this right away so we can cleanup
// and update our registers.
- const bool did_exec = stop_packet.GetStringRef().find(";reason:exec;") != std::string::npos;
-
- if (did_exec)
- {
- m_thread_list_real.Clear();
- m_thread_list.Clear();
- }
-
- if (GetStopID() == 0 || did_exec)
+ const uint32_t stop_id = GetStopID();
+ if (stop_id == 0)
{
// Our first stop, make sure we have a process ID, and also make
// sure we know about our registers
@@ -1519,6 +1503,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
else
{
bool handled = false;
+ bool did_exec = false;
if (!reason.empty())
{
if (reason.compare("trace") == 0)
@@ -1566,6 +1551,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
}
else if (reason.compare("exec") == 0)
{
+ did_exec = true;
thread_sp->SetStopInfo (StopInfo::CreateStopReasonWithExec(*thread_sp));
handled = true;
}
@@ -1898,6 +1884,26 @@ ProcessGDBRemote::DoDestroy ()
return error;
}
+void
+ProcessGDBRemote::SetLastStopPacket (const StringExtractorGDBRemote &response)
+{
+ lldb_private::Mutex::Locker locker (m_last_stop_packet_mutex);
+ const bool did_exec = response.GetStringRef().find(";reason:exec;") != std::string::npos;
+ if (did_exec)
+ {
+ Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+ if (log)
+ log->Printf ("ProcessGDBRemote::SetLastStopPacket () - detected exec");
+
+ m_thread_list_real.Clear();
+ m_thread_list.Clear();
+ BuildDynamicRegisterInfo (true);
+ m_gdb_comm.ResetDiscoverableSettings();
+ }
+ m_last_stop_packet = response;
+}
+
+
//------------------------------------------------------------------
// Process Queries
//------------------------------------------------------------------
OpenPOWER on IntegriCloud