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

+2 -2
View File
@@ -320,7 +320,7 @@ grub_efi_get_variable (const char *var, const grub_guid_t *guid,
/* Search the mods section from the PE32/PE32+ image. This code uses
a PE32 header, but should work with PE32+ as well. */
grub_addr_t
grub_efi_modules_addr (void)
grub_efi_section_addr (const char *section_name)
{
grub_efi_loaded_image_t *image;
struct grub_msdos_image_header *header;
@@ -349,7 +349,7 @@ grub_efi_modules_addr (void)
i < coff_header->num_sections;
i++, section++)
{
if (grub_strcmp (section->name, "mods") == 0)
if (grub_strcmp (section->name, section_name) == 0)
break;
}