]> git.ipfire.org Git - thirdparty/grub.git/commit
gdb: Replace module symbol loading implementation with Python one
authorGlenn Washburn <development@efficientek.com>
Mon, 27 Feb 2023 21:15:34 +0000 (15:15 -0600)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 14 Mar 2023 15:05:58 +0000 (16:05 +0100)
commit2f643b0560fbfbdf0c57427a7335aac5ada1201b
treec5157a731155b5adad321d2c6a34aa8387c84816
parent264cd9e74682f49b69f2dcbd8f6a80a249d02aee
gdb: Replace module symbol loading implementation with Python one

Remove gmodule.pl and rewrite as a python in gdb_helper.py. This removes
Perl dependency for the GRUB GDB script, but adds Python as a dependency.
This is more desirable because Python is tightly integrated with GDB and
can do things not even available to GDB native scripting language. GDB must
be built with Python, however this is not a major limitation because every
major distro non-end-of-life versions build GDB with Python support. And GDB
has had support for Python since around 7.1-ish, which is about a decade.

This re-implementation has an added feature. If there is a user defined
command named "onload_<module name>", then that command will be executed
after the symbols for the specified module are loaded. When debugging a
module it can be desirable to set break points on code in the module.
This is difficult in GRUB because, at GDB start, the module is not loaded
and on EFI platforms its not known ahead of time where the module will
be loaded. So allow users to create an "onload_<modname>" command which
will be run when the module with name "modname" is loaded.

Another addition is a new convenience function is defined
$is_user_command(), which returns true if its string argument is
the name of a user-defined command.

A secondary benefit of these changes is that the script does not write
temporary files and has better error handling capabilities.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/Makefile.core.def
grub-core/gdb_grub.in
grub-core/gdb_helper.py.in [new file with mode: 0644]
grub-core/gmodule.pl.in [deleted file]