X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=cgltrace.py;h=0e40663560ff720c40b9ac72b64c239d34260061;hb=4fdd5632465440b4f584a74bd4c171aa225a16e5;hp=33765f9b8d3b1ebfae3e81656c994e6434cc3cac;hpb=4364860d389bf273bcfce9c5286cc7a3642469c9;p=apitrace diff --git a/cgltrace.py b/cgltrace.py index 33765f9..0e40663 100644 --- a/cgltrace.py +++ b/cgltrace.py @@ -27,15 +27,15 @@ """Cgl tracing generator.""" -from stdapi import API -from glapi import glapi -from cglapi import cglapi +from specs.stdapi import API +from specs.glapi import glapi +from specs.cglapi import cglapi from gltrace import GlTracer class CglTracer(GlTracer): - def is_public_function(self, function): + def isFunctionPublic(self, function): # The symbols visible in libGL.dylib can vary, so expose them all return True @@ -45,12 +45,7 @@ if __name__ == '__main__': print '#include ' print '#include ' print - print '#ifndef _GNU_SOURCE' - print '#define _GNU_SOURCE // for dladdr' - print '#endif' - print '#include ' - print - print '#include "trace_write.hpp"' + print '#include "trace_writer_local.hpp"' print print '// To validate our prototypes' print '#define GL_GLEXT_PROTOTYPES' @@ -60,55 +55,13 @@ if __name__ == '__main__': print api = API() - api.add_api(cglapi) - api.add_api(glapi) + api.addApi(cglapi) + api.addApi(glapi) tracer = CglTracer() tracer.trace_api(api) print r''' - -/* - * Handle to the true libGL.so - */ -static void *libgl_handle = NULL; - - -/* - * Lookup a libGL symbol - */ -static void * __dlsym(const char *symbol) -{ - void *result; - if (!libgl_handle) { - const char * libgl_filename; - - /* - * Unfortunately we can't just dlopen - * /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib - * because DYLD_LIBRARY_PATH takes precedence, even for absolute paths. - */ - libgl_filename = "libGL.system.dylib"; - - libgl_handle = dlopen(libgl_filename, RTLD_LOCAL | RTLD_NOW | RTLD_FIRST); - if (!libgl_handle) { - OS::DebugMessage("error: couldn't load %s\n", libgl_filename); - return NULL; - } - } - - result = dlsym(libgl_handle, symbol); - - if (result == dlsym(RTLD_SELF, symbol)) { - OS::DebugMessage("error: symbol lookup recursion\n"); - OS::Abort(); - return NULL; - } - - return result; -} - - PUBLIC void * gll_noop = 0;