X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=cgltrace.py;h=21007237d9e8e725152550e5ffd4a9d8da99c7b7;hb=946da143b5fa8b5babddd5668743e4048bf08e7d;hp=b6a6fd0847215e9775f195b1a40c7cb2f740c774;hpb=559d5349e8039871ff14509a26c54c980c8e2cc7;p=apitrace diff --git a/cgltrace.py b/cgltrace.py index b6a6fd0..2100723 100644 --- a/cgltrace.py +++ b/cgltrace.py @@ -44,12 +44,6 @@ if __name__ == '__main__': print print '#include ' print '#include ' - print '#include ' - print - print '#ifndef _GNU_SOURCE' - print '#define _GNU_SOURCE // for dladdr' - print '#endif' - print '#include ' print print '#include "trace_writer.hpp"' print @@ -68,62 +62,6 @@ if __name__ == '__main__': print r''' - -/* - * Path to the true OpenGL framework - */ -static const char *libgl_filename = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; - - -/* - * Handle to the true OpenGL framework. - */ -static void *libgl_handle = NULL; - - -/* - * Lookup a libGL symbol - */ -void * __libgl_sym(const char *symbol) -{ - void *result; - - if (!libgl_handle) { - /* - * Unfortunately we can't just dlopen the true dynamic library because - * DYLD_LIBRARY_PATH/DYLD_FRAMEWORK_PATH take precedence, even for - * absolute paths. So we create a temporary symlink, and dlopen that - * instead. - */ - - char temp_filename[] = "/tmp/tmp.XXXXXX"; - - if (mktemp(temp_filename) != NULL) { - if (symlink(libgl_filename, temp_filename) == 0) { - libgl_handle = dlopen(temp_filename, RTLD_LOCAL | RTLD_NOW | RTLD_FIRST); - remove(temp_filename); - } - } - - if (!libgl_handle) { - os::log("apitrace: error: couldn't load %s\n", libgl_filename); - os::abort(); - return NULL; - } - } - - result = dlsym(libgl_handle, symbol); - - if (result == dlsym(RTLD_SELF, symbol)) { - os::log("apitrace: error: symbol lookup recursion\n"); - os::abort(); - return NULL; - } - - return result; -} - - PUBLIC void * gll_noop = 0;