[Lldb-commits] [lldb] [lldb] Use Expected in BreakpointLocationPredictor (PR #197730)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri May 15 00:11:08 PDT 2026


================
@@ -613,53 +614,49 @@ bool EmulateInstruction::CreateFunctionEntryUnwind(UnwindPlan &unwind_plan) {
   return false;
 }
 
-BreakpointLocations
-SingleStepBreakpointLocationsPredictor::GetBreakpointLocations(Status &status) {
+llvm::Expected<BreakpointLocations>
+SingleStepBreakpointLocationsPredictor::GetBreakpointLocations() {
   if (!m_emulator_up->ReadInstruction()) {
     // try to get at least the size of next instruction to set breakpoint.
-    lldb::addr_t next_pc = GetNextInstructionAddress(status);
-    return BreakpointLocations{next_pc};
+    llvm::Expected<addr_t> next_pc = GetNextInstructionAddress();
+    if (next_pc)
+      return BreakpointLocations{*next_pc};
+    return next_pc.takeError();
   }
 
-  auto entry_pc = m_emulator_up->ReadPC();
-  if (!entry_pc) {
-    status = Status("Can't read PC");
-    return {};
-  }
+  std::optional<addr_t> entry_pc = m_emulator_up->ReadPC();
+  if (!entry_pc)
+    return llvm::createStringErrorV("Can't read PC");
----------------
labath wrote:

Sure. done.

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


More information about the lldb-commits mailing list