[Lldb-commits] [lldb] 6fca189 - Simplify the breakpoint setting in DynamicLoaderMacOS::SetNotificationBreakpoint
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Sat Apr 24 14:05:03 PDT 2021
Author: Jason Molenda
Date: 2021-04-24T14:03:41-07:00
New Revision: 6fca189532511da1b48e8c0d9aad8ff2edca382d
URL: https://github.com/llvm/llvm-project/commit/6fca189532511da1b48e8c0d9aad8ff2edca382d
DIFF: https://github.com/llvm/llvm-project/commit/6fca189532511da1b48e8c0d9aad8ff2edca382d.diff
LOG: Simplify the breakpoint setting in DynamicLoaderMacOS::SetNotificationBreakpoint
Instead of looking up a symbol and reducing it to an addr_t to set
a breakpoint, set the breakpoint on the function name directly.
The old Mac OS X dynamic loader plugin worked in terms of addresses
and I incorrectly emulated that here when I wrote this newer one.
Differential Revision: https://reviews.llvm.org/D100931
Added:
Modified:
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index b86165a9ba9f..cad8a43d9252 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -343,29 +343,26 @@ void DynamicLoaderMacOS::PutToLog(Log *log) const {
bool DynamicLoaderMacOS::SetNotificationBreakpoint() {
if (m_break_id == LLDB_INVALID_BREAK_ID) {
- ConstString g_symbol_name("_dyld_debugger_notification");
- const Symbol *symbol = nullptr;
ModuleSP dyld_sp(GetDYLDModule());
if (dyld_sp) {
- symbol = dyld_sp->FindFirstSymbolWithNameAndType(g_symbol_name,
- eSymbolTypeCode);
- }
- if (symbol &&
- (symbol->ValueIsAddress() || symbol->GetAddressRef().IsValid())) {
- addr_t symbol_address =
- symbol->GetAddressRef().GetOpcodeLoadAddress(&m_process->GetTarget());
- if (symbol_address != LLDB_INVALID_ADDRESS) {
- bool internal = true;
- bool hardware = false;
- Breakpoint *breakpoint =
- m_process->GetTarget()
- .CreateBreakpoint(symbol_address, internal, hardware)
- .get();
- breakpoint->SetCallback(DynamicLoaderMacOS::NotifyBreakpointHit, this,
- true);
- breakpoint->SetBreakpointKind("shared-library-event");
- m_break_id = breakpoint->GetID();
- }
+ bool internal = true;
+ bool hardware = false;
+ LazyBool skip_prologue = eLazyBoolNo;
+ FileSpecList *source_files = nullptr;
+ FileSpecList dyld_filelist;
+ dyld_filelist.Append(dyld_sp->GetObjectFile()->GetFileSpec());
+
+ Breakpoint *breakpoint =
+ m_process->GetTarget()
+ .CreateBreakpoint(&dyld_filelist, source_files,
+ "_dyld_debugger_notification",
+ eFunctionNameTypeFull, eLanguageTypeC, 0,
+ skip_prologue, internal, hardware)
+ .get();
+ breakpoint->SetCallback(DynamicLoaderMacOS::NotifyBreakpointHit, this,
+ true);
+ breakpoint->SetBreakpointKind("shared-library-event");
+ m_break_id = breakpoint->GetID();
}
}
return m_break_id != LLDB_INVALID_BREAK_ID;
More information about the lldb-commits
mailing list