summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2020-01-16 14:21:17 -0800
committerHans Wennborg <hans@chromium.org>2020-02-19 14:20:34 +0100
commitcab81521b5afc2d4295f988aa5f087cbaeefb981 (patch)
treebaee5109738affad3ff3da565b3f11fa271cfe17 /lldb/source
parent7751f0c191518b377d9b71bdd17281abec83945a (diff)
downloadbcm5719-llvm-cab81521b5afc2d4295f988aa5f087cbaeefb981.tar.gz
bcm5719-llvm-cab81521b5afc2d4295f988aa5f087cbaeefb981.zip
Fix a buffer-size bug when the first DW_OP_piece is undefined
and document the shortcomings of LLDB's partially defined DW_OP_piece handling. This would manifest as "DW_OP_piece for offset foo but top of stack is of size bar". rdar://problem/46262998 Differential Revision: https://reviews.llvm.org/D72880 (cherry picked from commit f55ab6f90b7317a6bb85303a6102702bdae1199e)
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Expression/DWARFExpression.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 0f8eea754c2..08cc70c201f 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -2071,6 +2071,10 @@ bool DWARFExpression::Evaluate(
// not available. Fill with zeros for now by resizing the data and
// appending it
curr_piece.ResizeData(piece_byte_size);
+ // Note that "0" is not a correct value for the unknown bits.
+ // It would be better to also return a mask of valid bits together
+ // with the expression result, so the debugger can print missing
+ // members as "<optimized out>" or something.
::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size);
pieces.AppendDataToHostBuffer(curr_piece);
} else {
@@ -2193,8 +2197,8 @@ bool DWARFExpression::Evaluate(
return false;
}
}
- op_piece_offset += piece_byte_size;
}
+ op_piece_offset += piece_byte_size;
}
} break;
OpenPOWER on IntegriCloud