-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSysY_qemugdb_single.sh
36 lines (32 loc) · 1000 Bytes
/
SysY_qemugdb_single.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
case=$1
arch=$2
pwdasm=test_output/example
# gdb for generated asm code
# Example:
# ./SysY_qemugdb_single.sh DFS rv64gc
# Should exist test_output/example/DFS.sy.out.s
# Will automatically break at main
./SysY_asm2exe.sh ${case} ${arch}
if [ $arch == "armv7" ] ; then
echo "TODO: run armv7"
elif [ $arch == "rv64gc" ] ; then
if [ -f "${pwdasm}/${case}.in" ] ; then
qemu-riscv64 -g 1234 ${pwdasm}/${case} < ${pwdasm}/${case}.in > ${pwdasm}/${case}.output &
echo $? >> ${pwdasm}/${case}.output
else
qemu-riscv64 -g 1234 ${pwdasm}/${case} > ${pwdasm}/${case}.output &
echo $? >> ${pwdasm}/${case}.output
fi
riscv64-unknown-linux-gnu-gdb \
-ex "file ${pwdasm}/${case}" \
-ex "set arch riscv:rv64" \
-ex "target remote localhost:1234" \
-ex "b main" \
-ex "continue" \
-ex "set scheduler-locking on"
rm ${pwdasm}/${case}
else
echo "Unsupported architecture"
exit 1
fi