[Development] Load debug symbol from Qt library in lldb

Eike Ziller Eike.Ziller at qt.io
Mon Dec 19 09:07:54 CET 2016


> On Dec 19, 2016, at 4:10 AM, Ben Lau <xbenlau at gmail.com> wrote:
> 
> Hi,
> 
> I am tracking a crash problem in Qt library on Mac. First of all, I build a Qt 5.7.1 library from git with :
> 
> $ ./configure  -confirm-license -developer-build -opensource -nomake examples -nomake tests
> 
> Then build an example program via the the qmake built
> 
> $ qmake CONFIG+=debug
> 
> Run it via lldb
> 
> $ lldb ./lodashdemo.app/Contents/MacOS/lodashdemo 
> 
> $ run
> 
> (then crash)$ image list
> 
> ...
> 
> [  7] D6239705-2373-32D9-A1E9-E290DBA7CBAD 0x0000000101081000 /Users/benlau/tmp/qt5/qt5/qtbase/lib/QtQml.framework/Versions/5/QtQml 
> 
> ....
> 
> The QtQml is a shared library without debug symbol. The library that hold debug symbol should be QtQml_debug located in the same folder
> 
> $ file  /Users/benlau/tmp/qt5/qt5/qtbase/lib/QtQml.framework/Versions/5/QtQml*
> 
> /Users/benlau/tmp/qt5/qt5/qtbase/lib/QtQml.framework/Versions/5/QtQml:       Mach-O 64-bit dynamically linked shared library x86_64
> /Users/benlau/tmp/qt5/qt5/qtbase/lib/QtQml.framework/Versions/5/QtQml_debug: Mach-O 64-bit dynamically linked shared library x86_64
> 
> My questions are :
> 
> 1) can I turn qmake to link the QtQml_debug ?
> or
> 
> 2) can I build a QtQml library with debug symbol?

The “macOS” way to handle frameworks and debug builds, is that the application links against the non-_debug libraries, and if you want to make it load the debug symbols you set DYLD_IMAGE_SUFFIX=_debug before running the application.

http://doc.qt.io/qt-5/debug.html#debugging-in-macos-and-xcode

Note that applications in /usr/bin (like /usr/bin/lldb) have an additional safe-guard that they reset the DYLD_* variables, so you need to set it in lldb for the application process:
$ lldb <your app>
$ settings set target.env-vars DYLD_IMAGE_SUFFIX=_debug
$ run

Br,
-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B






More information about the Development mailing list