Added sys_assert level 3 which will make asserts to crash the application(#208)
Co-authored-by: aljanru <aljanru@amazon.com>
This commit is contained in:
@@ -4094,6 +4094,7 @@ void CSystem::CreateSystemVars()
|
||||
"0 = Suppress Asserts\n"
|
||||
"1 = Log Asserts\n"
|
||||
"2 = Show Assert Dialog\n"
|
||||
"3 = Crashes the Application on Assert\n"
|
||||
"Note: when set to '0 = Suppress Asserts', assert expressions are still evaluated. To turn asserts into a no-op, undefine AZ_ENABLE_TRACING and recompile.",
|
||||
OnAssertLevelCvarChanged);
|
||||
CSystem::SetAssertLevel(defaultAssertValue);
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace AZ
|
||||
static const char* logVerbosityUID = "sys_LogLevel";
|
||||
static const int assertLevel_log = 1;
|
||||
static const int assertLevel_nativeUI = 2;
|
||||
static const int assertLevel_crash = 3;
|
||||
static const int logLevel_errorWarning = 1;
|
||||
static const int logLevel_full = 2;
|
||||
static AZ::EnvironmentVariable<AZStd::unordered_set<size_t>> g_ignoredAsserts;
|
||||
@@ -289,8 +290,8 @@ namespace AZ
|
||||
}
|
||||
|
||||
#if AZ_ENABLE_TRACE_ASSERTS
|
||||
//display native UI dialogs at verbosity level 2 or higher
|
||||
if (currentLevel >= assertLevel_nativeUI)
|
||||
//display native UI dialogs at verbosity level 2
|
||||
if (currentLevel == assertLevel_nativeUI)
|
||||
{
|
||||
AZ::NativeUI::AssertAction buttonResult;
|
||||
EBUS_EVENT_RESULT(buttonResult, AZ::NativeUI::NativeUIRequestBus, DisplayAssertDialog, dialogBoxText);
|
||||
@@ -314,7 +315,13 @@ namespace AZ
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif //AZ_ENABLE_TRACE_ASSERTS
|
||||
// Crash the application directly at assert level 3
|
||||
if (currentLevel >= assertLevel_crash)
|
||||
{
|
||||
AZ_Crash();
|
||||
}
|
||||
}
|
||||
g_alreadyHandlingAssertOrFatal = false;
|
||||
}
|
||||
|
||||
@@ -539,8 +539,8 @@ namespace ImGui
|
||||
{
|
||||
int assertLevelValue = gAssertLevelCVAR->GetIVal();
|
||||
int dragIntVal = assertLevelValue;
|
||||
ImGui::Text("sys_asserts: %d ( 0-off | 1-log | 2-popup )", assertLevelValue);
|
||||
ImGui::SliderInt("##sys_asserts", &dragIntVal, 0, 2);
|
||||
ImGui::Text("sys_asserts: %d ( 0-off | 1-log | 2-popup | 3-crash )", assertLevelValue);
|
||||
ImGui::SliderInt("##sys_asserts", &dragIntVal, 0, 3);
|
||||
if (dragIntVal != assertLevelValue)
|
||||
{
|
||||
gAssertLevelCVAR->Set(dragIntVal);
|
||||
|
||||
Reference in New Issue
Block a user