[Mesa-dev] glretrace

tom fogal tfogal at sci.utah.edu
Mon Dec 6 14:14:06 PST 2010


Hi José,

José Fonseca wrote:
> FYI, I've extended my apitrace project to be able not only to show a
> list of GL calls, but also replay them.

Neat!

> The idea is to facilitate reproduction of bugs, help finding
> regressions, and do it across different platforms.
> 
> Code is in 
> http://cgit.freedesktop.org/~jrfonseca/apitrace/log/?h=retrace

I'm having trouble getting it to work on my system:

[ 33%] Generating glretrace.cpp
/usr/bin/python2.5 /home/tfogal/dev/gltrace/glretrace.py > 
/home/tfogal/dev/gltrace/glretrace.cpp
Traceback (most recent call last):
   File "/home/tfogal/dev/gltrace/glretrace.py", line 214, in <module>
     retracer.retrace_api(glapi.glapi)
   File "/home/tfogal/dev/gltrace/retrace.py", line 282, in retrace_api
     self.retrace_functions(api.functions)
   File "/home/tfogal/dev/gltrace/retrace.py", line 234, in 
retrace_functions
     self.retrace_function(function)
   File "/home/tfogal/dev/gltrace/glretrace.py", line 38, in 
retrace_function
     Retracer.retrace_function(self, function)
   File "/home/tfogal/dev/gltrace/retrace.py", line 185, in retrace_function
     self.extract_arg(function, arg, arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/glretrace.py", line 145, in extract_arg
     Retracer.extract_arg(self, function, arg, arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/retrace.py", line 216, in extract_arg
     ValueExtractor().visit(arg_type, lvalue, rvalue)
   File "/home/tfogal/dev/gltrace/stdapi.py", line 342, in visit
     return type.visit(self, *args, **kwargs)
   File "/home/tfogal/dev/gltrace/stdapi.py", line 166, in visit
     return visitor.visit_array(self, *args, **kwargs)
   File "/home/tfogal/dev/gltrace/retrace.py", line 80, in visit_array
     print '        for(size_t {i} = 0; {i} < {length}; ++{i}) 
{{'.format(i = index, length = length)
AttributeError: 'str' object has no attribute 'format'

Turns out the "format" function of strings was added in python 2.6:

    http://docs.python.org/library/stdtypes.html#str.format

and I happen to be running Debian stable, which is still shipping 2.5.

I could get by that particular format problem pretty easily, but then 
there's another one on line 161 that uses ``**locals'', and my python-fu 
isn't up to snuff to rewrite that as a `"string" % (a,b,c)' form.

Any thoughts on supporting 2.5?

-tom


More information about the mesa-dev mailing list