简体   繁体   中英

gdb errors in c++ using FLTK on MAC

I'm using FLTK in C++ and my program was every so often crashing when I changed the value of a widget. I ran my program with gdb to replicate the error and got two similar, but not identical errors when performing the backtrace. Weirdly the backtrace doesn't list any functions in my code, but it is in code I wouldn't expect to be in error so what might be wrong in my code to give these results?

The backtraces/errors are

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 ()

Any ideas? Thanks in advance.

Any crash inside free implementation (your first stack trace) is usually a sign of double-free, or another kind heap corruption.

System malloc on MacOS has debugging features that you can turn on, and that should allow you to catch it close to where it is happening.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM