v4 changes: * Fix issue where load_all_modules was only loading the last already loaded module. * Drastically simply runtime_load_module by using hardware break instead of software break. The previous work around didn't seem to be reliable on QEMU either. * Move early initialization symbol loading for i386-pc into its own patch v3 changes: * Rebase on to latest master * Use correct automake macro for target cpu
There's been a lot of changes since v1. There are more fixes and more features. The majority of the shell code has been moved to an external file named gdb_helper.sh, instead of being inline in the GDB script. The one (direct) PERL dependency in GRUB has been removed and converted to shell script. Also a section on debugging is added to the developer docs. Glenn Glenn Washburn (15): gdb: Fix redirection issue in dump_module_sections gdb: Prevent wrapping when writing to .segments.tmp gdb: If no modules have been loaded, do not try to load module symbols gdb: Move runtime module loading into runtime_load_module gdb: Reliably load modules in runtime_load_module gdb: Add functions to make loading from dynamically positioned targets easier gdb: Remove Perl dependency for GRUB GDB script gdb: If enabled, print line used to load EFI kernel symbols when using gdb_grub script gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB gdb: Only connect to remote target once when first sourced gdb: Allow user defined "onload_<modname>" command to be run when module is loaded gdb: Allow running user-defined commands at GRUB start gdb: Add extra early initialization symbols for i386-pc gdb: Add ability to turn on shell tracing for gdb helper script docs: Add debugging chapter to development documentation config.h.in | 3 + docs/grub-dev.texi | 191 ++++++++++++++++++++++++++++++++++++ grub-core/Makefile.core.def | 4 +- grub-core/gdb_grub.in | 162 +++++++++++++++++++++++++----- grub-core/gdb_helper.sh.in | 108 ++++++++++++++++++++ grub-core/gmodule.pl.in | 30 ------ grub-core/kern/efi/efi.c | 4 +- grub-core/kern/efi/init.c | 19 +++- include/grub/efi/efi.h | 2 +- 9 files changed, 465 insertions(+), 58 deletions(-) create mode 100644 grub-core/gdb_helper.sh.in delete mode 100644 grub-core/gmodule.pl.in Range-diff against v3: 1: ec2b71c403 ! 1: 9f273b8fa5 gdb: Fix redirection issue in dump_module_sections @@ Commit message which does the redirection and undoes the redirection when it finishes regardless of any errors in the command. + Also, remove .segments.tmp file prior to loading modules in case one was + left from a previous run. + ## grub-core/gdb_grub.in ## @@ ### @@ grub-core/gdb_grub.in: define dump_module_sections - set logging off - # FIXME: restore logging status +define dump_module_sections -+ pipe dump_module_sections_helper $arg0 | sh -c 'cat >.segments.tmp' ++ pipe dump_module_sections_helper $arg0 | sh -c 'cat >>.segments.tmp' end document dump_module_sections Gather information about module whose mod structure was +@@ grub-core/gdb_grub.in: document load_module + end + + define load_all_modules ++ shell rm -f .segments.tmp + set $this = grub_dl_head + while ($this != 0) + dump_module_sections $this 2: f350ddf3c9 ! 2: 85f68a8369 gdb: Prevent wrapping when writing to .segments.tmp @@ grub-core/gdb_grub.in: define dump_module_sections_helper + # to .segments.tmp + with width 0 -- \ + with trace-commands off -- \ - pipe dump_module_sections_helper $arg0 | sh -c 'cat >.segments.tmp' + pipe dump_module_sections_helper $arg0 | sh -c 'cat >>.segments.tmp' end document dump_module_sections 3: 75949e0d8e = 3: 88b3973cdb gdb: If no modules have been loaded, do not try to load module symbols 4: ed5599b842 = 4: c0d7da87a8 gdb: Move runtime module loading into runtime_load_module 5: e00aa463bb < -: ---------- gdb: Get correct mod variable value 6: c1e0439012 < -: ---------- gdb: Do not run load_module if module has already been loaded -: ---------- > 5: 4712465374 gdb: Reliably load modules in runtime_load_module 7: dc8ce82e27 = 6: 283021b7b9 gdb: Add functions to make loading from dynamically positioned targets easier 8: dc7338f00a = 7: 8f4b7c3bbd gdb: Remove Perl dependency for GRUB GDB script 9: 0ee5cb7cc1 = 8: 055e968779 gdb: If enabled, print line used to load EFI kernel symbols when using gdb_grub script 10: 7ec11bff7e = 9: 64eccfc37e gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB 11: e62defbaa7 = 10: 5064458dfd gdb: Only connect to remote target once when first sourced 12: 0101c41233 = 11: c33e8f57b4 gdb: Allow user defined "onload_<modname>" command to be run when module is loaded 13: 94f4707b14 ! 12: f8a26f3a56 gdb: Allow running user-defined commands at GRUB start @@ grub-core/gdb_grub.in: end # We may have been very late to loading the kernel.exec symbols and # and modules may already be loaded. So load symbols for any already # loaded. -@@ grub-core/gdb_grub.in: document num_modules - Given a module name print its address or NULL if not loaded. +@@ grub-core/gdb_grub.in: document runtime_load_module + Load module symbols at runtime as they are loaded. end +define run_on_start @@ grub-core/gdb_grub.in: document num_modules ### set confirm off -@@ grub-core/gdb_grub.in: set confirm off - # fail. - - set $platform_efi = $_streq("@platform@", "efi") -+set $target = "@target_cpu@-@platform@" - - if ! $runonce - if $platform_efi - # Only load the executable file, not the symbols +@@ grub-core/gdb_grub.in: if ! $runonce exec-file kernel.exec else -+ if $_streq($target, "i386-pc") -+ add-symbol-file boot.image -+ add-symbol-file diskboot.image -+ add-symbol-file lzma_decompress.image -+ end file kernel.exec + run_on_start runtime_load_module -: ---------- > 13: fbd217a89c gdb: Add extra early initialization symbols for i386-pc 14: 5fbef49d07 = 14: 973f24a485 gdb: Add ability to turn on shell tracing for gdb helper script 15: b1f6f5861b = 15: d6c6947762 docs: Add debugging chapter to development documentation -- 2.34.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel