[Lldb-commits] [PATCH] D100931: Set binaries-loaded/unloaded breakpoint on a name, not an address on macOS
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 21 00:42:55 PDT 2021
jasonmolenda created this revision.
jasonmolenda added a reviewer: jingham.
jasonmolenda added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jasonmolenda requested review of this revision.
I don't know what I was thinking when I wrote this; setting this on an addr_t just removes information that lldb could use to avoid unnecessary breakpoint setting evaluations when new libraries are loaded.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100931
Files:
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -344,28 +344,26 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100931.339129.patch
Type: text/x-patch
Size: 2345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210421/356a25ec/attachment.bin>
More information about the lldb-commits
mailing list