From 17fce286834344a5379288b68068224af74d51f0 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Mon, 16 Oct 2023 10:13:47 +0000 Subject: [PATCH] [lldb][DYLD][NFC] Dedupe calls to CreateBreakpoint These only differ in the modules passed to them. Also I've swapped the if order so we have the "positive" check first. --- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 85d7ae9dac75..c427b476089e 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -337,29 +337,20 @@ bool DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint() { }; ModuleSP interpreter = LoadInterpreterModule(); - if (!interpreter) { - FileSpecList containingModules; + FileSpecList containingModules; + if (interpreter) + containingModules.Append(interpreter->GetFileSpec()); + else containingModules.Append( m_process->GetTarget().GetExecutableModulePointer()->GetFileSpec()); - dyld_break = target.CreateBreakpoint( - &containingModules, /*containingSourceFiles=*/nullptr, - DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC, - /*m_offset=*/0, - /*skip_prologue=*/eLazyBoolNo, - /*internal=*/true, - /*request_hardware=*/false); - } else { - FileSpecList containingModules; - containingModules.Append(interpreter->GetFileSpec()); - dyld_break = target.CreateBreakpoint( - &containingModules, /*containingSourceFiles=*/nullptr, - DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC, - /*m_offset=*/0, - /*skip_prologue=*/eLazyBoolNo, - /*internal=*/true, - /*request_hardware=*/false); - } + dyld_break = target.CreateBreakpoint( + &containingModules, /*containingSourceFiles=*/nullptr, + DebugStateCandidates, eFunctionNameTypeFull, eLanguageTypeC, + /*m_offset=*/0, + /*skip_prologue=*/eLazyBoolNo, + /*internal=*/true, + /*request_hardware=*/false); } if (dyld_break->GetNumResolvedLocations() != 1) {