Add d_main_name to set the logical entry point for D programs.
[deliverable/binutils-gdb.git] / gdb / d-lang.c
index da2785c90c34b389fd732c76bbbffacc277334de..b6938290846d404a9b936da8ceea76a99fd0daa5 100644 (file)
@@ -1,6 +1,6 @@
 /* D language support routines for GDB, the GNU debugger.
 
-   Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
+   Copyright (C) 2005-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "defs.h"
 #include "symtab.h"
 #include "language.h"
+#include "varobj.h"
 #include "d-lang.h"
 #include "c-lang.h"
-#include "gdb_string.h"
+#include <string.h>
 #include "parser-defs.h"
 #include "gdb_obstack.h"
 
 #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
@@ -238,12 +260,12 @@ static const struct op_print d_op_print_tab[] =
 static const struct language_defn d_language_defn =
 {
   "d",
+  "D",
   language_d,
   range_check_off,
-  type_check_off,
   case_sensitive_on,
   array_row_major,
-  macro_expansion_c,
+  macro_expansion_no,
   &exp_descriptor_c,
   c_parse,
   c_error,
@@ -256,6 +278,7 @@ static const struct language_defn d_language_defn =
                                   syntax.  */
   d_val_print,                 /* Print a value using appropriate syntax.  */
   c_value_print,               /* Print a top-level value.  */
+  default_read_var_value,      /* la_read_var_value */
   NULL,                                /* Language specific skip_trampoline.  */
   "this",
   basic_lookup_symbol_nonlocal, 
@@ -272,11 +295,15 @@ static const struct language_defn d_language_defn =
   default_print_array_index,
   default_pass_by_reference,
   c_get_string,
-  strcmp_iw_ordered,
-  NULL,
+  NULL,                                /* la_get_symbol_name_cmp */
+  iterate_over_symbols,
+  &default_varobj_ops,
   LANG_MAGIC
 };
 
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+extern initialize_file_ftype _initialize_d_language;
+
 void
 _initialize_d_language (void)
 {
This page took 0.028009 seconds and 4 git commands to generate.