This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Add member pointer support to expression printing


I discovered while testing that the expression printer (used by set debug
expression 1, and also by e.g. breakpoint conditions) could not handle
foo->*bar.  This patch adds support for that.

Tested on x86_64-pc-linux-gnu and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2006-08-06  Daniel Jacobowitz  <dan@codesourcery.com>

	* expprint.c (print_subexp_standard, dump_subexp_body_standard): Add
	support for member pointers.

Index: expprint.c
===================================================================
RCS file: /cvs/src/src/gdb/expprint.c,v
retrieving revision 1.23
diff -u -p -r1.23 expprint.c
--- expprint.c	17 Dec 2005 22:33:59 -0000	1.23
+++ expprint.c	7 Aug 2006 03:07:49 -0000
@@ -346,6 +346,18 @@ print_subexp_standard (struct expression
       fputs_filtered (&exp->elts[pc + 2].string, stream);
       return;
 
+    case STRUCTOP_MEMBER:
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      fputs_filtered (".*", stream);
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      return;
+
+    case STRUCTOP_MPTR:
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      fputs_filtered ("->*", stream);
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      return;
+
     case BINOP_SUBSCRIPT:
       print_subexp (exp, pos, stream, PREC_SUFFIX);
       fputs_filtered ("[", stream);
@@ -873,6 +885,8 @@ dump_subexp_body_standard (struct expres
     case BINOP_IN:
     case BINOP_RANGE:
     case BINOP_END:
+    case STRUCTOP_MEMBER:
+    case STRUCTOP_MPTR:
       elt = dump_subexp (exp, stream, elt);
     case UNOP_NEG:
     case UNOP_LOGICAL_NOT:
@@ -1026,8 +1040,6 @@ dump_subexp_body_standard (struct expres
       break;
     default:
     case OP_NULL:
-    case STRUCTOP_MEMBER:
-    case STRUCTOP_MPTR:
     case MULTI_SUBSCRIPT:
     case OP_F77_UNDETERMINED_ARGLIST:
     case OP_COMPLEX:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]