[Lldb-commits] [PATCH] D89842: [lldb/DWARF] Add support for DW_OP_implicit_value
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 20 19:24:49 PDT 2020
mib updated this revision to Diff 299540.
mib added a comment.
Add test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89842/new/
https://reviews.llvm.org/D89842
Files:
lldb/source/Expression/DWARFExpression.cpp
lldb/test/Shell/SymbolFile/DWARF/DW_OP_implicit_value.test
lldb/test/Shell/SymbolFile/DWARF/Inputs/implicit_value.c
Index: lldb/test/Shell/SymbolFile/DWARF/Inputs/implicit_value.c
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/Inputs/implicit_value.c
@@ -0,0 +1,6 @@
+int main() {
+ double d = 3.14;
+ printf("break here");
+ d *= d;
+ return 0;
+}
Index: lldb/test/Shell/SymbolFile/DWARF/DW_OP_implicit_value.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/DW_OP_implicit_value.test
@@ -0,0 +1,19 @@
+# Make sure DW_OP_implicit_value is supported by lldb with DWARFv5
+# FIXME: Enable darwin platform once DWARFv5 is supported by dsymutil
+# rdar://67406091
+
+# REQUIRES: system-linux
+
+# RUN: %clang_host -gdwarf-5 -O1 %p/Inputs/implicit_value.c -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+
+br set -p 'break here'
+# CHECK: Breakpoint 1: where = {{.*}}`main {{.*}} at implicit_value.c:{{.*}}, address = 0x{{.*}}
+
+process launch
+# CHECK: break here
+
+frame var d
+# CHECK: (double) d = 3.1400{{.*}}
+
+quit
Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -846,6 +846,26 @@
return true;
}
+static bool Evaluate_DW_OP_implicit_value(std::vector<Value> &stack,
+ ExecutionContext *exe_ctx,
+ RegisterContext *reg_ctx,
+ const DataExtractor &opcodes,
+ lldb::offset_t &opcode_offset,
+ Status *error_ptr, Log *log) {
+
+ const uint32_t len = opcodes.GetULEB128(&opcode_offset);
+ const void *data = opcodes.GetData(&opcode_offset, len);
+
+ if (!data) {
+ LLDB_LOG(log, "Evaluate_DW_OP_implicit_value: could not be read data");
+ return false;
+ }
+
+ Value result(data, len);
+ stack.push_back(result);
+ return true;
+}
+
bool DWARFExpression::Evaluate(ExecutionContextScope *exe_scope,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr,
@@ -2248,6 +2268,23 @@
}
break;
+ // OPCODE: DW_OP_implicit_value
+ // OPERANDS: 2
+ // ULEB128 size of the value block in bytes
+ // uint8_t* block bytes encoding value in target's memory
+ // representation
+ // DESCRIPTION: Value is immediately stored in block in the debug info with
+ // the memory representation of the target.
+ case DW_OP_implicit_value: {
+ if (!Evaluate_DW_OP_implicit_value(stack, exe_ctx, reg_ctx, opcodes,
+ offset, error_ptr, log)) {
+ LLDB_ERRORF(error_ptr, "Could not evaluate %s.",
+ DW_OP_value_to_name(op));
+ return false;
+ }
+ break;
+ }
+
// OPCODE: DW_OP_push_object_address
// OPERANDS: none
// DESCRIPTION: Pushes the address of the object currently being
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89842.299540.patch
Type: text/x-patch
Size: 3118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201021/09d80e6f/attachment-0001.bin>
More information about the lldb-commits
mailing list