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