mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-27 12:21:11 +00:00
Replace GetLocalVariable with GetLocalVariables
This commit is contained in:
committed by
Baldur Karlsson
parent
c4363e615c
commit
3fc89b3717
@@ -213,16 +213,30 @@ bool InjectLibraries(const std::string &deviceID, Network::Socket *sock)
|
||||
|
||||
if(vulkanLoaderMethod)
|
||||
{
|
||||
int32_t slotIdx =
|
||||
conn.GetLocalVariable(vulkanLoaderClass, vulkanLoaderMethod, "librarySearchPath");
|
||||
std::vector<VariableSlot> slots = conn.GetLocalVariables(vulkanLoaderClass, vulkanLoaderMethod);
|
||||
|
||||
int32_t slotIdx = -1;
|
||||
|
||||
for(const VariableSlot &s : slots)
|
||||
{
|
||||
if(s.name == "librarySearchPath")
|
||||
{
|
||||
slotIdx = s.slot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Android 9 doesn't return names and changed how slots are indexed, try an offset from this
|
||||
if(slotIdx == -1)
|
||||
{
|
||||
slotIdx = conn.GetLocalVariable(vulkanLoaderClass, vulkanLoaderMethod, "this");
|
||||
|
||||
if(slotIdx != -1)
|
||||
slotIdx += 4;
|
||||
for(const VariableSlot &s : slots)
|
||||
{
|
||||
if(s.name == "this")
|
||||
{
|
||||
slotIdx = s.slot + 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// as a default, use the 4th slot as it's the 4th argument argument (0 is this), if symbols
|
||||
|
||||
@@ -516,10 +516,8 @@ public:
|
||||
methodID GetMethod(referenceTypeID type, const std::string &name,
|
||||
const std::string &signature = "", referenceTypeID *methClass = NULL);
|
||||
|
||||
// get a local variable slot. If signature is empty, it's ignored for matching. Returns -1 if not
|
||||
// found
|
||||
int32_t GetLocalVariable(referenceTypeID type, methodID method, const std::string &name,
|
||||
const std::string &signature = "");
|
||||
// get local variable slots
|
||||
std::vector<VariableSlot> GetLocalVariables(referenceTypeID type, methodID method);
|
||||
|
||||
// get a thread's stack frames
|
||||
std::vector<StackFrame> GetCallStack(threadID thread);
|
||||
|
||||
@@ -267,14 +267,13 @@ methodID Connection::GetMethod(referenceTypeID type, const std::string &name,
|
||||
return {};
|
||||
}
|
||||
|
||||
int32_t Connection::GetLocalVariable(referenceTypeID type, methodID method, const std::string &name,
|
||||
const std::string &signature)
|
||||
std::vector<VariableSlot> Connection::GetLocalVariables(referenceTypeID type, methodID method)
|
||||
{
|
||||
Command cmd(CommandSet::Method, 2);
|
||||
cmd.GetData().Write(type).Write(method);
|
||||
|
||||
if(!SendReceive(cmd))
|
||||
return -1;
|
||||
return {};
|
||||
|
||||
int32_t argumentCount = 0;
|
||||
std::vector<VariableSlot> slots;
|
||||
@@ -286,11 +285,7 @@ int32_t Connection::GetLocalVariable(referenceTypeID type, methodID method, cons
|
||||
});
|
||||
data.Done();
|
||||
|
||||
for(const VariableSlot &s : slots)
|
||||
if(s.name == name && (signature == "" || signature == s.signature))
|
||||
return s.slot;
|
||||
|
||||
return -1;
|
||||
return slots;
|
||||
}
|
||||
|
||||
fieldID Connection::GetField(referenceTypeID type, const std::string &name,
|
||||
|
||||
Reference in New Issue
Block a user