diff options
author | Jim Ingham <jingham@apple.com> | 2015-05-21 00:27:01 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2015-05-21 00:27:01 +0000 |
commit | 7ac5c86ba933fd02148e72c88b467b2313fdb8d3 (patch) | |
tree | 1b33dd85a1f11ca4d687364344de3de7253085f3 /lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | |
parent | 07b5899367e6aa29735c3487ea4966c105b36413 (diff) | |
download | bcm5719-llvm-7ac5c86ba933fd02148e72c88b467b2313fdb8d3.tar.gz bcm5719-llvm-7ac5c86ba933fd02148e72c88b467b2313fdb8d3.zip |
Fix the logic in DynamicLoaderMacOSXDYLD::Clear that would only remove the old dyld notification
breakpoint only if the process it was for is still alive. We need to always remove this because
it has a pointer to the old loader, and if we ever hit it we will crash. I also put in a sanity
check in the callback function to make sure we don't invoke it if the process is wrong.
<rdar://problem/21006189>
llvm-svn: 237866
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp')
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 711099122b5..80fe2531845 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -242,7 +242,7 @@ DynamicLoaderMacOSXDYLD::Clear (bool clear_process) { Mutex::Locker locker(m_mutex); - if (m_process->IsAlive() && LLDB_BREAK_ID_IS_VALID(m_break_id)) + if (LLDB_BREAK_ID_IS_VALID(m_break_id)) m_process->GetTarget().RemoveBreakpointByID (m_break_id); if (clear_process) @@ -607,11 +607,16 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpointHit (void *baton, // will do so and return true. In the course of initializing the all_image_infos it will read the complete // current state, so we don't need to figure out what has changed from the data passed in to us. + ExecutionContext exe_ctx (context->exe_ctx_ref); + Process *process = exe_ctx.GetProcessPtr(); + + // This is a sanity check just in case this dyld_instance is an old dyld plugin's breakpoint still lying around. + if (process != dyld_instance->m_process) + return false; + if (dyld_instance->InitializeFromAllImageInfos()) return dyld_instance->GetStopWhenImagesChange(); - ExecutionContext exe_ctx (context->exe_ctx_ref); - Process *process = exe_ctx.GetProcessPtr(); const lldb::ABISP &abi = process->GetABI(); if (abi) { |