MCPcopy Create free account
hub / github.com/apitrace/apitrace / classifyLibrary

Function classifyLibrary

wrappers/dlsym.cpp:55–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55inline LibClass
56classifyLibrary(const char *pathname)
57{
58 std::unique_ptr<char, decltype(free) *> dupname { strdup(pathname), free };
59
60 char *filename = basename(dupname.get());
61 assert(filename);
62
63 if (strcmp(filename, "libGL.so") == 0 ||
64 strcmp(filename, "libGL.so.1") == 0) {
65 return LIB_GL;
66 }
67
68 if (strcmp(filename, "libGLX.so") == 0 ||
69 strcmp(filename, "libGLX.so.0") == 0) {
70 return LIB_GLX;
71 }
72
73 if (strcmp(filename, "libOpenGL.so") == 0 ||
74 strcmp(filename, "libOpenGL.so.0") == 0) {
75 return LIB_OPENGL;
76 }
77
78#ifdef EGLTRACE
79 if (strcmp(filename, "libEGL.so") == 0 ||
80 strcmp(filename, "libEGL.so.1") == 0) {
81 return LIB_EGL;
82 }
83
84 if (strcmp(filename, "libGLESv1_CM.so") == 0 ||
85 strcmp(filename, "libGLESv1_CM.so.1") == 0) {
86 return LIB_GLES1;
87 }
88
89 if (strcmp(filename, "libGLESv2.so") == 0 ||
90 strcmp(filename, "libGLESv2.so.2") == 0) {
91 return LIB_GLES2;
92 }
93#endif
94
95 /*
96 * TODO: Identify driver SOs (e.g, *_dri.so), to prevent intercepting
97 * dlopen calls from them.
98 *
99 * Another alternative is to ignore dlopen calls when inside wrapped calls.
100 */
101
102 return LIB_UNKNOWN;
103}
104
105
106/*

Callers 1

dlopenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected