[Lldb-commits] [PATCH] D143792: [lldb] Fix image lookup crash

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 13 10:55:33 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf841c4af5f5e: [lldb] Fix image lookup crash (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143792/new/

https://reviews.llvm.org/D143792

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s


Index: lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s
===================================================================
--- lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s
+++ lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s
@@ -1,11 +1,17 @@
 # RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s
-# RUN: %lldb %t -o "target variable ug" -b | FileCheck %s
+# RUN: %lldb %t -o "target variable ug" -b \
+# RUN:  | FileCheck --check-prefix=TARGET-VARIABLE %s
+# RUN: %lldb %t -o "image lookup --verbose --address 0x0" -b \
+# RUN:  | FileCheck --check-prefix=IMAGE-LOOKUP %s
 
-# CHECK: (lldb) target variable ug
-# CHECK: (U) ug = {
-# CHECK:   raw = 0
-# CHECK:    = (a = 0, b = 0, c = 0, d = 0, e = 0, f = 0)
-# CHECK: }
+# TARGET-VARIABLE: (lldb) target variable ug
+# TARGET-VARIABLE: (U) ug = {
+# TARGET-VARIABLE:   raw = 0
+# TARGET-VARIABLE:    = (a = 0, b = 0, c = 0, d = 0, e = 0, f = 0)
+# TARGET-VARIABLE: }
+
+# IMAGE-LOOKUP: Summary:
+# IMAGE-LOOKUP: Module: file =
 
 # We are testing how DWARFExpression::Evaluate(...) in the case of
 # DW_OP_deref_size deals with static variable.
Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -1140,9 +1140,9 @@
           uint8_t addr_bytes[8];
           Status error;
 
-          if (exe_ctx->GetTargetRef().ReadMemory(
-                  so_addr, &addr_bytes, size, error,
-                  /*force_live_memory=*/false) == size) {
+          if (target &&
+              target->ReadMemory(so_addr, &addr_bytes, size, error,
+                                 /*force_live_memory=*/false) == size) {
             ObjectFile *objfile = module_sp->GetObjectFile();
 
             stack.back().GetScalar() = DerefSizeExtractDataHelper(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143792.497049.patch
Type: text/x-patch
Size: 1936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230213/9c97e1fd/attachment-0001.bin>


More information about the lldb-commits mailing list