190f2a
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
190f2a
From: Elena Zannoni <ezannoni@redhat.com>
190f2a
Date: Fri, 27 Oct 2017 21:07:50 +0200
190f2a
Subject: gdb-6.3-test-movedir-20050125.patch
190f2a
190f2a
;; Fix to support executable moving
190f2a
;;=fedoratest
190f2a
190f2a
2005-01-25  Elena Zannoni  <ezannoni@redhat.com>
190f2a
190f2a
        * gdb.base/move-dir.exp: New test.
190f2a
        * gdb.base/move-dir.c: Ditto.
190f2a
        * gdb.base/move-dir.h: Ditto.
190f2a
190f2a
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
190f2a
new file mode 100644
190f2a
--- /dev/null
190f2a
+++ b/gdb/testsuite/gdb.base/move-dir.c
190f2a
@@ -0,0 +1,10 @@
190f2a
+#include <stdio.h>
190f2a
+#include <stdlib.h>
190f2a
+#include "move-dir.h"
190f2a
+
190f2a
+int main() {
190f2a
+   const char* hw = "hello world.";
190f2a
+   printf ("%s\n", hw);;
190f2a
+   other();
190f2a
+}
190f2a
+
190f2a
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
190f2a
new file mode 100644
190f2a
--- /dev/null
190f2a
+++ b/gdb/testsuite/gdb.base/move-dir.exp
190f2a
@@ -0,0 +1,57 @@
190f2a
+#   Copyright 2005
190f2a
+#   Free Software Foundation, Inc.
190f2a
+
190f2a
+# This program is free software; you can redistribute it and/or modify
190f2a
+# it under the terms of the GNU General Public License as published by
190f2a
+# the Free Software Foundation; either version 2 of the License, or
190f2a
+# (at your option) any later version.
190f2a
+# 
190f2a
+# This program is distributed in the hope that it will be useful,
190f2a
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
190f2a
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
190f2a
+# GNU General Public License for more details.
190f2a
+# 
190f2a
+# You should have received a copy of the GNU General Public License
190f2a
+# along with this program; if not, write to the Free Software
190f2a
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
190f2a
+
190f2a
+set testfile "move-dir"
190f2a
+set srcfile ${testfile}.c
190f2a
+set incfile ${testfile}.h
190f2a
+set binfile [standard_output_file ${testfile}]
190f2a
+
190f2a
+set testdir [standard_output_file incdir]
190f2a
+
190f2a
+remote_exec build "mkdir $testdir"
190f2a
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} [standard_output_file ${srcfile}]"
190f2a
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} [standard_output_file ${incfile}]"
190f2a
+
190f2a
+set additional_flags "additional_flags=-I${subdir}/incdir"
190f2a
+
190f2a
+if  { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
190f2a
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
190f2a
+}
190f2a
+
190f2a
+# Create and source the file that provides information about the compiler
190f2a
+# used to compile the test case.
190f2a
+
190f2a
+if [get_compiler_info ${binfile}] {
190f2a
+    return -1;
190f2a
+}
190f2a
+
190f2a
+
190f2a
+set oldtimeout $timeout
190f2a
+set timeout [expr "$timeout + 60"]
190f2a
+
190f2a
+# Start with a fresh gdb.
190f2a
+
190f2a
+gdb_exit
190f2a
+gdb_start
190f2a
+gdb_test "cd ../.." "" ""
190f2a
+gdb_load ${binfile}
190f2a
+gdb_test "list main" ".*hw.*other.*" "found main"
190f2a
+gdb_test "list other" ".*ostring.*" "found include file"
190f2a
+
190f2a
+
190f2a
+set timeout $oldtimeout
190f2a
+return 0
190f2a
diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir.h
190f2a
new file mode 100644
190f2a
--- /dev/null
190f2a
+++ b/gdb/testsuite/gdb.base/move-dir.h
190f2a
@@ -0,0 +1,7 @@
190f2a
+#include <stdlib.h>
190f2a
+
190f2a
+void other() {
190f2a
+  const char* ostring = "other";
190f2a
+  printf ("%s\n", ostring);;
190f2a
+}
190f2a
+