summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp41
-rw-r--r--lldb/source/Interpreter/OptionGroupFile.cpp4
-rw-r--r--lldb/source/Interpreter/OptionGroupPlatform.cpp2
-rw-r--r--lldb/source/Interpreter/Options.cpp8
4 files changed, 45 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 829283dee9f..2dc5fab4829 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -155,7 +155,9 @@ public:
m_option_group (interpreter),
m_arch_option (),
m_platform_options(true), // Do include the "--platform" option in the platform settings by passing true
- m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypeFilename, "Fullpath to a core file to use for this target.")
+ m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypeFilename, "Fullpath to a core file to use for this target."),
+ m_symbol_file (LLDB_OPT_SET_1, false, "symfile", 's', 0, eArgTypeFilename, "Fullpath to a stand alone debug symbols file for when debug symbols are not in the executable."),
+ m_add_dependents (LLDB_OPT_SET_1, false, "no-dependents", 'd', "Don't load dependent files when creating the target, just add the specified executable.", true, true)
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
@@ -173,6 +175,8 @@ public:
m_option_group.Append (&m_arch_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append (&m_add_dependents, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
@@ -219,12 +223,25 @@ protected:
if (argc == 1 || core_file)
{
+ FileSpec symfile (m_symbol_file.GetOptionValue().GetCurrentValue());
+ if (symfile)
+ {
+ if (!symfile.Exists())
+ {
+ char symfile_path[PATH_MAX];
+ symfile.GetPath(symfile_path, sizeof(symfile_path));
+ result.AppendErrorWithFormat("invalid symbol file path '%s'", symfile_path);
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
+ }
+
const char *file_path = command.GetArgumentAtIndex(0);
Timer scoped_timer(__PRETTY_FUNCTION__, "(lldb) target create '%s'", file_path);
TargetSP target_sp;
Debugger &debugger = m_interpreter.GetDebugger();
const char *arch_cstr = m_arch_option.GetArchitectureName();
- const bool get_dependent_files = true;
+ const bool get_dependent_files = m_add_dependents.GetOptionValue().GetCurrentValue();
Error error (debugger.GetTargetList().CreateTarget (debugger,
file_path,
arch_cstr,
@@ -234,6 +251,13 @@ protected:
if (target_sp)
{
+ if (symfile)
+ {
+ ModuleSP module_sp (target_sp->GetExecutableModule());
+ if (module_sp)
+ module_sp->SetSymbolFileFileSpec(symfile);
+ }
+
debugger.GetTargetList().SetSelectedTarget(target_sp.get());
if (core_file)
{
@@ -303,7 +327,8 @@ private:
OptionGroupArchitecture m_arch_option;
OptionGroupPlatform m_platform_options;
OptionGroupFile m_core_file;
-
+ OptionGroupFile m_symbol_file;
+ OptionGroupBoolean m_add_dependents;
};
#pragma mark CommandObjectTargetList
@@ -2443,9 +2468,11 @@ public:
"target modules add",
"Add a new module to the current target's modules.",
"target modules add [<module>]"),
- m_option_group (interpreter)
+ m_option_group (interpreter),
+ m_symbol_file (LLDB_OPT_SET_1, false, "symfile", 's', 0, eArgTypeFilename, "Fullpath to a stand alone debug symbols file for when debug symbols are not in the executable.")
{
m_option_group.Append (&m_uuid_option_group, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
@@ -2488,6 +2515,7 @@ protected:
OptionGroupOptions m_option_group;
OptionGroupUUID m_uuid_option_group;
+ OptionGroupFile m_symbol_file;
virtual bool
@@ -2511,6 +2539,8 @@ protected:
// We are given a UUID only, go locate the file
ModuleSpec module_spec;
module_spec.GetUUID() = m_uuid_option_group.GetOptionValue ().GetCurrentValue();
+ if (m_symbol_file.GetOptionValue().OptionWasSet())
+ module_spec.GetSymbolFileSpec() = m_symbol_file.GetOptionValue().GetCurrentValue();
if (Symbols::DownloadObjectAndSymbolFile (module_spec))
{
ModuleSP module_sp (target->GetSharedModule (module_spec));
@@ -2580,7 +2610,8 @@ protected:
ModuleSpec module_spec (file_spec);
if (m_uuid_option_group.GetOptionValue ().OptionWasSet())
module_spec.GetUUID() = m_uuid_option_group.GetOptionValue ().GetCurrentValue();
-
+ if (m_symbol_file.GetOptionValue().OptionWasSet())
+ module_spec.GetSymbolFileSpec() = m_symbol_file.GetOptionValue().GetCurrentValue();
Error error;
ModuleSP module_sp (target->GetSharedModule (module_spec, &error));
if (!module_sp)
diff --git a/lldb/source/Interpreter/OptionGroupFile.cpp b/lldb/source/Interpreter/OptionGroupFile.cpp
index 532d78f6e6f..4749087da6c 100644
--- a/lldb/source/Interpreter/OptionGroupFile.cpp
+++ b/lldb/source/Interpreter/OptionGroupFile.cpp
@@ -43,8 +43,8 @@ OptionGroupFile::~OptionGroupFile ()
Error
OptionGroupFile::SetOptionValue (CommandInterpreter &interpreter,
- uint32_t option_idx,
- const char *option_arg)
+ uint32_t option_idx,
+ const char *option_arg)
{
Error error (m_file.SetValueFromCString (option_arg));
return error;
diff --git a/lldb/source/Interpreter/OptionGroupPlatform.cpp b/lldb/source/Interpreter/OptionGroupPlatform.cpp
index b3c419c563c..358dc01a428 100644
--- a/lldb/source/Interpreter/OptionGroupPlatform.cpp
+++ b/lldb/source/Interpreter/OptionGroupPlatform.cpp
@@ -84,7 +84,7 @@ g_option_table[] =
{ LLDB_OPT_SET_ALL, false, "platform", 'p', required_argument, NULL, 0, eArgTypePlatform, "Specify name of the platform to use for this target, creating the platform if necessary."},
{ LLDB_OPT_SET_ALL, false, "version" , 'v', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK version to use prior to connecting." },
{ LLDB_OPT_SET_ALL, false, "build" , 'b', required_argument, NULL, 0, eArgTypeNone, "Specify the initial SDK build number." },
- { LLDB_OPT_SET_ALL, false, "sysroot" , 's', required_argument, NULL, 0, eArgTypeFilename, "Specify the SDK root directory that contains a root of all remote system files." }
+ { LLDB_OPT_SET_ALL, false, "sysroot" , 'S', required_argument, NULL, 0, eArgTypeFilename, "Specify the SDK root directory that contains a root of all remote system files." }
};
const OptionDefinition*
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 484e7789e5a..4a04a4639fb 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -274,17 +274,21 @@ Options::GetLongOptions ()
m_getopt_table.resize(num_options + 1);
for (i = 0, j = 0; i < num_options; ++i)
{
- char short_opt = opt_defs[i].short_option;
+ const char short_opt = opt_defs[i].short_option;
if (option_seen.test(short_opt) == false)
{
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 = opt_defs[i].short_option;
+ m_getopt_table[j].val = short_opt;
option_seen.set(short_opt);
++j;
}
+ else
+ {
+ assert (!"duplicate short option character");
+ }
}
//getopt_long requires a NULL final entry in the table:
OpenPOWER on IntegriCloud