VsCode 执行 debug(lldb/gdb) 命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VsCode 执行 debug(lldb/gdb) 命令相关的知识,希望对你有一定的参考价值。

参考技术A 在使用其它 IDE 调试的时候,有时候仅仅使用 IDE 提供的调试按钮不能满足我们的需求,这时候我们会直接在 IDE 提供的 Console 中输入 LLDB/GDB 指令,进行细粒度的控制。但是在使用 VsCode 开发 的时候,这个入口很难找到。分享给小伙伴们 : )

不像其他 IDE 可以直接输入 LLDB/GDB 指令,VsCode 需要使用 -exec 作为前缀来执行调试命令。例如想要打印变量 v ,输入 -exec p v 就可以执行 LLDB/GDB 的 p v 指令了。

debug 使用lldb

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

 

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

以上是关于VsCode 执行 debug(lldb/gdb) 命令的主要内容,如果未能解决你的问题,请参考以下文章

开始调试会话时,MacOS 上的 VSCode LLDB 错误

LLDB Debug .Net 7 In Ubunt22.04 for Exception

mac vscode 调试 c++

mac vscode 调试 c++

mac vscode 调试 c++

mac vscode 调试 c++