gdb/testsuite/ChangeLog:
	D language support.
	* configure.ac (AC_OUTPUT): Add gdb.d/Makefile.
	* Makefile.in (ALL_SUBDIRS): Add gdb.d.
	* lib/d.exp: New file.
	* gdb.d/darray.d: New file.
	* gdb.d/darray.exp: New file.
	* gdb.d/main.d: New file.
	* gdb.d/main.exp: New file.
	* gdb.d/Makefile.in: New file.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 8d8d704..d64f7c0 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -33,8 +33,8 @@ SHELL = @SHELL@
 EXEEXT = @EXEEXT@
 SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
-ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
-	gdb.dwarf2 \
+ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.d \
+	gdb.disasm gdb.dwarf2 \
 	gdb.fortran gdb.server gdb.java gdb.mi gdb.multi \
 	gdb.objc gdb.opt gdb.pascal gdb.python gdb.threads gdb.trace \
 	gdb.xml \
diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac
index c8668e5..22e50e4 100644
--- a/gdb/testsuite/configure.ac
+++ b/gdb/testsuite/configure.ac
@@ -139,9 +139,9 @@ AC_CHECK_HEADERS(pthread.h)
 AC_EXEEXT
 
 AC_OUTPUT([Makefile \
-  gdb.ada/Makefile \
-  gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
-  gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
+  gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile \
+  gdb.base/Makefile gdb.cp/Makefile gdb.d/Makefile \
+  gdb.disasm/Makefile gdb.dwarf2/Makefile \
   gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
   gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
   gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
diff --git a/gdb/testsuite/gdb.d/Makefile.in b/gdb/testsuite/gdb.d/Makefile.in
new file mode 100644
index 0000000..16ed52b
--- /dev/null
+++ b/gdb/testsuite/gdb.d/Makefile.in
@@ -0,0 +1,14 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+EXECUTABLES = darray main 
+
+all info install-info dvi install uninstall installcheck check:
+	@echo "Nothing to be done for $@..."
+
+clean mostlyclean:
+	-rm -f *~ *.o *.ci
+	-rm -f core ${EXECUTABLES}
+
+distclean maintainer-clean realclean: clean
+	-rm -f Makefile config.status config.log
diff --git a/gdb/testsuite/gdb.d/darray.d b/gdb/testsuite/gdb.d/darray.d
new file mode 100644
index 0000000..4ecde29
--- /dev/null
+++ b/gdb/testsuite/gdb.d/darray.d
@@ -0,0 +1,38 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+   */
+
+void
+marker() {}
+
+int 
+main() 
+{
+  int[] a = [0, 1, 2];
+
+  char[] s;
+  s.length = 11;
+  s[] = "Test String";
+
+  char[][] s1 = ["Test 1", "Test 22", "Test 333"];
+
+  marker();
+  return 0;
+} 
+
+
+
diff --git a/gdb/testsuite/gdb.d/darray.exp b/gdb/testsuite/gdb.d/darray.exp
new file mode 100644
index 0000000..7194675
--- /dev/null
+++ b/gdb/testsuite/gdb.d/darray.exp
@@ -0,0 +1,46 @@
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+load_lib "d.exp"
+
+set testfile "darray"
+set srcfile ${testfile}.d
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_d "${srcdir}/${subdir}/${srcfile}" "${binfile}"] != "" } {
+  return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "break marker" \
+         "Breakpoint 1 at .*darray.d.*" \
+
+gdb_test "run" \
+         ".*marker.*" \
+         "going to marker"
+
+gdb_test "next" ".*return 0;"
+
+gdb_test "print a" ".*0, 1, 2.*"
+gdb_test "print s" ".*= \"Test String\""
+gdb_test "print s1" ".*= {\"Test 1\", \"Test 22\", \"Test 333\"}"
diff --git a/gdb/testsuite/gdb.d/main.d b/gdb/testsuite/gdb.d/main.d
new file mode 100644
index 0000000..346fd96
--- /dev/null
+++ b/gdb/testsuite/gdb.d/main.d
@@ -0,0 +1,63 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+   */
+
+int z;
+
+void
+foo()
+{
+  z = 22;
+}
+
+class CTest
+{
+  int x;
+  static int y;
+  this()
+  {
+    x = 11;
+    y = 3;
+  }
+}
+
+struct STest
+{
+  int x;
+  static int y;
+}
+
+int 
+main() 
+{
+  int i = 1;
+  int[3] a = [0, 1, 2];
+  char[11] s = "Test String";
+
+  foo();
+
+  CTest ct = new CTest;
+
+  STest st;
+  st.x = 2;
+  st.y = 4;
+
+  int *p = null; 
+  *p = 5;
+
+  return 0;
+} 
diff --git a/gdb/testsuite/gdb.d/main.exp b/gdb/testsuite/gdb.d/main.exp
new file mode 100644
index 0000000..1f38bd6
--- /dev/null
+++ b/gdb/testsuite/gdb.d/main.exp
@@ -0,0 +1,62 @@
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+load_lib "d.exp"
+
+set testfile "main"
+set srcfile ${testfile}.d
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_d "${srcdir}/${subdir}/${srcfile}" "${binfile}"] != "" } {
+  return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "break 'D main'" \
+         "Breakpoint 1 at .*main.d.*" \
+
+gdb_test "break foo" \
+         "Breakpoint 2 at .*main.d.*" \
+
+gdb_test "run" \
+         ".*int i = 1;" \
+         "going to 'D main'"
+
+gdb_test "continue" \
+         ".*z = 22;" \
+         "going to foo"
+
+gdb_test "backtrace" \
+	 "#0  foo .*main.d.*#1.*main.*main.d.*"
+
+gdb_test "continue" \
+         ".*p = 5;" \
+         "segmentation fault"
+
+gdb_test "print i" ".* = 1"
+gdb_test "print a" ".*0, 1, 2.*"
+gdb_test "print 'main.z'" ".* = 22"
+gdb_test "print ct" ".*x = 11.*"
+gdb_test "print 'main.CTest.y'" ".* = 3"
+gdb_test "print st" ".*x = 2.*"
+gdb_test "print 'main.STest.y'" ".* = 4"
diff --git a/gdb/testsuite/lib/d.exp b/gdb/testsuite/lib/d.exp
new file mode 100644
index 0000000..f067a93
--- /dev/null
+++ b/gdb/testsuite/lib/d.exp
@@ -0,0 +1,128 @@
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib libgloss.exp
+
+set d_init_done 0
+
+# This procedure looks for a suitable D compiler
+# First, environment variable GDC is checked
+# if present, GDC compiler is assumed to be the value of
+# that environment variable.
+# Second, environment variable DMD is checked
+# if present, DMD is assumed to be the value of
+# that environment variable.
+# Third, environment variable LDC is checked
+# if present, LDC is assumed to be the value of
+# that environment variable.
+# Fourth, gdc executable is searched using `which gdc`
+# Fifth, dmd executable is searched using `which dmd`
+# Lastly, ldc executable is searched using `which ldc`
+# Using environment variable allows to force
+# which compiler is used in testsuite.
+ 
+proc d_init {} {
+    global d_init_done
+    global d_compiler_is_gdc
+    global d_compiler_is_dmd
+    global d_compiler_is_ldc
+    global gdc_compiler
+    global dmd_compiler
+    global ldc_compiler
+    global env
+ 
+    if { $d_init_done == 1 } {
+	return
+    }
+
+    set d_compiler_is_gdc 0
+    set d_compiler_is_dmd 0
+    set d_compiler_is_ldc 0
+    set gdc_compiler [transform gdc]
+    set dmd_compiler [transform dmd]
+    set ldc_compiler [transform ldc]
+
+    if ![is_remote host] {
+	if { [info exists env(GDC)] } {
+	    set d_compiler_is_gdc 1
+	    set gdc_compiler $env(GDC)
+	    verbose -log "Assuming GDC ($gdc_compiler)"
+	} elseif { [info exists env(DMD)] } {
+	    set d_compiler_is_dmd 1
+	    set dmd_compiler $env(DMD)
+	    verbose -log "Assuming DMD ($dmd_compiler)"
+	} elseif { [info exists env(LDC)] } {
+	    set d_compiler_is_ldc 1
+	    set ldc_compiler $env(LDC)
+	    verbose -log "Assuming LDC ($ldc_compiler)"
+	} elseif { [which $gdc_compiler] != 0 } {
+	    set d_compiler_is_gdc 1
+	    verbose -log "GDC found"
+        } elseif { [which $dmd_compiler] != 0 } {
+	    set d_compiler_is_dmd 1
+	    verbose -log "DMD found"
+        } elseif { [which $ldc_compiler] != 0 } {
+	    set d_compiler_is_ldc 1
+	    verbose -log "LDC found"
+	}
+    }
+    set d_init_done 1
+}   
+
+proc gdc_compile {source dest} {
+    global gdc_compiler
+    set result [remote_exec host $gdc_compiler "-g3 -O0 $source -o $dest"]
+    return $result
+}
+
+proc dmd_compile {source dest} {
+    global dmd_compiler
+    set result [remote_exec host $dmd_compiler "-gc $source -of$dest"]
+    return $result
+}
+
+proc ldc_compile {source dest} {
+    global ldc_compiler
+    set result [remote_exec host $ldc_compiler "-O0 -g $source -of$dest"]
+    return $result
+}
+
+proc gdb_compile_d {source dest} {
+    global d_init_done
+    global d_compiler_is_gdc
+    global d_compiler_is_dmd
+    global d_compiler_is_ldc
+
+    if { $d_init_done == 0 } { 
+	d_init
+    }
+
+    if { $d_compiler_is_gdc == 1 } {
+        set result [gdc_compile $source $dest]
+    } elseif { $d_compiler_is_dmd == 1 } {
+        set result [dmd_compile $source $dest]
+    } elseif { $d_compiler_is_ldc == 1 } {
+        set result [ldc_compile $source $dest]
+    } else {
+	unsupported "No D compiler found"
+	return "No D compiler. Compilation failed."
+    }
+
+    if ![file exists $dest] {
+        unsupported "D compilation failed: $result"
+        return "D compilation failed."
+    }
+}
+
