(Another) Debug VS Release crash - help needed!
-
Okay, I've been struggling with this problem for the best part of a week now. If I don't find a solution soon, my PC's going for a flying lesson :mad: I'm developing an MFC app, in VC++ 6.0 with the latest service patch applied, running on Windows NT. The program works fine in debug mode, but dies a horrible death in debug mode. "The instruction at "0x00918ec3" referenced memory at "0x00002301". The memory could not be "written". Here's what I've tried so far... 1) Message boxes to try and pinpoint where the crash is occurring. After a bit of trial and error, the crash appears to occur sometime after a call in the application part of the code 'MyApp.cpp' : 'if (!ProcessShellCommand(cmdInfo))'. The crash occurs after this call is made, but before it returns. The last part of my own code that is called (as far as I can tell) is 'OnInitialUpdate' which is within the view. Now as far as I can see, it looks like the crash isn't happening in any of my code. No doubt it's somthing I've done, I just can't see where I did it! 2) Having drawn a blank with my usual method of release-mode debugging, I turned to google. I've read most of the debugging tutorials here on codeproject now and thought this might herald an answer, but the crash address doesn't appear to be relevent to either the program itself or any of the .dlls it loads (I used dependancy walker to have a look at what it uses). Their base addresses seem to be in the range 0x5F400000 (MFC42.dll) to 0x780C0000 (MSVCP60.dll) - nowhere near "0x00918ec3"! Have I missed / mis-understood anything obvious? What should I try next? I'd appreciate any suggestions you may have - thanks very much in advance! Success is 99% failure
-
Okay, I've been struggling with this problem for the best part of a week now. If I don't find a solution soon, my PC's going for a flying lesson :mad: I'm developing an MFC app, in VC++ 6.0 with the latest service patch applied, running on Windows NT. The program works fine in debug mode, but dies a horrible death in debug mode. "The instruction at "0x00918ec3" referenced memory at "0x00002301". The memory could not be "written". Here's what I've tried so far... 1) Message boxes to try and pinpoint where the crash is occurring. After a bit of trial and error, the crash appears to occur sometime after a call in the application part of the code 'MyApp.cpp' : 'if (!ProcessShellCommand(cmdInfo))'. The crash occurs after this call is made, but before it returns. The last part of my own code that is called (as far as I can tell) is 'OnInitialUpdate' which is within the view. Now as far as I can see, it looks like the crash isn't happening in any of my code. No doubt it's somthing I've done, I just can't see where I did it! 2) Having drawn a blank with my usual method of release-mode debugging, I turned to google. I've read most of the debugging tutorials here on codeproject now and thought this might herald an answer, but the crash address doesn't appear to be relevent to either the program itself or any of the .dlls it loads (I used dependancy walker to have a look at what it uses). Their base addresses seem to be in the range 0x5F400000 (MFC42.dll) to 0x780C0000 (MSVCP60.dll) - nowhere near "0x00918ec3"! Have I missed / mis-understood anything obvious? What should I try next? I'd appreciate any suggestions you may have - thanks very much in advance! Success is 99% failure
Almost certainly you are overwriting the stack somewhere before you call ProcessShellCommand. If you can't find the mistake by inspection (get someone else's eyes on it) and you don't want to invest in something like BoundsChecker or Purify, you might try a technique I've used in similar situations: Comment out suspect code until the crash goes away, then uncomment some until the crash comes back, and use a binary search to narrow down onto your mistake.
-
Okay, I've been struggling with this problem for the best part of a week now. If I don't find a solution soon, my PC's going for a flying lesson :mad: I'm developing an MFC app, in VC++ 6.0 with the latest service patch applied, running on Windows NT. The program works fine in debug mode, but dies a horrible death in debug mode. "The instruction at "0x00918ec3" referenced memory at "0x00002301". The memory could not be "written". Here's what I've tried so far... 1) Message boxes to try and pinpoint where the crash is occurring. After a bit of trial and error, the crash appears to occur sometime after a call in the application part of the code 'MyApp.cpp' : 'if (!ProcessShellCommand(cmdInfo))'. The crash occurs after this call is made, but before it returns. The last part of my own code that is called (as far as I can tell) is 'OnInitialUpdate' which is within the view. Now as far as I can see, it looks like the crash isn't happening in any of my code. No doubt it's somthing I've done, I just can't see where I did it! 2) Having drawn a blank with my usual method of release-mode debugging, I turned to google. I've read most of the debugging tutorials here on codeproject now and thought this might herald an answer, but the crash address doesn't appear to be relevent to either the program itself or any of the .dlls it loads (I used dependancy walker to have a look at what it uses). Their base addresses seem to be in the range 0x5F400000 (MFC42.dll) to 0x780C0000 (MSVCP60.dll) - nowhere near "0x00918ec3"! Have I missed / mis-understood anything obvious? What should I try next? I'd appreciate any suggestions you may have - thanks very much in advance! Success is 99% failure
You are probably doing some wild write, that is, writing at memory you dont have allocated... Any chance you are writing a single byte too much into a buffer somehwere? When compiling a debug version there is left some extra space at the begining and end of buffers, so you might not notice it there. Try some of the CRT debug functions, they are pretty good at tracking such things... - Anders Money talks, but all mine ever says is "Goodbye!" ShotKeeper, my Photo Album / Organizer Application[^]
-
You are probably doing some wild write, that is, writing at memory you dont have allocated... Any chance you are writing a single byte too much into a buffer somehwere? When compiling a debug version there is left some extra space at the begining and end of buffers, so you might not notice it there. Try some of the CRT debug functions, they are pretty good at tracking such things... - Anders Money talks, but all mine ever says is "Goodbye!" ShotKeeper, my Photo Album / Organizer Application[^]
do you have any commandline parameters set in ide...
greatest thing is to do wot others think you cant
suhredayan@omniquad.commessenger :suhredayan@hotmail.com
-
do you have any commandline parameters set in ide...
greatest thing is to do wot others think you cant
suhredayan@omniquad.commessenger :suhredayan@hotmail.com
-
Okay, I've been struggling with this problem for the best part of a week now. If I don't find a solution soon, my PC's going for a flying lesson :mad: I'm developing an MFC app, in VC++ 6.0 with the latest service patch applied, running on Windows NT. The program works fine in debug mode, but dies a horrible death in debug mode. "The instruction at "0x00918ec3" referenced memory at "0x00002301". The memory could not be "written". Here's what I've tried so far... 1) Message boxes to try and pinpoint where the crash is occurring. After a bit of trial and error, the crash appears to occur sometime after a call in the application part of the code 'MyApp.cpp' : 'if (!ProcessShellCommand(cmdInfo))'. The crash occurs after this call is made, but before it returns. The last part of my own code that is called (as far as I can tell) is 'OnInitialUpdate' which is within the view. Now as far as I can see, it looks like the crash isn't happening in any of my code. No doubt it's somthing I've done, I just can't see where I did it! 2) Having drawn a blank with my usual method of release-mode debugging, I turned to google. I've read most of the debugging tutorials here on codeproject now and thought this might herald an answer, but the crash address doesn't appear to be relevent to either the program itself or any of the .dlls it loads (I used dependancy walker to have a look at what it uses). Their base addresses seem to be in the range 0x5F400000 (MFC42.dll) to 0x780C0000 (MSVCP60.dll) - nowhere near "0x00918ec3"! Have I missed / mis-understood anything obvious? What should I try next? I'd appreciate any suggestions you may have - thanks very much in advance! Success is 99% failure
You can do a release build with debugging information. Single stepping can be 'odd' and the debugger can get confused about variable names (sometimes they have been optimised away, for example) but being able to see the call stack etc can be invaluable. Paul