app throws exception before winmain
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?
Or any other comments, would be welcome.
Thanks.
Re: app throws exception before winmain
Unless it's actually crashing, you can ignore those messages.
Re: app throws exception before winmain
Quote:
Originally Posted by
Dave C
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.
Regards,
Paul McKenzie
Re: app throws exception before winmain
Quote:
Originally Posted by
GCDEF
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.
Re: app throws exception before winmain
Quote:
Originally Posted by
Paul McKenzie
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.
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.
Thanks
Re: app throws exception before winmain
Quote:
Originally Posted by
VladimirF
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.
http://blogs.msdn.com/b/davidklinems...12/438061.aspx
Does a first chance exception mean there is a problem in my code?
First chance exception messages most often do not mean there is a problem in the code.
Re: app throws exception before winmain
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.
Re: app throws exception before winmain
Quote:
Originally Posted by
Dave C
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.
Quote:
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.
Regards,
Paul McKenzie
1 Attachment(s)
Re: app throws exception before winmain
Quote:
Originally Posted by
Dave C
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: