* lib/gdb.exp (exec_target_file, exec_symbol_file,
authorJanis Johnson <janis@sourceware.org>
Thu, 5 May 2011 16:29:58 +0000 (16:29 +0000)
committerJanis Johnson <janis@sourceware.org>
Thu, 5 May 2011 16:29:58 +0000 (16:29 +0000)
gdb_rename_execfile, gdb_touch_execfile): New.
* gdb.base/reread.exp: Use new procs to handle multiple
exec files.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/reread.exp
gdb/testsuite/lib/gdb.exp

index bf126dce8f8ff094d7c57e4c0f9a5f009441c838..109a544d22dd3008dd738415540df7efe21a4f3c 100644 (file)
@@ -1,3 +1,10 @@
+20110-5-05  Janis Johnson  <janisjo@codesourcery.com>
+
+       * lib/gdb.exp (exec_target_file, exec_symbol_file,
+       gdb_rename_execfile, gdb_touch_execfile): New.
+       * gdb.base/reread.exp: Use new procs to handle multiple
+       exec files.
+
 2011-05-05  Yao Qi  <yao@codesourcery.com>
 
        * gdb.arch/arm-disp-step.S(test_ldr_literal): New.
index 78d1126421d6b522cbfa2fde09429692facdfd6d..291de546e81f416f5d0012dc17054c9ac0437478 100644 (file)
@@ -53,7 +53,7 @@ gdb_reinitialize_dir $srcdir/$subdir
 
 # Load the first executable.
 
-gdb_test "shell mv ${binfile1} ${binfile}" ".*" ""
+gdb_rename_execfile ${binfile1} ${binfile}
 gdb_load ${binfile}
 
 # Set a breakpoint at foo
@@ -82,10 +82,10 @@ gdb_expect {
 # second executable into its place.  Ensure that the new
 # executable is at least a second newer than the old.
 
-gdb_test "shell mv ${binfile} ${binfile1}" ".*" ""
-gdb_test "shell mv ${binfile2} ${binfile}" ".*" ""
+gdb_rename_execfile ${binfile} ${binfile1}
+gdb_rename_execfile ${binfile2} ${binfile}
 gdb_test "shell sleep 1" ".*" ""
-gdb_test "shell touch ${binfile}" ".*" ""
+gdb_touch_execfile ${binfile}
 
 # Run a second time; GDB should detect that the executable has changed
 # and reset the breakpoints correctly.
@@ -120,8 +120,8 @@ if [is_remote target] {
 } else {
 
     # Put the older executable back in place.
-    gdb_test "shell mv ${binfile} ${binfile2}" ".*" ""
-    gdb_test "shell mv ${binfile1} ${binfile}" ".*" ""
+    gdb_rename_execfile ${binfile} ${binfile2}
+    gdb_rename_execfile ${binfile1} ${binfile}
 
     # Restart GDB entirely.
     gdb_start
@@ -154,8 +154,8 @@ if [is_remote target] {
     # Now move the newer executable into place, and re-run.  GDB
     # should still notice that the executable file has changed,
     # and still re-set the breakpoint appropriately.
-    gdb_test "shell mv ${binfile} ${binfile1}" ".*" ""
-    gdb_test "shell mv ${binfile2} ${binfile}" ".*" ""
+    gdb_rename_execfile ${binfile} ${binfile1}
+    gdb_rename_execfile ${binfile2} ${binfile}
     gdb_run_cmd
     gdb_expect {
        -re ".*Breakpoint.* foo .* at .*:9.*$gdb_prompt $" {
index 5979888fb0c3cb46378d2140622e22323b88e2b3..c50a73277b4088eb4478eeccfe10a0b0cb34087f 100644 (file)
@@ -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.
This page took 0.044157 seconds and 4 git commands to generate.