aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5979888..c50a732 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2653,6 +2653,54 @@ proc shlib_symbol_file { libname } {
return $libname
}
+# Return the filename to download to the target and load for this
+# executable. Normally just BINFILE unless it is renamed to something
+# else for this target.
+
+proc exec_target_file { binfile } {
+ return $binfile
+}
+
+# Return the filename GDB will load symbols from when debugging this
+# executable. Normally just BINFILE unless executables for this target
+# have separate files for symbols.
+
+proc exec_symbol_file { binfile } {
+ return $binfile
+}
+
+# Rename the executable file. Normally this is just BINFILE1 being renamed
+# to BINFILE2, but some targets require multiple binary files.
+proc gdb_rename_execfile { binfile1 binfile2 } {
+ catch { file rename -force \
+ [exec_target_file ${binfile1}] \
+ [exec_target_file ${binfile2}] }
+ if { [exec_target_file ${binfile1}] != [exec_symbol_file ${binfile1}] } {
+ catch { file rename -force \
+ [exec_symbol_file ${binfile1}] \
+ [exec_symbol_file ${binfile2}] }
+ }
+}
+
+# "Touch" the executable file to update the date. Normally this is just
+# BINFILE, but some targets require multiple files.
+proc gdb_touch_execfile { binfile } {
+ catch { file copy -force \
+ [exec_target_file ${binfile}] \
+ [exec_target_file ${binfile}.tmp] }
+ catch { file rename -force \
+ [exec_target_file ${binfile}.tmp] \
+ [exec_target_file ${binfile}] }
+ if { [exec_target_file ${binfile}] != [exec_symbol_file ${binfile}] } {
+ catch { file copy -force \
+ [exec_symbol_file ${binfile}] \
+ [exec_symbol_file ${binfile}.tmp] }
+ catch { file rename -force \
+ [exec_symbol_file ${binfile}.tmp] \
+ [exec_symbol_file ${binfile}] }
+ }
+}
+
# gdb_download
#
# Copy a file to the remote target and return its target filename.