-
Notifications
You must be signed in to change notification settings - Fork 3
/
debug.sh
executable file
·43 lines (35 loc) · 1.06 KB
/
debug.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
37
38
39
40
41
42
43
#!/bin/bash
set -ex
if [ $(sysctl -n kernel.yama.ptrace_scope) -ne 0 ]; then
echo 'Run `sudo sysctl -w kernel.yama.ptrace_scope=0`'
exit 1
fi
if [ -n "$(pgrep qemu-system)" ]; then
echo 'Multiple qemu instances running, prioritize lappis'
exit 1
fi
cat /dev/null > /tmp/serial.log
cat /dev/null > /tmp/serial.raw
kitty --class lappis-serial-raw -e tail -f /tmp/serial.raw &
kitty --class lappis-serial-log -e tail -f /tmp/serial.log &
kitty --class lappis-qemu \
qemu-system-x86_64 \
-cpu qemu64,+smep,+smap \
-no-reboot \
-no-shutdown \
-S \
-gdb tcp::1234 \
-d int \
-m size=4G \
-monitor stdio \
-serial file:/tmp/serial.log \
-serial file:/tmp/serial.raw \
-drive media=disk,index=0,file=bin/zipfs.img,format=raw,if=ide \
-cdrom bin/kernel.iso &
sleep 1
kitty --class lappis-gdb -e gdb \
--quiet \
-command=debug.gdb
ps ax | grep kitty | grep lappis-serial-log | awk '{print $1}' | xargs kill
ps ax | grep kitty | grep lappis-serial-raw | awk '{print $1}' | xargs kill
ps ax | grep kitty | grep lappis-qemu | awk '{print $1}' | xargs kill