[Lldb-commits] [lldb] [lldb/crashlog] Fix inlined frames in crashlog scripted process (PR #191132)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 9 09:26:48 PDT 2026
================
@@ -270,13 +275,47 @@ bool ScriptedThread::LoadArtificialStackFrames() {
synth_frame_sp = *frame_from_dict_or_err;
}
- if (!frames->SetFrameAtIndex(static_cast<uint32_t>(idx), synth_frame_sp))
+ if (!frames->SetFrameAtIndex(frame_list_idx, synth_frame_sp))
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
llvm::Twine("Couldn't add frame (" + llvm::Twine(idx) +
llvm::Twine(") to ScriptedThread StackFrameList."))
.str(),
error, LLDBLog::Thread);
+ frame_list_idx++;
+
+ // Synthesize inline frames, mirroring StackFrameList::FetchFramesUpTo().
+ SymbolContext unwind_sc = synth_frame_sp->GetSymbolContext(
+ eSymbolContextBlock | eSymbolContextFunction);
+ if (!unwind_sc.block)
+ continue;
+
+ Address curr_frame_address(
+ synth_frame_sp->GetFrameCodeAddressForSymbolication());
+ SymbolContext next_frame_sc;
+ Address next_frame_address;
+
+ while (unwind_sc.GetParentOfInlinedScope(curr_frame_address, next_frame_sc,
+ next_frame_address)) {
+ next_frame_sc.line_entry.ApplyFileMappings(target_sp);
+ auto inline_frame_sp = std::make_shared<StackFrame>(
+ shared_from_this(), frame_list_idx, idx,
+ synth_frame_sp->GetRegisterContextSP(), /*cfa=*/LLDB_INVALID_ADDRESS,
+ next_frame_address, /*behaves_like_zeroth_frame=*/false,
+ &next_frame_sc);
+
+ if (!frames->SetFrameAtIndex(frame_list_idx, inline_frame_sp))
+ return ScriptedInterface::ErrorWithMessage<bool>(
+ LLVM_PRETTY_FUNCTION,
+ llvm::Twine("Couldn't add inline frame (" +
+ llvm::Twine(frame_list_idx) +
+ llvm::Twine(") to ScriptedThread StackFrameList."))
----------------
JDevlieghere wrote:
Assuming this is similar to what `StackFrameList::FetchFramesUpTo` does per the comment, is there any opportunity to share code? Maybe have it return an error you can then pass to `ScriptedInterface::ErrorWithMessage` which seems like the only scripted thread specific thingy?
https://github.com/llvm/llvm-project/pull/191132
More information about the lldb-commits
mailing list