From c74fca5e3c4ff12865c57ba83702ae6586fa45a8 Mon Sep 17 00:00:00 2001 From: Regia König Date: Mon, 15 Aug 2022 17:09:30 +0200 Subject: More documentation --- documentation/DEBUG statement | 10 ++++++++++ documentation/Debugging in Qemu | 41 +++++++++++++++++++++++++++++++++++++++++ documentation/GDB commands | 7 ++++++- documentation/debug statement | 1 - documentation/debugcon | 11 +++++++++++ 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 documentation/DEBUG statement create mode 100644 documentation/Debugging in Qemu delete mode 100644 documentation/debug statement create mode 100644 documentation/debugcon diff --git a/documentation/DEBUG statement b/documentation/DEBUG statement new file mode 100644 index 0000000..eb110ff --- /dev/null +++ b/documentation/DEBUG statement @@ -0,0 +1,10 @@ + +Library to include: +#include "Library/DebugLib.h" + +DEBUG (("%a: %d\n", _FUNCTION_, _LINE_)); + +example: + +DEBUG((EFI_D_INFO, "My Entry Point: 0x%08x\r\n",(CHAR16*)UefiMain)); + diff --git a/documentation/Debugging in Qemu b/documentation/Debugging in Qemu new file mode 100644 index 0000000..6d43b3e --- /dev/null +++ b/documentation/Debugging in Qemu @@ -0,0 +1,41 @@ +######################################### +# # +# Ways to debug in Qemu # +# # +######################################### + +DEBUGCON +############### + +-debugcon file:debug.log -global isa-debugcon.iobase=0x402 + +SERIAL +############### + +-serial stdio + redirects the virtual serial port to the host's terminal i/o + +TRACE +############### + +-D ./qemu_log.txt +-d guest_errors, nochain, exec, in_asm, out_asm, op, op_opt, op_ind, int, cpu, mmu, pcall, cpu_reset, unimp, page + +--trace "memory_region*" + +MONITOR +############### + +-monitor stdio + +or + +Ctrl + Alt + 2 (Exit with Ctrl + Alt + 1) + +GDB - GNU DEBUGGER +##################### + +-s -S (when starting qemu) + +(gdb) target remote localhost:1234 +(gdb) c diff --git a/documentation/GDB commands b/documentation/GDB commands index a6db0cc..64ea1b8 100644 --- a/documentation/GDB commands +++ b/documentation/GDB commands @@ -13,6 +13,10 @@ QEMU CONFIGURATION # GDB PART # +SYMBOL FILES + add-symbol-file Hello.debug 0x... -s .data 0x... + + CONNECTION - source gdbscript (if a gdbscript is created, which contains @@ -69,7 +73,8 @@ INFORMATION CONTROL FLOW - - c + - c || continue + - next || move only one step forward - bt || print back_trace of all stack frames - stop || stop program until it reaches a different source line diff --git a/documentation/debug statement b/documentation/debug statement deleted file mode 100644 index a8e192c..0000000 --- a/documentation/debug statement +++ /dev/null @@ -1 +0,0 @@ -DEBUG (("%a: %d\n", _FUNCTION_, _LINE_)); diff --git a/documentation/debugcon b/documentation/debugcon new file mode 100644 index 0000000..5d914f5 --- /dev/null +++ b/documentation/debugcon @@ -0,0 +1,11 @@ +######################### +# # +# DEBUGCON # +# # +######################### + +for debug already in early bootphases +One can connect the I/O port to either a file or a device, like /dev/stdout + - debugcon /dev/stdout (terminal that started Qemu process) + - debugcon file:qemu/debug.log (or other file name) + -- cgit v1.2.3-55-g7522