Skip to content

Commit 7242cd8

Browse files
committed
format
1 parent 5a70327 commit 7242cd8

File tree

3 files changed

+30
-23
lines changed

3 files changed

+30
-23
lines changed

lldb/tools/lldb-dap/Protocol/DAPTypes.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@
2323

2424
namespace lldb_dap::protocol {
2525

26-
/// Data used to help lldb-dap resolve breakpoints persistently across different sessions.
27-
/// This information is especially useful for assembly breakpoints, because `sourceReference`
28-
/// can change across sessions. For regular source breakpoints the path and line are the same
29-
/// For each session.
26+
/// Data used to help lldb-dap resolve breakpoints persistently across different
27+
/// sessions. This information is especially useful for assembly breakpoints,
28+
/// because `sourceReference` can change across sessions. For regular source
29+
/// breakpoints the path and line are the same For each session.
3030
struct PersistenceData {
3131
/// The source module path.
3232
std::string module;
3333

3434
/// The file address of the function.
3535
lldb::addr_t file_addr;
3636
};
37-
bool fromJSON(const llvm::json::Value &, PersistenceData &,
38-
llvm::json::Path);
37+
bool fromJSON(const llvm::json::Value &, PersistenceData &, llvm::json::Path);
3938
llvm::json::Value toJSON(const PersistenceData &);
4039

4140
/// Custom source data used by lldb-dap.
4241
/// This data should help lldb-dap identify sources correctly across different
4342
/// sessions.
4443
struct SourceLLDBData {
45-
/// Data that helps lldb resolve this source persistently across different sessions.
44+
/// Data that helps lldb resolve this source persistently across different
45+
/// sessions.
4646
std::optional<PersistenceData> persistence_data;
4747
};
4848
bool fromJSON(const llvm::json::Value &, SourceLLDBData &, llvm::json::Path);

lldb/tools/lldb-dap/SourceBreakpoint.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,15 @@ llvm::Error SourceBreakpoint::SetBreakpoint(const protocol::Source &source) {
4949
if (IsAssemblySource(source)) {
5050
// Breakpoint set by assembly source.
5151
if (source.adapterData && source.adapterData->persistence_data) {
52-
// Prefer use the adapter persitence data, because this could be a breakpoint
53-
// from a previous session where the `sourceReference` is not valid anymore.
54-
if (llvm::Error error = CreateAssemblyBreakpointWithPersistenceData(*source.adapterData->persistence_data))
52+
// Prefer use the adapter persitence data, because this could be a
53+
// breakpoint from a previous session where the `sourceReference` is not
54+
// valid anymore.
55+
if (llvm::Error error = CreateAssemblyBreakpointWithPersistenceData(
56+
*source.adapterData->persistence_data))
5557
return error;
5658
} else {
57-
if (llvm::Error error = CreateAssemblyBreakpointWithSourceReference(*source.sourceReference))
59+
if (llvm::Error error = CreateAssemblyBreakpointWithSourceReference(
60+
*source.sourceReference))
5861
return error;
5962
}
6063
} else {
@@ -77,36 +80,37 @@ void SourceBreakpoint::UpdateBreakpoint(const SourceBreakpoint &request_bp) {
7780

7881
void SourceBreakpoint::CreatePathBreakpoint(const protocol::Source &source) {
7982
const auto source_path = source.path.value_or("");
80-
lldb::SBFileSpecList module_list;
81-
m_bp = m_dap.target.BreakpointCreateByLocation(source_path.c_str(), m_line,
82-
m_column, 0, module_list);
83+
lldb::SBFileSpecList module_list;
84+
m_bp = m_dap.target.BreakpointCreateByLocation(source_path.c_str(), m_line,
85+
m_column, 0, module_list);
8386
}
8487

85-
llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference(int64_t source_reference) {
88+
llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference(
89+
int64_t source_reference) {
8690
std::optional<lldb::addr_t> raw_addr =
8791
m_dap.GetSourceReferenceAddress(source_reference);
8892
if (!raw_addr)
8993
return llvm::createStringError(llvm::inconvertibleErrorCode(),
90-
"Invalid sourceReference.");
94+
"Invalid sourceReference.");
9195

9296
lldb::SBAddress source_address(*raw_addr, m_dap.target);
9397
if (!source_address.IsValid())
9498
return llvm::createStringError(llvm::inconvertibleErrorCode(),
95-
"Invalid sourceReference.");
99+
"Invalid sourceReference.");
96100

97101
lldb::SBSymbol symbol = source_address.GetSymbol();
98102
if (!symbol.IsValid()) {
99103
// FIXME: Support assembly breakpoints without a valid symbol.
100104
return llvm::createStringError(llvm::inconvertibleErrorCode(),
101-
"Breakpoints in assembly without a valid "
102-
"symbol are not supported yet.");
105+
"Breakpoints in assembly without a valid "
106+
"symbol are not supported yet.");
103107
}
104108

105109
lldb::SBInstructionList inst_list =
106110
m_dap.target.ReadInstructions(symbol.GetStartAddress(), m_line);
107111
if (inst_list.GetSize() < m_line)
108112
return llvm::createStringError(llvm::inconvertibleErrorCode(),
109-
"Invalid instruction list size.");
113+
"Invalid instruction list size.");
110114

111115
lldb::SBAddress address =
112116
inst_list.GetInstructionAtIndex(m_line - 1).GetAddress();
@@ -115,7 +119,8 @@ llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference(int64_
115119
return llvm::Error::success();
116120
}
117121

118-
llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithPersistenceData(const protocol::PersistenceData &persistence_data) {
122+
llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithPersistenceData(
123+
const protocol::PersistenceData &persistence_data) {
119124
lldb::SBFileSpec file_spec(persistence_data.module.c_str());
120125
m_bp = m_dap.target.BreakpointCreateByFileAddress(
121126
file_spec, persistence_data.file_addr, 0, m_line - 1);

lldb/tools/lldb-dap/SourceBreakpoint.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ class SourceBreakpoint : public Breakpoint {
5252

5353
protected:
5454
void CreatePathBreakpoint(const protocol::Source &source);
55-
llvm::Error CreateAssemblyBreakpointWithSourceReference(int64_t source_reference);
56-
llvm::Error CreateAssemblyBreakpointWithPersistenceData(const protocol::PersistenceData &persistence_data);
55+
llvm::Error
56+
CreateAssemblyBreakpointWithSourceReference(int64_t source_reference);
57+
llvm::Error CreateAssemblyBreakpointWithPersistenceData(
58+
const protocol::PersistenceData &persistence_data);
5759

5860
// logMessage part can be either a raw text or an expression.
5961
struct LogMessagePart {

0 commit comments

Comments
 (0)