[llvm-dev] Best way to run LLVM to debug optimized binaries

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 12 09:21:26 PDT 2015


On Sep 12, 2015 4:45 AM, "Greg Stark via llvm-dev" <llvm-dev at lists.llvm.org>
wrote:
>
> It seems like I get "<optimized out>" back from gdb when running on
> clang -O2 binaries much more so than with gcc -O2. So much so that I
> think it's not that they're optimized out but that I'm missing some
> key flag to include some key piece of debugging info. I can't believe
> that "t" here is optimized out entirely given that it's one of the
> function parameters and it's a pointer to a complex structure. The
> function is static so it is possible it was inlined but if the assert
> is failing it's hard to see how the structure would be entirely
> optimized out.
>
> #2  0x00000000010ac7c7 in cdissect (v=<optimized out>, t=<optimized
> out>, begin=<optimized out>, end=<optimized out>) at regexec.c:653
> 653 assert(er != REG_NOMATCH || (t->flags & BACKR));
> (gdb) p er
> $1 = <optimized out>
> (gdb) p t
> $2 = <optimized out>
>
> Is there some flag I should be giving to clang to get binaries that
> will perform reasonably fast but still be possible to debug? How can I
> tell why this variable is showing as optimized out?

Sorry answer to all the questions is, unfortunately, 'no'. Optimized debug
info produced by llvm isn't ideal. There's still a lot of work to be done
to make it good and it just hasn't been a priority for any of the
contributors so far.

>
> --
> greg
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150912/bf6e2189/attachment.html>


More information about the llvm-dev mailing list