Fix crash handler not launching as expected in official builds

This commit is contained in:
baldurk
2022-11-01 12:42:02 +00:00
parent 2c220e7af0
commit 3f9bf1ab27
4 changed files with 27 additions and 26 deletions
+20 -25
View File
@@ -297,18 +297,20 @@ void RenderDoc::RecreateCrashHandler()
{
SCOPED_WRITELOCK(m_ExHandlerLock);
if(!m_ExHandler)
return;
#if ENABLED(RDOC_CRASH_HANDLER)
#if ENABLED(RDOC_WIN32)
// there are way too many invalid reports coming from chrome, completely disable the crash handler
// in that case.
rdcstr exename;
FileIO::GetExecutableFilename(exename);
exename = strlower(exename);
// only create crash handler when we're not in renderdoccmd (to prevent infinite loop as
// the crash handler itself launches renderdoccmd)
if(exename.contains("renderdoccmd"))
return;
#if ENABLED(RDOC_WIN32)
// there are way too many invalid reports coming from chrome, completely disable the crash handler
// in that case.
if(exename.find("chrome.exe") &&
(GetModuleHandleA("chrome_elf.dll") || GetModuleHandleA("chrome_child.dll")))
{
@@ -504,10 +506,13 @@ void RenderDoc::Initialise()
RDCWARN("dlsym() hooking enabled!");
#endif
if(m_RemoteIdent == 0)
RDCWARN("Couldn't open socket for target control");
else
RDCDEBUG("Listening for target control on %u", m_RemoteIdent);
if(!IsReplayApp())
{
if(m_RemoteIdent == 0)
RDCWARN("Couldn't open socket for target control");
else
RDCDEBUG("Listening for target control on %u", m_RemoteIdent);
}
Keyboard::Init();
@@ -515,19 +520,7 @@ void RenderDoc::Initialise()
m_ExHandler = NULL;
{
rdcstr curFile;
FileIO::GetExecutableFilename(curFile);
rdcstr f = strlower(curFile);
// only create crash handler when we're not in renderdoccmd.exe (to prevent infinite loop as
// the crash handler itself launches renderdoccmd.exe)
if(!f.contains("renderdoccmd.exe"))
{
RecreateCrashHandler();
}
}
RecreateCrashHandler();
// begin printing to stdout/stderr after this point, earlier logging is debugging
// cruft that we don't want cluttering output.
@@ -615,11 +608,13 @@ void RenderDoc::InitialiseReplay(GlobalEnvironment env, const rdcarray<rdcstr> &
m_GlobalEnv.xlibDisplay = XOpenDisplay(NULL);
#endif
rdcstr exename;
FileIO::GetExecutableFilename(exename);
RDCLOG("Replay application '%s' launched", exename.c_str());
if(!args.empty())
{
RDCDEBUG("Replay application launched with parameters:");
for(size_t i = 0; i < args.size(); i++)
RDCDEBUG("[%u]: %s", (uint32_t)i, args[i].c_str());
RDCLOG("Parameter [%u]: %s", (uint32_t)i, args[i].c_str());
}
if(args.contains("--crash"))
+5 -1
View File
@@ -1685,7 +1685,11 @@ int renderdoccmd(GlobalEnvironment &env, std::vector<std::string> &argv)
return 1;
}
RENDERDOC_InitialiseReplay(env, convertArgs(cmd.rest()));
rdcarray<rdcstr> args = convertArgs(cmd.rest());
args.append(it->second->ReplayArgs());
RENDERDOC_InitialiseReplay(env, args);
int ret = it->second->Execute(opts);
+1
View File
@@ -35,6 +35,7 @@ struct Command
virtual int Execute(const CaptureOptions &opts) = 0;
virtual const char *Description() = 0;
virtual rdcarray<rdcstr> ReplayArgs() { return {}; }
virtual bool HandlesUsageManually() { return false; }
virtual bool IsInternalOnly() = 0;
virtual bool IsCaptureCommand() = 0;
+1
View File
@@ -468,6 +468,7 @@ public:
pipe = conv(parser.get<std::string>("pipe"));
return true;
}
virtual rdcarray<rdcstr> ReplayArgs() { return {"--crash"}; }
virtual int Execute(const CaptureOptions &)
{
CrashGenerationServer *crashServer = NULL;