From f233cc1066eadbcb404bd9a1e9bca78d5aa08535 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 29 Mar 2019 13:45:24 +0100 Subject: [PATCH] add debugging --- Makefile | 13 +++++++++++-- ProjectTree | 5 ++++- kaleid/kernel/init/init.c | 13 ------------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index b0cb2d9..13008c0 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ COPTIM=-O2 CWARNS=-Wall -Wextra -Werror=implicit-function-declaration CINCLUDES=-Ikaleid/include CFLAGS1=-nostdlib -ffreestanding -mcmodel=large -std=gnu11 -CFLAGS2= -c -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fno-strict-aliasing +CFLAGS2= -c -g -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fno-strict-aliasing CFLAGS=$(CFLAGS1) $(CFLAGS2) KCC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES) -D_OSK_SOURCE -D_KALEID_KERNEL @@ -208,9 +208,18 @@ debug: all .PHONY: gdb gdb: all @qemu-system-x86_64 -m 64M -hda build/bin/disk.img -no-reboot \ - -no-shutdown -mem-path memdump.bin -d cpu_reset,guest_errors,pcall,int -s -S 2> qemu.log & + -no-shutdown -mem-path memdump.bin -d cpu_reset,guest_errors,pcall,int -s 2> qemu.log & @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 64 > kaleid64_disasm.asm @ndisasm $(BINDIR)/kaleid -o 0x00100000 -b 32 > kaleid32_disasm.asm + @gdb \ + -ex "set arch i386:x86-64:intel" \ + -ex "target remote localhost:1234" \ + -ex "symbol-file $(BINDIR)/kaleid" \ + -ex "break BtStartKern" \ + -ex "def reload64" + -ex "set arch i386:x86-64" \ + -ex "target remote localhost:1234" \ + -ex "end" \ .PHONY: install_mbr install_mbr: $(BINDIR)/disk.img $(MBRDIR)/grub.cfg diff --git a/ProjectTree b/ProjectTree index 833ec5d..7f4faea 100644 --- a/ProjectTree +++ b/ProjectTree @@ -163,11 +163,14 @@ ├── ChangeLog ├── COPYING ├── grub.log +├── kaleid32_disasm.asm +├── kaleid64_disasm.asm ├── loader_disasm32.asm ├── loader_disasm64.asm ├── Makefile +├── memdump.bin ├── ProjectTree ├── qemu.log └── Readme.md -28 directories, 117 files +28 directories, 120 files diff --git a/kaleid/kernel/init/init.c b/kaleid/kernel/init/init.c index c70fde2..089dc98 100644 --- a/kaleid/kernel/init/init.c +++ b/kaleid/kernel/init/init.c @@ -30,17 +30,6 @@ #include #include -void func(void) -{ - void* p = NULL; - KernLog("%p ", (void*)&p); - - for (int i = 0; i < 50; i++) { ; } - - func(); -} - - // // BootInfo_t initialization. It is necessary because grub will potentially be @@ -156,8 +145,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic) MmInitHeap(); PsInitSched(); - func(); - //Buffer_t *buf = BOpenLineBuf(NULL, BS_WRONLY, 80, 24, 1, NULL); //error_t rc = BPrintOnBuf(buf, "%+#05x", 0xcafeb00b); //if(rc)KernLog("error\n");