summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Interpreter/CommandInterpreter.h10
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueBoolean.h10
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueEnumeration.h8
-rw-r--r--lldb/source/Core/Debugger.cpp35
-rw-r--r--lldb/source/Core/StringList.cpp5
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp24
-rw-r--r--lldb/source/Interpreter/CommandObjectRegexCommand.cpp3
-rw-r--r--lldb/source/Interpreter/OptionValueBoolean.cpp48
-rw-r--r--lldb/source/Interpreter/OptionValueEnumeration.cpp35
9 files changed, 161 insertions, 17 deletions
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 5706503aa87..c1b3d65748a 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -26,7 +26,9 @@
namespace lldb_private {
-class CommandInterpreter : public Broadcaster
+class CommandInterpreter :
+ public Broadcaster,
+ public Properties
{
public:
typedef std::map<std::string, OptionArgVectorSP> OptionArgMap;
@@ -449,6 +451,12 @@ public:
return "*** Some of your variables have more members than the debugger will show by default. To show all of them, you can either use the --show-all-children option to %s or raise the limit by changing the target.max-children-count setting.\n";
}
+ //------------------------------------------------------------------
+ // Properties
+ //------------------------------------------------------------------
+ bool
+ GetExpandRegexAliases () const;
+
protected:
friend class Debugger;
diff --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
index 27293bd9335..2b935e9e03e 100644
--- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -64,7 +64,15 @@ public:
m_value_was_set = false;
return true;
}
-
+
+ virtual size_t
+ AutoComplete (CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches);
+
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
diff --git a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
index 40628b3e6f9..012eeb68ac0 100644
--- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
+++ b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h
@@ -69,6 +69,14 @@ public:
virtual lldb::OptionValueSP
DeepCopy () const;
+ virtual size_t
+ AutoComplete (CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches);
+
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 682d57cd4bf..23fbbadbace 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -101,8 +101,8 @@ g_language_enumerators[] =
-PropertyDefinition
-g_instance_settings_table[] =
+static PropertyDefinition
+g_properties[] =
{
{ "auto-confirm", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true all confirmation prompts will receive their default reply." },
{ "frame-format", OptionValue::eTypeString , true, 0 , DEFAULT_FRAME_FORMAT, NULL, "The default frame format string to use when displaying stack frame information for threads." },
@@ -151,28 +151,28 @@ bool
Debugger::GetAutoConfirm () const
{
const uint32_t idx = ePropertyAutoConfirm;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_instance_settings_table[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
const char *
Debugger::GetFrameFormat() const
{
const uint32_t idx = ePropertyFrameFormat;
- return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_instance_settings_table[idx].default_cstr_value);
+ return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_properties[idx].default_cstr_value);
}
bool
Debugger::GetNotifyVoid () const
{
const uint32_t idx = ePropertyNotiftVoid;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_instance_settings_table[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
const char *
Debugger::GetPrompt() const
{
const uint32_t idx = ePropertyPrompt;
- return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_instance_settings_table[idx].default_cstr_value);
+ return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_properties[idx].default_cstr_value);
}
void
@@ -189,14 +189,14 @@ const char *
Debugger::GetThreadFormat() const
{
const uint32_t idx = ePropertyThreadFormat;
- return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_instance_settings_table[idx].default_cstr_value);
+ return m_collection_sp->GetPropertyAtIndexAsString (NULL, idx, g_properties[idx].default_cstr_value);
}
lldb::ScriptLanguage
Debugger::GetScriptLanguage() const
{
const uint32_t idx = ePropertyScriptLanguage;
- return (lldb::ScriptLanguage)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_instance_settings_table[idx].default_uint_value);
+ return (lldb::ScriptLanguage)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value);
}
bool
@@ -210,7 +210,7 @@ uint32_t
Debugger::GetTerminalWidth () const
{
const uint32_t idx = ePropertyTerminalWidth;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_instance_settings_table[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
}
bool
@@ -224,7 +224,7 @@ bool
Debugger::GetUseExternalEditor () const
{
const uint32_t idx = ePropertyUseExternalEditor;
- return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_instance_settings_table[idx].default_uint_value != 0);
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
bool
@@ -238,21 +238,21 @@ uint32_t
Debugger::GetStopSourceLineCount (bool before) const
{
const uint32_t idx = before ? ePropertyStopLineCountBefore : ePropertyStopLineCountAfter;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_instance_settings_table[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
}
Debugger::StopDisassemblyType
Debugger::GetStopDisassemblyDisplay () const
{
const uint32_t idx = ePropertyStopDisassemblyDisplay;
- return (Debugger::StopDisassemblyType)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_instance_settings_table[idx].default_uint_value);
+ return (Debugger::StopDisassemblyType)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value);
}
uint32_t
Debugger::GetDisassemblyLineCount () const
{
const uint32_t idx = ePropertyStopDisassemblyCount;
- return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_instance_settings_table[idx].default_uint_value);
+ return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
}
#pragma mark Debugger
@@ -431,11 +431,18 @@ Debugger::Debugger (lldb::LogOutputCallback log_callback, void *baton) :
assert (default_platform_sp.get());
m_platform_list.Append (default_platform_sp, true);
- m_collection_sp->Initialize (g_instance_settings_table);
+ m_collection_sp->Initialize (g_properties);
m_collection_sp->AppendProperty (ConstString("target"),
ConstString("Settings specify to debugging targets."),
true,
Target::GetGlobalProperties()->GetValueProperties());
+ if (m_command_interpreter_ap.get())
+ {
+ m_collection_sp->AppendProperty (ConstString("interpreter"),
+ ConstString("Settings specify to the debugger's command interpreter."),
+ true,
+ m_command_interpreter_ap->GetValueProperties());
+ }
OptionValueSInt64 *term_width = m_collection_sp->GetPropertyAtIndexAsOptionValueSInt64 (NULL, ePropertyTerminalWidth);
term_width->SetMinimumValue(10);
term_width->SetMaximumValue(1024);
diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp
index dae1c817ba5..18b6224a520 100644
--- a/lldb/source/Core/StringList.cpp
+++ b/lldb/source/Core/StringList.cpp
@@ -280,6 +280,11 @@ StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx)
}
}
}
+ else
+ {
+ // No string, so it matches everything
+ matches = *this;
+ }
return matches.GetSize();
}
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 05384e4a3e5..6ae9793cbd4 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -59,6 +59,19 @@
using namespace lldb;
using namespace lldb_private;
+
+static PropertyDefinition
+g_properties[] =
+{
+ { "expand-regex-aliases", OptionValue::eTypeBoolean, true, false, NULL, NULL, "If true, regular expression alias commands will show the expanded command that will be executed. This can be used to debug new regular expression alias commands." },
+ { NULL , OptionValue::eTypeInvalid, true, 0 , NULL, NULL, NULL }
+};
+
+enum
+{
+ ePropertyExpandRegexAliases = 0
+};
+
ConstString &
CommandInterpreter::GetStaticBroadcasterClass ()
{
@@ -73,6 +86,7 @@ CommandInterpreter::CommandInterpreter
bool synchronous_execution
) :
Broadcaster (&debugger, "lldb.command-interpreter"),
+ Properties(OptionValuePropertiesSP(new OptionValueProperties(ConstString("interpreter")))),
m_debugger (debugger),
m_synchronous_execution (synchronous_execution),
m_skip_lldbinit_files (false),
@@ -89,8 +103,18 @@ CommandInterpreter::CommandInterpreter
SetEventName (eBroadcastBitResetPrompt, "reset-prompt");
SetEventName (eBroadcastBitQuitCommandReceived, "quit");
CheckInWithManager ();
+ m_collection_sp->Initialize (g_properties);
}
+bool
+CommandInterpreter::GetExpandRegexAliases () const
+{
+ const uint32_t idx = ePropertyExpandRegexAliases;
+ return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
+}
+
+
+
void
CommandInterpreter::Initialize ()
{
diff --git a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
index de6faba4d87..27a67e5e02c 100644
--- a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -76,7 +76,8 @@ CommandObjectRegexCommand::DoExecute
}
}
// Interpret the new command and return this as the result!
- result.GetOutputStream().Printf("%s\n", new_command.c_str());
+ if (m_interpreter.GetExpandRegexAliases())
+ result.GetOutputStream().Printf("%s\n", new_command.c_str());
return m_interpreter.HandleCommand(new_command.c_str(), eLazyBoolCalculate, result);
}
}
diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp
index 4e6fd62bb69..6471943ee5d 100644
--- a/lldb/source/Interpreter/OptionValueBoolean.cpp
+++ b/lldb/source/Interpreter/OptionValueBoolean.cpp
@@ -14,6 +14,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
+#include "lldb/Core/StringList.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
@@ -84,4 +85,51 @@ OptionValueBoolean::DeepCopy () const
return OptionValueSP(new OptionValueBoolean(*this));
}
+size_t
+OptionValueBoolean::AutoComplete (CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ word_complete = false;
+ matches.Clear();
+ struct StringEntry {
+ const char *string;
+ const size_t length;
+ };
+ static const StringEntry g_autocomplete_entries[] =
+ {
+ { "true" , 4 },
+ { "false", 5 },
+ { "on" , 2 },
+ { "off" , 3 },
+ { "yes" , 3 },
+ { "no" , 2 },
+ { "1" , 1 },
+ { "0" , 1 },
+ };
+ const size_t k_num_autocomplete_entries = sizeof(g_autocomplete_entries)/sizeof(StringEntry);
+
+ if (s && s[0])
+ {
+ const size_t s_len = strlen(s);
+ for (size_t i=0; i<k_num_autocomplete_entries; ++i)
+ {
+ if (s_len <= g_autocomplete_entries[i].length)
+ if (::strncasecmp(s, g_autocomplete_entries[i].string, s_len) == 0)
+ matches.AppendString(g_autocomplete_entries[i].string);
+ }
+ }
+ else
+ {
+ // only suggest "true" or "false" by default
+ for (size_t i=0; i<2; ++i)
+ matches.AppendString(g_autocomplete_entries[i].string);
+ }
+ return matches.GetSize();
+}
+
+
diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp
index 61b184fe0a5..03314172931 100644
--- a/lldb/source/Interpreter/OptionValueEnumeration.cpp
+++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp
@@ -13,6 +13,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Core/StringList.h"
using namespace lldb;
using namespace lldb_private;
@@ -129,3 +130,37 @@ OptionValueEnumeration::DeepCopy () const
return OptionValueSP(new OptionValueEnumeration(*this));
}
+size_t
+OptionValueEnumeration::AutoComplete (CommandInterpreter &interpreter,
+ const char *s,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
+{
+ word_complete = false;
+ matches.Clear();
+
+ const uint32_t num_enumerators = m_enumerations.GetSize();
+ if (s && s[0])
+ {
+ const size_t s_len = strlen(s);
+ for (size_t i=0; i<num_enumerators; ++i)
+ {
+ const char *name = m_enumerations.GetCStringAtIndex(i);
+ if (::strncmp(s, name, s_len) == 0)
+ matches.AppendString(name);
+ }
+ }
+ else
+ {
+ // only suggest "true" or "false" by default
+ for (size_t i=0; i<num_enumerators; ++i)
+ matches.AppendString(m_enumerations.GetCStringAtIndex(i));
+ }
+ return matches.GetSize();
+}
+
+
+
+
OpenPOWER on IntegriCloud