blob: 51131d2ee040c36c6be6935936f42aaf807ac7f6 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- 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"
Jim Ingham84cdc152010-06-15 19:49:27 +000021#include "lldb/Interpreter/Options.h"
Chris Lattner24943d22010-06-08 16:52:24 +000022#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
28namespace lldb_private {
29
30//-------------------------------------------------------------------------
31// CommandObjectMultiwordBreakpoint
32//-------------------------------------------------------------------------
33
34class CommandObjectBreakpointCommand : public CommandObjectMultiword
35{
36public:
Greg Clayton63094e02010-06-23 01:19:29 +000037 CommandObjectBreakpointCommand (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000038
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
55class CommandObjectBreakpointCommandAdd : public CommandObject
56{
57public:
58
Greg Clayton238c0a12010-09-18 01:14:36 +000059 CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000060
61 virtual
62 ~CommandObjectBreakpointCommandAdd ();
63
64 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +000065 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +000066 CommandReturnObject &result);
67
68 virtual Options *
69 GetOptions ();
70
71 void
Greg Clayton238c0a12010-09-18 01:14:36 +000072 CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options,
Chris Lattner24943d22010-06-08 16:52:24 +000073 CommandReturnObject &result);
74
Johnny Chen3e0571b2010-09-11 00:23:59 +000075 /// Set a one-liner as the callback for the breakpoint.
Johnny Chenb81ed0d2010-09-11 00:18:09 +000076 void
Greg Clayton238c0a12010-09-18 01:14:36 +000077 SetBreakpointCommandCallback (BreakpointOptions *bp_options,
Johnny Chenb81ed0d2010-09-11 00:18:09 +000078 const char *oneliner);
79
Chris Lattner24943d22010-06-08 16:52:24 +000080 static size_t
81 GenerateBreakpointCommandCallback (void *baton,
Greg Clayton63094e02010-06-23 01:19:29 +000082 InputReader &reader,
Chris Lattner24943d22010-06-08 16:52:24 +000083 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;
Johnny Chenb81ed0d2010-09-11 00:18:09 +0000121
122 // Instance variables to hold the values for one_liner options.
123 bool m_use_one_liner;
124 std::string m_one_liner;
Jim Ingham949d5ac2011-02-18 00:54:25 +0000125 bool m_stop_on_error;
Chris Lattner24943d22010-06-08 16:52:24 +0000126 };
127
128private:
129 CommandOptions m_options;
130};
131
132//-------------------------------------------------------------------------
133// CommandObjectBreakpointCommandRemove
134//-------------------------------------------------------------------------
135
136class CommandObjectBreakpointCommandRemove : public CommandObject
137{
138public:
Greg Clayton238c0a12010-09-18 01:14:36 +0000139 CommandObjectBreakpointCommandRemove (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +0000140
141 virtual
142 ~CommandObjectBreakpointCommandRemove ();
143
144 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +0000145 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000146 CommandReturnObject &result);
147
148private:
149};
150
151//-------------------------------------------------------------------------
152// CommandObjectBreakpointCommandList
153//-------------------------------------------------------------------------
154
155class CommandObjectBreakpointCommandList : public CommandObject
156{
157public:
Greg Clayton238c0a12010-09-18 01:14:36 +0000158 CommandObjectBreakpointCommandList (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +0000159
160 virtual
161 ~CommandObjectBreakpointCommandList ();
162
163 virtual bool
Greg Clayton238c0a12010-09-18 01:14:36 +0000164 Execute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000165 CommandReturnObject &result);
166
167private:
168};
169
170
171} // namespace lldb_private
172
173#endif // liblldb_CommandObjectBreakpointCommand_h_