aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2expr.c
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2007-05-18 19:42:42 +0000
committerCaroline Tice <cmtice@google.com>2007-05-18 19:42:42 +0000
commit42be36b328ae784ae6981da7c7cab95b67ed7737 (patch)
tree5b0a0ffb49db6fe2d5c149e62e5d84f2c9de39b7 /gdb/dwarf2expr.c
parenta7c569c8f08b3485034e771a5e49cce0e23ca2b2 (diff)
downloadfsf-binutils-gdb-42be36b328ae784ae6981da7c7cab95b67ed7737.zip
fsf-binutils-gdb-42be36b328ae784ae6981da7c7cab95b67ed7737.tar.gz
fsf-binutils-gdb-42be36b328ae784ae6981da7c7cab95b67ed7737.tar.bz2
Add ability to report when a variable's value is uninitialized,
based on information provided by the compiler. Also add new DWARF OP, DW_OP_GNU_uninit, for this purpose.
Diffstat (limited to 'gdb/dwarf2expr.c')
-rw-r--r--gdb/dwarf2expr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index ad259f4..92d9e16 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -284,6 +284,7 @@ execute_stack_op (struct dwarf_expr_context *ctx,
gdb_byte *op_ptr, gdb_byte *op_end)
{
ctx->in_reg = 0;
+ ctx->initialized = 1; /* Default is initialized. */
while (op_ptr < op_end)
{
@@ -410,7 +411,9 @@ execute_stack_op (struct dwarf_expr_context *ctx,
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
- if (op_ptr != op_end && *op_ptr != DW_OP_piece)
+ if (op_ptr != op_end
+ && *op_ptr != DW_OP_piece
+ && *op_ptr != DW_OP_GNU_uninit)
error (_("DWARF-2 expression error: DW_OP_reg operations must be "
"used either alone or in conjuction with DW_OP_piece."));
@@ -731,6 +734,14 @@ execute_stack_op (struct dwarf_expr_context *ctx,
}
goto no_push;
+ case DW_OP_GNU_uninit:
+ if (op_ptr != op_end)
+ error (_("DWARF-2 expression error: DW_OP_GNU_unint must always "
+ "be the very last op."));
+
+ ctx->initialized = 0;
+ goto no_push;
+
default:
error (_("Unhandled dwarf expression opcode 0x%x"), op);
}