Comment 2 for bug 1490956

Revision history for this message
Gerry Boland (gerboland) wrote :

Crash only occurs on the phone, not desktop. This tends to be the usual backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0 0x00000000 in ?? ()
#1 0xb6b6af64 in glGenTextures (this=<optimized out>, textures=0x2815d8, n=1) at opengl/qopengltexturehelper_p.h:508
#2 create (this=0x2815c8) at opengl/qopengltexture.cpp:169
#3 QOpenGLTexture::setFormat (this=this@entry=0x281bb0, format=format@entry=QOpenGLTexture::RGBAFormat)
    at opengl/qopengltexture.cpp:1923
#4 0xb6b70b46 in QOpenGLTexture::setData (this=this@entry=0x281bb0, image=..., genMipMaps=QOpenGLTexture::GenerateMipMaps)
    at opengl/qopengltexture.cpp:2669
#5 0xb6b70c66 in QOpenGLTexture::QOpenGLTexture (this=0x281bb0, image=..., genMipMaps=<optimized out>)
    at opengl/qopengltexture.cpp:1707
#6 0x0000b480 in ?? ()

Qt has a non-trivial way of wrapping GL calls to abstract away API differences where possible. It starts in QOpenGLTextureHelper, which on creation, resolves symbols for the usual GL calls:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/opengl/qopengltexturehelper.cpp?id=69196b38c481610ef30bfe8ce8e7ba6826729ab8#n182
Here GenTextures is a function pointer:
    GenTextures = ::glGenTextures;
which should be set the address of the actual call. It is via this GenTextures that Qt then works.

But when I try to debug this assignment, I get confusing results:

(gdb) p GenTextures
$3 = (void (*)(GLsizei, GLuint *)) 0xffffffff
(gdb) p glGenTextures
Cannot take address of method glGenTextures.
(gdb) p ::glGenTextures
$4 = {<text gnu-indirect-function variable, no debug info>} 0xb6536384 <glGenTextures>

This debug is definitely taken after the variable should be assigned. But this makes no sense.