If I generate an exception on my own, I can include any info into the exception: a number of code line and name of source file. Something like this:
throw std::exception('myFile.cpp:255');
But what’s with unhandled exceptions or with exceptions that were not generated by me?
It seems everyone is trying to improve your code to throw exceptions in your code, and no one is attempting the actual question you asked.
Which is because it can’t be done. If the code that’s throwing the exception is only presented in binary form (e.g. in a LIB or DLL file), then the line number is gone, and there’s no way to connect the object to to a line in the source code.