Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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" |
Jim Ingham | 84cdc15 | 2010-06-15 19:49:27 +0000 | [diff] [blame] | 21 | #include "lldb/Interpreter/Options.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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: |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 37 | CommandObjectBreakpointCommand (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 59 | CommandObjectBreakpointCommandAdd (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 60 | |
| 61 | virtual |
| 62 | ~CommandObjectBreakpointCommandAdd (); |
| 63 | |
| 64 | virtual bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 65 | Execute (Args& command, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 66 | CommandReturnObject &result); |
| 67 | |
| 68 | virtual Options * |
| 69 | GetOptions (); |
| 70 | |
| 71 | void |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 72 | CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 73 | CommandReturnObject &result); |
| 74 | |
Johnny Chen | 3e0571b | 2010-09-11 00:23:59 +0000 | [diff] [blame] | 75 | /// Set a one-liner as the callback for the breakpoint. |
Johnny Chen | b81ed0d | 2010-09-11 00:18:09 +0000 | [diff] [blame] | 76 | void |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 77 | SetBreakpointCommandCallback (BreakpointOptions *bp_options, |
Johnny Chen | b81ed0d | 2010-09-11 00:18:09 +0000 | [diff] [blame] | 78 | const char *oneliner); |
| 79 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 80 | static size_t |
| 81 | GenerateBreakpointCommandCallback (void *baton, |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 82 | InputReader &reader, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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 | |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 98 | CommandOptions (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 99 | |
| 100 | virtual |
| 101 | ~CommandOptions (); |
| 102 | |
| 103 | virtual Error |
| 104 | SetOptionValue (int option_idx, const char *option_arg); |
| 105 | |
| 106 | void |
| 107 | ResetOptionValues (); |
| 108 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 109 | const OptionDefinition* |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 110 | GetDefinitions (); |
| 111 | |
| 112 | // Options table: Required for subclasses of Options. |
| 113 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 114 | static OptionDefinition g_option_table[]; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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 Chen | b81ed0d | 2010-09-11 00:18:09 +0000 | [diff] [blame] | 121 | |
| 122 | // Instance variables to hold the values for one_liner options. |
| 123 | bool m_use_one_liner; |
| 124 | std::string m_one_liner; |
Jim Ingham | 949d5ac | 2011-02-18 00:54:25 +0000 | [diff] [blame] | 125 | bool m_stop_on_error; |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | private: |
| 129 | CommandOptions m_options; |
| 130 | }; |
| 131 | |
| 132 | //------------------------------------------------------------------------- |
| 133 | // CommandObjectBreakpointCommandRemove |
| 134 | //------------------------------------------------------------------------- |
| 135 | |
| 136 | class CommandObjectBreakpointCommandRemove : public CommandObject |
| 137 | { |
| 138 | public: |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 139 | CommandObjectBreakpointCommandRemove (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 140 | |
| 141 | virtual |
| 142 | ~CommandObjectBreakpointCommandRemove (); |
| 143 | |
| 144 | virtual bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 145 | Execute (Args& command, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 146 | CommandReturnObject &result); |
| 147 | |
| 148 | private: |
| 149 | }; |
| 150 | |
| 151 | //------------------------------------------------------------------------- |
| 152 | // CommandObjectBreakpointCommandList |
| 153 | //------------------------------------------------------------------------- |
| 154 | |
| 155 | class CommandObjectBreakpointCommandList : public CommandObject |
| 156 | { |
| 157 | public: |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 158 | CommandObjectBreakpointCommandList (CommandInterpreter &interpreter); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 159 | |
| 160 | virtual |
| 161 | ~CommandObjectBreakpointCommandList (); |
| 162 | |
| 163 | virtual bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 164 | Execute (Args& command, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 165 | CommandReturnObject &result); |
| 166 | |
| 167 | private: |
| 168 | }; |
| 169 | |
| 170 | |
| 171 | } // namespace lldb_private |
| 172 | |
| 173 | #endif // liblldb_CommandObjectBreakpointCommand_h_ |