test: finalisation d'un déboguer efficace

This commit is contained in:
Nicolas Hordé 2019-01-12 20:46:00 +01:00
parent a00965b7a3
commit 0c6b0635ab
12 changed files with 84 additions and 47 deletions

View File

@ -1,5 +1,5 @@
target remote localhost:1234
set disassembly-flavor intel
set disassembly-flavor att
set architecture i8086
break *0x7c00
cont

26
debug/debug.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
session="debug"
tmux start-server
tmux new-session -d -s $session -n gdb
tmux splitw -h -p 90
tmux splitw -t 0 -v -p 50
tmux splitw -t 2 -h -p 45
tmux splitw -v -p 50
tmux splitw -v -p 50
tmux send-keys -t 5 "gdb --init-command=./debug/gdbinit -x $1" Enter
tmux send-keys -t 3 "telnet 127.0.0.1 6666" Enter
tmux send-keys -t 5 "dashboard stack -output /dev/pts/6" Enter
tmux send-keys -t 5 "dashboard threads -output /dev/null" Enter
tmux send-keys -t 5 "dashboard assembly -output /dev/pts/5" Enter
tmux send-keys -t 5 "dashboard registers -output /dev/pts/3" Enter
tmux send-keys -t 5 "dashboard expressions -output /dev/pts/8" Enter
tmux send-keys -t 5 "dashboard memory -output /dev/pts/8" Enter
tmux send-keys -t 5 "dashboard source -output /dev/pts/5" Enter
tmux send-keys -t 5 "dashboard history -output /dev/pts/10" Enter
tmux send-keys -t 5 "dashboard threads -output /dev/null" Enter
tmux send-keys -t 5 "dashboard stack -output /dev/pts/6" Enter
tmux new-window -t $session:1 -n scratch
tmux select-window -t $session:0
tmux attach-session -t $session

View File

@ -937,7 +937,7 @@ class Source(Dashboard.Module):
return {
'context': {
'doc': 'Number of context lines.',
'default': 5,
'default': 12,
'type': int,
'check': check_ge_zero
},
@ -1075,7 +1075,7 @@ instructions constituting the current statement are marked, if available."""
return {
'context': {
'doc': 'Number of context instructions.',
'default': 3,
'default': 10,
'type': int,
'check': check_ge_zero
},

View File

@ -1,7 +0,0 @@
target remote localhost:1234
set disassembly-flavor intel
set architecture i8086
symbol-file ./system/realmode/setup.sym
break *0x90000
break *0x90200
cont

View File

@ -1,6 +0,0 @@
target remote localhost:1234
set disassembly-flavor intel
set architecture i8086
break *0x800
cont
clear *0x800

View File

@ -1,7 +1,7 @@
target remote localhost:1234
set disassembly-flavor intel
set architecture i386
symbol-file ./system/system.sys
symbol-file ./system/realmode/setup.sym
break system.c:50
cont
clear system.c:50

Binary file not shown.

Binary file not shown.

0
final/makefile Normal file → Executable file
View File

19
final/makeimage Normal file → Executable file
View File

@ -8,8 +8,23 @@ echo ${lo}
losetup -P ${lo} harddisk.img
mkfs.ext2 ${lo}p1
mount ${lo}p1 /mnt
grub-install --no-floppy --install-modules="biosdisk part_msdos ext2 configfile normal multiboot2 video video_colors video_cirrus video_fb" --boot-directory=/mnt/boot ${lo} --target=i386-pc
echo -en "set timeout=4\nset default=0\nmenuentry "cos2000" {\nset root=(hd0,1)\nmultiboot2 /boot/system.sys\nboot\n}" > /mnt/boot/grub/grub.cfg
grub-install --no-floppy --install-modules="biosdisk part_msdos ext2 configfile normal linux vbe png gfxmenu video video_colors video_cirrus video_fb" --boot-directory=/mnt/boot ${lo} --target=i386-pc
echo -en "\
insmod ext2
insmod biosdisk
insmod part_msdos
insmod linux
insmod vbe
insmod gfxterm
insmod png
insmod font
set timeout=4\n\
set default=0\n\
menuentry "cos2000" {\n\
set root=(hd0,1)\n\
linux /boot/system.sys\n
boot\n\
}" > /mnt/boot/grub/grub.cfg
umount /mnt
losetup -d ${lo}
#xz -c harddisk.img > harddisk.img.xz

0
final/makeimageuefi Normal file → Executable file
View File

View File

@ -1,3 +1,11 @@
DEBUG=exec gnome-terminal --geometry=120x40+1+1 -x ./debug/debug.sh
REMOVE=rm -f
INSTALL=sudo apt-get install
COPY=cp
EMULATOR=bochs -f
GIT=git status
MAKECALL=python makesyscall.py
all: tools programs bits32 bits64 harddisk uefi
sync
@ -17,7 +25,7 @@ tools/build:
syscall: clean remakeapi all
remakeapi:
python makesyscall.py
$(MAKECALL)
programs: programs/test lib/TEST/test.c lib/TEST/test2.c
@ -35,8 +43,7 @@ harddisk: final/harddisk.img.final
uefi: final/harddiskuefi.img.final
install:
(sudo apt-get install gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix)
cp ./debug/.gdbinit ~/
$(INSTALL) gcc qemu fusefat fuseext2 gdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios dos2unix gnome-terminal
togit:
make -C system togit
@ -44,11 +51,11 @@ togit:
make -C final togit
make -C programs togit
make -C tools togit
git status
$(GIT)
sync
clean:
rm -f .gdb_history
$(RM) -f .gdb_history
make -C system clean
make -C lib clean
make -C final clean
@ -71,7 +78,8 @@ indent:
sync
backup: clean
(cd .. ; tar cf - Source\ C | gzip -f - > backup.tar.gz)
cd ..
tar cf - Source\ C | gzip -f - > backup.tar.gz
test: programs bits32 harddisk qemu
@ -84,7 +92,7 @@ retest64: littleclean test64
testbochs: programs bits32 harddisk bochs-debug
view:
(hexdump -C ./final/harddisk.img.final|head -c10000)
hexdump -C ./final/harddisk.img.final|head -c10000
debug: debug-system
@ -97,37 +105,38 @@ redebug64: littleclean debug-system64
kernel: debug-kernel
debug-boot: programs bits32 harddisk qemu-debug
(sleep 2;gdb -x ./debug/boot.txt)
debug-loader: programs bits32 harddisk qemu-debug
(sleep 2;gdb -x ./debug/loader.txt)
sleep 2
$(DEBUG) ./debug/boot.txt
debug-system: programs bits32 harddisk qemu-debug
(sleep 2;gdb -x ./debug/system.txt)
sleep 2
$(DEBUG) ./debug/system.txt
debug-system64: programs bits64 uefi qemu-debug64
(sleep 2;gdb -x ./debug/system.txt)
sleep 2
$(DEBUG) ./debug/system.txt
debug-kernel: all qemu-kernel
(sleep 2;gdb -x ./debug/kernel.txt)
bochs-debug: killer
$(EMULATOR) ./debug/config.bochs
bochs-debug:
(killall bochs-debug;bochs -f ./debug/config.bochs)
killer:
killall bochs-debug || true
killall qemu-system-x86_64 || true
killall qemu-system-i386 || true
killall gnome-terminal-server || true
tmux kill-session -t debug || true
qemu-kernel:
(killall qemu-system-i386;qemu-system-i386 -m 1G -kernel ./system/system.sys -s -S &)
qemu-debug: killer
qemu-system-i386 -monitor telnet:127.0.0.1:6666,server,nowait -m 1G -drive format=raw,file=./final/harddisk.img.final -s -S &
qemu-debug:
(killall qemu-system-i386;qemu-system-i386 -m 1G -drive format=raw,file=./final/harddisk.img.final -s -S &)
qemu-debug64: killer
qemu-system-x86_64 -monitor telnet:127.0.0.1:6666,server,nowait -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd -s -S &
qemu-debug64:
(killall qemu-system-x86_64;qemu-system-x86_64 -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd -s -S &)
qemu: killer
qemu-system-i386 -m 1G -drive format=raw,file=./final/harddisk.img.final --enable-kvm -cpu host -s &
qemu:
(killall qemu-system-i386;qemu-system-i386 -m 1G -drive format=raw,file=./final/harddisk.img.final --enable-kvm -cpu host -s &)
qemu64:
(killall qemu-system-x86_64;qemu-system-x86_64 -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd --enable-kvm -cpu host -s &)
qemu64: killer
qemu-system-x86_64 -m 5G -drive format=raw,file=./final/harddiskuefi.img.final --bios /usr/share/qemu/OVMF.fd --enable-kvm -cpu host -s &
system/system.sys:
make -C system VESA=$(VESA)