Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- CommandObjectFrame.cpp ----------------------------------*- 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 | #include "CommandObjectFrame.h" |
| 11 | |
| 12 | // C Includes |
| 13 | // C++ Includes |
| 14 | // Other libraries and framework includes |
| 15 | // Project includes |
Enrico Granata | 0be2e9b | 2011-08-22 22:03:47 +0000 | [diff] [blame] | 16 | #include "lldb/Core/DataVisualization.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 17 | #include "lldb/Core/Debugger.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 18 | #include "lldb/Core/Module.h" |
| 19 | #include "lldb/Core/StreamFile.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 20 | #include "lldb/Core/Timer.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 21 | #include "lldb/Core/Value.h" |
| 22 | #include "lldb/Core/ValueObject.h" |
| 23 | #include "lldb/Core/ValueObjectVariable.h" |
Greg Clayton | cd54803 | 2011-02-01 01:31:41 +0000 | [diff] [blame] | 24 | #include "lldb/Host/Host.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 25 | #include "lldb/Interpreter/Args.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 26 | #include "lldb/Interpreter/CommandInterpreter.h" |
| 27 | #include "lldb/Interpreter/CommandReturnObject.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 28 | #include "lldb/Interpreter/Options.h" |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 29 | #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 30 | #include "lldb/Interpreter/OptionGroupVariable.h" |
Johnny Chen | 58dba3c | 2011-09-09 23:25:26 +0000 | [diff] [blame] | 31 | #include "lldb/Interpreter/OptionGroupWatchpoint.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 32 | #include "lldb/Symbol/ClangASTType.h" |
| 33 | #include "lldb/Symbol/ClangASTContext.h" |
| 34 | #include "lldb/Symbol/ObjectFile.h" |
| 35 | #include "lldb/Symbol/SymbolContext.h" |
| 36 | #include "lldb/Symbol/Type.h" |
| 37 | #include "lldb/Symbol/Variable.h" |
| 38 | #include "lldb/Symbol/VariableList.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 39 | #include "lldb/Target/Process.h" |
| 40 | #include "lldb/Target/StackFrame.h" |
| 41 | #include "lldb/Target/Thread.h" |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 42 | #include "lldb/Target/Target.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 43 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 44 | using namespace lldb; |
| 45 | using namespace lldb_private; |
| 46 | |
| 47 | #pragma mark CommandObjectFrameInfo |
| 48 | |
| 49 | //------------------------------------------------------------------------- |
| 50 | // CommandObjectFrameInfo |
| 51 | //------------------------------------------------------------------------- |
| 52 | |
| 53 | class CommandObjectFrameInfo : public CommandObject |
| 54 | { |
| 55 | public: |
| 56 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 57 | CommandObjectFrameInfo (CommandInterpreter &interpreter) : |
| 58 | CommandObject (interpreter, |
| 59 | "frame info", |
| 60 | "List information about the currently selected frame in the current thread.", |
| 61 | "frame info", |
| 62 | eFlagProcessMustBeLaunched | eFlagProcessMustBePaused) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 63 | { |
| 64 | } |
| 65 | |
| 66 | ~CommandObjectFrameInfo () |
| 67 | { |
| 68 | } |
| 69 | |
| 70 | bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 71 | Execute (Args& command, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 72 | CommandReturnObject &result) |
| 73 | { |
Greg Clayton | b72d0f0 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 74 | ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 75 | if (exe_ctx.frame) |
| 76 | { |
Greg Clayton | a830adb | 2010-10-04 01:05:56 +0000 | [diff] [blame] | 77 | exe_ctx.frame->DumpUsingSettingsFormat (&result.GetOutputStream()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 78 | result.SetStatus (eReturnStatusSuccessFinishResult); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | result.AppendError ("no current frame"); |
| 83 | result.SetStatus (eReturnStatusFailed); |
| 84 | } |
| 85 | return result.Succeeded(); |
| 86 | } |
| 87 | }; |
| 88 | |
| 89 | #pragma mark CommandObjectFrameSelect |
| 90 | |
| 91 | //------------------------------------------------------------------------- |
| 92 | // CommandObjectFrameSelect |
| 93 | //------------------------------------------------------------------------- |
| 94 | |
| 95 | class CommandObjectFrameSelect : public CommandObject |
| 96 | { |
| 97 | public: |
| 98 | |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 99 | class CommandOptions : public Options |
| 100 | { |
| 101 | public: |
| 102 | |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 103 | CommandOptions (CommandInterpreter &interpreter) : |
Johnny Chen | 9335643 | 2011-04-08 22:39:17 +0000 | [diff] [blame] | 104 | Options(interpreter) |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 105 | { |
Greg Clayton | 143fcc3 | 2011-04-13 00:18:08 +0000 | [diff] [blame] | 106 | OptionParsingStarting (); |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | virtual |
| 110 | ~CommandOptions () |
| 111 | { |
| 112 | } |
| 113 | |
| 114 | virtual Error |
Greg Clayton | 143fcc3 | 2011-04-13 00:18:08 +0000 | [diff] [blame] | 115 | SetOptionValue (uint32_t option_idx, const char *option_arg) |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 116 | { |
| 117 | Error error; |
| 118 | bool success = false; |
| 119 | char short_option = (char) m_getopt_table[option_idx].val; |
| 120 | switch (short_option) |
| 121 | { |
| 122 | case 'r': |
| 123 | relative_frame_offset = Args::StringToSInt32 (option_arg, INT32_MIN, 0, &success); |
| 124 | if (!success) |
| 125 | error.SetErrorStringWithFormat ("invalid frame offset argument '%s'.\n", option_arg); |
| 126 | break; |
| 127 | |
| 128 | default: |
Benjamin Kramer | fddc25a | 2010-11-10 20:16:47 +0000 | [diff] [blame] | 129 | error.SetErrorStringWithFormat ("Invalid short option character '%c'.\n", short_option); |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 130 | break; |
| 131 | } |
| 132 | |
| 133 | return error; |
| 134 | } |
| 135 | |
| 136 | void |
Greg Clayton | 143fcc3 | 2011-04-13 00:18:08 +0000 | [diff] [blame] | 137 | OptionParsingStarting () |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 138 | { |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 139 | relative_frame_offset = INT32_MIN; |
| 140 | } |
| 141 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 142 | const OptionDefinition* |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 143 | GetDefinitions () |
| 144 | { |
| 145 | return g_option_table; |
| 146 | } |
| 147 | |
| 148 | // Options table: Required for subclasses of Options. |
| 149 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 150 | static OptionDefinition g_option_table[]; |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 151 | int32_t relative_frame_offset; |
| 152 | }; |
| 153 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 154 | CommandObjectFrameSelect (CommandInterpreter &interpreter) : |
| 155 | CommandObject (interpreter, |
| 156 | "frame select", |
| 157 | "Select a frame by index from within the current thread and make it the current frame.", |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 158 | NULL, |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 159 | eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), |
| 160 | m_options (interpreter) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 161 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 162 | CommandArgumentEntry arg; |
| 163 | CommandArgumentData index_arg; |
| 164 | |
| 165 | // Define the first (and only) variant of this arg. |
| 166 | index_arg.arg_type = eArgTypeFrameIndex; |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 167 | index_arg.arg_repetition = eArgRepeatOptional; |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 168 | |
| 169 | // There is only one variant this argument could be; put it into the argument entry. |
| 170 | arg.push_back (index_arg); |
| 171 | |
| 172 | // Push the data for the first argument into the m_arguments vector. |
| 173 | m_arguments.push_back (arg); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | ~CommandObjectFrameSelect () |
| 177 | { |
| 178 | } |
| 179 | |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 180 | virtual |
| 181 | Options * |
| 182 | GetOptions () |
| 183 | { |
| 184 | return &m_options; |
| 185 | } |
| 186 | |
| 187 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 188 | bool |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 189 | Execute (Args& command, |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 190 | CommandReturnObject &result) |
| 191 | { |
Greg Clayton | b72d0f0 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 192 | ExecutionContext exe_ctx (m_interpreter.GetExecutionContext()); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 193 | if (exe_ctx.thread) |
| 194 | { |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 195 | const uint32_t num_frames = exe_ctx.thread->GetStackFrameCount(); |
| 196 | uint32_t frame_idx = UINT32_MAX; |
| 197 | if (m_options.relative_frame_offset != INT32_MIN) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 198 | { |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 199 | // The one and only argument is a signed relative frame index |
| 200 | frame_idx = exe_ctx.thread->GetSelectedFrameIndex (); |
| 201 | if (frame_idx == UINT32_MAX) |
| 202 | frame_idx = 0; |
| 203 | |
| 204 | if (m_options.relative_frame_offset < 0) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 205 | { |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 206 | if (frame_idx >= -m_options.relative_frame_offset) |
| 207 | frame_idx += m_options.relative_frame_offset; |
| 208 | else |
Jim Ingham | d9fa9d7 | 2011-09-08 01:15:09 +0000 | [diff] [blame] | 209 | { |
| 210 | if (frame_idx == 0) |
| 211 | { |
| 212 | //If you are already at the bottom of the stack, then just warn and don't reset the frame. |
| 213 | result.AppendError("Already at the bottom of the stack"); |
| 214 | result.SetStatus(eReturnStatusFailed); |
| 215 | return false; |
| 216 | } |
| 217 | else |
| 218 | frame_idx = 0; |
| 219 | } |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 220 | } |
| 221 | else if (m_options.relative_frame_offset > 0) |
| 222 | { |
| 223 | if (num_frames - frame_idx > m_options.relative_frame_offset) |
| 224 | frame_idx += m_options.relative_frame_offset; |
| 225 | else |
Jim Ingham | d9fa9d7 | 2011-09-08 01:15:09 +0000 | [diff] [blame] | 226 | { |
| 227 | if (frame_idx == num_frames - 1) |
| 228 | { |
| 229 | //If we are already at the top of the stack, just warn and don't reset the frame. |
| 230 | result.AppendError("Already at the top of the stack"); |
| 231 | result.SetStatus(eReturnStatusFailed); |
| 232 | return false; |
| 233 | } |
| 234 | else |
| 235 | frame_idx = num_frames - 1; |
| 236 | } |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 237 | } |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | if (command.GetArgumentCount() == 1) |
| 242 | { |
| 243 | const char *frame_idx_cstr = command.GetArgumentAtIndex(0); |
| 244 | frame_idx = Args::StringToUInt32 (frame_idx_cstr, UINT32_MAX, 0); |
| 245 | } |
| 246 | else |
| 247 | { |
| 248 | result.AppendError ("invalid arguments.\n"); |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 249 | m_options.GenerateOptionUsage (result.GetErrorStream(), this); |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 250 | } |
| 251 | } |
| 252 | |
| 253 | if (frame_idx < num_frames) |
| 254 | { |
| 255 | exe_ctx.thread->SetSelectedFrameByIndex (frame_idx); |
| 256 | exe_ctx.frame = exe_ctx.thread->GetSelectedFrame ().get(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 257 | |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 258 | if (exe_ctx.frame) |
| 259 | { |
| 260 | bool already_shown = false; |
| 261 | SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry)); |
| 262 | if (m_interpreter.GetDebugger().GetUseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0) |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 263 | { |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 264 | already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line); |
| 265 | } |
Jim Ingham | 74989e8 | 2010-08-30 19:44:40 +0000 | [diff] [blame] | 266 | |
Greg Clayton | abe0fed | 2011-04-18 08:33:37 +0000 | [diff] [blame] | 267 | bool show_frame_info = true; |
| 268 | bool show_source = !already_shown; |
| 269 | uint32_t source_lines_before = 3; |
| 270 | uint32_t source_lines_after = 3; |
| 271 | if (exe_ctx.frame->GetStatus(result.GetOutputStream(), |
| 272 | show_frame_info, |
| 273 | show_source, |
| 274 | source_lines_before, |
| 275 | source_lines_after)) |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 276 | { |
| 277 | result.SetStatus (eReturnStatusSuccessFinishResult); |
| 278 | return result.Succeeded(); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 279 | } |
| 280 | } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 281 | } |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 282 | result.AppendErrorWithFormat ("Frame index (%u) out of range.\n", frame_idx); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 283 | } |
| 284 | else |
| 285 | { |
| 286 | result.AppendError ("no current thread"); |
| 287 | } |
| 288 | result.SetStatus (eReturnStatusFailed); |
| 289 | return false; |
| 290 | } |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 291 | protected: |
| 292 | |
| 293 | CommandOptions m_options; |
| 294 | }; |
| 295 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 296 | OptionDefinition |
Greg Clayton | c12b6b4 | 2010-10-10 22:28:11 +0000 | [diff] [blame] | 297 | CommandObjectFrameSelect::CommandOptions::g_option_table[] = |
| 298 | { |
| 299 | { LLDB_OPT_SET_1, false, "relative", 'r', required_argument, NULL, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."}, |
| 300 | { 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL } |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 301 | }; |
| 302 | |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 303 | #pragma mark CommandObjectFrameVariable |
| 304 | //---------------------------------------------------------------------- |
| 305 | // List images with associated information |
| 306 | //---------------------------------------------------------------------- |
| 307 | class CommandObjectFrameVariable : public CommandObject |
| 308 | { |
| 309 | public: |
| 310 | |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 311 | CommandObjectFrameVariable (CommandInterpreter &interpreter) : |
| 312 | CommandObject (interpreter, |
| 313 | "frame variable", |
Greg Clayton | fe424a9 | 2010-09-18 03:37:20 +0000 | [diff] [blame] | 314 | "Show frame variables. All argument and local variables " |
| 315 | "that are in scope will be shown when no arguments are given. " |
| 316 | "If any arguments are specified, they can be names of " |
Johnny Chen | 17a661c | 2010-10-25 23:57:26 +0000 | [diff] [blame] | 317 | "argument, local, file static and file global variables. " |
Greg Clayton | fe424a9 | 2010-09-18 03:37:20 +0000 | [diff] [blame] | 318 | "Children of aggregate variables can be specified such as " |
Johnny Chen | 58dba3c | 2011-09-09 23:25:26 +0000 | [diff] [blame] | 319 | "'var->child.x'. " |
| 320 | "NOTE that '-w' option is not working yet!!! " |
| 321 | "You can choose to watch a variable with the '-w' option. " |
| 322 | "Note that hardware resources for watching are often limited.", |
Jim Ingham | a7a9c89 | 2010-12-23 02:17:54 +0000 | [diff] [blame] | 323 | NULL, |
Greg Clayton | f15996e | 2011-04-07 22:46:35 +0000 | [diff] [blame] | 324 | eFlagProcessMustBeLaunched | eFlagProcessMustBePaused), |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 325 | m_option_group (interpreter), |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 326 | m_option_variable(true), // Include the frame specific options by passing "true" |
Johnny Chen | 58dba3c | 2011-09-09 23:25:26 +0000 | [diff] [blame] | 327 | m_option_watchpoint(), |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 328 | m_varobj_options() |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 329 | { |
Caroline Tice | 43b014a | 2010-10-04 22:28:36 +0000 | [diff] [blame] | 330 | CommandArgumentEntry arg; |
| 331 | CommandArgumentData var_name_arg; |
| 332 | |
| 333 | // Define the first (and only) variant of this arg. |
| 334 | var_name_arg.arg_type = eArgTypeVarName; |
| 335 | var_name_arg.arg_repetition = eArgRepeatStar; |
| 336 | |
| 337 | // There is only one variant this argument could be; put it into the argument entry. |
| 338 | arg.push_back (var_name_arg); |
| 339 | |
| 340 | // Push the data for the first argument into the m_arguments vector. |
| 341 | m_arguments.push_back (arg); |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 342 | |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 343 | m_option_group.Append (&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); |
Johnny Chen | 58dba3c | 2011-09-09 23:25:26 +0000 | [diff] [blame] | 344 | m_option_group.Append (&m_option_watchpoint, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 345 | m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); |
| 346 | m_option_group.Finalize(); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | virtual |
| 350 | ~CommandObjectFrameVariable () |
| 351 | { |
| 352 | } |
| 353 | |
| 354 | virtual |
| 355 | Options * |
| 356 | GetOptions () |
| 357 | { |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 358 | return &m_option_group; |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 359 | } |
| 360 | |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 361 | |
| 362 | virtual bool |
| 363 | Execute |
| 364 | ( |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 365 | Args& command, |
| 366 | CommandReturnObject &result |
| 367 | ) |
| 368 | { |
Greg Clayton | b72d0f0 | 2011-04-12 05:54:46 +0000 | [diff] [blame] | 369 | ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 370 | if (exe_ctx.frame == NULL) |
| 371 | { |
Greg Clayton | aa44805 | 2010-09-18 04:06:15 +0000 | [diff] [blame] | 372 | result.AppendError ("you must be stopped in a valid stack frame to view frame variables."); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 373 | result.SetStatus (eReturnStatusFailed); |
| 374 | return false; |
| 375 | } |
| 376 | else |
| 377 | { |
Greg Clayton | aed5881 | 2010-09-13 02:37:44 +0000 | [diff] [blame] | 378 | Stream &s = result.GetOutputStream(); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 379 | |
Greg Clayton | aed5881 | 2010-09-13 02:37:44 +0000 | [diff] [blame] | 380 | bool get_file_globals = true; |
Jim Ingham | 994aba0 | 2011-08-27 01:22:52 +0000 | [diff] [blame] | 381 | |
| 382 | // Be careful about the stack frame, if any summary formatter runs code, it might clear the StackFrameList |
| 383 | // for the thread. So hold onto a shared pointer to the frame so it stays alive. |
| 384 | |
| 385 | StackFrameSP frame_sp = exe_ctx.frame->GetSP(); |
| 386 | |
| 387 | VariableList *variable_list = frame_sp->GetVariableList (get_file_globals); |
Greg Clayton | aed5881 | 2010-09-13 02:37:44 +0000 | [diff] [blame] | 388 | |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 389 | VariableSP var_sp; |
| 390 | ValueObjectSP valobj_sp; |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 391 | |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 392 | const char *name_cstr = NULL; |
| 393 | size_t idx; |
Enrico Granata | 1a10208 | 2011-07-12 00:18:11 +0000 | [diff] [blame] | 394 | |
| 395 | SummaryFormatSP summary_format_sp; |
| 396 | if (!m_option_variable.summary.empty()) |
Enrico Granata | 3b23d20 | 2011-09-09 23:33:14 +0000 | [diff] [blame] | 397 | DataVisualization::NamedSummaryFormats::GetSummaryFormat(ConstString(m_option_variable.summary.c_str()), summary_format_sp); |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame] | 398 | |
| 399 | ValueObject::DumpValueObjectOptions options; |
| 400 | |
| 401 | options.SetPointerDepth(m_varobj_options.ptr_depth) |
| 402 | .SetMaximumDepth(m_varobj_options.max_depth) |
| 403 | .SetShowTypes(m_varobj_options.show_types) |
| 404 | .SetShowLocation(m_varobj_options.show_location) |
| 405 | .SetUseObjectiveC(m_varobj_options.use_objc) |
| 406 | .SetUseDynamicType(m_varobj_options.use_dynamic) |
| 407 | .SetUseSyntheticValue((lldb::SyntheticValueType)m_varobj_options.use_synth) |
| 408 | .SetFlatOutput(m_varobj_options.flat_output) |
| 409 | .SetOmitSummaryDepth(m_varobj_options.no_summary_depth) |
| 410 | .SetIgnoreCap(m_varobj_options.ignore_cap); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 411 | |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame] | 412 | if (m_varobj_options.be_raw) |
| 413 | options.SetRawDisplay(true); |
| 414 | |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 415 | if (variable_list) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 416 | { |
Johnny Chen | 3066b25 | 2011-09-12 19:12:06 +0000 | [diff] [blame] | 417 | // If watching a variable, there are certain restrictions to be followed. |
| 418 | if (m_option_watchpoint.watch_variable) |
| 419 | { |
| 420 | if (command.GetArgumentCount() != 1) { |
| 421 | result.GetErrorStream().Printf("error: specify exactly one variable when using the '-w' option\n"); |
| 422 | result.SetStatus(eReturnStatusFailed); |
| 423 | return false; |
| 424 | } else if (m_option_variable.use_regex) { |
| 425 | result.GetErrorStream().Printf("error: specify your variable name exactly (no regex) when using the '-w' option\n"); |
| 426 | result.SetStatus(eReturnStatusFailed); |
| 427 | return false; |
| 428 | } |
| 429 | |
| 430 | // Things have checked out ok... |
| 431 | // m_option_watchpoint.watch_mode specifies the mode for watching. |
| 432 | } |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 433 | if (command.GetArgumentCount() > 0) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 434 | { |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 435 | VariableList regex_var_list; |
| 436 | |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 437 | // If we have any args to the variable command, we will make |
| 438 | // variable objects from them... |
| 439 | for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != NULL; ++idx) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 440 | { |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 441 | if (m_option_variable.use_regex) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 442 | { |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 443 | const uint32_t regex_start_index = regex_var_list.GetSize(); |
| 444 | RegularExpression regex (name_cstr); |
| 445 | if (regex.Compile(name_cstr)) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 446 | { |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 447 | size_t num_matches = 0; |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 448 | const size_t num_new_regex_vars = variable_list->AppendVariablesIfUnique(regex, |
| 449 | regex_var_list, |
| 450 | num_matches); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 451 | if (num_new_regex_vars > 0) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 452 | { |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 453 | for (uint32_t regex_idx = regex_start_index, end_index = regex_var_list.GetSize(); |
| 454 | regex_idx < end_index; |
| 455 | ++regex_idx) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 456 | { |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 457 | var_sp = regex_var_list.GetVariableAtIndex (regex_idx); |
| 458 | if (var_sp) |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 459 | { |
Jim Ingham | 994aba0 | 2011-08-27 01:22:52 +0000 | [diff] [blame] | 460 | valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 461 | if (valobj_sp) |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 462 | { |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 463 | if (m_option_variable.format != eFormatDefault) |
| 464 | valobj_sp->SetFormat (m_option_variable.format); |
Greg Clayton | b1888f2 | 2011-03-19 01:12:21 +0000 | [diff] [blame] | 465 | |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 466 | if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile()) |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 467 | { |
Greg Clayton | fb81642 | 2011-07-10 19:21:23 +0000 | [diff] [blame] | 468 | bool show_fullpaths = false; |
| 469 | bool show_module = true; |
| 470 | if (var_sp->DumpDeclaration(&s, show_fullpaths, show_module)) |
| 471 | s.PutCString (": "); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 472 | } |
Enrico Granata | 1a10208 | 2011-07-12 00:18:11 +0000 | [diff] [blame] | 473 | if (summary_format_sp) |
| 474 | valobj_sp->SetCustomSummaryFormat(summary_format_sp); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 475 | ValueObject::DumpValueObject (result.GetOutputStream(), |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame] | 476 | valobj_sp.get(), |
| 477 | options); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 478 | } |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | else if (num_matches == 0) |
| 483 | { |
| 484 | result.GetErrorStream().Printf ("error: no variables matched the regular expression '%s'.\n", name_cstr); |
| 485 | } |
| 486 | } |
| 487 | else |
| 488 | { |
| 489 | char regex_error[1024]; |
| 490 | if (regex.GetErrorAsCString(regex_error, sizeof(regex_error))) |
| 491 | result.GetErrorStream().Printf ("error: %s\n", regex_error); |
| 492 | else |
| 493 | result.GetErrorStream().Printf ("error: unkown regex error when compiling '%s'\n", name_cstr); |
| 494 | } |
| 495 | } |
Johnny Chen | 34bbf85 | 2011-09-12 23:38:44 +0000 | [diff] [blame^] | 496 | else // No regex, either exact variable names or variable expressions. |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 497 | { |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 498 | Error error; |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 499 | uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember; |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 500 | lldb::VariableSP var_sp; |
Jim Ingham | 994aba0 | 2011-08-27 01:22:52 +0000 | [diff] [blame] | 501 | valobj_sp = frame_sp->GetValueForVariableExpressionPath (name_cstr, |
Johnny Chen | ca3e91a | 2011-09-12 20:25:57 +0000 | [diff] [blame] | 502 | m_varobj_options.use_dynamic, |
| 503 | expr_path_options, |
| 504 | var_sp, |
| 505 | error); |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 506 | if (valobj_sp) |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 507 | { |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 508 | if (m_option_variable.format != eFormatDefault) |
| 509 | valobj_sp->SetFormat (m_option_variable.format); |
| 510 | if (m_option_variable.show_decl && var_sp && var_sp->GetDeclaration ().GetFile()) |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 511 | { |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 512 | var_sp->GetDeclaration ().DumpStopContext (&s, false); |
| 513 | s.PutCString (": "); |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 514 | } |
Enrico Granata | 1a10208 | 2011-07-12 00:18:11 +0000 | [diff] [blame] | 515 | if (summary_format_sp) |
| 516 | valobj_sp->SetCustomSummaryFormat(summary_format_sp); |
Johnny Chen | 34bbf85 | 2011-09-12 23:38:44 +0000 | [diff] [blame^] | 517 | |
| 518 | Stream &output_stream = result.GetOutputStream(); |
| 519 | ValueObject::DumpValueObject (output_stream, |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 520 | valobj_sp.get(), |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame] | 521 | valobj_sp->GetParent() ? name_cstr : NULL, |
| 522 | options); |
Johnny Chen | 34bbf85 | 2011-09-12 23:38:44 +0000 | [diff] [blame^] | 523 | // Process watchpoint if necessary. |
| 524 | if (m_option_watchpoint.watch_variable) |
| 525 | { |
| 526 | lldb::addr_t addr = LLDB_INVALID_ADDRESS; |
| 527 | size_t size = 0; |
| 528 | uint32_t watch_type = m_option_watchpoint.watch_type; |
| 529 | WatchpointLocation *wp_loc = |
| 530 | exe_ctx.target->CreateWatchpointLocation(addr, size, watch_type).get(); |
| 531 | if (wp_loc) |
| 532 | { |
| 533 | output_stream.Printf("Watchpoint created: "); |
| 534 | wp_loc->GetDescription(&output_stream, lldb::eDescriptionLevelBrief); |
| 535 | output_stream.EOL(); |
| 536 | result.SetStatus(eReturnStatusSuccessFinishResult); |
| 537 | } |
| 538 | else |
| 539 | { |
| 540 | result.AppendErrorWithFormat("Watchpoint creation failed.\n"); |
| 541 | result.SetStatus(eReturnStatusFailed); |
| 542 | } |
| 543 | return (wp_loc != NULL); |
| 544 | } |
Greg Clayton | aed5881 | 2010-09-13 02:37:44 +0000 | [diff] [blame] | 545 | } |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 546 | else |
| 547 | { |
Greg Clayton | c3b61d2 | 2010-12-15 05:08:08 +0000 | [diff] [blame] | 548 | const char *error_cstr = error.AsCString(NULL); |
| 549 | if (error_cstr) |
| 550 | result.GetErrorStream().Printf("error: %s\n", error_cstr); |
| 551 | else |
| 552 | result.GetErrorStream().Printf ("error: unable to find any variable expression path that matches '%s'\n", name_cstr); |
Greg Clayton | 6bc0b5d | 2010-10-10 23:55:27 +0000 | [diff] [blame] | 553 | } |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 554 | } |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 555 | } |
| 556 | } |
Johnny Chen | ca3e91a | 2011-09-12 20:25:57 +0000 | [diff] [blame] | 557 | else // No command arg specified. Use variable_list, instead. |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 558 | { |
| 559 | const uint32_t num_variables = variable_list->GetSize(); |
| 560 | |
| 561 | if (num_variables > 0) |
| 562 | { |
| 563 | for (uint32_t i=0; i<num_variables; i++) |
| 564 | { |
Greg Clayton | bdcb6ab | 2011-01-25 23:55:37 +0000 | [diff] [blame] | 565 | var_sp = variable_list->GetVariableAtIndex(i); |
Jim Ingham | e41494a | 2011-04-16 00:01:13 +0000 | [diff] [blame] | 566 | |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 567 | bool dump_variable = true; |
| 568 | |
| 569 | switch (var_sp->GetScope()) |
| 570 | { |
| 571 | case eValueTypeVariableGlobal: |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 572 | dump_variable = m_option_variable.show_globals; |
| 573 | if (dump_variable && m_option_variable.show_scope) |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 574 | s.PutCString("GLOBAL: "); |
| 575 | break; |
| 576 | |
| 577 | case eValueTypeVariableStatic: |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 578 | dump_variable = m_option_variable.show_globals; |
| 579 | if (dump_variable && m_option_variable.show_scope) |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 580 | s.PutCString("STATIC: "); |
| 581 | break; |
| 582 | |
| 583 | case eValueTypeVariableArgument: |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 584 | dump_variable = m_option_variable.show_args; |
| 585 | if (dump_variable && m_option_variable.show_scope) |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 586 | s.PutCString(" ARG: "); |
| 587 | break; |
| 588 | |
| 589 | case eValueTypeVariableLocal: |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 590 | dump_variable = m_option_variable.show_locals; |
| 591 | if (dump_variable && m_option_variable.show_scope) |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 592 | s.PutCString(" LOCAL: "); |
| 593 | break; |
| 594 | |
| 595 | default: |
| 596 | break; |
| 597 | } |
| 598 | |
| 599 | if (dump_variable) |
| 600 | { |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 601 | |
| 602 | // Use the variable object code to make sure we are |
| 603 | // using the same APIs as the the public API will be |
| 604 | // using... |
Jim Ingham | 994aba0 | 2011-08-27 01:22:52 +0000 | [diff] [blame] | 605 | valobj_sp = frame_sp->GetValueObjectForFrameVariable (var_sp, |
Johnny Chen | 677aabd | 2011-09-08 23:52:06 +0000 | [diff] [blame] | 606 | m_varobj_options.use_dynamic); |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 607 | if (valobj_sp) |
| 608 | { |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 609 | if (m_option_variable.format != eFormatDefault) |
| 610 | valobj_sp->SetFormat (m_option_variable.format); |
Greg Clayton | b1888f2 | 2011-03-19 01:12:21 +0000 | [diff] [blame] | 611 | |
Greg Clayton | a357ecf | 2010-09-14 03:16:58 +0000 | [diff] [blame] | 612 | // When dumping all variables, don't print any variables |
| 613 | // that are not in scope to avoid extra unneeded output |
Jim Ingham | fa3a16a | 2011-03-31 00:19:25 +0000 | [diff] [blame] | 614 | if (valobj_sp->IsInScope ()) |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 615 | { |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 616 | if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile()) |
Greg Clayton | a357ecf | 2010-09-14 03:16:58 +0000 | [diff] [blame] | 617 | { |
| 618 | var_sp->GetDeclaration ().DumpStopContext (&s, false); |
| 619 | s.PutCString (": "); |
| 620 | } |
Enrico Granata | 1a10208 | 2011-07-12 00:18:11 +0000 | [diff] [blame] | 621 | if (summary_format_sp) |
| 622 | valobj_sp->SetCustomSummaryFormat(summary_format_sp); |
Greg Clayton | 66ed2fb | 2010-10-05 00:00:42 +0000 | [diff] [blame] | 623 | ValueObject::DumpValueObject (result.GetOutputStream(), |
Greg Clayton | 66ed2fb | 2010-10-05 00:00:42 +0000 | [diff] [blame] | 624 | valobj_sp.get(), |
Enrico Granata | 19030d8 | 2011-08-15 18:01:31 +0000 | [diff] [blame] | 625 | name_cstr, |
| 626 | options); |
Greg Clayton | a357ecf | 2010-09-14 03:16:58 +0000 | [diff] [blame] | 627 | } |
Greg Clayton | c0cf52d | 2010-09-13 03:44:33 +0000 | [diff] [blame] | 628 | } |
| 629 | } |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | result.SetStatus (eReturnStatusSuccessFinishResult); |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 634 | } |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 635 | } |
Enrico Granata | db64d95 | 2011-08-12 16:42:31 +0000 | [diff] [blame] | 636 | |
| 637 | if (m_interpreter.TruncationWarningNecessary()) |
| 638 | { |
| 639 | result.GetOutputStream().Printf(m_interpreter.TruncationWarningText(), |
| 640 | m_cmd_name.c_str()); |
| 641 | m_interpreter.TruncationWarningGiven(); |
| 642 | } |
| 643 | |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 644 | return result.Succeeded(); |
| 645 | } |
| 646 | protected: |
| 647 | |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 648 | OptionGroupOptions m_option_group; |
Greg Clayton | 368f822 | 2011-07-07 04:38:25 +0000 | [diff] [blame] | 649 | OptionGroupVariable m_option_variable; |
Johnny Chen | 58dba3c | 2011-09-09 23:25:26 +0000 | [diff] [blame] | 650 | OptionGroupWatchpoint m_option_watchpoint; |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 651 | OptionGroupValueObjectDisplay m_varobj_options; |
Jim Ingham | 537926c | 2010-09-02 00:18:39 +0000 | [diff] [blame] | 652 | }; |
| 653 | |
Jim Ingham | 10de7d1 | 2011-05-04 03:43:18 +0000 | [diff] [blame] | 654 | |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 655 | #pragma mark CommandObjectMultiwordFrame |
| 656 | |
| 657 | //------------------------------------------------------------------------- |
| 658 | // CommandObjectMultiwordFrame |
| 659 | //------------------------------------------------------------------------- |
| 660 | |
Greg Clayton | 63094e0 | 2010-06-23 01:19:29 +0000 | [diff] [blame] | 661 | CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) : |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 662 | CommandObjectMultiword (interpreter, |
| 663 | "frame", |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 664 | "A set of commands for operating on the current thread's frames.", |
| 665 | "frame <subcommand> [<subcommand-options>]") |
| 666 | { |
Greg Clayton | 238c0a1 | 2010-09-18 01:14:36 +0000 | [diff] [blame] | 667 | LoadSubCommand ("info", CommandObjectSP (new CommandObjectFrameInfo (interpreter))); |
| 668 | LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter))); |
| 669 | LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter))); |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 670 | } |
| 671 | |
| 672 | CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame () |
| 673 | { |
| 674 | } |
| 675 | |