aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-set.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/hash-set.h')
-rw-r--r--gcc/hash-set.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/hash-set.h b/gcc/hash-set.h
index 8ce796d..75ca147 100644
--- a/gcc/hash-set.h
+++ b/gcc/hash-set.h
@@ -127,6 +127,44 @@ private:
hash_table<Traits> m_table;
};
+/* Generic hash_set<TYPE> debug helper.
+
+ This needs to be instantiated for each hash_set<TYPE> used throughout
+ the compiler like this:
+
+ DEFINE_DEBUG_HASH_SET (TYPE)
+
+ The reason we have a debug_helper() is because GDB can't
+ disambiguate a plain call to debug(some_hash), and it must be called
+ like debug<TYPE>(some_hash). */
+template<typename T>
+void
+debug_helper (hash_set<T> &ref)
+{
+ for (typename hash_set<T>::iterator it = ref.begin ();
+ it != ref.end (); ++it)
+ {
+ debug_slim (*it);
+ fputc ('\n', stderr);
+ }
+}
+
+#define DEFINE_DEBUG_HASH_SET(T) \
+ template static void debug_helper (hash_set<T> &); \
+ DEBUG_FUNCTION void \
+ debug (hash_set<T> &ref) \
+ { \
+ debug_helper <T> (ref); \
+ } \
+ DEBUG_FUNCTION void \
+ debug (hash_set<T> *ptr) \
+ { \
+ if (ptr) \
+ debug (*ptr); \
+ else \
+ fprintf (stderr, "<nil>\n"); \
+ }
+
/* ggc marking routines. */
template<typename K, typename H>