summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Target.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2014-12-06 01:28:03 +0000
committerJim Ingham <jingham@apple.com>2014-12-06 01:28:03 +0000
commit33df7cd345e926f63c02c29bcaa5826dea84f265 (patch)
tree9da478a4d3225be373ffeac9d30aaaa6ee30519a /lldb/source/Target/Target.cpp
parentda41af9e9423eeb435bbf64f94649726569ae45b (diff)
downloadbcm5719-llvm-33df7cd345e926f63c02c29bcaa5826dea84f265.tar.gz
bcm5719-llvm-33df7cd345e926f63c02c29bcaa5826dea84f265.zip
Add the ability to set breakpoints with conditions, commands, etc,
in the "dummy-target". The dummy target breakpoints prime all future targets. Breakpoints set before any target is created (e.g. breakpoints in ~/.lldbinit) automatically get set in the dummy target. You can also list, add & delete breakpoints from the dummy target using the "-D" flag, which is supported by most of the breakpoint commands. This removes a long-standing wart in lldb... <rdar://problem/10881487> llvm-svn: 223565
Diffstat (limited to 'lldb/source/Target/Target.cpp')
-rw-r--r--lldb/source/Target/Target.cpp67
1 files changed, 39 insertions, 28 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 02125f9c062..76a89a45187 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -100,9 +100,6 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat
CheckInWithManager();
- if (!m_is_dummy_target)
- PrimeFromDummyTarget(m_debugger.GetDummyTarget());
-
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Target::Target()", static_cast<void*>(this));
@@ -119,7 +116,15 @@ Target::PrimeFromDummyTarget(Target *target)
return;
m_stop_hooks = target->m_stop_hooks;
-
+
+ for (BreakpointSP breakpoint_sp : target->m_breakpoint_list.Breakpoints())
+ {
+ if (breakpoint_sp->IsInternal())
+ continue;
+
+ BreakpointSP new_bp (new Breakpoint (*this, *breakpoint_sp.get()));
+ AddBreakpoint (new_bp, false);
+ }
}
//----------------------------------------------------------------------
@@ -346,7 +351,7 @@ Target::CreateBreakpoint (lldb::addr_t addr, bool internal, bool hardware)
BreakpointSP
Target::CreateBreakpoint (Address &addr, bool internal, bool hardware)
{
- SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
+ SearchFilterSP filter_sp(new SearchFilterForUnconstrainedSearches (shared_from_this()));
BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr));
return CreateBreakpoint (filter_sp, resolver_sp, internal, hardware, false);
}
@@ -446,7 +451,7 @@ Target::GetSearchFilterForModule (const FileSpec *containingModule)
else
{
if (m_search_filter_sp.get() == NULL)
- m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
+ m_search_filter_sp.reset (new SearchFilterForUnconstrainedSearches (shared_from_this()));
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -465,7 +470,7 @@ Target::GetSearchFilterForModuleList (const FileSpecList *containingModules)
else
{
if (m_search_filter_sp.get() == NULL)
- m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (shared_from_this()));
+ m_search_filter_sp.reset (new SearchFilterForUnconstrainedSearches (shared_from_this()));
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -526,29 +531,35 @@ Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resol
{
bp_sp.reset(new Breakpoint (*this, filter_sp, resolver_sp, request_hardware, resolve_indirect_symbols));
resolver_sp->SetBreakpoint (bp_sp.get());
+ AddBreakpoint (bp_sp, internal);
+ }
+ return bp_sp;
+}
- if (internal)
- m_internal_breakpoint_list.Add (bp_sp, false);
- else
- m_breakpoint_list.Add (bp_sp, true);
-
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- {
- StreamString s;
- bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
- log->Printf ("Target::%s (internal = %s) => break_id = %s\n", __FUNCTION__, internal ? "yes" : "no", s.GetData());
- }
+void
+Target::AddBreakpoint (lldb::BreakpointSP bp_sp, bool internal)
+{
+ if (!bp_sp)
+ return;
+ if (internal)
+ m_internal_breakpoint_list.Add (bp_sp, false);
+ else
+ m_breakpoint_list.Add (bp_sp, true);
- bp_sp->ResolveBreakpoint();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
+ if (log)
+ {
+ StreamString s;
+ bp_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
+ log->Printf ("Target::%s (internal = %s) => break_id = %s\n", __FUNCTION__, bp_sp->IsInternal() ? "yes" : "no", s.GetData());
}
-
- if (!internal && bp_sp)
+
+ bp_sp->ResolveBreakpoint();
+
+ if (!internal)
{
m_last_created_breakpoint = bp_sp;
}
-
- return bp_sp;
}
bool
@@ -1238,7 +1249,7 @@ Target::ModulesDidUnload (ModuleList &module_list, bool delete_locations)
}
bool
-Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_file_spec)
+Target::ModuleIsExcludedForUnconstrainedSearches (const FileSpec &module_file_spec)
{
if (GetBreakpointsConsultPlatformAvoidList())
{
@@ -1252,7 +1263,7 @@ Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_fil
{
for (size_t i = 0; i < num_modules; i++)
{
- if (!ModuleIsExcludedForNonModuleSpecificSearches (matchingModules.GetModuleAtIndex(i)))
+ if (!ModuleIsExcludedForUnconstrainedSearches (matchingModules.GetModuleAtIndex(i)))
return false;
}
return true;
@@ -1262,12 +1273,12 @@ Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_fil
}
bool
-Target::ModuleIsExcludedForNonModuleSpecificSearches (const lldb::ModuleSP &module_sp)
+Target::ModuleIsExcludedForUnconstrainedSearches (const lldb::ModuleSP &module_sp)
{
if (GetBreakpointsConsultPlatformAvoidList())
{
if (m_platform_sp)
- return m_platform_sp->ModuleIsExcludedForNonModuleSpecificSearches (*this, module_sp);
+ return m_platform_sp->ModuleIsExcludedForUnconstrainedSearches (*this, module_sp);
}
return false;
}
OpenPOWER on IntegriCloud