在MAC上使用FLTK的C++中的gdb错误
问题描述:
我在C++中使用FLTK,当我改变了一个窗口小部件的值时,我的程序经常崩溃。我用gdb运行我的程序来复制错误,并在执行回溯时得到两个相似但不完全相同的错误。奇怪的是,回溯并没有在我的代码中列出任何函数,但它在代码中我不会指望出现错误,所以在我的代码中可能会出现错误来给出这些结果?在MAC上使用FLTK的C++中的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()
任何想法?提前致谢。
答
free
实现(您的第一个堆栈跟踪)内的任何崩溃通常是双免费或另一种堆损坏的迹象。
MacOS上的系统malloc
有debugging features,您可以打开它,并且应该允许您将它靠近它发生的位置。