mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-17 11:17:48 +00:00
Make DXIL GlobalVar names unique in the debugger and disassmbly
This commit is contained in:
1 parent
9c31e0131e
commit
1c10c0654a
3 files changed
+18
-23
No files matched your search
@@ -1850,6 +1850,7 @@ bool ShouldIgnoreSourceMapping(const Instruction &inst);
|
||||
bool isUndef(const Value *v);
|
||||
|
||||
void SanitiseName(rdcstr &name);
|
||||
rdcstr GetGlobalVarName(const GlobalVar *gv);
|
||||
|
||||
}; // namespace DXIL
|
||||
|
||||
|
||||
@@ -5406,6 +5406,8 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
|
||||
case Operation::Alloca:
|
||||
{
|
||||
result.name = DXBC::BasicDemangle(result.name);
|
||||
result.name += "_";
|
||||
result.name += ToStr(resultId);
|
||||
m_Memory.AllocateMemoryForType(inst.type, resultId, false, false, result);
|
||||
break;
|
||||
}
|
||||
@@ -8944,8 +8946,7 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
|
||||
for(const DXIL::GlobalVar *gv : m_Program->m_GlobalVars)
|
||||
{
|
||||
GlobalVariable globalVar;
|
||||
rdcstr n = DXBC::BasicDemangle(gv->name);
|
||||
DXIL::SanitiseName(n);
|
||||
rdcstr n = DXIL::GetGlobalVarName(gv);
|
||||
globalVar.var.name = n;
|
||||
globalVar.id = gv->ssaId;
|
||||
globalVar.gsm = (gv->type->addrSpace == DXIL::Type::PointerAddrSpace::GroupShared);
|
||||
|
||||
@@ -1724,12 +1724,7 @@ rdcstr Program::DisassembleGlobalVars(int &instructionLine) const
|
||||
{
|
||||
const GlobalVar &g = *m_GlobalVars[i];
|
||||
|
||||
rdcstr n = g.name;
|
||||
if(!m_DXCStyle)
|
||||
{
|
||||
n = DXBC::BasicDemangle(g.name);
|
||||
DXIL::SanitiseName(n);
|
||||
}
|
||||
rdcstr n = !m_DXCStyle ? DXIL::GetGlobalVarName(&g) : g.name;
|
||||
ret += StringFormat::Fmt("@%s = ", escapeStringIfNeeded(n).c_str());
|
||||
switch(g.flags & GlobalFlags::LinkageMask)
|
||||
{
|
||||
@@ -1772,6 +1767,7 @@ rdcstr Program::DisassembleGlobalVars(int &instructionLine) const
|
||||
if(g.section >= 0)
|
||||
ret += StringFormat::Fmt(", section %s", escapeString(m_Sections[g.section]).c_str());
|
||||
|
||||
ret += " // " + escapeString(g.name);
|
||||
ret += "\n";
|
||||
instructionLine++;
|
||||
}
|
||||
@@ -4718,21 +4714,11 @@ void Program::MakeRDDisassemblyString(const DXBC::Reflection *reflection)
|
||||
// arg[0] : ptr
|
||||
if(cast<GlobalVar>(inst.args[0]))
|
||||
{
|
||||
lineStr += DXBC::BasicDemangle(cast<GlobalVar>(inst.args[0])->name);
|
||||
lineStr += DXIL::GetGlobalVarName(cast<GlobalVar>(inst.args[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
rdcstr ptrStr = GetArgId(0);
|
||||
// Simple demangle take string between first "?" and next "@"
|
||||
int nameStart = ptrStr.indexOf('?');
|
||||
if(nameStart > 0)
|
||||
{
|
||||
nameStart++;
|
||||
int nameEnd = ptrStr.indexOf('@', nameStart);
|
||||
if(nameEnd > nameStart)
|
||||
ptrStr = ptrStr.substr(nameStart, nameEnd - nameStart);
|
||||
lineStr += ptrStr;
|
||||
}
|
||||
lineStr += GetArgId(0);
|
||||
}
|
||||
// arg[1] : index 0
|
||||
bool first = true;
|
||||
@@ -6347,9 +6333,7 @@ SourceMappingInfo Program::ParseDbgOpDeclare(const DXIL::Instruction &inst) cons
|
||||
else if(const GlobalVar *gv = cast<GlobalVar>(value))
|
||||
{
|
||||
ret.dbgVarId = gv->ssaId;
|
||||
rdcstr n = DXBC::BasicDemangle(gv->name);
|
||||
DXIL::SanitiseName(n);
|
||||
ret.dbgVarName = n;
|
||||
ret.dbgVarName = DXIL::GetGlobalVarName(gv);
|
||||
}
|
||||
else if(const Constant *c = cast<Constant>(value))
|
||||
{
|
||||
@@ -6376,4 +6360,13 @@ SourceMappingInfo Program::ParseDbgOpDeclare(const DXIL::Instruction &inst) cons
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdcstr GetGlobalVarName(const GlobalVar *gv)
|
||||
{
|
||||
rdcstr n = DXBC::BasicDemangle(gv->name);
|
||||
DXIL::SanitiseName(n);
|
||||
n += "_";
|
||||
n += ToStr(gv->ssaId);
|
||||
return n;
|
||||
}
|
||||
|
||||
}; // namespace DXIL
|
||||
Reference in new issue
Block a user