I have an MFC application that I'm attempting to debug and I've enabled all the exception breakpoint options. I get an exception before it executes any of my code. I've put a breakpoint at the earliest point I can get to (InitInstance) and it happens before that.
Error says:
First-chance exception at 0x7c919af2 in HIDCPS.exe:
0xC0000005: Access violation writing location 0x00000010.
I'm not sure how to interpret the stack trace, but it looks to be in the Windows DLLs?
ntdll.dll!7c919af2()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!7c901046()
advapi32.dll!77dd6cf8()
advapi32.dll!77dd6b57()
PGPmapih.dll!0039175f()
kernel32.dll!7c85b44f()
PGPmapih.dll!003937f5()
PGPmapih.dll!0039267b()
PGPmapih.dll!003927ad()
PGPmapih.dll!00392854()
ntdll.dll!7c90118a()
ntdll.dll!7c91b5d2()
ntdll.dll!7c9162db()
ntdll.dll!7c91585f()
ntdll.dll!7c915721()
ntdll.dll!7c91538b()
ntdll.dll!7c9221b6()
ntdll.dll!7c9211e4()
ntdll.dll!7c90e457()
HIDCPS.exe!CODBCFieldInfo::`vector deleting destructor'() + 0x4f bytes C++
74958b84()
This project was imported from VC6 - could I have a conflict somewhere in the CRT libs?
I have an MFC application that I'm attempting to debug and I've enabled all the exception breakpoint options. I get an exception before it executes any of my code.
Not correct.
Your code includes any global and static objects that are created. Obviously, one of your objects is a vector or has a vector as a member.
Code:
HIDCPS.exe!CODBCFieldInfo::`vector deleting destructor'() + 0x4f bytes C++
So your code is being executed -- it has something to do with your global or static data that is being instantiated.
Unless it's actually crashing, you can ignore those messages.
Are you serious? Ignore the access violation that was caught?
You are at least guaranteed that something was NOT written as was expected, and you don't know who caught that exception, and if they recovered from it.
One can set their debugger to break on first-chance exception to track what is going on.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...
Your code includes any global and static objects that are created. Obviously, one of your objects is a vector or has a vector as a member.
Code:
HIDCPS.exe!CODBCFieldInfo::`vector deleting destructor'() + 0x4f bytes C++
So your code is being executed -- it has something to do with your global or static data that is being instantiated.
Regards,
Paul McKenzie
From what I can Google, that CODBCFieldInfo has something to do with CRecordset. There is a global object (a class of mine) that includes CDatabase and CRecordset objects, but the exception occurs well before the constructor of my class.
Is there any way to know from the address in the call stack which of my static or global variables might be causing this? All I get is the disassembly and I don't know how to interpret that.
Are you serious? Ignore the access violation that was caught?
You are at least guaranteed that something was NOT written as was expected, and you don't know who caught that exception, and if they recovered from it.
One can set their debugger to break on first-chance exception to track what is going on.
I said unless the app is crashing, first-chance exceptions can usually be ignored. Yes I'm serious.
You might find some clue in the map file. If it's possible (i.e. not to much work) you can comment that global object and check if the issue still exists. Also check that you don't link explicitly with some VC6 libs.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
From what I can Google, that CODBCFieldInfo has something to do with CRecordset. There is a global object (a class of mine) that includes CDatabase and CRecordset objects,
Please show this class.
but the exception occurs well before the constructor of my class.
How are you able to verify this? We can't verify your claims that the exception occurs before the constructor.
Is there any way to know from the address in the call stack which of my static or global variables might be causing this?
As I said in post #4 above, set your debugger to break when Access Violation exception is thrown.
Go to Debug -> Exceptions… and place a checkmark:
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.