The little app I am currently programming crashes somewhere, and my debugger actualy does not work. So I tried putting some cout << "blop\n"; everywhere in my code to see when it crashes, but it appears that the bugged instruction is executed multiple times before the app crashes.
Is there a way to know what line of code was executed last?
If you are lucky, then the crash has occured inside of an STL container. If that's the case, then try/catch an exception.
For hard-to-reproduce bugs, I like to throw exceptions in places where I think bugs could exist. Then add __FILE__ and __LINE__ to the message of the exception. That will tell me exactly where the issue occurred.
For the poor-man's debugger, instead of writing "blop\n" everywhere, write cout << __FUNCTION__ << std::endl; at the start of every function (this one is MSVC-specific). This will give you an idea of the stack and what functions were called immediately before the crash. Once, you've isolated the function, narrow down to a single line with the __LINE__ macro. Once you've narrowed it down to the line (it doesn't matter how many times that line is called before-hand), start printing local variables to see what the conditions are that are causing the crash. There is some condition, unique to this situation which is causing your problem.