diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index 9ecb9e7..552ca8c 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -110,3 +110,122 @@ new file mode 100644
+ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
+diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gstack.c
+@@ -0,0 +1,43 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see . */
++
++#include
++#include
++#include
++
++void
++func (void)
++{
++ const char msg[] = "looping\n";
++
++ /* Use the most simple notification not to get caught by attach on exiting
++ the function. */
++ write (1, msg, strlen (msg));
++
++ for (;;);
++}
++
++int
++main (void)
++{
++ alarm (60);
++ nice (100);
++
++ func ();
++
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gstack.exp
+@@ -0,0 +1,66 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++set testfile gstack
++set executable ${testfile}
++set binfile [standard_output_file $executable]
++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
++ return -1
++}
++
++set test "spawn inferior"
++set command "${binfile}"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++ return
++}
++set use_gdb_stub 1
++set pid [exp_pid -i $res]
++gdb_expect {
++ -re "looping\r\n" {
++ pass $test
++ }
++ eof {
++ fail "$test (eof)"
++ return
++ }
++ timeout {
++ fail "$test (timeout)"
++ return
++ }
++}
++gdb_exit
++
++# Testcase uses the most simple notification not to get caught by attach on
++# exiting the function. Still we could retry the gstack command if we fail.
++
++set test "spawn gstack"
++set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++}
++set pid [exp_pid -i $res]
++gdb_test_multiple "" $test {
++ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" {
++ pass $test
++ }
++}
++gdb_exit
++
++remote_exec host "kill -9 $pid"
diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch
index aa8611b..f11df0a 100644
--- a/gdb-6.5-bz216711-clone-is-outermost.patch
+++ b/gdb-6.5-bz216711-clone-is-outermost.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Jan Kratochvil
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.5-bz216711-clone-is-outermost.patch
+
+;; Fix bogus 0x0 unwind of the thread's topmost function clone(3) (BZ 216711).
+;;=fedora
+
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711
FIXME: This workaround should be dropped and
@@ -184,3 +192,113 @@ diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
};
/* Floating-point registers. */
+diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.c b/gdb/testsuite/gdb.threads/bt-clone-stop.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/bt-clone-stop.c
+@@ -0,0 +1,39 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2006 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++ MA 02110-1301, USA. */
++
++
++#include
++#include
++#include
++
++
++void *threader (void *arg)
++{
++ assert (0);
++ return NULL;
++}
++
++int main (void)
++{
++ pthread_t t1;
++
++ pthread_create (&t1, NULL, threader, (void *) NULL);
++ for (;;)
++ pause();
++}
+diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.exp b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.threads/bt-clone-stop.exp
+@@ -0,0 +1,61 @@
++# Copyright 2006 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Backtraced `clone' must not have `PC == 0' as its previous frame.
++
++if $tracelevel then {
++ strace $tracelevel
++}
++
++set testfile bt-clone-stop
++set srcfile ${testfile}.c
++set binfile [standard_output_file ${testfile}]
++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# threader: threader.c:8: threader: Assertion `0' failed.
++# Program received signal SIGABRT, Aborted.
++
++gdb_test "run" \
++ {Thread 2 "bt-clone-stop" received signal SIGABRT.*} \
++ "run"
++
++# Former gdb unwind (the first function is `clone'):
++# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6
++# #6 0x0000000000000000 in ?? ()
++# (gdb)
++# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'.
++#
++# Two `-re' cases below must be in this order (1st is a subset of the 2nd one).
++# Unhandled case below should not happen and it is fortunately handled by
++# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid').
++gdb_test_multiple "bt" "0x0 entry output invalid" {
++ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" {
++ fail "0x0 entry found"
++ }
++ -re "in threader \\(.*$gdb_prompt $" {
++ pass "0x0 entry not found"
++ }
++}
diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch
index 64d8a98..2b96166 100644
--- a/gdb-6.6-buildid-locate-solib-missing-ids.patch
+++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch
@@ -1,3 +1,13 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.6-buildid-locate-solib-missing-ids.patch
+
+;; Fix loading of core files without build-ids but with build-ids in executables.
+;; Load strictly build-id-checked core files only if no executable is specified
+;; (Jan Kratochvil, RH BZ 1339862).
+;;=push+jan
+
gdb returns an incorrect back trace when applying a debuginfo
https://bugzilla.redhat.com/show_bug.cgi?id=1339862
@@ -59,3 +69,169 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
xfree (build_id_filename);
xfree (build_id);
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c
+@@ -0,0 +1,21 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see . */
++
++void
++lib (void)
++{
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c
+@@ -0,0 +1,25 @@
++/* Copyright 2010 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see . */
++
++extern void lib (void);
++
++int
++main (void)
++{
++ lib ();
++ return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp
+@@ -0,0 +1,105 @@
++# Copyright 2016 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++if {[skip_shlib_tests]} {
++ return 0
++}
++
++set testfile "gcore-buildid-exec-but-not-solib"
++set srcmainfile ${testfile}-main.c
++set srclibfile ${testfile}-lib.c
++set libfile [standard_output_file ${testfile}-lib.so]
++set objfile [standard_output_file ${testfile}-main.o]
++set executable ${testfile}-main
++set binfile [standard_output_file ${executable}]
++set gcorefile [standard_output_file ${executable}.gcore]
++set outdir [file dirname $binfile]
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != ""
++ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } {
++ unsupported "-Wl,--build-id compilation failed"
++ return -1
++}
++set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"]
++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } {
++ unsupported "-Wl,--build-id compilation failed"
++ return -1
++}
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++# Does this gdb support gcore?
++set test "help gcore"
++gdb_test_multiple $test $test {
++ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" {
++ # gcore command not supported -- nothing to test here.
++ unsupported "gdb does not support gcore on this target"
++ return -1;
++ }
++ -re "Save a core file .*\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++if { ![runto lib] } then {
++ return -1
++}
++
++set escapedfilename [string_to_regexp ${gcorefile}]
++
++set test "save a corefile"
++gdb_test_multiple "gcore ${gcorefile}" $test {
++ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "Can't create a corefile\r\n$gdb_prompt $" {
++ unsupported $test
++ return -1
++ }
++}
++
++# Now restart gdb and load the corefile.
++
++clean_restart $executable
++gdb_load_shlib $libfile
++
++set buildid [build_id_debug_filename_get $libfile]
++
++regsub {\.debug$} $buildid {} buildid
++
++set debugdir [standard_output_file ${testfile}-debugdir]
++file delete -force -- $debugdir
++
++file mkdir $debugdir/[file dirname $libfile]
++file copy $libfile $debugdir/${libfile}
++
++file mkdir $debugdir/[file dirname $buildid]
++file copy $libfile $debugdir/${buildid}
++
++remote_exec build "ln -s /lib ${debugdir}/"
++remote_exec build "ln -s /lib64 ${debugdir}/"
++# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2
++
++gdb_test "set solib-absolute-prefix $debugdir"
++
++gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory"
++
++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile"
++
++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded"
++
++gdb_test "bt"
++gdb_test "info shared"
diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch
index 9cc655c..6acb6bc 100644
--- a/gdb-6.6-buildid-locate.patch
+++ b/gdb-6.6-buildid-locate.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-6.6-buildid-locate.patch
+
+;; New locating of the matching binaries from the pure core file (build-id).
+;;=push+jan
+
diff --git a/gdb/build-id.c b/gdb/build-id.c
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -1151,3 +1159,91 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h
/* From dwarf2read.c */
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
+diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
+--- a/gdb/testsuite/gdb.base/corefile.exp
++++ b/gdb/testsuite/gdb.base/corefile.exp
+@@ -311,3 +311,33 @@ gdb_test_multiple "core-file $corefile" $test {
+ pass $test
+ }
+ }
++
++
++# Test auto-loading of binary files through build-id from the core file.
++set buildid [build_id_debug_filename_get $binfile]
++set wholetest "binfile found by build-id"
++if {$buildid == ""} {
++ untested "$wholetest (binary has no build-id)"
++} else {
++ gdb_exit
++ gdb_start
++
++ regsub {\.debug$} $buildid {} buildid
++ set debugdir [standard_output_file ${testfile}-debugdir]
++ file delete -force -- $debugdir
++ file mkdir $debugdir/[file dirname $buildid]
++ file copy $binfile $debugdir/$buildid
++
++ set test "show debug-file-directory"
++ gdb_test_multiple $test $test {
++ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" {
++ set debugdir_orig $expect_out(1,string)
++ pass $test
++ }
++ }
++ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory"
++ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.}
++ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable"
++ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
++ pass $wholetest
++}
+diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+--- a/gdb/testsuite/gdb.base/new-ui-pending-input.exp
++++ b/gdb/testsuite/gdb.base/new-ui-pending-input.exp
+@@ -62,6 +62,7 @@ proc test_command_line_new_ui_pending_input {} {
+ set options ""
+ append options " -iex \"set height 0\""
+ append options " -iex \"set width 0\""
++ append options " -iex \"set build-id-verbose 0\""
+ append options " -iex \"new-ui console $extra_tty_name\""
+ append options " -ex \"b $bpline\""
+ append options " -ex \"run\""
+diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+--- a/gdb/testsuite/lib/gdb.exp
++++ b/gdb/testsuite/lib/gdb.exp
+@@ -1695,6 +1695,16 @@ proc default_gdb_start { } {
+ warning "Couldn't set the width to 0."
+ }
+ }
++ # Turn off the missing warnings as the testsuite does not expect it.
++ send_gdb "set build-id-verbose 0\n"
++ gdb_expect 10 {
++ -re "$gdb_prompt $" {
++ verbose "Disabled the missing debug infos warnings." 2
++ }
++ timeout {
++ warning "Could not disable the missing debug infos warnings.."
++ }
++ }
+ return 0
+ }
+
+diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
+--- a/gdb/testsuite/lib/mi-support.exp
++++ b/gdb/testsuite/lib/mi-support.exp
+@@ -309,6 +309,16 @@ proc default_mi_gdb_start { args } {
+ warning "Couldn't set the width to 0."
+ }
+ }
++ # Turn off the missing warnings as the testsuite does not expect it.
++ send_gdb "190-gdb-set build-id-verbose 0\n"
++ gdb_expect 10 {
++ -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" {
++ verbose "Disabled the missing debug infos warnings." 2
++ }
++ timeout {
++ warning "Could not disable the missing debug infos warnings.."
++ }
++ }
+
+ if { $separate_inferior_pty } {
+ mi_create_inferior_pty
diff --git a/gdb-archer.patch b/gdb-archer.patch
index 4b35aad..f083691 100644
--- a/gdb-archer.patch
+++ b/gdb-archer.patch
@@ -521,6 +521,45 @@ diff --git a/gdb/python/python.h b/gdb/python/python.h
+extern void run_python_script (int argc, char **argv);
+
#endif /* GDB_PYTHON_H */
+diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
+--- a/gdb/testsuite/gdb.python/py-frame.exp
++++ b/gdb/testsuite/gdb.python/py-frame.exp
+@@ -95,6 +95,8 @@ gdb_test "python print ('result = %s' % f0.read_var ('a'))" " = 1" "test Frame.r
+
+ gdb_test "python print ('result = %s' % (gdb.selected_frame () == f1))" " = True" "test gdb.selected_frame"
+
++gdb_test "python print ('result = %s' % (f0.block ()))" "" "test Frame.block"
++
+ # Can read SP register.
+ gdb_test "python print ('result = %s' % (gdb.selected_frame ().read_register ('sp') == gdb.parse_and_eval ('\$sp')))" \
+ " = True" \
+diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
+--- a/gdb/testsuite/gdb.python/py-value.exp
++++ b/gdb/testsuite/gdb.python/py-value.exp
+@@ -384,6 +384,15 @@ proc test_value_after_death {} {
+ "print value's type"
+ }
+
++# Regression test for a cast failure. The bug was that if we cast a
++# value to its own type, gdb could crash. This happened because we
++# could end up double-freeing a struct value.
++proc test_cast_regression {} {
++ gdb_test "python v = gdb.Value(5)" "" "create value for cast test"
++ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test"
++ gdb_test "python print(v)" "5" "print value for cast test"
++}
++
+ # Regression test for invalid subscript operations. The bug was that
+ # the type of the value was not being checked before allowing a
+ # subscript operation to proceed.
+@@ -512,6 +521,7 @@ if ![runto_main] then {
+ test_value_in_inferior
+ test_inferior_function_call
+ test_value_after_death
++test_cast_regression
+
+ # Test either C or C++ values.
+
diff --git a/gdb/varobj.c b/gdb/varobj.c
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch
index c1aca0a..3eecfc5 100644
--- a/gdb-bz541866-rwatch-before-run.patch
+++ b/gdb-bz541866-rwatch-before-run.patch
@@ -119,3 +119,48 @@ diff --git a/gdb/target.h b/gdb/target.h
/* Returns the number of debug registers needed to watch the given
memory region, or zero if not supported. */
+diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
+@@ -0,0 +1,40 @@
++# Copyright 2009, 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
++if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
++ && ![istarget "ia64-*-*"])
++ || [target_info exists gdb,no_hardware_watchpoints]} then {
++ verbose "Skipping watchpoint-hw-before-run test."
++ return
++}
++
++set test watchpoint-hw-before-run
++set srcfile watchpoint-hw-hit-once.c
++if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
++ return -1
++}
++
++gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
++
++# `runto_main' or `runto main' would delete the watchpoint created above.
++
++if { [gdb_start_cmd] < 0 } {
++ untested start
++ return -1
++}
++gdb_test "" "main .* at .*" "start"
++
++gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch
index 8ccbe69..85c9621 100644
--- a/gdb-glibc-strstr-workaround.patch
+++ b/gdb-glibc-strstr-workaround.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-glibc-strstr-workaround.patch
+
+;; Workaround PR libc/14166 for inferior calls of strstr.
+;;=fedora: Compatibility with RHELs (unchecked which ones).
+
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -28,3 +36,116 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
/* Fortran does not have mangling standard and the mangling does differ
+diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+@@ -0,0 +1,108 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++# Workaround for:
++# invalid IFUNC DW_AT_linkage_name: memmove strstr time
++# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
++
++if {[skip_shlib_tests]} {
++ return 0
++}
++
++set testfile "gnu-ifunc-strstr-workaround"
++set executable ${testfile}
++set srcfile start.c
++set binfile [standard_output_file ${executable}]
++
++if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
++ return -1
++}
++
++if ![runto_main] {
++ return 0
++}
++
++set test "ptype atoi"
++gdb_test_multiple $test $test {
++ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = int \\(\\)\r\n$gdb_prompt $" {
++ untested "$test (no DWARF)"
++ return 0
++ }
++}
++
++set addr ""
++set test "print strstr"
++gdb_test_multiple $test $test {
++ -re " = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" {
++ set addr $expect_out(1,string)
++ pass $test
++ }
++ -re " = {} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
++ set addr $expect_out(1,string)
++ pass "$test (GDB workaround)"
++ }
++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" {
++ set addr $expect_out(1,string)
++ pass "$test (fixed glibc)"
++ }
++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" {
++ untested "$test (gnu-ifunc not in use by glibc)"
++ return 0
++ }
++}
++
++set test "info sym"
++gdb_test_multiple "info sym $addr" $test {
++ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" {
++ # unexpected
++ xfail "$test (not in libc.so.6)"
++ return 0
++ }
++}
++
++set test "info addr strstr"
++gdb_test_multiple $test $test {
++ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
++ fail "$test (DWARF for strstr)"
++ }
++ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
++ pass "$test"
++ }
++}
++
++set test "print strstr second time"
++gdb_test_multiple "print strstr" $test {
++ -re " = {} $addr \r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re " = {} $addr <__strstr>\r\n$gdb_prompt $" {
++ pass "$test (GDB workaround)"
++ }
++ -re " = {} $addr <__libc_strstr>\r\n$gdb_prompt $" {
++ pass "$test (fixed glibc)"
++ }
++ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" {
++ fail $test
++ }
++}
++
++gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
++gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch
index 516412b..a20da46 100644
--- a/gdb-gnat-dwarf-crash-3of3.patch
+++ b/gdb-gnat-dwarf-crash-3of3.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-gnat-dwarf-crash-3of3.patch
+
+;; Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211).
+;;=push+jan
+
http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html
--6TrnltStXW4iwmi0
@@ -156,3 +164,73 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
}
/* Convert a native/host siginfo object, into/from the siginfo in the
+diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
+--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
++++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
+@@ -56,7 +56,65 @@ proc corefunc { threadtype } {
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+- # Verify that we can attach to the stopped process.
++ # Verify that we can attach to the process by first giving its
++ # executable name via the file command, and using attach with the
++ # process ID.
++
++ set test "$threadtype: set file, before attach1 to stopped process"
++ gdb_test_multiple "file $binfile" "$test" {
++ -re "Load new symbol table from.*y or n. $" {
++ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
++ "$test (re-read)"
++ }
++ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
++ pass "$test"
++ }
++ }
++
++ set test "$threadtype: attach1 to stopped, after setting file"
++ gdb_test_multiple "attach $testpid" "$test" {
++ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
++ pass "$test"
++ }
++ }
++
++ # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
++ if {[string equal $threadtype threaded]} {
++ gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
++ } else {
++ gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
++ }
++
++ # Exit and detach the process.
++
++ gdb_exit
++
++ # Avoid some race:
++ sleep 2
++
++ if [catch {open /proc/${testpid}/status r} fileid] {
++ set line2 "NOTFOUND"
++ } else {
++ gets $fileid line1;
++ gets $fileid line2;
++ close $fileid;
++ }
++
++ set test "$threadtype: attach1, exit leaves process stopped"
++ if {[string match "*(stopped)*" $line2]} {
++ pass $test
++ } else {
++ fail $test
++ }
++
++ # At this point, the process should still be stopped
++
++ gdb_start
++ gdb_reinitialize_dir $srcdir/$subdir
++ gdb_load ${binfile}
++
++ # Verify that we can attach to the process just by giving the
++ # process ID.
+
+ set test "$threadtype: attach2 to stopped, after setting file"
+ gdb_test_multiple "attach $testpid" "$test" {
diff --git a/gdb-python-gil.patch b/gdb-python-gil.patch
index 1b1305c..9ff2e45 100644
--- a/gdb-python-gil.patch
+++ b/gdb-python-gil.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-python-gil.patch
+
+;; Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957).
+;;=push
+
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -106,3 +114,128 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c
}
END_CATCH
+diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.c b/gdb/testsuite/gdb.python/py-gil-mthread.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gil-mthread.c
+@@ -0,0 +1,13 @@
++#include
++#include
++
++int
++main (void)
++{
++ int i;
++ for (i = 0; i < 10; i++)
++ {
++ sleep (1); /* break-here */
++ printf ("Sleeping %d\n", i);
++ }
++}
+diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.exp b/gdb/testsuite/gdb.python/py-gil-mthread.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gil-mthread.exp
+@@ -0,0 +1,69 @@
++# Copyright (C) 2014 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile .c .py
++set executable $testfile
++
++if { [prepare_for_testing $testfile.exp $executable $srcfile] } {
++ return -1
++}
++
++# Skip all tests if Python scripting is not enabled.
++if { [skip_python_tests] } { continue }
++
++if ![runto_main] {
++ return -1
++}
++
++gdb_breakpoint $srcfile:[gdb_get_line_number "break-here"] temporary
++gdb_continue_to_breakpoint "break-here" ".* break-here .*"
++
++set test "response"
++set timeout 60
++set sleeping_last -1
++set hello_last 0
++set minimal 5
++gdb_test_multiple "python exec (open ('$srcdir/$subdir/$srcfile2').read ())" $test {
++ -re "Error: unable to start thread\r\n" {
++ fail $test
++ # Not $gdb_prompt-synced!
++ }
++ -re "Sleeping (\[0-9\]+)\r\n" {
++ set n $expect_out(1,string)
++ if { $sleeping_last + 1 != $n } {
++ fail $test
++ } else {
++ set sleeping_last $n
++ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
++ pass $test
++ } else {
++ exp_continue
++ }
++ }
++ }
++ -re "Hello \\( (\[0-9\]+) \\)\r\n" {
++ set n $expect_out(1,string)
++ if { $hello_last + 1 != $n } {
++ fail $test
++ } else {
++ set hello_last $n
++ if { $sleeping_last >= $minimal && $hello_last >= $minimal } {
++ pass $test
++ } else {
++ exp_continue
++ }
++ }
++ }
++}
+diff --git a/gdb/testsuite/gdb.python/py-gil-mthread.py b/gdb/testsuite/gdb.python/py-gil-mthread.py
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.python/py-gil-mthread.py
+@@ -0,0 +1,28 @@
++try:
++ import thread
++except:
++ import _thread
++import time
++import gdb
++
++# Define a function for the thread
++def print_thread_hello():
++ count = 0
++ while count < 10:
++ time.sleep(1)
++ count += 1
++ print ("Hello ( %d )" % count)
++
++# Create a threads a continue
++try:
++ thread.start_new_thread (print_thread_hello, ())
++ gdb.execute ("continue", release_gil=True)
++except:
++ try:
++ _thread.start_new_thread (print_thread_hello, ())
++ gdb.execute ("continue", release_gil=True)
++ except:
++ print ("Error: unable to start thread")
++
++while 1:
++ pass
diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch
new file mode 100644
index 0000000..d06e121
--- /dev/null
+++ b/gdb-rhbz1350436-type-printers-error.patch
@@ -0,0 +1,81 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-rhbz1350436-type-printers-error.patch
+
+;; Test 'info type-printers' Python error (RH BZ 1350436).
+;;=fedoratest
+
+Typo in Python support breaks info type-printers command
+https://bugzilla.redhat.com/show_bug.cgi?id=1350436
+
+[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers
+https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html
+
+diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc
+--- a/gdb/testsuite/gdb.python/py-typeprint.cc
++++ b/gdb/testsuite/gdb.python/py-typeprint.cc
+@@ -31,6 +31,12 @@ templ s;
+
+ basic_string bs;
+
++class Other
++{
++};
++
++Other ovar;
++
+ int main()
+ {
+ return 0;
+diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp
+--- a/gdb/testsuite/gdb.python/py-typeprint.exp
++++ b/gdb/testsuite/gdb.python/py-typeprint.exp
+@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string"
+ gdb_test "whatis bs" "string" "whatis with enabled printer"
+
+ gdb_test "whatis s" "templ"
++
++gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \
++ "info type-printers for other"
++gdb_test "whatis ovar" "type = Another"
+diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py
+--- a/gdb/testsuite/gdb.python/py-typeprint.py
++++ b/gdb/testsuite/gdb.python/py-typeprint.py
+@@ -15,7 +15,7 @@
+
+ import gdb
+
+-class Recognizer(object):
++class StringRecognizer(object):
+ def __init__(self):
+ self.enabled = True
+
+@@ -30,6 +30,26 @@ class StringTypePrinter(object):
+ self.enabled = True
+
+ def instantiate(self):
+- return Recognizer()
++ return StringRecognizer()
+
+ gdb.type_printers.append(StringTypePrinter())
++
++class OtherRecognizer(object):
++ def __init__(self):
++ self.enabled = True
++
++ def recognize(self, type_obj):
++ if type_obj.tag == 'Other':
++ return 'Another'
++ return None
++
++class OtherTypePrinter(object):
++ def __init__(self):
++ self.name = 'other'
++ self.enabled = True
++
++ def instantiate(self):
++ return OtherRecognizer()
++
++import gdb.types
++gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter())
diff --git a/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch b/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
new file mode 100644
index 0000000..b1ba523
--- /dev/null
+++ b/gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
@@ -0,0 +1,65 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Gary Benson
+Date: Mon, 3 Sep 2018 16:14:55 +0100
+Subject: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
+
+;; Fix for 'gdb in batch mode always exit with status 0' (Gary Benson)
+;; RHBZ #1491128
+
+Fix batch exit status test failure on Fedora 28
+
+This commit adds calls to remote_close and clear_gdb_spawn_id to
+gdb.base/batch-exit-status.exp, fixing failures reported by buildbot
+on Fedora 28 where gdb_spawn_id not being reset by the previous test
+caused default_gdb_spawn to return without spawning.
+
+This commit also changes the test to use detect GDB's exit using
+gdb_test_multiple expecting 'eof', rather than using 'wait -i' alone.
+This means the testcase won't hang forever on failure as fixed in
+gdb.base/quit.exp by commit 15763a09d4ae ("Fix 'gdb.base/quit.exp
+hangs forever' if the test fails").
+
+gdb/testsuite/ChangeLog:
+
+ * gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
+ 'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id.
+
+diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
+--- a/gdb/testsuite/ChangeLog
++++ b/gdb/testsuite/ChangeLog
+@@ -1,3 +1,8 @@
++2018-09-04 Gary Benson
++
++ * gdb.base/batch-exit-status.exp: Use gdb_test_multiple and expect
++ 'eof' before 'wait -i'. Use remote_close and clear_gdb_spawn_id.
++
+ 2018-08-16 Gary Benson
+
+ PR gdb/13000:
+diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
+--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
++++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
+@@ -29,11 +29,18 @@ proc _test_exit_status {expect_status cmdline_opts} {
+ return
+ }
+
+- set result [wait -i $gdb_spawn_id]
+- verbose $result
+- gdb_assert { [lindex $result 2] == 0 }
+- set actual_status [lindex $result 3]
+- gdb_assert { $actual_status == $expect_status }
++ gdb_test_multiple "" "run til exit" {
++ eof {
++ set result [wait -i $gdb_spawn_id]
++ verbose $result
++
++ gdb_assert { [lindex $result 2] == 0 }
++ gdb_assert { [lindex $result 3] == $expect_status }
++
++ remote_close host
++ clear_gdb_spawn_id
++ }
++ }
+ }
+
+ proc test_exit_status {expect_status cmdline_opts} {
diff --git a/gdb-rhbz881849-ipv6-1of3.patch b/gdb-rhbz881849-ipv6-1of3.patch
index ec4768e..542db3a 100644
--- a/gdb-rhbz881849-ipv6-1of3.patch
+++ b/gdb-rhbz881849-ipv6-1of3.patch
@@ -1,3 +1,10 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Sergio Durigan Junior
+Date: Fri, 18 May 2018 01:29:24 -0400
+Subject: gdb-rhbz881849-ipv6-1of3.patch
+
+;; Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior).
+
Implement IPv6 support for GDB/gdbserver
This patch implements IPv6 support for both GDB and gdbserver. Based
@@ -1399,3 +1406,529 @@ diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
}
#ifdef SIGPIPE
+diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
+--- a/gdb/testsuite/ChangeLog
++++ b/gdb/testsuite/ChangeLog
+@@ -1,3 +1,23 @@
++2018-07-11 Sergio Durigan Junior
++ Jan Kratochvil
++ Paul Fertser
++ Tsutomu Seki
++
++ * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST'
++ parameter.
++ * boards/native-extended-gdbserver.exp: Do not set 'sockethost'
++ by default.
++ * boards/native-gdbserver.exp: Likewise.
++ * gdb.server/run-without-local-binary.exp: Improve regexp used
++ for detecting when a remote debugging connection succeeds.
++ * gdb.server/server-connect.exp: New file.
++ * lib/gdbserver-support.exp (gdbserver_default_get_comm_port):
++ Do not prefix the port number with ":".
++ (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement
++ support for detecting and using it. Add '$debughost_gdbserver'
++ to the list of arguments used to start gdbserver. Handle case
++ when gdbserver cannot resolve a network name.
++
+ 2018-08-31 Tom Tromey
+
+ * gdb.rust/simple.rs: Rename second variable "v".
+diff --git a/gdb/testsuite/README b/gdb/testsuite/README
+--- a/gdb/testsuite/README
++++ b/gdb/testsuite/README
+@@ -259,6 +259,20 @@ This make (not runtest) variable is used to specify whether the
+ testsuite preloads the read1.so library into expect. Any non-empty
+ value means true. See "Race detection" below.
+
++GDB_TEST_SOCKETHOST
++
++This variable can provide the hostname/address that should be used
++when performing GDBserver-related tests. This is useful in some
++situations, e.g., when you want to test the IPv6 connectivity of GDB
++and GDBserver, or when using a different hostname/address is needed.
++For example, to make GDB and GDBserver use IPv6-only connections, you
++can do:
++
++ make check TESTS="gdb.server/*.exp" RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]'
++
++Note that only a hostname/address can be provided, without a port
++number.
++
+ Race detection
+ **************
+
+diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp
+--- a/gdb/testsuite/boards/native-extended-gdbserver.exp
++++ b/gdb/testsuite/boards/native-extended-gdbserver.exp
+@@ -24,8 +24,6 @@ load_generic_config "extended-gdbserver"
+ load_board_description "gdbserver-base"
+ load_board_description "local-board"
+
+-set_board_info sockethost "localhost:"
+-
+ # We will be using the extended GDB remote protocol.
+ set_board_info gdb_protocol "extended-remote"
+
+diff --git a/gdb/testsuite/boards/native-gdbserver.exp b/gdb/testsuite/boards/native-gdbserver.exp
+--- a/gdb/testsuite/boards/native-gdbserver.exp
++++ b/gdb/testsuite/boards/native-gdbserver.exp
+@@ -30,7 +30,6 @@ set_board_info gdb,do_reload_on_run 1
+ # There's no support for argument-passing (yet).
+ set_board_info noargs 1
+
+-set_board_info sockethost "localhost:"
+ set_board_info use_gdb_stub 1
+ set_board_info exit_is_reliable 1
+
+diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
+--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
++++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
+@@ -53,7 +53,7 @@ save_vars { GDBFLAGS } {
+ set use_gdb_stub 0
+
+ gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \
+- "Remote debugging using $gdbserver_gdbport" \
++ "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \
+ "connect to gdbserver"
+
+ gdb_test "run" \
+diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.server/server-connect.exp
+@@ -0,0 +1,111 @@
++# This testcase is part of GDB, the GNU debugger.
++#
++# Copyright 2018 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++# Test multiple types of connection (IPv4, IPv6, TCP, UDP) and make
++# sure both gdbserver and GDB work.
++
++load_lib gdbserver-support.exp
++
++standard_testfile normal.c
++
++if {[skip_gdbserver_tests]} {
++ return 0
++}
++
++# We want to have control over where we start gdbserver.
++if { [is_remote target] } {
++ return 0
++}
++
++if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
++ return -1
++}
++
++# Make sure we're disconnected, in case we're testing with an
++# extended-remote board, therefore already connected.
++gdb_test "disconnect" ".*"
++
++set target_exec [gdbserver_download_current_prog]
++
++# An array containing the test instructions for each scenario. The
++# description of each field is as follows:
++#
++# - The connection specification to be used when starting
++# gdbserver/GDB. This string will be used to set the
++# GDB_TEST_SOCKETHOST when calling gdbserver_start.
++#
++# - A flag indicating whether gdbserver should fail when we attempt to
++# start it. Useful when testing erroneous connection specs such as
++# "tcp8:".
++#
++# - The prefix that should be prepended to the test messages.
++set test_params \
++ { \
++ { "tcp4:127.0.0.1" 0 "tcp4" } \
++ { "tcp6:::1" 0 "tcp6" } \
++ { "tcp6:[::1]" 0 "tcp6-with-brackets" } \
++ { "tcp:localhost" 0 "tcp" } \
++ { "udp4:127.0.0.1" 0 "udp4" } \
++ { "udp6:::1" 0 "udp6" } \
++ { "udp6:[::1]" 0 "udp6-with-brackets" } \
++ { "tcp8:123" 1 "tcp8" } \
++ { "udp123:::" 1 "udp123" } \
++ { "garbage:1234" 1 "garbage:1234" } \
++ }
++
++# The best way to test different types of connections is to set the
++# GDB_TEST_SOCKETHOST variable accordingly.
++save_vars { GDB_TEST_SOCKETHOST } {
++ foreach line $test_params {
++ set sockhost [lindex $line 0]
++ set gdbserver_should_fail [lindex $line 1]
++ set prefix [lindex $line 2]
++
++ with_test_prefix $prefix {
++ set GDB_TEST_SOCKETHOST $sockhost
++ set test "start gdbserver"
++
++ # Try to start gdbserver.
++ set catchres [catch {set res [gdbserver_start "" $target_exec]} errmsg]
++
++ if { $catchres != 0 } {
++ if { $gdbserver_should_fail } {
++ pass "$test: gdbserver failed as expected"
++ } else {
++ fail "$test: $errmsg"
++ }
++ continue
++ } else {
++ if { $gdbserver_should_fail } {
++ fail "$test: gdbserver should fail but did not"
++ } else {
++ pass "$test"
++ }
++ }
++
++ set gdbserver_protocol [lindex $res 0]
++ set gdbserver_gdbport [lindex $res 1]
++ set test "connect to gdbserver using $sockhost"
++
++ if { [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0 } {
++ pass $test
++ } else {
++ fail $test
++ }
++ }
++ }
++}
+diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
+--- a/gdb/testsuite/lib/gdbserver-support.exp
++++ b/gdb/testsuite/lib/gdbserver-support.exp
+@@ -211,7 +211,7 @@ proc gdbserver_default_get_remote_address { host port } {
+ # Default routine to compute the "comm" argument for gdbserver.
+
+ proc gdbserver_default_get_comm_port { port } {
+- return ":$port"
++ return "$port"
+ }
+
+ # Start a gdbserver process with initial OPTIONS and trailing ARGUMENTS.
+@@ -221,6 +221,7 @@ proc gdbserver_default_get_comm_port { port } {
+
+ proc gdbserver_start { options arguments } {
+ global portnum
++ global GDB_TEST_SOCKETHOST
+
+ # Port id -- either specified in baseboard file, or managed here.
+ if [target_info exists gdb,socketport] {
+@@ -231,10 +232,22 @@ proc gdbserver_start { options arguments } {
+ }
+
+ # Extract the local and remote host ids from the target board struct.
+- if [target_info exists sockethost] {
++ if { [info exists GDB_TEST_SOCKETHOST] } {
++ # The user is not supposed to provide a port number, just a
++ # hostname/address, therefore we add the trailing ":" here.
++ set debughost "${GDB_TEST_SOCKETHOST}:"
++ # Escape open and close square brackets.
++ set debughost_tmp [string map { [ \\[ ] \\] } $debughost]
++ # We need a "gdbserver" version of the debughost, which will
++ # have the possible connection prefix stripped. This is
++ # because gdbserver currently doesn't recognize the prefixes.
++ regsub -all "^\(tcp:|udp:|tcp4:|udp4:|tcp6:|udp6:\)" $debughost_tmp "" debughost_gdbserver
++ } elseif [target_info exists sockethost] {
+ set debughost [target_info sockethost]
++ set debughost_gdbserver $debughost
+ } else {
+ set debughost "localhost:"
++ set debughost_gdbserver $debughost
+ }
+
+ # Some boards use a different value for the port that is passed to
+@@ -277,8 +290,14 @@ proc gdbserver_start { options arguments } {
+ if { $options != "" } {
+ append gdbserver_command " $options"
+ }
++ if { $debughost_gdbserver != "" } {
++ append gdbserver_command " $debughost_gdbserver"
++ }
+ if { $portnum != "" } {
+- append gdbserver_command " [$get_comm_port $portnum]"
++ if { $debughost_gdbserver == "" } {
++ append gdbserver_command " "
++ }
++ append gdbserver_command "[$get_comm_port $portnum]"
+ }
+ if { $arguments != "" } {
+ append gdbserver_command " $arguments"
+@@ -307,6 +326,9 @@ proc gdbserver_start { options arguments } {
+ continue
+ }
+ }
++ -re ".*: cannot resolve name: Name or service not known\r\n" {
++ error "gdbserver cannot resolve name."
++ }
+ timeout {
+ error "Timeout waiting for gdbserver response."
+ }
+diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c
+new file mode 100644
+--- /dev/null
++++ b/gdb/unittests/parse-connection-spec-selftests.c
+@@ -0,0 +1,249 @@
++/* Self tests for parsing connection specs for GDB, the GNU debugger.
++
++ Copyright (C) 2018 Free Software Foundation, Inc.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see . */
++
++#include "defs.h"
++#include "selftest.h"
++#include "common/netstuff.h"
++#include "diagnostics.h"
++#ifdef USE_WIN32API
++#include
++#include
++#else
++#include
++#include
++#include
++#include
++#include
++#endif
++
++namespace selftests {
++namespace parse_connection_spec_tests {
++
++/* Auxiliary struct that holds info about a specific test for a
++ connection spec. */
++
++struct parse_conn_test
++{
++ /* The connection spec. */
++ const char *connspec;
++
++ /* Expected result from 'parse_connection_spec'. */
++ parsed_connection_spec expected_result;
++
++ /* True if this test should fail, false otherwise. If true, only
++ the CONNSPEC field should be considered as valid. */
++ bool should_fail;
++
++ /* The expected AI_FAMILY to be found on the 'struct addrinfo'
++ HINT. */
++ int exp_ai_family;
++
++ /* The expected AI_SOCKTYPE to be found on the 'struct addrinfo'
++ HINT. */
++ int exp_ai_socktype;
++
++ /* The expected AI_PROTOCOL to be found on the 'struct addrinfo'
++ HINT. */
++ int exp_ai_protocol;
++};
++
++/* Some defines to help us fill a 'struct parse_conn_test'. */
++
++/* Initialize a full entry. */
++#define INIT_ENTRY(ADDR, EXP_HOST, EXP_PORT, SHOULD_FAIL, EXP_AI_FAMILY, \
++ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
++ { ADDR, { EXP_HOST, EXP_PORT }, SHOULD_FAIL, EXP_AI_FAMILY, \
++ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL }
++
++/* Initialize an unprefixed entry. In this case, we don't expect
++ anything on the 'struct addrinfo' HINT. */
++#define INIT_UNPREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, 0, 0, 0)
++
++/* Initialized an unprefixed IPv6 entry. In this case, we don't
++ expect anything on the 'struct addrinfo' HINT. */
++#define INIT_UNPREFIXED_IPV6_ENTRY(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, AF_INET6, 0, 0)
++
++/* Initialize a prefixed entry. */
++#define INIT_PREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT, EXP_AI_FAMILY, \
++ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
++ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, EXP_AI_FAMILY, \
++ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL)
++
++/* Initialize an entry prefixed with "tcp4:". */
++#define INIT_PREFIXED_IPV4_TCP(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_STREAM, \
++ IPPROTO_TCP)
++
++/* Initialize an entry prefixed with "tcp6:". */
++#define INIT_PREFIXED_IPV6_TCP(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_STREAM, \
++ IPPROTO_TCP)
++
++/* Initialize an entry prefixed with "udp4:". */
++#define INIT_PREFIXED_IPV4_UDP(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_DGRAM, \
++ IPPROTO_UDP)
++
++/* Initialize an entry prefixed with "udp6:". */
++#define INIT_PREFIXED_IPV6_UDP(ADDR, EXP_HOST, EXP_PORT) \
++ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_DGRAM, \
++ IPPROTO_UDP)
++
++/* Initialize a bogus entry, i.e., a connection spec that should
++ fail. */
++#define INIT_BOGUS_ENTRY(ADDR) \
++ INIT_ENTRY (ADDR, "", "", true, 0, 0, 0)
++
++/* The variable which holds all of our tests. */
++
++static const parse_conn_test conn_test[] =
++ {
++ /* Unprefixed addresses. */
++
++ /* IPv4, host and port present. */
++ INIT_UNPREFIXED_ENTRY ("127.0.0.1:1234", "127.0.0.1", "1234"),
++ /* IPv4, only host. */
++ INIT_UNPREFIXED_ENTRY ("127.0.0.1", "127.0.0.1", ""),
++ /* IPv4, missing port. */
++ INIT_UNPREFIXED_ENTRY ("127.0.0.1:", "127.0.0.1", ""),
++
++ /* IPv6, host and port present, no brackets. */
++ INIT_UNPREFIXED_ENTRY ("::1:1234", "::1", "1234"),
++ /* IPv6, missing port, no brackets. */
++ INIT_UNPREFIXED_ENTRY ("::1:", "::1", ""),
++ /* IPv6, host and port present, with brackets. */
++ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:1234", "::1", "1234"),
++ /* IPv6, only host, with brackets. */
++ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]", "::1", ""),
++ /* IPv6, missing port, with brackets. */
++ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:", "::1", ""),
++
++ /* Unspecified, only port. */
++ INIT_UNPREFIXED_ENTRY (":1234", "localhost", "1234"),
++
++ /* Prefixed addresses. */
++
++ /* Prefixed "tcp4:" IPv4, host and port presents. */
++ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:1234", "127.0.0.1", "1234"),
++ /* Prefixed "tcp4:" IPv4, only port. */
++ INIT_PREFIXED_IPV4_TCP ("tcp4::1234", "localhost", "1234"),
++ /* Prefixed "tcp4:" IPv4, only host. */
++ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1", "127.0.0.1", ""),
++ /* Prefixed "tcp4:" IPv4, missing port. */
++ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:", "127.0.0.1", ""),
++
++ /* Prefixed "udp4:" IPv4, host and port present. */
++ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:1234", "127.0.0.1", "1234"),
++ /* Prefixed "udp4:" IPv4, only port. */
++ INIT_PREFIXED_IPV4_UDP ("udp4::1234", "localhost", "1234"),
++ /* Prefixed "udp4:" IPv4, only host. */
++ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1", "127.0.0.1", ""),
++ /* Prefixed "udp4:" IPv4, missing port. */
++ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:", "127.0.0.1", ""),
++
++
++ /* Prefixed "tcp6:" IPv6, host and port present. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:1234", "::1", "1234"),
++ /* Prefixed "tcp6:" IPv6, only port. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6::1234", "localhost", "1234"),
++ /* Prefixed "tcp6:" IPv6, only host. */
++ //INIT_PREFIXED_IPV6_TCP ("tcp6:::1", "::1", ""),
++ /* Prefixed "tcp6:" IPv6, missing port. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:", "::1", ""),
++
++ /* Prefixed "udp6:" IPv6, host and port present. */
++ INIT_PREFIXED_IPV6_UDP ("udp6:::1:1234", "::1", "1234"),
++ /* Prefixed "udp6:" IPv6, only port. */
++ INIT_PREFIXED_IPV6_UDP ("udp6::1234", "localhost", "1234"),
++ /* Prefixed "udp6:" IPv6, only host. */
++ //INIT_PREFIXED_IPV6_UDP ("udp6:::1", "::1", ""),
++ /* Prefixed "udp6:" IPv6, missing port. */
++ INIT_PREFIXED_IPV6_UDP ("udp6:::1:", "::1", ""),
++
++ /* Prefixed "tcp6:" IPv6 with brackets, host and port present. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:1234", "::1", "1234"),
++ /* Prefixed "tcp6:" IPv6 with brackets, only host. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]", "::1", ""),
++ /* Prefixed "tcp6:" IPv6 with brackets, missing port. */
++ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:", "::1", ""),
++
++ /* Prefixed "udp6:" IPv6 with brackets, host and port present. */
++ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:1234", "::1", "1234"),
++ /* Prefixed "udp6:" IPv6 with brackets, only host. */
++ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]", "::1", ""),
++ /* Prefixed "udp6:" IPv6 with brackets, missing port. */
++ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:", "::1", ""),
++
++
++ /* Bogus addresses. */
++ INIT_BOGUS_ENTRY ("tcp6:[::1]123:44"),
++ INIT_BOGUS_ENTRY ("[::1"),
++ INIT_BOGUS_ENTRY ("tcp6:::1]:"),
++ };
++
++/* Test a connection spec C. */
++
++static void
++test_conn (const parse_conn_test &c)
++{
++ struct addrinfo hint;
++ parsed_connection_spec ret;
++
++ memset (&hint, 0, sizeof (hint));
++
++ TRY
++ {
++ ret = parse_connection_spec (c.connspec, &hint);
++ }
++ CATCH (ex, RETURN_MASK_ERROR)
++ {
++ /* If we caught an error, we should check if this connection
++ spec was supposed to fail. */
++ SELF_CHECK (c.should_fail);
++ return;
++ }
++ END_CATCH
++
++ SELF_CHECK (!c.should_fail);
++ SELF_CHECK (ret.host_str == c.expected_result.host_str);
++ SELF_CHECK (ret.port_str == c.expected_result.port_str);
++ SELF_CHECK (hint.ai_family == c.exp_ai_family);
++ SELF_CHECK (hint.ai_socktype == c.exp_ai_socktype);
++ SELF_CHECK (hint.ai_protocol == c.exp_ai_protocol);
++}
++
++/* Run the tests associated with parsing connection specs. */
++
++static void
++run_tests ()
++{
++ for (const parse_conn_test &c : conn_test)
++ test_conn (c);
++}
++} /* namespace parse_connection_spec_tests */
++} /* namespace selftests */
++
++void
++_initialize_parse_connection_spec_selftests ()
++{
++ selftests::register_test ("parse_connection_spec",
++ selftests::parse_connection_spec_tests::run_tests);
++}
diff --git a/gdb-rhbz881849-ipv6-2of3.patch b/gdb-rhbz881849-ipv6-2of3.patch
new file mode 100644
index 0000000..390be0f
--- /dev/null
+++ b/gdb-rhbz881849-ipv6-2of3.patch
@@ -0,0 +1,54 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Sergio Durigan Junior
+Date: Mon, 30 Jul 2018 15:23:27 -0400
+Subject: gdb-rhbz881849-ipv6-2of3.patch
+
+Match any kind of error after "cannot resolve name" on lib/gdbserver-support.exp:gdbserver_start
+
+On commit:
+
+commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585
+Author: Sergio Durigan Junior
+Date: Fri Jul 13 16:20:34 2018 -0400
+
+ Expect for another variant of error message when gdbserver cannot resolve hostname
+
+I extended the regular expression being used to identify whether
+gdbserver could not resolve a (host)name. This was needed because the
+error message being printed had a different variation across some
+systems. However, as it turns out, I've just noticed that the message
+has yet another variation:
+
+ target remote tcp8:123:2353
+ tcp8:123:2353: cannot resolve name: System error
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ tcp8:123:2353: No such file or directory.
+ (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123
+
+which is causing FAILs on some systems (namely, Fedora-i686 on
+BuildBot).
+
+So instead of trying to predict everything that can be printed, I
+decided to just match anything after the "cannot resolve name: " part.
+This patch implements that.
+
+Regression tested on the BuildBot.
+
+gdb/testsuite/ChangeLog:
+2018-07-30 Sergio Durigan Junior
+
+ * lib/gdbserver-support.exp (gdbserver_start): Match any kind of
+ error after "cannot resolve name" string.
+
+diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
+--- a/gdb/testsuite/lib/gdbserver-support.exp
++++ b/gdb/testsuite/lib/gdbserver-support.exp
+@@ -326,7 +326,7 @@ proc gdbserver_start { options arguments } {
+ continue
+ }
+ }
+- -re ".*: cannot resolve name: Name or service not known\r\n" {
++ -re ".*: cannot resolve name: .*\r\n" {
+ error "gdbserver cannot resolve name."
+ }
+ timeout {
diff --git a/gdb-vla-intel-fix-print-char-array.patch b/gdb-vla-intel-fix-print-char-array.patch
index dcccc7b..944f82b 100644
--- a/gdb-vla-intel-fix-print-char-array.patch
+++ b/gdb-vla-intel-fix-print-char-array.patch
@@ -1,3 +1,10 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Sergio Durigan Junior
+Date: Thu, 7 Dec 2017 16:20:31 -0500
+Subject: gdb-vla-intel-fix-print-char-array.patch
+
+;; Revert upstream commit 469412dd9ccc4de5874fd3299b105833f36b34cd
+
Revert commit (only the part touching gdb/f-valprint.c):
commit 469412dd9ccc4de5874fd3299b105833f36b34cd
@@ -40,3 +47,15 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
break;
case TYPE_CODE_STRUCT:
+diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fortran/printing-types.exp
+--- a/gdb/testsuite/gdb.fortran/printing-types.exp
++++ b/gdb/testsuite/gdb.fortran/printing-types.exp
+@@ -29,7 +29,7 @@ if {![runto MAIN__]} then {
+ gdb_breakpoint [gdb_get_line_number "write"]
+ gdb_continue_to_breakpoint "write"
+
+-gdb_test "print oneByte" " = 1"
++gdb_test "print oneByte" " = 1 \'\\\\001\'"
+ gdb_test "print twobytes" " = 2"
+ gdb_test "print chvalue" " = \'a\'"
+ gdb_test "print logvalue" " = \.TRUE\."
diff --git a/gdb-vla-intel-fortran-strides.patch b/gdb-vla-intel-fortran-strides.patch
index f504308..7868efe 100644
--- a/gdb-vla-intel-fortran-strides.patch
+++ b/gdb-vla-intel-fortran-strides.patch
@@ -1,3 +1,11 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-vla-intel-fortran-strides.patch
+
+;; VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests.
+;;=push
+
git diff --stat -p gdb/master...gdb/users/bheckel/fortran-strides
dbfd7140bf4c0500d1f5d192be781f83f78f7922
@@ -14,6 +22,13 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922
gdb/parse.c | 24 +-
gdb/rust-exp.y | 12 +-
gdb/rust-lang.c | 17 +-
+ gdb/testsuite/gdb.fortran/static-arrays.exp | 421 ++++++++++++++++++++++++++++
+ gdb/testsuite/gdb.fortran/static-arrays.f90 | 55 ++++
+ gdb/testsuite/gdb.fortran/vla-ptype.exp | 4 +
+ gdb/testsuite/gdb.fortran/vla-sizeof.exp | 4 +
+ gdb/testsuite/gdb.fortran/vla-stride.exp | 44 +++
+ gdb/testsuite/gdb.fortran/vla-stride.f90 | 29 ++
+ gdb/testsuite/gdb.fortran/vla.f90 | 10 +
gdb/valarith.c | 10 +-
gdb/valops.c | 197 +++++++++++--
gdb/value.h | 2 +
@@ -1134,6 +1149,615 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
high = high_bound;
if (high < 0)
error (_("High index less than zero"));
+diff --git a/gdb/testsuite/gdb.fortran/static-arrays.exp b/gdb/testsuite/gdb.fortran/static-arrays.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/static-arrays.exp
+@@ -0,0 +1,421 @@
++# Copyright 2015 Free Software Foundation, Inc.
++#
++# Contributed by Intel Corp.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile static-arrays.f90
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
++ return -1
++}
++
++if ![runto MAIN__] then {
++ perror "couldn't run to breakpoint MAIN__"
++ continue
++}
++
++gdb_breakpoint [gdb_get_line_number "BP1"]
++gdb_continue_to_breakpoint "BP1" ".*BP1.*"
++
++# Tests subarrays of one dimensional arrays with subrange variations
++gdb_test "print ar1" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
++ "print ar1."
++gdb_test "print ar1\(4:7\)" "\\$\[0-9\]+ = \\(4, 5, 6, 7\\)" \
++ "print ar1\(4:7\)"
++gdb_test "print ar1\(8:\)" "\\$\[0-9\]+ = \\(8, 9\\).*" \
++ "print ar1\(8:\)"
++gdb_test "print ar1\(:3\)" "\\$\[0-9\]+ = \\(1, 2, 3\\).*" \
++ "print ar1\(:3\)"
++gdb_test "print ar1\(:\)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7, 8, 9\\)" \
++ "print ar1\(:\)"
++
++# Check assignment
++gdb_test_no_output "set \$my_ary = ar1\(3:8\)"
++gdb_test "print \$my_ary" \
++ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
++ "Assignment of subarray to variable"
++gdb_test_no_output "set ar1\(5\) = 42"
++ gdb_test "print ar1\(3:8\)" \
++ "\\$\[0-9\]+ = \\(3, 4, 42, 6, 7, 8\\)" \
++ "print ar1\(3:8\) after assignment"
++gdb_test "print \$my_ary" \
++ "\\$\[0-9\]+ = \\(3, 4, 5, 6, 7, 8\\)" \
++ "Assignment of subarray to variable after original array changed"
++
++# Test for subarrays of one dimensional arrays with literals
++ gdb_test "print ar1\(3\)" "\\$\[0-9\]+ = 3" \
++ "print ar1\(3\)"
++
++# Tests for subranges of 2 dimensional arrays with subrange variations
++gdb_test "print ar2\(2:3, 3:4\)" \
++ "\\$\[0-9\]+ = \\(\\( 23, 33\\) \\( 24, 34\\) \\)" \
++ "print ar2\(2:3, 3:4\)."
++gdb_test "print ar2\(8:9,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
++ "print ar2\(8:9,8:\)"
++gdb_test "print ar2\(8:9,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
++ "print ar2\(8:9,:2\)"
++
++gdb_test "print ar2\(8:,8:9\)" \
++ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
++ "print ar2\(8:,8:9\)"
++gdb_test "print ar2\(8:,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 88, 98\\) \\( 89, 99\\) \\)" \
++ "print ar2\(8:,8:\)"
++gdb_test "print ar2\(8:,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 81, 91\\) \\( 82, 92\\) \\)" \
++ "print ar2\(8:,:2\)"
++
++gdb_test "print ar2\(:2,2:3\)" \
++ "\\$\[0-9\]+ = \\(\\( 12, 22\\) \\( 13, 23\\) \\)" \
++ "print ar2\(:2,2:3\)"
++gdb_test "print ar2\(:2,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 18, 28\\) \\( 19, 29\\) \\)" \
++ "print ar2\(:2,8:\)"
++gdb_test "print ar2\(:2,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 11, 21\\) \\( 12, 22\\) \\)" \
++ "print ar2\(:2,:2\)"
++
++# Test subranges of 2 dimensional arrays with literals and subrange variations
++gdb_test "print ar2\(7, 3:6\)" \
++ "\\$\[0-9\]+ = \\(73, 74, 75, 76\\)" \
++ "print ar2\(7, 3:6\)"
++gdb_test "print ar2\(7,8:\)" \
++ "\\$\[0-9\]+ = \\(78, 79\\)" \
++ "print ar2\(7,8:\)"
++gdb_test "print ar2\(7,:2\)" \
++ "\\$\[0-9\]+ = \\(71, 72\\)" \
++ "print ar2\(7,:2\)"
++
++gdb_test "print ar2\(7:8,4\)" \
++ "\\$\[0-9\]+ = \\(74, 84\\)" \
++ "print ar2(7:8,4\)"
++gdb_test "print ar2\(8:,4\)" \
++ "\\$\[0-9\]+ = \\(84, 94\\)" \
++ "print ar2\(8:,4\)"
++gdb_test "print ar2\(:2,4\)" \
++ "\\$\[0-9\]+ = \\(14, 24\\)" \
++ "print ar2\(:2,4\)"
++gdb_test "print ar2\(3,4\)" \
++ "\\$\[0-9\]+ = 34" \
++ "print ar2\(3,4\)"
++
++# Test subarrays of 3 dimensional arrays with literals and subrange variations
++gdb_test "print ar3\(2:4,3:4,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 237, 337, 437\\) \\( 247, 347, 447\\)\
++ \\) \\( \\( 238, 338, 438\\) \\( 248, 348, 448\\) \\) \\)" \
++ "print ar3\(2:4,3:4,7:8\)"
++gdb_test "print ar3\(2:3,4:5,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 248, 348\\) \\( 258, 358\\) \\) \\(\
++ \\( 249, 349\\) \\( 259, 359\\) \\) \\)" \
++ "print ar3\(2:3,4:5,8:\)"
++gdb_test "print ar3\(2:3,4:5,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 241, 341\\) \\( 251, 351\\) \\) \\(\
++ \\( 242, 342\\) \\( 252, 352\\) \\) \\)" \
++ "print ar3\(2:3,4:5,:2\)"
++
++gdb_test "print ar3\(2:3,8:,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 287, 387\\) \\( 297, 397\\) \\) \\(\
++ \\( 288, 388\\) \\( 298, 398\\) \\) \\)" \
++ "print ar3\(2:3,8:,7:8\)"
++gdb_test "print ar3\(2:3,8:,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 288, 388\\) \\( 298, 398\\) \\) \\(\
++ \\( 289, 389\\) \\( 299, 399\\) \\) \\)" \
++ "print ar3\(2:3,8:,8:\)"
++gdb_test "print ar3\(2:3,8:,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 281, 381\\) \\( 291, 391\\) \\) \\(\
++ \\( 282, 382\\) \\( 292, 392\\) \\) \\)" \
++ "print ar3\(2:3,8:,:2\)"
++
++gdb_test "print ar3\(2:3,:2,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 217, 317\\) \\( 227, 327\\) \\) \\(\
++ \\( 218, 318\\) \\( 228, 328\\) \\) \\)" \
++ "print ar3\(2:3,:2,7:8\)"
++gdb_test "print ar3\(2:3,:2,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 218, 318\\) \\( 228, 328\\) \\) \\(\
++ \\( 219, 319\\) \\( 229, 329\\) \\) \\)" \
++ "print ar3\(2:3,:2,8:\)"
++gdb_test "print ar3\(2:3,:2,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 211, 311\\) \\( 221, 321\\) \\) \\(\
++ \\( 212, 312\\) \\( 222, 322\\) \\) \\)" \
++ "print ar3\(2:3,:2,:2\)"
++
++gdb_test "print ar3\(8:,3:4,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 837, 937\\) \\( 847, 947\\) \\) \\(\
++ \\( 838, 938\\) \\( 848, 948\\) \\) \\)" \
++ "print ar3\(8:,3:4,7:8\)"
++gdb_test "print ar3\(8:,4:5,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 848, 948\\) \\( 858, 958\\) \\) \\(\
++ \\( 849, 949\\) \\( 859, 959\\) \\) \\)" \
++ "print ar3\(8:,4:5,8:\)"
++gdb_test "print ar3\(8:,4:5,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 841, 941\\) \\( 851, 951\\) \\) \\(\
++ \\( 842, 942\\) \\( 852, 952\\) \\) \\)" \
++ "print ar3\(8:,4:5,:2\)"
++
++gdb_test "print ar3\(8:,8:,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 887, 987\\) \\( 897, 997\\) \\) \\(\
++ \\( 888, 988\\) \\( 898, 998\\) \\) \\)" \
++ "print ar3\(8:,8:,7:8\)"
++gdb_test "print ar3\(8:,8:,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 888, 988\\) \\( 898, 998\\) \\) \\(\
++ \\( 889, 989\\) \\( 899, 999\\) \\) \\)" \
++ "print ar3\(8:,8:,8:\)"
++gdb_test "print ar3\(8:,8:,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 881, 981\\) \\( 891, 991\\) \\) \\(\
++ \\( 882, 982\\) \\( 892, 992\\) \\) \\)" \
++ "print ar3\(8:,8:,:2\)"
++
++gdb_test "print ar3\(8:,:2,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 817, 917\\) \\( 827, 927\\) \\) \\(\
++ \\( 818, 918\\) \\( 828, 928\\) \\) \\)" \
++ "print ar3\(8:,:2,7:8\)"
++gdb_test "print ar3\(8:,:2,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 818, 918\\) \\( 828, 928\\) \\) \\(\
++ \\( 819, 919\\) \\( 829, 929\\) \\) \\)" \
++ "print ar3\(8:,:2,8:\)"
++gdb_test "print ar3\(8:,:2,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 811, 911\\) \\( 821, 921\\) \\) \\(\
++ \\( 812, 912\\) \\( 822, 922\\) \\) \\)" \
++ "print ar3\(8:,:2,:2\)"
++
++
++gdb_test "print ar3\(:2,3:4,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 137, 237\\) \\( 147, 247\\) \\) \\(\
++ \\( 138, 238\\) \\( 148, 248\\) \\) \\)" \
++ "print ar3 \(:2,3:4,7:8\)."
++gdb_test "print ar3\(:2,3:4,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 138, 238\\) \\( 148, 248\\) \\) \\(\
++ \\( 139, 239\\) \\( 149, 249\\) \\) \\)" \
++ "print ar3\(:2,3:4,8:\)"
++gdb_test "print ar3\(:2,3:4,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 131, 231\\) \\( 141, 241\\) \\) \\(\
++ \\( 132, 232\\) \\( 142, 242\\) \\) \\)" \
++ "print ar3\(:2,3:4,:2\)"
++
++gdb_test "print ar3\(:2,8:,7:8\)" "\\$\[0-9\]+ = \\(\\( \\( 187, 287\\) \\(\
++ 197, 297\\) \\) \\( \\( 188, 288\\) \\( 198, 298\\) \\) \\)" \
++ "print ar3\(:2,8:,7:8\)"
++gdb_test "print ar3\(:2,8:,8:\)" "\\$\[0-9\]+ = \\(\\( \\( 188, 288\\) \\( 198,\
++ 298\\) \\) \\( \\( 189, 289\\) \\( 199, 299\\) \\) \\)" \
++ "print ar3\(:2,8:,8:\)"
++gdb_test "print ar3\(:2,8:,:2\)" "\\$\[0-9\]+ = \\(\\( \\( 181, 281\\) \\( 191,\
++ 291\\) \\) \\( \\( 182, 282\\) \\( 192, 292\\) \\) \\)" \
++ "print ar3\(:2,8:,:2\)"
++
++gdb_test "print ar3\(:2,:2,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 117, 217\\) \\( 127, 227\\) \\) \\(\
++ \\( 118, 218\\) \\( 128, 228\\) \\) \\)" \
++ "print ar3\(:2,:2,7:8\)"
++gdb_test "print ar3\(:2,:2,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 118, 218\\) \\( 128, 228\\) \\) \\(\
++ \\( 119, 219\\) \\( 129, 229\\) \\) \\)" \
++ "print ar3\(:2,:2,8:\)"
++gdb_test "print ar3\(:2,:2,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 111, 211\\) \\( 121, 221\\) \\) \\(\
++ \\( 112, 212\\) \\( 122, 222\\) \\) \\)" \
++ "print ar3\(:2,:2,:2\)"
++
++#Tests for subarrays of 3 dimensional arrays with literals and subranges
++gdb_test "print ar3\(3,3:4,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 337, 347\\) \\( 338, 348\\) \\)" \
++ "print ar3\(3,3:4,7:8\)"
++gdb_test "print ar3\(3,4:5,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 348, 358\\) \\( 349, 359\\) \\)" \
++ "print ar3\(3,4:5,8:\)"
++gdb_test "print ar3\(3,4:5,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 341, 351\\) \\( 342, 352\\) \\)" \
++ "print ar3\(3,4:5,:2\)"
++gdb_test "print ar3\(3,4:5,3\)" \
++ "\\$\[0-9\]+ = \\(343, 353\\)" \
++ "print ar3\(3,4:5,3\)"
++
++gdb_test "print ar3\(2,8:,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 287, 297\\) \\( 288, 298\\) \\)" \
++ "print ar3\(2,8:,7:8\)"
++gdb_test "print ar3\(2,8:,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 288, 298\\) \\( 289, 299\\) \\)" \
++ "print ar3\(2,8:,8:\)"
++gdb_test "print ar3\(2,8:,:2\)"\
++ "\\$\[0-9\]+ = \\(\\( 281, 291\\) \\( 282, 292\\) \\)" \
++ "print ar3\(2,8:,:2\)"
++gdb_test "print ar3\(2,8:,3\)" \
++ "\\$\[0-9\]+ = \\(283, 293\\)" \
++ "print ar3\(2,8:,3\)"
++
++gdb_test "print ar3\(2,:2,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 217, 227\\) \\( 218, 228\\) \\)" \
++ "print ar3\(2,:2,7:8\)"
++gdb_test "print ar3\(2,:2,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 218, 228\\) \\( 219, 229\\) \\)" \
++ "print ar3\(2,:2,8:\)"
++gdb_test "print ar3\(2,:2,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 211, 221\\) \\( 212, 222\\) \\)" \
++ "print ar3\(2,:2,:2\)"
++gdb_test "print ar3\(2,:2,3\)" \
++ "\\$\[0-9\]+ = \\(213, 223\\)" \
++ "print ar3\(2,:2,3\)"
++
++gdb_test "print ar3\(3,4,7:8\)" \
++ "\\$\[0-9\]+ = \\(347, 348\\)" \
++ "print ar3\(3,4,7:8\)"
++gdb_test "print ar3\(3,4,8:\)" \
++ "\\$\[0-9\]+ = \\(348, 349\\)" \
++i "print ar3\(3,4,8:\)"
++gdb_test "print ar3\(3,4,:2\)" \
++ "\\$\[0-9\]+ = \\(341, 342\\)" \
++ "print ar3\(3,4,:2\)"
++gdb_test "print ar3\(5,6,7\)" \
++ "\\$\[0-9\]+ = 567" \
++ "print ar3\(5,6,7\)"
++
++gdb_test "print ar3\(3:4,6,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 367, 467\\) \\( 368, 468\\) \\)" \
++ "print ar3\(3:4,6,7:8\)"
++gdb_test "print ar3\(3:4,6,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 368, 468\\) \\( 369, 469\\) \\)" \
++ "print ar3\(3:4,6,8:\)"
++gdb_test "print ar3\(3:4,6,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 361, 461\\) \\( 362, 462\\) \\)" \
++ "print ar3\(3:4,6,:2\)"
++gdb_test "print ar3\(3:4,6,5\)" \
++ "\\$\[0-9\]+ = \\(365, 465\\)" \
++ "print ar3\(3:4,6,5\)"
++
++gdb_test "print ar3\(8:,6,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 867, 967\\) \\( 868, 968\\) \\)" \
++ "print ar3\(8:,6,7:8\)"
++gdb_test "print ar3\(8:,6,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 868, 968\\) \\( 869, 969\\) \\)" \
++ "print ar3\(8:,6,8:\)"
++gdb_test "print ar3\(8:,6,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 861, 961\\) \\( 862, 962\\) \\)" \
++ "print ar3\(8:,6,:2\)"
++gdb_test "print ar3\(8:,6,5\)" \
++ "\\$\[0-9\]+ = \\(865, 965\\)" \
++ "print ar3\(8:,6,5\)"
++
++gdb_test "print ar3\(:2,6,7:8\)" \
++ "\\$\[0-9\]+ = \\(\\( 167, 267\\) \\( 168, 268\\) \\)" \
++ "print ar3\(:2,6,7:8\)"
++gdb_test "print ar3\(:2,6,8:\)" \
++ "\\$\[0-9\]+ = \\(\\( 168, 268\\) \\( 169, 269\\) \\)" \
++ "print ar3\(:2,6,8:\)"
++gdb_test "print ar3\(:2,6,:2\)" \
++ "\\$\[0-9\]+ = \\(\\( 161, 261\\) \\( 162, 262\\) \\)" \
++ "print ar3\(:2,6,:2\)"
++gdb_test "print ar3\(:2,6,5\)" \
++ "\\$\[0-9\]+ = \\(165, 265\\)" \
++ "print ar3\(:2,6,5\)"
++
++gdb_test "print ar3\(3:4,5:6,4\)" \
++ "\\$\[0-9\]+ = \\(\\( 354, 454\\) \\( 364, 464\\) \\)" \
++ "print ar2\(3:4,5:6,4\)"
++gdb_test "print ar3\(8:,5:6,4\)" \
++ "\\$\[0-9\]+ = \\(\\( 854, 954\\) \\( 864, 964\\) \\)" \
++ "print ar2\(8:,5:6,4\)"
++gdb_test "print ar3\(:2,5:6,4\)" \
++ "\\$\[0-9\]+ = \\(\\( 154, 254\\) \\( 164, 264\\) \\)" \
++ "print ar2\(:2,5:6,4\)"
++
++# Stride > 1
++gdb_test "print ar1\(2:6:2\)" \
++ "\\$\[0-9\]+ = \\(2, 4, 6\\)" \
++ "print ar1\(2:6:2\)"
++gdb_test "print ar2\(2:6:2,3:4\)" \
++ "\\$\[0-9\]+ = \\(\\( 23, 43, 63\\) \\( 24, 44, 64\\) \\)" \
++ "print ar2\(2:6:2,3:4\)"
++gdb_test "print ar2\(2:6:2,3\)" \
++ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \
++ "print ar2\(2:6:2,3\)"
++gdb_test "print ar3\(2:6:2,3:5:2,4:7:3\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 234, 434, 634\\) \\( 254, 454, 654\\)\
++ \\) \\( \\( 237, 437, 637\\) \\( 257, 457, 657\\) \\) \\)" \
++ "print ar3\(2:6:2,3:5:2,4:7:3\)"
++gdb_test "print ar3\(2:6:2,5,4:7:3\)" \
++ "\\$\[0-9\]+ = \\(\\( 254, 454, 654\\) \\( 257, 457, 657\\)\
++ \\)" \
++ "print ar3\(2:6:2,5,4:7:3\)"
++
++# Stride < 0
++gdb_test "print ar1\(8:2:-2\)" \
++ "\\$\[0-9\]+ = \\(8, 6, 4, 2\\)" \
++ "print ar1\(8:2:-2\)"
++gdb_test "print ar2\(8:2:-2,3:4\)" \
++ "\\$\[0-9\]+ = \\(\\( 83, 63, 43, 23\\) \\( 84, 64, 44, 24\\)\
++ \\)" \
++ "print ar2\(8:2:-2,3:4\)"
++gdb_test "print ar2\(2:6:2,3\)" \
++ "\\$\[0-9\]+ = \\(23, 43, 63\\)" \
++ "print ar2\(2:6:2,3\)"
++gdb_test "print ar3\(2:3,7:3:-4,4:7:3\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 274, 374\\) \\( 234, 334\\) \\) \\(\
++ \\( 277, 377\\) \\( 237, 337\\) \\) \\)" \
++ "print ar3\(2:3,7:3:-4,4:7:3\)"
++gdb_test "print ar3\(2:6:2,5,7:4:-3\)" \
++ "\\$\[0-9\]+ = \\(\\( 257, 457, 657\\) \\( 254, 454, 654\\)\
++ \\)" \
++ "print ar3\(2:6:2,5,7:4:-3\)"
++
++# Tests with negative and mixed indices
++gdb_test "p ar4\(2:4, -2:1, -15:-14\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 261, 361, 461\\) \\( 271, 371, 471\\)\
++ \\( 281, 381, 481\\) \\( 291, 391, 491\\) \\) \\( \\( 262,\
++ 362, 462\\) \\( 272, 372, 472\\) \\( 282, 382, 482\\) \\( 292,\
++ 392, 492\\) \\) \\)" \
++ "print ar4(2:4, -2:1, -15:-14)"
++
++gdb_test "p ar4\(7,-6:2:3,-7\)" \
++ "\\$\[0-9\]+ = \\(729, 759, 789\\)" \
++ "print ar4(7,-6:2:3,-7)"
++
++gdb_test "p ar4\(9:2:-2, -6:2:3, -6:-15:-3\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 930, 730, 530, 330\\) \\( 960, 760,\
++ 560, 360\\) \\( 990, 790, 590, 390\\) \\) \\( \\( 927, 727,\
++ 527, 327\\) \\( 957, 757, 557, 357\\) \\( 987, 787, 587,\
++ 387\\) \\) \\( \\( 924, 724, 524, 324\\) \\( 954, 754, 554,\
++ 354\\) \\( 984, 784, 584, 384\\) \\) \\( \\( 921, 721, 521,\
++ 321\\) \\( 951, 751, 551, 351\\) \\( 981, 781, 581, 381\\) \\)\
++ \\)" \
++ "print ar4(9:2:-2, -6:2:3, -6:-15:-3)"
++
++gdb_test "p ar4\(:,:,:\)" \
++ "\\$\[0-9\]+ = \\(\\( \\( 111, 211, 311, 411, 511, 611, 711,\
++ 811, .*" \
++ "print ar4(:,:,:)"
++
++# Provoke error messages for bad user input
++gdb_test "print ar1\(0:4\)" \
++ "provided bound\\(s\\) outside array bound\\(s\\)" \
++ "print ar1\(0:4\)"
++gdb_test "print ar1\(8:12\)" \
++ "provided bound\\(s\\) outside array bound\\(s\\)" \
++ "print ar1\(8:12\)"
++gdb_test "print ar1\(8:2:\)" \
++ "A syntax error in expression, near `\\)'." \
++ "print ar1\(8:2:\)"
++gdb_test "print ar1\(8:2:2\)" \
++ "Wrong value provided for stride and boundaries" \
++ "print ar1\(8:2:2\)"
++gdb_test "print ar1\(2:8:-2\)" \
++ "Wrong value provided for stride and boundaries" \
++ "print ar1\(2:8:-2\)"
++gdb_test "print ar1\(2:7:0\)" \
++ "Stride must not be 0" \
++ "print ar1\(2:7:0\)"
++gdb_test "print ar1\(3:7\) = 42" \
++ "Invalid cast." \
++ "Assignment of value to subarray"
+diff --git a/gdb/testsuite/gdb.fortran/static-arrays.f90 b/gdb/testsuite/gdb.fortran/static-arrays.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/static-arrays.f90
+@@ -0,0 +1,55 @@
++! Copyright 2015 Free Software Foundation, Inc.
++!
++! Contributed by Intel Corp.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program. If not, see .
++
++subroutine sub
++ integer, dimension(9) :: ar1
++ integer, dimension(9,9) :: ar2
++ integer, dimension(9,9,9) :: ar3
++ integer, dimension(10,-7:3, -15:-5) :: ar4
++ integer :: i,j,k
++
++ ar1 = 1
++ ar2 = 1
++ ar3 = 1
++ ar4 = 4
++
++ ! Resulting array ar3 looks like ((( 111, 112, 113, 114,...)))
++ do i = 1, 9, 1
++ ar1(i) = i
++ do j = 1, 9, 1
++ ar2(i,j) = i*10 + j
++ do k = 1, 9, 1
++ ar3(i,j,k) = i*100 + j*10 + k
++ end do
++ end do
++ end do
++
++ do i = 1, 10, 1
++ do j = -7, 3, 1
++ do k = -15, -5, 1
++ ar4(i,j,k) = i*100 + (j+8)*10 + (k+16)
++ end do
++ end do
++ end do
++
++ ar1(1) = 11 !BP1
++ return
++end
++
++program testprog
++ call sub
++end
+diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
+--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
++++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
+@@ -98,3 +98,7 @@ gdb_test "ptype vla2" "type = " "ptype vla2 not allocated"
+ gdb_test "ptype vla2(5, 45, 20)" \
+ "no such vector element \\\(vector not allocated\\\)" \
+ "ptype vla2(5, 45, 20) not allocated"
++
++gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"]
++gdb_continue_to_breakpoint "vla1-neg-bounds"
++gdb_test "ptype vla1" "type = $real \\(-2:1,-5:4,-3:-1\\)" "ptype vla1 negative bounds"
+diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+--- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp
++++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp
+@@ -44,3 +44,7 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla"
+ gdb_breakpoint [gdb_get_line_number "pvla-associated"]
+ gdb_continue_to_breakpoint "pvla-associated"
+ gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
++
++gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"]
++gdb_continue_to_breakpoint "vla1-neg-bounds"
++gdb_test "print sizeof(vla1)" " = 480" "print sizeof vla1 negative bounds"
+diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/vla-stride.exp
+@@ -0,0 +1,44 @@
++# Copyright 2016 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++ {debug f90 quiet}] } {
++ return -1
++}
++
++if ![runto MAIN__] then {
++ perror "couldn't run to breakpoint MAIN__"
++ continue
++}
++
++gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
++gdb_continue_to_breakpoint "re-reverse-elements"
++gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
++ "print re-reverse-elements"
++gdb_test "print pvla(1)" " = 1" "print first re-reverse-element"
++gdb_test "print pvla(10)" " = 10" "print last re-reverse-element"
++
++gdb_breakpoint [gdb_get_line_number "odd-elements"]
++gdb_continue_to_breakpoint "odd-elements"
++gdb_test "print pvla" " = \\\(1, 3, 5, 7, 9\\\)" "print odd-elements"
++gdb_test "print pvla(1)" " = 1" "print first odd-element"
++gdb_test "print pvla(5)" " = 9" "print last odd-element"
++
++gdb_breakpoint [gdb_get_line_number "single-element"]
++gdb_continue_to_breakpoint "single-element"
++gdb_test "print pvla" " = \\\(5\\\)" "print single-element"
++gdb_test "print pvla(1)" " = 5" "print one single-element"
+diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/vla-stride.f90
+@@ -0,0 +1,29 @@
++! Copyright 2016 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program. If not, see .
++
++program vla_stride
++ integer, target, allocatable :: vla (:)
++ integer, pointer :: pvla (:)
++
++ allocate(vla(10))
++ vla = (/ (I, I = 1,10) /)
++
++ pvla => vla(10:1:-1)
++ pvla => pvla(10:1:-1)
++ pvla => vla(1:10:2) ! re-reverse-elements
++ pvla => vla(5:4:-2) ! odd-elements
++
++ pvla => null() ! single-element
++end program vla_stride
+diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90
+--- a/gdb/testsuite/gdb.fortran/vla.f90
++++ b/gdb/testsuite/gdb.fortran/vla.f90
+@@ -54,4 +54,14 @@ program vla
+
+ allocate (vla3 (2,2)) ! vla2-deallocated
+ vla3(:,:) = 13
++
++ allocate (vla1 (-2:1, -5:4, -3:-1))
++ l = allocated(vla1)
++
++ vla1(:, :, :) = 1
++ vla1(-2, -3, -1) = -231
++
++ deallocate (vla1) ! vla1-neg-bounds
++ l = allocated(vla1)
++
+ end program vla
diff --git a/gdb/valarith.c b/gdb/valarith.c
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch
index 4a19f3c..49ab71c 100644
--- a/gdb-vla-intel-fortran-vla-strings.patch
+++ b/gdb-vla-intel-fortran-vla-strings.patch
@@ -1,3 +1,10 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Fedora GDB patches
+Date: Fri, 27 Oct 2017 21:07:50 +0200
+Subject: gdb-vla-intel-fortran-vla-strings.patch
+
+;;=push
+
git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings
0ad7d8d1a3a36c6e04e3b6d37d8825f18d595723
@@ -6,10 +13,22 @@ git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings
gdb/dwarf2read.c | 158 +++++++++++++++++++++++++-----
gdb/f-typeprint.c | 93 +++++++++---------
gdb/gdbtypes.c | 44 ++++++++-
+ gdb/testsuite/gdb.cp/vla-cxx.cc | 9 ++
+ gdb/testsuite/gdb.cp/vla-cxx.exp | 9 ++
+ gdb/testsuite/gdb.fortran/pointers.exp | 143 +++++++++++++++++++++++++++
+ gdb/testsuite/gdb.fortran/pointers.f90 | 109 +++++++++++++++++++++
+ gdb/testsuite/gdb.fortran/print_type.exp | 100 +++++++++++++++++++
+ gdb/testsuite/gdb.fortran/vla-ptype.exp | 12 +--
+ gdb/testsuite/gdb.fortran/vla-strings.exp | 103 +++++++++++++++++++
+ gdb/testsuite/gdb.fortran/vla-strings.f90 | 39 ++++++++
+ gdb/testsuite/gdb.fortran/vla-type.exp | 7 +-
+ gdb/testsuite/gdb.fortran/vla-value.exp | 12 ++-
+ gdb/testsuite/gdb.mi/mi-var-child-f.exp | 7 +-
+ gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 27 ++---
gdb/typeprint.c | 19 ++++
gdb/valops.c | 16 ++-
gdb/valprint.c | 6 --
- 8 files changed, 827 insertions(+), 110 deletions(-)
+ 20 files changed, 827 insertions(+), 110 deletions(-)
diff --git a/gdb/NEWS b/gdb/NEWS
--- a/gdb/NEWS
@@ -568,6 +587,693 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
resolved_type = resolve_dynamic_array (type, addr_stack);
break;
+diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc
+--- a/gdb/testsuite/gdb.cp/vla-cxx.cc
++++ b/gdb/testsuite/gdb.cp/vla-cxx.cc
+@@ -15,6 +15,10 @@
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see . */
+
++extern "C" {
++#include
++}
++
+ struct container;
+
+ struct element
+@@ -40,11 +44,16 @@ int main(int argc, char **argv)
+ typedef typeof (vla) &vlareftypedef;
+ vlareftypedef vlaref2 (vla);
+ container c;
++ typeof (vla) *ptr = NULL;
++
++ // Before pointer assignment
++ ptr = &vla;
+
+ for (int i = 0; i < z; ++i)
+ vla[i] = 5 + 2 * i;
+
+ // vlas_filled
+ vla[0] = 2 * vla[0];
++
+ return vla[2];
+ }
+diff --git a/gdb/testsuite/gdb.cp/vla-cxx.exp b/gdb/testsuite/gdb.cp/vla-cxx.exp
+--- a/gdb/testsuite/gdb.cp/vla-cxx.exp
++++ b/gdb/testsuite/gdb.cp/vla-cxx.exp
+@@ -23,6 +23,12 @@ if ![runto_main] {
+ return -1
+ }
+
++gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
++gdb_continue_to_breakpoint "Before pointer assignment"
++gdb_test "ptype ptr" "int \\(\\*\\)\\\[variable length\\\]" "ptype ptr, Before pointer assignment"
++gdb_test "print ptr" "\\(int \\(\\*\\)\\\[variable length\\\]\\) 0x0" "print ptr, Before pointer assignment"
++gdb_test "print *ptr" "Cannot access memory at address 0x0" "print *ptr, Before pointer assignment"
++
+ gdb_breakpoint [gdb_get_line_number "vlas_filled"]
+ gdb_continue_to_breakpoint "vlas_filled"
+
+@@ -33,3 +39,6 @@ gdb_test "print vlaref" " = \\(int \\(&\\)\\\[3\\\]\\) @$hex: \\{5, 7, 9\\}"
+ # bug being tested, it's better not to depend on the exact spelling.
+ gdb_test "print vlaref2" " = \\(.*\\) @$hex: \\{5, 7, 9\\}"
+ gdb_test "print c" " = \\{e = \\{c = @$hex\\}\\}"
++gdb_test "ptype ptr" "int \\(\\*\\)\\\[3\\\]"
++gdb_test "print ptr" "\\(int \\(\\*\\)\\\[3\\\]\\) $hex"
++gdb_test "print *ptr" " = \\{5, 7, 9\\}"
+diff --git a/gdb/testsuite/gdb.fortran/pointers.exp b/gdb/testsuite/gdb.fortran/pointers.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/pointers.exp
+@@ -0,0 +1,143 @@
++# Copyright 2016 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile "pointers.f90"
++load_lib fortran.exp
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++ {debug f90 quiet}] } {
++ return -1
++}
++
++if ![runto_main] {
++ untested "could not run to main"
++ return -1
++}
++
++# Depending on the compiler being used, the type names can be printed differently.
++set logical [fortran_logical4]
++set real [fortran_real4]
++set int [fortran_int4]
++set complex [fortran_complex4]
++
++
++gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
++gdb_continue_to_breakpoint "Before pointer assignment"
++gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated"
++gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated"
++gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated"
++gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated"
++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated"
++gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated"
++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated"
++gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated"
++gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated"
++gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated"
++set test "print intap, not associated"
++gdb_test_multiple "print intap" $test {
++ -re " = \\(PTR TO -> \\( $int \\(:,:\\)\\)\\) \r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re " = \r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated"
++gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated"
++gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0"
++set test "print cyclicp1, not associated"
++gdb_test_multiple "print cyclicp1" $test {
++ -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "= \\( i = -?\\d+, p = \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++set test "print cyclicp1%p, not associated"
++gdb_test_multiple "print cyclicp1%p" $test {
++ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) \r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++
++gdb_breakpoint [gdb_get_line_number "Before value assignment"]
++gdb_continue_to_breakpoint "Before value assignment"
++gdb_test "print *(twop)%ivla2" "= "
++
++
++gdb_breakpoint [gdb_get_line_number "After value assignment"]
++gdb_continue_to_breakpoint "After value assignment"
++gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?"
++gdb_test "print *logp" "= \\.TRUE\\."
++gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?"
++gdb_test "print *comp" "= \\(1,2\\)"
++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?"
++gdb_test "print *charp" "= 'a'"
++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?"
++gdb_test "print *charap" "= 'abc'"
++gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?"
++gdb_test "print *intp" "= 10"
++set test_name "print intap, associated"
++gdb_test_multiple "print intap" $test_name {
++ -re "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)\r\n$gdb_prompt $" {
++ pass $test_name
++ }
++ -re "= \\(PTR TO -> \\( $int \\(10,2\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
++ gdb_test "print *intap" "= \\(\\( 1, 1, 3(, 1){7}\\) \\( 1(, 1){9}\\) \\)"
++ pass $test_name
++ }
++}
++set test_name "print intvlap, associated"
++gdb_test_multiple "print intvlap" $test_name {
++ -re "= \\(2, 2, 2, 4(, 2){6}\\)\r\n$gdb_prompt $" {
++ pass $test_name
++ }
++ -re "= \\(PTR TO -> \\( $int \\(10\\)\\)\\) $hex\( <.*>\)?\r\n$gdb_prompt $" {
++ gdb_test "print *intvlap" "= \\(2, 2, 2, 4(, 2){6}\\)"
++ pass $test_name
++ }
++}
++gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) $hex\( <.*>\)?"
++gdb_test "print *realp" "= 3\\.14000\\d+"
++gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two \\)\\) $hex\( <.*>\)?"
++gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)"
++set test_name "print arrayOfPtr(3)%p"
++gdb_test_multiple $test_name $test_name {
++ -re "= \\(PTR TO -> \\( Type two \\)\\) \r\n$gdb_prompt $" {
++ pass $test_name
++ }
++ -re "= \\(PTR TO -> \\( Type two \\)\\) 0x0\r\n$gdb_prompt $" {
++ pass $test_name
++ }
++}
++set test_name "print *(arrayOfPtr(3)%p), associated"
++gdb_test_multiple "print *(arrayOfPtr(3)%p)" $test_name {
++ -re "Cannot access memory at address 0x0\r\n$gdb_prompt $" {
++ pass $test_name
++ }
++ -re "Attempt to take contents of a not associated pointer.\r\n$gdb_prompt $" {
++ pass $test_name
++ }
++}
++gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)"
++gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?"
++gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array"
++gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla"
++gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex " "Print program counter"
+diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/pointers.f90
+@@ -0,0 +1,109 @@
++! Copyright 2016 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program. If not, see .
++
++program pointers
++
++ type :: two
++ integer, allocatable :: ivla1 (:)
++ integer, allocatable :: ivla2 (:, :)
++ end type two
++
++ type :: typeWithPointer
++ integer i
++ type(typeWithPointer), pointer:: p
++ end type typeWithPointer
++
++ type :: twoPtr
++ type (two), pointer :: p
++ end type twoPtr
++
++ logical, target :: logv
++ complex, target :: comv
++ character, target :: charv
++ character (len=3), target :: chara
++ integer, target :: intv
++ integer, target, dimension (10,2) :: inta
++ integer, target, allocatable, dimension (:) :: intvla
++ real, target :: realv
++ type(two), target :: twov
++ type(twoPtr) :: arrayOfPtr (3)
++ type(typeWithPointer), target:: cyclicp1,cyclicp2
++
++ logical, pointer :: logp
++ complex, pointer :: comp
++ character, pointer:: charp
++ character (len=3), pointer:: charap
++ integer, pointer :: intp
++ integer, pointer, dimension (:,:) :: intap
++ integer, pointer, dimension (:) :: intvlap
++ real, pointer :: realp
++ type(two), pointer :: twop
++
++ nullify (logp)
++ nullify (comp)
++ nullify (charp)
++ nullify (charap)
++ nullify (intp)
++ nullify (intap)
++ nullify (intvlap)
++ nullify (realp)
++ nullify (twop)
++ nullify (arrayOfPtr(1)%p)
++ nullify (arrayOfPtr(2)%p)
++ nullify (arrayOfPtr(3)%p)
++ nullify (cyclicp1%p)
++ nullify (cyclicp2%p)
++
++ logp => logv ! Before pointer assignment
++ comp => comv
++ charp => charv
++ charap => chara
++ intp => intv
++ intap => inta
++ intvlap => intvla
++ realp => realv
++ twop => twov
++ arrayOfPtr(2)%p => twov
++ cyclicp1%i = 1
++ cyclicp1%p => cyclicp2
++ cyclicp2%i = 2
++ cyclicp2%p => cyclicp1
++
++ logv = associated(logp) ! Before value assignment
++ comv = cmplx(1,2)
++ charv = "a"
++ chara = "abc"
++ intv = 10
++ inta(:,:) = 1
++ inta(3,1) = 3
++ allocate (intvla(10))
++ intvla(:) = 2
++ intvla(4) = 4
++ intvlap => intvla
++ realv = 3.14
++
++ allocate (twov%ivla1(3))
++ allocate (twov%ivla2(2,2))
++ twov%ivla1(1) = 11
++ twov%ivla1(2) = 12
++ twov%ivla1(3) = 13
++ twov%ivla2(1,1) = 211
++ twov%ivla2(2,1) = 221
++ twov%ivla2(1,2) = 212
++ twov%ivla2(2,2) = 222
++
++ intv = intv + 1 ! After value assignment
++
++end program pointers
+diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/print_type.exp
+@@ -0,0 +1,100 @@
++# Copyright 2016 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile "pointers.f90"
++load_lib fortran.exp
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++ {debug f90 quiet}] } {
++ return -1
++}
++
++
++if ![runto_main] {
++ untested "could not run to main"
++ return -1
++}
++
++# Depending on the compiler being used, the type names can be printed differently.
++set logical [fortran_logical4]
++set real [fortran_real4]
++set int [fortran_int4]
++set complex [fortran_complex4]
++
++gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
++gdb_continue_to_breakpoint "Before pointer assignment"
++gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" "ptype logp, not associated"
++gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" "ptype comp, not associated"
++gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" "ptype charp, not associated"
++gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" "ptype charap, not associated"
++gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" "ptype intp, not associated"
++set test "ptype intap, not associated"
++gdb_test_multiple "ptype intap" $test {
++ -re "type = PTR TO -> \\( $int \\(:,:\\)\\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = $int \\(:,:\\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" "ptype realp, not associated"
++gdb_test "ptype twop" \
++ [multi_line "type = PTR TO -> \\( Type two" \
++ " $int :: ivla1\\(:\\)" \
++ " $int :: ivla2\\(:,:\\)" \
++ "End Type two \\)"] \
++ "ptype twop, not associated"
++gdb_test "ptype two" \
++ [multi_line "type = Type two" \
++ " $int :: ivla1\\(:\\)" \
++ " $int :: ivla2\\(:,:\\)" \
++ "End Type two"]
++
++
++gdb_breakpoint [gdb_get_line_number "Before value assignment"]
++gdb_continue_to_breakpoint "Before value assignment"
++gdb_test "ptype twop" \
++ [multi_line "type = PTR TO -> \\( Type two" \
++ " $int :: ivla1\\(:\\)" \
++ " $int :: ivla2\\(:,:\\)" \
++ "End Type two \\)"]
++
++
++gdb_breakpoint [gdb_get_line_number "After value assignment"]
++gdb_continue_to_breakpoint "After value assignment"
++gdb_test "ptype logv" "type = $logical"
++gdb_test "ptype comv" "type = $complex"
++gdb_test "ptype charv" "type = character\\*1"
++gdb_test "ptype chara" "type = character\\*3"
++gdb_test "ptype intv" "type = $int"
++gdb_test "ptype inta" "type = $int \\(10,2\\)"
++gdb_test "ptype realv" "type = $real"
++
++
++gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
++gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
++gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
++gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
++gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
++set test "ptype intap"
++gdb_test_multiple $test $test {
++ -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
+diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
+--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
++++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
+@@ -32,9 +32,9 @@ set real [fortran_real4]
+ # Check the ptype of various VLA states and pointer to VLA's.
+ gdb_breakpoint [gdb_get_line_number "vla1-init"]
+ gdb_continue_to_breakpoint "vla1-init"
+-gdb_test "ptype vla1" "type = " "ptype vla1 not initialized"
+-gdb_test "ptype vla2" "type = " "ptype vla2 not initialized"
+-gdb_test "ptype pvla" "type = " "ptype pvla not initialized"
++gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not initialized"
++gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not initialized"
++gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized"
+ gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
+ "ptype vla1(3, 6, 9) not initialized"
+ gdb_test "ptype vla2(5, 45, 20)" \
+@@ -81,20 +81,20 @@ gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
+
+ gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
+ gdb_continue_to_breakpoint "pvla-deassociated"
+-gdb_test "ptype pvla" "type = " "ptype pvla deassociated"
++gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated"
+ gdb_test "ptype pvla(5, 45, 20)" \
+ "no such vector element \\\(vector not associated\\\)" \
+ "ptype pvla(5, 45, 20) not associated"
+
+ gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
+ gdb_continue_to_breakpoint "vla1-deallocated"
+-gdb_test "ptype vla1" "type = " "ptype vla1 not allocated"
++gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not allocated"
+ gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
+ "ptype vla1(3, 6, 9) not allocated"
+
+ gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
+ gdb_continue_to_breakpoint "vla2-deallocated"
+-gdb_test "ptype vla2" "type = " "ptype vla2 not allocated"
++gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not allocated"
+ gdb_test "ptype vla2(5, 45, 20)" \
+ "no such vector element \\\(vector not allocated\\\)" \
+ "ptype vla2(5, 45, 20) not allocated"
+diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/vla-strings.exp
+@@ -0,0 +1,103 @@
++# Copyright 2016 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program. If not, see .
++
++standard_testfile ".f90"
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
++ {debug f90 quiet}] } {
++ return -1
++}
++
++# check that all fortran standard datatypes will be
++# handled correctly when using as VLA's
++
++if ![runto_main] {
++ untested "could not run to main"
++ return -1
++}
++
++gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"]
++gdb_continue_to_breakpoint "var_char-allocated-1"
++set test "whatis var_char first time"
++gdb_test_multiple "whatis var_char" $test {
++ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = character\\*10\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++set test "ptype var_char first time"
++gdb_test_multiple "ptype var_char" $test {
++ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = character\\*10\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++
++gdb_test "next" "\\d+.*var_char = 'foo'.*" \
++ "next to allocation status of var_char"
++gdb_test "print l" " = \\.TRUE\\." "print allocation status first time"
++
++
++gdb_breakpoint [gdb_get_line_number "var_char-filled-1"]
++gdb_continue_to_breakpoint "var_char-filled-1"
++set test "print var_char, var_char-filled-1"
++gdb_test_multiple "print var_char" $test {
++ -re "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\r\n$gdb_prompt $" {
++ gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1"
++ pass $test
++ }
++ -re "= 'foo'\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++set test "ptype var_char, var_char-filled-1"
++gdb_test_multiple "ptype var_char" $test {
++ -re "type = PTR TO -> \\( character\\*3 \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = character\\*3\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)"
++gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)"
++
++
++gdb_breakpoint [gdb_get_line_number "var_char-filled-2"]
++gdb_continue_to_breakpoint "var_char-filled-2"
++set test "print var_char, var_char-filled-2"
++gdb_test_multiple "print var_char" $test {
++ -re "= \\(PTR TO -> \\( character\\*6 \\)\\) $hex\r\n$gdb_prompt $" {
++ gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2"
++ pass $test
++ }
++ -re "= 'foobar'\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++set test "ptype var_char, var_char-filled-2"
++gdb_test_multiple "ptype var_char" $test {
++ -re "type = PTR TO -> \\( character\\*6 \\)\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "type = character\\*6\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
+diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/vla-strings.f90
+@@ -0,0 +1,39 @@
++! Copyright 2016 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program. If not, see .
++
++program vla_strings
++ character(len=:), target, allocatable :: var_char
++ character(len=:), pointer :: var_char_p
++ logical :: l
++
++ allocate(character(len=10) :: var_char)
++ l = allocated(var_char) ! var_char-allocated-1
++ var_char = 'foo'
++ deallocate(var_char) ! var_char-filled-1
++ l = allocated(var_char) ! var_char-deallocated
++ allocate(character(len=42) :: var_char)
++ l = allocated(var_char)
++ var_char = 'foobar'
++ var_char = '' ! var_char-filled-2
++ var_char = 'bar' ! var_char-empty
++ deallocate(var_char)
++ allocate(character(len=21) :: var_char)
++ l = allocated(var_char) ! var_char-allocated-3
++ var_char = 'johndoe'
++ var_char_p => var_char
++ l = associated(var_char_p) ! var_char_p-associated
++ var_char_p => null()
++ l = associated(var_char_p) ! var_char_p-not-associated
++end program vla_strings
+diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
+--- a/gdb/testsuite/gdb.fortran/vla-type.exp
++++ b/gdb/testsuite/gdb.fortran/vla-type.exp
+@@ -132,7 +132,10 @@ gdb_test "ptype fivearr(2)%tone" \
+ "End Type one" ]
+
+ # Check allocation status of dynamic array and it's dynamic members
+-gdb_test "ptype fivedynarr" "type = "
++gdb_test "ptype fivedynarr" \
++ [multi_line "type = Type five" \
++ " Type one :: tone" \
++ "End Type five \\(:\\)" ]
+ gdb_test "next" ""
+ gdb_test "ptype fivedynarr(2)" \
+ [multi_line "type = Type five" \
+@@ -141,7 +144,7 @@ gdb_test "ptype fivedynarr(2)" \
+ "ptype fivedynarr(2), tone is not allocated"
+ gdb_test "ptype fivedynarr(2)%tone" \
+ [multi_line "type = Type one" \
+- " $int :: ivla\\(\\)" \
++ " $int :: ivla\\(:,:,:\\)" \
+ "End Type one" ] \
+ "ptype fivedynarr(2)%tone, not allocated"
+
+diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp
+--- a/gdb/testsuite/gdb.fortran/vla-value.exp
++++ b/gdb/testsuite/gdb.fortran/vla-value.exp
+@@ -35,7 +35,7 @@ gdb_breakpoint [gdb_get_line_number "vla1-init"]
+ gdb_continue_to_breakpoint "vla1-init"
+ gdb_test "print vla1" " = " "print non-allocated vla1"
+ gdb_test "print &vla1" \
+- " = \\\(PTR TO -> \\\( $real \\\(\\\)\\\)\\\) $hex" \
++ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
+ "print non-allocated &vla1"
+ gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
+ "print member in non-allocated vla1 (1)"
+@@ -76,7 +76,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \
+ # Try to access values in undefined pointer to VLA (dangling)
+ gdb_test "print pvla" " = " "print undefined pvla"
+ gdb_test "print &pvla" \
+- " = \\\(PTR TO -> \\\( $real \\\(\\\)\\\)\\\) $hex" \
++ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
+ "print non-associated &pvla"
+ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
+ "print undefined pvla(1,3,8)"
+diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
+--- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
++++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
+@@ -51,10 +51,10 @@ mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \
+ mi_gdb_test "500-data-evaluate-expression vla1" \
+ "500\\^done,value=\"\"" "evaluate not allocated vla, before allocation"
+
+-mi_create_varobj_checked vla1_not_allocated vla1 "" \
++mi_create_varobj_checked vla1_not_allocated vla1 "$real \\(:\\)" \
+ "create local variable vla1_not_allocated"
+ mi_gdb_test "501-var-info-type vla1_not_allocated" \
+- "501\\^done,type=\"\"" \
++ "501\\^done,type=\"$real \\(:\\)\"" \
+ "info type variable vla1_not_allocated"
+ mi_gdb_test "502-var-show-format vla1_not_allocated" \
+ "502\\^done,format=\"natural\"" \
+@@ -146,10 +146,10 @@ gdb_expect {
+ -re "580\\^done,value=\"\".*${mi_gdb_prompt}$" {
+ pass $test
+
+- mi_create_varobj_checked pvla2_not_associated pvla2 "" \
++ mi_create_varobj_checked pvla2_not_associated pvla2 "$real \\(:,:\\)" \
+ "create local variable pvla2_not_associated"
+ mi_gdb_test "581-var-info-type pvla2_not_associated" \
+- "581\\^done,type=\"\"" \
++ "581\\^done,type=\"$real \\(:,:\\)\"" \
+ "info type variable pvla2_not_associated"
+ mi_gdb_test "582-var-show-format pvla2_not_associated" \
+ "582\\^done,format=\"natural\"" \
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch
index cf0a5a3..b2170f4 100644
--- a/gdb-vla-intel-stringbt-fix.patch
+++ b/gdb-vla-intel-stringbt-fix.patch
@@ -1,3 +1,10 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Jan Kratochvil
+Date: Fri, 1 Aug 2014 23:02:17 +0200
+Subject: gdb-vla-intel-stringbt-fix.patch
+
+;;=push+jan
+
http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
@@ -52,3 +59,117 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
scoped_value_mark free_values;
ctx.gdbarch = get_objfile_arch (objfile);
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+@@ -0,0 +1,24 @@
++! Copyright 2010 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek .
++! Modified for the GDB testcase by Jan Kratochvil .
++
++subroutine bar
++ real :: dummy
++ dummy = 1
++end subroutine bar
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
+@@ -0,0 +1,39 @@
++# Copyright 2010 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++set testfile "dynamic-other-frame"
++set srcfile1 ${testfile}.f90
++set srcfile2 ${testfile}-stub.f90
++set objfile2 [standard_output_file ${testfile}-stub.o]
++set executable ${testfile}
++set binfile [standard_output_file ${executable}]
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
++ || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
++ untested "Couldn't compile ${srcfile1} or ${srcfile2}"
++ return -1
++}
++
++clean_restart ${executable}
++
++gdb_test_no_output "set print frame-arguments all"
++
++if ![runto bar_] then {
++ perror "couldn't run to bar_"
++ continue
++}
++
++gdb_test "bt" {foo \(string='hello'.*}
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+new file mode 100644
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+@@ -0,0 +1,36 @@
++! Copyright 2010 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek .
++! Modified for the GDB testcase by Jan Kratochvil .
++
++subroutine foo (string)
++ interface
++ subroutine bar
++ end subroutine
++ end interface
++ character string*(*)
++ call bar ! stop-here
++end subroutine foo
++program test
++ interface
++ subroutine foo (string)
++ character string*(*)
++ end subroutine
++ end interface
++ call foo ('hello')
++end
diff --git a/gdb.spec b/gdb.spec
index 782becd..b6cd538 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -84,6 +84,7 @@ Patch091: gdb-gnat-dwarf-crash-3of3.patch
Patch096: gdb-btrobust.patch
Patch098: gdb-python-gil.patch
Patch100: gdb-jit-reader-multilib.patch
+Patch103: gdb-rhbz1350436-type-printers-error.patch
Patch105: gdb-bz1219747-attach-kills.patch
Patch106: gdb-fedora-libncursesw.patch
Patch108: gdb-dts-rhel6-python-compat.patch
@@ -95,6 +96,7 @@ Patch116: gdb-libexec-add-index.patch
Patch119: gdb-archer.patch
Patch120: gdb-vla-intel-fix-print-char-array.patch
Patch122: gdb-rhbz881849-ipv6-1of3.patch
+Patch123: gdb-rhbz881849-ipv6-2of3.patch
Patch124: gdb-rhbz881849-ipv6-3of3.patch
Patch125: gdb-rhbz1187581-power8-regs-1of7.patch
Patch126: gdb-rhbz1187581-power8-regs-2of7.patch
@@ -103,6 +105,7 @@ Patch128: gdb-rhbz1187581-power8-regs-4of7.patch
Patch129: gdb-rhbz1187581-power8-regs-5of7.patch
Patch130: gdb-rhbz1187581-power8-regs-6of7.patch
Patch131: gdb-rhbz1187581-power8-regs-7of7.patch
+Patch133: gdb-rhbz1491128-batch-mode-exit-status-2of2.patch
Patch134: gdb-use-pulongest-aarch64-linux-tdep.patch
Patch6000: gdb-Detect-invalid-length-field-in-debug-frame-FDE-header.patch