Thank You. As of now we are reporting the issues to the owners of the library and they are fixing and providing the fixes in their next release. But i cannot hold my work till their fix. Some how i need to proceed by excluding those exceptions in my code. Is it possible by any chance or any technique to skip those crashes and handling them in my code?
You can add generic Catch block in your code for function which is calling that third party APIs and in catch you do nothing.But its just to avoid your application from getting crash, ideally you should not do it as it makes no sense.
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 <<exe name="">>: 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.
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.
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.
It appears to use some third party library (curl ?) to obtain text input, find the first token and convert its text to an integer, which it then returns to the caller. I would suggest getting the documentation for the library and studying that.
I don't know Polish so that it is really hard to retrace the code.
But you missed some points:
There are two versions of info headers with different sizes which can be identified using the biSize member: BITMAPINFOHEADER and BITMAPV5HEADER
When biCompression is BI_BITFIELDS, these bitfields are stored after the info header.
Your code supports only 24-bit RGB bitmaps. So you should check if the file is in that format (biBitCount == 24).
You can read the pixel data from file offset bfOffBits with size biSizeImage which includes the padding bytes. But your code starts reading after the info header which is the location of the bitfields table or still within a BITMAPV5HEADER.
fread() returns the number of successfully read items which is the same as the third function parameter when reading was successful. So the while loop continues to be executed while reading is successful.
stricmp() returns zero when the passed strings are identical. So the if block is executed when the passed strings are identical.
The first two lines are updating angle by a fraction of turnSpeed. If speed were == maxSpeed then speed/maxSpeed = 1. So angle += turnSpeed for a right-turn. turnSpeed = 0.08 so that's in Radians which is 4.58 degrees. This means if you're turning right or left at max speed, it'll add or remove 4.58 degrees each time through. If speed is less than the max, then the angle will change by a smaller amount (a fraction of .08 radians). Try it in the debugger and see the change.
The last two lines are updating the x,y location of the car using it's orientation (angle). cos(angle) is typically the x portion of an angle so I'm not sure why it modifies the y coor with that but that's what it does. sin(angle) or cos(angle) produces a value from 0-1 (which it uses as a percentage) * speed. That means x or y changes by a fraction of speed in the direction of angle.
It would probably help you to print out the values or use the debugger.