This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Shiftiness for agent expressions
- From: Stan Shebs <stan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Mar 2010 15:19:19 -0800
- Subject: [PATCH] Shiftiness for agent expressions
There are already bytecodes for left and right shift, so very simple to
support expressions with shift operators; committed to trunk.
Stan
2010-03-12 Stan Shebs <stan@codesourcery.com>
* ax-gdb.c (gen_expr): Add shift expressions.
(gen_expr_binop_rest): Ditto.
Index: ax-gdb.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-gdb.c,v
retrieving revision 1.65
diff -p -r1.65 ax-gdb.c
*** ax-gdb.c 9 Mar 2010 18:09:07 -0000 1.65
--- ax-gdb.c 12 Mar 2010 23:12:23 -0000
*************** gen_expr (struct expression *exp, union
*** 1479,1484 ****
--- 1479,1486 ----
case BINOP_MUL:
case BINOP_DIV:
case BINOP_REM:
+ case BINOP_LSH:
+ case BINOP_RSH:
case BINOP_SUBSCRIPT:
case BINOP_BITWISE_AND:
case BINOP_BITWISE_IOR:
*************** gen_expr_binop_rest (struct expression *
*** 1884,1889 ****
--- 1886,1899 ----
gen_binop (ax, value, value1, value2,
aop_rem_signed, aop_rem_unsigned, 1, "remainder");
break;
+ case BINOP_LSH:
+ gen_binop (ax, value, value1, value2,
+ aop_lsh, aop_lsh, 1, "left shift");
+ break;
+ case BINOP_RSH:
+ gen_binop (ax, value, value1, value2,
+ aop_rsh_signed, aop_rsh_unsigned, 1, "right shift");
+ break;
case BINOP_SUBSCRIPT:
{
struct type *type;