From 9f3fe11c951a7f5963a1548c553a0d481299d6f5 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 15 Dec 2008 11:32:08 +0000 Subject: [PATCH] 2008-12-15 Tristan Gingold * dwarf2expr.c (execute_stack_op): Handle DW_OP_swap. --- gdb/ChangeLog | 4 ++++ gdb/dwarf2expr.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 493e5faf23..4a4f5dfc1e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2008-12-15 Tristan Gingold + + * dwarf2expr.c (execute_stack_op): Handle DW_OP_swap. + 2008-12-15 Jerome Guitton * ada-lang.c (ada_value_slice_ptr): Rename to... diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 707c0de3e1..de9cea861d 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c @@ -514,6 +514,20 @@ execute_stack_op (struct dwarf_expr_context *ctx, offset = *op_ptr++; result = dwarf_expr_fetch (ctx, offset); break; + + case DW_OP_swap: + { + CORE_ADDR t1, t2; + + if (ctx->stack_len < 2) + error (_("Not enough elements for DW_OP_swap. Need 2, have %d."), + ctx->stack_len); + t1 = ctx->stack[ctx->stack_len - 1]; + t2 = ctx->stack[ctx->stack_len - 2]; + ctx->stack[ctx->stack_len - 1] = t2; + ctx->stack[ctx->stack_len - 2] = t1; + goto no_push; + } case DW_OP_over: result = dwarf_expr_fetch (ctx, 1);