[all-commits] [llvm/llvm-project] f841c4: [lldb] Fix image lookup crash

Alex via All-commits all-commits at lists.llvm.org
Mon Feb 13 10:55:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f841c4af5f5ec887777c33130ad744ee57ad672f
      https://github.com/llvm/llvm-project/commit/f841c4af5f5ec887777c33130ad744ee57ad672f
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-02-13 (Mon, 13 Feb 2023)

  Changed paths:
    M lldb/source/Expression/DWARFExpression.cpp
    M lldb/test/Shell/SymbolFile/DWARF/x86/DW_OP_deref_size_static_var.s

  Log Message:
  -----------
  [lldb] Fix image lookup crash

lldb may crash when performing `image lookup --verbose --address $ADDR`.
The ExecutionContext that gets passed into DWARFExpression::Evaluate may
be valid but unpopulated. However, in one specific case, we were
assuming that it has a valid Target and using it without checking first.

We reach this codepath when we attempt to get information about an
address that doesn't map to a CompileUnit in the module containing the
requested address. lldb then checks to see if it maps to a global
variable, so lldb has to evaluate the location of each global variable
in the module. If a location expression contains DW_OP_deref_size that
uses a FileAddress, we hit this code path. The simplest test case is to
take a module that has a global variable with DW_OP_deref_size in its
location expression, attempt to read an address that doesn't map to a
CompileUnit (e.g. 0x0) and ensure we don't crash.

Differential Revision: https://reviews.llvm.org/D143792




More information about the All-commits mailing list