[llvm-dev] [cfe-dev] RFC: CodeView debug info emission in Clang/LLVM

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 3 16:46:35 PST 2015


On Tue, Nov 3, 2015 at 4:37 PM, Zachary Turner <zturner at google.com> wrote:

> On Tue, Nov 3, 2015 at 4:25 PM Dave Bartolomeo <
> Dave.Bartolomeo at microsoft.com> wrote:
>
>> The LLVMCodeView library is definitely independent of the rest of the
>> design questions.
>>
>>
>>
>> As far as testing goes, what would be the conventional LLVM way of
>> testing a library for file format manipulation? A test tool that converts
>> some simple text form into a .obj containing CodeView sections, and
>> comparing with a baseline .obj? Or would the test convert back from the
>> .obj to some kind of text as well, and compare to a text baseline? Is there
>> some other LLVM component that has similar testing requirements that I can
>> use as an example for how to test LLVMCodeView? Note that I’d be adding a
>> CodeView->text dump tool anyway, since that will be pretty much essential
>> for anyone working with CodeView.
>>
>>
>>
>> -Dave
>>
> David Majnemer and David Blaikie (this is seriously like the attack of the
> Daves) probably have some thoughts, but currently there is code in
> llvm-readobj.exe to parse certain types of codeview from object files
> (mostly line table information).
>
> So one idea is to generate some object files that have CV records you know
> about up front, then pass the output of llvm-readobj (which would need to
> be updated to use LLVMCodeView instead of hand-rolled parsing) to FileCheck
> and verify that it matches some pattern.
>

Yep, this would test the dumping behavior - and how we test llvm-dwarfdump.
I assume you have similar checked-in-binary tests for llvm-pdbdump?

How you get output to dump is a bit fuzzy in this case (we don't have much
test coverage like this particular situation) - one way is to create
another textual format (json, etc), read it, generate CV from it, dump it,
FileCheck it, but that's a bit heavyweight.

I'd be inclined to write unit tests if possible - use the CV APIs directly
in a unit test, generate in-memory CV output to feed into the dumper
in-process, if possible (or, if necessary/substantially more convenient,
have the unit test actually write CV output, dump, check)

Hmm, yeah, not perfect, though - how do you check the dumped output?
FileCheck is our usual tool for this & there's, again, probably no great
in-process story for that...

Open to further ideas...

- Nth Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151103/e4eae10c/attachment.html>


More information about the llvm-dev mailing list