[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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user