How to trace an unhandled exception in C++ using Visual Studio 2017
-
I am currently working on fixing a project for a client. A little information about the project first: 1. Originally developed in Visual Studio 2012 using xp_v110 build tools 2. Multiple projects in the solution 3. Currently updating/debugging in Visual Studio 2017 using VS 2015/xp_v140 build tools 4. Working on Windows 10 The application will run in debug mode, however if I just leave the application after starting the debug session (i.e. not opening/clicking on the application to open it as it starts minimized in the tray), the application crashes after 1-2 minutes. Unfortunately the IDE is showing that the crash is taking place in chkstk.asm with the following message: Exception thrown at 0x0064EDF9 in <>: 0xC00000FD: Stack overflow (parameters 0x00000000, 0x000A2000). I have updated the exception settings to break when all C++ Exceptions are thrown, checked the box that says "Break when this exception type is thrown", and wrapped the initial method that runs in a try block, however I can never catch the error in the C++ code; it always occurs in the chkstk.asm file. Any suggestions on how I can find out where in the C++ code the exception is occurring. Like I said, this is an update for a client and the original programmer is not available, and they never commented their code, so it is difficult enough trying to go through all this. Any help/suggestions would be greatly appreciated. Thanks in advance.
A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.
-
I am currently working on fixing a project for a client. A little information about the project first: 1. Originally developed in Visual Studio 2012 using xp_v110 build tools 2. Multiple projects in the solution 3. Currently updating/debugging in Visual Studio 2017 using VS 2015/xp_v140 build tools 4. Working on Windows 10 The application will run in debug mode, however if I just leave the application after starting the debug session (i.e. not opening/clicking on the application to open it as it starts minimized in the tray), the application crashes after 1-2 minutes. Unfortunately the IDE is showing that the crash is taking place in chkstk.asm with the following message: Exception thrown at 0x0064EDF9 in <>: 0xC00000FD: Stack overflow (parameters 0x00000000, 0x000A2000). I have updated the exception settings to break when all C++ Exceptions are thrown, checked the box that says "Break when this exception type is thrown", and wrapped the initial method that runs in a try block, however I can never catch the error in the C++ code; it always occurs in the chkstk.asm file. Any suggestions on how I can find out where in the C++ code the exception is occurring. Like I said, this is an update for a client and the original programmer is not available, and they never commented their code, so it is difficult enough trying to go through all this. Any help/suggestions would be greatly appreciated. Thanks in advance.
A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.
-
I am currently working on fixing a project for a client. A little information about the project first: 1. Originally developed in Visual Studio 2012 using xp_v110 build tools 2. Multiple projects in the solution 3. Currently updating/debugging in Visual Studio 2017 using VS 2015/xp_v140 build tools 4. Working on Windows 10 The application will run in debug mode, however if I just leave the application after starting the debug session (i.e. not opening/clicking on the application to open it as it starts minimized in the tray), the application crashes after 1-2 minutes. Unfortunately the IDE is showing that the crash is taking place in chkstk.asm with the following message: Exception thrown at 0x0064EDF9 in <>: 0xC00000FD: Stack overflow (parameters 0x00000000, 0x000A2000). I have updated the exception settings to break when all C++ Exceptions are thrown, checked the box that says "Break when this exception type is thrown", and wrapped the initial method that runs in a try block, however I can never catch the error in the C++ code; it always occurs in the chkstk.asm file. Any suggestions on how I can find out where in the C++ code the exception is occurring. Like I said, this is an update for a client and the original programmer is not available, and they never commented their code, so it is difficult enough trying to go through all this. Any help/suggestions would be greatly appreciated. Thanks in advance.
A black hole is where God tried to divide by zero. There are 10 kinds of people in the world; those who understand binary and those who don't.
I suggest you launch the app in the debugger and then wait for ~20 seconds then break into the debugger. Most likely you'll see the a deep stack as it's in the midst of eating up stack space. That callstack should lead you to the issue.
-
You need to get the stack trace at the time of the crash and walk back through it to find out who is using all the stack space.
You should make small memory dump using windows task manager. If you have application .pdb files and source files you can load windows dump file with Visual studio and debug it as managed code. If there are symbols debugging files (pdb) you can see thread`s stack in appropriate state.
-
You should make small memory dump using windows task manager. If you have application .pdb files and source files you can load windows dump file with Visual studio and debug it as managed code. If there are symbols debugging files (pdb) you can see thread`s stack in appropriate state.