@@ -731,13 +731,6 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
731
731
return false ;
732
732
}
733
733
734
- Function *parent_func =
735
- parent_frame->GetSymbolContext (eSymbolContextFunction).function ;
736
- if (!parent_func) {
737
- LLDB_LOG (log, " Evaluate_DW_OP_entry_value: no parent function" );
738
- return false ;
739
- }
740
-
741
734
// 2. Find the call edge in the parent function responsible for creating the
742
735
// current activation.
743
736
Function *current_func =
@@ -751,6 +744,7 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
751
744
ModuleList &modlist = target.GetImages ();
752
745
ExecutionContext parent_exe_ctx = *exe_ctx;
753
746
parent_exe_ctx.SetFrameSP (parent_frame);
747
+ Function *parent_func = nullptr ;
754
748
#ifdef LLDB_ENABLE_SWIFT
755
749
// Swift async function arguments are represented relative to a
756
750
// DW_OP_entry_value that fetches the async context register. This
@@ -760,6 +754,14 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
760
754
auto fn_name = current_func->GetMangled ().GetMangledName ().GetStringRef ();
761
755
if (!SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (fn_name)) {
762
756
#endif
757
+
758
+ parent_func =
759
+ parent_frame->GetSymbolContext (eSymbolContextFunction).function ;
760
+ if (!parent_func) {
761
+ LLDB_LOG (log, " Evaluate_DW_OP_entry_value: no parent function" );
762
+ return false ;
763
+ }
764
+
763
765
if (!parent_frame->IsArtificial ()) {
764
766
// If the parent frame is not artificial, the current activation may be
765
767
// produced by an ambiguous tail call. In this case, refuse to proceed.
@@ -845,7 +847,8 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
845
847
}
846
848
llvm::Optional<DWARFExpression> subexpr;
847
849
if (!matched_param) {
848
- subexpr.emplace (parent_func->CalculateSymbolContextModule (),
850
+ auto *ctx_func = parent_func ? parent_func : current_func;
851
+ subexpr.emplace (ctx_func->CalculateSymbolContextModule (),
849
852
DataExtractor (opcodes, subexpr_offset, subexpr_len),
850
853
dwarf_cu);
851
854
}
0 commit comments