public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [incremental] Patch: FYI: add accessor macros to gdbinit
@ 2008-05-21 15:35 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2008-05-21 15:35 UTC (permalink / raw)
  To: Gcc Patch List

I'm checking this in on the incremental-compiler branch.

If you have a gdb with a working "macro define", this patch enables
the coexistence of gcc's runtime checking and -g3.  It works by
overriding any tree macro that might use a statement expression.  I
also added __builtin_offsetof, since I ran into this omission while
hacking on the GC.

Tom

ChangeLog:
2008-05-21  Tom Tromey  <tromey@redhat.com>

	* gdbinit.in: Add macros for tree accessors.

Index: gdbinit.in
===================================================================
--- gdbinit.in	(revision 132956)
+++ gdbinit.in	(working copy)
@@ -149,3 +149,35 @@
 # USE_SYSTEM_ABORT is defined, so gdb may complain and bail out.
 b exit
 b abort
+
+# Redefine any macro from tree.h that uses a statement expression.
+# Last in case of failure.
+macro define TREE_CHECK(T, CODE) (T)
+macro define TREE_NOT_CHECK(T, CODE) (T)
+macro define TREE_CHECK2(T, CODE1, CODE2) (T)
+macro define TREE_NOT_CHECK2(T, CODE1, CODE2) (T)
+macro define TREE_CHECK3(T, CODE1, CODE2, CODE3) (T)
+macro define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) (T)
+macro define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
+macro define NON_TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T)
+macro define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
+macro define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T)
+macro define CONTAINS_STRUCT_CHECK(T, STRUCT) (T)
+macro define TREE_CLASS_CHECK(T, CLASS) (T)
+macro define TREE_RANGE_CHECK(T, CODE1, CODE2) (T)
+macro define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) (T)
+macro define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T)
+macro define EXPR_CHECK(T) (T)
+macro define GIMPLE_STMT_CHECK(T) (T)
+macro define NON_TYPE_CHECK(T) (T)
+macro define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I])
+macro define PHI_NODE_ELT_CHECK(T, I) ((T)->phi.a[I])
+macro define OMP_CLAUSE_ELT_CHECK(T, I) ((T)->omp_clause.ops[I])
+macro define TREE_OPERAND_CHECK(T, I) ((T)->exp.operands[I])
+macro define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I])
+macro define GIMPLE_STMT_OPERAND_CHECK(T, I) ((T)->gstmt.operands[I])
+macro define TREE_RTL_OPERAND_CHECK(T, CODE, I) ((T)->exp.operands[I])
+macro define TREE_CHAIN(NODE) ((T)->common.chain)
+macro define TREE_TYPE(NODE) ((T)->common.type)
+# Another handy one.
+macro define __builtin_offsetof(T, F) ((int) &(((T *) 0)->F))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-21 14:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-21 15:35 [incremental] Patch: FYI: add accessor macros to gdbinit Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).