-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from martinus/2022-08-small-bucket
Plenty of fixes when capacity is reached
- Loading branch information
Showing
5 changed files
with
149 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#if __GNUC__ | ||
|
||
# include <fmt/format.h> | ||
|
||
# include <array> | ||
# include <cstdio> | ||
# include <cstdlib> | ||
# include <execinfo.h> | ||
# include <signal.h> | ||
# include <unistd.h> | ||
|
||
namespace { | ||
|
||
void handler(int sig) { | ||
fmt::print(stderr, "Error: signal {}:\n", sig); | ||
auto ary = std::array<void*, 50>(); | ||
|
||
// get void*'s for all entries on the stack | ||
auto size = backtrace(ary.data(), static_cast<int>(ary.size())); | ||
|
||
// print out all the frames to stderr | ||
fmt::print(stderr, "Error: signal {}. See stacktrace with\n", sig); | ||
fmt::print(stderr, "addr2line -Cafpie ./test/udm"); | ||
for (size_t i = 0; i < static_cast<size_t>(size); ++i) { | ||
fmt::print(stderr, " {}", ary[i]); | ||
} | ||
exit(1); // NOLINT(concurrency-mt-unsafe) | ||
} | ||
|
||
class Handler { | ||
public: | ||
Handler() { | ||
(void)signal(SIGTERM, handler); | ||
} | ||
}; | ||
|
||
auto const h = Handler(); | ||
|
||
} // namespace | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters