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