Skip to content

[lldb-dap] Cleanup InstructionBreakpoint - #200228

Merged
DrSergei merged 1 commit into
llvm:mainfrom
DrSergei:cleanup-instruction-breakpoints
Jun 1, 2026
Merged

[lldb-dap] Cleanup InstructionBreakpoint#200228
DrSergei merged 1 commit into
llvm:mainfrom
DrSergei:cleanup-instruction-breakpoints

Conversation

@DrSergei

Copy link
Copy Markdown
Contributor

Added mutex like in other breakpoints (PR). Also removed unused m_offset field.

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-lldb

Author: Sergei Druzhkov (DrSergei)

Changes

Added mutex like in other breakpoints (PR). Also removed unused m_offset field.


Full diff: https://github.com/llvm/llvm-project/pull/200228.diff

2 Files Affected:

  • (modified) lldb/tools/lldb-dap/InstructionBreakpoint.cpp (+5-3)
  • (modified) lldb/tools/lldb-dap/InstructionBreakpoint.h (-1)
diff --git a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
index ddae1a8b20243..89a0983b07809 100644
--- a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
@@ -18,14 +18,16 @@ namespace lldb_dap {
 InstructionBreakpoint::InstructionBreakpoint(
     DAP &d, const protocol::InstructionBreakpoint &breakpoint)
     : Breakpoint(d, breakpoint.condition, breakpoint.hitCondition),
-      m_instruction_address_reference(LLDB_INVALID_ADDRESS),
-      m_offset(breakpoint.offset.value_or(0)) {
+      m_instruction_address_reference(LLDB_INVALID_ADDRESS) {
   llvm::StringRef instruction_reference(breakpoint.instructionReference);
   instruction_reference.getAsInteger(0, m_instruction_address_reference);
-  m_instruction_address_reference += m_offset;
+  m_instruction_address_reference += breakpoint.offset.value_or(0);
 }
 
 void InstructionBreakpoint::SetBreakpoint() {
+  lldb::SBMutex lock = m_dap.GetAPIMutex();
+  std::lock_guard<lldb::SBMutex> guard(lock);
+
   m_bp =
       m_dap.target.BreakpointCreateByAddress(m_instruction_address_reference);
   Breakpoint::SetBreakpoint();
diff --git a/lldb/tools/lldb-dap/InstructionBreakpoint.h b/lldb/tools/lldb-dap/InstructionBreakpoint.h
index a8c8f2113e5eb..578926871f99b 100644
--- a/lldb/tools/lldb-dap/InstructionBreakpoint.h
+++ b/lldb/tools/lldb-dap/InstructionBreakpoint.h
@@ -33,7 +33,6 @@ class InstructionBreakpoint : public Breakpoint {
 
 protected:
   lldb::addr_t m_instruction_address_reference;
-  int32_t m_offset;
 };
 
 } // namespace lldb_dap

@DrSergei
DrSergei merged commit 8b901cc into llvm:main Jun 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants