LLDB only works for project contains one go source file

190 views
Skip to first unread message

Leopold Freeman

unread,
Oct 26, 2016, 7:20:01 AM10/26/16
to golang-nuts
Hi:
    I upgraded my MBP to macOS Sierra, and gdb was broke because Apple tightened security policy. So I compiled LLDB from trunk according to here and here. Here are the steps:

cd llvm/tools
svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
> cd clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk clang-tools-extra
> cd ../../../projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx
svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi
svn co http://llvm.org/svn/llvm-project/libunwind/trunk libunwind
svn co http://llvm.org/svn/llvm-project/lld/trunk lld
> cd .. && mkdir build && cd build
cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"/llvm-"$1" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_DOXYGEN=Off -DLLVM_ENABLE_SPHINX=Off

The lldb I compiled only works for simple project contains one go source file. If the project contains many go files (go build with -gcflags "-N -l"), the outputs of lldb were all assembly codes:

> lldb ./bin/debug/xkcd 

(lldb) target create "./bin/debug/xkcd"

Current executable set to './bin/debug/xkcd' (x86_64).

(lldb) b main.main

Breakpoint 1: where = xkcd`main.main + 77 at xkcd.go:16, address = 0x000000000000208d

(lldb) r

Process 38114 launched: './bin/debug/xkcd' (x86_64)

Process 38114 stopped

* thread #6: tid = 0x0001, 0x000000000000208d libenergytrace.dylib, stop reason = breakpoint 1.1

    frame #0: 0x000000000000208d libenergytrace.dylib

->  0x208d: callq  0x5d4a0

    0x2092: movq   0x366ccf(%rip), %rax

    0x2099: jmp    0x209b

    0x209b: movzbl (%rax), %eax


It seems llvm supports go from v3.8 (https://groups.google.com/forum/#!topic/golang-nuts/pzpNcarQcvo).

So, did I miss some compile options?



Leopold Freeman

unread,
Oct 26, 2016, 8:19:17 AM10/26/16
to golang-nuts
It seems I put lld in the wrong place, but after I moved it to the llvm/tools, and recompiled it, the result is the same.

xied...@gmail.com

unread,
Mar 25, 2017, 10:37:44 AM3/25/17
to golang-nuts
hi, I have meet the same question, did you solved it ?

在 2016年10月26日星期三 UTC+8下午7:20:01,Leopold Freeman写道:

Derek Parker

unread,
Mar 28, 2017, 12:37:33 PM3/28/17
to golang-nuts
You could try using Delve for debugging: https://github.com/derekparker/delve
Reply all
Reply to author
Forward
0 new messages