Skip to content

Commit

Permalink
Hard force a crash on a failure for SetupNowRio() and wpi::Now() when…
Browse files Browse the repository at this point in the history
… not configured
  • Loading branch information
ThadHouse committed Mar 8, 2024
1 parent e64c203 commit 38dde45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hal/src/main/native/athena/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,12 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
});

if (!SetupNowRio()) {
fmt::print(stderr, "Failed to run SetupNowRio()\n");
std::fflush(stdout);
// Attempt to force a segfault to get a better java log
*(int*)0 = 0;
// If that fails, terminate
std::terminate();
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions wpiutil/src/main/native/cpp/timestamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ uint64_t wpi::Now() {
"correct.\n");
std::fflush(stderr);
}
// Attempt to force a segfault to get a better java log
*(int*)0 = 0;
// If that fails, terminate
std::terminate();
return 1;
}
}
Expand Down

0 comments on commit 38dde45

Please sign in to comment.