summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
diff options
context:
space:
mode:
authorTatyana Krasnukha <tatyana@synopsys.com>2020-03-03 13:29:12 +0300
committerTatyana Krasnukha <tatyana@synopsys.com>2020-03-04 16:56:50 +0300
commit6c17cc531f9f4ee94f2298200fc4813c02999d78 (patch)
tree5538338d8e6af1dd64013df1530d1f775d01e838 /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
parent587feec07e3e8028ba40018c5316b5bf353fee3f (diff)
[lldb] Make BreakpointResolver hold weak_ptr instead of raw pointer to breakpoint
This prevents calling Breakpoint::shared_from_this of an object that is not owned by any shared_ptr. Differential Revision: https://reviews.llvm.org/D74557
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 3ef6a3f39aab..dd9312234d8b 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -793,6 +793,9 @@ RenderScriptRuntime::CreateInstance(Process *process,
Searcher::CallbackReturn
RSBreakpointResolver::SearchCallback(SearchFilter &filter,
SymbolContext &context, Address *) {
+ BreakpointSP breakpoint_sp = GetBreakpoint();
+ assert(breakpoint_sp);
+
ModuleSP module = context.module_sp;
if (!module || !IsRenderScriptScriptModule(module))
@@ -813,7 +816,7 @@ RSBreakpointResolver::SearchCallback(SearchFilter &filter,
if (kernel_sym) {
Address bp_addr = kernel_sym->GetAddress();
if (filter.AddressPasses(bp_addr))
- m_breakpoint->AddLocation(bp_addr);
+ breakpoint_sp->AddLocation(bp_addr);
}
return Searcher::eCallbackReturnContinue;
@@ -823,6 +826,9 @@ Searcher::CallbackReturn
RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,
lldb_private::SymbolContext &context,
Address *) {
+ BreakpointSP breakpoint_sp = GetBreakpoint();
+ assert(breakpoint_sp);
+
// We need to have access to the list of reductions currently parsed, as
// reduce names don't actually exist as symbols in a module. They are only
// identifiable by parsing the .rs.info packet, or finding the expand symbol.
@@ -869,7 +875,7 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,
if (!SkipPrologue(module, address)) {
LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__);
}
- m_breakpoint->AddLocation(address, &new_bp);
+ breakpoint_sp->AddLocation(address, &new_bp);
LLDB_LOGF(log, "%s: %s reduction breakpoint on %s in %s",
__FUNCTION__, new_bp ? "new" : "existing",
kernel_name.GetCString(),
@@ -884,7 +890,8 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,
Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(
SearchFilter &filter, SymbolContext &context, Address *addr) {
- if (!m_breakpoint)
+ BreakpointSP breakpoint_sp = GetBreakpoint();
+ if (!breakpoint_sp)
return eCallbackReturnContinue;
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
@@ -894,7 +901,8 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(
return Searcher::eCallbackReturnContinue;
std::vector<std::string> names;
- m_breakpoint->GetNames(names);
+ Breakpoint& breakpoint = *breakpoint_sp;
+ breakpoint.GetNames(names);
if (names.empty())
return eCallbackReturnContinue;
@@ -934,7 +942,7 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(
}
bool new_bp;
- m_breakpoint->AddLocation(address, &new_bp);
+ breakpoint.AddLocation(address, &new_bp);
LLDB_LOGF(log, "%s: Placed %sbreakpoint on %s", __FUNCTION__,
new_bp ? "new " : "", k.m_name.AsCString());
@@ -1031,8 +1039,8 @@ bool RenderScriptRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
}
lldb::BreakpointResolverSP
-RenderScriptRuntime::CreateExceptionResolver(Breakpoint *bp, bool catch_bp,
- bool throw_bp) {
+RenderScriptRuntime::CreateExceptionResolver(const lldb::BreakpointSP &bp,
+ bool catch_bp, bool throw_bp) {
BreakpointResolverSP resolver_sp;
return resolver_sp;
}