1 //===-- MICmdCmdBreak.h -----------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // Overview: CMICmdCmdBreakInsert interface. 11 // CMICmdCmdBreakDelete interface. 12 // CMICmdCmdBreakDisable interface. 13 // CMICmdCmdBreakEnable interface. 14 // CMICmdCmdBreakAfter interface. 15 // CMICmdCmdBreakCondition interface. 16 // 17 // To implement new MI commands derive a new command class from the 18 // command base 19 // class. To enable the new command for interpretation add the new 20 // command class 21 // to the command factory. The files of relevance are: 22 // MICmdCommands.cpp 23 // MICmdBase.h / .cpp 24 // MICmdCmd.h / .cpp 25 // For an introduction to adding a new command see 26 // CMICmdCmdSupportInfoMiCmdQuery 27 // command class as an example. 28 29 #pragma once 30 31 // Third party headers: 32 #include "lldb/API/SBBreakpoint.h" 33 34 // In-house headers: 35 #include "MICmdBase.h" 36 37 //++ 38 //============================================================================ 39 // Details: MI command class. MI commands derived from the command base class. 40 // *this class implements MI command "break-insert". 41 // This command does not follow the MI documentation exactly. 42 //-- 43 class CMICmdCmdBreakInsert : public CMICmdBase { 44 // Statics: 45 public: 46 // Required by the CMICmdFactory when registering *this command 47 static CMICmdBase *CreateSelf(); 48 49 // Methods: 50 public: 51 /* ctor */ CMICmdCmdBreakInsert(); 52 53 // Overridden: 54 public: 55 // From CMICmdInvoker::ICmd 56 bool Execute() override; 57 bool Acknowledge() override; 58 bool ParseArgs() override; 59 // From CMICmnBase 60 /* dtor */ ~CMICmdCmdBreakInsert() override; 61 62 // Enumerations: 63 private: 64 //++ =================================================================== 65 // Details: The type of break point give in the MI command text. 66 //-- 67 enum BreakPoint_e { 68 eBreakPoint_Invalid = 0, 69 eBreakPoint_ByFileLine, 70 eBreakPoint_ByFileFn, 71 eBreakPoint_ByName, 72 eBreakPoint_ByAddress, 73 eBreakPoint_count, 74 eBreakPoint_NotDefineYet 75 }; 76 77 // Attributes: 78 private: 79 bool m_bBrkPtIsTemp; 80 bool m_bHaveArgOptionThreadGrp; 81 CMIUtilString m_brkName; 82 CMIUtilString m_strArgOptionThreadGrp; 83 lldb::SBBreakpoint m_brkPt; 84 bool m_bBrkPtIsPending; 85 MIuint m_nBrkPtIgnoreCount; 86 bool m_bBrkPtEnabled; 87 bool m_bBrkPtCondition; 88 CMIUtilString m_brkPtCondition; 89 bool m_bBrkPtThreadId; 90 MIuint m_nBrkPtThreadId; 91 const CMIUtilString m_constStrArgNamedTempBrkPt; 92 const CMIUtilString m_constStrArgNamedHWBrkPt; // Not handled by *this command 93 const CMIUtilString m_constStrArgNamedPendinfBrkPt; 94 const CMIUtilString m_constStrArgNamedDisableBrkPt; 95 const CMIUtilString m_constStrArgNamedTracePt; // Not handled by *this command 96 const CMIUtilString m_constStrArgNamedConditionalBrkPt; 97 const CMIUtilString m_constStrArgNamedInoreCnt; 98 const CMIUtilString m_constStrArgNamedRestrictBrkPtToThreadId; 99 const CMIUtilString m_constStrArgNamedLocation; 100 }; 101 102 //++ 103 //============================================================================ 104 // Details: MI command class. MI commands derived from the command base class. 105 // *this class implements MI command "break-delete". 106 //-- 107 class CMICmdCmdBreakDelete : public CMICmdBase { 108 // Statics: 109 public: 110 // Required by the CMICmdFactory when registering *this command 111 static CMICmdBase *CreateSelf(); 112 113 // Methods: 114 public: 115 /* ctor */ CMICmdCmdBreakDelete(); 116 117 // Overridden: 118 public: 119 // From CMICmdInvoker::ICmd 120 bool Execute() override; 121 bool Acknowledge() override; 122 bool ParseArgs() override; 123 // From CMICmnBase 124 /* dtor */ ~CMICmdCmdBreakDelete() override; 125 126 // Attributes: 127 private: 128 const CMIUtilString m_constStrArgNamedBrkPt; 129 }; 130 131 //++ 132 //============================================================================ 133 // Details: MI command class. MI commands derived from the command base class. 134 // *this class implements MI command "break-disable". 135 //-- 136 class CMICmdCmdBreakDisable : public CMICmdBase { 137 // Statics: 138 public: 139 // Required by the CMICmdFactory when registering *this command 140 static CMICmdBase *CreateSelf(); 141 142 // Methods: 143 public: 144 /* ctor */ CMICmdCmdBreakDisable(); 145 146 // Overridden: 147 public: 148 // From CMICmdInvoker::ICmd 149 bool Execute() override; 150 bool Acknowledge() override; 151 bool ParseArgs() override; 152 // From CMICmnBase 153 /* dtor */ ~CMICmdCmdBreakDisable() override; 154 155 // Attributes: 156 private: 157 const CMIUtilString m_constStrArgNamedBrkPt; 158 bool m_bBrkPtDisabledOk; 159 MIuint m_nBrkPtId; 160 }; 161 162 //++ 163 //============================================================================ 164 // Details: MI command class. MI commands derived from the command base class. 165 // *this class implements MI command "break-enable". 166 //-- 167 class CMICmdCmdBreakEnable : public CMICmdBase { 168 // Statics: 169 public: 170 // Required by the CMICmdFactory when registering *this command 171 static CMICmdBase *CreateSelf(); 172 173 // Methods: 174 public: 175 /* ctor */ CMICmdCmdBreakEnable(); 176 177 // Overridden: 178 public: 179 // From CMICmdInvoker::ICmd 180 bool Execute() override; 181 bool Acknowledge() override; 182 bool ParseArgs() override; 183 // From CMICmnBase 184 /* dtor */ ~CMICmdCmdBreakEnable() override; 185 186 // Attributes: 187 private: 188 const CMIUtilString m_constStrArgNamedBrkPt; 189 bool m_bBrkPtEnabledOk; 190 MIuint m_nBrkPtId; 191 }; 192 193 //++ 194 //============================================================================ 195 // Details: MI command class. MI commands derived from the command base class. 196 // *this class implements MI command "break-after". 197 //-- 198 class CMICmdCmdBreakAfter : public CMICmdBase { 199 // Statics: 200 public: 201 // Required by the CMICmdFactory when registering *this command 202 static CMICmdBase *CreateSelf(); 203 204 // Methods: 205 public: 206 /* ctor */ CMICmdCmdBreakAfter(); 207 208 // Overridden: 209 public: 210 // From CMICmdInvoker::ICmd 211 bool Execute() override; 212 bool Acknowledge() override; 213 bool ParseArgs() override; 214 // From CMICmnBase 215 /* dtor */ ~CMICmdCmdBreakAfter() override; 216 217 // Attributes: 218 private: 219 const CMIUtilString m_constStrArgNamedNumber; 220 const CMIUtilString m_constStrArgNamedCount; 221 MIuint m_nBrkPtId; 222 MIuint m_nBrkPtCount; 223 }; 224 225 //++ 226 //============================================================================ 227 // Details: MI command class. MI commands derived from the command base class. 228 // *this class implements MI command "break-condition". 229 //-- 230 class CMICmdCmdBreakCondition : public CMICmdBase { 231 // Statics: 232 public: 233 // Required by the CMICmdFactory when registering *this command 234 static CMICmdBase *CreateSelf(); 235 236 // Methods: 237 public: 238 /* ctor */ CMICmdCmdBreakCondition(); 239 240 // Overridden: 241 public: 242 // From CMICmdInvoker::ICmd 243 bool Execute() override; 244 bool Acknowledge() override; 245 bool ParseArgs() override; 246 // From CMICmnBase 247 /* dtor */ ~CMICmdCmdBreakCondition() override; 248 249 // Methods: 250 private: 251 CMIUtilString GetRestOfExpressionNotSurroundedInQuotes(); 252 253 // Attributes: 254 private: 255 const CMIUtilString m_constStrArgNamedNumber; 256 const CMIUtilString m_constStrArgNamedExpr; 257 const CMIUtilString m_constStrArgNamedExprNoQuotes; // Not specified in MI 258 // spec, we need to handle 259 // expressions not 260 // surrounded by quotes 261 MIuint m_nBrkPtId; 262 CMIUtilString m_strBrkPtExpr; 263 }; 264