...
1#!/usr/bin/env bash
2
3set -e
4
5target=$1
6bazel build --strip=never -c dbg "${target}"
7outs=$(bazel cquery --strip=never -c dbg --output=files "${target}")
8n=${#outs[@]}
9if [[ "$n" -gt 1 ]]; then
10 echo "too many outputs, not sure which one to debug"
11fi
12command="${outs[0]}"
13
14echo "###############"
15echo "Starting headless dlv debug server"
16echo "- You will need to connect with a DAP client (eg, vscode) on the given port"
17echo "- Call @dk185217 if you want a vscode launch config. Help wanted for other clients"
18echo "- If something isnt working, useful options are: --log --log-output=dap"
19echo "- You will need to pkill dlv to stop it if your client doesnt"
20echo "###############"
21
22set -x
23dlv exec "${command}" --headless --listen=127.0.0.1:50034 --api-version=2 -- "${@:3}"
View as plain text