gdb: Add gdbinfo command for printing the load address of the EFI application

EFI firmware determines where to load the GRUB EFI at runtime, and so the
addresses of debug symbols are not known ahead of time. There is a command
defined in the gdb_grub script which will load the debug symbols at the
appropriate addresses, if given the application load address for GRUB.
So add a command named "gdbinfo" to allow the user to print this GDB command
string with the application load address on-demand. For the outputted GDB
command to have any effect when entered into a GDB session, GDB should have
been started with the script as an argument to the -x option or sourced into
an active GDB session before running the outputted command.

Documentation for the gdbinfo command is also added.

Co-developed-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn authored and Daniel Kiper committed 2023-06-01 12:10:04 +02:00
1 parent db1d70f2f3
commit c016a969d1
7 files changed
+100 -4

No files matched your search

+13
View File
@@ -4324,6 +4324,7 @@ you forget a command, you can run the command @command{help}
* export:: Export an environment variable
* false:: Do nothing, unsuccessfully
* fwsetup:: Reboot into the firmware setup menu
* gdbinfo:: Provide info for debugging with GDB
* gettext:: Translate a string
* gptsync:: Fill an MBR based on GPT entries
* halt:: Shut down your computer
@@ -4856,6 +4857,18 @@ exit successfully if so.
@end deffn
@node gdbinfo
@subsection gdbinfo
@deffn Command gdbinfo
Output text to be used as a GDB command for a GDB session using the gdb_grub
script and attached to a running GRUB instance. The GDB command that is
output will tell GDB how to load debugging symbols to their proper runtime
address. Currently this is only available for EFI platforms. See the Debugging
in the developer documentation for more information.
@end deffn
@node gettext
@subsection gettext