xref: /llvm-project/lldb/source/Commands/CommandObjectFrame.cpp (revision a701509229f658eac7c10bd6aa54cf6ed5b5011d)
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
16 #include "lldb/Core/Debugger.h"
17 #include "lldb/Core/Module.h"
18 #include "lldb/Core/StreamFile.h"
19 #include "lldb/Core/Timer.h"
20 #include "lldb/Core/Value.h"
21 #include "lldb/Core/ValueObject.h"
22 #include "lldb/Core/ValueObjectVariable.h"
23 #include "lldb/Interpreter/Args.h"
24 #include "lldb/Interpreter/CommandInterpreter.h"
25 #include "lldb/Interpreter/CommandReturnObject.h"
26 #include "lldb/Interpreter/Options.h"
27 #include "lldb/Symbol/ClangASTType.h"
28 #include "lldb/Symbol/ClangASTContext.h"
29 #include "lldb/Symbol/ObjectFile.h"
30 #include "lldb/Symbol/SymbolContext.h"
31 #include "lldb/Symbol/Type.h"
32 #include "lldb/Symbol/Variable.h"
33 #include "lldb/Symbol/VariableList.h"
34 #include "lldb/Target/Process.h"
35 #include "lldb/Target/StackFrame.h"
36 #include "lldb/Target/Thread.h"
37 #include "lldb/Target/Target.h"
38 
39 #include "CommandObjectThread.h"
40 
41 using namespace lldb;
42 using namespace lldb_private;
43 
44 #pragma mark CommandObjectFrameInfo
45 
46 //-------------------------------------------------------------------------
47 // CommandObjectFrameInfo
48 //-------------------------------------------------------------------------
49 
50 class CommandObjectFrameInfo : public CommandObject
51 {
52 public:
53 
54     CommandObjectFrameInfo (CommandInterpreter &interpreter) :
55         CommandObject (interpreter,
56                        "frame info",
57                        "List information about the currently selected frame in the current thread.",
58                        "frame info",
59                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
60     {
61     }
62 
63     ~CommandObjectFrameInfo ()
64     {
65     }
66 
67     bool
68     Execute (Args& command,
69              CommandReturnObject &result)
70     {
71         ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
72         if (exe_ctx.frame)
73         {
74             exe_ctx.frame->Dump (&result.GetOutputStream(), true, false);
75             result.GetOutputStream().EOL();
76             result.SetStatus (eReturnStatusSuccessFinishResult);
77         }
78         else
79         {
80             result.AppendError ("no current frame");
81             result.SetStatus (eReturnStatusFailed);
82         }
83         return result.Succeeded();
84     }
85 };
86 
87 #pragma mark CommandObjectFrameSelect
88 
89 //-------------------------------------------------------------------------
90 // CommandObjectFrameSelect
91 //-------------------------------------------------------------------------
92 
93 class CommandObjectFrameSelect : public CommandObject
94 {
95 public:
96 
97     CommandObjectFrameSelect (CommandInterpreter &interpreter) :
98         CommandObject (interpreter,
99                        "frame select",
100                        "Select a frame by index from within the current thread and make it the current frame.",
101                        "frame select <frame-index>",
102                        eFlagProcessMustBeLaunched | eFlagProcessMustBePaused)
103     {
104     }
105 
106     ~CommandObjectFrameSelect ()
107     {
108     }
109 
110     bool
111     Execute (Args& command,
112              CommandReturnObject &result)
113     {
114         ExecutionContext exe_ctx (m_interpreter.GetDebugger().GetExecutionContext());
115         if (exe_ctx.thread)
116         {
117             if (command.GetArgumentCount() == 1)
118             {
119                 const char *frame_idx_cstr = command.GetArgumentAtIndex(0);
120 
121                 const uint32_t num_frames = exe_ctx.thread->GetStackFrameCount();
122                 const uint32_t frame_idx = Args::StringToUInt32 (frame_idx_cstr, UINT32_MAX, 0);
123                 if (frame_idx < num_frames)
124                 {
125                     exe_ctx.thread->SetSelectedFrameByIndex (frame_idx);
126                     exe_ctx.frame = exe_ctx.thread->GetSelectedFrame ().get();
127 
128                     if (exe_ctx.frame)
129                     {
130                         bool already_shown = false;
131                         SymbolContext frame_sc(exe_ctx.frame->GetSymbolContext(eSymbolContextLineEntry));
132                         if (m_interpreter.GetDebugger().UseExternalEditor() && frame_sc.line_entry.file && frame_sc.line_entry.line != 0)
133                         {
134                             already_shown = Host::OpenFileInExternalEditor (frame_sc.line_entry.file, frame_sc.line_entry.line);
135                         }
136 
137                         if (DisplayFrameForExecutionContext (exe_ctx.thread,
138                                                              exe_ctx.frame,
139                                                              m_interpreter,
140                                                              result.GetOutputStream(),
141                                                              true,
142                                                              !already_shown,
143                                                              3,
144                                                              3))
145                         {
146                             result.SetStatus (eReturnStatusSuccessFinishResult);
147                             return result.Succeeded();
148                         }
149                     }
150                 }
151                 if (frame_idx == UINT32_MAX)
152                     result.AppendErrorWithFormat ("Invalid frame index: %s.\n", frame_idx_cstr);
153                 else
154                     result.AppendErrorWithFormat ("Frame index (%u) out of range.\n", frame_idx);
155             }
156             else
157             {
158                 result.AppendError ("invalid arguments");
159                 result.AppendErrorWithFormat ("Usage: %s\n", m_cmd_syntax.c_str());
160             }
161         }
162         else
163         {
164             result.AppendError ("no current thread");
165         }
166         result.SetStatus (eReturnStatusFailed);
167         return false;
168     }
169 };
170 
171 #pragma mark CommandObjectFrameVariable
172 //----------------------------------------------------------------------
173 // List images with associated information
174 //----------------------------------------------------------------------
175 class CommandObjectFrameVariable : public CommandObject
176 {
177 public:
178 
179     class CommandOptions : public Options
180     {
181     public:
182 
183         CommandOptions () :
184             Options()
185         {
186             ResetOptionValues ();
187         }
188 
189         virtual
190         ~CommandOptions ()
191         {
192         }
193 
194         virtual Error
195         SetOptionValue (int option_idx, const char *option_arg)
196         {
197             Error error;
198             bool success;
199             char short_option = (char) m_getopt_table[option_idx].val;
200             switch (short_option)
201             {
202             case 'o':   use_objc     = true;  break;
203             case 'n':   name = option_arg;    break;
204             case 'r':   use_regex    = true;  break;
205             case 'a':   show_args    = false; break;
206             case 'l':   show_locals  = false; break;
207             case 'g':   show_globals = true;  break;
208             case 't':   show_types   = false; break;
209             case 'y':   show_summary = false; break;
210             case 'L':   show_location= true;  break;
211             case 'c':   show_decl    = true;  break;
212             case 'D':   debug        = true;  break;
213             case 'd':
214                 max_depth = Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success);
215                 if (!success)
216                     error.SetErrorStringWithFormat("Invalid max depth '%s'.\n", option_arg);
217                 break;
218 
219             case 'p':
220                 ptr_depth = Args::StringToUInt32 (option_arg, 0, 0, &success);
221                 if (!success)
222                     error.SetErrorStringWithFormat("Invalid pointer depth '%s'.\n", option_arg);
223                 break;
224 
225             case 'G':
226                 globals.push_back(ConstString (option_arg));
227                 break;
228 
229             case 's':
230                 show_scope = true;
231                 break;
232 
233             default:
234                 error.SetErrorStringWithFormat("Invalid short option character '%c'.\n", short_option);
235                 break;
236             }
237 
238             return error;
239         }
240 
241         void
242         ResetOptionValues ()
243         {
244             Options::ResetOptionValues();
245 
246             name.clear();
247             use_objc      = false;
248             use_regex     = false;
249             show_args     = true;
250             show_locals   = true;
251             show_globals  = false;
252             show_types    = true;
253             show_scope    = false;
254             show_summary  = true;
255             show_location = false;
256             show_decl     = false;
257             debug         = false;
258             max_depth     = UINT32_MAX;
259             ptr_depth     = 0;
260             globals.clear();
261         }
262 
263         const lldb::OptionDefinition*
264         GetDefinitions ()
265         {
266             return g_option_table;
267         }
268 
269         // Options table: Required for subclasses of Options.
270 
271         static lldb::OptionDefinition g_option_table[];
272         std::string name;
273         bool use_objc:1,
274              use_regex:1,
275              show_args:1,
276              show_locals:1,
277              show_globals:1,
278              show_types:1,
279              show_scope:1,
280              show_summary:1,
281              show_location:1,
282              show_decl:1,
283              debug:1;
284         uint32_t max_depth; // The depth to print when dumping concrete (not pointers) aggreate values
285         uint32_t ptr_depth; // The default depth that is dumped when we find pointers
286         std::vector<ConstString> globals;
287         // Instance variables to hold the values for command options.
288     };
289 
290     CommandObjectFrameVariable (CommandInterpreter &interpreter) :
291         CommandObject (interpreter,
292                        "frame variable",
293                        "Show specified argument, local variable, static variable or global variable for the current frame.  If none specified, list them all.",
294                        "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
295     {
296     }
297 
298     virtual
299     ~CommandObjectFrameVariable ()
300     {
301     }
302 
303     virtual
304     Options *
305     GetOptions ()
306     {
307         return &m_options;
308     }
309 
310     void
311     DumpValueObject (CommandReturnObject &result,
312                      ExecutionContextScope *exe_scope,
313                      ValueObject *valobj,
314                      const char *root_valobj_name,
315                      uint32_t ptr_depth,
316                      uint32_t curr_depth,
317                      uint32_t max_depth,
318                      bool use_objc,
319                      bool scope_already_checked)
320     {
321         if (valobj)
322         {
323             Stream &s = result.GetOutputStream();
324 
325             //const char *loc_cstr = valobj->GetLocationAsCString();
326             if (m_options.show_location)
327             {
328                 s.Printf("@ %s: ", valobj->GetLocationAsCString(exe_scope));
329             }
330             if (m_options.debug)
331                 s.Printf ("%p ValueObject{%u} ", valobj, valobj->GetID());
332 
333             s.Indent();
334 
335             if (m_options.show_types)
336                 s.Printf("(%s) ", valobj->GetTypeName().AsCString());
337 
338             const char *name_cstr = root_valobj_name ? root_valobj_name : valobj->GetName().AsCString("");
339             s.Printf ("%s = ", name_cstr);
340 
341             if (!scope_already_checked && !valobj->IsInScope(exe_scope->CalculateStackFrame()))
342             {
343                 s.PutCString("error: out of scope");
344                 return;
345             }
346 
347             const char *val_cstr = valobj->GetValueAsCString(exe_scope);
348             const char *err_cstr = valobj->GetError().AsCString();
349 
350             if (err_cstr)
351             {
352                 s.Printf ("error: %s", err_cstr);
353             }
354             else
355             {
356                 const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope);
357 
358                 const bool is_aggregate = ClangASTContext::IsAggregateType (valobj->GetOpaqueClangQualType());
359 
360                 if (val_cstr)
361                     s.PutCString(val_cstr);
362 
363                 if (sum_cstr)
364                     s.Printf(" %s", sum_cstr);
365 
366                 if (use_objc)
367                 {
368                     const char *object_desc = valobj->GetObjectDescription(exe_scope);
369                     if (object_desc)
370                         s.Printf("\n%s\n", object_desc);
371                     else
372                         s.Printf ("No description available.\n");
373                     return;
374                 }
375 
376 
377                 if (curr_depth < max_depth)
378                 {
379                     if (is_aggregate)
380                         s.PutChar('{');
381 
382                     bool is_ptr_or_ref = ClangASTContext::IsPointerOrReferenceType (valobj->GetOpaqueClangQualType());
383 
384                     if (is_ptr_or_ref && ptr_depth == 0)
385                         return;
386 
387                     const uint32_t num_children = valobj->GetNumChildren();
388                     if (num_children)
389                     {
390                         s.IndentMore();
391                         for (uint32_t idx=0; idx<num_children; ++idx)
392                         {
393                             ValueObjectSP child_sp(valobj->GetChildAtIndex(idx, true));
394                             if (child_sp.get())
395                             {
396                                 s.EOL();
397                                 DumpValueObject (result,
398                                                  exe_scope,
399                                                  child_sp.get(),
400                                                  NULL,
401                                                  is_ptr_or_ref ? ptr_depth - 1 : ptr_depth,
402                                                  curr_depth + 1,
403                                                  max_depth,
404                                                  false,
405                                                  true);
406                                 if (idx + 1 < num_children)
407                                     s.PutChar(',');
408                             }
409                         }
410                         s.IndentLess();
411                     }
412                     if (is_aggregate)
413                     {
414                         s.EOL();
415                         s.Indent("}");
416                     }
417                 }
418                 else
419                 {
420                     if (is_aggregate)
421                     {
422                         s.PutCString("{...}");
423                     }
424                 }
425 
426             }
427         }
428     }
429 
430     virtual bool
431     Execute
432     (
433         Args& command,
434         CommandReturnObject &result
435     )
436     {
437         ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
438         if (exe_ctx.frame == NULL)
439         {
440             result.AppendError ("invalid frame");
441             result.SetStatus (eReturnStatusFailed);
442             return false;
443         }
444         else
445         {
446             Stream &s = result.GetOutputStream();
447 
448             bool get_file_globals = true;
449             VariableList *variable_list = exe_ctx.frame->GetVariableList (get_file_globals);
450 
451             VariableSP var_sp;
452             ValueObjectSP valobj_sp;
453             //ValueObjectList &valobj_list = exe_ctx.frame->GetValueObjectList();
454             const char *name_cstr = NULL;
455             size_t idx;
456             if (!m_options.globals.empty())
457             {
458                 uint32_t fail_count = 0;
459                 if (exe_ctx.target)
460                 {
461                     const size_t num_globals = m_options.globals.size();
462                     for (idx = 0; idx < num_globals; ++idx)
463                     {
464                         VariableList global_var_list;
465                         const uint32_t num_matching_globals = exe_ctx.target->GetImages().FindGlobalVariables (m_options.globals[idx], true, UINT32_MAX, global_var_list);
466 
467                         if (num_matching_globals == 0)
468                         {
469                             ++fail_count;
470                             result.GetErrorStream().Printf ("error: can't find global variable '%s'\n", m_options.globals[idx].AsCString());
471                         }
472                         else
473                         {
474                             for (uint32_t global_idx=0; global_idx<num_matching_globals; ++global_idx)
475                             {
476                                 var_sp = global_var_list.GetVariableAtIndex(global_idx);
477                                 if (var_sp)
478                                 {
479                                     valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
480                                     if (!valobj_sp)
481                                         valobj_sp = exe_ctx.frame->TrackGlobalVariable (var_sp);
482 
483                                     if (valobj_sp)
484                                     {
485                                         if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
486                                         {
487                                             var_sp->GetDeclaration ().DumpStopContext (&s, false);
488                                             s.PutCString (": ");
489                                         }
490 
491                                         DumpValueObject (result,
492                                                          exe_ctx.frame,
493                                                          valobj_sp.get(),
494                                                          name_cstr,
495                                                          m_options.ptr_depth,
496                                                          0,
497                                                          m_options.max_depth,
498                                                          m_options.use_objc,
499                                                          false);
500 
501                                         s.EOL();
502                                     }
503                                 }
504                             }
505                         }
506                     }
507                 }
508                 if (fail_count)
509                     result.SetStatus (eReturnStatusFailed);
510             }
511             else if (variable_list)
512             {
513                 if (command.GetArgumentCount() > 0)
514                 {
515                     // If we have any args to the variable command, we will make
516                     // variable objects from them...
517                     for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != NULL; ++idx)
518                     {
519                         uint32_t ptr_depth = m_options.ptr_depth;
520                         // If first character is a '*', then show pointer contents
521                         if (name_cstr[0] == '*')
522                         {
523                             ++ptr_depth;
524                             name_cstr++; // Skip the '*'
525                         }
526 
527                         std::string var_path (name_cstr);
528                         size_t separator_idx = var_path.find_first_of(".-[");
529 
530                         ConstString name_const_string;
531                         if (separator_idx == std::string::npos)
532                             name_const_string.SetCString (var_path.c_str());
533                         else
534                             name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
535 
536                         var_sp = variable_list->FindVariable(name_const_string);
537                         if (var_sp)
538                         {
539                             valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
540 
541                             var_path.erase (0, name_const_string.GetLength ());
542                             // We are dumping at least one child
543                             while (separator_idx != std::string::npos)
544                             {
545                                 // Calculate the next separator index ahead of time
546                                 ValueObjectSP child_valobj_sp;
547                                 const char separator_type = var_path[0];
548                                 switch (separator_type)
549                                 {
550 
551                                 case '-':
552                                     if (var_path.size() >= 2 && var_path[1] != '>')
553                                     {
554                                         result.GetErrorStream().Printf ("error: invalid character in variable path starting at '%s'\n",
555                                                                         var_path.c_str());
556                                         var_path.clear();
557                                         valobj_sp.reset();
558                                         break;
559                                     }
560                                     var_path.erase (0, 1); // Remove the '-'
561                                     // Fall through
562                                 case '.':
563                                     {
564                                         var_path.erase (0, 1); // Remove the '.' or '>'
565                                         separator_idx = var_path.find_first_of(".-[");
566                                         ConstString child_name;
567                                         if (separator_idx == std::string::npos)
568                                             child_name.SetCString (var_path.c_str());
569                                         else
570                                             child_name.SetCStringWithLength(var_path.c_str(), separator_idx);
571 
572                                         child_valobj_sp = valobj_sp->GetChildMemberWithName (child_name, true);
573                                         if (!child_valobj_sp)
574                                         {
575                                             result.GetErrorStream().Printf ("error: can't find child of '%s' named '%s'\n",
576                                                                             valobj_sp->GetName().AsCString(),
577                                                                             child_name.GetCString());
578                                             var_path.clear();
579                                             valobj_sp.reset();
580                                             break;
581                                         }
582                                         // Remove the child name from the path
583                                         var_path.erase(0, child_name.GetLength());
584                                     }
585                                     break;
586 
587                                 case '[':
588                                     // Array member access, or treating pointer as an array
589                                     if (var_path.size() > 2) // Need at least two brackets and a number
590                                     {
591                                         char *end = NULL;
592                                         int32_t child_index = ::strtol (&var_path[1], &end, 0);
593                                         if (end && *end == ']')
594                                         {
595 
596                                             if (valobj_sp->IsPointerType ())
597                                             {
598                                                 child_valobj_sp = valobj_sp->GetSyntheticArrayMemberFromPointer (child_index, true);
599                                             }
600                                             else
601                                             {
602                                                 child_valobj_sp = valobj_sp->GetChildAtIndex (child_index, true);
603                                             }
604 
605                                             if (!child_valobj_sp)
606                                             {
607                                                 result.GetErrorStream().Printf ("error: invalid array index %u in '%s'\n",
608                                                                                 child_index,
609                                                                                 valobj_sp->GetName().AsCString());
610                                                 var_path.clear();
611                                                 valobj_sp.reset();
612                                                 break;
613                                             }
614 
615                                             // Erase the array member specification '[%i]' where %i is the array index
616                                             var_path.erase(0, (end - var_path.c_str()) + 1);
617                                             separator_idx = var_path.find_first_of(".-[");
618 
619                                             // Break out early from the switch since we were able to find the child member
620                                             break;
621                                         }
622                                     }
623                                     result.GetErrorStream().Printf ("error: invalid array member specification for '%s' starting at '%s'\n",
624                                                                     valobj_sp->GetName().AsCString(),
625                                                                     var_path.c_str());
626                                     var_path.clear();
627                                     valobj_sp.reset();
628                                     break;
629 
630                                     break;
631 
632                                 default:
633                                     result.GetErrorStream().Printf ("error: invalid character in variable path starting at '%s'\n",
634                                                                         var_path.c_str());
635                                     var_path.clear();
636                                     valobj_sp.reset();
637                                     separator_idx = std::string::npos;
638                                     break;
639                                 }
640 
641                                 if (child_valobj_sp)
642                                     valobj_sp = child_valobj_sp;
643 
644                                 if (var_path.empty())
645                                     break;
646 
647                             }
648 
649                             if (valobj_sp)
650                             {
651                                 if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
652                                 {
653                                     var_sp->GetDeclaration ().DumpStopContext (&s, false);
654                                     s.PutCString (": ");
655                                 }
656 
657                                 DumpValueObject (result,
658                                                  exe_ctx.frame,
659                                                  valobj_sp.get(),
660                                                  name_cstr,
661                                                  ptr_depth,
662                                                  0,
663                                                  m_options.max_depth,
664                                                  m_options.use_objc,
665                                                  false);
666 
667                                 s.EOL();
668                             }
669                         }
670                         else
671                         {
672                             result.GetErrorStream().Printf ("error: unable to find any variables named '%s'\n", name_cstr);
673                             var_path.clear();
674                         }
675                     }
676                 }
677                 else
678                 {
679                     const uint32_t num_variables = variable_list->GetSize();
680 
681                     if (num_variables > 0)
682                     {
683                         for (uint32_t i=0; i<num_variables; i++)
684                         {
685                             VariableSP var_sp (variable_list->GetVariableAtIndex(i));
686                             bool dump_variable = true;
687 
688                             switch (var_sp->GetScope())
689                             {
690                             case eValueTypeVariableGlobal:
691                                 dump_variable = m_options.show_globals;
692                                 if (dump_variable && m_options.show_scope)
693                                     s.PutCString("GLOBAL: ");
694                                 break;
695 
696                             case eValueTypeVariableStatic:
697                                 dump_variable = m_options.show_globals;
698                                 if (dump_variable && m_options.show_scope)
699                                     s.PutCString("STATIC: ");
700                                 break;
701 
702                             case eValueTypeVariableArgument:
703                                 dump_variable = m_options.show_args;
704                                 if (dump_variable && m_options.show_scope)
705                                     s.PutCString("   ARG: ");
706                                 break;
707 
708                             case eValueTypeVariableLocal:
709                                 dump_variable = m_options.show_locals;
710                                 if (dump_variable && m_options.show_scope)
711                                     s.PutCString(" LOCAL: ");
712                                 break;
713 
714                             default:
715                                 break;
716                             }
717 
718                             if (dump_variable)
719                             {
720 
721                                 // Use the variable object code to make sure we are
722                                 // using the same APIs as the the public API will be
723                                 // using...
724                                 valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
725                                 if (valobj_sp)
726                                 {
727                                     // When dumping all variables, don't print any variables
728                                     // that are not in scope to avoid extra unneeded output
729                                     if (valobj_sp->IsInScope (exe_ctx.frame))
730                                     {
731                                         if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
732                                         {
733                                             var_sp->GetDeclaration ().DumpStopContext (&s, false);
734                                             s.PutCString (": ");
735                                         }
736                                         DumpValueObject (result,
737                                                          exe_ctx.frame,
738                                                          valobj_sp.get(),
739                                                          name_cstr,
740                                                          m_options.ptr_depth,
741                                                          0,
742                                                          m_options.max_depth,
743                                                          m_options.use_objc,
744                                                          true);
745 
746                                         s.EOL();
747                                     }
748                                 }
749                             }
750                         }
751                     }
752                 }
753                 result.SetStatus (eReturnStatusSuccessFinishResult);
754             }
755         }
756         return result.Succeeded();
757     }
758 protected:
759 
760     CommandOptions m_options;
761 };
762 
763 lldb::OptionDefinition
764 CommandObjectFrameVariable::CommandOptions::g_option_table[] =
765 {
766 { LLDB_OPT_SET_1, false, "debug",      'D', no_argument,       NULL, 0, NULL,        "Enable verbose debug information."},
767 { LLDB_OPT_SET_1, false, "depth",      'd', required_argument, NULL, 0, "<count>",   "Set the max recurse depth when dumping aggregate types (default is infinity)."},
768 { LLDB_OPT_SET_1, false, "show-globals",'g', no_argument,      NULL, 0, NULL,        "Show the current frame source file global and static variables."},
769 { LLDB_OPT_SET_1, false, "find-global",'G', required_argument, NULL, 0, NULL,        "Find a global variable by name (which might not be in the current stack frame source file)."},
770 { LLDB_OPT_SET_1, false, "location",   'L', no_argument,       NULL, 0, NULL,        "Show variable location information."},
771 { LLDB_OPT_SET_1, false, "show-declaration", 'c', no_argument, NULL, 0, NULL,        "Show variable declaration information (source file and line where the variable was declared)."},
772 { LLDB_OPT_SET_1, false, "name",       'n', required_argument, NULL, 0, "<name>",    "Lookup a variable by name or regex (--regex) for the current execution context."},
773 { LLDB_OPT_SET_1, false, "no-args",    'a', no_argument,       NULL, 0, NULL,        "Omit function arguments."},
774 { LLDB_OPT_SET_1, false, "no-locals",  'l', no_argument,       NULL, 0, NULL,        "Omit local variables."},
775 { LLDB_OPT_SET_1, false, "no-types",   't', no_argument,       NULL, 0, NULL,        "Omit variable type names."},
776 { LLDB_OPT_SET_1, false, "no-summary", 'y', no_argument,       NULL, 0, NULL,        "Omit summary information."},
777 { LLDB_OPT_SET_1, false, "scope",      's', no_argument,       NULL, 0, NULL,        "Show variable scope (argument, local, global, static)."},
778 { LLDB_OPT_SET_1, false, "objc",       'o', no_argument,       NULL, 0, NULL,        "When looking up a variable by name (--name), print as an Objective-C object."},
779 { LLDB_OPT_SET_1, false, "ptr-depth",  'p', required_argument, NULL, 0, "<count>",   "The number of pointers to be traversed when dumping values (default is zero)."},
780 { LLDB_OPT_SET_1, false, "regex",      'r', no_argument,       NULL, 0, NULL,        "The <name> argument for name lookups are regular expressions."},
781 { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL }
782 };
783 #pragma mark CommandObjectMultiwordFrame
784 
785 //-------------------------------------------------------------------------
786 // CommandObjectMultiwordFrame
787 //-------------------------------------------------------------------------
788 
789 CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) :
790     CommandObjectMultiword (interpreter,
791                             "frame",
792                             "A set of commands for operating on the current thread's frames.",
793                             "frame <subcommand> [<subcommand-options>]")
794 {
795     LoadSubCommand ("info",   CommandObjectSP (new CommandObjectFrameInfo (interpreter)));
796     LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter)));
797     LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter)));
798 }
799 
800 CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame ()
801 {
802 }
803 
804