[Lldb-commits] [lldb] r197857 - Any time ProcessGDBRemote tries to get the remote's ProcessArchitecture,

Jason Molenda jmolenda at apple.com
Fri Dec 20 21:20:36 PST 2013


Author: jmolenda
Date: Fri Dec 20 23:20:36 2013
New Revision: 197857

URL: http://llvm.org/viewvc/llvm-project?rev=197857&view=rev
Log:
Any time ProcessGDBRemote tries to get the remote's ProcessArchitecture,
it needs to fall back to using the HostArchitecture if a valid one is not
returned.  When doing low-level system debugging we may not have a process
(or the remote stub may not support the qProcessInfo packet) in which case
we should fall back to the architecture we determined via qHostInfo.
<rdar://problem/15713180> 

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=197857&r1=197856&r2=197857&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Dec 20 23:20:36 2013
@@ -619,11 +619,18 @@ ProcessGDBRemote::DoConnectRemote (Strea
         GetThreadList();
         if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false) == GDBRemoteCommunication::PacketResult::Success)
         {
-            if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
-               m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+            if (!m_target.GetArchitecture().IsValid()) 
+            {
+                if (m_gdb_comm.GetProcessArchitecture().IsValid())
+                {
+                    m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+                }
+                else
+                {
+                    m_target.SetArchitecture(m_gdb_comm.GetHostArchitecture());
+                }
             }
 
-
             const StateType state = SetThreadStopInfo (m_last_stop_packet);
             if (state == eStateStopped)
             {
@@ -809,8 +816,16 @@ ProcessGDBRemote::DoLaunch (Module *exe_
 
             if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false) == GDBRemoteCommunication::PacketResult::Success)
             {
-                if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
-                   m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+                if (!m_target.GetArchitecture().IsValid()) 
+                {
+                    if (m_gdb_comm.GetProcessArchitecture().IsValid())
+                    {
+                        m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+                    }
+                    else
+                    {
+                        m_target.SetArchitecture(m_gdb_comm.GetHostArchitecture());
+                    }
                 }
 
                 SetPrivateState (SetThreadStopInfo (m_last_stop_packet));





More information about the lldb-commits mailing list