[Lldb-commits] [PATCH] D69273: ValueObject: Fix a crash related to children address type computation
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 21 10:55:46 PDT 2019
labath created this revision.
labath added reviewers: jingham, clayborg.
Herald added a subscriber: aprantl.
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.
https://reviews.llvm.org/D69273
Files:
include/lldb/Core/ValueObject.h
source/Core/ValueObject.cpp
source/Core/ValueObjectVariable.cpp
test/Shell/SymbolFile/DWARF/DW_OP_piece-struct.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69273.225921.patch
Type: text/x-patch
Size: 11872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191021/4d70d16c/attachment-0001.bin>
More information about the lldb-commits
mailing list