]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: tests: add support for testing FLAT toolchains
authorJie Zhang <jie@codesourcery.com>
Wed, 10 Mar 2010 15:16:37 +0000 (10:16 -0500)
committerMike Frysinger <vapier@gentoo.org>
Thu, 10 Nov 2022 18:44:12 +0000 (01:44 +0700)
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@codesourcery.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
gdb/testsuite/lib/gdb.exp

index 3e0a46445cacae8ddcb4b621af0cdbdf970decdc..b3e904cb02fc0b86bc0ebbcfc71005456e6baf94 100644 (file)
@@ -4536,6 +4536,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 ""
 set gdb_wrapper_file ""
@@ -5023,6 +5033,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
 }