Giter Site home page Giter Site logo

apitrace / apitrace Goto Github PK

View Code? Open in Web Editor NEW
2.5K 2.5K 475.0 20.79 MB

Tools for tracing OpenGL, Direct3D, and other graphics APIs

Home Page: https://apitrace.github.io/

License: MIT License

Emacs Lisp 0.01% Makefile 0.01% CMake 0.71% C++ 78.09% Python 20.02% C 0.89% Shell 0.06% Objective-C++ 0.14% Dockerfile 0.04% PowerShell 0.04%
d3d11 d3d12 d3d9 debugging-tool direct3d opengl opengl-es

apitrace's Introduction

About apitrace

apitrace consists of a set of tools to:

  • trace OpenGL, Direct3D, and DirectDraw APIs calls to a file;

  • replay OpenGL and Direct3D calls from a file;

  • inspect OpenGL and Direct3D state at any call while retracing;

  • visualize and edit trace files.

See the apitrace homepage for more details.

Status

TL;DR: Apitrace is still being maintained, but the maintainer has very little time to work on it, so patches/issues/requests are addressed if/as time permits.

Long version here

Obtaining apitrace

To obtain apitrace either download the latest binaries for your platform if available, or follow these instructions to build and install it yourself.

On 64bits Linux and Windows platforms you'll need apitrace binaries that match the architecture (32bits or 64bits) of the application being traced.

Usage

Detailed usage instructions are available here.

apitrace's People

Contributors

10110111 avatar afrantzis avatar ahartmetz avatar amonakov avatar brianpaul avatar cworth-gh avatar gabedagani avatar gerddie avatar gregory38 avatar haraldf avatar ideak avatar joshua-ashton avatar jrfonseca avatar jrmuizel avatar kkinnunen avatar lawlove avatar linkmauve avatar nigels-com avatar okias avatar olvaffe avatar rawoul avatar robclark avatar schulmar avatar siro20 avatar snations avatar trtt avatar urkle avatar vasild avatar velorums avatar zackr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apitrace's Issues

segfault in replayStateFound

revision: 38c932b

I get segfaults at random when retracing to do state lookup in qapitrace, but the only reliable way I found to reproduce a crash is like this:

  1. Run qapitrace under gdb
  2. start a 'Lookup State' operation
  3. Ctrl+C to interrupt it, then resume the program.

It triggers a null deref like this:

^C
Program received signal SIGINT, Interrupt.
0x00007ffff3f2cf03 in poll () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) cont
Continuing.
Process error =  1 
    err =  "1297: warning: could not infer drawable size (glViewport never called)
2784: warning: unsupported glXSwapIntervalSGI call
" 
"       out =  "
[Thread 0x7fffd978a700 (LWP 14816) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00000000004336ee in ApiTraceEvent::setState (this=0x0, state=0x7fffd4000aa0) at /home/nobled/code/apitrace/gui/apitracecall.cpp:612
612     m_state = state;
(gdb) bt
#0  0x00000000004336ee in ApiTraceEvent::setState (this=0x0, state=0x7fffd4000aa0) at /home/nobled/code/apitrace/gui/apitracecall.cpp:612
#1  0x00000000004583da in MainWindow::replayStateFound (this=0x7fffffffde80, state=0x7fffd4000aa0) at /home/nobled/code/apitrace/gui/mainwindow.cpp:807
#2  0x000000000045aad1 in MainWindow::qt_metacall (this=0x7fffffffde80, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x7fffffffc940) at /home/nobled/code/apitrace-build4/gui/mainwindow.moc:146
#3  0x00007ffff4afa5f8 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#4  0x0000000000465729 in Retracer::foundState (this=0xab8740, _t1=0x7fffd4000aa0) at /home/nobled/code/apitrace-build4/gui/retracer.moc:213
#5  0x0000000000465646 in Retracer::qt_metacall (this=0xab8740, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fffd4098940) at /home/nobled/code/apitrace-build4/gui/retracer.moc:191
#6  0x00007ffff4af949a in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#7  0x00007ffff59719f4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#8  0x00007ffff59763ba in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#9  0x00007ffff4ae549c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#10 0x00007ffff4ae8c25 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#11 0x00007ffff4b10253 in ?? () from /usr/lib/libQtCore.so.4
#12 0x00007ffff2aebbcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff2aec3a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff2aec639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff4b103ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#16 0x00007ffff5a1b4de in ?? () from /usr/lib/libQtGui.so.4
#17 0x00007ffff4ae4882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#18 0x00007ffff4ae4abc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#19 0x00007ffff5e32fd6 in QDialog::exec() () from /usr/lib/libQtGui.so.4
#20 0x00007ffff5e534a2 in ?? () from /usr/lib/libQtGui.so.4
#21 0x00007ffff5e5359f in QMessageBox::warning(QWidget*, QString const&, QString const&, QFlags<QMessageBox::StandardButton>, QMessageBox::StandardButton) () from /usr/lib/libQtGui.so.4
#22 0x0000000000454a1c in MainWindow::replayError (this=0x7fffffffde80, message=...) at /home/nobled/code/apitrace/gui/mainwindow.cpp:232
#23 0x000000000045aaf3 in MainWindow::qt_metacall (this=0x7fffffffde80, _c=QMetaObject::InvokeMetaMethod, _id=8, _a=0x7fffffffd500) at /home/nobled/code/apitrace-build4/gui/mainwindow.moc:147
#24 0x00007ffff4afa5f8 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#25 0x0000000000465771 in Retracer::error (this=0xab8740, _t1=...) at /home/nobled/code/apitrace-build4/gui/retracer.moc:220
#26 0x0000000000465665 in Retracer::qt_metacall (this=0xab8740, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fffd40a2800) at /home/nobled/code/apitrace-build4/gui/retracer.moc:192
#27 0x00007ffff4af949a in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#28 0x00007ffff59719f4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#29 0x00007ffff59763ba in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#30 0x00007ffff4ae549c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#31 0x00007ffff4ae8c25 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#32 0x00007ffff4b10253 in ?? () from /usr/lib/libQtCore.so.4
#33 0x00007ffff2aebbcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff2aec3a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007ffff2aec639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007ffff4b103ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#37 0x00007ffff5a1b4de in ?? () from /usr/lib/libQtGui.so.4
#38 0x00007ffff4ae4882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#39 0x00007ffff4ae4abc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#40 0x00007ffff4ae8ecb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#41 0x00000000004630b7 in main (argc=2, argv=0x7fffffffe238) at /home/nobled/code/apitrace/gui/main.cpp:33
(gdb) up
#1  0x00000000004583da in MainWindow::replayStateFound (this=0x7fffffffde80, state=0x7fffd4000aa0)  at /home/nobled/code/apitrace/gui/mainwindow.cpp:807
807     m_stateEvent->setState(state);
(gdb) print m_stateEvent
$1 = (ApiTraceEvent *) 0x0
(gdb) 

Using this trace, btw - http://www.mediafire.com/?a4l90bbkoo2e0an

save trace subset to render a particular object

I would like the option to save the part of trace required to render a particular mesh with the textures and shaders as applied to it.

Sometimes a glitch could be demonstrated with a much smaller trace that way.

Show StencilBuffer properly.

If StencilBuffer consist of more than 3 different bits, qapitrace show solid black as StencilBuffer On Surface tab.

ApiTrace does not show all textures

ApiTrace with OpenGL on Windows:

The QApiTrace application does not show GL_TEXTURE_RECTANGLE textures when inspecting the state.

Also, I would find it helpful if the Surfaces tab showed more information about the textures - texture id, mipmap level (or even group mipmap levels for a single texture), data type (float/byte/...).

crash on glDrawArrays with count 0

OS: Windows 7 x64

My program is crashing while using the OpenGL wrapper .dll on the following call:

glDrawArrays(GL_TRIANGLES,0,render_list.size());

render_list.size() is 0 at this point. It is probably poor form on my part, but the docs for glDrawArrays don't mention a count of 0 as being bad. Skipping this call when render_list is empty makes the problem disappear.

Stack trace:

#0 754D9B60 msvcrt!memcpy() (C:\Windows\syswow64\msvcrt.dll:??)
#1 6EB3D1DB read_buf(strm=0x8085978, buf=0x80963e4 "", size=3324) (C:\Users\X\Desktop\apitrace\zlib\deflate.c:976)
#2 6EB3D77B fill_window(s=0x8085a08) (C:\Users\X\Desktop\apitrace\zlib\deflate.c:1342)
#3 6EB3E0F1 deflate_slow(s=0x8085a08, flush=0) (C:\Users\X\Desktop\apitrace\zlib\deflate.c:1569)
#4 6EB3CA6B deflate(strm=0x8085978, flush=0) (C:\Users\X\Desktop\apitrace\zlib\deflate.c:790)
#5 6EB39FFE gzwrite(file=0x8085978, buf=0x20, len=4294967240) (C:\Users\X\Desktop\apitrace\zlib\gzio.c:584)
#6 6EB382DF Write(sBuffer=0x20, dwBytesToWrite=4294967240) (C:\Users\X\Desktop\apitrace\trace_write.cpp:98)
#7 6EB38AAE Trace::LiteralBlob(data=0x20, size=4294967240) (C:\Users\X\Desktop\apitrace\trace_write.cpp:303)
#8 6EB37510 __trace_user_arrays(maxindex=4294967295) (C:\Users\X\Desktop\apitrace_build\wgltrace.cpp:105352)
#9 6EA90551 glDrawArrays@12(mode=4, first=0, count=0) (C:\Users\X\Desktop\apitrace_build\wgltrace.cpp:22881)
#10 0054E259    mal::font_ft::font_object::render(this=0xda2a5f0) (C:\dev\libs\libmal\src\font\mal_font_font_obj.cpp:301)
#11 00583AE4    mal::ui::Window::render_text(this=0xda2a450) (C:\dev\libs\libmal\src\ui\mal_ui_window.cpp:149)

Exeption error on second trace file load within qapitrace

Behaviour: exception error occurs on loading a second trace file from the same instance of qapitrace.

To reproduce:

  1. Load a trace file (a.trace)
  2. Load another trace file (b.trace)
  3. Experience exception error.

Cause is
trace_parser.cpp
Ln:55 assert(!file);
File object is not deleted before loading another trace file.

Callstack:
qapitrace.exe!_NMSG_WRITE(int rterrnum=10) Line 198 C
qapitrace.exe!abort() Line 59 + 0x7 bytes C
qapitrace.exe!_wassert(const wchar_t * expr=0x00554350, const wchar_t * filename=0x00554314, unsigned int lineno=55) Line 163 C

qapitrace.exe!Trace::Parser::open(const char * filename=0x0777fa38) Line 55 + 0x19 bytes C++
qapitrace.exe!TraceLoader::loadTrace(const QString & filename={...}) Line 41 + 0x44 bytes C++
qapitrace.exe!TraceLoader::qt_metacall(QMetaObject::Call _c=InvokeMetaMethod, int _id=9, void * * _a=0x0777d9c8) Line 116 + 0xf bytes C++

Best regards
Jeremy

build fails on OS X

$ cmake -H. -Bbuild
-- checking for module 'QJson>=0.5'
-- package 'QJson>=0.5' not found
-- Could NOT find QJSON (missing: QJSON_LIBRARIES QJSON_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nsc/install/apitrace/build

$ make -C build
[ 4%] Generating glproc.hpp
[ 8%] Generating cgltrace.cpp
[ 12%] Building CXX object CMakeFiles/cgltrace.dir/cgltrace.cpp.o
[ 16%] Building CXX object CMakeFiles/cgltrace.dir/trace_writer.cpp.o
[ 20%] Building CXX object CMakeFiles/cgltrace.dir/os_posix.cpp.o
Linking CXX shared library wrappers/OpenGL
[ 20%] Built target cgltrace
[ 25%] Building CXX object CMakeFiles/trace.dir/trace_model.cpp.o
[ 29%] Building CXX object CMakeFiles/trace.dir/trace_parser.cpp.o
[ 33%] Building CXX object CMakeFiles/trace.dir/trace_writer.cpp.o
[ 37%] Building CXX object CMakeFiles/trace.dir/trace_model_writer.cpp.o
[ 41%] Building CXX object CMakeFiles/trace.dir/os_posix.cpp.o
Linking CXX static library libtrace.a
[ 41%] Built target trace
[ 45%] Generating glretrace_gl.cpp
[ 50%] Generating glstate_params.cpp
[ 54%] Building CXX object CMakeFiles/glretrace.dir/glretrace_gl.cpp.o
[ 58%] Building CXX object CMakeFiles/glretrace.dir/glretrace_cgl.cpp.o
[ 62%] Building CXX object CMakeFiles/glretrace.dir/glretrace_glx.cpp.o
[ 66%] Building CXX object CMakeFiles/glretrace.dir/glretrace_wgl.cpp.o
[ 70%] Building CXX object CMakeFiles/glretrace.dir/glretrace_main.cpp.o
[ 75%] Building CXX object CMakeFiles/glretrace.dir/glstate.cpp.o
[ 79%] Building CXX object CMakeFiles/glretrace.dir/glstate_params.cpp.o
[ 83%] Building CXX object CMakeFiles/glretrace.dir/retrace.cpp.o
[ 87%] Building CXX object CMakeFiles/glretrace.dir/glws_glx.cpp.o
/Users/nsc/install/apitrace/glws_glx.cpp:33:20: error: GL/glx.h: No such file or directory
/Users/nsc/install/apitrace/glws_glx.cpp:46: error: ISO C++ forbids declaration of ‘XVisualInfo’ with no type
/Users/nsc/install/apitrace/glws_glx.cpp:46: error: expected ‘;’ before ‘’ token
/Users/nsc/install/apitrace/glws_glx.cpp:48: error: expected `)' before ‘
’ token
/Users/nsc/install/apitrace/glws_glx.cpp: In destructor ‘virtual glws::GlxVisual::~GlxVisual()’:
/Users/nsc/install/apitrace/glws_glx.cpp:53: error: ‘visinfo’ was not declared in this scope

...

Building the GUI on windows

I get lots of compiler errors in vertexdatainterpreter.cpp (resulting from WINGDIAPI and APIENTRY being undefined inside gl.h).

The file includes GL/gl.h without including windows.h, which seems to be necessary.

In GLee.h (an extension loading library), the include block looks as follows:

#ifdef WIN32
    #ifndef WIN32_LEAN_AND_MEAN
    #define WIN32_LEAN_AND_MEAN
    #endif
    #include <windows.h>
    #include <GL/gl.h>
#elif defined(__APPLE__) || defined(__APPLE_CC__)
    #define GL_GLEXT_LEGACY
    #include <OpenGL/gl.h>
#else // GLX
    #define __glext_h_  /* prevent glext.h from being included  */
    #define __glxext_h_ /* prevent glxext.h from being included */
    #define GLX_GLXEXT_PROTOTYPES
    #include <GL/gl.h>
    #include <GL/glx.h>
#endif

In glext.h, there is the following block:

#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif

Error building apitrace 2.0 on Mandriva 2010.2

I'm trying to make an rpm package for my distro (Mandriva 2010.2 x86_64) but the building process always fails at the linking phase.

First, when linking tracedump:
** snip
Linking CXX executable tracedump
[ 46%] Generating apicalldelegate.moc
CMakeFiles/tracedump.dir/tracedump.cpp.o: In function main': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:75: undefined reference toTrace::Parser::Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:77: undefined reference to Trace::Parser::open(char const*)' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:84: undefined reference toTrace::Call::dump(std::basic_ostream<char, std::char_traits >&, bool)'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:85: undefined reference to Trace::Call::~Call()' CMakeFiles/tracedump.dir/tracedump.cpp.o: In functionTrace::Parser::parse_call()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)' CMakeFiles/tracedump.dir/tracedump.cpp.o: In functionmain':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:74: undefined reference to Trace::Parser::~Parser()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:74: undefined reference toTrace::Parser::~Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/tracedump.cpp:74: undefined reference to Trace::Parser::~Parser()' collect2: ld returned 1 exit status make[2]: *** [tracedump] Error 1 make[1]: *** [CMakeFiles/tracedump.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... ************* snip ************* And next when linking qapitrace: ************** snip ************************* Linking CXX executable ../qapitrace CMakeFiles/qapitrace.dir/apitracecall.cpp.o:(.rodata._ZTI14VariantVisitor[typeinfo for VariantVisitor]+0x10): undefined reference totypeinfo for Trace::Visitor'
CMakeFiles/qapitrace.dir/saverthread.cpp.o: In function SaverThread::run()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:346: undefined reference toTrace::Writer::Writer()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:347: undefined reference to Trace::Writer::open(char const*)' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:349: undefined reference toTrace::Parser::Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:350: undefined reference to Trace::Parser::open(char const*)' CMakeFiles/qapitrace.dir/saverthread.cpp.o: In functionTrace::Parser::parse_call()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)' CMakeFiles/qapitrace.dir/saverthread.cpp.o: In functionSaverThread::run()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:360: undefined reference to Trace::Writer::writeCall(Trace::Call*)' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:362: undefined reference toTrace::Writer::writeCall(Trace::Call_)'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:366: undefined reference to Trace::Writer::close()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:368: undefined reference toTrace::Parser::~Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:368: undefined reference to Trace::Writer::~Writer()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:368: undefined reference toTrace::Writer::~Writer()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/saverthread.cpp:368: undefined reference to Trace::Parser::~Parser()' CMakeFiles/qapitrace.dir/saverthread.cpp.o: In functionFloat':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:176: undefined reference to vtable for Trace::Float' CMakeFiles/qapitrace.dir/saverthread.cpp.o: In functionSInt':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:144: undefined reference to vtable for Trace::SInt' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:144: undefined reference tovtable for Trace::SInt'
CMakeFiles/qapitrace.dir/saverthread.cpp.o: In function Bool': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:128: undefined reference tovtable for Trace::Bool'
CMakeFiles/qapitrace.dir/saverthread.cpp.o: In function Array': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:247: undefined reference tovtable for Trace::Array'
CMakeFiles/qapitrace.dir/saverthread.cpp.o: In function ~Value': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:89: undefined reference tovtable for Trace::Value'
CMakeFiles/qapitrace.dir/saverthread.cpp.o: In function String': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_model.hpp:192: undefined reference tovtable for Trace::String'
CMakeFiles/qapitrace.dir/saverthread.cpp.o:(.rodata.ZTI11EditVisitor[typeinfo for EditVisitor]+0x10): undefined reference to typeinfo for Trace::Visitor' CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTraceLoader':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:24: undefined reference to Trace::Parser::Parser()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:24: undefined reference toTrace::Parser::Parser()'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::fetchFrameContents(ApiTraceFrame_)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:434: undefined reference to Trace::Parser::setBookmark(Trace::ParseBookmark const&)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTrace::Parser::parse_call()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTraceLoader::fetchFrameContents(ApiTraceFrame_)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:453: undefined reference to Trace::Call::~Call()'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTrace::Parser::parse_call()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTraceLoader::parseTrace()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:237: undefined reference to Trace::Call::~Call()'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTrace::Parser::parse_call()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function~TraceLoader': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:30: undefined reference to Trace::Parser::close()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference toTrace::Parser::~Parser()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference to Trace::Parser::~Parser()'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTraceLoader::searchNext(ApiTrace::SearchRequest const&)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:292: undefined reference to Trace::Parser::setBookmark(Trace::ParseBookmark const&)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTrace::Parser::parse_call()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference to Trace::Parser::parse_call(Trace::Parser::Mode)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In functionTraceLoader::searchNext(ApiTrace::SearchRequest const&)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:312: undefined reference to Trace::Call::~Call()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:308: undefined reference toTrace::Call::~Call()' CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::scanTrace()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:145: undefined reference toTrace::Parser::getBookmark(Trace::ParseBookmark&)' CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function Trace::Parser::scan_call()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:119: undefined reference toTrace::Parser::parse_call(Trace::Parser::Mode)' CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::scanTrace()':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:171: undefined reference toTrace::Call::~Call()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:168: undefined reference to Trace::Parser::getBookmark(Trace::ParseBookmark&)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function~TraceLoader': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:30: undefined reference to Trace::Parser::close()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference toTrace::Parser::~Parser()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference to Trace::Parser::~Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:30: undefined reference toTrace::Parser::close()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference to Trace::Parser::~Parser()'
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:33: undefined reference toTrace::Parser::~Parser()' CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::loadTrace(QString const&)':
/home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:48: undefined reference toTrace::Parser::close()' /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:51: undefined reference to Trace::Parser::open(char const
)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::searchPrev(ApiTrace::SearchRequest const&)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:329: undefined reference toTrace::Parser::setBookmark(Trace::ParseBookmark const&)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function Trace::Parser::parse_call()': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/common/trace_parser.hpp:101: undefined reference toTrace::Parser::parse_call(Trace::Parser::Mode)'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function qDeleteAll<QList<Trace::Call*>::const_iterator>': /usr/lib/qt4/include/QtCore/qalgorithms.h:322: undefined reference toTrace::Call::~Call()'
CMakeFiles/qapitrace.dir/traceloader.cpp.o: In function TraceLoader::searchPrev(ApiTrace::SearchRequest const&)': /home/giovanni/rpm/BUILD/apitrace-apitrace-e2c4320/gui/traceloader.cpp:352: undefined reference toTrace::Parser::setBookmark(Trace::ParseBookmark const&)'
collect2: ld returned 1 exit status
make[2]: *** [qapitrace] Error 1
make[1]: *** [gui/CMakeFiles/qapitrace.dir/all] Error 2
************** snip *************************

The build process on Mandriva calls cmake and make as below:
************** snip *************************

  • cd /home/giovanni/rpm/BUILD
  • cd apitrace-apitrace-e2c4320
  • '[' 1 -eq 1 ']'
  • '[' 1 -eq 1 ']'
  • CFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4'
  • export CFLAGS
  • CXXFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4'
  • export CXXFLAGS
  • FFLAGS='-O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4'
  • export FFLAGS
  • LDFLAGS=' -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro -Wl,-O1 -Wl,--build-id'
  • export LDFLAGS
  • mkdir -p build
  • cd build
  • /usr/bin/cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=release -DLIB_SUFFIX=64 -DCMAKE_SKIP_RPATH:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -Wl,-z,relro -Wl,-O1 -Wl,--build-id'
    ************** snip *************************

Obviously, when decompressing the tarball in a directory of choice and launching cmake and make from here (with the same parameters as above) the build succeeds, so the culprit lies somewhere between the source CMakeList.txt and the Mandriva build system...
And yes, I could simply adapt and hardcode in my spec file the steps lisrted in the INSTALL.markdown file, but I would prefer to find a way to use all the nice macros the Mandriva build system provides and still have a successful build of apitrace.
So, being a monkey-packager rather than a true and competent developer, I have to ask for help:
how can I have a successful build of apitrace without totally defeating my distro build system?

TIA.
GvM

Crash when using OpenGL from different threads

It is not allowed to make OpenGL calls from different threads. I just happen to have a (windows) application which did it anyway and worked. Here's what happened when I used ApiTrace:

Main Application: create an OpenGL context from thread 1
Main Application: call glEnable from thread 1. Works as intended.
Plugin DLL: call glEnable from thread 2. Crash in wgltrace.cpp, inside glEnable: calling __glEnable, a NULL pointer.

So ApiTrace helped me to find the bug. However, after calling a NULL pointer, you loose the call stack (at least in the Visual Studio), so you don't know where the bug is.
If it is not too expensive, it might be therefore a good idea to check the function pointer (or thread id) before calling it.

Crash in GL library

Hi there,

I wanted to give a try to apitrace, I compiled everything with no problem.
Unfortunately I'm stuck with my application crashing when running with glxtrace.so.

Here my backtrace :

~/mex/source/media-explorer$ LD_PRELOAD=/home/djdeath/mex/source/apitrace/build/glxtrace.so gdb --args mex
GNU gdb (GDB) 7.2-debian
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/djdeath/mex/install/bin/mex...done.
(gdb) r
Starting program: /home/djdeath/mex/install/bin/mex
[Thread debugging using libthread_db enabled]
apitrace: tracing to /home/djdeath/mex/source/media-explorer/mex.1.trace
apitrace: redirecting dlopen("libGL.so.1", 0x102)
apitrace: redirecting dlopen("libGL.so.1", 0x102)
apitrace: redirecting dlopen("libGL.so.1", 0x102)
[New Thread 0x7fffea6b0700 (LWP 1196)]
[New Thread 0x7fffe9eaf700 (LWP 1197)]
[New Thread 0x7fffe192d700 (LWP 1198)]
[New Thread 0x7fffe08a4700 (LWP 1199)]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff4882db7 in ChangeDrawableAttribute (dpy=0x62a3e0, drawable=56623111, mask=) at glx_pbuffer.c:144
144 glx_pbuffer.c: No such file or directory.
in glx_pbuffer.c
(gdb) bt
#0 0x00007ffff4882db7 in ChangeDrawableAttribute (dpy=0x62a3e0, drawable=56623111, mask=) at glx_pbuffer.c:144
#1 glXSelectEvent (dpy=0x62a3e0, drawable=56623111, mask=) at glx_pbuffer.c:794
#2 0x00007ffff7a1026c in __glXSelectEvent(_XDisplay*, unsigned long, unsigned long) () from /home/djdeath/mex/source/apitrace/build/glxtrace.so
#3 0x00007ffff7a77598 in glXSelectEvent () from /home/djdeath/mex/source/apitrace/build/glxtrace.so
#4 0x00007ffff556b229 in clutter_stage_glx_realize (stage_window=0x69e3a0) at ./glx/clutter-stage-glx.c:146
#5 0x00007ffff55e8b11 in _clutter_stage_window_realize (window=0x69e3a0) at ./clutter-stage-window.c:60
#6 0x00007ffff55e2890 in clutter_stage_realize (self=0x8c0070) at ./clutter-stage.c:493
#7 0x00007ffff12f3dee in g_closure_invoke (closure=0x8bbf40, return_value=0x0, n_param_values=1, param_values=0x7fffe40a8000, invocation_hint=0x7fffffffcfc0) at gclosure.c:767
#8 0x00007ffff1304a8d in signal_emit_unlocked_R (node=, detail=0, instance=0x8c0070, emission_return=0x0, instance_and_params=0x7fffe40a8000) at gsignal.c:3290
#9 0x00007ffff130e39a in g_signal_emit_valist (instance=, signal_id=, detail=, var_args=) at gsignal.c:2983
#10 0x00007ffff130e542 in g_signal_emit (instance=, signal_id=, detail=) at gsignal.c:3040
#11 0x00007ffff556fdae in clutter_actor_realize (self=0x8c0070) at ./clutter-actor.c:1430
#12 0x00007ffff556ef23 in clutter_actor_update_map_state (self=0x8c0070, change=MAP_STATE_CHECK) at ./clutter-actor.c:847
#13 0x00007ffff556f686 in clutter_actor_real_show (self=0x8c0070) at ./clutter-actor.c:1163
#14 0x00007ffff55e29ed in clutter_stage_show (self=0x8c0070) at ./clutter-stage.c:544
#15 0x00007ffff12f3dee in g_closure_invoke (closure=0x8b9fd0, return_value=0x0, n_param_values=1, param_values=0x7fffe40a4e40, invocation_hint=0x7fffffffd4d0) at gclosure.c:767
#16 0x00007ffff1304405 in signal_emit_unlocked_R (node=, detail=0, instance=0x8c0070, emission_return=0x0, instance_and_params=0x7fffe40a4e40) at gsignal.c:3182
#17 0x00007ffff130e39a in g_signal_emit_valist (instance=, signal_id=, detail=, var_args=) at gsignal.c:2983
#18 0x00007ffff130e542 in g_signal_emit (instance=, signal_id=, detail=) at gsignal.c:3040
#19 0x00007ffff556f886 in clutter_actor_show (self=0x8c0070) at ./clutter-actor.c:1243
#20 0x00000000004108ae in main (argc=1, argv=0x7fffffffdc78) at mex-main.c:2542

(gdb)

debian packaging

I wrote a debian package for apitrace.

Anyone interested can update the debian/changelog file with current package version and build a package for their Debian or Ubuntu system.

If github allows me to upload the tarball, that is.

Mac Lion SFML 1.6 Crash

[omegaice@MacPheonix:~/Documents/Code/visarray/viewer/molecular/build/Debug]% DYLD_LIBRARY_PATH=/usr/local/Cellar/apitrace/HEAD/wrappers/ gdb Molecular
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 8 20:32:45 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...
warning: Unable to read symbols for @executable_path/../Frameworks/sfml-system.framework/Versions/A/sfml-system (file not found).

warning: Unable to read symbols from "sfml-system" (not yet mapped into memory).

warning: Unable to read symbols for @executable_path/../Frameworks/sfml-window.framework/Versions/A/sfml-window (file not found).

warning: Unable to read symbols from "sfml-window" (not yet mapped into memory).

warning: Unable to read symbols for @executable_path/../Frameworks/sfml-graphics.framework/Versions/A/sfml-graphics (file not found).

warning: Unable to read symbols from "sfml-graphics" (not yet mapped into memory).
Reading symbols for shared libraries ..... done

(gdb) r
Starting program: /Users/omegaice/Documents/Code/visarray/viewer/molecular/build/Debug/Molecular
Reading symbols for shared libraries ...++++......................................................................................................................................... done
Reading symbols for shared libraries . done

Program received signal SIGABRT, Aborted.
0x00007fff8bbc9ce2 in __pthread_kill ()
(gdb) backtrace
#0 0x00007fff8bbc9ce2 in __pthread_kill ()
#1 0x00007fff8c17b7d2 in pthread_kill ()
#2 0x00007fff8c16cb4a in __abort ()
#3 0x00007fff8c169070 in __stack_chk_fail ()
#4 0x0000000100551a6b in OS::GetProcessName ()
#5 0x00000001005513a5 in Trace::LocalWriter::open ()
#6 0x000000010055147e in Trace::LocalWriter::beginEnter ()
#7 0x00000001004a97a6 in CGLSetOption ()
#8 0x00007fff91750115 in createPixelFormat ()
#9 0x00007fff917500be in -NSOpenGLPixelFormat initWithAttributes:
#10 0x00000001001d3f86 in -sfPrivGLContext initWithAttributes:mode:sharedContext:
#11 0x00000001001d3dde in +sfPrivGLContext sharedContext
#12 0x00000001001c813c in sf::priv::WindowImplCocoa::WindowImplCocoa ()
#13 0x00000001001c7e15 in sf::priv::WindowImpl::New ()
#14 0x00000001001c7bf1 in sf::Context::Context ()
#15 0x00000001001c7c65 in sf::Context::GetGlobal ()
#16 0x00000001001c7cd5 in __static_initialization_and_destruction_0 ()
#17 0x00007fff5fc0fd1a in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE ()
#18 0x00007fff5fc0fa66 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE ()
#19 0x00007fff5fc0d258 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#20 0x00007fff5fc0d1f1 in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE ()
#21 0x00007fff5fc0e02b in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE ()
#22 0x00007fff5fc034ad in __dyld__ZN4dyld24initializeMainExecutableEv ()
#23 0x00007fff5fc07580 in _dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5 ()
#24 0x00007fff5fc01059 in __dyld__dyld_start ()

Unigine Heaven benchmark crashes

On Linux the Unigine Heaven benchmark crashes at startup when one is trying to trace it. The benchmark is available from:
http://unigine.com/download/
start it with:
./x64_1024x768_windowed_tess_normal.sh (./x86_1024x768_windowed_tess_normal.sh if running on 32bit system)

a way to truncate / reduce / edit traces

Right now i have a trace that's 76 MB, but because it's producing a gpu hang the bulk of it is the final frame caught in an infinite loop of querying state that never changes -- 13,530,363 calls in Frame 560 versus 113,795 in the first 559 frames. The calls in the infinite loop are just dead weight, so it'd be nice to have a way to prune them-- expanding the final frame to view all the calls in it inflates memory usage from 20 MB to 4.3 GB, and only the first thousand or so are interesting.

No output when retracing file if glViewport not called

I've tried using apitrace 2.0 with my application (OpenGL, Windows) but, while tracing works fine, retracing seems to be broken. When I retrace I don't get a window at all, and if I retrace in qapitrace.exe to inspect buffers, I get garbage on framebuffers and a tiny squished down version of the actual texture on textures I've rendered to with a FBO.

I've uploaded a trace file here: http://www.mediafire.com/?jrgjv6cu0gd4p2v
The source code for the application is here: https://github.com/yuriks/cga-t2/tree/eeedf8813ce3804ae8f6dedec2eb8ace28d5a848

gDEBugger also seemed to have problems reading the buffers, so it may be something specific to my application that's causing issues.

UI build fails (but have both Qt 4.7.0 and QJson)

commands I used: (qt4.7 installed to home/kevin/qtsdk-2010.05 from Qt SDK .run at http://qt.nokia.com/downloads/sdk-linux-x11-32bit-cpp)

export PATH=/home/kevin/qtsdk-2010.05/bin/:/home/kevin/qtsdk-2010.05/qt/bin/:$PATH
export LD_LIBRARY_PATH=/home/kevin/qtsdk-2010.05/lib/:/home/kevin/qtsdk-2010.05/qt/lib/
cmake -H. -Bbuild

Cmake output:
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /usr/bin/python2.6
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so
-- Looking for XOpenDisplay in /usr/lib/libX11.so;/usr/lib/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/libX11.so
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.7.0 (using /home/kevin/qtsdk-2010.05/qt/bin/qmake)
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- checking for module 'QJson>=0.5'
-- found QJson, version 0.7.1
-- Found QJSON: qjson;QtCore
-- Found ZLIB: /usr/lib/libz.so
-- Found PNG: /usr/lib/libpng.so
-- Performing Test CXX_COMPILER_FLAG_VISIBILITY
-- Performing Test CXX_COMPILER_FLAG_VISIBILITY - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kevin/gl_debuggers/apitrace/build

and then the build fails at link time:
make -C build

LOTS of undefined reference error messages:
CMakeFiles/qapitrace.dir/apitrace.cpp.o: In function QList<ApiTraceFrame*>::detach_helper_grow(int, int)': apitrace.cpp:(.text._ZN5QListIP13ApiTraceFrameE18detach_helper_growEii[QList<ApiTraceFrame*>::detach_helper_grow(int, int)]+0x2b): undefined reference toQListData::detach_grow(int_, int)'
CMakeFiles/qapitrace.dir/apitrace.cpp.o: In function QList<ApiTraceCall_>::detach_helper_grow(int, int)': apitrace.cpp:(.text._ZN5QListIP12ApiTraceCallE18detach_helper_growEii[QList<ApiTraceCall*>::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)'
CMakeFiles/qapitrace.dir/apitrace.cpp.o: In functionQList<ApiTraceCall*>::detach_helper(int)': apitrace.cpp:(.text._ZN5QListIP12ApiTraceCallE13detach_helperEi[QList<ApiTraceCall*>::detach_helper(int)]+0x23): undefined reference to QListData::detach(int)'
CMakeFiles/qapitrace.dir/apitrace.cpp.o: In functionQList<ApiTraceFrame*>::detach_helper(int)': apitrace.cpp:(.text._ZN5QListIP13ApiTraceFrameE13detach_helperEi[QList<ApiTraceFrame*>::detach_helper(int)]+0x23): undefined reference to QListData::detach(int)'
CMakeFiles/qapitrace.dir/apicalldelegate.cpp.o: In functionint qRegisterMetaType<ApiTraceEvent*>(char const_, ApiTraceEvent_*)': apicalldelegate.cpp:(.text._Z17qRegisterMetaTypeIP13ApiTraceEventEiPKcPT_[int qRegisterMetaType<ApiTraceEvent*>(char const_, ApiTraceEvent__)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)'
CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In function int qRegisterMetaType<ApiEnum>(char const*, ApiEnum*)': apitracecall.cpp:(.text._Z17qRegisterMetaTypeI7ApiEnumEiPKcPT_[int qRegisterMetaType<ApiEnum>(char const*, ApiEnum*)]+0x2f): undefined reference toQMetaType::registerTypedef(char const_, int)'
CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In function int qRegisterMetaType<ApiPointer>(char const_, ApiPointer_)': apitracecall.cpp:(.text._Z17qRegisterMetaTypeI10ApiPointerEiPKcPT_[int qRegisterMetaType<ApiPointer>(char const_, ApiPointer_)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)'
CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In function int qRegisterMetaType<ApiBitmask>(char const*, ApiBitmask*)': apitracecall.cpp:(.text._Z17qRegisterMetaTypeI10ApiBitmaskEiPKcPT_[int qRegisterMetaType<ApiBitmask>(char const*, ApiBitmask*)]+0x2f): undefined reference toQMetaType::registerTypedef(char const_, int)'
CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In function int qRegisterMetaType<ApiStruct>(char const_, ApiStruct_)': apitracecall.cpp:(.text._Z17qRegisterMetaTypeI9ApiStructEiPKcPT_[int qRegisterMetaType<ApiStruct>(char const_, ApiStruct_)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)'
CMakeFiles/qapitrace.dir/apitracecall.cpp.o:apitracecall.cpp:(.text.Z17qRegisterMetaTypeI8ApiArrayEiPKcPT[int qRegisterMetaType(char const_, ApiArray_)]+0x2f): more undefined references to QMetaType::registerTypedef(char const*, int)' follow CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper_grow(int, int)':
apitracecall.cpp:(.text._ZN5QListI7QStringE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList<QPair<QString, unsigned long long> >::detach_helper_grow(int, int)':
apitracecall.cpp:(.text._ZN5QListI5QPairI7QStringyEE18detach_helper_growEii[QList<QPair<QString, unsigned long long> >::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper_grow(int, int)':
apitracecall.cpp:(.text._ZN5QListI8QVariantE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper_grow(int, int)':
apitracecall.cpp:(.text.ZN5QListI10ApiTextureE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper_grow(int, int)':
apitracecall.cpp:(.text.ZN5QListI14ApiFramebufferE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper(int)':
apitracecall.cpp:(.text.ZN5QListI7QStringE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper(int)':
apitracecall.cpp:(.text.ZN5QListI8QVariantE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper(int)':
apitracecall.cpp:(.text.ZN5QListI10ApiTextureE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList::detach_helper(int)':
apitracecall.cpp:(.text.ZN5QListI14ApiFramebufferE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/apitracecall.cpp.o: In functionQList<QPair<QString, unsigned long long> >::detach_helper(int)':
apitracecall.cpp:(.text.ZN5QListI5QPairI7QStringyEE13detach_helperEi[QList<QPair<QString, unsigned long long> >::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/argumentseditor.cpp.o: In functionQList<QStandardItem*>::detach_helper_grow(int, int)':
argumentseditor.cpp:(.text.ZN5QListIP13QStandardItemE18detach_helper_growEii[QList<QStandardItem*>::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/glsledit.cpp.o: In functionQListQTextEdit::ExtraSelection::detach_helper_grow(int, int)':
glsledit.cpp:(.text.ZN5QListIN9QTextEdit14ExtraSelectionEE18detach_helper_growEii[QListQTextEdit::ExtraSelection::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/glsledit.cpp.o: In functionQList::detach_helper_grow(int, int)':
glsledit.cpp:(.text.ZN5QListIiE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference to QListData::detach_grow(int*, int)' CMakeFiles/qapitrace.dir/glsledit.cpp.o: In functionQList::detach_helper(int)':
glsledit.cpp:(.text.ZN5QListIiE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference to QListData::detach(int)' CMakeFiles/qapitrace.dir/mainwindow.cpp.o: In functionint qRegisterMetaType<ApiTraceCall*>(char const, ApiTraceCall
)':
mainwindow.cpp:(.text.Z17qRegisterMetaTypeIP12ApiTraceCallEiPKcPT[int qRegisterMetaType<ApiTraceCall
>(char const
, ApiTraceCall
)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)' CMakeFiles/qapitrace.dir/mainwindow.cpp.o: In function QList<QTreeWidgetItem*>::detach_helper_grow(int, int)':
mainwindow.cpp:(.text.ZN5QListIP15QTreeWidgetItemE18detach_helper_growEii[QList<QTreeWidgetItem*>::detach_helper_grow(int, int)]+0x2b): undefined reference toQListData::detach_grow(int_, int)' CMakeFiles/qapitrace.dir/mainwindow.cpp.o: In function QList::detach_helper(int)':
mainwindow.cpp:(.text.ZN5QListI12RetraceErrorE13detach_helperEi[QList::detach_helper(int)]+0x24): undefined reference toQListData::detach(int)' CMakeFiles/qapitrace.dir/main.cpp.o: In function int qRegisterMetaType(char const, ApiTraceState
)':
main.cpp:(.text.Z17qRegisterMetaTypeI13ApiTraceStateEiPKcPT[int qRegisterMetaType(char const, ApiTraceState)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)' CMakeFiles/qapitrace.dir/main.cpp.o: In function int qRegisterMetaType<QList<ApiTraceFrame*> >(char const*, QList<ApiTraceFrame*>)':
main.cpp:(.text.Z17qRegisterMetaTypeI5QListIP13ApiTraceFrameEEiPKcPT[int qRegisterMetaType<QList<ApiTraceFrame
> >(char const*, QList<ApiTraceFrame*>*)]+0x2f): undefined reference toQMetaType::registerTypedef(char const_, int)' CMakeFiles/qapitrace.dir/retracer.cpp.o: In function int qRegisterMetaType<QList >(char const, QList)':
retracer.cpp:(.text.Z17qRegisterMetaTypeI5QListI12RetraceErrorEEiPKcPT[int qRegisterMetaType<QList >(char const, QList)]+0x2f): undefined reference to QMetaType::registerTypedef(char const_, int)' CMakeFiles/qapitrace.dir/retracer.cpp.o: In function QList::detach_helper_grow(int, int)':
retracer.cpp:(.text._ZN5QListI12RetraceErrorE18detach_helper_growEii[QList::detach_helper_grow(int, int)]+0x2b): undefined reference toQListData::detach_grow(int_, int)' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to qDecodeDataUrl(QUrl const&)'
/home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference toQElapsedTimer::elapsed() const' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QElapsedTimer::hasExpired(long long) const'
/home/kevin/qtsdk-2010.05/qt/lib/libQtNetwork.so.4: undefined reference toQIODevicePrivate::peek(long long)' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QElapsedTimer::restart()'
/home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference toQLocale::textDirection() const' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QElapsedTimer::start()'
/home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference toqDetectCPUFeatures()' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QString::isRightToLeft() const'
/home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference toQAbstractDeclarativeData::destroyed' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QElapsedTimer::isValid() const'
/home/kevin/qtsdk-2010.05/qt/lib/libQtNetwork.so.4: undefined reference toQIODevicePrivate::peek(char_, long long)' /home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to QElapsedTimer::msecsTo(QElapsedTimer const&) const'
/home/kevin/qtsdk-2010.05/qt/lib/libQtGui.so: undefined reference to`QElapsedTimer::invalidate()'

envp PWD=

i would fork but I'd have nothing else to contribute. Coming undergraduate Operating Systems class, you look in the envp* dictionary. I forget how to get things out of dictionaries in C but the envp* dictionary is a parameter of your main function so, for example
int main(int argc,char *argv[],char *envp[])
printf("The environment is as follows:\n");
int a = 0;
while (envp[a] != NULL)
printf("\t%s\n", envp[a++]);
return 0;
the *envp pointer is a dictionary, so it should print out the entire environmental dictionary. where did u think bash was getting it?

error building on mac osx 10.7 (lion)

mkdir build
cd build
cmake ..
make

gets me

/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:21991: error: declaration of C function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2742: error: previous declaration ‘void glTexImage1D(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:22032: error: declaration of C function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2743: error: previous declaration ‘void glTexImage2D(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:29140: error: declaration of C function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2744: error: previous declaration ‘void glTexImage3D(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:21991: error: declaration of C function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2742: error: previous declaration ‘void glTexImage1D(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:22032: error: declaration of C function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2743: error: previous declaration ‘void glTexImage2D(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:29140: error: declaration of C function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2744: error: previous declaration ‘void glTexImage3D(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
lipo: can't figure out the architecture type of: /var/folders/yr/s06w52pd27ngk05n92dl0vn40000gn/T//cc3aVDhq.out
make[2]: *** [CMakeFiles/cgltrace.dir/cgltrace.cpp.o] Error 1
make[1]: *** [CMakeFiles/cgltrace.dir/all] Error 2

CMake configuring error.

CMake isnt able to find my python interpreter on ubuntu. here's a log:

CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake:55 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:13 (find_package)

-- Configuring incomplete, errors occurred!
antonio@antonio-pc:~/Descargas/apitrace$ python -V
Python 2.7.1+

Better call details view

Right now the call details view is rather ugly and not very useful. It should show more info, at least the error if any at the current call, plus all the docs from the resources (both extensions and man pages).

On-demand loading of trace files

Currently the GUI freezes if we're loading a larger trace file. A well gzip'ed 200mb trace file can easily take +4gb in ram so we're just running out of memory. We need to incrementally load the data. Most likely through memory mapping the entire trace file and being able to seek in it. The gui needs to know:

  • the number of frames int the trace file
  • the number of calls in each frame

and it has to be able to:

  • get calls for every random frame,

So something like the following would be great for the gui:

class ApiTrace
{
public:
    ApiTrace(const std::string &filename);
    int numberOfFrames() const;
    int numberOfCallsInFrame(int frameIdx) const;
    // loaded on demand or fetched from a fixed size (e.g. within 100mb) cache
    ApiTraceFrame *frame(int frameIdx);
};

// loaded frame
class ApiTraceFrame 
{
public:
    int numberOfCalls() const;
    const ApiTraceCall *calls() const;
};

Qapitrace: Surface Viewer: Window extent calculation / scroll bars

The Surface Viewer calculates the optimal window size to display the surface, but the horizontal and vertical border offset is not included in the calculation for the intial window size.
This results in all Surface Viewer windows having horizontal and vertical scrollbars.

At first I thought it could be due to my dual portrait enviroment, I tested on a 'normal' configuration as well and observed the same behavior.

File: mainwindow.cpp
Function: void MainWindow::showSelectedSurface()
Line: 622
viewer->resize(qMin(int(0.75 * screenRect.width()), img.width()) + 40,
qMin(int(0.75 * screenRect.height()), img.height()) + 40);

changing to these values yields the intended effect.

viewer->resize(qMin(int(0.85 * screenRect.width()), img.width()) + 60,
qMin(int(0.85 * screenRect.height()), img.height()) + 60);

Batched state lookups

Right now, as far as I can see, you can only lookup state for one frame/call at a time. It would be nice and very time saving to be able to ask for several calls to be looked up at once, and, even better, for the retracing to pause and sit idle once it reaches your frame, so that future lookups on calls after that one resume from where you paused, instead of starting the whole retracing over again.

Assertion in Parser::parse_value()

After reading zrushin's blog I did a short and quick test. All seemed to work fine but a replay (and qapitrace & others) are failing with an assertion in Parser::parse_value(): "error: unknown type -1".
Removing the assert and returning 0 solves the problem - the replay works fine until the end.
Here the bt:

...
42951 glPolygonMode(face = GL_FRONT, mode = GL_FILL)

Breakpoint 1, Trace::Parser::parse_value (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:246
246 std::cerr << "error: unknown type " << c << "\n";
(gdb) bt
#0 Trace::Parser::parse_value (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:246
#1 0x000000000041408a in Trace::Parser::parse_array (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:323
#2 0x00000000004139e6 in Trace::Parser::parse_value (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:238
#3 0x0000000000413866 in Trace::Parser::parse_arg (this=0x7fffffffda80, call=0x874ca0)

at /home/chehrlic/tds/apitrace/trace_parser.cpp:205

#4 0x00000000004137d2 in Trace::Parser::parse_call_details (this=0x7fffffffda80, call=0x874ca0)

at /home/chehrlic/tds/apitrace/trace_parser.cpp:187

#5 0x00000000004135fc in Trace::Parser::parse_enter (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:154
#6 0x00000000004133aa in Trace::Parser::parse_call (this=0x7fffffffda80) at /home/chehrlic/tds/apitrace/trace_parser.cpp:104
#7 0x000000000041035f in main (argc=2, argv=0x7fffffffdc18) at /home/chehrlic/tds/apitrace/tracedump.cpp:45

git revision e4397f1

apitrace shows the wrong buffer in snapshots

When I do snapshots in retrace they show small black squares.

When I do snapshots with -sb I get errors about invalid buffer (obviously) and every other snapshot shows the traced app (upside down).

Crash when editing a trace

After editing the number of vertices to a glDrawArrays call, apitrace saves the edited trace, then when I do a state lookup I see the replay going on, and once the replay has ended, apitrace crashes with a segfault :

Process error = 1
err = "glretrace: /home/arthur/src/apitrace/trace_model.cpp:80: virtual long long int Trace::Value::toSInt() const: Assertion `0' failed.
"
out = ""
Segmentation fault (core dumped)

The core dump contains nothing useful, I'll see if I can rebuild with debug symbols.

Help appreciated.

apitrace crashes while tracing

I can't give you the trace because

  1. github does not allow attaching files

  2. the trace contains copyrighted material from the application in question which is disallowed on github

  3. the trace is large (a few megabytes compressed)

gltrace loops infinitely when TRACE_FILE cannot be opened

When the environment variable TRACE_FILE is set to a read-only/nonexistent location or an invalid filename like "~/traces/bluh.trace" (without the shell expanding the ~), gltrace keeps repeatedly trying to open it until the program exits:

apitrace: tracing to ~/traces/bluh.trace
apitrace: tracing to ~/traces/bluh.trace
apitrace: tracing to ~/traces/bluh.trace
apitrace: tracing to ~/traces/bluh.trace

It should probably just abort() with a descriptive error that the file couldn't be opened instead of retrying for the whole run of the program and tracing nothing.

Markers in GL command stream

gDEBugger had special extensions that could be used to output a string marker in the GL command stream. This allowed you to break execution at given points (for example, when a given object was going to be drawn). It was useful to be able to debug specific areas of the program.

It was rudimentary however. I would think it would be pretty simple to do something even more powerful, for example, use a string to name these markers and then be able to break execution only when a marker with a given name was reached, or output start/end markers and record trace only between these markers.

All this is so that apitrace is easier to use in a more targeted way, and with large programs where, in its current state, it is very slow and outputs very large trace files.

Unsupported symbols

Does apitrace support platform specific OpenGL calls? I'm getting this error on Snow Leopard testing out Firefox:

DYLD_LIBRARY_PATH=/path/to/apitrace/wrappers /Applications/Firefox.app/Contents/MacOS/firefox

dyld: Symbol not found: _glFlushRenderAPPLE
Referenced from: /System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup
Expected in: /path/to/apitrace/wrappers/OpenGL
in /System/Library/PrivateFrameworks/Backup.framework/Versions/A/Backup
Trace/BPT trap

Display all textures? Support GL_KHR_debug object labels?

Hello,

I realize this may be slightly out of scope for apitrace, but I find myself often wondering what is the texture ID for a given texture I have in mind.

Would it be technically possible for apitrace to dump all existing textures, and display them? This is somewhat part of the state after all.

Thanks

Trace editing

Implement simple trace editing in the GUI. Initially, not addition of removal of calls but just editing arguments to individual calls. It should be possible to edit arguments, replay the new trace and save it.

Typo in CMakeLists

./gui/CMakeLists.txt, line 48:

It should be QJSON_INCLUDE_DIR and not QJSON_INCLUDE_DIRS (as set in FindQJSON.cmake)

Also, I had to manually add PC_QJSON_LIBRARY_DIRS and PC_QJSON_INCLUDE_DIRS entries in my CMake configuration, otherwise it could not find qjson (which I installed by building INSTALL from the CMake-generated qjson project).

Resolving symbols for dynamically loaded GL libs

There's a wonky case of applications which don't link to GL, linking to a library which doesn't link to GL but dlopens another library which links to GL. In this case our dlsym seems to return NULL for gl/glx symbols and the glxtrace.so exits with:
error: unavailable function "glXGetProcAddressARB"
testing:
starting any Qt 4.7+ application with argument "-graphicssystem opengl" e.g.:
qapitrace -graphicsssytem opengl
assistant -graphicssystem opengl
and so on (qtopengl library needs to be installed).

Show all shaders in a program?

Hello, I imagine you will get many new users like me now that gDEBugger has been bought by AMD and turned into a Visual Studio 2010-only plugin... I've tried out apitrace and have a few requests to make. I currently have no available development time or I would implement these myself - perhaps if no one gets to them soon it will still be me, but it's still useful to discuss these here and record them.

We have multiple shader objects attached to our program objects most of the time, and it seems qapitrace does not display them all (it seems to display the last one, which is not necessarily the one that has the main() ). It would be useful to be able to see them all. I guess this is a GUI issue only, as obviously all shaders are in the trace file because the scene looks fine when replaying the trace.

Thanks in advance.

apitrace crashes when tracing wine

Example session, with steam (this is just starting steam, even before "loading" windows appears, and not starting any game):

$ wine Steam.exe
[8 wine warning/fixmes removed]
signal_handler: sig = 11
apitrace: flushing trace due to an exception
Erreur de segmentation

I remember it used to work several months ago, so I started bisecting apitrace, and found this commit to cause the breakage:
3d9a70c
I added signal numbers 11 (SIGSEGV), 10 (SIGUSR1) and 3 (SIGQUIT) to current code "ignore" list, and I could dump a trace again.

I'm still puzzled as to what the right fix would be... I'm surprised a library[ wrapper] registers signal handlers: shouldn't it just leave them alone ?

edit: 10 is SIGUSR1, much less scary than SIGBUS...

qapitrace segfault on 'incomplete call'

git revision id: 6068f67

gdb log below:


Loading  :  "/home/nobled/opt/AmnesiaDemo/Amnesia.intel.libtxc-dxtn.4.trace" 
[Thread 0x7fffd6116700 (LWP 6383) exited]
10486564: warning: incomplete call glGetQueryObjectivARB

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffda217700 (LWP 6378)]
0x0000000000432542 in ApiTraceCall::ApiTraceCall (this=0x7fff0cdc30f0, parentFrame=0x7fffc6db3c70, loader=0xac33c0, call=0x7fffd2137360)
    at /home/nobled/code/apitrace/gui/apitracecall.cpp:639
639         call->args[i]->visit(argVisitor);
(gdb) bt
#0  0x0000000000432542 in ApiTraceCall::ApiTraceCall (this=0x7fff0cdc30f0, parentFrame=0x7fffc6db3c70, loader=0xac33c0, 
call=0x7fffd2137360) at /home/nobled/code/apitrace/gui/apitracecall.cpp:639
#1  0x000000000046ddef in apiCallFromTraceCall (call=0x7fffd2137360, helpHash=..., frame=0x7fffc6db3c70, loader=0xac33c0)
at /home/nobled/code/apitrace/gui/traceloader.cpp:15
#2  0x000000000046ed12 in TraceLoader::parseTrace (this=0xac33c0) at /home/nobled/code/apitrace/gui/traceloader.cpp:213
#3  0x000000000046e294 in TraceLoader::loadTrace (this=0xac33c0, filename=...) at /home/nobled/code/apitrace/gui/traceloader.cpp:62
#4  0x000000000046ffaa in TraceLoader::qt_metacall (this=0xac33c0, _c=QMetaObject::InvokeMetaMethod, _id=9, _a=0xc10c20)
at /home/nobled/code/apitrace-build2/gui/traceloader.moc:114
#5  0x00007ffff4af949a in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#6  0x00007ffff59719f4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#7  0x00007ffff59763ba in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#8  0x00007ffff4ae549c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#9  0x00007ffff4ae8c25 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#10 0x00007ffff4b10253 in ?? () from /usr/lib/libQtCore.so.4
#11 0x00007ffff2aecbcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007ffff2aed3a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff2aed639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff4b103ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#15 0x00007ffff4ae4882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#16 0x00007ffff4ae4abc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#17 0x00007ffff49fb924 in QThread::exec() () from /usr/lib/libQtCore.so.4
#18 0x00007ffff49fe175 in ?? () from /usr/lib/libQtCore.so.4
#19 0x00007ffff3c3dd8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#20 0x00007ffff3f3b04d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#21 0x0000000000000000 in ?? ()
(gdb) print call
$1 = (const trace::Call *) 0x7fffd2137360
(gdb) print call->args
$2 = {<std::_Vector_base<trace::Value*, std::allocator<trace::Value*> >> = {
    _M_impl = {<std::allocator<trace::Value*>> = {<__gnu_cxx::new_allocator<trace::Value*>> = {<No data fields>}, <No data fields>}, 
      _M_start = 0x7fffc6de1cf0, _M_finish = 0x7fffc6de1d08, _M_end_of_storage = 0x7fffc6de1d08}}, <No data fields>}
(gdb) print call->args[i]
$3 = (trace::Value *&) @0x7fffc6de1d00: 0x0
(gdb) print call->no
$4 = 10486564
(gdb) print i
$5 = 2
(gdb) print call->args.size()
$6 = 3
(gdb) quit

Reading multisampled buffers in GL

Lots of apps is using multisampled surfaces (Qt "-graphicssytem opengl" are easy to test) and one can't use glReadPixels on buffers with multisampling enabled. Right now we're just getting garbage on those buffers. We'll need to use something akin to glBlitFramebuffer to blit to another non-multisampled buffer and read that.

Create an edit menu

Create an edit menu with search, go to, go to beginning of the frame and go to end of frame.

Retrace failing on Windows, built with Visual C++ Express 2008

Hi,
I built APITrace with Visual C++ Express 2008 on Win 7 32-bit. None of the traces I recorded would playback correctly as glretrace reported that all the GL functions were unknown.

I found that in retrace_call(), "name" was not pointing at the GL function name. I fixed this issue with the following:

bool retrace::retrace_call(Trace::Call &call) {
{
char *name;
name = new char [call.name().size()+1];
strcpy(name,call.name().c_str());

...

delete[] name;
}

Standalone GLES tracer

Hello,

I see that you just started working on a GLES2 branch, which is very interesting. I'm working on a platform where only EGL/GLES2 are available, with no X11 or OpenGL support.

I've tried hacking the makefile to only build a tracer for GLES/GLES2 and EGL, however it seems the code depends on OpenGL being available. Do you have plans to support this kind of build, and if not, can you please give me some advice on how this would be doable ? Does the tracer need to have any knowledge of the EGL platform backend to create pixmaps, images or windows ?

Thank you very much.

Start / stop trace

It would be useful to be able to start / stop the trace to be able to make the trace more targeted. I could see two ways to do this:

  • Expose some kind of API in the wrapper DLL, which the app could call to start / stop tracing. This would be very flexible, because the app could start / stop tracing at known points, or it could expose a button in its own GUI, or whatever.
  • Make an application, similar to gDEBugger, that would run the app we want to trace, and which would start / stop tracing when the user clicks a button. This would be very user-friendly.

The second idea could even be made part of the wrapper DLL I guess - when the wrapper sees the first OpenGL call, it spawns a small Qt GUI that lets you control the tracing. As long as tracing is not started, the wrapper just forwards calls, and when the user presses a "play" button on that GUI, then the wrapper starts saving all commands to the trace file, until the user presses a "stop" button on the GUI or the application quits.

This would help users trace only at known performance-critical times, and it would make trace files smaller.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.