/* D language support routines for GDB, the GNU debugger.
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "varobj.h"
#include "d-lang.h"
#include "c-lang.h"
-#include "parser-defs.h"
-#include "gdb_obstack.h"
+#include "demangle.h"
+#include "cp-support.h"
/* The name of the symbol to use to get the name of the main subprogram. */
static const char D_MAIN[] = "D main";
const char *
d_main_name (void)
{
- struct minimal_symbol *msym;
+ struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol (D_MAIN, NULL, NULL);
- if (msym != NULL)
+ if (msym.minsym != NULL)
return D_MAIN;
/* No known entry procedure found, the main program is probably not D. */
char *
d_demangle (const char *symbol, int options)
{
- struct obstack tempbuf;
- char *result;
-
- if ((symbol == NULL) || (*symbol == '\0'))
- return NULL;
- else if (strcmp (symbol, "_Dmain") == 0)
- return xstrdup ("D main");
-
- obstack_init (&tempbuf);
-
- if (strncmp (symbol, "_D", 2) == 0)
- symbol += 2;
- else
- {
- obstack_free (&tempbuf, NULL);
- return NULL;
- }
-
- if (d_parse_symbol (&tempbuf, symbol) != NULL)
- {
- obstack_grow_str0 (&tempbuf, "");
- result = xstrdup (obstack_finish (&tempbuf));
- obstack_free (&tempbuf, NULL);
- }
- else
- {
- obstack_free (&tempbuf, NULL);
- return NULL;
- }
-
- return result;
+ return gdb_demangle (symbol, options | DMGL_DLANG);
}
/* Table mapping opcodes into strings for printing operators
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
- {"==", BINOP_EQUAL, PREC_EQUAL, 0},
- {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+ {"==", BINOP_EQUAL, PREC_ORDER, 0},
+ {"!=", BINOP_NOTEQUAL, PREC_ORDER, 0},
{"<=", BINOP_LEQ, PREC_ORDER, 0},
{">=", BINOP_GEQ, PREC_ORDER, 0},
{">", BINOP_GTR, PREC_ORDER, 0},
{"<<", BINOP_LSH, PREC_SHIFT, 0},
{"+", BINOP_ADD, PREC_ADD, 0},
{"-", BINOP_SUB, PREC_ADD, 0},
+ {"~", BINOP_CONCAT, PREC_ADD, 0},
{"*", BINOP_MUL, PREC_MUL, 0},
{"/", BINOP_DIV, PREC_MUL, 0},
{"%", BINOP_REM, PREC_MUL, 0},
+ {"^^", BINOP_EXP, PREC_REPEAT, 0},
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
{"-", UNOP_NEG, PREC_PREFIX, 0},
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
array_row_major,
macro_expansion_no,
&exp_descriptor_c,
- c_parse,
- c_error,
+ d_parse,
+ d_error,
null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
NULL, /* la_get_symbol_name_cmp */
iterate_over_symbols,
&default_varobj_ops,
+ NULL,
+ NULL,
LANG_MAGIC
};