Blame SOURCES/gdb-6.3-test-movedir-20050125.patch

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