Skip to content

Commit f236856

Browse files
authored
Merge pull request #4775 from gottesmm/swift/release/5.7-movedbginfo
[release/5.7][move-function] Cherry-pick LLVM changes needed for _move in 5.7
2 parents 68920b5 + 1e8d7e9 commit f236856

File tree

7 files changed

+344
-175
lines changed

7 files changed

+344
-175
lines changed

lldb/source/Expression/DWARFExpression.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,6 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
731731
return false;
732732
}
733733

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-
741734
// 2. Find the call edge in the parent function responsible for creating the
742735
// current activation.
743736
Function *current_func =
@@ -751,6 +744,7 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
751744
ModuleList &modlist = target.GetImages();
752745
ExecutionContext parent_exe_ctx = *exe_ctx;
753746
parent_exe_ctx.SetFrameSP(parent_frame);
747+
Function *parent_func = nullptr;
754748
#ifdef LLDB_ENABLE_SWIFT
755749
// Swift async function arguments are represented relative to a
756750
// 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,
760754
auto fn_name = current_func->GetMangled().GetMangledName().GetStringRef();
761755
if (!SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol(fn_name)) {
762756
#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+
763765
if (!parent_frame->IsArtificial()) {
764766
// If the parent frame is not artificial, the current activation may be
765767
// 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,
845847
}
846848
llvm::Optional<DWARFExpression> subexpr;
847849
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(),
849852
DataExtractor(opcodes, subexpr_offset, subexpr_len),
850853
dwarf_cu);
851854
}

0 commit comments

Comments
 (0)