Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gdcproject.org>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: [PATCH] gdb/testsuite: Add D support to gdb_default_target_compile
Date: Mon, 01 Feb 2016 12:47:00 -0000	[thread overview]
Message-ID: <CABOHX+eGh84pSjxegpmK1dOsGd3DxvzNe9y-_LkTL+TqXCzLpQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 158 bytes --]

Hi,

As discussed a couple months back.  Adding support for D in
gdb_default_target_compile, which should allow D sources to be used in
the testsuite.

Iain.

[-- Attachment #2: dlang-future.patch --]
[-- Type: text/x-patch, Size: 2309 bytes --]

gdb/testsuite/ChangeLog:
        * lib/future.exp: Add D support.
        (gdb_find_gdc): New proc.
        (gdb_default_target_compile): Add D support.

---
diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp
index 538fa5a..da0dd15 100644
--- a/gdb/testsuite/lib/future.exp
+++ b/gdb/testsuite/lib/future.exp
@@ -41,6 +41,27 @@ proc gdb_find_gnatmake {} {
     return $GM
 }   
 
+proc gdb_find_gdc {} {
+    global tool_root_dir
+    print "Tool Root: $tool_root_dir"
+
+    if {![is_remote host]} {
+	set file [lookfor_file $tool_root_dir gdc]
+	if { $file == "" } {
+	    set file [lookfor_file $tool_root_dir gcc/gdc]
+	}
+	if { $file != "" } {
+	    set CC "$file -B[file dirname $file]/"
+	} else {
+	    set CC [transform gdc]
+	}
+    } else {
+	set CC [transform gdc]
+    }
+    print "CC: $CC"
+    return $CC
+}
+
 proc gdb_find_gfortran {} {
     global tool_root_dir
 
@@ -185,6 +206,18 @@ proc gdb_default_target_compile {source destfile type options} {
 	    }
 	}
 
+	if { $i == "d" } {
+	    set compiler_type "d"
+	    if {[board_info $dest exists dflags]} {
+		append add_flags " [target_info dflags]"
+	    }
+	    if {[board_info $dest exists dcompiler]} {
+		set compiler [target_info dcompiler]
+	    } else {
+		set compiler [find_gdc]
+	    }
+	}
+
 	if { $i == "f77" } {
 	    set compiler_type "f77"
 	    if {[board_info $dest exists f77flags]} {
@@ -285,6 +318,7 @@ proc gdb_default_target_compile {source destfile type options} {
 
     global CC_FOR_TARGET
     global CXX_FOR_TARGET
+    global DC_FOR_TARGET
     global F77_FOR_TARGET
     global F90_FOR_TARGET
     global GNATMAKE_FOR_TARGET
@@ -309,6 +343,12 @@ proc gdb_default_target_compile {source destfile type options} {
 	}
     }
 
+    if {[info exists DC_FOR_TARGET]} {
+	if { $compiler_type == "d" } {
+	    set compiler $DC_FOR_TARGET
+	}
+    }
+
     if {[info exists F77_FOR_TARGET]} {
 	if { $compiler_type == "f77" } {
 	    set compiler $F77_FOR_TARGET
@@ -560,6 +600,11 @@ if {[info procs find_go_linker] == ""} {
     set use_gdb_compile 1
 }
 
+if {[info procs find_gdc] == ""} {
+    rename gdb_find_gdc find_gdc
+    set use_gdb_compile 1
+}
+
 if {$use_gdb_compile} {
     catch {rename default_target_compile {}}
     rename gdb_default_target_compile default_target_compile

             reply	other threads:[~2016-02-01 12:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 12:47 Iain Buclaw [this message]
2016-02-10 12:29 ` Pedro Alves
2016-02-11  7:04   ` Iain Buclaw
2016-02-11 10:00     ` Pedro Alves
2016-02-18 20:52       ` Iain Buclaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABOHX+eGh84pSjxegpmK1dOsGd3DxvzNe9y-_LkTL+TqXCzLpQ@mail.gmail.com \
    --to=ibuclaw@gdcproject.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox