I found out how to do it.
It was enough to modify the abortHandler inside src/sim/init_signals.cc, adding the statistics::dump() instruction. Make sure to #include "base/statistics.hh" at the beginning of the file.
/* src/sim/init_signals.cc */
/// Abort signal handler.
void
abortHandler(int sigtype)
{
const EventQueue *const eq(curEventQueue());
// INSERT STATISTICS DUMP HERE
// ----------------
std::cout << "Dumping statistics..." << std::endl;
statistics::dump();
// ----------------
if (eq) {
ccprintf(std::cerr, "Program aborted at tick %llu\n",
eq->getCurTick());
} else {
STATIC_ERR("Program aborted\n\n");
}
print_backtrace();
raiseFatalSignal(sigtype);
}