aboutsummaryrefslogtreecommitdiff
path: root/gdb/d-lang.c
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2014-01-18 17:09:43 +0000
committerIain Buclaw <ibuclaw@gdcproject.org>2014-01-18 18:10:32 +0000
commit6377854769ea85f2dd38aac9a9b11fded61245f3 (patch)
treea6b415087fe1602e2752652e93fafc36d6729729 /gdb/d-lang.c
parent3271ba660a6a8434b1ec32b88ba456e9287a89ac (diff)
downloadgdb-6377854769ea85f2dd38aac9a9b11fded61245f3.zip
gdb-6377854769ea85f2dd38aac9a9b11fded61245f3.tar.gz
gdb-6377854769ea85f2dd38aac9a9b11fded61245f3.tar.bz2
Add d_main_name to set the logical entry point for D programs.
gdb/ChangeLog: 2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org> * d-lang.h (d_main_name): Add declaration. * d-lang.c (d_main_name): New function. * symtab.c (find_main_name): Add call to d_main_name.
Diffstat (limited to 'gdb/d-lang.c')
-rw-r--r--gdb/d-lang.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 766b5fa..b693829 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -29,6 +29,27 @@
#include <ctype.h>
+/* The name of the symbol to use to get the name of the main subprogram. */
+static const char D_MAIN[] = "D main";
+
+/* Function returning the special symbol name used by D for the main
+ procedure in the main program if it is found in minimal symbol list.
+ This function tries to find minimal symbols so that it finds them even
+ if the program was compiled without debugging information. */
+
+const char *
+d_main_name (void)
+{
+ struct minimal_symbol *msym;
+
+ msym = lookup_minimal_symbol (D_MAIN, NULL, NULL);
+ if (msym != NULL)
+ return D_MAIN;
+
+ /* No known entry procedure found, the main program is probably not D. */
+ return NULL;
+}
+
/* Extract identifiers from MANGLED_STR and append it to TEMPBUF.
Return 1 on success or 0 on failure. */
static int