DWARF validation?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

DWARF validation?

Talin-3
When developing an LLVM-based frontend, is there a way to automatically verify that the DWARF metadata being emitted is correct? Specifically, I'd like to be able to write some sort of unit test that will fail if the DWARF is invalid. I don't just want to test whether the LLVM metadata statements are well-formed - if I make a change that will cause lldb or gdb to barf, I would like to have at least a 50% chance to catch this beforehand. I can't really run the debugger in a unit test, and even if I could the resulting error message is likely to be poor. This means that the validator would have to incorporate knowledge of the DWARF standard. Is there such a thing?

Trying to ensure that DWARF is correct is one of the reasons why I abandoned my earlier LLVM project a few years ago, it was simply too hard then. I'm just wondering if the situation has improved in the last several years.

--
-- Talin

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: DWARF validation?

David Blaikie


On Thu, Mar 12, 2015 at 1:06 PM, Talin <[hidden email]> wrote:
When developing an LLVM-based frontend, is there a way to automatically verify that the DWARF metadata being emitted is correct? Specifically, I'd like to be able to write some sort of unit test that will fail if the DWARF is invalid. I don't just want to test whether the LLVM metadata statements are well-formed - if I make a change that will cause lldb or gdb to barf, I would like to have at least a 50% chance to catch this beforehand. I can't really run the debugger in a unit test, and even if I could the resulting error message is likely to be poor. This means that the validator would have to incorporate knowledge of the DWARF standard. Is there such a thing?

Trying to ensure that DWARF is correct is one of the reasons why I abandoned my earlier LLVM project a few years ago, it was simply too hard then. I'm just wondering if the situation has improved in the last several years.

Not substantially, that I know of - you can verify the debug info metadata itself (there's a DebugInfoVerifier - I forget what flag you need to pass to run it) & it'll warn and drop the metadata if it's ill-formed, but that doesn't guarantee that a debugger will like what LLVM generates from that metadata.

We have a buildbot that runs GDB's test suite against Clang to verify that the debug info provided is usefully debuggable.

- David
 


--
-- Talin

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: DWARF validation?

Robinson, Paul-3

There's an open-source "dwarfdump" tool that I believe has a "check" mode of some kind, which will tell you about malformed DWARF.

http://www.prevanders.net/dwarf.html

This is a "syntactic" check, it doesn't tell you whether you've described the input source code correctly. J

--paulr

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of David Blaikie
Sent: Thursday, March 12, 2015 1:19 PM
To: Talin
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] DWARF validation?

 

 

 

On Thu, Mar 12, 2015 at 1:06 PM, Talin <[hidden email]> wrote:

When developing an LLVM-based frontend, is there a way to automatically verify that the DWARF metadata being emitted is correct? Specifically, I'd like to be able to write some sort of unit test that will fail if the DWARF is invalid. I don't just want to test whether the LLVM metadata statements are well-formed - if I make a change that will cause lldb or gdb to barf, I would like to have at least a 50% chance to catch this beforehand. I can't really run the debugger in a unit test, and even if I could the resulting error message is likely to be poor. This means that the validator would have to incorporate knowledge of the DWARF standard. Is there such a thing?

 

Trying to ensure that DWARF is correct is one of the reasons why I abandoned my earlier LLVM project a few years ago, it was simply too hard then. I'm just wondering if the situation has improved in the last several years.


Not substantially, that I know of - you can verify the debug info metadata itself (there's a DebugInfoVerifier - I forget what flag you need to pass to run it) & it'll warn and drop the metadata if it's ill-formed, but that doesn't guarantee that a debugger will like what LLVM generates from that metadata.

We have a buildbot that runs GDB's test suite against Clang to verify that the debug info provided is usefully debuggable.

- David
 


 

--

-- Talin


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

 


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: DWARF validation?

Adrian Prantl
In reply to this post by Talin-3

> On Mar 12, 2015, at 1:06 PM, Talin <[hidden email]> wrote:
>
> When developing an LLVM-based frontend, is there a way to automatically verify that the DWARF metadata being emitted is correct? Specifically, I'd like to be able to write some sort of unit test that will fail if the DWARF is invalid. I don't just want to test whether the LLVM metadata statements are well-formed - if I make a change that will cause lldb or gdb to barf, I would like to have at least a 50% chance to catch this beforehand. I can't really run the debugger in a unit test, and even if I could the resulting error message is likely to be poor. This means that the validator would have to incorporate knowledge of the DWARF standard. Is there such a thing?
>
> Trying to ensure that DWARF is correct is one of the reasons why I abandoned my earlier LLVM project a few years ago, it was simply too hard then. I'm just wondering if the situation has improved in the last several years.

The dwarfdump utility in MacOS X has a --verify mode. We are planning to add similar functionality to llvm-dwarfdump soon-ish.

-- adrian


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev