[1/7,gdb/testsuite] Adding function to find runtime path to support remote execution for testsuite

Message ID 20221025162946.727169-2-ivan.tetyushkin@syntacore.com
State New
Headers
Series introduce get_runtime_path |

Commit Message

Ivan Tetyushkin Oct. 25, 2022, 4:29 p.m. UTC
  ---
 gdb/testsuite/lib/gdb.exp | 12 ++++++++++++
 1 file changed, 12 insertions(+)
  

Patch

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index e2cda30b95a..ee25daadac5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6200,6 +6200,18 @@  proc standard_output_file {basename} {
     return [file join $dir $basename]
 }
 
+# Turns a full file name in a name for runtime context.
+# This is needed as on remote folder structure is different
+proc get_runtime_file {fullfile} {
+    if [is_remote target] {
+        set remotedir [board_info target remotedir]
+        set filename [file tail $fullfile]
+        return [file join $remotedir $filename]
+    } else {
+        return $fullfile
+    }
+}
+
 # Turn BASENAME into a full file name in the standard output directory.  If
 # GDB has been launched more than once then append the count, starting with
 # a ".1" postfix.