mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
rename logfile -> capturefile parameter on execute, document for python
This commit is contained in:
@@ -2057,6 +2057,7 @@ DOCUMENT(R"(Launch an application and inject into it to allow capturing.
|
||||
:param str cmdLine: The command line to use when running the application, it will be processed in a
|
||||
platform specific way to generate arguments.
|
||||
:param list env: Any :class:`EnvironmentModification` that should be made when running the program.
|
||||
:param str capturefile: The capture file path template, or blank to use a default location.
|
||||
:param CaptureOptions opts: The capture options to use when injecting into the program.
|
||||
:param bool waitForExit: If ``True`` this function will block until the process exits.
|
||||
:return: The :class:`ExecuteResult` indicating both the status of the operation (success or failure)
|
||||
@@ -2066,13 +2067,14 @@ DOCUMENT(R"(Launch an application and inject into it to allow capturing.
|
||||
)");
|
||||
extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC
|
||||
RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine,
|
||||
const rdcarray<EnvironmentModification> &env, const char *logfile,
|
||||
const rdcarray<EnvironmentModification> &env, const char *capturefile,
|
||||
const CaptureOptions &opts, bool waitForExit);
|
||||
|
||||
DOCUMENT(R"(Where supported by operating system and permissions, inject into a running process.
|
||||
|
||||
:param int pid: The Process ID (PID) to inject into.
|
||||
:param list env: Any :class:`EnvironmentModification` that should be made when running the program.
|
||||
:param str capturefile: The capture file path template, or blank to use a default location.
|
||||
:param CaptureOptions opts: The capture options to use when injecting into the program.
|
||||
:param bool waitForExit: If ``True`` this function will block until the process exits.
|
||||
:return: The :class:`ExecuteResult` indicating both the status of the operation (success or failure)
|
||||
@@ -2082,7 +2084,7 @@ DOCUMENT(R"(Where supported by operating system and permissions, inject into a r
|
||||
)");
|
||||
extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC
|
||||
RENDERDOC_InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts, bool waitForExit);
|
||||
const char *capturefile, const CaptureOptions &opts, bool waitForExit);
|
||||
|
||||
DOCUMENT(R"(When debugging RenderDoc it can be useful to capture itself by doing a side-build with a
|
||||
temporary name. This function wraps up the use of the in-application API to start a capture.
|
||||
|
||||
@@ -56,12 +56,13 @@ void ApplyEnvironmentModification();
|
||||
const char *GetEnvVariable(const char *name);
|
||||
|
||||
bool CanGlobalHook();
|
||||
bool StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts);
|
||||
bool StartGlobalHook(const char *pathmatch, const char *capturefile, const CaptureOptions &opts);
|
||||
bool IsGlobalHookActive();
|
||||
void StopGlobalHook();
|
||||
|
||||
ExecuteResult InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts, bool waitForExit);
|
||||
const char *capturefile, const CaptureOptions &opts,
|
||||
bool waitForExit);
|
||||
struct ProcessResult
|
||||
{
|
||||
string strStdout, strStderror;
|
||||
@@ -73,7 +74,7 @@ uint32_t LaunchScript(const char *script, const char *workingDir, const char *ar
|
||||
ProcessResult *result = NULL);
|
||||
ExecuteResult LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine,
|
||||
const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts,
|
||||
const char *capturefile, const CaptureOptions &opts,
|
||||
bool waitForExit);
|
||||
void *LoadModule(const char *module);
|
||||
void *GetFunctionAddress(void *module, const char *function);
|
||||
|
||||
@@ -48,7 +48,7 @@ void library_loaded()
|
||||
{
|
||||
RenderDoc::Inst().Initialise();
|
||||
|
||||
const char *logfile = Process::GetEnvVariable("RENDERDOC_LOGFILE");
|
||||
const char *capturefile = Process::GetEnvVariable("RENDERDOC_CAPFILE");
|
||||
const char *opts = Process::GetEnvVariable("RENDERDOC_CAPTUREOPTS");
|
||||
|
||||
if(opts)
|
||||
@@ -61,9 +61,9 @@ void library_loaded()
|
||||
RenderDoc::Inst().SetCaptureOptions(optstruct);
|
||||
}
|
||||
|
||||
if(logfile)
|
||||
if(capturefile)
|
||||
{
|
||||
RenderDoc::Inst().SetCaptureFileTemplate(logfile);
|
||||
RenderDoc::Inst().SetCaptureFileTemplate(capturefile);
|
||||
}
|
||||
|
||||
RDCLOG("Loading into %s", curfile.c_str());
|
||||
|
||||
@@ -691,8 +691,8 @@ uint32_t Process::LaunchScript(const char *script, const char *workingDir, const
|
||||
ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir,
|
||||
const char *cmdLine,
|
||||
const rdcarray<EnvironmentModification> &envList,
|
||||
const char *logfile, const CaptureOptions &opts,
|
||||
bool waitForExit)
|
||||
const char *capturefile,
|
||||
const CaptureOptions &opts, bool waitForExit)
|
||||
{
|
||||
if(app == NULL || app[0] == 0)
|
||||
{
|
||||
@@ -708,8 +708,8 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w
|
||||
for(const EnvironmentModification &e : envList)
|
||||
modifications.push_back(e);
|
||||
|
||||
if(logfile == NULL)
|
||||
logfile = "";
|
||||
if(capturefile == NULL)
|
||||
capturefile = "";
|
||||
|
||||
string binpath, libpath;
|
||||
{
|
||||
@@ -743,7 +743,7 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w
|
||||
modifications.push_back(
|
||||
EnvironmentModification(EnvMod::Append, EnvSep::Platform, PRELOAD_ENV_VAR, libfile.c_str()));
|
||||
modifications.push_back(
|
||||
EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_LOGFILE", logfile));
|
||||
EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_CAPFILE", capturefile));
|
||||
modifications.push_back(
|
||||
EnvironmentModification(EnvMod::Set, EnvSep::NoSep, "RENDERDOC_CAPTUREOPTS", optstr.c_str()));
|
||||
modifications.push_back(EnvironmentModification(EnvMod::Set, EnvSep::NoSep,
|
||||
|
||||
@@ -196,10 +196,10 @@ extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetCaptureOptions(Capture
|
||||
RenderDoc::Inst().SetCaptureOptions(*opts);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetLogFile(const char *log)
|
||||
extern "C" __declspec(dllexport) void __cdecl INTERNAL_SetCaptureFile(const char *capfile)
|
||||
{
|
||||
if(log)
|
||||
RenderDoc::Inst().SetCaptureFileTemplate(log);
|
||||
if(capfile)
|
||||
RenderDoc::Inst().SetCaptureFileTemplate(capfile);
|
||||
}
|
||||
|
||||
static EnvironmentModification tempEnvMod;
|
||||
@@ -540,10 +540,10 @@ static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, c
|
||||
}
|
||||
|
||||
ExecuteResult Process::InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts,
|
||||
const char *capturefile, const CaptureOptions &opts,
|
||||
bool waitForExit)
|
||||
{
|
||||
wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(logfile);
|
||||
wstring wcapturefile = capturefile == NULL ? L"" : StringFormat::UTF82Wide(capturefile);
|
||||
|
||||
HANDLE hProcess =
|
||||
OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION |
|
||||
@@ -792,9 +792,10 @@ ExecuteResult Process::InjectIntoProcess(uint32_t pid, const rdcarray<Environmen
|
||||
std::string debugLogfile = RDCGETLOGFILE();
|
||||
wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile);
|
||||
|
||||
_snwprintf_s(paramsAlloc, 2047, 2047,
|
||||
L"\"%ls\" capaltbit --pid=%d --log=\"%ls\" --debuglog=\"%ls\" --capopts=\"%hs\"",
|
||||
renderdocPath, pid, wlogfile.c_str(), wdebugLogfile.c_str(), optstr.c_str());
|
||||
_snwprintf_s(
|
||||
paramsAlloc, 2047, 2047,
|
||||
L"\"%ls\" capaltbit --pid=%d --capfile=\"%ls\" --debuglog=\"%ls\" --capopts=\"%hs\"",
|
||||
renderdocPath, pid, wcapturefile.c_str(), wdebugLogfile.c_str(), optstr.c_str());
|
||||
|
||||
RDCDEBUG("params %ls", paramsAlloc);
|
||||
|
||||
@@ -911,8 +912,9 @@ ExecuteResult Process::InjectIntoProcess(uint32_t pid, const rdcarray<Environmen
|
||||
{
|
||||
// safe to cast away the const as we know these functions don't modify the parameters
|
||||
|
||||
if(logfile != NULL)
|
||||
InjectFunctionCall(hProcess, loc, "INTERNAL_SetLogFile", (void *)logfile, strlen(logfile) + 1);
|
||||
if(capturefile != NULL)
|
||||
InjectFunctionCall(hProcess, loc, "INTERNAL_SetCaptureFile", (void *)capturefile,
|
||||
strlen(capturefile) + 1);
|
||||
|
||||
std::string debugLogfile = RDCGETLOGFILE();
|
||||
|
||||
@@ -1033,11 +1035,11 @@ uint32_t Process::LaunchScript(const char *script, const char *workingDir, const
|
||||
ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir,
|
||||
const char *cmdLine,
|
||||
const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts,
|
||||
bool waitForExit)
|
||||
const char *capturefile,
|
||||
const CaptureOptions &opts, bool waitForExit)
|
||||
{
|
||||
void *func =
|
||||
GetProcAddress(GetModuleHandleA(STRINGIZE(RDOC_DLL_FILE) ".dll"), "INTERNAL_SetLogFile");
|
||||
GetProcAddress(GetModuleHandleA(STRINGIZE(RDOC_DLL_FILE) ".dll"), "INTERNAL_SetCaptureFile");
|
||||
|
||||
if(func == NULL)
|
||||
{
|
||||
@@ -1051,7 +1053,7 @@ ExecuteResult Process::LaunchAndInjectIntoProcess(const char *app, const char *w
|
||||
if(pi.dwProcessId == 0)
|
||||
return {ReplayStatus::InjectionFailed, 0};
|
||||
|
||||
ExecuteResult ret = InjectIntoProcess(pi.dwProcessId, {}, logfile, opts, false);
|
||||
ExecuteResult ret = InjectIntoProcess(pi.dwProcessId, {}, capturefile, opts, false);
|
||||
|
||||
CloseHandle(pi.hProcess);
|
||||
ResumeThread(pi.hThread);
|
||||
@@ -1337,7 +1339,8 @@ static void GlobalHookThread()
|
||||
}
|
||||
}
|
||||
|
||||
bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const CaptureOptions &opts)
|
||||
bool Process::StartGlobalHook(const char *pathmatch, const char *capturefile,
|
||||
const CaptureOptions &opts)
|
||||
{
|
||||
if(pathmatch == NULL)
|
||||
return false;
|
||||
@@ -1443,17 +1446,17 @@ bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const
|
||||
// serialise to string with two chars per byte
|
||||
string optstr = opts.EncodeAsString();
|
||||
|
||||
wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(string(logfile));
|
||||
wstring wcapturefile = capturefile == NULL ? L"" : StringFormat::UTF82Wide(string(capturefile));
|
||||
wstring wpathmatch = StringFormat::UTF82Wide(string(pathmatch));
|
||||
|
||||
std::string debugLogfile = RDCGETLOGFILE();
|
||||
wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile);
|
||||
|
||||
_snwprintf_s(¶msAlloc[0], 2047, 2047,
|
||||
L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" "
|
||||
L"\"%ls\" globalhook --match \"%ls\" --capfile \"%ls\" --debuglog \"%ls\" "
|
||||
L"--capopts \"%hs\"",
|
||||
cmdpathNative.c_str(), wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(),
|
||||
optstr.c_str());
|
||||
cmdpathNative.c_str(), wpathmatch.c_str(), wcapturefile.c_str(),
|
||||
wdebugLogfile.c_str(), optstr.c_str());
|
||||
|
||||
paramsAlloc[2047] = 0;
|
||||
|
||||
@@ -1515,10 +1518,10 @@ bool Process::StartGlobalHook(const char *pathmatch, const char *logfile, const
|
||||
// repeat the process for the Wow32 renderdoccmd
|
||||
#if ENABLED(RDOC_X64)
|
||||
_snwprintf_s(¶msAlloc[0], 2047, 2047,
|
||||
L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" "
|
||||
L"\"%ls\" globalhook --match \"%ls\" --capfile \"%ls\" --debuglog \"%ls\" "
|
||||
L"--capopts \"%hs\"",
|
||||
cmdpathWow32.c_str(), wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(),
|
||||
optstr.c_str());
|
||||
cmdpathWow32.c_str(), wpathmatch.c_str(), wcapturefile.c_str(),
|
||||
wdebugLogfile.c_str(), optstr.c_str());
|
||||
|
||||
paramsAlloc[2047] = 0;
|
||||
|
||||
|
||||
@@ -303,10 +303,10 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UnregisterMemoryRegion(void
|
||||
|
||||
extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC
|
||||
RENDERDOC_ExecuteAndInject(const char *app, const char *workingDir, const char *cmdLine,
|
||||
const rdcarray<EnvironmentModification> &env, const char *logfile,
|
||||
const rdcarray<EnvironmentModification> &env, const char *capturefile,
|
||||
const CaptureOptions &opts, bool waitForExit)
|
||||
{
|
||||
return Process::LaunchAndInjectIntoProcess(app, workingDir, cmdLine, env, logfile, opts,
|
||||
return Process::LaunchAndInjectIntoProcess(app, workingDir, cmdLine, env, capturefile, opts,
|
||||
waitForExit != 0);
|
||||
}
|
||||
|
||||
@@ -316,10 +316,10 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_GetDefaultCaptureOptions(Ca
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_StartGlobalHook(const char *pathmatch,
|
||||
const char *logfile,
|
||||
const char *capturefile,
|
||||
const CaptureOptions &opts)
|
||||
{
|
||||
return Process::StartGlobalHook(pathmatch, logfile, opts);
|
||||
return Process::StartGlobalHook(pathmatch, capturefile, opts);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_StopGlobalHook()
|
||||
@@ -339,9 +339,9 @@ extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_CanGlobalHook()
|
||||
|
||||
extern "C" RENDERDOC_API ExecuteResult RENDERDOC_CC
|
||||
RENDERDOC_InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModification> &env,
|
||||
const char *logfile, const CaptureOptions &opts, bool waitForExit)
|
||||
const char *capturefile, const CaptureOptions &opts, bool waitForExit)
|
||||
{
|
||||
return Process::InjectIntoProcess(pid, env, logfile, opts, waitForExit != 0);
|
||||
return Process::InjectIntoProcess(pid, env, capturefile, opts, waitForExit != 0);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_FreeArrayMem(const void *mem)
|
||||
|
||||
@@ -821,7 +821,7 @@ struct CapAltBitCommand : public Command
|
||||
virtual void AddOptions(cmdline::parser &parser)
|
||||
{
|
||||
parser.add<uint32_t>("pid", 0, "");
|
||||
parser.add<string>("log", 0, "");
|
||||
parser.add<string>("capfile", 0, "");
|
||||
parser.add<string>("debuglog", 0, "");
|
||||
parser.add<string>("capopts", 0, "");
|
||||
parser.stop_at_rest(true);
|
||||
@@ -916,7 +916,7 @@ struct CapAltBitCommand : public Command
|
||||
RENDERDOC_SetDebugLogFile(debuglog.c_str());
|
||||
|
||||
ExecuteResult result = RENDERDOC_InjectIntoProcess(
|
||||
parser.get<uint32_t>("pid"), env, parser.get<string>("log").c_str(), cmdopts, false);
|
||||
parser.get<uint32_t>("pid"), env, parser.get<string>("capfile").c_str(), cmdopts, false);
|
||||
|
||||
if(result.status == ReplayStatus::Succeeded)
|
||||
return result.ident;
|
||||
|
||||
@@ -596,7 +596,7 @@ struct GlobalHookCommand : public Command
|
||||
virtual void AddOptions(cmdline::parser &parser)
|
||||
{
|
||||
parser.add<string>("match", 0, "");
|
||||
parser.add<string>("logfile", 0, "");
|
||||
parser.add<string>("capfile", 0, "");
|
||||
parser.add<string>("debuglog", 0, "");
|
||||
parser.add<string>("capopts", 0, "");
|
||||
}
|
||||
@@ -606,7 +606,7 @@ struct GlobalHookCommand : public Command
|
||||
virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
|
||||
{
|
||||
wstring wpathmatch = conv(parser.get<string>("match"));
|
||||
string logfile = parser.get<string>("logfile");
|
||||
string capfile = parser.get<string>("capfile");
|
||||
string debuglog = parser.get<string>("debuglog");
|
||||
|
||||
CaptureOptions cmdopts;
|
||||
@@ -670,7 +670,7 @@ struct GlobalHookCommand : public Command
|
||||
|
||||
wcsncpy_s(shimdata->pathmatchstring, wpathmatch.c_str(), _TRUNCATE);
|
||||
wcsncpy_s(shimdata->rdocpath, rdocpath, _TRUNCATE);
|
||||
strncpy_s(shimdata->logfile, logfile.c_str(), _TRUNCATE);
|
||||
strncpy_s(shimdata->capfile, capfile.c_str(), _TRUNCATE);
|
||||
strncpy_s(shimdata->debuglog, debuglog.c_str(), _TRUNCATE);
|
||||
memcpy(shimdata->opts, &cmdopts, sizeof(CaptureOptions));
|
||||
|
||||
|
||||
@@ -124,8 +124,8 @@ void CheckHook()
|
||||
if(setopts)
|
||||
setopts((const CaptureOptions *)data->opts);
|
||||
|
||||
if(setlogfile && data->logfile[0])
|
||||
setlogfile(data->logfile);
|
||||
if(setlogfile && data->capfile[0])
|
||||
setlogfile(data->capfile);
|
||||
|
||||
if(setdebuglog && data->debuglog[0])
|
||||
setdebuglog(data->debuglog);
|
||||
|
||||
@@ -27,7 +27,7 @@ struct ShimData
|
||||
wchar_t pathmatchstring[2048];
|
||||
wchar_t rdocpath[2048];
|
||||
char debuglog[2048];
|
||||
char logfile[2048];
|
||||
char capfile[2048];
|
||||
|
||||
unsigned char opts[512];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user