I looked some more into this and it turns out that the IntrinsicCleanerPass in KModule.cpp is not the pass that removes the debug info.
One other observation is that klee-gcc runs llvm-ld with optimizations disabled, so this may explain why compiling coreutils with -O3 preserves the debug info I am interested in, but the Klee optimization pass does not. Thus, I am looking for a way to keep the debug info by inserting some code that cannot be optimized. More specifically, I want to preserve the debug info associated with a call to printf . So far I had no luck with inserting additional function calls before the call to printf. Does anyone have suggestions? Thanks, Cristi On Wed, Jul 7, 2010 at 4:13 PM, Cristian Zamfir <cristian.zamfir at epfl.ch> wrote: > Hi, > > I noticed that running Klee with --optimize removes a lot of the debug > info. This did not use to happen when Klee was using LLVM 2.3, so this > might be a consequence of the interactions between optimization passes > and the debug info in LLVM 2.6. I saw some discussions on llvm-dev > about removing debug info for optimized code, I assume this is the > cause. > > However, this only happens when running Klee with --optimize. On the > other hand, if I add -O3 and -O4 to CFLAGS when compiling coreutils > and dissassamble with llvm-dis, the debug info is still there. > > Thus, I have four questions: > > 1. Why is the optimization done by Klee more agressive than llvm-gcc -O3? > > 2. Is it possible to force the optimization passes to leave the debug info in? > > 3. Which optimization pass is likely the culprit for removing the debug info? > > 4. I tried adding some code that I believed would disable the > optimization (e.g., function calls, incrementing volatile variables) > and the debug info is still removed. Is there another way to disable > optimizations for a specific region of the code? Maybe using > llvm.annotation ? > > > Thanks, > Cristi > > On Sun, May 2, 2010 at 10:09 PM, Daniel Dunbar <daniel at zuster.org> wrote: >> Fixed in r102873, thanks for the report! >> >> FWIW, I hope to have a buildbot up real soon now... >> >> ?- Daniel >> >> On Fri, Mar 19, 2010 at 8:54 AM, Cristian Cadar <c.cadar at imperial.ac.uk> >> wrote: >>> >>> Hi Daniel, >>> >>> After pulling these changes, I don't get debug info anymore. ?In particular, >>> WriteCov and StaticDestructor (which rely on debug info) fail. ?I tested >>> this on a Ubuntu x86_64 machine. >>> >>> Thanks, >>> Cristian >>> >>> On 14/03/10 05:36, Daniel Dunbar wrote: >>>> >>>> Hi, >>>> >>>> I just checked in a patch for building KLEE with LLVM 2.7. I have >>>> tested it on Linux x86_32 with LLVM 2.6 and 2.7 and on Darwin x86_32 >>>> and x86_64. I'd appreciate it if someone can test it on Linux x86_64. >>>> >>>> Please let me know of any problems. >>>> >>>> ?- Daniel >>>> _______________________________________________ >>>> klee-dev mailing list >>>> klee-dev at keeda.stanford.edu >>>> http://keeda.Stanford.EDU/mailman/listinfo/klee-dev >>> >> _______________________________________________ >> klee-dev mailing list >> klee-dev at keeda.stanford.edu >> http://keeda.Stanford.EDU/mailman/listinfo/klee-dev >> >
