forked from OSchip/llvm-project
<rdar://problem/12798131>
Cleaned up the option parsing code to always pass around the short options as integers. Previously we cast this down to "char" and lost some information. I recently added an assert that would detect duplicate short character options which was firing during the test suite. This fix does the following: - make sure all short options are treated as "int" - make sure that short options can be non-printable values when a short option is not required or when an option group is mixed into many commands and a short option is not desired - fix the help printing to "do the right thing" in all cases. Previously if there were duplicate short character options, it would just not emit help for the duplicates - fix option parsing when there are duplicates to parse options correctly. Previously the option parsing, when done for an OptionGroup, would just start parsing options incorrectly by omitting table entries and it would end up setting the wrong option value llvm-svn: 169189
This commit is contained in:
parent
1dd82dd3fc
commit
3bcdfc0ec1
|
@ -31,7 +31,7 @@ namespace lldb_private {
|
|||
OptionGroupBoolean (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
const char *usage_text,
|
||||
bool default_value,
|
||||
bool no_argument_toggle_default);
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
OptionGroupFile (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text);
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
OptionGroupFileList (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text);
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace lldb_private {
|
|||
OptionGroupString (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text,
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace lldb_private {
|
|||
OptionGroupUInt64 (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text,
|
||||
|
|
|
@ -296,7 +296,7 @@ public:
|
|||
|
||||
protected:
|
||||
// This is a set of options expressed as indexes into the options table for this Option.
|
||||
typedef std::set<char> OptionSet;
|
||||
typedef std::set<int> OptionSet;
|
||||
typedef std::vector<OptionSet> OptionSetVector;
|
||||
|
||||
CommandInterpreter &m_interpreter;
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
Dump(Stream *s, bool show_context) const;
|
||||
|
||||
lldb::VariableSP
|
||||
GetVariableAtIndex(uint32_t idx);
|
||||
GetVariableAtIndex(uint32_t idx) const;
|
||||
|
||||
lldb::VariableSP
|
||||
RemoveVariableAtIndex (uint32_t idx);
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace lldb_private
|
|||
// then this option belongs to option set n.
|
||||
bool required; // This option is required (in the current usage level)
|
||||
const char *long_option; // Full name for this option.
|
||||
char short_option; // Single character for this option.
|
||||
int short_option; // Single character for this option.
|
||||
int option_has_arg; // no_argument, required_argument or optional_argument
|
||||
OptionEnumValueElement *enum_values; // If non-NULL an array of enum values.
|
||||
uint32_t completion_type; // Cookie the option class can use to do define the argument completion.
|
||||
|
|
|
@ -54,7 +54,7 @@ CommandObjectArgs::CommandOptions::SetOptionValue (uint32_t option_idx, const ch
|
|||
{
|
||||
Error error;
|
||||
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -746,7 +746,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1253,7 +1253,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1441,7 +1441,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -413,7 +413,7 @@ one command per line.\n" );
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
@ -234,7 +234,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
@ -1082,7 +1082,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1335,7 +1335,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1478,7 +1478,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
|
|||
{
|
||||
Error error;
|
||||
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
bool success;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int
|
|||
{
|
||||
Error error;
|
||||
|
||||
const char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
{
|
||||
Error error;
|
||||
bool success = false;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'r':
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -861,7 +861,7 @@ public:
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_memory_write_option_table[option_idx].short_option;
|
||||
const int short_option = g_memory_write_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -606,7 +606,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success = false;
|
||||
|
||||
switch (short_option)
|
||||
|
|
|
@ -355,7 +355,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success = false;
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -715,7 +715,7 @@ protected:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success = false;
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -941,7 +941,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1533,7 +1533,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -289,7 +289,7 @@ protected:
|
|||
const char *option_value)
|
||||
{
|
||||
Error error;
|
||||
const char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 's':
|
||||
|
|
|
@ -119,7 +119,7 @@ insert-before or insert-after.\n");
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
const char short_option = g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'l':
|
||||
|
@ -162,7 +162,7 @@ class CommandObjectSourceList : public CommandObjectParsed
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
const char short_option = g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'l':
|
||||
|
|
|
@ -602,8 +602,8 @@ public:
|
|||
m_option_group (interpreter),
|
||||
m_option_variable (false), // Don't include frame options
|
||||
m_option_format (eFormatDefault),
|
||||
m_option_compile_units (LLDB_OPT_SET_1, false, "file", 'f', 0, eArgTypeFilename, "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
|
||||
m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",'s', 0, eArgTypeFilename, "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
|
||||
m_option_compile_units (LLDB_OPT_SET_1, false, "file", 'file', 0, eArgTypeFilename, "A basename or fullpath to a file that contains global variables. This option can be specified multiple times."),
|
||||
m_option_shared_libraries (LLDB_OPT_SET_1, false, "shlib",'shlb', 0, eArgTypeFilename, "A basename or fullpath to a shared library to use in the search for global variables. This option can be specified multiple times."),
|
||||
m_varobj_options()
|
||||
{
|
||||
CommandArgumentEntry arg;
|
||||
|
@ -719,6 +719,51 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
|
||||
void
|
||||
DumpGlobalVariableList(const ExecutionContext &exe_ctx, const SymbolContext &sc, const VariableList &variable_list, Stream &s)
|
||||
{
|
||||
size_t count = variable_list.GetSize();
|
||||
if (count > 0)
|
||||
{
|
||||
if (sc.module_sp)
|
||||
{
|
||||
if (sc.comp_unit)
|
||||
{
|
||||
s.Printf ("Global variables for %s/%s in %s/%s:\n",
|
||||
sc.comp_unit->GetDirectory().GetCString(),
|
||||
sc.comp_unit->GetFilename().GetCString(),
|
||||
sc.module_sp->GetFileSpec().GetDirectory().GetCString(),
|
||||
sc.module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
s.Printf ("Global variables for %s/%s\n",
|
||||
sc.module_sp->GetFileSpec().GetDirectory().GetCString(),
|
||||
sc.module_sp->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
}
|
||||
else if (sc.comp_unit)
|
||||
{
|
||||
s.Printf ("Global variables for %s/%s\n",
|
||||
sc.comp_unit->GetDirectory().GetCString(),
|
||||
sc.comp_unit->GetFilename().GetCString());
|
||||
}
|
||||
|
||||
for (uint32_t i=0; i<count; ++i)
|
||||
{
|
||||
VariableSP var_sp (variable_list.GetVariableAtIndex(i));
|
||||
if (var_sp)
|
||||
{
|
||||
ValueObjectSP valobj_sp (ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp));
|
||||
|
||||
if (valobj_sp)
|
||||
DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
virtual bool
|
||||
DoExecute (Args& args, CommandReturnObject &result)
|
||||
{
|
||||
|
@ -728,6 +773,7 @@ protected:
|
|||
{
|
||||
const size_t argc = args.GetArgumentCount();
|
||||
Stream &s = result.GetOutputStream();
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
|
||||
|
@ -791,55 +837,120 @@ protected:
|
|||
}
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
StackFrame *frame = exe_ctx.GetFramePtr();
|
||||
CompileUnit *comp_unit = NULL;
|
||||
if (frame)
|
||||
const FileSpecList &compile_units = m_option_compile_units.GetOptionValue().GetCurrentValue();
|
||||
const FileSpecList &shlibs = m_option_shared_libraries.GetOptionValue().GetCurrentValue();
|
||||
SymbolContextList sc_list;
|
||||
const size_t num_compile_units = compile_units.GetSize();
|
||||
const size_t num_shlibs = shlibs.GetSize();
|
||||
if (num_compile_units == 0 && num_shlibs == 0)
|
||||
{
|
||||
comp_unit = frame->GetSymbolContext (eSymbolContextCompUnit).comp_unit;
|
||||
if (comp_unit)
|
||||
bool success = false;
|
||||
StackFrame *frame = exe_ctx.GetFramePtr();
|
||||
CompileUnit *comp_unit = NULL;
|
||||
if (frame)
|
||||
{
|
||||
const bool can_create = true;
|
||||
VariableListSP comp_unit_varlist_sp (comp_unit->GetVariableList(can_create));
|
||||
if (comp_unit_varlist_sp)
|
||||
SymbolContext sc = frame->GetSymbolContext (eSymbolContextCompUnit);
|
||||
if (sc.comp_unit)
|
||||
{
|
||||
size_t count = comp_unit_varlist_sp->GetSize();
|
||||
if (count > 0)
|
||||
const bool can_create = true;
|
||||
VariableListSP comp_unit_varlist_sp (sc.comp_unit->GetVariableList(can_create));
|
||||
if (comp_unit_varlist_sp)
|
||||
{
|
||||
s.Printf ("Global variables for %s/%s:\n",
|
||||
comp_unit->GetDirectory().GetCString(),
|
||||
comp_unit->GetFilename().GetCString());
|
||||
|
||||
success = true;
|
||||
for (uint32_t i=0; i<count; ++i)
|
||||
size_t count = comp_unit_varlist_sp->GetSize();
|
||||
if (count > 0)
|
||||
{
|
||||
VariableSP var_sp (comp_unit_varlist_sp->GetVariableAtIndex(i));
|
||||
if (var_sp)
|
||||
{
|
||||
ValueObjectSP valobj_sp (ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp));
|
||||
|
||||
if (valobj_sp)
|
||||
DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString());
|
||||
}
|
||||
DumpGlobalVariableList(exe_ctx, sc, *comp_unit_varlist_sp, s);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
if (frame)
|
||||
if (!success)
|
||||
{
|
||||
if (comp_unit)
|
||||
result.AppendErrorWithFormat ("no global variables in current compile unit: %s/%s\n",
|
||||
comp_unit->GetDirectory().GetCString(),
|
||||
comp_unit->GetFilename().GetCString());
|
||||
if (frame)
|
||||
{
|
||||
if (comp_unit)
|
||||
result.AppendErrorWithFormat ("no global variables in current compile unit: %s/%s\n",
|
||||
comp_unit->GetDirectory().GetCString(),
|
||||
comp_unit->GetFilename().GetCString());
|
||||
else
|
||||
result.AppendError ("no debug information for frame %u\n", frame->GetFrameIndex());
|
||||
}
|
||||
else
|
||||
result.AppendError ("no debug information for frame %u\n", frame->GetFrameIndex());
|
||||
}
|
||||
result.AppendError ("'target variable' takes one or more global variable names as arguments\n");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SymbolContextList sc_list;
|
||||
const bool append = true;
|
||||
// We have one or more compile unit or shlib
|
||||
if (num_shlibs > 0)
|
||||
{
|
||||
for (size_t shlib_idx=0; shlib_idx<num_shlibs; ++shlib_idx)
|
||||
{
|
||||
const FileSpec module_file(shlibs.GetFileSpecAtIndex(shlib_idx));
|
||||
ModuleSpec module_spec (module_file);
|
||||
|
||||
ModuleSP module_sp (target->GetImages().FindFirstModule(module_spec));
|
||||
if (module_sp)
|
||||
{
|
||||
if (num_compile_units > 0)
|
||||
{
|
||||
for (size_t cu_idx=0; cu_idx<num_compile_units; ++cu_idx)
|
||||
module_sp->FindCompileUnits(compile_units.GetFileSpecAtIndex(cu_idx), append, sc_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc.module_sp = module_sp;
|
||||
sc_list.Append(sc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Didn't find matching shlib/module in target...
|
||||
result.AppendErrorWithFormat ("target doesn't contain the specified shared library: %s%s%s\n",
|
||||
module_file.GetDirectory().GetCString(),
|
||||
module_file.GetDirectory() ? "/" : "",
|
||||
module_file.GetFilename().GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
result.AppendError ("'target variable' takes one or more global variable names as arguments\n");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
{
|
||||
// No shared libraries, we just want to find globals for the compile units files that were specified
|
||||
for (size_t cu_idx=0; cu_idx<num_compile_units; ++cu_idx)
|
||||
target->GetImages().FindCompileUnits(compile_units.GetFileSpecAtIndex(cu_idx), append, sc_list);
|
||||
}
|
||||
|
||||
const uint32_t num_scs = sc_list.GetSize();
|
||||
if (num_scs > 0)
|
||||
{
|
||||
SymbolContext sc;
|
||||
for (uint32_t sc_idx=0; sc_idx<num_scs; ++sc_idx)
|
||||
{
|
||||
if (sc_list.GetContextAtIndex(sc_idx, sc))
|
||||
{
|
||||
if (sc.comp_unit)
|
||||
{
|
||||
const bool can_create = true;
|
||||
VariableListSP comp_unit_varlist_sp (sc.comp_unit->GetVariableList(can_create));
|
||||
if (comp_unit_varlist_sp)
|
||||
DumpGlobalVariableList(exe_ctx, sc, *comp_unit_varlist_sp, s);
|
||||
}
|
||||
else if (sc.module_sp)
|
||||
{
|
||||
// Get all global variables for this module
|
||||
lldb_private::RegularExpression all_globals_regex("."); // Any global with at least one character
|
||||
VariableList variable_list;
|
||||
sc.module_sp->FindGlobalVariables(all_globals_regex, append, UINT32_MAX, variable_list);
|
||||
DumpGlobalVariableList(exe_ctx, sc, variable_list, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1980,7 +2091,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -2913,7 +3024,7 @@ public:
|
|||
virtual Error
|
||||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
if (short_option == 'g')
|
||||
{
|
||||
m_use_global_module_list = true;
|
||||
|
@ -3368,7 +3479,7 @@ public:
|
|||
{
|
||||
Error error;
|
||||
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -3601,7 +3712,7 @@ public:
|
|||
{
|
||||
Error error;
|
||||
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -4489,7 +4600,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -818,7 +818,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -209,7 +209,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
@ -374,7 +374,7 @@ private:
|
|||
const char *option_value)
|
||||
{
|
||||
Error error;
|
||||
const char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
@ -915,7 +915,7 @@ Error
|
|||
CommandObjectTypeSummaryAdd::CommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
@ -1417,7 +1417,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1580,7 +1580,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -1724,7 +1724,7 @@ class CommandObjectTypeSummaryList : public CommandObjectParsed
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -2287,7 +2287,7 @@ class CommandObjectTypeFilterList : public CommandObjectParsed
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -2501,7 +2501,7 @@ class CommandObjectTypeSynthList : public CommandObjectParsed
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -2699,7 +2699,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -2865,7 +2865,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -3032,7 +3032,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -3161,7 +3161,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -3658,7 +3658,7 @@ private:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
bool success;
|
||||
|
||||
switch (short_option)
|
||||
|
|
|
@ -213,7 +213,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -642,7 +642,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -799,7 +799,7 @@ public:
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -396,7 +396,7 @@ but do NOT enter more than one command per line. \n" );
|
|||
SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -100,7 +100,7 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args)
|
|||
if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP))
|
||||
{
|
||||
struct timeval tv = TimeValue::Now().GetAsTimeVal();
|
||||
header.Printf ("%9ld.%6.6ld ", tv.tv_sec, tv.tv_usec);
|
||||
header.Printf ("%9ld.%6.6" PRIi32 " ", tv.tv_sec, tv.tv_usec);
|
||||
}
|
||||
|
||||
// Add the process and thread if requested
|
||||
|
|
|
@ -625,13 +625,16 @@ Args::ParseOptions (Options &options)
|
|||
{
|
||||
if (long_options[i].flag == NULL)
|
||||
{
|
||||
sstr << (char)long_options[i].val;
|
||||
switch (long_options[i].has_arg)
|
||||
if (isprint(long_options[i].val))
|
||||
{
|
||||
default:
|
||||
case no_argument: break;
|
||||
case required_argument: sstr << ':'; break;
|
||||
case optional_argument: sstr << "::"; break;
|
||||
sstr << (char)long_options[i].val;
|
||||
switch (long_options[i].has_arg)
|
||||
{
|
||||
default:
|
||||
case no_argument: break;
|
||||
case required_argument: sstr << ':'; break;
|
||||
case optional_argument: sstr << "::"; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -645,7 +648,10 @@ Args::ParseOptions (Options &options)
|
|||
while (1)
|
||||
{
|
||||
int long_options_index = -1;
|
||||
val = ::getopt_long(GetArgumentCount(), GetArgumentVector(), sstr.GetData(), long_options,
|
||||
val = ::getopt_long(GetArgumentCount(),
|
||||
GetArgumentVector(),
|
||||
sstr.GetData(),
|
||||
long_options,
|
||||
&long_options_index);
|
||||
if (val == -1)
|
||||
break;
|
||||
|
@ -1092,7 +1098,7 @@ Args::FindArgumentIndexForOption (struct option *long_options, int long_options_
|
|||
{
|
||||
char short_buffer[3];
|
||||
char long_buffer[255];
|
||||
::snprintf (short_buffer, sizeof (short_buffer), "-%c", (char) long_options[long_options_index].val);
|
||||
::snprintf (short_buffer, sizeof (short_buffer), "-%c", long_options[long_options_index].val);
|
||||
::snprintf (long_buffer, sizeof (long_buffer), "--%s", long_options[long_options_index].name);
|
||||
size_t end = GetArgumentCount ();
|
||||
size_t idx = 0;
|
||||
|
@ -1216,7 +1222,7 @@ Args::ParseAliasOptions (Options &options,
|
|||
if (long_options_index >= 0)
|
||||
{
|
||||
StreamString option_str;
|
||||
option_str.Printf ("-%c", (char) val);
|
||||
option_str.Printf ("-%c", val);
|
||||
|
||||
switch (long_options[long_options_index].has_arg)
|
||||
{
|
||||
|
@ -1256,16 +1262,14 @@ Args::ParseAliasOptions (Options &options,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
result.AppendErrorWithFormat
|
||||
("error with options table; invalid value in has_arg field for option '%c'.\n",
|
||||
(char) val);
|
||||
result.AppendErrorWithFormat ("error with options table; invalid value in has_arg field for option '%c'.\n", val);
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.AppendErrorWithFormat ("Invalid option with value '%c'.\n", (char) val);
|
||||
result.AppendErrorWithFormat ("Invalid option with value '%c'.\n", val);
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ OptionGroupArchitecture::SetOptionValue (CommandInterpreter &interpreter,
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace lldb_private;
|
|||
OptionGroupBoolean::OptionGroupBoolean (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
const char *usage_text,
|
||||
bool default_value,
|
||||
bool no_argument_toggle_default) :
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace lldb_private;
|
|||
OptionGroupFile::OptionGroupFile (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text) :
|
||||
|
@ -60,7 +60,7 @@ OptionGroupFile::OptionParsingStarting (CommandInterpreter &interpreter)
|
|||
OptionGroupFileList::OptionGroupFileList (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text) :
|
||||
|
@ -83,8 +83,8 @@ OptionGroupFileList::~OptionGroupFileList ()
|
|||
|
||||
Error
|
||||
OptionGroupFileList::SetOptionValue (CommandInterpreter &interpreter,
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error (m_file_list.SetValueFromCString (option_arg));
|
||||
return error;
|
||||
|
|
|
@ -67,7 +67,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ static OptionDefinition
|
|||
g_option_table[] =
|
||||
{
|
||||
{ LLDB_OPT_SET_1 , false, "outfile", 'o', required_argument, NULL, 0, eArgTypeFilename , "Specify a path for capturing command output."},
|
||||
{ LLDB_OPT_SET_1 , false, "append-outfile" , 'A', no_argument, NULL, 0, eArgTypeNone , "Append to the the file specified with '--outfile <path>'."},
|
||||
{ LLDB_OPT_SET_1 , false, "append-outfile" , 'apnd', no_argument, NULL, 0, eArgTypeNone , "Append to the the file specified with '--outfile <path>'."},
|
||||
};
|
||||
|
||||
uint32_t
|
||||
|
@ -49,11 +49,11 @@ OptionGroupOutputFile::GetDefinitions ()
|
|||
|
||||
Error
|
||||
OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter,
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter,
|
|||
error = m_file.SetValueFromCString (option_arg);
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
case 'apnd':
|
||||
m_append.SetCurrentValue(true);
|
||||
break;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ OptionGroupPlatform::SetOptionValue (CommandInterpreter &interpreter,
|
|||
if (!m_include_platform_option)
|
||||
++option_idx;
|
||||
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace lldb_private;
|
|||
OptionGroupString::OptionGroupString (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text,
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace lldb_private;
|
|||
OptionGroupUInt64::OptionGroupUInt64 (uint32_t usage_mask,
|
||||
bool required,
|
||||
const char *long_option,
|
||||
char short_option,
|
||||
int short_option,
|
||||
uint32_t completion_type,
|
||||
lldb::CommandArgumentType argument_type,
|
||||
const char *usage_text,
|
||||
|
|
|
@ -47,11 +47,11 @@ OptionGroupUUID::GetDefinitions ()
|
|||
|
||||
Error
|
||||
OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
bool success = false;
|
||||
|
||||
switch (short_option)
|
||||
|
|
|
@ -24,14 +24,14 @@ using namespace lldb_private;
|
|||
static OptionDefinition
|
||||
g_option_table[] =
|
||||
{
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-args", 'a', no_argument, NULL, 0, eArgTypeNone, "Omit function arguments."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-locals", 'l', no_argument, NULL, 0, eArgTypeNone, "Omit local variables."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g', no_argument, NULL, 0, eArgTypeNone, "Show the current frame source file global and static variables."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration",'c', no_argument, NULL, 0, eArgTypeNone, "Show variable declaration information (source file and line where the variable was declared)."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "scope", 's', no_argument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."},
|
||||
{ LLDB_OPT_SET_1, false, "summary", 'y', required_argument, NULL, 0, eArgTypeName, "Specify the summary that the variable output should use."},
|
||||
{ LLDB_OPT_SET_2, false, "summary-string", 'z', required_argument, NULL, 0, eArgTypeName, "Specify a summary string to use to format the variable output."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-args", 'a', no_argument, NULL, 0, eArgTypeNone, "Omit function arguments."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "no-locals", 'l', no_argument, NULL, 0, eArgTypeNone, "Omit local variables."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-globals", 'g', no_argument, NULL, 0, eArgTypeNone, "Show the current frame source file global and static variables."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "show-declaration",'c', no_argument, NULL, 0, eArgTypeNone, "Show variable declaration information (source file and line where the variable was declared)."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "regex", 'r', no_argument, NULL, 0, eArgTypeRegularExpression, "The <variable-name> argument for name lookups are regular expressions."},
|
||||
{ LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "scope", 's', no_argument, NULL, 0, eArgTypeNone, "Show variable scope (argument, local, global, static)."},
|
||||
{ LLDB_OPT_SET_1, false, "summary", 'y', required_argument, NULL, 0, eArgTypeName, "Specify the summary that the variable output should use."},
|
||||
{ LLDB_OPT_SET_2, false, "summary-string", 'z', required_argument, NULL, 0, eArgTypeName, "Specify a summary string to use to format the variable output."},
|
||||
};
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ OptionGroupVariable::SetOptionValue (CommandInterpreter &interpreter,
|
|||
Error error;
|
||||
if (!include_frame_options)
|
||||
option_idx += 3;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'r': use_regex = true; break;
|
||||
|
|
|
@ -73,7 +73,7 @@ OptionGroupWatchpoint::SetOptionValue (CommandInterpreter &interpreter,
|
|||
const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) g_option_table[option_idx].short_option;
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'w':
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// C++ Includes
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
@ -58,7 +58,7 @@ Options::NotifyOptionParsingFinished ()
|
|||
void
|
||||
Options::OptionSeen (int option_idx)
|
||||
{
|
||||
m_seen_options.insert ((char) option_idx);
|
||||
m_seen_options.insert (option_idx);
|
||||
}
|
||||
|
||||
// Returns true is set_a is a subset of set_b; Otherwise returns false.
|
||||
|
@ -266,37 +266,54 @@ Options::GetLongOptions ()
|
|||
return NULL;
|
||||
|
||||
uint32_t i;
|
||||
uint32_t j;
|
||||
const OptionDefinition *opt_defs = GetDefinitions();
|
||||
|
||||
std::bitset<256> option_seen;
|
||||
std::map<int, uint32_t> option_seen;
|
||||
|
||||
m_getopt_table.resize(num_options + 1);
|
||||
for (i = 0, j = 0; i < num_options; ++i)
|
||||
for (i = 0; i < num_options; ++i)
|
||||
{
|
||||
const char short_opt = opt_defs[i].short_option;
|
||||
const int short_opt = opt_defs[i].short_option;
|
||||
|
||||
if (option_seen.test(short_opt) == false)
|
||||
m_getopt_table[i].name = opt_defs[i].long_option;
|
||||
m_getopt_table[i].has_arg = opt_defs[i].option_has_arg;
|
||||
m_getopt_table[i].flag = NULL;
|
||||
m_getopt_table[i].val = short_opt;
|
||||
|
||||
if (option_seen.find(short_opt) == option_seen.end())
|
||||
{
|
||||
m_getopt_table[j].name = opt_defs[i].long_option;
|
||||
m_getopt_table[j].has_arg = opt_defs[i].option_has_arg;
|
||||
m_getopt_table[j].flag = NULL;
|
||||
m_getopt_table[j].val = short_opt;
|
||||
option_seen.set(short_opt);
|
||||
++j;
|
||||
option_seen[short_opt] = i;
|
||||
}
|
||||
else
|
||||
else if (short_opt)
|
||||
{
|
||||
assert (!"duplicate short option character");
|
||||
m_getopt_table[i].val = 0;
|
||||
std::map<int, uint32_t>::const_iterator pos = option_seen.find(short_opt);
|
||||
StreamString strm;
|
||||
if (isprint(short_opt))
|
||||
Host::SystemLog (Host::eSystemLogError, "option[%u] --%s has a short option -%c that conflicts with option[%u] --%s, short option won't be used for --%s\n",
|
||||
i,
|
||||
opt_defs[i].long_option,
|
||||
short_opt,
|
||||
pos->second,
|
||||
m_getopt_table[pos->second].name,
|
||||
opt_defs[i].long_option);
|
||||
else
|
||||
Host::SystemLog (Host::eSystemLogError, "option[%u] --%s has a short option 0x%x that conflicts with option[%u] --%s, short option won't be used for --%s\n",
|
||||
i,
|
||||
opt_defs[i].long_option,
|
||||
short_opt,
|
||||
pos->second,
|
||||
m_getopt_table[pos->second].name,
|
||||
opt_defs[i].long_option);
|
||||
}
|
||||
}
|
||||
|
||||
//getopt_long requires a NULL final entry in the table:
|
||||
|
||||
m_getopt_table[j].name = NULL;
|
||||
m_getopt_table[j].has_arg = 0;
|
||||
m_getopt_table[j].flag = NULL;
|
||||
m_getopt_table[j].val = 0;
|
||||
m_getopt_table[i].name = NULL;
|
||||
m_getopt_table[i].has_arg = 0;
|
||||
m_getopt_table[i].flag = NULL;
|
||||
m_getopt_table[i].val = 0;
|
||||
}
|
||||
|
||||
if (m_getopt_table.empty())
|
||||
|
@ -393,6 +410,57 @@ Options::SupportsLongOption (const char *long_option)
|
|||
return false;
|
||||
}
|
||||
|
||||
enum OptionDisplayType
|
||||
{
|
||||
eDisplayBestOption,
|
||||
eDisplayShortOption,
|
||||
eDisplayLongOption
|
||||
};
|
||||
|
||||
static bool
|
||||
PrintOption (const OptionDefinition &opt_def,
|
||||
OptionDisplayType display_type,
|
||||
const char *header,
|
||||
const char *footer,
|
||||
bool show_optional,
|
||||
Stream &strm)
|
||||
{
|
||||
const bool has_short_option = isprint(opt_def.short_option) != 0;
|
||||
|
||||
if (display_type == eDisplayShortOption && !has_short_option)
|
||||
return false;
|
||||
|
||||
if (header && header[0])
|
||||
strm.PutCString(header);
|
||||
|
||||
if (show_optional && !opt_def.required)
|
||||
strm.PutChar('[');
|
||||
const bool show_short_option = has_short_option && display_type != eDisplayLongOption;
|
||||
if (show_short_option)
|
||||
strm.Printf ("-%c", opt_def.short_option);
|
||||
else
|
||||
strm.Printf ("--%s", opt_def.long_option);
|
||||
switch (opt_def.option_has_arg)
|
||||
{
|
||||
case no_argument:
|
||||
break;
|
||||
case required_argument:
|
||||
strm.Printf (" <%s>", CommandObject::GetArgumentName (opt_def.argument_type));
|
||||
break;
|
||||
|
||||
case optional_argument:
|
||||
strm.Printf ("%s[<%s>]",
|
||||
show_short_option ? "" : "=",
|
||||
CommandObject::GetArgumentName (opt_def.argument_type));
|
||||
break;
|
||||
}
|
||||
if (show_optional && !opt_def.required)
|
||||
strm.PutChar(']');
|
||||
if (footer && footer[0])
|
||||
strm.PutCString(footer);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Options::GenerateOptionUsage
|
||||
(
|
||||
|
@ -450,12 +518,12 @@ Options::GenerateOptionUsage
|
|||
// a single string. If a command has "-a" "-b" and "-c", this will show
|
||||
// up as [-abc]
|
||||
|
||||
std::set<char> options;
|
||||
std::set<char>::const_iterator options_pos, options_end;
|
||||
std::set<int> options;
|
||||
std::set<int>::const_iterator options_pos, options_end;
|
||||
bool first;
|
||||
for (i = 0, first = true; i < num_options; ++i)
|
||||
{
|
||||
if (opt_defs[i].usage_mask & opt_set_mask)
|
||||
if (opt_defs[i].usage_mask & opt_set_mask && isprint(opt_defs[i].short_option))
|
||||
{
|
||||
// Add current option to the end of out_stream.
|
||||
|
||||
|
@ -476,17 +544,17 @@ Options::GenerateOptionUsage
|
|||
options_pos != options_end;
|
||||
++options_pos)
|
||||
{
|
||||
if (i==0 && ::isupper (*options_pos))
|
||||
if (i==0 && ::islower (*options_pos))
|
||||
continue;
|
||||
if (i==1 && ::islower (*options_pos))
|
||||
if (i==1 && ::isupper (*options_pos))
|
||||
continue;
|
||||
strm << *options_pos;
|
||||
strm << (char)*options_pos;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0, options.clear(); i < num_options; ++i)
|
||||
{
|
||||
if (opt_defs[i].usage_mask & opt_set_mask)
|
||||
if (opt_defs[i].usage_mask & opt_set_mask && isprint(opt_defs[i].short_option))
|
||||
{
|
||||
// Add current option to the end of out_stream.
|
||||
|
||||
|
@ -507,11 +575,11 @@ Options::GenerateOptionUsage
|
|||
options_pos != options_end;
|
||||
++options_pos)
|
||||
{
|
||||
if (i==0 && ::isupper (*options_pos))
|
||||
if (i==0 && ::islower (*options_pos))
|
||||
continue;
|
||||
if (i==1 && ::islower (*options_pos))
|
||||
if (i==1 && ::isupper (*options_pos))
|
||||
continue;
|
||||
strm << *options_pos;
|
||||
strm << (char)*options_pos;
|
||||
}
|
||||
strm.PutChar(']');
|
||||
}
|
||||
|
@ -520,26 +588,10 @@ Options::GenerateOptionUsage
|
|||
|
||||
for (i = 0; i < num_options; ++i)
|
||||
{
|
||||
if (opt_defs[i].usage_mask & opt_set_mask)
|
||||
if (opt_defs[i].usage_mask & opt_set_mask && isprint(opt_defs[i].short_option))
|
||||
{
|
||||
// Add current option to the end of out_stream.
|
||||
CommandArgumentType arg_type = opt_defs[i].argument_type;
|
||||
|
||||
if (opt_defs[i].required)
|
||||
{
|
||||
if (opt_defs[i].option_has_arg == required_argument)
|
||||
{
|
||||
strm.Printf (" -%c <%s>",
|
||||
opt_defs[i].short_option,
|
||||
CommandObject::GetArgumentName (arg_type));
|
||||
}
|
||||
else if (opt_defs[i].option_has_arg == optional_argument)
|
||||
{
|
||||
strm.Printf (" -%c [<%s>]",
|
||||
opt_defs[i].short_option,
|
||||
CommandObject::GetArgumentName (arg_type));
|
||||
}
|
||||
}
|
||||
if (opt_defs[i].required && opt_defs[i].option_has_arg != no_argument)
|
||||
PrintOption (opt_defs[i], eDisplayBestOption, " ", NULL, true, strm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,17 +603,8 @@ Options::GenerateOptionUsage
|
|||
{
|
||||
// Add current option to the end of out_stream.
|
||||
|
||||
CommandArgumentType arg_type = opt_defs[i].argument_type;
|
||||
|
||||
if (! opt_defs[i].required)
|
||||
{
|
||||
if (opt_defs[i].option_has_arg == required_argument)
|
||||
strm.Printf (" [-%c <%s>]", opt_defs[i].short_option,
|
||||
CommandObject::GetArgumentName (arg_type));
|
||||
else if (opt_defs[i].option_has_arg == optional_argument)
|
||||
strm.Printf (" [-%c [<%s>]]", opt_defs[i].short_option,
|
||||
CommandObject::GetArgumentName (arg_type));
|
||||
}
|
||||
if (!opt_defs[i].required && opt_defs[i].option_has_arg != no_argument)
|
||||
PrintOption (opt_defs[i], eDisplayBestOption, " ", NULL, true, strm);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,86 +635,69 @@ Options::GenerateOptionUsage
|
|||
// This variable is used to keep track of which options' info we've printed out, because some options can be in
|
||||
// more than one usage level, but we only want to print the long form of its information once.
|
||||
|
||||
OptionSet options_seen;
|
||||
OptionSet::iterator pos;
|
||||
std::multimap<int, uint32_t> options_seen;
|
||||
strm.IndentMore (5);
|
||||
|
||||
std::vector<char> sorted_options;
|
||||
|
||||
|
||||
// Put the unique command options in a vector & sort it, so we can output them alphabetically (by short_option)
|
||||
// when writing out detailed help for each option.
|
||||
|
||||
for (i = 0; i < num_options; ++i)
|
||||
{
|
||||
pos = options_seen.find (opt_defs[i].short_option);
|
||||
if (pos == options_seen.end())
|
||||
{
|
||||
options_seen.insert (opt_defs[i].short_option);
|
||||
sorted_options.push_back (opt_defs[i].short_option);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort (sorted_options.begin(), sorted_options.end());
|
||||
options_seen.insert(std::make_pair(opt_defs[i].short_option, i));
|
||||
|
||||
// Go through the unique'd and alphabetically sorted vector of options, find the table entry for each option
|
||||
// and write out the detailed help information for that option.
|
||||
|
||||
int first_option_printed = 1;
|
||||
size_t end = sorted_options.size();
|
||||
for (size_t j = 0; j < end; ++j)
|
||||
bool first_option_printed = false;;
|
||||
|
||||
for (auto pos : options_seen)
|
||||
{
|
||||
char option = sorted_options[j];
|
||||
bool found = false;
|
||||
for (i = 0; i < num_options && !found; ++i)
|
||||
i = pos.second;
|
||||
//Print out the help information for this option.
|
||||
|
||||
// Put a newline separation between arguments
|
||||
if (first_option_printed)
|
||||
strm.EOL();
|
||||
else
|
||||
first_option_printed = true;
|
||||
|
||||
CommandArgumentType arg_type = opt_defs[i].argument_type;
|
||||
|
||||
StreamString arg_name_str;
|
||||
arg_name_str.Printf ("<%s>", CommandObject::GetArgumentName (arg_type));
|
||||
|
||||
strm.Indent ();
|
||||
if (opt_defs[i].short_option && isprint(opt_defs[i].short_option))
|
||||
{
|
||||
if (opt_defs[i].short_option == option)
|
||||
{
|
||||
found = true;
|
||||
//Print out the help information for this option.
|
||||
|
||||
// Put a newline separation between arguments
|
||||
if (first_option_printed)
|
||||
first_option_printed = 0;
|
||||
else
|
||||
strm.EOL();
|
||||
|
||||
CommandArgumentType arg_type = opt_defs[i].argument_type;
|
||||
|
||||
StreamString arg_name_str;
|
||||
arg_name_str.Printf ("<%s>", CommandObject::GetArgumentName (arg_type));
|
||||
|
||||
strm.Indent ();
|
||||
strm.Printf ("-%c", opt_defs[i].short_option);
|
||||
if (arg_type != eArgTypeNone)
|
||||
strm.Printf (" <%s>", CommandObject::GetArgumentName (arg_type));
|
||||
strm.Printf (" ( --%s", opt_defs[i].long_option);
|
||||
if (arg_type != eArgTypeNone)
|
||||
strm.Printf (" <%s>", CommandObject::GetArgumentName (arg_type));
|
||||
strm.PutCString(" )\n");
|
||||
|
||||
strm.IndentMore (5);
|
||||
|
||||
if (opt_defs[i].usage_text)
|
||||
OutputFormattedUsageText (strm,
|
||||
opt_defs[i].usage_text,
|
||||
screen_width);
|
||||
if (opt_defs[i].enum_values != NULL)
|
||||
{
|
||||
strm.Indent ();
|
||||
strm.Printf("Values: ");
|
||||
for (int k = 0; opt_defs[i].enum_values[k].string_value != NULL; k++)
|
||||
{
|
||||
if (k == 0)
|
||||
strm.Printf("%s", opt_defs[i].enum_values[k].string_value);
|
||||
else
|
||||
strm.Printf(" | %s", opt_defs[i].enum_values[k].string_value);
|
||||
}
|
||||
strm.EOL();
|
||||
}
|
||||
strm.IndentLess (5);
|
||||
}
|
||||
PrintOption (opt_defs[i], eDisplayShortOption, NULL, NULL, false, strm);
|
||||
PrintOption (opt_defs[i], eDisplayLongOption, " ( ", " )", false, strm);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Short option is not printable, just print long option
|
||||
PrintOption (opt_defs[i], eDisplayLongOption, NULL, NULL, false, strm);
|
||||
}
|
||||
strm.EOL();
|
||||
|
||||
strm.IndentMore (5);
|
||||
|
||||
if (opt_defs[i].usage_text)
|
||||
OutputFormattedUsageText (strm,
|
||||
opt_defs[i].usage_text,
|
||||
screen_width);
|
||||
if (opt_defs[i].enum_values != NULL)
|
||||
{
|
||||
strm.Indent ();
|
||||
strm.Printf("Values: ");
|
||||
for (int k = 0; opt_defs[i].enum_values[k].string_value != NULL; k++)
|
||||
{
|
||||
if (k == 0)
|
||||
strm.Printf("%s", opt_defs[i].enum_values[k].string_value);
|
||||
else
|
||||
strm.Printf(" | %s", opt_defs[i].enum_values[k].string_value);
|
||||
}
|
||||
strm.EOL();
|
||||
}
|
||||
strm.IndentLess (5);
|
||||
}
|
||||
|
||||
// Restore the indent level
|
||||
|
|
|
@ -67,7 +67,7 @@ VariableList::Clear()
|
|||
}
|
||||
|
||||
VariableSP
|
||||
VariableList::GetVariableAtIndex(uint32_t idx)
|
||||
VariableList::GetVariableAtIndex(uint32_t idx) const
|
||||
{
|
||||
VariableSP var_sp;
|
||||
if (idx < m_variables.size())
|
||||
|
|
|
@ -681,7 +681,7 @@ Error
|
|||
ProcessLaunchCommandOptions::SetOptionValue (uint32_t option_idx, const char *option_arg)
|
||||
{
|
||||
Error error;
|
||||
char short_option = (char) m_getopt_table[option_idx].val;
|
||||
const int short_option = m_getopt_table[option_idx].val;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
|
@ -52,9 +52,9 @@ class ExprFormattersTestCase(TestBase):
|
|||
self.runCmd("script import formatters")
|
||||
self.runCmd("script import foosynth")
|
||||
|
||||
self.runCmd("frame variable foo1 -T")
|
||||
self.runCmd("frame variable foo1.b -T")
|
||||
self.runCmd("frame variable foo1.b.b_ref -T")
|
||||
self.runCmd("frame variable foo1 --show-types")
|
||||
self.runCmd("frame variable foo1.b --show-types")
|
||||
self.runCmd("frame variable foo1.b.b_ref --show-types")
|
||||
|
||||
self.expect("expression *(new foo(47))",
|
||||
substrs = ['(int) a = 47', '(bar) b = {', '(int) i = 94', '(baz) b = {', '(int) k = 99'])
|
||||
|
|
|
@ -54,7 +54,7 @@ class BreakpointCommandTestCase(TestBase):
|
|||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
|
||||
|
||||
# Now add callbacks for the breakpoints just created.
|
||||
self.runCmd("breakpoint command add -s command -o 'frame variable -T -s' 1")
|
||||
self.runCmd("breakpoint command add -s command -o 'frame variable --show-types --scope' 1")
|
||||
self.runCmd("breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); print >> here, \"lldb\"; here.close()' 2")
|
||||
self.runCmd("breakpoint command add --python-function bktptcmd.function 3")
|
||||
|
||||
|
@ -73,7 +73,7 @@ class BreakpointCommandTestCase(TestBase):
|
|||
|
||||
self.expect("breakpoint command list 1", "Breakpoint 1 command ok",
|
||||
substrs = ["Breakpoint commands:",
|
||||
"frame variable -T -s"])
|
||||
"frame variable --show-types --scope"])
|
||||
self.expect("breakpoint command list 2", "Breakpoint 2 command ok",
|
||||
substrs = ["Breakpoint commands:",
|
||||
"here = open",
|
||||
|
|
|
@ -85,8 +85,8 @@ class BreakpointConditionsTestCase(TestBase):
|
|||
self.expect("process status", PROCESS_STOPPED,
|
||||
patterns = ['Process .* stopped'])
|
||||
|
||||
# 'frame variable -T val' should return 3 due to breakpoint condition.
|
||||
self.expect("frame variable -T val", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# 'frame variable --show-types val' should return 3 due to breakpoint condition.
|
||||
self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(int) val = 3')
|
||||
|
||||
# Also check the hit count, which should be 3, by design.
|
||||
|
@ -116,8 +116,8 @@ class BreakpointConditionsTestCase(TestBase):
|
|||
self.expect("process status", PROCESS_STOPPED,
|
||||
patterns = ['Process .* stopped'])
|
||||
|
||||
# 'frame variable -T val' should return 1 since it is the first breakpoint hit.
|
||||
self.expect("frame variable -T val", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# 'frame variable --show-types val' should return 1 since it is the first breakpoint hit.
|
||||
self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(int) val = 1')
|
||||
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class AdvDataFormatterTestCase(TestBase):
|
|||
'i_2',
|
||||
'k_2',
|
||||
'o_2'])
|
||||
self.expect('frame variable a_long_guy -A', matching=False,
|
||||
self.expect('frame variable a_long_guy --show-all-children', matching=False,
|
||||
substrs = ['...'])
|
||||
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
'a = 280']);
|
||||
|
||||
# check that expanding a pointer does the right thing
|
||||
self.expect("frame variable -P 1 f00_ptr",
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs = ['r = 45',
|
||||
'fake_a = 218103808',
|
||||
'a = 12'])
|
||||
|
@ -139,7 +139,7 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
self.expect('frame variable f00_1', matching=False,
|
||||
substrs = ['b = 1',
|
||||
'j = 17'])
|
||||
self.expect("frame variable -P 1 f00_ptr",
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs = ['r = 45',
|
||||
'fake_a = 218103808',
|
||||
'a = 12'])
|
||||
|
@ -151,7 +151,7 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
self.expect('frame variable f00_1',
|
||||
substrs = ['b = 1',
|
||||
'j = 17'])
|
||||
self.expect("frame variable -P 1 f00_ptr", matching=False,
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr", matching=False,
|
||||
substrs = ['r = 45',
|
||||
'fake_a = 218103808',
|
||||
'a = 12'])
|
||||
|
@ -176,7 +176,7 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
self.expect('frame variable f00_1', matching=False,
|
||||
substrs = ['b = 1',
|
||||
'j = 17'])
|
||||
self.expect("frame variable -P 1 f00_ptr",
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs = ['r = 45',
|
||||
'fake_a = 218103808',
|
||||
'a = 12'])
|
||||
|
|
|
@ -74,7 +74,7 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'}'])
|
||||
|
||||
# Skip the default (should be 1) levels of summaries
|
||||
self.expect('frame variable -Y',
|
||||
self.expect('frame variable --no-summary-depth',
|
||||
substrs = ['(DeepData_1) data1 = {',
|
||||
'm_child1 = 0x',
|
||||
'}',
|
||||
|
@ -86,7 +86,7 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'}'])
|
||||
|
||||
# Now skip 2 levels of summaries
|
||||
self.expect('frame variable -Y2',
|
||||
self.expect('frame variable --no-summary-depth=2',
|
||||
substrs = ['(DeepData_1) data1 = {',
|
||||
'm_child1 = 0x',
|
||||
'}',
|
||||
|
@ -99,15 +99,15 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'}'])
|
||||
|
||||
# Check that no "Level 3" comes out
|
||||
self.expect('frame variable data1.m_child1 -Y2', matching=False,
|
||||
self.expect('frame variable data1.m_child1 --no-summary-depth=2', matching=False,
|
||||
substrs = ['Level 3'])
|
||||
|
||||
# Now expand a pointer with 2 level of skipped summaries
|
||||
self.expect('frame variable data1.m_child1 -Y2',
|
||||
self.expect('frame variable data1.m_child1 --no-summary-depth=2',
|
||||
substrs = ['(DeepData_2 *) data1.m_child1 = 0x'])
|
||||
|
||||
# Deref and expand said pointer
|
||||
self.expect('frame variable *data1.m_child1 -Y2',
|
||||
self.expect('frame variable *data1.m_child1 --no-summary-depth=2',
|
||||
substrs = ['(DeepData_2) *data1.m_child1 = {',
|
||||
'm_child2 = {',
|
||||
'm_child1 = 0x',
|
||||
|
@ -115,7 +115,7 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'}'])
|
||||
|
||||
# Expand an expression, skipping 2 layers of summaries
|
||||
self.expect('frame variable data1.m_child1->m_child2 -Y2',
|
||||
self.expect('frame variable data1.m_child1->m_child2 --no-summary-depth=2',
|
||||
substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
|
||||
'm_child2 = {',
|
||||
'm_child1 = Level 5',
|
||||
|
@ -124,7 +124,7 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'}'])
|
||||
|
||||
# Expand same expression, skipping only 1 layer of summaries
|
||||
self.expect('frame variable data1.m_child1->m_child2 -Y1',
|
||||
self.expect('frame variable data1.m_child1->m_child2 --no-summary-depth=1',
|
||||
substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
|
||||
'm_child1 = 0x',
|
||||
'Level 4',
|
||||
|
@ -148,14 +148,14 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
self.skipTest("rdar://problem/9804600 wrong namespace for std::string in debug info")
|
||||
|
||||
# Expand same expression, skipping 3 layers of summaries
|
||||
self.expect('frame variable data1.m_child1->m_child2 -T -Y3',
|
||||
self.expect('frame variable data1.m_child1->m_child2 --show-types --no-summary-depth=3',
|
||||
substrs = ['(DeepData_3) data1.m_child1->m_child2 = {',
|
||||
'm_some_text = "Just a test"',
|
||||
'm_child2 = {',
|
||||
'm_some_text = "Just a test"'])
|
||||
|
||||
# Expand within a standard string (might depend on the implementation of the C++ stdlib you use)
|
||||
self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 -Y2',
|
||||
self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=2',
|
||||
substrs = ['(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
|
||||
'm_some_text = {',
|
||||
'_M_dataplus = {',
|
||||
|
@ -163,18 +163,18 @@ class SkipSummaryDataFormatterTestCase(TestBase):
|
|||
'"Just a test"'])
|
||||
|
||||
# Repeat the above, but only skip 1 level of summaries
|
||||
self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 -Y1',
|
||||
self.expect('frame variable data1.m_child1->m_child2.m_child1.m_child2 --no-summary-depth=1',
|
||||
substrs = ['(DeepData_5) data1.m_child1->m_child2.m_child1.m_child2 = {',
|
||||
'm_some_text = "Just a test"',
|
||||
'}'])
|
||||
|
||||
# Change summary and expand, first without -Y then with -Y
|
||||
# Change summary and expand, first without --no-summary-depth then with --no-summary-depth
|
||||
self.runCmd("type summary add --summary-string \"${var.m_some_text}\" DeepData_5")
|
||||
|
||||
self.expect('fr var data2.m_child4.m_child2.m_child2',
|
||||
substrs = ['(DeepData_5) data2.m_child4.m_child2.m_child2 = "Just a test"'])
|
||||
|
||||
self.expect('fr var data2.m_child4.m_child2.m_child2 -Y',
|
||||
self.expect('fr var data2.m_child4.m_child2.m_child2 --no-summary-depth',
|
||||
substrs = ['(DeepData_5) data2.m_child4.m_child2.m_child2 = {',
|
||||
'm_some_text = "Just a test"',
|
||||
'}'])
|
||||
|
|
|
@ -58,7 +58,7 @@ class LibcxxListDataFormatterTestCase(TestBase):
|
|||
# Execute the cleanup function during test case tear down.
|
||||
self.addTearDownHook(cleanup)
|
||||
|
||||
self.runCmd("frame variable numbers_list -T")
|
||||
self.runCmd("frame variable numbers_list --show-types")
|
||||
self.runCmd("type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e")
|
||||
self.runCmd("type format add -f hex int")
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
|
|||
|
||||
self.expect('image list',substrs=['libc++.1.dylib','libc++abi.dylib'])
|
||||
|
||||
self.runCmd("frame variable ii -T")
|
||||
self.runCmd("frame variable ii --show-types")
|
||||
|
||||
self.runCmd("type summary add -x \"std::__1::map<\" --summary-string \"map has ${svar%#} items\" -e")
|
||||
|
||||
|
@ -135,7 +135,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
|
|||
substrs = ['map has 0 items',
|
||||
'{}'])
|
||||
|
||||
self.runCmd("frame variable si -T")
|
||||
self.runCmd("frame variable si --show-types")
|
||||
|
||||
self.expect('frame variable si',
|
||||
substrs = ['map has 0 items',
|
||||
|
@ -206,7 +206,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
|
|||
'{}'])
|
||||
|
||||
self.runCmd("n")
|
||||
self.runCmd("frame variable is -T")
|
||||
self.runCmd("frame variable is --show-types")
|
||||
|
||||
self.expect('frame variable is',
|
||||
substrs = ['map has 0 items',
|
||||
|
@ -267,7 +267,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
|
|||
'{}'])
|
||||
|
||||
self.runCmd("n");self.runCmd("n");
|
||||
self.runCmd("frame variable ss -T")
|
||||
self.runCmd("frame variable ss --show-types")
|
||||
|
||||
self.expect('frame variable ss',
|
||||
substrs = ['map has 0 items',
|
||||
|
|
|
@ -56,7 +56,7 @@ class StdListDataFormatterTestCase(TestBase):
|
|||
# Execute the cleanup function during test case tear down.
|
||||
self.addTearDownHook(cleanup)
|
||||
|
||||
self.runCmd("frame variable numbers_list -T")
|
||||
self.runCmd("frame variable numbers_list --show-types")
|
||||
#self.runCmd("type synth add std::int_list std::string_list int_list string_list -l StdListSynthProvider")
|
||||
self.runCmd("type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e")
|
||||
self.runCmd("type format add -f hex int")
|
||||
|
|
|
@ -56,7 +56,7 @@ class StdMapDataFormatterTestCase(TestBase):
|
|||
# Execute the cleanup function during test case tear down.
|
||||
self.addTearDownHook(cleanup)
|
||||
|
||||
self.runCmd("frame variable ii -T")
|
||||
self.runCmd("frame variable ii --show-types")
|
||||
|
||||
self.runCmd("type summary add -x \"std::map<\" --summary-string \"map has ${svar%#} items\" -e")
|
||||
|
||||
|
@ -136,7 +136,7 @@ class StdMapDataFormatterTestCase(TestBase):
|
|||
'{}'])
|
||||
|
||||
self.runCmd("n")
|
||||
self.runCmd("frame variable si -T")
|
||||
self.runCmd("frame variable si --show-types")
|
||||
|
||||
self.expect('frame variable si',
|
||||
substrs = ['map has 0 items',
|
||||
|
@ -211,7 +211,7 @@ class StdMapDataFormatterTestCase(TestBase):
|
|||
'{}'])
|
||||
|
||||
self.runCmd("n")
|
||||
self.runCmd("frame variable is -T")
|
||||
self.runCmd("frame variable is --show-types")
|
||||
|
||||
self.expect('frame variable is',
|
||||
substrs = ['map has 0 items',
|
||||
|
@ -272,7 +272,7 @@ class StdMapDataFormatterTestCase(TestBase):
|
|||
'{}'])
|
||||
|
||||
self.runCmd("n")
|
||||
self.runCmd("frame variable ss -T")
|
||||
self.runCmd("frame variable ss --show-types")
|
||||
|
||||
self.expect('frame variable ss',
|
||||
substrs = ['map has 0 items',
|
||||
|
|
|
@ -71,7 +71,7 @@ class SynthDataFormatterTestCase(TestBase):
|
|||
'z = 8'])
|
||||
|
||||
# if we skip synth and summary show y
|
||||
self.expect("frame variable int_bag -S false -Y1",
|
||||
self.expect("frame variable int_bag --synthetic-type false --no-summary-depth=1",
|
||||
substrs = ['x = 6',
|
||||
'y = 7',
|
||||
'z = 8'])
|
||||
|
@ -97,7 +97,7 @@ class SynthDataFormatterTestCase(TestBase):
|
|||
'z = 8'])
|
||||
|
||||
# If I skip summaries, still give me the artificial children
|
||||
self.expect("frame variable int_bag -Y1",
|
||||
self.expect("frame variable int_bag --no-summary-depth=1",
|
||||
substrs = ['x = 6',
|
||||
'z = 8'])
|
||||
|
||||
|
@ -135,14 +135,14 @@ class SynthDataFormatterTestCase(TestBase):
|
|||
|
||||
# ...even bitfields
|
||||
self.runCmd("type filter add BagOfBags --child x.y --child \"y->z[1-2]\"")
|
||||
self.expect('frame variable bag_bag -T',
|
||||
self.expect('frame variable bag_bag --show-types',
|
||||
substrs = ['x.y = 70',
|
||||
'(int:2) y->z[1-2] = 2'])
|
||||
|
||||
# ...even if we format the bitfields
|
||||
self.runCmd("type filter add BagOfBags --child x.y --child \"y->y[0-0]\"")
|
||||
self.runCmd("type format add \"int:1\" -f bool")
|
||||
self.expect('frame variable bag_bag -T',
|
||||
self.expect('frame variable bag_bag --show-types',
|
||||
substrs = ['x.y = 70',
|
||||
'(int:1) y->y[0-0] = true'])
|
||||
|
||||
|
@ -167,7 +167,7 @@ class SynthDataFormatterTestCase(TestBase):
|
|||
'array[2] = 3'])
|
||||
|
||||
# skip synthetic children
|
||||
self.expect('frame variable plenty_of_stuff -S no',
|
||||
self.expect('frame variable plenty_of_stuff --synthetic-type no',
|
||||
substrs = ['some_values = 0x0',
|
||||
'array = 0x',
|
||||
'array_size = 5'])
|
||||
|
@ -180,19 +180,19 @@ class SynthDataFormatterTestCase(TestBase):
|
|||
'*(plenty_of_stuff.array) = 3'])
|
||||
|
||||
# check that we do not lose location information for our children
|
||||
self.expect('frame variable plenty_of_stuff -L',
|
||||
self.expect('frame variable plenty_of_stuff --location',
|
||||
substrs = ['0x',
|
||||
': bitfield = 17'])
|
||||
|
||||
# check we work across pointer boundaries
|
||||
self.expect('frame variable plenty_of_stuff.some_values -P1',
|
||||
self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1',
|
||||
substrs = ['(BagOfInts *) plenty_of_stuff.some_values',
|
||||
'x = 5',
|
||||
'z = 7'])
|
||||
|
||||
# but not if we don't want to
|
||||
self.runCmd("type filter add BagOfInts --child x --child z -p")
|
||||
self.expect('frame variable plenty_of_stuff.some_values -P1',
|
||||
self.expect('frame variable plenty_of_stuff.some_values --ptr-depth=1',
|
||||
substrs = ['(BagOfInts *) plenty_of_stuff.some_values',
|
||||
'x = 5',
|
||||
'y = 6',
|
||||
|
|
|
@ -65,13 +65,13 @@ class DataFormatterRdar11988289TestCase(TestBase):
|
|||
substrs = ['3 key/value pairs','[0] = {','key = 0x','value = 0x','[1] = {','[2] = {'])
|
||||
self.expect('frame variable mutable --ptr-depth 1',
|
||||
substrs = ['4 key/value pairs','[0] = {','key = 0x','value = 0x','[1] = {','[2] = {','[3] = {'])
|
||||
self.expect('frame variable dictionary --ptr-depth 1 -d no-run-target',
|
||||
self.expect('frame variable dictionary --ptr-depth 1 --dynamic-type no-run-target',
|
||||
substrs = ['3 key/value pairs','@"bar"','@"2 objects"','@"baz"','2 key/value pairs'])
|
||||
self.expect('frame variable mutable --ptr-depth 1 -d no-run-target',
|
||||
self.expect('frame variable mutable --ptr-depth 1 --dynamic-type no-run-target',
|
||||
substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"puartist"','3 key/value pairs'])
|
||||
self.expect('frame variable mutable --ptr-depth 2 -d no-run-target',
|
||||
self.expect('frame variable mutable --ptr-depth 2 --dynamic-type no-run-target',
|
||||
substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"puartist"','3 key/value pairs {','@"bar"','@"2 objects"'])
|
||||
self.expect('frame variable mutable --ptr-depth 3 -d no-run-target',
|
||||
self.expect('frame variable mutable --ptr-depth 3 --dynamic-type no-run-target',
|
||||
substrs = ['4 key/value pairs','(int)23','@"123"','@"http://www.apple.com"','@"puartist"','3 key/value pairs {','@"bar"','@"2 objects"','(int)1','@"two"'])
|
||||
|
||||
self.assertTrue(self.frame().FindVariable("dictionary").MightHaveChildren(), "dictionary says it does not have children!")
|
||||
|
|
|
@ -64,7 +64,7 @@ class DataFormatterRdar12437442TestCase(TestBase):
|
|||
id_x.SetPreferSyntheticValue(True)
|
||||
|
||||
if self.TraceOn():
|
||||
self.runCmd("frame variable x -d run-target --ptr-depth 1")
|
||||
self.runCmd("frame variable x --dynamic-type run-target --ptr-depth 1")
|
||||
|
||||
self.assertTrue(id_x.GetSummary() == '@"5 objects"', "array does not get correct summary")
|
||||
|
||||
|
@ -75,7 +75,7 @@ class DataFormatterRdar12437442TestCase(TestBase):
|
|||
id_x.SetPreferSyntheticValue(True)
|
||||
|
||||
if self.TraceOn():
|
||||
self.runCmd("frame variable x -d run-target --ptr-depth 1")
|
||||
self.runCmd("frame variable x --dynamic-type run-target --ptr-depth 1")
|
||||
|
||||
self.assertTrue(id_x.GetNumChildren() == 7, "dictionary does not have 7 children")
|
||||
id_x.SetPreferSyntheticValue(False)
|
||||
|
|
|
@ -61,7 +61,7 @@ class StopHookForMultipleThreadsTestCase(TestBase):
|
|||
# Now run the program, expect to stop at the the first breakpoint which is within the stop-hook range.
|
||||
child.sendline('run')
|
||||
child.expect_exact(prompt)
|
||||
child.sendline('target stop-hook add -o "frame variable -g g_val"')
|
||||
child.sendline('target stop-hook add -o "frame variable --show-globals g_val"')
|
||||
child.expect_exact(prompt)
|
||||
|
||||
# Continue and expect to find the output emitted by the firing of our stop hook.
|
||||
|
|
|
@ -103,7 +103,7 @@ class WatchpointLLDBCommandTestCase(TestBase):
|
|||
'new value:', ' = 1'])
|
||||
|
||||
# The watchpoint command "forced" our global variable 'cookie' to become 777.
|
||||
self.expect("frame variable -g cookie",
|
||||
self.expect("frame variable --show-globals cookie",
|
||||
substrs = ['(int32_t)', 'cookie = 777'])
|
||||
|
||||
def watchpoint_command_can_disable_a_watchpoint(self):
|
||||
|
|
|
@ -90,7 +90,7 @@ class WatchpointPythonCommandTestCase(TestBase):
|
|||
'new value:', ' = 1'])
|
||||
|
||||
# The watchpoint command "forced" our global variable 'cookie' to become 777.
|
||||
self.expect("frame variable -g cookie",
|
||||
self.expect("frame variable --show-globals cookie",
|
||||
substrs = ['(int32_t)', 'cookie = 777'])
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class WatchpointConditionCmdTestCase(TestBase):
|
|||
# The stop reason of the thread should be watchpoint.
|
||||
self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
|
||||
substrs = ['stop reason = watchpoint'])
|
||||
self.expect("frame variable -g global",
|
||||
self.expect("frame variable --show-globals global",
|
||||
substrs = ['(int32_t)', 'global = 5'])
|
||||
|
||||
# Use the '-v' option to do verbose listing of the watchpoint.
|
||||
|
|
|
@ -71,7 +71,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
|
||||
# Issue 'variable list' command on several array-type variables.
|
||||
|
||||
self.expect("frame variable -T strings", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types strings", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(char *[4])',
|
||||
substrs = ['(char *) [0]',
|
||||
'(char *) [1]',
|
||||
|
@ -82,14 +82,14 @@ class ArrayTypesTestCase(TestBase):
|
|||
'Bonjour',
|
||||
'Guten Tag'])
|
||||
|
||||
self.expect("frame variable -T char_16", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types char_16", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['(char) [0]',
|
||||
'(char) [15]'])
|
||||
|
||||
self.expect("frame variable -T ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(unsigned short [2][3])')
|
||||
|
||||
self.expect("frame variable -T long_6", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types long_6", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(long [6])')
|
||||
|
||||
def array_types_python(self):
|
||||
|
|
|
@ -64,7 +64,7 @@ class BitfieldsTestCase(TestBase):
|
|||
substrs = [' resolved, hit count = 1'])
|
||||
|
||||
# This should display correctly.
|
||||
self.expect("frame variable -T bits", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types bits", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['(uint32_t:1) b1 = 1',
|
||||
'(uint32_t:2) b2 = 3',
|
||||
'(uint32_t:3) b3 = 7',
|
||||
|
@ -76,7 +76,7 @@ class BitfieldsTestCase(TestBase):
|
|||
|
||||
# And so should this.
|
||||
# rdar://problem/8348251
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['(uint32_t:1) b1 = 1',
|
||||
'(uint32_t:2) b2 = 3',
|
||||
'(uint32_t:3) b3 = 7',
|
||||
|
|
|
@ -48,7 +48,7 @@ class ForwardDeclarationTestCase(TestBase):
|
|||
|
||||
# This should display correctly.
|
||||
# Note that the member fields of a = 1 and b = 2 is by design.
|
||||
self.expect("frame variable -T *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['(bar) *bar_ptr = ',
|
||||
'(int) a = 1',
|
||||
'(int) b = 2'])
|
||||
|
|
|
@ -66,7 +66,7 @@ class FunctionTypesTestCase(TestBase):
|
|||
self.runToBreakpoint()
|
||||
|
||||
# Check that the 'callback' variable display properly.
|
||||
self.expect("frame variable -T callback", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types callback", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(int (*)(const char *)) callback =')
|
||||
|
||||
# And that we can break on the callback function.
|
||||
|
|
|
@ -13,13 +13,13 @@ class GlobalVariablesTestCase(TestBase):
|
|||
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
|
||||
@dsym_test
|
||||
def test_with_dsym(self):
|
||||
"""Test 'frame variable -s -a' which omits args and shows scopes."""
|
||||
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
|
||||
self.buildDsym()
|
||||
self.global_variables()
|
||||
|
||||
@dwarf_test
|
||||
def test_with_dwarf(self):
|
||||
"""Test 'frame variable -s -a' which omits args and shows scopes."""
|
||||
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
|
||||
self.buildDwarf()
|
||||
self.global_variables()
|
||||
|
||||
|
@ -34,7 +34,7 @@ class GlobalVariablesTestCase(TestBase):
|
|||
self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
|
||||
|
||||
def global_variables(self):
|
||||
"""Test 'frame variable -s -a' which omits args and shows scopes."""
|
||||
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
|
||||
exe = os.path.join(os.getcwd(), "a.out")
|
||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
|
@ -53,7 +53,7 @@ class GlobalVariablesTestCase(TestBase):
|
|||
substrs = [' resolved, hit count = 1'])
|
||||
|
||||
# Check that GLOBAL scopes are indicated for the variables.
|
||||
self.expect("frame variable -T -s -g -a", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types --scope --show-globals --no-args", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['GLOBAL: (int) g_file_global_int = 42',
|
||||
'GLOBAL: (const char *) g_file_global_cstr',
|
||||
'"g_file_global_cstr"',
|
||||
|
|
|
@ -61,63 +61,63 @@ class SetValuesTestCase(TestBase):
|
|||
substrs = [' resolved, hit count = 1'])
|
||||
|
||||
# main.c:15
|
||||
# Check that 'frame variable -T' displays the correct data type and value.
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# Check that 'frame variable --show-types' displays the correct data type and value.
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(char) i = 'a'")
|
||||
|
||||
# Now set variable 'i' and check that it is correctly displayed.
|
||||
self.runCmd("expression i = 'b'")
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(char) i = 'b'")
|
||||
|
||||
self.runCmd("continue")
|
||||
|
||||
# main.c:36
|
||||
# Check that 'frame variable -T' displays the correct data type and value.
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# Check that 'frame variable --show-types' displays the correct data type and value.
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
patterns = ["\((short unsigned int|unsigned short)\) i = 33"])
|
||||
|
||||
# Now set variable 'i' and check that it is correctly displayed.
|
||||
self.runCmd("expression i = 333")
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
patterns = ["\((short unsigned int|unsigned short)\) i = 333"])
|
||||
|
||||
self.runCmd("continue")
|
||||
|
||||
# main.c:57
|
||||
# Check that 'frame variable -T' displays the correct data type and value.
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# Check that 'frame variable --show-types' displays the correct data type and value.
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(long) i = 33")
|
||||
|
||||
# Now set variable 'i' and check that it is correctly displayed.
|
||||
self.runCmd("expression i = 33333")
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(long) i = 33333")
|
||||
|
||||
self.runCmd("continue")
|
||||
|
||||
# main.c:78
|
||||
# Check that 'frame variable -T' displays the correct data type and value.
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
# Check that 'frame variable --show-types' displays the correct data type and value.
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(double) i = 3.14159")
|
||||
|
||||
# Now set variable 'i' and check that it is correctly displayed.
|
||||
self.runCmd("expression i = 3.14")
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(double) i = 3.14")
|
||||
|
||||
self.runCmd("continue")
|
||||
|
||||
# main.c:85
|
||||
# Check that 'frame variable -T' displays the correct data type and value.
|
||||
# Check that 'frame variable --show-types' displays the correct data type and value.
|
||||
# rdar://problem/8422727
|
||||
# set_values test directory: 'frame variable' shows only (long double) i =
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(long double) i = 3.14159")
|
||||
|
||||
# Now set variable 'i' and check that it is correctly displayed.
|
||||
self.runCmd("expression i = 3.1")
|
||||
self.expect("frame variable -T", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(long double) i = 3.1")
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class ClassTypesTestCase(TestBase):
|
|||
substrs = [' resolved, hit count = 1'])
|
||||
|
||||
# We should be stopped on the ctor function of class C.
|
||||
self.expect("frame variable -T this", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types this", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['C *',
|
||||
' this = '])
|
||||
|
||||
|
@ -188,10 +188,10 @@ class ClassTypesTestCase(TestBase):
|
|||
self.expect("frame variable this",VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ['C *'])
|
||||
|
||||
# Verify that frame variable -T this->m_c_int behaves correctly.
|
||||
# Verify that frame variable --show-types this->m_c_int behaves correctly.
|
||||
self.runCmd("register read pc")
|
||||
self.runCmd("expr m_c_int")
|
||||
self.expect("frame variable -T this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = '(int) this->m_c_int = 66')
|
||||
|
||||
# Verify that 'expression this' gets the data type correct.
|
||||
|
|
|
@ -66,12 +66,12 @@ class NamespaceTestCase(TestBase):
|
|||
substrs = slist)
|
||||
|
||||
# 'frame variable' with basename 'i' should work.
|
||||
self.expect("frame variable -c -g i",
|
||||
self.expect("frame variable --show-declaration --show-globals i",
|
||||
startstr = "main.cpp:%d: (int) (anonymous namespace)::i = 3" % self.line_var_i)
|
||||
# main.cpp:12: (int) (anonymous namespace)::i = 3
|
||||
|
||||
# 'frame variable' with basename 'j' should work, too.
|
||||
self.expect("frame variable -c -g j",
|
||||
self.expect("frame variable --show-declaration --show-globals j",
|
||||
startstr = "main.cpp:%d: (int) A::B::j = 4" % self.line_var_j)
|
||||
# main.cpp:19: (int) A::B::j = 4
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class UnsignedTypesTestCase(TestBase):
|
|||
self.runCmd("thread step-over")
|
||||
|
||||
# Test that signed types display correctly.
|
||||
self.expect("frame variable -T -a", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
patterns = ["\((short int|short)\) the_signed_short = 99"],
|
||||
substrs = ["(signed char) the_signed_char = 'c'",
|
||||
"(int) the_signed_int = 99",
|
||||
|
|
|
@ -58,8 +58,8 @@ class UniqueTypesTestCase(TestBase):
|
|||
if clang_version < 3:
|
||||
self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
|
||||
|
||||
# Do a "frame variable -T longs" and verify "long" is in each line of output.
|
||||
self.runCmd("frame variable -T longs")
|
||||
# Do a "frame variable --show-types longs" and verify "long" is in each line of output.
|
||||
self.runCmd("frame variable --show-types longs")
|
||||
output = self.res.GetOutput()
|
||||
for x in [line.strip() for line in output.split(os.linesep)]:
|
||||
# Skip empty line or closing brace.
|
||||
|
@ -68,8 +68,8 @@ class UniqueTypesTestCase(TestBase):
|
|||
self.expect(x, "Expect type 'long'", exe=False,
|
||||
substrs = ['long'])
|
||||
|
||||
# Do a "frame variable -T shorts" and verify "short" is in each line of output.
|
||||
self.runCmd("frame variable -T shorts")
|
||||
# Do a "frame variable --show-types shorts" and verify "short" is in each line of output.
|
||||
self.runCmd("frame variable --show-types shorts")
|
||||
output = self.res.GetOutput()
|
||||
for x in [line.strip() for line in output.split(os.linesep)]:
|
||||
# Skip empty line or closing brace.
|
||||
|
|
|
@ -51,7 +51,7 @@ class UnsignedTypesTestCase(TestBase):
|
|||
substrs = [' resolved, hit count = 1'])
|
||||
|
||||
# Test that unsigned types display correctly.
|
||||
self.expect("frame variable -T -a", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(unsigned char) the_unsigned_char = 'c'",
|
||||
patterns = ["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
|
||||
substrs = ["(unsigned int) the_unsigned_int = 99",
|
||||
|
|
|
@ -146,7 +146,7 @@ class FoundationTestCase(TestBase):
|
|||
'NSString * str;',
|
||||
'NSDate * date;'])
|
||||
|
||||
self.expect("frame variable -T -s", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types --scope", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ["ARG: (MyString *) self"],
|
||||
patterns = ["ARG: \(.*\) _cmd",
|
||||
"(objc_selector *)|(SEL)"])
|
||||
|
@ -158,16 +158,16 @@ class FoundationTestCase(TestBase):
|
|||
# rdar://problem/8492646
|
||||
# test/foundation fails after updating to tot r115023
|
||||
# self->str displays nothing as output
|
||||
self.expect("frame variable -T self->str", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types self->str", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(NSString *) self->str")
|
||||
|
||||
# rdar://problem/8447030
|
||||
# 'frame variable self->date' displays the wrong data member
|
||||
self.expect("frame variable -T self->date", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types self->date", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
startstr = "(NSDate *) self->date")
|
||||
|
||||
# This should display the str and date member fields as well.
|
||||
self.expect("frame variable -T *self", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
self.expect("frame variable --show-types *self", VARIABLES_DISPLAYED_CORRECTLY,
|
||||
substrs = ["(MyString) *self",
|
||||
"(NSString *) str",
|
||||
"(NSDate *) date"])
|
||||
|
|
|
@ -48,13 +48,13 @@ class Rdar10967107TestCase(TestBase):
|
|||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
# check that we correctly see the const char*, even with dynamic types on
|
||||
self.expect("frame variable my_string", substrs = ['const char *'])
|
||||
self.expect("frame variable my_string -d run-target", substrs = ['const char *'])
|
||||
self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
|
||||
# check that expr also gets it right
|
||||
self.expect("expr my_string", substrs = ['const char *'])
|
||||
self.expect("expr -d true -- my_string", substrs = ['const char *'])
|
||||
# but check that we get the real Foolie as such
|
||||
self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
|
||||
self.expect("frame variable my_foolie -d run-target", substrs = ['FoolMeOnce *'])
|
||||
self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
|
||||
# check that expr also gets it right
|
||||
self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
|
||||
self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
|
||||
|
@ -62,13 +62,13 @@ class Rdar10967107TestCase(TestBase):
|
|||
self.runCmd("next")
|
||||
# check that we correctly see the const char*, even with dynamic types on
|
||||
self.expect("frame variable my_string", substrs = ['const char *'])
|
||||
self.expect("frame variable my_string -d run-target", substrs = ['const char *'])
|
||||
self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
|
||||
# check that expr also gets it right
|
||||
self.expect("expr my_string", substrs = ['const char *'])
|
||||
self.expect("expr -d true -- my_string", substrs = ['const char *'])
|
||||
# but check that we get the real Foolie as such
|
||||
self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
|
||||
self.expect("frame variable my_foolie -d run-target", substrs = ['FoolMeOnce *'])
|
||||
self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
|
||||
# check that expr also gets it right
|
||||
self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
|
||||
self.expect("expr -d true -- my_foolie", substrs = ['FoolMeOnce *'])
|
||||
|
|
|
@ -10,7 +10,7 @@ import lldbutil
|
|||
|
||||
def Msg(var, val, using_frame_variable):
|
||||
return "'%s %s' matches the output (from compiled code): %s" % (
|
||||
'frame variable -T' if using_frame_variable else 'expression' ,var, val)
|
||||
'frame variable --show-types' if using_frame_variable else 'expression' ,var, val)
|
||||
|
||||
class GenericTester(TestBase):
|
||||
|
||||
|
@ -116,7 +116,7 @@ class GenericTester(TestBase):
|
|||
lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
|
||||
|
||||
# Bring the program to the point where we can issue a series of
|
||||
# 'frame variable -T' command.
|
||||
# 'frame variable --show-types' command.
|
||||
if blockCaptured:
|
||||
break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
|
||||
else:
|
||||
|
@ -128,19 +128,19 @@ class GenericTester(TestBase):
|
|||
substrs = [" at basic_type.cpp:%d" % break_line,
|
||||
"stop reason = breakpoint"])
|
||||
|
||||
#self.runCmd("frame variable -T")
|
||||
#self.runCmd("frame variable --show-types")
|
||||
|
||||
# Now iterate through the golden list, comparing against the output from
|
||||
# 'frame variable -T var'.
|
||||
# 'frame variable --show-types var'.
|
||||
for var, val in gl:
|
||||
self.runCmd("frame variable -T %s" % var)
|
||||
self.runCmd("frame variable --show-types %s" % var)
|
||||
output = self.res.GetOutput()
|
||||
|
||||
# The input type is in a canonical form as a set of named atoms.
|
||||
# The display type string must conatin each and every element.
|
||||
#
|
||||
# Example:
|
||||
# runCmd: frame variable -T a_array_bounded[0]
|
||||
# runCmd: frame variable --show-types a_array_bounded[0]
|
||||
# output: (char) a_array_bounded[0] = 'a'
|
||||
#
|
||||
try:
|
||||
|
@ -209,7 +209,7 @@ class GenericTester(TestBase):
|
|||
substrs = [" at basic_type.cpp:%d" % break_line,
|
||||
"stop reason = breakpoint"])
|
||||
|
||||
#self.runCmd("frame variable -T")
|
||||
#self.runCmd("frame variable --show-types")
|
||||
|
||||
# Now iterate through the golden list, comparing against the output from
|
||||
# 'expr var'.
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct
|
|||
// then this option belongs to option set n.
|
||||
bool required; // This option is required (in the current usage level)
|
||||
const char * long_option; // Full name for this option.
|
||||
char short_option; // Single character for this option.
|
||||
int short_option; // Single character for this option.
|
||||
int option_has_arg; // no_argument, required_argument or optional_argument
|
||||
uint32_t completion_type; // Cookie the option class can use to do define the argument completion.
|
||||
lldb::CommandArgumentType argument_type; // Type of argument this option takes
|
||||
|
@ -578,7 +578,7 @@ Driver::ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &exit)
|
|||
|
||||
if (long_options_index >= 0)
|
||||
{
|
||||
const char short_option = (char) g_options[long_options_index].short_option;
|
||||
const int short_option = g_options[long_options_index].short_option;
|
||||
|
||||
switch (short_option)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue