This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 02/16] gdb: tests: add support for testing FLAT toolchains


From: Jie Zhang <jie.zhang@analog.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.

Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-03-18  Jie Zhang  <jie@codesourcery.com>

	* gdb.base/cursal.exp: Append ".gdb" to binfile when use_binfmt_flat
	is set in target_info.
	* gdb.base/dump.exp: Declare new symfile variable and use it.
	* gdb.mi/mi-basics.exp: Likewise.
	* lib/gdbserver-support.exp (gdbserver_reconnect): Check for
	$host_exec.gdb when use_binfmt_flat is set.

 gdb/testsuite/gdb.base/cursal.exp       |    7 ++++++-
 gdb/testsuite/gdb.base/dump.exp         |    9 ++++++++-
 gdb/testsuite/gdb.mi/mi-basics.exp      |   14 +++++++++++---
 gdb/testsuite/lib/gdbserver-support.exp |   11 +++++++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/cursal.exp b/gdb/testsuite/gdb.base/cursal.exp
index 69f864a..649a844 100644
--- a/gdb/testsuite/gdb.base/cursal.exp
+++ b/gdb/testsuite/gdb.base/cursal.exp
@@ -32,7 +32,12 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_file_cmd ${binfile}
+if [target_info exists use_binfmt_flat] {
+    gdb_file_cmd ${binfile}.gdb
+} else {
+    gdb_file_cmd ${binfile}
+}
+
 gdb_test "set listsize 1" \
     ".*"
 
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index bc992dc..3820fd4 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -27,6 +27,13 @@ set testfile "dump"
 
 set srcfile  ${testfile}.c
 set binfile  ${objdir}/${subdir}/${testfile}
+
+if [target_info exists use_binfmt_flat] {
+    set symfile "${binfile}.gdb"
+} else {
+    set symfile ${binfile}
+}
+
 set options  {debug}
 
 set is64bitonly "no"
@@ -208,7 +215,7 @@ make_dump_file \
 
 gdb_exit
 gdb_start
-gdb_file_cmd ${binfile}
+gdb_file_cmd ${symfile}
 
 # Now fix the endianness at the correct state.
 
diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp
index dcf4dd4..a0054b8 100644
--- a/gdb/testsuite/gdb.mi/mi-basics.exp
+++ b/gdb/testsuite/gdb.mi/mi-basics.exp
@@ -37,6 +37,13 @@ if [mi_gdb_start separate-inferior-tty] {
 set testfile "basics"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/mi-basics
+
+if [target_info exists use_binfmt_flat] {
+    set symfile "${binfile}.gdb"
+} else {
+    set symfile ${binfile}
+}
+
 set escapedobjdir [string_to_regexp ${objdir}]
 set envirodir [string_to_regexp ${objdir}/${subdir}]
 
@@ -83,6 +90,7 @@ proc test_mi_interpreter_selection {} {
 proc test_exec_and_symbol_mi_operatons {} {
     global mi_gdb_prompt
     global binfile
+    global symfile
 
     # Load symbols and specify executable on a single operation
     # Tests:
@@ -90,7 +98,7 @@ proc test_exec_and_symbol_mi_operatons {} {
 
     # Can't use mi_gdb_test as if this doesn't work,
     #  we must give up on the whole test file
-    send_gdb "-file-exec-and-symbols ${binfile}\n"
+    send_gdb "-file-exec-and-symbols ${symfile}\n"
     gdb_expect {
            -re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \
                { pass "file-exec-and-symbols operation" }
@@ -114,11 +122,11 @@ proc test_exec_and_symbol_mi_operatons {} {
 #            "\\\^done" \
 #            "file-clear operation"
 
-    mi_gdb_test "-file-exec-file ${binfile}" \
+    mi_gdb_test "-file-exec-file ${symfile}" \
              "\\\^done" \
              "file-exec-file operation"
 
-    mi_gdb_test "-file-symbol-file ${binfile}" \
+    mi_gdb_test "-file-symbol-file ${symfile}" \
              "\\\^done" \
              "file-symbol-file operation"
 
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index 5d53dfa..a32a2e5 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -315,6 +315,17 @@ proc gdbserver_reconnect { } {
     global gdbserver_protocol
     global gdbserver_gdbport
 
+    if { $host_exec != "" } {
+	if [target_info exists use_binfmt_flat] {
+	    if [gdb_file_cmd "$host_exec.gdb"] {
+		return -1
+	    }
+	} else {
+	    if [gdb_file_cmd $host_exec] {
+		return -1
+	    }
+	}
+    }
     return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
 }
 
-- 
1.7.0.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]