From f9d8d1688f43edf3079c839b9dc19f48fcc04576 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 4 Mar 2023 15:16:03 -0500 Subject: [PATCH] debugging --- .vscode/launch.json | 21 +++++++++++++++++++++ scripts/debug.sh | 5 +++++ scripts/debug_ssh.sh | 12 ++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 scripts/debug.sh create mode 100755 scripts/debug_ssh.sh diff --git a/.vscode/launch.json b/.vscode/launch.json index ca85eff4..de1c0f0d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,6 +3,13 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", + "inputs": [ + { + "id": "pickPid", + "type": "promptString", + "description": "Enter process id" + } + ], "configurations": [ { "type": "lldb", @@ -14,6 +21,20 @@ "rust" ] }, + { + "type": "lldb", + "request": "launch", + "name": "Launch remote veilid-server", + "program": "${workspaceFolder}/target/debug/veilid-server", + "initCommands": [ + "platform select remote-linux", + "platform connect connect://127.0.0.1:6969", + "settings set target.inherit-env false", + ], + "sourceLanguages": [ + "rust" + ] + }, { "type": "lldb", "request": "attach", diff --git a/scripts/debug.sh b/scripts/debug.sh new file mode 100644 index 00000000..a59abc54 --- /dev/null +++ b/scripts/debug.sh @@ -0,0 +1,5 @@ +#!/bin/bash +trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT +killall lldb-server 2> /dev/null +echo Running lldb-server +lldb-server platform --server --listen 127.0.0.1:6969 --gdbserver-port 6970 diff --git a/scripts/debug_ssh.sh b/scripts/debug_ssh.sh new file mode 100755 index 00000000..5714980a --- /dev/null +++ b/scripts/debug_ssh.sh @@ -0,0 +1,12 @@ +#!/bin/bash +SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +SSHHOST=$1 +if [[ "$SSHHOST" == "" ]]; then + SSHHOST="bootstrap-1.dev.veilid.net" +fi + +echo Copying debug script +scp -q $SCRIPTDIR/debug.sh $SSHHOST:/tmp/debug.sh +echo Connecting to debug server +ssh -t $SSHHOST -L 6969:127.0.0.1:6969 -L 6970:127.0.0.1:6970 'bash /tmp/debug.sh'