summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/CommandInterpreter.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-08-26 22:05:43 +0000
committerGreg Clayton <gclayton@apple.com>2010-08-26 22:05:43 +0000
commit12fc3e0f3e5608f14ba755728bc3614f2438d867 (patch)
treeee48e484eceb0129978ba51c3e730023598e5f0d /lldb/source/Interpreter/CommandInterpreter.cpp
parentc8bd967430846ccdb8c5b19984022cf8ac7718df (diff)
downloadbcm5719-llvm-12fc3e0f3e5608f14ba755728bc3614f2438d867.tar.gz
bcm5719-llvm-12fc3e0f3e5608f14ba755728bc3614f2438d867.zip
Changed the StackID to store its start PC address as a load address instead of
a section offset address. Fixed up some very inefficient STL code. llvm-svn: 112230
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index a4df0616770..db5cb65f42e 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -494,25 +494,20 @@ CommandInterpreter::GetAliasHelp (const char *alias_name, const char *command_na
help_string.Printf ("'");
}
-std::string
+size_t
CommandInterpreter::FindLongestCommandWord (CommandObject::CommandMap &dict)
{
CommandObject::CommandMap::const_iterator pos;
- int max_len = 0;
- CommandObjectSP cmd_sp;
- std::string longest_word;
-
- for (pos = dict.begin(); pos != dict.end(); ++pos)
- {
- if ((max_len == 0)
- || (strlen (pos->first.c_str()) > max_len))
- {
- longest_word = pos->first;
- max_len = strlen (longest_word.c_str());
- }
- }
+ CommandObject::CommandMap::const_iterator end = dict.end();
+ size_t max_len = 0;
- return longest_word;
+ for (pos = dict.begin(); pos != end; ++pos)
+ {
+ size_t len = pos->first.size();
+ if (max_len < len)
+ max_len = len;
+ }
+ return max_len;
}
void
@@ -521,8 +516,7 @@ CommandInterpreter::GetHelp (CommandReturnObject &result)
CommandObject::CommandMap::const_iterator pos;
result.AppendMessage("The following is a list of built-in, permanent debugger commands:");
result.AppendMessage("");
- std::string longest_word = FindLongestCommandWord (m_command_dict);
- uint32_t max_len = strlen (longest_word.c_str());
+ uint32_t max_len = FindLongestCommandWord (m_command_dict);
for (pos = m_command_dict.begin(); pos != m_command_dict.end(); ++pos)
{
@@ -535,8 +529,8 @@ CommandInterpreter::GetHelp (CommandReturnObject &result)
{
result.AppendMessage("The following is a list of your current command abbreviations (see 'commands alias' for more info):");
result.AppendMessage("");
- longest_word = FindLongestCommandWord (m_alias_dict);
- max_len = strlen (longest_word.c_str());
+ max_len = FindLongestCommandWord (m_alias_dict);
+
for (pos = m_alias_dict.begin(); pos != m_alias_dict.end(); ++pos)
{
StreamString sstr;
OpenPOWER on IntegriCloud