Professor Chaos
Professor Chaos

Reputation: 9060

app.exe has triggered a break point, followed by Access violation writing location

I have a Qt c++ application with a huge code base. I'm kinda familiar with the architecture but I don't know much of the code. Every time the application is closed, it shows the message "app.exe has triggered a break point" and if I hit continue, I get

"Unhandled exception at 0x6701c95d (QtCored4.dll) in app.exe: 0xC0000005: Access violation writing location 0x0c3e9fd8."

with a stack trace looking like this

enter image description here

I have App Verifier hooked up and it dumps this in the output window

===========================================================
VERIFIER STOP 0000000000000013: pid 0x2654: first chance access violation for current stack trace 

    000000000C3E9FD8 : Invalid address being accessed
    000000006701C95D : Code performing invalid access
    000000000008EB40 : Exception record. Use .exr to display it.
    000000000008E650 : Context record. Use .cxr to display it.
===========================================================
This verifier stop is continuable. 
After debugging it use `go' to continue.
===========================================================

My question is, how would one go about trying to debug to find out what's causing this issue? I don't have much experience in the unmanaged programming world and I'm completely lost. Any help would be much appreciated.

Upvotes: 1

Views: 7152

Answers (2)

the_mandrill
the_mandrill

Reputation: 30832

Chances are you've either got some memory corruption caused by something like a buffer overflow, or a double deletion of a dangling pointer. This sort of thing can happen when calling Qt code if you don't realise that the QObject's parent takes ownership of it, as Bart notes. You are already using App Verifier, but I would also try running gflags from the Debugging Tools for Windows and enable Page Heap debugging as that may help localise the problem.

Upvotes: 2

EdChum
EdChum

Reputation: 393923

You have the debugger attached and it is showing the call stack, you should be able to inspect the variable values as you walk up the stack and see if any of your variables are in a correct state.

The crash here is because you an invalid pointer that you are trying to access/dereference.

Do you have the source code? If so then this should be relatively simple as it looks like you have the full pdbs for QT as it is showing correctly resolved symbols and line numbers.

You could also try WinDbg but this is a very advanced debugger that will take you time to learn.

I think the fact you already have the debugger attached and it is already showing you so much useful information that you should look at the memory window/locals/autos and inspect the variables values, it is likely that one of these pointers will be null or uninitialised.

Looking at the call stack I would look at the QCursor object and if your debugging session is live then hovering the cursor over the object will probably give some popup window that will show its current value, it is likely the value or address is null or invalid.

Upvotes: 1

Related Questions