raz / test / gdb.sh

16 lines · 698 B · executable · raw · history · last change 1d7484fe

1#!/bin/sh
2# Line numbers for gdb: stops a test program at a line of its source,
3# by file and line, and checks that gdb names it, and the line of each
4# caller.
5out=build/check
6mkdir -p $out
7./raz -I conform/run/mods -o $out/Procs conform/run/Procs.raz || exit 1
8gdb -batch -ex 'break conform/run/Procs.raz:13' -ex run -ex bt $out/Procs > $out/gdb.out 2>&1
9for want in 'Breakpoint 1, Procs.odd () at conform/run/Procs.raz:13' \
10 'in Procs.even () at conform/run/Procs.raz:20' \
11 'in Procs.main () at conform/run/Procs.raz:'; do
12 if ! grep -qF "$want" $out/gdb.out; then
13 echo "FAIL gdb: no \"$want\""; cat $out/gdb.out; exit 1
14 fi
15done
16echo "gdb finds the lines"