removed dependency of irnode.h
[libfirm] / ir / debug / debugger.c
index b3257ae..fb81809 100644 (file)
 #include "debug.h"
 
 #ifdef _WIN32
-/** Break into the debugger. The Win32 way. */
-static void firm_debug_break(void) {
+/* Break into the debugger. The Win32 way. */
+void firm_debug_break(void) {
   DebugBreak();
 }
 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64))
-/** Break into the debugger. The ia32/x86_64 way under GCC. */
-static void firm_debug_break(void) {
+/* Break into the debugger. The ia32/x86_64 way under GCC. */
+void firm_debug_break(void) {
   __asm__ __volatile__("int3");
 }
 #else
-/** Break into the debugger. Poor Unix way. */
-static void firm_debug_break(void) {
+/* Break into the debugger. Poor Unix way. */
+void firm_debug_break(void) {
   raise(SIGINT);
 }
 #endif /* _WIN32 */
@@ -143,13 +143,20 @@ static int is_active = 0;
 
 /** hook the hook h with function fkt. */
 #define HOOK(h, fkt) \
-  debugger_hooks[h].hook._##h = fkt; register_hook(h, &debugger_hooks[h])
+do {                                    \
+  debugger_hooks[h].hook._##h = fkt;    \
+  register_hook(h, &debugger_hooks[h]); \
+} while(0)
 
 /** unhook the hook h */
-#define UNHOOK(h)   unregister_hook(h, &debugger_hooks[h])
+#define UNHOOK(h) \
+do {                                      \
+  unregister_hook(h, &debugger_hooks[h]); \
+  debugger_hooks[h].hook._##h = NULL;     \
+} while(0)
 
 /** returns non-zero if a entry hook h is used */
-#define IS_HOOKED(h) (debugger_hooks[h].next != NULL)
+#define IS_HOOKED(h) (debugger_hooks[h].hook._##h != NULL)
 
 /* some macros needed to create the info string */
 #define _DBG_VERSION(major, minor)  #major "." #minor
@@ -358,7 +365,7 @@ static void dbg_new_entity(void *ctx, entity *ent)
  * @param ctx   the hook context
  * @param tp    the newly created type
  */
-static void dbg_new_type(void *ctx, type *tp)
+static void dbg_new_type(void *ctx, ir_type *tp)
 {
   {
     bp_nr_t key, *elem;
@@ -699,7 +706,7 @@ void firm_init_debugger(void)
   char *env;
 
   bp_numbers = new_set(cmp_nr_bp, 8);
-  bp_idents       = new_set(cmp_ident_bp, 8);
+  bp_idents  = new_set(cmp_ident_bp, 8);
 
   env = getenv("FIRMDBG");