Enable debug info.

This commit is contained in:
Alexander Myltsev 2022-11-18 18:33:40 +03:00
parent 3acb397549
commit 8a8fb95965

View File

@ -5,12 +5,19 @@ CC=x86_64-elf-gcc
run: image.bin run: image.bin
qemu-system-i386 -drive format=raw,file=$< qemu-system-i386 -drive format=raw,file=$<
debug-boot: image.bin mbr.elf
qemu-system-i386 -drive format=raw,file=$< -s -S &
x86_64-elf-gdb mbr.elf \
-ex "set architecture i386" \
-ex "target remote localhost:1234" \
-ex "break init_32bit" \
-ex "continue"
debug: image.bin debug: image.bin
qemu-system-i386 -drive format=raw,file=$< -s -S & qemu-system-i386 -drive format=raw,file=$< -s -S &
x86_64-elf-gdb \ x86_64-elf-gdb kernel.bin \
-ex "target remote localhost:1234" \ -ex "target remote localhost:1234" \
-ex "set architecture i8086" \ -ex "break _start" \
-ex "break *0x7c5d" \
-ex "continue" -ex "continue"
image.bin: mbr.bin kernel.bin image.bin: mbr.bin kernel.bin
@ -20,13 +27,16 @@ kernel.bin: kernel.o vga.o string.o drivers/ata.o
$(LD) -m elf_i386 -o $@ -Ttext 0x1000 $^ $(LD) -m elf_i386 -o $@ -Ttext 0x1000 $^
%.o: %.c %.o: %.c
$(CC) -m32 -ffreestanding -c $< -o $@ $(CC) -m32 -ffreestanding -c -g $< -o $@
%.o: %.S %.o: %.S
$(AS) $^ -o $@ $(AS) $^ -g -o $@
mbr.bin: mbr.o mbr.bin: mbr.o
$(LD) -Ttext=0x7c00 --oformat=binary $^ -o $@ $(LD) -Ttext=0x7c00 --oformat=binary $^ -o $@
mbr.elf: mbr.o
$(LD) -Ttext=0x7c00 $^ -o $@
clean: clean:
rm *.bin *.o rm *.bin *.o