[cfe-users] Generating debug symbol data for lldb on OSX 10.11

2016-06-02 Thread Ross Inglis via cfe-users

Hi folks.

I'm trying to debug an issue on a browser plugin built on OSX 10.11 with 
clang/llvm
(sorry, I can't seem to get useful versions out - I just installed the 
toolset from Apple).


The plugin build is adapted from a build that functions back to OSX 
10.6. It uses
GNU Makefiles (not XCode).  It has been adapted to clang/llvm simply by 
tweaking the
base makefiles to swap tools: gcc to clang, g++ to clang++ etc.  The 
final shlib in this case

is presently 32-bit (to work under 32-bit browsers).

When I tried to use lldb to debug an issue, I found it had very limited 
abilities. It could
show me function names/addresses, but nothing useful on variables or 
arguments.


I suspect the problem is a lack of debug information in the final 
shlib.  I find that while
objects out of llvm have plenty of DWARF Debug info in them (-g is used 
throughout the
debug build)... the final shared library has no DWARF data at all 
(according to dwarfdump).
This is in spite of the -g option clearly being used in the final link 
(via the clang++ front-end).


(I'm assuming lldb wants DWARF right?)

Can anyone point me at the right options to use to get functional debug 
information
from clang/llvm, though to El-Capitans linker out to lldb?  I'm thinking 
this problem looks like
the linker in use  (as far as I can tell, the old system 'ld') simply 
doesn't understand the
DWARF information - or is it trying to translate DWARF to something 
else? Do I need to
install/use a different linker?  I'd hate to back off  to gcc at this 
point, but I need a

functional debugger.

Thanks in advance for any clues.

Ross.
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] Generating debug symbol data for lldb on OSX 10.11 (Solved)

2016-06-04 Thread Ross Inglis via cfe-users
OK. I was poking around using the '-v' option to 'clang' to try and work 
out which linker was actually
being used. It pointed me at the right toolchain folder, where I found 
the magic command 'dsymutil'.


This looked interesting, especially when I checked out the man page.

So I ran it, and got a huge folder full of output that seems to give 
lldb what it needs.


So for non-Mac types (like me)...

You need to run a post-link step... Simply run 'dsymutil' on the final 
executable (or dylib). It should

build a folder ('bundle' in Mac-speak) with the debug symbol data in it.

I wasn't sure where to put the resulting .dSym folder on the target 
machine, but simply copying

it alongside the binary seems to do the job.

Personally, I'd prefer to keep debug symbol data embedded (less chance 
of mislaying it). But I'm happy

as long as the debugger works!

Ross.
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users