Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Cc: toolchain-devel@blackfin.uclinux.org,	Jie Zhang <jie@codesourcery.com>
Subject: [PATCH/RFC] gdb: tests: add support for testing FLAT toolchains
Date: Fri, 01 Jul 2011 00:24:00 -0000	[thread overview]
Message-ID: <1309479881-10550-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <201003182126.17119.vapier@gentoo.org>

From: Jie Zhang <jie@codesourcery.com>

FLAT toolchains output a FLAT binary for the named output and create
another file with a .gdb suffix that is used for debugging.  So when
testing a FLAT toolchain and we need to load up a file, use the .gdb.

This restarts an old thread and implements things as suggested by
Daniel Jacobowitz:
http://sourceware.org/ml/gdb-patches/2010-03/msg00648.html

Pretty sure this works (I'll double check), but I want to make sure
this is going in the direction people are OK with.

Signed-off-by: Jie Zhang <jie@codesourcery.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 gdb/testsuite/lib/gdb.exp |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index dc16cfa..091b271 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2091,6 +2091,16 @@ proc current_target_name { } {
     return $answer
 }
 
+proc gdb_get_exec_name { binfile } {
+    # FLAT toolchains have to load the .flt file to the board
+    if { [target_info exists use_binfmt_flat]
+	 && [file exists "${binfile}.flt"] } {
+	return "${binfile}.flt"
+    } else {
+	return ${binfile}
+    }
+}
+
 set gdb_wrapper_initialized 0
 set gdb_wrapper_target ""
 
@@ -2286,6 +2296,16 @@ proc gdb_compile {source dest type options} {
 	    clone_output "gdb compile failed, $result"
 	}
     }
+
+    # FLAT toolchains output a bFLT file with the default name and create
+    # a secondary ELF file with a .gdb suffix.  GDB needs the ELF file in
+    # order to do debugging, so flip-flop things.
+    if { [target_info exists use_binfmt_flat]
+	 && [file exists "${dest}.gdb"] } {
+	file rename -force "${dest}" "${dest}.flt"
+	file rename -force "${dest}.gdb" "${dest}"
+    }
+
     return $result;
 }
 
@@ -2762,7 +2782,7 @@ proc gdb_touch_execfile { binfile } {
 proc gdb_download { filename } {
     global cleanfiles
 
-    set destname [remote_download target $filename]
+    set destname [remote_download target [gdb_get_exec_name $filename]]
     lappend cleanfiles $destname
     return $destname
 }
-- 
1.7.6


  reply	other threads:[~2011-07-01  0:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-18  7:10 [PATCH 02/16] " Mike Frysinger
2010-03-18  7:13 ` Mike Frysinger
2010-03-18 13:38 ` Daniel Jacobowitz
2010-03-19  1:26   ` Mike Frysinger
2011-07-01  0:24     ` Mike Frysinger [this message]
2011-07-01  9:17       ` [PATCH/RFC] " Pedro Alves
2011-07-01 14:28         ` Mike Frysinger
2011-07-01 15:16           ` Pedro Alves
2011-07-01 15:55             ` Mike Frysinger
2011-07-01 16:24               ` Pedro Alves

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=1309479881-10550-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jie@codesourcery.com \
    --cc=toolchain-devel@blackfin.uclinux.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