I have some questions regarding debugging symbols and what can be done with them, besides, well, debugging. I'm mostly interested in answers regarding GCC, but I'd also be happy to know how it looks like under other compilers, including MSVC.
First of all:
- What are the common formats/types of debugging symbols?
- How do they relate to compilers and platforms? Is it always the same format on GCC and MinGW among platforms?
- Can I check in runtime whether the build has them and what format are they in?
And some more practical questions... How can I:
- Check the current file and line number?
- Obtain the (qualified) function name being executed?
- Obtain a full current stack trace?
Let me emphasize that I'm talking about run-time checks. All of those can be read and pretty-printed by GDB, but I don't know how much info comes from the debugging symbols themselves and how much from the source code which GDB also has access to.
Maybe there's a library which is able to parse the debugging symbols and yield such information?
Are the debugging symbols standardised well enough that I can expect some degree of portability for such solutions?