aboutsummaryrefslogtreecommitdiffstats
path: root/extras/vcl-ldpreload/test/emacs_gdb_vpp.sh
blob: 460e4077e53fc2e4970d903ad2f73a15c890846b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /bin/bash

if [ -z "$WS_ROOT" ] ; then
    echo "ERROR: WS_ROOT environment variable is not set!"
    exit 1
fi

source $WS_ROOT/extras/vcl-ldpreload/env.sh
tmp_gdb_cmdfile="/tmp/gdb_cmdfile_vpp.$$"

trap "rm -f $tmp_gdb_cmdfile" SIGINT SIGTERM EXIT

cat <<EOF > $tmp_gdb_cmdfile
set confirm off
source $WS_ROOT/extras/gdb/gdb_cmdfile.vpp
start
EOF

gdb_in_emacs() {
    sudo -E emacs --eval "(gdb \"gdb -x $tmp_gdb_cmdfile -i=mi --args $*\")" --eval "(setq frame-title-format \"VPP-DEBUG\")"
}
sudo rm -f /dev/shm/*
gdb_in_emacs $WS_ROOT/build-root/install-vpp_debug-native/vpp/bin/vpp unix { interactive exec $LDP_TEST_DIR/common/vpp_docker.conf } api-segment { gid $(id -g) }