aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp')
-rw-r--r--source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp47
1 files changed, 32 insertions, 15 deletions
diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index 4a8ad38d1785..1ff0ec2c7937 100644
--- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -12,7 +12,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/State.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
@@ -21,6 +20,7 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
#include "DynamicLoaderDarwin.h"
#include "DynamicLoaderMacOS.h"
@@ -55,6 +55,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process,
case llvm::Triple::IOS:
case llvm::Triple::TvOS:
case llvm::Triple::WatchOS:
+ // NEED_BRIDGEOS_TRIPLE case llvm::Triple::BridgeOS:
create = triple_ref.getVendor() == llvm::Triple::Apple;
break;
default:
@@ -64,7 +65,7 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process,
}
}
- if (UseDYLDSPI(process) == false) {
+ if (!UseDYLDSPI(process)) {
create = false;
}
@@ -78,7 +79,8 @@ DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process,
//----------------------------------------------------------------------
DynamicLoaderMacOS::DynamicLoaderMacOS(Process *process)
: DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
- m_break_id(LLDB_INVALID_BREAK_ID), m_mutex() {}
+ m_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
+ m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
//----------------------------------------------------------------------
// Destructor
@@ -94,16 +96,31 @@ bool DynamicLoaderMacOS::ProcessDidExec() {
if (m_process) {
// If we are stopped after an exec, we will have only one thread...
if (m_process->GetThreadList().GetSize() == 1) {
- // See if we are stopped at '_dyld_start'
- ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
- if (thread_sp) {
- lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
- if (frame_sp) {
- const Symbol *symbol =
- frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
- if (symbol) {
- if (symbol->GetName() == ConstString("_dyld_start"))
- did_exec = true;
+ // Maybe we still have an image infos address around? If so see
+ // if that has changed, and if so we have exec'ed.
+ if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+ lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
+ if (image_infos_address != m_maybe_image_infos_address) {
+ // We don't really have to reset this here, since we are going to
+ // call DoInitialImageFetch right away to handle the exec. But in
+ // case anybody looks at it in the meantime, it can't hurt.
+ m_maybe_image_infos_address = image_infos_address;
+ did_exec = true;
+ }
+ }
+
+ if (!did_exec) {
+ // See if we are stopped at '_dyld_start'
+ ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
+ if (thread_sp) {
+ lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
+ if (frame_sp) {
+ const Symbol *symbol =
+ frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
+ if (symbol) {
+ if (symbol->GetName() == ConstString("_dyld_start"))
+ did_exec = true;
+ }
}
}
}
@@ -179,6 +196,7 @@ void DynamicLoaderMacOS::DoInitialImageFetch() {
}
m_dyld_image_infos_stop_id = m_process->GetStopID();
+ m_maybe_image_infos_address = m_process->GetImageInfoAddress();
}
bool DynamicLoaderMacOS::NeedToDoInitialImageFetch() { return true; }
@@ -485,8 +503,7 @@ bool DynamicLoaderMacOS::GetSharedCacheInformation(
info_dict->GetValueForKey("shared_cache_uuid")->GetStringValue();
if (!uuid_str.empty())
uuid.SetFromStringRef(uuid_str);
- if (info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue() ==
- false)
+ if (!info_dict->GetValueForKey("no_shared_cache")->GetBooleanValue())
using_shared_cache = eLazyBoolYes;
else
using_shared_cache = eLazyBoolNo;