@@ -16,11 +16,11 @@ jobs:
1616 steps :
1717 - uses : actions/checkout@v5
1818
19- - name : Build wolfSSL (dtls profile)
19+ - name : Build wolfSSL (dtls profile + debug )
2020 run : |
2121 set -euo pipefail
2222 sudo apt-get update -qq
23- sudo apt-get install -y --no-install-recommends gdb >/dev/null
23+ sudo apt-get install -y --no-install-recommends gdb strace >/dev/null
2424 git clone -q --depth 1 https://github.com/wolfSSL/wolfssl /tmp/wolfssl
2525 cd /tmp/wolfssl
2626 ./autogen.sh >/dev/null 2>&1
@@ -31,56 +31,43 @@ jobs:
3131 --enable-static --enable-shared --enable-debug \
3232 CFLAGS="-DWOLFSSL_DTLS13_NO_HRR_ON_RESUME -g -O0" >/dev/null
3333 make -j"$(nproc)" >/dev/null && make install >/dev/null
34- echo " built"
34+ echo built
3535
36- - name : memory-bio-dtls -- where are the threads stuck
36+ - name : memory-bio-dtls -- wolfSSL state machine trace
3737 run : |
3838 set -uo pipefail
3939 cd dtls
40- make memory-bio-dtls CFLAGS="-I/tmp/inst/include -g -O0" \
41- LDFLAGS="-L/tmp/inst/lib" 2>&1 | tail -3 || \
42- gcc -g -O0 -o memory-bio-dtls memory-bio-dtls.c \
43- -I/tmp/inst/include -L/tmp/inst/lib -lwolfssl -lpthread -lm
40+ # flip the example's own `#if 0 wolfSSL_Debugging_ON()` on
41+ sed -i '143s/#if 0/#if 1/' memory-bio-dtls.c
42+ sed -n '142,145p' memory-bio-dtls.c
43+ gcc -g -O0 -o mb memory-bio-dtls.c -I/tmp/inst/include \
44+ -L/tmp/inst/lib -lwolfssl -lpthread -lm || exit 1
4445 export LD_LIBRARY_PATH=/tmp/inst/lib
45- stdbuf -oL -eL ./memory-bio-dtls > /tmp/mb.out 2>&1 &
46- PID=$!
47- sleep 15
48- if kill -0 $PID 2>/dev/null; then
49- echo "=== STILL RUNNING after 15s -- thread stacks:"
50- sudo gdb -batch -p $PID -ex 'thread apply all bt' 2>/dev/null \
51- | grep -vE '^\[|^Reading|^Downloading|warning:' | head -60
52- kill -9 $PID
53- else
54- echo "=== exited on its own, rc=$?"
55- fi
56- echo "=== stdout so far:"
57- cat /tmp/mb.out
46+ timeout 12 stdbuf -oL -eL ./mb > /tmp/mb.out 2>&1
47+ echo "rc=$?"
48+ echo "=== total debug lines: $(wc -l < /tmp/mb.out)"
49+ echo "=== FIRST 40:"; head -40 /tmp/mb.out
50+ echo "=== LAST 60 (where it spins):"; tail -60 /tmp/mb.out
5851
59- - name : dtls-nonblocking -- where are the two sides stuck
52+ - name : dtls-nonblocking -- state machine + syscalls
6053 run : |
6154 set -uo pipefail
6255 cd dtls
6356 export LD_LIBRARY_PATH=/tmp/inst/lib
6457 for t in server-dtls-nonblocking client-dtls-nonblocking; do
65- gcc -g -O0 -o "$t" "$t.c" -I/tmp/inst/include -L/tmp/inst/lib \
66- -lwolfssl -lm 2>&1 | head -3
58+ sed -i 's/wolfSSL_Init();/wolfSSL_Init(); wolfSSL_Debugging_ON();/' "$t.c"
59+ gcc -g -O0 -o "${t%%-dtls*}X" "$t.c" -I/tmp/inst/include \
60+ -L/tmp/inst/lib -lwolfssl -lm || exit 1
6761 done
68- stdbuf -oL -eL ./server-dtls-nonblocking > /tmp/s.out 2>&1 &
69- SPID=$!
62+ strace -f -e trace=sendto,recvfrom,recvmsg,sendmsg,connect,bind \
63+ -o /tmp/s.strace stdbuf -oL -eL ./serverX > /tmp/s.out 2>&1 &
7064 sleep 2
71- echo "hello" | stdbuf -oL -eL ./client-dtls-nonblocking 127.0.0.1 > /tmp/c.out 2>&1 &
72- CPID=$!
73- sleep 15
74- for n in server:$SPID client:$CPID; do
75- name=${n%%:*}; pid=${n##*:}
76- if kill -0 $pid 2>/dev/null; then
77- echo "=== $name STILL RUNNING -- stack:"
78- sudo gdb -batch -p $pid -ex 'bt' 2>/dev/null \
79- | grep -vE '^\[|^Reading|^Downloading|warning:' | head -25
80- else
81- echo "=== $name already exited"
82- fi
83- done
84- kill -9 $SPID $CPID 2>/dev/null || true
85- echo "=== server out:"; cat /tmp/s.out
86- echo "=== client out:"; cat /tmp/c.out
65+ echo hello | timeout 12 strace -f -e trace=sendto,recvfrom,recvmsg,sendmsg,connect \
66+ -o /tmp/c.strace stdbuf -oL -eL ./clientX 127.0.0.1 > /tmp/c.out 2>&1
67+ echo "client rc=$?"
68+ sleep 1
69+ pkill -9 serverX 2>/dev/null || true
70+ echo "=== SERVER wolfSSL trace (last 45):"; tail -45 /tmp/s.out
71+ echo "=== SERVER syscalls (first 25):"; head -25 /tmp/s.strace
72+ echo "=== CLIENT wolfSSL trace (last 45):"; tail -45 /tmp/c.out
73+ echo "=== CLIENT syscalls (first 25):"; head -25 /tmp/c.strace
0 commit comments