Keep debug log the same even when going via cap32for64

This commit is contained in:
baldurk
2016-12-08 18:22:48 +00:00
parent 739b4cb1ab
commit c810a96300
4 changed files with 18 additions and 9 deletions
+1
View File
@@ -647,6 +647,7 @@ extern "C" RENDERDOC_API uint32_t RENDERDOC_CC RENDERDOC_InjectIntoProcess(
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_TriggerExceptionHandler(void *exceptionPtrs,
bool32 crashed);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char *filename);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogText(const char *text);
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogMessage(LogMessageType type,
const char *project, const char *file,
+6 -9
View File
@@ -172,12 +172,6 @@ extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetLogFile(const char *lo
RenderDoc::Inst().SetLogFile(log);
}
extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetDebugLogFile(const char *log)
{
if(log)
RDCLOGFILE(log);
}
static Process::EnvironmentModification tempEnvMod;
extern "C" __declspec(dllexport) void __cdecl INTERNAL_EnvModName(const char *name)
@@ -595,9 +589,12 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env,
wchar_t *paramsAlloc = new wchar_t[2048];
std::string debugLogfile = RDCGETLOGFILE();
wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile);
_snwprintf_s(paramsAlloc, 2047, 2047,
L"\"%ls\" cap32for64 --pid=%d --log=\"%ls\" --capopts=\"%hs\"", renderdocPath, pid,
wlogfile.c_str(), optstr.c_str());
L"\"%ls\" cap32for64 --pid=%d --log=\"%ls\" --debuglog=\"%ls\" --capopts=\"%hs\"",
renderdocPath, pid, wlogfile.c_str(), wdebugLogfile.c_str(), optstr.c_str());
paramsAlloc[2047] = 0;
@@ -711,7 +708,7 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, EnvironmentModification *env,
std::string debugLogfile = RDCGETLOGFILE();
InjectFunctionCall(hProcess, loc, "INTERNAL_SetDebugLogFile", (void *)debugLogfile.c_str(),
InjectFunctionCall(hProcess, loc, "RENDERDOC_SetDebugLogFile", (void *)debugLogfile.c_str(),
debugLogfile.size() + 1);
if(opts != NULL)
+6
View File
@@ -285,6 +285,12 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeEnvironmentModification
delete[] mods;
}
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_SetDebugLogFile(const char *log)
{
if(log)
RDCLOGFILE(log);
}
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_LogText(const char *text)
{
rdclog_int(RDCLog_Comment, "EXT", "external", 0, "%s", text);
+5
View File
@@ -548,6 +548,7 @@ struct Cap32For64Command : public Command
{
parser.add<uint32_t>("pid", 0, "");
parser.add<string>("log", 0, "");
parser.add<string>("debuglog", 0, "");
parser.add<string>("capopts", 0, "");
parser.stop_at_rest(true);
}
@@ -634,6 +635,10 @@ struct Cap32For64Command : public Command
type, sep);
}
string debuglog = parser.get<string>("debuglog");
RENDERDOC_SetDebugLogFile(debuglog.c_str());
int ret = RENDERDOC_InjectIntoProcess(parser.get<uint32_t>("pid"), env,
parser.get<string>("log").c_str(), &cmdopts, false);