summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/TargetList.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-08-09 23:31:02 +0000
committerJim Ingham <jingham@apple.com>2010-08-09 23:31:02 +0000
commit5aee162f978eac7ffb6363d25b193e51edfbc0b1 (patch)
treeaffe5547d828a14a967f9b5deff564248940554b /lldb/source/Target/TargetList.cpp
parent394a69ed528c403248c6354baeedaf0533b33afc (diff)
downloadbcm5719-llvm-5aee162f978eac7ffb6363d25b193e51edfbc0b1.tar.gz
bcm5719-llvm-5aee162f978eac7ffb6363d25b193e51edfbc0b1.zip
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. llvm-svn: 110624
Diffstat (limited to 'lldb/source/Target/TargetList.cpp')
-rw-r--r--lldb/source/Target/TargetList.cpp59
1 files changed, 39 insertions, 20 deletions
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 4e2952ec0a3..ac169465e28 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -60,30 +60,50 @@ TargetList::CreateTarget
file.GetFilename().AsCString(),
arch.AsCString(),
uuid_ptr);
- ModuleSP exe_module_sp;
- FileSpec resolved_file(file);
- if (!Host::ResolveExecutableInBundle (&resolved_file))
- resolved_file = file;
-
- Error error = ModuleList::GetSharedModule(resolved_file,
- arch,
- uuid_ptr,
- NULL,
- 0,
- exe_module_sp,
- NULL,
- NULL);
- if (exe_module_sp)
+ Error error;
+
+ if (!file)
{
target_sp.reset(new Target(debugger));
- target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
+ target_sp->SetArchitecture(arch);
+ }
+ else
+ {
+ ModuleSP exe_module_sp;
+ FileSpec resolved_file(file);
+ if (!Host::ResolveExecutableInBundle (&resolved_file))
+ resolved_file = file;
- if (target_sp.get())
+ error = ModuleList::GetSharedModule(resolved_file,
+ arch,
+ uuid_ptr,
+ NULL,
+ 0,
+ exe_module_sp,
+ NULL,
+ NULL);
+ if (exe_module_sp)
{
- Mutex::Locker locker(m_target_list_mutex);
- m_current_target_idx = m_target_list.size();
- m_target_list.push_back(target_sp);
+ if (exe_module_sp->GetObjectFile() == NULL)
+ {
+ error.SetErrorStringWithFormat("%s%s%s: doesn't contain architecture %s",
+ file.GetDirectory().AsCString(),
+ file.GetDirectory() ? "/" : "",
+ file.GetFilename().AsCString(),
+ arch.AsCString());
+ return error;
+ }
+ target_sp.reset(new Target(debugger));
+ target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
}
+ }
+
+ if (target_sp.get())
+ {
+ Mutex::Locker locker(m_target_list_mutex);
+ m_current_target_idx = m_target_list.size();
+ m_target_list.push_back(target_sp);
+ }
// target_sp.reset(new Target);
// // Let the target resolve any funky bundle paths before we try and get
@@ -107,7 +127,6 @@ TargetList::CreateTarget
// m_target_list.push_back(target_sp);
// }
// }
- }
else
{
target_sp.reset();
OpenPOWER on IntegriCloud