[all-commits] [llvm/llvm-project] 96601e: ValueObject: Fix a crash related to children addre...

plabath via All-commits all-commits at lists.llvm.org
Fri Oct 25 10:49:22 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 96601ec28b7efe5abf3479a1aa91bcedb235bbbd
      https://github.com/llvm/llvm-project/commit/96601ec28b7efe5abf3479a1aa91bcedb235bbbd
  Author: Pavel Labath <labath at google.com>
  Date:   2019-10-25 (Fri, 25 Oct 2019)

  Changed paths:
    M lldb/include/lldb/Core/ValueObject.h
    M lldb/source/Core/ValueObject.cpp
    M lldb/source/Core/ValueObjectVariable.cpp
    A lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-struct.s

  Log Message:
  -----------
  ValueObject: Fix a crash related to children address type computation

Summary:
This patch fixes a crash encountered when debugging optimized code. If some
variable has been completely optimized out, but it's value is nonetheless known,
the compiler can replace it with a DWARF expression computing its value. The
evaluating these expressions results in a eValueTypeHostAddress Value object, as
it's contents are computed into an lldb buffer. However, any value that is
obtained by dereferencing pointers in this object should no longer have the
"host" address type.

Lldb had code to account for this, but it was only present in the
ValueObjectVariable class. This wasn't enough when the object being described
was a struct, as then the object holding the actual pointer was a
ValueObjectChild. This caused lldb to dereference the contained pointer in the
context of the host process and crash.

Though I am not an expert on ValueObjects, it seems to me that this children
address type logic should apply to all types of objects (and indeed, applying
applying the same logic to ValueObjectChild fixes the crash). Therefore, I move
this code to the base class, and arrange it to be run everytime the value is
updated.

The test case is a reduced and simplified version of the original debug info
triggering the crash. Originally we were dealing with a local variable, but as
these require a running process to display, I changed it to use a global one
instead.

Reviewers: jingham, clayborg

Subscribers: aprantl, lldb-commits

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




More information about the All-commits mailing list