Renato, On Mar 17, 2011, at 2:00 PM, Renato Golin wrote:> On 17 March 2011 18:45, Devang Patel <dpatel at apple.com> wrote: >> Yes, It'd be good to have a setup to build SingleSource and MultiSource tests with debug info and run dwarfdump --verify on them. > > I tried some dwarfdump on a few examples I had and the comparison with > codesourcery's gcc is impossible, the resulting Dwarf is very > different.I did not mean comparing dwarfdump output. It is never going to work. Sorry for the confusion. I meant letting dwarfdump verify the structure of dwarf info.> For instance, GCC declares the types at the beginning of the tree > while LLVM only does when needed (metadata-style). The relocation > sections in GCC are huge and they also use debug_loc in many more > cases than LLVM, for instance extern functions, global variables and > the cases I mentioned in my example before. Of course, Dwarf produced > by Armcc is also different (though, closer to what GCC does, for > obvious reasons).You'll find that dwarf produced by llvm-gcc and clang is also different (even from the days when clang used DIFactory). And guess what clang generate DIE (Debug Info Entries) ordering is likely to change again in near future!> One way we could do this, slowly and painfully, but surely, is to > generate Dwarf, use the debugger to make sure that Dwarf actually > produces what GDB is expecting (you probably have many cases already) > and take a snapshot of that Dwarf. Once we understand how that Dwarf > works and what are the required tags, we create a dwarfdump test that > will FileCheck on those.Instead, isn't it easier and straight forward to do a FileCheck on debugger output in the first place ? - Devang
On 17 March 2011 21:54, Devang Patel <dpatel at apple.com> wrote:> I did not mean comparing dwarfdump output. It is never going to work. Sorry for the confusion. I meant letting dwarfdump verify the structure of dwarf info.Yes, using dwarfdump to verify is fine, but producing correct Dwarf is not the same as producing THE correct Dwarf you need. You still need some way of grepping for the symbols you want to have generated, or the test is not testing for the right thing. You could have regressions and not break the dwarf, but break what the dwarf represents.> Instead, isn't it easier and straight forward to do a FileCheck on debugger output in the first place ?Oh, but that is only one level of testing, and it doesn't guarantee your generating correct Dwarf, just "gdb compatible" Dwarf. I'm doing all three levels (IR, Dwarf and gdb) and it's much easier to see it fail in the IR level, or even Dwarf than to debug problems using gdb output. But I need some better validation for both IR and Dwarf. One way of testing without comparing IR and Dwarf would be to have several tests, ALL of them validating with dwarfdump AND stepping through with gdb and testing every single detail in them. That way, you assure that the Dwarf generated is gdb compatible and avoid regressions in that area. If all you care is gdb compatibility, then you're safe. But when you have a regression, you'll have two major problems: 1. You won't know where the regression started. There could have been multiple regressions and only the last one caused validation/gdb to fail, and the last one could even be an unrelated commit that changes ELF sections layout, for instance. 2. Even if there was only one regression, finding the bug would be tiresome. You won't have a "good version" of the IR or the Dwarf to compare and see what went wrong. Someone not used to Dwarf would take a long time to figure out what went wrong and how to fix it. Depends on the level of compatibility you want... -- cheers, --renato http://systemcall.org/ Reclaim your digital rights, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm
On Mar 18, 2011, at 2:25 AM, Renato Golin wrote:>> Instead, isn't it easier and straight forward to do a FileCheck on debugger output in the first place ? > > Oh, but that is only one level of testing, and it doesn't guarantee > your generating correct Dwarf, just "gdb compatible" Dwarf. > > I'm doing all three levels (IR, Dwarf and gdb) and it's much easier to > see it fail in the IR level, or even Dwarf than to debug problems > using gdb output. > > But I need some better validation for both IR and Dwarf. >We have setup to test all these three levels you mention above. All you need is several thousands tests. Do you think that it will show up magically one day ? - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110318/3eb9f3e7/attachment.html>