Open
Description
lldb HEAD works with linkmode internal on macOS Sierra:
$ go build -gcflags "-N -l" -x test.go
WORK=/var/folders/ry/v14gg02d0y9cb2w9809hf6ch0000gn/T/go-build450234285
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /Users/filippo/code/misc/rustgo
/usr/local/Cellar/go/1.8.1_1/libexec/pkg/tool/darwin_amd64/compile -o $WORK/command-line-arguments.a -trimpath $WORK -N -l -p main -complete -buildid 671e0e95e61f5bf7c157a090a3801fe9766c1a0a -D _/Users/filippo/code/misc/rustgo -I $WORK -pack ./test.go
cd .
/usr/local/Cellar/go/1.8.1_1/libexec/pkg/tool/darwin_amd64/link -o $WORK/command-line-arguments/_obj/exe/a.out -L $WORK -extld=clang -buildmode=exe -buildid=671e0e95e61f5bf7c157a090a3801fe9766c1a0a $WORK/command-line-arguments.a
mv $WORK/command-line-arguments/_obj/exe/a.out test
$ sudo /usr/local/opt/llvm/bin/lldb test
(lldb) target create "test"
Current executable set to 'test' (x86_64).
(lldb) b main.main
Breakpoint 1: where = test`main.main at test.go:5, address = 0x000000000104bf20
(lldb) run
Process 5724 launched: '/Users/filippo/code/misc/rustgo/test' (x86_64)
Process 5724 stopped
* thread #6, stop reason = breakpoint 1.1
frame #0: 0x000000000104bf20 test`main.main at test.go:5
2
3 package main
4
-> 5 func main() {
6 println("foo")
7 }
But fails with linkmode external:
$ go build -gcflags "-N -l" -ldflags "-linkmode external" -x test.go
WORK=/var/folders/ry/v14gg02d0y9cb2w9809hf6ch0000gn/T/go-build843720462
mkdir -p $WORK/command-line-arguments/_obj/
mkdir -p $WORK/command-line-arguments/_obj/exe/
cd /Users/filippo/code/misc/rustgo
/usr/local/Cellar/go/1.8.1_1/libexec/pkg/tool/darwin_amd64/compile -o $WORK/command-line-arguments.a -trimpath $WORK -N -l -p main -complete -buildid 09e299344f906f0b167907ec8bcdd857d3794aa0 -D _/Users/filippo/code/misc/rustgo -I $WORK -pack ./test.go
cd .
/usr/local/Cellar/go/1.8.1_1/libexec/pkg/tool/darwin_amd64/link -o $WORK/command-line-arguments/_obj/exe/a.out -L $WORK -extld=clang -buildmode=exe -buildid=09e299344f906f0b167907ec8bcdd857d3794aa0 -linkmode external $WORK/command-line-arguments.a
mv $WORK/command-line-arguments/_obj/exe/a.out test
$ sudo /usr/local/opt/llvm/bin/lldb test
(lldb) target create "test"
Current executable set to 'test' (x86_64).
(lldb) b main.main
Breakpoint 1: where = test`main.main, address = 0x000000000404d060
(lldb) run
Process 5854 launched: '/Users/filippo/code/misc/rustgo/test' (x86_64)
foo
Process 5854 exited with status = 0 (0x00000000)
This appears to be a regression to #8973