DXIL Debugger use function name for callstack if no debug scopes

This commit is contained in:
Jake Turner
2024-12-16 13:50:18 +00:00
parent 71ba5a9310
commit 8a9b344953
@@ -1657,13 +1657,35 @@ void ThreadState::EnterEntryPoint(const Function *function, ShaderDebugState *st
void ThreadState::FillCallstack(ShaderDebugState &state)
{
if(m_FunctionInfo->callstacks.size() == 1)
{
state.callstack = m_FunctionInfo->callstacks.begin()->second;
return;
}
auto it = m_FunctionInfo->callstacks.upper_bound(state.nextInstruction);
if(it == m_FunctionInfo->callstacks.end())
{
RDCWARN("No callstack entry found for instruction %u", state.nextInstruction);
state.callstack.clear();
state.callstack.push_back(m_FunctionInfo->function->name);
return;
}
if(it != m_FunctionInfo->callstacks.begin())
--it;
if(it->first <= m_FunctionInstructionIdx)
{
state.callstack = it->second;
}
else
{
RDCWARN("No callstack entry found for instruction %u", state.nextInstruction);
state.callstack.clear();
state.callstack.push_back(m_FunctionInfo->function->name);
return;
}
}
bool IsNopInstruction(const Instruction &inst)
@@ -7529,6 +7551,13 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
}
info.callstacks[instructionIndex] = callstack;
}
// If there is no callstack for the function then use the function name
if(info.callstacks.empty())
{
FunctionInfo::Callstack callstack;
callstack.push_back(f->name);
info.callstacks[0] = callstack;
}
}
}