This is an archive of the discontinued LLVM Phabricator instance.

Record the DWARF version in MCContext
ClosedPublic

Authored by olista01 on Apr 16 2014, 3:44 AM.

Details

Reviewers
dblaikie
echristo
Summary

Record the DWARF version in MCContext, and use it when emitting the dwarf version into the debug info.

Diff Detail

Event Timeline

dblaikie added inline comments.Apr 16 2014, 8:42 AM
test/MC/ELF/gen-dwarf.s
2

I'm assuming this is a no-op for now? (well, other than to exercise the codepath - but adding or removing this flag doesn't change any behavior?)

Or perhaps this test case actually verifies the dwarf version?

Could you add another test case (possibly just a new RUN line on this test case with a different check prefix) to verify that if you pass a different dwarf version it appears in the output?

olista01 updated this revision to Unknown Object (????).Apr 16 2014, 9:16 AM

Expand test/MC/ELF/gen-dwarf.s to check that the correct dwarf version is emitted.

You can use a common prefix for multiple FileChecks like this:

FileCheck --check-prefix=ASM --check-prefix=V2
FileCheck --check-prefix=ASM --check-prefix=V3

ASM: stuff
V2: byte 2
V3: byte 3
ASM: stuff

Which makes the test a bit simpler to read by removing duplication.

olista01 updated this revision to Unknown Object (????).Apr 16 2014, 9:51 AM

Made test clearer by using multiple --check-prefix's

dblaikie added inline comments.Apr 16 2014, 10:02 AM
include/llvm/MC/MCContext.h
151

I'd probably make this a uint16_t (and similarly for the get/set functions) since that's the limit on the output.

tools/llvm-mc/llvm-mc.cpp
409

This error case could use test coverage.

(careful about matching on the program name - the program name in windows will be different (.exe suffix) - usually best just to omit that portion of the error message from the match line)

olista01 updated this revision to Unknown Object (????).Apr 17 2014, 7:48 AM

Changed DwarfVersion to uint16_t, increased test coverage of error cases

dblaikie accepted this revision.Apr 30 2014, 10:49 AM
dblaikie edited edge metadata.
This revision is now accepted and ready to land.Apr 30 2014, 10:49 AM
echristo accepted this revision.Apr 30 2014, 11:05 AM
echristo added a reviewer: echristo.
echristo added a subscriber: echristo.

LGTM. Sorry I missed the original.

olista01 closed this revision.May 1 2014, 1:53 AM

Thanks, committed revision 207739.