mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 22:36:48 +00:00
🆕 gdb源代码级别调试
This commit is contained in:
parent
e5274ce8e4
commit
e667fff256
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
/bin/
|
||||
DragonOS.iso
|
||||
.idea/
|
||||
kernel/kernel
|
||||
|
||||
*.o
|
||||
*.s
|
5
Makefile
5
Makefile
@ -16,4 +16,7 @@ clean:
|
||||
echo "Clean in dir: $$subdir";\
|
||||
cd $$subdir && make clean;\
|
||||
cd .. ;\
|
||||
done
|
||||
done
|
||||
|
||||
gdb:
|
||||
gdb -n -x tools/.gdbinit
|
@ -7,7 +7,7 @@ DIR_LIB=lib
|
||||
lib_patterns := *.a
|
||||
LIB_FILES := $(foreach DIR,$(DIR_LIB),$(addprefix $(DIR)/,$(lib_patterns)))
|
||||
|
||||
CFLAGS := -mcmodel=large -fno-builtin -m64
|
||||
CFLAGS := -mcmodel=large -fno-builtin -m64 -g
|
||||
|
||||
# 控制操作系统使用的中断控制器 _INTR_8259A_ _INTR_APIC_
|
||||
PIC := _INTR_APIC_
|
||||
@ -16,8 +16,8 @@ CFLAGS += -D $(PIC)
|
||||
ASFLAGS := --64
|
||||
|
||||
all: kernel
|
||||
objcopy -I elf64-x86-64 -S -R ".comment" -R ".eh_frame" -O elf64-x86-64 kernel ../bin/kernel/kernel.elf
|
||||
|
||||
objcopy -I elf64-x86-64 -O elf64-x86-64 -R ".comment" -R ".eh_frame" kernel ../bin/kernel/kernel.elf
|
||||
#
|
||||
|
||||
kernel: head.o entry.o main.o printk.o trap.o mm.o slab.o irq.o pic.o process.o syscall.o multiboot2.o cpu.o acpi.o ps2_keyboard.o ps2_mouse.o ata.o pci.o ahci.o
|
||||
ld -b elf64-x86-64 -z muldefs -o kernel head.o exception/entry.o main.o common/printk.o exception/trap.o exception/irq.o mm/mm.o mm/slab.o process/process.o syscall/syscall.o driver/multiboot2/multiboot2.o \
|
||||
|
4
run.sh
4
run.sh
@ -92,8 +92,8 @@ if [ $flag_can_run -eq 1 ]; then
|
||||
if [ ${IA32_USE_QEMU} == 0 ]; then
|
||||
bochs -q -f ${bochsrc} -rc ./tools/bochsinit
|
||||
else
|
||||
qemu-system-x86_64 -cdrom ${iso} -m 512M \
|
||||
-monitor telnet::2333,server,nowait -serial stdio -s -cpu IvyBridge --enable-kvm \
|
||||
qemu-system-x86_64 -cdrom ${iso} -m 512M -smp 2,cores=2,threads=1,sockets=1 \
|
||||
-monitor telnet::2333,server,nowait -serial stdio -s -S -cpu IvyBridge --enable-kvm \
|
||||
-drive id=disk,file=bin/disk.img,if=none \
|
||||
-device ahci,id=ahci \
|
||||
-device ide-hd,drive=disk,bus=ahci.0 \
|
||||
|
4
tools/.gdbinit
Normal file
4
tools/.gdbinit
Normal file
@ -0,0 +1,4 @@
|
||||
target remote localhost:1234
|
||||
file bin/kernel/kernel.elf
|
||||
set follow-fork-mode child
|
||||
b Start_Kernel
|
Loading…
x
Reference in New Issue
Block a user