> On Mar 30, 2016, at 2:19 PM, Joerg Sonnenberger via cfe-commits > <cfe-commits@lists.llvm.org> wrote: > > On Wed, Mar 30, 2016 at 10:54:32AM -0700, Adrian Prantl via cfe-commits wrote: >>> Let's take a kernel as example. I want to include certain types for >>> dtrace-like use with /dev/kmem, but not all the 100KB+ of boring types. >>> Enough for doing some basic post-mortem debugging even on embedded >>> systems. >> >> If I understand this correctly, you want to pass a list of “interesting” >> types to clang that are guaranteed to make it into the debug info? >> At the moment this is not directly possible. What you could do is >> collect all the interesting types in a header file and then build a >> Clang module (using -gmodules) from that header. The resulting .pcm >> will be and object file that has DWARF for all types in the module. > > Oh, the "makes it into the debug info" is likely the easy part. Your > patch does that :) The real question is whether there is a tool to > *reduce* the set of defined types based on a whitelist. E.g. I want to > have a new file with the DWARF definitions for "struct stat" and all > types used by that, but nothing more. That's a lot of nasty source > processing to emulate by hand, so I was curious if someone had written a > tool for that already.
This is how I would do this: 1) Produce a preprocessed source file that includes the struct. 2) Write a shell script that compiles the source clang -o - | llvm-dwarfdump - | FileCheck checking for the struct. 3) Reduce the preprocessed source using delta [1] and your shell script. -- adrian [1] http://delta.tigris.org _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits