@@ -49,12 +49,15 @@ llvm::Error SourceBreakpoint::SetBreakpoint(const protocol::Source &source) {
49
49
if (IsAssemblySource (source)) {
50
50
// Breakpoint set by assembly source.
51
51
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 ))
55
57
return error;
56
58
} else {
57
- if (llvm::Error error = CreateAssemblyBreakpointWithSourceReference (*source.sourceReference ))
59
+ if (llvm::Error error = CreateAssemblyBreakpointWithSourceReference (
60
+ *source.sourceReference ))
58
61
return error;
59
62
}
60
63
} else {
@@ -77,36 +80,37 @@ void SourceBreakpoint::UpdateBreakpoint(const SourceBreakpoint &request_bp) {
77
80
78
81
void SourceBreakpoint::CreatePathBreakpoint (const protocol::Source &source) {
79
82
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);
83
86
}
84
87
85
- llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference (int64_t source_reference) {
88
+ llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference (
89
+ int64_t source_reference) {
86
90
std::optional<lldb::addr_t > raw_addr =
87
91
m_dap.GetSourceReferenceAddress (source_reference);
88
92
if (!raw_addr)
89
93
return llvm::createStringError (llvm::inconvertibleErrorCode (),
90
- " Invalid sourceReference." );
94
+ " Invalid sourceReference." );
91
95
92
96
lldb::SBAddress source_address (*raw_addr, m_dap.target );
93
97
if (!source_address.IsValid ())
94
98
return llvm::createStringError (llvm::inconvertibleErrorCode (),
95
- " Invalid sourceReference." );
99
+ " Invalid sourceReference." );
96
100
97
101
lldb::SBSymbol symbol = source_address.GetSymbol ();
98
102
if (!symbol.IsValid ()) {
99
103
// FIXME: Support assembly breakpoints without a valid symbol.
100
104
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." );
103
107
}
104
108
105
109
lldb::SBInstructionList inst_list =
106
110
m_dap.target .ReadInstructions (symbol.GetStartAddress (), m_line);
107
111
if (inst_list.GetSize () < m_line)
108
112
return llvm::createStringError (llvm::inconvertibleErrorCode (),
109
- " Invalid instruction list size." );
113
+ " Invalid instruction list size." );
110
114
111
115
lldb::SBAddress address =
112
116
inst_list.GetInstructionAtIndex (m_line - 1 ).GetAddress ();
@@ -115,7 +119,8 @@ llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithSourceReference(int64_
115
119
return llvm::Error::success ();
116
120
}
117
121
118
- llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithPersistenceData (const protocol::PersistenceData &persistence_data) {
122
+ llvm::Error SourceBreakpoint::CreateAssemblyBreakpointWithPersistenceData (
123
+ const protocol::PersistenceData &persistence_data) {
119
124
lldb::SBFileSpec file_spec (persistence_data.module .c_str ());
120
125
m_bp = m_dap.target .BreakpointCreateByFileAddress (
121
126
file_spec, persistence_data.file_addr , 0 , m_line - 1 );
0 commit comments