Change Target & Process so they can really be initialized with an invalid architecture.
Arrange that this then gets properly set on attach, or when a "file" is set.
Add a completer for "process attach -n".
Caveats: there isn't currently a way to handle multiple processes with the same name. That
will have to wait on a way to pass annotations along with the completion strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@110624 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectFile.cpp b/source/Commands/CommandObjectFile.cpp
index 2700e20..25576e1 100644
--- a/source/Commands/CommandObjectFile.cpp
+++ b/source/Commands/CommandObjectFile.cpp
@@ -126,31 +126,14 @@
TargetSP target_sp;
- ArchSpec arch;
- if (m_options.m_arch.IsValid())
- arch = m_options.m_arch;
- else
- {
- arch = lldb_private::GetDefaultArchitecture ();
- if (!arch.IsValid())
- arch = LLDB_ARCH_DEFAULT;
- }
+ ArchSpec arch = m_options.m_arch;
Debugger &debugger = interpreter.GetDebugger();
- Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
-
- if (error.Fail() && !m_options.m_arch.IsValid())
- {
- if (arch == LLDB_ARCH_DEFAULT_32BIT)
- arch = LLDB_ARCH_DEFAULT_64BIT;
- else
- arch = LLDB_ARCH_DEFAULT_32BIT;
- error = debugger.GetTargetList().CreateTarget (debugger, file_spec, arch, NULL, true, target_sp);
- }
+ Error error = debugger.GetTargetList().CreateTarget (debugger, file_spec, m_options.m_arch, NULL, true, target_sp);
if (target_sp)
{
debugger.GetTargetList().SetCurrentTarget(target_sp.get());
- result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, arch.AsCString());
+ result.AppendMessageWithFormat ("Current executable set to '%s' (%s).\n", file_path, target_sp->GetArchitecture().AsCString());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else