Skip to content

Commit

Permalink
Always coredump on crash if we're allowed to (#1327)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeSiFive authored Jun 29, 2023
1 parent dd4a1fd commit f79c1d9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/wake/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <inttypes.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
#include <wcl/defer.h>
Expand Down Expand Up @@ -190,6 +191,14 @@ class TerminalReporter : public DiagnosticReporter {
};

int main(int argc, char **argv) {
// Make sure we always get core dumps but don't fail
// if that fails for some reason.
struct rlimit core_lim;
getrlimit(RLIMIT_CORE, &core_lim);
core_lim.rlim_cur = core_lim.rlim_max;
setrlimit(RLIMIT_CORE, &core_lim);

// Get the start time for wake
auto start = std::chrono::steady_clock::now();

TerminalReporter terminalReporter;
Expand Down

0 comments on commit f79c1d9

Please sign in to comment.