Hi,
I'm having an STL code, in which the STL throws an exception I didn't catch (I didn't catch it on purpose, since this exceptions means bugs in my code. The exception is vector.at getting wrong index). I want, just like in Java, to see who (which line) threw the exception. I found no way to do that with mingw (I heard one should put a breakpoint at '__raise_exception', and then have a look at the stack with bt, but Mingw say no such function exists.
Is there any way to do that? Knowing who threw the exception, really helps with debugging. If it was me who threw the exception I could incorporate a __LINE__ macro that would tell me who threw it, but it's STL, and I can't (and don't want) to change it.
Well, Java is compiled to bytecode, which lets it keep more data about the original source than native exes. I don't think there's any way to know which line throws an exception. Specially since the exception comes from a different function that has no idea what function is calling it from which line.
The way you could use __LINE__ is by catching the exception and displaying the line somewhere.
You could use a debugger. It holds stack trace information, which is very helpful in these cases.
Yeah. Change the STL. That sounds like a good idea right there.
Zaita:
Thanks!
But which debugger does that? gdb didn't do that for me automatically, and I don't know how to tell him to do that. I don't think VS 6 do that automatically also.
Can you guide me with what to do to have the debugger do that?