MCPcopy Create free account
hub / github.com/baldurk/renderdoc / InjectVulkanLayerSearchPath

Function InjectVulkanLayerSearchPath

renderdoc/android/jdwp.cpp:34–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace JDWP
33{
34void InjectVulkanLayerSearchPath(Connection &conn, threadID thread, int32_t slotIdx,
35 const rdcstr &libPath)
36{
37 referenceTypeID stringClass = conn.GetType("Ljava/lang/String;");
38 methodID stringConcat = conn.GetMethod(stringClass, "concat");
39
40 if(conn.IsErrored())
41 return;
42
43 if(!stringClass || !stringConcat)
44 {
45 RDCERR("Couldn't find java.lang.String (%llu) or java.lang.String.concat() (%llu)",
46 (uint64_t)stringClass, (uint64_t)stringConcat);
47 return;
48 }
49
50 // get the callstack frames
51 rdcarray<StackFrame> stack = conn.GetCallStack(thread);
52
53 if(stack.empty())
54 {
55 RDCERR("Couldn't get callstack!");
56 return;
57 }
58
59 // get the local in the top (current) frame
60 value librarySearchPath = conn.GetLocalValue(thread, stack[0].id, slotIdx, Tag::Object);
61
62 if(librarySearchPath.tag != Tag::String || librarySearchPath.String == 0)
63 {
64 RDCERR("Couldn't get 'String librarySearchPath' local parameter!");
65 return;
66 }
67
68 RDCDEBUG("librarySearchPath is %s", conn.GetString(librarySearchPath.String).c_str());
69
70 value appendSearch = conn.NewString(thread, ":" + libPath);
71
72 // temp = librarySearchPath.concat(appendSearch);
73 value temp = conn.InvokeInstance(thread, stringClass, stringConcat, librarySearchPath.String,
74 {appendSearch});
75
76 if(temp.tag != Tag::String || temp.String == 0)
77 {
78 RDCERR("Failed to concat search path!");
79 return;
80 }
81
82 RDCDEBUG("librarySearchPath is now %s", conn.GetString(temp.String).c_str());
83
84 // we will have resume the thread above to call concat, invalidating our frames.
85 // Re-fetch the callstack
86 stack = conn.GetCallStack(thread);
87
88 if(stack.empty())
89 {
90 RDCERR("Couldn't get callstack!");
91 return;

Callers 1

InjectLibrariesFunction · 0.85

Calls 11

GetMethodMethod · 0.80
GetCallStackMethod · 0.80
GetLocalValueMethod · 0.80
NewStringMethod · 0.80
InvokeInstanceMethod · 0.80
SetLocalValueMethod · 0.80
GetTypeMethod · 0.45
IsErroredMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected