1 //===-- CommandObjectBreakpoint.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 #ifndef liblldb_CommandObjectBreakpoint_h_
11 #define liblldb_CommandObjectBreakpoint_h_
12 
13 // C Includes
14 // C++ Includes
15 
16 #include <utility>
17 #include <vector>
18 
19 // Other libraries and framework includes
20 // Project includes
21 #include "lldb/Core/Address.h"
22 #include "lldb/Interpreter/CommandObjectMultiword.h"
23 #include "lldb/Interpreter/Options.h"
24 #include "lldb/Core/STLUtils.h"
25 
26 namespace lldb_private {
27 
28 //-------------------------------------------------------------------------
29 // CommandObjectMultiwordBreakpoint
30 //-------------------------------------------------------------------------
31 
32 class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword
33 {
34 public:
35     CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter);
36 
37     virtual
38     ~CommandObjectMultiwordBreakpoint ();
39 
40     static void
41     VerifyBreakpointIDs (Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids);
42 
43 };
44 
45 //-------------------------------------------------------------------------
46 // CommandObjectdBreakpointSet
47 //-------------------------------------------------------------------------
48 
49 
50 class CommandObjectBreakpointSet : public CommandObject
51 {
52 public:
53 
54     typedef enum BreakpointSetType
55     {
56         eSetTypeInvalid,
57         eSetTypeFileAndLine,
58         eSetTypeAddress,
59         eSetTypeFunctionName,
60         eSetTypeFunctionRegexp,
61         eSetTypeSourceRegexp,
62         eSetTypeException
63     } BreakpointSetType;
64 
65     CommandObjectBreakpointSet (CommandInterpreter &interpreter);
66 
67     virtual
68     ~CommandObjectBreakpointSet ();
69 
70     virtual bool
71     Execute (Args& command,
72              CommandReturnObject &result);
73 
74     virtual Options *
75     GetOptions ();
76 
77     class CommandOptions : public Options
78     {
79     public:
80 
81         CommandOptions (CommandInterpreter &interpreter);
82 
83         virtual
84         ~CommandOptions ();
85 
86         virtual Error
87         SetOptionValue (uint32_t option_idx, const char *option_arg);
88 
89         void
90         OptionParsingStarting ();
91 
92         const OptionDefinition*
93         GetDefinitions ();
94 
95         // Options table: Required for subclasses of Options.
96 
97         static OptionDefinition g_option_table[];
98 
99         // Instance variables to hold the values for command options.
100 
101         FileSpecList m_filenames;
102         uint32_t m_line_num;
103         uint32_t m_column;
104         bool m_check_inlines;
105         std::vector<std::string> m_func_names;
106         uint32_t m_func_name_type_mask;
107         std::string m_func_regexp;
108         std::string m_source_text_regexp;
109         FileSpecList m_modules;
110         lldb::addr_t m_load_addr;
111         uint32_t m_ignore_count;
112         lldb::tid_t m_thread_id;
113         uint32_t m_thread_index;
114         std::string m_thread_name;
115         std::string m_queue_name;
116         bool m_catch_bp;
117         bool m_throw_bp;
118         lldb::LanguageType m_language;
119 
120     };
121 
122 private:
123     bool
124     GetDefaultFile (Target *target, FileSpec &file, CommandReturnObject &result);
125 
126     CommandOptions m_options;
127 };
128 
129 //-------------------------------------------------------------------------
130 // CommandObjectMultiwordBreakpointModify
131 //-------------------------------------------------------------------------
132 
133 
134 class CommandObjectBreakpointModify : public CommandObject
135 {
136 public:
137 
138     CommandObjectBreakpointModify (CommandInterpreter &interpreter);
139 
140     virtual
141     ~CommandObjectBreakpointModify ();
142 
143     virtual bool
144     Execute (Args& command,
145              CommandReturnObject &result);
146 
147     virtual Options *
148     GetOptions ();
149 
150     class CommandOptions : public Options
151     {
152     public:
153 
154         CommandOptions (CommandInterpreter &interpreter);
155 
156         virtual
157         ~CommandOptions ();
158 
159         virtual Error
160         SetOptionValue (uint32_t option_idx, const char *option_arg);
161 
162         void
163         OptionParsingStarting ();
164 
165         const OptionDefinition*
166         GetDefinitions ();
167 
168         // Options table: Required for subclasses of Options.
169 
170         static OptionDefinition g_option_table[];
171 
172         // Instance variables to hold the values for command options.
173 
174         uint32_t m_ignore_count;
175         lldb::tid_t m_thread_id;
176         bool m_thread_id_passed;
177         uint32_t m_thread_index;
178         bool m_thread_index_passed;
179         std::string m_thread_name;
180         std::string m_queue_name;
181         std::string m_condition;
182         bool m_enable_passed;
183         bool m_enable_value;
184         bool m_name_passed;
185         bool m_queue_passed;
186         bool m_condition_passed;
187 
188     };
189 
190 private:
191     CommandOptions m_options;
192 };
193 
194 //-------------------------------------------------------------------------
195 // CommandObjectBreakpointEnable
196 //-------------------------------------------------------------------------
197 
198 class CommandObjectBreakpointEnable : public CommandObject
199 {
200 public:
201     CommandObjectBreakpointEnable (CommandInterpreter &interpreter);
202 
203     virtual
204     ~CommandObjectBreakpointEnable ();
205 
206     virtual bool
207     Execute (Args& command,
208              CommandReturnObject &result);
209 
210 private:
211 };
212 
213 //-------------------------------------------------------------------------
214 // CommandObjectBreakpointDisable
215 //-------------------------------------------------------------------------
216 
217 class CommandObjectBreakpointDisable : public CommandObject
218 {
219 public:
220     CommandObjectBreakpointDisable (CommandInterpreter &interpreter);
221 
222     virtual
223     ~CommandObjectBreakpointDisable ();
224 
225     virtual bool
226     Execute (Args& command,
227              CommandReturnObject &result);
228 
229 private:
230 };
231 
232 //-------------------------------------------------------------------------
233 // CommandObjectBreakpointList
234 //-------------------------------------------------------------------------
235 
236 class CommandObjectBreakpointList : public CommandObject
237 {
238 public:
239     CommandObjectBreakpointList (CommandInterpreter &interpreter);
240 
241     virtual
242     ~CommandObjectBreakpointList ();
243 
244     virtual bool
245     Execute (Args& command,
246              CommandReturnObject &result);
247 
248     virtual Options *
249     GetOptions ();
250 
251     class CommandOptions : public Options
252     {
253     public:
254 
255         CommandOptions (CommandInterpreter &interpreter);
256 
257         virtual
258         ~CommandOptions ();
259 
260         virtual Error
261         SetOptionValue (uint32_t option_idx, const char *option_arg);
262 
263         void
264         OptionParsingStarting ();
265 
266         const OptionDefinition *
267         GetDefinitions ();
268 
269         // Options table: Required for subclasses of Options.
270 
271         static OptionDefinition g_option_table[];
272 
273         // Instance variables to hold the values for command options.
274 
275         lldb::DescriptionLevel m_level;
276 
277         bool m_internal;
278     };
279 
280 private:
281     CommandOptions m_options;
282 };
283 
284 //-------------------------------------------------------------------------
285 // CommandObjectBreakpointClear
286 //-------------------------------------------------------------------------
287 
288 
289 class CommandObjectBreakpointClear : public CommandObject
290 {
291 public:
292 
293     typedef enum BreakpointClearType
294     {
295         eClearTypeInvalid,
296         eClearTypeFileAndLine
297     } BreakpointClearType;
298 
299     CommandObjectBreakpointClear (CommandInterpreter &interpreter);
300 
301     virtual
302     ~CommandObjectBreakpointClear ();
303 
304     virtual bool
305     Execute (Args& command,
306              CommandReturnObject &result);
307 
308     virtual Options *
309     GetOptions ();
310 
311     class CommandOptions : public Options
312     {
313     public:
314 
315         CommandOptions (CommandInterpreter &interpreter);
316 
317         virtual
318         ~CommandOptions ();
319 
320         virtual Error
321         SetOptionValue (uint32_t option_idx, const char *option_arg);
322 
323         void
324         OptionParsingStarting ();
325 
326         const OptionDefinition*
327         GetDefinitions ();
328 
329         // Options table: Required for subclasses of Options.
330 
331         static OptionDefinition g_option_table[];
332 
333         // Instance variables to hold the values for command options.
334 
335         std::string m_filename;
336         uint32_t m_line_num;
337 
338     };
339 
340 private:
341     CommandOptions m_options;
342 };
343 
344 //-------------------------------------------------------------------------
345 // CommandObjectBreakpointDelete
346 //-------------------------------------------------------------------------
347 
348 class CommandObjectBreakpointDelete : public CommandObject
349 {
350 public:
351     CommandObjectBreakpointDelete (CommandInterpreter &interpreter);
352 
353     virtual
354     ~CommandObjectBreakpointDelete ();
355 
356     virtual bool
357     Execute (Args& command,
358              CommandReturnObject &result);
359 
360 private:
361 };
362 
363 } // namespace lldb_private
364 
365 #endif  // liblldb_CommandObjectBreakpoint_h_
366