mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Add option to non-interactively resolve callstack symbols
* Primarily for use in scripts
This commit is contained in:
@@ -2441,8 +2441,8 @@ void MainWindow::on_action_Resolve_Symbols_triggered()
|
||||
bool finished = false;
|
||||
|
||||
m_Ctx.Replay().AsyncInvoke([this, &progress, &finished](IReplayController *) {
|
||||
bool success =
|
||||
m_Ctx.Replay().GetCaptureAccess()->InitResolver([&progress](float p) { progress = p; });
|
||||
bool success = m_Ctx.Replay().GetCaptureAccess()->InitResolver(
|
||||
true, [&progress](float p) { progress = p; });
|
||||
|
||||
if(!success)
|
||||
{
|
||||
|
||||
@@ -1141,12 +1141,16 @@ necessary.
|
||||
This function blocks while trying to initialise callstack resolving, so it should be called on a
|
||||
separate thread.
|
||||
|
||||
:param bool interactive: ``True`` if missing symbols or other prompts should be resolved interactively.
|
||||
If this is ``False``, the function will not interact or block forever on user interaction and will
|
||||
always assume the input is effectively 'cancel' or empty. This may cause the symbol resolution to
|
||||
fail.
|
||||
:param ProgressCallback progress: A callback that will be repeatedly called with an updated progress
|
||||
value for the resolver process. Can be ``None`` if no progress is desired.
|
||||
:return: ``True`` if the resolver successfully initialised, ``False`` if something went wrong.
|
||||
:rtype: ``bool``
|
||||
)");
|
||||
virtual bool InitResolver(RENDERDOC_ProgressCallback progress) = 0;
|
||||
virtual bool InitResolver(bool interactive, RENDERDOC_ProgressCallback progress) = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the details of each stackframe in the provided callstack.
|
||||
|
||||
|
||||
@@ -614,7 +614,7 @@ static void ActiveRemoteClientThread(ClientThread *threadData,
|
||||
}
|
||||
});
|
||||
|
||||
resolver = Callstack::MakeResolver(buf.data(), buf.size(),
|
||||
resolver = Callstack::MakeResolver(false, buf.data(), buf.size(),
|
||||
[&progress](float p) { progress = p; });
|
||||
|
||||
Threading::JoinThread(ticker);
|
||||
@@ -1943,7 +1943,7 @@ bool RemoteServer::HasCallstacks()
|
||||
return hasCallstacks;
|
||||
}
|
||||
|
||||
bool RemoteServer::InitResolver(RENDERDOC_ProgressCallback progress)
|
||||
bool RemoteServer::InitResolver(bool interactive, RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
{
|
||||
WRITE_DATA_SCOPE();
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
|
||||
virtual bool HasCallstacks();
|
||||
|
||||
virtual bool InitResolver(RENDERDOC_ProgressCallback progress);
|
||||
virtual bool InitResolver(bool interactive, RENDERDOC_ProgressCallback progress);
|
||||
|
||||
virtual rdcarray<rdcstr> GetResolve(const rdcarray<uint64_t> &callstack);
|
||||
|
||||
|
||||
@@ -265,7 +265,8 @@ void Init();
|
||||
Stackwalk *Collect();
|
||||
Stackwalk *Create();
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback);
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback);
|
||||
|
||||
bool GetLoadedModules(byte *buf, size_t &size);
|
||||
}; // namespace Callstack
|
||||
|
||||
@@ -77,7 +77,8 @@ bool GetLoadedModules(byte *buf, size_t &size)
|
||||
return true;
|
||||
}
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress)
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
RDCERR("Callstack resolving not supported on Android.");
|
||||
return NULL;
|
||||
|
||||
@@ -77,7 +77,8 @@ bool GetLoadedModules(byte *buf, size_t &size)
|
||||
return true;
|
||||
}
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress)
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
RDCERR("Callstack resolving not supported on Apple.");
|
||||
return NULL;
|
||||
|
||||
@@ -230,7 +230,8 @@ private:
|
||||
std::map<uint64_t, Callstack::AddressDetails> m_Cache;
|
||||
};
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress)
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
// we look in the original locations for the files, we don't prompt if we can't
|
||||
// find the file, or the file doesn't have symbols (and we don't validate that
|
||||
|
||||
@@ -234,7 +234,8 @@ private:
|
||||
std::map<uint64_t, Callstack::AddressDetails> m_Cache;
|
||||
};
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress)
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
// we look in the original locations for the files, we don't prompt if we can't
|
||||
// find the file, or the file doesn't have symbols (and we don't validate that
|
||||
|
||||
@@ -413,7 +413,8 @@ private:
|
||||
class Win32CallstackResolver : public Callstack::StackResolver
|
||||
{
|
||||
public:
|
||||
Win32CallstackResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress);
|
||||
Win32CallstackResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress);
|
||||
~Win32CallstackResolver();
|
||||
|
||||
Callstack::AddressDetails GetAddr(uint64_t addr);
|
||||
@@ -719,7 +720,7 @@ rdcstr Win32CallstackResolver::pdbBrowse(rdcstr startingPoint)
|
||||
return StringFormat::Wide2UTF8(outBuf);
|
||||
}
|
||||
|
||||
Win32CallstackResolver::Win32CallstackResolver(byte *moduleDB, size_t DBSize,
|
||||
Win32CallstackResolver::Win32CallstackResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
rdcwstr configPath = StringFormat::UTF82Wide(FileIO::GetAppFolderFilename("config.ini"));
|
||||
@@ -807,6 +808,10 @@ Win32CallstackResolver::Win32CallstackResolver(byte *moduleDB, size_t DBSize,
|
||||
{
|
||||
SAFE_RELEASE(source);
|
||||
|
||||
// can't manually locate msdia if we're non-interactive
|
||||
if(!interactive)
|
||||
return;
|
||||
|
||||
int ret = MessageBoxW(NULL,
|
||||
L"Couldn't initialise DIA - it may not be registered. "
|
||||
L"In VS2017 and above, DIA is not registered by default.\n\n"
|
||||
@@ -931,9 +936,9 @@ Win32CallstackResolver::Win32CallstackResolver(byte *moduleDB, size_t DBSize,
|
||||
{
|
||||
pdbName = get_dirname(defaultPdb) + "\\" + get_basename(defaultPdb);
|
||||
|
||||
// prompt for new pdbName, unless it's renderdoc or dbghelp
|
||||
// prompt for new pdbName, unless it's renderdoc or dbghelp, or we're non-interactive
|
||||
if(pdbName.contains("renderdoc.") || pdbName.contains("dbghelp.") ||
|
||||
pdbName.contains("symsrv."))
|
||||
pdbName.contains("symsrv.") || !interactive)
|
||||
pdbName = "";
|
||||
else
|
||||
pdbName = pdbBrowse(pdbName);
|
||||
@@ -975,6 +980,10 @@ Win32CallstackResolver::Win32CallstackResolver(byte *moduleDB, size_t DBSize,
|
||||
if(m.name.contains("renderdoc.") || m.name.contains("dbghelp.") || m.name.contains("symsrv."))
|
||||
continue;
|
||||
|
||||
// if we're not interactive, just continue
|
||||
if(!interactive)
|
||||
continue;
|
||||
|
||||
rdcstr text = StringFormat::Fmt("Do you want to permanently ignore this file?\nPath: %s",
|
||||
m.name.c_str());
|
||||
|
||||
@@ -1085,7 +1094,8 @@ Stackwalk *Create()
|
||||
return new Win32Callstack(NULL, 0);
|
||||
}
|
||||
|
||||
StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCallback progress)
|
||||
StackResolver *MakeResolver(bool interactive, byte *moduleDB, size_t DBSize,
|
||||
RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
if(DBSize < 8 || memcmp(moduleDB, "WN32CALL", 8))
|
||||
{
|
||||
@@ -1096,7 +1106,7 @@ StackResolver *MakeResolver(byte *moduleDB, size_t DBSize, RENDERDOC_ProgressCal
|
||||
// initialise dbghelp if we haven't already
|
||||
::InitDbgHelp();
|
||||
|
||||
return new Win32CallstackResolver(moduleDB, DBSize, progress);
|
||||
return new Win32CallstackResolver(interactive, moduleDB, DBSize, progress);
|
||||
}
|
||||
|
||||
bool GetLoadedModules(byte *buf, size_t &size)
|
||||
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
bool WriteSection(const SectionProperties &props, const bytebuf &contents);
|
||||
|
||||
bool HasCallstacks();
|
||||
bool InitResolver(RENDERDOC_ProgressCallback progress);
|
||||
bool InitResolver(bool interactive, RENDERDOC_ProgressCallback progress);
|
||||
rdcarray<rdcstr> GetResolve(const rdcarray<uint64_t> &callstack);
|
||||
|
||||
private:
|
||||
@@ -756,7 +756,7 @@ bool CaptureFile::HasCallstacks()
|
||||
return m_RDC && m_RDC->SectionIndex(SectionType::ResolveDatabase) >= 0;
|
||||
}
|
||||
|
||||
bool CaptureFile::InitResolver(RENDERDOC_ProgressCallback progress)
|
||||
bool CaptureFile::InitResolver(bool interactive, RENDERDOC_ProgressCallback progress)
|
||||
{
|
||||
if(!HasCallstacks())
|
||||
{
|
||||
@@ -789,7 +789,7 @@ bool CaptureFile::InitResolver(RENDERDOC_ProgressCallback progress)
|
||||
if(progress)
|
||||
progress(0.002f);
|
||||
|
||||
m_Resolver = Callstack::MakeResolver(buf.data(), buf.size(), progress);
|
||||
m_Resolver = Callstack::MakeResolver(interactive, buf.data(), buf.size(), progress);
|
||||
|
||||
if(!m_Resolver)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user