add debugging

This commit is contained in:
Adrien Bourmault 2019-03-29 13:45:24 +01:00
parent 929b399f33
commit f233cc1066
3 changed files with 15 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -30,17 +30,6 @@
#include <kernel/buf.h>
#include <kernel/mm.h>
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");