From c442308b482aa30a3cd8bb8cd5b5137909b0ed68 Mon Sep 17 00:00:00 2001 From: Regia König Date: Thu, 19 May 2022 12:21:39 +0200 Subject: More detailed documantation on gdb with ovmf --- test_code/OVMF_VARS.fd | Bin 540672 -> 540672 bytes test_code/debug.log | 15 +-------------- test_code/ovmf_with_gdb_16_5_2022.txt | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/test_code/OVMF_VARS.fd b/test_code/OVMF_VARS.fd index 628c15d..537bf09 100644 Binary files a/test_code/OVMF_VARS.fd and b/test_code/OVMF_VARS.fd differ diff --git a/test_code/debug.log b/test_code/debug.log index 290b099..60f82d2 100644 --- a/test_code/debug.log +++ b/test_code/debug.log @@ -30,7 +30,7 @@ FW CFG Revision: 0x3 QemuFwCfg interface (DMA) is supported. Platform PEIM Loaded CMOS: -00: 09 00 26 00 09 00 05 19 05 22 26 02 00 80 00 00 +00: 29 00 14 00 10 00 05 19 05 22 26 02 00 80 00 00 10: 00 00 F0 00 06 80 02 FF FF 2F 00 00 04 10 FF FF 20: C8 00 04 3F 00 00 00 00 00 00 00 00 00 00 00 00 30: FF FF 20 00 00 07 00 20 30 00 00 00 00 12 00 00 @@ -1402,16 +1402,3 @@ ProtectUefiImageCommon - 0x6CB0440 InstallProtocolInterface: 387477C2-69C7-11D2-8E39-00A0C969723B 66B8620 InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 66B7E18 InstallProtocolInterface: 6302D008-7F9B-4F30-87AC-60C9FEF5DA4E 65710C0 -FSOpen: Open '\' Success -FSOpen: Open '.' Success -FSOpen: Open '\memtest.efi' Success -FSOpen: Open '\memtest.efi' Success -FSOpen: Open '\memtest.efi' Success -FSOpen: Open '\memtest.efi' Success -[Security] 3rd party image[0] can be loaded after EndOfDxe: PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)/\memtest.efi. -InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 6680340 -Loading driver at 0x00000200000 EntryPoint=0x000002011E0 -InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 6680B98 -ProtectUefiImageCommon - 0x6680340 - - 0x0000000000200000 - 0x000000000006BB80 -InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA 7E9B6A8 diff --git a/test_code/ovmf_with_gdb_16_5_2022.txt b/test_code/ovmf_with_gdb_16_5_2022.txt index 5646d53..5062c35 100644 --- a/test_code/ovmf_with_gdb_16_5_2022.txt +++ b/test_code/ovmf_with_gdb_16_5_2022.txt @@ -77,6 +77,7 @@ cat ${LOG} | grep Loading | grep -i efi | while read LINE; do echo "add-symbol-file ${BUILD}/${SYMS} ${TEXT}" done $ bash gen_symbol_offsets.sh > gdbscript +cat gdb The generated GDB script is like this: add-symbol-file edk2/Build/OvmfX64/DEBUG_GCC5/X64/PcdPeim.debug 0x82c380 @@ -96,8 +97,23 @@ $ make debug Let’s place a breakpoint at BootServices->HandleProtocol(). (gdb) source gdbscript +q + +(gdb) info functions CoreHandleProtocol +All functions matching regular expression "CoreHandleProtocol": +File /.../edk2/MdeModulePkg/Core/Dxe/Hand/Handle.c: +EFI_STATUS CoreHandleProtocol(EFI_HANDLE, EFI_GUID *, void **); + +(gdb) info address CoreHandleProtocol +Symbol "CoreHandleProtocol" is a function at address 0x7ea4aa9. + (gdb) b CoreHandleProtocol (gdb) target remote localhost:1234 +Remote debugging using localhost:1234 +warning: No executable has been specified and target does not support +determining executable automatically. Try using the "file" command. +0x000000000000fff0 in ?? () + (gdb) c The debugger stops, and we can do source code level debug. -- cgit v1.2.3-55-g7522