aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorRichard Bunt <richard.bunt@linaro.org>2023-03-31 15:31:40 +0100
committerMaciej W. Rozycki <macro@embecosm.com>2023-03-31 15:31:40 +0100
commit03d83cd5f55abef6a8e6b8e1811cb86f8a05d616 (patch)
tree369805d17231ef7a67d59cc036fff2e4a2e0f4b9 /gdb/symtab.c
parent5b2007ad26f51b244ce66ec65d13e7f71a7f22bc (diff)
downloadfsf-binutils-gdb-03d83cd5f55abef6a8e6b8e1811cb86f8a05d616.zip
fsf-binutils-gdb-03d83cd5f55abef6a8e6b8e1811cb86f8a05d616.tar.gz
fsf-binutils-gdb-03d83cd5f55abef6a8e6b8e1811cb86f8a05d616.tar.bz2
GDB: Add `info main' command
Allow consumers of GDB to extract the name of the main method. This is most useful for Fortran programs which have a variable main method. Used by both MAP and DDT e.g. it is used to detect the presence of debug information. Co-Authored-By: Maciej W. Rozycki <macro@embecosm.com>
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 42e7f5c..9e97986 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5282,6 +5282,14 @@ info_modules_command (const char *args, int from_tty)
from_tty);
}
+/* Implement the 'info main' command. */
+
+static void
+info_main_command (const char *args, int from_tty)
+{
+ gdb_printf ("%s\n", main_name ());
+}
+
static void
rbreak_command (const char *regexp, int from_tty)
{
@@ -6873,6 +6881,9 @@ Options:\n\
_("All module names, or those matching REGEXP."));
set_cmd_completer_handle_brkchars (c, info_types_command_completer);
+ add_info ("main", info_main_command,
+ _("Get main symbol to identify entry point into program."));
+
add_basic_prefix_cmd ("module", class_info, _("\
Print information about modules."),
&info_module_cmdlist, 0, &infolist);