diff options
-rw-r--r-- | test_code/.gen_symbol_offsets.sh.swp | bin | 0 -> 1024 bytes | |||
-rw-r--r-- | test_code/Makefile | 2 | ||||
-rw-r--r-- | test_code/gdbscript | 107 | ||||
-rw-r--r-- | test_code/gen_symbol_offsets.sh | 23 |
4 files changed, 132 insertions, 0 deletions
diff --git a/test_code/.gen_symbol_offsets.sh.swp b/test_code/.gen_symbol_offsets.sh.swp Binary files differnew file mode 100644 index 0000000..0684b31 --- /dev/null +++ b/test_code/.gen_symbol_offsets.sh.swp diff --git a/test_code/Makefile b/test_code/Makefile index 2ca2bc3..5f0a260 100644 --- a/test_code/Makefile +++ b/test_code/Makefile @@ -19,6 +19,8 @@ QEMUFLAGS=-drive format=raw,file=fat:rw:hda-contents,index=0,media=disk \ run: $(QEMU) $(QEMUFLAGS) +# -S freeze CPU at startup (use 'c' to start execution) +# -s shorthand for -gdb tcp::1234 debug: $(QEMU) $(QEMUFLAGS) -s -S diff --git a/test_code/gdbscript b/test_code/gdbscript new file mode 100644 index 0000000..5d43a44 --- /dev/null +++ b/test_code/gdbscript @@ -0,0 +1,107 @@ +add-symbol-file symbol-files/PcdPeim.debug 0x82c200 +add-symbol-file symbol-files/ReportStatusCodeRouterPei.debug 0x831380 +add-symbol-file symbol-files/StatusCodeHandlerPei.debug 0x833400 +add-symbol-file symbol-files/PlatformPei.debug 0x835380 +add-symbol-file symbol-files/PeiCore.debug 0x7ee8240 +add-symbol-file symbol-files/PcdPeim.debug 0x7ee2240 +add-symbol-file symbol-files/DxeIpl.debug 0x7edd240 +add-symbol-file symbol-files/S3Resume2Pei.debug 0x7ed9240 +add-symbol-file symbol-files/CpuMpPei.debug 0x7ecc240 +add-symbol-file symbol-files/DxeCore.debug 0x7e9c240 +add-symbol-file symbol-files/DevicePathDxe.debug 0x7595240 +add-symbol-file symbol-files/PcdDxe.debug 0x758f240 +add-symbol-file symbol-files/AmdSevDxe.debug 0x75a2240 +add-symbol-file symbol-files/FvbServicesRuntimeDxe.debug 0x7ae8000 +add-symbol-file symbol-files/ReportStatusCodeRouterRuntimeDxe.debug 0x7ae2000 +add-symbol-file symbol-files/RuntimeDxe.debug 0x7adc000 +add-symbol-file symbol-files/SecurityStubDxe.debug 0x758c240 +add-symbol-file symbol-files/EbcDxe.debug 0x7580240 +add-symbol-file symbol-files/Legacy8259.debug 0x75a1240 +add-symbol-file symbol-files/CpuIo2Dxe.debug 0x7586240 +add-symbol-file symbol-files/CpuDxe.debug 0x715c240 +add-symbol-file symbol-files/IncompatiblePciDeviceSupportDxe.debug 0x7158240 +add-symbol-file symbol-files/PciHotPlugInitDxe.debug 0x714e240 +add-symbol-file symbol-files/ResetSystemRuntimeDxe.debug 0x7ad6000 +add-symbol-file symbol-files/Metronome.debug 0x7154240 +add-symbol-file symbol-files/HiiDatabase.debug 0x7110240 +add-symbol-file symbol-files/NullMemoryTestDxe.debug 0x7148240 +add-symbol-file symbol-files/AcpiTableDxe.debug 0x7138240 +add-symbol-file symbol-files/S3SaveStateDxe.debug 0x7132240 +add-symbol-file symbol-files/DpcDxe.debug 0x7145240 +add-symbol-file symbol-files/IoMmuDxe.debug 0x710b240 +add-symbol-file symbol-files/EmuVariableFvbRuntimeDxe.debug 0x7ad0000 +add-symbol-file symbol-files/VariableRuntimeDxe.debug 0x7ac6000 +add-symbol-file symbol-files/StatusCodeHandlerRuntimeDxe.debug 0x7ac1000 +add-symbol-file symbol-files/Timer.debug 0x7141240 +add-symbol-file symbol-files/PciHostBridgeDxe.debug 0x70f7240 +add-symbol-file symbol-files/SetupBrowser.debug 0x70c3240 +add-symbol-file symbol-files/SmbiosDxe.debug 0x70f1240 +add-symbol-file symbol-files/QemuFwCfgAcpiPlatform.debug 0x70ea240 +add-symbol-file symbol-files/BootScriptExecutorDxe.debug 0x70a3240 +add-symbol-file symbol-files/tftpDynamicCommand.debug 0x70b8240 +add-symbol-file symbol-files/httpDynamicCommand.debug 0x7096240 +add-symbol-file symbol-files/LinuxInitrdDynamicShellCommand.debug 0x708e240 +add-symbol-file symbol-files/LogoDxe.debug 0x70e5240 +add-symbol-file symbol-files/QemuRamfbDxe.debug 0x70b3240 +add-symbol-file symbol-files/FaultTolerantWriteDxe.debug 0x7088240 +add-symbol-file symbol-files/PcRtc.debug 0x7abb000 +add-symbol-file symbol-files/WatchdogTimer.debug 0x70de240 +add-symbol-file symbol-files/MonotonicCounterRuntimeDxe.debug 0x7ab7000 +add-symbol-file symbol-files/CapsuleRuntimeDxe.debug 0x7ab3000 +add-symbol-file symbol-files/DriverHealthManagerDxe.debug 0x707a240 +add-symbol-file symbol-files/BdsDxe.debug 0x7042240 +add-symbol-file symbol-files/RamDiskDxe.debug 0x7064240 +add-symbol-file symbol-files/DisplayEngine.debug 0x701a240 +add-symbol-file symbol-files/SmbiosPlatformDxe.debug 0x7074240 +add-symbol-file symbol-files/PlatformDxe.debug 0x705f240 +add-symbol-file symbol-files/PciBusDxe.debug 0x700a240 +add-symbol-file symbol-files/VirtioPciDeviceDxe.debug 0x703e240 +add-symbol-file symbol-files/Virtio10.debug 0x7039240 +add-symbol-file symbol-files/VirtioBlkDxe.debug 0x7035240 +add-symbol-file symbol-files/VirtioScsiDxe.debug 0x7031240 +add-symbol-file symbol-files/VirtioRngDxe.debug 0x7006240 +add-symbol-file symbol-files/PvScsiDxe.debug 0x7002240 +add-symbol-file symbol-files/MptScsiDxe.debug 0x6dfc240 +add-symbol-file symbol-files/ConPlatformDxe.debug 0x6df2240 +add-symbol-file symbol-files/ConSplitterDxe.debug 0x6de2240 +add-symbol-file symbol-files/GraphicsConsoleDxe.debug 0x6ddc240 +add-symbol-file symbol-files/TerminalDxe.debug 0x6dd4240 +add-symbol-file symbol-files/QemuKernelLoaderFsDxe.debug 0x6dcf240 +add-symbol-file symbol-files/DiskIoDxe.debug 0x6dcf240 +add-symbol-file symbol-files/PartitionDxe.debug 0x6dc8240 +add-symbol-file symbol-files/EnglishDxe.debug 0x6def240 +add-symbol-file symbol-files/ScsiBus.debug 0x6dc3240 +add-symbol-file symbol-files/ScsiDisk.debug 0x6daf240 +add-symbol-file symbol-files/SataController.debug 0x6dbf240 +add-symbol-file symbol-files/AtaAtapiPassThruDxe.debug 0x6d97240 +add-symbol-file symbol-files/AtaBusDxe.debug 0x6d90240 +add-symbol-file symbol-files/NvmExpressDxe.debug 0x6d86240 +add-symbol-file symbol-files/SioBusDxe.debug 0x6dbb240 +add-symbol-file symbol-files/PciSioSerialDxe.debug 0x6d7f240 +add-symbol-file symbol-files/Ps2KeyboardDxe.debug 0x6da3240 +add-symbol-file symbol-files/BootGraphicsResourceTableDxe.debug 0x6dac240 +add-symbol-file symbol-files/Fat.debug 0x6d69240 +add-symbol-file symbol-files/UdfDxe.debug 0x6d62240 +add-symbol-file symbol-files/VirtioFsDxe.debug 0x6d58240 +add-symbol-file symbol-files/SnpDxe.debug 0x6d50240 +add-symbol-file symbol-files/VlanConfigDxe.debug 0x6d49240 +add-symbol-file symbol-files/MnpDxe.debug 0x6d3e240 +add-symbol-file symbol-files/ArpDxe.debug 0x6d38240 +add-symbol-file symbol-files/Dhcp4Dxe.debug 0x6d2d240 +add-symbol-file symbol-files/Ip4Dxe.debug 0x6d05240 +add-symbol-file symbol-files/Udp4Dxe.debug 0x6d24240 +add-symbol-file symbol-files/Mtftp4Dxe.debug 0x6d1a240 +add-symbol-file symbol-files/TcpDxe.debug 0x6cdf240 +add-symbol-file symbol-files/UefiPxeBcDxe.debug 0x6ccd240 +add-symbol-file symbol-files/IScsiDxe.debug 0x6c8f240 +add-symbol-file symbol-files/VirtioNetDxe.debug 0x6cfb240 +add-symbol-file symbol-files/UhciDxe.debug 0x6cc3240 +add-symbol-file symbol-files/EhciDxe.debug 0x6cba240 +add-symbol-file symbol-files/XhciDxe.debug 0x6c73240 +add-symbol-file symbol-files/UsbBusDxe.debug 0x6c85240 +add-symbol-file symbol-files/UsbKbDxe.debug 0x6cb3240 +add-symbol-file symbol-files/UsbMassStorageDxe.debug 0x6cf5240 +add-symbol-file symbol-files/QemuVideoDxe.debug 0x6c65240 +add-symbol-file symbol-files/VirtioGpuDxe.debug 0x6c5f240 +add-symbol-file symbol-files/Shell.debug 0x64f5240 +add-symbol-file symbol-files/MemtestEfi.debug 0x661d240 diff --git a/test_code/gen_symbol_offsets.sh b/test_code/gen_symbol_offsets.sh new file mode 100644 index 0000000..dda608c --- /dev/null +++ b/test_code/gen_symbol_offsets.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +LOG="debug.log" +BUILD="/home/koenigr/Memtest/git/edk2/Build/OvmfX64/DEBUG_GCC5/X64" +SYMOUT="symbol-files" +PEINFO="../../peinfo/peinfo" + +cat ${LOG} | grep Loading | grep -i efi | while read LINE; do + BASE="`echo ${LINE} | cut -d " " -f4`" + NAME="`echo ${LINE} | cut -d " " -f6 | tr -d "[:cntrl:]"`" + if [ "$NAME" == "MemtestEfi.efi" ]; + then + ADDR="`${PEINFO} hda-contents/MemtestEfi.efi \ + | grep -A 5 text | grep VirtualAddress | cut -d " " -f2`" + else + ADDR="`${PEINFO} ${BUILD}/${NAME} \ + | grep -A 5 text | grep VirtualAddress | cut -d " " -f2`" + fi + TEXT="`python -c "print(hex(${BASE} + ${ADDR}))"`" + SYMS="`echo ${NAME} | sed -e "s/\.efi/\.debug/g"`" + echo "add-symbol-file ${SYMOUT}/${SYMS} ${TEXT}" +done + |