summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 52fd8578a46..5da9a9fc603 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2167,6 +2167,25 @@ Process::AttachCompletionHandler::PerformAction (lldb::EventSP &event_sp)
// lldb_private::Process subclasses must set the process must set
// the new process ID.
assert (m_process->GetID() != LLDB_INVALID_PROCESS_ID);
+ // We just attached, if we haven't gotten a valid architecture at this point we should do so now.
+ Target &target = m_process->GetTarget();
+ if (!target.GetArchitecture().IsValid())
+ {
+ // FIXME: We shouldn't be getting the Selected Platform, there should
+ // be a platform for the target, and we should get that.
+ PlatformSP platform_sp (target.GetDebugger().GetPlatformList().GetSelectedPlatform ());
+ if (platform_sp)
+ {
+ ProcessInstanceInfo process_info;
+ platform_sp->GetProcessInfo (m_process->GetID(), process_info);
+ const ArchSpec &process_arch = process_info.GetArchitecture();
+ if (process_arch.IsValid())
+ {
+ // Set the architecture on the target.
+ target.SetArchitecture (process_arch);
+ }
+ }
+ }
m_process->CompleteAttach ();
return eEventActionSuccess;
}
OpenPOWER on IntegriCloud