Handle SIGABRT a little more nicely.
base/misc.cc:
Don't dump trace in panic(), SIGABRT handler will do it now.
sim/main.cc:
Add SIGABRT handler that prints curTick and dumps buffered trace (if any).
This doesn't work as well as I would like since the buffered trace records
often contain stale references to stack-resident temporary std::string objects.
Someday we'll have to put in a fix for that.
--HG--
extra : convert_revision : 67576efbf5c10e63e255fc9a9ec520326fd3567b
This commit is contained in:
@@ -61,11 +61,6 @@ __panic(const string &format, cp::ArgList &args, const char *func,
|
||||
|
||||
delete &args;
|
||||
|
||||
#if TRACING_ON
|
||||
// dump trace buffer, if there is one
|
||||
Trace::theLog.dump(cerr);
|
||||
#endif
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
13
sim/main.cc
13
sim/main.cc
@@ -90,6 +90,18 @@ exitNowHandler(int sigtype)
|
||||
async_exit = true;
|
||||
}
|
||||
|
||||
/// Abort signal handler.
|
||||
void
|
||||
abortHandler(int sigtype)
|
||||
{
|
||||
cerr << "Program aborted at cycle " << curTick << endl;
|
||||
|
||||
#if TRACING_ON
|
||||
// dump trace buffer, if there is one
|
||||
Trace::theLog.dump(cerr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Simulator executable name
|
||||
const char *myProgName = "";
|
||||
|
||||
@@ -232,6 +244,7 @@ main(int argc, char **argv)
|
||||
signal(SIGUSR1, dumpStatsHandler); // dump intermediate stats
|
||||
signal(SIGUSR2, dumprstStatsHandler); // dump and reset stats
|
||||
signal(SIGINT, exitNowHandler); // dump final stats and exit
|
||||
signal(SIGABRT, abortHandler);
|
||||
|
||||
sayHello(cerr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user