[Lldb-commits] [lldb] [lldb] Use `Address` to setup breakpoint (PR #94794)

Julian Lettner via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 12:53:54 PDT 2024


================
@@ -235,18 +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)
+          .CreateBreakpoint(address, internal, hardware)
----------------
yln wrote:

Cleanup suggested by @jimingham here: https://github.com/llvm/llvm-project/pull/84583#issuecomment-1986590436

> you could set it by Address, in which case it would survive re-running, but instead it converts the Address to an addr_t - the most fragile way to set a breakpoint

So we are using the `CreateBreakpoint` overload that takes `Address` instead of `addr_t` now and Jim mentioned that this survives re-running.  Are we concerned at all about this change in behavior?  For example, could we get into a situation where we keep adding superfluous breakpoints because the old ones survive?
@jimingham @usama54321 

https://github.com/llvm/llvm-project/pull/94794


More information about the lldb-commits mailing list