================
@@ -656,6 +671,49 @@ void
BreakpointLocation::SendBreakpointLocationChangedEvent(
}
}
+std::optional<uint32_t> BreakpointLocation::GetSuggestedStackFrameIndex() {
+ if (!GetPreferredLineEntry())
+ return {};
+ LineEntry preferred = *GetPreferredLineEntry();
+ SymbolContext sc;
+ if (!m_address.CalculateSymbolContext(&sc))
+ return {};
+ // Don't return anything special if frame 0 is the preferred line entry.
+ // We not really telling the stack frame list to do anything special in that
+ // case.
+ if (!LineEntry::Compare(sc.line_entry, preferred))
+ return {};
+
+ if (!sc.block)
+ return {};
+
+ // Blocks have their line info in Declaration form, so make one here:
+ Declaration preferred_decl(preferred.GetFile(), preferred.line,
+ preferred.column);
+
+ uint32_t depth = 0;
+ Block *inlined_block = sc.block->GetContainingInlinedBlock();
+ while (inlined_block) {
+ // If we've moved to a block that this isn't the start of, that's not
+ // our inlining info or call site, so we can stop here.
+ Address start_address;
+ if (!inlined_block->GetStartAddress(start_address) ||
+ start_address != m_address)
+ return {};
+
+ const InlineFunctionInfo *info = inlined_block->GetInlinedFunctionInfo();
+ if (info) {
+ if (preferred_decl == info->GetDeclaration())
+ return depth;
+ if (preferred_decl == info->GetCallSite())
+ return depth + 1;
+ }
+ inlined_block = inlined_block->GetInlinedParent();
+ depth++;
----------------
jimingham wrote:
That would mean there were cycles in the blocks? I don't think we guard
against that anywhere else that we're traversing the block structure.
https://github.com/llvm/llvm-project/pull/112939
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits