[Lldb-commits] [lldb] [lldb][lldb-vscode] Add example configuration for connecting to a remote gdbserver (PR #68866)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 13 06:34:05 PDT 2023


https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/68866

>From a7c0c715f8c355e548e27e7c538fb9fccaf0ce89 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Thu, 12 Oct 2023 10:04:52 +0100
Subject: [PATCH 1/2] [lldb][lldb-vscode] Add example configuration for
 connecting to a remote gdbserver

This can be used to have VS Code debug various emulators, remote systems, hardware probes, etc.

In my case I was doing this for the Gameboy Advance,
https://github.com/stuij/gba-llvm-devkit/blob/main/docs/Debugging.md#debugging-using-visual-studio-code.

It's not very complex if you know LLDB well, but when using another plugin,
CodeLLDB, I was very glad that they had an example for it. So we should have one too.
---
 lldb/tools/lldb-vscode/README.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lldb/tools/lldb-vscode/README.md b/lldb/tools/lldb-vscode/README.md
index 6f930293126d53e..e5104adfda07942 100644
--- a/lldb/tools/lldb-vscode/README.md
+++ b/lldb/tools/lldb-vscode/README.md
@@ -212,6 +212,21 @@ This loads the coredump file `/cores/123.core` associated with the program
 }
 ```
 
+### Connect to a Remote Debug Server
+
+This connects to a debug server (e.g. `lldb-server`, `gdbserver`) that is
+debugging the program `/tmp/a.out` and listening locally on port `2345`.
+
+```javascript
+{
+  "name": "Remote Debug Server",
+  "type": "lldb-vscode",
+  "request": "launch",
+  "program": "/tmp/a.out",
+  "launchCommands": ["gdb-remote 2345"],
+}
+```
+
 # Custom debugger commands
 
 The `lldb-vscode` tool includes additional custom commands to support the Debug

>From a1bcb56b598363c053b70c23e43136bb32ea3269 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Fri, 13 Oct 2023 14:33:28 +0100
Subject: [PATCH 2/2] Split local/remote (other machine) examples

---
 lldb/tools/lldb-vscode/README.md | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/lldb/tools/lldb-vscode/README.md b/lldb/tools/lldb-vscode/README.md
index e5104adfda07942..d6c9fc9421b532d 100644
--- a/lldb/tools/lldb-vscode/README.md
+++ b/lldb/tools/lldb-vscode/README.md
@@ -212,14 +212,15 @@ This loads the coredump file `/cores/123.core` associated with the program
 }
 ```
 
-### Connect to a Remote Debug Server
+### Connect to a Debug Server on the Current Machine
 
-This connects to a debug server (e.g. `lldb-server`, `gdbserver`) that is
-debugging the program `/tmp/a.out` and listening locally on port `2345`.
+This connects to a debug server (e.g. `lldb-server`, `gdbserver`) on
+the current machine, that is debugging the program `/tmp/a.out` and listening
+locally on port `2345`.
 
 ```javascript
 {
-  "name": "Remote Debug Server",
+  "name": "Local Debug Server",
   "type": "lldb-vscode",
   "request": "launch",
   "program": "/tmp/a.out",
@@ -227,6 +228,22 @@ debugging the program `/tmp/a.out` and listening locally on port `2345`.
 }
 ```
 
+### Connect to a Debug Server on Another Machine
+
+This connects to a debug server running on another machine with hostname
+`hostnmame`. Which is debugging the program `/tmp/a.out` and listening on
+port `5678` of that other machine.
+
+```javascript
+{
+  "name": "Remote Debug Server",
+  "type": "lldb-vscode",
+  "request": "launch",
+  "program": "/tmp/a.out",
+  "launchCommands": ["gdb-remote hostname:5678"],
+}
+```
+
 # Custom debugger commands
 
 The `lldb-vscode` tool includes additional custom commands to support the Debug



More information about the lldb-commits mailing list