How can I see where my program crashes in a given file? - c++

My problem is that when I debug my modification on a c++ project (it is very huge) and when the program crashes, the visual studio shows me another cpp file where the program crashes. I know it shows me that because it is related to it, but I need the root where the crash started to I can fix my code. I have tried doing "step out" SHIFT + F11, not worked. So how can I make the debugger strict to my file ?
I know this question is gonna be underrated, but I can only explain this way.

Related

Strange behavior of Eclipse Neon

I use Eclipse with CDT plugin for my C/C++ development. And I use MinGW compiler. Environment Path set properly. All the setting done properly in Eclipse. While editing the source code its working fine but after compilation when I try to execute the source code sometimes it says it cannot open the .exe file or sometimes doesn't show anything when there is some input to take. When I stop the execution pressing the red button program gets executed completely with default values.
But everything is fine if I compile and run the same source code using notepad and the command prompt. Please help.
A common problem is that if the program is currently executing, the program file is opened by the system and cannot be reopened for writing by the compiler (or more exactly by the linker). This problem can be easily reproduced by starting the program in debug mode and stop it at a breakpoint. Then, while the process is active, change a line in source and ask for a new build: you will get the error saying that the exe file cannot be opened.
How to fix: ensure to close any possible execution of the program when the error happens and rebuild

How to ignore breakpoints in DLLs in Visual Studio

I'm using a 3rd party dll with no source code available. It runs perfectly fine, but every time I run my program, an annoying pop-up says "MyProgram.exe has triggered a breakpoint".
If I press continue, my program runs 100% correctly.
If I press break, I can see that the breakpoint is occurring in the 3rd party file alp41basic.dll
I have no clue why they put breakpoints in their dll. How can I disable them?
My question is identical to one that went unanswered:
https://stackoverflow.com/questions/17514072/is-there-a-way-to-make-visual-studio-continue-when-an-exception-occurs-on-a-line
I eventually checked in with the company that distributed the dll, and indeed there are breakpoints in there for reasons that I won't get into. However, if I run the program outside the debugger (even simply open the binary from windows), these popup windows do not occur.
Thank you all for your help!

strange Debugging Error: possible memory corruption?

I've got a strange problem:
I use eclipse and have written a program which is quite long. Now if I compile "Debug" (so no compiler optimization) and click "Run" then everything is finde and my Program produces the expected output.
Now If I compile "Release" the program does not terminate but instead "stops" at one point...
So I've started Debugging with the dgb Debugger build into eclipse and clicked through the program. And if I let it just run through everything is fine, but If I click through every single line of code then the program "stops" at some other point.
Now I've gone one step further and clicked not only through every line but stepped into each function.
What I found very strange is that in depence on HOW I step through my program with the debugger I get the error at different positions. So I think the stopping of the debugger is related to eclipse which cannot show something in the debugger-window or so.
Additionally the error critically depends on other lines of code.
So my best guess is that the error is related to some memory problem.
Thank you very much!

Visual Studio 2012 Release only error

There are a number of errors going on here but I'm sure they are all linked, so first off I'm getting Access violation reading location exceptions at locations (generally near 0x00000000)
but I only get these exceptions in release and not in debug, even if i setup debugging to do so. Also I found where the error happens but when I step over that it goes in to a complete unrelated function that is not called in the line or in any of the functions in that line of code. But when similar code is called it still goes to this unrelated function but doesn't fail. This all only happens in release versions. I know which piece of code is causing the error as if I comment it out its all fine. Also in the watch window in release all the numbers are wrong most of the time, which has never been a problem but it could help also a added some code to it to output the values of variables to a file and the variables are all fine, the pointers are sensible, but when the exception happens it always says their 0x00000020 but when I look at the log they are fine. This is in 32 bit , but on 64 bit windows 7 in c++. Please any help would be good!
Visual Studio's debugger will cause the program to use a debug heap that can hide uninitialized memory if you use the option "Start with Debugging" to start your program, in release or debug. You can try to run your program built in the Debug configuration without the debugger attached, and then use the Attach to Process... option in the debug menu to attach to your executable.
If this doesn't help, I recommend using windbg to debug your program. For help getting started with windbg, take a look at the answers on this question.
Once windbg is configured and symbol paths are set up, you can use the "!analyze -v" option once the program crashes to get a lot of information about the crash automatically.

debugging openCV in visual studio 2005

I am new to Visual Studio 2005 and am trying to get to grips with it. I am using it to compile and debug an application called AAM-library (which I didn't write) which uses OpenCV 1.0. I have compiled the software and now I'm getting a runtime error.
To figure out the reason for the error (I know the line number and file name that generates the error, since the runtime error tells me) I want to step through the code in the few lines before the error. The error is in an openCV file called opencv/cv/src/cvshapedescr.cpp. To debug I have figured out that I can step through from the start of the program using F11 or F10 but this is taking forever to reach the error. Is there a way to get straight to the error? I'm trying to put a breakpoint in the openCV file, but this is not part of the workspace that I am working on, and so it doesn't seem to be having an effect.
Place a breakpoint a few lines before the error or use run to cursor. There is no magical "10 lines before this breakpoint" feature. (Intellitrace can do this for managed code but that's a whole different ballgame)
Also note that concurrent debugging was made a LOT better in VC2008, you might want to consider using a more recent compiler, such as VC2008 or VC2010.