changeset 72046b9b3323 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=72046b9b3323
description:
        sim: don't ignore SIG_TRAP

        By ignoring SIG_TRAP, using --debug-break <N> when not connected to
        a debugger becomes a no-op.  Apparently this was intended to be a
        feature, though the rationale is not clear.

        If we don't ignore SIG_TRAP, then using --debug-break <N> when not
        connected to a debugger causes the simulation process to terminate
        at tick N.  This is occasionally useful, e.g., if you just want to
        collect a trace for a specific window of execution then you can combine
        this with --debug-start to do exactly that.

        In addition to not ignoring the signal, this patch also updates
        the --debug-break help message and deletes a handful of unprotected
        calls to Debug::breakpoint() that relied on the prior behavior.

diffstat:

 src/arch/alpha/ev5.cc   |  5 -----
 src/dev/net/ns_gige.cc  |  3 ---
 src/dev/net/sinic.cc    |  1 -
 src/python/m5/main.py   |  9 +++++----
 src/sim/init_signals.cc |  3 ---
 5 files changed, 5 insertions(+), 16 deletions(-)

diffs (89 lines):

diff -r e535b95573c0 -r 72046b9b3323 src/arch/alpha/ev5.cc
--- a/src/arch/alpha/ev5.cc     Sun Jan 17 21:13:29 2016 -0500
+++ b/src/arch/alpha/ev5.cc     Sun Jan 17 18:27:46 2016 -0800
@@ -271,11 +271,6 @@
         break;
 
       case IPR_IPLR:
-#ifdef DEBUG
-        if (break_ipl != -1 && break_ipl == (int)(val & 0x1f))
-            Debug::breakpoint();
-#endif
-
         // only write least significant five bits - interrupt level
         ipr[idx] = val & 0x1f;
         if (tc->getKernelStats())
diff -r e535b95573c0 -r 72046b9b3323 src/dev/net/ns_gige.cc
--- a/src/dev/net/ns_gige.cc    Sun Jan 17 21:13:29 2016 -0500
+++ b/src/dev/net/ns_gige.cc    Sun Jan 17 18:27:46 2016 -0800
@@ -951,7 +951,6 @@
 
     intrTick = when;
     if (intrTick < curTick()) {
-        Debug::breakpoint();
         intrTick = curTick();
     }
 
@@ -1725,7 +1724,6 @@
                             tcp->sum(cksum(tcp));
                             txTcpChecksums++;
                         } else {
-                            Debug::breakpoint();
                             warn_once("TCPPKT set, but not UDP!\n");
                         }
                     }
@@ -1735,7 +1733,6 @@
                             ip->sum(cksum(ip));
                             txIpChecksums++;
                         } else {
-                            Debug::breakpoint();
                             warn_once("IPPKT set, but not UDP!\n");
                         }
                     }
diff -r e535b95573c0 -r 72046b9b3323 src/dev/net/sinic.cc
--- a/src/dev/net/sinic.cc      Sun Jan 17 21:13:29 2016 -0500
+++ b/src/dev/net/sinic.cc      Sun Jan 17 18:27:46 2016 -0800
@@ -527,7 +527,6 @@
 
     intrTick = when;
     if (intrTick < curTick()) {
-        Debug::breakpoint();
         intrTick = curTick();
     }
 
diff -r e535b95573c0 -r 72046b9b3323 src/python/m5/main.py
--- a/src/python/m5/main.py     Sun Jan 17 21:13:29 2016 -0500
+++ b/src/python/m5/main.py     Sun Jan 17 18:27:46 2016 -0800
@@ -94,14 +94,15 @@
 
     # Debugging options
     group("Debugging Options")
-    option("--debug-break", metavar="TIME[,TIME]", action='append', split=',',
-        help="Tick to create a breakpoint")
+    option("--debug-break", metavar="TICK[,TICK]", action='append', split=',',
+        help="Create breakpoint(s) at TICK(s) " \
+             "(kills process if no debugger attached)")
     option("--debug-help", action='store_true',
         help="Print help on debug flags")
     option("--debug-flags", metavar="FLAG[,FLAG]", action='append', split=',',
         help="Sets the flags for debug output (-FLAG disables a flag)")
-    option("--debug-start", metavar="TIME", type='int',
-        help="Start debug output at TIME (must be in ticks)")
+    option("--debug-start", metavar="TICK", type='int',
+        help="Start debug output at TICK (must be in ticks)")
     option("--debug-file", metavar="FILE", default="cout",
         help="Sets the output file for debug [Default: %default]")
     option("--debug-ignore", metavar="EXPR", action='append', split=':',
diff -r e535b95573c0 -r 72046b9b3323 src/sim/init_signals.cc
--- a/src/sim/init_signals.cc   Sun Jan 17 21:13:29 2016 -0500
+++ b/src/sim/init_signals.cc   Sun Jan 17 18:27:46 2016 -0800
@@ -178,9 +178,6 @@
     // ignore them
     signal(SIGFPE, SIG_IGN);
 
-    // We use SIGTRAP sometimes for debugging
-    signal(SIGTRAP, SIG_IGN);
-
     // Dump intermediate stats
     installSignalHandler(SIGUSR1, dumpStatsHandler);
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to