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
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);
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);
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);
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,
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,
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;
Dump(Stream *s, bool show_context) const;
lldb::VariableSP
- GetVariableAtIndex(uint32_t idx);
+ GetVariableAtIndex(uint32_t idx) const;
lldb::VariableSP
RemoveVariableAtIndex (uint32_t idx);
// 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.
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
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)
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)
{
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)
{
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)
{
{
Error error;
- char short_option = (char) m_getopt_table[option_idx].val;
+ const int short_option = m_getopt_table[option_idx].val;
bool success;
{
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)
{
{
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':
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)
{
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)
{
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)
{
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)
{
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)
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)
{
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)
{
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)
{
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)
{
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':
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)
{
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':
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':
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;
}
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)
{
{
const size_t argc = args.GetArgumentCount();
Stream &s = result.GetOutputStream();
+
if (argc > 0)
{
}
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 (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 ("'target variable' takes one or more global variable names as arguments\n");
+ result.SetStatus (eReturnStatusFailed);
+ }
}
- if (!success)
+ else
{
- if (frame)
+ SymbolContextList sc_list;
+ const bool append = true;
+ // We have one or more compile unit or shlib
+ if (num_shlibs > 0)
{
- 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());
- }
+ 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);
+ }
+ }
+ }
+ }
}
}
}
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)
{
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;
{
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)
{
{
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)
{
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)
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)
{
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)
{
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)
{
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)
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)
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)
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
{
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)
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)
{
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)
{
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)
{
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)
{
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
{
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;
+ }
}
}
}
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;
{
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;
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)
{
}
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);
}
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)
{
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) :
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) :
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) :
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;
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)
{
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
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)
{
error = m_file.SetValueFromCString (option_arg);
break;
- case 'A':
+ case 'apnd':
m_append.SetCurrentValue(true);
break;
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)
{
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,
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,
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)
{
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)
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."},
};
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;
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':
// C++ Includes
#include <algorithm>
#include <bitset>
-#include <set>
+#include <map>
// Other libraries and framework includes
// Project includes
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.
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;
+
+ 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.test(short_opt) == false)
+ 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())
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
(
// 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.
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.
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(']');
}
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);
}
}
{
// 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);
}
}
// 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))
+ {
+ PrintOption (opt_defs[i], eDisplayShortOption, NULL, NULL, false, strm);
+ PrintOption (opt_defs[i], eDisplayLongOption, " ( ", " )", false, strm);
+ }
+ else
{
- if (opt_defs[i].short_option == option)
+ // 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++)
{
- found = true;
- //Print out the help information for this option.
-
- // Put a newline separation between arguments
- if (first_option_printed)
- first_option_printed = 0;
+ if (k == 0)
+ strm.Printf("%s", opt_defs[i].enum_values[k].string_value);
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);
+ strm.Printf(" | %s", opt_defs[i].enum_values[k].string_value);
}
+ strm.EOL();
}
+ strm.IndentLess (5);
}
// Restore the indent level
}
VariableSP
-VariableList::GetVariableAtIndex(uint32_t idx)
+VariableList::GetVariableAtIndex(uint32_t idx) const
{
VariableSP var_sp;
if (idx < m_variables.size())
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)
{
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'])
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")
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",
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.
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')
'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 = ['...'])
'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'])
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'])
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'])
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'])
'}'])
# 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',
'}',
'}'])
# 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',
'}',
'}'])
# 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',
'}'])
# 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',
'}'])
# 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',
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 = {',
'"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"',
'}'])
# 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")
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")
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',
'{}'])
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',
'{}'])
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',
# 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")
# 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")
'{}'])
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',
'{}'])
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',
'{}'])
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',
'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'])
'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'])
# ...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'])
'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'])
'*(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',
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!")
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")
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)
# 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.
'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):
'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'])
# 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.
# 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]',
'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):
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',
# 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',
# 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'])
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.
@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()
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)
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"',
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")
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 = '])
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.
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
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",
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.
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.
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",
'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)"])
# 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"])
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 *'])
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 *'])
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):
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:
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:
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'.
// 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
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)
{