I want to write a tool that is designed to convert debug symbols of one format to another format compatible for use in GDB. This seems like a tedious and potentially complex project, so I'm not quite sure how to solve it.
Inside, I'm going to convert the Turbo Debug Symbol (TDS) table emitted from Borland compilers to something like stabs or dwarf (it seems the dwarf prefers my research). But ideally, I want my tool to be simple enough to extend it, so that later it can convert other formats. for example codeview4 or even pdb.
My main motivation for creating this is:
- Interoperability If I can convert the external debugging format to a form, then gdb can work, then source level debugging will be possible in binaries compiled from another compiler other than gcc. This means that any debugging interface that uses gdb as a backend will also work.
- No other tools exist. I was looking for searches for similar tools, and the closest I found tds2dbg . But this is not quite what I am looking for.
What should I work with at the moment:
- I already have a debug debugging API that can understand the TDS debugging format. I can use this to help me get the necessary information from the source format from which I am converting.
- As part of this project, I am interested in working in a win32 environment. Other platforms and tools that I don’t really care about.
- The debug format of the target dwarf to which I am converting. I don’t know this at all. I used gcc ported compilers like MinGW before and debugged them using gdb with dwarf format. But I do not know how this format is implemented in Windows.
The last thing I'm worried about. I read the dwarf spec documentation, but I find that I have problems understanding and understanding how this works. There are so many details, but at the same time it has no details about how the dwarf is implemented in object files and image files on a platform that does not use ELF initially - namely, the PE-COFF format, which uses windows, Documentation also very dry, long sentences make it difficult to understand, and diagrams and illustrations are sparse. I came across an API called libDwarf , which should do most of the parsing of the dwarf interpretation. The problem is that I'm still trying to create it, and I don’t know yet how it will turn out.
I have not written any code yet, as I do not quite understand what I need to build. I have a feeling that the biggest blow will determine how to work with the dwarf because of its complexity. Googling did not help for information on how the dwarf works under the windows. For example, there is no information about the glue code that the dwarf must contain in the PE executable file. How clearly are dwarf sections drawn? Is there heading information for each section? GDB obviously doesn’t just take the “raw” dwarf debugging file and use it as is. So, what gdb format does the debug file expect so that it can work with it?
My question is: how can I start with such a project? More importantly, where can I go for help when I inevitably get up to a problem?
source share