From 95bef3b956c8cb07582d98d2efcdef8477bcf81a Mon Sep 17 00:00:00 2001 From: Regia König Date: Wed, 31 Aug 2022 13:25:47 +0200 Subject: Creating gdb script --- Makefile_for_memtest_gdb | 8 +++++--- create_debug.sh | 22 +++++++++++----------- test_code/OVMF_VARS.fd | Bin 540672 -> 540672 bytes test_code/memtest_gdbscript | 8 ++++++++ 4 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 test_code/memtest_gdbscript diff --git a/Makefile_for_memtest_gdb b/Makefile_for_memtest_gdb index 3413741..aa1e692 100644 --- a/Makefile_for_memtest_gdb +++ b/Makefile_for_memtest_gdb @@ -14,7 +14,9 @@ else endif CFLAGS = -std=c11 -Wall -Wextra -Wshadow -m64 -march=x86-64 -mno-mmx -mno-sse -mno-sse2 \ - -fpic -fno-builtin -ffreestanding -fomit-frame-pointer -fno-stack-protector + -fno-builtin -ffreestanding -fomit-frame-pointer -fno-stack-protector + +#-fpic ## NEW PART CFLAGS += -ggdb3 -O0 -DEFI_DEBUG=1 @@ -83,7 +85,7 @@ all: memtest.efi -include $(subst .o,.d,$(APP_OBJS)) boot/%.o: boot/%.s - $(AS) $< -o $@ + $(AS) $< -o $@ boot/startup.s: ../boot/startup64.S ../boot/boot.h @mkdir -p boot @@ -91,7 +93,7 @@ boot/startup.s: ../boot/startup64.S ../boot/boot.h boot/%.s: ../boot/%.S ../boot/boot.h @mkdir -p boot - $(CC) -E -traditional -fPIC -I../boot -o $@ $< + $(CC) -E -traditional -I../boot -o $@ $< boot/efisetup.o: ../boot/efisetup.c @mkdir -p boot diff --git a/create_debug.sh b/create_debug.sh index 45f4c1f..a807d2c 100755 --- a/create_debug.sh +++ b/create_debug.sh @@ -8,15 +8,15 @@ BSS_SIZE=$(size -B -d memtest_shared | grep memtest_shared | tr -s ' ' | cut -d' echo $BSS_SIZE echo "bss_size: $BSS_SIZE" -ld --defsym=_bss_size=$(size -B -d memtest_shared | grep memtest_shared | tr -s ' ' | cut -d ' ' -f3) \ - -shared \ - --print-memory-usage \ - --print-output-format \ - -Bsymbolic \ - -M \ - -nostdlib \ - -T linker_modified.lds \ - -o memtest_modified.efi \ - boot/setup.o boot/startup.o boot/efisetup.o app/*.o lib/*.o system/*.o tests/*.o +#ld --defsym=_bss_size=$(size -B -d memtest_shared | grep memtest_shared | tr -s ' ' | cut -d ' ' -f3) \ +# -shared \ +# --print-memory-usage \ +# --print-output-format \ +# -Bsymbolic \ +# -M \ +# -nostdlib \ +# -T linker_modified.lds \ +# -o memtest_modified.efi \ +# boot/setup.o boot/startup.o boot/efisetup.o app/*.o lib/*.o system/*.o tests/*.o -# ld -N --defsym=_bss_size=$BSS_SIZE -T linker_modified.lds boot/header.o boot/setup.o -b elf64-x86-64 memtest_shared -o memtest_modified.efi +ld -N --defsym=_bss_size=$BSS_SIZE -T linker_modified.lds boot/header.o boot/setup.o -b elf64-x86-64 memtest_shared -o memtest_modified.efi diff --git a/test_code/OVMF_VARS.fd b/test_code/OVMF_VARS.fd index 53d80c2..6252fc6 100644 Binary files a/test_code/OVMF_VARS.fd and b/test_code/OVMF_VARS.fd differ diff --git a/test_code/memtest_gdbscript b/test_code/memtest_gdbscript new file mode 100644 index 0000000..3295919 --- /dev/null +++ b/test_code/memtest_gdbscript @@ -0,0 +1,8 @@ +add-symbol-file ../../memtest86plus_debug/build64/memtest.debug 0x20000 +b main + +# while loop +b *0x21414a + +# supposed main +b *0x21412a -- cgit v1.2.3-55-g7522