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]

[ob] Make gdb1555.exp more like other shlib tests


This cleans up a lot of duplicated code, and also adds an isnative test that
most of the other shared library .exp files already use.  This prevents us
from running the test on an e.g. arm-elf simulator, which doesn't support
shared libraries.

At some point someone may want to support cross-testing shared libraries
when using gdbserver.  It'll be easier if all the tests are uniform, though
:-)

Tested and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2006-06-22  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdb.base/gdb1555.exp: Use gdb_compile_shlib.  Skip if not
	native.

Index: gdb-20060226/gdb/testsuite/gdb.base/gdb1555.exp
===================================================================
--- gdb-20060226.orig/gdb/testsuite/gdb.base/gdb1555.exp	2004-02-17 19:35:08.000000000 -0800
+++ gdb-20060226/gdb/testsuite/gdb.base/gdb1555.exp	2006-06-13 20:29:21.000000000 -0700
@@ -30,59 +30,29 @@ set libfile gdb1555
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 
-remote_exec build "rm -f ${binfile}"
-
-# get the value of gcc_compiled
-if [get_compiler_info ${binfile}] {
-    return -1
-}
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
-    return -1
-}
+set libsrc "${srcdir}/${subdir}/${libfile}.c"
+set libobj "${objdir}/${subdir}/${libfile}.so"
+set execsrc "${srcdir}/${subdir}/${srcfile}"
 
-# Build the shared libraries this test case needs.
-#
+remote_exec build "rm -f ${binfile}"
 
-if {$gcc_compiled == 0} {
-    if [istarget "hppa*-hp-hpux*"] then {
-        set additional_flags "additional_flags=+z"
-    } elseif { [istarget "mips-sgi-irix*"] } {
-        # Disable SGI compiler's implicit -Dsgi
-        set additional_flags "additional_flags=-Usgi"
-    } else {
-        # don't know what the compiler is...
-        set additional_flags ""
-    }
-} else {
-    if { ([istarget "powerpc*-*-aix*"]
-    || [istarget "rs6000*-*-aix*"]) } {
-        set additional_flags ""
-    } else {
-        set additional_flags "additional_flags=-fpic"
-    }
+# Are we on a target board?  No support for downloading shared libraries
+# to a target yet.
+if ![isnative] then {
+    return 0
 }
 
-set additional_flags "$additional_flags -shared"
-if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.so" executable [list debug $additional_flags "incdir=${objdir}"]] != ""} {
+# get the value of gcc_compiled
+if [get_compiler_info ${binfile}] {
     return -1
 }
 
-if { ($gcc_compiled 
-&&  ([istarget "powerpc*-*-aix*"]
-|| [istarget "rs6000*-*-aix*"] )) } {
-    set additional_flags "additional_flags=-L${objdir}/${subdir}"
-} elseif { [istarget "mips-sgi-irix*"] } {
-    set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
-} else {
-    set additional_flags ""
-}
-
-if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.so" "${binfile}" executable [list debug $additional_flags]] != ""} {
+if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
+     || [gdb_compile $execsrc ${binfile} executable \
+	     [list debug shlib=${libobj}]] != "" } {
     return -1
 }
 
-
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir


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