Added new OptionGroup classes for UInt64, UUID, File and Boolean values.
Removed the "image" command and moved it to "target modules". Added an alias
for "image" to "target modules".
Added some new target commands to be able to add and load modules to a target:
(lldb) target modules add <path>
(lldb) target modules load [--file <path>] [--slide <offset>] [<sect-name> <sect-load-addr> ...]
So you can load individual sections without running a target:
(lldb) target modules load --file /usr/lib/libSystem.B.dylib __TEXT 0x7fccc80000 __DATA 0x1234000000
Or you can rigidly slide an entire shared library:
(lldb) target modules load --file /usr/lib/libSystem.B.dylib --slid 0x7fccc80000
This should improve bare board debugging when symbol files need to be slid around manually.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130796 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 16e5f3b..dad3323 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -22,7 +22,6 @@
//#include "../Commands/CommandObjectFile.h"
#include "../Commands/CommandObjectFrame.h"
#include "../Commands/CommandObjectHelp.h"
-#include "../Commands/CommandObjectImage.h"
#include "../Commands/CommandObjectLog.h"
#include "../Commands/CommandObjectMemory.h"
#include "../Commands/CommandObjectPlatform.h"
@@ -118,6 +117,7 @@
HandleCommand ("command alias up _regexp-up", false, result);
HandleCommand ("command alias down _regexp-down", false, result);
HandleCommand ("command alias file target create", false, result);
+ HandleCommand ("command alias image target modules", false, result);
}
@@ -169,7 +169,7 @@
// m_command_dict["file"] = CommandObjectSP (new CommandObjectFile (*this));
m_command_dict["frame"] = CommandObjectSP (new CommandObjectMultiwordFrame (*this));
m_command_dict["help"] = CommandObjectSP (new CommandObjectHelp (*this));
- m_command_dict["image"] = CommandObjectSP (new CommandObjectImage (*this));
+ /// m_command_dict["image"] = CommandObjectSP (new CommandObjectImage (*this));
m_command_dict["log"] = CommandObjectSP (new CommandObjectLog (*this));
m_command_dict["memory"] = CommandObjectSP (new CommandObjectMemory (*this));
m_command_dict["platform"] = CommandObjectSP (new CommandObjectPlatform (*this));
diff --git a/source/Interpreter/NamedOptionValue.cpp b/source/Interpreter/NamedOptionValue.cpp
index 6ccc8d0..4ab9810 100644
--- a/source/Interpreter/NamedOptionValue.cpp
+++ b/source/Interpreter/NamedOptionValue.cpp
@@ -96,6 +96,16 @@
return NULL;
}
+OptionValueUUID *
+OptionValue::GetAsUUID ()
+{
+ if (GetType () == OptionValue::eTypeUUID)
+ return static_cast<OptionValueUUID *>(this);
+ return NULL;
+
+}
+
+
OptionValueArray *
OptionValue::GetAsArray ()
{
@@ -306,6 +316,24 @@
//-------------------------------------------------------------------------
+// OptionValueUUID
+//-------------------------------------------------------------------------
+void
+OptionValueUUID::DumpValue (Stream &strm)
+{
+ m_uuid.Dump (&strm);
+}
+
+Error
+OptionValueUUID::SetValueFromCString (const char *value_cstr)
+{
+ Error error;
+ if (m_uuid.SetfromCString(value_cstr) == 0)
+ error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
+ return error;
+}
+
+//-------------------------------------------------------------------------
// OptionValueFormat
//-------------------------------------------------------------------------
void
diff --git a/source/Interpreter/OptionGroupBoolean.cpp b/source/Interpreter/OptionGroupBoolean.cpp
new file mode 100644
index 0000000..f1fd62b
--- /dev/null
+++ b/source/Interpreter/OptionGroupBoolean.cpp
@@ -0,0 +1,58 @@
+//===-- OptionGroupBoolean.cpp ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OptionGroupBoolean.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+OptionGroupBoolean::OptionGroupBoolean (uint32_t usage_mask,
+ bool required,
+ const char *long_option,
+ char short_option,
+ uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text,
+ bool default_value) :
+ m_value (default_value, default_value)
+{
+ m_option_definition.usage_mask = usage_mask;
+ m_option_definition.required = required;
+ m_option_definition.long_option = long_option;
+ m_option_definition.short_option = short_option;
+ m_option_definition.option_has_arg = required_argument;
+ m_option_definition.enum_values = NULL;
+ m_option_definition.completion_type = completion_type;
+ m_option_definition.argument_type = argument_type;
+ m_option_definition.usage_text = usage_text;
+}
+
+OptionGroupBoolean::~OptionGroupBoolean ()
+{
+}
+
+Error
+OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
+{
+ Error error (m_value.SetValueFromCString (option_arg));
+ return error;
+}
+
+void
+OptionGroupBoolean::OptionParsingStarting (CommandInterpreter &interpreter)
+{
+ m_value.Clear();
+}
diff --git a/source/Interpreter/OptionGroupFile.cpp b/source/Interpreter/OptionGroupFile.cpp
new file mode 100644
index 0000000..86acede
--- /dev/null
+++ b/source/Interpreter/OptionGroupFile.cpp
@@ -0,0 +1,57 @@
+//===-- OptionGroupFile.cpp -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OptionGroupFile.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+OptionGroupFile::OptionGroupFile (uint32_t usage_mask,
+ bool required,
+ const char *long_option,
+ char short_option,
+ uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text) :
+ m_file ()
+{
+ m_option_definition.usage_mask = usage_mask;
+ m_option_definition.required = required;
+ m_option_definition.long_option = long_option;
+ m_option_definition.short_option = short_option;
+ m_option_definition.option_has_arg = required_argument;
+ m_option_definition.enum_values = NULL;
+ m_option_definition.completion_type = completion_type;
+ m_option_definition.argument_type = argument_type;
+ m_option_definition.usage_text = usage_text;
+}
+
+OptionGroupFile::~OptionGroupFile ()
+{
+}
+
+Error
+OptionGroupFile::SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
+{
+ Error error (m_file.SetValueFromCString (option_arg));
+ return error;
+}
+
+void
+OptionGroupFile::OptionParsingStarting (CommandInterpreter &interpreter)
+{
+ m_file.Clear();
+}
diff --git a/source/Interpreter/OptionGroupPlatform.cpp b/source/Interpreter/OptionGroupPlatform.cpp
index 59dbceb..d94c41a 100644
--- a/source/Interpreter/OptionGroupPlatform.cpp
+++ b/source/Interpreter/OptionGroupPlatform.cpp
@@ -83,7 +83,7 @@
{
Error error;
if (!m_include_platform_option)
- --option_idx;
+ ++option_idx;
char short_option = (char) g_option_table[option_idx].short_option;
diff --git a/source/Interpreter/OptionGroupUInt64.cpp b/source/Interpreter/OptionGroupUInt64.cpp
new file mode 100644
index 0000000..d0ab1ef
--- /dev/null
+++ b/source/Interpreter/OptionGroupUInt64.cpp
@@ -0,0 +1,58 @@
+//===-- OptionGroupUInt64.cpp ----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OptionGroupUInt64.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+OptionGroupUInt64::OptionGroupUInt64 (uint32_t usage_mask,
+ bool required,
+ const char *long_option,
+ char short_option,
+ uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text,
+ uint64_t default_value) :
+ m_value (default_value, default_value)
+{
+ m_option_definition.usage_mask = usage_mask;
+ m_option_definition.required = required;
+ m_option_definition.long_option = long_option;
+ m_option_definition.short_option = short_option;
+ m_option_definition.option_has_arg = required_argument;
+ m_option_definition.enum_values = NULL;
+ m_option_definition.completion_type = completion_type;
+ m_option_definition.argument_type = argument_type;
+ m_option_definition.usage_text = usage_text;
+}
+
+OptionGroupUInt64::~OptionGroupUInt64 ()
+{
+}
+
+Error
+OptionGroupUInt64::SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
+{
+ Error error (m_value.SetValueFromCString (option_arg));
+ return error;
+}
+
+void
+OptionGroupUInt64::OptionParsingStarting (CommandInterpreter &interpreter)
+{
+ m_value.Clear();
+}
diff --git a/source/Interpreter/OptionGroupUUID.cpp b/source/Interpreter/OptionGroupUUID.cpp
new file mode 100644
index 0000000..e436f61
--- /dev/null
+++ b/source/Interpreter/OptionGroupUUID.cpp
@@ -0,0 +1,75 @@
+//===-- OptionGroupUUID.cpp -------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OptionGroupUUID.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+OptionGroupUUID::OptionGroupUUID() :
+ m_uuid ()
+{
+}
+
+OptionGroupUUID::~OptionGroupUUID ()
+{
+}
+
+static OptionDefinition
+g_option_table[] =
+{
+{ LLDB_OPT_SET_1 , false, "uuid", 'u', required_argument, NULL, 0, eArgTypeNone, "A module UUID value."},
+};
+
+const uint32_t k_num_file_options = sizeof(g_option_table)/sizeof(OptionDefinition);
+
+uint32_t
+OptionGroupUUID::GetNumDefinitions ()
+{
+ return k_num_file_options;
+}
+
+const OptionDefinition *
+OptionGroupUUID::GetDefinitions ()
+{
+ return g_option_table;
+}
+
+Error
+OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
+ uint32_t option_idx,
+ const char *option_arg)
+{
+ Error error;
+ char short_option = (char) g_option_table[option_idx].short_option;
+
+ switch (short_option)
+ {
+ case 'u':
+ error = m_uuid.SetValueFromCString (option_arg);
+ break;
+
+ default:
+ error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option);
+ break;
+ }
+
+ return error;
+}
+
+void
+OptionGroupUUID::OptionParsingStarting (CommandInterpreter &interpreter)
+{
+ m_uuid.Clear();
+}