*** set a breakpoint in malloc_error_break to debug - how in Qt?
-
My app crashes with this message:
@
Lotus(18762,0x111e19000) malloc: *** error for object 0x102469358: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
@How do I set a breakpoint to "malloc_error_break" in Qt? If I right click on the breakpoints window, I am presented with a bunch options. But which one is it I use for malloc_error_break?
-
"This site":http://qt-project.org/doc/qtcreator-3.1/creator-debug-mode.html describes in detail how to interact with the debugger.
In short - just open a file, set a cursor in wanted line and press F9 to set a breakpoint (or click on the left margin next to that line). A red circle will be displayed on the margin to indicate that a breakpoint was set and you will see it also in the breakpoints window. -
I know how to do break points. Thats hilarious. This is a special breakpoint that uses a symbol called "malloc_error_break". I have a memory problem that this warning gives me instructions how to track it down.
I just don't how to make QT do this with its break points implementation.
-
There is a section "Adding Breakpoints":http://qt-project.org/doc/qtcreator-3.1/creator-debug-mode.html#adding-breakpoints in the link that Chris Kawa posted.
When you start "Add Breakpoint" dialog select "Function Name" from "Breakpoint type" drop-down box. Enter the function name in the "Function" field.
You may need to enter a module name in the "Advanced" section.
I can not tell you where this function from. I know that it is definitely not from Qt. Maybe some system library, which depends on OS. -
[quote author="kloveridge" date="1401412991"]I know how to do break points. Thats hilarious.[/quote]
Sorry. It sounded like you didn't.
[quote author="kloveridge" date="1401412991"]This is a special breakpoint that uses a symbol called "malloc_error_break". I have a memory problem that this warning gives me instructions how to track it down.[/quote]
What is special about it? Is it a function? an object instance?
[quote author="kloveridge" date="1401412991"]I just don't how to make QT do this with its break points implementation.[/quote]
Qt (btw. QT usually means Apple QuickTime) is a library. It doesn't have "breakpoint implementation". If you mean Qt Creator then it uses whatever debugger you set with a kit so it's no different than any other IDE.So you have a symbol name. If you know where it is defined go there and hit F9 like I said. If you don't then use andreyc's suggestion and it will do the same for you.
-
it turned out this is not just a typical breakpoint. its not a function, its not any of the types in the pulldown for the breakpoints.
I had to go to the Debugger log and type in the command field:
@b malloc_error_break@
Now, withat that said, the break did go off in my application. But the output was so cryptic that I frankly found it useless.
I found my bug, btw. turned out I was memcpy() too many bytes to a buffer I allocated with 'new'