debug 使用lldb

http://www.zddhub.com/memo/2015/12/20/lldb-golang-debug/

go build -gcflags "-N -l" -o test test.go

MoJetdeMacBook-Pro:Downloads mojet$ lldb test

(lldb) target create "test"

Current executable set to 'test' (x86_64).

(lldb) breakpoint set --file test.go

error: invalid combination of options for the given command

(lldb) b test.go:17 

Breakpoint 1: where = test`main.main + 68 at test.go:17, address = 0x0000000000002134

(lldb)  b test.go:10

Breakpoint 2: where = test`main.counting + 43 at test.go:10, address = 0x000000000000206b

(lldb) b test.go:23

Breakpoint 3: where = test`main.main + 514 at test.go:23, address = 0x00000000000022f2

(lldb) br list

Current breakpoints:

1: file = 'test.go', line = 17, locations = 1

  1.1: where = test`main.main + 68 at test.go:17, address = test[0x0000000000002134], unresolved, hit count = 0 

 

2: file = 'test.go', line = 10, locations = 1

  2.1: where = test`main.counting + 43 at test.go:10, address = test[0x000000000000206b], unresolved, hit count = 0 

 

3: file = 'test.go', line = 23, locations = 1

  3.1: where = test`main.main + 514 at test.go:23, address = test[0x00000000000022f2], unresolved, hit count = 0 

 

(lldb) run

error: argdumper exited with error 127

(lldb) process launch test

Process 58501 launched: '/Users/mojet/Downloads/test' (x86_64)

Process 58501 stopped

* thread #1: tid = 0x4a03e1, 0x0000000000002134 test`main.main + 68 at test.go:17, stop reason = breakpoint 1.1

    frame #0: 0x0000000000002134 test`main.main + 68 at test.go:17

   14  }

   15  

   16  func main() {

-> 17  msg := "Starting main"

   18  fmt.Println(msg)

   19  bus := make(chan int)

   20  msg = "starting a gorountie"

(lldb) c

原文地址:https://www.cnblogs.com/studyNT/p/5178542.html