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 ();
99 
100         virtual
101         ~CommandOptions ();
102 
103         virtual Error
104         SetOptionValue (int option_idx, const char *option_arg);
105 
106         void
107         ResetOptionValues ();
108 
109         const lldb::OptionDefinition*
110         GetDefinitions ();
111 
112         // Options table: Required for subclasses of Options.
113 
114         static lldb::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     };
126 
127 private:
128     CommandOptions m_options;
129 };
130 
131 //-------------------------------------------------------------------------
132 // CommandObjectBreakpointCommandRemove
133 //-------------------------------------------------------------------------
134 
135 class CommandObjectBreakpointCommandRemove : public CommandObject
136 {
137 public:
138     CommandObjectBreakpointCommandRemove (CommandInterpreter &interpreter);
139 
140     virtual
141     ~CommandObjectBreakpointCommandRemove ();
142 
143     virtual bool
144     Execute (Args& command,
145              CommandReturnObject &result);
146 
147 private:
148 };
149 
150 //-------------------------------------------------------------------------
151 // CommandObjectBreakpointCommandList
152 //-------------------------------------------------------------------------
153 
154 class CommandObjectBreakpointCommandList : public CommandObject
155 {
156 public:
157     CommandObjectBreakpointCommandList (CommandInterpreter &interpreter);
158 
159     virtual
160     ~CommandObjectBreakpointCommandList ();
161 
162     virtual bool
163     Execute (Args& command,
164              CommandReturnObject &result);
165 
166 private:
167 };
168 
169 
170 } // namespace lldb_private
171 
172 #endif  // liblldb_CommandObjectBreakpointCommand_h_
173