[Lldb-commits] [lldb] 01e980e - [lldb] Use `Address` to setup breakpoint (#94794)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 6 15:26:21 PST 2025
Author: Julian Lettner
Date: 2025-01-06T15:26:18-08:00
New Revision: 01e980e792651391dfc3b399dbe300eddbbd0997
URL: https://github.com/llvm/llvm-project/commit/01e980e792651391dfc3b399dbe300eddbbd0997
DIFF: https://github.com/llvm/llvm-project/commit/01e980e792651391dfc3b399dbe300eddbbd0997.diff
LOG: [lldb] Use `Address` to setup breakpoint (#94794)
Use `Address` (instead of `addr_t`) to setup
breakpoint in `ReportRetriever::SetupBreakpoint`.
This is cleaner and the breakpoint should now
survive re-running of the binary.
rdar://124399066
Added:
Modified:
lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
index cd91f4a6ff1bc2..b1151febb7cc45 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/ASanLibsanitizers/InstrumentationRuntimeASanLibsanitizers.cpp
@@ -90,17 +90,9 @@ void InstrumentationRuntimeASanLibsanitizers::Activate() {
if (!process_sp)
return;
- lldb::ModuleSP module_sp = GetRuntimeModuleSP();
-
Breakpoint *breakpoint = ReportRetriever::SetupBreakpoint(
- module_sp, process_sp, ConstString("sanitizers_address_on_report"));
-
- if (!breakpoint) {
- breakpoint = ReportRetriever::SetupBreakpoint(
- module_sp, process_sp,
- ConstString("_Z22raise_sanitizers_error23sanitizer_error_context"));
- }
-
+ GetRuntimeModuleSP(), process_sp,
+ ConstString("sanitizers_address_on_report"));
if (!breakpoint)
return;
diff --git a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
index 04ce339d8f6610..74e0fa7d49f82d 100644
--- a/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
+++ b/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp
@@ -219,7 +219,6 @@ bool ReportRetriever::NotifyBreakpointHit(ProcessSP process_sp,
return true; // Return true to stop the target
}
-// FIXME: Setup the breakpoint using a less fragile SPI. rdar://124399066
Breakpoint *ReportRetriever::SetupBreakpoint(ModuleSP module_sp,
ProcessSP process_sp,
ConstString symbol_name) {
@@ -235,19 +234,13 @@ Breakpoint *ReportRetriever::SetupBreakpoint(ModuleSP module_sp,
if (!symbol->ValueIsAddress() || !symbol->GetAddressRef().IsValid())
return nullptr;
- Target &target = process_sp->GetTarget();
- addr_t symbol_address = symbol->GetAddressRef().GetOpcodeLoadAddress(&target);
-
- if (symbol_address == LLDB_INVALID_ADDRESS)
- return nullptr;
-
+ const Address &address = symbol->GetAddressRef();
const bool internal = true;
const bool hardware = false;
- Breakpoint *breakpoint =
- process_sp->GetTarget()
- .CreateBreakpoint(symbol_address, internal, hardware)
- .get();
+ Breakpoint *breakpoint = process_sp->GetTarget()
+ .CreateBreakpoint(address, internal, hardware)
+ .get();
return breakpoint;
}
More information about the lldb-commits
mailing list