This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Handle DW_OP_swap
- From: Tristan Gingold <gingold at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 4 Dec 2008 12:00:47 +0100
- Subject: [RFA] Handle DW_OP_swap
Hi,
Darwin/x86 uses this opcode. Quiet simple to implement.
Tristan.
2008-12-04 Tristan Gingold <gingold@adacore.com>
* dwarf2expr.c (execute_stack_op): Handle DW_OP_swap.
diff -c -p -r1.27 dwarf2expr.c
*** dwarf2expr.c 5 Sep 2008 11:40:53 -0000 1.27
--- dwarf2expr.c 4 Dec 2008 10:54:18 -0000
*************** execute_stack_op (struct dwarf_expr_cont
*** 514,519 ****
--- 514,533 ----
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;
+ }