This is an archive of the discontinued LLVM Phabricator instance.

Add support for CodeView debug information
Needs ReviewPublic

Authored by Kai on Dec 4 2012, 9:23 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

I started to work on support for emitting CodeView debug information.

In order to support other debug information I extracted the used interface of the DwarfDebug class into an abstract class. After that I changed the AsmPrinter class to use the new interface. (Patch 0001)

The next step is to enumerate all debug information types. The boolean variable SupportsDebugInformation is replaced by DebugInformationType which is based on an enumeration. (Patch 0002)

During development I noticed that there is no possibility to get the return type from DISubprogramm if the return type is modelled as DIType. Because I need this functionality I added the support. (Patch 0003)
(BTW: Does DISubprogram.Verify check the right thing in case the return
type is modelled as DIType?)

Finally I created the classes needed for CodeView debug symbol output. This is really work-in-progress and is not ready yet. Nevertheless it can output type information for simply signatures like int add(int,int). It is a proof of concept that the interface is working. (Patch 0004)

I like to get review and comments on patches 0001-0003. Is my approach
ok? If yes then I like to get these patches committed so that further
updates to debug related classes can consider the new interface.

Thank you very much!

Diff Detail

Event Timeline

Thank you for working on it!

With my quick build, I found some issues.

  1. I would like you to check also on non-windows hosts, Linux or Darwin. clang-3.2rc is better.
  2. This breaks a few codegen/x86 tests on mingw and dozen of tests in llvm and clang on msvc.

You should not break any tests, or you should update tests with clear reason.

Ok, you would know, TESTCASE please!

I suggest you might begin to write dump utility for this. Then...

    1. Verify your new utility with well-known files, for example, cl.exe generated. (I have not tried non-pdb debug, though)
    2. (Additional) Add tests for the utility to confirm minimal requirements.
    3. Add tests for the debug infos with the utility.
  1. It seems this patch would be ignorant of endianness.

I think, for now, we could go as far as you add comments, FIXMEs or W-I-P.

FYI, clang reports warnings like as below;

include/llvm/Support/CodeView.h
417

warning: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]

463

warning: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]

569

(g++-4.4 -pedantic) warning: ISO C++ forbids zero-size array ‘data’

578

(g++-4.4 -pedantic) warning: ISO C++ forbids zero-size array ‘offset’

605

5 of types clashes against each member. g++-4.4, I am using, cannot accept them.

  1. Sink them into a namespace.
  2. Mangle each of them, for example, Arglist_V2_t.
lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
132

Don't use cbegin() and cend. LLVM doesn't require C++11.

145

Ditto.

169

warning: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]

550

Please fix it in next time ;)

lib/CodeGen/AsmPrinter/CodeViewDebug.h
66

warning: field 'NextIndex' will be initialized after field 'TypesString' [-Wreorder]