[Lldb-commits] [lldb] [lldb] Convert Breakpoint & Watchpoints structs to classes (NFC) (PR #133780)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 31 11:56:31 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Jonas Devlieghere (JDevlieghere)
<details>
<summary>Changes</summary>
Convert Breakpoint & Watchpoints structs to classes to provide proper access control. This is in preparation for adopting SBMutex to protect the underlying SBBreakpoint and SBWatchpoint.
---
Patch is 28.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/133780.diff
23 Files Affected:
- (modified) lldb/tools/lldb-dap/Breakpoint.cpp (+13-11)
- (modified) lldb/tools/lldb-dap/Breakpoint.h (+9-5)
- (modified) lldb/tools/lldb-dap/BreakpointBase.h (+13-10)
- (modified) lldb/tools/lldb-dap/DAP.cpp (+4-4)
- (modified) lldb/tools/lldb-dap/DAP.h (+1-1)
- (modified) lldb/tools/lldb-dap/DAPForward.h (+8-8)
- (modified) lldb/tools/lldb-dap/ExceptionBreakpoint.cpp (+9-9)
- (modified) lldb/tools/lldb-dap/ExceptionBreakpoint.h (+19-9)
- (modified) lldb/tools/lldb-dap/FunctionBreakpoint.cpp (+3-3)
- (modified) lldb/tools/lldb-dap/FunctionBreakpoint.h (+8-4)
- (modified) lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp (+2-2)
- (modified) lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp (+4-3)
- (modified) lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp (+2-2)
- (modified) lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp (+2-2)
- (modified) lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp (+4-4)
- (modified) lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp (+3-3)
- (modified) lldb/tools/lldb-dap/InstructionBreakpoint.cpp (+5-6)
- (modified) lldb/tools/lldb-dap/InstructionBreakpoint.h (+12-7)
- (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+4-4)
- (modified) lldb/tools/lldb-dap/SourceBreakpoint.cpp (+3-3)
- (modified) lldb/tools/lldb-dap/SourceBreakpoint.h (+28-24)
- (modified) lldb/tools/lldb-dap/Watchpoint.cpp (+11-10)
- (modified) lldb/tools/lldb-dap/Watchpoint.h (+13-9)
``````````diff
diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp b/lldb/tools/lldb-dap/Breakpoint.cpp
index eba534dcc51c7..188a51909f111 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -19,21 +19,21 @@
using namespace lldb_dap;
-void Breakpoint::SetCondition() { bp.SetCondition(condition.c_str()); }
+void Breakpoint::SetCondition() { m_bp.SetCondition(condition.c_str()); }
void Breakpoint::SetHitCondition() {
uint64_t hitCount = 0;
if (llvm::to_integer(hitCondition, hitCount))
- bp.SetIgnoreCount(hitCount - 1);
+ m_bp.SetIgnoreCount(hitCount - 1);
}
void Breakpoint::CreateJsonObject(llvm::json::Object &object) {
// Each breakpoint location is treated as a separate breakpoint for VS code.
// They don't have the notion of a single breakpoint with multiple locations.
- if (!bp.IsValid())
+ if (!m_bp.IsValid())
return;
- object.try_emplace("verified", bp.GetNumResolvedLocations() > 0);
- object.try_emplace("id", bp.GetID());
+ object.try_emplace("verified", m_bp.GetNumResolvedLocations() > 0);
+ object.try_emplace("id", m_bp.GetID());
// VS Code DAP doesn't currently allow one breakpoint to have multiple
// locations so we just report the first one. If we report all locations
// then the IDE starts showing the wrong line numbers and locations for
@@ -43,20 +43,20 @@ void Breakpoint::CreateJsonObject(llvm::json::Object &object) {
// this as the breakpoint location since it will have a complete location
// that is at least loaded in the current process.
lldb::SBBreakpointLocation bp_loc;
- const auto num_locs = bp.GetNumLocations();
+ const auto num_locs = m_bp.GetNumLocations();
for (size_t i = 0; i < num_locs; ++i) {
- bp_loc = bp.GetLocationAtIndex(i);
+ bp_loc = m_bp.GetLocationAtIndex(i);
if (bp_loc.IsResolved())
break;
}
// If not locations are resolved, use the first location.
if (!bp_loc.IsResolved())
- bp_loc = bp.GetLocationAtIndex(0);
+ bp_loc = m_bp.GetLocationAtIndex(0);
auto bp_addr = bp_loc.GetAddress();
if (bp_addr.IsValid()) {
std::string formatted_addr =
- "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(bp.GetTarget()));
+ "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget()));
object.try_emplace("instructionReference", formatted_addr);
auto line_entry = bp_addr.GetLineEntry();
const auto line = line_entry.GetLine();
@@ -69,10 +69,12 @@ void Breakpoint::CreateJsonObject(llvm::json::Object &object) {
}
}
-bool Breakpoint::MatchesName(const char *name) { return bp.MatchesName(name); }
+bool Breakpoint::MatchesName(const char *name) {
+ return m_bp.MatchesName(name);
+}
void Breakpoint::SetBreakpoint() {
- bp.AddName(kDAPBreakpointLabel);
+ m_bp.AddName(kDAPBreakpointLabel);
if (!condition.empty())
SetCondition();
if (!hitCondition.empty())
diff --git a/lldb/tools/lldb-dap/Breakpoint.h b/lldb/tools/lldb-dap/Breakpoint.h
index a726f27e59ee0..580017125af44 100644
--- a/lldb/tools/lldb-dap/Breakpoint.h
+++ b/lldb/tools/lldb-dap/Breakpoint.h
@@ -15,12 +15,12 @@
namespace lldb_dap {
-struct Breakpoint : public BreakpointBase {
- // The LLDB breakpoint associated wit this source breakpoint
- lldb::SBBreakpoint bp;
-
+class Breakpoint : public BreakpointBase {
+public:
Breakpoint(DAP &d, const llvm::json::Object &obj) : BreakpointBase(d, obj) {}
- Breakpoint(DAP &d, lldb::SBBreakpoint bp) : BreakpointBase(d), bp(bp) {}
+ Breakpoint(DAP &d, lldb::SBBreakpoint bp) : BreakpointBase(d), m_bp(bp) {}
+
+ lldb::break_id_t GetID() const { return m_bp.GetID(); }
void SetCondition() override;
void SetHitCondition() override;
@@ -28,6 +28,10 @@ struct Breakpoint : public BreakpointBase {
bool MatchesName(const char *name);
void SetBreakpoint();
+
+protected:
+ /// The LLDB breakpoint associated wit this source breakpoint.
+ lldb::SBBreakpoint m_bp;
};
} // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/BreakpointBase.h b/lldb/tools/lldb-dap/BreakpointBase.h
index 0b036dd1985b3..07133dc44828b 100644
--- a/lldb/tools/lldb-dap/BreakpointBase.h
+++ b/lldb/tools/lldb-dap/BreakpointBase.h
@@ -15,16 +15,8 @@
namespace lldb_dap {
-struct BreakpointBase {
- // Associated DAP session.
- DAP &dap;
-
- // An optional expression for conditional breakpoints.
- std::string condition;
- // An optional expression that controls how many hits of the breakpoint are
- // ignored. The backend is expected to interpret the expression as needed
- std::string hitCondition;
-
+class BreakpointBase {
+public:
explicit BreakpointBase(DAP &d) : dap(d) {}
BreakpointBase(DAP &d, const llvm::json::Object &obj);
virtual ~BreakpointBase() = default;
@@ -49,6 +41,17 @@ struct BreakpointBase {
/// breakpoint in one of the DAP breakpoints that we should report changes
/// for.
static constexpr const char *kDAPBreakpointLabel = "dap";
+
+protected:
+ /// Associated DAP session.
+ DAP &dap;
+
+ /// An optional expression for conditional breakpoints.
+ std::string condition;
+
+ /// An optional expression that controls how many hits of the breakpoint are
+ /// ignored. The backend is expected to interpret the expression as needed
+ std::string hitCondition;
};
} // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index 512cabdf77880..8951384212f11 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -162,7 +162,7 @@ void DAP::PopulateExceptionBreakpoints() {
});
}
-ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const std::string &filter) {
+ExceptionBreakpoint *DAP::GetExceptionBreakpoint(llvm::StringRef filter) {
// PopulateExceptionBreakpoints() is called after g_dap.debugger is created
// in a request-initialize.
//
@@ -181,7 +181,7 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const std::string &filter) {
PopulateExceptionBreakpoints();
for (auto &bp : *exception_breakpoints) {
- if (bp.filter == filter)
+ if (bp.GetFilter() == filter)
return &bp;
}
return nullptr;
@@ -192,7 +192,7 @@ ExceptionBreakpoint *DAP::GetExceptionBreakpoint(const lldb::break_id_t bp_id) {
PopulateExceptionBreakpoints();
for (auto &bp : *exception_breakpoints) {
- if (bp.bp.GetID() == bp_id)
+ if (bp.GetID() == bp_id)
return &bp;
}
return nullptr;
@@ -1066,7 +1066,7 @@ void DAP::SetThreadFormat(llvm::StringRef format) {
InstructionBreakpoint *
DAP::GetInstructionBreakpoint(const lldb::break_id_t bp_id) {
for (auto &bp : instruction_breakpoints) {
- if (bp.second.bp.GetID() == bp_id)
+ if (bp.second.GetID() == bp_id)
return &bp.second;
}
return nullptr;
diff --git a/lldb/tools/lldb-dap/DAP.h b/lldb/tools/lldb-dap/DAP.h
index 6689980806047..4357bdd5cc80f 100644
--- a/lldb/tools/lldb-dap/DAP.h
+++ b/lldb/tools/lldb-dap/DAP.h
@@ -236,7 +236,7 @@ struct DAP {
void operator=(const DAP &rhs) = delete;
/// @}
- ExceptionBreakpoint *GetExceptionBreakpoint(const std::string &filter);
+ ExceptionBreakpoint *GetExceptionBreakpoint(llvm::StringRef filter);
ExceptionBreakpoint *GetExceptionBreakpoint(const lldb::break_id_t bp_id);
/// Redirect stdout and stderr fo the IDE's console output.
diff --git a/lldb/tools/lldb-dap/DAPForward.h b/lldb/tools/lldb-dap/DAPForward.h
index 58e034ed1cc77..6620d5fd33642 100644
--- a/lldb/tools/lldb-dap/DAPForward.h
+++ b/lldb/tools/lldb-dap/DAPForward.h
@@ -12,16 +12,16 @@
// IWYU pragma: begin_exports
namespace lldb_dap {
-struct BreakpointBase;
-struct ExceptionBreakpoint;
-struct FunctionBreakpoint;
-struct SourceBreakpoint;
-struct Watchpoint;
-struct InstructionBreakpoint;
-struct DAP;
-class Log;
class BaseRequestHandler;
+class BreakpointBase;
+class ExceptionBreakpoint;
+class FunctionBreakpoint;
+class InstructionBreakpoint;
+class Log;
class ResponseHandler;
+class SourceBreakpoint;
+class Watchpoint;
+struct DAP;
} // namespace lldb_dap
namespace lldb {
diff --git a/lldb/tools/lldb-dap/ExceptionBreakpoint.cpp b/lldb/tools/lldb-dap/ExceptionBreakpoint.cpp
index 15aee55ad923e..d8109daf89129 100644
--- a/lldb/tools/lldb-dap/ExceptionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/ExceptionBreakpoint.cpp
@@ -14,20 +14,20 @@
namespace lldb_dap {
void ExceptionBreakpoint::SetBreakpoint() {
- if (bp.IsValid())
+ if (m_bp.IsValid())
return;
- bool catch_value = filter.find("_catch") != std::string::npos;
- bool throw_value = filter.find("_throw") != std::string::npos;
- bp = dap.target.BreakpointCreateForException(language, catch_value,
- throw_value);
- bp.AddName(BreakpointBase::kDAPBreakpointLabel);
+ bool catch_value = m_filter.find("_catch") != std::string::npos;
+ bool throw_value = m_filter.find("_throw") != std::string::npos;
+ m_bp = m_dap.target.BreakpointCreateForException(m_language, catch_value,
+ throw_value);
+ m_bp.AddName(BreakpointBase::kDAPBreakpointLabel);
}
void ExceptionBreakpoint::ClearBreakpoint() {
- if (!bp.IsValid())
+ if (!m_bp.IsValid())
return;
- dap.target.BreakpointDelete(bp.GetID());
- bp = lldb::SBBreakpoint();
+ m_dap.target.BreakpointDelete(m_bp.GetID());
+ m_bp = lldb::SBBreakpoint();
}
} // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/ExceptionBreakpoint.h b/lldb/tools/lldb-dap/ExceptionBreakpoint.h
index b83c5ef777352..49a338fdbc6ee 100644
--- a/lldb/tools/lldb-dap/ExceptionBreakpoint.h
+++ b/lldb/tools/lldb-dap/ExceptionBreakpoint.h
@@ -12,25 +12,35 @@
#include "DAPForward.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/StringRef.h"
#include <string>
#include <utility>
namespace lldb_dap {
-struct ExceptionBreakpoint {
- DAP &dap;
- std::string filter;
- std::string label;
- lldb::LanguageType language;
- bool default_value = false;
- lldb::SBBreakpoint bp;
+class ExceptionBreakpoint {
+public:
ExceptionBreakpoint(DAP &d, std::string f, std::string l,
lldb::LanguageType lang)
- : dap(d), filter(std::move(f)), label(std::move(l)), language(lang),
- bp() {}
+ : m_dap(d), m_filter(std::move(f)), m_label(std::move(l)),
+ m_language(lang), m_bp() {}
void SetBreakpoint();
void ClearBreakpoint();
+ void CreateJsonObject(llvm::json::Object &object);
+
+ lldb::break_id_t GetID() const { return m_bp.GetID(); }
+ llvm::StringRef GetFilter() const { return m_filter; }
+ llvm::StringRef GetLabel() const { return m_label; }
+
+ static constexpr bool kDefaultValue = false;
+
+protected:
+ DAP &m_dap;
+ std::string m_filter;
+ std::string m_label;
+ lldb::LanguageType m_language;
+ lldb::SBBreakpoint m_bp;
};
} // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/FunctionBreakpoint.cpp b/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
index cafae32b662f2..6a4fff4a50f94 100644
--- a/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/FunctionBreakpoint.cpp
@@ -14,12 +14,12 @@ namespace lldb_dap {
FunctionBreakpoint::FunctionBreakpoint(DAP &d, const llvm::json::Object &obj)
: Breakpoint(d, obj),
- functionName(std::string(GetString(obj, "name").value_or(""))) {}
+ m_function_name(std::string(GetString(obj, "name").value_or(""))) {}
void FunctionBreakpoint::SetBreakpoint() {
- if (functionName.empty())
+ if (m_function_name.empty())
return;
- bp = dap.target.BreakpointCreateByName(functionName.c_str());
+ m_bp = dap.target.BreakpointCreateByName(m_function_name.c_str());
Breakpoint::SetBreakpoint();
}
diff --git a/lldb/tools/lldb-dap/FunctionBreakpoint.h b/lldb/tools/lldb-dap/FunctionBreakpoint.h
index 93f0b93b35291..7100360cd7ec1 100644
--- a/lldb/tools/lldb-dap/FunctionBreakpoint.h
+++ b/lldb/tools/lldb-dap/FunctionBreakpoint.h
@@ -14,13 +14,17 @@
namespace lldb_dap {
-struct FunctionBreakpoint : public Breakpoint {
- std::string functionName;
-
+class FunctionBreakpoint : public Breakpoint {
+public:
FunctionBreakpoint(DAP &dap, const llvm::json::Object &obj);
- // Set this breakpoint in LLDB as a new breakpoint
+ /// Set this breakpoint in LLDB as a new breakpoint.
void SetBreakpoint();
+
+ llvm::StringRef GetFunctionName() const { return m_function_name; }
+
+protected:
+ std::string m_function_name;
};
} // namespace lldb_dap
diff --git a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
index 2f4d4efd1b189..924ea63ed1593 100644
--- a/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ExceptionInfoRequestHandler.cpp
@@ -125,8 +125,8 @@ void ExceptionInfoRequestHandler::operator()(
else if (stopReason == lldb::eStopReasonBreakpoint) {
ExceptionBreakpoint *exc_bp = dap.GetExceptionBPFromStopReason(thread);
if (exc_bp) {
- EmplaceSafeString(body, "exceptionId", exc_bp->filter);
- EmplaceSafeString(body, "description", exc_bp->label);
+ EmplaceSafeString(body, "exceptionId", exc_bp->GetFilter());
+ EmplaceSafeString(body, "description", exc_bp->GetLabel());
} else {
body.try_emplace("exceptionId", "exception");
}
diff --git a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
index 5ca2c9c01965e..dc0368852101f 100644
--- a/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp
@@ -143,7 +143,8 @@ void SetBreakpointsRequestHandler::operator()(
const auto *bp_obj = bp.getAsObject();
if (bp_obj) {
SourceBreakpoint src_bp(dap, *bp_obj);
- std::pair<uint32_t, uint32_t> bp_pos(src_bp.line, src_bp.column);
+ std::pair<uint32_t, uint32_t> bp_pos(src_bp.GetLine(),
+ src_bp.GetColumn());
request_bps.try_emplace(bp_pos, src_bp);
const auto [iv, inserted] =
dap.source_breakpoints[path].try_emplace(bp_pos, src_bp);
@@ -153,7 +154,7 @@ void SetBreakpointsRequestHandler::operator()(
else
iv->getSecond().UpdateBreakpoint(src_bp);
AppendBreakpoint(&iv->getSecond(), response_breakpoints, path,
- src_bp.line);
+ src_bp.GetLine());
}
}
}
@@ -167,7 +168,7 @@ void SetBreakpointsRequestHandler::operator()(
auto request_pos = request_bps.find(old_bp.first);
if (request_pos == request_bps.end()) {
// This breakpoint no longer exists in this source file, delete it
- dap.target.BreakpointDelete(old_bp.second.bp.GetID());
+ dap.target.BreakpointDelete(old_bp.second.GetID());
old_src_bp_pos->second.erase(old_bp.first);
}
}
diff --git a/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp
index 87310131255e1..365c9f0d722d4 100644
--- a/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp
@@ -97,9 +97,9 @@ void SetDataBreakpointsRequestHandler::operator()(
// backward.
std::set<lldb::addr_t> addresses;
for (auto iter = watchpoints.rbegin(); iter != watchpoints.rend(); ++iter) {
- if (addresses.count(iter->addr) == 0) {
+ if (addresses.count(iter->GetAddress()) == 0) {
iter->SetWatchpoint();
- addresses.insert(iter->addr);
+ addresses.insert(iter->GetAddress());
}
}
for (auto wp : watchpoints)
diff --git a/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
index 8be5d870a070f..09d4fea2a9a22 100644
--- a/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetExceptionBreakpointsRequestHandler.cpp
@@ -70,9 +70,9 @@ void SetExceptionBreakpointsRequestHandler::operator()(
const auto *filters = arguments->getArray("filters");
// Keep a list of any exception breakpoint filter names that weren't set
// so we can clear any exception breakpoints if needed.
- std::set<std::string> unset_filters;
+ std::set<llvm::StringRef> unset_filters;
for (const auto &bp : *dap.exception_breakpoints)
- unset_filters.insert(bp.filter);
+ unset_filters.insert(bp.GetFilter());
for (const auto &value : *filters) {
const auto filter = GetAsString(value);
diff --git a/lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp
index 945df68936bac..c45dc0d0d6553 100644
--- a/lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp
@@ -110,15 +110,15 @@ void SetFunctionBreakpointsRequestHandler::operator()(
if (!bp_obj)
continue;
FunctionBreakpoint fn_bp(dap, *bp_obj);
- const auto [it, inserted] =
- dap.function_breakpoints.try_emplace(fn_bp.functionName, dap, *bp_obj);
+ const auto [it, inserted] = dap.function_breakpoints.try_emplace(
+ fn_bp.GetFunctionName(), dap, *bp_obj);
if (inserted)
it->second.SetBreakpoint();
else
it->second.UpdateBreakpoint(fn_bp);
AppendBreakpoint(&it->second, response_breakpoints);
- seen.erase(fn_bp.functionName);
+ seen.erase(fn_bp.GetFunctionName());
}
// Remove any breakpoints that are no longer in our list
@@ -126,7 +126,7 @@ void SetFunctionBreakpointsRequestHandler::operator()(
auto fn_bp = dap.function_breakpoints.find(name);
if (fn_bp == dap.function_breakpoints.end())
continue;
- dap.target.BreakpointDelete(fn_bp->second.bp.GetID());
+ dap.target.BreakpointDelete(fn_bp->second.GetID());
dap.function_breakpoints.erase(name);
}
diff --git a/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp
index b1e47942de8e6..4e555ad605a26 100644
--- a/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp
@@ -223,20 +223,20 @@ void SetInstructionBreakpointsRequestHandler::operator()(
// Read instruction breakpoint request.
InstructionBreakpoint inst_bp(dap, *bp_obj);
const auto [iv, inserted] = dap.instruction_breakpoints.try_emplace(
- inst_bp.instructionAddressReference, dap, *bp_obj);
+ inst_bp.GetInstructionAddressReference(), dap, *bp_obj);
if (inserted)
iv->second.SetBreakpoint();
else
iv->second.UpdateBreakpoint(inst_bp);
AppendBreakpoint(&iv->second, response_breakpoints);
- seen.erase(inst_bp.instructionAddressReference);
+ seen.erase(inst_bp.GetInstructionAddressReference());
}
for (const auto &addr : seen) {
auto inst_bp = dap.instruction_breakpoints.find(addr);
if (inst_bp == dap.instruction_breakpoints.end())
continue;
- dap.target.BreakpointDelete(inst_bp->second.bp.GetID());
+ dap.target.BreakpointDelete(inst_bp->second.GetID());
dap.instruction_breakpoints.erase(addr);
}
diff --git a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
index 710787625ec58..265da61e513c1 100644
--- a/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
+++ b/lldb/tools/lldb-dap/InstructionBreakpoint.cpp
@@ -16,19 +16,18 @@
namespace lldb_dap {
-// Instruction Breakpoint
InstructionBreakpoint::InstructionBreakpoint(DAP &d,
const llvm::json::Object &obj)
- : Breakpoint(d, obj), instructionAddressReference(LLDB_INVALID_ADDRESS),
- offset(GetInteger<int64_t>(obj, "offset").value_or(0)) {
+ : Breakpoint(d, obj), m_instruction_address_reference(LLDB_INVALID_ADDRESS),
+ m_offset(GetInteger<int64_t>(obj, "offset").value_or(0)) {
GetString(obj, "instructionReference")
.value_or("")
- .getAsInteger(0, instructionAddressReference);
- instructionAddressReference += offset;
+ .getAsInteger(0, m_instruction_address_reference);
+ m_instruction_address_reference += m_offset;
}
void InstructionBreakpoint::SetBreakpoint() {
- ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/133780
More information about the lldb-commits
mailing list