Skip to content

Commit acc54b0

Browse files
authored
Merge pull request #6277 from bulbazord/cherrypick/20221013/fix-image-lookup-crash
[lldb] Fix image lookup crash
2 parents 27fddf0 + 9551315 commit acc54b0

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lldb/source/Expression/DWARFExpression.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,9 +1154,9 @@ bool DWARFExpression::Evaluate(
11541154
uint8_t addr_bytes[8];
11551155
Status error;
11561156

1157-
if (exe_ctx->GetTargetRef().ReadMemory(
1158-
so_addr, &addr_bytes, size, error,
1159-
/*force_live_memory=*/false) == size) {
1157+
if (target &&
1158+
target->ReadMemory(so_addr, &addr_bytes, size, error,
1159+
/*force_live_memory=*/false) == size) {
11601160
ObjectFile *objfile = module_sp->GetObjectFile();
11611161

11621162
stack.back().GetScalar() = DerefSizeExtractDataHelper(

lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s
2-
# RUN: %lldb %t -o "target variable ug" -b | FileCheck %s
2+
# RUN: %lldb %t -o "target variable ug" -b \
3+
# RUN: | FileCheck --check-prefix=TARGET-VARIABLE %s
4+
# RUN: %lldb %t -o "image lookup --verbose --address 0x0" -b \
5+
# RUN: | FileCheck --check-prefix=IMAGE-LOOKUP %s
36

4-
# CHECK: (lldb) target variable ug
5-
# CHECK: (U) ug = {
6-
# CHECK: raw = 0
7-
# CHECK: = (a = 0, b = 0, c = 0, d = 0, e = 0, f = 0)
8-
# CHECK: }
7+
# TARGET-VARIABLE: (lldb) target variable ug
8+
# TARGET-VARIABLE: (U) ug = {
9+
# TARGET-VARIABLE: raw = 0
10+
# TARGET-VARIABLE: = (a = 0, b = 0, c = 0, d = 0, e = 0, f = 0)
11+
# TARGET-VARIABLE: }
12+
13+
# IMAGE-LOOKUP: Summary:
14+
# IMAGE-LOOKUP: Module: file =
915

1016
# We are testing how DWARFExpression::Evaluate(...) in the case of
1117
# DW_OP_deref_size deals with static variable.

0 commit comments

Comments
 (0)