1 //===-- CommandObjectBreakpointCommand.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_CommandObjectBreakpointCommand_h_
11 #define liblldb_CommandObjectBreakpointCommand_h_
12 
13 // C Includes
14 // C++ Includes
15 
16 
17 // Other libraries and framework includes
18 // Project includes
19 
20 #include "lldb/lldb-types.h"
21 #include "lldb/Interpreter/Options.h"
22 #include "lldb/Core/InputReader.h"
23 #include "lldb/Interpreter/CommandObject.h"
24 #include "lldb/Interpreter/CommandReturnObject.h"
25 #include "lldb/Interpreter/CommandObjectMultiword.h"
26 
27 
28 namespace lldb_private {
29 
30 //-------------------------------------------------------------------------
31 // CommandObjectMultiwordBreakpoint
32 //-------------------------------------------------------------------------
33 
34 class CommandObjectBreakpointCommand : public CommandObjectMultiword
35 {
36 public:
37     CommandObjectBreakpointCommand (CommandInterpreter &interpreter);
38 
39     virtual
40     ~CommandObjectBreakpointCommand ();
41 
42 
43     static bool
44     BreakpointOptionsCallbackFunction (void *baton,
45                                        StoppointCallbackContext *context,
46                                        lldb::user_id_t break_id,
47                                        lldb::user_id_t break_loc_id);
48 };
49 
50 //-------------------------------------------------------------------------
51 // CommandObjectBreakpointCommandAdd
52 //-------------------------------------------------------------------------
53 
54 
55 class CommandObjectBreakpointCommandAdd : public CommandObject
56 {
57 public:
58 
59     CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter);
60 
61     virtual
62     ~CommandObjectBreakpointCommandAdd ();
63 
64     virtual bool
65     Execute (Args& command,
66              CommandReturnObject &result);
67 
68     virtual Options *
69     GetOptions ();
70 
71     void
72     CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
73                                              CommandReturnObject &result);
74 
75     /// Set a one-liner as the callback for the breakpoint.
76     void
77     SetBreakpointCommandCallback (BreakpointOptions *bp_options,
78                                   const char *oneliner);
79 
80     static size_t
81     GenerateBreakpointCommandCallback (void *baton,
82                                        InputReader &reader,
83                                        lldb::InputReaderAction notification,
84                                        const char *bytes,
85                                        size_t bytes_len);
86 
87     static bool
88     BreakpointOptionsCallbackFunction (void *baton,
89                                        StoppointCallbackContext *context,
90                                        lldb::user_id_t break_id,
91                                        lldb::user_id_t break_loc_id);
92 
93 
94     class CommandOptions : public Options
95     {
96     public:
97 
98         CommandOptions (CommandInterpreter &interpreter);
99 
100         virtual
101         ~CommandOptions ();
102 
103         virtual Error
104         SetOptionValue (uint32_t option_idx, const char *option_arg);
105 
106         void
107         OptionParsingStarting ();
108 
109         const OptionDefinition*
110         GetDefinitions ();
111 
112         // Options table: Required for subclasses of Options.
113 
114         static OptionDefinition g_option_table[];
115 
116         // Instance variables to hold the values for command options.
117 
118         bool m_use_commands;
119         bool m_use_script_language;
120         lldb::ScriptLanguage m_script_language;
121 
122         // Instance variables to hold the values for one_liner options.
123         bool m_use_one_liner;
124         std::string m_one_liner;
125         bool m_stop_on_error;
126     };
127 
128 private:
129     CommandOptions m_options;
130 };
131 
132 //-------------------------------------------------------------------------
133 // CommandObjectBreakpointCommandDelete
134 //-------------------------------------------------------------------------
135 
136 class CommandObjectBreakpointCommandDelete : public CommandObject
137 {
138 public:
139     CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter);
140 
141     virtual
142     ~CommandObjectBreakpointCommandDelete ();
143 
144     virtual bool
145     Execute (Args& command,
146              CommandReturnObject &result);
147 
148 private:
149 };
150 
151 //-------------------------------------------------------------------------
152 // CommandObjectBreakpointCommandList
153 //-------------------------------------------------------------------------
154 
155 class CommandObjectBreakpointCommandList : public CommandObject
156 {
157 public:
158     CommandObjectBreakpointCommandList (CommandInterpreter &interpreter);
159 
160     virtual
161     ~CommandObjectBreakpointCommandList ();
162 
163     virtual bool
164     Execute (Args& command,
165              CommandReturnObject &result);
166 
167 private:
168 };
169 
170 
171 } // namespace lldb_private
172 
173 #endif  // liblldb_CommandObjectBreakpointCommand_h_
174