[Lldb-commits] [PATCH] when connecting to a running gdb process or launch one from them, set the process architecture before calling SetThreadStopInfo
Carlo Kok
ck at remobjects.com
Fri Oct 11 05:37:09 PDT 2013
The code in ProcessGDBRemote::SetThreadStopInfo depends on having a byte
order & architecture set, but when connecting to a remote GDB with no
arch/file loaded it doesn't have one yet and fails to set the register
info properly, making the callstacks and dyld code fail, with this patch
it becomes possible to use an empty target, connect and then load modules.
--
Carlo Kok
RemObjects Software
-------------- next part --------------
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index f7b5868..dd94133 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -564,6 +564,11 @@ ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url)
GetThreadList();
if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
{
+ if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
+ m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+ }
+
+
const StateType state = SetThreadStopInfo (m_last_stop_packet);
if (state == eStateStopped)
{
@@ -765,6 +770,10 @@ ProcessGDBRemote::DoLaunch (Module *exe_module, const ProcessLaunchInfo &launch_
if (m_gdb_comm.SendPacketAndWaitForResponse("?", 1, m_last_stop_packet, false))
{
+ if (!m_target.GetArchitecture().IsValid()) { // Make sure we have an architecture
+ m_target.SetArchitecture(m_gdb_comm.GetProcessArchitecture());
+ }
+
SetPrivateState (SetThreadStopInfo (m_last_stop_packet));
if (!disable_stdio)
More information about the lldb-commits
mailing list