Skip to content

Commit 513f414

Browse files
ilya-nozhkintkrasnukha
authored andcommitted
Introduce unified stoppoint indexing
LLDB uses separate indexing for breakpoints and watchpoints unlike GDB (and thus MI protocol too) which uses the same space of indices for both. So, it is necessary to provide some mapping that maps possibly overlapping breakpoint and watchpoint LLDB IDs to non-overlapping GDB IDs. This commit adds such mechanism to CMICmnLLDBDebugSessionInfo class. Existing methods and commands are modified to support new indexing and watchpoints. Also, there introduced some new methods that will be used by further commits.
1 parent 6257b47 commit 513f414

7 files changed

+642
-337
lines changed

src/MICmdCmdBreak.cpp

Lines changed: 208 additions & 100 deletions
Large diffs are not rendered by default.

src/MICmdCmdBreak.h

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
// In-house headers:
3434
#include "MICmdBase.h"
35+
#include "MICmnLLDBDebugSessionInfo.h"
3536

3637
//++
3738
//============================================================================
@@ -155,7 +156,7 @@ class CMICmdCmdBreakDisable : public CMICmdBase {
155156
private:
156157
const CMIUtilString m_constStrArgNamedBrkPt;
157158
bool m_bBrkPtDisabledOk;
158-
MIuint m_nBrkPtId;
159+
MIuint m_nMiStopPtId;
159160
};
160161

161162
//++
@@ -186,7 +187,7 @@ class CMICmdCmdBreakEnable : public CMICmdBase {
186187
private:
187188
const CMIUtilString m_constStrArgNamedBrkPt;
188189
bool m_bBrkPtEnabledOk;
189-
MIuint m_nBrkPtId;
190+
MIuint m_nMiStopPtId;
190191
};
191192

192193
//++
@@ -213,11 +214,30 @@ class CMICmdCmdBreakAfter : public CMICmdBase {
213214
// From CMICmnBase
214215
/* dtor */ ~CMICmdCmdBreakAfter() override;
215216

217+
// Methods:
218+
private:
219+
bool UpdateStopPtInfo(CMICmnLLDBDebugSessionInfo &rSessionInfo);
220+
template <class T>
221+
bool SetIgnoreCount(CMICmnLLDBDebugSessionInfo &rSessionInfo, T &vrStopPt) {
222+
if (!vrStopPt.IsValid()) {
223+
const CMIUtilString strBrkPtId(CMIUtilString::Format(
224+
"%" PRIu64, static_cast<uint64_t>(m_nMiStopPtId)));
225+
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_STOPPT_INVALID),
226+
m_cmdData.strMiCmd.c_str(),
227+
strBrkPtId.c_str()));
228+
return MIstatus::failure;
229+
}
230+
231+
vrStopPt.SetIgnoreCount(m_nBrkPtCount);
232+
233+
return UpdateStopPtInfo(rSessionInfo);
234+
}
235+
216236
// Attributes:
217237
private:
218238
const CMIUtilString m_constStrArgNamedNumber;
219239
const CMIUtilString m_constStrArgNamedCount;
220-
MIuint m_nBrkPtId;
240+
MIuint m_nMiStopPtId;
221241
MIuint m_nBrkPtCount;
222242
};
223243

@@ -248,6 +268,22 @@ class CMICmdCmdBreakCondition : public CMICmdBase {
248268
// Methods:
249269
private:
250270
CMIUtilString GetRestOfExpressionNotSurroundedInQuotes();
271+
bool UpdateStopPtInfo(CMICmnLLDBDebugSessionInfo &rSessionInfo);
272+
template <class T>
273+
bool SetCondition(CMICmnLLDBDebugSessionInfo &rSessionInfo, T &vrStopPt) {
274+
if (!vrStopPt.IsValid()) {
275+
const CMIUtilString strBrkPtId(CMIUtilString::Format(
276+
"%" PRIu64, static_cast<uint64_t>(m_nMiStopPtId)));
277+
SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_STOPPT_INVALID),
278+
m_cmdData.strMiCmd.c_str(),
279+
strBrkPtId.c_str()));
280+
return MIstatus::failure;
281+
}
282+
283+
vrStopPt.SetCondition(m_strBrkPtExpr.c_str());
284+
285+
return UpdateStopPtInfo(rSessionInfo);
286+
}
251287

252288
// Attributes:
253289
private:
@@ -257,6 +293,6 @@ class CMICmdCmdBreakCondition : public CMICmdBase {
257293
// spec, we need to handle
258294
// expressions not
259295
// surrounded by quotes
260-
MIuint m_nBrkPtId;
296+
MIuint m_nMiStopPtId;
261297
CMIUtilString m_strBrkPtExpr;
262298
};

0 commit comments

Comments
 (0)