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

Function InjectLibraries

renderdoc/android/jdwp.cpp:99–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99bool InjectLibraries(const rdcstr &deviceID, Network::Socket *sock)
100{
101 Connection conn(sock);
102
103 // check that the handshake completed successfully
104 if(conn.IsErrored())
105 return false;
106
107 // immediately re-suspend, as connecting will have woken it up
108 conn.Suspend();
109
110 conn.SetupIDSizes();
111
112 if(conn.IsErrored())
113 return false;
114
115 // default to arm as a safe bet
116 Android::ABI abi = Android::ABI::armeabi_v7a;
117
118 // determine the CPU ABI from android.os.Build.CPU_ABI
119 referenceTypeID buildClass = conn.GetType("Landroid/os/Build;");
120 if(buildClass)
121 {
122 fieldID CPU_ABI = conn.GetField(buildClass, "CPU_ABI");
123
124 if(CPU_ABI)
125 {
126 value val = conn.GetFieldValue(buildClass, CPU_ABI);
127
128 if(val.tag == Tag::String)
129 abi = Android::GetABI(conn.GetString(val.String));
130 else
131 RDCERR("CPU_ABI value was type %u, not string!", (uint32_t)val.tag);
132 }
133 else
134 {
135 RDCERR("Couldn't find CPU_ABI field in android.os.Build");
136 }
137 }
138 else
139 {
140 RDCERR("Couldn't find android.os.Build");
141 }
142
143 if(abi == Android::ABI::unknown)
144 {
145 RDCERR("Unrecognised running ABI, falling back to armeabi-v7a");
146 abi = Android::ABI::armeabi_v7a;
147 }
148
149 rdcstr libPath = Android::GetPathForPackage(deviceID, Android::GetRenderDocPackageForABI(abi));
150
151 switch(abi)
152 {
153 case Android::ABI::unknown:
154 case Android::ABI::armeabi_v7a: libPath += "lib/arm"; break;
155 case Android::ABI::arm64_v8a: libPath += "lib/arm64"; break;
156 case Android::ABI::x86_64: libPath += "lib/x86_64"; break;

Callers 1

InjectWithJDWPFunction · 0.85

Calls 15

GetABIFunction · 0.85
GetPathForPackageFunction · 0.85
SuspendMethod · 0.80
SetupIDSizesMethod · 0.80
GetFieldMethod · 0.80
GetFieldValueMethod · 0.80
GetMethodMethod · 0.80
GetLocalVariablesMethod · 0.80
WaitForEventMethod · 0.80
GetCallStackMethod · 0.80

Tested by

no test coverage detected