+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.
+
2014-01-17 Iain Buclaw <ibuclaw@gdcproject.org>
* d-lang.c (d_language_defn): Change macro_expansion_c to
#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
#include "symtab.h"
+/* Defined in d-lang.c */
+
+extern const char *d_main_name (void);
+
extern char *d_demangle (const char *mangled, int options);
extern void d_val_print (struct type *type, const gdb_byte *valaddr,
return;
}
+ new_main_name = d_main_name ();
+ if (new_main_name != NULL)
+ {
+ set_main_name (new_main_name, language_d);
+ return;
+ }
+
new_main_name = go_main_name ();
if (new_main_name != NULL)
{