summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-09-14 01:01:48 +0000
committerJim Ingham <jingham@apple.com>2011-09-14 01:01:48 +0000
commit91991efcdc439967ca30d81d82fe21232bd929a9 (patch)
tree65d9eb8553a337ed09a89ccdeb27d9e8e24eaee8 /lldb/source/Target/Process.cpp
parent2dadd3ebeed948d24f0ca142afb404a1faa2eb0a (diff)
downloadbcm5719-llvm-91991efcdc439967ca30d81d82fe21232bd929a9.tar.gz
bcm5719-llvm-91991efcdc439967ca30d81d82fe21232bd929a9.zip
If we haven't gotten the architecture of the process we're attaching
to by the time we get to the AttachCompletionHandler, do it before completing the attach. llvm-svn: 139679
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