cmake doesn't build libLTO with debug info

cmake+ninja doesn’t build libLTO with debug info (at least, not on OS X
Mavericks). I expect this applies to our cmake setup generally, although
I’ve only tested cmake+ninja. A workaround is to manually run dsymutil
on libLTO.dylib before starting a debug session.

There appear to be a couple [1] of [2] open PRs about related problems
when building debug shared libraries with cmake.

Are there any cmake hackers around that know how to fix this? Should I
file a separate PR?

[1]: http://llvm.org/bugs/show_bug.cgi?id=13465
[2]: http://llvm.org/bugs/show_bug.cgi?id=15242

+llvmdev

Thanks for the reply Nick.

Either libLTO was build with debug info or it was not, running dysmutil does not change that.

Right; my language wasn’t precise.

For daily development, you don’t need dsymutil. lldb also looks for debug notes and finds the original .o files and loads the debug info as needed.

Maybe, you moved libLTO to a different machine, or maybe you moved/deleted your .o files before trying to debug, or maybe this is some weird C++ debug info issue??

I was debugging libLTO.dylib, which I hadn’t done since I switched from
configure to cmake. I didn’t get any symbols in lldb until I ran
dsymutil and loaded them manually. Last time I debugged libLTO.dylib
(with configure+make), I hadn’t had to run dsymutil.

However, I’ve just tried to reproduce the problem on a trivial test case
and it’s gone. I can’t remember what my environment was at the time,
but it looks like user error, or at least unrelated to cmake!