使用MAC上的FLTK在c ++中的gdb错误

时间:2014-09-30 17:49:53

标签: c++ gdb

我在C ++中使用FLTK,当我更改窗口小部件的值时,我的程序经常崩溃。我用gdb运行我的程序来复制错误,并在执行回溯时得到两个相似但不完全相同的错误。奇怪的是,回溯并没有列出我的代码中的任何函数,但它在代码中我不会期望出错,所以在我的代码中出现这些结果可能有什么问题?

回溯/错误

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018
0x00007fff8f018d2b in tiny_free_list_remove_ptr ()
(gdb) backtrace
#0  0x00007fff8f018d2b in tiny_free_list_remove_ptr ()
#1  0x00007fff8f01579d in szone_free_definite_size ()
#2  0x00007fff8f00f8c8 in free ()
#3  0x00007fff8ccdcfc0 in object_dispose ()
#4  0x00007fff919fff2b in -[__NSArrayI dealloc] ()
#5  0x00007fff919c228a in CFRelease ()
#6  0x00007fff8f339591 in -[NSFocusState flush] ()
#7  0x00007fff8f337f43 in -[NSView _focusFromView:withContext:] ()
#8  0x00007fff8f337719 in -[NSView lockFocusIfCanDraw] ()
#9  0x00007fff8f33744e in -[NSView lockFocus] ()
#10 0x0000000100033548 in Fl_Window::make_current ()
#11 0x0000000100042e8a in Fl_Double_Window::flush ()
#12 0x0000000100034134 in Fl_X::flush ()
#13 0x000000010003acc8 in Fl::flush ()
#14 0x0000000100036e8f in fl_mac_flush_and_wait ()
#15 0x000000010003ae39 in Fl::run ()
#16 0x0000000100100150 in main ()

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 13 at address: 0x0000000000000000
0x00007fff8ccda718 in objc_msgSend_vtable13 ()
(gdb) backtrace
#0  0x00007fff8ccda718 in objc_msgSend_vtable13 ()
#1  0x00007fff91a132fa in __CFRunLoopDoObservers ()
#2  0x00007fff919ee7b8 in __CFRunLoopRun ()
#3  0x00007fff919ee0e2 in CFRunLoopRunSpecific ()
#4  0x00007fff8e873eb4 in RunCurrentEventLoopInMode ()
#5  0x00007fff8e873b94 in ReceiveNextEventCommon ()
#6  0x00007fff8e873ae3 in BlockUntilNextEventMatchingListInMode ()
#7  0x00007fff8f2fc533 in _DPSNextEvent ()
#8  0x00007fff8f2fbdf2 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#9  0x0000000100036e1a in fl_wait ()
#10 0x0000000100036eb6 in fl_mac_flush_and_wait ()
#11 0x000000010003ae39 in Fl::run ()
#12 0x0000000100100150 in main ()

有什么想法吗?提前谢谢。

1 个答案:

答案 0 :(得分:0)

free实现中的任何崩溃(您的第一个堆栈跟踪)通常都是双重释放或另一种堆损坏的迹象。

MacOS上的系统mallocdebugging features您可以打开,这应该可以让您接近它发生的位置。