const lldb::ProcessSP &
GetProcessSP () const;
+ bool
+ IsValid()
+ {
+ return m_valid;
+ }
+
void
Destroy();
// we can correctly tear down everything that we need to, so the only
// class that knows about the process lifespan is this target class.
lldb::ProcessSP m_process_sp;
+ bool m_valid;
lldb::SearchFilterSP m_search_filter_sp;
PathMappingList m_image_search_paths;
std::auto_ptr<ClangASTContext> m_scratch_ast_context_ap;
lldb::TargetSP
Host::GetDummyTarget (lldb_private::Debugger &debugger)
{
- lldb::TargetSP dummy_target_sp;
-
- ArchSpec arch(Target::GetDefaultArchitecture());
- if (!arch.IsValid())
- arch = Host::GetArchitecture ();
- Error err = debugger.GetTargetList().CreateTarget(debugger,
- FileSpec(),
- arch.GetTriple().getTriple().c_str(),
- false,
- NULL,
- dummy_target_sp);
-
- return dummy_target_sp;
+ static TargetSP g_dummy_target_sp;
+
+ // FIXME: Maybe the dummy target should be per-Debugger
+ if (!g_dummy_target_sp || !g_dummy_target_sp->IsValid())
+ {
+ ArchSpec arch(Target::GetDefaultArchitecture());
+ if (!arch.IsValid())
+ arch = Host::GetArchitecture ();
+ Error err = debugger.GetTargetList().CreateTarget(debugger,
+ FileSpec(),
+ arch.GetTriple().getTriple().c_str(),
+ false,
+ NULL,
+ g_dummy_target_sp);
+ }
+
+ return g_dummy_target_sp;
}
struct ShellInfo
m_internal_breakpoint_list (true),
m_watchpoint_list (),
m_process_sp (),
+ m_valid (true),
m_search_filter_sp (),
m_image_search_paths (ImageSearchPathsChanged, this),
m_scratch_ast_context_ap (NULL),
Target::Destroy()
{
Mutex::Locker locker (m_mutex);
+ m_valid = false;
DeleteCurrentProcess ();
m_platform_sp.reset();
m_arch.Clear();