[Interest] Debugging on Mac OS X

Paul Floyd paulf at free.fr
Sat Feb 23 20:27:07 CET 2013


Hi

Thanks for the quick reply (as ever).

On 23 Feb 2013, at 18:34, Thiago Macieira wrote:

> On sábado, 23 de fevereiro de 2013 18.29.31, Paul Floyd wrote:
>> Hi
>> 
>> I'm trying to build and run an app that a colleague wrote, without too much
>> success. It works OK on Linux (and Windows, but I'm not certain of that).
>> 
>> I have
>> Mac OS X 10.6.8
>> XCode 4.0
>> clang 3.2
>> Qt 4.8.4 built with whatever compiler it chooses by default, probably GCC
>> 4.2 Qt 5.0.1 built with clang 3.2, release only
>> 
>> With Qt 4.8.4 and g++ 4.2, it crashes in the call to QApplication::exec()
>> with an abort(). Even with the debug version of Qt, I can't step into this
>> code. Any ideas how I can debug this problem?
> 
> How did you enable the debug libraries? Did you set DYLD_IMAGE_SUFFIX?

Yes, via Qt Creator.

> 
> I've also been told you should try lldb instead of gdb. Also, if you have 
> Apple clang 3.2, it means you don't have the latest XCode. Can you try to 
> upgrade?
> 

This is clang from llvm.org. Apple clang 4.2 is included with XCode, which won't install on OS X 10.6.  The clang in XCode 4.0 is clang 2.0

I'll try lldb.

> Does this problem happen on later versions of Mac OS X?
> 

I don't have access to a later version (I could upgrade to 10.7 with some effort).

>> In the Qt 5 version of the same code (hastily ported), I get a lockup
>> earlier, in a call to QFileDialog::getExistingDirectory. The callstack
>> contains
>> 
>> mach_msg_trap
>> mach_msg
>> __CFRunLoopRun
> 
> Is that the entire backtrace? It contains no Qt frames there, so it doesn't 
> help me.

It's the top 3 elements. The (almost) full stack is:

0	mach_msg_trap			0x1022e0e3a	
1	mach_msg			0x1022e15ef	
2	__CFRunLoopRun			0x7fff8a4fd902	
3	CFRunLoopRunSpecific			0x7fff8a4fcd8f	
4	RunCurrentEventLoopInMode			0x7fff88cea7ee	
5	ReceiveNextEventCommon			0x7fff88cea5f3	
6	BlockUntilNextEventMatchingListInMode			0x7fff88cea4ac	
7	_DPSNextEvent			0x7fff890b0eb2	
8	-[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]			0x7fff890b0801	
9	-[NSApplication _realDoModalLoop:peek:]			0x7fff892ebdc3	
10	-[NSApplication runModalForWindow:]			0x7fff892e9951	
11	-[NSSavePanel runModal]			0x7fff8954f112	
12	-[QNSOpenSavePanelDelegate runApplicationModalPanel]			0x103444e17	
13	QCocoaFileDialogHelper::exec			0x103448bac	
14	QDialog::exec			0x10052ee7f	
15	QFileDialog::getExistingDirectory			0x10053c440	
16	EngineeringDataModel::LoadAll	TableModel.cpp	17	0x100033694	
17	EngineeringDataModel::EngineeringDataModel	TableModel.h	22	0x100028761	
18	EngineeringDataModel::EngineeringDataModel	TableModel.h	23	0x100019b75	
19	MainWindow::MainWindow	mainwindow.cpp	41	0x100006036	
20	MainWindow::MainWindow	mainwindow.cpp	156	0x100005f9d	



> 
> Also note that Mac OS X 10.6 is not a valid development target for Qt 5. You 
> have to develop on 10.7 or 10.8, but you can deploy (and debug) there.
> 

OK, but I shouldn't have problems with Qt 4.8., right?

A+
Paul




More information about the Interest mailing list