CommandObjectFrame.cpp revision aa44805e19afee2e2796ad294bd77a5f952df5d3
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
41using namespace lldb;
42using namespace lldb_private;
43
44#pragma mark CommandObjectFrameInfo
45
46//-------------------------------------------------------------------------
47// CommandObjectFrameInfo
48//-------------------------------------------------------------------------
49
50class CommandObjectFrameInfo : public CommandObject
51{
52public:
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
93class CommandObjectFrameSelect : public CommandObject
94{
95public:
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//----------------------------------------------------------------------
175class CommandObjectFrameVariable : public CommandObject
176{
177public:
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 frame variables. All argument and local variables "
294                       "that are in scope will be shown when no arguments are given. "
295                       "If any arguments are specified, they can be names of "
296                       "argument, local, file static and file global variables."
297                       "Children of aggregate variables can be specified such as "
298                       "'var->child.x'.",
299                       "frame variable [<cmd-options>] [<var-name1> [<var-name2>...]]")
300    {
301    }
302
303    virtual
304    ~CommandObjectFrameVariable ()
305    {
306    }
307
308    virtual
309    Options *
310    GetOptions ()
311    {
312        return &m_options;
313    }
314
315    void
316    DumpValueObject (CommandReturnObject &result,
317                     ExecutionContextScope *exe_scope,
318                     ValueObject *valobj,
319                     const char *root_valobj_name,
320                     uint32_t ptr_depth,
321                     uint32_t curr_depth,
322                     uint32_t max_depth,
323                     bool use_objc,
324                     bool scope_already_checked)
325    {
326        if (valobj)
327        {
328            Stream &s = result.GetOutputStream();
329
330            //const char *loc_cstr = valobj->GetLocationAsCString();
331            if (m_options.show_location)
332            {
333                s.Printf("%s: ", valobj->GetLocationAsCString(exe_scope));
334            }
335            if (m_options.debug)
336                s.Printf ("%p ValueObject{%u} ", valobj, valobj->GetID());
337
338            s.Indent();
339
340            if (m_options.show_types)
341                s.Printf("(%s) ", valobj->GetTypeName().AsCString());
342
343            const char *name_cstr = root_valobj_name ? root_valobj_name : valobj->GetName().AsCString("");
344            s.Printf ("%s = ", name_cstr);
345
346            if (!scope_already_checked && !valobj->IsInScope(exe_scope->CalculateStackFrame()))
347            {
348                s.PutCString("error: out of scope");
349                return;
350            }
351
352            const char *val_cstr = valobj->GetValueAsCString(exe_scope);
353            const char *err_cstr = valobj->GetError().AsCString();
354
355            if (err_cstr)
356            {
357                s.Printf ("error: %s", err_cstr);
358            }
359            else
360            {
361                const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope);
362
363                const bool is_aggregate = ClangASTContext::IsAggregateType (valobj->GetOpaqueClangQualType());
364
365                if (val_cstr)
366                    s.PutCString(val_cstr);
367
368                if (sum_cstr)
369                    s.Printf(" %s", sum_cstr);
370
371                if (use_objc)
372                {
373                    const char *object_desc = valobj->GetObjectDescription(exe_scope);
374                    if (object_desc)
375                        s.Printf("\n%s\n", object_desc);
376                    else
377                        s.Printf ("No description available.\n");
378                    return;
379                }
380
381
382                if (curr_depth < max_depth)
383                {
384                    if (is_aggregate)
385                        s.PutChar('{');
386
387                    bool is_ptr_or_ref = ClangASTContext::IsPointerOrReferenceType (valobj->GetOpaqueClangQualType());
388
389                    if (is_ptr_or_ref && ptr_depth == 0)
390                        return;
391
392                    const uint32_t num_children = valobj->GetNumChildren();
393                    if (num_children)
394                    {
395                        s.IndentMore();
396                        for (uint32_t idx=0; idx<num_children; ++idx)
397                        {
398                            ValueObjectSP child_sp(valobj->GetChildAtIndex(idx, true));
399                            if (child_sp.get())
400                            {
401                                s.EOL();
402                                DumpValueObject (result,
403                                                 exe_scope,
404                                                 child_sp.get(),
405                                                 NULL,
406                                                 is_ptr_or_ref ? ptr_depth - 1 : ptr_depth,
407                                                 curr_depth + 1,
408                                                 max_depth,
409                                                 false,
410                                                 true);
411                                if (idx + 1 < num_children)
412                                    s.PutChar(',');
413                            }
414                        }
415                        s.IndentLess();
416                    }
417                    if (is_aggregate)
418                    {
419                        s.EOL();
420                        s.Indent("}");
421                    }
422                }
423                else
424                {
425                    if (is_aggregate)
426                    {
427                        s.PutCString("{...}");
428                    }
429                }
430
431            }
432        }
433    }
434
435    virtual bool
436    Execute
437    (
438        Args& command,
439        CommandReturnObject &result
440    )
441    {
442        ExecutionContext exe_ctx(m_interpreter.GetDebugger().GetExecutionContext());
443        if (exe_ctx.frame == NULL)
444        {
445            result.AppendError ("you must be stopped in a valid stack frame to view frame variables.");
446            result.SetStatus (eReturnStatusFailed);
447            return false;
448        }
449        else
450        {
451            Stream &s = result.GetOutputStream();
452
453            bool get_file_globals = true;
454            VariableList *variable_list = exe_ctx.frame->GetVariableList (get_file_globals);
455
456            VariableSP var_sp;
457            ValueObjectSP valobj_sp;
458            //ValueObjectList &valobj_list = exe_ctx.frame->GetValueObjectList();
459            const char *name_cstr = NULL;
460            size_t idx;
461            if (!m_options.globals.empty())
462            {
463                uint32_t fail_count = 0;
464                if (exe_ctx.target)
465                {
466                    const size_t num_globals = m_options.globals.size();
467                    for (idx = 0; idx < num_globals; ++idx)
468                    {
469                        VariableList global_var_list;
470                        const uint32_t num_matching_globals = exe_ctx.target->GetImages().FindGlobalVariables (m_options.globals[idx], true, UINT32_MAX, global_var_list);
471
472                        if (num_matching_globals == 0)
473                        {
474                            ++fail_count;
475                            result.GetErrorStream().Printf ("error: can't find global variable '%s'\n", m_options.globals[idx].AsCString());
476                        }
477                        else
478                        {
479                            for (uint32_t global_idx=0; global_idx<num_matching_globals; ++global_idx)
480                            {
481                                var_sp = global_var_list.GetVariableAtIndex(global_idx);
482                                if (var_sp)
483                                {
484                                    valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
485                                    if (!valobj_sp)
486                                        valobj_sp = exe_ctx.frame->TrackGlobalVariable (var_sp);
487
488                                    if (valobj_sp)
489                                    {
490                                        if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
491                                        {
492                                            var_sp->GetDeclaration ().DumpStopContext (&s, false);
493                                            s.PutCString (": ");
494                                        }
495
496                                        DumpValueObject (result,
497                                                         exe_ctx.frame,
498                                                         valobj_sp.get(),
499                                                         name_cstr,
500                                                         m_options.ptr_depth,
501                                                         0,
502                                                         m_options.max_depth,
503                                                         m_options.use_objc,
504                                                         false);
505
506                                        s.EOL();
507                                    }
508                                }
509                            }
510                        }
511                    }
512                }
513                if (fail_count)
514                    result.SetStatus (eReturnStatusFailed);
515            }
516            else if (variable_list)
517            {
518                if (command.GetArgumentCount() > 0)
519                {
520                    // If we have any args to the variable command, we will make
521                    // variable objects from them...
522                    for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != NULL; ++idx)
523                    {
524                        uint32_t ptr_depth = m_options.ptr_depth;
525                        // If first character is a '*', then show pointer contents
526                        if (name_cstr[0] == '*')
527                        {
528                            ++ptr_depth;
529                            name_cstr++; // Skip the '*'
530                        }
531
532                        std::string var_path (name_cstr);
533                        size_t separator_idx = var_path.find_first_of(".-[");
534
535                        ConstString name_const_string;
536                        if (separator_idx == std::string::npos)
537                            name_const_string.SetCString (var_path.c_str());
538                        else
539                            name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
540
541                        var_sp = variable_list->FindVariable(name_const_string);
542                        if (var_sp)
543                        {
544                            valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
545
546                            var_path.erase (0, name_const_string.GetLength ());
547                            // We are dumping at least one child
548                            while (separator_idx != std::string::npos)
549                            {
550                                // Calculate the next separator index ahead of time
551                                ValueObjectSP child_valobj_sp;
552                                const char separator_type = var_path[0];
553                                switch (separator_type)
554                                {
555
556                                case '-':
557                                    if (var_path.size() >= 2 && var_path[1] != '>')
558                                    {
559                                        result.GetErrorStream().Printf ("error: invalid character in variable path starting at '%s'\n",
560                                                                        var_path.c_str());
561                                        var_path.clear();
562                                        valobj_sp.reset();
563                                        break;
564                                    }
565                                    var_path.erase (0, 1); // Remove the '-'
566                                    // Fall through
567                                case '.':
568                                    {
569                                        var_path.erase (0, 1); // Remove the '.' or '>'
570                                        separator_idx = var_path.find_first_of(".-[");
571                                        ConstString child_name;
572                                        if (separator_idx == std::string::npos)
573                                            child_name.SetCString (var_path.c_str());
574                                        else
575                                            child_name.SetCStringWithLength(var_path.c_str(), separator_idx);
576
577                                        child_valobj_sp = valobj_sp->GetChildMemberWithName (child_name, true);
578                                        if (!child_valobj_sp)
579                                        {
580                                            result.GetErrorStream().Printf ("error: can't find child of '%s' named '%s'\n",
581                                                                            valobj_sp->GetName().AsCString(),
582                                                                            child_name.GetCString());
583                                            var_path.clear();
584                                            valobj_sp.reset();
585                                            break;
586                                        }
587                                        // Remove the child name from the path
588                                        var_path.erase(0, child_name.GetLength());
589                                    }
590                                    break;
591
592                                case '[':
593                                    // Array member access, or treating pointer as an array
594                                    if (var_path.size() > 2) // Need at least two brackets and a number
595                                    {
596                                        char *end = NULL;
597                                        int32_t child_index = ::strtol (&var_path[1], &end, 0);
598                                        if (end && *end == ']')
599                                        {
600
601                                            if (valobj_sp->IsPointerType ())
602                                            {
603                                                child_valobj_sp = valobj_sp->GetSyntheticArrayMemberFromPointer (child_index, true);
604                                            }
605                                            else
606                                            {
607                                                child_valobj_sp = valobj_sp->GetChildAtIndex (child_index, true);
608                                            }
609
610                                            if (!child_valobj_sp)
611                                            {
612                                                result.GetErrorStream().Printf ("error: invalid array index %u in '%s'\n",
613                                                                                child_index,
614                                                                                valobj_sp->GetName().AsCString());
615                                                var_path.clear();
616                                                valobj_sp.reset();
617                                                break;
618                                            }
619
620                                            // Erase the array member specification '[%i]' where %i is the array index
621                                            var_path.erase(0, (end - var_path.c_str()) + 1);
622                                            separator_idx = var_path.find_first_of(".-[");
623
624                                            // Break out early from the switch since we were able to find the child member
625                                            break;
626                                        }
627                                    }
628                                    result.GetErrorStream().Printf ("error: invalid array member specification for '%s' starting at '%s'\n",
629                                                                    valobj_sp->GetName().AsCString(),
630                                                                    var_path.c_str());
631                                    var_path.clear();
632                                    valobj_sp.reset();
633                                    break;
634
635                                    break;
636
637                                default:
638                                    result.GetErrorStream().Printf ("error: invalid character in variable path starting at '%s'\n",
639                                                                        var_path.c_str());
640                                    var_path.clear();
641                                    valobj_sp.reset();
642                                    separator_idx = std::string::npos;
643                                    break;
644                                }
645
646                                if (child_valobj_sp)
647                                    valobj_sp = child_valobj_sp;
648
649                                if (var_path.empty())
650                                    break;
651
652                            }
653
654                            if (valobj_sp)
655                            {
656                                if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
657                                {
658                                    var_sp->GetDeclaration ().DumpStopContext (&s, false);
659                                    s.PutCString (": ");
660                                }
661
662                                DumpValueObject (result,
663                                                 exe_ctx.frame,
664                                                 valobj_sp.get(),
665                                                 name_cstr,
666                                                 ptr_depth,
667                                                 0,
668                                                 m_options.max_depth,
669                                                 m_options.use_objc,
670                                                 false);
671
672                                s.EOL();
673                            }
674                        }
675                        else
676                        {
677                            result.GetErrorStream().Printf ("error: unable to find any variables named '%s'\n", name_cstr);
678                            var_path.clear();
679                        }
680                    }
681                }
682                else
683                {
684                    const uint32_t num_variables = variable_list->GetSize();
685
686                    if (num_variables > 0)
687                    {
688                        for (uint32_t i=0; i<num_variables; i++)
689                        {
690                            VariableSP var_sp (variable_list->GetVariableAtIndex(i));
691                            bool dump_variable = true;
692
693                            switch (var_sp->GetScope())
694                            {
695                            case eValueTypeVariableGlobal:
696                                dump_variable = m_options.show_globals;
697                                if (dump_variable && m_options.show_scope)
698                                    s.PutCString("GLOBAL: ");
699                                break;
700
701                            case eValueTypeVariableStatic:
702                                dump_variable = m_options.show_globals;
703                                if (dump_variable && m_options.show_scope)
704                                    s.PutCString("STATIC: ");
705                                break;
706
707                            case eValueTypeVariableArgument:
708                                dump_variable = m_options.show_args;
709                                if (dump_variable && m_options.show_scope)
710                                    s.PutCString("   ARG: ");
711                                break;
712
713                            case eValueTypeVariableLocal:
714                                dump_variable = m_options.show_locals;
715                                if (dump_variable && m_options.show_scope)
716                                    s.PutCString(" LOCAL: ");
717                                break;
718
719                            default:
720                                break;
721                            }
722
723                            if (dump_variable)
724                            {
725
726                                // Use the variable object code to make sure we are
727                                // using the same APIs as the the public API will be
728                                // using...
729                                valobj_sp = exe_ctx.frame->GetValueObjectForFrameVariable (var_sp);
730                                if (valobj_sp)
731                                {
732                                    // When dumping all variables, don't print any variables
733                                    // that are not in scope to avoid extra unneeded output
734                                    if (valobj_sp->IsInScope (exe_ctx.frame))
735                                    {
736                                        if (m_options.show_decl && var_sp->GetDeclaration ().GetFile())
737                                        {
738                                            var_sp->GetDeclaration ().DumpStopContext (&s, false);
739                                            s.PutCString (": ");
740                                        }
741                                        DumpValueObject (result,
742                                                         exe_ctx.frame,
743                                                         valobj_sp.get(),
744                                                         name_cstr,
745                                                         m_options.ptr_depth,
746                                                         0,
747                                                         m_options.max_depth,
748                                                         m_options.use_objc,
749                                                         true);
750
751                                        s.EOL();
752                                    }
753                                }
754                            }
755                        }
756                    }
757                }
758                result.SetStatus (eReturnStatusSuccessFinishResult);
759            }
760        }
761        return result.Succeeded();
762    }
763protected:
764
765    CommandOptions m_options;
766};
767
768lldb::OptionDefinition
769CommandObjectFrameVariable::CommandOptions::g_option_table[] =
770{
771{ LLDB_OPT_SET_1, false, "debug",      'D', no_argument,       NULL, 0, NULL,        "Enable verbose debug information."},
772{ LLDB_OPT_SET_1, false, "depth",      'd', required_argument, NULL, 0, "<count>",   "Set the max recurse depth when dumping aggregate types (default is infinity)."},
773{ LLDB_OPT_SET_1, false, "show-globals",'g', no_argument,      NULL, 0, NULL,        "Show the current frame source file global and static variables."},
774{ LLDB_OPT_SET_1, false, "find-global",'G', required_argument, NULL, 0, "<name>",    "Find a global variable by name (which might not be in the current stack frame source file)."},
775{ LLDB_OPT_SET_1, false, "location",   'L', no_argument,       NULL, 0, NULL,        "Show variable location information."},
776{ 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)."},
777{ 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."},
778{ LLDB_OPT_SET_1, false, "no-args",    'a', no_argument,       NULL, 0, NULL,        "Omit function arguments."},
779{ LLDB_OPT_SET_1, false, "no-locals",  'l', no_argument,       NULL, 0, NULL,        "Omit local variables."},
780{ LLDB_OPT_SET_1, false, "no-types",   't', no_argument,       NULL, 0, NULL,        "Omit variable type names."},
781{ LLDB_OPT_SET_1, false, "no-summary", 'y', no_argument,       NULL, 0, NULL,        "Omit summary information."},
782{ LLDB_OPT_SET_1, false, "scope",      's', no_argument,       NULL, 0, NULL,        "Show variable scope (argument, local, global, static)."},
783{ 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."},
784{ 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)."},
785{ LLDB_OPT_SET_1, false, "regex",      'r', no_argument,       NULL, 0, NULL,        "The <name> argument for name lookups are regular expressions."},
786{ 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL }
787};
788#pragma mark CommandObjectMultiwordFrame
789
790//-------------------------------------------------------------------------
791// CommandObjectMultiwordFrame
792//-------------------------------------------------------------------------
793
794CommandObjectMultiwordFrame::CommandObjectMultiwordFrame (CommandInterpreter &interpreter) :
795    CommandObjectMultiword (interpreter,
796                            "frame",
797                            "A set of commands for operating on the current thread's frames.",
798                            "frame <subcommand> [<subcommand-options>]")
799{
800    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectFrameInfo (interpreter)));
801    LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter)));
802    LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter)));
803}
804
805CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame ()
806{
807}
808
809