mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
Add runtime program option to soften assert behavior.
This commit is contained in:
parent
9661db89af
commit
351f1804c8
4 changed files with 18 additions and 0 deletions
|
@ -31,6 +31,7 @@ bool no6;
|
|||
bool norun;
|
||||
bool read_only;
|
||||
bool write_avoid;
|
||||
bool soft_assert;
|
||||
const char *execute;
|
||||
std::array<bool, 6> smoketest;
|
||||
|
||||
|
@ -54,6 +55,7 @@ lgetopt opts[]
|
|||
{ "ro", &read_only, lgetopt::BOOL, "Read-only mode. No writes to database allowed." },
|
||||
{ "wa", &write_avoid, lgetopt::BOOL, "Like read-only mode, but writes permitted if triggered." },
|
||||
{ "smoketest", &smoketest[0], lgetopt::BOOL, "Starts and stops the daemon to return success."},
|
||||
{ "sassert", &soft_assert, lgetopt::BOOL, "Softens assertion effects in debug mode."},
|
||||
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
||||
};
|
||||
|
||||
|
@ -358,4 +360,7 @@ applyargs()
|
|||
|
||||
if(no6)
|
||||
ircd::net::enable_ipv6.set("false");
|
||||
|
||||
if(soft_assert)
|
||||
ircd::soft_assert.set("true");
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace ircd
|
|||
extern conf::item<bool> debugmode;
|
||||
extern conf::item<bool> read_only;
|
||||
extern conf::item<bool> write_avoid;
|
||||
extern conf::item<bool> soft_assert;
|
||||
}
|
||||
|
||||
#endif // HAVE_IRCD_IRCD_H
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <RB_INC_SIGNAL_H
|
||||
|
||||
#if !defined(NDEBUG) && defined(RB_ASSERT)
|
||||
void
|
||||
__attribute__((visibility("default")))
|
||||
ircd::debugtrap()
|
||||
|
@ -39,6 +40,9 @@ __assert_fail(const char *__assertion,
|
|||
__function,
|
||||
__assertion);
|
||||
|
||||
if(ircd::soft_assert)
|
||||
return;
|
||||
|
||||
if(strcmp(RB_ASSERT, "quit") == 0)
|
||||
ircd::quit();
|
||||
|
||||
|
|
|
@ -17,6 +17,14 @@ namespace ircd
|
|||
static void main() noexcept;
|
||||
}
|
||||
|
||||
decltype(ircd::soft_assert)
|
||||
ircd::soft_assert
|
||||
{
|
||||
{ "name", "ircd.soft_assert" },
|
||||
{ "default", false },
|
||||
{ "persist", false },
|
||||
};
|
||||
|
||||
decltype(ircd::write_avoid)
|
||||
ircd::write_avoid
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue