debugger: add randnode debug command
authorMatthias Braun <matthias.braun@kit.edu>
Wed, 13 Jun 2012 09:02:30 +0000 (11:02 +0200)
committerMatthias Braun <matthias.braun@kit.edu>
Wed, 13 Jun 2012 09:05:27 +0000 (11:05 +0200)
This call initializes the node_nr with a random value on startup. This
lets you test wether the compile behaves deterministically regardless of
node numbers (which isn't always the case right now).

ir/debug/debugger.c

index d119ff1..0d02f3b 100644 (file)
@@ -39,6 +39,7 @@
 #include <signal.h>
 #include <string.h>
 #include <strings.h>
+#include <time.h>
 
 #include <ctype.h>
 
@@ -590,6 +591,7 @@ static void show_commands(void)
                "setoutfile name file  redirects debug output of module name to file\n"
                "irgname name          prints address and graph number of a method given by its name\n"
                "irgldname ldname      prints address and graph number of a method given by its ldname\n"
+               "randnodenr            randomize initial node number\n"
                "help                  list all commands\n"
                );
 }
@@ -906,6 +908,7 @@ enum tokens {
        tok_setoutfile,
        tok_showent,
        tok_showtype,
+       tok_randnodenr,
        tok_identifier,
        tok_number,
        tok_eof,
@@ -931,6 +934,7 @@ static const char *reserved[] = {
        "setoutfile",
        "showent",
        "showtype",
+       "randnodenr",
 };
 
 /**
@@ -1227,6 +1231,12 @@ void firm_debug(const char *cmd)
                        irg_name(name);
                        break;
 
+               case tok_randnodenr:
+                       dbg_printf("Randomizing initial node number\n");
+                       srand(time(0));
+                       irp->max_node_nr += rand() % 6666;
+                       break;
+
                case tok_irgldname:
                        token = get_token();
                        if (token != tok_identifier)