blob: a5d6be3dfee6fd4cc55b6c7498f8fee8f92ca3dd [file] [log] [blame]
Dave Wallace86b8e262017-10-19 03:47:42 -04001#! /bin/bash
2
3if [ -z "$WS_ROOT" ] ; then
4 echo "ERROR: WS_ROOT environment variable is not set!"
5 exit 1
6fi
7
8source $WS_ROOT/extras/vcl-ldpreload/env.sh
9tmp_gdb_cmdfile="/tmp/gdb_cmdfile_curl.$$"
10
11trap "rm -f $tmp_gdb_cmdfile" SIGINT SIGTERM EXIT
12
13cat <<EOF > $tmp_gdb_cmdfile
14set confirm off
15source $WS_ROOT/extras/gdb/gdb_cmdfile.vpp
16set exec-wrapper env LD_PRELOAD=$VCL_LDPRELOAD_LIB_DIR/libvcl_ldpreload.so.0.0.0
17start
18EOF
19
20gdb_in_emacs() {
21 sudo -E emacs --eval "(gdb \"gdb -x $tmp_gdb_cmdfile -i=mi --args $*\")" --eval "(setq frame-title-format \"CURL-DEBUG (VCL-LDPRELOAD)\")"
22}
23
24# Extract nginx IPv4 address from docker bridge
25#
26nginx_addr=$(docker network inspect bridge | grep IPv4Address | awk -e '{print $2}' | sed -e 's,/16,,' -e 's,",,g' -e 's/,//')
27
28if [ -z "$nginx_addr" ] ; then
29 echo "ERROR: Unable to determine docker container address!"
30 exit 1
31fi
32
33gdb_in_emacs /usr/bin/curl http://$nginx_addr