Added debugger attachment utilities to the engine, fixed crash when showing console variables, improvements to timeout handling and small cleanup (#3591)

* Added debugger attachment utilities to the engine, fixed crash when showing console variables

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Removed unused variables

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Removed unneded check

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Small fix for crashes/timeouts

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Removed unused variable, fixed compile error

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Fix compile

Signed-off-by: Garcia Ruiz <aljanru@amazon.co.uk>

* Addressed esteban comments

* Addressed tom comments

Co-authored-by: Garcia Ruiz <aljanru@amazon.co.uk>
This commit is contained in:
AMZN-AlexOteiza
2021-08-31 09:27:14 +01:00
committed by GitHub
parent 9752fb009a
commit d784ff8c57
9 changed files with 210 additions and 38 deletions
+17 -2
View File
@@ -551,7 +551,9 @@ public:
{ "NSDocumentRevisionsDebugMode", nsDocumentRevisionsDebugMode},
{ "skipWelcomeScreenDialog", m_bSkipWelcomeScreenDialog},
{ "autotest_mode", m_bAutotestMode},
{ "regdumpall", dummy }
{ "regdumpall", dummy },
{ "attach-debugger", dummy }, // Attaches a debugger for the current application
{ "wait-for-debugger", dummy }, // Waits until a debugger is attached to the current application
};
QString dummyString;
@@ -2290,7 +2292,7 @@ int CCryEditApp::IdleProcessing(bool bBackgroundUpdate)
int res = 0;
if (bIsAppWindow || m_bForceProcessIdle || m_bKeepEditorActive
// Automated tests must always keep the editor active, or they can get stuck
|| m_bAutotestMode)
|| m_bAutotestMode || m_bRunPythonTestScript)
{
res = 1;
bActive = true;
@@ -4011,6 +4013,19 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
{
CryAllocatorsRAII cryAllocatorsRAII;
// Debugging utilities
for (int i = 1; i < argc; ++i)
{
if (azstricmp(argv[i], "--attach-debugger") == 0)
{
AZ::Debug::Trace::AttachDebugger();
}
else if (azstricmp(argv[i], "--wait-for-debugger") == 0)
{
AZ::Debug::Trace::WaitForDebugger();
}
}
// ensure the EditorEventsBus context gets created inside EditorLib
[[maybe_unused]] const auto& editorEventsContext = AzToolsFramework::EditorEvents::Bus::GetOrCreateContext();