From eb6cb2db363d172ecc38e626d26627cb67712dd3 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 19 Jun 2014 22:14:32 +0200 Subject: [PATCH] Rebase to FSF GDB 7.7.90.20140613 (pre-7.8 snapshot). --- .gitignore | 2 +- gdb-6.3-test-pie-20050107.patch | 58 +- ...379-solib-trampoline-lookup-lock-fix.patch | 14 +- gdb-6.6-bfd-vdso8k.patch | 119 - gdb-6.6-buildid-locate-core-as-arg.patch | 36 +- gdb-6.6-buildid-locate-rpm.patch | 108 +- gdb-6.6-buildid-locate.patch | 102 +- ....6-scheduler_locking-step-is-default.patch | 30 +- ...heduler_locking-step-sw-watchpoints2.patch | 156 +- gdb-6.8-attach-signalled-detach-stopped.patch | 32 +- gdb-6.8-quit-never-aborts.patch | 64 +- gdb-archer-pie-addons-keep-disabled.patch | 28 +- gdb-archer-pie-addons.patch | 48 +- gdb-archer-vla-tests.patch | 3488 ++++++++ gdb-archer.patch | 7622 +---------------- gdb-attach-fail-reasons-5of5.patch | 106 +- gdb-bfd-demangled-names.patch | 207 + gdb-bz533176-fortran-omp-step.patch | 20 +- gdb-bz541866-rwatch-before-run.patch | 35 +- gdb-dts-rhel6-python-compat.patch | 40 +- gdb-glibc-strstr-workaround.patch | 19 +- gdb-gnat-dwarf-crash-1of3.patch | 451 - gdb-gnat-dwarf-crash-2of3.patch | 125 - gdb-rhbz795424-bitpos-20of25.patch | 1202 +-- gdb-rhbz795424-bitpos-21of25.patch | 82 +- gdb-rhbz795424-bitpos-22of25.patch | 583 +- gdb-rhbz795424-bitpos-25of25.patch | 88 +- gdb-static-tls-1of2.patch | 82 - gdb-static-tls-2of2.patch | 326 - gdb-testsuite-nohostid.patch | 50 - gdb-upstream-ppc64le02of15.patch | 61 - gdb-upstream-ppc64le03of15.patch | 36 - gdb-upstream-ppc64le04of15.patch | 1413 --- gdb-upstream-ppc64le05of15.patch | 44 - gdb-upstream-ppc64le06of15.patch | 67 - gdb-upstream-ppc64le07of15.patch | 149 - gdb-upstream-ppc64le08of15.patch | 57 - gdb-upstream-ppc64le09of15.patch | 140 - gdb-upstream-ppc64le10of15.patch | 159 - gdb-upstream-ppc64le11of15.patch | 132 - gdb-upstream-ppc64le12of15.patch | 48 - gdb-upstream-ppc64le13of15.patch | 309 - gdb-upstream-ppc64le14of15.patch | 375 - gdb-upstream-ppc64le15of15.patch | 90 - gdb-upstream.patch | 644 +- gdb-vla-intel-01of23.patch | 270 + gdb-vla-intel-02of23.patch | 192 + gdb-vla-intel-03of23.patch | 115 + gdb-vla-intel-04of23-fix.patch | 36 + gdb-vla-intel-04of23.patch | 614 ++ gdb-vla-intel-05of23.patch | 65 + gdb-vla-intel-06of23.patch | 67 + gdb-vla-intel-07of23.patch | 211 + gdb-vla-intel-08of23.patch | 49 + gdb-vla-intel-09of23.patch | 316 + gdb-vla-intel-10of23.patch | 94 + gdb-vla-intel-11of23.patch | 272 + gdb-vla-intel-12of23.patch | 243 + gdb-vla-intel-13of23.patch | 273 + gdb-vla-intel-14of23.patch | 172 + gdb-vla-intel-15of23.patch | 409 + gdb-vla-intel-16of23.patch | 126 + gdb-vla-intel-17of23.patch | 95 + gdb-vla-intel-18of23.patch | 171 + gdb-vla-intel-19of23.patch | 92 + gdb-vla-intel-20of23.patch | 181 + gdb-vla-intel-21of23.patch | 262 + gdb-vla-intel-22of23.patch | 75 + gdb-vla-intel-23of23.patch | 119 + gdb-watchpoint-fork-fix.patch | 38 + gdb.spec | 117 +- sources | 2 +- 72 files changed, 9873 insertions(+), 13850 deletions(-) delete mode 100644 gdb-6.6-bfd-vdso8k.patch create mode 100644 gdb-archer-vla-tests.patch create mode 100644 gdb-bfd-demangled-names.patch delete mode 100644 gdb-gnat-dwarf-crash-1of3.patch delete mode 100644 gdb-gnat-dwarf-crash-2of3.patch delete mode 100644 gdb-static-tls-1of2.patch delete mode 100644 gdb-static-tls-2of2.patch delete mode 100644 gdb-testsuite-nohostid.patch delete mode 100644 gdb-upstream-ppc64le02of15.patch delete mode 100644 gdb-upstream-ppc64le03of15.patch delete mode 100644 gdb-upstream-ppc64le04of15.patch delete mode 100644 gdb-upstream-ppc64le05of15.patch delete mode 100644 gdb-upstream-ppc64le06of15.patch delete mode 100644 gdb-upstream-ppc64le07of15.patch delete mode 100644 gdb-upstream-ppc64le08of15.patch delete mode 100644 gdb-upstream-ppc64le09of15.patch delete mode 100644 gdb-upstream-ppc64le10of15.patch delete mode 100644 gdb-upstream-ppc64le11of15.patch delete mode 100644 gdb-upstream-ppc64le12of15.patch delete mode 100644 gdb-upstream-ppc64le13of15.patch delete mode 100644 gdb-upstream-ppc64le14of15.patch delete mode 100644 gdb-upstream-ppc64le15of15.patch create mode 100644 gdb-vla-intel-01of23.patch create mode 100644 gdb-vla-intel-02of23.patch create mode 100644 gdb-vla-intel-03of23.patch create mode 100644 gdb-vla-intel-04of23-fix.patch create mode 100644 gdb-vla-intel-04of23.patch create mode 100644 gdb-vla-intel-05of23.patch create mode 100644 gdb-vla-intel-06of23.patch create mode 100644 gdb-vla-intel-07of23.patch create mode 100644 gdb-vla-intel-08of23.patch create mode 100644 gdb-vla-intel-09of23.patch create mode 100644 gdb-vla-intel-10of23.patch create mode 100644 gdb-vla-intel-11of23.patch create mode 100644 gdb-vla-intel-12of23.patch create mode 100644 gdb-vla-intel-13of23.patch create mode 100644 gdb-vla-intel-14of23.patch create mode 100644 gdb-vla-intel-15of23.patch create mode 100644 gdb-vla-intel-16of23.patch create mode 100644 gdb-vla-intel-17of23.patch create mode 100644 gdb-vla-intel-18of23.patch create mode 100644 gdb-vla-intel-19of23.patch create mode 100644 gdb-vla-intel-20of23.patch create mode 100644 gdb-vla-intel-21of23.patch create mode 100644 gdb-vla-intel-22of23.patch create mode 100644 gdb-vla-intel-23of23.patch create mode 100644 gdb-watchpoint-fork-fix.patch diff --git a/.gitignore b/.gitignore index c6aa6dc..5975d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /gdb-libstdc++-v3-python-r155978.tar.bz2 -/gdb-7.7.1.tar.bz2 +/gdb-7.7.90.20140613.tar.bz2 diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index f38c0bf..84195b8 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -1,29 +1,29 @@ -Index: gdb-7.6.90.20140127/gdb/testsuite/configure.ac +Index: gdb-7.7.50.20140609/gdb/testsuite/configure.ac =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/configure.ac 2014-01-27 22:41:19.281501688 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/configure.ac 2014-01-27 22:41:39.736517360 +0100 -@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \ +--- gdb-7.7.50.20140609.orig/gdb/testsuite/configure.ac 2014-06-13 20:05:33.058506817 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/configure.ac 2014-06-13 20:05:59.991532595 +0200 +@@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \ gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \ - gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \ + gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile \ gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \ - gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ + gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \ gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) -Index: gdb-7.6.90.20140127/gdb/testsuite/configure +Index: gdb-7.7.50.20140609/gdb/testsuite/configure =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/configure 2014-01-27 22:41:19.283501689 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/configure 2014-01-27 22:41:49.933525172 +0100 +--- gdb-7.7.50.20140609.orig/gdb/testsuite/configure 2014-06-13 20:05:29.956503899 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/configure 2014-06-13 20:06:24.492555709 +0200 @@ -3448,7 +3448,7 @@ done --ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" +-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.dlang/Makefile gdb.fortran/Makefile gdb.gdb/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" ++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.btrace/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.dlang/Makefile gdb.fortran/Makefile gdb.gdb/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.guile/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.perf/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure -@@ -4176,6 +4176,7 @@ do +@@ -4179,6 +4179,7 @@ do "gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;; "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;; @@ -31,10 +31,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/configure "gdb.perf/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.perf/Makefile" ;; "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c 2014-01-27 22:41:19.284501690 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.c 2014-06-13 20:05:33.060506819 +0200 @@ -0,0 +1,20 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -56,10 +56,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.c + } + return 0; +} -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c 2014-01-27 22:41:19.284501690 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach2.c 2014-06-13 20:05:33.060506819 +0200 @@ -0,0 +1,24 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -85,10 +85,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach2.c + } + return (0); +} -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c 2014-01-27 22:41:19.284501690 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.c 2014-06-13 20:05:33.061506820 +0200 @@ -0,0 +1,146 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -236,10 +236,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.c + } + return 0; +} -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break1.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c 2014-01-27 22:41:19.284501690 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break1.c 2014-06-13 20:05:33.061506820 +0200 @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -285,10 +285,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break1.c +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ +void marker4 (d) long d; {} /* set breakpoint 13 here */ +#endif -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/coremaker.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c 2014-01-27 22:41:19.284501690 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/coremaker.c 2014-06-13 20:05:33.061506820 +0200 @@ -0,0 +1,142 @@ +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 + Free Software Foundation, Inc. @@ -432,10 +432,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/coremaker.c + return 0; +} + -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp 2014-01-27 22:41:19.285501691 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/attach.exp 2014-06-13 20:05:33.061506820 +0200 @@ -0,0 +1,417 @@ +# Copyright 1997, 1999, 2002 Free Software Foundation, Inc. + @@ -854,10 +854,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/attach.exp +do_call_attach_tests + +return 0 -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp 2014-01-27 22:41:19.286501691 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/break.exp 2014-06-13 20:05:33.062506821 +0200 @@ -0,0 +1,962 @@ +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2002, 2003, 2004 @@ -1821,10 +1821,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/break.exp + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} +} -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/corefile.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp 2014-01-27 22:41:19.286501691 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/corefile.exp 2014-06-13 20:05:33.063506822 +0200 @@ -0,0 +1,233 @@ +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. @@ -2059,10 +2059,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/corefile.exp +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" + +gdb_test "core" "No core file now." -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/Makefile.in +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/Makefile.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.pie/Makefile.in 2014-01-27 22:41:19.286501691 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.pie/Makefile.in 2014-06-13 20:05:33.063506822 +0200 @@ -0,0 +1,19 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch index 0b3931f..58aadbf 100644 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -1,11 +1,11 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 -Index: gdb-7.6.50.20130731-cvs/gdb/symtab.c +Index: gdb-7.7.90.20140613/gdb/symtab.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/symtab.c 2013-08-02 17:06:19.854663801 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/symtab.c 2013-08-02 17:07:04.317721471 +0200 -@@ -2327,6 +2327,13 @@ find_pc_sect_line (CORE_ADDR pc, struct +--- gdb-7.7.90.20140613.orig/gdb/symtab.c 2014-06-13 21:52:06.219338401 +0200 ++++ gdb-7.7.90.20140613/gdb/symtab.c 2014-06-13 21:55:02.753531885 +0200 +@@ -2394,6 +2394,13 @@ find_pc_sect_line (CORE_ADDR pc, struct SYMBOL_LINKAGE_NAME (msymbol)); */ ; /* fall through */ @@ -13,9 +13,9 @@ Index: gdb-7.6.50.20130731-cvs/gdb/symtab.c + but this text symbol may be the address we were looking for. + Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop. + Red Hat Bug 218379. */ -+ else if (SYMBOL_VALUE (mfunsym) == pc) -+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", SYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc)); ++ else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc) ++ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc)); + /* fall through */ else - return find_pc_line (SYMBOL_VALUE_ADDRESS (mfunsym), 0); + return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0); } diff --git a/gdb-6.6-bfd-vdso8k.patch b/gdb-6.6-bfd-vdso8k.patch deleted file mode 100644 index 06507b0..0000000 --- a/gdb-6.6-bfd-vdso8k.patch +++ /dev/null @@ -1,119 +0,0 @@ -2007-09-23 Jan Kratochvil - - * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New variables - X_SHDR_SHSTRTAB and I_SHDR_SHSTRTAB. Fixed the CONTENTS_SIZE trimming - check for its aligned size between the last segment and still before - the section header end. Added variables check to cover also the - section header string table. - ---- gdb-7.4.50.20120120-orig/bfd/elfcode.h 2012-02-29 09:17:08.000000000 +0100 -+++ gdb-7.4.50.20120120/bfd/elfcode.h 2012-02-29 10:23:03.000000000 +0100 -@@ -1621,6 +1621,8 @@ NAME(_bfd_elf,bfd_from_remote_memory) - Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ - Elf_External_Phdr *x_phdrs; - Elf_Internal_Phdr *i_phdrs, *last_phdr; -+ Elf_External_Shdr *x_shdrs; -+ Elf_Internal_Shdr *i_shdrs; - bfd *nbfd; - struct bfd_in_memory *bim; - int contents_size; -@@ -1740,24 +1742,46 @@ NAME(_bfd_elf,bfd_from_remote_memory) - - /* Trim the last segment so we don't bother with zeros in the last page - that are off the end of the file. However, if the extra bit in that -- page includes the section headers, keep them. */ -- if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz -- && (bfd_vma) contents_size >= (i_ehdr.e_shoff -- + i_ehdr.e_shnum * i_ehdr.e_shentsize)) -+ page includes the section headers os the section header string table, -+ keep them. */ -+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz) -+ contents_size = last_phdr->p_offset + last_phdr->p_filesz; -+ -+ if ((bfd_vma) contents_size < i_ehdr.e_shoff -+ + i_ehdr.e_shnum * i_ehdr.e_shentsize) -+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize; -+ -+ /* Verify also all the sections fit into CONTENTS_SIZE. */ -+ -+ x_shdrs = bfd_malloc (i_ehdr.e_shnum * (sizeof *x_shdrs + sizeof *i_shdrs)); -+ if (x_shdrs == NULL) - { -- contents_size = last_phdr->p_offset + last_phdr->p_filesz; -- if ((bfd_vma) contents_size < (i_ehdr.e_shoff -- + i_ehdr.e_shnum * i_ehdr.e_shentsize)) -- contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize; -+ free (x_phdrs); -+ bfd_set_error (bfd_error_no_memory); -+ return NULL; - } -+ err = target_read_memory (ehdr_vma + i_ehdr.e_shoff, (bfd_byte *) x_shdrs, -+ i_ehdr.e_shnum * sizeof *x_shdrs); -+ if (err) -+ i_shdrs = NULL; - else -- contents_size = last_phdr->p_offset + last_phdr->p_filesz; -+ { -+ i_shdrs = (Elf_Internal_Shdr *) &x_shdrs[i_ehdr.e_shnum]; -+ for (i = 0; i < i_ehdr.e_shnum; ++i) -+ { -+ elf_swap_shdr_in (templ, &x_shdrs[i], &i_shdrs[i]); -+ -+ if ((bfd_vma) contents_size < i_shdrs[i].sh_offset + i_shdrs[i].sh_size) -+ contents_size = i_shdrs[i].sh_offset + i_shdrs[i].sh_size; -+ } -+ } - - /* Now we know the size of the whole image we want read in. */ - contents = (bfd_byte *) bfd_zmalloc (contents_size); - if (contents == NULL) - { - free (x_phdrs); -+ free (x_shdrs); - bfd_set_error (bfd_error_no_memory); - return NULL; - } -@@ -1776,6 +1800,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) - if (err) - { - free (x_phdrs); -+ free (x_shdrs); - free (contents); - bfd_set_error (bfd_error_system_call); - errno = err; -@@ -1784,10 +1809,32 @@ NAME(_bfd_elf,bfd_from_remote_memory) - } - free (x_phdrs); - -- /* If the segments visible in memory didn't include the section headers, -+ if (i_shdrs) -+ { -+ memcpy (contents + i_ehdr.e_shoff, x_shdrs, -+ i_ehdr.e_shnum * sizeof *x_shdrs); -+ -+ for (i = 0; i < i_ehdr.e_shnum; ++i) -+ { -+ bfd_vma start = i_shdrs[i].sh_offset; -+ bfd_vma end = i_shdrs[i].sh_offset + i_shdrs[i].sh_size; -+ -+ if (end > (bfd_vma) contents_size) -+ end = contents_size; -+ err = target_read_memory (ehdr_vma + start, contents + start, -+ end - start); -+ if (err) -+ { -+ i_shdrs = NULL; -+ break; -+ } -+ } -+ } -+ free (x_shdrs); -+ -+ /* If the segments readable in memory didn't include the section headers, - then clear them from the file header. */ -- if ((bfd_vma) contents_size < (i_ehdr.e_shoff -- + i_ehdr.e_shnum * i_ehdr.e_shentsize)) -+ if (i_shdrs == NULL) - { - memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff); - memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum); diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index ffe0b40..1138658 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -58,13 +58,13 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html * exec.c (exec_file_attach): Print a more useful error message if the user did "gdb core". -Index: gdb-7.6.90.20140127/gdb/exceptions.h +Index: gdb-7.7.50.20140609/gdb/exceptions.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/exceptions.h 2014-02-06 17:31:00.148529736 +0100 -+++ gdb-7.6.90.20140127/gdb/exceptions.h 2014-02-06 17:31:17.560548525 +0100 -@@ -97,6 +97,9 @@ enum errors { - /* An undefined command was executed. */ - UNDEFINED_COMMAND_ERROR, +--- gdb-7.7.50.20140609.orig/gdb/exceptions.h 2014-06-13 20:26:46.988804553 +0200 ++++ gdb-7.7.50.20140609/gdb/exceptions.h 2014-06-13 20:27:01.930820057 +0200 +@@ -100,6 +100,9 @@ enum errors { + /* Requested feature, method, mechanism, etc. is not supported. */ + NOT_SUPPORTED_ERROR, + /* Attempt to load a core file as executable. */ + IS_CORE_ERROR, @@ -72,19 +72,19 @@ Index: gdb-7.6.90.20140127/gdb/exceptions.h /* Add more errors here. */ NR_ERRORS }; -Index: gdb-7.6.90.20140127/gdb/exec.c +Index: gdb-7.7.50.20140609/gdb/exec.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/exec.c 2014-02-06 17:30:58.266527708 +0100 -+++ gdb-7.6.90.20140127/gdb/exec.c 2014-02-06 17:31:00.149529737 +0100 -@@ -34,6 +34,7 @@ - #include "gdbthread.h" +--- gdb-7.7.50.20140609.orig/gdb/exec.c 2014-06-13 20:26:44.831802315 +0200 ++++ gdb-7.7.50.20140609/gdb/exec.c 2014-06-13 20:27:17.282836454 +0200 +@@ -35,6 +35,7 @@ #include "progspace.h" #include "gdb_bfd.h" + #include "gcore.h" +#include "exceptions.h" #include #include "readline/readline.h" -@@ -228,12 +229,27 @@ exec_file_attach (char *filename, int fr +@@ -231,12 +232,27 @@ exec_file_attach (char *filename, int fr if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { @@ -115,11 +115,11 @@ Index: gdb-7.6.90.20140127/gdb/exec.c } if (build_section_table (exec_bfd, §ions, §ions_end)) -Index: gdb-7.6.90.20140127/gdb/main.c +Index: gdb-7.7.50.20140609/gdb/main.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/main.c 2014-02-06 17:30:58.267527709 +0100 -+++ gdb-7.6.90.20140127/gdb/main.c 2014-02-06 17:32:32.232629052 +0100 -@@ -307,6 +307,36 @@ typedef struct cmdarg { +--- gdb-7.7.50.20140609.orig/gdb/main.c 2014-06-13 20:26:44.831802315 +0200 ++++ gdb-7.7.50.20140609/gdb/main.c 2014-06-13 20:26:46.990804555 +0200 +@@ -341,6 +341,36 @@ typedef struct cmdarg { /* Define type VEC (cmdarg_s). */ DEF_VEC_O (cmdarg_s); @@ -156,7 +156,7 @@ Index: gdb-7.6.90.20140127/gdb/main.c static int captured_main (void *data) { -@@ -824,6 +854,8 @@ captured_main (void *data) +@@ -854,6 +884,8 @@ captured_main (void *data) { symarg = argv[optind]; execarg = argv[optind]; @@ -165,7 +165,7 @@ Index: gdb-7.6.90.20140127/gdb/main.c optind++; } -@@ -987,11 +1019,25 @@ captured_main (void *data) +@@ -1017,11 +1049,25 @@ captured_main (void *data) && symarg != NULL && strcmp (execarg, symarg) == 0) { diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 77b2ca4..746877f 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,8 +1,8 @@ -Index: gdb-7.6.90.20140127/gdb/event-top.c +Index: gdb-7.7.50.20140609/gdb/event-top.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/event-top.c 2014-02-06 17:18:26.965717210 +0100 -+++ gdb-7.6.90.20140127/gdb/event-top.c 2014-02-06 16:59:23.174474404 +0100 -@@ -37,6 +37,7 @@ +--- gdb-7.7.50.20140609.orig/gdb/event-top.c 2014-06-13 20:10:19.632787642 +0200 ++++ gdb-7.7.50.20140609/gdb/event-top.c 2014-06-13 20:11:49.605878557 +0200 +@@ -38,6 +38,7 @@ #include "gdbcmd.h" /* for dont_repeat() */ #include "annotate.h" #include "maint.h" @@ -10,7 +10,7 @@ Index: gdb-7.6.90.20140127/gdb/event-top.c /* readline include files. */ #include "readline/readline.h" -@@ -173,6 +174,8 @@ rl_callback_read_char_wrapper (gdb_clien +@@ -176,6 +177,8 @@ rl_callback_read_char_wrapper (gdb_clien void cli_command_loop (void *data) { @@ -19,20 +19,20 @@ Index: gdb-7.6.90.20140127/gdb/event-top.c display_gdb_prompt (0); /* Now it's time to start the event loop. */ -@@ -240,6 +243,8 @@ display_gdb_prompt (char *new_prompt) +@@ -243,6 +246,8 @@ display_gdb_prompt (char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); + debug_flush_missing (); + - /* Each interpreter has its own rules on displaying the command - prompt. */ - if (!current_interp_display_prompt_p ()) -Index: gdb-7.6.90.20140127/gdb/symfile.h + old_chain = make_cleanup (free_current_contents, &actual_gdb_prompt); + + /* Do not call the python hook on an explicit prompt change as +Index: gdb-7.7.50.20140609/gdb/symfile.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/symfile.h 2014-02-06 17:18:33.865724666 +0100 -+++ gdb-7.6.90.20140127/gdb/symfile.h 2014-02-06 17:08:56.282099150 +0100 -@@ -557,6 +557,8 @@ extern struct cleanup *increment_reading +--- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:10:19.633787643 +0200 ++++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:31.066799158 +0200 +@@ -573,6 +573,8 @@ void map_symbol_filenames (symbol_filena /* build-id support. */ extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr); extern void debug_print_missing (const char *binary, const char *debug); @@ -41,11 +41,11 @@ Index: gdb-7.6.90.20140127/gdb/symfile.h /* From dwarf2read.c */ -Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/gdb.exp 2014-02-06 17:18:26.969717214 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp 2014-02-06 17:18:33.866724667 +0100 -@@ -1504,7 +1504,7 @@ proc default_gdb_start { } { +--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:19.634787644 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:10:31.067799159 +0200 +@@ -1492,7 +1492,7 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -54,10 +54,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp send_gdb "set build-id-verbose 0\n" gdb_expect 10 { -re "$gdb_prompt $" { -Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/mi-support.exp 2014-02-06 17:18:26.970717215 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp 2014-02-06 17:18:33.867724668 +0100 +--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:19.635787645 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:10:31.068799160 +0200 @@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } { warning "Couldn't set the width to 0." } @@ -67,22 +67,22 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp 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$" { -Index: gdb-7.6.90.20140127/gdb/tui/tui-interp.c +Index: gdb-7.7.50.20140609/gdb/tui/tui-interp.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/tui/tui-interp.c 2014-02-06 17:18:26.970717215 +0100 -+++ gdb-7.6.90.20140127/gdb/tui/tui-interp.c 2014-02-06 17:18:33.867724668 +0100 -@@ -30,6 +30,7 @@ - #include "tui/tui.h" - #include "tui/tui-io.h" +--- gdb-7.7.50.20140609.orig/gdb/tui/tui-interp.c 2014-06-13 20:10:31.068799160 +0200 ++++ gdb-7.7.50.20140609/gdb/tui/tui-interp.c 2014-06-13 20:10:47.806816542 +0200 +@@ -32,6 +32,7 @@ #include "exceptions.h" + #include "infrun.h" + #include "observer.h" +#include "symfile.h" - /* Set to 1 when the TUI mode must be activated when we first start - gdb. */ -Index: gdb-7.6.90.20140127/gdb/aclocal.m4 + static struct ui_out *tui_ui_out (struct interp *self); + +Index: gdb-7.7.50.20140609/gdb/aclocal.m4 =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/aclocal.m4 2014-02-06 17:18:33.868724669 +0100 -+++ gdb-7.6.90.20140127/gdb/aclocal.m4 2014-02-06 17:09:49.877157405 +0100 +--- gdb-7.7.50.20140609.orig/gdb/aclocal.m4 2014-06-13 20:10:19.636787646 +0200 ++++ gdb-7.7.50.20140609/gdb/aclocal.m4 2014-06-13 20:10:31.069799161 +0200 @@ -11,6 +11,221 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @@ -305,10 +305,10 @@ Index: gdb-7.6.90.20140127/gdb/aclocal.m4 # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -Index: gdb-7.6.90.20140127/gdb/config.in +Index: gdb-7.7.50.20140609/gdb/config.in =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/config.in 2014-02-06 17:18:26.971717216 +0100 -+++ gdb-7.6.90.20140127/gdb/config.in 2014-02-06 17:18:33.868724669 +0100 +--- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:10:19.637787647 +0200 ++++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:10:31.069799161 +0200 @@ -33,6 +33,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -319,7 +319,7 @@ Index: gdb-7.6.90.20140127/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -207,6 +210,9 @@ +@@ -210,6 +213,9 @@ /* Define if Python 2.7 is being used. */ #undef HAVE_LIBPYTHON2_7 @@ -329,11 +329,11 @@ Index: gdb-7.6.90.20140127/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H -Index: gdb-7.6.90.20140127/gdb/configure +Index: gdb-7.7.50.20140609/gdb/configure =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/configure 2014-02-06 17:18:26.976717221 +0100 -+++ gdb-7.6.90.20140127/gdb/configure 2014-02-06 17:18:33.872724673 +0100 -@@ -689,6 +689,11 @@ PKGVERSION +--- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:10:19.642787652 +0200 ++++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:10:31.073799165 +0200 +@@ -692,6 +692,11 @@ PKGVERSION HAVE_NATIVE_GCORE_TARGET TARGET_OBS subdirs @@ -345,7 +345,7 @@ Index: gdb-7.6.90.20140127/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -792,6 +797,7 @@ with_gdb_datadir +@@ -795,6 +800,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path @@ -353,7 +353,7 @@ Index: gdb-7.6.90.20140127/gdb/configure enable_targets enable_64_bit_bfd enable_gdbcli -@@ -842,6 +848,11 @@ CPPFLAGS +@@ -846,6 +852,11 @@ CPPFLAGS CPP MAKEINFO MAKEINFOFLAGS @@ -365,7 +365,7 @@ Index: gdb-7.6.90.20140127/gdb/configure YACC YFLAGS XMKMF' -@@ -1512,6 +1523,8 @@ Optional Packages: +@@ -1516,6 +1527,8 @@ Optional Packages: [--with-auto-load-dir] --without-auto-load-safe-path do not restrict auto-loaded files locations @@ -374,7 +374,7 @@ Index: gdb-7.6.90.20140127/gdb/configure --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-curses use the curses library instead of the termcap library -@@ -1559,6 +1572,13 @@ Some influential environment variables: +@@ -1565,6 +1578,13 @@ Some influential environment variables: MAKEINFO Parent configure detects if it is of sufficient version. MAKEINFOFLAGS Parameters for MAKEINFO. @@ -388,7 +388,7 @@ Index: gdb-7.6.90.20140127/gdb/configure YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. -@@ -5154,6 +5174,491 @@ _ACEOF +@@ -5160,6 +5180,491 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -880,10 +880,10 @@ Index: gdb-7.6.90.20140127/gdb/configure subdirs="$subdirs testsuite" -Index: gdb-7.6.90.20140127/gdb/configure.ac +Index: gdb-7.7.50.20140609/gdb/configure.ac =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/configure.ac 2014-02-06 17:18:26.977717223 +0100 -+++ gdb-7.6.90.20140127/gdb/configure.ac 2014-02-06 17:18:33.873724674 +0100 +--- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:10:19.643787653 +0200 ++++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:10:31.074799166 +0200 @@ -165,6 +165,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -1084,11 +1084,11 @@ Index: gdb-7.6.90.20140127/gdb/configure.ac AC_CONFIG_SUBDIRS(testsuite) # Check whether to support alternative target configurations -Index: gdb-7.6.90.20140127/gdb/corelow.c +Index: gdb-7.7.50.20140609/gdb/corelow.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/corelow.c 2014-02-06 17:18:26.978717224 +0100 -+++ gdb-7.6.90.20140127/gdb/corelow.c 2014-02-06 17:18:33.873724674 +0100 -@@ -315,7 +315,7 @@ build_id_locate_exec (int from_tty) +--- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:10:19.644787654 +0200 ++++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:10:31.074799166 +0200 +@@ -316,7 +316,7 @@ build_id_locate_exec (int from_tty) symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; } else @@ -1097,10 +1097,10 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c do_cleanups (back_to); -Index: gdb-7.6.90.20140127/gdb/build-id.c +Index: gdb-7.7.50.20140609/gdb/build-id.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/build-id.c 2014-02-06 17:18:26.842717077 +0100 -+++ gdb-7.6.90.20140127/gdb/build-id.c 2014-02-06 17:08:18.341060295 +0100 +--- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:10:19.644787654 +0200 ++++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:10:31.075799167 +0200 @@ -32,6 +32,7 @@ #include "gdbcmd.h" #include "observer.h" diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index d3bc4a5..eb4f1d3 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,8 +1,8 @@ -Index: gdb-7.6.90.20140127/gdb/corelow.c +Index: gdb-7.7.50.20140609/gdb/corelow.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/corelow.c 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/corelow.c 2014-02-06 16:46:52.261646499 +0100 -@@ -48,6 +48,10 @@ +--- gdb-7.7.50.20140609.orig/gdb/corelow.c 2014-06-13 20:09:37.369745221 +0200 ++++ gdb-7.7.50.20140609/gdb/corelow.c 2014-06-13 20:09:42.407750265 +0200 +@@ -49,6 +49,10 @@ #include "gdb_bfd.h" #include "completer.h" #include "filestuff.h" @@ -13,7 +13,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c #ifndef O_LARGEFILE #define O_LARGEFILE 0 -@@ -271,6 +275,53 @@ add_to_thread_list (bfd *abfd, asection +@@ -272,6 +276,53 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current. */ } @@ -67,7 +67,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c /* This routine opens and sets up the core file bfd. */ static void -@@ -409,6 +460,14 @@ core_open (char *filename, int from_tty) +@@ -410,6 +461,14 @@ core_open (char *filename, int from_tty) switch_to_thread (thread->ptid); } @@ -82,7 +82,7 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c post_create_inferior (&core_ops, from_tty); /* Now go through the target stack looking for threads since there -@@ -980,4 +1039,11 @@ _initialize_corelow (void) +@@ -1029,4 +1088,11 @@ _initialize_corelow (void) init_core_ops (); add_target_with_completer (&core_ops, filename_completer); @@ -94,11 +94,11 @@ Index: gdb-7.6.90.20140127/gdb/corelow.c + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-7.6.90.20140127/gdb/doc/gdb.texinfo +Index: gdb-7.7.50.20140609/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/doc/gdb.texinfo 2014-02-06 16:46:51.804645989 +0100 -+++ gdb-7.6.90.20140127/gdb/doc/gdb.texinfo 2014-02-06 16:46:52.110646331 +0100 -@@ -17413,6 +17413,27 @@ information files. +--- gdb-7.7.50.20140609.orig/gdb/doc/gdb.texinfo 2014-06-13 20:09:37.380745232 +0200 ++++ gdb-7.7.50.20140609/gdb/doc/gdb.texinfo 2014-06-13 20:09:42.417750275 +0200 +@@ -17547,6 +17547,27 @@ information files. @end table @@ -126,11 +126,11 @@ Index: gdb-7.6.90.20140127/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named -Index: gdb-7.6.90.20140127/gdb/solib-svr4.c +Index: gdb-7.7.50.20140609/gdb/solib-svr4.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/solib-svr4.c 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/solib-svr4.c 2014-02-06 16:49:27.508819174 +0100 -@@ -47,6 +47,7 @@ +--- gdb-7.7.50.20140609.orig/gdb/solib-svr4.c 2014-06-13 20:09:37.382745234 +0200 ++++ gdb-7.7.50.20140609/gdb/solib-svr4.c 2014-06-13 20:09:42.418750276 +0200 +@@ -48,6 +48,7 @@ #include "exceptions.h" #include "gdb_bfd.h" #include "probe.h" @@ -194,11 +194,11 @@ Index: gdb-7.6.90.20140127/gdb/solib-svr4.c xfree (buffer); /* If this entry has no name, or its name matches the name -Index: gdb-7.6.90.20140127/gdb/elfread.c +Index: gdb-7.7.50.20140609/gdb/elfread.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/elfread.c 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/elfread.c 2014-02-06 16:46:52.249646486 +0100 -@@ -1316,9 +1316,10 @@ elf_symfile_read (struct objfile *objfil +--- gdb-7.7.50.20140609.orig/gdb/elfread.c 2014-06-13 20:09:37.383745235 +0200 ++++ gdb-7.7.50.20140609/gdb/elfread.c 2014-06-13 20:09:42.418750276 +0200 +@@ -1335,9 +1335,10 @@ elf_symfile_read (struct objfile *objfil && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -211,7 +211,7 @@ Index: gdb-7.6.90.20140127/gdb/elfread.c if (debugfile == NULL) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1332,6 +1333,12 @@ elf_symfile_read (struct objfile *objfil +@@ -1351,6 +1352,12 @@ elf_symfile_read (struct objfile *objfil symbol_file_add_separate (abfd, debugfile, symfile_flags, objfile); do_cleanups (cleanup); } @@ -224,13 +224,13 @@ Index: gdb-7.6.90.20140127/gdb/elfread.c } } -Index: gdb-7.6.90.20140127/gdb/symfile.h +Index: gdb-7.7.50.20140609/gdb/symfile.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/symfile.h 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/symfile.h 2014-02-06 16:46:52.250646487 +0100 -@@ -554,6 +554,10 @@ void free_symfile_segment_data (struct s - - extern struct cleanup *increment_reading_symtab (void); +--- gdb-7.7.50.20140609.orig/gdb/symfile.h 2014-06-13 20:09:42.419750277 +0200 ++++ gdb-7.7.50.20140609/gdb/symfile.h 2014-06-13 20:10:04.478772510 +0200 +@@ -570,6 +570,10 @@ void expand_symtabs_matching (expand_sym + void map_symbol_filenames (symbol_filename_ftype *fun, void *data, + int need_fullname); +/* build-id support. */ +extern struct elf_build_id *build_id_addr_get (CORE_ADDR addr); @@ -239,11 +239,11 @@ Index: gdb-7.6.90.20140127/gdb/symfile.h /* From dwarf2read.c */ /* Names for a dwarf2 debugging section. The field NORMAL is the normal -Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/gdb.exp 2014-02-06 16:46:51.643645810 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp 2014-02-06 16:46:52.251646488 +0100 -@@ -1504,6 +1504,16 @@ proc default_gdb_start { } { +--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/gdb.exp 2014-06-13 20:09:37.384745236 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/lib/gdb.exp 2014-06-13 20:09:42.420750278 +0200 +@@ -1492,6 +1492,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -260,10 +260,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/gdb.exp return 0 } -Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/lib/mi-support.exp 2014-01-27 02:57:54.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp 2014-02-06 16:46:52.252646489 +0100 +--- gdb-7.7.50.20140609.orig/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:09:37.385745237 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/lib/mi-support.exp 2014-06-13 20:09:42.421750279 +0200 @@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } { warning "Couldn't set the width to 0." } @@ -281,11 +281,11 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/lib/mi-support.exp # If allowing the inferior to have its own PTY then assign the inferior # its own terminal device here. if { $separate_inferior_pty } { -Index: gdb-7.6.90.20140127/gdb/objfiles.h +Index: gdb-7.7.50.20140609/gdb/objfiles.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/objfiles.h 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/objfiles.h 2014-02-06 16:46:52.113646334 +0100 -@@ -436,6 +436,10 @@ struct objfile +--- gdb-7.7.50.20140609.orig/gdb/objfiles.h 2014-06-13 20:09:37.385745237 +0200 ++++ gdb-7.7.50.20140609/gdb/objfiles.h 2014-06-13 20:09:42.421750279 +0200 +@@ -464,6 +464,10 @@ struct objfile #define OBJF_NOT_FILENAME (1 << 6) @@ -296,11 +296,11 @@ Index: gdb-7.6.90.20140127/gdb/objfiles.h /* Declarations for functions defined in objfiles.c */ extern struct objfile *allocate_objfile (bfd *, const char *name, int); -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.base/corefile.exp 2014-01-27 02:57:54.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp 2014-02-06 16:46:52.113646334 +0100 -@@ -281,3 +281,33 @@ gdb_test_multiple "core-file $corefile" +--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.base/corefile.exp 2014-06-13 20:09:37.385745237 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.base/corefile.exp 2014-06-13 20:09:42.421750279 +0200 +@@ -293,3 +293,33 @@ gdb_test_multiple "core-file $corefile" pass $test } } @@ -334,10 +334,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/corefile.exp + gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" + pass $wholetest +} -Index: gdb-7.6.90.20140127/gdb/build-id.c +Index: gdb-7.7.50.20140609/gdb/build-id.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/build-id.c 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/build-id.c 2014-02-06 16:46:52.113646334 +0100 +--- gdb-7.7.50.20140609.orig/gdb/build-id.c 2014-06-13 20:09:37.386745238 +0200 ++++ gdb-7.7.50.20140609/gdb/build-id.c 2014-06-13 20:09:42.422750280 +0200 @@ -27,11 +27,65 @@ #include "symfile.h" #include "objfiles.h" @@ -1160,10 +1160,10 @@ Index: gdb-7.6.90.20140127/gdb/build-id.c + + observer_attach_executable_changed (debug_print_executable_changed); +} -Index: gdb-7.6.90.20140127/gdb/build-id.h +Index: gdb-7.7.50.20140609/gdb/build-id.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/build-id.h 2014-01-27 02:57:53.000000000 +0100 -+++ gdb-7.6.90.20140127/gdb/build-id.h 2014-02-06 16:46:52.114646335 +0100 +--- gdb-7.7.50.20140609.orig/gdb/build-id.h 2014-06-13 20:09:37.386745238 +0200 ++++ gdb-7.7.50.20140609/gdb/build-id.h 2014-06-13 20:09:42.422750280 +0200 @@ -32,13 +32,18 @@ extern int build_id_verify (bfd *abfd, the caller. */ @@ -1185,11 +1185,11 @@ Index: gdb-7.6.90.20140127/gdb/build-id.h + char **build_id_filename_return); #endif /* BUILD_ID_H */ -Index: gdb-7.6.90.20140127/gdb/dwarf2read.c +Index: gdb-7.7.50.20140609/gdb/dwarf2read.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c 2014-02-06 16:46:51.809645995 +0100 -+++ gdb-7.6.90.20140127/gdb/dwarf2read.c 2014-02-06 16:49:55.679850414 +0100 -@@ -2429,7 +2429,7 @@ dwarf2_get_dwz_file (void) +--- gdb-7.7.50.20140609.orig/gdb/dwarf2read.c 2014-06-13 20:09:37.389745241 +0200 ++++ gdb-7.7.50.20140609/gdb/dwarf2read.c 2014-06-13 20:09:42.425750283 +0200 +@@ -2446,7 +2446,7 @@ dwarf2_get_dwz_file (void) } if (dwz_bfd == NULL) diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch index 67e35c2..e8e0595 100644 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ b/gdb-6.6-scheduler_locking-step-is-default.patch @@ -1,8 +1,8 @@ -Index: gdb-7.6.90.20140127/gdb/infrun.c +Index: gdb-7.7.50.20140609/gdb/infrun.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/infrun.c 2014-02-04 23:48:27.262092869 +0100 -+++ gdb-7.6.90.20140127/gdb/infrun.c 2014-02-04 23:48:31.674096613 +0100 -@@ -1618,7 +1618,7 @@ static const char *const scheduler_enums +--- gdb-7.7.50.20140609.orig/gdb/infrun.c 2014-06-13 20:08:51.225699203 +0200 ++++ gdb-7.7.50.20140609/gdb/infrun.c 2014-06-13 20:08:55.515703466 +0200 +@@ -1661,7 +1661,7 @@ static const char *const scheduler_enums schedlock_step, NULL }; @@ -11,11 +11,11 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c static void show_scheduler_mode (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2014-02-04 23:48:27.263092871 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp 2014-02-04 23:48:31.674096613 +0100 -@@ -163,7 +163,7 @@ mi_execute_to "exec-continue" "breakpoin +--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2014-06-13 20:08:55.515703466 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-cli.exp 2014-06-13 20:09:24.862732832 +0200 +@@ -181,7 +181,7 @@ mi_expect_stop "breakpoint-hit" "main" " # Test that the token is output even for CLI commands # Also test that *stopped includes frame information. mi_gdb_test "34 next" \ @@ -23,11 +23,11 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-cli.exp + ".*34\\\^running.*\\*running,thread-id=\"1\"" \ "34 next: run" - if {!$async} { -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp + # Test that the new current source line is output to the console +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2014-02-04 23:48:27.263092871 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp 2014-02-04 23:48:31.674096613 +0100 +--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2014-06-13 20:08:51.227699205 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-logging.exp 2014-06-13 20:08:55.516703467 +0200 @@ -53,7 +53,7 @@ close $chan set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" @@ -46,10 +46,10 @@ Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-logging.exp pass "Redirect log file contents" } else { fail "Redirect log file contents" -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-console.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/testsuite/gdb.mi/mi-console.exp 2014-02-04 23:48:31.675096666 +0100 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.mi/mi-console.exp 2014-02-04 23:48:55.981127963 +0100 +--- gdb-7.7.50.20140609.orig/gdb/testsuite/gdb.mi/mi-console.exp 2014-06-13 20:08:51.227699205 +0200 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.mi/mi-console.exp 2014-06-13 20:08:55.516703467 +0200 @@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ mi_run_to_main diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 75dda1a..8ce8107 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -21,41 +21,20 @@ Port to GDB-6.8pre. -Index: gdb-7.6.90.20140127/gdb/inferior.h +Index: gdb-7.7.90.20140613/gdb/infrun.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/inferior.h 2014-01-27 22:05:28.801895347 +0100 -+++ gdb-7.6.90.20140127/gdb/inferior.h 2014-01-27 22:33:45.230157813 +0100 -@@ -155,7 +155,15 @@ extern void reopen_exec_file (void); - /* The `resume' routine should only be called in special circumstances. - Normally, use `proceed', which handles a lot of bookkeeping. */ - --extern void resume (int, enum gdb_signal); -+enum resume_step -+ { -+ /* currently_stepping () should return non-zero for non-continue. */ -+ RESUME_STEP_CONTINUE = 0, -+ RESUME_STEP_USER, /* Stepping is intentional by the user. */ -+ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */ -+ }; -+ -+extern void resume (enum resume_step, enum gdb_signal); - - extern ptid_t user_visible_resume_ptid (int step); - -Index: gdb-7.6.90.20140127/gdb/infrun.c -=================================================================== ---- gdb-7.6.90.20140127.orig/gdb/infrun.c 2014-01-27 22:05:28.804895349 +0100 -+++ gdb-7.6.90.20140127/gdb/infrun.c 2014-01-27 22:35:12.781224279 +0100 -@@ -83,7 +83,7 @@ static int follow_fork (void); +--- gdb-7.7.90.20140613.orig/gdb/infrun.c 2014-06-13 03:59:36.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/infrun.c 2014-06-13 21:36:43.637294782 +0200 +@@ -84,7 +84,7 @@ static int follow_fork (void); static void set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c); -static int currently_stepping (struct thread_info *tp); +static enum resume_step currently_stepping (struct thread_info *tp); - static int currently_stepping_or_nexting_callback (struct thread_info *tp, - void *data); -@@ -1699,7 +1699,8 @@ user_visible_resume_ptid (int step) + static void xdb_handle_command (char *args, int from_tty); + +@@ -1742,7 +1742,8 @@ user_visible_resume_ptid (int step) } else if ((scheduler_mode == schedlock_on) || (scheduler_mode == schedlock_step @@ -65,16 +44,16 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -1717,7 +1718,7 @@ user_visible_resume_ptid (int step) +@@ -1760,7 +1761,7 @@ user_visible_resume_ptid (int step) STEP nonzero if we should step (zero to continue instead). SIG is the signal to give the inferior (zero for none). */ void -resume (int step, enum gdb_signal sig) +resume (enum resume_step step, enum gdb_signal sig) { - int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1750,9 +1751,13 @@ resume (int step, enum gdb_signal sig) + struct regcache *regcache = get_current_regcache (); +@@ -1800,9 +1801,13 @@ resume (int step, enum gdb_signal sig) if (debug_infrun) fprintf_unfiltered (gdb_stdlog, @@ -90,64 +69,59 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c tp->control.trap_expected, target_pid_to_str (inferior_ptid), paddress (gdbarch, pc)); -@@ -2147,7 +2152,7 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2188,6 +2193,7 @@ proceed (CORE_ADDR addr, enum gdb_signal + struct thread_info *tp; CORE_ADDR pc; struct address_space *aspace; - /* GDB may force the inferior to step due to various reasons. */ -- int force_step = 0; + enum resume_step resume_step = RESUME_STEP_CONTINUE; /* If we're stopped at a fork/vfork, follow the branch set by the "set follow-fork-mode" command; otherwise, we'll just proceed -@@ -2187,13 +2192,13 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2230,13 +2236,19 @@ proceed (CORE_ADDR addr, enum gdb_signal + Note, we don't do this in reverse, because we won't actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ - -- force_step = 1; ++ { + tp->stepping_over_breakpoint = 1; + resume_step = RESUME_STEP_USER; ++ } else if (gdbarch_single_step_through_delay_p (gdbarch) && gdbarch_single_step_through_delay (gdbarch, get_current_frame ())) /* We stepped onto an instruction that needs to be stepped again before re-inserting the breakpoint, do so. */ -- force_step = 1; ++ { + tp->stepping_over_breakpoint = 1; + resume_step = RESUME_STEP_USER; ++ } } else { -@@ -2225,13 +2230,13 @@ proceed (CORE_ADDR addr, enum gdb_signal - is required it returns TRUE and sets the current thread to - the old thread. */ - if (prepare_to_proceed (step)) -- force_step = 1; -+ resume_step = RESUME_STEP_USER; +@@ -2288,6 +2300,7 @@ proceed (CORE_ADDR addr, enum gdb_signal + tp->prev_pc = regcache_read_pc (get_current_regcache ()); + switch_to_thread (step_over->ptid); + tp = step_over; ++ resume_step = RESUME_STEP_USER; + } } - /* prepare_to_proceed may change the current thread. */ - tp = inferior_thread (); - -- if (force_step) -+ if (resume_step == RESUME_STEP_USER) - { - tp->control.trap_expected = 1; - /* If displaced stepping is enabled, we can step over the -@@ -2318,9 +2323,13 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2375,9 +2388,13 @@ proceed (CORE_ADDR addr, enum gdb_signal /* Reset to normal state. */ init_infwait_state (); -+ if (step) ++ if (tp->control.trap_expected || step) + resume_step = RESUME_STEP_USER; + if (resume_step == RESUME_STEP_CONTINUE && bpstat_should_step ()) + resume_step = RESUME_STEP_NEEDED; + /* Resume inferior. */ -- resume (force_step || step || bpstat_should_step (), +- resume (tp->control.trap_expected || step || bpstat_should_step (), - tp->suspend.stop_signal); + resume (resume_step, tp->suspend.stop_signal); /* Wait for it to stop (if not standalone) and in any case decode why it stopped, and act accordingly. */ -@@ -5332,13 +5341,18 @@ switch_back_to_stepped_thread (struct ex +@@ -5359,13 +5376,16 @@ switch_back_to_stepped_thread (struct ex /* Is thread TP in the middle of single-stepping? */ @@ -156,26 +130,23 @@ Index: gdb-7.6.90.20140127/gdb/infrun.c currently_stepping (struct thread_info *tp) { - return ((tp->control.step_range_end -- && tp->control.step_resume_breakpoint == NULL) ++ if ((tp->control.step_range_end + && tp->control.step_resume_breakpoint == NULL) - || tp->control.trap_expected - || bpstat_should_step ()); -+ if ((tp->control.step_range_end -+ && tp->control.step_resume_breakpoint == NULL) -+ || tp->control.trap_expected) ++ || tp->control.trap_expected) + return RESUME_STEP_USER; -+ -+ if (bpstat_should_step ()) ++ if (bpstat_should_step ()) + return RESUME_STEP_NEEDED; -+ + return RESUME_STEP_CONTINUE; } - /* Returns true if any thread *but* the one passed in "data" is in the -Index: gdb-7.6.90.20140127/gdb/linux-nat.c + /* Inferior has stepped into a subroutine call with source code that +Index: gdb-7.7.90.20140613/gdb/linux-nat.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/linux-nat.c 2014-01-27 22:05:28.806895350 +0100 -+++ gdb-7.6.90.20140127/gdb/linux-nat.c 2014-01-27 22:33:45.330157889 +0100 -@@ -2697,7 +2697,11 @@ static int +--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/linux-nat.c 2014-06-13 21:31:19.449949814 +0200 +@@ -2709,7 +2709,11 @@ static int select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { if (lp->last_resume_kind == resume_step @@ -188,11 +159,19 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c return 1; else return 0; -Index: gdb-7.6.90.20140127/gdb/linux-nat.h +Index: gdb-7.7.90.20140613/gdb/linux-nat.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/linux-nat.h 2014-01-27 22:05:28.807895351 +0100 -+++ gdb-7.6.90.20140127/gdb/linux-nat.h 2014-01-27 22:33:45.334157892 +0100 -@@ -59,8 +59,8 @@ struct lwp_info +--- gdb-7.7.90.20140613.orig/gdb/linux-nat.h 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/linux-nat.h 2014-06-13 21:31:19.449949814 +0200 +@@ -18,6 +18,7 @@ + along with this program. If not, see . */ + + #include "target.h" ++#include "infrun.h" + + #include + +@@ -59,8 +60,8 @@ struct lwp_info /* If non-zero, a pending wait status. */ int status; @@ -203,3 +182,36 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.h /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data watchpoint trap. */ +Index: gdb-7.7.90.20140613/gdb/infrun.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/infrun.h 2014-06-13 03:59:36.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/infrun.h 2014-06-13 21:31:19.449949814 +0200 +@@ -89,7 +89,14 @@ extern void proceed (CORE_ADDR, enum gdb + + /* The `resume' routine should only be called in special circumstances. + Normally, use `proceed', which handles a lot of bookkeeping. */ +-extern void resume (int, enum gdb_signal); ++enum resume_step ++ { ++ /* currently_stepping () should return non-zero for non-continue. */ ++ RESUME_STEP_CONTINUE = 0, ++ RESUME_STEP_USER, /* Stepping is intentional by the user. */ ++ RESUME_STEP_NEEDED /* Stepping only for software watchpoints. */ ++ }; ++extern void resume (enum resume_step, enum gdb_signal); + + extern ptid_t user_visible_resume_ptid (int step); + +diff --git a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp +index 2a30604..ee1fd11 100644 +--- a/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp ++++ b/gdb/testsuite/gdb.threads/signal-while-stepping-over-bp-other-thread.exp +@@ -97,7 +97,7 @@ gdb_test "set debug infrun 1" + + gdb_test \ + "step" \ +- ".*need to step-over.*resume \\(step=1.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \ ++ ".*need to step-over.*resume \\(step=RESUME_STEP_USER.*signal arrived while stepping over breakpoint.*switching back to stepped thread.*stepped to a different line.*callme.*" \ + "step" + + set cnt_after [get_value "args\[$my_number\]" "get count after step"] diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch index bf5526a..759dec8 100644 --- a/gdb-6.8-attach-signalled-detach-stopped.patch +++ b/gdb-6.8-attach-signalled-detach-stopped.patch @@ -1,8 +1,8 @@ -Index: gdb-7.7/gdb/linux-nat.c +Index: gdb-7.7.90.20140613/gdb/linux-nat.c =================================================================== ---- gdb-7.7.orig/gdb/linux-nat.c 2014-02-09 19:13:32.998214571 +0100 -+++ gdb-7.7/gdb/linux-nat.c 2014-02-09 19:17:37.561499606 +0100 -@@ -176,6 +176,9 @@ blocked. */ +--- gdb-7.7.90.20140613.orig/gdb/linux-nat.c 2014-06-13 23:03:34.364177614 +0200 ++++ gdb-7.7.90.20140613/gdb/linux-nat.c 2014-06-13 23:05:07.749279122 +0200 +@@ -178,6 +178,9 @@ blocked. */ static struct target_ops *linux_ops; static struct target_ops linux_ops_saved; @@ -12,7 +12,7 @@ Index: gdb-7.7/gdb/linux-nat.c /* The method to call, if any, when a new thread is attached. */ static void (*linux_nat_new_thread) (struct lwp_info *); -@@ -652,7 +655,14 @@ holding the child stopped. Try \"set de +@@ -683,7 +686,14 @@ holding the child stopped. Try \"set de parent_inf->waiting_for_vfork_done = 0; } else if (detach_fork) @@ -28,7 +28,7 @@ Index: gdb-7.7/gdb/linux-nat.c /* Note that the detach above makes PARENT_INF dangling. */ -@@ -1099,6 +1109,7 @@ linux_nat_post_attach_wait (ptid_t ptid, +@@ -1107,6 +1117,7 @@ linux_nat_post_attach_wait (ptid_t ptid, if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, "LNPAW: Attaching to a stopped process\n"); @@ -36,7 +36,7 @@ Index: gdb-7.7/gdb/linux-nat.c /* The process is definitely stopped. It is in a job control stop, unless the kernel predates the TASK_STOPPED / -@@ -1518,6 +1529,9 @@ get_pending_status (struct lwp_info *lp, +@@ -1529,6 +1540,9 @@ get_pending_status (struct lwp_info *lp, gdb_signal_to_string (signo)); } @@ -46,7 +46,7 @@ Index: gdb-7.7/gdb/linux-nat.c return 0; } -@@ -1631,6 +1645,8 @@ linux_nat_detach (struct target_ops *ops +@@ -1642,6 +1656,8 @@ linux_nat_detach (struct target_ops *ops } else linux_ops->to_detach (ops, args, from_tty); @@ -55,9 +55,9 @@ Index: gdb-7.7/gdb/linux-nat.c } /* Resume LP. */ -@@ -1813,6 +1829,14 @@ linux_nat_resume (struct target_ops *ops - linux_nat_resume_callback. */ - lp->stopped = 0; +@@ -1824,6 +1840,14 @@ linux_nat_resume (struct target_ops *ops + return; + } + /* At this point, we are going to resume the inferior and if we + have attached to a stopped process, we no longer should leave @@ -68,9 +68,9 @@ Index: gdb-7.7/gdb/linux-nat.c + pid_was_stopped = 0; + if (resume_many) - iterate_over_lwps (ptid, linux_nat_resume_callback, NULL); + iterate_over_lwps (ptid, linux_nat_resume_callback, lp); -@@ -3864,6 +3888,8 @@ linux_nat_mourn_inferior (struct target_ +@@ -3870,6 +3894,8 @@ linux_nat_mourn_inferior (struct target_ /* Let the arch-specific native code know this process is gone. */ linux_nat_forget_process (pid); @@ -79,10 +79,10 @@ Index: gdb-7.7/gdb/linux-nat.c } /* Convert a native/host siginfo object, into/from the siginfo in the -Index: gdb-7.7/gdb/testsuite/gdb.threads/attach-stopped.exp +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp =================================================================== ---- gdb-7.7.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-02-09 19:13:33.321214945 +0100 +--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-06-13 23:03:34.365177615 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.threads/attach-stopped.exp 2014-06-13 23:03:37.162180660 +0200 @@ -61,7 +61,65 @@ proc corefunc { threadtype } { gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch index f45c707..3e637c9 100644 --- a/gdb-6.8-quit-never-aborts.patch +++ b/gdb-6.8-quit-never-aborts.patch @@ -5,23 +5,23 @@ Some of the threads may not be properly PTRACE_DETACHed which hurts if they should have been detached with SIGSTOP (as they are accidentally left running on the debugger termination). -Index: gdb-7.6.50.20130731-cvs/gdb/defs.h +Index: gdb-7.7.90.20140613/gdb/defs.h =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/defs.h 2013-08-02 16:58:31.453016573 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/defs.h 2013-08-02 16:58:41.221030412 +0200 -@@ -177,6 +177,7 @@ extern int check_quit_flag (void); - /* Set the quit flag. */ - extern void set_quit_flag (void); +--- gdb-7.7.90.20140613.orig/gdb/defs.h 2014-06-13 23:10:18.876623018 +0200 ++++ gdb-7.7.90.20140613/gdb/defs.h 2014-06-13 23:10:52.450660505 +0200 +@@ -174,6 +174,7 @@ extern void set_quit_flag (void); + /* Flag that function quit should call quit_force. */ + extern volatile int sync_quit_force_run; +extern int quit_flag_cleanup; extern int immediate_quit; extern void quit (void); -Index: gdb-7.6.50.20130731-cvs/gdb/top.c +Index: gdb-7.7.90.20140613/gdb/top.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/top.c 2013-08-02 16:58:41.222030414 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/top.c 2013-08-02 16:59:06.321066228 +0200 -@@ -1415,7 +1415,9 @@ quit_force (char *args, int from_tty) +--- gdb-7.7.90.20140613.orig/gdb/top.c 2014-06-13 23:10:15.910619715 +0200 ++++ gdb-7.7.90.20140613/gdb/top.c 2014-06-13 23:10:18.877623020 +0200 +@@ -1378,7 +1378,9 @@ quit_force (char *args, int from_tty) if (ex.reason < 0) \ exception_print (gdb_stderr, ex) @@ -32,11 +32,11 @@ Index: gdb-7.6.50.20130731-cvs/gdb/top.c /* Get out of tfind mode, and kill or detach all inferiors. */ DO_TRY -Index: gdb-7.6.50.20130731-cvs/gdb/utils.c +Index: gdb-7.7.90.20140613/gdb/utils.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/utils.c 2013-08-02 16:58:31.455016575 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/utils.c 2013-08-02 16:58:41.223030415 +0200 -@@ -136,6 +136,11 @@ int quit_flag; +--- gdb-7.7.90.20140613.orig/gdb/utils.c 2014-06-13 23:10:18.878623021 +0200 ++++ gdb-7.7.90.20140613/gdb/utils.c 2014-06-13 23:10:38.307644652 +0200 +@@ -125,6 +125,11 @@ int job_control; int immediate_quit; @@ -45,30 +45,20 @@ Index: gdb-7.6.50.20130731-cvs/gdb/utils.c + +int quit_flag_cleanup; + - #ifndef HAVE_PYTHON - - /* Clear the quit flag. */ -@@ -159,6 +164,9 @@ set_quit_flag (void) - int - check_quit_flag (void) - { -+ if (quit_flag_cleanup) -+ return 0; -+ - /* This is written in a particular way to avoid races. */ - if (quit_flag) - { -Index: gdb-7.6.50.20130731-cvs/gdb/python/python.c + /* Nonzero means that strings with character values >0x7F should be printed + as octal escapes. Zero means just print the value (e.g. it's an + international character, and the terminal or window can cope.) */ +Index: gdb-7.7.90.20140613/gdb/extension.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/python/python.c 2013-08-02 16:58:31.456016577 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/python/python.c 2013-08-02 16:58:41.224030416 +0200 -@@ -191,6 +191,9 @@ set_quit_flag (void) - int - check_quit_flag (void) - { +--- gdb-7.7.90.20140613.orig/gdb/extension.c 2014-06-13 03:59:36.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/extension.c 2014-06-13 23:11:32.434704853 +0200 +@@ -817,6 +817,9 @@ check_quit_flag (void) + int i, result = 0; + const struct extension_language_defn *extlang; + + if (quit_flag_cleanup) + return 0; + - return PyOS_InterruptOccurred (); - } - + ALL_ENABLED_EXTENSION_LANGUAGES (i, extlang) + { + if (extlang->ops->check_quit_flag != NULL) diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 68a6a1a..1f849d1 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,8 +1,8 @@ -Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.c +Index: gdb-7.7.50.20140609/gdb/breakpoint.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/breakpoint.c 2013-08-02 16:29:16.065402116 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/breakpoint.c 2013-08-02 16:29:17.073403456 +0200 -@@ -15963,6 +15963,50 @@ initialize_breakpoint_ops (void) +--- gdb-7.7.50.20140609.orig/gdb/breakpoint.c 2014-06-13 20:24:34.564667225 +0200 ++++ gdb-7.7.50.20140609/gdb/breakpoint.c 2014-06-13 20:24:35.650668351 +0200 +@@ -16364,6 +16364,50 @@ initialize_breakpoint_ops (void) static struct cmd_list_element *enablebreaklist = NULL; void @@ -53,11 +53,11 @@ Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.c _initialize_breakpoint (void) { struct cmd_list_element *c; -Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.h +Index: gdb-7.7.50.20140609/gdb/breakpoint.h =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/breakpoint.h 2013-08-02 16:29:17.074403457 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/breakpoint.h 2013-08-02 16:29:30.221420896 +0200 -@@ -1555,4 +1555,7 @@ extern void breakpoint_free_objfile (str +--- gdb-7.7.50.20140609.orig/gdb/breakpoint.h 2014-06-13 20:24:34.566667227 +0200 ++++ gdb-7.7.50.20140609/gdb/breakpoint.h 2014-06-13 20:24:35.651668352 +0200 +@@ -1553,4 +1553,7 @@ extern void breakpoint_free_objfile (str extern char *ep_parse_optional_if_clause (char **arg); @@ -65,13 +65,13 @@ Index: gdb-7.6.50.20130731-cvs/gdb/breakpoint.h + struct section_offsets *delta); + #endif /* !defined (BREAKPOINT_H) */ -Index: gdb-7.6.50.20130731-cvs/gdb/objfiles.c +Index: gdb-7.7.50.20140609/gdb/objfiles.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/objfiles.c 2013-08-02 16:29:16.068402120 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/objfiles.c 2013-08-02 16:29:17.075403458 +0200 -@@ -851,6 +851,11 @@ objfile_relocate1 (struct objfile *objfi - objfile->sf->sym_probe_fns->sym_relocate_probe (objfile, - new_offsets, delta); +--- gdb-7.7.50.20140609.orig/gdb/objfiles.c 2014-06-13 20:24:35.652668353 +0200 ++++ gdb-7.7.50.20140609/gdb/objfiles.c 2014-06-13 20:25:10.867704891 +0200 +@@ -820,6 +820,11 @@ objfile_relocate1 (struct objfile *objfi + obj_section_addr (s)); + } + /* Final call of breakpoint_re_set can keep breakpoint locations disabled if + their addresses match. */ diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index d099b5b..8f7cdea 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,24 +1,24 @@ -Index: gdb-7.5.50.20130118/gdb/gdbtypes.h +Index: gdb-7.7.50.20140609/gdb/gdbtypes.h =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/gdbtypes.h 2013-01-18 23:07:03.488358315 +0100 -+++ gdb-7.5.50.20130118/gdb/gdbtypes.h 2013-01-18 23:08:10.286451570 +0100 -@@ -420,6 +420,7 @@ enum field_loc_kind +--- gdb-7.7.50.20140609.orig/gdb/gdbtypes.h 2014-06-13 20:23:55.210626427 +0200 ++++ gdb-7.7.50.20140609/gdb/gdbtypes.h 2014-06-13 20:24:26.156658622 +0200 +@@ -440,6 +440,7 @@ enum field_loc_kind { - FIELD_LOC_KIND_BITPOS, /* bitpos */ - FIELD_LOC_KIND_ENUMVAL, /* enumval */ + FIELD_LOC_KIND_BITPOS, /**< bitpos */ + FIELD_LOC_KIND_ENUMVAL, /**< enumval */ + /* This address is unrelocated by the objfile's ANOFFSET. */ - FIELD_LOC_KIND_PHYSADDR, /* physaddr */ - FIELD_LOC_KIND_PHYSNAME, /* physname */ - FIELD_LOC_KIND_DWARF_BLOCK /* dwarf_block */ -@@ -614,6 +615,7 @@ struct main_type - is the location (in the target) of the static field. - Otherwise, physname is the mangled label of the static field. */ + FIELD_LOC_KIND_PHYSADDR, /**< physaddr */ + FIELD_LOC_KIND_PHYSNAME, /**< physname */ + FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */ +@@ -617,6 +618,7 @@ struct main_type + field. Otherwise, physname is the mangled label of the + static field. */ + /* This address is unrelocated by the objfile's ANOFFSET. */ CORE_ADDR physaddr; const char *physname; -@@ -1237,6 +1239,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1262,6 +1264,7 @@ extern void allocate_gnat_aux_type (stru #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) @@ -26,7 +26,7 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ -@@ -1248,6 +1251,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1273,6 +1276,7 @@ extern void allocate_gnat_aux_type (stru #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -34,7 +34,7 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1264,6 +1268,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1289,6 +1293,7 @@ extern void allocate_gnat_aux_type (stru #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) @@ -42,11 +42,11 @@ Index: gdb-7.5.50.20130118/gdb/gdbtypes.h #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) -Index: gdb-7.5.50.20130118/gdb/jv-lang.c +Index: gdb-7.7.50.20140609/gdb/jv-lang.c =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/jv-lang.c 2013-01-18 23:07:03.488358315 +0100 -+++ gdb-7.5.50.20130118/gdb/jv-lang.c 2013-01-18 23:08:10.286451570 +0100 -@@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd +--- gdb-7.7.50.20140609.orig/gdb/jv-lang.c 2014-06-13 20:23:55.211626428 +0200 ++++ gdb-7.7.50.20140609/gdb/jv-lang.c 2014-06-13 20:23:56.278627534 +0200 +@@ -427,7 +427,8 @@ java_link_class_type (struct gdbarch *gd fields = NULL; nfields--; /* First set up dummy "class" field. */ @@ -56,7 +56,7 @@ Index: gdb-7.5.50.20130118/gdb/jv-lang.c TYPE_FIELD_NAME (type, nfields) = "class"; TYPE_FIELD_TYPE (type, nfields) = value_type (clas); SET_TYPE_FIELD_PRIVATE (type, nfields); -@@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd +@@ -475,7 +476,8 @@ java_link_class_type (struct gdbarch *gd SET_TYPE_FIELD_PROTECTED (type, i); } if (accflags & 0x0008) /* ACC_STATIC */ @@ -66,11 +66,11 @@ Index: gdb-7.5.50.20130118/gdb/jv-lang.c else SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset); if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ -Index: gdb-7.5.50.20130118/gdb/value.c +Index: gdb-7.7.50.20140609/gdb/value.c =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/value.c 2013-01-18 23:07:03.490358319 +0100 -+++ gdb-7.5.50.20130118/gdb/value.c 2013-01-18 23:08:10.287451543 +0100 -@@ -2624,7 +2624,8 @@ value_static_field (struct type *type, i +--- gdb-7.7.50.20140609.orig/gdb/value.c 2014-06-13 20:23:55.212626429 +0200 ++++ gdb-7.7.50.20140609/gdb/value.c 2014-06-13 20:23:56.279627535 +0200 +@@ -2783,7 +2783,8 @@ value_static_field (struct type *type, i { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), diff --git a/gdb-archer-vla-tests.patch b/gdb-archer-vla-tests.patch new file mode 100644 index 0000000..1f8886d --- /dev/null +++ b/gdb-archer-vla-tests.patch @@ -0,0 +1,3488 @@ +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.ada/packed_array.exp 2014-06-16 23:30:30.107940483 +0200 +@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" { + # are. Observed with (FSF GNU Ada 4.5.3 20110124). + xfail $test + } ++ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" { ++ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an ++ # empty array [0..-1]. ++ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref) ++ xfail $test ++ } + } + +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S 2014-06-16 23:30:30.108940484 +0200 +@@ -0,0 +1,457 @@ ++ .file "x86_64-vla-pointer.c" ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .text ++.Ltext0: ++.globl foo ++ .type foo, @function ++foo: ++.LFB2: ++ .file 1 "x86_64-vla-pointer.c" ++ .loc 1 22 0 ++ pushq %rbp ++.LCFI0: ++ movq %rsp, %rbp ++.LCFI1: ++ subq $64, %rsp ++.LCFI2: ++ movl %edi, -36(%rbp) ++ .loc 1 22 0 ++ movq %rsp, %rax ++ movq %rax, -48(%rbp) ++ .loc 1 23 0 ++ movl -36(%rbp), %edx ++ movslq %edx,%rax ++ subq $1, %rax ++ movq %rax, -24(%rbp) ++ .loc 1 24 0 ++ movslq %edx,%rax ++ addq $15, %rax ++ addq $15, %rax ++ shrq $4, %rax ++ salq $4, %rax ++ subq %rax, %rsp ++ movq %rsp, -56(%rbp) ++ movq -56(%rbp), %rax ++ addq $15, %rax ++ shrq $4, %rax ++ salq $4, %rax ++ movq %rax, -56(%rbp) ++ movq -56(%rbp), %rax ++ movq %rax, -16(%rbp) ++ .loc 1 27 0 ++ movl $0, -4(%rbp) ++ jmp .L2 ++.L3: ++ .loc 1 28 0 ++ movl -4(%rbp), %esi ++ movl -4(%rbp), %eax ++ movl %eax, %ecx ++ movq -16(%rbp), %rdx ++ movslq %esi,%rax ++ movb %cl, (%rdx,%rax) ++ .loc 1 27 0 ++ addl $1, -4(%rbp) ++.L2: ++ movl -4(%rbp), %eax ++ cmpl -36(%rbp), %eax ++ jl .L3 ++ .loc 1 30 0 ++ .globl break_here ++break_here: ++ movq -16(%rbp), %rax ++ movb $0, (%rax) ++ movq -48(%rbp), %rsp ++ .loc 1 31 0 ++ leave ++ ret ++.LFE2: ++ .size foo, .-foo ++ .section .debug_frame,"",@progbits ++.Lframe0: ++ .long .LECIE0-.LSCIE0 ++.LSCIE0: ++ .long 0xffffffff ++ .byte 0x1 ++ .string "" ++ .uleb128 0x1 ++ .sleb128 -8 ++ .byte 0x10 ++ .byte 0xc ++ .uleb128 0x7 ++ .uleb128 0x8 ++ .byte 0x90 ++ .uleb128 0x1 ++ .align 8 ++.LECIE0: ++.LSFDE0: ++ .long .LEFDE0-.LASFDE0 ++.LASFDE0: ++ .long .Lframe0 ++ .quad .LFB2 ++ .quad .LFE2-.LFB2 ++ .byte 0x4 ++ .long .LCFI0-.LFB2 ++ .byte 0xe ++ .uleb128 0x10 ++ .byte 0x86 ++ .uleb128 0x2 ++ .byte 0x4 ++ .long .LCFI1-.LCFI0 ++ .byte 0xd ++ .uleb128 0x6 ++ .align 8 ++.LEFDE0: ++ .section .eh_frame,"a",@progbits ++.Lframe1: ++ .long .LECIE1-.LSCIE1 ++.LSCIE1: ++ .long 0x0 ++ .byte 0x1 ++ .string "zR" ++ .uleb128 0x1 ++ .sleb128 -8 ++ .byte 0x10 ++ .uleb128 0x1 ++ .byte 0x3 ++ .byte 0xc ++ .uleb128 0x7 ++ .uleb128 0x8 ++ .byte 0x90 ++ .uleb128 0x1 ++ .align 8 ++.LECIE1: ++.LSFDE1: ++ .long .LEFDE1-.LASFDE1 ++.LASFDE1: ++ .long .LASFDE1-.Lframe1 ++ .long .LFB2 ++ .long .LFE2-.LFB2 ++ .uleb128 0x0 ++ .byte 0x4 ++ .long .LCFI0-.LFB2 ++ .byte 0xe ++ .uleb128 0x10 ++ .byte 0x86 ++ .uleb128 0x2 ++ .byte 0x4 ++ .long .LCFI1-.LCFI0 ++ .byte 0xd ++ .uleb128 0x6 ++ .align 8 ++.LEFDE1: ++ .text ++.Letext0: ++ .section .debug_loc,"",@progbits ++.Ldebug_loc0: ++.LLST0: ++ .quad .LFB2-.Ltext0 ++ .quad .LCFI0-.Ltext0 ++ .value 0x2 ++ .byte 0x77 ++ .sleb128 8 ++ .quad .LCFI0-.Ltext0 ++ .quad .LCFI1-.Ltext0 ++ .value 0x2 ++ .byte 0x77 ++ .sleb128 16 ++ .quad .LCFI1-.Ltext0 ++ .quad .LFE2-.Ltext0 ++ .value 0x2 ++ .byte 0x76 ++ .sleb128 16 ++ .quad 0x0 ++ .quad 0x0 ++ .section .debug_info ++.Ldebug_relative: ++ .long .Ldebug_end - .Ldebug_start ++.Ldebug_start: ++ .value 0x2 ++ .long .Ldebug_abbrev0 ++ .byte 0x8 ++ .uleb128 0x1 ++ .long .LASF2 ++ .byte 0x1 ++ .long .LASF3 ++ .long .LASF4 ++ .quad .Ltext0 ++ .quad .Letext0 ++ .long .Ldebug_line0 ++ .uleb128 0x2 ++ .byte 0x1 ++ .string "foo" ++ .byte 0x1 ++ .byte 0x16 ++ .byte 0x1 ++ .quad .LFB2 ++ .quad .LFE2 ++ .long .LLST0 ++ .long .Ltype_int - .Ldebug_relative ++ .uleb128 0x3 ++ .long .LASF5 ++ .byte 0x1 ++ .byte 0x15 ++ .long .Ltype_int - .Ldebug_relative ++ .byte 0x2 ++ .byte 0x91 ++ .sleb128 -52 ++.Ltag_pointer: ++ .uleb128 0x4 ++ .byte 0x8 /* DW_AT_byte_size */ ++ .long .Ltag_array_type - .debug_info /* DW_AT_type */ ++ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ ++ .long .LASF0 ++ .byte 0x1 ++ .byte 0x18 ++#if 1 ++ .long .Ltag_pointer - .debug_info ++#else ++ /* Debugging only: Skip the typedef indirection. */ ++ .long .Ltag_array_type - .debug_info ++#endif ++ /* DW_AT_location: DW_FORM_block1: start */ ++ .byte 0x3 ++ .byte 0x91 ++ .sleb128 -32 ++#if 0 ++ .byte 0x6 /* DW_OP_deref */ ++#else ++ .byte 0x96 /* DW_OP_nop */ ++#endif ++ /* DW_AT_location: DW_FORM_block1: end */ ++ .uleb128 0x6 ++ .string "i" ++ .byte 0x1 ++ .byte 0x19 ++ .long .Ltype_int - .Ldebug_relative ++ .byte 0x2 ++ .byte 0x91 ++ .sleb128 -20 ++ .byte 0x0 ++.Ltype_int: ++ .uleb128 0x7 ++ .byte 0x4 ++ .byte 0x5 ++ .string "int" ++.Ltag_array_type: ++ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ ++ .long .Ltype_char - .Ldebug_relative ++ .long .Ltype_ulong - .Ldebug_relative /* DW_AT_sibling: DW_FORM_ref4 */ ++1: /* DW_AT_data_location: DW_FORM_block1: start */ ++ .byte 2f - 3f /* length */ ++3: ++ .byte 0x97 /* DW_OP_push_object_address */ ++#if 1 ++ .byte 0x6 /* DW_OP_deref */ ++#else ++ .byte 0x96 /* DW_OP_nop */ ++#endif ++2: /* DW_AT_data_location: DW_FORM_block1: end */ ++ .uleb128 0x9 ++ .long .Ltype_char - .Ldebug_relative /* DW_AT_type: DW_FORM_ref4 */ ++ .byte 0x3 ++ .byte 0x91 ++ .sleb128 -40 ++ .byte 0x6 ++ .byte 0x0 ++.Ltype_ulong: ++ .uleb128 0xa ++ .byte 0x8 ++ .byte 0x7 ++.Ltype_char: ++ .uleb128 0xb ++ .byte 0x1 ++ .byte 0x6 ++ .long .LASF1 ++ .byte 0x0 ++.Ldebug_end: ++ .section .debug_abbrev ++ .uleb128 0x1 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x1 ++ .uleb128 0x10 ++ .uleb128 0x6 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x2 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0xc ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0xc ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x1 ++ .uleb128 0x40 ++ .uleb128 0x6 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0x5 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x4 /* .Ltag_pointer abbrev */ ++ .uleb128 0x0f /* DW_TAG_pointer_type */ ++ .byte 0x0 ++ .uleb128 0x0b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x6 ++ .uleb128 0x34 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x7 ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ ++ .uleb128 0x1 ++ .byte 0x1 ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x1 /* DW_AT_sibling */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x50 /* DW_AT_data_location */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x9 ++ .uleb128 0x21 ++ .byte 0x0 ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x2f ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0xa ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0x0 ++ .byte 0x0 ++ .byte 0x0 ++ .section .debug_pubnames,"",@progbits ++ .long 0x16 ++ .value 0x2 ++ .long .Ldebug_info0 ++ .long 0xa8 ++ .long 0x2d ++ .string "foo" ++ .long 0x0 ++ .section .debug_aranges,"",@progbits ++ .long 0x2c ++ .value 0x2 ++ .long .Ldebug_info0 ++ .byte 0x8 ++ .byte 0x0 ++ .value 0x0 ++ .value 0x0 ++ .quad .Ltext0 ++ .quad .Letext0-.Ltext0 ++ .quad 0x0 ++ .quad 0x0 ++ .section .debug_str,"MS",@progbits,1 ++.LASF0: ++ .string "array" ++.LASF5: ++ .string "size" ++.LASF3: ++ .string "x86_64-vla-pointer.c" ++.LASF6: ++ .string "array_t" ++.LASF1: ++ .string "char" ++.LASF4: ++ .string "gdb.arch" ++.LASF2: ++ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" ++ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" ++ .section .note.GNU-stack,"",@progbits +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c 2014-06-16 23:30:30.108940484 +0200 +@@ -0,0 +1,43 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++#if 0 ++ ++void ++foo (int size) ++{ ++ typedef char array_t[size]; ++ array_t array; ++ int i; ++ ++ for (i = 0; i < size; i++) ++ array[i] = i; ++ ++ array[0] = 0; /* break-here */ ++} ++ ++#else ++ ++int ++main (void) ++{ ++ foo (26); ++ foo (78); ++ return 0; ++} ++ ++#endif +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp 2014-06-16 23:30:30.108940484 +0200 +@@ -0,0 +1,66 @@ ++# Copyright 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 . ++ ++if ![istarget "x86_64-*-*"] then { ++ verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64." ++ return ++} ++ ++set testfile x86_64-vla-pointer ++set srcasmfile ${testfile}-foo.S ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++set binobjfile ${objdir}/${subdir}/${testfile}-foo.o ++if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto_main] { ++ untested x86_64-vla-pointer ++ return -1 ++} ++ ++gdb_breakpoint "break_here" ++ ++gdb_continue_to_breakpoint "break_here" ++ ++gdb_test "whatis array" "type = char \\(\\*\\)\\\[26\\\]" "first: whatis array" ++gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array" ++ ++gdb_test "whatis *array" "type = char \\\[variable length\\\]" "first: whatis *array" ++gdb_test "ptype *array" "type = char \\\[variable length\\\]" "first: ptype *array" ++ ++gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'" ++gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'" ++gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'" ++gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'" ++ ++gdb_continue_to_breakpoint "break_here" ++ ++gdb_test "whatis array" "type = char \\(\\*\\)\\\[78\\\]" "second: whatis array" ++gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array" ++ ++gdb_test "whatis *array" "type = char \\\[variable length\\\]" "second: whatis *array" ++gdb_test "ptype *array" "type = char \\\[variable length\\\]" "second: ptype *array" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S 2014-06-16 23:30:30.108940484 +0200 +@@ -0,0 +1,455 @@ ++ .file "x86_64-vla-typedef.c" ++ .section .debug_abbrev,"",@progbits ++.Ldebug_abbrev0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .text ++.Ltext0: ++.globl foo ++ .type foo, @function ++foo: ++.LFB2: ++ .file 1 "x86_64-vla-typedef.c" ++ .loc 1 22 0 ++ pushq %rbp ++.LCFI0: ++ movq %rsp, %rbp ++.LCFI1: ++ subq $64, %rsp ++.LCFI2: ++ movl %edi, -36(%rbp) ++ .loc 1 22 0 ++ movq %rsp, %rax ++ movq %rax, -48(%rbp) ++ .loc 1 23 0 ++ movl -36(%rbp), %edx ++ movslq %edx,%rax ++ subq $1, %rax ++ movq %rax, -24(%rbp) ++ .loc 1 24 0 ++ movslq %edx,%rax ++ addq $15, %rax ++ addq $15, %rax ++ shrq $4, %rax ++ salq $4, %rax ++ subq %rax, %rsp ++ movq %rsp, -56(%rbp) ++ movq -56(%rbp), %rax ++ addq $15, %rax ++ shrq $4, %rax ++ salq $4, %rax ++ movq %rax, -56(%rbp) ++ movq -56(%rbp), %rax ++ movq %rax, -16(%rbp) ++ .loc 1 27 0 ++ movl $0, -4(%rbp) ++ jmp .L2 ++.L3: ++ .loc 1 28 0 ++ movl -4(%rbp), %esi ++ movl -4(%rbp), %eax ++ movl %eax, %ecx ++ movq -16(%rbp), %rdx ++ movslq %esi,%rax ++ movb %cl, (%rdx,%rax) ++ .loc 1 27 0 ++ addl $1, -4(%rbp) ++.L2: ++ movl -4(%rbp), %eax ++ cmpl -36(%rbp), %eax ++ jl .L3 ++ .loc 1 30 0 ++ .globl break_here ++break_here: ++ movq -16(%rbp), %rax ++ movb $0, (%rax) ++ movq -48(%rbp), %rsp ++ .loc 1 31 0 ++ leave ++ ret ++.LFE2: ++ .size foo, .-foo ++ .section .debug_frame,"",@progbits ++.Lframe0: ++ .long .LECIE0-.LSCIE0 ++.LSCIE0: ++ .long 0xffffffff ++ .byte 0x1 ++ .string "" ++ .uleb128 0x1 ++ .sleb128 -8 ++ .byte 0x10 ++ .byte 0xc ++ .uleb128 0x7 ++ .uleb128 0x8 ++ .byte 0x90 ++ .uleb128 0x1 ++ .align 8 ++.LECIE0: ++.LSFDE0: ++ .long .LEFDE0-.LASFDE0 ++.LASFDE0: ++ .long .Lframe0 ++ .quad .LFB2 ++ .quad .LFE2-.LFB2 ++ .byte 0x4 ++ .long .LCFI0-.LFB2 ++ .byte 0xe ++ .uleb128 0x10 ++ .byte 0x86 ++ .uleb128 0x2 ++ .byte 0x4 ++ .long .LCFI1-.LCFI0 ++ .byte 0xd ++ .uleb128 0x6 ++ .align 8 ++.LEFDE0: ++ .section .eh_frame,"a",@progbits ++.Lframe1: ++ .long .LECIE1-.LSCIE1 ++.LSCIE1: ++ .long 0x0 ++ .byte 0x1 ++ .string "zR" ++ .uleb128 0x1 ++ .sleb128 -8 ++ .byte 0x10 ++ .uleb128 0x1 ++ .byte 0x3 ++ .byte 0xc ++ .uleb128 0x7 ++ .uleb128 0x8 ++ .byte 0x90 ++ .uleb128 0x1 ++ .align 8 ++.LECIE1: ++.LSFDE1: ++ .long .LEFDE1-.LASFDE1 ++.LASFDE1: ++ .long .LASFDE1-.Lframe1 ++ .long .LFB2 ++ .long .LFE2-.LFB2 ++ .uleb128 0x0 ++ .byte 0x4 ++ .long .LCFI0-.LFB2 ++ .byte 0xe ++ .uleb128 0x10 ++ .byte 0x86 ++ .uleb128 0x2 ++ .byte 0x4 ++ .long .LCFI1-.LCFI0 ++ .byte 0xd ++ .uleb128 0x6 ++ .align 8 ++.LEFDE1: ++ .text ++.Letext0: ++ .section .debug_loc,"",@progbits ++.Ldebug_loc0: ++.LLST0: ++ .quad .LFB2-.Ltext0 ++ .quad .LCFI0-.Ltext0 ++ .value 0x2 ++ .byte 0x77 ++ .sleb128 8 ++ .quad .LCFI0-.Ltext0 ++ .quad .LCFI1-.Ltext0 ++ .value 0x2 ++ .byte 0x77 ++ .sleb128 16 ++ .quad .LCFI1-.Ltext0 ++ .quad .LFE2-.Ltext0 ++ .value 0x2 ++ .byte 0x76 ++ .sleb128 16 ++ .quad 0x0 ++ .quad 0x0 ++ .section .debug_info ++ .long .Ldebug_end - .Ldebug_start ++.Ldebug_start: ++ .value 0x2 ++ .long .Ldebug_abbrev0 ++ .byte 0x8 ++ .uleb128 0x1 ++ .long .LASF2 ++ .byte 0x1 ++ .long .LASF3 ++ .long .LASF4 ++ .quad .Ltext0 ++ .quad .Letext0 ++ .long .Ldebug_line0 ++ .uleb128 0x2 ++ .byte 0x1 ++ .string "foo" ++ .byte 0x1 ++ .byte 0x16 ++ .byte 0x1 ++ .quad .LFB2 ++ .quad .LFE2 ++ .long .LLST0 ++ .long 0x83 ++ .uleb128 0x3 ++ .long .LASF5 ++ .byte 0x1 ++ .byte 0x15 ++ .long 0x83 ++ .byte 0x2 ++ .byte 0x91 ++ .sleb128 -52 ++.Ltag_typedef: ++ .uleb128 0x4 ++ .long .LASF6 ++ .byte 0x1 ++ .byte 0x17 ++ .long .Ltag_array_type - .debug_info ++ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ ++ .long .LASF0 ++ .byte 0x1 ++ .byte 0x18 ++#if 1 ++ .long .Ltag_typedef - .debug_info ++#else ++ /* Debugging only: Skip the typedef indirection. */ ++ .long .Ltag_array_type - .debug_info ++#endif ++ /* DW_AT_location: DW_FORM_block1: start */ ++ .byte 0x3 ++ .byte 0x91 ++ .sleb128 -32 ++#if 0 ++ .byte 0x6 /* DW_OP_deref */ ++#else ++ .byte 0x96 /* DW_OP_nop */ ++#endif ++ /* DW_AT_location: DW_FORM_block1: end */ ++ .uleb128 0x6 ++ .string "i" ++ .byte 0x1 ++ .byte 0x19 ++ .long 0x83 ++ .byte 0x2 ++ .byte 0x91 ++ .sleb128 -20 ++ .byte 0x0 ++ .uleb128 0x7 ++ .byte 0x4 ++ .byte 0x5 ++ .string "int" ++.Ltag_array_type: ++ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ ++ .long 0xa0 + (2f - 1f) /* DW_AT_type: DW_FORM_ref4 */ ++ .long 0x9d + (2f - 1f) /* DW_AT_sibling: DW_FORM_ref4 */ ++1: /* DW_AT_data_location: DW_FORM_block1: start */ ++ .byte 2f - 3f /* length */ ++3: ++ .byte 0x97 /* DW_OP_push_object_address */ ++ .byte 0x6 /* DW_OP_deref */ ++2: /* DW_AT_data_location: DW_FORM_block1: end */ ++ .uleb128 0x9 ++ .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */ ++ .byte 0x3 ++ .byte 0x91 ++ .sleb128 -40 ++ .byte 0x6 ++ .byte 0x0 ++ .uleb128 0xa ++ .byte 0x8 ++ .byte 0x7 ++ .uleb128 0xb ++ .byte 0x1 ++ .byte 0x6 ++ .long .LASF1 ++ .byte 0x0 ++.Ldebug_end: ++ .section .debug_abbrev ++ .uleb128 0x1 ++ .uleb128 0x11 ++ .byte 0x1 ++ .uleb128 0x25 ++ .uleb128 0xe ++ .uleb128 0x13 ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x1b ++ .uleb128 0xe ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x1 ++ .uleb128 0x10 ++ .uleb128 0x6 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x2 ++ .uleb128 0x2e ++ .byte 0x1 ++ .uleb128 0x3f ++ .uleb128 0xc ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x27 ++ .uleb128 0xc ++ .uleb128 0x11 ++ .uleb128 0x1 ++ .uleb128 0x12 ++ .uleb128 0x1 ++ .uleb128 0x40 ++ .uleb128 0x6 ++ .uleb128 0x1 ++ .uleb128 0x13 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0x5 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x4 ++ .uleb128 0x16 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x5 ++ .uleb128 0x34 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0xe ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x6 ++ .uleb128 0x34 ++ .byte 0x0 ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .uleb128 0x3a ++ .uleb128 0xb ++ .uleb128 0x3b ++ .uleb128 0xb ++ .uleb128 0x49 ++ .uleb128 0x13 ++ .uleb128 0x2 ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x7 ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0x8 ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ ++ .uleb128 0x1 ++ .byte 0x1 ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x1 /* DW_AT_sibling */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x50 /* DW_AT_data_location */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0x9 ++ .uleb128 0x21 ++ .byte 0x0 ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x2f ++ .uleb128 0xa ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0xa ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .byte 0x0 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0x24 ++ .byte 0x0 ++ .uleb128 0xb ++ .uleb128 0xb ++ .uleb128 0x3e ++ .uleb128 0xb ++ .uleb128 0x3 ++ .uleb128 0xe ++ .byte 0x0 ++ .byte 0x0 ++ .byte 0x0 ++ .section .debug_pubnames,"",@progbits ++ .long 0x16 ++ .value 0x2 ++ .long .Ldebug_info0 ++ .long 0xa8 ++ .long 0x2d ++ .string "foo" ++ .long 0x0 ++ .section .debug_aranges,"",@progbits ++ .long 0x2c ++ .value 0x2 ++ .long .Ldebug_info0 ++ .byte 0x8 ++ .byte 0x0 ++ .value 0x0 ++ .value 0x0 ++ .quad .Ltext0 ++ .quad .Letext0-.Ltext0 ++ .quad 0x0 ++ .quad 0x0 ++ .section .debug_str,"MS",@progbits,1 ++.LASF0: ++ .string "array" ++.LASF5: ++ .string "size" ++.LASF3: ++ .string "x86_64-vla-typedef.c" ++.LASF6: ++ .string "array_t" ++.LASF1: ++ .string "char" ++.LASF4: ++ .string "gdb.arch" ++.LASF2: ++ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" ++ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" ++ .section .note.GNU-stack,"",@progbits +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c 2014-06-16 23:30:30.109940484 +0200 +@@ -0,0 +1,43 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 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 0 ++ ++void ++foo (int size) ++{ ++ typedef char array_t[size]; ++ array_t array; ++ int i; ++ ++ for (i = 0; i < size; i++) ++ array[i] = i; ++ ++ array[0] = 0; /* break-here */ ++} ++ ++#else ++ ++int ++main (void) ++{ ++ foo (26); ++ foo (78); ++ return 0; ++} ++ ++#endif +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp 2014-06-16 23:30:30.109940484 +0200 +@@ -0,0 +1,64 @@ ++# Copyright 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 . ++ ++# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate. ++ ++if ![istarget "x86_64-*-*"] then { ++ verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64." ++ return ++} ++ ++set testfile x86_64-vla-typedef ++set srcasmfile ${testfile}-foo.S ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++set binobjfile ${objdir}/${subdir}/${testfile}-foo.o ++if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto_main] { ++ untested x86_64-vla-typedef ++ return -1 ++} ++ ++gdb_breakpoint "break_here" ++ ++gdb_continue_to_breakpoint "break_here" ++ ++gdb_test "whatis array" "type = array_t" "first: whatis array" ++ ++gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array" ++ ++gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'" ++gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'" ++gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'" ++gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'" ++ ++gdb_continue_to_breakpoint "break_here" ++ ++gdb_test "whatis array" "type = array_t" "second: whatis array" ++ ++gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.c 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.c 2014-06-16 23:30:30.109940484 +0200 +@@ -17,6 +17,13 @@ + + int array[] = {1, 2, 3, 4}; + ++#ifdef __GNUC__ ++struct ++ { ++ int a[0]; ++ } unbound; ++#endif ++ + int + main (void) + { +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/arrayidx.exp 2014-06-16 23:30:30.109940484 +0200 +@@ -49,4 +49,12 @@ gdb_test "print array" \ + "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ + "Print array with array-indexes on" + +- ++set test "p unbound.a == &unbound.a\[0\]" ++gdb_test_multiple $test $test { ++ -re " = 1\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" { ++ unsupported "$test (no GCC)" ++ } ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.c 2014-06-16 23:30:30.109940484 +0200 +@@ -0,0 +1,20 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++struct { ++ int field; ++} staticstruct = { 1 }; +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/internal-var-field-address.exp 2014-06-16 23:30:30.109940484 +0200 +@@ -0,0 +1,26 @@ ++# Copyright 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 . ++ ++set test internal-var-field-address ++set binfile ${test}.x ++if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++clean_restart $binfile ++ ++gdb_test {set $varstruct = staticstruct} ++gdb_test {p $varstruct.field} " = 1" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.c 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,31 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2011 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 ++ ++int ++main (int argc, char **argv) ++{ ++ char s[2 + argc]; ++ void (*f) (char *) = 0; ++ ++ memset (s, 0, sizeof (s)); ++ s[0] = 'X'; ++ ++ f (s); ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-frame.exp 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,38 @@ ++# Copyright 2011 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 vla-frame ++set executable ${testfile} ++ ++if { [prepare_for_testing ${testfile}.exp ${executable}] } { ++ return -1 ++} ++ ++if ![runto_main] { ++ return -1 ++} ++ ++set test "continue" ++gdb_test_multiple $test $test { ++ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ untested ${testfile}.exp ++ return ++ } ++} ++ ++gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.c 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,30 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 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 ++ ++int ++main (int argc, char **argv) ++{ ++ int array[argc]; ++ ++ array[0] = array[0]; ++ ++ abort (); ++ ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla-overflow.exp 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,109 @@ ++# Copyright 2008 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 . ++ ++# We could crash in: ++# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69 ++# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97 ++# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL)); ++# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496 ++# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156 ++# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206 ++# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430 ++# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840 ++# ... ++# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292 ++# ... ++# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273 ++ ++set testfile vla-overflow ++set shfile ${objdir}/${subdir}/${testfile}-gdb.sh ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++set f [open "|getconf PAGESIZE" "r"] ++gets $f pagesize ++close $f ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set pid_of_gdb [exp_pid -i [board_info host fileid]] ++ ++if { [runto_main] < 0 } { ++ untested vla-overflow ++ return -1 ++} ++ ++# Get the GDB memory size when we stay at main. ++ ++proc memory_v_pages_get {} { ++ global pid_of_gdb pagesize ++ set fd [open "/proc/$pid_of_gdb/statm"] ++ gets $fd line ++ close $fd ++ # number of pages of virtual memory ++ scan $line "%d" drs ++ return $drs ++} ++ ++set pages_found [memory_v_pages_get] ++ ++# s390x with glibc-debuginfo.s390x installed used approx. 16MB. ++set mb_reserve 40 ++verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve" ++set kb_found [expr $pages_found * $pagesize / 1024] ++set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024] ++verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" ++ ++# Create the ulimit wrapper. ++set f [open $shfile "w"] ++puts $f "#! /bin/sh" ++puts $f "ulimit -v $kb_permit" ++puts $f "exec $GDB \"\$@\"" ++close $f ++remote_exec host "chmod +x $shfile" ++ ++gdb_exit ++set GDBold $GDB ++set GDB "$shfile" ++gdb_start ++set GDB $GDBold ++ ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set pid_of_gdb [exp_pid -i [board_info host fileid]] ++ ++# Check the size again after the second run. ++# We must not stop in main as it would cache `array' and never crash later. ++ ++gdb_run_cmd ++ ++verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" ++ ++gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()" ++ ++verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" ++ ++# `abort' can get expressed as `*__GI_abort'. ++gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()" ++ ++verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.c 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,55 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 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 ++ ++void ++marker (void) ++{ ++} ++ ++void ++bar (char *a, char *b, char *c, int size) ++{ ++ memset (a, '1', size); ++ memset (b, '2', size); ++ memset (c, '3', 48); ++} ++ ++void ++foo (int size) ++{ ++ char temp1[size]; ++ char temp3[48]; ++ ++ temp1[size - 1] = '\0'; ++ { ++ char temp2[size]; ++ ++ bar (temp1, temp2, temp3, size); ++ ++ marker (); /* break-here */ ++ } ++} ++ ++int ++main (void) ++{ ++ foo (26); ++ foo (78); ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/vla.exp 2014-06-16 23:30:30.110940485 +0200 +@@ -0,0 +1,62 @@ ++# Copyright 2008 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 vla ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto_main] { ++ untested vla ++ return -1 ++} ++ ++gdb_breakpoint [gdb_get_line_number "break-here"] ++ ++gdb_continue_to_breakpoint "break-here" ++ ++gdb_test "whatis temp1" "type = char \\\[26\\\]" "first: whatis temp1" ++gdb_test "whatis temp2" "type = char \\\[26\\\]" "first: whatis temp2" ++gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3" ++ ++gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1" ++gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2" ++gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3" ++ ++gdb_test "p temp1" " = '1' " "first: print temp1" ++gdb_test "p temp2" " = '2' " "first: print temp2" ++gdb_test "p temp3" " = '3' " "first: print temp3" ++ ++gdb_continue_to_breakpoint "break-here" ++ ++gdb_test "whatis temp1" "type = char \\\[78\\\]" "second: whatis temp1" ++gdb_test "whatis temp2" "type = char \\\[78\\\]" "second: whatis temp2" ++gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3" ++ ++gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1" ++gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2" ++gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3" ++ ++gdb_test "p temp1" " = '1' " "second: print temp1" ++gdb_test "p temp2" " = '2' " "second: print temp2" ++gdb_test "p temp3" " = '3' " "second: print temp3" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S 2014-06-16 23:30:30.111940487 +0200 +@@ -0,0 +1,246 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ 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 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 . */ ++ ++/* Debug information */ ++ ++/* We will `break *main' at the very first instruction. */ ++#define main_length 1 ++ ++ .section .data ++vardata: ++ /* See DW_OP_lit3 + 1 (0-based). */ ++ .string "seennotseen" ++ ++ .section .debug_info ++.Lcu1_begin: ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF version number */ ++ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ ++ .byte 4 /* Pointer Size (in bytes) */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .4byte .Lproducer /* DW_AT_producer */ ++ /* Use C++ to exploit a bug in parsing DW_AT_name "". */ ++ .byte 4 /* DW_AT_language (C++) - */ ++ .4byte main /* DW_AT_low_pc */ ++ .byte main_length /* DW_AT_high_pc */ ++ ++.Larray_type: ++ .uleb128 2 /* Abbrev: DW_TAG_array_type */ ++ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ ++ ++ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ ++ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 0 /* DW_AT_lower_bound */ ++ .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */ ++ .byte 0 /* End of children of die */ ++ ++ /* DW_AT_upper_bound is referencing an optimized-out variable. */ ++.Larrayb_type: ++ .uleb128 2 /* Abbrev: DW_TAG_array_type */ ++ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ ++ ++ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ ++ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 0 /* DW_AT_lower_bound */ ++ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */ ++ .byte 0 /* End of children of die */ ++ ++ /* DW_AT_upper_bound is referencing register. */ ++.Larrayreg_type: ++ .uleb128 2 /* Abbrev: DW_TAG_array_type */ ++ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ ++ ++ .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */ ++ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 0 /* DW_AT_lower_bound */ ++ .byte 2f - 1f /* DW_AT_upper_bound */ ++1: .byte 0x50 /* DW_OP_reg0 */ ++2: ++ .byte 0 /* End of children of die */ ++ ++.Luint_type: ++ .uleb128 4 /* Abbrev: DW_TAG_base_type */ ++ .4byte .Luint_str /* DW_AT_name */ ++ .byte 4 /* DW_AT_byte_size */ ++ .byte 7 /* DW_AT_encoding */ ++ ++.Lchar_type: ++ .uleb128 4 /* Abbrev: DW_TAG_base_type */ ++ .4byte .Lchar_str /* DW_AT_name */ ++ .byte 1 /* DW_AT_byte_size */ ++ .byte 6 /* DW_AT_encoding */ ++ ++.Llen_var: ++ .uleb128 5 /* Abbrev: DW_TAG_variable artificial */ ++ .byte 1 /* DW_AT_artificial */ ++ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ ++ .4byte .Llen_loclist-.Lloclist /* DW_AT_location */ ++ ++ /* optimized-out variable for b_string. */ ++.Llenb_var: ++ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */ ++ .byte 1 /* DW_AT_artificial */ ++ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ ++ ++ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ ++ .string "a_string" /* DW_AT_name */ ++ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 2f - 1f /* DW_AT_location */ ++1: .byte 3 /* DW_OP_addr */ ++ .4byte vardata /* */ ++2: ++ ++ /* DW_AT_upper_bound is referencing an optimized-out variable. */ ++ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ ++ .string "b_string" /* DW_AT_name */ ++ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 2f - 1f /* DW_AT_location */ ++1: .byte 3 /* DW_OP_addr */ ++ .4byte vardata /* */ ++2: ++ ++ /* DW_AT_upper_bound is referencing register. */ ++ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ ++ .string "reg_string" /* DW_AT_name */ ++ .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 2f - 1f /* DW_AT_location */ ++1: .byte 3 /* DW_OP_addr */ ++ .4byte vardata /* */ ++2: ++ ++ .byte 0 /* End of children of CU */ ++.Lcu1_end: ++ ++ .section .debug_loc ++.Lloclist: ++.Llen_loclist: ++ .4byte 0 # Location list begin address ++ .4byte main_length # Location list end address ++ .value 2f-1f # Location expression size ++1: .byte 0x33 # DW_OP_lit3 ++ .byte 0x9f # DW_OP_stack_value ++2: ++ .quad 0x0 # Location list terminator begin (*.LLST2) ++ .quad 0x0 # Location list terminator end (*.LLST2) ++ ++ .section .debug_abbrev ++.Ldebug_abbrev0: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 0x1 /* has_children */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0xe /* DW_FORM_strp */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x1 /* TAG: DW_TAG_array_type */ ++ .byte 0x1 /* DW_children_yes */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 3 /* Abbrev code */ ++ .uleb128 0x21 /* DW_TAG_subrange_type */ ++ .byte 0x0 /* no children */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x22 /* DW_AT_lower_bound */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x2f /* DW_AT_upper_bound */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 4 /* Abbrev code */ ++ .uleb128 0x24 /* DW_TAG_base_type */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0xe /* DW_FORM_strp */ ++ .uleb128 0xb /* DW_AT_byte_size */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3e /* DW_AT_encoding */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 5 /* Abbrev code */ ++ .uleb128 0x34 /* DW_TAG_variable */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x34 /* DW_AT_artificial */ ++ .uleb128 0x0c /* DW_FORM_flag */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x02 /* DW_AT_location */ ++ .uleb128 0x06 /* DW_FORM_data4 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 6 /* Abbrev code */ ++ .uleb128 0x34 /* DW_TAG_variable */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x2 /* DW_AT_location */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 7 /* Abbrev code */ ++ .uleb128 0x34 /* DW_TAG_variable */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x34 /* DW_AT_artificial */ ++ .uleb128 0x0c /* DW_FORM_flag */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 8 /* Abbrev code */ ++ .uleb128 0x21 /* DW_TAG_subrange_type with block */ ++ .byte 0x0 /* no children */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x22 /* DW_AT_lower_bound */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x2f /* DW_AT_upper_bound */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ ++ ++/* String table */ ++ .section .debug_str ++.Lproducer: ++ .string "GNU C 3.3.3" ++.Lchar_str: ++ .string "char" ++.Luint_str: ++ .string "unsigned int" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp 2014-06-16 23:30:30.111940487 +0200 +@@ -0,0 +1,63 @@ ++# 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 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 printing variable with dynamic bounds which reference a different ++# (artificial in the GCC case) variable containing loclist as its location. ++# This testcase uses value (not address) of the referenced variable: ++# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762 ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++set testfile dw2-bound-loclist ++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } { ++ return -1 ++} ++ ++# Verify it behaves at least as an unbound array without inferior. ++ ++set test "p a_string" ++gdb_test_multiple $test $test { ++ -re " = 0x\[0-9a-f\]+ \"seennotseen\"\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "No registers\\.\r\n$gdb_prompt $" { ++ kfail "vlaregression" $test ++ } ++} ++ ++gdb_test "ptype a_string" {type = char \[variable length\]} ++ ++# Not runto_main as dw2-bound-loclist.S handles only the first byte of main. ++if ![runto "*main"] { ++ return -1 ++} ++ ++gdb_test "p a_string" { = "seen"} ++gdb_test "ptype a_string" {type = char \[4\]} ++ ++gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"} ++gdb_test "ptype b_string" {type = char \[\]} ++ ++# The register contains unpredictable value - the array size. ++gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2014-06-16 23:30:30.111940487 +0200 +@@ -0,0 +1,42 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2004 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. */ ++ ++ ++/* The function `func1' traced into must have debug info on offset > 0; ++ (DW_UNSND (attr)). This is the reason of `func0' existence. */ ++ ++void ++func0(int a, int b) ++{ ++} ++ ++/* `func1' being traced into must have some arguments to dump. */ ++ ++void ++func1(int a, int b) ++{ ++ func0 (a,b); ++} ++ ++int ++main(void) ++{ ++ func1 (1, 2); ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2014-06-16 23:30:30.111940487 +0200 +@@ -0,0 +1,79 @@ ++# 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. ++ ++# Minimal DWARF-2 unit test ++ ++# This test can only be run on targets which support DWARF-2. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++set testfile "dw2-stripped" ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile}.x ++ ++remote_exec build "rm -f ${binfile}" ++ ++# get the value of gcc_compiled ++if [get_compiler_info ${binfile}] { ++ return -1 ++} ++ ++# This test can only be run on gcc as we use additional_flags=FIXME ++if {$gcc_compiled == 0} { ++ return 0 ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } { ++ return -1 ++} ++ ++remote_exec build "objcopy -R .debug_loc ${binfile}" ++set strip_output [remote_exec build "objdump -h ${binfile}"] ++ ++set test "stripping test file preservation" ++if [ regexp ".debug_info " $strip_output] { ++ pass "$test (.debug_info preserved)" ++} else { ++ fail "$test (.debug_info got also stripped)" ++} ++ ++set test "stripping test file functionality" ++if [ regexp ".debug_loc " $strip_output] { ++ fail "$test (.debug_loc still present)" ++} else { ++ pass "$test (.debug_loc stripped)" ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++# For C programs, "start" should stop in main(). ++ ++gdb_test "start" \ ++ ".*main \\(\\) at .*" \ ++ "start" ++gdb_test "step" \ ++ "func.* \\(.*\\) at .*" \ ++ "step" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,83 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++/* Debug information */ ++ ++ .section .debug_info ++.Lcu1_begin: ++ /* CU header */ ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF Version */ ++ .4byte .Labbrev1_begin /* Offset into abbrev section */ ++ .byte 4 /* Pointer size */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */ ++ .ascii "GNU C 4.3.2\0" /* DW_AT_producer */ ++ .byte 1 /* DW_AT_language (C) */ ++ ++.Ltype_uchar: ++ .uleb128 2 /* Abbrev: DW_TAG_structure_type */ ++ .ascii "some_struct\0" /* DW_AT_name */ ++ ++ .uleb128 3 /* Abbrev: DW_TAG_member */ ++ .ascii "field\0" /* DW_AT_name */ ++ .byte 0 /* DW_AT_data_member_location */ ++ ++ .byte 0 /* End of children of some_struct */ ++ ++ .byte 0 /* End of children of CU */ ++ ++.Lcu1_end: ++ ++/* Abbrev table */ ++ .section .debug_abbrev ++.Labbrev1_begin: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 1 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x13 /* DW_TAG_structure_type */ ++ .byte 1 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 3 /* Abbrev code */ ++ .uleb128 0x0d /* DW_TAG_member */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x38 /* DW_AT_data_member_location */ ++ .uleb128 0x0b /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,37 @@ ++# Copyright 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 . ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++set testfile "dw2-struct-member-data-location" ++set srcfile ${testfile}.S ++set binfile ${testfile}.x ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } { ++ return -1 ++} ++ ++clean_restart $binfile ++ ++gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,121 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++/* Debug information */ ++ ++ .section .data ++vardata: ++ .rept 129 ++ .ascii "x" ++ .endr ++ .ascii "UNSEEN\0" ++ ++ .section .debug_info ++.Lcu1_begin: ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF version number */ ++ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ ++ .byte 4 /* Pointer Size (in bytes) */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ ++ .byte 2 /* DW_AT_language (C) - */ ++ ++.Larray_type: ++ .uleb128 2 /* Abbrev: DW_TAG_array_type */ ++ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ ++ ++ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */ ++ .byte 0 /* DW_AT_lower_bound */ ++ .byte 128 /* DW_AT_upper_bound */ ++ ++ .byte 0 /* End of children of die */ ++ ++.Lchar_type: ++ .uleb128 4 /* Abbrev: DW_TAG_base_type */ ++ .ascii "char\0" /* DW_AT_name */ ++ .byte 1 /* DW_AT_byte_size */ ++ .byte 6 /* DW_AT_encoding */ ++ ++ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ ++ .ascii "notype_string\0" /* DW_AT_name */ ++ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ ++ .byte 2f - 1f /* DW_AT_location */ ++1: .byte 3 /* DW_OP_addr */ ++ .4byte vardata /* */ ++2: ++ ++ .byte 0 /* End of children of CU */ ++.Lcu1_end: ++ ++ .section .debug_abbrev ++.Ldebug_abbrev0: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 0x1 /* has_children */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x1 /* TAG: DW_TAG_array_type */ ++ .byte 0x1 /* DW_children_yes */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 4 /* Abbrev code */ ++ .uleb128 0x24 /* DW_TAG_base_type */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0xb /* DW_AT_byte_size */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3e /* DW_AT_encoding */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 6 /* Abbrev code */ ++ .uleb128 0x34 /* DW_TAG_variable */ ++ .byte 0x0 /* no_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x2 /* DW_AT_location */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 8 /* Abbrev code */ ++ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */ ++ .byte 0x0 /* no children */ ++ .uleb128 0x22 /* DW_AT_lower_bound */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x2f /* DW_AT_upper_bound */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,39 @@ ++# Copyright 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 . ++load_lib dwarf.exp ++ ++# https://bugzilla.redhat.com/show_bug.cgi?id=806920 ++# read_subrange_type reinitialization ++# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without ++# specified DW_AT_type, present only in XLF produced code. ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++if {![dwarf2_support]} { ++ return 0 ++} ++ ++set testfile dw2-subrange-no-type ++set srcfile ${testfile}.S ++set executable ${testfile}.x ++set binfile [standard_output_file ${executable}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { ++ return -1 ++} ++ ++clean_restart $executable ++ ++gdb_test "ptype notype_string" {type = char \[129\]} ++gdb_test "p notype_string" " = 'x' " +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,42 @@ ++# Copyright 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 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. ++ ++# This file was written by Jan Kratochvil . ++ ++# This file is part of the gdb testsuite. Array element stride must not be ++# specified in the number of elements but in a number of bytes instead. ++# Original problem: ++# (gdb) p c40pt(1) ++# $1 = '0-hello', ' ' ++# (gdb) p c40pt(2) ++# warning: Fortran array stride not divisible by the element size ++ ++set testfile dwarf-stride ++set srcfile ${testfile}.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 "break-here"] ++gdb_continue_to_breakpoint "break-here" ".*break-here.*" ++gdb_test "p c40pt(1)" " = '0-hello.*" ++gdb_test "p c40pt(2)" " = '1-hello.*" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dwarf-stride.f90 2014-06-16 23:30:30.112940488 +0200 +@@ -0,0 +1,40 @@ ++! Copyright 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 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. ++! ++! File written by Alan Matsuoka. ++ ++program repro ++ ++ type small_stride ++ character*40 long_string ++ integer small_pad ++ end type small_stride ++ ++ type(small_stride), dimension (20), target :: unpleasant ++ character*40, pointer, dimension(:):: c40pt ++ ++ integer i ++ ++ do i = 0,19 ++ unpleasant(i+1)%small_pad = i+1 ++ unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello' ++ end do ++ ++ c40pt => unpleasant%long_string ++ ++ print *, c40pt ! break-here ++ ++end program repro +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2014-06-16 23:30:30.113940488 +0200 +@@ -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 +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2014-06-16 23:30:30.113940488 +0200 +@@ -0,0 +1,37 @@ ++# 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} ++ ++if ![runto bar_] then { ++ perror "couldn't run to bar_" ++ continue ++} ++ ++gdb_test "bt" {foo \(string='hello'.*} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2014-06-16 23:30:30.113940488 +0200 +@@ -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 +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.exp 2014-06-16 23:37:45.568362563 +0200 +@@ -0,0 +1,151 @@ ++# Copyright 2007 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. ++ ++# This file was written by Jan Kratochvil . ++ ++# This file is part of the gdb testsuite. It contains tests for dynamically ++# allocated Fortran arrays. ++# It depends on the GCC dynamic Fortran arrays DWARF support: ++# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244 ++ ++set testfile "dynamic" ++set srcfile ${testfile}.f90 ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "varx-init"] ++gdb_continue_to_breakpoint "varx-init" ++gdb_test "p varx" "\\$\[0-9\]* = " "p varx unallocated" ++gdb_test "ptype varx" "type = " "ptype varx unallocated" ++gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) unallocated" ++gdb_test "p varx(1,5,17)=1" "no such vector element because not allocated" "p varx(1,5,17)=1 unallocated" ++gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) unallocated" ++ ++gdb_breakpoint [gdb_get_line_number "varx-allocated"] ++gdb_continue_to_breakpoint "varx-allocated" ++# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) ++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated" ++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. ++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated" ++ ++gdb_breakpoint [gdb_get_line_number "varx-filled"] ++gdb_continue_to_breakpoint "varx-filled" ++gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6" ++gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7" ++gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8" ++gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9" ++gdb_test "p varv" "\\$\[0-9\]* = " "p varv unassociated" ++gdb_test "ptype varv" "type = " "ptype varv unassociated" ++ ++set test "output varx" ++gdb_test_multiple $test $test { ++ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++gdb_breakpoint [gdb_get_line_number "varv-associated"] ++gdb_continue_to_breakpoint "varv-associated" ++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated" ++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated" ++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. ++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated" ++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated" ++# Intel Fortran Compiler 10.1.008 uses the pointer type. ++gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated" ++ ++gdb_breakpoint [gdb_get_line_number "varv-filled"] ++gdb_continue_to_breakpoint "varv-filled" ++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled" ++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled" ++ ++gdb_breakpoint [gdb_get_line_number "varv-deassociated"] ++gdb_continue_to_breakpoint "varv-deassociated" ++# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. ++gdb_test "p varv" "\\$\[0-9\]* = (|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated" ++gdb_test "ptype varv" "type = (|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated" ++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated" ++gdb_test "p varv(1,5,17)" "no such vector element because not associated" ++gdb_test "ptype varv(1,5,17)" "no such vector element because not associated" ++ ++gdb_breakpoint [gdb_get_line_number "varx-deallocated"] ++gdb_continue_to_breakpoint "varx-deallocated" ++gdb_test "p varx" "\\$\[0-9\]* = " "p varx deallocated" ++gdb_test "ptype varx" "type = " "ptype varx deallocated" ++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated" ++gdb_test "p varx(1,5,17)" "no such vector element because not allocated" "p varx(1,5,17) deallocated" ++gdb_test "ptype varx(1,5,17)" "no such vector element because not allocated" "ptype varx(1,5,17) deallocated" ++ ++gdb_breakpoint [gdb_get_line_number "vary-passed"] ++gdb_continue_to_breakpoint "vary-passed" ++# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...) ++gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)" ++ ++gdb_breakpoint [gdb_get_line_number "vary-filled"] ++gdb_continue_to_breakpoint "vary-filled" ++gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)" ++gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8" ++gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9" ++gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10" ++# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...) ++gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)" ++ ++gdb_breakpoint [gdb_get_line_number "varw-almostfilled"] ++gdb_continue_to_breakpoint "varw-almostfilled" ++gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)" ++gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1" ++# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...) ++gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled" ++# "up" works with GCC but other Fortran compilers may copy the values into the ++# outer function only on the exit of the inner function. ++# We need both variants as depending on the arch we optionally may still be ++# executing the caller line or not after `finish'. ++gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))" ++gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3" ++gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6" ++gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5" ++gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1" ++ ++gdb_breakpoint [gdb_get_line_number "varz-almostfilled"] ++gdb_continue_to_breakpoint "varz-almostfilled" ++# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not. ++gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" ++# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7) ++# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7. ++gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?" ++gdb_test "p varz" "\\$\[0-9\]* = \\(\\)" ++gdb_test "p vart" "\\$\[0-9\]* = \\(\\)" ++gdb_test "p varz(3)" "\\$\[0-9\]* = 4" ++# maps to foo::vary(1,1) ++gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8" ++# maps to foo::vary(2,2) ++gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" ++# maps to foo::vary(1,3) ++gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic.f90 2014-06-16 23:30:30.113940488 +0200 +@@ -0,0 +1,98 @@ ++! Copyright 2007 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 baz ++ real, target, allocatable :: varx (:, :, :) ++ real, pointer :: varv (:, :, :) ++ real, target :: varu (1, 2, 3) ++ logical :: l ++ allocate (varx (1:6, 5:15, 17:28)) ! varx-init ++ l = allocated (varx) ++ varx(:, :, :) = 6 ! varx-allocated ++ varx(1, 5, 17) = 7 ++ varx(2, 6, 18) = 8 ++ varx(6, 15, 28) = 9 ++ varv => varx ! varx-filled ++ l = associated (varv) ++ varv(3, 7, 19) = 10 ! varv-associated ++ varv => null () ! varv-filled ++ l = associated (varv) ++ deallocate (varx) ! varv-deassociated ++ l = allocated (varx) ++ varu(:, :, :) = 10 ! varx-deallocated ++ allocate (varv (1:6, 5:15, 17:28)) ++ l = associated (varv) ++ varv(:, :, :) = 6 ++ varv(1, 5, 17) = 7 ++ varv(2, 6, 18) = 8 ++ varv(6, 15, 28) = 9 ++ deallocate (varv) ++ l = associated (varv) ++ varv => varu ++ varv(1, 1, 1) = 6 ++ varv(1, 2, 3) = 7 ++ l = associated (varv) ++end subroutine baz ++subroutine foo (vary, varw) ++ real :: vary (:, :) ++ real :: varw (:, :, :) ++ vary(:, :) = 4 ! vary-passed ++ vary(1, 1) = 8 ++ vary(2, 2) = 9 ++ vary(1, 3) = 10 ++ varw(:, :, :) = 5 ! vary-filled ++ varw(1, 1, 1) = 6 ++ varw(2, 2, 2) = 7 ! varw-almostfilled ++end subroutine foo ++subroutine bar (varz, vart) ++ real :: varz (*) ++ real :: vart (2:11, 7:*) ++ varz(1:3) = 4 ++ varz(2) = 5 ! varz-almostfilled ++ vart(2,7) = vart(2,7) ++end subroutine bar ++program test ++ interface ++ subroutine foo (vary, varw) ++ real :: vary (:, :) ++ real :: varw (:, :, :) ++ end subroutine ++ end interface ++ interface ++ subroutine bar (varz, vart) ++ real :: varz (*) ++ real :: vart (2:11, 7:*) ++ end subroutine ++ end interface ++ real :: x (10, 10), y (5), z(8, 8, 8) ++ x(:,:) = 1 ++ y(:) = 2 ++ z(:,:,:) = 3 ++ call baz ++ call foo (x, z(2:6, 4:7, 6:8)) ++ call bar (y, x) ++ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort ++ if (x (1, 3) .ne. 10) call abort ++ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort ++ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort ++ call foo (transpose (x), z) ++ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort ++ if (x (3, 1) .ne. 10) call abort ++end +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.exp 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,59 @@ ++# Copyright 2008 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. ++ ++# This file was written by Jan Kratochvil . ++ ++# This file is part of the gdb testsuite. It contains tests for Fortran ++# strings with dynamic length. ++ ++set testfile "string" ++set srcfile ${testfile}.f90 ++set binfile ${objdir}/${subdir}/${testfile} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "var-init"] ++gdb_continue_to_breakpoint "var-init" ++gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)" ++gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)" ++gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)" ++gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)" ++gdb_test "ptype *e" "Attempt to take contents of a non-pointer value." ++gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)" ++gdb_test "p c" "\\$\[0-9\]* = 'c'" ++gdb_test "p d" "\\$\[0-9\]* = 'd '" ++gdb_test "p e" "\\$\[0-9\]* = 'g '" ++gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)" ++gdb_test "p *e" "Attempt to take contents of a non-pointer value." ++gdb_test "p *f" "Attempt to take contents of a non-pointer value." ++ ++gdb_breakpoint [gdb_get_line_number "var-finish"] ++gdb_continue_to_breakpoint "var-finish" ++gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" ++gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/string.f90 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,37 @@ ++! Copyright 2008 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 (e, f) ++ character (len=1) :: c ++ character (len=8) :: d ++ character (len=*) :: e ++ character (len=*) :: f (1:7, 8:10) ++ c = 'c' ++ d = 'd' ++ e = 'e' ! var-init ++ f = 'f' ++ f(1,9) = 'f2' ++ c = 'c' ! var-finish ++end subroutine foo ++ character (len=4) :: g, h (1:7, 8:10) ++ g = 'g' ++ h = 'h' ++ call foo (g, h) ++end +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.exp 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,72 @@ ++# Copyright 2011 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_fortran_tests] } { return -1 } ++ ++set testfile "subrange" ++set srcfile ${testfile}.f90 ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { ++ return -1 ++} ++ ++if ![runto MAIN__] { ++ perror "Couldn't run to MAIN__" ++ continue ++} ++ ++# Depending on the compiler version being used, the name of the 4-byte integer ++# and real types can be printed differently. For instance, gfortran-4.1 uses ++# "int4" whereas gfortran-4.3 uses "int(kind=4)". ++set int4 "(int4|integer\\(kind=4\\))" ++ ++gdb_breakpoint [gdb_get_line_number "break-static"] ++gdb_continue_to_breakpoint "break-static" ".*break-static.*" ++ ++foreach var {a alloc ptr} { ++ global pf_prefix ++ set old_prefix $pf_prefix ++ lappend pf_prefix "$var:" ++ ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (2, 2:3)" { = \(22, 32\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (2:3, 3)" { = \(32, 33\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (1, 2:)" { = \(21, 31\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (2, :2)" { = \(12, 22\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (3, 2:2)" { = \(23\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)" ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (4, :)" { = \(14, 24, 34\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)} ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)" ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (:)" "Wrong number of subscripts" ++ setup_kfail "*-*-*" "vlaregression/9999" ++ gdb_test "p $var (:, :, :)" "Wrong number of subscripts" ++ ++ set pf_prefix $old_prefix ++} ++ ++gdb_test_no_output {set $a=a} ++delete_breakpoints ++gdb_unload ++setup_kfail "*-*-*" "vlaregression/9999" ++gdb_test {p $a (3, 2:2)} { = \(23\)} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/subrange.f90 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,28 @@ ++! Copyright 2011 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 test ++ integer, target :: a (4, 3) ++ integer, allocatable :: alloc (:, :) ++ integer, pointer :: ptr (:, :) ++ do 1 i = 1, 4 ++ do 1 j = 1, 3 ++ a (i, j) = j * 10 + i ++1 continue ++ allocate (alloc (4, 3)) ++ alloc = a ++ ptr => a ++ write (*,*) a ! break-static ++end +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.c 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,26 @@ ++/* Copyright 2011 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 . */ ++ ++int ++main (int argc, char **argv) ++{ ++ char vla[argc]; ++ ++ vla[0] = 0; /* break-here */ ++ ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp 2014-06-16 23:30:30.114940489 +0200 +@@ -0,0 +1,57 @@ ++# Copyright 2011 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 . ++ ++load_lib mi-support.exp ++set MIFLAGS "-i=mi2" ++ ++gdb_exit ++if [mi_gdb_start] { ++ continue ++} ++ ++set testfile "mi2-var-stale-type" ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} { ++ return -1 ++} ++ ++mi_delete_breakpoints ++mi_gdb_reinitialize_dir $srcdir/$subdir ++mi_gdb_load ${binfile} ++ ++mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \ ++ {\^done} \ ++ "maintenance set internal-error quit yes" ++ ++mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \ ++ {\^done} \ ++ "maintenance set internal-error corefile yes" ++ ++set line [gdb_get_line_number "break-here"] ++set func "main" ++ ++mi_gdb_test "-break-insert -t $srcfile:$line" \ ++ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \ ++ "breakpoint at $func" ++ ++if { [mi_run_cmd] < 0 } { ++ return -1 ++} ++mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla" ++ ++mi_create_varobj "vla" "vla" "create local variable vla" ++ ++mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register-func.c 2014-06-16 23:30:30.115940490 +0200 +@@ -0,0 +1,22 @@ ++/* This file is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++int ++func (int *arr) ++{ ++ return arr[0]; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.c 2014-06-16 23:30:30.115940490 +0200 +@@ -0,0 +1,28 @@ ++/* This file is part of GDB, the GNU debugger. ++ ++ Copyright 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 . */ ++ ++extern int func (int *arr); ++ ++int ++main (void) ++{ ++ int arr[] = { 42 }; ++ ++ func (arr); ++ ++ return 0; ++} +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.opt/array-from-register.exp 2014-06-16 23:30:30.115940490 +0200 +@@ -0,0 +1,33 @@ ++# Copyright 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 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. ++# ++# This file is part of the gdb testsuite. ++ ++if { [prepare_for_testing array-from-register.exp "array-from-register" \ ++ {array-from-register.c array-from-register-func.c} \ ++ {debug optimize=-O2}] } { ++ return -1 ++} ++ ++if ![runto func] then { ++ return -1 ++} ++ ++gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+" ++ ++# Seen regression: ++# Address requested for identifier "arr" which is in register $rdi ++gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.exp 2014-06-16 23:30:30.115940490 +0200 +@@ -0,0 +1,104 @@ ++# Copyright 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 . ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++load_lib "pascal.exp" ++ ++set testfile "arrays" ++set srcfile ${testfile}.pas ++set binfile ${objdir}/${subdir}/${testfile}$EXEEXT ++ ++# These tests only work with fpc, using the -gw3 compile-option ++pascal_init ++if { $pascal_compiler_is_fpc != 1 } { ++ return -1 ++} ++ ++# Detect if the fpc version is below 2.3.0 ++set fpc_generates_dwarf_for_dynamic_arrays 1 ++if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} { ++ set fpc_generates_dwarf_for_dynamic_arrays 0 ++} ++ ++ ++if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] ++set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] ++ ++ ++if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { ++ pass "setting breakpoint 1" ++} ++if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { ++ pass "setting breakpoint 2" ++} ++ ++# Verify that "start" lands inside the right procedure. ++if { [gdb_start_cmd] < 0 } { ++ untested start ++ return -1 ++} ++ ++gdb_test "" ".* at .*${srcfile}.*" "start" ++ ++gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" ++ ++gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type" ++gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer" ++ ++gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint" ++ ++gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char" ++gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type" ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" ++ ++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { ++ setup_xfail "*-*-*" ++} ++gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" ++ +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.pascal/arrays.pas 2014-06-16 23:30:30.115940490 +0200 +@@ -0,0 +1,82 @@ ++{ ++ Copyright 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 . ++} ++ ++program arrays; ++ ++{$mode objfpc}{$h+} ++ ++uses sysutils; ++ ++type TStatArrInt= array[0..11] of integer; ++ TDynArrInt= array of integer; ++ TStatArrStr= array[0..12] of string; ++ TDynArrStr= array of string; ++ TDynArrChar = array of char; ++ TStatArrChar = array [0..11] of char; ++ ++ TStat2dArrInt = array[0..11,0..4] of integer; ++ ++var StatArrInt: TStatArrInt; ++ StatArrInt_: Array[0..11] of integer; ++ DynArrInt: TDynArrInt; ++ DynArrInt_: Array of integer; ++ StatArrStr: TStatArrStr; ++ DynArrStr: TDynArrStr; ++ StatArrChar: TStatArrChar; ++ DynArrChar: TDynArrChar; ++ ++ Stat2dArrInt: TStat2dArrInt; ++ ++ s: string; ++ ++ i,j : integer; ++ ++begin ++ for i := 0 to 11 do ++ begin ++ StatArrInt[i]:= i+50; ++ StatArrInt_[i]:= i+50; ++ StatArrChar[i]:= chr(ord('a')+i); ++ for j := 0 to 4 do ++ Stat2dArrInt[i,j]:=i+j; ++ end; ++ writeln(StatArrInt_[0]); ++ writeln(StatArrInt[0]); { set breakpoint 1 here } ++ writeln(StatArrChar[0]); ++ writeln(Stat2dArrInt[0,0]); ++ ++ setlength(DynArrInt,13); ++ setlength(DynArrInt_,13); ++ setlength(DynArrStr,13); ++ setlength(DynArrChar,13); ++ for i := 0 to 12 do ++ begin ++ DynArrInt[i]:= i+50; ++ DynArrInt_[i]:= i+50; ++ DynArrChar[i]:= chr(ord('a')+i); ++ StatArrStr[i]:='str'+inttostr(i); ++ DynArrStr[i]:='dstr'+inttostr(i); ++ end; ++ writeln(DynArrInt_[1]); ++ writeln(DynArrInt[1]); ++ writeln(DynArrStr[1]); ++ writeln(StatArrStr[1]); ++ writeln(DynArrChar[1]); ++ ++ s := 'test'#0'string'; ++ writeln(s); { set breakpoint 2 here } ++end. +Index: gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:29.278939700 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/lib/gdb.exp 2014-06-16 23:30:30.117940492 +0200 +@@ -159,6 +159,11 @@ proc gdb_unload {} { + send_gdb "y\n" + exp_continue + } ++ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\ ++ { send_gdb "y\n" ++ verbose "\t\tUnloading symbols for program being debugged" ++ exp_continue ++ } + -re "Discard symbol table from .*y or n.*$" { + send_gdb "y\n" + exp_continue +Index: gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/testsuite/lib/pascal.exp 2014-06-13 03:59:37.000000000 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/lib/pascal.exp 2014-06-16 23:30:30.117940492 +0200 +@@ -37,6 +37,9 @@ proc pascal_init {} { + global pascal_compiler_is_fpc + global gpc_compiler + global fpc_compiler ++ global fpcversion_major ++ global fpcversion_minor ++ global fpcversion_release + global env + + if { $pascal_init_done == 1 } { +@@ -64,6 +67,20 @@ proc pascal_init {} { + set pascal_compiler_is_fpc 1 + verbose -log "Free Pascal compiler found" + } ++ ++ # Detect the fpc-version ++ if { $pascal_compiler_is_fpc == 1 } { ++ set fpcversion_major 1 ++ set fpcversion_minor 0 ++ set fpcversion_release 0 ++ set fpcversion [ remote_exec host $fpc_compiler "-iV" ] ++ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] { ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor ++ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release ++ } ++ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release" ++ } + } + set pascal_init_done 1 + } diff --git a/gdb-archer.patch b/gdb-archer.patch index 6694dc0..c6be51c 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,37 +2,24 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 21c8ac8faa4256f27d4751d8f0d2b218f2d232a8 +commit b88230edf4e2da948d633c283ba0893bf22bd7ae -branch jankratochvil/fedoragdb77 - the merge of branches: -jankratochvil/vla tromey/python diff --git a/README.archer b/README.archer new file mode 100644 -index 0000000..5ae587e +index 0000000..173b8ea --- /dev/null +++ b/README.archer -@@ -0,0 +1,13 @@ -+Merge for Fedora 21: http://pkgs.fedoraproject.org/cgit/gdb.git/ -+ -+jankratochvil/vla -+tromey/python -+ -+================================================================ +@@ -0,0 +1,2 @@ +This branch originally held the Python code for gdb. It still exists +because a small amount of code here has not yet been merged upstream. -+ -+================================================================ -+C variable length arrays / DW_FORM_block / Fortran dynamic arrays. -+implementation plan: http://sourceware.org/ml/gdb/2012-11/msg00094.html -+explanation of its merge status: http://sourceware.org/ml/gdb/2011-03/msg00021.html diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 824b26b..56f052a 100644 +index ea27cf5..bc04024 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1372,6 +1372,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -1476,6 +1476,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -42,180 +29,39 @@ index 824b26b..56f052a 100644 + CONFIG_HEADERS= \ + $(SHELL) config.status + - config.status: $(srcdir)/configure configure.tgt configure.host development.sh + config.status: $(srcdir)/configure configure.tgt configure.host ../bfd/development.sh $(SHELL) config.status --recheck -diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index e70a33b..977f3e2 100644 ---- a/gdb/ada-lang.c -+++ b/gdb/ada-lang.c -@@ -12703,6 +12703,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, - - static int - ada_operator_check (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, void *data), - void *data) - { -@@ -12717,12 +12718,15 @@ ada_operator_check (struct expression *exp, int pos, - break; - - default: -- return operator_check_standard (exp, pos, objfile_func, data); -+ return operator_check_standard (exp, pos, type_func, objfile_func, -+ data); - } - - /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ - -- if (type && TYPE_OBJFILE (type) -+ if (type && type_func && (*type_func) (type, data)) -+ return 1; -+ if (type && TYPE_OBJFILE (type) && objfile_func - && (*objfile_func) (TYPE_OBJFILE (type), data)) - return 1; - -diff --git a/gdb/block.c b/gdb/block.c -index 2ae6ee2..376a1e8 100644 ---- a/gdb/block.c -+++ b/gdb/block.c -@@ -693,3 +693,21 @@ block_iter_match_next (const char *name, - - return block_iter_match_step (iterator, name, compare, 0); - } -+ -+/* Return OBJFILE in which BLOCK is located or NULL if we cannot find it for -+ whatever reason. */ -+ -+struct objfile * -+block_objfile (const struct block *block) -+{ -+ struct symbol *func; -+ -+ if (block == NULL) -+ return NULL; -+ -+ func = block_linkage_function (block); -+ if (func == NULL) -+ return NULL; -+ -+ return SYMBOL_SYMTAB (func)->objfile; -+} -diff --git a/gdb/block.h b/gdb/block.h -index ca143a9..0f065f8 100644 ---- a/gdb/block.h -+++ b/gdb/block.h -@@ -279,4 +279,6 @@ extern struct symbol *block_iter_match_next (const char *name, - (sym); \ - (sym) = block_iterator_next (&(iter))) - -+extern struct objfile *block_objfile (const struct block *block); -+ - #endif /* BLOCK_H */ -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 66a69b5..952e1c5 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -15734,6 +15734,24 @@ all_tracepoints (void) - return tp_vec; - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+breakpoint_types_mark_used (void) -+{ -+ struct breakpoint *b; -+ -+ ALL_BREAKPOINTS (b) -+ { -+ if (b->exp) -+ exp_types_mark_used (b->exp); -+ if (b->val) -+ type_mark_used (value_type (b->val)); -+ } -+} -+#endif -+ - - /* This help string is used for the break, hbreak, tbreak and thbreak - commands. It is defined as a macro to prevent duplication. -@@ -16699,4 +16717,7 @@ agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\ - - observer_attach_about_to_proceed (breakpoint_about_to_proceed); - observer_attach_thread_exit (remove_threaded_breakpoints); -+#if 0 -+ observer_attach_mark_used (breakpoint_types_mark_used); -+#endif - } -diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index 4edc9ec..292eddb 100644 ---- a/gdb/c-typeprint.c -+++ b/gdb/c-typeprint.c -@@ -689,7 +689,13 @@ c_type_print_varspec_suffix (struct type *type, - - fprintf_filtered (stream, (is_vector ? - " __attribute__ ((vector_size(" : "[")); -- if (get_array_bounds (type, &low_bound, &high_bound)) -+ if (TYPE_RANGE_DATA (TYPE_INDEX_TYPE (type))->high.kind -+ != RANGE_BOUND_KIND_CONSTANT) -+ { -+ /* No _() - printed sources should not be locale dependent. */ -+ fprintf_filtered (stream, "variable"); -+ } -+ else if (get_array_bounds (type, &low_bound, &high_bound)) - fprintf_filtered (stream, "%s", - plongest (high_bound - low_bound + 1)); - fprintf_filtered (stream, (is_vector ? ")))" : "]")); -diff --git a/gdb/cleanups.c b/gdb/cleanups.c -index e5291ab..4820972 100644 ---- a/gdb/cleanups.c -+++ b/gdb/cleanups.c -@@ -261,9 +261,11 @@ save_final_cleanups (void) - static void - restore_my_cleanups (struct cleanup **pmy_chain, struct cleanup *chain) - { -+#if 0 /* archer-jankratochvil-vla */ - if (*pmy_chain != SENTINEL_CLEANUP) - internal_warning (__FILE__, __LINE__, - _("restore_my_cleanups has found a stale cleanup")); -+#endif - - *pmy_chain = chain; - } diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in -index e535316..444de9d 100644 +index b9fcc03..3c2afe2 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in -@@ -63,13 +63,21 @@ PYTHON_FILES = \ - gdb/prompt.py \ +@@ -66,6 +66,8 @@ PYTHON_FILES = \ + gdb/xmethod.py \ gdb/command/bound_registers.py \ gdb/command/__init__.py \ + gdb/command/ignore_errors.py \ + gdb/command/pahole.py \ + gdb/command/xmethods.py \ gdb/command/frame_filters.py \ gdb/command/type_printers.py \ - gdb/command/pretty_printers.py \ +@@ -73,7 +75,10 @@ PYTHON_FILES = \ gdb/command/prompt.py \ gdb/command/explore.py \ gdb/function/__init__.py \ - gdb/function/strfns.py + gdb/function/strfns.py \ -+ gdb/function/__init__.py \ + gdb/function/caller_is.py \ + gdb/function/in_scope.py \ -+ gdb/printing.py \ -+ gdb/prompt.py \ + gdb/types.py - SYSTEM_GDBINIT_DIR = system-gdbinit - SYSTEM_GDBINIT_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(SYSTEM_GDBINIT_DIR) + GUILE_DIR = guile + GUILE_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(GUILE_DIR) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 74ddcf5..c45e1eb 100644 +index a0fb66d..3fae61e 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -1222,6 +1222,16 @@ for remote debugging. +@@ -1225,6 +1225,16 @@ for remote debugging. Run using @var{device} for your program's standard input and output. @c FIXME: kingdon thinks there is more to -tty. Investigate. @@ -232,7 +78,11 @@ index 74ddcf5..c45e1eb 100644 @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -@@ -23521,8 +23531,6 @@ containing @code{end}. For example: +diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi +index 4688783..a32133a 100644 +--- a/gdb/doc/python.texi ++++ b/gdb/doc/python.texi +@@ -88,8 +88,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -241,1844 +91,6 @@ index 74ddcf5..c45e1eb 100644 >print 23 >end 23 -@@ -23536,6 +23544,14 @@ controlled using @code{set python print-stack}: if @code{full}, then - full Python stack printing is enabled; if @code{none}, then Python stack - and message printing is disabled; if @code{message}, the default, only - the message component of the error is printed. -+ -+@kindex maint set python auto-load -+@item maint set python auto-load -+By default, @value{GDBN} will attempt to automatically load Python -+code when an object file is opened. This can be controlled using -+@code{maint set python auto-load}: if @code{on}, the default, then -+Python auto-loading is enabled; if @code{off}, then Python -+auto-loading is disabled. - @end table - - It is also possible to execute a Python script from the @value{GDBN} -diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi -index 61acbb2..ac37324 100644 ---- a/gdb/doc/observer.texi -+++ b/gdb/doc/observer.texi -@@ -253,6 +253,11 @@ The trace state variable @var{tsv} is deleted. If @var{tsv} is - The trace state value @var{tsv} is modified. - @end deftypefun - -+@c @deftypefun void mark_used (void) -+@c Mark any possibly reclaimable objects as used during a mark-and-sweep garbage -+@c collector pass. Currently only @code{type_mark_used} marker is supported. -+@c @end deftypefun -+ - @deftypefun void test_notification (int @var{somearg}) - This observer is used for internal testing. Do not use. - See testsuite/gdb.gdb/observer.exp. -diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 36c9f66..1f21766 100644 ---- a/gdb/dwarf2expr.c -+++ b/gdb/dwarf2expr.c -@@ -1478,6 +1478,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, - } - break; - -+ case DW_OP_push_object_address: -+ if (ctx->funcs->get_object_address == NULL) -+ error (_("DWARF-2 expression error: DW_OP_push_object_address must " -+ "have a value to push.")); -+ result = (ctx->funcs->get_object_address) (ctx->baton); -+ result_val = value_from_ulongest (address_type, result); -+ break; -+ - default: - error (_("Unhandled dwarf expression opcode 0x%x"), op); - } -diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 39dadf3..8cebbe8 100644 ---- a/gdb/dwarf2expr.h -+++ b/gdb/dwarf2expr.h -@@ -84,12 +84,8 @@ struct dwarf_expr_context_funcs - This can throw an exception if the index is out of range. */ - CORE_ADDR (*get_addr_index) (void *baton, unsigned int index); - --#if 0 -- /* Not yet implemented. */ -- - /* Return the `object address' for DW_OP_push_object_address. */ - CORE_ADDR (*get_object_address) (void *baton); --#endif - }; - - /* The location of a value. */ -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index dd921ec..01a8566 100644 ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -306,6 +306,9 @@ struct dwarf_expr_baton - { - struct frame_info *frame; - struct dwarf2_per_cu_data *per_cu; -+ /* From DW_TAG_variable's DW_AT_location (not DW_TAG_type's -+ DW_AT_data_location) for DW_OP_push_object_address. */ -+ CORE_ADDR object_address; - }; - - /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -433,7 +436,7 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - - if (*length == 0) - error (_("Could not find the frame base for \"%s\"."), -- SYMBOL_NATURAL_NAME (framefunc)); -+ SYMBOL_PRINT_NAME (framefunc)); - } - - /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -500,6 +503,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset) - ctx->funcs->get_frame_pc, ctx->baton); - } - -+static CORE_ADDR -+dwarf_expr_object_address (void *baton) -+{ -+ struct dwarf_expr_baton *debaton = baton; -+ -+ /* The message is suppressed in DWARF_BLOCK_EXEC. */ -+ if (debaton->object_address == 0) -+ error (_("Cannot resolve DW_OP_push_object_address for a missing object")); -+ -+ return debaton->object_address; -+} -+ -+/* Address of the variable we are currently referring to. It is set from -+ DW_TAG_variable's DW_AT_location (not DW_TAG_type's DW_AT_data_location) for -+ DW_OP_push_object_address. */ -+ -+static CORE_ADDR object_address; -+ -+/* Callers use object_address_set while their callers use the result set so we -+ cannot run the cleanup at the local block of our direct caller. Still we -+ should reset OBJECT_ADDRESS at least for the next GDB command. */ -+ -+static void -+object_address_cleanup (void *prev_save_voidp) -+{ -+ CORE_ADDR *prev_save = prev_save_voidp; -+ -+ object_address = *prev_save; -+ xfree (prev_save); -+} -+ -+/* Set the base address - DW_AT_location - of a variable. It is being later -+ used to derive other object addresses by DW_OP_push_object_address. -+ -+ It would be useful to sanity check ADDRESS - such as for some objects with -+ unset value_raw_address - but some valid addresses may be zero (such as first -+ objects in relocatable .o files). */ -+ -+void -+object_address_set (CORE_ADDR address) -+{ -+ CORE_ADDR *prev_save; -+ -+ prev_save = xmalloc (sizeof *prev_save); -+ *prev_save = object_address; -+ make_cleanup (object_address_cleanup, prev_save); -+ -+ object_address = address; -+} -+ -+/* Evaluate DWARF location list at DLLBATON expecting it produces exactly one -+ CORE_ADDR result stored to *ADDRP on the DWARF stack stack. If the result -+ could not be found return zero and keep *ADDRP unchanged. */ -+ -+int -+dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton, -+ struct type *type, CORE_ADDR *addrp) -+{ -+ struct frame_info *frame = get_selected_frame (NULL); -+ const gdb_byte *data; -+ size_t size; -+ struct value *val; -+ -+ if (!dllbaton) -+ return 0; -+ -+ data = dwarf2_find_location_expression (dllbaton, &size, -+ get_frame_address_in_block (frame)); -+ if (data == NULL) -+ return 0; -+ -+ val = dwarf2_evaluate_loc_desc (type, frame, data, size, dllbaton->per_cu); -+ if (value_optimized_out (val)) -+ return 0; -+ -+ *addrp = value_as_address (val); -+ return 1; -+} -+ - /* Callback function for dwarf2_evaluate_loc_desc. */ - - static struct type * -@@ -1215,10 +1297,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, - - saved_ctx.gdbarch = ctx->gdbarch; - saved_ctx.addr_size = ctx->addr_size; -+ saved_ctx.ref_addr_size = ctx->ref_addr_size; - saved_ctx.offset = ctx->offset; - saved_ctx.baton = ctx->baton; - ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (baton_local.per_cu)); - ctx->addr_size = dwarf2_per_cu_addr_size (baton_local.per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (baton_local.per_cu); - ctx->offset = dwarf2_per_cu_text_offset (baton_local.per_cu); - ctx->baton = &baton_local; - -@@ -1226,10 +1310,78 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, - - ctx->gdbarch = saved_ctx.gdbarch; - ctx->addr_size = saved_ctx.addr_size; -+ ctx->ref_addr_size = saved_ctx.ref_addr_size; - ctx->offset = saved_ctx.offset; - ctx->baton = saved_ctx.baton; - } - -+static CORE_ADDR dwarf_expr_get_addr_index (void *baton, unsigned int index); -+ -+/* Evaluate DWARF expression at DATA ... DATA + SIZE with its result readable -+ by dwarf_expr_fetch (RETVAL, 0). FRAME parameter can be NULL to call -+ get_selected_frame to find it. Returned dwarf_expr_context freeing is -+ pushed on the cleanup chain. */ -+ -+static void -+dwarf_expr_prep_ctx (struct dwarf_expr_context *ctx, struct frame_info *frame, -+ const gdb_byte *data, size_t size, -+ struct dwarf2_per_cu_data *per_cu) -+{ -+ struct dwarf_expr_baton baton; -+ struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); -+ volatile struct gdb_exception ex; -+ -+ baton.frame = frame; -+ baton.per_cu = per_cu; -+ baton.object_address = object_address; -+ -+ ctx->gdbarch = get_objfile_arch (objfile); -+ ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -+ ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); -+ ctx->offset = dwarf2_per_cu_text_offset (per_cu); -+ ctx->baton = &baton; -+ ctx->funcs = &dwarf_expr_ctx_funcs; -+ -+ dwarf_expr_eval (ctx, data, size); -+} -+ -+/* Evaluate DWARF expression at DLBATON expecting it produces exactly one -+ CORE_ADDR result on the DWARF stack stack. */ -+ -+CORE_ADDR -+dwarf_locexpr_baton_eval (struct dwarf2_locexpr_baton *dlbaton) -+{ -+ struct dwarf_expr_context *ctx; -+ CORE_ADDR retval; -+ struct cleanup *back_to; -+ -+ ctx = new_dwarf_expr_context (); -+ back_to = make_cleanup_free_dwarf_expr_context (ctx); -+ -+ dwarf_expr_prep_ctx (ctx, get_selected_frame (NULL), dlbaton->data, -+ dlbaton->size, dlbaton->per_cu); -+ -+ if (ctx->num_pieces > 0) -+ error (_("DW_OP_*piece is unsupported for DW_FORM_block")); -+ -+ retval = dwarf_expr_fetch_address (ctx, 0); -+ -+ if (ctx->location == DWARF_VALUE_REGISTER) -+ { -+ /* Inlined dwarf_expr_read_reg as we no longer have the baton. */ -+ -+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (ctx->gdbarch, retval); -+ struct type *type = builtin_type (ctx->gdbarch)->builtin_data_ptr; -+ struct frame_info *frame = get_selected_frame (NULL); -+ -+ retval = address_from_register (type, gdb_regnum, frame); -+ } -+ -+ do_cleanups (back_to); -+ -+ return retval; -+} -+ - /* Callback function for dwarf2_evaluate_loc_desc. - Fetch the address indexed by DW_OP_GNU_addr_index. */ - -@@ -2205,7 +2357,8 @@ static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = - dwarf_expr_dwarf_call, - dwarf_expr_get_base_type, - dwarf_expr_push_dwarf_reg_entry_value, -- dwarf_expr_get_addr_index -+ dwarf_expr_get_addr_index, -+ dwarf_expr_object_address - }; - - /* Evaluate a location description, starting at DATA and with length -@@ -2220,7 +2373,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - LONGEST byte_offset) - { - struct value *retval; -- struct dwarf_expr_baton baton; - struct dwarf_expr_context *ctx; - struct cleanup *old_chain, *value_chain; - struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); -@@ -2232,29 +2384,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - if (size == 0) - return allocate_optimized_out_value (type); - -- baton.frame = frame; -- baton.per_cu = per_cu; -- - ctx = new_dwarf_expr_context (); - old_chain = make_cleanup_free_dwarf_expr_context (ctx); - value_chain = make_cleanup_value_free_to_mark (value_mark ()); - -- ctx->gdbarch = get_objfile_arch (objfile); -- ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); -- ctx->ref_addr_size = dwarf2_per_cu_ref_addr_size (per_cu); -- ctx->offset = dwarf2_per_cu_text_offset (per_cu); -- ctx->baton = &baton; -- ctx->funcs = &dwarf_expr_ctx_funcs; -- - TRY_CATCH (ex, RETURN_MASK_ERROR) - { -- dwarf_expr_eval (ctx, data, size); -+ dwarf_expr_prep_ctx (ctx, frame, data, size, per_cu); - } - if (ex.reason < 0) - { - if (ex.error == NOT_AVAILABLE_ERROR) - { -- do_cleanups (old_chain); - retval = allocate_value (type); - mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type)); - return retval; -@@ -2329,6 +2470,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, - int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); - - do_cleanups (value_chain); -+ -+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ -+ /* object_address_set called here is required in ALLOCATE_VALUE's -+ CHECK_TYPEDEF for the object's possible -+ DW_OP_push_object_address. */ -+ object_address_set (address); -+ - retval = value_at_lazy (type, address + byte_offset); - if (in_stack_memory) - set_value_stack (retval, 1); -@@ -4241,8 +4392,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, - dlbaton->per_cu); - } - --/* The set of location functions used with the DWARF-2 expression -- evaluator and location lists. */ -+/* The set of location functions used with the DWARF-2 location lists. */ - const struct symbol_computed_ops dwarf2_loclist_funcs = { - loclist_read_variable, - loclist_read_variable_at_entry, -diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index 786e77c..55ff4e6 100644 ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -137,6 +137,15 @@ struct dwarf2_loclist_baton - - extern const struct symbol_computed_ops dwarf2_locexpr_funcs; - extern const struct symbol_computed_ops dwarf2_loclist_funcs; -+extern const struct symbol_computed_ops dwarf2_missing_funcs; -+ -+extern void object_address_set (CORE_ADDR address); -+ -+extern CORE_ADDR dwarf_locexpr_baton_eval -+ (struct dwarf2_locexpr_baton *dlbaton); -+ -+extern int dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton, -+ struct type *type, CORE_ADDR *addrp); - - extern const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs; - extern const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs; -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 23bcfe0..ca9ffda 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -1738,6 +1738,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu, - struct dwarf2_loclist_baton *baton, - const struct attribute *attr); - -+static struct dwarf2_loclist_baton *dwarf2_attr_to_loclist_baton -+ (const struct attribute *attr, struct dwarf2_cu *cu); -+ - static void dwarf2_symbol_mark_computed (const struct attribute *attr, - struct symbol *sym, - struct dwarf2_cu *cu, -@@ -1771,6 +1774,9 @@ static void age_cached_comp_units (void); - - static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *); - -+static void fetch_die_type_attrs (struct die_info *die, struct type *type, -+ struct dwarf2_cu *cu); -+ - static struct type *set_die_type (struct die_info *, struct type *, - struct dwarf2_cu *); - -@@ -1799,6 +1805,9 @@ static struct type *get_die_type_at_offset (sect_offset, - - static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); - -+static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton -+ (const struct attribute *attr, struct dwarf2_cu *cu); -+ - static void dwarf2_release_queue (void *dummy); - - static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, -@@ -13227,6 +13236,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) - new_symbol (die, this_type, cu); - } - -+/* Create a new array dimension referencing its target type TYPE. -+ -+ Multidimensional arrays are internally represented as a stack of -+ singledimensional arrays being referenced by their TYPE_TARGET_TYPE. */ -+ -+static struct type * -+create_single_array_dimension (struct type *type, struct type *range_type, -+ struct die_info *die, struct dwarf2_cu *cu) -+{ -+ type = create_array_type (NULL, type, range_type); -+ -+ /* These generic type attributes need to be fetched by -+ evaluate_subexp_standard 's call of -+ value_subscripted_rvalue only for the innermost array type. */ -+ fetch_die_type_attrs (die, type, cu); -+ -+ /* These generic type attributes are checked for allocated/associated -+ validity while accessing FIELD_LOC_KIND_DWARF_BLOCK. */ -+ fetch_die_type_attrs (die, range_type, cu); -+ -+ return type; -+} -+ - /* Extract all information from a DW_TAG_array_type DIE and put it in - the DIE's type field. For now, this only handles one dimensional - arrays. */ -@@ -13240,7 +13272,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - struct type *element_type, *range_type, *index_type; - struct type **range_types = NULL; - struct attribute *attr; -- int ndim = 0; -+ int ndim = 0, i; - struct cleanup *back_to; - const char *name; - -@@ -13293,17 +13325,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - type = element_type; - - if (read_array_order (die, cu) == DW_ORD_col_major) -- { -- int i = 0; -- -- while (i < ndim) -- type = create_array_type (NULL, type, range_types[i++]); -- } -- else -- { -- while (ndim-- > 0) -- type = create_array_type (NULL, type, range_types[ndim]); -- } -+ for (i = 0; i < ndim; i++) -+ type = create_single_array_dimension (type, range_types[i], die, cu); -+ else /* (read_array_order (die, cu) == DW_ORD_row_major) */ -+ for (i = ndim - 1; i >= 0; i--) -+ type = create_single_array_dimension (type, range_types[i], die, cu); -+ -+ /* Data locations should be set only for the outermost dimension as they -+ would be confusing for the dereferenced offset on the inner ones. */ -+ attr = dwarf2_attr (die, DW_AT_data_location, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) -+ = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_DATA_LOCATION_IS_ADDR (type)); - - /* Understand Dwarf2 support for vector types (like they occur on - the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -13942,29 +13976,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) - struct gdbarch *gdbarch = get_objfile_arch (objfile); - struct type *type, *range_type, *index_type, *char_type; - struct attribute *attr; -- unsigned int length; -+ int length; -+ -+ index_type = objfile_type (objfile)->builtin_int; -+ /* RANGE_TYPE is allocated from OBJFILE, not as a permanent type. */ -+ range_type = alloc_type (objfile); -+ /* LOW_BOUND and HIGH_BOUND are set for real below. */ -+ range_type = create_range_type (range_type, index_type, 0, -1); -+ -+ /* C/C++ should probably have the low bound 0 but C/C++ does not use -+ DW_TAG_string_type. */ -+ TYPE_LOW_BOUND (range_type) = 1; - - attr = dwarf2_attr (die, DW_AT_string_length, cu); -- if (attr) -+ if (attr && attr_form_is_block (attr)) - { -- length = DW_UNSND (attr); -+ /* Security check for a size overflow. */ -+ if (DW_BLOCK (attr)->size + 2 < DW_BLOCK (attr)->size) -+ TYPE_HIGH_BOUND (range_type) = 1; -+ /* Extend the DWARF block by a new DW_OP_deref/DW_OP_deref_size -+ instruction as DW_AT_string_length specifies the length location, not -+ its value. */ -+ else -+ { -+ struct dwarf2_locexpr_baton *length_baton = NULL; -+ struct dwarf_block *blk = DW_BLOCK (attr); -+ -+ /* Turn any single DW_OP_reg* into DW_OP_breg*(0) but clearing -+ DW_OP_deref* in such case. */ -+ -+ if (blk->size == 1 && blk->data[0] >= DW_OP_reg0 -+ && blk->data[0] <= DW_OP_reg31) -+ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); -+ else if (blk->size > 1 && blk->data[0] == DW_OP_regx) -+ { -+ ULONGEST ulongest; -+ const gdb_byte *end; -+ -+ end = safe_read_uleb128 (&blk->data[1], &blk->data[blk->size], -+ &ulongest); -+ if (end == &blk->data[blk->size]) -+ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); -+ } -+ -+ if (length_baton == NULL) -+ { -+ struct attribute *size_attr; -+ gdb_byte *data; -+ -+ length_baton = obstack_alloc (&cu->comp_unit_obstack, -+ sizeof (*length_baton)); -+ length_baton->per_cu = cu->per_cu; -+ length_baton->size = DW_BLOCK (attr)->size + 2; -+ data = obstack_alloc (&cu->comp_unit_obstack, -+ length_baton->size); -+ length_baton->data = data; -+ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size); -+ -+ /* DW_AT_BYTE_SIZE existing together with DW_AT_STRING_LENGTH -+ specifies the size of an integer to fetch. */ -+ size_attr = dwarf2_attr (die, DW_AT_byte_size, cu); -+ if (size_attr) -+ { -+ data[DW_BLOCK (attr)->size] = DW_OP_deref_size; -+ data[DW_BLOCK (attr)->size + 1] = DW_UNSND (size_attr); -+ if (data[DW_BLOCK (attr)->size + 1] != DW_UNSND (size_attr)) -+ complaint (&symfile_complaints, -+ _("DW_AT_string_length's DW_AT_byte_size " -+ "integer exceeds the byte size storage")); -+ } -+ else -+ { -+ data[DW_BLOCK (attr)->size] = DW_OP_deref; -+ data[DW_BLOCK (attr)->size + 1] = DW_OP_nop; -+ } -+ } -+ -+ TYPE_RANGE_DATA (range_type)->high.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = length_baton; -+ TYPE_DYNAMIC (range_type) = 1; -+ } - } - else - { -- /* Check for the DW_AT_byte_size attribute. */ -+ if (attr && attr_form_is_constant (attr)) -+ { -+ /* We currently do not support a constant address where the location -+ should be read from - attr_form_is_block is expected instead. See -+ DWARF for the DW_AT_STRING_LENGTH vs. DW_AT_BYTE_SIZE difference. -+ */ -+ /* PASSTHRU */ -+ } -+ - attr = dwarf2_attr (die, DW_AT_byte_size, cu); -- if (attr) -- { -- length = DW_UNSND (attr); -- } -+ if (attr && attr_form_is_block (attr)) -+ { -+ TYPE_RANGE_DATA (range_type)->high.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_constant (attr)) -+ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0); - else -- { -- length = 1; -- } -+ TYPE_HIGH_BOUND (range_type) = 1; - } - -- index_type = objfile_type (objfile)->builtin_int; -- range_type = create_range_type (NULL, index_type, 1, length); - char_type = language_string_char_type (cu->language_defn, gdbarch); - type = create_string_type (NULL, char_type, range_type); - -@@ -14289,7 +14408,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - struct type *base_type, *orig_base_type; - struct type *range_type; - struct attribute *attr; -- LONGEST low, high; -+ LONGEST low; - int low_default_is_valid; - const char *name; - LONGEST negative_mask; -@@ -14348,42 +14467,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - "- DIE at 0x%x [in module %s]"), - die->offset.sect_off, objfile_name (cu->objfile)); - -- attr = dwarf2_attr (die, DW_AT_upper_bound, cu); -- if (attr) -- { -- if (attr_form_is_block (attr) || attr_form_is_ref (attr)) -- { -- /* GCC encodes arrays with unspecified or dynamic length -- with a DW_FORM_block1 attribute or a reference attribute. -- FIXME: GDB does not yet know how to handle dynamic -- arrays properly, treat them as arrays with unspecified -- length for now. -- -- FIXME: jimb/2003-09-22: GDB does not really know -- how to handle arrays of unspecified length -- either; we just represent them as zero-length -- arrays. Choose an appropriate upper bound given -- the lower bound we've computed above. */ -- high = low - 1; -- } -- else -- high = dwarf2_get_attr_constant_value (attr, 1); -- } -- else -- { -- attr = dwarf2_attr (die, DW_AT_count, cu); -- if (attr) -- { -- int count = dwarf2_get_attr_constant_value (attr, 1); -- high = low + count - 1; -- } -- else -- { -- /* Unspecified array length. */ -- high = low - 1; -- } -- } -- - /* Dwarf-2 specifications explicitly allows to create subrange types - without specifying a base type. - In that case, the base type must be set to the type of -@@ -14422,24 +14505,163 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - } - } - -- negative_mask = -+ /* LOW_BOUND and HIGH_BOUND are set for real below. */ -+ range_type = create_range_type (NULL, orig_base_type, 0, -1); -+ TYPE_UNSIGNED (range_type) = 0; -+ -+ negative_mask = - (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1); -- if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) -- low |= negative_mask; -- if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) -- high |= negative_mask; - -- range_type = create_range_type (NULL, orig_base_type, low, high); -+ /* Exclude language_ada from any TYPE_DYNAMIC constructs below. GDB Ada -+ supports implements the dynamic bounds in a non-DWARF way and the -+ existing DWARF dynamic bounds are invalid, leading to memory access -+ errors. */ - -- /* Mark arrays with dynamic length at least as an array of unspecified -- length. GDB could check the boundary but before it gets implemented at -- least allow accessing the array elements. */ -- if (attr && attr_form_is_block (attr)) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ attr = dwarf2_attr (die, DW_AT_lower_bound, cu); -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ -+ low = 0; -+ } -+ else if (attr && attr_form_is_ref (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; -+ -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->low.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ /* For setting a default if DW_AT_UPPER_BOUND would be missing. */ -+ low = 0; -+ } -+ else -+ { -+ if (attr && attr_form_is_constant (attr)) -+ low = dwarf2_get_attr_constant_value (attr, 0); -+ else -+ { -+ if (cu->language == language_fortran) -+ { -+ /* FORTRAN implies a lower bound of 1, if not given. */ -+ low = 1; -+ } -+ else -+ { -+ /* According to DWARF we should assume the value 0 only for -+ LANGUAGE_C and LANGUAGE_CPLUS. */ -+ low = 0; -+ } -+ } -+ if (!TYPE_UNSIGNED (base_type) && (low & negative_mask)) -+ low |= negative_mask; -+ TYPE_LOW_BOUND (range_type) = low; -+ if (low >= 0) -+ TYPE_UNSIGNED (range_type) = 1; -+ } - -- /* Ada expects an empty array on no boundary attributes. */ -- if (attr == NULL && cu->language != language_ada) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ attr = dwarf2_attr (die, DW_AT_upper_bound, cu); -+ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) -+ && !attr_form_is_ref (attr))) -+ { -+ attr = dwarf2_attr (die, DW_AT_count, cu); -+ /* It does not hurt but it is needlessly ineffective in check_typedef. */ -+ if (attr && (attr_form_is_block (attr) || attr_form_is_constant (attr))) -+ { -+ TYPE_RANGE_HIGH_BOUND_IS_COUNT (range_type) = 1; -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ /* Pass it now as the regular DW_AT_upper_bound. */ -+ } -+ -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_ref (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; -+ -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->high.kind = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->high.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else -+ { -+ LONGEST high; -+ -+ if (attr && attr_form_is_constant (attr)) -+ high = dwarf2_get_attr_constant_value (attr, 0); -+ else -+ { -+ /* Ada expects an empty array on no boundary attributes. */ -+ if (cu->language != language_ada) -+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; -+ high = low - 1; -+ } -+ if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) -+ high |= negative_mask; -+ TYPE_HIGH_BOUND (range_type) = high; -+ } -+ -+ /* DW_AT_bit_stride is currently unsupported as we count in bytes. */ -+ attr = dwarf2_attr (die, DW_AT_byte_stride, cu); -+ if (attr && attr_form_is_block (attr) && cu->language != language_ada) -+ { -+ TYPE_RANGE_DATA (range_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_DWARF_BLOCK; -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_block = -+ dwarf2_attr_to_locexpr_baton (attr, cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_ref (attr) && cu->language != language_ada) -+ { -+ struct die_info *target_die; -+ struct dwarf2_cu *target_cu = cu; -+ struct attribute *target_loc_attr; -+ -+ target_die = follow_die_ref_or_sig (die, attr, &target_cu); -+ gdb_assert (target_cu->objfile == cu->objfile); -+ target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); -+ -+ TYPE_RANGE_DATA (range_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_DWARF_LOCLIST; -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist -+ = dwarf2_attr_to_loclist_baton (target_loc_attr, target_cu); -+ TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.type -+ = die_type (target_die, target_cu); -+ TYPE_DYNAMIC (range_type) = 1; -+ } -+ else if (attr && attr_form_is_constant (attr)) -+ { -+ TYPE_BYTE_STRIDE (range_type) = dwarf2_get_attr_constant_value (attr, 0); -+ if (TYPE_BYTE_STRIDE (range_type) == 0) -+ complaint (&symfile_complaints, -+ _("Found DW_AT_byte_stride with unsupported value 0")); -+ } - - name = dwarf2_name (die, cu); - if (name) -@@ -17361,11 +17583,14 @@ var_decode_location (struct attribute *attr, struct symbol *sym, - (i.e. when the value of a register or memory location is - referenced, or a thread-local block, etc.). Then again, it might - not be worthwhile. I'm assuming that it isn't unless performance -- or memory numbers show me otherwise. */ -+ or memory numbers show me otherwise. -+ -+ SYMBOL_CLASS may get overriden by dwarf2_symbol_mark_computed. */ - - dwarf2_symbol_mark_computed (attr, sym, cu, 0); - -- if (SYMBOL_COMPUTED_OPS (sym)->location_has_loclist) -+ if (SYMBOL_COMPUTED_OPS (sym) != NULL -+ && SYMBOL_COMPUTED_OPS (sym)->location_has_loclist) - cu->has_loclist = 1; - } - -@@ -18212,6 +18437,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) - break; - } - -+ if (this_type) -+ finalize_type (this_type); -+ - return this_type; - } - -@@ -20894,66 +21122,109 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, - baton->from_dwo = cu->dwo_unit != NULL; - } - --static void --dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, -- struct dwarf2_cu *cu, int is_block) -+/* Convert DW_BLOCK into struct dwarf2_locexpr_baton. ATTR must be a DW_BLOCK -+ attribute type. */ -+ -+static struct dwarf2_locexpr_baton * -+dwarf2_attr_to_locexpr_baton (const struct attribute *attr, -+ struct dwarf2_cu *cu) -+{ -+ struct objfile *objfile = dwarf2_per_objfile->objfile; -+ struct dwarf2_locexpr_baton *baton; -+ -+ gdb_assert (attr == NULL || attr_form_is_block (attr)); -+ -+ baton = obstack_alloc (&objfile->objfile_obstack, sizeof (*baton)); -+ baton->per_cu = cu->per_cu; -+ gdb_assert (baton->per_cu); -+ -+ /* Note that we're just copying the block's data pointer -+ here, not the actual data. We're still pointing into the -+ info_buffer for SYM's objfile; right now we never release -+ that buffer, but when we do clean up properly this may -+ need to change. */ -+ if (attr != NULL) -+ { -+ baton->size = DW_BLOCK (attr)->size; -+ baton->data = DW_BLOCK (attr)->data; -+ } -+ else -+ { -+ baton->size = 0; -+ baton->data = NULL; -+ } -+ gdb_assert (baton->size == 0 || baton->data != NULL); -+ -+ return baton; -+} -+ -+static struct dwarf2_loclist_baton * -+dwarf2_attr_to_loclist_baton (const struct attribute *attr, -+ struct dwarf2_cu *cu) - { - struct objfile *objfile = dwarf2_per_objfile->objfile; - struct dwarf2_section_info *section = cu_debug_loc_section (cu); -+ struct dwarf2_loclist_baton *baton; - -- if (attr_form_is_section_offset (attr) -+ /* DW_AT_location of the referenced DIE may be missing if the referenced -+ variable has been optimized out. */ -+ if (!attr) -+ return NULL; -+ -+ dwarf2_read_section (dwarf2_per_objfile->objfile, section); -+ -+ if (!(attr_form_is_section_offset (attr) - /* .debug_loc{,.dwo} may not exist at all, or the offset may be outside - the section. If so, fall through to the complaint in the - other branch. */ -- && DW_UNSND (attr) < dwarf2_section_size (objfile, section)) -- { -- struct dwarf2_loclist_baton *baton; -+ && DW_UNSND (attr) < dwarf2_section_size (objfile, section))) -+ return NULL; - -- baton = obstack_alloc (&objfile->objfile_obstack, -- sizeof (struct dwarf2_loclist_baton)); -+ baton = obstack_alloc (&objfile->objfile_obstack, -+ sizeof (struct dwarf2_loclist_baton)); - -- fill_in_loclist_baton (cu, baton, attr); -+ fill_in_loclist_baton (cu, baton, attr); - -- if (cu->base_known == 0) -- complaint (&symfile_complaints, -- _("Location list used without " -- "specifying the CU base address.")); -+ if (cu->base_known == 0) -+ complaint (&symfile_complaints, -+ _("Location list used without " -+ "specifying the CU base address.")); -+ -+ return baton; -+} -+ -+/* SYM may get its SYMBOL_CLASS overriden on invalid ATTR content. */ -+ -+static void -+dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, -+ struct dwarf2_cu *cu, int is_block) -+{ -+ struct dwarf2_loclist_baton *loclist_baton; - -+ loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu); -+ if (loclist_baton) -+ { - SYMBOL_ACLASS_INDEX (sym) = (is_block - ? dwarf2_loclist_block_index - : dwarf2_loclist_index); -- SYMBOL_LOCATION_BATON (sym) = baton; -+ SYMBOL_LOCATION_BATON (sym) = loclist_baton; -+ } -+ else if (attr_form_is_block (attr)) -+ { -+ SYMBOL_ACLASS_INDEX (sym) = (is_block -+ ? dwarf2_locexpr_block_index -+ : dwarf2_locexpr_index); -+ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu); - } - else - { -- struct dwarf2_locexpr_baton *baton; -- -- baton = obstack_alloc (&objfile->objfile_obstack, -- sizeof (struct dwarf2_locexpr_baton)); -- baton->per_cu = cu->per_cu; -- gdb_assert (baton->per_cu); -- -- if (attr_form_is_block (attr)) -- { -- /* Note that we're just copying the block's data pointer -- here, not the actual data. We're still pointing into the -- info_buffer for SYM's objfile; right now we never release -- that buffer, but when we do clean up properly this may -- need to change. */ -- baton->size = DW_BLOCK (attr)->size; -- baton->data = DW_BLOCK (attr)->data; -- } -- else -- { -- dwarf2_invalid_attrib_class_complaint ("location description", -- SYMBOL_NATURAL_NAME (sym)); -- baton->size = 0; -- } -+ dwarf2_invalid_attrib_class_complaint ("location description", -+ SYMBOL_NATURAL_NAME (sym)); - - SYMBOL_ACLASS_INDEX (sym) = (is_block - ? dwarf2_locexpr_block_index - : dwarf2_locexpr_index); -- SYMBOL_LOCATION_BATON (sym) = baton; -+ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (NULL, cu); - } - } - -@@ -21326,6 +21597,25 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs) - && ofs_lhs->offset.sect_off == ofs_rhs->offset.sect_off); - } - -+/* Fill in generic attributes applicable for type DIEs. */ -+ -+static void -+fetch_die_type_attrs (struct die_info *die, struct type *type, -+ struct dwarf2_cu *cu) -+{ -+ struct attribute *attr; -+ -+ attr = dwarf2_attr (die, DW_AT_allocated, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_ALLOCATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_NOT_ALLOCATED (type)); -+ -+ attr = dwarf2_attr (die, DW_AT_associated, cu); -+ if (attr_form_is_block (attr)) -+ TYPE_ASSOCIATED (type) = dwarf2_attr_to_locexpr_baton (attr, cu); -+ gdb_assert (!TYPE_NOT_ASSOCIATED (type)); -+} -+ - /* Set the type associated with DIE to TYPE. Save it in CU's hash - table if necessary. For convenience, return TYPE. - -@@ -21350,6 +21640,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - struct dwarf2_per_cu_offset_and_type **slot, ofs; - struct objfile *objfile = cu->objfile; - -+ fetch_die_type_attrs (die, type, cu); -+ - /* For Ada types, make sure that the gnat-specific data is always - initialized (if not already set). There are a few types where - we should not be doing so, because the type-specific area is -diff --git a/gdb/eval.c b/gdb/eval.c -index bfbe319..3fdc5d5 100644 ---- a/gdb/eval.c -+++ b/gdb/eval.c -@@ -41,6 +41,7 @@ - #include "gdb_obstack.h" - #include "objfiles.h" - #include "python/python.h" -+#include "dwarf2loc.h" - - #include "gdb_assert.h" - -@@ -397,27 +398,222 @@ init_array_element (struct value *array, struct value *element, - } - - static struct value * --value_f90_subarray (struct value *array, -- struct expression *exp, int *pos, enum noside noside) -+value_f90_subarray (struct value *array, struct expression *exp, int *pos, -+ int nargs, enum noside noside) - { -- int pc = (*pos) + 1; -- LONGEST low_bound, high_bound; -- struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array))); -- enum f90_range_type range_type = longest_to_int (exp->elts[pc].longconst); -- -- *pos += 3; -- -- if (range_type == LOW_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) -- low_bound = TYPE_LOW_BOUND (range); -+ /* Type to use for the newly allocated value ARRAY. */ -+ struct type *new_array_type; -+ -+ /* Type being iterated for each dimension. */ -+ struct type *type, *type_last_target; -+ -+ /* Pointer in the last holder to the type of current dimension. */ -+ struct type **typep = &new_array_type; -+ -+ struct subscript_index -+ { -+ enum { SUBSCRIPT_RANGE, SUBSCRIPT_NUMBER } kind; -+ union -+ { -+ struct subscript_range -+ { -+ enum f90_range_type f90_range_type; -+ LONGEST low_bound, high_bound; -+ } -+ range; -+ LONGEST number; -+ }; -+ } -+ *subscript_array; -+ struct type **type_array; -+ int i; -+ struct cleanup *old_chain; -+ CORE_ADDR value_byte_address, value_byte_offset = 0; -+ htab_t copied_types; -+ struct value *saved_array; -+ -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (array)); -+ -+ if (value_optimized_out (array) -+ || (VALUE_LVAL (array) != not_lval -+ && VALUE_LVAL (array) != lval_memory -+ && VALUE_LVAL (array) != lval_internalvar_component -+ && VALUE_LVAL (array) != lval_internalvar)) -+ error (_("value being subranged must be in memory")); -+ type = check_typedef (value_type (array)); -+ f_object_address_data_valid_or_error (type); -+ -+ copied_types = create_copied_types_hash (NULL); -+ type = copy_type_recursive (type, copied_types); -+ htab_delete (copied_types); -+ -+ if (nargs != calc_f77_array_dims (type)) -+ error (_("Wrong number of subscripts")); -+ -+ if (TYPE_DATA_LOCATION_IS_ADDR (type)) -+ { -+ value_byte_address = (TYPE_DATA_LOCATION_ADDR (type) -+ + value_offset (array)); -+ TYPE_DATA_LOCATION_IS_ADDR (type) = 0; -+ TYPE_DATA_LOCATION_DWARF_BLOCK (type) = NULL; -+ } - else -- low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); -+ { -+ gdb_assert (TYPE_DATA_LOCATION_DWARF_BLOCK (type) == NULL); -+ value_byte_address = value_address (array); -+ } -+ -+ new_array_type = type; -+ -+ subscript_array = alloca (sizeof (*subscript_array) * nargs); -+ -+ gdb_assert (nargs > 0); -+ -+ /* Now that we know we have a legal array subscript expression -+ let us actually find out where this element exists in the array. */ -+ -+ /* Take array indices left to right. */ -+ for (i = 0; i < nargs; i++) -+ { -+ struct subscript_index *index = &subscript_array[i]; -+ -+ if (exp->elts[*pos].opcode == OP_F90_RANGE) -+ { -+ int pc = (*pos) + 1; -+ struct subscript_range *range; -+ -+ index->kind = SUBSCRIPT_RANGE; -+ range = &index->range; -+ -+ *pos += 3; -+ range->f90_range_type = longest_to_int (exp->elts[pc].longconst); -+ -+ if (range->f90_range_type == HIGH_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ range->low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, -+ pos, noside)); -+ -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ range->high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, -+ pos, noside)); -+ } -+ else -+ { -+ struct value *val; - -- if (range_type == HIGH_BOUND_DEFAULT || range_type == BOTH_BOUND_DEFAULT) -- high_bound = TYPE_HIGH_BOUND (range); -+ index->kind = SUBSCRIPT_NUMBER; -+ -+ /* Evaluate each subscript; it must be a legal integer in F77. */ -+ val = evaluate_subexp_with_coercion (exp, pos, noside); -+ index->number = value_as_long (val); -+ } -+ } -+ -+ /* Internal type of array is arranged right to left. */ -+ for (i = nargs - 1; i >= 0; i--) -+ { -+ struct subscript_index *index = &subscript_array[i]; -+ struct type *range_type = TYPE_INDEX_TYPE (type); -+ -+ switch (index->kind) -+ { -+ case SUBSCRIPT_RANGE: -+ { -+ struct subscript_range *range = &index->range; -+ CORE_ADDR byte_offset; -+ -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == BOTH_BOUND_DEFAULT) -+ range->low_bound = TYPE_LOW_BOUND (range_type); -+ -+ if (range->f90_range_type == HIGH_BOUND_DEFAULT -+ || range->f90_range_type == BOTH_BOUND_DEFAULT) -+ range->high_bound = TYPE_HIGH_BOUND (range_type); -+ -+ if (range->low_bound < TYPE_LOW_BOUND (range_type) -+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type) -+ && range->high_bound > TYPE_HIGH_BOUND (range_type))) -+ error (_("slice out of range")); -+ -+ byte_offset = ((range->low_bound - TYPE_LOW_BOUND (range_type)) -+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type)); -+ TYPE_LOW_BOUND (range_type) = range->low_bound; -+ TYPE_HIGH_BOUND (range_type) = range->high_bound; -+ if (range->f90_range_type == LOW_BOUND_DEFAULT -+ || range->f90_range_type == NONE_BOUND_DEFAULT) -+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 0; -+ -+ typep = &TYPE_TARGET_TYPE (type); -+ value_byte_offset += byte_offset; -+ type = TYPE_TARGET_TYPE (type); -+ } -+ break; -+ -+ case SUBSCRIPT_NUMBER: -+ { -+ CORE_ADDR byte_offset; -+ -+ if (index->number < TYPE_LOW_BOUND (range_type) -+ || (!TYPE_HIGH_BOUND_UNDEFINED (range_type) -+ && index->number > TYPE_HIGH_BOUND (range_type))) -+ error (_("no such vector element")); -+ -+ byte_offset = ((index->number - TYPE_LOW_BOUND (range_type)) -+ * TYPE_ARRAY_BYTE_STRIDE_VALUE (type)); -+ -+ type = TYPE_TARGET_TYPE (type); -+ *typep = type; -+ value_byte_offset += byte_offset; -+ } -+ break; -+ } -+ } -+ -+ type_last_target = type; -+ type_array = alloca (sizeof (*type_array) * nargs); -+ i = 0; -+ for (type = new_array_type; type != type_last_target; -+ type = TYPE_TARGET_TYPE (type)) -+ type_array[i++] = type; -+ while (i > 0) -+ { -+ struct type *type = type_array[--i]; -+ -+ /* Force TYPE_LENGTH (type) recalculation. */ -+ TYPE_TARGET_STUB (type) = 1; -+ check_typedef (type); -+ } -+ -+ saved_array = array; -+ array = allocate_value_lazy (new_array_type); -+ VALUE_LVAL (array) = VALUE_LVAL (saved_array); -+ if (VALUE_LVAL (saved_array) == lval_internalvar_component) -+ VALUE_LVAL (array) = lval_internalvar; - else -- high_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); -+ VALUE_LVAL (array) = VALUE_LVAL (saved_array); -+ VALUE_FRAME_ID (array) = VALUE_FRAME_ID (saved_array); -+ if (VALUE_LVAL (array) != lval_internalvar) -+ set_value_address (array, value_byte_address + value_byte_offset); -+ -+ if (!value_lazy (saved_array) -+ && TYPE_LENGTH (value_type (saved_array)) > 0 -+ && TYPE_LENGTH (new_array_type) > 0) -+ { -+ gdb_assert (TYPE_LENGTH (new_array_type) -+ <= TYPE_LENGTH (value_type (saved_array))); -+ /* FIXME: It simulates non-public allocate_value_contents. */ -+ value_contents_all_raw (array); -+ set_value_lazy (array, 0); -+ -+ memcpy (value_contents_writeable (array), -+ value_contents (saved_array) + value_byte_offset, -+ TYPE_LENGTH (new_array_type)); -+ } - -- return value_slice (array, low_bound, high_bound - low_bound + 1); -+ do_cleanups (old_chain); -+ return array; - } - - -@@ -714,6 +910,7 @@ evaluate_subexp_standard (struct type *expect_type, - int save_pos1; - struct symbol *function = NULL; - char *function_name = NULL; -+ struct cleanup *old_chain; - - pc = (*pos)++; - op = exp->elts[pc].opcode; -@@ -1780,6 +1977,8 @@ evaluate_subexp_standard (struct type *expect_type, - - /* First determine the type code we are dealing with. */ - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (arg1)); - type = check_typedef (value_type (arg1)); - code = TYPE_CODE (type); - -@@ -1800,23 +1999,13 @@ evaluate_subexp_standard (struct type *expect_type, - code = TYPE_CODE (type); - } - } -+ do_cleanups (old_chain); - - switch (code) - { - case TYPE_CODE_ARRAY: -- if (exp->elts[*pos].opcode == OP_F90_RANGE) -- return value_f90_subarray (arg1, exp, pos, noside); -- else -- goto multi_f77_subscript; -- - case TYPE_CODE_STRING: -- if (exp->elts[*pos].opcode == OP_F90_RANGE) -- return value_f90_subarray (arg1, exp, pos, noside); -- else -- { -- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); -- return value_subscript (arg1, value_as_long (arg2)); -- } -+ return value_f90_subarray (arg1, exp, pos, nargs, noside); - - case TYPE_CODE_PTR: - case TYPE_CODE_FUNC: -@@ -2229,49 +2418,6 @@ evaluate_subexp_standard (struct type *expect_type, - } - return (arg1); - -- multi_f77_subscript: -- { -- LONGEST subscript_array[MAX_FORTRAN_DIMS]; -- int ndimensions = 1, i; -- struct value *array = arg1; -- -- if (nargs > MAX_FORTRAN_DIMS) -- error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS); -- -- ndimensions = calc_f77_array_dims (type); -- -- if (nargs != ndimensions) -- error (_("Wrong number of subscripts")); -- -- gdb_assert (nargs > 0); -- -- /* Now that we know we have a legal array subscript expression -- let us actually find out where this element exists in the array. */ -- -- /* Take array indices left to right. */ -- for (i = 0; i < nargs; i++) -- { -- /* Evaluate each subscript; it must be a legal integer in F77. */ -- arg2 = evaluate_subexp_with_coercion (exp, pos, noside); -- -- /* Fill in the subscript array. */ -- -- subscript_array[i] = value_as_long (arg2); -- } -- -- /* Internal type of array is arranged right to left. */ -- for (i = nargs; i > 0; i--) -- { -- struct type *array_type = check_typedef (value_type (array)); -- LONGEST index = subscript_array[i - 1]; -- -- array = value_subscripted_rvalue (array, index, -- f77_get_lowerbound (array_type)); -- } -- -- return array; -- } -- - case BINOP_LOGICAL_AND: - arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); - if (noside == EVAL_SKIP) -@@ -2503,15 +2649,23 @@ evaluate_subexp_standard (struct type *expect_type, - if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) - expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); - arg1 = evaluate_subexp (expect_type, exp, pos, noside); -+ old_chain = make_cleanup (null_cleanup, 0); -+ object_address_set (value_raw_address (arg1)); - type = check_typedef (value_type (arg1)); - if (TYPE_CODE (type) == TYPE_CODE_METHODPTR - || TYPE_CODE (type) == TYPE_CODE_MEMBERPTR) - error (_("Attempt to dereference pointer " - "to member without an object")); - if (noside == EVAL_SKIP) -- goto nosideret; -+ { -+ do_cleanups (old_chain); -+ goto nosideret; -+ } - if (unop_user_defined_p (op, arg1)) -- return value_x_unop (arg1, op, noside); -+ { -+ do_cleanups (old_chain); -+ return value_x_unop (arg1, op, noside); -+ } - else if (noside == EVAL_AVOID_SIDE_EFFECTS) - { - type = check_typedef (value_type (arg1)); -@@ -2520,12 +2674,18 @@ evaluate_subexp_standard (struct type *expect_type, - /* In C you can dereference an array to get the 1st elt. */ - || TYPE_CODE (type) == TYPE_CODE_ARRAY - ) -- return value_zero (TYPE_TARGET_TYPE (type), -- lval_memory); -+ { -+ do_cleanups (old_chain); -+ return value_zero (TYPE_TARGET_TYPE (type), -+ lval_memory); -+ } - else if (TYPE_CODE (type) == TYPE_CODE_INT) -- /* GDB allows dereferencing an int. */ -- return value_zero (builtin_type (exp->gdbarch)->builtin_int, -- lval_memory); -+ { -+ do_cleanups (old_chain); -+ /* GDB allows dereferencing an int. */ -+ return value_zero (builtin_type (exp->gdbarch)->builtin_int, -+ lval_memory); -+ } - else - error (_("Attempt to take contents of a non-pointer value.")); - } -@@ -2535,9 +2695,14 @@ evaluate_subexp_standard (struct type *expect_type, - do. "long long" variables are rare enough that - BUILTIN_TYPE_LONGEST would seem to be a mistake. */ - if (TYPE_CODE (type) == TYPE_CODE_INT) -- return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, -- (CORE_ADDR) value_as_address (arg1)); -- return value_ind (arg1); -+ { -+ do_cleanups (old_chain); -+ return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, -+ (CORE_ADDR) value_as_address (arg1)); -+ } -+ arg1 = value_ind (arg1); -+ do_cleanups (old_chain); -+ return arg1; - - case UNOP_ADDR: - /* C++: check for and handle pointer to members. */ -@@ -2967,7 +3132,7 @@ evaluate_subexp_with_coercion (struct expression *exp, - { - enum exp_opcode op; - int pc; -- struct value *val; -+ struct value *val = NULL; - struct symbol *var; - struct type *type; - -@@ -2978,13 +3143,18 @@ evaluate_subexp_with_coercion (struct expression *exp, - { - case OP_VAR_VALUE: - var = exp->elts[pc + 2].symbol; -+ /* address_of_variable will call object_address_set for check_typedef. -+ Call it only if required as it can error-out on VAR in register. */ -+ if (TYPE_DYNAMIC (SYMBOL_TYPE (var))) -+ val = address_of_variable (var, exp->elts[pc + 1].block); - type = check_typedef (SYMBOL_TYPE (var)); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY - && !TYPE_VECTOR (type) - && CAST_IS_CONVERSION (exp->language_defn)) - { - (*pos) += 4; -- val = address_of_variable (var, exp->elts[pc + 1].block); -+ if (!val) -+ val = address_of_variable (var, exp->elts[pc + 1].block); - return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), - val); - } -@@ -3042,9 +3212,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) - - case OP_VAR_VALUE: - (*pos) += 4; -- type = check_typedef (SYMBOL_TYPE (exp->elts[pc + 2].symbol)); -- return -- value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); -+ /* We do not need to call read_var_value but the object evaluation may -+ need to have executed object_address_set which needs valid -+ SYMBOL_VALUE_ADDRESS of the symbol. Still VALUE returned by -+ read_var_value we left as lazy. */ -+ type = value_type (read_var_value (exp->elts[pc + 2].symbol, -+ deprecated_safe_get_selected_frame ())); -+ return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); - - default: - val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); -@@ -3075,18 +3249,25 @@ parse_and_eval_type (char *p, int length) - int - calc_f77_array_dims (struct type *array_type) - { -- int ndimen = 1; -- struct type *tmp_type; -+ switch (TYPE_CODE (array_type)) -+ { -+ case TYPE_CODE_STRING: -+ return 1; - -- if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY)) -- error (_("Can't get dimensions for a non-array type")); -+ case TYPE_CODE_ARRAY: -+ { -+ int ndimen = 1; - -- tmp_type = array_type; -+ while ((array_type = TYPE_TARGET_TYPE (array_type))) -+ { -+ if (TYPE_CODE (array_type) == TYPE_CODE_ARRAY) -+ ++ndimen; -+ } -+ return ndimen; -+ } - -- while ((tmp_type = TYPE_TARGET_TYPE (tmp_type))) -- { -- if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY) -- ++ndimen; -+ default: -+ error (_("Can't get dimensions for a non-array/non-string type")); - } -- return ndimen; -+ - } -diff --git a/gdb/f-exp.y b/gdb/f-exp.y -index 7a94b15..a6ba784 100644 ---- a/gdb/f-exp.y -+++ b/gdb/f-exp.y -@@ -297,7 +297,9 @@ arglist : subrange - { arglist_len = 1; } - ; - --arglist : arglist ',' exp %prec ABOVE_COMMA -+arglist : arglist ',' exp %prec ABOVE_COMMA -+ { arglist_len++; } -+ | arglist ',' subrange %prec ABOVE_COMMA - { arglist_len++; } - ; - -diff --git a/gdb/f-lang.h b/gdb/f-lang.h -index 2d67a48..4d2f411 100644 ---- a/gdb/f-lang.h -+++ b/gdb/f-lang.h -@@ -29,6 +29,10 @@ extern void f_error (char *); /* Defined in f-exp.y */ - extern void f_print_type (struct type *, const char *, struct ui_file *, int, - int, const struct type_print_options *); - -+extern const char *f_object_address_data_valid_print_to_stream -+ (struct type *type, struct ui_file *stream); -+extern void f_object_address_data_valid_or_error (struct type *type); -+ - extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, - struct ui_file *, int, - const struct value *, -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 8356aab..5050255 100644 ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c -@@ -30,6 +30,7 @@ - #include "gdbcore.h" - #include "target.h" - #include "f-lang.h" -+#include "dwarf2loc.h" - - #include - #include -@@ -47,6 +48,34 @@ void f_type_print_varspec_prefix (struct type *, struct ui_file *, - void f_type_print_base (struct type *, struct ui_file *, int, int); - - -+const char * -+f_object_address_data_valid_print_to_stream (struct type *type, -+ struct ui_file *stream) -+{ -+ const char *msg; -+ -+ msg = object_address_data_not_valid (type); -+ if (msg != NULL) -+ { -+ /* Assuming the content printed to STREAM should not be localized. */ -+ fprintf_filtered (stream, "<%s>", msg); -+ } -+ -+ return msg; -+} -+ -+void -+f_object_address_data_valid_or_error (struct type *type) -+{ -+ const char *msg; -+ -+ msg = object_address_data_not_valid (type); -+ if (msg != NULL) -+ { -+ error (_("Cannot access it because the %s."), _(msg)); -+ } -+} -+ - /* LEVEL is the depth to indent lines by. */ - - void -@@ -56,6 +85,9 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, - enum type_code code; - int demangled_args; - -+ if (f_object_address_data_valid_print_to_stream (type, stream) != NULL) -+ return; -+ - f_type_print_base (type, stream, show, level); - code = TYPE_CODE (type); - if ((varstring != NULL && *varstring != '\0') -@@ -162,6 +194,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - - QUIT; - -+ if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF) -+ CHECK_TYPEDEF (type); -+ - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index d8c767f..4aa0d5e 100644 ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -51,15 +51,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; - /* The following macro gives us the size of the nth dimension, Where - n is 1 based. */ - --#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1]) -+#define F77_DIM_COUNT(n) (f77_array_offset_tbl[n][1]) - --/* The following gives us the offset for row n where n is 1-based. */ -+/* The following gives us the element size for row n where n is 1-based. */ - --#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0]) -+#define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) - - int - f77_get_lowerbound (struct type *type) - { -+ f_object_address_data_valid_or_error (type); -+ - if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) - error (_("Lower bound may not be '*' in F77")); - -@@ -69,14 +71,17 @@ f77_get_lowerbound (struct type *type) - int - f77_get_upperbound (struct type *type) - { -+ f_object_address_data_valid_or_error (type); -+ - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) - { -- /* We have an assumed size array on our hands. Assume that -- upper_bound == lower_bound so that we show at least 1 element. -- If the user wants to see more elements, let him manually ask for 'em -- and we'll subscript the array and show him. */ -+ /* We have an assumed size array on our hands. As type_length_get -+ already assumes a length zero of arrays with underfined bounds VALADDR -+ passed to the Fortran functions does not contained the real inferior -+ memory content. User should request printing of specific array -+ elements instead. */ - -- return f77_get_lowerbound (type); -+ return f77_get_lowerbound (type) - 1; - } - - return TYPE_ARRAY_UPPER_BOUND_VALUE (type); -@@ -132,24 +137,29 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) - upper = f77_get_upperbound (tmp_type); - lower = f77_get_lowerbound (tmp_type); - -- F77_DIM_SIZE (ndimen) = upper - lower + 1; -+ F77_DIM_COUNT (ndimen) = upper - lower + 1; -+ -+ F77_DIM_BYTE_STRIDE (ndimen) = -+ TYPE_ARRAY_BYTE_STRIDE_VALUE (tmp_type); - - tmp_type = TYPE_TARGET_TYPE (tmp_type); - ndimen++; - } - -- /* Now we multiply eltlen by all the offsets, so that later we -+ /* Now we multiply eltlen by all the BYTE_STRIDEs, so that later we - can print out array elements correctly. Up till now we -- know an offset to apply to get the item but we also -+ know an eltlen to apply to get the item but we also - have to know how much to add to get to the next item. */ - - ndimen--; - eltlen = TYPE_LENGTH (tmp_type); -- F77_DIM_OFFSET (ndimen) = eltlen; -+ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) -+ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; - while (--ndimen > 0) - { -- eltlen *= F77_DIM_SIZE (ndimen + 1); -- F77_DIM_OFFSET (ndimen) = eltlen; -+ eltlen *= F77_DIM_COUNT (ndimen + 1); -+ if (F77_DIM_BYTE_STRIDE (ndimen) == 0) -+ F77_DIM_BYTE_STRIDE (ndimen) = eltlen; - } - } - -@@ -171,37 +181,35 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - - if (nss != ndimensions) - { -- for (i = 0; -- (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); -- i++) -+ for (i = 0; (i < F77_DIM_COUNT (nss) && (*elts) < options->print_max); i++) - { - fprintf_filtered (stream, "( "); - f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), - valaddr, -- embedded_offset + i * F77_DIM_OFFSET (nss), -+ embedded_offset + i * F77_DIM_BYTE_STRIDE (nss), - address, - stream, recurse, val, options, elts); - fprintf_filtered (stream, ") "); - } -- if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) -+ if (*elts >= options->print_max && i < F77_DIM_COUNT (nss)) - fprintf_filtered (stream, "..."); - } - else - { -- for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max; -+ for (i = 0; i < F77_DIM_COUNT (nss) && (*elts) < options->print_max; - i++, (*elts)++) - { - val_print (TYPE_TARGET_TYPE (type), - valaddr, -- embedded_offset + i * F77_DIM_OFFSET (ndimensions), -+ embedded_offset + i * F77_DIM_BYTE_STRIDE (ndimensions), - address, stream, recurse, - val, options, current_language); - -- if (i != (F77_DIM_SIZE (nss) - 1)) -+ if (i != (F77_DIM_COUNT (nss) - 1)) - fprintf_filtered (stream, ", "); - - if ((*elts == options->print_max - 1) -- && (i != (F77_DIM_SIZE (nss) - 1))) -+ && (i != (F77_DIM_COUNT (nss) - 1))) - fprintf_filtered (stream, "..."); - } - } -@@ -267,6 +275,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, - CORE_ADDR addr; - int index; - -+ if (f_object_address_data_valid_print_to_stream (type, stream) != NULL) -+ return; -+ - CHECK_TYPEDEF (type); - switch (TYPE_CODE (type)) - { -diff --git a/gdb/findvar.c b/gdb/findvar.c -index 0647c0f..a2a0a4f 100644 ---- a/gdb/findvar.c -+++ b/gdb/findvar.c -@@ -34,6 +34,7 @@ - #include "block.h" - #include "objfiles.h" - #include "language.h" -+#include "dwarf2loc.h" - - /* Basic byte-swapping routines. All 'extract' functions return a - host-format integer from a target-format integer at ADDR which is -@@ -416,7 +417,10 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data) - } - - /* A default implementation for the "la_read_var_value" hook in -- the language vector which should work in most situations. */ -+ the language vector which should work in most situations. -+ We have to first find the address of the variable before allocating struct -+ value to return as its size may depend on DW_OP_PUSH_OBJECT_ADDRESS possibly -+ used by its type. */ - - struct value * - default_read_var_value (struct symbol *var, struct frame_info *frame) -@@ -425,13 +429,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - struct type *type = SYMBOL_TYPE (var); - CORE_ADDR addr; - -- /* Call check_typedef on our type to make sure that, if TYPE is -- a TYPE_CODE_TYPEDEF, its length is set to the length of the target type -- instead of zero. However, we do not replace the typedef type by the -- target type, because we want to keep the typedef in order to be able to -- set the returned value type description correctly. */ -- check_typedef (type); -- - if (symbol_read_needs_frame (var)) - gdb_assert (frame); - -@@ -599,6 +596,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - break; - } - -+ /* ADDR is set here for ALLOCATE_VALUE's CHECK_TYPEDEF for -+ DW_OP_PUSH_OBJECT_ADDRESS. */ -+ object_address_set (addr); - v = value_at_lazy (type, addr); - return v; - } -@@ -702,10 +702,11 @@ struct value * - value_from_register (struct type *type, int regnum, struct frame_info *frame) - { - struct gdbarch *gdbarch = get_frame_arch (frame); -- struct type *type1 = check_typedef (type); - struct value *v; - -- if (gdbarch_convert_register_p (gdbarch, regnum, type1)) -+ type = check_typedef (type); -+ -+ if (gdbarch_convert_register_p (gdbarch, regnum, type)) - { - int optim, unavail, ok; - -@@ -720,7 +721,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) - VALUE_LVAL (v) = lval_register; - VALUE_FRAME_ID (v) = get_frame_id (frame); - VALUE_REGNUM (v) = regnum; -- ok = gdbarch_register_to_value (gdbarch, frame, regnum, type1, -+ ok = gdbarch_register_to_value (gdbarch, frame, regnum, type, - value_contents_raw (v), &optim, - &unavail); - diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in index 05a38b2..9801fdf 100644 --- a/gdb/gdb-gdb.gdb.in @@ -2099,945 +111,8 @@ index 05a38b2..9801fdf 100644 if !$gdb_init_done set variable $gdb_init_done = 1 -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 8e3090d..758b3c5 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -40,6 +40,8 @@ - #include "cp-support.h" - #include "bcache.h" - #include "dwarf2loc.h" -+#include "observer.h" -+#include "dwarf2expr.h" - - /* Initialize BADNESS constants. */ - -@@ -188,6 +190,43 @@ alloc_type (struct objfile *objfile) - return type; - } - -+#if 0 -+/* Declare TYPE as discardable on next garbage collection by free_all_types. -+ You must call type_mark_used during each free_all_types to protect TYPE from -+ being deallocated. */ -+ -+static void -+set_type_as_discardable (struct type *type) -+{ -+ void **slot; -+ -+ gdb_assert (!TYPE_DISCARDABLE (type)); -+ -+ TYPE_DISCARDABLE (type) = 1; -+ TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current; -+ -+ slot = htab_find_slot (type_discardable_table, type, INSERT); -+ gdb_assert (!*slot); -+ *slot = type; -+} -+#endif -+ -+/* Allocate a new type like alloc_type but preserve for it the discardability -+ state of PARENT_TYPE. */ -+ -+static struct type * -+alloc_type_as_parent (struct type *parent_type) -+{ -+ struct type *new_type = alloc_type_copy (parent_type); -+ -+#if 0 -+ if (TYPE_DISCARDABLE (parent_type)) -+ set_type_as_discardable (new_type); -+#endif -+ -+ return new_type; -+} -+ - /* Allocate a new GDBARCH-associated type structure and fill it - with some defaults. Space for the type structure is allocated - on the heap. */ -@@ -328,7 +367,7 @@ make_pointer_type (struct type *type, struct type **typeptr) - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); - if (typeptr) - *typeptr = ntype; - } -@@ -401,7 +440,7 @@ make_reference_type (struct type *type, struct type **typeptr) - - if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ - { -- ntype = alloc_type_copy (type); -+ ntype = alloc_type_as_parent (type); - if (typeptr) - *typeptr = ntype; - } -@@ -824,6 +863,7 @@ create_range_type (struct type *result_type, struct type *index_type, - TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); - TYPE_LOW_BOUND (result_type) = low_bound; - TYPE_HIGH_BOUND (result_type) = high_bound; -+ TYPE_BYTE_STRIDE (result_type) = 0; - - if (low_bound >= 0) - TYPE_UNSIGNED (result_type) = 1; -@@ -944,6 +984,10 @@ get_array_bounds (struct type *type, LONGEST *low_bound, LONGEST *high_bound) - return 1; - } - -+static LONGEST type_length_get (struct type *type, struct type *target_type, -+ int full_span); -+ -+ - /* Create an array type using either a blank type supplied in - RESULT_TYPE, or creating a new type, inheriting the objfile from - RANGE_TYPE. -@@ -967,26 +1011,31 @@ create_array_type (struct type *result_type, - - TYPE_CODE (result_type) = TYPE_CODE_ARRAY; - TYPE_TARGET_TYPE (result_type) = element_type; -- if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -- low_bound = high_bound = 0; -- CHECK_TYPEDEF (element_type); -- /* Be careful when setting the array length. Ada arrays can be -- empty arrays with the high_bound being smaller than the low_bound. -- In such cases, the array length should be zero. */ -- if (high_bound < low_bound) -- TYPE_LENGTH (result_type) = 0; -- else -- TYPE_LENGTH (result_type) = -- TYPE_LENGTH (element_type) * (high_bound - low_bound + 1); - TYPE_NFIELDS (result_type) = 1; - TYPE_FIELDS (result_type) = - (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)); - TYPE_INDEX_TYPE (result_type) = range_type; - TYPE_VPTR_FIELDNO (result_type) = -1; - -- /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays. */ -+ /* DWARF blocks may depend on runtime information like -+ DW_OP_PUSH_OBJECT_ADDRESS not being available during the -+ CREATE_ARRAY_TYPE time. */ -+ if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT -+ || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT -+ || TYPE_DYNAMIC (element_type)) -+ TYPE_LENGTH (result_type) = 0; -+ else -+ { -+ CHECK_TYPEDEF (element_type); -+ TYPE_LENGTH (result_type) = type_length_get (result_type, element_type, -+ 0); -+ } - if (TYPE_LENGTH (result_type) == 0) -- TYPE_TARGET_STUB (result_type) = 1; -+ { -+ /* The real size will be computed for specific instances by -+ CHECK_TYPEDEF. */ -+ TYPE_TARGET_STUB (result_type) = 1; -+ } - - return result_type; - } -@@ -1508,6 +1557,105 @@ stub_noname_complaint (void) - complaint (&symfile_complaints, _("stub type has NULL name")); - } - -+/* Calculate the memory length of array TYPE. -+ -+ TARGET_TYPE should be set to `check_typedef (TYPE_TARGET_TYPE (type))' as -+ a performance hint. Feel free to pass NULL. Set FULL_SPAN to return the -+ size incl. the possible padding of the last element - it may differ from the -+ cleared FULL_SPAN return value (the expected SIZEOF) for non-zero -+ TYPE_BYTE_STRIDE values. */ -+ -+static LONGEST -+type_length_get (struct type *type, struct type *target_type, int full_span) -+{ -+ struct type *range_type; -+ LONGEST byte_stride = 0; /* `= 0' for a false GCC warning. */ -+ LONGEST count, element_size, retval; -+ -+ if (TYPE_CODE (type) != TYPE_CODE_ARRAY -+ && TYPE_CODE (type) != TYPE_CODE_STRING) -+ return TYPE_LENGTH (type); -+ -+ /* Avoid executing TYPE_HIGH_BOUND for invalid (unallocated/unassociated) -+ Fortran arrays. The allocated data will never be used so they can be -+ zero-length. */ -+ if (object_address_data_not_valid (type)) -+ return 0; -+ -+ range_type = TYPE_INDEX_TYPE (type); -+ if (TYPE_LOW_BOUND_UNDEFINED (range_type) -+ || TYPE_HIGH_BOUND_UNDEFINED (range_type)) -+ return 0; -+ count = TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1; -+ /* It may happen for wrong DWARF annotations returning garbage data. */ -+ if (count < 0) -+ warning (_("Range for type %s has invalid bounds %s..%s"), -+ TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)), -+ plongest (TYPE_HIGH_BOUND (range_type))); -+ /* The code below does not handle count == 0 right. */ -+ if (count <= 0) -+ return 0; -+ if (full_span || count > 1) -+ { -+ /* We do not use TYPE_ARRAY_BYTE_STRIDE_VALUE (type) here as we want to -+ force FULL_SPAN to 1. */ -+ byte_stride = TYPE_BYTE_STRIDE (range_type); -+ if (byte_stride == 0) -+ { -+ if (target_type == NULL) -+ target_type = check_typedef (TYPE_TARGET_TYPE (type)); -+ byte_stride = type_length_get (target_type, NULL, 1); -+ } -+ } -+ -+ /* For now, we conservatively take the array length to be 0 if its length -+ exceeds UINT_MAX. The code below assumes that for x < 0, -+ (ULONGEST) x == -x + ULONGEST_MAX + 1, which is technically not guaranteed -+ by C, but is usually true (because it would be true if x were unsigned -+ with its high-order bit on). It uses the fact that high_bound-low_bound is -+ always representable in ULONGEST and that if high_bound-low_bound+1 -+ overflows, it overflows to 0. We must change these tests if we decide to -+ increase the representation of TYPE_LENGTH from unsigned int to ULONGEST. -+ */ -+ -+ if (full_span) -+ { -+ retval = count * byte_stride; -+ if (count == 0 || retval / count != byte_stride || retval > UINT_MAX) -+ retval = 0; -+ return retval; -+ } -+ if (target_type == NULL) -+ target_type = check_typedef (TYPE_TARGET_TYPE (type)); -+ element_size = type_length_get (target_type, NULL, 1); -+ retval = (count - 1) * byte_stride + element_size; -+ if (retval < element_size -+ || (byte_stride != 0 -+ && (retval - element_size) / byte_stride != count - 1) -+ || retval > UINT_MAX) -+ retval = 0; -+ return retval; -+} -+ -+/* Prepare TYPE after being read in by the backend. Currently this function -+ only propagates the TYPE_DYNAMIC flag. */ -+ -+void -+finalize_type (struct type *type) -+{ -+ int i; -+ -+ for (i = 0; i < TYPE_NFIELDS (type); ++i) -+ if (TYPE_FIELD_TYPE (type, i) && TYPE_DYNAMIC (TYPE_FIELD_TYPE (type, i))) -+ break; -+ -+ /* FIXME: cplus_stuff is ignored here. */ -+ if (i < TYPE_NFIELDS (type) -+ || (TYPE_VPTR_BASETYPE (type) && TYPE_DYNAMIC (TYPE_VPTR_BASETYPE (type))) -+ || (TYPE_TARGET_TYPE (type) && TYPE_DYNAMIC (TYPE_TARGET_TYPE (type)))) -+ TYPE_DYNAMIC (type) = 1; -+} -+ - /* Find the real type of TYPE. This function returns the real type, - after removing all layers of typedefs, and completing opaque or stub - types. Completion changes the TYPE argument, but stripping of -@@ -1674,52 +1822,37 @@ check_typedef (struct type *type) - } - } - -- if (TYPE_TARGET_STUB (type)) -+ /* copy_type_recursive automatically makes the resulting type containing only -+ constant values expected by the callers of this function. */ -+ if (TYPE_DYNAMIC (type)) -+ { -+ htab_t copied_types; -+ -+ copied_types = create_copied_types_hash (NULL); -+ type = copy_type_recursive (type, copied_types); -+ htab_delete (copied_types); -+ -+ gdb_assert (TYPE_DYNAMIC (type) == 0); -+ /* Force TYPE_LENGTH (type) recalculation. */ -+ TYPE_DYNAMIC (type) = 1; -+ } -+ -+ if (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type)) - { -- struct type *range_type; - struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type)); - -+ if (TYPE_DYNAMIC (type)) -+ TYPE_TARGET_TYPE (type) = target_type; - if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type)) - { - /* Nothing we can do. */ - } - else if (TYPE_CODE (type) == TYPE_CODE_ARRAY -- && TYPE_NFIELDS (type) == 1 -- && (TYPE_CODE (range_type = TYPE_INDEX_TYPE (type)) -- == TYPE_CODE_RANGE)) -+ || TYPE_CODE (type) == TYPE_CODE_STRING) - { - /* Now recompute the length of the array type, based on its -- number of elements and the target type's length. -- Watch out for Ada null Ada arrays where the high bound -- is smaller than the low bound. */ -- const LONGEST low_bound = TYPE_LOW_BOUND (range_type); -- const LONGEST high_bound = TYPE_HIGH_BOUND (range_type); -- ULONGEST len; -- -- if (high_bound < low_bound) -- len = 0; -- else -- { -- /* For now, we conservatively take the array length to be 0 -- if its length exceeds UINT_MAX. The code below assumes -- that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1, -- which is technically not guaranteed by C, but is usually true -- (because it would be true if x were unsigned with its -- high-order bit on). It uses the fact that -- high_bound-low_bound is always representable in -- ULONGEST and that if high_bound-low_bound+1 overflows, -- it overflows to 0. We must change these tests if we -- decide to increase the representation of TYPE_LENGTH -- from unsigned int to ULONGEST. */ -- ULONGEST ulow = low_bound, uhigh = high_bound; -- ULONGEST tlen = TYPE_LENGTH (target_type); -- -- len = tlen * (uhigh - ulow + 1); -- if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh -- || len > UINT_MAX) -- len = 0; -- } -- TYPE_LENGTH (type) = len; -+ number of elements and the target type's length. */ -+ TYPE_LENGTH (type) = type_length_get (type, target_type, 0); - TYPE_TARGET_STUB (type) = 0; - } - else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1727,6 +1860,7 @@ check_typedef (struct type *type) - TYPE_LENGTH (type) = TYPE_LENGTH (target_type); - TYPE_TARGET_STUB (type) = 0; - } -+ TYPE_DYNAMIC (type) = 0; - } - - type = make_qualified_type (type, instance_flags, NULL); -@@ -3632,33 +3766,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) - } - - /* Allocate the hash table used by copy_type_recursive to walk -- types without duplicates. We use OBJFILE's obstack, because -- OBJFILE is about to be deleted. */ -+ types without duplicates. */ - - htab_t - create_copied_types_hash (struct objfile *objfile) - { -- return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq, -- NULL, &objfile->objfile_obstack, -- hashtab_obstack_allocate, -- dummy_obstack_deallocate); -+ if (objfile == NULL) -+ { -+ /* NULL OBJFILE is for TYPE_DYNAMIC types already contained in -+ OBJFILE_MALLOC memory, such as those from VALUE_HISTORY_CHAIN. Table -+ element entries get allocated by xmalloc - so use xfree. */ -+ return htab_create (1, type_pair_hash, type_pair_eq, xfree); -+ } -+ else -+ { -+ /* Use OBJFILE's obstack, because OBJFILE is about to be deleted. Table -+ element entries get allocated by xmalloc - so use xfree. */ -+ return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq, -+ xfree, &objfile->objfile_obstack, -+ hashtab_obstack_allocate, -+ dummy_obstack_deallocate); -+ } - } - --/* Recursively copy (deep copy) TYPE, if it is associated with -- OBJFILE. Return a new type allocated using malloc, a saved type if -- we have already visited TYPE (using COPIED_TYPES), or TYPE if it is -- not associated with OBJFILE. */ -+/* A helper for copy_type_recursive. This does all the work. OBJFILE is used -+ only for an assertion checking. */ - --struct type * --copy_type_recursive (struct objfile *objfile, -- struct type *type, -- htab_t copied_types) -+static struct type * -+copy_type_recursive_1 (struct objfile *objfile, -+ struct type *type, -+ htab_t copied_types) - { - struct type_pair *stored, pair; - void **slot; - struct type *new_type; - -- if (! TYPE_OBJFILE_OWNED (type)) -+ if (! TYPE_OBJFILE_OWNED (type) && !TYPE_DYNAMIC (type)) - return type; - - /* This type shouldn't be pointing to any types in other objfiles; -@@ -3673,9 +3816,10 @@ copy_type_recursive (struct objfile *objfile, - new_type = alloc_type_arch (get_type_arch (type)); - - /* We must add the new type to the hash table immediately, in case -- we encounter this type again during a recursive call below. */ -- stored -- = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair)); -+ we encounter this type again during a recursive call below. Memory could -+ be allocated from OBJFILE in the case we will be removing OBJFILE, this -+ optimization is missed and xfree is called for it from COPIED_TYPES. */ -+ stored = xmalloc (sizeof (*stored)); - stored->old = type; - stored->new = new_type; - *slot = stored; -@@ -3686,6 +3830,21 @@ copy_type_recursive (struct objfile *objfile, - TYPE_OBJFILE_OWNED (new_type) = 0; - TYPE_OWNER (new_type).gdbarch = get_type_arch (type); - -+#if 0 -+ /* TYPE_MAIN_TYPE memory copy above rewrote the TYPE_DISCARDABLE flag so we -+ need to initialize it again. And even if TYPE was already discardable -+ NEW_TYPE so far is not registered in TYPE_DISCARDABLE_TABLE. */ -+ TYPE_DISCARDABLE (new_type) = 0; -+ set_type_as_discardable (new_type); -+#endif -+ -+ /* Pre-clear the fields processed by delete_main_type. If DWARF block -+ evaluations below call error we would leave an unfreeable TYPE. */ -+ TYPE_TARGET_TYPE (new_type) = NULL; -+ TYPE_VPTR_BASETYPE (new_type) = NULL; -+ TYPE_NFIELDS (new_type) = 0; -+ TYPE_FIELDS (new_type) = NULL; -+ - if (TYPE_NAME (type)) - TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); - if (TYPE_TAG_NAME (type)) -@@ -3694,12 +3853,48 @@ copy_type_recursive (struct objfile *objfile, - TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); - TYPE_LENGTH (new_type) = TYPE_LENGTH (type); - -+ if (TYPE_ALLOCATED (new_type)) -+ { -+ gdb_assert (!TYPE_NOT_ALLOCATED (new_type)); -+ -+ if (!dwarf_locexpr_baton_eval (TYPE_ALLOCATED (new_type))) -+ TYPE_NOT_ALLOCATED (new_type) = 1; -+ TYPE_ALLOCATED (new_type) = NULL; -+ } -+ -+ if (TYPE_ASSOCIATED (new_type)) -+ { -+ gdb_assert (!TYPE_NOT_ASSOCIATED (new_type)); -+ -+ if (!dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (new_type))) -+ TYPE_NOT_ASSOCIATED (new_type) = 1; -+ TYPE_ASSOCIATED (new_type) = NULL; -+ } -+ -+ if (!TYPE_DATA_LOCATION_IS_ADDR (new_type) -+ && TYPE_DATA_LOCATION_DWARF_BLOCK (new_type)) -+ { -+ if (TYPE_NOT_ALLOCATED (new_type) -+ || TYPE_NOT_ASSOCIATED (new_type)) -+ TYPE_DATA_LOCATION_DWARF_BLOCK (new_type) = NULL; -+ else -+ { -+ TYPE_DATA_LOCATION_IS_ADDR (new_type) = 1; -+ TYPE_DATA_LOCATION_ADDR (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_DATA_LOCATION_DWARF_BLOCK (new_type)); -+ } -+ } -+ - /* Copy the fields. */ - if (TYPE_NFIELDS (type)) - { - int i, nfields; - -+ /* TYPE_CODE_RANGE uses TYPE_RANGE_DATA of the union with TYPE_FIELDS. */ -+ gdb_assert (TYPE_CODE (type) != TYPE_CODE_RANGE); -+ - nfields = TYPE_NFIELDS (type); -+ TYPE_NFIELDS (new_type) = nfields; - TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); - for (i = 0; i < nfields; i++) - { -@@ -3708,8 +3903,8 @@ copy_type_recursive (struct objfile *objfile, - TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); - if (TYPE_FIELD_TYPE (type, i)) - TYPE_FIELD_TYPE (new_type, i) -- = copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i), -- copied_types); -+ = copy_type_recursive_1 (objfile, TYPE_FIELD_TYPE (type, i), -+ copied_types); - if (TYPE_FIELD_NAME (type, i)) - TYPE_FIELD_NAME (new_type, i) = - xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3740,24 +3935,184 @@ copy_type_recursive (struct objfile *objfile, - } - } - -+ /* Both FIELD_LOC_KIND_DWARF_BLOCK and TYPE_RANGE_HIGH_BOUND_IS_COUNT were -+ possibly converted. */ -+ TYPE_DYNAMIC (new_type) = 0; -+ - /* For range types, copy the bounds information. */ -- if (TYPE_CODE (type) == TYPE_CODE_RANGE) -+ if (TYPE_CODE (new_type) == TYPE_CODE_RANGE) - { - TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds)); - *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); -+ -+ switch (TYPE_RANGE_DATA (new_type)->low.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ { -+ /* We should set 1 for Fortran but how to find the language? */ -+ TYPE_LOW_BOUND (new_type) = 0; -+ TYPE_LOW_BOUND_UNDEFINED (new_type) = 1; -+ } -+ else -+ { -+ TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->low.u.dwarf_block); -+ if (TYPE_LOW_BOUND (new_type) >= 0) -+ TYPE_UNSIGNED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames () -+ && dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.type, &addr)) -+ { -+ TYPE_LOW_BOUND (new_type) = addr; -+ if (TYPE_LOW_BOUND (new_type) >= 0) -+ TYPE_UNSIGNED (new_type) = 1; -+ } -+ else -+ { -+ /* We should set 1 for Fortran but how to find the language? */ -+ TYPE_LOW_BOUND (new_type) = 0; -+ TYPE_LOW_BOUND_UNDEFINED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ switch (TYPE_RANGE_DATA (new_type)->high.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1; -+ TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1; -+ } -+ else -+ TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block); -+ TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames () -+ && dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.type, -+ &addr)) -+ TYPE_HIGH_BOUND (new_type) = addr; -+ else -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1; -+ TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1; -+ } -+ TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ switch (TYPE_RANGE_DATA (new_type)->byte_stride.kind) -+ { -+ case RANGE_BOUND_KIND_CONSTANT: -+ break; -+ case RANGE_BOUND_KIND_DWARF_BLOCK: -+ /* `struct dwarf2_locexpr_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type) -+ || ! has_stack_frames ()) -+ TYPE_BYTE_STRIDE (new_type) = 0; -+ else -+ TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval -+ (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block); -+ TYPE_RANGE_DATA (new_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_CONSTANT; -+ break; -+ case RANGE_BOUND_KIND_DWARF_LOCLIST: -+ { -+ CORE_ADDR addr = 0; -+ -+ /* `struct dwarf2_loclist_baton' is too bound to its objfile so -+ it is expected to be made constant by CHECK_TYPEDEF. -+ TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE. -+ */ -+ if (! TYPE_NOT_ALLOCATED (new_type) -+ && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()) -+ dwarf_loclist_baton_eval -+ (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.loclist, -+ TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.type, -+ &addr); -+ TYPE_BYTE_STRIDE (new_type) = addr; -+ TYPE_RANGE_DATA (new_type)->byte_stride.kind -+ = RANGE_BOUND_KIND_CONSTANT; -+ } -+ break; -+ } -+ -+ /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound. */ -+ if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type)) -+ { -+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) -+ + TYPE_HIGH_BOUND (new_type) - 1; -+ TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0; -+ } - } - - /* Copy pointers to other types. */ - if (TYPE_TARGET_TYPE (type)) - TYPE_TARGET_TYPE (new_type) = -- copy_type_recursive (objfile, -- TYPE_TARGET_TYPE (type), -- copied_types); -+ copy_type_recursive_1 (objfile, -+ TYPE_TARGET_TYPE (type), -+ copied_types); - if (TYPE_VPTR_BASETYPE (type)) - TYPE_VPTR_BASETYPE (new_type) = -- copy_type_recursive (objfile, -- TYPE_VPTR_BASETYPE (type), -- copied_types); -+ copy_type_recursive_1 (objfile, -+ TYPE_VPTR_BASETYPE (type), -+ copied_types); -+ -+ if (TYPE_CODE (new_type) == TYPE_CODE_ARRAY) -+ { -+ struct type *new_index_type = TYPE_INDEX_TYPE (new_type); -+ -+ if (TYPE_BYTE_STRIDE (new_index_type) == 0) -+ TYPE_BYTE_STRIDE (new_index_type) -+ = TYPE_LENGTH (TYPE_TARGET_TYPE (new_type)); -+ } -+ - /* Maybe copy the type_specific bits. - - NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3774,6 +4129,17 @@ copy_type_recursive (struct objfile *objfile, - return new_type; - } - -+/* Recursively copy (deep copy) TYPE. Return a new type allocated using -+ malloc, a saved type if we have already visited TYPE (using COPIED_TYPES), -+ or TYPE if it is not associated with OBJFILE. */ -+ -+struct type * -+copy_type_recursive (struct type *type, -+ htab_t copied_types) -+{ -+ return copy_type_recursive_1 (TYPE_OBJFILE (type), type, copied_types); -+} -+ - /* Make a copy of the given TYPE, except that the pointer & reference - types are not preserved. - -@@ -4330,6 +4696,13 @@ void - _initialize_gdbtypes (void) - { - gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); -+ -+#if 0 -+ type_discardable_table = htab_create_alloc (20, type_discardable_hash, -+ type_discardable_equal, NULL, -+ xcalloc, xfree); -+#endif -+ - objfile_type_data = register_objfile_data (); - - add_setshow_zuinteger_cmd ("overload", no_class, &overload_debug, -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 61ddeff..fc6f276 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -226,6 +226,11 @@ enum type_instance_flag_value - - #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) - -+/* Type needs to be evaluated on each CHECK_TYPEDEF and its results must not be -+ sticky. */ -+ -+#define TYPE_DYNAMIC(t) (TYPE_MAIN_TYPE (t)->flag_dynamic) -+ - /* Static type. If this is set, the corresponding type had - a static modifier. - Note: This may be unnecessary, since static data members -@@ -309,6 +314,50 @@ enum type_instance_flag_value - - #define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum) - -+#if 0 -+/* Define this type as being reclaimable during free_all_types. Type is -+ required to be have TYPE_OBJFILE set to NULL. Setting this flag requires -+ initializing TYPE_DISCARDABLE_AGE, see alloc_type_discardable. */ -+ -+#define TYPE_DISCARDABLE(t) (TYPE_MAIN_TYPE (t)->flag_discardable) -+ -+/* Marker this type has been visited by the type_mark_used by this -+ mark-and-sweep types garbage collecting pass. Current pass is represented -+ by TYPE_DISCARDABLE_AGE_CURRENT. */ -+ -+#define TYPE_DISCARDABLE_AGE(t) (TYPE_MAIN_TYPE (t)->flag_discardable_age) -+#endif -+ -+/* Is HIGH_BOUND a low-bound relative count (1) or the high bound itself (0)? */ -+ -+#define TYPE_RANGE_HIGH_BOUND_IS_COUNT(range_type) \ -+ (TYPE_MAIN_TYPE (range_type)->flag_range_high_bound_is_count) -+ -+/* Not allocated. TYPE_ALLOCATED(t) must be NULL in such case. If this flag -+ is unset and TYPE_ALLOCATED(t) is NULL then the type is allocated. If this -+ flag is unset and TYPE_ALLOCATED(t) is not NULL then its DWARF block -+ determines the actual allocation state. */ -+ -+#define TYPE_NOT_ALLOCATED(t) (TYPE_MAIN_TYPE (t)->flag_not_allocated) -+ -+/* Not associated. TYPE_ASSOCIATED(t) must be NULL in such case. If this flag -+ is unset and TYPE_ASSOCIATED(t) is NULL then the type is associated. If -+ this flag is unset and TYPE_ASSOCIATED(t) is not NULL then its DWARF block -+ determines the actual association state. */ -+ -+#define TYPE_NOT_ASSOCIATED(t) (TYPE_MAIN_TYPE (t)->flag_not_associated) -+ -+/* Address of the actual data as for DW_AT_data_location. Its dwarf block must -+ not be evaluated unless both TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are -+ false. If TYPE_DATA_LOCATION_IS_ADDR set then TYPE_DATA_LOCATION_ADDR value -+ is the actual data address value. If unset and -+ TYPE_DATA_LOCATION_DWARF_BLOCK is NULL then the value is the normal -+ value_raw_address. If unset and TYPE_DATA_LOCATION_DWARF_BLOCK is not NULL -+ then its DWARF block determines the actual data address. */ -+ -+#define TYPE_DATA_LOCATION_IS_ADDR(t) \ -+ (TYPE_MAIN_TYPE (t)->flag_data_location_is_addr) -+ - /* Constant type. If this is set, the corresponding type has a - const modifier. */ - -@@ -425,6 +474,15 @@ struct main_type - /* True if this type was declared with "class" rather than - "struct". */ - unsigned int flag_declared_class : 1; -+#if 0 -+ unsigned int flag_discardable : 1; -+ unsigned int flag_discardable_age : 1; -+#endif -+ unsigned int flag_dynamic : 1; -+ unsigned int flag_range_high_bound_is_count : 1; -+ unsigned int flag_not_allocated : 1; -+ unsigned int flag_not_associated : 1; -+ unsigned int flag_data_location_is_addr : 1; - - /* True if this is an enum type with disjoint values. This affects - how the enum is printed. */ -@@ -505,6 +563,20 @@ struct main_type - - struct type *target_type; - -+ /* For DW_AT_data_location. */ -+ union -+ { -+ struct dwarf2_locexpr_baton *dwarf_block; -+ CORE_ADDR addr; -+ } -+ data_location; -+ -+ /* For DW_AT_allocated. */ -+ struct dwarf2_locexpr_baton *allocated; -+ -+ /* For DW_AT_associated. */ -+ struct dwarf2_locexpr_baton *associated; -+ - /* For structure and union types, a description of each field. - For set and pascal array types, there is one "field", - whose type is the domain type of the set or array. -@@ -587,13 +659,34 @@ struct main_type - - struct range_bounds - { -+ struct -+ { -+ union -+ { -+ LONGEST constant; -+ struct dwarf2_locexpr_baton *dwarf_block; -+ struct -+ { -+ struct dwarf2_loclist_baton *loclist; -+ struct type *type; -+ } -+ dwarf_loclist; -+ } -+ u; -+ enum range_bound_kind -+ { -+ RANGE_BOUND_KIND_CONSTANT, -+ RANGE_BOUND_KIND_DWARF_BLOCK, -+ RANGE_BOUND_KIND_DWARF_LOCLIST -+ } -+ kind; -+ } - /* Low bound of range. */ -- -- LONGEST low; -- -+ low, - /* High bound of range. */ -- -- LONGEST high; -+ high, -+ /* Byte stride of range. */ -+ byte_stride; - - /* Flags indicating whether the values of low and high are - valid. When true, the respective range value is -@@ -1053,9 +1146,9 @@ extern void allocate_gnat_aux_type (struct type *); - #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type - #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type - #define TYPE_CHAIN(thistype) (thistype)->chain --/* Note that if thistype is a TYPEDEF type, you have to call check_typedef. -- But check_typedef does set the TYPE_LENGTH of the TYPEDEF type, -- so you only have to call check_typedef once. Since allocate_value -+/* Note that if thistype is a TYPEDEF, ARRAY or STRING type, you have to call -+ check_typedef. But check_typedef does set the TYPE_LENGTH of the TYPEDEF -+ type, so you only have to call check_typedef once. Since allocate_value - calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ - #define TYPE_LENGTH(thistype) (thistype)->length - /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -1063,11 +1156,16 @@ extern void allocate_gnat_aux_type (struct type *); - #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code - #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields - #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields -+#define TYPE_DATA_LOCATION_DWARF_BLOCK(thistype) TYPE_MAIN_TYPE (thistype)->data_location.dwarf_block -+#define TYPE_DATA_LOCATION_ADDR(thistype) TYPE_MAIN_TYPE (thistype)->data_location.addr -+#define TYPE_ALLOCATED(thistype) TYPE_MAIN_TYPE (thistype)->allocated -+#define TYPE_ASSOCIATED(thistype) TYPE_MAIN_TYPE (thistype)->associated - - #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0) - #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds --#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low --#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high -+#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low.u.constant -+#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high.u.constant -+#define TYPE_BYTE_STRIDE(range_type) TYPE_RANGE_DATA(range_type)->byte_stride.u.constant - #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ - TYPE_RANGE_DATA(range_type)->low_undefined - #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -1084,7 +1182,14 @@ extern void allocate_gnat_aux_type (struct type *); - (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) - - #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ -- (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype)))) -+ TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arraytype)) -+ -+/* TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) with a fallback to the -+ element size if no specific stride value is known. */ -+#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype) \ -+ (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) == 0 \ -+ ? TYPE_LENGTH (TYPE_TARGET_TYPE (arraytype)) \ -+ : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype))) - - /* C++ */ - -@@ -1533,6 +1638,18 @@ extern struct type *create_array_type (struct type *, struct type *, - struct type *); - extern struct type *lookup_array_range_type (struct type *, LONGEST, LONGEST); - -+extern CORE_ADDR type_range_any_field_internal (struct type *range_type, -+ int fieldno); -+ -+extern int type_range_high_bound_internal (struct type *range_type); -+ -+extern int type_range_count_bound_internal (struct type *range_type); -+ -+extern CORE_ADDR type_range_byte_stride_internal (struct type *range_type, -+ struct type *element_type); -+ -+extern void finalize_type (struct type *type); -+ - extern struct type *create_string_type (struct type *, struct type *, - struct type *); - extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST); -@@ -1578,6 +1695,10 @@ extern int is_public_ancestor (struct type *, struct type *); - - extern int is_unique_ancestor (struct type *, struct value *); - -+#if 0 -+extern void type_mark_used (struct type *type); -+#endif -+ - /* Overload resolution */ - - #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1656,8 +1777,7 @@ extern void maintenance_print_type (char *, int); - - extern htab_t create_copied_types_hash (struct objfile *objfile); - --extern struct type *copy_type_recursive (struct objfile *objfile, -- struct type *type, -+extern struct type *copy_type_recursive (struct type *type, - htab_t copied_types); - - extern struct type *copy_type (const struct type *type); diff --git a/gdb/main.c b/gdb/main.c -index 0c8349e..a07f41a 100644 +index 108759d..a624c1b 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -37,6 +37,7 @@ @@ -3047,8 +122,8 @@ index 0c8349e..a07f41a 100644 +#include "python/python.h" #include "source.h" #include "cli/cli-cmds.h" - #include "python/python.h" -@@ -325,6 +326,8 @@ captured_main (void *data) + #include "objfiles.h" +@@ -359,6 +360,8 @@ captured_main (void *data) char *cdarg = NULL; char *ttyarg = NULL; @@ -3057,7 +132,7 @@ index 0c8349e..a07f41a 100644 /* These are static so that we can take their address in an initializer. */ static int print_help; -@@ -531,10 +534,14 @@ captured_main (void *data) +@@ -566,10 +569,14 @@ captured_main (void *data) {"args", no_argument, &set_args, 1}, {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, @@ -3073,7 +148,7 @@ index 0c8349e..a07f41a 100644 { int option_index; -@@ -552,6 +559,9 @@ captured_main (void *data) +@@ -587,6 +594,9 @@ captured_main (void *data) case 0: /* Long option that just sets a flag. */ break; @@ -3083,7 +158,7 @@ index 0c8349e..a07f41a 100644 case OPT_SE: symarg = optarg; execarg = optarg; -@@ -761,7 +771,31 @@ captured_main (void *data) +@@ -791,7 +801,31 @@ captured_main (void *data) /* Now that gdb_init has created the initial inferior, we're in position to set args for that inferior. */ @@ -3116,7 +191,7 @@ index 0c8349e..a07f41a 100644 { /* The remaining options are the command-line options for the inferior. The first one is the sym/exec file, and the rest -@@ -1047,7 +1081,8 @@ captured_main (void *data) +@@ -1077,7 +1111,8 @@ captured_main (void *data) /* Read in the old history after all the command files have been read. */ @@ -3126,7 +201,7 @@ index 0c8349e..a07f41a 100644 if (batch_flag) { -@@ -1058,13 +1093,25 @@ captured_main (void *data) +@@ -1088,13 +1123,25 @@ captured_main (void *data) /* Show time and/or space usage. */ do_cleanups (pre_stat_chain); @@ -3158,7 +233,7 @@ index 0c8349e..a07f41a 100644 } /* No exit -- exit is through quit_command. */ } -@@ -1099,6 +1146,12 @@ print_gdb_help (struct ui_file *stream) +@@ -1128,6 +1175,12 @@ print_gdb_help (struct ui_file *stream) fputs_unfiltered (_("\ This is the GNU debugger. Usage:\n\n\ gdb [options] [executable-file [core-file or process-id]]\n\ @@ -3171,7 +246,7 @@ index 0c8349e..a07f41a 100644 gdb [options] --args executable-file [inferior-arguments ...]\n\n\ "), stream); fputs_unfiltered (_("\ -@@ -1144,6 +1197,13 @@ Output and user interface control:\n\n\ +@@ -1173,6 +1226,13 @@ Output and user interface control:\n\n\ fputs_unfiltered (_("\ --dbx DBX compatibility mode.\n\ --xdb XDB compatibility mode.\n\ @@ -3182,298 +257,9 @@ index 0c8349e..a07f41a 100644 + arguments are passed to script.\n"), stream); +#endif + fputs_unfiltered (_("\ - --quiet Do not print version number on startup.\n\n\ + -q, --quiet, --silent\n\ + Do not print version number on startup.\n\n\ "), stream); - fputs_unfiltered (_("\ -diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c -index a87f1f4..0f93271 100644 ---- a/gdb/p-valprint.c -+++ b/gdb/p-valprint.c -@@ -38,6 +38,7 @@ - #include "cp-abi.h" - #include "cp-support.h" - #include "exceptions.h" -+#include "dwarf2loc.h" - - - /* Decorations for Pascal. */ -@@ -73,8 +74,31 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - struct type *char_type; - CORE_ADDR addr; - int want_space = 0; -+ struct cleanup *back_to; -+ struct type *saved_type = type; -+ CORE_ADDR saved_address = address; -+ -+ back_to = make_cleanup (null_cleanup, 0); -+ address += embedded_offset; -+ type = object_address_get_data (type, &address); -+ if (type == NULL) -+ { -+ fputs_filtered (object_address_data_not_valid (saved_type), stream); -+ gdb_flush (stream); -+ do_cleanups (back_to); -+ return; -+ } -+ if (address != saved_address + embedded_offset) -+ { -+ size_t length = TYPE_LENGTH (type); - -- CHECK_TYPEDEF (type); -+ valaddr = xmalloc (length); -+ make_cleanup (xfree, (gdb_byte *) valaddr); -+ read_memory (address, (gdb_byte *) valaddr, length); -+ embedded_offset = 0; -+ } -+ else -+ address -= embedded_offset; - switch (TYPE_CODE (type)) - { - case TYPE_CODE_ARRAY: -@@ -130,8 +154,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - { - i = 0; - } -- val_print_array_elements (type, valaddr, embedded_offset, -- address, stream, recurse, -+ val_print_array_elements (saved_type, valaddr, embedded_offset, -+ saved_address, stream, recurse, - original_value, options, i); - fprintf_filtered (stream, "}"); - } -@@ -169,6 +193,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - { - /* Try to print what function it points to. */ - print_address_demangle (options, gdbarch, addr, stream, demangle); -+ do_cleanups (back_to); - return; - } - -@@ -271,6 +296,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - } - } - -+ do_cleanups (back_to); - return; - - case TYPE_CODE_REF: -@@ -411,6 +437,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, - TYPE_CODE (type)); - } - gdb_flush (stream); -+ do_cleanups (back_to); - } - - void -diff --git a/gdb/parse.c b/gdb/parse.c -index 1171289..2afdb85 100644 ---- a/gdb/parse.c -+++ b/gdb/parse.c -@@ -1773,6 +1773,7 @@ parser_fprintf (FILE *x, const char *y, ...) - - int - operator_check_standard (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, - void *data), - void *data) -@@ -1812,7 +1813,7 @@ operator_check_standard (struct expression *exp, int pos, - struct type *type = elts[pos + 2 + arg].type; - struct objfile *objfile = TYPE_OBJFILE (type); - -- if (objfile && (*objfile_func) (objfile, data)) -+ if (objfile && objfile_func && (*objfile_func) (objfile, data)) - return 1; - } - } -@@ -1830,7 +1831,8 @@ operator_check_standard (struct expression *exp, int pos, - - /* Check objfile where the variable itself is placed. - SYMBOL_OBJ_SECTION (symbol) may be NULL. */ -- if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) -+ if (objfile_func -+ && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data)) - return 1; - - /* Check objfile where is placed the code touching the variable. */ -@@ -1843,24 +1845,27 @@ operator_check_standard (struct expression *exp, int pos, - - /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ - -- if (type && TYPE_OBJFILE (type) -+ if (type && type_func && (*type_func) (type, data)) -+ return 1; -+ if (type && TYPE_OBJFILE (type) && objfile_func - && (*objfile_func) (TYPE_OBJFILE (type), data)) - return 1; -- if (objfile && (*objfile_func) (objfile, data)) -+ if (objfile && objfile_func && (*objfile_func) (objfile, data)) - return 1; - - return 0; - } - --/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP. -- The functions are never called with NULL OBJFILE. Functions get passed an -- arbitrary caller supplied DATA pointer. If any of the functions returns -- non-zero value then (any other) non-zero value is immediately returned to -- the caller. Otherwise zero is returned after iterating through whole EXP. -- */ -+/* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being -+ referenced by EXP. The functions are never called with NULL TYPE or NULL -+ OBJFILE. Functions get passed an arbitrary caller supplied DATA pointer. -+ If any of the functions returns non-zero value then (any other) non-zero -+ value is immediately returned to the caller. Otherwise zero is returned -+ after iterating through whole EXP. */ - - static int - exp_iterate (struct expression *exp, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, void *data), - void *data) - { -@@ -1875,7 +1880,9 @@ exp_iterate (struct expression *exp, - - pos = endpos - oplen; - if (exp->language_defn->la_exp_desc->operator_check (exp, pos, -- objfile_func, data)) -+ type_func, -+ objfile_func, -+ data)) - return 1; - - endpos = pos; -@@ -1906,8 +1913,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) - { - gdb_assert (objfile->separate_debug_objfile_backlink == NULL); - -- return exp_iterate (exp, exp_uses_objfile_iter, objfile); -+ return exp_iterate (exp, NULL, exp_uses_objfile_iter, objfile); -+} -+ -+/* Helper for exp_types_mark_used. */ -+ -+#if 0 -+static int -+exp_types_mark_used_iter (struct type *type, void *unused) -+{ -+ type_mark_used (type); -+ -+ /* Continue the traversal. */ -+ return 0; -+} -+ -+/* Call type_mark_used for any type contained in EXP. */ -+ -+void -+exp_types_mark_used (struct expression *exp) -+{ -+ exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL); - } -+#endif - - void - _initialize_parse (void) -diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index c3f2607..fa0af7b 100644 ---- a/gdb/parser-defs.h -+++ b/gdb/parser-defs.h -@@ -245,6 +245,8 @@ extern void operator_length_standard (const struct expression *, int, int *, - int *); - - extern int operator_check_standard (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, -+ void *data), - int (*objfile_func) - (struct objfile *objfile, void *data), - void *data); -@@ -331,6 +333,7 @@ struct exp_descriptor - value should be immediately returned to the caller. Otherwise zero - should be returned. */ - int (*operator_check) (struct expression *exp, int pos, -+ int (*type_func) (struct type *type, void *data), - int (*objfile_func) (struct objfile *objfile, - void *data), - void *data); -diff --git a/gdb/printcmd.c b/gdb/printcmd.c -index 10d3c23..5759d5c 100644 ---- a/gdb/printcmd.c -+++ b/gdb/printcmd.c -@@ -50,6 +50,7 @@ - #include "cli/cli-utils.h" - #include "format.h" - #include "source.h" -+#include "dwarf2loc.h" - - #ifdef TUI - #include "tui/tui.h" /* For tui_active et al. */ -@@ -979,6 +980,11 @@ print_command_1 (const char *exp, int voidprint) - else - val = access_value_history (0); - -+ /* Do not try to OBJECT_ADDRESS_SET here anything. We are interested in the -+ source variable base addresses as found by READ_VAR_VALUE. The value here -+ can be already a calculated expression address inappropriate for -+ DW_OP_push_object_address. */ -+ - if (voidprint || (val && value_type (val) && - TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) - { -@@ -1060,6 +1066,9 @@ output_command_const (const char *exp, int from_tty) - - val = evaluate_expression (expr); - -+ if (VALUE_LVAL (val) == lval_memory) -+ object_address_set (value_raw_address (val)); -+ - annotate_value_begin (value_type (val)); - - get_formatted_print_options (&opts, format); -@@ -1494,6 +1503,24 @@ x_command (char *exp, int from_tty) - set_internalvar (lookup_internalvar ("__"), last_examine_value); - } - } -+ -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+print_types_mark_used (void) -+{ -+ struct display *d; -+ -+ if (last_examine_value) -+ type_mark_used (value_type (last_examine_value)); -+ -+ for (d = display_chain; d; d = d->next) -+ if (d->exp) -+ exp_types_mark_used (d->exp); -+} -+#endif -+ - - - /* Add an expression to the auto-display chain. -@@ -1995,6 +2022,10 @@ print_variable_and_value (const char *name, struct symbol *var, - struct value_print_options opts; - - val = read_var_value (var, frame); -+ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ - get_user_print_options (&opts); - opts.deref_ref = 1; - common_val_print (val, stream, indent, &opts, current_language); -@@ -2651,4 +2682,8 @@ Show printing of source filename and line number with ."), NULL, - add_com ("eval", no_class, eval_command, _("\ - Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ - a command line, and call it.")); -+ -+#if 0 -+ observer_attach_mark_used (print_types_mark_used); -+#endif - } diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py new file mode 100644 index 0000000..6fa48ff @@ -3721,238 +507,11 @@ index 0000000..debb3bb + return wanted == found + +InScope () -diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c -index 16bb442..8cf6deb 100644 ---- a/gdb/python/py-type.c -+++ b/gdb/python/py-type.c -@@ -29,6 +29,8 @@ - #include "language.h" - #include "vec.h" - #include "typeprint.h" -+#include "observer.h" -+#include "gdb_assert.h" - - typedef struct pyty_type_object - { -@@ -37,11 +39,19 @@ typedef struct pyty_type_object - - /* If a Type object is associated with an objfile, it is kept on a - doubly-linked list, rooted in the objfile. This lets us copy the -- underlying struct type when the objfile is deleted. */ -+ underlying struct type when the objfile is deleted. -+ -+ With NULL objfile Type still can be doubly-linked in the list -+ PYTY_OBJECTS_DISCARDABLE. */ - struct pyty_type_object *prev; - struct pyty_type_object *next; - } type_object; - -+#if 0 -+/* First element of a doubly-linked list of TYPE_DISCARDABLE Types. */ -+static type_object *pyty_objects_discardable; -+#endif -+ - static PyTypeObject type_object_type - CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object"); - -@@ -1024,8 +1034,63 @@ typy_richcompare (PyObject *self, PyObject *other, int op) - - - -+/* Key associated with each objfile pointing to the first element of -+ a doubly-linked list of Types associated with this objfile. */ - static const struct objfile_data *typy_objfile_data_key; - -+/* Link TYPE_OBJ to its appropriate list. Either to its objfile associated one -+ or at least to the global list for TYPE_DISCARDABLE Types. Permanent types -+ do not get linked anywhere. */ -+static void -+typy_link (type_object *type_obj) -+{ -+ type_obj->prev = NULL; -+ -+ if (type_obj->type && TYPE_OBJFILE (type_obj->type)) -+ { -+ struct objfile *objfile = TYPE_OBJFILE (type_obj->type); -+ -+ type_obj->next = objfile_data (objfile, typy_objfile_data_key); -+ if (type_obj->next) -+ type_obj->next->prev = type_obj; -+ set_objfile_data (objfile, typy_objfile_data_key, type_obj); -+ } -+#if 0 -+ else if (type_obj->type && TYPE_DISCARDABLE (type_obj->type)) -+ { -+ type_obj->next = pyty_objects_discardable; -+ if (type_obj->next) -+ type_obj->next->prev = type_obj; -+ pyty_objects_discardable = type_obj; -+ } -+#endif -+ else -+ type_obj->next = NULL; -+} -+ -+/* Unlink TYPE_OBJ from its current list. Permanent types are not linked -+ anywhere and this function has no effect on them. */ -+static void -+typy_unlink (type_object *type_obj) -+{ -+ if (type_obj->prev) -+ type_obj->prev->next = type_obj->next; -+ else if (type_obj->type && TYPE_OBJFILE (type_obj->type)) -+ { -+ /* Must reset head of list. */ -+ struct objfile *objfile = TYPE_OBJFILE (type_obj->type); -+ -+ set_objfile_data (objfile, typy_objfile_data_key, type_obj->next); -+ } -+#if 0 -+ else if (pyty_objects_discardable == type_obj) -+ pyty_objects_discardable = type_obj->next; -+#endif -+ -+ if (type_obj->next) -+ type_obj->next->prev = type_obj->prev; -+} -+ - static void - save_objfile_types (struct objfile *objfile, void *datum) - { -@@ -1046,12 +1111,13 @@ save_objfile_types (struct objfile *objfile, void *datum) - { - type_object *next = obj->next; - -- htab_empty (copied_types); -+ gdb_assert (TYPE_OBJFILE (obj->type) == objfile); -+ typy_unlink (obj); - -- obj->type = copy_type_recursive (objfile, obj->type, copied_types); -+ obj->type = copy_type_recursive (obj->type, copied_types); - -- obj->next = NULL; -- obj->prev = NULL; -+ gdb_assert (TYPE_OBJFILE (obj->type) == NULL); -+ typy_link (obj); - - obj = next; - } -@@ -1062,43 +1128,28 @@ save_objfile_types (struct objfile *objfile, void *datum) - } - - static void --set_type (type_object *obj, struct type *type) -+typy_dealloc (PyObject *obj) - { -- obj->type = type; -- obj->prev = NULL; -- if (type && TYPE_OBJFILE (type)) -- { -- struct objfile *objfile = TYPE_OBJFILE (type); -+ type_object *type_obj = (type_object *) obj; - -- obj->next = objfile_data (objfile, typy_objfile_data_key); -- if (obj->next) -- obj->next->prev = obj; -- set_objfile_data (objfile, typy_objfile_data_key, obj); -- } -- else -- obj->next = NULL; -+ typy_unlink (type_obj); -+ -+ type_obj->ob_type->tp_free (obj); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ - static void --typy_dealloc (PyObject *obj) -+typy_types_mark_used (void) - { -- type_object *type = (type_object *) obj; -- -- if (type->prev) -- type->prev->next = type->next; -- else if (type->type && TYPE_OBJFILE (type->type)) -- { -- /* Must reset head of list. */ -- struct objfile *objfile = TYPE_OBJFILE (type->type); -- -- if (objfile) -- set_objfile_data (objfile, typy_objfile_data_key, type->next); -- } -- if (type->next) -- type->next->prev = type->prev; -+ type_object *type_obj; - -- Py_TYPE (type)->tp_free (type); -+ for (type_obj = pyty_objects_discardable; -+ type_obj != NULL; -+ type_obj = type_obj->next) -+ type_mark_used (type_obj->type); - } -+#endif - - /* Return number of fields ("length" of the field dictionary). */ - -@@ -1318,7 +1369,10 @@ type_to_type_object (struct type *type) - - type_obj = PyObject_New (type_object, &type_object_type); - if (type_obj) -- set_type (type_obj, type); -+ { -+ type_obj->type = type; -+ typy_link (type_obj); -+ } - - return (PyObject *) type_obj; - } -diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c -index 4ab782d..eed91b878 100644 ---- a/gdb/python/py-value.c -+++ b/gdb/python/py-value.c -@@ -29,6 +29,7 @@ - #include "expression.h" - #include "cp-abi.h" - #include "python.h" -+#include "observer.h" - - #ifdef HAVE_PYTHON - -@@ -1503,12 +1504,28 @@ gdbpy_is_value_object (PyObject *obj) - return PyObject_TypeCheck (obj, &value_object_type); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+python_types_mark_used (void) -+{ -+ value_object *iter; -+ -+ for (iter = values_in_python; iter; iter = iter->next) -+ type_mark_used (value_type (iter->value)); -+} -+#endif -+ - int - gdbpy_initialize_values (void) - { - if (PyType_Ready (&value_object_type) < 0) - return -1; - -+#if 0 -+ observer_attach_mark_used (python_types_mark_used); -+#endif - return gdb_pymodule_addobject (gdb_module, "Value", - (PyObject *) &value_object_type); - } diff --git a/gdb/python/python.c b/gdb/python/python.c -index 337c170..873c0dc 100644 +index 369a249..0f136a8 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c -@@ -67,6 +67,8 @@ static const char *gdbpy_should_print_stack = python_excp_message; +@@ -95,6 +95,8 @@ const struct extension_language_defn extension_language_python = #include "linespec.h" #include "source.h" #include "version.h" @@ -3960,8 +519,8 @@ index 337c170..873c0dc 100644 +#include "gdbthread.h" #include "target.h" #include "gdbthread.h" - #include "observer.h" -@@ -1116,6 +1118,56 @@ gdbpy_print_stack (void) + #include "interps.h" +@@ -1222,6 +1224,56 @@ gdbpy_print_stack (void) /* Return the current Progspace. There always is one. */ @@ -4018,7 +577,7 @@ index 337c170..873c0dc 100644 static PyObject * gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -1831,6 +1883,8 @@ static PyMethodDef GdbMethods[] = +@@ -1910,6 +1962,8 @@ static PyMethodDef GdbMethods[] = Evaluate command, a string, as a gdb CLI command. Optionally returns\n\ a Python String containing the output of the command if to_string is\n\ set to True." }, @@ -4028,3098 +587,18 @@ index 337c170..873c0dc 100644 "Return a gdb parameter's value" }, diff --git a/gdb/python/python.h b/gdb/python/python.h -index 96bf7c2..79ad6c9 100644 +index 9e99992..c776e59 100644 --- a/gdb/python/python.h +++ b/gdb/python/python.h -@@ -108,6 +108,8 @@ void eval_python_from_control_command (struct command_line *); +@@ -25,4 +25,6 @@ + /* This is all that python exports to gdb. */ + extern const struct extension_language_defn extension_language_python; - void source_python_script (FILE *file, const char *filename); - -+void run_python_script (int argc, char **argv); ++extern void run_python_script (int argc, char **argv); + - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, -diff --git a/gdb/stack.c b/gdb/stack.c -index 314e4da..d07a9c2 100644 ---- a/gdb/stack.c -+++ b/gdb/stack.c -@@ -537,6 +537,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, - stb = mem_fileopen (); - old_chain = make_cleanup_ui_file_delete (stb); - -+ /* Frame may be needed for check_typedef of TYPE_DYNAMIC. */ -+ make_cleanup_restore_selected_frame (); -+ select_frame (frame); -+ - if (func) - { - struct block *b = SYMBOL_BLOCK_VALUE (func); -diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp -index afc1475..7e94c49 100644 ---- a/gdb/testsuite/gdb.ada/packed_array.exp -+++ b/gdb/testsuite/gdb.ada/packed_array.exp -@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" { - # are. Observed with (FSF GNU Ada 4.5.3 20110124). - xfail $test - } -+ -re "= \\(\\)\[\r\n\]+$gdb_prompt $" { -+ # archer-jankratochvil-vla resolves it as a dynamic type resolved as an -+ # empty array [0..-1]. -+ # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref) -+ xfail $test -+ } - } - -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -new file mode 100644 -index 0000000..83faaf6 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S -@@ -0,0 +1,457 @@ -+ .file "x86_64-vla-pointer.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl foo -+ .type foo, @function -+foo: -+.LFB2: -+ .file 1 "x86_64-vla-pointer.c" -+ .loc 1 22 0 -+ pushq %rbp -+.LCFI0: -+ movq %rsp, %rbp -+.LCFI1: -+ subq $64, %rsp -+.LCFI2: -+ movl %edi, -36(%rbp) -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, -48(%rbp) -+ .loc 1 23 0 -+ movl -36(%rbp), %edx -+ movslq %edx,%rax -+ subq $1, %rax -+ movq %rax, -24(%rbp) -+ .loc 1 24 0 -+ movslq %edx,%rax -+ addq $15, %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ subq %rax, %rsp -+ movq %rsp, -56(%rbp) -+ movq -56(%rbp), %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ movq %rax, -56(%rbp) -+ movq -56(%rbp), %rax -+ movq %rax, -16(%rbp) -+ .loc 1 27 0 -+ movl $0, -4(%rbp) -+ jmp .L2 -+.L3: -+ .loc 1 28 0 -+ movl -4(%rbp), %esi -+ movl -4(%rbp), %eax -+ movl %eax, %ecx -+ movq -16(%rbp), %rdx -+ movslq %esi,%rax -+ movb %cl, (%rdx,%rax) -+ .loc 1 27 0 -+ addl $1, -4(%rbp) -+.L2: -+ movl -4(%rbp), %eax -+ cmpl -36(%rbp), %eax -+ jl .L3 -+ .loc 1 30 0 -+ .globl break_here -+break_here: -+ movq -16(%rbp), %rax -+ movb $0, (%rax) -+ movq -48(%rbp), %rsp -+ .loc 1 31 0 -+ leave -+ ret -+.LFE2: -+ .size foo, .-foo -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .quad .LFB2 -+ .quad .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+ .string "zR" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .uleb128 0x1 -+ .byte 0x3 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LFB2-.Ltext0 -+ .quad .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 8 -+ .quad .LCFI0-.Ltext0 -+ .quad .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 16 -+ .quad .LCFI1-.Ltext0 -+ .quad .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x76 -+ .sleb128 16 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_info -+.Ldebug_relative: -+ .long .Ldebug_end - .Ldebug_start -+.Ldebug_start: -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x8 -+ .uleb128 0x1 -+ .long .LASF2 -+ .byte 0x1 -+ .long .LASF3 -+ .long .LASF4 -+ .quad .Ltext0 -+ .quad .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .string "foo" -+ .byte 0x1 -+ .byte 0x16 -+ .byte 0x1 -+ .quad .LFB2 -+ .quad .LFE2 -+ .long .LLST0 -+ .long .Ltype_int - .Ldebug_relative -+ .uleb128 0x3 -+ .long .LASF5 -+ .byte 0x1 -+ .byte 0x15 -+ .long .Ltype_int - .Ldebug_relative -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -52 -+.Ltag_pointer: -+ .uleb128 0x4 -+ .byte 0x8 /* DW_AT_byte_size */ -+ .long .Ltag_array_type - .debug_info /* DW_AT_type */ -+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x18 -+#if 1 -+ .long .Ltag_pointer - .debug_info -+#else -+ /* Debugging only: Skip the typedef indirection. */ -+ .long .Ltag_array_type - .debug_info -+#endif -+ /* DW_AT_location: DW_FORM_block1: start */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -32 -+#if 0 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+ /* DW_AT_location: DW_FORM_block1: end */ -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x19 -+ .long .Ltype_int - .Ldebug_relative -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -20 -+ .byte 0x0 -+.Ltype_int: -+ .uleb128 0x7 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+.Ltag_array_type: -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .long .Ltype_char - .Ldebug_relative -+ .long .Ltype_ulong - .Ldebug_relative /* DW_AT_sibling: DW_FORM_ref4 */ -+1: /* DW_AT_data_location: DW_FORM_block1: start */ -+ .byte 2f - 3f /* length */ -+3: -+ .byte 0x97 /* DW_OP_push_object_address */ -+#if 1 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+2: /* DW_AT_data_location: DW_FORM_block1: end */ -+ .uleb128 0x9 -+ .long .Ltype_char - .Ldebug_relative /* DW_AT_type: DW_FORM_ref4 */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -40 -+ .byte 0x6 -+ .byte 0x0 -+.Ltype_ulong: -+ .uleb128 0xa -+ .byte 0x8 -+ .byte 0x7 -+.Ltype_char: -+ .uleb128 0xb -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF1 -+ .byte 0x0 -+.Ldebug_end: -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 /* .Ltag_pointer abbrev */ -+ .uleb128 0x0f /* DW_TAG_pointer_type */ -+ .byte 0x0 -+ .uleb128 0x0b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .uleb128 0x1 -+ .byte 0x1 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x1 /* DW_AT_sibling */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x50 /* DW_AT_data_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0x21 -+ .byte 0x0 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2f -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x16 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa8 -+ .long 0x2d -+ .string "foo" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x8 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .quad .Ltext0 -+ .quad .Letext0-.Ltext0 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "array" -+.LASF5: -+ .string "size" -+.LASF3: -+ .string "x86_64-vla-pointer.c" -+.LASF6: -+ .string "array_t" -+.LASF1: -+ .string "char" -+.LASF4: -+ .string "gdb.arch" -+.LASF2: -+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -new file mode 100644 -index 0000000..fe2c8f7 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c -@@ -0,0 +1,43 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+#if 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -new file mode 100644 -index 0000000..d243cf1 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp -@@ -0,0 +1,66 @@ -+# Copyright 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 . -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-pointer -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-pointer -+ return -1 -+} -+ -+gdb_breakpoint "break_here" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "first: whatis array" -+gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array" -+ -+gdb_test "whatis *array" "type = char \\\[26\\\]" "first: whatis *array" -+gdb_test "ptype *array" "type = char \\\[26\\\]" "first: ptype *array" -+ -+gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "second: whatis array" -+gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array" -+ -+gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array" -+gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array" -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -new file mode 100644 -index 0000000..66f7a39 ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S -@@ -0,0 +1,455 @@ -+ .file "x86_64-vla-typedef.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .text -+.Ltext0: -+.globl foo -+ .type foo, @function -+foo: -+.LFB2: -+ .file 1 "x86_64-vla-typedef.c" -+ .loc 1 22 0 -+ pushq %rbp -+.LCFI0: -+ movq %rsp, %rbp -+.LCFI1: -+ subq $64, %rsp -+.LCFI2: -+ movl %edi, -36(%rbp) -+ .loc 1 22 0 -+ movq %rsp, %rax -+ movq %rax, -48(%rbp) -+ .loc 1 23 0 -+ movl -36(%rbp), %edx -+ movslq %edx,%rax -+ subq $1, %rax -+ movq %rax, -24(%rbp) -+ .loc 1 24 0 -+ movslq %edx,%rax -+ addq $15, %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ subq %rax, %rsp -+ movq %rsp, -56(%rbp) -+ movq -56(%rbp), %rax -+ addq $15, %rax -+ shrq $4, %rax -+ salq $4, %rax -+ movq %rax, -56(%rbp) -+ movq -56(%rbp), %rax -+ movq %rax, -16(%rbp) -+ .loc 1 27 0 -+ movl $0, -4(%rbp) -+ jmp .L2 -+.L3: -+ .loc 1 28 0 -+ movl -4(%rbp), %esi -+ movl -4(%rbp), %eax -+ movl %eax, %ecx -+ movq -16(%rbp), %rdx -+ movslq %esi,%rax -+ movb %cl, (%rdx,%rax) -+ .loc 1 27 0 -+ addl $1, -4(%rbp) -+.L2: -+ movl -4(%rbp), %eax -+ cmpl -36(%rbp), %eax -+ jl .L3 -+ .loc 1 30 0 -+ .globl break_here -+break_here: -+ movq -16(%rbp), %rax -+ movb $0, (%rax) -+ movq -48(%rbp), %rsp -+ .loc 1 31 0 -+ leave -+ ret -+.LFE2: -+ .size foo, .-foo -+ .section .debug_frame,"",@progbits -+.Lframe0: -+ .long .LECIE0-.LSCIE0 -+.LSCIE0: -+ .long 0xffffffff -+ .byte 0x1 -+ .string "" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE0: -+.LSFDE0: -+ .long .LEFDE0-.LASFDE0 -+.LASFDE0: -+ .long .Lframe0 -+ .quad .LFB2 -+ .quad .LFE2-.LFB2 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE0: -+ .section .eh_frame,"a",@progbits -+.Lframe1: -+ .long .LECIE1-.LSCIE1 -+.LSCIE1: -+ .long 0x0 -+ .byte 0x1 -+ .string "zR" -+ .uleb128 0x1 -+ .sleb128 -8 -+ .byte 0x10 -+ .uleb128 0x1 -+ .byte 0x3 -+ .byte 0xc -+ .uleb128 0x7 -+ .uleb128 0x8 -+ .byte 0x90 -+ .uleb128 0x1 -+ .align 8 -+.LECIE1: -+.LSFDE1: -+ .long .LEFDE1-.LASFDE1 -+.LASFDE1: -+ .long .LASFDE1-.Lframe1 -+ .long .LFB2 -+ .long .LFE2-.LFB2 -+ .uleb128 0x0 -+ .byte 0x4 -+ .long .LCFI0-.LFB2 -+ .byte 0xe -+ .uleb128 0x10 -+ .byte 0x86 -+ .uleb128 0x2 -+ .byte 0x4 -+ .long .LCFI1-.LCFI0 -+ .byte 0xd -+ .uleb128 0x6 -+ .align 8 -+.LEFDE1: -+ .text -+.Letext0: -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .quad .LFB2-.Ltext0 -+ .quad .LCFI0-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 8 -+ .quad .LCFI0-.Ltext0 -+ .quad .LCFI1-.Ltext0 -+ .value 0x2 -+ .byte 0x77 -+ .sleb128 16 -+ .quad .LCFI1-.Ltext0 -+ .quad .LFE2-.Ltext0 -+ .value 0x2 -+ .byte 0x76 -+ .sleb128 16 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_info -+ .long .Ldebug_end - .Ldebug_start -+.Ldebug_start: -+ .value 0x2 -+ .long .Ldebug_abbrev0 -+ .byte 0x8 -+ .uleb128 0x1 -+ .long .LASF2 -+ .byte 0x1 -+ .long .LASF3 -+ .long .LASF4 -+ .quad .Ltext0 -+ .quad .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .string "foo" -+ .byte 0x1 -+ .byte 0x16 -+ .byte 0x1 -+ .quad .LFB2 -+ .quad .LFE2 -+ .long .LLST0 -+ .long 0x83 -+ .uleb128 0x3 -+ .long .LASF5 -+ .byte 0x1 -+ .byte 0x15 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -52 -+.Ltag_typedef: -+ .uleb128 0x4 -+ .long .LASF6 -+ .byte 0x1 -+ .byte 0x17 -+ .long .Ltag_array_type - .debug_info -+ .uleb128 0x5 /* Abbrev Number: 5 (DW_TAG_variable) */ -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x18 -+#if 1 -+ .long .Ltag_typedef - .debug_info -+#else -+ /* Debugging only: Skip the typedef indirection. */ -+ .long .Ltag_array_type - .debug_info -+#endif -+ /* DW_AT_location: DW_FORM_block1: start */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -32 -+#if 0 -+ .byte 0x6 /* DW_OP_deref */ -+#else -+ .byte 0x96 /* DW_OP_nop */ -+#endif -+ /* DW_AT_location: DW_FORM_block1: end */ -+ .uleb128 0x6 -+ .string "i" -+ .byte 0x1 -+ .byte 0x19 -+ .long 0x83 -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 -20 -+ .byte 0x0 -+ .uleb128 0x7 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+.Ltag_array_type: -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .long 0xa0 + (2f - 1f) /* DW_AT_type: DW_FORM_ref4 */ -+ .long 0x9d + (2f - 1f) /* DW_AT_sibling: DW_FORM_ref4 */ -+1: /* DW_AT_data_location: DW_FORM_block1: start */ -+ .byte 2f - 3f /* length */ -+3: -+ .byte 0x97 /* DW_OP_push_object_address */ -+ .byte 0x6 /* DW_OP_deref */ -+2: /* DW_AT_data_location: DW_FORM_block1: end */ -+ .uleb128 0x9 -+ .long 0x9d + (2b - 1b) /* DW_AT_type: DW_FORM_ref4 */ -+ .byte 0x3 -+ .byte 0x91 -+ .sleb128 -40 -+ .byte 0x6 -+ .byte 0x0 -+ .uleb128 0xa -+ .byte 0x8 -+ .byte 0x7 -+ .uleb128 0xb -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF1 -+ .byte 0x0 -+.Ldebug_end: -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0x6 -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x16 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0x34 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* Abbrev Number: 8 (DW_TAG_array_type) */ -+ .uleb128 0x1 -+ .byte 0x1 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x1 /* DW_AT_sibling */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x50 /* DW_AT_data_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 -+ .uleb128 0x21 -+ .byte 0x0 -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2f -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x16 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa8 -+ .long 0x2d -+ .string "foo" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x8 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .quad .Ltext0 -+ .quad .Letext0-.Ltext0 -+ .quad 0x0 -+ .quad 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF0: -+ .string "array" -+.LASF5: -+ .string "size" -+.LASF3: -+ .string "x86_64-vla-typedef.c" -+.LASF6: -+ .string "array_t" -+.LASF1: -+ .string "char" -+.LASF4: -+ .string "gdb.arch" -+.LASF2: -+ .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .ident "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -new file mode 100644 -index 0000000..b809c4e ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c -@@ -0,0 +1,43 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 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 0 -+ -+void -+foo (int size) -+{ -+ typedef char array_t[size]; -+ array_t array; -+ int i; -+ -+ for (i = 0; i < size; i++) -+ array[i] = i; -+ -+ array[0] = 0; /* break-here */ -+} -+ -+#else -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -+ -+#endif -diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -new file mode 100644 -index 0000000..b05411e ---- /dev/null -+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp -@@ -0,0 +1,64 @@ -+# Copyright 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 . -+ -+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate. -+ -+if ![istarget "x86_64-*-*"] then { -+ verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64." -+ return -+} -+ -+set testfile x86_64-vla-typedef -+set srcasmfile ${testfile}-foo.S -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o -+if { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested x86_64-vla-typedef -+ return -1 -+} -+ -+gdb_breakpoint "break_here" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "first: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array" -+ -+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'" -+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'" -+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'" -+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'" -+ -+gdb_continue_to_breakpoint "break_here" -+ -+gdb_test "whatis array" "type = array_t" "second: whatis array" -+ -+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array" -diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c -index 58be08c..04e36cd 100644 ---- a/gdb/testsuite/gdb.base/arrayidx.c -+++ b/gdb/testsuite/gdb.base/arrayidx.c -@@ -17,6 +17,13 @@ - - int array[] = {1, 2, 3, 4}; - -+#ifdef __GNUC__ -+struct -+ { -+ int a[0]; -+ } unbound; -+#endif -+ - int - main (void) - { -diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp -index 35454e3..6144d36 100644 ---- a/gdb/testsuite/gdb.base/arrayidx.exp -+++ b/gdb/testsuite/gdb.base/arrayidx.exp -@@ -49,4 +49,12 @@ gdb_test "print array" \ - "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ - "Print array with array-indexes on" - -- -+set test "p unbound.a == &unbound.a\[0\]" -+gdb_test_multiple $test $test { -+ -re " = 1\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" { -+ unsupported "$test (no GCC)" -+ } -+} -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c -new file mode 100644 -index 0000000..eeb7b85 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.c -@@ -0,0 +1,20 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+struct { -+ int field; -+} staticstruct = { 1 }; -diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp -new file mode 100644 -index 0000000..33c9e94 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp -@@ -0,0 +1,26 @@ -+# Copyright 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 . -+ -+set test internal-var-field-address -+set binfile ${test}.x -+if { [gdb_compile "${srcdir}/${subdir}/${test}.c" "[standard_output_file ${binfile}]" object {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test {set $varstruct = staticstruct} -+gdb_test {p $varstruct.field} " = 1" -diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c -new file mode 100644 -index 0000000..5750f68 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.c -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2011 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 -+ -+int -+main (int argc, char **argv) -+{ -+ char s[2 + argc]; -+ void (*f) (char *) = 0; -+ -+ memset (s, 0, sizeof (s)); -+ s[0] = 'X'; -+ -+ f (s); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp -new file mode 100644 -index 0000000..47736c7 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-frame.exp -@@ -0,0 +1,38 @@ -+# Copyright 2011 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 vla-frame -+set executable ${testfile} -+ -+if { [prepare_for_testing ${testfile}.exp ${executable}] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+set test "continue" -+gdb_test_multiple $test $test { -+ -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ untested ${testfile}.exp -+ return -+ } -+} -+ -+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*" -diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c -new file mode 100644 -index 0000000..c5d5ee0 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.c -@@ -0,0 +1,30 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 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 -+ -+int -+main (int argc, char **argv) -+{ -+ int array[argc]; -+ -+ array[0] = array[0]; -+ -+ abort (); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp -new file mode 100644 -index 0000000..24a608f ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla-overflow.exp -@@ -0,0 +1,109 @@ -+# Copyright 2008 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 . -+ -+# We could crash in: -+# #0 block_linkage_function (bl=0x0) at ../../gdb/block.c:69 -+# #1 in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97 -+# 97 framefunc = block_linkage_function (get_frame_block (frame, NULL)); -+# #2 in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496 -+# #3 in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156 -+# #4 dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206 -+# #5 in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430 -+# #6 in create_array_type (...) at ../../gdb/gdbtypes.c:840 -+# ... -+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292 -+# ... -+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273 -+ -+set testfile vla-overflow -+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+set f [open "|getconf PAGESIZE" "r"] -+gets $f pagesize -+close $f -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+if { [runto_main] < 0 } { -+ untested vla-overflow -+ return -1 -+} -+ -+# Get the GDB memory size when we stay at main. -+ -+proc memory_v_pages_get {} { -+ global pid_of_gdb pagesize -+ set fd [open "/proc/$pid_of_gdb/statm"] -+ gets $fd line -+ close $fd -+ # number of pages of virtual memory -+ scan $line "%d" drs -+ return $drs -+} -+ -+set pages_found [memory_v_pages_get] -+ -+# s390x with glibc-debuginfo.s390x installed used approx. 16MB. -+set mb_reserve 40 -+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve" -+set kb_found [expr $pages_found * $pagesize / 1024] -+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024] -+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit" -+ -+# Create the ulimit wrapper. -+set f [open $shfile "w"] -+puts $f "#! /bin/sh" -+puts $f "ulimit -v $kb_permit" -+puts $f "exec $GDB \"\$@\"" -+close $f -+remote_exec host "chmod +x $shfile" -+ -+gdb_exit -+set GDBold $GDB -+set GDB "$shfile" -+gdb_start -+set GDB $GDBold -+ -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+set pid_of_gdb [exp_pid -i [board_info host fileid]] -+ -+# Check the size again after the second run. -+# We must not stop in main as it would cache `array' and never crash later. -+ -+gdb_run_cmd -+ -+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()" -+ -+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -+ -+# `abort' can get expressed as `*__GI_abort'. -+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()" -+ -+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]" -diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c -new file mode 100644 -index 0000000..e1f3ed1 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.c -@@ -0,0 +1,55 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2008 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 -+ -+void -+marker (void) -+{ -+} -+ -+void -+bar (char *a, char *b, char *c, int size) -+{ -+ memset (a, '1', size); -+ memset (b, '2', size); -+ memset (c, '3', 48); -+} -+ -+void -+foo (int size) -+{ -+ char temp1[size]; -+ char temp3[48]; -+ -+ temp1[size - 1] = '\0'; -+ { -+ char temp2[size]; -+ -+ bar (temp1, temp2, temp3, size); -+ -+ marker (); /* break-here */ -+ } -+} -+ -+int -+main (void) -+{ -+ foo (26); -+ foo (78); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp -new file mode 100644 -index 0000000..5da7378 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/vla.exp -@@ -0,0 +1,62 @@ -+# Copyright 2008 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 vla -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto_main] { -+ untested vla -+ return -1 -+} -+ -+gdb_breakpoint [gdb_get_line_number "break-here"] -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "first: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "first: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "first: print temp1" -+gdb_test "p temp2" " = '2' " "first: print temp2" -+gdb_test "p temp3" " = '3' " "first: print temp3" -+ -+gdb_continue_to_breakpoint "break-here" -+ -+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "second: whatis temp1" -+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "second: whatis temp2" -+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3" -+ -+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1" -+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2" -+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3" -+ -+gdb_test "p temp1" " = '1' " "second: print temp1" -+gdb_test "p temp2" " = '2' " "second: print temp2" -+gdb_test "p temp3" " = '3' " "second: print temp3" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -new file mode 100644 -index 0000000..aac3baa ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S -@@ -0,0 +1,246 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ 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 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 . */ -+ -+/* Debug information */ -+ -+/* We will `break *main' at the very first instruction. */ -+#define main_length 1 -+ -+ .section .data -+vardata: -+ /* See DW_OP_lit3 + 1 (0-based). */ -+ .string "seennotseen" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .4byte .Lproducer /* DW_AT_producer */ -+ /* Use C++ to exploit a bug in parsing DW_AT_name "". */ -+ .byte 4 /* DW_AT_language (C++) - */ -+ .4byte main /* DW_AT_low_pc */ -+ .byte main_length /* DW_AT_high_pc */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llen_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+.Larrayb_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subrange_type */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .4byte .Llenb_var-.Lcu1_begin /* DW_AT_upper_bound */ -+ .byte 0 /* End of children of die */ -+ -+ /* DW_AT_upper_bound is referencing register. */ -+.Larrayreg_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type with block */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 2f - 1f /* DW_AT_upper_bound */ -+1: .byte 0x50 /* DW_OP_reg0 */ -+2: -+ .byte 0 /* End of children of die */ -+ -+.Luint_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Luint_str /* DW_AT_name */ -+ .byte 4 /* DW_AT_byte_size */ -+ .byte 7 /* DW_AT_encoding */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .4byte .Lchar_str /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+.Llen_var: -+ .uleb128 5 /* Abbrev: DW_TAG_variable artificial */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ .4byte .Llen_loclist-.Lloclist /* DW_AT_location */ -+ -+ /* optimized-out variable for b_string. */ -+.Llenb_var: -+ .uleb128 7 /* Abbrev: DW_TAG_variable artificial no DW_AT_location */ -+ .byte 1 /* DW_AT_artificial */ -+ .4byte .Luint_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "a_string" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing an optimized-out variable. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "b_string" /* DW_AT_name */ -+ .4byte .Larrayb_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ /* DW_AT_upper_bound is referencing register. */ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .string "reg_string" /* DW_AT_name */ -+ .4byte .Larrayreg_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_loc -+.Lloclist: -+.Llen_loclist: -+ .4byte 0 # Location list begin address -+ .4byte main_length # Location list end address -+ .value 2f-1f # Location expression size -+1: .byte 0x33 # DW_OP_lit3 -+ .byte 0x9f # DW_OP_stack_value -+2: -+ .quad 0x0 # Location list terminator begin (*.LLST2) -+ .quad 0x0 # Location list terminator end (*.LLST2) -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 5 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x02 /* DW_AT_location */ -+ .uleb128 0x06 /* DW_FORM_data4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 7 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0x0c /* DW_FORM_flag */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type with block */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ -+/* String table */ -+ .section .debug_str -+.Lproducer: -+ .string "GNU C 3.3.3" -+.Lchar_str: -+ .string "char" -+.Luint_str: -+ .string "unsigned int" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -new file mode 100644 -index 0000000..815ed93 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp -@@ -0,0 +1,54 @@ -+# 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 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 printing variable with dynamic bounds which reference a different -+# (artificial in the GCC case) variable containing loclist as its location. -+# This testcase uses value (not address) of the referenced variable: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762 -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile dw2-bound-loclist -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } { -+ return -1 -+} -+ -+# Verify it behaves at least as an unbound array without inferior. -+ -+gdb_test "p a_string" { = 0x[0-9a-f]+ "seennotseen"} -+gdb_test "ptype a_string" {type = char \[\]} -+ -+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main. -+if ![runto "*main"] { -+ return -1 -+} -+ -+gdb_test "p a_string" { = "seen"} -+gdb_test "ptype a_string" {type = char \[4\]} -+ -+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"} -+gdb_test "ptype b_string" {type = char \[\]} -+ -+# The register contains unpredictable value - the array size. -+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -new file mode 100644 -index 0000000..1f02d90 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c -@@ -0,0 +1,42 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004 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. */ -+ -+ -+/* The function `func1' traced into must have debug info on offset > 0; -+ (DW_UNSND (attr)). This is the reason of `func0' existence. */ -+ -+void -+func0(int a, int b) -+{ -+} -+ -+/* `func1' being traced into must have some arguments to dump. */ -+ -+void -+func1(int a, int b) -+{ -+ func0 (a,b); -+} -+ -+int -+main(void) -+{ -+ func1 (1, 2); -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -new file mode 100644 -index 0000000..1c6e84a ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp -@@ -0,0 +1,79 @@ -+# 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. -+ -+# Minimal DWARF-2 unit test -+ -+# This test can only be run on targets which support DWARF-2. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-stripped" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile}.x -+ -+remote_exec build "rm -f ${binfile}" -+ -+# get the value of gcc_compiled -+if [get_compiler_info ${binfile}] { -+ return -1 -+} -+ -+# This test can only be run on gcc as we use additional_flags=FIXME -+if {$gcc_compiled == 0} { -+ return 0 -+} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } { -+ return -1 -+} -+ -+remote_exec build "objcopy -R .debug_loc ${binfile}" -+set strip_output [remote_exec build "objdump -h ${binfile}"] -+ -+set test "stripping test file preservation" -+if [ regexp ".debug_info " $strip_output] { -+ pass "$test (.debug_info preserved)" -+} else { -+ fail "$test (.debug_info got also stripped)" -+} -+ -+set test "stripping test file functionality" -+if [ regexp ".debug_loc " $strip_output] { -+ fail "$test (.debug_loc still present)" -+} else { -+ pass "$test (.debug_loc stripped)" -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# For C programs, "start" should stop in main(). -+ -+gdb_test "start" \ -+ ".*main \\(\\) at .*" \ -+ "start" -+gdb_test "step" \ -+ "func.* \\(.*\\) at .*" \ -+ "step" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -new file mode 100644 -index 0000000..5fcdd84 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S -@@ -0,0 +1,83 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+/* Debug information */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "dw2-struct-member-data-location.c\0" /* DW_AT_name */ -+ .ascii "GNU C 4.3.2\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ -+.Ltype_uchar: -+ .uleb128 2 /* Abbrev: DW_TAG_structure_type */ -+ .ascii "some_struct\0" /* DW_AT_name */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_member */ -+ .ascii "field\0" /* DW_AT_name */ -+ .byte 0 /* DW_AT_data_member_location */ -+ -+ .byte 0 /* End of children of some_struct */ -+ -+ .byte 0 /* End of children of CU */ -+ -+.Lcu1_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x13 /* DW_TAG_structure_type */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x0d /* DW_TAG_member */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x38 /* DW_AT_data_member_location */ -+ .uleb128 0x0b /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -new file mode 100644 -index 0000000..bc35209 ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp -@@ -0,0 +1,37 @@ -+# Copyright 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 . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-struct-member-data-location" -+set srcfile ${testfile}.S -+set binfile ${testfile}.x -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "[standard_output_file ${binfile}]" object {nodebug}] != "" } { -+ return -1 -+} -+ -+clean_restart $binfile -+ -+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}" -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -new file mode 100644 -index 0000000..9dbbf3c ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S -@@ -0,0 +1,121 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+/* Debug information */ -+ -+ .section .data -+vardata: -+ .rept 129 -+ .ascii "x" -+ .endr -+ .ascii "UNSEEN\0" -+ -+ .section .debug_info -+.Lcu1_begin: -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 4 /* Pointer Size (in bytes) */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 2 /* DW_AT_language (C) - */ -+ -+.Larray_type: -+ .uleb128 2 /* Abbrev: DW_TAG_array_type */ -+ .4byte .Lchar_type-.Lcu1_begin /* DW_AT_type */ -+ -+ .uleb128 8 /* Abbrev: DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0 /* DW_AT_lower_bound */ -+ .byte 128 /* DW_AT_upper_bound */ -+ -+ .byte 0 /* End of children of die */ -+ -+.Lchar_type: -+ .uleb128 4 /* Abbrev: DW_TAG_base_type */ -+ .ascii "char\0" /* DW_AT_name */ -+ .byte 1 /* DW_AT_byte_size */ -+ .byte 6 /* DW_AT_encoding */ -+ -+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */ -+ .ascii "notype_string\0" /* DW_AT_name */ -+ .4byte .Larray_type-.Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte vardata /* */ -+2: -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* has_children */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x1 /* TAG: DW_TAG_array_type */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 6 /* Abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* no_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 8 /* Abbrev code */ -+ .uleb128 0x21 /* DW_TAG_subrange_type without DW_AT_type */ -+ .byte 0x0 /* no children */ -+ .uleb128 0x22 /* DW_AT_lower_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x2f /* DW_AT_upper_bound */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -new file mode 100644 -index 0000000..cec673c ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp -@@ -0,0 +1,39 @@ -+# Copyright 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 . -+load_lib dwarf.exp -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=806920 -+# read_subrange_type reinitialization -+# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without -+# specified DW_AT_type, present only in XLF produced code. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+set testfile dw2-subrange-no-type -+set srcfile ${testfile}.S -+set executable ${testfile}.x -+set binfile [standard_output_file ${executable}] -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { -+ return -1 -+} -+ -+clean_restart $executable -+ -+gdb_test "ptype notype_string" {type = char \[129\]} -+gdb_test "p notype_string" " = 'x' " -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -new file mode 100644 -index 0000000..d7b8bea ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp -@@ -0,0 +1,42 @@ -+# Copyright 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 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. Array element stride must not be -+# specified in the number of elements but in a number of bytes instead. -+# Original problem: -+# (gdb) p c40pt(1) -+# $1 = '0-hello', ' ' -+# (gdb) p c40pt(2) -+# warning: Fortran array stride not divisible by the element size -+ -+set testfile dwarf-stride -+set srcfile ${testfile}.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 "break-here"] -+gdb_continue_to_breakpoint "break-here" ".*break-here.*" -+gdb_test "p c40pt(1)" " = '0-hello.*" -+gdb_test "p c40pt(2)" " = '1-hello.*" -diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -new file mode 100644 -index 0000000..e492b3a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90 -@@ -0,0 +1,40 @@ -+! Copyright 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 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. -+! -+! File written by Alan Matsuoka. -+ -+program repro -+ -+ type small_stride -+ character*40 long_string -+ integer small_pad -+ end type small_stride -+ -+ type(small_stride), dimension (20), target :: unpleasant -+ character*40, pointer, dimension(:):: c40pt -+ -+ integer i -+ -+ do i = 0,19 -+ unpleasant(i+1)%small_pad = i+1 -+ unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello' -+ end do -+ -+ c40pt => unpleasant%long_string -+ -+ print *, c40pt ! break-here -+ -+end program repro -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 -index 0000000..261ce17 ---- /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 -index 0000000..e5a82ee ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp -@@ -0,0 +1,37 @@ -+# 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} -+ -+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 -index 0000000..2bc637d ---- /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/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp -new file mode 100644 -index 0000000..e79e94a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.exp -@@ -0,0 +1,152 @@ -+# Copyright 2007 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for dynamically -+# allocated Fortran arrays. -+# It depends on the GCC dynamic Fortran arrays DWARF support: -+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244 -+ -+set testfile "dynamic" -+set srcfile ${testfile}.f90 -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "varx-init"] -+gdb_continue_to_breakpoint "varx-init" -+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx unallocated" -+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx unallocated" -+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) unallocated" -+gdb_test "p varx(1,5,17)=1" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17)=1 unallocated" -+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) unallocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-allocated"] -+gdb_continue_to_breakpoint "varx-allocated" -+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated" -+ -+gdb_breakpoint [gdb_get_line_number "varx-filled"] -+gdb_continue_to_breakpoint "varx-filled" -+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6" -+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7" -+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8" -+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9" -+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. -+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv unassociated" -+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv unassociated" -+ -+set test "output varx" -+gdb_test_multiple $test $test { -+ -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_breakpoint [gdb_get_line_number "varv-associated"] -+gdb_continue_to_breakpoint "varv-associated" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated" -+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. -+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated" -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated" -+# Intel Fortran Compiler 10.1.008 uses the pointer type. -+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated" -+ -+gdb_breakpoint [gdb_get_line_number "varv-filled"] -+gdb_continue_to_breakpoint "varv-filled" -+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled" -+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled" -+ -+gdb_breakpoint [gdb_get_line_number "varv-deassociated"] -+gdb_continue_to_breakpoint "varv-deassociated" -+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type. -+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated" -+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated" -+gdb_test "p varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\." -+gdb_test "ptype varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\." -+ -+gdb_breakpoint [gdb_get_line_number "varx-deallocated"] -+gdb_continue_to_breakpoint "varx-deallocated" -+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx deallocated" -+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx deallocated" -+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated" -+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) deallocated" -+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) deallocated" -+ -+gdb_breakpoint [gdb_get_line_number "vary-passed"] -+gdb_continue_to_breakpoint "vary-passed" -+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...) -+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "vary-filled"] -+gdb_continue_to_breakpoint "vary-filled" -+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)" -+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8" -+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9" -+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10" -+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)" -+ -+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"] -+gdb_continue_to_breakpoint "varw-almostfilled" -+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)" -+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1" -+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...) -+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled" -+# "up" works with GCC but other Fortran compilers may copy the values into the -+# outer function only on the exit of the inner function. -+# We need both variants as depending on the arch we optionally may still be -+# executing the caller line or not after `finish'. -+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))" -+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3" -+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6" -+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5" -+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1" -+ -+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"] -+gdb_continue_to_breakpoint "varz-almostfilled" -+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not. -+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" -+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7) -+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7. -+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?" -+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)" -+gdb_test "p varz(3)" "\\$\[0-9\]* = 4" -+# maps to foo::vary(1,1) -+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8" -+# maps to foo::vary(2,2) -+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" -+# maps to foo::vary(1,3) -+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" -diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90 -new file mode 100644 -index 0000000..0f43564 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/dynamic.f90 -@@ -0,0 +1,98 @@ -+! Copyright 2007 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 baz -+ real, target, allocatable :: varx (:, :, :) -+ real, pointer :: varv (:, :, :) -+ real, target :: varu (1, 2, 3) -+ logical :: l -+ allocate (varx (1:6, 5:15, 17:28)) ! varx-init -+ l = allocated (varx) -+ varx(:, :, :) = 6 ! varx-allocated -+ varx(1, 5, 17) = 7 -+ varx(2, 6, 18) = 8 -+ varx(6, 15, 28) = 9 -+ varv => varx ! varx-filled -+ l = associated (varv) -+ varv(3, 7, 19) = 10 ! varv-associated -+ varv => null () ! varv-filled -+ l = associated (varv) -+ deallocate (varx) ! varv-deassociated -+ l = allocated (varx) -+ varu(:, :, :) = 10 ! varx-deallocated -+ allocate (varv (1:6, 5:15, 17:28)) -+ l = associated (varv) -+ varv(:, :, :) = 6 -+ varv(1, 5, 17) = 7 -+ varv(2, 6, 18) = 8 -+ varv(6, 15, 28) = 9 -+ deallocate (varv) -+ l = associated (varv) -+ varv => varu -+ varv(1, 1, 1) = 6 -+ varv(1, 2, 3) = 7 -+ l = associated (varv) -+end subroutine baz -+subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ vary(:, :) = 4 ! vary-passed -+ vary(1, 1) = 8 -+ vary(2, 2) = 9 -+ vary(1, 3) = 10 -+ varw(:, :, :) = 5 ! vary-filled -+ varw(1, 1, 1) = 6 -+ varw(2, 2, 2) = 7 ! varw-almostfilled -+end subroutine foo -+subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ varz(1:3) = 4 -+ varz(2) = 5 ! varz-almostfilled -+ vart(2,7) = vart(2,7) -+end subroutine bar -+program test -+ interface -+ subroutine foo (vary, varw) -+ real :: vary (:, :) -+ real :: varw (:, :, :) -+ end subroutine -+ end interface -+ interface -+ subroutine bar (varz, vart) -+ real :: varz (*) -+ real :: vart (2:11, 7:*) -+ end subroutine -+ end interface -+ real :: x (10, 10), y (5), z(8, 8, 8) -+ x(:,:) = 1 -+ y(:) = 2 -+ z(:,:,:) = 3 -+ call baz -+ call foo (x, z(2:6, 4:7, 6:8)) -+ call bar (y, x) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (1, 3) .ne. 10) call abort -+ if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort -+ if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort -+ call foo (transpose (x), z) -+ if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort -+ if (x (3, 1) .ne. 10) call abort -+end -diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp -new file mode 100644 -index 0000000..39de2c4 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.exp -@@ -0,0 +1,59 @@ -+# Copyright 2008 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. -+ -+# This file was written by Jan Kratochvil . -+ -+# This file is part of the gdb testsuite. It contains tests for Fortran -+# strings with dynamic length. -+ -+set testfile "string" -+set srcfile ${testfile}.f90 -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } { -+ untested "Couldn't compile ${srcfile}" -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+if ![runto MAIN__] then { -+ perror "couldn't run to breakpoint MAIN__" -+ continue -+} -+ -+gdb_breakpoint [gdb_get_line_number "var-init"] -+gdb_continue_to_breakpoint "var-init" -+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)" -+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)" -+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)" -+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)" -+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value." -+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)" -+gdb_test "p c" "\\$\[0-9\]* = 'c'" -+gdb_test "p d" "\\$\[0-9\]* = 'd '" -+gdb_test "p e" "\\$\[0-9\]* = 'g '" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\( 'h ', 'h ', 'h ', 'h ', 'h ', 'h ', 'h '\\) \\)" -+gdb_test "p *e" "Attempt to take contents of a non-pointer value." -+gdb_test "p *f" "Attempt to take contents of a non-pointer value." -+ -+gdb_breakpoint [gdb_get_line_number "var-finish"] -+gdb_continue_to_breakpoint "var-finish" -+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" -+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" -diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90 -new file mode 100644 -index 0000000..226dc5d ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/string.f90 -@@ -0,0 +1,37 @@ -+! Copyright 2008 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 (e, f) -+ character (len=1) :: c -+ character (len=8) :: d -+ character (len=*) :: e -+ character (len=*) :: f (1:7, 8:10) -+ c = 'c' -+ d = 'd' -+ e = 'e' ! var-init -+ f = 'f' -+ f(1,9) = 'f2' -+ c = 'c' ! var-finish -+end subroutine foo -+ character (len=4) :: g, h (1:7, 8:10) -+ g = 'g' -+ h = 'h' -+ call foo (g, h) -+end -diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp -new file mode 100644 -index 0000000..c819e23 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.exp -@@ -0,0 +1,60 @@ -+# Copyright 2011 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_fortran_tests] } { return -1 } -+ -+set testfile "subrange" -+set srcfile ${testfile}.f90 -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } { -+ return -1 -+} -+ -+if ![runto MAIN__] { -+ perror "Couldn't run to MAIN__" -+ continue -+} -+ -+# Depending on the compiler version being used, the name of the 4-byte integer -+# and real types can be printed differently. For instance, gfortran-4.1 uses -+# "int4" whereas gfortran-4.3 uses "int(kind=4)". -+set int4 "(int4|integer\\(kind=4\\))" -+ -+gdb_breakpoint [gdb_get_line_number "break-static"] -+gdb_continue_to_breakpoint "break-static" ".*break-static.*" -+ -+foreach var {a alloc ptr} { -+ global pf_prefix -+ set old_prefix $pf_prefix -+ lappend pf_prefix "$var:" -+ -+ gdb_test "p $var (2, 2:3)" { = \(22, 32\)} -+ gdb_test "p $var (2:3, 3)" { = \(32, 33\)} -+ gdb_test "p $var (1, 2:)" { = \(21, 31\)} -+ gdb_test "p $var (2, :2)" { = \(12, 22\)} -+ gdb_test "p $var (3, 2:2)" { = \(23\)} -+ gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)" -+ gdb_test "p $var (4, :)" { = \(14, 24, 34\)} -+ gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)} -+ gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)" -+ gdb_test "p $var (:)" "Wrong number of subscripts" -+ gdb_test "p $var (:, :, :)" "Wrong number of subscripts" -+ -+ set pf_prefix $old_prefix -+} -+ -+gdb_test_no_output {set $a=a} -+delete_breakpoints -+gdb_unload -+gdb_test {p $a (3, 2:2)} { = \(23\)} -diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90 -new file mode 100644 -index 0000000..4747ea9 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/subrange.f90 -@@ -0,0 +1,28 @@ -+! Copyright 2011 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 test -+ integer, target :: a (4, 3) -+ integer, allocatable :: alloc (:, :) -+ integer, pointer :: ptr (:, :) -+ do 1 i = 1, 4 -+ do 1 j = 1, 3 -+ a (i, j) = j * 10 + i -+1 continue -+ allocate (alloc (4, 3)) -+ alloc = a -+ ptr => a -+ write (*,*) a ! break-static -+end + #endif /* GDB_PYTHON_H */ diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index 1d02779..f9f5be4 100644 +index 91142fe..724679f 100644 --- a/gdb/testsuite/gdb.gdb/selftest.exp +++ b/gdb/testsuite/gdb.gdb/selftest.exp @@ -92,6 +92,10 @@ proc do_steps_and_nexts {} { @@ -7133,400 +612,6 @@ index 1d02779..f9f5be4 100644 -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" { set description "next over make_command_stats_cleanup and everything it calls" set command "next" -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -new file mode 100644 -index 0000000..ebced3c ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c -@@ -0,0 +1,26 @@ -+/* Copyright 2011 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 . */ -+ -+int -+main (int argc, char **argv) -+{ -+ char vla[argc]; -+ -+ vla[0] = 0; /* break-here */ -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -new file mode 100644 -index 0000000..88326c0 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp -@@ -0,0 +1,57 @@ -+# Copyright 2011 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 . -+ -+load_lib mi-support.exp -+set MIFLAGS "-i=mi2" -+ -+gdb_exit -+if [mi_gdb_start] { -+ continue -+} -+ -+set testfile "mi2-var-stale-type" -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} { -+ return -1 -+} -+ -+mi_delete_breakpoints -+mi_gdb_reinitialize_dir $srcdir/$subdir -+mi_gdb_load ${binfile} -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \ -+ {\^done} \ -+ "maintenance set internal-error quit yes" -+ -+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \ -+ {\^done} \ -+ "maintenance set internal-error corefile yes" -+ -+set line [gdb_get_line_number "break-here"] -+set func "main" -+ -+mi_gdb_test "-break-insert -t $srcfile:$line" \ -+ "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",fullname=\".*\",line=\"$line\",\[^\r\n\]*,original-location=\".*\"\}" \ -+ "breakpoint at $func" -+ -+if { [mi_run_cmd] < 0 } { -+ return -1 -+} -+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla" -+ -+mi_create_varobj "vla" "vla" "create local variable vla" -+ -+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *" -diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c -new file mode 100644 -index 0000000..729f457 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register-func.c -@@ -0,0 +1,22 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+int -+func (int *arr) -+{ -+ return arr[0]; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c -new file mode 100644 -index 0000000..3090e7e ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.c -@@ -0,0 +1,28 @@ -+/* This file is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+extern int func (int *arr); -+ -+int -+main (void) -+{ -+ int arr[] = { 42 }; -+ -+ func (arr); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp -new file mode 100644 -index 0000000..f2de718 ---- /dev/null -+++ b/gdb/testsuite/gdb.opt/array-from-register.exp -@@ -0,0 +1,33 @@ -+# Copyright 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 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. -+# -+# This file is part of the gdb testsuite. -+ -+if { [prepare_for_testing array-from-register.exp "array-from-register" \ -+ {array-from-register.c array-from-register-func.c} \ -+ {debug optimize=-O2}] } { -+ return -1 -+} -+ -+if ![runto func] then { -+ return -1 -+} -+ -+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+" -+ -+# Seen regression: -+# Address requested for identifier "arr" which is in register $rdi -+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" -diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp -new file mode 100644 -index 0000000..ccc6e1e ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.exp -@@ -0,0 +1,104 @@ -+# Copyright 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 . -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+load_lib "pascal.exp" -+ -+set testfile "arrays" -+set srcfile ${testfile}.pas -+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT -+ -+# These tests only work with fpc, using the -gw3 compile-option -+pascal_init -+if { $pascal_compiler_is_fpc != 1 } { -+ return -1 -+} -+ -+# Detect if the fpc version is below 2.3.0 -+set fpc_generates_dwarf_for_dynamic_arrays 1 -+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))} { -+ set fpc_generates_dwarf_for_dynamic_arrays 0 -+} -+ -+ -+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } { -+ return -1 -+} -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] -+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] -+ -+ -+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } { -+ pass "setting breakpoint 1" -+} -+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } { -+ pass "setting breakpoint 2" -+} -+ -+# Verify that "start" lands inside the right procedure. -+if { [gdb_start_cmd] < 0 } { -+ untested start -+ return -1 -+} -+ -+gdb_test "" ".* at .*${srcfile}.*" "start" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint" -+ -+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type" -+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer" -+ -+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint" -+ -+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char" -+gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type" -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string" -+ -+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} { -+ setup_xfail "*-*-*" -+} -+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char" -+ -diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas -new file mode 100644 -index 0000000..295602d ---- /dev/null -+++ b/gdb/testsuite/gdb.pascal/arrays.pas -@@ -0,0 +1,82 @@ -+{ -+ Copyright 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 . -+} -+ -+program arrays; -+ -+{$mode objfpc}{$h+} -+ -+uses sysutils; -+ -+type TStatArrInt= array[0..11] of integer; -+ TDynArrInt= array of integer; -+ TStatArrStr= array[0..12] of string; -+ TDynArrStr= array of string; -+ TDynArrChar = array of char; -+ TStatArrChar = array [0..11] of char; -+ -+ TStat2dArrInt = array[0..11,0..4] of integer; -+ -+var StatArrInt: TStatArrInt; -+ StatArrInt_: Array[0..11] of integer; -+ DynArrInt: TDynArrInt; -+ DynArrInt_: Array of integer; -+ StatArrStr: TStatArrStr; -+ DynArrStr: TDynArrStr; -+ StatArrChar: TStatArrChar; -+ DynArrChar: TDynArrChar; -+ -+ Stat2dArrInt: TStat2dArrInt; -+ -+ s: string; -+ -+ i,j : integer; -+ -+begin -+ for i := 0 to 11 do -+ begin -+ StatArrInt[i]:= i+50; -+ StatArrInt_[i]:= i+50; -+ StatArrChar[i]:= chr(ord('a')+i); -+ for j := 0 to 4 do -+ Stat2dArrInt[i,j]:=i+j; -+ end; -+ writeln(StatArrInt_[0]); -+ writeln(StatArrInt[0]); { set breakpoint 1 here } -+ writeln(StatArrChar[0]); -+ writeln(Stat2dArrInt[0,0]); -+ -+ setlength(DynArrInt,13); -+ setlength(DynArrInt_,13); -+ setlength(DynArrStr,13); -+ setlength(DynArrChar,13); -+ for i := 0 to 12 do -+ begin -+ DynArrInt[i]:= i+50; -+ DynArrInt_[i]:= i+50; -+ DynArrChar[i]:= chr(ord('a')+i); -+ StatArrStr[i]:='str'+inttostr(i); -+ DynArrStr[i]:='dstr'+inttostr(i); -+ end; -+ writeln(DynArrInt_[1]); -+ writeln(DynArrInt[1]); -+ writeln(DynArrStr[1]); -+ writeln(StatArrStr[1]); -+ writeln(DynArrChar[1]); -+ -+ s := 'test'#0'string'; -+ writeln(s); { set breakpoint 2 here } -+end. diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp index 3517824..4fa2bd8 100644 --- a/gdb/testsuite/gdb.python/py-frame.exp @@ -7538,7 +623,7 @@ index 3517824..4fa2bd8 100644 + +gdb_test "python print ('result = %s' % (f0.block ()))" "" "test Frame.block" diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp -index ed332db..06466ec 100644 +index 13433fd..b146165 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -385,6 +385,15 @@ proc test_value_after_death {} { @@ -7557,7 +642,7 @@ index ed332db..06466ec 100644 # 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 @@ test_value_in_inferior +@@ -514,6 +523,7 @@ test_value_in_inferior test_inferior_function_call test_lazy_strings test_value_after_death @@ -7565,618 +650,3 @@ index ed332db..06466ec 100644 # Test either C or C++ values. -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 2713ddf..533b81b 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -150,6 +150,11 @@ proc gdb_unload {} { - send_gdb "y\n" - exp_continue - } -+ -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\ -+ { send_gdb "y\n" -+ verbose "\t\tUnloading symbols for program being debugged" -+ exp_continue -+ } - -re "Discard symbol table from .*y or n.*$" { - send_gdb "y\n" - exp_continue -diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp -index 1b494ee..3bb8ad9 100644 ---- a/gdb/testsuite/lib/pascal.exp -+++ b/gdb/testsuite/lib/pascal.exp -@@ -37,6 +37,9 @@ proc pascal_init {} { - global pascal_compiler_is_fpc - global gpc_compiler - global fpc_compiler -+ global fpcversion_major -+ global fpcversion_minor -+ global fpcversion_release - global env - - if { $pascal_init_done == 1 } { -@@ -64,6 +67,20 @@ proc pascal_init {} { - set pascal_compiler_is_fpc 1 - verbose -log "Free Pascal compiler found" - } -+ -+ # Detect the fpc-version -+ if { $pascal_compiler_is_fpc == 1 } { -+ set fpcversion_major 1 -+ set fpcversion_minor 0 -+ set fpcversion_release 0 -+ set fpcversion [ remote_exec host $fpc_compiler "-iV" ] -+ if [regexp {.*([0-9]+)\.([0-9]+)\.([0-9]+).?} $fpcversion] { -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\1} fpcversion_major -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\2} fpcversion_minor -+ regsub {.*([0-9]+)\.([0-9]+)\.([0-9]+).?\n?.?} $fpcversion {\3} fpcversion_release -+ } -+ verbose -log "Freepascal version: $fpcversion_major.$fpcversion_minor.$fpcversion_release" -+ } - } - set pascal_init_done 1 - } -diff --git a/gdb/top.c b/gdb/top.c -index d068450..e2b4110 100644 ---- a/gdb/top.c -+++ b/gdb/top.c -@@ -331,6 +331,9 @@ prepare_execute_command (void) - - mark = value_mark (); - cleanup = make_cleanup_value_free_to_mark (mark); -+#if 0 -+ free_all_types (); -+#endif - - /* With multiple threads running while the one we're examining is - stopped, the dcache can get stale without us being able to detect -diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index 09993dd..9fcb3b3 100644 ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c -@@ -34,6 +34,7 @@ - #include - #include "exceptions.h" - #include "valprint.h" -+#include "dwarf2loc.h" - #include - #include - #include "cli/cli-utils.h" -@@ -363,6 +364,9 @@ void - type_print (struct type *type, const char *varstring, struct ui_file *stream, - int show) - { -+ if (show >= 0 && current_language->la_language != language_ada) -+ type = check_typedef (type); -+ - LA_PRINT_TYPE (type, varstring, stream, show, 0, &default_ptype_flags); - } - -@@ -410,6 +414,7 @@ whatis_exp (char *exp, int show) - struct value_print_options opts; - struct type_print_options flags = default_ptype_flags; - -+ /* Required at least for the object_address_set call. */ - old_chain = make_cleanup (null_cleanup, NULL); - - if (exp) -@@ -457,6 +462,7 @@ whatis_exp (char *exp, int show) - else - val = access_value_history (0); - -+ object_address_set (value_raw_address (val)); - type = value_type (val); - - get_user_print_options (&opts); -diff --git a/gdb/utils.c b/gdb/utils.c -index e062e89..773242d 100644 ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -1745,6 +1745,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void) - return back_to; - } - -+/* Helper for make_cleanup_restore_page_info. */ -+ -+static void -+do_restore_selected_frame_cleanup (void *arg) -+{ -+ struct frame_id *frame_idp = arg; -+ -+ select_frame (frame_find_by_id (*frame_idp)); -+ -+ xfree (frame_idp); -+} -+ -+/* Provide cleanup for restoring currently selected frame. Use frame_id for -+ the case the current frame becomes stale in the meantime. */ -+ -+struct cleanup * -+make_cleanup_restore_selected_frame (void) -+{ -+ struct frame_id *frame_idp; -+ -+ /* get_selected_frame->get_current_frame would error otherwise. */ -+ if (!has_stack_frames ()) -+ return make_cleanup (null_cleanup, NULL); -+ -+ frame_idp = xmalloc (sizeof (*frame_idp)); -+ *frame_idp = get_frame_id (get_selected_frame (NULL)); -+ -+ return make_cleanup (do_restore_selected_frame_cleanup, frame_idp); -+} -+ - /* Set the screen size based on LINES_PER_PAGE and CHARS_PER_LINE. */ - - static void -diff --git a/gdb/utils.h b/gdb/utils.h -index 8bbcc5f..1342d68 100644 ---- a/gdb/utils.h -+++ b/gdb/utils.h -@@ -382,4 +382,6 @@ extern ULONGEST align_down (ULONGEST v, int n); - - extern LONGEST gdb_sign_extend (LONGEST value, int bit); - -+extern struct cleanup *make_cleanup_restore_selected_frame (void); -+ - #endif /* UTILS_H */ -diff --git a/gdb/valarith.c b/gdb/valarith.c -index 8e863e3..97a8b0f 100644 ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -195,7 +195,10 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) - struct type *array_type = check_typedef (value_type (array)); - struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); - unsigned int elt_size = TYPE_LENGTH (elt_type); -- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); -+ unsigned int elt_stride -+ = (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)) == 0 -+ ? elt_size : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type))); -+ unsigned int elt_offs = elt_stride * longest_to_int (index - lowerbound); - struct value *v; - - if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -@@ -255,6 +258,10 @@ int - binop_user_defined_p (enum exp_opcode op, - struct value *arg1, struct value *arg2) - { -+ /* FIXME: We should support user defined ops for dynamic types. */ -+ if (TYPE_DYNAMIC (value_type (arg1)) || TYPE_DYNAMIC (value_type (arg2))) -+ return 0; -+ - return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2)); - } - -diff --git a/gdb/valops.c b/gdb/valops.c -index 5382c49..0de8009 100644 ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -42,6 +42,7 @@ - #include "observer.h" - #include "objfiles.h" - #include "exceptions.h" -+#include "dwarf2loc.h" - - extern unsigned int overload_debug; - /* Local functions. */ -@@ -900,6 +901,65 @@ value_one (struct type *type) - return val; - } - -+/* object_address_set must be already called before this function. */ -+ -+const char * -+object_address_data_not_valid (struct type *type) -+{ -+ /* Attributes are present only at the target type of a typedef. Make the -+ call conditional as it would otherwise loop through type_length_get. */ -+ if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) -+ CHECK_TYPEDEF (type); -+ -+ /* DW_AT_associated has a preference over DW_AT_allocated. */ -+ if (TYPE_NOT_ASSOCIATED (type) -+ || (TYPE_ASSOCIATED (type) != NULL -+ && 0 == dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (type)))) -+ return N_("object is not associated"); -+ -+ if (TYPE_NOT_ALLOCATED (type) -+ || (TYPE_ALLOCATED (type) != NULL -+ && 0 == dwarf_locexpr_baton_eval (TYPE_ALLOCATED (type)))) -+ return N_("object is not allocated"); -+ -+ return NULL; -+} -+ -+/* Return non-NULL check_typedef result on TYPE if the variable is valid. If -+ it is valid the function may store the data address (DW_AT_DATA_LOCATION) of -+ TYPE at *ADDRESS_RETURN. You must set *ADDRESS_RETURN from -+ value_raw_address (VAL) before calling this function. If no -+ DW_AT_DATA_LOCATION is present for TYPE the address at *ADDRESS_RETURN is -+ left unchanged. ADDRESS_RETURN must not be NULL, use -+ object_address_data_not_valid () for just the data validity check. */ -+ -+struct type * -+object_address_get_data (struct type *type, CORE_ADDR *address_return) -+{ -+ gdb_assert (address_return != NULL); -+ -+ object_address_set (*address_return); -+ -+ /* TYPE_DATA_LOCATION_DWARF_BLOCK / TYPE_DATA_LOCATION_ADDR are present only -+ at the target type of a typedef. */ -+ CHECK_TYPEDEF (type); -+ -+ if (object_address_data_not_valid (type) != NULL) -+ { -+ /* Do not try to evaluate DW_AT_data_location as it may even crash -+ (it would just return the value zero in the gfortran case). */ -+ return NULL; -+ } -+ -+ if (TYPE_DATA_LOCATION_IS_ADDR (type)) -+ *address_return = TYPE_DATA_LOCATION_ADDR (type); -+ else if (TYPE_DATA_LOCATION_DWARF_BLOCK (type) != NULL) -+ *address_return -+ = dwarf_locexpr_baton_eval (TYPE_DATA_LOCATION_DWARF_BLOCK (type)); -+ -+ return type; -+} -+ - /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ - - static struct value * -@@ -1365,7 +1425,18 @@ address_of_variable (struct symbol *var, const struct block *b) - if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) - || TYPE_CODE (type) == TYPE_CODE_FUNC) - { -- CORE_ADDR addr = value_address (val); -+ CORE_ADDR addr; -+ -+ if (VALUE_LVAL (val) == lval_memory) -+ { -+ addr = value_raw_address (val); -+ if (!object_address_get_data (type, &addr)) -+ error (_("Can't take address of memory lvalue \"%s\"."), -+ SYMBOL_PRINT_NAME (var)); -+ set_value_address (val, addr); -+ } -+ -+ addr = value_address (val); - - return value_from_pointer (lookup_pointer_type (type), addr); - } -@@ -1472,6 +1543,7 @@ struct value * - value_coerce_array (struct value *arg1) - { - struct type *type = check_typedef (value_type (arg1)); -+ CORE_ADDR address; - - /* If the user tries to do something requiring a pointer with an - array that has not yet been pushed to the target, then this would -@@ -1481,8 +1553,12 @@ value_coerce_array (struct value *arg1) - if (VALUE_LVAL (arg1) != lval_memory) - error (_("Attempt to take address of value not located in memory.")); - -+ address = value_raw_address (arg1); -+ if (!object_address_get_data (type, &address)) -+ error (_("Attempt to take address of non-valid value.")); -+ - return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), -- value_address (arg1)); -+ address + value_offset (arg1)); - } - - /* Given a value which is a function, return a value which is a pointer -@@ -3571,6 +3647,8 @@ value_slice (struct value *array, int lowbound, int length) - TYPE_TARGET_TYPE (range_type), - lowbound, - lowbound + length - 1); -+ TYPE_BYTE_STRIDE (slice_range_type) = TYPE_BYTE_STRIDE (range_type); -+ - - { - struct type *element_type = TYPE_TARGET_TYPE (array_type); -diff --git a/gdb/valprint.c b/gdb/valprint.c -index 01889c5..e25e3c8 100644 ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -37,6 +37,7 @@ - #include "gdb_obstack.h" - #include "charset.h" - #include -+#include "dwarf2loc.h" - - #include - -@@ -290,7 +291,6 @@ val_print_scalar_type_p (struct type *type) - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_SET: -- case TYPE_CODE_STRING: - return 0; - default: - return 1; -@@ -1625,6 +1625,7 @@ val_print_array_elements (struct type *type, - { - unsigned int things_printed = 0; - unsigned len; -+ struct type *saved_type = type; - struct type *elttype, *index_type; - unsigned eltlen; - /* Position of the array element we are examining to see -@@ -1633,9 +1634,33 @@ val_print_array_elements (struct type *type, - /* Number of repetitions we have detected so far. */ - unsigned int reps; - LONGEST low_bound, high_bound; -+ struct cleanup *back_to; -+ CORE_ADDR saved_address = address; -+ -+ back_to = make_cleanup (null_cleanup, 0); -+ type = object_address_get_data (type, &address); -+ if (!type) -+ { -+ fputs_filtered (object_address_data_not_valid (type), stream); -+ do_cleanups (back_to); -+ return; -+ } -+ if (address != saved_address) -+ { -+ size_t length = TYPE_LENGTH (type); - -- elttype = TYPE_TARGET_TYPE (type); -- eltlen = TYPE_LENGTH (check_typedef (elttype)); -+ valaddr = xmalloc (length); -+ make_cleanup (xfree, (gdb_byte *) valaddr); -+ read_memory (address, (gdb_byte *) valaddr, length); -+ } -+ -+ /* Skip typedefs but do not resolve TYPE_DYNAMIC. */ -+ elttype = saved_type; -+ while (TYPE_CODE (elttype) == TYPE_CODE_TYPEDEF) -+ elttype = TYPE_TARGET_TYPE (elttype); -+ elttype = TYPE_TARGET_TYPE (elttype); -+ -+ eltlen = TYPE_ARRAY_BYTE_STRIDE_VALUE (type); - index_type = TYPE_INDEX_TYPE (type); - - if (get_array_bounds (type, &low_bound, &high_bound)) -@@ -1722,6 +1747,8 @@ val_print_array_elements (struct type *type, - { - fprintf_filtered (stream, "..."); - } -+ -+ do_cleanups (back_to); - } - - /* Read LEN bytes of target memory at address MEMADDR, placing the -diff --git a/gdb/value.c b/gdb/value.c -index 8542316..f75cf37 100644 ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -43,6 +43,7 @@ - #include "tracepoint.h" - #include "cp-abi.h" - #include "user-regs.h" -+#include "observer.h" - - /* Prototypes for exported functions. */ - -@@ -1623,12 +1624,15 @@ void - set_value_component_location (struct value *component, - const struct value *whole) - { -+ CORE_ADDR addr; -+ - if (whole->lval == lval_internalvar) - VALUE_LVAL (component) = lval_internalvar_component; - else - VALUE_LVAL (component) = whole->lval; - - component->location = whole->location; -+ - if (whole->lval == lval_computed) - { - const struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -1636,6 +1640,12 @@ set_value_component_location (struct value *component, - if (funcs->copy_closure) - component->location.computed.closure = funcs->copy_closure (whole); - } -+ -+ addr = value_raw_address (component); -+ object_address_get_data (value_type (whole), &addr); -+ if (component->lval != lval_internalvar -+ && component->lval != lval_internalvar_component) -+ set_value_address (component, addr); - } - - -@@ -1769,6 +1779,31 @@ show_values (char *num_exp, int from_tty) - num_exp[1] = '\0'; - } - } -+ -+/* Sanity check for memory leaks and proper types reference counting. */ -+ -+static void -+value_history_cleanup (void *unused) -+{ -+ while (value_history_chain) -+ { -+ struct value_history_chunk *chunk = value_history_chain; -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE (chunk->values); i++) -+ value_free (chunk->values[i]); -+ -+ value_history_chain = chunk->next; -+ xfree (chunk); -+ } -+ value_history_count = 0; -+ -+ /* Free the unreferenced types above. */ -+ free_all_values (); -+#if 0 -+ free_all_types (); -+#endif -+} - - /* Internal variables. These are variables within the debugger - that hold values assigned by debugger commands. -@@ -2304,6 +2339,38 @@ call_internal_function (struct gdbarch *gdbarch, - return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); - } - -+#if 0 -+/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ -+ -+static void -+value_types_mark_used (void) -+{ -+ struct internalvar *var; -+ struct value_history_chunk *chunk; -+ -+ for (var = internalvars; var != NULL; var = var->next) -+ switch (var->kind) -+ { -+ case INTERNALVAR_VALUE: -+ type_mark_used (value_type (var->u.value)); -+ break; -+ -+ case INTERNALVAR_INTEGER: -+ type_mark_used (var->u.integer.type); -+ break; -+ } -+ -+ for (chunk = value_history_chain; chunk != NULL; chunk = chunk->next) -+ { -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE (chunk->values); i++) -+ if (chunk->values[i]) -+ type_mark_used (value_type (chunk->values[i])); -+ } -+} -+#endif -+ - /* The 'function' command. This does nothing -- it is just a - placeholder to let "help function NAME" work. This is also used as - the implementation of the sub-command that is created when -@@ -2351,11 +2418,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, - htab_t copied_types) - { - if (TYPE_OBJFILE (value->type) == objfile) -- value->type = copy_type_recursive (objfile, value->type, copied_types); -+ value->type = copy_type_recursive (value->type, copied_types); - - if (TYPE_OBJFILE (value->enclosing_type) == objfile) -- value->enclosing_type = copy_type_recursive (objfile, -- value->enclosing_type, -+ value->enclosing_type = copy_type_recursive (value->enclosing_type, - copied_types); - } - -@@ -2370,7 +2436,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, - case INTERNALVAR_INTEGER: - if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) - var->u.integer.type -- = copy_type_recursive (objfile, var->u.integer.type, copied_types); -+ = copy_type_recursive (var->u.integer.type, copied_types); - break; - - case INTERNALVAR_VALUE: -@@ -3479,10 +3545,27 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, - struct value * - coerce_ref (struct value *arg) - { -- struct type *value_type_arg_tmp = check_typedef (value_type (arg)); -+ struct type *value_type_arg_tmp; - struct value *retval; - struct type *enc_type; - -+ if (TYPE_DYNAMIC (value_type (arg))) -+ { -+ struct cleanup *cleanups = make_cleanup (null_cleanup, NULL); -+ CORE_ADDR address; -+ -+ value_type_arg_tmp = value_type (arg); -+ address = value_raw_address (arg); -+ value_type_arg_tmp = object_address_get_data (value_type_arg_tmp, -+ &address); -+ if (! value_type_arg_tmp) -+ error (_("Attempt to coerce non-valid value.")); -+ arg = value_at_lazy (value_type_arg_tmp, address); -+ do_cleanups (cleanups); -+ } -+ else -+ value_type_arg_tmp = check_typedef (value_type (arg)); -+ - retval = coerce_ref_if_computed (arg); - if (retval) - return retval; -@@ -3590,7 +3673,8 @@ int - value_fetch_lazy (struct value *val) - { - gdb_assert (value_lazy (val)); -- allocate_value_contents (val); -+ if (VALUE_LVAL (val) != lval_memory) -+ allocate_value_contents (val); - if (value_bitsize (val)) - { - /* To read a lazy bitfield, read the entire enclosing value. This -@@ -3625,13 +3709,24 @@ value_fetch_lazy (struct value *val) - } - else if (VALUE_LVAL (val) == lval_memory) - { -- CORE_ADDR addr = value_address (val); -- struct type *type = check_typedef (value_enclosing_type (val)); -+ CORE_ADDR addr = value_raw_address (val); -+ -+ if (object_address_get_data (value_type (val), &addr)) -+ { -+ struct type *type = value_enclosing_type (val); -+ int length = TYPE_LENGTH (check_typedef (type)); - -- if (TYPE_LENGTH (type)) -- read_value_memory (val, 0, value_stack (val), -- addr, value_contents_all_raw (val), -- TYPE_LENGTH (type)); -+ if (length) -+ { -+ /* Delay it after object_address_get_data above. */ -+ allocate_value_contents (val); -+ addr += value_offset (val); -+ read_value_memory (val, 0, value_stack (val), -+ addr, value_contents_all_raw (val), length); -+ } -+ } -+ /* Just to be sure it has been called. */ -+ allocate_value_contents (val); - } - else if (VALUE_LVAL (val) == lval_register) - { -@@ -3814,4 +3909,10 @@ Check whether an expression is void.\n\ - Usage: $_isvoid (expression)\n\ - Return 1 if the expression is void, zero otherwise."), - isvoid_internal_fn, NULL); -+ -+ make_final_cleanup (value_history_cleanup, NULL); -+ -+#if 0 -+ observer_attach_mark_used (value_types_mark_used); -+#endif - } -diff --git a/gdb/value.h b/gdb/value.h -index 5924b2f..eae3553 100644 ---- a/gdb/value.h -+++ b/gdb/value.h -@@ -571,6 +571,10 @@ extern struct value *value_from_decfloat (struct type *type, - const gdb_byte *decbytes); - extern struct value *value_from_history_ref (char *, char **); - -+extern const char *object_address_data_not_valid (struct type *type); -+extern struct type *object_address_get_data (struct type *type, -+ CORE_ADDR *address_return); -+ - extern struct value *value_at (struct type *type, CORE_ADDR addr); - extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); - diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch index 1f58d34..91d2959 100644 --- a/gdb-attach-fail-reasons-5of5.patch +++ b/gdb-attach-fail-reasons-5of5.patch @@ -37,10 +37,10 @@ gdb/gdbserver/ (linux_create_inferior, linux_tracefork_child): Call it instead of direct ptrace. -Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c +Index: gdb-7.7.50.20140609/gdb/common/linux-ptrace.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/common/linux-ptrace.c 2014-02-06 17:40:32.530145960 +0100 -+++ gdb-7.6.90.20140127/gdb/common/linux-ptrace.c 2014-02-06 17:48:16.329644534 +0100 +--- gdb-7.7.50.20140609.orig/gdb/common/linux-ptrace.c 2014-06-13 20:28:04.375884828 +0200 ++++ gdb-7.7.50.20140609/gdb/common/linux-ptrace.c 2014-06-13 20:28:57.514940079 +0200 @@ -32,6 +32,10 @@ #include @@ -52,16 +52,16 @@ Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c /* Stores the currently supported ptrace options. A value of -1 means we did not check for features yet. A value of 0 means there are no supported features. */ -@@ -56,6 +60,8 @@ linux_ptrace_attach_warnings (pid_t pid, - buffer_xml_printf (buffer, _("warning: process %d is a zombie " - "- the process has already terminated\n"), +@@ -56,6 +60,8 @@ linux_ptrace_attach_fail_reason (pid_t p + buffer_xml_printf (buffer, _("process %d is a zombie " + "- the process has already terminated"), (int) pid); + + linux_ptrace_create_warnings (buffer); } #if defined __i386__ || defined __x86_64__ -@@ -542,3 +548,19 @@ linux_ptrace_init_warnings (void) +@@ -551,3 +557,19 @@ linux_ptrace_init_warnings (void) linux_ptrace_test_ret_to_nx (); } @@ -81,23 +81,23 @@ Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.c + "(gdb) shell sudo setsebool deny_ptrace=0")); +#endif /* HAVE_LIBSELINUX */ +} -Index: gdb-7.6.90.20140127/gdb/common/linux-ptrace.h +Index: gdb-7.7.50.20140609/gdb/common/linux-ptrace.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/common/linux-ptrace.h 2014-02-06 17:40:35.506149162 +0100 -+++ gdb-7.6.90.20140127/gdb/common/linux-ptrace.h 2014-02-06 17:48:00.601627995 +0100 +--- gdb-7.7.50.20140609.orig/gdb/common/linux-ptrace.h 2014-06-13 20:28:14.375895202 +0200 ++++ gdb-7.7.50.20140609/gdb/common/linux-ptrace.h 2014-06-13 20:28:33.298914047 +0200 @@ -85,6 +85,7 @@ struct buffer; - extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer); + extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer); extern void linux_ptrace_init_warnings (void); +extern void linux_ptrace_create_warnings (struct buffer *buffer); extern void linux_enable_event_reporting (pid_t pid); + extern void linux_disable_event_reporting (pid_t pid); extern int linux_supports_tracefork (void); - extern int linux_supports_traceclone (void); -Index: gdb-7.6.90.20140127/gdb/configure.ac +Index: gdb-7.7.50.20140609/gdb/configure.ac =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/configure.ac 2014-02-06 17:40:32.532145962 +0100 -+++ gdb-7.6.90.20140127/gdb/configure.ac 2014-02-06 17:40:35.507149163 +0100 -@@ -1975,6 +1975,10 @@ case $host_os in +--- gdb-7.7.50.20140609.orig/gdb/configure.ac 2014-06-13 20:28:04.377884830 +0200 ++++ gdb-7.7.50.20140609/gdb/configure.ac 2014-06-13 20:28:14.376895203 +0200 +@@ -2138,6 +2138,10 @@ case $host_os in esac AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) @@ -108,10 +108,10 @@ Index: gdb-7.6.90.20140127/gdb/configure.ac dnl Handle optional features that can be enabled. # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, -Index: gdb-7.6.90.20140127/gdb/gdbserver/configure.ac +Index: gdb-7.7.50.20140609/gdb/gdbserver/configure.ac =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/gdbserver/configure.ac 2014-02-06 17:40:32.532145962 +0100 -+++ gdb-7.6.90.20140127/gdb/gdbserver/configure.ac 2014-02-06 17:40:35.507149163 +0100 +--- gdb-7.7.50.20140609.orig/gdb/gdbserver/configure.ac 2014-06-13 20:28:04.377884830 +0200 ++++ gdb-7.7.50.20140609/gdb/gdbserver/configure.ac 2014-06-13 20:28:14.376895203 +0200 @@ -454,6 +454,10 @@ if $want_ipa ; then fi fi @@ -123,11 +123,11 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/configure.ac AC_SUBST(GDBSERVER_DEPFILES) AC_SUBST(GDBSERVER_LIBS) AC_SUBST(srv_xmlbuiltin) -Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c +Index: gdb-7.7.50.20140609/gdb/gdbserver/linux-low.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/gdbserver/linux-low.c 2014-02-06 17:40:32.534145964 +0100 -+++ gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c 2014-02-06 17:49:32.385726514 +0100 -@@ -543,6 +543,29 @@ add_lwp (ptid_t ptid) +--- gdb-7.7.50.20140609.orig/gdb/gdbserver/linux-low.c 2014-06-13 20:28:04.379884832 +0200 ++++ gdb-7.7.50.20140609/gdb/gdbserver/linux-low.c 2014-06-13 20:28:14.377895204 +0200 +@@ -541,6 +541,29 @@ add_lwp (ptid_t ptid) return lwp; } @@ -157,7 +157,7 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c /* Start an inferior process and returns its pid. ALLARGS is a vector of program-name and args. */ -@@ -584,7 +607,7 @@ linux_create_inferior (char *program, ch +@@ -582,7 +605,7 @@ linux_create_inferior (char *program, ch if (pid == 0) { close_most_fds (); @@ -166,10 +166,10 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/linux-low.c #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */ signal (__SIGRTMIN + 1, SIG_DFL); -Index: gdb-7.6.90.20140127/gdb/inf-ptrace.c +Index: gdb-7.7.50.20140609/gdb/inf-ptrace.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/inf-ptrace.c 2014-02-06 17:40:32.535145965 +0100 -+++ gdb-7.6.90.20140127/gdb/inf-ptrace.c 2014-02-06 17:40:35.510149167 +0100 +--- gdb-7.7.50.20140609.orig/gdb/inf-ptrace.c 2014-06-13 20:28:04.380884833 +0200 ++++ gdb-7.7.50.20140609/gdb/inf-ptrace.c 2014-06-13 20:28:14.377895204 +0200 @@ -105,7 +105,15 @@ static void inf_ptrace_me (void) { @@ -186,11 +186,11 @@ Index: gdb-7.6.90.20140127/gdb/inf-ptrace.c } /* Start a new inferior Unix child process. EXEC_FILE is the file to -Index: gdb-7.6.90.20140127/gdb/linux-nat.c +Index: gdb-7.7.50.20140609/gdb/linux-nat.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/linux-nat.c 2014-02-06 17:40:32.537145968 +0100 -+++ gdb-7.6.90.20140127/gdb/linux-nat.c 2014-02-06 17:40:35.511149168 +0100 -@@ -1283,6 +1283,7 @@ linux_nat_create_inferior (struct target +--- gdb-7.7.50.20140609.orig/gdb/linux-nat.c 2014-06-13 20:28:04.382884835 +0200 ++++ gdb-7.7.50.20140609/gdb/linux-nat.c 2014-06-13 20:29:34.554977995 +0200 +@@ -1285,6 +1285,7 @@ linux_nat_create_inferior (struct target #ifdef HAVE_PERSONALITY int personality_orig = 0, personality_set = 0; #endif /* HAVE_PERSONALITY */ @@ -198,9 +198,9 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c /* The fork_child mechanism is synchronous and calls target_wait, so we have to mask the async mode. */ -@@ -1307,7 +1308,10 @@ linux_nat_create_inferior (struct target +@@ -1309,7 +1310,10 @@ linux_nat_create_inferior (struct target /* Make sure we report all signals during startup. */ - linux_nat_pass_signals (0, NULL); + linux_nat_pass_signals (ops, 0, NULL); - linux_ops->to_create_inferior (ops, exec_file, allargs, env, from_tty); + TRY_CATCH (ex, RETURN_MASK_ERROR) @@ -210,7 +210,7 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c #ifdef HAVE_PERSONALITY if (personality_set) -@@ -1319,6 +1323,24 @@ linux_nat_create_inferior (struct target +@@ -1321,6 +1325,24 @@ linux_nat_create_inferior (struct target safe_strerror (errno)); } #endif /* HAVE_PERSONALITY */ @@ -235,11 +235,11 @@ Index: gdb-7.6.90.20140127/gdb/linux-nat.c } static void -Index: gdb-7.6.90.20140127/gdb/config.in +Index: gdb-7.7.50.20140609/gdb/config.in =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/config.in 2014-02-06 17:40:32.538145969 +0100 -+++ gdb-7.6.90.20140127/gdb/config.in 2014-02-06 17:40:35.511149168 +0100 -@@ -213,6 +213,9 @@ +--- gdb-7.7.50.20140609.orig/gdb/config.in 2014-06-13 20:28:04.383884836 +0200 ++++ gdb-7.7.50.20140609/gdb/config.in 2014-06-13 20:29:57.378002067 +0200 +@@ -216,6 +216,9 @@ /* Define if librpm library is being used. */ #undef HAVE_LIBRPM @@ -249,9 +249,9 @@ Index: gdb-7.6.90.20140127/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H -@@ -345,6 +348,9 @@ - /* Define to 1 if you have the `sbrk' function. */ - #undef HAVE_SBRK +@@ -351,6 +354,9 @@ + /* Define to 1 if you have the `scm_new_smob' function. */ + #undef HAVE_SCM_NEW_SMOB +/* Define to 1 if you have the header file. */ +#undef HAVE_SELINUX_SELINUX_H @@ -259,11 +259,11 @@ Index: gdb-7.6.90.20140127/gdb/config.in /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE -Index: gdb-7.6.90.20140127/gdb/configure +Index: gdb-7.7.50.20140609/gdb/configure =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/configure 2014-02-06 17:40:32.541145972 +0100 -+++ gdb-7.6.90.20140127/gdb/configure 2014-02-06 17:40:35.515149172 +0100 -@@ -12861,6 +12861,64 @@ cat >>confdefs.h <<_ACEOF +--- gdb-7.7.50.20140609.orig/gdb/configure 2014-06-13 20:28:04.387884840 +0200 ++++ gdb-7.7.50.20140609/gdb/configure 2014-06-13 20:28:14.383895210 +0200 +@@ -13282,6 +13282,64 @@ cat >>confdefs.h <<_ACEOF _ACEOF @@ -328,11 +328,11 @@ Index: gdb-7.6.90.20140127/gdb/configure # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, # except that the argument to --with-sysroot is optional. -Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in +Index: gdb-7.7.50.20140609/gdb/gdbserver/config.in =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/gdbserver/config.in 2014-02-06 17:40:32.542145973 +0100 -+++ gdb-7.6.90.20140127/gdb/gdbserver/config.in 2014-02-06 17:54:06.923021799 +0100 -@@ -78,6 +78,9 @@ +--- gdb-7.7.50.20140609.orig/gdb/gdbserver/config.in 2014-06-13 20:28:04.389884842 +0200 ++++ gdb-7.7.50.20140609/gdb/gdbserver/config.in 2014-06-13 20:28:14.383895210 +0200 +@@ -81,6 +81,9 @@ /* Define to 1 if you have the `mcheck' library (-lmcheck). */ #undef HAVE_LIBMCHECK @@ -342,7 +342,7 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in /* Define if the target supports branch tracing. */ #undef HAVE_LINUX_BTRACE -@@ -151,6 +154,9 @@ +@@ -154,6 +157,9 @@ /* Define to 1 if you have the `readlink' function. */ #undef HAVE_READLINK @@ -352,10 +352,10 @@ Index: gdb-7.6.90.20140127/gdb/gdbserver/config.in /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H -Index: gdb-7.6.90.20140127/gdb/gdbserver/configure +Index: gdb-7.7.50.20140609/gdb/gdbserver/configure =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/gdbserver/configure 2014-02-06 17:40:32.543145974 +0100 -+++ gdb-7.6.90.20140127/gdb/gdbserver/configure 2014-02-06 17:40:35.516149173 +0100 +--- gdb-7.7.50.20140609.orig/gdb/gdbserver/configure 2014-06-13 20:28:04.390884844 +0200 ++++ gdb-7.7.50.20140609/gdb/gdbserver/configure 2014-06-13 20:28:14.384895211 +0200 @@ -6170,6 +6170,64 @@ if $want_ipa ; then fi fi diff --git a/gdb-bfd-demangled-names.patch b/gdb-bfd-demangled-names.patch new file mode 100644 index 0000000..72bd834 --- /dev/null +++ b/gdb-bfd-demangled-names.patch @@ -0,0 +1,207 @@ +Re: ASAN crash regression [Re: [PATCH 2/2] move the demangled_names_hash into the per-BFD] +https://sourceware.org/ml/gdb-patches/2014-06/msg00550.html + +Jan> ./configure ... -fsanitize=address +Jan> echo 'void f(){}main(){}'|gcc -x c++ - -g;ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ./gdb -batch a.out -ex 'file a.out' + +Readily seen with valgrind as well. + +Here's my proposed fix. + +Tom + +commit 3a93a67ad0ea3495f67c9708673345b73de2d806 +Author: Tom Tromey +Date: Mon Jun 16 03:17:19 2014 -0600 + + fix memory errors with demangled name hash + + This fixes a regression that Jan pointed out. + + The bug is that some names were allocated by dwarf2read on the objfile + obstack, but then passed to SYMBOL_SET_NAMES with copy_name=0. This + violates the invariant that the names must have a lifetime tied to the + lifetime of the BFD. + + The fix is to allocate names on the per-BFD obstack. + + I looked at all callers, direct or indirect, of SYMBOL_SET_NAMES that + pass copy_name=0. Note that only the ELF and DWARF readers do this; + other symbol readers were never updated (and perhaps cannot be, + depending on the details of the formats). This is why the patch is + relatively small. + + Built and regtested on x86-64 Fedora 20. + + 2014-06-16 Tom Tromey + + * dwarf2read.c (fixup_go_packaging, dwarf2_compute_name) + (dwarf2_physname, read_partial_die) + (guess_partial_die_structure_name, fixup_partial_die) + (guess_full_die_structure_name, anonymous_struct_prefix) + (dwarf2_name): Use per-BFD obstack. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,5 +1,13 @@ + 2014-06-16 Tom Tromey + ++ * dwarf2read.c (fixup_go_packaging, dwarf2_compute_name) ++ (dwarf2_physname, read_partial_die) ++ (guess_partial_die_structure_name, fixup_partial_die) ++ (guess_full_die_structure_name, anonymous_struct_prefix) ++ (dwarf2_name): Use per-BFD obstack. ++ ++2014-06-16 Tom Tromey ++ + * minsyms.h (prim_record_minimal_symbol) + (prim_record_minimal_symbol_and_info): Update comments. + +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -7745,9 +7745,10 @@ fixup_go_packaging (struct dwarf2_cu *cu) + if (package_name != NULL) + { + struct objfile *objfile = cu->objfile; +- const char *saved_package_name = obstack_copy0 (&objfile->objfile_obstack, +- package_name, +- strlen (package_name)); ++ const char *saved_package_name ++ = obstack_copy0 (&objfile->per_bfd->storage_obstack, ++ package_name, ++ strlen (package_name)); + struct type *type = init_type (TYPE_CODE_MODULE, 0, 0, + saved_package_name, objfile); + struct symbol *sym; +@@ -8365,6 +8366,8 @@ dwarf2_compute_name (const char *name, + long length; + const char *prefix; + struct ui_file *buf; ++ char *intermediate_name; ++ const char *canonical_name = NULL; + + prefix = determine_prefix (die, cu); + buf = mem_fileopen (); +@@ -8541,19 +8544,25 @@ dwarf2_compute_name (const char *name, + } + } + +- name = ui_file_obsavestring (buf, &objfile->objfile_obstack, +- &length); ++ intermediate_name = ui_file_xstrdup (buf, &length); + ui_file_delete (buf); + + if (cu->language == language_cplus) +- { +- const char *cname +- = dwarf2_canonicalize_name (name, cu, +- &objfile->objfile_obstack); ++ canonical_name ++ = dwarf2_canonicalize_name (intermediate_name, cu, ++ &objfile->per_bfd->storage_obstack); ++ ++ /* If we only computed INTERMEDIATE_NAME, or if ++ INTERMEDIATE_NAME is already canonical, then we need to ++ copy it to the appropriate obstack. */ ++ if (canonical_name == NULL || canonical_name == intermediate_name) ++ name = obstack_copy0 (&objfile->per_bfd->storage_obstack, ++ intermediate_name, ++ strlen (intermediate_name)); ++ else ++ name = canonical_name; + +- if (cname != NULL) +- name = cname; +- } ++ xfree (intermediate_name); + } + } + +@@ -8562,7 +8571,7 @@ dwarf2_compute_name (const char *name, + + /* Return the fully qualified name of DIE, based on its DW_AT_name. + If scope qualifiers are appropriate they will be added. The result +- will be allocated on the objfile_obstack, or NULL if the DIE does ++ will be allocated on the storage_obstack, or NULL if the DIE does + not have a name. NAME may either be from a previous call to + dwarf2_name or NULL. + +@@ -8677,7 +8686,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu) + retval = canon; + + if (need_copy) +- retval = obstack_copy0 (&objfile->objfile_obstack, retval, strlen (retval)); ++ retval = obstack_copy0 (&objfile->per_bfd->storage_obstack, ++ retval, strlen (retval)); + + do_cleanups (back_to); + return retval; +@@ -15508,7 +15518,7 @@ read_partial_die (const struct die_reader_specs *reader, + default: + part_die->name + = dwarf2_canonicalize_name (DW_STRING (&attr), cu, +- &objfile->objfile_obstack); ++ &objfile->per_bfd->storage_obstack); + break; + } + break; +@@ -15793,7 +15803,7 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi, + if (actual_class_name != NULL) + { + struct_pdi->name +- = obstack_copy0 (&cu->objfile->objfile_obstack, ++ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, + actual_class_name, + strlen (actual_class_name)); + xfree (actual_class_name); +@@ -15879,8 +15889,9 @@ fixup_partial_die (struct partial_die_info *part_die, + else + base = demangled; + +- part_die->name = obstack_copy0 (&cu->objfile->objfile_obstack, +- base, strlen (base)); ++ part_die->name ++ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, ++ base, strlen (base)); + xfree (demangled); + } + } +@@ -18557,7 +18568,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu) + && actual_name[actual_name_len + - die_name_len - 1] == ':') + name = +- obstack_copy0 (&cu->objfile->objfile_obstack, ++ obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, + actual_name, + actual_name_len - die_name_len - 2); + } +@@ -18603,7 +18614,7 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu) + if (base == NULL || base == DW_STRING (attr) || base[-1] != ':') + return ""; + +- return obstack_copy0 (&cu->objfile->objfile_obstack, ++ return obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, + DW_STRING (attr), &base[-1] - DW_STRING (attr)); + } + +@@ -18943,8 +18954,9 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) + char *base; + + /* FIXME: we already did this for the partial symbol... */ +- DW_STRING (attr) = obstack_copy0 (&cu->objfile->objfile_obstack, +- demangled, strlen (demangled)); ++ DW_STRING (attr) ++ = obstack_copy0 (&cu->objfile->per_bfd->storage_obstack, ++ demangled, strlen (demangled)); + DW_STRING_IS_CANONICAL (attr) = 1; + xfree (demangled); + +@@ -18967,7 +18979,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) + { + DW_STRING (attr) + = dwarf2_canonicalize_name (DW_STRING (attr), cu, +- &cu->objfile->objfile_obstack); ++ &cu->objfile->per_bfd->storage_obstack); + DW_STRING_IS_CANONICAL (attr) = 1; + } + return DW_STRING (attr); diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch index 1978d5e..1ad42b9 100644 --- a/gdb-bz533176-fortran-omp-step.patch +++ b/gdb-bz533176-fortran-omp-step.patch @@ -21,11 +21,11 @@ debugging problem of GOMP outside of the scope of this Bug. -Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c +Index: gdb-7.7.90.20140613/gdb/infrun.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/infrun.c 2013-08-02 17:10:08.446962958 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/infrun.c 2013-08-02 17:10:49.109016685 +0200 -@@ -4930,6 +4930,16 @@ process_event_stop_test: +--- gdb-7.7.90.20140613.orig/gdb/infrun.c 2014-06-13 21:59:10.835805512 +0200 ++++ gdb-7.7.90.20140613/gdb/infrun.c 2014-06-13 21:59:31.064829121 +0200 +@@ -4820,6 +4820,16 @@ process_event_stop_test (struct executio if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL) { @@ -36,13 +36,13 @@ Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c + || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL) + /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */ + && (stopf == NULL -+ || strstr (SYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL)) ++ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL)) +{ /* ".omp_fn." */ + /* We're doing a "next". Normal (forward) execution: set a breakpoint at the -@@ -4965,6 +4975,7 @@ process_event_stop_test: +@@ -4855,6 +4865,7 @@ process_event_stop_test (struct executio keep_going (ecs); return; @@ -50,10 +50,10 @@ Index: gdb-7.6.50.20130731-cvs/gdb/infrun.c } /* If we are in a function call trampoline (a stub between the -Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp 2013-08-02 17:10:37.063000571 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.exp 2014-06-13 21:59:22.801819481 +0200 @@ -0,0 +1,31 @@ +# Copyright 2009 Free Software Foundation, Inc. + @@ -86,10 +86,10 @@ Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.exp + +gdb_breakpoint [gdb_get_line_number "success"] +gdb_continue_to_breakpoint "success" ".*success.*" -Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.f90 +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.fortran/omp-step.f90 2013-08-02 17:10:37.063000571 +0200 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/omp-step.f90 2014-06-13 21:59:22.801819481 +0200 @@ -0,0 +1,32 @@ +! Copyright 2009 Free Software Foundation, Inc. + diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch index e6073eb..7bfe411 100644 --- a/gdb-bz541866-rwatch-before-run.patch +++ b/gdb-bz541866-rwatch-before-run.patch @@ -1,7 +1,7 @@ -Index: gdb-7.6.90.20140127/gdb/config/i386/linux64.mh +Index: gdb-7.7.50.20140609/gdb/config/i386/linux64.mh =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/config/i386/linux64.mh 2014-02-06 17:30:23.021489736 +0100 -+++ gdb-7.6.90.20140127/gdb/config/i386/linux64.mh 2014-02-06 17:30:44.984513403 +0100 +--- gdb-7.7.50.20140609.orig/gdb/config/i386/linux64.mh 2014-06-13 20:25:37.356732335 +0200 ++++ gdb-7.7.50.20140609/gdb/config/i386/linux64.mh 2014-06-13 20:26:07.984764098 +0200 @@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \ proc-service.o linux-thread-db.o linux-fork.o \ linux-procfs.o linux-ptrace.o linux-btrace.o \ @@ -11,10 +11,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/linux64.mh NAT_CDEPS = $(srcdir)/proc-service.list # The dynamically loaded libthread_db needs access to symbols in the -Index: gdb-7.6.90.20140127/gdb/config/i386/linux.mh +Index: gdb-7.7.50.20140609/gdb/config/i386/linux.mh =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/config/i386/linux.mh 2014-02-06 17:30:15.893482056 +0100 -+++ gdb-7.6.90.20140127/gdb/config/i386/linux.mh 2014-02-06 17:30:23.021489736 +0100 +--- gdb-7.7.50.20140609.orig/gdb/config/i386/linux.mh 2014-06-13 20:25:37.356732335 +0200 ++++ gdb-7.7.50.20140609/gdb/config/i386/linux.mh 2014-06-13 20:26:07.984764098 +0200 @@ -1,6 +1,6 @@ # Host: Intel 386 running GNU/Linux. @@ -23,10 +23,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/linux.mh NATDEPFILES= inf-ptrace.o fork-child.o \ i386-nat.o i386-linux-nat.o \ proc-service.o linux-thread-db.o \ -Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h +Index: gdb-7.7.50.20140609/gdb/config/i386/nm-linux.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h 2014-02-06 17:30:23.021489736 +0100 ++++ gdb-7.7.50.20140609/gdb/config/i386/nm-linux.h 2014-06-13 20:26:07.984764098 +0200 @@ -0,0 +1,28 @@ +/* Native support for GNU/Linux i386. + @@ -56,10 +56,10 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux.h +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 + +#endif /* NM_LINUX64_H */ -Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h +Index: gdb-7.7.50.20140609/gdb/config/i386/nm-linux64.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h 2014-02-06 17:30:23.021489736 +0100 ++++ gdb-7.7.50.20140609/gdb/config/i386/nm-linux64.h 2014-06-13 20:26:07.984764098 +0200 @@ -0,0 +1,28 @@ +/* Native support for GNU/Linux amd64. + @@ -89,25 +89,26 @@ Index: gdb-7.6.90.20140127/gdb/config/i386/nm-linux64.h +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 + +#endif /* NM_LINUX64_H */ -Index: gdb-7.6.90.20140127/gdb/target.h +Index: gdb-7.7.50.20140609/gdb/target.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/target.h 2014-02-06 17:30:15.894482057 +0100 -+++ gdb-7.6.90.20140127/gdb/target.h 2014-02-06 17:30:23.022489737 +0100 -@@ -1521,8 +1521,10 @@ extern char *target_thread_name (struct +--- gdb-7.7.50.20140609.orig/gdb/target.h 2014-06-13 20:26:07.985764099 +0200 ++++ gdb-7.7.50.20140609/gdb/target.h 2014-06-13 20:26:34.915792095 +0200 +@@ -1728,9 +1728,11 @@ extern char *target_thread_name (struct bp_hardware_breakpoint. CNT is the number of such watchpoints used so far (including this one?). OTHERTYPE is who knows what... */ +#ifndef target_can_use_hardware_watchpoint #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); + (*current_target.to_can_use_hw_breakpoint) (¤t_target, \ + TYPE, CNT, OTHERTYPE); +#endif /* Returns the number of debug registers needed to watch the given memory region, or zero if not supported. */ -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp +Index: gdb-7.7.50.20140609/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2014-02-06 17:30:23.022489737 +0100 ++++ gdb-7.7.50.20140609/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp 2014-06-13 20:26:07.986764101 +0200 @@ -0,0 +1,40 @@ +# Copyright 2009, 2010 Free Software Foundation, Inc. + diff --git a/gdb-dts-rhel6-python-compat.patch b/gdb-dts-rhel6-python-compat.patch index 69eb92e..3688713 100644 --- a/gdb-dts-rhel6-python-compat.patch +++ b/gdb-dts-rhel6-python-compat.patch @@ -1,9 +1,10 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1020004 -diff -dup -ruNp gdb-7.7-orig/gdb/data-directory/Makefile.in gdb-7.7/gdb/data-directory/Makefile.in ---- gdb-7.7-orig/gdb/data-directory/Makefile.in 2014-02-23 18:12:51.338866391 +0100 -+++ gdb-7.7/gdb/data-directory/Makefile.in 2014-02-23 18:14:31.187756983 +0100 -@@ -58,9 +58,12 @@ PYTHON_FILES = \ +Index: gdb-7.7.90.20140613/gdb/data-directory/Makefile.in +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/data-directory/Makefile.in 2014-06-13 23:02:37.597115787 +0200 ++++ gdb-7.7.90.20140613/gdb/data-directory/Makefile.in 2014-06-13 23:03:21.285163909 +0200 +@@ -60,6 +60,8 @@ PYTHON_FILES = \ gdb/frames.py \ gdb/FrameIterator.py \ gdb/FrameDecorator.py \ @@ -12,13 +13,18 @@ diff -dup -ruNp gdb-7.7-orig/gdb/data-directory/Makefile.in gdb-7.7/gdb/data-dir gdb/types.py \ gdb/printing.py \ gdb/prompt.py \ +@@ -74,6 +76,7 @@ PYTHON_FILES = \ + gdb/command/pretty_printers.py \ + gdb/command/prompt.py \ + gdb/command/explore.py \ + gdb/command/backtrace.py \ - gdb/command/bound_registers.py \ - gdb/command/__init__.py \ - gdb/command/ignore_errors.py \ -diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py gdb-7.7/gdb/python/lib/gdb/FrameWrapper.py ---- gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.7/gdb/python/lib/gdb/FrameWrapper.py 2014-02-23 18:14:31.188756981 +0100 + gdb/function/__init__.py \ + gdb/function/strfns.py \ + gdb/function/caller_is.py \ +Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py 2014-06-13 23:02:37.598115788 +0200 @@ -0,0 +1,122 @@ +# Wrapper API for frames. + @@ -142,9 +148,10 @@ diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/FrameWrapper.py gdb-7.7/gdb/pyth + + def __getattr__ (self, name): + return getattr (self.frame, name) -diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py gdb-7.7/gdb/python/lib/gdb/backtrace.py ---- gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.7/gdb/python/lib/gdb/backtrace.py 2014-02-23 18:14:31.188756981 +0100 +Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py 2014-06-13 23:02:37.598115788 +0200 @@ -0,0 +1,42 @@ +# Filtering backtrace. + @@ -188,9 +195,10 @@ diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/backtrace.py gdb-7.7/gdb/python/ + return iter + return old_frame_filter (iter) + -diff -dup -ruNp gdb-7.7-orig/gdb/python/lib/gdb/command/backtrace.py gdb-7.7/gdb/python/lib/gdb/command/backtrace.py ---- gdb-7.7-orig/gdb/python/lib/gdb/command/backtrace.py 1970-01-01 01:00:00.000000000 +0100 -+++ gdb-7.7/gdb/python/lib/gdb/command/backtrace.py 2014-02-23 18:14:31.188756981 +0100 +Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py 2014-06-13 23:02:37.598115788 +0200 @@ -0,0 +1,106 @@ +# New backtrace command. + diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch index c6383db..3c0c042 100644 --- a/gdb-glibc-strstr-workaround.patch +++ b/gdb-glibc-strstr-workaround.patch @@ -1,8 +1,8 @@ -Index: gdb-7.6.90.20140127/gdb/dwarf2read.c +Index: gdb-7.7.90.20140613/gdb/dwarf2read.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/dwarf2read.c 2014-02-06 18:18:09.676572271 +0100 -+++ gdb-7.6.90.20140127/gdb/dwarf2read.c 2014-02-06 18:18:42.664607823 +0100 -@@ -17646,6 +17646,25 @@ new_symbol_full (struct die_info *die, s +--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-13 21:56:54.744653443 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-13 22:01:51.529990684 +0200 +@@ -17695,6 +17695,26 @@ new_symbol_full (struct die_info *die, s /* Cache this symbol's name and the name's demangled form (if any). */ SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack); linkagename = dwarf2_physname (name, die, cu); @@ -14,24 +14,25 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2read.c + && strstr (objfile_name (objfile), "/libc") != NULL) + { + struct objfile *objfile_msym; -+ struct minimal_symbol *msym; ++ struct bound_minimal_symbol bmsym; + + if (objfile->separate_debug_objfile_backlink) + objfile_msym = objfile->separate_debug_objfile_backlink; + else + objfile_msym = objfile; -+ msym = lookup_minimal_symbol ("strstr", NULL, objfile_msym); -+ if (msym && MSYMBOL_TYPE (msym) == mst_text_gnu_ifunc) ++ bmsym = lookup_minimal_symbol ("strstr", NULL, objfile_msym); ++ if (bmsym.minsym != NULL ++ && MSYMBOL_TYPE (bmsym.minsym) == mst_text_gnu_ifunc) + linkagename = "__strstr"; + } + SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile); /* Fortran does not have mangling standard and the mangling does differ -Index: gdb-7.6.90.20140127/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.90.20140127/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2014-02-06 18:18:16.294579381 +0100 ++++ gdb-7.7.90.20140613/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp 2014-06-13 21:59:41.174840871 +0200 @@ -0,0 +1,108 @@ +# Copyright (C) 2012 Free Software Foundation, Inc. + diff --git a/gdb-gnat-dwarf-crash-1of3.patch b/gdb-gnat-dwarf-crash-1of3.patch deleted file mode 100644 index efad332..0000000 --- a/gdb-gnat-dwarf-crash-1of3.patch +++ /dev/null @@ -1,451 +0,0 @@ -commit adde2bff0757e89175ede493f03b86953d0d9352 -Author: Doug Evans -Date: Thu Feb 20 09:13:53 2014 -0800 - - Fix PR symtab/16581 - - * dwarf2read.c (struct die_info): New member in_process. - (reset_die_in_process): New function. - (process_die): Set it at the start, reset when returning. - (inherit_abstract_dies): Only call process_die if origin_child_die - not already being processed. - - testsuite/ - * gdb.dwarf2/dw2-icycle.S: New file. - * gdb.dwarf2/dw2-icycle.c: New file. - * gdb.dwarf2/dw2-icycle.exp: New file. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,14 @@ -+2014-02-20 lin zuojian -+ Joel Brobecker -+ Doug Evans -+ -+ PR symtab/16581 -+ * dwarf2read.c (struct die_info): New member in_process. -+ (reset_die_in_process): New function. -+ (process_die): Set it at the start, reset when returning. -+ (inherit_abstract_dies): Only call process_die if origin_child_die -+ not already being processed. -+ - 2014-02-20 Joel Brobecker - - * windows-nat.c (handle_unload_dll): Add function documentation. ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -1225,6 +1225,9 @@ struct die_info - type derived from this DIE. */ - unsigned char building_fullname : 1; - -+ /* True if this die is in process. PR 16581. */ -+ unsigned char in_process : 1; -+ - /* Abbrev number */ - unsigned int abbrev; - -@@ -8008,11 +8011,28 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) - } - } - -+/* Reset the in_process bit of a die. */ -+ -+static void -+reset_die_in_process (void *arg) -+{ -+ struct die_info *die = arg; -+ die->in_process = 0; -+} -+ - /* Process a die and its children. */ - - static void - process_die (struct die_info *die, struct dwarf2_cu *cu) - { -+ struct cleanup *in_process; -+ -+ /* We should only be processing those not already in process. */ -+ gdb_assert (!die->in_process); -+ -+ die->in_process = 1; -+ in_process = make_cleanup (reset_die_in_process,die); -+ - switch (die->tag) - { - case DW_TAG_padding: -@@ -7762,6 +7782,8 @@ process_die (struct die_info *die, struc - new_symbol (die, NULL, cu); - break; - } -+ -+ do_cleanups (in_process); - } - - /* DWARF name computation. */ -@@ -10967,8 +10989,12 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) - if (offsetp >= offsets_end - || offsetp->sect_off > origin_child_die->offset.sect_off) - { -- /* Found that ORIGIN_CHILD_DIE is really not referenced. */ -- process_die (origin_child_die, origin_cu); -+ /* Found that ORIGIN_CHILD_DIE is really not referenced. -+ Check whether we're already processing ORIGIN_CHILD_DIE. -+ This can happen with mutually referenced abstract_origins. -+ PR 16581. */ -+ if (!origin_child_die->in_process) -+ process_die (origin_child_die, origin_cu); - } - origin_child_die = sibling_die (origin_child_die); - } -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,3 +1,12 @@ -+2014-02-20 lin zuojian -+ Joel Brobecker -+ Doug Evans -+ -+ PR symtab/16581 -+ * gdb.dwarf2/dw2-icycle.S: New file. -+ * gdb.dwarf2/dw2-icycle.c: New file. -+ * gdb.dwarf2/dw2-icycle.exp: New file. -+ - 2014-02-19 Siva Chandra Reddy - - * gdb.python/py-value-cc.cc: Improve test case to enable testing ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S -@@ -0,0 +1,258 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+ .text -+ -+.Ltext0: -+ .type p__top__middle__inside.3062, @function -+p__top__middle__inside.3062: -+.LFB4: -+ .file 1 "p.adb" -+ .4byte 0 -+.LBE6: -+ -+ .globl p__top -+ .type p__top, @function -+p__top: -+.LFB2: -+ .4byte 0 -+.LFE2: -+.Letext0: -+ -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .4byte .Ledebug_info0 - .Lsdebug_info0 /* Length of CU Info */ -+.Lsdebug_info0: -+ .2byte 0x4 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 0x4 /* Pointer Size (in bytes) */ -+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ -+ .ascii "GNU Ada 4.9.0 20140126\0" /* DW_AT_producer */ -+ .byte 0xd /* DW_AT_language */ -+ .ascii "p.adb\0" /* DW_AT_name */ -+ .ascii "/tmp\0" /* DW_AT_comp_dir */ -+ .4byte .Ltext0 /* DW_AT_low_pc */ -+ .4byte .Letext0-.Ltext0 /* DW_AT_high_pc */ -+.S0x142: -+ .uleb128 0x8 /* (DIE (0x142) DW_TAG_base_type) */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .byte 0x5 /* DW_AT_encoding */ -+ .ascii "integer\0" /* DW_AT_name */ -+ -+ .uleb128 0x13 /* (DIE (0x1b4) DW_TAG_subprogram) */ -+ /* DW_AT_external */ -+ .ascii "p__top\0" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_decl_file (p.adb) */ -+ .byte 0x3 /* DW_AT_decl_line */ -+ .4byte .LFB2 /* DW_AT_low_pc */ -+ .4byte .LFE2-.LFB2 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_AT_frame_base */ -+ .byte 0x9c /* DW_OP_call_frame_cfa */ -+ /* DW_AT_GNU_all_call_sites */ -+ .4byte .S0x4fc - .Ldebug_info0 /* DW_AT_sibling */ -+.S0x1e0: -+ .uleb128 0x15 /* (DIE (0x1e0) DW_TAG_subprogram) */ -+ .ascii "p__top__middle\0" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_decl_file (p.adb) */ -+ .byte 0x4 /* DW_AT_decl_line */ -+ .byte 0x1 /* DW_AT_inline */ -+ .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */ -+.S0x202: -+ .uleb128 0x15 /* (DIE (0x202) DW_TAG_subprogram) */ -+ .ascii "p__top__middle__inside\0" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_decl_file (p.adb) */ -+ .byte 0x5 /* DW_AT_decl_line */ -+ .byte 0x1 /* DW_AT_inline */ -+ .4byte .S0x225 - .Ldebug_info0 /* DW_AT_sibling */ -+ .byte 0 /* end of children of DIE 0x202 */ -+.S0x225: -+ .uleb128 0x18 /* (DIE (0x225) DW_TAG_subprogram) */ -+ .4byte .S0x202 - .Ldebug_info0 /* DW_AT_abstract_origin */ -+ .4byte .LFB4 /* DW_AT_low_pc */ -+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_AT_frame_base */ -+ .byte 0x9c /* DW_OP_call_frame_cfa */ -+ .uleb128 0x1 /* DW_AT_static_link */ -+ .byte 0x56 /* DW_OP_reg6 */ -+ /* DW_AT_GNU_all_call_sites */ -+ .uleb128 0x1a /* (DIE (0x247) DW_TAG_inlined_subroutine) */ -+ .4byte .S0x1e0 - .Ldebug_info0 /* DW_AT_abstract_origin */ -+ .4byte .LFB4 /* DW_AT_low_pc */ -+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */ -+ .byte 0x1 /* DW_AT_call_file (p.adb) */ -+ .byte 0x14 /* DW_AT_call_line */ -+ .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */ -+ .byte 0 /* end of children of DIE 0x247 */ -+ .byte 0 /* end of children of DIE 0x225 */ -+ .byte 0 /* end of children of DIE 0x1e0 */ -+.S0x374: -+ .uleb128 0x23 /* (DIE (0x382) DW_TAG_inlined_subroutine) */ -+ .4byte .S0x1e0 - .Ldebug_info0 /* DW_AT_abstract_origin */ -+ .4byte .LFB4 /* DW_AT_low_pc */ -+ .4byte .LBE6-.LFB4 /* DW_AT_high_pc */ -+ .byte 0x1 /* DW_AT_call_file (p.adb) */ -+ .byte 0x1d /* DW_AT_call_line */ -+ .byte 0 /* end of children of DIE 0x382 */ -+ .byte 0 /* end of children of DIE 0x1b4 */ -+.S0x4fc: -+ .uleb128 0x28 /* (DIE (0x52e) DW_TAG_subprogram) */ -+ /* DW_AT_external */ -+ .ascii "__gnat_rcheck_PE_Explicit_Raise\0" /* DW_AT_name */ -+ /* DW_AT_artificial */ -+ /* DW_AT_declaration */ -+ .byte 0 /* end of children of DIE 0x52e */ -+ .byte 0 /* end of children of DIE 0xb */ -+.Ledebug_info0: -+ -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .uleb128 0x1 /* (abbrev code) */ -+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x25 /* (DW_AT_producer) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x13 /* (DW_AT_language) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x1b /* (DW_AT_comp_dir) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x11 /* (DW_AT_low_pc) */ -+ .uleb128 0x1 /* (DW_FORM_addr) */ -+ .uleb128 0x12 /* (DW_AT_high_pc) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 /* (abbrev code) */ -+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3e /* (DW_AT_encoding) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x13 /* (abbrev code) */ -+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3f /* (DW_AT_external) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x11 /* (DW_AT_low_pc) */ -+ .uleb128 0x1 /* (DW_FORM_addr) */ -+ .uleb128 0x12 /* (DW_AT_high_pc) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .uleb128 0x40 /* (DW_AT_frame_base) */ -+ .uleb128 0x18 /* (DW_FORM_exprloc) */ -+ .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .uleb128 0x1 /* (DW_AT_sibling) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x15 /* (abbrev code) */ -+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x20 /* (DW_AT_inline) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x1 /* (DW_AT_sibling) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x18 /* (abbrev code) */ -+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x31 /* (DW_AT_abstract_origin) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x11 /* (DW_AT_low_pc) */ -+ .uleb128 0x1 /* (DW_FORM_addr) */ -+ .uleb128 0x12 /* (DW_AT_high_pc) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .uleb128 0x40 /* (DW_AT_frame_base) */ -+ .uleb128 0x18 /* (DW_FORM_exprloc) */ -+ .uleb128 0x48 /* (DW_AT_static_link) */ -+ .uleb128 0x18 /* (DW_FORM_exprloc) */ -+ .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x1a /* (abbrev code) */ -+ .uleb128 0x1d /* (TAG: DW_TAG_inlined_subroutine) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x31 /* (DW_AT_abstract_origin) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x11 /* (DW_AT_low_pc) */ -+ .uleb128 0x1 /* (DW_FORM_addr) */ -+ .uleb128 0x12 /* (DW_AT_high_pc) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .uleb128 0x58 /* (DW_AT_call_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x59 /* (DW_AT_call_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x1 /* (DW_AT_sibling) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x23 /* (abbrev code) */ -+ .uleb128 0x1d /* (TAG: DW_TAG_inlined_subroutine) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x31 /* (DW_AT_abstract_origin) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x11 /* (DW_AT_low_pc) */ -+ .uleb128 0x1 /* (DW_FORM_addr) */ -+ .uleb128 0x12 /* (DW_AT_high_pc) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .uleb128 0x58 /* (DW_AT_call_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x59 /* (DW_AT_call_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x28 /* (abbrev code) */ -+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3f /* (DW_AT_external) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x34 /* (DW_AT_artificial) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .uleb128 0x3c /* (DW_AT_declaration) */ -+ .uleb128 0x19 /* (DW_FORM_flag_present) */ -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ -+ .section .debug_line -+.Lline1_begin: -+ .byte 0 -+ ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.c -@@ -0,0 +1,24 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004-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 . */ -+ -+/* Dummy main function. */ -+ -+int -+main() -+{ -+ return 0; -+} ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp -@@ -0,0 +1,46 @@ -+# Copyright 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 . -+ -+# This test exercises PR 16581. -+ -+load_lib dwarf.exp -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+if {![dwarf2_support]} { -+ return 0 -+} -+ -+standard_testfile .S .c -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} \ -+ [list $srcfile $srcfile2] {nodebug}] } { -+ return -1 -+} -+ -+# We are trying to verify that the partial symtab to symtab expansion -+# for the debugging info hand-coded in our assembly file does not cause -+# the debugger to crash (infinite recursion). To facilitate the test, -+# start the debugger with -readnow. This force expansion as soon as -+# the objfile is loaded. -+ -+set saved_gdbflags $GDBFLAGS -+set GDBFLAGS "$GDBFLAGS -readnow" -+clean_restart ${testfile} -+set GDBFLAGS $saved_gdbflags -+ -+# And just to be sure that the debugger did not crash after having -+# expanded our symbols, do a life-check. -+ -+gdb_test "echo life check\\n" "life check" diff --git a/gdb-gnat-dwarf-crash-2of3.patch b/gdb-gnat-dwarf-crash-2of3.patch deleted file mode 100644 index 32f0259..0000000 --- a/gdb-gnat-dwarf-crash-2of3.patch +++ /dev/null @@ -1,125 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-02/msg00729.html -Subject: [patch] [testsuite] Fix dw2-icycle.exp -fsanitize=address GDB crash - - ---WIyZ46R2i8wDzkSu -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi Doug, - -in fact obvious, I will check it in. - -binutils readelf -wi: - <4>: Abbrev Number: 26 (DW_TAG_inlined_subroutine) - DW_AT_abstract_origin: <0x5a> - DW_AT_low_pc : 0x400590 - DW_AT_high_pc : 0x4 - DW_AT_call_file : 1 - DW_AT_call_line : 20 - DW_AT_sibling : <0xb8> - <2>: Abbrev Number: 35 (DW_TAG_inlined_subroutine) - DW_AT_abstract_origin: <0x5a> - DW_AT_low_pc : 0x400590 - DW_AT_high_pc : 0x4 - DW_AT_call_file : 1 - DW_AT_call_line : 29 - - DW_AT_sibling points to the next DIE - but that DIE is 2 levels -upwards - definitely not a sibling. This confuses GDB up to a crash: - -==32143== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6024000198ac at pc 0xb4d104 bp 0x7fff63e96e70 sp 0x7fff63e96e60 -READ of size 1 at 0x6024000198ac thread T0 - #0 0xb4d103 in read_unsigned_leb128 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb4d103) - #1 0xb15f3c in peek_die_abbrev (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb15f3c) - #2 0xb46185 in load_partial_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb46185) - #3 0xb103fb in process_psymtab_comp_unit_reader (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb103fb) - #4 0xb0d2a9 in init_cutu_and_read_dies (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb0d2a9) - #5 0xb1115f in process_psymtab_comp_unit (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1115f) - #6 0xb1235f in dwarf2_build_psymtabs_hard (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb1235f) - #7 0xb05536 in dwarf2_build_psymtabs (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0xb05536) - #8 0x86d5a5 in read_psyms (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x86d5a5) - #9 0x9b1c37 in require_partial_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9b1c37) - #10 0x9bf2d0 in read_symbols (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9bf2d0) - #11 0x9c014c in syms_from_objfile_1 (/home/jkratoch/redhat/gdb-clean/gdb/gdb+0x9c014c) - -I have added === Delete all DW_AT_sibling ===: - https://sourceware.org/gdb/wiki/GDBTestcaseCookbook?action=diff&rev2=31&rev1=30 - - -Jan - ---WIyZ46R2i8wDzkSu -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="sibling.patch" - -gdb/testsuite/ -2014-02-24 Jan Kratochvil - - Fix dw2-icycle.exp -fsanitize=address GDB crash. - * gdb.dwarf2/dw2-icycle.S: Remove all DW_AT_sibling. - -diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S -index 1f84e4a..938ff20 100644 ---- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.S -+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.S -@@ -63,21 +63,18 @@ p__top: - .uleb128 0x1 /* DW_AT_frame_base */ - .byte 0x9c /* DW_OP_call_frame_cfa */ - /* DW_AT_GNU_all_call_sites */ -- .4byte .S0x4fc - .Ldebug_info0 /* DW_AT_sibling */ - .S0x1e0: - .uleb128 0x15 /* (DIE (0x1e0) DW_TAG_subprogram) */ - .ascii "p__top__middle\0" /* DW_AT_name */ - .byte 0x1 /* DW_AT_decl_file (p.adb) */ - .byte 0x4 /* DW_AT_decl_line */ - .byte 0x1 /* DW_AT_inline */ -- .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */ - .S0x202: - .uleb128 0x15 /* (DIE (0x202) DW_TAG_subprogram) */ - .ascii "p__top__middle__inside\0" /* DW_AT_name */ - .byte 0x1 /* DW_AT_decl_file (p.adb) */ - .byte 0x5 /* DW_AT_decl_line */ - .byte 0x1 /* DW_AT_inline */ -- .4byte .S0x225 - .Ldebug_info0 /* DW_AT_sibling */ - .byte 0 /* end of children of DIE 0x202 */ - .S0x225: - .uleb128 0x18 /* (DIE (0x225) DW_TAG_subprogram) */ -@@ -95,7 +92,6 @@ p__top: - .4byte .LBE6-.LFB4 /* DW_AT_high_pc */ - .byte 0x1 /* DW_AT_call_file (p.adb) */ - .byte 0x14 /* DW_AT_call_line */ -- .4byte .S0x374 - .Ldebug_info0 /* DW_AT_sibling */ - .byte 0 /* end of children of DIE 0x247 */ - .byte 0 /* end of children of DIE 0x225 */ - .byte 0 /* end of children of DIE 0x1e0 */ -@@ -167,8 +163,6 @@ p__top: - .uleb128 0x18 /* (DW_FORM_exprloc) */ - .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */ - .uleb128 0x19 /* (DW_FORM_flag_present) */ -- .uleb128 0x1 /* (DW_AT_sibling) */ -- .uleb128 0x13 /* (DW_FORM_ref4) */ - .byte 0 - .byte 0 - .uleb128 0x15 /* (abbrev code) */ -@@ -182,8 +176,6 @@ p__top: - .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x20 /* (DW_AT_inline) */ - .uleb128 0xb /* (DW_FORM_data1) */ -- .uleb128 0x1 /* (DW_AT_sibling) */ -- .uleb128 0x13 /* (DW_FORM_ref4) */ - .byte 0 - .byte 0 - .uleb128 0x18 /* (abbrev code) */ -@@ -216,8 +208,6 @@ p__top: - .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x59 /* (DW_AT_call_line) */ - .uleb128 0xb /* (DW_FORM_data1) */ -- .uleb128 0x1 /* (DW_AT_sibling) */ -- .uleb128 0x13 /* (DW_FORM_ref4) */ - .byte 0 - .byte 0 - .uleb128 0x23 /* (abbrev code) */ - ---WIyZ46R2i8wDzkSu-- - diff --git a/gdb-rhbz795424-bitpos-20of25.patch b/gdb-rhbz795424-bitpos-20of25.patch index ed20d8b..cd17364 100644 --- a/gdb-rhbz795424-bitpos-20of25.patch +++ b/gdb-rhbz795424-bitpos-20of25.patch @@ -463,11 +463,11 @@ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bitpos-main.patch -Index: gdb-7.7.1/gdb/ada-lang.c +Index: gdb-7.7.90.20140613/gdb/ada-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/ada-lang.c 2014-05-12 20:22:04.761443495 +0200 -+++ gdb-7.7.1/gdb/ada-lang.c 2014-05-12 20:22:05.781444107 +0200 -@@ -80,7 +80,7 @@ static struct type *desc_bounds_type (st +--- gdb-7.7.90.20140613.orig/gdb/ada-lang.c 2014-06-16 23:27:05.125747019 +0200 ++++ gdb-7.7.90.20140613/gdb/ada-lang.c 2014-06-16 23:27:07.850749591 +0200 +@@ -78,7 +78,7 @@ static struct type *desc_bounds_type (st static struct value *desc_bounds (struct value *); @@ -476,7 +476,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c static int fat_pntr_bounds_bitsize (struct type *); -@@ -88,13 +88,13 @@ static struct type *desc_data_target_typ +@@ -86,13 +86,13 @@ static struct type *desc_data_target_typ static struct value *desc_data (struct value *); @@ -492,7 +492,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c static int desc_bound_bitsize (struct type *, int, int); -@@ -174,7 +174,7 @@ static struct type *static_unwrap_type ( +@@ -172,7 +172,7 @@ static struct type *static_unwrap_type ( static struct value *unwrap_value (struct value *); @@ -501,7 +501,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c static struct type *decode_constrained_packed_array_type (struct type *); -@@ -189,7 +189,8 @@ static int ada_is_unconstrained_packed_a +@@ -187,7 +187,8 @@ static int ada_is_unconstrained_packed_a static struct value *value_subscript_packed (struct value *, int, struct value **); @@ -511,7 +511,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c static struct value *coerce_unspec_val_to_type (struct value *, struct type *); -@@ -217,14 +218,14 @@ static struct value *value_val_atr (stru +@@ -215,14 +216,14 @@ static struct value *value_val_atr (stru static struct symbol *standard_lookup (const char *, const struct block *, domain_enum); @@ -530,7 +530,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR, struct value *); -@@ -240,7 +241,7 @@ static void ada_language_arch_info (stru +@@ -238,7 +239,7 @@ static void ada_language_arch_info (stru static void check_size (const struct type *); @@ -539,7 +539,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *); static struct value *assign_aggregate (struct value *, struct value *, -@@ -587,7 +588,7 @@ coerce_unspec_val_to_type (struct value +@@ -694,7 +695,7 @@ coerce_unspec_val_to_type (struct value } static const gdb_byte * @@ -548,7 +548,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c { if (valaddr == NULL) return NULL; -@@ -596,7 +597,7 @@ cond_offset_host (const gdb_byte *valadd +@@ -703,7 +704,7 @@ cond_offset_host (const gdb_byte *valadd } static CORE_ADDR @@ -557,7 +557,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c { if (address == 0) return 0; -@@ -1602,7 +1603,7 @@ desc_bounds (struct value *arr) +@@ -1711,7 +1712,7 @@ desc_bounds (struct value *arr) /* If TYPE is the type of an array-descriptor (fat pointer), the bit position of the field containing the address of the bounds data. */ @@ -566,7 +566,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c fat_pntr_bounds_bitpos (struct type *type) { return TYPE_FIELD_BITPOS (desc_base_type (type), 1); -@@ -1668,7 +1669,7 @@ desc_data (struct value *arr) +@@ -1777,7 +1778,7 @@ desc_data (struct value *arr) /* If TYPE is the type of an array-descriptor (fat pointer), the bit position of the field containing the address of the data. */ @@ -575,7 +575,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c fat_pntr_data_bitpos (struct type *type) { return TYPE_FIELD_BITPOS (desc_base_type (type), 0); -@@ -1703,7 +1704,7 @@ desc_one_bound (struct value *bounds, in +@@ -1812,7 +1813,7 @@ desc_one_bound (struct value *bounds, in of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper bound, if WHICH is 1. The first bound is I=1. */ @@ -584,7 +584,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c desc_bound_bitpos (struct type *type, int i, int which) { return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2); -@@ -1893,7 +1894,7 @@ ada_type_of_array (struct value *arr, in +@@ -2002,7 +2003,7 @@ ada_type_of_array (struct value *arr, in zero, and does not need to be recomputed. */ if (lo < hi) { @@ -593,7 +593,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8; -@@ -2045,7 +2046,7 @@ decode_packed_array_bitsize (struct type +@@ -2154,7 +2155,7 @@ decode_packed_array_bitsize (struct type in bits. */ static struct type * @@ -602,7 +602,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c { struct type *new_elt_type; struct type *new_type; -@@ -2097,7 +2098,7 @@ decode_constrained_packed_array_type (st +@@ -2206,7 +2207,7 @@ decode_constrained_packed_array_type (st char *name; const char *tail; struct type *shadow_type; @@ -611,7 +611,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c if (!raw_name) raw_name = ada_type_name (desc_base_type (type)); -@@ -2168,7 +2169,8 @@ decode_constrained_packed_array (struct +@@ -2277,7 +2278,8 @@ decode_constrained_packed_array (struct array with no wrapper. In order to interpret the value through the (left-justified) packed array type we just built, we must first left-justify it. */ @@ -621,7 +621,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c ULONGEST mod; mod = ada_modulus (value_type (arr)) - 1; -@@ -2269,15 +2271,16 @@ has_negatives (struct type *type) +@@ -2378,15 +2380,16 @@ has_negatives (struct type *type) struct value * ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, @@ -644,7 +644,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c byte of source that are unused */ accumSize; /* Number of meaningful bits in accum */ unsigned char *bytes; /* First byte containing data to unpack */ -@@ -2310,7 +2313,7 @@ ada_value_primitive_packed_val (struct v +@@ -2420,7 +2423,7 @@ ada_value_primitive_packed_val (struct v if (obj != NULL) { @@ -653,7 +653,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c set_value_component_location (v, obj); set_value_bitpos (v, bit_offset + value_bitpos (obj)); -@@ -2426,7 +2429,7 @@ ada_value_primitive_packed_val (struct v +@@ -2536,7 +2539,7 @@ ada_value_primitive_packed_val (struct v not overlap. */ static void move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source, @@ -662,7 +662,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c { unsigned int accum, mask; int accum_bits, chunk_size; -@@ -2516,7 +2519,7 @@ ada_value_assign (struct value *toval, s +@@ -2626,7 +2629,7 @@ ada_value_assign (struct value *toval, s { int len = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; @@ -671,7 +671,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c gdb_byte *buffer = alloca (len); struct value *val; CORE_ADDR to_addr = value_address (toval); -@@ -2561,7 +2564,7 @@ value_assign_to_component (struct value +@@ -2671,7 +2674,7 @@ value_assign_to_component (struct value (LONGEST) (value_address (component) - value_address (container)); int bit_offset_in_container = value_bitpos (component) - value_bitpos (container); @@ -680,7 +680,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c val = value_cast (value_type (component), val); -@@ -4085,7 +4088,7 @@ ensure_lval (struct value *val) +@@ -4196,7 +4199,7 @@ ensure_lval (struct value *val) if (VALUE_LVAL (val) == not_lval || VALUE_LVAL (val) == lval_internalvar) { @@ -689,7 +689,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c const CORE_ADDR addr = value_as_long (value_allocate_space_in_inferior (len)); -@@ -4159,7 +4162,7 @@ static CORE_ADDR +@@ -4270,7 +4273,7 @@ static CORE_ADDR value_pointer (struct value *value, struct type *type) { struct gdbarch *gdbarch = get_type_arch (type); @@ -698,7 +698,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c gdb_byte *buf = alloca (len); CORE_ADDR addr; -@@ -6145,7 +6148,7 @@ value_tag_from_contents_and_address (str +@@ -6374,7 +6377,7 @@ value_tag_from_contents_and_address (str const gdb_byte *valaddr, CORE_ADDR address) { @@ -707,7 +707,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *tag_type; if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, -@@ -6610,7 +6613,7 @@ ada_in_variant (LONGEST val, struct type +@@ -6839,7 +6842,7 @@ ada_in_variant (LONGEST val, struct type only in that it can handle packed values of arbitrary type. */ static struct value * @@ -716,7 +716,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *arg_type) { struct type *type; -@@ -6622,7 +6625,7 @@ ada_value_primitive_field (struct value +@@ -6851,7 +6854,7 @@ ada_value_primitive_field (struct value if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0) { @@ -725,7 +725,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); return ada_value_primitive_packed_val (arg1, value_contents (arg1), -@@ -6649,9 +6652,9 @@ ada_value_primitive_field (struct value +@@ -6878,9 +6881,9 @@ ada_value_primitive_field (struct value Returns 1 if found, 0 otherwise. */ static int @@ -737,7 +737,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c int *index_p) { int i; -@@ -6669,8 +6672,8 @@ find_struct_field (const char *name, str +@@ -6898,8 +6901,8 @@ find_struct_field (const char *name, str for (i = 0; i < TYPE_NFIELDS (type); i += 1) { @@ -748,7 +748,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c const char *t_field_name = TYPE_FIELD_NAME (type, i); if (t_field_name == NULL) -@@ -6740,7 +6743,7 @@ num_visible_fields (struct type *type) +@@ -6969,7 +6972,7 @@ num_visible_fields (struct type *type) Searches recursively through wrapper fields (e.g., '_parent'). */ static struct value * @@ -757,7 +757,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *type) { int i; -@@ -6773,7 +6776,7 @@ ada_search_struct_field (char *name, str +@@ -7002,7 +7005,7 @@ ada_search_struct_field (char *name, str int j; struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -766,7 +766,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c for (j = 0; j < TYPE_NFIELDS (field_type); j += 1) { -@@ -6791,8 +6794,8 @@ ada_search_struct_field (char *name, str +@@ -7020,8 +7023,8 @@ ada_search_struct_field (char *name, str return NULL; } @@ -777,7 +777,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c /* Return field #INDEX in ARG, where the index is that returned by -@@ -6801,7 +6804,7 @@ static struct value *ada_index_struct_fi +@@ -7030,7 +7033,7 @@ static struct value *ada_index_struct_fi * If found, return value, else return NULL. */ static struct value * @@ -786,7 +786,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *type) { return ada_index_struct_field_1 (&index, arg, offset, type); -@@ -6813,7 +6816,7 @@ ada_index_struct_field (int index, struc +@@ -7042,7 +7045,7 @@ ada_index_struct_field (int index, struc * *INDEX_P. */ static struct value * @@ -795,7 +795,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *type) { int i; -@@ -6903,7 +6906,8 @@ ada_value_struct_elt (struct value *arg, +@@ -7132,7 +7135,8 @@ ada_value_struct_elt (struct value *arg, v = ada_search_struct_field (name, arg, 0, t); else { @@ -805,7 +805,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c struct type *field_type; CORE_ADDR address; -@@ -7216,8 +7220,8 @@ ada_coerce_ref (struct value *val0) +@@ -7449,8 +7453,8 @@ ada_coerce_ref (struct value *val0) /* Return OFF rounded upward if necessary to a multiple of ALIGNMENT (a power of 2). */ @@ -816,7 +816,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c { return (off + alignment - 1) & ~(alignment - 1); } -@@ -7596,10 +7600,9 @@ ada_template_to_fixed_record_type_1 (str +@@ -7832,10 +7836,9 @@ ada_template_to_fixed_record_type_1 (str struct value *mark = value_mark (); struct value *dval; struct type *rtype; @@ -829,7 +829,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c int f; /* Compute the number of fields in this record type that are going -@@ -7670,7 +7673,7 @@ ada_template_to_fixed_record_type_1 (str +@@ -7913,7 +7916,7 @@ ada_template_to_fixed_record_type_1 (str that follow this one. */ if (ada_is_aligner_type (field_type)) { @@ -838,7 +838,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c field_valaddr = cond_offset_host (field_valaddr, field_offset); field_address = cond_offset_target (field_address, field_offset); -@@ -7799,11 +7802,11 @@ ada_template_to_fixed_record_type_1 (str +@@ -8049,11 +8052,11 @@ ada_template_to_fixed_record_type_1 (str if (TYPE_LENGTH (type) <= 0) { if (TYPE_NAME (rtype)) @@ -854,7 +854,7 @@ Index: gdb-7.7.1/gdb/ada-lang.c } else { -@@ -8140,7 +8143,8 @@ to_fixed_array_type (struct type *type0, +@@ -8393,7 +8396,8 @@ to_fixed_array_type (struct type *type0, type was a regular (non-packed) array type. As a result, the bitsize of the array elements needs to be set again, and the array length needs to be recomputed based on that bitsize. */ @@ -864,11 +864,11 @@ Index: gdb-7.7.1/gdb/ada-lang.c int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0); TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0); -Index: gdb-7.7.1/gdb/ada-lang.h +Index: gdb-7.7.90.20140613/gdb/ada-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/ada-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ada-lang.h 2014-05-12 20:22:05.781444107 +0200 -@@ -180,7 +180,7 @@ extern void ada_print_type (struct type +--- gdb-7.7.90.20140613.orig/gdb/ada-lang.h 2014-06-16 23:27:05.126747020 +0200 ++++ gdb-7.7.90.20140613/gdb/ada-lang.h 2014-06-16 23:27:07.850749591 +0200 +@@ -181,7 +181,7 @@ extern void ada_print_type (struct type extern void ada_print_typedef (struct type *type, struct symbol *new_symbol, struct ui_file *stream); @@ -877,7 +877,7 @@ Index: gdb-7.7.1/gdb/ada-lang.h struct ui_file *, int, const struct value *, const struct value_print_options *); -@@ -195,7 +195,7 @@ extern void ada_emit_char (int, struct t +@@ -196,7 +196,7 @@ extern void ada_emit_char (int, struct t extern void ada_printchar (int, struct type *, struct ui_file *); extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *, @@ -886,7 +886,7 @@ Index: gdb-7.7.1/gdb/ada-lang.h const struct value_print_options *); struct value *ada_convert_actual (struct value *actual, -@@ -268,7 +268,7 @@ extern int ada_is_constrained_packed_arr +@@ -267,7 +267,7 @@ extern int ada_is_constrained_packed_arr extern struct value *ada_value_primitive_packed_val (struct value *, const gdb_byte *, @@ -895,11 +895,11 @@ Index: gdb-7.7.1/gdb/ada-lang.h struct type *); extern struct type *ada_coerce_to_simple_array_type (struct type *); -Index: gdb-7.7.1/gdb/ada-typeprint.c +Index: gdb-7.7.90.20140613/gdb/ada-typeprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/ada-typeprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ada-typeprint.c 2014-05-12 20:22:05.781444107 +0200 -@@ -829,8 +829,8 @@ ada_print_type (struct type *type0, cons +--- gdb-7.7.90.20140613.orig/gdb/ada-typeprint.c 2014-06-16 23:27:05.126747020 +0200 ++++ gdb-7.7.90.20140613/gdb/ada-typeprint.c 2014-06-16 23:27:07.851749592 +0200 +@@ -865,8 +865,8 @@ ada_print_type (struct type *type0, cons const char *name = ada_type_name (type); if (!ada_is_range_type_name (name)) @@ -910,7 +910,7 @@ Index: gdb-7.7.1/gdb/ada-typeprint.c else { fprintf_filtered (stream, "range "); -@@ -851,7 +851,8 @@ ada_print_type (struct type *type0, cons +@@ -887,7 +887,8 @@ ada_print_type (struct type *type0, cons } break; case TYPE_CODE_FLT: @@ -920,10 +920,10 @@ Index: gdb-7.7.1/gdb/ada-typeprint.c break; case TYPE_CODE_ENUM: if (show < 0) -Index: gdb-7.7.1/gdb/ada-valprint.c +Index: gdb-7.7.90.20140613/gdb/ada-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/ada-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ada-valprint.c 2014-05-12 20:22:05.782444107 +0200 +--- gdb-7.7.90.20140613.orig/gdb/ada-valprint.c 2014-06-16 23:27:05.127747021 +0200 ++++ gdb-7.7.90.20140613/gdb/ada-valprint.c 2014-06-16 23:27:07.851749592 +0200 @@ -35,11 +35,11 @@ #include "objfiles.h" @@ -1077,11 +1077,11 @@ Index: gdb-7.7.1/gdb/ada-valprint.c struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options) -Index: gdb-7.7.1/gdb/annotate.c +Index: gdb-7.7.90.20140613/gdb/annotate.c =================================================================== ---- gdb-7.7.1.orig/gdb/annotate.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/annotate.c 2014-05-12 20:22:05.782444107 +0200 -@@ -523,21 +523,21 @@ annotate_frame_end (void) +--- gdb-7.7.90.20140613.orig/gdb/annotate.c 2014-06-16 23:27:05.127747021 +0200 ++++ gdb-7.7.90.20140613/gdb/annotate.c 2014-06-16 23:27:07.851749592 +0200 +@@ -524,21 +524,21 @@ annotate_frame_end (void) } void @@ -1107,10 +1107,10 @@ Index: gdb-7.7.1/gdb/annotate.c } void -Index: gdb-7.7.1/gdb/annotate.h +Index: gdb-7.7.90.20140613/gdb/annotate.h =================================================================== ---- gdb-7.7.1.orig/gdb/annotate.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/annotate.h 2014-05-12 20:22:05.782444107 +0200 +--- gdb-7.7.90.20140613.orig/gdb/annotate.h 2014-06-16 23:27:05.127747021 +0200 ++++ gdb-7.7.90.20140613/gdb/annotate.h 2014-06-16 23:27:07.852749593 +0200 @@ -92,8 +92,8 @@ extern void annotate_frame_source_end (v extern void annotate_frame_where (void); extern void annotate_frame_end (void); @@ -1122,24 +1122,24 @@ Index: gdb-7.7.1/gdb/annotate.h extern void annotate_elt_rep_end (void); extern void annotate_elt (void); extern void annotate_array_section_end (void); -Index: gdb-7.7.1/gdb/arm-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/arm-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/arm-linux-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/arm-linux-nat.c 2014-05-12 20:22:05.782444107 +0200 -@@ -1073,7 +1073,7 @@ arm_linux_remove_hw_breakpoint (struct g - /* Are we able to use a hardware watchpoint for the LEN bytes starting at +--- gdb-7.7.90.20140613.orig/gdb/arm-linux-nat.c 2014-06-16 23:27:05.128747022 +0200 ++++ gdb-7.7.90.20140613/gdb/arm-linux-nat.c 2014-06-16 23:27:07.852749593 +0200 +@@ -1187,7 +1187,7 @@ arm_linux_remove_hw_breakpoint (struct t ADDR? */ static int --arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + arm_linux_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); CORE_ADDR max_wp_length, aligned_addr; -Index: gdb-7.7.1/gdb/ax-gdb.c +Index: gdb-7.7.90.20140613/gdb/ax-gdb.c =================================================================== ---- gdb-7.7.1.orig/gdb/ax-gdb.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ax-gdb.c 2014-05-12 20:22:05.783444108 +0200 -@@ -82,12 +82,12 @@ static void gen_traced_pop (struct gdbar +--- gdb-7.7.90.20140613.orig/gdb/ax-gdb.c 2014-06-16 23:27:05.129747022 +0200 ++++ gdb-7.7.90.20140613/gdb/ax-gdb.c 2014-06-16 23:27:07.853749594 +0200 +@@ -83,12 +83,12 @@ static void gen_traced_pop (struct gdbar static void gen_sign_extend (struct agent_expr *, struct type *); static void gen_extend (struct agent_expr *, struct type *); static void gen_fetch (struct agent_expr *, struct type *); @@ -1154,7 +1154,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c static void gen_sym_offset (struct agent_expr *, struct symbol *); static void gen_var_ref (struct gdbarch *, struct agent_expr *ax, struct axs_value *value, struct symbol *var); -@@ -135,15 +135,16 @@ static void gen_deref (struct agent_expr +@@ -136,15 +136,16 @@ static void gen_deref (struct agent_expr static void gen_address_of (struct agent_expr *, struct axs_value *); static void gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, struct axs_value *value, @@ -1174,7 +1174,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c struct type *type); static void gen_struct_ref (struct expression *exp, struct agent_expr *ax, struct axs_value *value, -@@ -538,7 +539,7 @@ gen_fetch (struct agent_expr *ax, struct +@@ -539,7 +540,7 @@ gen_fetch (struct agent_expr *ax, struct right shift it by -DISTANCE bits if DISTANCE < 0. This generates unsigned (logical) right shifts. */ static void @@ -1183,7 +1183,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c { if (distance > 0) { -@@ -592,7 +593,7 @@ gen_frame_locals_address (struct gdbarch +@@ -593,7 +594,7 @@ gen_frame_locals_address (struct gdbarch programming in ML, it would be clearer why these are the same thing. */ static void @@ -1192,7 +1192,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c { /* It would suffice to simply push the offset and add it, but this makes it easier to read positive and negative offsets in the -@@ -1248,7 +1249,7 @@ gen_address_of (struct agent_expr *ax, s +@@ -1249,7 +1250,7 @@ gen_address_of (struct agent_expr *ax, s static void gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, struct axs_value *value, struct type *type, @@ -1201,7 +1201,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c { /* Note that ops[i] fetches 8 << i bits. */ static enum agent_op ops[] -@@ -1283,13 +1284,13 @@ gen_bitfield_ref (struct expression *exp +@@ -1284,13 +1285,13 @@ gen_bitfield_ref (struct expression *exp /* The first and one-after-last bits in the field, but rounded down and up to byte boundaries. */ @@ -1220,7 +1220,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c /* The index in ops of the opcode we're considering. */ int op; -@@ -1408,7 +1409,7 @@ gen_bitfield_ref (struct expression *exp +@@ -1409,7 +1410,7 @@ gen_bitfield_ref (struct expression *exp static void gen_primitive_field (struct expression *exp, struct agent_expr *ax, struct axs_value *value, @@ -1229,7 +1229,7 @@ Index: gdb-7.7.1/gdb/ax-gdb.c { /* Is this a bitfield? */ if (TYPE_FIELD_PACKED (type, fieldno)) -@@ -1433,7 +1434,7 @@ gen_primitive_field (struct expression * +@@ -1434,7 +1435,7 @@ gen_primitive_field (struct expression * static int gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax, struct axs_value *value, @@ -1238,10 +1238,10 @@ Index: gdb-7.7.1/gdb/ax-gdb.c { int i, rslt; int nbases = TYPE_N_BASECLASSES (type); -Index: gdb-7.7.1/gdb/ax-general.c +Index: gdb-7.7.90.20140613/gdb/ax-general.c =================================================================== ---- gdb-7.7.1.orig/gdb/ax-general.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/ax-general.c 2014-05-12 20:22:05.783444108 +0200 +--- gdb-7.7.90.20140613.orig/gdb/ax-general.c 2014-06-16 23:27:05.129747022 +0200 ++++ gdb-7.7.90.20140613/gdb/ax-general.c 2014-06-16 23:27:07.853749594 +0200 @@ -195,7 +195,7 @@ ax_zero_ext (struct agent_expr *x, int n /* Append a trace_quick instruction to EXPR, to record N bytes. */ @@ -1251,10 +1251,10 @@ Index: gdb-7.7.1/gdb/ax-general.c { /* N must fit in a byte. */ if (n < 0 || n > 255) -Index: gdb-7.7.1/gdb/ax.h +Index: gdb-7.7.90.20140613/gdb/ax.h =================================================================== ---- gdb-7.7.1.orig/gdb/ax.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/ax.h 2014-05-12 20:22:05.783444108 +0200 +--- gdb-7.7.90.20140613.orig/gdb/ax.h 2014-06-16 23:27:05.129747022 +0200 ++++ gdb-7.7.90.20140613/gdb/ax.h 2014-06-16 23:27:07.853749594 +0200 @@ -207,7 +207,7 @@ extern void ax_ext (struct agent_expr *E extern void ax_zero_ext (struct agent_expr *EXPR, int N); @@ -1264,11 +1264,11 @@ Index: gdb-7.7.1/gdb/ax.h /* Append a goto op to EXPR. OP is the actual op (must be aop_goto or aop_if_goto). We assume we don't know the target offset yet, -Index: gdb-7.7.1/gdb/breakpoint.c +Index: gdb-7.7.90.20140613/gdb/breakpoint.c =================================================================== ---- gdb-7.7.1.orig/gdb/breakpoint.c 2014-05-12 20:22:05.585443989 +0200 -+++ gdb-7.7.1/gdb/breakpoint.c 2014-05-12 20:22:05.785444109 +0200 -@@ -6754,7 +6754,7 @@ breakpoint_address_match (struct address +--- gdb-7.7.90.20140613.orig/gdb/breakpoint.c 2014-06-16 23:27:05.132747025 +0200 ++++ gdb-7.7.90.20140613/gdb/breakpoint.c 2014-06-16 23:27:07.857749597 +0200 +@@ -6930,7 +6930,7 @@ breakpoint_address_match (struct address static int breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1, @@ -1277,7 +1277,7 @@ Index: gdb-7.7.1/gdb/breakpoint.c CORE_ADDR addr2) { return ((gdbarch_has_global_breakpoints (target_gdbarch ()) -@@ -11353,7 +11353,7 @@ can_use_hardware_watchpoint (struct valu +@@ -11542,7 +11542,7 @@ can_use_hardware_watchpoint (struct valu && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { CORE_ADDR vaddr = value_address (v); @@ -1286,11 +1286,11 @@ Index: gdb-7.7.1/gdb/breakpoint.c int num_regs; len = (target_exact_watchpoints -Index: gdb-7.7.1/gdb/breakpoint.h +Index: gdb-7.7.90.20140613/gdb/breakpoint.h =================================================================== ---- gdb-7.7.1.orig/gdb/breakpoint.h 2014-05-12 20:22:05.546443966 +0200 -+++ gdb-7.7.1/gdb/breakpoint.h 2014-05-12 20:22:05.786444110 +0200 -@@ -242,7 +242,7 @@ struct bp_target_info +--- gdb-7.7.90.20140613.orig/gdb/breakpoint.h 2014-06-16 23:27:05.133747026 +0200 ++++ gdb-7.7.90.20140613/gdb/breakpoint.h 2014-06-16 23:27:07.857749597 +0200 +@@ -244,7 +244,7 @@ struct bp_target_info /* If this is a ranged breakpoint, then this field contains the length of the range that will be watched for execution. */ @@ -1299,7 +1299,7 @@ Index: gdb-7.7.1/gdb/breakpoint.h /* If the breakpoint lives in memory and reading that memory would give back the breakpoint, instead of the original contents, then -@@ -411,7 +411,7 @@ struct bp_location +@@ -413,7 +413,7 @@ struct bp_location /* For hardware watchpoints, the size of the memory region being watched. For hardware ranged breakpoints, the size of the breakpoint range. */ @@ -1308,10 +1308,10 @@ Index: gdb-7.7.1/gdb/breakpoint.h /* Type of hardware watchpoint. */ enum target_hw_bp_type watchpoint_type; -Index: gdb-7.7.1/gdb/c-lang.c +Index: gdb-7.7.90.20140613/gdb/c-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/c-lang.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/c-lang.c 2014-05-12 20:22:05.786444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/c-lang.c 2014-06-16 23:27:05.134747027 +0200 ++++ gdb-7.7.90.20140613/gdb/c-lang.c 2014-06-16 23:27:07.858749598 +0200 @@ -190,7 +190,7 @@ c_printchar (int c, struct type *type, s void @@ -1339,11 +1339,11 @@ Index: gdb-7.7.1/gdb/c-lang.c if (get_discrete_bounds (TYPE_INDEX_TYPE (expect_type), &low_bound, &high_bound) < 0) -Index: gdb-7.7.1/gdb/c-lang.h +Index: gdb-7.7.90.20140613/gdb/c-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/c-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/c-lang.h 2014-05-12 20:22:05.786444110 +0200 -@@ -73,7 +73,7 @@ extern void c_print_typedef (struct type +--- gdb-7.7.90.20140613.orig/gdb/c-lang.h 2014-06-16 23:27:05.134747027 +0200 ++++ gdb-7.7.90.20140613/gdb/c-lang.h 2014-06-16 23:27:07.858749598 +0200 +@@ -74,7 +74,7 @@ extern void c_print_typedef (struct type struct ui_file *); extern void c_val_print (struct type *, const gdb_byte *, @@ -1352,7 +1352,7 @@ Index: gdb-7.7.1/gdb/c-lang.h struct ui_file *, int, const struct value *, const struct value_print_options *); -@@ -93,7 +93,7 @@ extern void c_printchar (int, struct typ +@@ -94,7 +94,7 @@ extern void c_printchar (int, struct typ extern void c_printstr (struct ui_file * stream, struct type *elttype, const gdb_byte *string, @@ -1361,7 +1361,7 @@ Index: gdb-7.7.1/gdb/c-lang.h const char *user_encoding, int force_ellipses, const struct value_print_options *options); -@@ -119,14 +119,14 @@ extern void cp_print_class_member (const +@@ -120,14 +120,14 @@ extern void cp_print_class_member (const struct ui_file *, char *); extern void cp_print_value_fields (struct type *, struct type *, @@ -1378,11 +1378,11 @@ Index: gdb-7.7.1/gdb/c-lang.h struct ui_file *, int, const struct value *, const struct value_print_options *, -Index: gdb-7.7.1/gdb/c-valprint.c +Index: gdb-7.7.90.20140613/gdb/c-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/c-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/c-valprint.c 2014-05-12 20:22:05.786444110 +0200 -@@ -132,7 +132,7 @@ static const struct generic_val_print_de +--- gdb-7.7.90.20140613.orig/gdb/c-valprint.c 2014-06-16 23:27:05.134747027 +0200 ++++ gdb-7.7.90.20140613/gdb/c-valprint.c 2014-06-16 23:27:07.858749598 +0200 +@@ -133,7 +133,7 @@ static const struct generic_val_print_de void c_val_print (struct type *type, const gdb_byte *valaddr, @@ -1391,7 +1391,7 @@ Index: gdb-7.7.1/gdb/c-valprint.c struct ui_file *stream, int recurse, const struct value *original_value, const struct value_print_options *options) -@@ -143,7 +143,7 @@ c_val_print (struct type *type, const gd +@@ -144,7 +144,7 @@ c_val_print (struct type *type, const gd unsigned len; struct type *elttype, *unresolved_elttype; struct type *unresolved_type = type; @@ -1400,7 +1400,7 @@ Index: gdb-7.7.1/gdb/c-valprint.c CORE_ADDR addr; CHECK_TYPEDEF (type); -@@ -379,9 +379,9 @@ c_val_print (struct type *type, const gd +@@ -380,9 +380,9 @@ c_val_print (struct type *type, const gd /* Print vtable entry - we only get here if NOT using -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */ @@ -1413,7 +1413,7 @@ Index: gdb-7.7.1/gdb/c-valprint.c struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET); CORE_ADDR addr -@@ -460,7 +460,8 @@ c_value_print (struct value *val, struct +@@ -461,7 +461,8 @@ c_value_print (struct value *val, struct const struct value_print_options *options) { struct type *type, *real_type, *val_type; @@ -1423,10 +1423,10 @@ Index: gdb-7.7.1/gdb/c-valprint.c struct value_print_options opts = *options; opts.deref_ref = 1; -Index: gdb-7.7.1/gdb/cp-abi.c +Index: gdb-7.7.90.20140613/gdb/cp-abi.c =================================================================== ---- gdb-7.7.1.orig/gdb/cp-abi.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/cp-abi.c 2014-05-12 20:22:05.787444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/cp-abi.c 2014-06-16 23:27:05.134747027 +0200 ++++ gdb-7.7.90.20140613/gdb/cp-abi.c 2014-06-16 23:27:07.859749599 +0200 @@ -68,13 +68,13 @@ is_operator_name (const char *name) return (*current_cp_abi.is_operator_name) (name); } @@ -1462,10 +1462,10 @@ Index: gdb-7.7.1/gdb/cp-abi.c { struct type *ret = NULL; volatile struct gdb_exception e; -Index: gdb-7.7.1/gdb/cp-abi.h +Index: gdb-7.7.90.20140613/gdb/cp-abi.h =================================================================== ---- gdb-7.7.1.orig/gdb/cp-abi.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/cp-abi.h 2014-05-12 20:22:05.787444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/cp-abi.h 2014-06-16 23:27:05.135747028 +0200 ++++ gdb-7.7.90.20140613/gdb/cp-abi.h 2014-06-16 23:27:07.859749599 +0200 @@ -108,7 +108,7 @@ extern struct value *value_virtual_fn_fi struct fn_field *f, int j, @@ -1520,10 +1520,10 @@ Index: gdb-7.7.1/gdb/cp-abi.h void (*print_method_ptr) (const gdb_byte *contents, struct type *type, struct ui_file *stream); -Index: gdb-7.7.1/gdb/cp-valprint.c +Index: gdb-7.7.90.20140613/gdb/cp-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/cp-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/cp-valprint.c 2014-05-12 20:22:05.787444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/cp-valprint.c 2014-06-16 23:27:05.135747028 +0200 ++++ gdb-7.7.90.20140613/gdb/cp-valprint.c 2014-06-16 23:27:07.859749599 +0200 @@ -82,7 +82,7 @@ static void cp_print_static_field (struc const struct value_print_options *); @@ -1570,7 +1570,7 @@ Index: gdb-7.7.1/gdb/cp-valprint.c /* Ugh, we have to convert back to a value here. */ value = value_from_contents_and_address (type, valaddr + offset, -@@ -462,7 +463,7 @@ cp_print_value_fields_rtti (struct type +@@ -463,7 +464,7 @@ cp_print_value_fields_rtti (struct type static void cp_print_value (struct type *type, struct type *real_type, @@ -1579,7 +1579,7 @@ Index: gdb-7.7.1/gdb/cp-valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, -@@ -472,7 +473,7 @@ cp_print_value (struct type *type, struc +@@ -473,7 +474,7 @@ cp_print_value (struct type *type, struc = (struct type **) obstack_next_free (&dont_print_vb_obstack); struct obstack tmp_obstack = dont_print_vb_obstack; int i, n_baseclasses = TYPE_N_BASECLASSES (type); @@ -1588,7 +1588,7 @@ Index: gdb-7.7.1/gdb/cp-valprint.c struct type *thistype; if (dont_print_vb == 0) -@@ -486,7 +487,7 @@ cp_print_value (struct type *type, struc +@@ -487,7 +488,7 @@ cp_print_value (struct type *type, struc for (i = 0; i < n_baseclasses; i++) { @@ -1597,12 +1597,12 @@ Index: gdb-7.7.1/gdb/cp-valprint.c int skip; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); const char *basename = TYPE_NAME (baseclass); -Index: gdb-7.7.1/gdb/d-lang.h +Index: gdb-7.7.90.20140613/gdb/d-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/d-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/d-lang.h 2014-05-12 20:22:05.787444110 +0200 -@@ -25,7 +25,7 @@ - extern char *d_demangle (const char *mangled, int options); +--- gdb-7.7.90.20140613.orig/gdb/d-lang.h 2014-06-16 23:27:05.135747028 +0200 ++++ gdb-7.7.90.20140613/gdb/d-lang.h 2014-06-16 23:27:07.859749599 +0200 +@@ -69,7 +69,7 @@ extern const char *d_parse_symbol (struc + /* Defined in d-valprint.c */ extern void d_val_print (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, @@ -1610,10 +1610,10 @@ Index: gdb-7.7.1/gdb/d-lang.h struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options); -Index: gdb-7.7.1/gdb/d-valprint.c +Index: gdb-7.7.90.20140613/gdb/d-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/d-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/d-valprint.c 2014-05-12 20:22:05.787444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/d-valprint.c 2014-06-16 23:27:05.135747028 +0200 ++++ gdb-7.7.90.20140613/gdb/d-valprint.c 2014-06-16 23:27:07.859749599 +0200 @@ -29,7 +29,7 @@ static int @@ -1623,7 +1623,7 @@ Index: gdb-7.7.1/gdb/d-valprint.c struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options) -@@ -71,9 +71,9 @@ dynamic_array_type (struct type *type, c +@@ -72,9 +72,9 @@ dynamic_array_type (struct type *type, c /* Implements the la_val_print routine for language D. */ void @@ -1636,10 +1636,10 @@ Index: gdb-7.7.1/gdb/d-valprint.c const struct value_print_options *options) { int ret; -Index: gdb-7.7.1/gdb/doublest.c +Index: gdb-7.7.90.20140613/gdb/doublest.c =================================================================== ---- gdb-7.7.1.orig/gdb/doublest.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/doublest.c 2014-05-12 20:22:05.787444110 +0200 +--- gdb-7.7.90.20140613.orig/gdb/doublest.c 2014-06-16 23:27:05.136747029 +0200 ++++ gdb-7.7.90.20140613/gdb/doublest.c 2014-06-16 23:27:07.860749600 +0200 @@ -767,7 +767,7 @@ floatformat_from_doublest (const struct but not passed on by GDB. This should be fixed. */ @@ -1660,11 +1660,11 @@ Index: gdb-7.7.1/gdb/doublest.c return format; } -Index: gdb-7.7.1/gdb/dwarf2loc.c +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c =================================================================== ---- gdb-7.7.1.orig/gdb/dwarf2loc.c 2014-05-12 20:22:04.773443502 +0200 -+++ gdb-7.7.1/gdb/dwarf2loc.c 2014-05-12 20:22:05.788444111 +0200 -@@ -1709,19 +1709,19 @@ insert_bits (unsigned int datum, +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-16 23:27:05.137747030 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-16 23:27:07.861749601 +0200 +@@ -1572,19 +1572,19 @@ insert_bits (unsigned int datum, BITS_BIG_ENDIAN is taken directly from gdbarch. */ static void @@ -1690,7 +1690,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c dest_avail = 8 - dest_offset_bits % 8; -@@ -1759,13 +1759,13 @@ static void +@@ -1622,13 +1622,13 @@ static void read_pieced_value (struct value *v) { int i; @@ -1706,7 +1706,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c size_t buffer_size = 0; gdb_byte *buffer = NULL; struct cleanup *cleanup; -@@ -1792,8 +1792,8 @@ read_pieced_value (struct value *v) +@@ -1655,8 +1655,8 @@ read_pieced_value (struct value *v) for (i = 0; i < c->n_pieces && offset < type_len; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1717,7 +1717,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c const gdb_byte *intermediate_buffer; /* Compute size, source, and destination offsets for copying, in -@@ -1942,13 +1942,13 @@ static void +@@ -1805,13 +1805,13 @@ static void write_pieced_value (struct value *to, struct value *from) { int i; @@ -1733,7 +1733,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c size_t buffer_size = 0; gdb_byte *buffer = NULL; struct cleanup *cleanup; -@@ -1976,8 +1976,8 @@ write_pieced_value (struct value *to, st +@@ -1839,8 +1839,8 @@ write_pieced_value (struct value *to, st for (i = 0; i < c->n_pieces && offset < type_len; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1744,7 +1744,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c int need_bitwise; const gdb_byte *source_buffer; -@@ -2107,8 +2107,8 @@ write_pieced_value (struct value *to, st +@@ -1970,8 +1970,8 @@ write_pieced_value (struct value *to, st implicit pointer. */ static int @@ -1755,7 +1755,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c enum dwarf_value_location check_for) { struct piece_closure *c -@@ -2124,7 +2124,7 @@ check_pieced_value_bits (const struct va +@@ -1987,7 +1987,7 @@ check_pieced_value_bits (const struct va for (i = 0; i < c->n_pieces && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1764,7 +1764,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2162,8 +2162,8 @@ check_pieced_value_bits (const struct va +@@ -2025,8 +2025,8 @@ check_pieced_value_bits (const struct va } static int @@ -1775,7 +1775,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c { return check_pieced_value_bits (value, bit_offset, bit_length, DWARF_VALUE_MEMORY); -@@ -2181,8 +2181,8 @@ check_pieced_value_invalid (const struct +@@ -2044,8 +2044,8 @@ check_pieced_value_invalid (const struct a synthetic pointer. */ static int @@ -1786,7 +1786,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c { return check_pieced_value_bits (value, bit_offset, bit_length, DWARF_VALUE_IMPLICIT_POINTER); -@@ -2207,9 +2207,10 @@ indirect_pieced_value (struct value *val +@@ -2070,9 +2070,10 @@ indirect_pieced_value (struct value *val struct type *type; struct frame_info *frame; struct dwarf2_locexpr_baton baton; @@ -1799,7 +1799,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c type = check_typedef (value_type (value)); if (TYPE_CODE (type) != TYPE_CODE_PTR) -@@ -2223,7 +2224,7 @@ indirect_pieced_value (struct value *val +@@ -2086,7 +2087,7 @@ indirect_pieced_value (struct value *val for (i = 0; i < c->n_pieces && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1808,7 +1808,7 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2491,7 +2492,7 @@ dwarf2_evaluate_loc_desc_full (struct ty +@@ -2357,7 +2358,7 @@ dwarf2_evaluate_loc_desc_full (struct ty struct value *value = dwarf_expr_fetch (ctx, 0); gdb_byte *contents; const gdb_byte *val_bytes; @@ -1817,11 +1817,11 @@ Index: gdb-7.7.1/gdb/dwarf2loc.c if (byte_offset + TYPE_LENGTH (type) > n) invalid_synthetic_pointer (); -Index: gdb-7.7.1/gdb/dwarf2read.c +Index: gdb-7.7.90.20140613/gdb/dwarf2read.c =================================================================== ---- gdb-7.7.1.orig/gdb/dwarf2read.c 2014-05-12 20:22:05.752444089 +0200 -+++ gdb-7.7.1/gdb/dwarf2read.c 2014-05-12 20:22:05.791444113 +0200 -@@ -1893,12 +1893,12 @@ dwarf2_complex_location_expr_complaint ( +--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-16 23:27:05.141747034 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-16 23:27:07.864749604 +0200 +@@ -1889,12 +1889,12 @@ dwarf2_complex_location_expr_complaint ( } static void @@ -1838,7 +1838,7 @@ Index: gdb-7.7.1/gdb/dwarf2read.c } static void -@@ -12190,8 +12190,8 @@ dwarf2_add_field (struct field_info *fip +@@ -12326,8 +12326,8 @@ dwarf2_add_field (struct field_info *fip object, and then subtract off the number of bits of the field itself. The result is the bit offset of the LSB of the field. */ @@ -1849,11 +1849,11 @@ Index: gdb-7.7.1/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_byte_size, cu); if (attr) -Index: gdb-7.7.1/gdb/eval.c +Index: gdb-7.7.90.20140613/gdb/eval.c =================================================================== ---- gdb-7.7.1.orig/gdb/eval.c 2014-05-12 20:22:04.777443504 +0200 -+++ gdb-7.7.1/gdb/eval.c 2014-05-12 20:22:05.792444113 +0200 -@@ -298,7 +298,8 @@ evaluate_struct_tuple (struct value *str +--- gdb-7.7.90.20140613.orig/gdb/eval.c 2014-06-16 23:27:05.143747036 +0200 ++++ gdb-7.7.90.20140613/gdb/eval.c 2014-06-16 23:27:07.864749604 +0200 +@@ -297,7 +297,8 @@ evaluate_struct_tuple (struct value *str while (--nargs >= 0) { struct value *val = NULL; @@ -1863,7 +1863,7 @@ Index: gdb-7.7.1/gdb/eval.c bfd_byte *addr; fieldno++; -@@ -360,7 +361,7 @@ init_array_element (struct value *array, +@@ -359,7 +360,7 @@ init_array_element (struct value *array, enum noside noside, LONGEST low_bound, LONGEST high_bound) { LONGEST index; @@ -1872,7 +1872,7 @@ Index: gdb-7.7.1/gdb/eval.c if (exp->elts[*pos].opcode == BINOP_COMMA) { -@@ -718,11 +719,11 @@ binop_promote (const struct language_def +@@ -522,11 +523,11 @@ binop_promote (const struct language_def /* FIXME: Also mixed integral/booleans, with result an integer. */ { const struct builtin_type *builtin = builtin_type (gdbarch); @@ -1887,7 +1887,7 @@ Index: gdb-7.7.1/gdb/eval.c int unsigned_operation; /* Determine type length and signedness after promotion for -@@ -905,7 +906,7 @@ evaluate_subexp_standard (struct type *e +@@ -709,7 +710,7 @@ evaluate_subexp_standard (struct type *e struct value **argvec; int code; int ix; @@ -1896,7 +1896,7 @@ Index: gdb-7.7.1/gdb/eval.c struct type **arg_types; int save_pos1; struct symbol *function = NULL; -@@ -1085,7 +1086,7 @@ evaluate_subexp_standard (struct type *e +@@ -888,7 +889,7 @@ evaluate_subexp_standard (struct type *e struct type *range_type = TYPE_INDEX_TYPE (type); struct type *element_type = TYPE_TARGET_TYPE (type); struct value *array = allocate_value (expect_type); @@ -1905,7 +1905,7 @@ Index: gdb-7.7.1/gdb/eval.c LONGEST low_bound, high_bound, index; if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -@@ -2080,7 +2081,8 @@ evaluate_subexp_standard (struct type *e +@@ -1903,7 +1904,8 @@ evaluate_subexp_standard (struct type *e { struct type *type = value_type (arg1); struct type *real_type; @@ -1915,10 +1915,10 @@ Index: gdb-7.7.1/gdb/eval.c struct value_print_options opts; get_user_print_options (&opts); -Index: gdb-7.7.1/gdb/f-lang.c +Index: gdb-7.7.90.20140613/gdb/f-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/f-lang.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/f-lang.c 2014-05-12 20:22:05.792444113 +0200 +--- gdb-7.7.90.20140613.orig/gdb/f-lang.c 2014-06-16 23:27:05.143747036 +0200 ++++ gdb-7.7.90.20140613/gdb/f-lang.c 2014-06-16 23:27:07.865749605 +0200 @@ -104,7 +104,7 @@ f_printchar (int c, struct type *type, s static void @@ -1928,25 +1928,25 @@ Index: gdb-7.7.1/gdb/f-lang.c const struct value_print_options *options) { const char *type_encoding = f_get_encoding (type); -Index: gdb-7.7.1/gdb/f-lang.h +Index: gdb-7.7.90.20140613/gdb/f-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/f-lang.h 2014-05-12 20:22:04.777443504 +0200 -+++ gdb-7.7.1/gdb/f-lang.h 2014-05-12 20:22:05.792444113 +0200 -@@ -33,7 +33,7 @@ extern const char *f_object_address_data - (struct type *type, struct ui_file *stream); - extern void f_object_address_data_valid_or_error (struct type *type); +--- gdb-7.7.90.20140613.orig/gdb/f-lang.h 2014-06-16 23:27:05.143747036 +0200 ++++ gdb-7.7.90.20140613/gdb/f-lang.h 2014-06-16 23:27:07.865749605 +0200 +@@ -30,7 +30,7 @@ extern void f_error (char *); /* Defined + extern void f_print_type (struct type *, const char *, struct ui_file *, int, + int, const struct type_print_options *); -extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, +extern void f_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, struct ui_file *, int, const struct value *, const struct value_print_options *); -Index: gdb-7.7.1/gdb/f-valprint.c +Index: gdb-7.7.90.20140613/gdb/f-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/f-valprint.c 2014-05-12 20:22:04.778443505 +0200 -+++ gdb-7.7.1/gdb/f-valprint.c 2014-05-12 20:22:05.793444114 +0200 -@@ -43,7 +43,7 @@ static void f77_create_arrayprint_offset - struct ui_file *); +--- gdb-7.7.90.20140613.orig/gdb/f-valprint.c 2014-06-16 23:27:05.143747036 +0200 ++++ gdb-7.7.90.20140613/gdb/f-valprint.c 2014-06-16 23:27:07.865749605 +0200 +@@ -41,7 +41,7 @@ extern void _initialize_f_valprint (void + static void info_common_command (char *, int); static void f77_get_dynamic_length_of_aggregate (struct type *); -int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -1954,16 +1954,18 @@ Index: gdb-7.7.1/gdb/f-valprint.c /* Array which holds offsets to be applied to get a row's elements for a given array. Array also holds the size of each subarray. */ -@@ -126,7 +126,7 @@ static void - f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) +@@ -76,8 +76,8 @@ f77_get_upperbound (struct type *type) + static void + f77_get_dynamic_length_of_aggregate (struct type *type) { - struct type *tmp_type; -- int eltlen; -+ LONGEST eltlen; - int ndimen = 1; - int upper, lower; +- int upper_bound = -1; +- int lower_bound = 1; ++ LONGEST upper_bound = -1; ++ LONGEST lower_bound = 1; -@@ -171,13 +171,13 @@ f77_create_arrayprint_offset_tbl (struct + /* Recursively go all the way down into a possibly multi-dimensional + F77 array and get the bounds. For simple arrays, this is pretty +@@ -109,7 +109,7 @@ f77_get_dynamic_length_of_aggregate (str static void f77_print_array_1 (int nss, int ndimensions, struct type *type, const gdb_byte *valaddr, @@ -1972,14 +1974,16 @@ Index: gdb-7.7.1/gdb/f-valprint.c struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, - int *elts) - { +@@ -118,7 +118,7 @@ f77_print_array_1 (int nss, int ndimensi + struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type)); + CORE_ADDR addr = address + embedded_offset; + LONGEST lowerbound, upperbound; - int i; + LONGEST i; - if (nss != ndimensions) - { -@@ -220,7 +220,7 @@ f77_print_array_1 (int nss, int ndimensi + get_discrete_bounds (range_type, &lowerbound, &upperbound); + +@@ -175,7 +175,7 @@ f77_print_array_1 (int nss, int ndimensi static void f77_print_array (struct type *type, const gdb_byte *valaddr, @@ -1988,7 +1992,7 @@ Index: gdb-7.7.1/gdb/f-valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, -@@ -263,8 +263,9 @@ static const struct generic_val_print_de +@@ -212,8 +212,9 @@ static const struct generic_val_print_de function; they are identical. */ void @@ -2000,29 +2004,20 @@ Index: gdb-7.7.1/gdb/f-valprint.c const struct value *original_value, const struct value_print_options *options) { -@@ -389,7 +390,7 @@ f_val_print (struct type *type, const gd - fprintf_filtered (stream, "( "); - for (index = 0; index < TYPE_NFIELDS (type); index++) - { -- int offset = TYPE_FIELD_BITPOS (type, index) / 8; -+ LONGEST offset = TYPE_FIELD_BITPOS (type, index) / 8; - - val_print (TYPE_FIELD_TYPE (type, index), valaddr, - embedded_offset + offset, -Index: gdb-7.7.1/gdb/findvar.c +Index: gdb-7.7.90.20140613/gdb/findvar.c =================================================================== ---- gdb-7.7.1.orig/gdb/findvar.c 2014-05-12 20:22:04.778443505 +0200 -+++ gdb-7.7.1/gdb/findvar.c 2014-05-12 20:22:05.793444114 +0200 -@@ -623,7 +623,7 @@ default_value_from_register (struct type - struct frame_info *frame) +--- gdb-7.7.90.20140613.orig/gdb/findvar.c 2014-06-16 23:27:05.144747037 +0200 ++++ gdb-7.7.90.20140613/gdb/findvar.c 2014-06-16 23:27:07.865749605 +0200 +@@ -628,7 +628,7 @@ struct value * + default_value_from_register (struct gdbarch *gdbarch, struct type *type, + int regnum, struct frame_id frame_id) { - struct gdbarch *gdbarch = get_frame_arch (frame); - int len = TYPE_LENGTH (type); + LONGEST len = TYPE_LENGTH (type); struct value *value = allocate_value (type); VALUE_LVAL (value) = lval_register; -@@ -656,10 +656,10 @@ void +@@ -661,10 +661,10 @@ void read_frame_register_value (struct value *value, struct frame_info *frame) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -2036,7 +2031,7 @@ Index: gdb-7.7.1/gdb/findvar.c gdb_assert (VALUE_LVAL (value) == lval_register); -@@ -674,7 +674,7 @@ read_frame_register_value (struct value +@@ -679,7 +679,7 @@ read_frame_register_value (struct value while (len > 0) { struct value *regval = get_frame_register_value (frame, regnum); @@ -2045,11 +2040,11 @@ Index: gdb-7.7.1/gdb/findvar.c if (value_optimized_out (regval)) { -Index: gdb-7.7.1/gdb/frame.c +Index: gdb-7.7.90.20140613/gdb/frame.c =================================================================== ---- gdb-7.7.1.orig/gdb/frame.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/frame.c 2014-05-12 20:22:05.793444114 +0200 -@@ -1247,7 +1247,7 @@ deprecated_frame_register_read (struct f +--- gdb-7.7.90.20140613.orig/gdb/frame.c 2014-06-16 23:27:05.144747037 +0200 ++++ gdb-7.7.90.20140613/gdb/frame.c 2014-06-16 23:27:07.866749606 +0200 +@@ -1272,7 +1272,7 @@ deprecated_frame_register_read (struct f int get_frame_register_bytes (struct frame_info *frame, int regnum, @@ -2058,7 +2053,7 @@ Index: gdb-7.7.1/gdb/frame.c int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -1276,7 +1276,7 @@ get_frame_register_bytes (struct frame_i +@@ -1301,7 +1301,7 @@ get_frame_register_bytes (struct frame_i } if (len > maxsize) error (_("Bad debug information detected: " @@ -2067,11 +2062,11 @@ Index: gdb-7.7.1/gdb/frame.c /* Copy the data. */ while (len > 0) -Index: gdb-7.7.1/gdb/frame.h +Index: gdb-7.7.90.20140613/gdb/frame.h =================================================================== ---- gdb-7.7.1.orig/gdb/frame.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/frame.h 2014-05-12 20:22:05.793444114 +0200 -@@ -556,7 +556,7 @@ extern void put_frame_register (struct f +--- gdb-7.7.90.20140613.orig/gdb/frame.h 2014-06-16 23:27:05.145747038 +0200 ++++ gdb-7.7.90.20140613/gdb/frame.h 2014-06-16 23:27:07.866749606 +0200 +@@ -583,7 +583,7 @@ extern void put_frame_register (struct f contents are optimized out or unavailable, set *OPTIMIZEDP, *UNAVAILABLEP accordingly. */ extern int get_frame_register_bytes (struct frame_info *frame, int regnum, @@ -2080,11 +2075,11 @@ Index: gdb-7.7.1/gdb/frame.h gdb_byte *myaddr, int *optimizedp, int *unavailablep); -Index: gdb-7.7.1/gdb/gdbtypes.c +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c =================================================================== ---- gdb-7.7.1.orig/gdb/gdbtypes.c 2014-05-12 20:22:04.779443505 +0200 -+++ gdb-7.7.1/gdb/gdbtypes.c 2014-05-12 20:22:05.794444114 +0200 -@@ -2108,7 +2108,7 @@ allocate_gnat_aux_type (struct type *typ +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-16 23:27:05.146747039 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-16 23:27:07.866749606 +0200 +@@ -2463,7 +2463,7 @@ allocate_gnat_aux_type (struct type *typ least as long as OBJFILE. */ struct type * @@ -2093,7 +2088,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c const char *name, struct objfile *objfile) { struct type *type; -@@ -2339,8 +2339,8 @@ is_public_ancestor (struct type *base, s +@@ -2694,8 +2694,8 @@ is_public_ancestor (struct type *base, s static int is_unique_ancestor_worker (struct type *base, struct type *dclass, @@ -2104,7 +2099,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c CORE_ADDR address, struct value *val) { int i, count = 0; -@@ -2351,7 +2351,7 @@ is_unique_ancestor_worker (struct type * +@@ -2706,7 +2706,7 @@ is_unique_ancestor_worker (struct type * for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i) { struct type *iter; @@ -2113,7 +2108,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c iter = check_typedef (TYPE_BASECLASS (dclass, i)); -@@ -2392,7 +2392,7 @@ is_unique_ancestor_worker (struct type * +@@ -2747,7 +2747,7 @@ is_unique_ancestor_worker (struct type * int is_unique_ancestor (struct type *base, struct value *val) { @@ -2122,7 +2117,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c return is_unique_ancestor_worker (base, value_type (val), &offset, value_contents_for_printing (val), -@@ -3530,7 +3530,7 @@ recursive_dump_type (struct type *type, +@@ -3891,7 +3891,7 @@ recursive_dump_type (struct type *type, break; } puts_filtered ("\n"); @@ -2131,7 +2126,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c if (TYPE_OBJFILE_OWNED (type)) { printfi_filtered (spaces, "objfile "); -@@ -3654,8 +3654,8 @@ recursive_dump_type (struct type *type, +@@ -4015,8 +4015,8 @@ recursive_dump_type (struct type *type, idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); else printfi_filtered (spaces + 2, @@ -2142,7 +2137,7 @@ Index: gdb-7.7.1/gdb/gdbtypes.c TYPE_FIELD_BITSIZE (type, idx)); gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout); printf_filtered (" name '%s' (", -@@ -4169,7 +4169,7 @@ copy_type (const struct type *type) +@@ -4357,7 +4357,7 @@ copy_type (const struct type *type) struct type * arch_type (struct gdbarch *gdbarch, @@ -2151,32 +2146,32 @@ Index: gdb-7.7.1/gdb/gdbtypes.c { struct type *type; -Index: gdb-7.7.1/gdb/gdbtypes.h +Index: gdb-7.7.90.20140613/gdb/gdbtypes.h =================================================================== ---- gdb-7.7.1.orig/gdb/gdbtypes.h 2014-05-12 20:22:05.533443958 +0200 -+++ gdb-7.7.1/gdb/gdbtypes.h 2014-05-12 20:22:05.795444115 +0200 -@@ -606,7 +606,7 @@ struct main_type +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.h 2014-06-16 23:27:05.147747040 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.h 2014-06-16 23:27:07.867749607 +0200 +@@ -608,7 +608,7 @@ struct main_type gdbarch_bits_big_endian=0 targets, it is the bit offset to the LSB. */ - int bitpos; + LONGEST bitpos; - /* Enum value. */ + /* * Enum value. */ LONGEST enumval; -@@ -798,7 +798,7 @@ struct type +@@ -810,7 +810,7 @@ struct type HOST_CHAR_BIT. However, this would still fail to address machines based on a ternary or decimal representation. */ - unsigned length; + ULONGEST length; - /* Core type, shared by a group of qualified types. */ - struct main_type *main_type; -@@ -1546,11 +1546,12 @@ extern struct gdbarch *get_type_arch (co - extern struct type *get_target_type (struct type *type); + /* * Core type, shared by a group of qualified types. */ + +@@ -1640,11 +1640,12 @@ extern struct type *get_target_type (str + + /* * Helper function to construct objfile-owned types. */ - /* Helper function to construct objfile-owned types. */ -extern struct type *init_type (enum type_code, int, int, const char *, +extern struct type *init_type (enum type_code, LONGEST, int, const char *, struct objfile *); @@ -2188,10 +2183,10 @@ Index: gdb-7.7.1/gdb/gdbtypes.h extern struct type *arch_integer_type (struct gdbarch *, int, int, char *); extern struct type *arch_character_type (struct gdbarch *, int, int, char *); extern struct type *arch_boolean_type (struct gdbarch *, int, int, char *); -Index: gdb-7.7.1/gdb/gnu-v2-abi.c +Index: gdb-7.7.90.20140613/gdb/gnu-v2-abi.c =================================================================== ---- gdb-7.7.1.orig/gdb/gnu-v2-abi.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/gnu-v2-abi.c 2014-05-12 20:22:05.795444115 +0200 +--- gdb-7.7.90.20140613.orig/gdb/gnu-v2-abi.c 2014-06-16 23:27:05.147747040 +0200 ++++ gdb-7.7.90.20140613/gdb/gnu-v2-abi.c 2014-06-16 23:27:07.867749607 +0200 @@ -85,7 +85,7 @@ gnuv2_is_operator_name (const char *name TYPE is the type in which F is located. */ static struct value * @@ -2243,10 +2238,10 @@ Index: gdb-7.7.1/gdb/gnu-v2-abi.c gnuv2_baseclass_offset (type, i, valaddr, embedded_offset, address, val); -Index: gdb-7.7.1/gdb/gnu-v3-abi.c +Index: gdb-7.7.90.20140613/gdb/gnu-v3-abi.c =================================================================== ---- gdb-7.7.1.orig/gdb/gnu-v3-abi.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/gnu-v3-abi.c 2014-05-12 20:22:05.795444115 +0200 +--- gdb-7.7.90.20140613.orig/gdb/gnu-v3-abi.c 2014-06-16 23:27:05.148747040 +0200 ++++ gdb-7.7.90.20140613/gdb/gnu-v3-abi.c 2014-06-16 23:27:07.867749607 +0200 @@ -112,7 +112,7 @@ build_gdb_vtable_type (struct gdbarch *a { struct type *t; @@ -2321,11 +2316,11 @@ Index: gdb-7.7.1/gdb/gnu-v3-abi.c struct type *basetype; if (BASETYPE_VIA_VIRTUAL (domain, i)) -Index: gdb-7.7.1/gdb/go-lang.h +Index: gdb-7.7.90.20140613/gdb/go-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/go-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/go-lang.h 2014-05-12 20:22:05.795444115 +0200 -@@ -83,7 +83,7 @@ extern void go_print_type (struct type * +--- gdb-7.7.90.20140613.orig/gdb/go-lang.h 2014-06-16 23:27:05.148747040 +0200 ++++ gdb-7.7.90.20140613/gdb/go-lang.h 2014-06-16 23:27:07.867749607 +0200 +@@ -85,7 +85,7 @@ extern void go_print_type (struct type * /* Defined in go-valprint.c. */ extern void go_val_print (struct type *type, const gdb_byte *valaddr, @@ -2334,10 +2329,10 @@ Index: gdb-7.7.1/gdb/go-lang.h struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options); -Index: gdb-7.7.1/gdb/go-valprint.c +Index: gdb-7.7.90.20140613/gdb/go-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/go-valprint.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/go-valprint.c 2014-05-12 20:22:05.795444115 +0200 +--- gdb-7.7.90.20140613.orig/gdb/go-valprint.c 2014-06-16 23:27:05.148747040 +0200 ++++ gdb-7.7.90.20140613/gdb/go-valprint.c 2014-06-16 23:27:07.868749608 +0200 @@ -37,7 +37,7 @@ static void @@ -2360,10 +2355,10 @@ Index: gdb-7.7.1/gdb/go-valprint.c const struct value_print_options *options) { CHECK_TYPEDEF (type); -Index: gdb-7.7.1/gdb/i386-nat.c +Index: gdb-7.7.90.20140613/gdb/i386-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/i386-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/i386-nat.c 2014-05-12 20:22:05.796444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/i386-nat.c 2014-06-16 23:27:05.148747040 +0200 ++++ gdb-7.7.90.20140613/gdb/i386-nat.c 2014-06-16 23:27:07.868749608 +0200 @@ -290,7 +290,7 @@ static int i386_remove_aligned_watchpoin valid value, bombs through internal_error. */ static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, @@ -2384,32 +2379,32 @@ Index: gdb-7.7.1/gdb/i386-nat.c { int retval = 0; int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4; -@@ -662,7 +662,7 @@ i386_remove_watchpoint (CORE_ADDR addr, - address ADDR and whose length is LEN bytes. */ +@@ -665,7 +665,7 @@ i386_remove_watchpoint (struct target_op static int --i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) -+i386_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len) + i386_region_ok_for_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { struct i386_debug_reg_state *state = i386_debug_reg_state (ptid_get_pid (inferior_ptid)); -Index: gdb-7.7.1/gdb/inf-ttrace.c +Index: gdb-7.7.90.20140613/gdb/inf-ttrace.c =================================================================== ---- gdb-7.7.1.orig/gdb/inf-ttrace.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/inf-ttrace.c 2014-05-12 20:22:05.796444116 +0200 -@@ -365,7 +365,7 @@ inf_ttrace_can_use_hw_breakpoint (int ty - } +--- gdb-7.7.90.20140613.orig/gdb/inf-ttrace.c 2014-06-16 23:27:05.149747041 +0200 ++++ gdb-7.7.90.20140613/gdb/inf-ttrace.c 2014-06-16 23:27:07.868749608 +0200 +@@ -369,7 +369,7 @@ inf_ttrace_can_use_hw_breakpoint (struct static int --inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + inf_ttrace_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { return 1; } -Index: gdb-7.7.1/gdb/jv-lang.c +Index: gdb-7.7.90.20140613/gdb/jv-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/jv-lang.c 2014-05-12 20:22:05.534443958 +0200 -+++ gdb-7.7.1/gdb/jv-lang.c 2014-05-12 20:22:05.796444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/jv-lang.c 2014-06-16 23:27:05.149747041 +0200 ++++ gdb-7.7.90.20140613/gdb/jv-lang.c 2014-06-16 23:27:07.868749608 +0200 @@ -436,7 +436,7 @@ java_link_class_type (struct gdbarch *gd for (i = TYPE_N_BASECLASSES (type); i < nfields; i++) { @@ -2428,11 +2423,11 @@ Index: gdb-7.7.1/gdb/jv-lang.c const struct value_print_options *options) { const char *type_encoding = java_get_encoding (type); -Index: gdb-7.7.1/gdb/jv-lang.h +Index: gdb-7.7.90.20140613/gdb/jv-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/jv-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/jv-lang.h 2014-05-12 20:22:05.796444116 +0200 -@@ -42,8 +42,8 @@ struct builtin_java_type +--- gdb-7.7.90.20140613.orig/gdb/jv-lang.h 2014-06-16 23:27:05.149747041 +0200 ++++ gdb-7.7.90.20140613/gdb/jv-lang.h 2014-06-16 23:27:07.868749608 +0200 +@@ -43,8 +43,8 @@ struct builtin_java_type extern const struct builtin_java_type *builtin_java_type (struct gdbarch *); @@ -2443,11 +2438,11 @@ Index: gdb-7.7.1/gdb/jv-lang.h const struct value *, const struct value_print_options *); -Index: gdb-7.7.1/gdb/jv-valprint.c +Index: gdb-7.7.90.20140613/gdb/jv-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/jv-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/jv-valprint.c 2014-05-12 20:22:05.796444116 +0200 -@@ -266,7 +266,7 @@ java_value_print (struct value *val, str +--- gdb-7.7.90.20140613.orig/gdb/jv-valprint.c 2014-06-16 23:27:05.150747042 +0200 ++++ gdb-7.7.90.20140613/gdb/jv-valprint.c 2014-06-16 23:27:07.869749609 +0200 +@@ -267,7 +267,7 @@ java_value_print (struct value *val, str static void java_print_value_fields (struct type *type, const gdb_byte *valaddr, @@ -2456,7 +2451,7 @@ Index: gdb-7.7.1/gdb/jv-valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, -@@ -459,7 +459,7 @@ java_print_value_fields (struct type *ty +@@ -460,7 +460,7 @@ java_print_value_fields (struct type *ty void java_val_print (struct type *type, const gdb_byte *valaddr, @@ -2465,10 +2460,10 @@ Index: gdb-7.7.1/gdb/jv-valprint.c struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options) -Index: gdb-7.7.1/gdb/language.c +Index: gdb-7.7.90.20140613/gdb/language.c =================================================================== ---- gdb-7.7.1.orig/gdb/language.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/language.c 2014-05-12 20:22:05.797444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/language.c 2014-06-16 23:27:05.150747042 +0200 ++++ gdb-7.7.90.20140613/gdb/language.c 2014-06-16 23:27:07.869749609 +0200 @@ -722,7 +722,7 @@ unk_lang_printchar (int c, struct type * static void @@ -2487,11 +2482,11 @@ Index: gdb-7.7.1/gdb/language.c struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options) -Index: gdb-7.7.1/gdb/language.h +Index: gdb-7.7.90.20140613/gdb/language.h =================================================================== ---- gdb-7.7.1.orig/gdb/language.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/language.h 2014-05-12 20:22:05.797444116 +0200 -@@ -182,7 +182,7 @@ struct language_defn +--- gdb-7.7.90.20140613.orig/gdb/language.h 2014-06-16 23:27:05.150747042 +0200 ++++ gdb-7.7.90.20140613/gdb/language.h 2014-06-16 23:27:07.869749609 +0200 +@@ -183,7 +183,7 @@ struct language_defn struct ui_file * stream); void (*la_printstr) (struct ui_file * stream, struct type *elttype, @@ -2500,7 +2495,7 @@ Index: gdb-7.7.1/gdb/language.h const char *encoding, int force_ellipses, const struct value_print_options *); -@@ -224,7 +224,7 @@ struct language_defn +@@ -225,7 +225,7 @@ struct language_defn void (*la_val_print) (struct type *type, const gdb_byte *contents, @@ -2509,10 +2504,10 @@ Index: gdb-7.7.1/gdb/language.h struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options); -Index: gdb-7.7.1/gdb/m2-lang.c +Index: gdb-7.7.90.20140613/gdb/m2-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/m2-lang.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/m2-lang.c 2014-05-12 20:22:05.797444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/m2-lang.c 2014-06-16 23:27:05.151747043 +0200 ++++ gdb-7.7.90.20140613/gdb/m2-lang.c 2014-06-16 23:27:07.869749609 +0200 @@ -104,10 +104,10 @@ m2_printchar (int c, struct type *type, static void @@ -2547,11 +2542,11 @@ Index: gdb-7.7.1/gdb/m2-lang.c i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; -Index: gdb-7.7.1/gdb/m2-lang.h +Index: gdb-7.7.90.20140613/gdb/m2-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/m2-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/m2-lang.h 2014-05-12 20:22:05.797444116 +0200 -@@ -33,7 +33,7 @@ extern void m2_print_typedef (struct typ +--- gdb-7.7.90.20140613.orig/gdb/m2-lang.h 2014-06-16 23:27:05.151747043 +0200 ++++ gdb-7.7.90.20140613/gdb/m2-lang.h 2014-06-16 23:27:07.869749609 +0200 +@@ -34,7 +34,7 @@ extern void m2_print_typedef (struct typ extern int m2_is_long_set (struct type *type); extern int m2_is_unbounded_array (struct type *type); @@ -2560,10 +2555,10 @@ Index: gdb-7.7.1/gdb/m2-lang.h struct ui_file *, int, const struct value *, const struct value_print_options *); -Index: gdb-7.7.1/gdb/m2-typeprint.c +Index: gdb-7.7.90.20140613/gdb/m2-typeprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/m2-typeprint.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/m2-typeprint.c 2014-05-12 20:22:05.797444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/m2-typeprint.c 2014-06-16 23:27:05.151747043 +0200 ++++ gdb-7.7.90.20140613/gdb/m2-typeprint.c 2014-06-16 23:27:07.869749609 +0200 @@ -233,9 +233,12 @@ static void m2_array (struct type *type, m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 1); } @@ -2580,10 +2575,10 @@ Index: gdb-7.7.1/gdb/m2-typeprint.c } fprintf_filtered (stream, "] OF "); m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); -Index: gdb-7.7.1/gdb/m2-valprint.c +Index: gdb-7.7.90.20140613/gdb/m2-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/m2-valprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/m2-valprint.c 2014-05-12 20:22:05.797444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/m2-valprint.c 2014-06-16 23:27:05.151747043 +0200 ++++ gdb-7.7.90.20140613/gdb/m2-valprint.c 2014-06-16 23:27:07.870749610 +0200 @@ -35,7 +35,7 @@ static int print_unpacked_pointer (struc struct ui_file *stream); static void @@ -2649,10 +2644,10 @@ Index: gdb-7.7.1/gdb/m2-valprint.c /* Look for a NULL char. */ for (temp_len = 0; -Index: gdb-7.7.1/gdb/memrange.c +Index: gdb-7.7.90.20140613/gdb/memrange.c =================================================================== ---- gdb-7.7.1.orig/gdb/memrange.c 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/memrange.c 2014-05-12 20:22:05.797444116 +0200 +--- gdb-7.7.90.20140613.orig/gdb/memrange.c 2014-06-16 23:27:05.151747043 +0200 ++++ gdb-7.7.90.20140613/gdb/memrange.c 2014-06-16 23:27:07.870749610 +0200 @@ -21,8 +21,8 @@ #include "memrange.h" @@ -2664,10 +2659,10 @@ Index: gdb-7.7.1/gdb/memrange.c { ULONGEST h, l; -Index: gdb-7.7.1/gdb/memrange.h +Index: gdb-7.7.90.20140613/gdb/memrange.h =================================================================== ---- gdb-7.7.1.orig/gdb/memrange.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/memrange.h 2014-05-12 20:22:05.798444117 +0200 +--- gdb-7.7.90.20140613.orig/gdb/memrange.h 2014-06-16 23:27:05.152747044 +0200 ++++ gdb-7.7.90.20140613/gdb/memrange.h 2014-06-16 23:27:07.870749610 +0200 @@ -30,7 +30,7 @@ struct mem_range CORE_ADDR start; @@ -2688,23 +2683,23 @@ Index: gdb-7.7.1/gdb/memrange.h /* Sort ranges by start address, then coalesce contiguous or overlapping ranges. */ -Index: gdb-7.7.1/gdb/mips-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/mips-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/mips-linux-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/mips-linux-nat.c 2014-05-12 20:22:05.798444117 +0200 -@@ -588,7 +588,7 @@ mips_linux_stopped_data_address (struct - the specified region can be covered by the watch registers. */ +--- gdb-7.7.90.20140613.orig/gdb/mips-linux-nat.c 2014-06-16 23:27:05.152747044 +0200 ++++ gdb-7.7.90.20140613/gdb/mips-linux-nat.c 2014-06-16 23:27:07.870749610 +0200 +@@ -590,7 +590,7 @@ mips_linux_stopped_data_address (struct static int --mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + mips_linux_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { struct pt_watch_regs dummy_regs; int i; -Index: gdb-7.7.1/gdb/opencl-lang.c +Index: gdb-7.7.90.20140613/gdb/opencl-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/opencl-lang.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/opencl-lang.c 2014-05-12 20:22:05.798444117 +0200 +--- gdb-7.7.90.20140613.orig/gdb/opencl-lang.c 2014-06-16 23:27:05.152747044 +0200 ++++ gdb-7.7.90.20140613/gdb/opencl-lang.c 2014-06-16 23:27:07.870749610 +0200 @@ -80,11 +80,11 @@ builtin_opencl_type (struct gdbarch *gdb static struct type * @@ -2831,10 +2826,10 @@ Index: gdb-7.7.1/gdb/opencl-lang.c if (!value_bits_synthetic_pointer (c->val, c->indices[i] * elsize + comp_offset, -Index: gdb-7.7.1/gdb/p-lang.c +Index: gdb-7.7.90.20140613/gdb/p-lang.c =================================================================== ---- gdb-7.7.1.orig/gdb/p-lang.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/p-lang.c 2014-05-12 20:22:05.798444117 +0200 +--- gdb-7.7.90.20140613.orig/gdb/p-lang.c 2014-06-16 23:27:05.153747045 +0200 ++++ gdb-7.7.90.20140613/gdb/p-lang.c 2014-06-16 23:27:07.871749610 +0200 @@ -96,8 +96,8 @@ pascal_main_name (void) are not multiple of TARGET_CHAR_BIT then the results are wrong but this does not happen for Free Pascal nor for GPC. */ @@ -2882,11 +2877,11 @@ Index: gdb-7.7.1/gdb/p-lang.c i = rep1 - 1; things_printed += options->repeat_count_threshold; need_comma = 1; -Index: gdb-7.7.1/gdb/p-lang.h +Index: gdb-7.7.90.20140613/gdb/p-lang.h =================================================================== ---- gdb-7.7.1.orig/gdb/p-lang.h 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/p-lang.h 2014-05-12 20:22:05.798444117 +0200 -@@ -35,7 +35,7 @@ extern void pascal_print_type (struct ty +--- gdb-7.7.90.20140613.orig/gdb/p-lang.h 2014-06-16 23:27:05.153747045 +0200 ++++ gdb-7.7.90.20140613/gdb/p-lang.h 2014-06-16 23:27:07.871749610 +0200 +@@ -36,7 +36,7 @@ extern void pascal_print_type (struct ty extern void pascal_print_typedef (struct type *, struct symbol *, struct ui_file *); @@ -2895,7 +2890,7 @@ Index: gdb-7.7.1/gdb/p-lang.h CORE_ADDR, struct ui_file *, int, const struct value *, const struct value_print_options *); -@@ -49,13 +49,13 @@ extern void pascal_type_print_method_arg +@@ -50,13 +50,13 @@ extern void pascal_type_print_method_arg /* These are in p-lang.c: */ extern int @@ -2911,7 +2906,7 @@ Index: gdb-7.7.1/gdb/p-lang.h const struct value_print_options *); extern struct type **const (pascal_builtin_types[]); -@@ -71,7 +71,7 @@ extern void +@@ -72,7 +72,7 @@ extern void const struct type_print_options *); extern void pascal_object_print_value_fields (struct type *, const gdb_byte *, @@ -2920,10 +2915,10 @@ Index: gdb-7.7.1/gdb/p-lang.h CORE_ADDR, struct ui_file *, int, const struct value *, -Index: gdb-7.7.1/gdb/p-valprint.c +Index: gdb-7.7.90.20140613/gdb/p-valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/p-valprint.c 2014-05-12 20:22:04.780443506 +0200 -+++ gdb-7.7.1/gdb/p-valprint.c 2014-05-12 20:22:05.799444117 +0200 +--- gdb-7.7.90.20140613.orig/gdb/p-valprint.c 2014-06-16 23:27:05.153747045 +0200 ++++ gdb-7.7.90.20140613/gdb/p-valprint.c 2014-06-16 23:27:07.871749610 +0200 @@ -58,7 +58,7 @@ static const struct generic_val_print_de void @@ -2944,7 +2939,7 @@ Index: gdb-7.7.1/gdb/p-valprint.c struct type *char_type; CORE_ADDR addr; int want_space = 0; -@@ -494,7 +494,7 @@ static void pascal_object_print_static_f +@@ -468,7 +468,7 @@ static void pascal_object_print_static_f const struct value_print_options *); static void pascal_object_print_value (struct type *, const gdb_byte *, @@ -2953,7 +2948,7 @@ Index: gdb-7.7.1/gdb/p-valprint.c CORE_ADDR, struct ui_file *, int, const struct value *, const struct value_print_options *, -@@ -553,7 +553,7 @@ pascal_object_is_vtbl_member (struct typ +@@ -527,7 +527,7 @@ pascal_object_is_vtbl_member (struct typ void pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, @@ -2962,7 +2957,7 @@ Index: gdb-7.7.1/gdb/p-valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, -@@ -729,7 +729,7 @@ pascal_object_print_value_fields (struct +@@ -703,7 +703,7 @@ pascal_object_print_value_fields (struct static void pascal_object_print_value (struct type *type, const gdb_byte *valaddr, @@ -2971,7 +2966,7 @@ Index: gdb-7.7.1/gdb/p-valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, -@@ -752,11 +752,11 @@ pascal_object_print_value (struct type * +@@ -726,11 +726,11 @@ pascal_object_print_value (struct type * for (i = 0; i < n_baseclasses; i++) { @@ -2985,24 +2980,24 @@ Index: gdb-7.7.1/gdb/p-valprint.c volatile struct gdb_exception ex; int skip = 0; -Index: gdb-7.7.1/gdb/ppc-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/ppc-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/ppc-linux-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ppc-linux-nat.c 2014-05-12 20:22:05.799444117 +0200 -@@ -1496,7 +1496,7 @@ ppc_linux_can_use_hw_breakpoint (int typ - } +--- gdb-7.7.90.20140613.orig/gdb/ppc-linux-nat.c 2014-06-16 23:27:05.154747046 +0200 ++++ gdb-7.7.90.20140613/gdb/ppc-linux-nat.c 2014-06-16 23:27:07.871749610 +0200 +@@ -1498,7 +1498,7 @@ ppc_linux_can_use_hw_breakpoint (struct static int --ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + ppc_linux_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { /* Handle sub-8-byte quantities. */ if (len <= 0) -Index: gdb-7.7.1/gdb/printcmd.c +Index: gdb-7.7.90.20140613/gdb/printcmd.c =================================================================== ---- gdb-7.7.1.orig/gdb/printcmd.c 2014-05-12 20:22:05.091443693 +0200 -+++ gdb-7.7.1/gdb/printcmd.c 2014-05-12 20:22:05.799444117 +0200 -@@ -289,7 +289,7 @@ print_formatted (struct value *val, int +--- gdb-7.7.90.20140613.orig/gdb/printcmd.c 2014-06-16 23:27:05.155747047 +0200 ++++ gdb-7.7.90.20140613/gdb/printcmd.c 2014-06-16 23:27:07.872749612 +0200 +@@ -288,7 +288,7 @@ print_formatted (struct value *val, int struct ui_file *stream) { struct type *type = check_typedef (value_type (val)); @@ -3011,7 +3006,7 @@ Index: gdb-7.7.1/gdb/printcmd.c if (VALUE_LVAL (val) == lval_memory) next_address = value_address (val) + len; -@@ -367,7 +367,7 @@ print_scalar_formatted (const void *vala +@@ -366,7 +366,7 @@ print_scalar_formatted (const void *vala { struct gdbarch *gdbarch = get_type_arch (type); LONGEST val_long = 0; @@ -3020,58 +3015,36 @@ Index: gdb-7.7.1/gdb/printcmd.c enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); /* String printing should go through val_print_scalar_formatted. */ -Index: gdb-7.7.1/gdb/procfs.c +Index: gdb-7.7.90.20140613/gdb/procfs.c =================================================================== ---- gdb-7.7.1.orig/gdb/procfs.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/procfs.c 2014-05-12 20:22:05.800444118 +0200 -@@ -4924,7 +4924,7 @@ procfs_remove_watchpoint (CORE_ADDR addr - } +--- gdb-7.7.90.20140613.orig/gdb/procfs.c 2014-06-16 23:27:05.156747048 +0200 ++++ gdb-7.7.90.20140613/gdb/procfs.c 2014-06-16 23:27:07.872749612 +0200 +@@ -4916,7 +4916,7 @@ procfs_remove_watchpoint (struct target_ static int --procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + procfs_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { /* The man page for proc(4) on Solaris 2.6 and up says that the system can support "thousands" of hardware watchpoints, but gives -Index: gdb-7.7.1/gdb/python/py-prettyprint.c +Index: gdb-7.7.90.20140613/gdb/python/py-prettyprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/python/py-prettyprint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/python/py-prettyprint.c 2014-05-12 20:22:05.800444118 +0200 -@@ -688,7 +688,7 @@ print_children (PyObject *printer, const - - int - apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value *val, - const struct value_print_options *options, -@@ -843,7 +843,7 @@ gdbpy_default_visualizer (PyObject *self - - int - apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value *val, - const struct value_print_options *options, -Index: gdb-7.7.1/gdb/python/python.h +--- gdb-7.7.90.20140613.orig/gdb/python/py-prettyprint.c 2014-06-16 23:27:05.156747048 +0200 ++++ gdb-7.7.90.20140613/gdb/python/py-prettyprint.c 2014-06-16 23:27:07.873749612 +0200 +@@ -687,7 +687,7 @@ print_children (PyObject *printer, const + enum ext_lang_rc + gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang, + struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +Index: gdb-7.7.90.20140613/gdb/regcache.c =================================================================== ---- gdb-7.7.1.orig/gdb/python/python.h 2014-05-12 20:22:04.783443508 +0200 -+++ gdb-7.7.1/gdb/python/python.h 2014-05-12 20:22:05.801444119 +0200 -@@ -111,7 +111,7 @@ void source_python_script (FILE *file, c - void run_python_script (int argc, char **argv); - - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value *val, - const struct value_print_options *options, -Index: gdb-7.7.1/gdb/regcache.c -=================================================================== ---- gdb-7.7.1.orig/gdb/regcache.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/regcache.c 2014-05-12 20:22:05.801444119 +0200 +--- gdb-7.7.90.20140613.orig/gdb/regcache.c 2014-06-16 23:27:05.157747049 +0200 ++++ gdb-7.7.90.20140613/gdb/regcache.c 2014-06-16 23:27:07.873749612 +0200 @@ -899,7 +899,7 @@ typedef void (regcache_write_ftype) (str static enum register_status @@ -3117,10 +3090,10 @@ Index: gdb-7.7.1/gdb/regcache.c { struct regcache_descr *descr = regcache->descr; -Index: gdb-7.7.1/gdb/regcache.h +Index: gdb-7.7.90.20140613/gdb/regcache.h =================================================================== ---- gdb-7.7.1.orig/gdb/regcache.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/regcache.h 2014-05-12 20:22:05.801444119 +0200 +--- gdb-7.7.90.20140613.orig/gdb/regcache.h 2014-06-16 23:27:05.157747049 +0200 ++++ gdb-7.7.90.20140613/gdb/regcache.h 2014-06-16 23:27:07.873749612 +0200 @@ -89,9 +89,9 @@ extern void regcache_raw_write_unsigned extern enum register_status @@ -3148,37 +3121,37 @@ Index: gdb-7.7.1/gdb/regcache.h /* Special routines to read/write the PC. */ -Index: gdb-7.7.1/gdb/remote.c +Index: gdb-7.7.90.20140613/gdb/remote.c =================================================================== ---- gdb-7.7.1.orig/gdb/remote.c 2014-05-12 20:22:05.110443704 +0200 -+++ gdb-7.7.1/gdb/remote.c 2014-05-12 20:22:05.803444120 +0200 -@@ -8413,7 +8413,7 @@ int remote_hw_watchpoint_length_limit = - int remote_hw_breakpoint_limit = -1; +--- gdb-7.7.90.20140613.orig/gdb/remote.c 2014-06-16 23:27:05.159747051 +0200 ++++ gdb-7.7.90.20140613/gdb/remote.c 2014-06-16 23:27:07.875749614 +0200 +@@ -8272,7 +8272,7 @@ int remote_hw_breakpoint_limit = -1; static int --remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + remote_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { if (remote_hw_watchpoint_length_limit == 0) return 0; -Index: gdb-7.7.1/gdb/spu-multiarch.c +Index: gdb-7.7.90.20140613/gdb/spu-multiarch.c =================================================================== ---- gdb-7.7.1.orig/gdb/spu-multiarch.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/spu-multiarch.c 2014-05-12 20:22:05.803444120 +0200 -@@ -118,7 +118,7 @@ spu_thread_architecture (struct target_o - +--- gdb-7.7.90.20140613.orig/gdb/spu-multiarch.c 2014-06-16 23:27:05.159747051 +0200 ++++ gdb-7.7.90.20140613/gdb/spu-multiarch.c 2014-06-16 23:27:07.875749614 +0200 +@@ -119,7 +119,7 @@ spu_thread_architecture (struct target_o /* Override the to_region_ok_for_hw_watchpoint routine. */ static int --spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + spu_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { struct target_ops *ops_beneath = find_target_beneath (&spu_ops); while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint) -Index: gdb-7.7.1/gdb/stack.c +Index: gdb-7.7.90.20140613/gdb/stack.c =================================================================== ---- gdb-7.7.1.orig/gdb/stack.c 2014-05-12 20:22:04.783443508 +0200 -+++ gdb-7.7.1/gdb/stack.c 2014-05-12 20:22:05.803444120 +0200 -@@ -180,7 +180,7 @@ print_stack_frame (struct frame_info *fr +--- gdb-7.7.90.20140613.orig/gdb/stack.c 2014-06-16 23:27:05.160747052 +0200 ++++ gdb-7.7.90.20140613/gdb/stack.c 2014-06-16 23:27:07.875749614 +0200 +@@ -179,7 +179,7 @@ print_stack_frame (struct frame_info *fr argument (not just the first nameless argument). */ static void @@ -3187,7 +3160,7 @@ Index: gdb-7.7.1/gdb/stack.c int first, struct ui_file *stream) { struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -526,7 +526,7 @@ print_frame_args (struct symbol *func, s +@@ -525,7 +525,7 @@ print_frame_args (struct symbol *func, s /* Offset of next stack argument beyond the one we have seen that is at the highest offset, or -1 if we haven't come to a stack argument yet. */ @@ -3196,7 +3169,7 @@ Index: gdb-7.7.1/gdb/stack.c /* Number of ints of arguments that we have printed so far. */ int args_printed = 0; struct cleanup *old_chain; -@@ -564,8 +564,8 @@ print_frame_args (struct symbol *func, s +@@ -559,8 +559,8 @@ print_frame_args (struct symbol *func, s case LOC_ARG: case LOC_REF_ARG: { @@ -3207,7 +3180,7 @@ Index: gdb-7.7.1/gdb/stack.c /* Compute address of next argument by adding the size of this argument and rounding to an int boundary. */ -@@ -700,7 +700,7 @@ print_frame_args (struct symbol *func, s +@@ -695,7 +695,7 @@ print_frame_args (struct symbol *func, s enough about the stack to find them. */ if (num != -1) { @@ -3216,11 +3189,11 @@ Index: gdb-7.7.1/gdb/stack.c if (highest_offset == -1) start = gdbarch_frame_args_skip (get_frame_arch (frame)); -Index: gdb-7.7.1/gdb/symmisc.c +Index: gdb-7.7.90.20140613/gdb/symmisc.c =================================================================== ---- gdb-7.7.1.orig/gdb/symmisc.c 2014-05-12 20:22:05.212443765 +0200 -+++ gdb-7.7.1/gdb/symmisc.c 2014-05-12 20:22:05.804444120 +0200 -@@ -529,11 +529,11 @@ print_symbol (void *args) +--- gdb-7.7.90.20140613.orig/gdb/symmisc.c 2014-06-16 23:27:05.160747052 +0200 ++++ gdb-7.7.90.20140613/gdb/symmisc.c 2014-06-16 23:27:07.875749614 +0200 +@@ -530,11 +530,11 @@ print_symbol (void *args) case LOC_CONST_BYTES: { @@ -3235,64 +3208,64 @@ Index: gdb-7.7.1/gdb/symmisc.c for (i = 0; i < TYPE_LENGTH (type); i++) fprintf_filtered (outfile, " %02x", (unsigned) SYMBOL_VALUE_BYTES (symbol)[i]); -Index: gdb-7.7.1/gdb/target.c +Index: gdb-7.7.90.20140613/gdb/target.c =================================================================== ---- gdb-7.7.1.orig/gdb/target.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/target.c 2014-05-12 20:22:05.804444120 +0200 -@@ -52,7 +52,7 @@ static void default_terminal_info (const - static int default_watchpoint_addr_within_range (struct target_ops *, +--- gdb-7.7.90.20140613.orig/gdb/target.c 2014-06-16 23:27:05.161747053 +0200 ++++ gdb-7.7.90.20140613/gdb/target.c 2014-06-16 23:27:07.876749615 +0200 +@@ -55,7 +55,7 @@ static int default_watchpoint_addr_withi CORE_ADDR, CORE_ADDR, int); --static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int); -+static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + static int default_region_ok_for_hw_watchpoint (struct target_ops *, +- CORE_ADDR, int); ++ CORE_ADDR, LONGEST); - static void tcomplain (void) ATTRIBUTE_NORETURN; + static void default_rcmd (struct target_ops *, char *, struct ui_file *); -@@ -116,7 +116,7 @@ static int debug_to_stopped_data_address - static int debug_to_watchpoint_addr_within_range (struct target_ops *, +@@ -153,7 +153,7 @@ static int debug_to_watchpoint_addr_with CORE_ADDR, CORE_ADDR, int); --static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int); -+static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); - - static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, - struct expression *); -@@ -3590,7 +3590,7 @@ target_fileio_read_stralloc (const char + static int debug_to_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR, int); ++ CORE_ADDR, LONGEST); + static int debug_to_can_accel_watchpoint_condition (struct target_ops *self, + CORE_ADDR, int, int, +@@ -2951,7 +2951,7 @@ target_fileio_read_stralloc (const char static int --default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+default_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + default_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT); } -@@ -4557,7 +4557,7 @@ debug_to_can_use_hw_breakpoint (int type - } +@@ -3664,7 +3664,7 @@ debug_to_can_use_hw_breakpoint (struct t static int --debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + debug_to_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int len) ++ CORE_ADDR addr, LONGEST len) { CORE_ADDR retval; -Index: gdb-7.7.1/gdb/target.h +Index: gdb-7.7.90.20140613/gdb/target.h =================================================================== ---- gdb-7.7.1.orig/gdb/target.h 2014-05-12 20:22:05.574443982 +0200 -+++ gdb-7.7.1/gdb/target.h 2014-05-12 20:22:05.805444121 +0200 -@@ -428,7 +428,7 @@ struct target_ops - +--- gdb-7.7.90.20140613.orig/gdb/target.h 2014-06-16 23:27:05.162747054 +0200 ++++ gdb-7.7.90.20140613/gdb/target.h 2014-06-16 23:27:07.876749615 +0200 +@@ -475,7 +475,7 @@ struct target_ops /* Documentation of this routine is provided with the corresponding target_* macro. */ -- int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int); -+ int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); + int (*to_region_ok_for_hw_watchpoint) (struct target_ops *, +- CORE_ADDR, int) ++ CORE_ADDR, LONGEST) + TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); - int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, - struct expression *); -Index: gdb-7.7.1/gdb/tracepoint.c + int (*to_can_accel_watchpoint_condition) (struct target_ops *, +Index: gdb-7.7.90.20140613/gdb/tracepoint.c =================================================================== ---- gdb-7.7.1.orig/gdb/tracepoint.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/tracepoint.c 2014-05-12 20:22:05.806444122 +0200 -@@ -937,13 +937,13 @@ add_register (struct collection_list *co +--- gdb-7.7.90.20140613.orig/gdb/tracepoint.c 2014-06-16 23:27:05.163747055 +0200 ++++ gdb-7.7.90.20140613/gdb/tracepoint.c 2014-06-16 23:27:07.877749616 +0200 +@@ -930,13 +930,13 @@ add_register (struct collection_list *co static void add_memrange (struct collection_list *memranges, int type, bfd_signed_vma base, @@ -3308,7 +3281,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c } /* type: memrange_absolute == memory, other n == basereg */ -@@ -973,7 +973,7 @@ collect_symbol (struct collection_list * +@@ -966,7 +966,7 @@ collect_symbol (struct collection_list * CORE_ADDR scope, int trace_string) { @@ -3317,7 +3290,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c unsigned int reg; bfd_signed_vma offset; int treat_as_expr = 0; -@@ -997,8 +997,8 @@ collect_symbol (struct collection_list * +@@ -990,8 +990,8 @@ collect_symbol (struct collection_list * char tmp[40]; sprintf_vma (tmp, offset); @@ -3328,7 +3301,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c tmp /* address */); } /* A struct may be a C++ class with static fields, go to general -@@ -1030,8 +1030,8 @@ collect_symbol (struct collection_list * +@@ -1023,8 +1023,8 @@ collect_symbol (struct collection_list * offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3339,7 +3312,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c printf_vma (offset); printf_filtered (" from frame ptr reg %d\n", reg); } -@@ -1042,8 +1042,8 @@ collect_symbol (struct collection_list * +@@ -1035,8 +1035,8 @@ collect_symbol (struct collection_list * offset = 0; if (info_verbose) { @@ -3350,7 +3323,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c printf_vma (offset); printf_filtered (" from reg %d\n", reg); } -@@ -1054,8 +1054,8 @@ collect_symbol (struct collection_list * +@@ -1047,8 +1047,8 @@ collect_symbol (struct collection_list * offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3361,7 +3334,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c printf_vma (offset); printf_filtered (" from frame ptr reg %d\n", reg); } -@@ -2713,7 +2713,8 @@ scope_info (char *args, int from_tty) +@@ -2709,7 +2709,8 @@ scope_info (char *args, int from_tty) const char *symname; char *save_args = args; struct block_iterator iter; @@ -3371,7 +3344,7 @@ Index: gdb-7.7.1/gdb/tracepoint.c struct gdbarch *gdbarch; int regno; -@@ -2849,8 +2850,11 @@ scope_info (char *args, int from_tty) +@@ -2845,8 +2846,11 @@ scope_info (char *args, int from_tty) } } if (SYMBOL_TYPE (sym)) @@ -3385,11 +3358,11 @@ Index: gdb-7.7.1/gdb/tracepoint.c } if (BLOCK_FUNCTION (block)) break; -Index: gdb-7.7.1/gdb/typeprint.c +Index: gdb-7.7.90.20140613/gdb/typeprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/typeprint.c 2014-05-12 20:22:04.790443512 +0200 -+++ gdb-7.7.1/gdb/typeprint.c 2014-05-12 20:22:05.806444122 +0200 -@@ -409,7 +409,7 @@ whatis_exp (char *exp, int show) +--- gdb-7.7.90.20140613.orig/gdb/typeprint.c 2014-06-16 23:27:05.164747056 +0200 ++++ gdb-7.7.90.20140613/gdb/typeprint.c 2014-06-16 23:27:07.877749616 +0200 +@@ -405,7 +405,7 @@ whatis_exp (char *exp, int show) struct type *real_type = NULL; struct type *type; int full = 0; @@ -3398,31 +3371,39 @@ Index: gdb-7.7.1/gdb/typeprint.c int using_enc = 0; struct value_print_options opts; struct type_print_options flags = default_ptype_flags; -Index: gdb-7.7.1/gdb/valarith.c +Index: gdb-7.7.90.20140613/gdb/valarith.c =================================================================== ---- gdb-7.7.1.orig/gdb/valarith.c 2014-05-12 20:22:04.791443513 +0200 -+++ gdb-7.7.1/gdb/valarith.c 2014-05-12 20:22:05.806444122 +0200 -@@ -190,15 +190,15 @@ value_subscript (struct value *array, LO +--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:27:05.164747056 +0200 ++++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:27:39.124779265 +0200 +@@ -190,12 +190,13 @@ value_subscript (struct value *array, LO to doubles, but no longer does. */ struct value * -value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) -+value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound) ++value_subscripted_rvalue (struct value *array, LONGEST index, ++ LONGEST lowerbound) { struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); - unsigned int elt_size = TYPE_LENGTH (elt_type); -- unsigned int elt_stride +- unsigned int elt_offs; + ULONGEST elt_size = TYPE_LENGTH (elt_type); -+ ULONGEST elt_stride - = (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)) == 0 - ? elt_size : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type))); -- unsigned int elt_offs = elt_stride * longest_to_int (index - lowerbound); -+ ULONGEST elt_offs = elt_stride * longest_to_int (index - lowerbound); ++ ULONGEST elt_offs; + LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)); struct value *v; - if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -@@ -635,7 +635,7 @@ value_concat (struct value *arg1, struct +@@ -204,7 +205,9 @@ value_subscripted_rvalue (struct value * + if (TYPE_NOT_ALLOCATED (array_type)) + error (_("no such vector element because not allocated")); + +- elt_offs = longest_to_int (index - lowerbound); ++ if (index < lowerbound) ++ error (_("no such vector element")); ++ elt_offs = index - lowerbound; + + if (elt_stride > 0) + elt_offs *= elt_stride; +@@ -662,7 +665,7 @@ value_concat (struct value *arg1, struct struct value *inval1; struct value *inval2; struct value *outval = NULL; @@ -3431,7 +3412,7 @@ Index: gdb-7.7.1/gdb/valarith.c int count, idx; char *ptr; char inchar; -@@ -1488,7 +1488,7 @@ value_binop (struct value *arg1, struct +@@ -1515,7 +1518,7 @@ value_binop (struct value *arg1, struct int value_logical_not (struct value *arg1) { @@ -3440,7 +3421,7 @@ Index: gdb-7.7.1/gdb/valarith.c const gdb_byte *p; struct type *type1; -@@ -1519,11 +1519,11 @@ value_logical_not (struct value *arg1) +@@ -1546,11 +1549,11 @@ value_logical_not (struct value *arg1) static int value_strcmp (struct value *arg1, struct value *arg2) { @@ -3455,10 +3436,10 @@ Index: gdb-7.7.1/gdb/valarith.c for (i = 0; i < len; i++) { -Index: gdb-7.7.1/gdb/valops.c +Index: gdb-7.7.90.20140613/gdb/valops.c =================================================================== ---- gdb-7.7.1.orig/gdb/valops.c 2014-05-12 20:22:05.444443904 +0200 -+++ gdb-7.7.1/gdb/valops.c 2014-05-12 20:22:05.807444122 +0200 +--- gdb-7.7.90.20140613.orig/gdb/valops.c 2014-06-16 23:27:05.167747058 +0200 ++++ gdb-7.7.90.20140613/gdb/valops.c 2014-06-16 23:27:07.879749618 +0200 @@ -51,11 +51,11 @@ static int typecmp (int staticp, int var struct field t1[], struct value *t2[]); @@ -3479,21 +3460,22 @@ Index: gdb-7.7.1/gdb/valops.c static struct value *value_struct_elt_for_reference (struct type *, - int, struct type *, + LONGEST, struct type *, - char *, + const char *, struct type *, int, enum noside); -@@ -100,8 +100,8 @@ static CORE_ADDR allocate_space_in_infer +@@ -100,9 +100,9 @@ static CORE_ADDR allocate_space_in_infer static struct value *cast_into_complex (struct type *, struct value *); - static struct fn_field *find_method_list (struct value **, const char *, -- int, struct type *, int *, -- struct type **, int *); -+ LONGEST, struct type *, int *, -+ struct type **, LONGEST *); + static void find_method_list (struct value **, const char *, +- int, struct type *, struct fn_field **, int *, ++ LONGEST, struct type *, struct fn_field **, int *, + VEC (xmethod_worker_ptr) **, +- struct type **, int *); ++ struct type **, LONGEST *); void _initialize_valops (void); -@@ -186,7 +186,7 @@ find_function_in_inferior (const char *n +@@ -187,7 +187,7 @@ find_function_in_inferior (const char *n space. */ struct value * @@ -3502,7 +3484,7 @@ Index: gdb-7.7.1/gdb/valops.c { struct objfile *objf; struct value *val = find_function_in_inferior ("malloc", &objf); -@@ -259,7 +259,8 @@ value_cast_structs (struct type *type, s +@@ -260,7 +260,8 @@ value_cast_structs (struct type *type, s if (TYPE_NAME (t2) != NULL) { /* Try downcasting using the run-time type of the value. */ @@ -3512,7 +3494,7 @@ Index: gdb-7.7.1/gdb/valops.c struct type *real_type; real_type = value_rtti_type (v2, &full, &top, &using_enc); -@@ -398,12 +399,12 @@ value_cast (struct type *type, struct va +@@ -400,12 +401,12 @@ value_cast (struct type *type, struct va if (code1 == TYPE_CODE_ARRAY) { struct type *element_type = TYPE_TARGET_TYPE (type); @@ -3527,7 +3509,7 @@ Index: gdb-7.7.1/gdb/valops.c LONGEST low_bound, high_bound, new_length; if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -@@ -637,7 +638,7 @@ value_reinterpret_cast (struct type *typ +@@ -639,7 +640,7 @@ value_reinterpret_cast (struct type *typ static int dynamic_cast_check_1 (struct type *desired_type, const gdb_byte *valaddr, @@ -3536,7 +3518,7 @@ Index: gdb-7.7.1/gdb/valops.c CORE_ADDR address, struct value *val, struct type *search_type, -@@ -649,8 +650,8 @@ dynamic_cast_check_1 (struct type *desir +@@ -651,8 +652,8 @@ dynamic_cast_check_1 (struct type *desir for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) { @@ -3547,7 +3529,7 @@ Index: gdb-7.7.1/gdb/valops.c if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i))) { -@@ -684,7 +685,7 @@ dynamic_cast_check_1 (struct type *desir +@@ -686,7 +687,7 @@ dynamic_cast_check_1 (struct type *desir static int dynamic_cast_check_2 (struct type *desired_type, const gdb_byte *valaddr, @@ -3556,7 +3538,7 @@ Index: gdb-7.7.1/gdb/valops.c CORE_ADDR address, struct value *val, struct type *search_type, -@@ -694,7 +695,7 @@ dynamic_cast_check_2 (struct type *desir +@@ -696,7 +697,7 @@ dynamic_cast_check_2 (struct type *desir for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) { @@ -3565,7 +3547,7 @@ Index: gdb-7.7.1/gdb/valops.c if (! BASETYPE_VIA_PUBLIC (search_type, i)) continue; -@@ -725,7 +726,8 @@ dynamic_cast_check_2 (struct type *desir +@@ -727,7 +728,8 @@ dynamic_cast_check_2 (struct type *desir struct value * value_dynamic_cast (struct type *type, struct value *arg) { @@ -3575,7 +3557,7 @@ Index: gdb-7.7.1/gdb/valops.c struct type *resolved_type = check_typedef (type); struct type *arg_type = check_typedef (value_type (arg)); struct type *class_type, *rtti_type; -@@ -1005,7 +1007,7 @@ value_at_lazy (struct type *type, CORE_A +@@ -958,7 +960,7 @@ value_at_lazy (struct type *type, CORE_A } void @@ -3584,7 +3566,7 @@ Index: gdb-7.7.1/gdb/valops.c int stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length) { -@@ -1155,7 +1157,7 @@ value_assign (struct value *toval, struc +@@ -1058,7 +1060,7 @@ value_assign (struct value *toval, struc { const gdb_byte *dest_buffer; CORE_ADDR changed_addr; @@ -3593,7 +3575,7 @@ Index: gdb-7.7.1/gdb/valops.c gdb_byte buffer[sizeof (LONGEST)]; if (value_bitsize (toval)) -@@ -1234,7 +1236,7 @@ value_assign (struct value *toval, struc +@@ -1137,7 +1139,7 @@ value_assign (struct value *toval, struc if (value_bitsize (toval)) { struct value *parent = value_parent (toval); @@ -3602,7 +3584,7 @@ Index: gdb-7.7.1/gdb/valops.c int changed_len; gdb_byte buffer[sizeof (LONGEST)]; int optim, unavail; -@@ -1715,7 +1717,7 @@ value_array (int lowbound, int highbound +@@ -1605,7 +1607,7 @@ value_array (int lowbound, int highbound { int nelem; int idx; @@ -3611,7 +3593,7 @@ Index: gdb-7.7.1/gdb/valops.c struct value *val; struct type *arraytype; -@@ -1890,7 +1892,7 @@ typecmp (int staticp, int varargs, int n +@@ -1780,7 +1782,7 @@ typecmp (int staticp, int varargs, int n static void update_search_result (struct value **result_ptr, struct value *v, @@ -3620,7 +3602,7 @@ Index: gdb-7.7.1/gdb/valops.c const char *name, struct type *type) { if (v != NULL) -@@ -1914,10 +1916,10 @@ update_search_result (struct value **res +@@ -1804,10 +1806,10 @@ update_search_result (struct value **res lookup is ambiguous. */ static void @@ -3633,7 +3615,7 @@ Index: gdb-7.7.1/gdb/valops.c struct type *outermost_type) { int i; -@@ -1966,7 +1968,7 @@ do_search_struct_field (const char *name +@@ -1856,7 +1858,7 @@ do_search_struct_field (const char *name . */ struct value *v = NULL; @@ -3642,7 +3624,7 @@ Index: gdb-7.7.1/gdb/valops.c /* This is pretty gross. In G++, the offset in an anonymous union is relative to the beginning of the -@@ -2005,7 +2007,7 @@ do_search_struct_field (const char *name +@@ -1895,7 +1897,7 @@ do_search_struct_field (const char *name && (strcmp_iw (name, TYPE_BASECLASS_NAME (type, i)) == 0)); @@ -3651,7 +3633,7 @@ Index: gdb-7.7.1/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (type, i)) { -@@ -2078,11 +2080,11 @@ do_search_struct_field (const char *name +@@ -1968,11 +1970,11 @@ do_search_struct_field (const char *name fields, look for a baseclass named NAME. */ static struct value * @@ -3665,7 +3647,7 @@ Index: gdb-7.7.1/gdb/valops.c do_search_struct_field (name, arg1, offset, type, looking_for_baseclass, &result, &boffset, type); -@@ -2099,7 +2101,7 @@ search_struct_field (const char *name, s +@@ -1989,7 +1991,7 @@ search_struct_field (const char *name, s static struct value * search_struct_method (const char *name, struct value **arg1p, @@ -3674,7 +3656,7 @@ Index: gdb-7.7.1/gdb/valops.c int *static_memfuncp, struct type *type) { int i; -@@ -2163,8 +2165,8 @@ search_struct_method (const char *name, +@@ -2053,8 +2055,8 @@ search_struct_method (const char *name, for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) { @@ -3685,19 +3667,21 @@ Index: gdb-7.7.1/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (type, i)) { -@@ -2391,8 +2393,8 @@ value_struct_elt_bitpos (struct value ** +@@ -2289,10 +2291,10 @@ value_struct_elt_bitpos (struct value ** - static struct fn_field * + static void find_method_list (struct value **argp, const char *method, -- int offset, struct type *type, int *num_fns, +- int offset, struct type *type, ++ LONGEST offset, struct type *type, + struct fn_field **fn_list, int *num_fns, + VEC (xmethod_worker_ptr) **xm_worker_vec, - struct type **basetype, int *boffset) -+ LONGEST offset, struct type *type, int *num_fns, + struct type **basetype, LONGEST *boffset) { int i; - struct fn_field *f; -@@ -2425,7 +2427,7 @@ find_method_list (struct value **argp, c - /* Not found in object, check in base subobjects. */ + struct fn_field *f = NULL; +@@ -2349,7 +2351,7 @@ find_method_list (struct value **argp, c + extension methods. */ for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) { - int base_offset; @@ -3705,16 +3689,16 @@ Index: gdb-7.7.1/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (type, i)) { -@@ -2461,7 +2463,7 @@ find_method_list (struct value **argp, c - static struct fn_field * - value_find_oload_method_list (struct value **argp, const char *method, - int offset, int *num_fns, +@@ -2392,7 +2394,7 @@ value_find_oload_method_list (struct val + int offset, struct fn_field **fn_list, + int *num_fns, + VEC (xmethod_worker_ptr) **xm_worker_vec, - struct type **basetype, int *boffset) + struct type **basetype, LONGEST *boffset) { struct type *t; -@@ -2551,7 +2553,7 @@ find_overload_match (struct value **args +@@ -2496,7 +2498,7 @@ find_overload_match (struct value **args /* Number of overloaded instances being considered. */ int num_fns = 0; struct type *basetype = NULL; @@ -3723,16 +3707,16 @@ Index: gdb-7.7.1/gdb/valops.c struct cleanup *all_cleanups = make_cleanup (null_cleanup, NULL); -@@ -3221,7 +3223,7 @@ compare_parameters (struct type *t1, str +@@ -3307,7 +3309,7 @@ compare_parameters (struct type *t1, str the form "DOMAIN::NAME". */ static struct value * -value_struct_elt_for_reference (struct type *domain, int offset, +value_struct_elt_for_reference (struct type *domain, LONGEST offset, - struct type *curtype, char *name, + struct type *curtype, const char *name, struct type *intype, int want_address, -@@ -3255,7 +3257,7 @@ value_struct_elt_for_reference (struct t +@@ -3341,7 +3343,7 @@ value_struct_elt_for_reference (struct t if (want_address) return value_from_longest (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain), @@ -3741,7 +3725,7 @@ Index: gdb-7.7.1/gdb/valops.c else if (noside != EVAL_NORMAL) return allocate_value (TYPE_FIELD_TYPE (t, i)); else -@@ -3423,7 +3425,7 @@ value_struct_elt_for_reference (struct t +@@ -3509,7 +3511,7 @@ value_struct_elt_for_reference (struct t for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) { struct value *v; @@ -3750,7 +3734,7 @@ Index: gdb-7.7.1/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (t, i)) base_offset = 0; -@@ -3513,7 +3515,7 @@ value_maybe_namespace_elt (const struct +@@ -3599,7 +3601,7 @@ value_maybe_namespace_elt (const struct struct type * value_rtti_indirect_type (struct value *v, int *full, @@ -3759,7 +3743,7 @@ Index: gdb-7.7.1/gdb/valops.c { struct value *target; struct type *type, *real_type, *target_type; -@@ -3563,12 +3565,12 @@ value_rtti_indirect_type (struct value * +@@ -3649,12 +3651,12 @@ value_rtti_indirect_type (struct value * struct value * value_full_object (struct value *argp, struct type *rtype, @@ -3774,10 +3758,10 @@ Index: gdb-7.7.1/gdb/valops.c int using_enc = 0; struct value *new_val; -Index: gdb-7.7.1/gdb/valprint.c +Index: gdb-7.7.90.20140613/gdb/valprint.c =================================================================== ---- gdb-7.7.1.orig/gdb/valprint.c 2014-05-12 20:22:04.792443513 +0200 -+++ gdb-7.7.1/gdb/valprint.c 2014-05-12 20:22:05.807444122 +0200 +--- gdb-7.7.90.20140613.orig/gdb/valprint.c 2014-06-16 23:27:05.168747059 +0200 ++++ gdb-7.7.90.20140613/gdb/valprint.c 2014-06-16 23:27:07.879749618 +0200 @@ -302,7 +302,7 @@ val_print_scalar_type_p (struct type *ty int valprint_check_validity (struct ui_file *stream, @@ -3787,7 +3771,7 @@ Index: gdb-7.7.1/gdb/valprint.c const struct value *val) { CHECK_TYPEDEF (type); -@@ -375,7 +375,7 @@ val_print_invalid_address (struct ui_fil +@@ -399,7 +399,7 @@ val_print_not_associated (struct ui_file void generic_val_print (struct type *type, const gdb_byte *valaddr, @@ -3796,7 +3780,7 @@ Index: gdb-7.7.1/gdb/valprint.c struct ui_file *stream, int recurse, const struct value *original_value, const struct value_print_options *options, -@@ -737,7 +737,7 @@ generic_val_print (struct type *type, co +@@ -761,7 +761,7 @@ generic_val_print (struct type *type, co RECURSE. */ void @@ -3805,7 +3789,7 @@ Index: gdb-7.7.1/gdb/valprint.c CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, -@@ -958,7 +958,7 @@ val_print_type_code_flags (struct type * +@@ -999,7 +999,7 @@ val_print_type_code_flags (struct type * void val_print_scalar_formatted (struct type *type, @@ -3814,7 +3798,7 @@ Index: gdb-7.7.1/gdb/valprint.c const struct value *val, const struct value_print_options *options, int size, -@@ -1499,7 +1499,7 @@ print_decimal_chars (struct ui_file *str +@@ -1540,7 +1540,7 @@ print_decimal_chars (struct ui_file *str void print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, @@ -3823,7 +3807,7 @@ Index: gdb-7.7.1/gdb/valprint.c { const gdb_byte *p; -@@ -1616,23 +1616,23 @@ maybe_print_array_index (struct type *in +@@ -1657,22 +1657,22 @@ maybe_print_array_index (struct type *in void val_print_array_elements (struct type *type, @@ -3839,7 +3823,6 @@ Index: gdb-7.7.1/gdb/valprint.c unsigned int things_printed = 0; - unsigned len; + ULONGEST len; - struct type *saved_type = type; struct type *elttype, *index_type; - unsigned eltlen; + ULONGEST eltlen; @@ -3851,9 +3834,9 @@ Index: gdb-7.7.1/gdb/valprint.c - unsigned int reps; + ULONGEST reps; LONGEST low_bound, high_bound; - struct cleanup *back_to; - CORE_ADDR saved_address = address; -@@ -1727,7 +1727,7 @@ val_print_array_elements (struct type *t + + elttype = TYPE_TARGET_TYPE (type); +@@ -1743,7 +1743,7 @@ val_print_array_elements (struct type *t address, stream, recurse + 1, val, options, current_language); annotate_elt_rep (reps); @@ -3862,7 +3845,7 @@ Index: gdb-7.7.1/gdb/valprint.c annotate_elt_rep_end (); i = rep1 - 1; -@@ -2382,7 +2382,7 @@ print_converted_chars_to_obstack (struct +@@ -2400,7 +2400,7 @@ print_converted_chars_to_obstack (struct void generic_printstr (struct ui_file *stream, struct type *type, @@ -3871,10 +3854,10 @@ Index: gdb-7.7.1/gdb/valprint.c const char *encoding, int force_ellipses, int quote_char, int c_style_terminator, const struct value_print_options *options) -Index: gdb-7.7.1/gdb/valprint.h +Index: gdb-7.7.90.20140613/gdb/valprint.h =================================================================== ---- gdb-7.7.1.orig/gdb/valprint.h 2014-01-08 10:23:36.000000000 +0100 -+++ gdb-7.7.1/gdb/valprint.h 2014-05-12 20:22:05.808444123 +0200 +--- gdb-7.7.90.20140613.orig/gdb/valprint.h 2014-06-16 23:27:05.168747059 +0200 ++++ gdb-7.7.90.20140613/gdb/valprint.h 2014-06-16 23:27:07.879749618 +0200 @@ -115,11 +115,11 @@ extern void maybe_print_array_index (str struct ui_file *stream, const struct value_print_options *); @@ -3925,10 +3908,10 @@ Index: gdb-7.7.1/gdb/valprint.h const char *encoding, int force_ellipses, int quote_char, int c_style_terminator, const struct value_print_options *options); -Index: gdb-7.7.1/gdb/value.c +Index: gdb-7.7.90.20140613/gdb/value.c =================================================================== ---- gdb-7.7.1.orig/gdb/value.c 2014-05-12 20:22:05.534443958 +0200 -+++ gdb-7.7.1/gdb/value.c 2014-05-12 20:22:05.808444123 +0200 +--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-16 23:27:05.171747062 +0200 ++++ gdb-7.7.90.20140613/gdb/value.c 2014-06-16 23:27:07.880749619 +0200 @@ -69,10 +69,10 @@ struct internal_function struct range { @@ -3962,7 +3945,7 @@ Index: gdb-7.7.1/gdb/value.c { range_s what; int i; -@@ -246,7 +246,7 @@ struct value +@@ -252,7 +252,7 @@ struct value lval == lval_register, this is a further offset from location.address within the registers structure. Note also the member embedded_offset below. */ @@ -3971,7 +3954,7 @@ Index: gdb-7.7.1/gdb/value.c /* Only used for bitfields; number of bits contained in them. */ int bitsize; -@@ -316,8 +316,8 @@ struct value +@@ -322,8 +322,8 @@ struct value `type', and `embedded_offset' is zero, so everything works normally. */ struct type *enclosing_type; @@ -3982,7 +3965,7 @@ Index: gdb-7.7.1/gdb/value.c /* Values are stored in a chain, so that they can be deleted easily over calls to the inferior. Values assigned to internal -@@ -348,7 +348,8 @@ value_bits_available (const struct value +@@ -351,7 +351,8 @@ value_bits_available (const struct value } int @@ -3992,7 +3975,7 @@ Index: gdb-7.7.1/gdb/value.c { return value_bits_available (value, offset * TARGET_CHAR_BIT, -@@ -555,7 +556,8 @@ mark_value_bits_unavailable (struct valu +@@ -558,7 +559,8 @@ mark_value_bits_unavailable (struct valu } void @@ -4002,7 +3985,7 @@ Index: gdb-7.7.1/gdb/value.c { mark_value_bits_unavailable (value, offset * TARGET_CHAR_BIT, -@@ -569,7 +571,7 @@ mark_value_bytes_unavailable (struct val +@@ -572,7 +574,7 @@ mark_value_bytes_unavailable (struct val static int find_first_range_overlap (VEC(range_s) *ranges, int pos, @@ -4011,7 +3994,7 @@ Index: gdb-7.7.1/gdb/value.c { range_s *r; int i; -@@ -760,9 +762,9 @@ value_available_contents_bits_eq (const +@@ -763,9 +765,9 @@ value_available_contents_bits_eq (const } int @@ -4024,7 +4007,7 @@ Index: gdb-7.7.1/gdb/value.c { return value_available_contents_bits_eq (val1, offset1 * TARGET_CHAR_BIT, val2, offset2 * TARGET_CHAR_BIT, -@@ -927,13 +929,13 @@ deprecated_set_value_type (struct value +@@ -930,13 +932,13 @@ deprecated_set_value_type (struct value value->type = type; } @@ -4040,7 +4023,7 @@ Index: gdb-7.7.1/gdb/value.c { value->offset = offset; } -@@ -1103,8 +1105,9 @@ value_contents_all (struct value *value) +@@ -1106,8 +1108,9 @@ value_contents_all (struct value *value) DST_OFFSET+LENGTH) range are wholly available. */ void @@ -4052,7 +4035,7 @@ Index: gdb-7.7.1/gdb/value.c { range_s *r; int i; -@@ -1156,8 +1159,8 @@ value_contents_copy_raw (struct value *d +@@ -1159,8 +1162,8 @@ value_contents_copy_raw (struct value *d DST_OFFSET+LENGTH) range are wholly available. */ void @@ -4063,7 +4046,7 @@ Index: gdb-7.7.1/gdb/value.c { require_not_optimized_out (src); -@@ -1262,7 +1265,7 @@ value_entirely_optimized_out (const stru +@@ -1265,7 +1268,7 @@ value_entirely_optimized_out (const stru } int @@ -4072,7 +4055,7 @@ Index: gdb-7.7.1/gdb/value.c { if (!value->optimized_out) return 1; -@@ -1275,7 +1278,7 @@ value_bits_valid (const struct value *va +@@ -1278,7 +1281,7 @@ value_bits_valid (const struct value *va int value_bits_synthetic_pointer (const struct value *value, @@ -4081,7 +4064,7 @@ Index: gdb-7.7.1/gdb/value.c { if (value->lval != lval_computed || !value->location.computed.funcs->check_synthetic_pointer) -@@ -1285,26 +1288,26 @@ value_bits_synthetic_pointer (const stru +@@ -1288,26 +1291,26 @@ value_bits_synthetic_pointer (const stru length); } @@ -4112,7 +4095,7 @@ Index: gdb-7.7.1/gdb/value.c { value->pointed_to_offset = val; } -@@ -2157,7 +2160,7 @@ get_internalvar_function (struct interna +@@ -2154,7 +2157,7 @@ get_internalvar_function (struct interna } void @@ -4121,7 +4104,7 @@ Index: gdb-7.7.1/gdb/value.c int bitsize, struct value *newval) { gdb_byte *addr; -@@ -2863,7 +2866,7 @@ set_value_enclosing_type (struct value * +@@ -2860,7 +2863,7 @@ set_value_enclosing_type (struct value * FIELDNO says which field. */ struct value * @@ -4130,7 +4113,7 @@ Index: gdb-7.7.1/gdb/value.c int fieldno, struct type *arg_type) { struct value *v; -@@ -2891,7 +2894,7 @@ value_primitive_field (struct value *arg +@@ -2888,7 +2891,7 @@ value_primitive_field (struct value *arg bit. Assume that the address, offset, and embedded offset are sufficiently aligned. */ @@ -4139,7 +4122,7 @@ Index: gdb-7.7.1/gdb/value.c int container_bitsize = TYPE_LENGTH (type) * 8; if (arg1->optimized_out) -@@ -2918,7 +2921,7 @@ value_primitive_field (struct value *arg +@@ -2915,7 +2918,7 @@ value_primitive_field (struct value *arg /* This field is actually a base subobject, so preserve the entire object's contents for later references to virtual bases, etc. */ @@ -4148,7 +4131,7 @@ Index: gdb-7.7.1/gdb/value.c /* Lazy register values with offsets are not supported. */ if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) -@@ -3008,7 +3011,7 @@ value_field (struct value *arg1, int fie +@@ -3014,7 +3017,7 @@ value_field (struct value *arg1, int fie struct value * value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *type, @@ -4157,7 +4140,7 @@ Index: gdb-7.7.1/gdb/value.c { struct value *v; struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); -@@ -3068,8 +3071,8 @@ value_fn_field (struct value **arg1p, st +@@ -3074,8 +3077,8 @@ value_fn_field (struct value **arg1p, st static int unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, @@ -4168,7 +4151,7 @@ Index: gdb-7.7.1/gdb/value.c LONGEST *result) { enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (field_type)); -@@ -3077,7 +3080,7 @@ unpack_value_bits_as_long_1 (struct type +@@ -3083,7 +3086,7 @@ unpack_value_bits_as_long_1 (struct type ULONGEST valmask; int lsbcount; int bytes_read; @@ -4177,7 +4160,7 @@ Index: gdb-7.7.1/gdb/value.c /* Read the minimum number of bytes required; there may not be enough bytes to read an entire ULONGEST. */ -@@ -3147,7 +3150,7 @@ unpack_value_bits_as_long_1 (struct type +@@ -3153,7 +3156,7 @@ unpack_value_bits_as_long_1 (struct type int unpack_value_bits_as_long (struct type *field_type, const gdb_byte *valaddr, @@ -4186,7 +4169,7 @@ Index: gdb-7.7.1/gdb/value.c const struct value *original_value, LONGEST *result) { -@@ -3165,10 +3168,10 @@ unpack_value_bits_as_long (struct type * +@@ -3171,10 +3174,10 @@ unpack_value_bits_as_long (struct type * static int unpack_value_field_as_long_1 (struct type *type, const gdb_byte *valaddr, @@ -4199,7 +4182,7 @@ Index: gdb-7.7.1/gdb/value.c int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); -@@ -3184,7 +3187,7 @@ unpack_value_field_as_long_1 (struct typ +@@ -3190,7 +3193,7 @@ unpack_value_field_as_long_1 (struct typ int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, @@ -4208,7 +4191,7 @@ Index: gdb-7.7.1/gdb/value.c const struct value *val, LONGEST *result) { gdb_assert (val != NULL); -@@ -3216,7 +3219,7 @@ unpack_field_as_long (struct type *type, +@@ -3222,7 +3225,7 @@ unpack_field_as_long (struct type *type, struct value * value_field_bitfield (struct type *type, int fieldno, const gdb_byte *valaddr, @@ -4217,7 +4200,7 @@ Index: gdb-7.7.1/gdb/value.c { LONGEST l; -@@ -3243,12 +3246,12 @@ value_field_bitfield (struct type *type, +@@ -3249,12 +3252,12 @@ value_field_bitfield (struct type *type, void modify_field (struct type *type, gdb_byte *addr, @@ -4232,11 +4215,11 @@ Index: gdb-7.7.1/gdb/value.c /* Normalize BITPOS. */ addr += bitpos / 8; -Index: gdb-7.7.1/gdb/value.h +Index: gdb-7.7.90.20140613/gdb/value.h =================================================================== ---- gdb-7.7.1.orig/gdb/value.h 2014-05-12 20:22:04.793443514 +0200 -+++ gdb-7.7.1/gdb/value.h 2014-05-12 20:22:05.809444123 +0200 -@@ -82,8 +82,8 @@ extern void set_value_parent (struct val +--- gdb-7.7.90.20140613.orig/gdb/value.h 2014-06-16 23:27:05.172747063 +0200 ++++ gdb-7.7.90.20140613/gdb/value.h 2014-06-16 23:27:07.880749619 +0200 +@@ -83,8 +83,8 @@ extern void set_value_parent (struct val within the registers structure. Note also the member embedded_offset below. */ @@ -4247,7 +4230,7 @@ Index: gdb-7.7.1/gdb/value.h /* The comment from "struct value" reads: ``Is it modifiable? Only relevant if lval != not_lval.''. Shouldn't the value instead be -@@ -152,10 +152,10 @@ extern struct type *value_actual_type (s +@@ -153,10 +153,10 @@ extern struct type *value_actual_type (s int resolve_simple_types, int *real_type_found); @@ -4262,7 +4245,7 @@ Index: gdb-7.7.1/gdb/value.h /* For lval_computed values, this structure holds functions used to retrieve and set the value (or portions of the value). -@@ -183,7 +183,8 @@ struct lval_funcs +@@ -184,7 +184,8 @@ struct lval_funcs /* Check the validity of some bits in VALUE. This should return 1 if all the bits starting at OFFSET and extending for LENGTH bits are valid, or 0 if any bit is invalid. */ @@ -4272,7 +4255,7 @@ Index: gdb-7.7.1/gdb/value.h /* Return 1 if any bit in VALUE is valid, 0 if they are all invalid. */ int (*check_any_valid) (const struct value *value); -@@ -201,7 +202,7 @@ struct lval_funcs +@@ -202,7 +203,7 @@ struct lval_funcs /* If non-NULL, this is used to determine whether the indicated bits of VALUE are a synthetic pointer. */ int (*check_synthetic_pointer) (const struct value *value, @@ -4281,7 +4264,7 @@ Index: gdb-7.7.1/gdb/value.h /* Return a duplicate of VALUE's closure, for use in a new value. This may simply return the same closure, if VALUE's is -@@ -238,7 +239,7 @@ extern struct value *allocate_computed_v +@@ -239,7 +240,7 @@ extern struct value *allocate_computed_v Otherwise, return 1. */ extern int valprint_check_validity (struct ui_file *stream, struct type *type, @@ -4290,7 +4273,7 @@ Index: gdb-7.7.1/gdb/value.h const struct value *val); extern struct value *allocate_optimized_out_value (struct type *type); -@@ -420,13 +421,13 @@ extern struct value *coerce_array (struc +@@ -421,13 +422,13 @@ extern struct value *coerce_array (struc bits in the given range are valid, zero if any bit is invalid. */ extern int value_bits_valid (const struct value *value, @@ -4306,7 +4289,7 @@ Index: gdb-7.7.1/gdb/value.h /* Given a value, determine whether the contents bytes starting at OFFSET and extending for LENGTH bytes are available. This returns -@@ -434,7 +435,7 @@ extern int value_bits_synthetic_pointer +@@ -435,7 +436,7 @@ extern int value_bits_synthetic_pointer byte is unavailable. */ extern int value_bytes_available (const struct value *value, @@ -4315,7 +4298,7 @@ Index: gdb-7.7.1/gdb/value.h /* Given a value, determine whether the contents bits starting at OFFSET and extending for LENGTH bits are available. This returns -@@ -456,7 +457,7 @@ extern int value_entirely_unavailable (s +@@ -457,7 +458,7 @@ extern int value_entirely_unavailable (s LENGTH bytes as unavailable. */ extern void mark_value_bytes_unavailable (struct value *value, @@ -4324,7 +4307,7 @@ Index: gdb-7.7.1/gdb/value.h /* Mark VALUE's content bits starting at OFFSET and extending for LENGTH bits as unavailable. */ -@@ -472,7 +473,7 @@ extern void mark_value_bits_unavailable +@@ -473,7 +474,7 @@ extern void mark_value_bits_unavailable example, to compare a complete object value with itself, including its enclosing type chunk, you'd do: @@ -4333,7 +4316,7 @@ Index: gdb-7.7.1/gdb/value.h value_available_contents (val, 0, val, 0, len); Returns true iff the set of available contents match. Unavailable -@@ -499,9 +500,9 @@ extern void mark_value_bits_unavailable +@@ -500,9 +501,9 @@ extern void mark_value_bits_unavailable gone, it works with const values. Therefore, this routine must not be called with lazy values. */ @@ -4346,7 +4329,7 @@ Index: gdb-7.7.1/gdb/value.h /* Read LENGTH bytes of memory starting at MEMADDR into BUFFER, which is (or will be copied to) VAL's contents buffer offset by -@@ -510,7 +511,7 @@ extern int value_available_contents_eq ( +@@ -511,7 +512,7 @@ extern int value_available_contents_eq ( memory is likewise unavailable. STACK indicates whether the memory is known to be stack memory. */ @@ -4355,7 +4338,7 @@ Index: gdb-7.7.1/gdb/value.h int stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length); -@@ -544,7 +545,7 @@ extern CORE_ADDR unpack_pointer (struct +@@ -545,7 +546,7 @@ extern CORE_ADDR unpack_pointer (struct extern int unpack_value_bits_as_long (struct type *field_type, const gdb_byte *valaddr, @@ -4364,7 +4347,7 @@ Index: gdb-7.7.1/gdb/value.h int bitsize, const struct value *original_value, LONGEST *result); -@@ -553,12 +554,12 @@ extern LONGEST unpack_field_as_long (str +@@ -554,12 +555,12 @@ extern LONGEST unpack_field_as_long (str const gdb_byte *valaddr, int fieldno); extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, @@ -4469,16 +4452,55 @@ Index: gdb-7.7.1/gdb/value.h /* User function handler. */ -Index: gdb-7.7.1/gdb/s390-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/s390-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/s390-linux-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/s390-linux-nat.c 2014-05-12 20:22:48.767470010 +0200 -@@ -563,7 +563,7 @@ s390_can_use_hw_breakpoint (int type, in - } +--- gdb-7.7.90.20140613.orig/gdb/s390-linux-nat.c 2014-06-16 23:27:05.172747063 +0200 ++++ gdb-7.7.90.20140613/gdb/s390-linux-nat.c 2014-06-16 23:27:07.881749620 +0200 +@@ -567,7 +567,7 @@ s390_can_use_hw_breakpoint (struct targe static int --s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt) -+s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST cnt) + s390_region_ok_for_hw_watchpoint (struct target_ops *self, +- CORE_ADDR addr, int cnt) ++ CORE_ADDR addr, LONGEST cnt) { return 1; } +Index: gdb-7.7.90.20140613/gdb/extension-priv.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/extension-priv.h 2014-06-16 23:27:05.172747063 +0200 ++++ gdb-7.7.90.20140613/gdb/extension-priv.h 2014-06-16 23:27:07.881749620 +0200 +@@ -175,7 +175,7 @@ struct extension_language_ops + enum ext_lang_rc (*apply_val_pretty_printer) + (const struct extension_language_defn *, + struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, const struct value_print_options *options, + const struct language_defn *language); +Index: gdb-7.7.90.20140613/gdb/python/python-internal.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/python/python-internal.h 2014-06-16 23:27:05.172747063 +0200 ++++ gdb-7.7.90.20140613/gdb/python/python-internal.h 2014-06-16 23:27:07.881749620 +0200 +@@ -317,7 +317,7 @@ extern int gdbpy_auto_load_enabled (cons + extern enum ext_lang_rc gdbpy_apply_val_pretty_printer + (const struct extension_language_defn *, + struct type *type, const gdb_byte *valaddr, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +Index: gdb-7.7.90.20140613/gdb/target-delegates.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/target-delegates.c 2014-06-16 23:27:05.173747064 +0200 ++++ gdb-7.7.90.20140613/gdb/target-delegates.c 2014-06-16 23:27:07.881749620 +0200 +@@ -268,7 +268,7 @@ delegate_watchpoint_addr_within_range (s + } + + static int +-delegate_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, int arg2) ++delegate_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR arg1, LONGEST arg2) + { + self = self->beneath; + return self->to_region_ok_for_hw_watchpoint (self, arg1, arg2); diff --git a/gdb-rhbz795424-bitpos-21of25.patch b/gdb-rhbz795424-bitpos-21of25.patch index 7d0b6fe..9ca0010 100644 --- a/gdb-rhbz795424-bitpos-21of25.patch +++ b/gdb-rhbz795424-bitpos-21of25.patch @@ -52,10 +52,10 @@ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch -Index: gdb-7.6.90.20140127/gdb/alpha-tdep.c +Index: gdb-7.7.90.20140613/gdb/alpha-tdep.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/alpha-tdep.c 2014-02-06 18:18:51.005616676 +0100 -+++ gdb-7.6.90.20140127/gdb/alpha-tdep.c 2014-02-06 18:18:53.671621349 +0100 +--- gdb-7.7.90.20140613.orig/gdb/alpha-tdep.c 2014-06-13 22:14:49.725846383 +0200 ++++ gdb-7.7.90.20140613/gdb/alpha-tdep.c 2014-06-13 22:14:53.163850081 +0200 @@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *g accumulate_size = 0; else @@ -70,11 +70,11 @@ Index: gdb-7.6.90.20140127/gdb/alpha-tdep.c sp -= accumulate_size; /* Keep sp aligned to a multiple of 16 as the ABI requires. */ -Index: gdb-7.6.90.20140127/gdb/cp-valprint.c +Index: gdb-7.7.90.20140613/gdb/cp-valprint.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/cp-valprint.c 2014-02-06 18:18:51.006616677 +0100 -+++ gdb-7.6.90.20140127/gdb/cp-valprint.c 2014-02-06 18:18:53.671621349 +0100 -@@ -537,6 +537,8 @@ cp_print_value (struct type *type, struc +--- gdb-7.7.90.20140613.orig/gdb/cp-valprint.c 2014-06-13 22:14:49.725846383 +0200 ++++ gdb-7.7.90.20140613/gdb/cp-valprint.c 2014-06-13 22:14:53.164850081 +0200 +@@ -538,6 +538,8 @@ cp_print_value (struct type *type, struc gdb_byte *buf; struct cleanup *back_to; @@ -83,11 +83,11 @@ Index: gdb-7.6.90.20140127/gdb/cp-valprint.c buf = xmalloc (TYPE_LENGTH (baseclass)); back_to = make_cleanup (xfree, buf); -Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/dwarf2loc.c 2014-02-06 18:18:51.007616678 +0100 -+++ gdb-7.6.90.20140127/gdb/dwarf2loc.c 2014-02-06 18:18:53.672621293 +0100 -@@ -1821,6 +1821,8 @@ read_pieced_value (struct value *v) +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-13 22:14:49.726846384 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-13 22:14:53.166850084 +0200 +@@ -1666,6 +1666,8 @@ read_pieced_value (struct value *v) this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8; source_offset = source_offset_bits / 8; @@ -96,7 +96,7 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c if (buffer_size < this_size) { buffer_size = this_size; -@@ -2012,6 +2014,7 @@ write_pieced_value (struct value *to, st +@@ -1857,6 +1859,7 @@ write_pieced_value (struct value *to, st } else { @@ -104,10 +104,10 @@ Index: gdb-7.6.90.20140127/gdb/dwarf2loc.c if (buffer_size < this_size) { buffer_size = this_size; -Index: gdb-7.6.90.20140127/gdb/findcmd.c +Index: gdb-7.7.90.20140613/gdb/findcmd.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/findcmd.c 2014-02-06 18:18:51.008616679 +0100 -+++ gdb-7.6.90.20140127/gdb/findcmd.c 2014-02-06 18:18:53.673621239 +0100 +--- gdb-7.7.90.20140613.orig/gdb/findcmd.c 2014-06-13 22:14:49.726846384 +0200 ++++ gdb-7.7.90.20140613/gdb/findcmd.c 2014-06-13 22:14:53.166850084 +0200 @@ -185,6 +185,7 @@ parse_find_args (char *args, ULONGEST *m size_t current_offset = pattern_buf_end - pattern_buf; @@ -116,11 +116,11 @@ Index: gdb-7.6.90.20140127/gdb/findcmd.c pattern_buf = xrealloc (pattern_buf, pattern_buf_size); pattern_buf_end = pattern_buf + current_offset; } -Index: gdb-7.6.90.20140127/gdb/p-valprint.c +Index: gdb-7.7.90.20140613/gdb/p-valprint.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/p-valprint.c 2014-02-06 18:18:51.008616679 +0100 -+++ gdb-7.6.90.20140127/gdb/p-valprint.c 2014-02-06 18:18:53.673621239 +0100 -@@ -798,6 +798,7 @@ pascal_object_print_value (struct type * +--- gdb-7.7.90.20140613.orig/gdb/p-valprint.c 2014-06-13 22:14:49.728846387 +0200 ++++ gdb-7.7.90.20140613/gdb/p-valprint.c 2014-06-13 22:14:53.166850084 +0200 +@@ -772,6 +772,7 @@ pascal_object_print_value (struct type * gdb_byte *buf; struct cleanup *back_to; @@ -128,12 +128,12 @@ Index: gdb-7.6.90.20140127/gdb/p-valprint.c buf = xmalloc (TYPE_LENGTH (baseclass)); back_to = make_cleanup (xfree, buf); -Index: gdb-7.6.90.20140127/gdb/utils.c +Index: gdb-7.7.90.20140613/gdb/utils.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/utils.c 2014-02-06 18:18:51.008616679 +0100 -+++ gdb-7.6.90.20140127/gdb/utils.c 2014-02-06 18:18:53.674621186 +0100 -@@ -3169,6 +3169,18 @@ host_address_to_string (const void *addr - return str; +--- gdb-7.7.90.20140613.orig/gdb/utils.c 2014-06-13 22:14:53.166850084 +0200 ++++ gdb-7.7.90.20140613/gdb/utils.c 2014-06-13 22:15:16.839875341 +0200 +@@ -2838,6 +2838,18 @@ string_to_core_addr (const char *my_stri + return addr; } +/* Ensure that the input NUM is not larger than the maximum capacity of the @@ -151,11 +151,11 @@ Index: gdb-7.6.90.20140127/gdb/utils.c char * gdb_realpath (const char *filename) { -Index: gdb-7.6.90.20140127/gdb/valops.c +Index: gdb-7.7.90.20140613/gdb/valops.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/valops.c 2014-02-06 18:18:51.009616680 +0100 -+++ gdb-7.6.90.20140127/gdb/valops.c 2014-02-06 18:18:53.675621135 +0100 -@@ -2184,6 +2184,7 @@ search_struct_method (const char *name, +--- gdb-7.7.90.20140613.orig/gdb/valops.c 2014-06-13 22:14:49.730846389 +0200 ++++ gdb-7.7.90.20140613/gdb/valops.c 2014-06-13 22:14:53.169850088 +0200 +@@ -2074,6 +2074,7 @@ search_struct_method (const char *name, struct cleanup *back_to; CORE_ADDR address; @@ -163,11 +163,11 @@ Index: gdb-7.6.90.20140127/gdb/valops.c tmp = xmalloc (TYPE_LENGTH (baseclass)); back_to = make_cleanup (xfree, tmp); address = value_address (*arg1p); -Index: gdb-7.6.90.20140127/gdb/value.c +Index: gdb-7.7.90.20140613/gdb/value.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/value.c 2014-02-06 18:18:51.010616681 +0100 -+++ gdb-7.6.90.20140127/gdb/value.c 2014-02-06 18:19:10.261637398 +0100 -@@ -822,6 +822,7 @@ allocate_value_lazy (struct type *type) +--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-13 22:14:49.732846391 +0200 ++++ gdb-7.7.90.20140613/gdb/value.c 2014-06-13 22:14:53.169850088 +0200 +@@ -824,6 +824,7 @@ allocate_value_lazy (struct type *type) description correctly. */ check_typedef (type); @@ -175,7 +175,7 @@ Index: gdb-7.6.90.20140127/gdb/value.c val = (struct value *) xzalloc (sizeof (struct value)); val->contents = NULL; val->next = all_values; -@@ -853,6 +854,8 @@ allocate_value_lazy (struct type *type) +@@ -855,6 +856,8 @@ allocate_value_lazy (struct type *type) static void allocate_value_contents (struct value *val) { @@ -184,7 +184,7 @@ Index: gdb-7.6.90.20140127/gdb/value.c if (!val->contents) val->contents = (gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type)); } -@@ -2854,8 +2857,12 @@ void +@@ -2831,8 +2834,12 @@ void set_value_enclosing_type (struct value *val, struct type *new_encl_type) { if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val))) @@ -199,10 +199,10 @@ Index: gdb-7.6.90.20140127/gdb/value.c val->enclosing_type = new_encl_type; } -Index: gdb-7.6.90.20140127/gdb/vax-tdep.c +Index: gdb-7.7.90.20140613/gdb/vax-tdep.c =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/vax-tdep.c 2014-02-06 18:18:51.370617068 +0100 -+++ gdb-7.6.90.20140127/gdb/vax-tdep.c 2014-02-06 18:18:53.676621086 +0100 +--- gdb-7.7.90.20140613.orig/gdb/vax-tdep.c 2014-06-13 22:14:49.732846391 +0200 ++++ gdb-7.7.90.20140613/gdb/vax-tdep.c 2014-06-13 22:14:53.169850088 +0200 @@ -223,6 +223,7 @@ vax_return_value (struct gdbarch *gdbarc ULONGEST addr; @@ -211,11 +211,11 @@ Index: gdb-7.6.90.20140127/gdb/vax-tdep.c read_memory (addr, readbuf, len); } -Index: gdb-7.6.90.20140127/gdb/defs.h +Index: gdb-7.7.90.20140613/gdb/defs.h =================================================================== ---- gdb-7.6.90.20140127.orig/gdb/defs.h 2014-02-06 18:18:51.370617068 +0100 -+++ gdb-7.6.90.20140127/gdb/defs.h 2014-02-06 18:18:53.677621038 +0100 -@@ -768,4 +768,6 @@ enum block_enum +--- gdb-7.7.90.20140613.orig/gdb/defs.h 2014-06-13 22:14:49.732846391 +0200 ++++ gdb-7.7.90.20140613/gdb/defs.h 2014-06-13 22:14:53.169850088 +0200 +@@ -756,4 +756,6 @@ enum block_enum #include "utils.h" diff --git a/gdb-rhbz795424-bitpos-22of25.patch b/gdb-rhbz795424-bitpos-22of25.patch index 8863b42..0f23895 100644 --- a/gdb-rhbz795424-bitpos-22of25.patch +++ b/gdb-rhbz795424-bitpos-22of25.patch @@ -96,29 +96,11 @@ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=bitpos-wp.patch -Index: gdb-7.7.1/gdb/arm-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/arm-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/arm-linux-nat.c 2014-05-30 23:24:14.728103476 +0200 -+++ gdb-7.7.1/gdb/arm-linux-nat.c 2014-05-30 23:24:14.783103499 +0200 -@@ -1105,7 +1105,7 @@ arm_linux_region_ok_for_hw_watchpoint (C - - /* Insert a Hardware breakpoint. */ - static int --arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, -+arm_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - struct lwp_info *lp; -@@ -1123,7 +1123,7 @@ arm_linux_insert_watchpoint (CORE_ADDR a - - /* Remove a hardware breakpoint. */ - static int --arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, -+arm_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - struct lwp_info *lp; -@@ -1180,7 +1180,7 @@ arm_linux_stopped_by_watchpoint (void) +--- gdb-7.7.90.20140613.orig/gdb/arm-linux-nat.c 2014-06-13 22:23:09.630440699 +0200 ++++ gdb-7.7.90.20140613/gdb/arm-linux-nat.c 2014-06-13 22:23:54.666492199 +0200 +@@ -1296,7 +1296,7 @@ arm_linux_stopped_by_watchpoint (struct static int arm_linux_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -127,151 +109,11 @@ Index: gdb-7.7.1/gdb/arm-linux-nat.c { return start <= addr && start + length - 1 >= addr; } -Index: gdb-7.7.1/gdb/i386-nat.c +Index: gdb-7.7.90.20140613/gdb/ppc-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/i386-nat.c 2014-05-30 23:24:14.742103482 +0200 -+++ gdb-7.7.1/gdb/i386-nat.c 2014-05-30 23:24:14.783103499 +0200 -@@ -589,7 +589,7 @@ i386_update_inferior_debug_regs (struct - of the type TYPE. Return 0 on success, -1 on failure. */ - - static int --i386_insert_watchpoint (CORE_ADDR addr, int len, int type, -+i386_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct i386_debug_reg_state *state -@@ -627,7 +627,7 @@ i386_insert_watchpoint (CORE_ADDR addr, - address ADDR, whose length is LEN bytes, and for accesses of the - type TYPE. Return 0 on success, -1 on failure. */ - static int --i386_remove_watchpoint (CORE_ADDR addr, int len, int type, -+i386_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct i386_debug_reg_state *state -Index: gdb-7.7.1/gdb/ia64-linux-nat.c -=================================================================== ---- gdb-7.7.1.orig/gdb/ia64-linux-nat.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/ia64-linux-nat.c 2014-05-30 23:24:14.784103500 +0200 -@@ -542,7 +542,7 @@ is_power_of_2 (int val) - } - - static int --ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, -+ia64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - struct lwp_info *lp; -@@ -596,7 +596,7 @@ ia64_linux_insert_watchpoint (CORE_ADDR - } - - static int --ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, -+ia64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int idx; -Index: gdb-7.7.1/gdb/inf-ttrace.c -=================================================================== ---- gdb-7.7.1.orig/gdb/inf-ttrace.c 2014-05-30 23:24:14.742103482 +0200 -+++ gdb-7.7.1/gdb/inf-ttrace.c 2014-05-30 23:24:14.784103500 +0200 -@@ -314,14 +314,14 @@ inf_ttrace_disable_page_protections (pid - type TYPE. */ - - static int --inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, -+inf_ttrace_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - const int pagesize = inf_ttrace_page_dict.pagesize; - pid_t pid = ptid_get_pid (inferior_ptid); - CORE_ADDR page_addr; -- int num_pages; -- int page; -+ LONGEST num_pages; -+ LONGEST page; - - gdb_assert (type == hw_write); - -@@ -338,14 +338,14 @@ inf_ttrace_insert_watchpoint (CORE_ADDR - type TYPE. */ - - static int --inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, -+inf_ttrace_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - const int pagesize = inf_ttrace_page_dict.pagesize; - pid_t pid = ptid_get_pid (inferior_ptid); - CORE_ADDR page_addr; -- int num_pages; -- int page; -+ LONGEST num_pages; -+ LONGEST page; - - gdb_assert (type == hw_write); - -Index: gdb-7.7.1/gdb/mips-linux-nat.c -=================================================================== ---- gdb-7.7.1.orig/gdb/mips-linux-nat.c 2014-05-30 23:24:14.744103483 +0200 -+++ gdb-7.7.1/gdb/mips-linux-nat.c 2014-05-30 23:24:14.784103500 +0200 -@@ -644,7 +644,7 @@ mips_linux_new_thread (struct lwp_info * - watch. Return zero on success. */ - - static int --mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, -+mips_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct pt_watch_regs regs; -@@ -697,7 +697,7 @@ mips_linux_insert_watchpoint (CORE_ADDR - Return zero on success. */ - - static int --mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, -+mips_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int retval; -Index: gdb-7.7.1/gdb/nto-procfs.c -=================================================================== ---- gdb-7.7.1.orig/gdb/nto-procfs.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/nto-procfs.c 2014-05-30 23:24:14.785103500 +0200 -@@ -69,10 +69,10 @@ static ptid_t do_attach (ptid_t ptid); - - static int procfs_can_use_hw_breakpoint (int, int, int); - --static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, -+static int procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond); - --static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, -+static int procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond); - - static int procfs_stopped_by_watchpoint (void); -@@ -1494,14 +1494,14 @@ procfs_can_use_hw_breakpoint (int type, - } - - static int --procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, -+procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - return procfs_hw_watchpoint (addr, -1, type); - } - - static int --procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, -+procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - return procfs_hw_watchpoint (addr, len, type); -Index: gdb-7.7.1/gdb/ppc-linux-nat.c -=================================================================== ---- gdb-7.7.1.orig/gdb/ppc-linux-nat.c 2014-05-30 23:24:14.745103483 +0200 -+++ gdb-7.7.1/gdb/ppc-linux-nat.c 2014-05-30 23:24:14.786103501 +0200 -@@ -1853,11 +1853,11 @@ can_use_watchpoint_cond_accel (void) +--- gdb-7.7.90.20140613.orig/gdb/ppc-linux-nat.c 2014-06-13 22:23:09.635440704 +0200 ++++ gdb-7.7.90.20140613/gdb/ppc-linux-nat.c 2014-06-13 22:23:54.672492206 +0200 +@@ -1857,11 +1857,11 @@ can_use_watchpoint_cond_accel (void) CONDITION_VALUE will hold the value which should be put in the DVC register. */ static void @@ -286,7 +128,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c CORE_ADDR addr_end_data, addr_end_dvc; /* The DVC register compares bytes within fixed-length windows which -@@ -1944,7 +1944,7 @@ num_memory_accesses (struct value *v) +@@ -1948,7 +1948,7 @@ num_memory_accesses (struct value *v) of the constant. */ static int check_condition (CORE_ADDR watch_addr, struct expression *cond, @@ -295,16 +137,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c { int pc = 1, num_accesses_left, num_accesses_right; struct value *left_val, *right_val, *left_chain, *right_chain; -@@ -2011,7 +2011,7 @@ check_condition (CORE_ADDR watch_addr, s - the condition expression, thus only triggering the watchpoint when it is - true. */ - static int --ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, -+ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - CORE_ADDR data_value; -@@ -2028,7 +2028,7 @@ ppc_linux_can_accel_watchpoint_condition +@@ -2033,7 +2033,7 @@ ppc_linux_can_accel_watchpoint_condition static void create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, @@ -313,25 +146,7 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c int insert) { if (len == 1 -@@ -2073,7 +2073,7 @@ create_watchpoint_request (struct ppc_hw - } - - static int --ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, -+ppc_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - struct lwp_info *lp; -@@ -2141,7 +2141,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR a - } - - static int --ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, -+ppc_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - struct lwp_info *lp; -@@ -2292,7 +2292,7 @@ ppc_linux_stopped_by_watchpoint (void) +@@ -2299,7 +2299,7 @@ ppc_linux_stopped_by_watchpoint (struct static int ppc_linux_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -340,11 +155,11 @@ Index: gdb-7.7.1/gdb/ppc-linux-nat.c { int mask; -Index: gdb-7.7.1/gdb/procfs.c +Index: gdb-7.7.90.20140613/gdb/procfs.c =================================================================== ---- gdb-7.7.1.orig/gdb/procfs.c 2014-05-30 23:24:14.746103484 +0200 -+++ gdb-7.7.1/gdb/procfs.c 2014-05-30 23:24:14.787103501 +0200 -@@ -2428,7 +2428,7 @@ procfs_address_to_host_pointer (CORE_ADD +--- gdb-7.7.90.20140613.orig/gdb/procfs.c 2014-06-13 22:23:09.638440708 +0200 ++++ gdb-7.7.90.20140613/gdb/procfs.c 2014-06-13 22:23:54.673492207 +0200 +@@ -2429,7 +2429,7 @@ procfs_address_to_host_pointer (CORE_ADD #endif static int @@ -353,7 +168,7 @@ Index: gdb-7.7.1/gdb/procfs.c { #if !defined (PCWATCH) && !defined (PIOCSWATCH) /* If neither or these is defined, we can't support watchpoints. -@@ -4774,7 +4774,7 @@ procfs_pid_to_str (struct target_ops *op +@@ -4762,7 +4762,7 @@ procfs_pid_to_str (struct target_ops *op /* Insert a watchpoint. */ static int @@ -362,102 +177,11 @@ Index: gdb-7.7.1/gdb/procfs.c int after) { #ifndef AIX5 -@@ -4895,7 +4895,7 @@ procfs_stopped_data_address (struct targ - } - - static int --procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, -+procfs_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - if (!target_have_steppable_watchpoint -@@ -4917,7 +4917,7 @@ procfs_insert_watchpoint (CORE_ADDR addr - } - - static int --procfs_remove_watchpoint (CORE_ADDR addr, int len, int type, -+procfs_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); -Index: gdb-7.7.1/gdb/remote-m32r-sdi.c +Index: gdb-7.7.90.20140613/gdb/remote.c =================================================================== ---- gdb-7.7.1.orig/gdb/remote-m32r-sdi.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/remote-m32r-sdi.c 2014-05-30 23:24:14.788103502 +0200 -@@ -1415,14 +1415,15 @@ m32r_can_use_hw_watchpoint (int type, in - watchpoint. */ - - static int --m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, -+m32r_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int i; - - if (remote_debug) -- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n", -- paddress (target_gdbarch (), addr), len, type); -+ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%s,%d)\n", -+ paddress (target_gdbarch (), addr), plongest (len), -+ type); - - for (i = 0; i < MAX_ACCESS_BREAKS; i++) - { -@@ -1440,14 +1441,15 @@ m32r_insert_watchpoint (CORE_ADDR addr, - } - - static int --m32r_remove_watchpoint (CORE_ADDR addr, int len, int type, -+m32r_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int i; - - if (remote_debug) -- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n", -- paddress (target_gdbarch (), addr), len, type); -+ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%s,%d)\n", -+ paddress (target_gdbarch (), addr), plongest (len), -+ type); - - for (i = 0; i < MAX_ACCESS_BREAKS; i++) - { -Index: gdb-7.7.1/gdb/remote-mips.c -=================================================================== ---- gdb-7.7.1.orig/gdb/remote-mips.c 2014-05-05 23:51:24.000000000 +0200 -+++ gdb-7.7.1/gdb/remote-mips.c 2014-05-30 23:24:14.789103502 +0200 -@@ -2424,7 +2424,7 @@ calculate_mask (CORE_ADDR addr, int len) - watchpoint. */ - - static int --mips_insert_watchpoint (CORE_ADDR addr, int len, int type, -+mips_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - if (mips_set_breakpoint (addr, len, type)) -@@ -2436,7 +2436,7 @@ mips_insert_watchpoint (CORE_ADDR addr, - /* Remove a watchpoint. */ - - static int --mips_remove_watchpoint (CORE_ADDR addr, int len, int type, -+mips_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - if (mips_clear_breakpoint (addr, len, type)) -Index: gdb-7.7.1/gdb/remote.c -=================================================================== ---- gdb-7.7.1.orig/gdb/remote.c 2014-05-30 23:24:14.748103484 +0200 -+++ gdb-7.7.1/gdb/remote.c 2014-05-30 23:24:14.791103503 +0200 -@@ -8322,7 +8322,7 @@ watchpoint_to_Z_packet (int type) - } - - static int --remote_insert_watchpoint (CORE_ADDR addr, int len, int type, -+remote_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct remote_state *rs = get_remote_state (); -@@ -8342,7 +8342,7 @@ remote_insert_watchpoint (CORE_ADDR addr +--- gdb-7.7.90.20140613.orig/gdb/remote.c 2014-06-13 22:23:09.643440713 +0200 ++++ gdb-7.7.90.20140613/gdb/remote.c 2014-06-13 22:23:54.680492215 +0200 +@@ -8199,7 +8199,7 @@ remote_insert_watchpoint (struct target_ p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); @@ -466,7 +190,7 @@ Index: gdb-7.7.1/gdb/remote.c putpkt (rs->buf); getpkt (&rs->buf, &rs->buf_size, 0); -@@ -8362,7 +8362,7 @@ remote_insert_watchpoint (CORE_ADDR addr +@@ -8219,7 +8219,7 @@ remote_insert_watchpoint (struct target_ static int remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -475,16 +199,7 @@ Index: gdb-7.7.1/gdb/remote.c { CORE_ADDR diff = remote_address_masked (addr - start); -@@ -8371,7 +8371,7 @@ remote_watchpoint_addr_within_range (str - - - static int --remote_remove_watchpoint (CORE_ADDR addr, int len, int type, -+remote_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct remote_state *rs = get_remote_state (); -@@ -8391,7 +8391,7 @@ remote_remove_watchpoint (CORE_ADDR addr +@@ -8249,7 +8249,7 @@ remote_remove_watchpoint (struct target_ p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); @@ -493,92 +208,29 @@ Index: gdb-7.7.1/gdb/remote.c putpkt (rs->buf); getpkt (&rs->buf, &rs->buf_size, 0); -Index: gdb-7.7.1/gdb/s390-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/target.c =================================================================== ---- gdb-7.7.1.orig/gdb/s390-linux-nat.c 2014-05-30 23:24:14.754103487 +0200 -+++ gdb-7.7.1/gdb/s390-linux-nat.c 2014-05-30 23:24:14.791103503 +0200 -@@ -508,7 +508,7 @@ s390_fix_watch_points (struct lwp_info * - } - - static int --s390_insert_watchpoint (CORE_ADDR addr, int len, int type, -+s390_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct lwp_info *lp; -@@ -529,7 +529,7 @@ s390_insert_watchpoint (CORE_ADDR addr, - } - - static int --s390_remove_watchpoint (CORE_ADDR addr, int len, int type, -+s390_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - struct lwp_info *lp; -Index: gdb-7.7.1/gdb/target.c -=================================================================== ---- gdb-7.7.1.orig/gdb/target.c 2014-05-30 23:24:14.750103485 +0200 -+++ gdb-7.7.1/gdb/target.c 2014-05-30 23:24:14.792103503 +0200 -@@ -50,7 +50,7 @@ static void target_info (char *, int); - static void default_terminal_info (const char *, int); +--- gdb-7.7.90.20140613.orig/gdb/target.c 2014-06-13 22:23:09.645440716 +0200 ++++ gdb-7.7.90.20140613/gdb/target.c 2014-06-13 22:26:24.077661601 +0200 +@@ -52,7 +52,7 @@ static void target_info (char *, int); + static void default_terminal_info (struct target_ops *, const char *, int); static int default_watchpoint_addr_within_range (struct target_ops *, - CORE_ADDR, CORE_ADDR, int); + CORE_ADDR, CORE_ADDR, LONGEST); - static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); - -@@ -103,10 +103,10 @@ static int debug_to_insert_hw_breakpoint - static int debug_to_remove_hw_breakpoint (struct gdbarch *, - struct bp_target_info *); - --static int debug_to_insert_watchpoint (CORE_ADDR, int, int, -+static int debug_to_insert_watchpoint (CORE_ADDR, LONGEST, int, - struct expression *); - --static int debug_to_remove_watchpoint (CORE_ADDR, int, int, -+static int debug_to_remove_watchpoint (CORE_ADDR, LONGEST, int, - struct expression *); - - static int debug_to_stopped_by_watchpoint (void); -@@ -114,11 +114,12 @@ static int debug_to_stopped_by_watchpoin + static int default_region_ok_for_hw_watchpoint (struct target_ops *, + CORE_ADDR, LONGEST); +@@ -150,7 +150,7 @@ static int debug_to_remove_watchpoint (s static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); static int debug_to_watchpoint_addr_within_range (struct target_ops *, - CORE_ADDR, CORE_ADDR, int); -+ CORE_ADDR, CORE_ADDR, -+ LONGEST); ++ CORE_ADDR, CORE_ADDR, LONGEST); - static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); - --static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, -+static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, - struct expression *); - - static void debug_to_terminal_init (void); -@@ -739,10 +740,10 @@ update_current_target (void) - (int (*) (struct gdbarch *, struct bp_target_info *)) - return_minus_one); - de_fault (to_insert_watchpoint, -- (int (*) (CORE_ADDR, int, int, struct expression *)) -+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) - return_minus_one); - de_fault (to_remove_watchpoint, -- (int (*) (CORE_ADDR, int, int, struct expression *)) -+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) - return_minus_one); - de_fault (to_stopped_by_watchpoint, - (int (*) (void)) -@@ -755,7 +756,7 @@ update_current_target (void) - de_fault (to_region_ok_for_hw_watchpoint, - default_region_ok_for_hw_watchpoint); - de_fault (to_can_accel_watchpoint_condition, -- (int (*) (CORE_ADDR, int, int, struct expression *)) -+ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) - return_zero); - de_fault (to_terminal_init, - (void (*) (void)) -@@ -3598,7 +3599,7 @@ default_region_ok_for_hw_watchpoint (COR + static int debug_to_region_ok_for_hw_watchpoint (struct target_ops *self, + CORE_ADDR, LONGEST); +@@ -2959,7 +2959,7 @@ default_region_ok_for_hw_watchpoint (str static int default_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -587,16 +239,7 @@ Index: gdb-7.7.1/gdb/target.c { return addr >= start && addr < start + length; } -@@ -4571,7 +4572,7 @@ debug_to_region_ok_for_hw_watchpoint (CO - } - - static int --debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, -+debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, - struct expression *cond) - { - int retval; -@@ -4581,8 +4582,8 @@ debug_to_can_accel_watchpoint_condition +@@ -3691,8 +3691,8 @@ debug_to_can_accel_watchpoint_condition fprintf_unfiltered (gdb_stdlog, "target_can_accel_watchpoint_condition " @@ -607,7 +250,7 @@ Index: gdb-7.7.1/gdb/target.c host_address_to_string (cond), (unsigned long) retval); return retval; } -@@ -4617,7 +4618,7 @@ debug_to_stopped_data_address (struct ta +@@ -3727,7 +3727,7 @@ debug_to_stopped_data_address (struct ta static int debug_to_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -616,7 +259,7 @@ Index: gdb-7.7.1/gdb/target.c { int retval; -@@ -4625,9 +4626,9 @@ debug_to_watchpoint_addr_within_range (s +@@ -3735,9 +3735,9 @@ debug_to_watchpoint_addr_within_range (s start, length); fprintf_filtered (gdb_stdlog, @@ -628,79 +271,23 @@ Index: gdb-7.7.1/gdb/target.c return retval; } -@@ -4662,7 +4663,7 @@ debug_to_remove_hw_breakpoint (struct gd - } - - static int --debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, -+debug_to_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int retval; -@@ -4670,14 +4671,14 @@ debug_to_insert_watchpoint (CORE_ADDR ad - retval = debug_target.to_insert_watchpoint (addr, len, type, cond); - - fprintf_unfiltered (gdb_stdlog, -- "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n", -- core_addr_to_string (addr), len, type, -+ "target_insert_watchpoint (%s, %s, %d, %s) = %ld\n", -+ core_addr_to_string (addr), plongest (len), type, - host_address_to_string (cond), (unsigned long) retval); - return retval; - } - - static int --debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, -+debug_to_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int retval; -@@ -4685,8 +4686,8 @@ debug_to_remove_watchpoint (CORE_ADDR ad - retval = debug_target.to_remove_watchpoint (addr, len, type, cond); - - fprintf_unfiltered (gdb_stdlog, -- "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n", -- core_addr_to_string (addr), len, type, -+ "target_remove_watchpoint (%s, %s, %d, %s) = %ld\n", -+ core_addr_to_string (addr), plongest (len), type, - host_address_to_string (cond), (unsigned long) retval); - return retval; - } -Index: gdb-7.7.1/gdb/target.h +Index: gdb-7.7.90.20140613/gdb/target.h =================================================================== ---- gdb-7.7.1.orig/gdb/target.h 2014-05-30 23:24:14.750103485 +0200 -+++ gdb-7.7.1/gdb/target.h 2014-05-30 23:24:14.793103504 +0200 -@@ -412,8 +412,8 @@ struct target_ops - - /* Documentation of what the two routines below are expected to do is - provided with the corresponding target_* macros. */ -- int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); -- int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); -+ int (*to_remove_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); -+ int (*to_insert_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); - - int (*to_insert_mask_watchpoint) (struct target_ops *, - CORE_ADDR, CORE_ADDR, int); -@@ -424,13 +424,13 @@ struct target_ops - int to_have_continuable_watchpoint; - int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *); +--- gdb-7.7.90.20140613.orig/gdb/target.h 2014-06-13 22:23:54.683492219 +0200 ++++ gdb-7.7.90.20140613/gdb/target.h 2014-06-13 22:25:41.372613039 +0200 +@@ -469,7 +469,7 @@ struct target_ops + int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *) + TARGET_DEFAULT_RETURN (0); int (*to_watchpoint_addr_within_range) (struct target_ops *, -- CORE_ADDR, CORE_ADDR, int); -+ CORE_ADDR, CORE_ADDR, LONGEST); +- CORE_ADDR, CORE_ADDR, int) ++ CORE_ADDR, CORE_ADDR, LONGEST) + TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range); /* Documentation of this routine is provided with the corresponding - target_* macro. */ - int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); - -- int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, -+ int (*to_can_accel_watchpoint_condition) (CORE_ADDR, LONGEST, int, - struct expression *); - int (*to_masked_watch_num_registers) (struct target_ops *, - CORE_ADDR, CORE_ADDR); -Index: gdb-7.7.1/gdb/aarch64-linux-nat.c +Index: gdb-7.7.90.20140613/gdb/aarch64-linux-nat.c =================================================================== ---- gdb-7.7.1.orig/gdb/aarch64-linux-nat.c 2014-05-30 23:30:49.088277930 +0200 -+++ gdb-7.7.1/gdb/aarch64-linux-nat.c 2014-05-30 23:30:56.911280725 +0200 +--- gdb-7.7.90.20140613.orig/gdb/aarch64-linux-nat.c 2014-06-13 22:23:09.647440718 +0200 ++++ gdb-7.7.90.20140613/gdb/aarch64-linux-nat.c 2014-06-13 22:23:54.683492219 +0200 @@ -428,14 +428,14 @@ aarch64_notify_debug_reg_change (const s static void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, @@ -719,7 +306,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c type == hw_write ? "hw-write-watchpoint" : (type == hw_read ? "hw-read-watchpoint" : (type == hw_access ? "hw-access-watchpoint" -@@ -867,9 +867,10 @@ aarch64_linux_read_description (struct t +@@ -869,9 +869,10 @@ aarch64_linux_read_description (struct t gdbserver/linux-aarch64-low.c for more information. */ static void @@ -732,7 +319,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c { int aligned_len; unsigned int offset; -@@ -1035,7 +1036,7 @@ aarch64_point_encode_ctrl_reg (int type, +@@ -1038,7 +1039,7 @@ aarch64_point_encode_ctrl_reg (int type, Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise. */ static int @@ -741,7 +328,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c { unsigned int alignment = is_watchpoint ? AARCH64_HWP_ALIGNMENT : AARCH64_HBP_ALIGNMENT; -@@ -1285,7 +1286,7 @@ aarch64_handle_aligned_watchpoint (int t +@@ -1290,7 +1291,7 @@ aarch64_handle_aligned_watchpoint (int t Return 0 if succeed. */ static int @@ -750,7 +337,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c int is_insert) { struct aarch64_debug_reg_state *state -@@ -1310,8 +1311,8 @@ aarch64_handle_unaligned_watchpoint (int +@@ -1315,8 +1316,8 @@ aarch64_handle_unaligned_watchpoint (int fprintf_unfiltered (gdb_stdlog, "handle_unaligned_watchpoint: is_insert: %d\n" " aligned_addr: 0x%08lx, aligned_len: %d\n" @@ -761,7 +348,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c if (ret != 0) return ret; -@@ -1323,7 +1324,7 @@ aarch64_handle_unaligned_watchpoint (int +@@ -1328,7 +1329,7 @@ aarch64_handle_unaligned_watchpoint (int /* Implements insertion and removal of a single watchpoint. */ static int @@ -770,54 +357,7 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c { if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len)) return aarch64_handle_aligned_watchpoint (type, addr, len, is_insert); -@@ -1338,15 +1339,15 @@ aarch64_handle_watchpoint (int type, COR - of the type TYPE. Return 0 on success, -1 on failure. */ - - static int --aarch64_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, -+aarch64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int ret; - - if (debug_hw_points) - fprintf_unfiltered (gdb_stdlog, -- "insert_watchpoint on entry (addr=0x%08lx, len=%d)\n", -- (unsigned long) addr, len); -+ "insert_watchpoint on entry (addr=0x%08lx, len=%s)\n", -+ (unsigned long) addr, plongest (len)); - - gdb_assert (type != hw_execute); - -@@ -1370,15 +1371,15 @@ aarch64_linux_insert_watchpoint (CORE_AD - type TYPE. Return 0 on success, -1 on failure. */ - - static int --aarch64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, -+aarch64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, - struct expression *cond) - { - int ret; - - if (debug_hw_points) - fprintf_unfiltered (gdb_stdlog, -- "remove_watchpoint on entry (addr=0x%08lx, len=%d)\n", -- (unsigned long) addr, len); -+ "remove_watchpoint on entry (addr=0x%08lx, len=%s)\n", -+ (unsigned long) addr, plongest (len)); - - gdb_assert (type != hw_execute); - -@@ -1399,7 +1400,7 @@ aarch64_linux_remove_watchpoint (CORE_AD - /* Implement the "to_region_ok_for_hw_watchpoint" target_ops method. */ - - static int --aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+aarch64_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - CORE_ADDR aligned_addr; - -@@ -1489,7 +1490,7 @@ aarch64_linux_stopped_by_watchpoint (voi +@@ -1497,7 +1498,7 @@ aarch64_linux_stopped_by_watchpoint (str static int aarch64_linux_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -826,3 +366,16 @@ Index: gdb-7.7.1/gdb/aarch64-linux-nat.c { return start <= addr && start + length - 1 >= addr; } +Index: gdb-7.7.90.20140613/gdb/target-delegates.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/target-delegates.c 2014-06-13 22:22:37.917404611 +0200 ++++ gdb-7.7.90.20140613/gdb/target-delegates.c 2014-06-13 22:26:06.092640924 +0200 +@@ -261,7 +261,7 @@ tdefault_stopped_data_address (struct ta + } + + static int +-delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, int arg3) ++delegate_watchpoint_addr_within_range (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2, LONGEST arg3) + { + self = self->beneath; + return self->to_watchpoint_addr_within_range (self, arg1, arg2, arg3); diff --git a/gdb-rhbz795424-bitpos-25of25.patch b/gdb-rhbz795424-bitpos-25of25.patch index 1c39b9e..3a66c01 100644 --- a/gdb-rhbz795424-bitpos-25of25.patch +++ b/gdb-rhbz795424-bitpos-25of25.patch @@ -47,11 +47,11 @@ Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=f77-bounds.patch -Index: gdb-7.5.50.20130118/gdb/f-lang.h +Index: gdb-7.7.90.20140613/gdb/f-lang.h =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/f-lang.h 2013-01-18 23:39:40.209500968 +0100 -+++ gdb-7.5.50.20130118/gdb/f-lang.h 2013-01-18 23:40:04.010531177 +0100 -@@ -65,9 +65,9 @@ struct common_block +--- gdb-7.7.90.20140613.orig/gdb/f-lang.h 2014-06-16 22:45:00.404470944 +0200 ++++ gdb-7.7.90.20140613/gdb/f-lang.h 2014-06-16 22:45:10.352477761 +0200 +@@ -62,9 +62,9 @@ struct common_block struct symbol *contents[1]; }; @@ -63,11 +63,11 @@ Index: gdb-7.5.50.20130118/gdb/f-lang.h extern void f77_get_dynamic_array_length (struct type *); -Index: gdb-7.5.50.20130118/gdb/f-typeprint.c +Index: gdb-7.7.90.20140613/gdb/f-typeprint.c =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/f-typeprint.c 2013-01-18 23:39:37.564497620 +0100 -+++ gdb-7.5.50.20130118/gdb/f-typeprint.c 2013-01-18 23:39:40.210500970 +0100 -@@ -180,7 +180,7 @@ f_type_print_varspec_suffix (struct type +--- gdb-7.7.90.20140613.orig/gdb/f-typeprint.c 2014-06-16 22:45:00.404470944 +0200 ++++ gdb-7.7.90.20140613/gdb/f-typeprint.c 2014-06-16 22:45:10.353477761 +0200 +@@ -161,7 +161,7 @@ f_type_print_varspec_suffix (struct type int show, int passed_a_ptr, int demangled_args, int arrayprint_recurse_level) { @@ -76,25 +76,25 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c /* No static variables are permitted as an error call may occur during execution of this function. */ -@@ -210,7 +210,7 @@ f_type_print_varspec_suffix (struct type +@@ -195,7 +195,7 @@ f_type_print_varspec_suffix (struct type - lower_bound = f77_get_lowerbound (type); - if (lower_bound != 1) /* Not the default. */ -- fprintf_filtered (stream, "%d:", lower_bound); -+ fprintf_filtered (stream, "%s:", plongest (lower_bound)); + lower_bound = f77_get_lowerbound (type); + if (lower_bound != 1) /* Not the default. */ +- fprintf_filtered (stream, "%d:", lower_bound); ++ fprintf_filtered (stream, "%s:", plongest (lower_bound)); - /* Make sure that, if we have an assumed size array, we - print out a warning and print the upperbound as '*'. */ -@@ -220,7 +220,7 @@ f_type_print_varspec_suffix (struct type - else - { - upper_bound = f77_get_upperbound (type); -- fprintf_filtered (stream, "%d", upper_bound); -+ fprintf_filtered (stream, "%s", plongest (upper_bound)); - } + /* Make sure that, if we have an assumed size array, we + print out a warning and print the upperbound as '*'. */ +@@ -205,7 +205,7 @@ f_type_print_varspec_suffix (struct type + else + { + upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "%d", upper_bound); ++ fprintf_filtered (stream, "%s", plongest (upper_bound)); + } - if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) -@@ -288,7 +288,7 @@ void + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) +@@ -274,7 +274,7 @@ void f_type_print_base (struct type *type, struct ui_file *stream, int show, int level) { @@ -103,7 +103,7 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c int index; QUIT; -@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, st +@@ -356,7 +356,7 @@ f_type_print_base (struct type *type, st else { upper_bound = f77_get_upperbound (type); @@ -112,20 +112,20 @@ Index: gdb-7.5.50.20130118/gdb/f-typeprint.c } break; -Index: gdb-7.5.50.20130118/gdb/f-valprint.c +Index: gdb-7.7.90.20140613/gdb/f-valprint.c =================================================================== ---- gdb-7.5.50.20130118.orig/gdb/f-valprint.c 2013-01-18 23:39:37.564497620 +0100 -+++ gdb-7.5.50.20130118/gdb/f-valprint.c 2013-01-18 23:39:40.210500970 +0100 -@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN - - #define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) +--- gdb-7.7.90.20140613.orig/gdb/f-valprint.c 2014-06-16 22:45:34.901495069 +0200 ++++ gdb-7.7.90.20140613/gdb/f-valprint.c 2014-06-16 22:45:44.933502067 +0200 +@@ -46,7 +46,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN + /* Array which holds offsets to be applied to get a row's elements + for a given array. Array also holds the size of each subarray. */ -int +LONGEST f77_get_lowerbound (struct type *type) { - f_object_address_data_valid_or_error (type); -@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type) + if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) +@@ -55,7 +55,7 @@ f77_get_lowerbound (struct type *type) return TYPE_ARRAY_LOWER_BOUND_VALUE (type); } @@ -133,24 +133,4 @@ Index: gdb-7.5.50.20130118/gdb/f-valprint.c +LONGEST f77_get_upperbound (struct type *type) { - f_object_address_data_valid_or_error (type); -@@ -92,8 +92,8 @@ f77_get_upperbound (struct type *type) - static void - f77_get_dynamic_length_of_aggregate (struct type *type) - { -- int upper_bound = -1; -- int lower_bound = 1; -+ LONGEST upper_bound = -1; -+ LONGEST lower_bound = 1; - - /* Recursively go all the way down into a possibly multi-dimensional - F77 array and get the bounds. For simple arrays, this is pretty -@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct - struct type *tmp_type; - LONGEST eltlen; - int ndimen = 1; -- int upper, lower; -+ LONGEST upper, lower; - - tmp_type = type; - + if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) diff --git a/gdb-static-tls-1of2.patch b/gdb-static-tls-1of2.patch deleted file mode 100644 index caddad0..0000000 --- a/gdb-static-tls-1of2.patch +++ /dev/null @@ -1,82 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-04/msg00154.html -Subject: [patch] Fix gdbserver qGetTLSAddr for x86_64 -m32 - - ---St7VIuEGZ6dlpu13 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -gdbserver makes libthread_db to access uninitialized memory. Surprisingly it -does not harm normally, even -fsanitize=address works with current gdbserver. -I have found just valgrind detects it as a very first warning for gdbserver: - -Syscall param ptrace(addr) contains uninitialised byte(s) - at 0x3721EECEBE: ptrace (ptrace.c:45) - by 0x436EE5: ps_get_thread_area (linux-x86-low.c:252) - by 0x5559D02: __td_ta_lookup_th_unique (td_ta_map_lwp2thr.c:157) - by 0x5559EC3: td_ta_map_lwp2thr (td_ta_map_lwp2thr.c:207) - by 0x43F87D: find_one_thread (thread-db.c:281) - by 0x440038: thread_db_get_tls_address (thread-db.c:505) - by 0x40F6D0: handle_query (server.c:2004) - by 0x4124CF: process_serial_event (server.c:3445) - by 0x4136B6: handle_serial_event (server.c:3889) - by 0x419571: handle_file_event (event-loop.c:434) - by 0x418D38: process_event (event-loop.c:189) - by 0x419AB7: start_event_loop (event-loop.c:552) - -Reproducible with: -cd gdb/testsuite -g++ -o gdb.threads/tls gdb.threads/tls{,2}.c -m32 -pthread -../gdbserver/gdbserver :1234 gdb.threads/tls -../gdb -batch gdb.threads/tls -ex 'target remote :1234' -ex 'b spin' -ex c -ex 'p a_thread_local' - -It is more easily reproducible even without valgrind using s/0x00/0xff/ in the -attached patch. It will then turn the output of reproducer above: -$1 = 0 --> -Cannot find thread-local storage for Thread 29044, executable file .../gdb/testsuite/gdb.threads/tls: -Remote target failed to process qGetTLSAddr request - - -Thanks, -Jan - ---St7VIuEGZ6dlpu13 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="00ff.patch" - -gdb/gdbserver/ -2014-04-10 Jan Kratochvil - - Fix gdbserver qGetTLSAddr for x86_64 -m32. - * linux-x86-low.c (X86_64_USER_REGS): New. - (x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case. - -diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c -index 33b5f26..1156e58 100644 ---- a/gdb/gdbserver/linux-x86-low.c -+++ b/gdb/gdbserver/linux-x86-low.c -@@ -185,6 +185,7 @@ static const int x86_64_regmap[] = - }; - - #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0])) -+#define X86_64_USER_REGS (GS + 1) - - #else /* ! __x86_64__ */ - -@@ -343,6 +344,10 @@ x86_fill_gregset (struct regcache *regcache, void *buf) - collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]); - return; - } -+ -+ /* 32-bit inferior registers need to be zero-extended. -+ Callers would read uninitialized memory otherwise. */ -+ memset (buf, 0x00, X86_64_USER_REGS * 8); - #endif - - for (i = 0; i < I386_NUM_REGS; i++) - ---St7VIuEGZ6dlpu13-- - diff --git a/gdb-static-tls-2of2.patch b/gdb-static-tls-2of2.patch deleted file mode 100644 index 72dd1b3..0000000 --- a/gdb-static-tls-2of2.patch +++ /dev/null @@ -1,326 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-04/msg00155.html -Subject: [patch] Fix TLS access for -static -pthread - - ---qtZFehHsKgwS5rPz -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -testcase results may depend on patch: - [patch] Fix gdbserver qGetTLSAddr for x86_64 -m32 - https://sourceware.org/ml/gdb-patches/2014-04/msg00154.html - Message-ID: <20140410114901.GA16411@host2.jankratochvil.net> - -There is: - * gdb.threads/staticthreads.exp to test -static -pthread 'info threads' - * gdb.threads/tls.exp to test TLS access (__thread variables) -but no testcase to test both together - it even does not work. - -I have posted: - TLS variables access for -static -lpthread executables - https://sourceware.org/ml/libc-help/2014-03/msg00024.html -and the GDB patch below has been confirmed as OK for current glibcs. - -Future glibcs may implement more native support for -static -pthread TLS - https://sourceware.org/bugzilla/show_bug.cgi?id=16828 -which will require also some new GDB support. - -Still the patch below implements the feature in a fully functional way backward -compatible with current glibcs, it depends on the following glibc source line: - csu/libc-tls.c - main_map->l_tls_modid = 1; - -No regressions on {x86_64,x86_64-m32}-fedorarawhide-linux-gnu. - - -Thanks, -Jan - ---qtZFehHsKgwS5rPz -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="staticthread.patch" - -gdb/ -2014-04-10 Jan Kratochvil - - Fix TLS access for -static -pthread. - * linux-thread-db.c (struct thread_db_info): Add td_thr_tlsbase_p. - (try_thread_db_load_1): Initialize it. - (thread_db_get_thread_local_address): Call it if LM is zero. - * target.c (target_translate_tls_address): Remove LM_ADDR zero check. - * target.h (struct target_ops) (to_get_thread_local_address): Add - load_module_addr comment. - -gdb/gdbserver/ -2014-04-10 Jan Kratochvil - - Fix TLS access for -static -pthread. - * gdbserver/thread-db.c (struct thread_db): Add td_thr_tlsbase_p. - (thread_db_get_tls_address): Call it if LOAD_MODULE is zero. - (thread_db_load_search, try_thread_db_load_1): Initialize it. - -gdb/testsuite/ -2014-04-10 Jan Kratochvil - - Fix TLS access for -static -pthread. - * gdb.threads/staticthreads.c (tlsvar): New. - (thread_function, main): Initialize it. - * gdb.threads/staticthreads.exp: Try gdb_compile_pthreads for $have_tls. - Add clean_restart. - <$have_tls != "">: Check TLSVAR. - -diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c -index ca614a3..4578610 100644 ---- a/gdb/linux-thread-db.c -+++ b/gdb/linux-thread-db.c -@@ -196,6 +196,9 @@ struct thread_db_info - td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th, - psaddr_t map_address, - size_t offset, psaddr_t *address); -+ td_err_e (*td_thr_tlsbase_p) (const td_thrhandle_t *th, -+ unsigned long int modid, -+ psaddr_t *base); - }; - - /* List of known processes using thread_db, and the required -@@ -799,6 +802,7 @@ try_thread_db_load_1 (struct thread_db_info *info) - info->td_ta_event_getmsg_p = dlsym (info->handle, "td_ta_event_getmsg"); - info->td_thr_event_enable_p = dlsym (info->handle, "td_thr_event_enable"); - info->td_thr_tls_get_addr_p = dlsym (info->handle, "td_thr_tls_get_addr"); -+ info->td_thr_tlsbase_p = dlsym (info->handle, "td_thr_tlsbase"); - - if (thread_db_find_new_threads_silently (inferior_ptid) != 0) - { -@@ -1811,21 +1815,34 @@ thread_db_get_thread_local_address (struct target_ops *ops, - - info = get_thread_db_info (ptid_get_pid (ptid)); - -- /* glibc doesn't provide the needed interface. */ -- if (!info->td_thr_tls_get_addr_p) -- throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR, -- _("No TLS library support")); -- -- /* Caller should have verified that lm != 0. */ -- gdb_assert (lm != 0); -- - /* Finally, get the address of the variable. */ -- /* Note the cast through uintptr_t: this interface only works if -- a target address fits in a psaddr_t, which is a host pointer. -- So a 32-bit debugger can not access 64-bit TLS through this. */ -- err = info->td_thr_tls_get_addr_p (&thread_info->private->th, -- (psaddr_t)(uintptr_t) lm, -- offset, &address); -+ if (lm != 0) -+ { -+ /* glibc doesn't provide the needed interface. */ -+ if (!info->td_thr_tls_get_addr_p) -+ throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR, -+ _("No TLS library support")); -+ -+ /* Note the cast through uintptr_t: this interface only works if -+ a target address fits in a psaddr_t, which is a host pointer. -+ So a 32-bit debugger can not access 64-bit TLS through this. */ -+ err = info->td_thr_tls_get_addr_p (&thread_info->private->th, -+ (psaddr_t)(uintptr_t) lm, -+ offset, &address); -+ } -+ else -+ { -+ /* If glibc doesn't provide the needed interface throw an error -+ that LM is zero - normally cases it should not be. */ -+ if (!info->td_thr_tlsbase_p) -+ throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR, -+ _("TLS load module not found")); -+ -+ /* GNU __libc_setup_tls initializes l_tls_modid as 1. */ -+ err = info->td_thr_tlsbase_p (&thread_info->private->th, -+ 1, &address); -+ address = (char *) address + offset; -+ } - - #ifdef THREAD_DB_HAS_TD_NOTALLOC - /* The memory hasn't been allocated, yet. */ -diff --git a/gdb/target.c b/gdb/target.c -index 1b48f79..fce646c 100644 ---- a/gdb/target.c -+++ b/gdb/target.c -@@ -753,10 +753,6 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) - /* Fetch the load module address for this objfile. */ - lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (), - objfile); -- /* If it's 0, throw the appropriate exception. */ -- if (lm_addr == 0) -- throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR, -- _("TLS load module not found")); - - addr = target->to_get_thread_local_address (target, ptid, - lm_addr, offset); -diff --git a/gdb/target.h b/gdb/target.h -index d7c6c3d..1aba9e1 100644 ---- a/gdb/target.h -+++ b/gdb/target.h -@@ -605,7 +605,8 @@ struct target_ops - thread-local storage for the thread PTID and the shared library - or executable file given by OBJFILE. If that block of - thread-local storage hasn't been allocated yet, this function -- may return an error. */ -+ may return an error. LOAD_MODULE_ADDR may be zero for statically -+ linked multithreaded inferiors. */ - CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops, - ptid_t ptid, - CORE_ADDR load_module_addr, -diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c -index f63e39e..f2335ab 100644 ---- a/gdb/gdbserver/thread-db.c -+++ b/gdb/gdbserver/thread-db.c -@@ -88,6 +88,9 @@ struct thread_db - td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th, - psaddr_t map_address, - size_t offset, psaddr_t *address); -+ td_err_e (*td_thr_tlsbase_p) (const td_thrhandle_t *th, -+ unsigned long int modid, -+ psaddr_t *base); - const char ** (*td_symbol_list_p) (void); - }; - -@@ -497,7 +500,10 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset, - if (thread_db == NULL || !thread_db->all_symbols_looked_up) - return TD_ERR; - -- if (thread_db->td_thr_tls_get_addr_p == NULL) -+ /* If td_thr_tls_get_addr is missing rather do not expect td_thr_tlsbase -+ could work. */ -+ if (thread_db->td_thr_tls_get_addr_p == NULL -+ || (load_module == 0 && thread_db->td_thr_tlsbase_p == NULL)) - return -1; - - lwp = get_thread_lwp (thread); -@@ -508,12 +514,23 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset, - - saved_inferior = current_inferior; - current_inferior = thread; -- /* Note the cast through uintptr_t: this interface only works if -- a target address fits in a psaddr_t, which is a host pointer. -- So a 32-bit debugger can not access 64-bit TLS through this. */ -- err = thread_db->td_thr_tls_get_addr_p (&lwp->th, -- (psaddr_t) (uintptr_t) load_module, -- offset, &addr); -+ -+ if (load_module != 0) -+ { -+ /* Note the cast through uintptr_t: this interface only works if -+ a target address fits in a psaddr_t, which is a host pointer. -+ So a 32-bit debugger can not access 64-bit TLS through this. */ -+ err = thread_db->td_thr_tls_get_addr_p (&lwp->th, -+ (psaddr_t) (uintptr_t) load_module, -+ offset, &addr); -+ } -+ else -+ { -+ /* GNU __libc_setup_tls initializes l_tls_modid as 1. */ -+ err = thread_db->td_thr_tlsbase_p (&lwp->th, 1, &addr); -+ addr = (char *) addr + offset; -+ } -+ - current_inferior = saved_inferior; - if (err == TD_OK) - { -@@ -565,6 +582,7 @@ thread_db_load_search (void) - tdb->td_ta_set_event_p = &td_ta_set_event; - tdb->td_ta_event_getmsg_p = &td_ta_event_getmsg; - tdb->td_thr_tls_get_addr_p = &td_thr_tls_get_addr; -+ tdb->td_thr_tlsbase_p = &td_thr_tlsbase; - - return 1; - } -@@ -633,6 +651,7 @@ try_thread_db_load_1 (void *handle) - CHK (0, tdb->td_ta_set_event_p = dlsym (handle, "td_ta_set_event")); - CHK (0, tdb->td_ta_event_getmsg_p = dlsym (handle, "td_ta_event_getmsg")); - CHK (0, tdb->td_thr_tls_get_addr_p = dlsym (handle, "td_thr_tls_get_addr")); -+ CHK (0, tdb->td_thr_tlsbase_p = dlsym (handle, "td_thr_tlsbase")); - - #undef CHK - -diff --git a/gdb/testsuite/gdb.threads/staticthreads.c b/gdb/testsuite/gdb.threads/staticthreads.c -index f98f4f1..93bef56 100644 ---- a/gdb/testsuite/gdb.threads/staticthreads.c -+++ b/gdb/testsuite/gdb.threads/staticthreads.c -@@ -28,10 +28,17 @@ - - sem_t semaphore; - -+#ifdef HAVE_TLS -+__thread int tlsvar; -+#endif -+ - void * - thread_function (void *arg) - { -- printf ("Thread executing\n"); -+#ifdef HAVE_TLS -+ tlsvar = 2; -+#endif -+ printf ("Thread executing\n"); /* tlsvar-is-set */ - while (sem_wait (&semaphore) != 0) - { - if (errno != EINTR) -@@ -57,6 +64,9 @@ main (int argc, char **argv) - return -1; - } - -+#ifdef HAVE_TLS -+ tlsvar = 1; -+#endif - - /* Create a thread, wait for it to complete. */ - { -diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp -index 80b0ba8..9fa625a 100644 ---- a/gdb/testsuite/gdb.threads/staticthreads.exp -+++ b/gdb/testsuite/gdb.threads/staticthreads.exp -@@ -22,11 +22,16 @@ - standard_testfile - set static_flag "-static" - --if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ -- executable \ -- [list debug "additional_flags=${static_flag}" \ -- ]] != "" } { -- return -1 -+foreach have_tls { "-DHAVE_TLS" "" } { -+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ -+ executable \ -+ [list debug "additional_flags=${static_flag} ${have_tls}" \ -+ ]] == "" } { -+ break -+ } -+ if { $have_tls == "" } { -+ return -1 -+ } - } - - clean_restart ${binfile} -@@ -89,3 +94,18 @@ gdb_test_multiple "quit" "$test" { - pass "$test" - } - } -+clean_restart ${binfile} -+ -+ -+if { "$have_tls" != "" } { -+ if ![runto_main] { -+ return -1 -+ } -+ gdb_breakpoint [gdb_get_line_number "tlsvar-is-set"] -+ gdb_continue_to_breakpoint "tlsvar-is-set" ".* tlsvar-is-set .*" -+ gdb_test "p tlsvar" " = 2" "tlsvar in thread" -+ gdb_test "thread 1" ".*" -+ # Unwind from pthread_join. -+ gdb_test "up 10" " in main .*" -+ gdb_test "p tlsvar" " = 1" "tlsvar in main" -+} - ---qtZFehHsKgwS5rPz-- - diff --git a/gdb-testsuite-nohostid.patch b/gdb-testsuite-nohostid.patch deleted file mode 100644 index dc880a8..0000000 --- a/gdb-testsuite-nohostid.patch +++ /dev/null @@ -1,50 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-02/msg00158.html -Subject: [patch] testsuite: Fix "ERROR: no fileid for" - - ---azLHFNyN32YCQGCU -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -a35cfb4007cee8cb84106412cd17f4e12f13345b is the first bad commit -commit a35cfb4007cee8cb84106412cd17f4e12f13345b -Author: Maciej W. Rozycki -Date: Thu Oct 24 23:32:30 2013 +0100 - -$ runtest gdb.base/solib-disc.exp -Running ./gdb.base/solib-disc.exp ... -ERROR: no fileid for host1 -[...] - - -Jan - ---azLHFNyN32YCQGCU -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="gdbfinish.patch" - -gdb/testsuite/ -2014-02-06 Jan Kratochvil - - Fix "ERROR: no fileid for" in the testsuite. - * lib/gdb.exp (gdb_finish): Check gdb_spawn_id. - -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 533b81b..5c53cdf 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -3708,7 +3708,8 @@ proc gdb_finish { } { - global cleanfiles - - # Give persistent gdbserver a chance to terminate before GDB is killed. -- if {[info exists gdbserver_reconnect_p] && $gdbserver_reconnect_p} { -+ if {[info exists gdbserver_reconnect_p] && $gdbserver_reconnect_p -+ && [info exists gdb_spawn_id]} { - send_gdb "kill\n"; - gdb_expect 10 { - -re "y or n" { - ---azLHFNyN32YCQGCU-- - diff --git a/gdb-upstream-ppc64le02of15.patch b/gdb-upstream-ppc64le02of15.patch deleted file mode 100644 index 202e3f5..0000000 --- a/gdb-upstream-ppc64le02of15.patch +++ /dev/null @@ -1,61 +0,0 @@ -commit 718ee4dc9b09491707420ae403ad1ce8dfdb61b2 -Author: Ulrich Weigand -Date: Thu Jan 30 19:12:35 2014 +0100 - - Add support for AT_HWCAP2 auxv entry - - Recent ppc64 Linux kernels provide a new auxv entry AT_HWCAP2, - which is currently not recognized by GDB, causing every use of - "info auxv" to show an error. - - This commit adds the AT_HWCAP2 define to include/elf/common.h - and handles it in GDB. - - include/elf/ChangeLog: - - * common.h (AT_HWCAP2): Define. - - gdb/ChangeLog: - - * auxv.c (fprint_target_auxv): Handle AT_HWCAP2. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,7 @@ -+2014-01-30 Ulrich Weigand  -+ -+ * auxv.c (fprint_target_auxv): Handle AT_HWCAP2. -+ - 2014-01-29 Jose E. Marchesi - - * sparc64-linux-tdep.c (sparc64_linux_step_trap): Get PC from ---- a/gdb/auxv.c -+++ b/gdb/auxv.c -@@ -442,6 +442,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops) - TAG (AT_IGNOREPPC, _("Entry should be ignored"), dec); - TAG (AT_BASE_PLATFORM, _("String identifying base platform"), str); - TAG (AT_RANDOM, _("Address of 16 random bytes"), hex); -+ TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), hex); - TAG (AT_EXECFN, _("File name of executable"), str); - TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), dec); - TAG (AT_SYSINFO, _("Special system info/entry points"), hex); -### a/include/elf/ChangeLog -### b/include/elf/ChangeLog -## -1,3 +1,7 @@ -+2014-01-30 Ulrich Weigand -+ -+ * common.h (AT_HWCAP2): Define. -+ - 2013-12-13 Kuan-Lin Chen - Wei-Cheng Wang - ---- a/include/elf/common.h -+++ b/include/elf/common.h -@@ -959,6 +959,7 @@ - #define AT_BASE_PLATFORM 24 /* String identifying real platform, - may differ from AT_PLATFORM. */ - #define AT_RANDOM 25 /* Address of 16 random bytes. */ -+#define AT_HWCAP2 26 /* Extension of AT_HWCAP. */ - #define AT_EXECFN 31 /* Filename of executable. */ - /* Pointer to the global system page used for system calls and other - nice things. */ diff --git a/gdb-upstream-ppc64le03of15.patch b/gdb-upstream-ppc64le03of15.patch deleted file mode 100644 index 30b4fcf..0000000 --- a/gdb-upstream-ppc64le03of15.patch +++ /dev/null @@ -1,36 +0,0 @@ -commit 36c24d95382572e9cf4095712a8613664d7165cc -Author: Ulrich Weigand -Date: Tue Feb 4 18:19:51 2014 +0100 - - Document support for powerpc64le-*-linux* target - - gdb/ChangeLog: - - * NEWS: Document new target powerpc64le-*-linux*. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,7 @@ -+2014-02-04 Ulrich Weigand  -+ -+ * NEWS: Document new target powerpc64le-*-linux*. -+ - 2014-02-04 Mark Kettenis - - * sparc64obsd-tdep.c (sparc64obsd_gregset): New variable. -Index: gdb-7.7.1/gdb/NEWS -=================================================================== ---- gdb-7.7.1.orig/gdb/NEWS 2014-05-09 19:21:57.798235002 +0200 -+++ gdb-7.7.1/gdb/NEWS 2014-05-09 19:22:30.206239145 +0200 -@@ -1,6 +1,11 @@ - What has changed in GDB? - (Organized release by release) - -+*** Changes since GDB 7.7 -+ -+* New targets -+PowerPC64 GNU/Linux little-endian powerpc64le-*-linux* -+ - *** Changes in GDB 7.7 - - * GDB now supports SystemTap SDT probes on AArch64 GNU/Linux. diff --git a/gdb-upstream-ppc64le04of15.patch b/gdb-upstream-ppc64le04of15.patch deleted file mode 100644 index 1b6730f..0000000 --- a/gdb-upstream-ppc64le04of15.patch +++ /dev/null @@ -1,1413 +0,0 @@ -commit e765b44c3853ed228506fc22c276becd63198238 -Author: Ulrich Weigand -Date: Tue Feb 4 18:24:42 2014 +0100 - - Refactor ppc64 function call and return value handling - - This patch refactors the ppc64 function call and return value handling code - in ppc-sysv-tdep.c. The main problem to be addressed by this refactoring - is the code duplication caused by certain aggregate types: - - According to the ABI, some types are to be decomposed into component types - for parameter and return value handling. For example, complex types are - to be passed as if the real and imaginary component were separate arguments. - Similarly, certain OpenCL vector types are passed as if they were multiple - separate arguments of the vector element type. With the new ELFv2 ABI, - there is another case: "homogeneous aggregates" (e.g. a struct containing - 4 floats) are passed in multiple floating point registers as well. - - Unfortunately, the current code is not structured to easily model these - ABI properties. For example, code to pass complex values re-implements - code to pass the underlying (floating-point) type. This has already - led to some unfortunate code duplication, and with the addition of - ELFv2 ABI support, I would have had to add yet more such duplication. - - To avoid that, I've decided to refactor the code in order to re-use - subroutines that handle the "base" types when handling those aggregate - types. This was not intended to cause any difference on current - (ELFv1) ABI code, but in fact it fixes a bug: - - FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) - - This was caused by the old code in ppc64_sysv_abi_push_float incorrectly - handling floating-point arguments to vararg routines, which just happens - to work out correctly automatically in the refactored code ... - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment. - (struct ppc64_sysv_argpos): New data structure. - (ppc64_sysv_abi_push_float): Remove. - (ppc64_sysv_abi_push_val): New function. - (ppc64_sysv_abi_push_integer): Likewise. - (ppc64_sysv_abi_push_freg): Likewise. - (ppc64_sysv_abi_push_vreg): Likewise. - (ppc64_sysv_abi_push_param): Likewise. - (ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines. - (ppc64_sysv_abi_return_value_base): New function. - (ppc64_sysv_abi_return_value): Refactor to use it. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,19 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment. -+ (struct ppc64_sysv_argpos): New data structure. -+ (ppc64_sysv_abi_push_float): Remove. -+ (ppc64_sysv_abi_push_val): New function. -+ (ppc64_sysv_abi_push_integer): Likewise. -+ (ppc64_sysv_abi_push_freg): Likewise. -+ (ppc64_sysv_abi_push_vreg): Likewise. -+ (ppc64_sysv_abi_push_param): Likewise. -+ (ppc64_sysv_abi_push_dummy_call): Refactor to use those new routines. -+ (ppc64_sysv_abi_return_value_base): New function. -+ (ppc64_sysv_abi_return_value): Refactor to use it. -+ -+2014-02-04 Ulrich Weigand  -+ - * NEWS: Document new target powerpc64le-*-linux*. - - 2014-02-04 Mark Kettenis ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -609,8 +609,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - return sp; - } - --/* Handle the return-value conventions for Decimal Floating Point values -- in both ppc32 and ppc64, which are the same. */ -+/* Handle the return-value conventions for Decimal Floating Point values. */ - static int - get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, - struct regcache *regcache, gdb_byte *readbuf, -@@ -1102,80 +1101,287 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) - return 1; - } - --/* Push a float in either registers, or in the stack. Using the ppc 64 bit -- SysV ABI. -+/* Structure holding the next argument position. */ -+struct ppc64_sysv_argpos -+ { -+ /* Register cache holding argument registers. If this is NULL, -+ we only simulate argument processing without actually updating -+ any registers or memory. */ -+ struct regcache *regcache; -+ /* Next available general-purpose argument register. */ -+ int greg; -+ /* Next available floating-point argument register. */ -+ int freg; -+ /* Next available vector argument register. */ -+ int vreg; -+ /* The address, at which the next general purpose parameter -+ (integer, struct, float, vector, ...) should be saved. */ -+ CORE_ADDR gparam; -+ /* The address, at which the next by-reference parameter -+ (non-Altivec vector, variably-sized type) should be saved. */ -+ CORE_ADDR refparam; -+ }; -+ -+/* VAL is a value of length LEN. Store it into the argument area on the -+ stack and load it into the corresponding general-purpose registers -+ required by the ABI, and update ARGPOS. -+ -+ If ALIGN is nonzero, it specifies the minimum alignment required -+ for the on-stack copy of the argument. */ - -- This implements a dumbed down version of the ABI. It always writes -- values to memory, GPR and FPR, even when not necessary. Doing this -- greatly simplifies the logic. */ -+static void -+ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, -+ const bfd_byte *val, int len, int align, -+ struct ppc64_sysv_argpos *argpos) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ int offset = 0; -+ -+ /* Enforce alignment of stack location, if requested. */ -+ if (align > tdep->wordsize) -+ { -+ CORE_ADDR aligned_gparam = align_up (argpos->gparam, align); -+ -+ argpos->greg += (aligned_gparam - argpos->gparam) / tdep->wordsize; -+ argpos->gparam = aligned_gparam; -+ } -+ -+ /* The ABI (version 1.9) specifies that values smaller than one -+ doubleword are right-aligned and those larger are left-aligned. -+ GCC versions before 3.4 implemented this incorrectly; see -+ . */ -+ if (len < tdep->wordsize) -+ offset = tdep->wordsize - len; -+ -+ if (argpos->regcache) -+ write_memory (argpos->gparam + offset, val, len); -+ argpos->gparam = align_up (argpos->gparam + len, tdep->wordsize); -+ -+ while (len >= tdep->wordsize) -+ { -+ if (argpos->regcache && argpos->greg <= 10) -+ regcache_cooked_write (argpos->regcache, -+ tdep->ppc_gp0_regnum + argpos->greg, val); -+ argpos->greg++; -+ len -= tdep->wordsize; -+ val += tdep->wordsize; -+ } -+ -+ if (len > 0) -+ { -+ if (argpos->regcache && argpos->greg <= 10) -+ regcache_cooked_write_part (argpos->regcache, -+ tdep->ppc_gp0_regnum + argpos->greg, -+ offset, len, val); -+ argpos->greg++; -+ } -+} -+ -+/* The same as ppc64_sysv_abi_push_val, but using a single-word integer -+ value VAL as argument. */ - - static void --ppc64_sysv_abi_push_float (struct gdbarch *gdbarch, struct regcache *regcache, -- struct gdbarch_tdep *tdep, struct type *type, -- const bfd_byte *val, int freg, int greg, -- CORE_ADDR gparam) -+ppc64_sysv_abi_push_integer (struct gdbarch *gdbarch, ULONGEST val, -+ struct ppc64_sysv_argpos *argpos) - { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- const gdb_byte *p; -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ gdb_byte buf[MAX_REGISTER_SIZE]; - -- if (TYPE_LENGTH (type) <= 8) -+ if (argpos->regcache) -+ store_unsigned_integer (buf, tdep->wordsize, byte_order, val); -+ ppc64_sysv_abi_push_val (gdbarch, buf, tdep->wordsize, 0, argpos); -+} -+ -+/* VAL is a value of TYPE, a (binary or decimal) floating-point type. -+ Load it into a floating-point register if required by the ABI, -+ and update ARGPOS. */ -+ -+static void -+ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, -+ struct type *type, const bfd_byte *val, -+ struct ppc64_sysv_argpos *argpos) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ if (tdep->soft_float) -+ return; -+ -+ if (TYPE_LENGTH (type) <= 8 -+ && TYPE_CODE (type) == TYPE_CODE_FLT) - { -- /* Version 1.7 of the 64-bit PowerPC ELF ABI says: -+ /* Floats and doubles go in f1 .. f13. 32-bit floats are converted -+ to double first. */ -+ if (argpos->regcache && argpos->freg <= 13) -+ { -+ int regnum = tdep->ppc_fp0_regnum + argpos->freg; -+ struct type *regtype = register_type (gdbarch, regnum); -+ gdb_byte regval[MAX_REGISTER_SIZE]; - -- "Single precision floating point values are mapped to -- the first word in a single doubleword." -+ convert_typed_floating (val, type, regval, regtype); -+ regcache_cooked_write (argpos->regcache, regnum, regval); -+ } - -- And version 1.9 says: -+ argpos->freg++; -+ } -+ else if (TYPE_LENGTH (type) <= 8 -+ && TYPE_CODE (type) == TYPE_CODE_DECFLOAT) -+ { -+ /* Floats and doubles go in f1 .. f13. 32-bit decimal floats are -+ placed in the least significant word. */ -+ if (argpos->regcache && argpos->freg <= 13) -+ { -+ int regnum = tdep->ppc_fp0_regnum + argpos->freg; -+ int offset = 8 - TYPE_LENGTH (type); - -- "Single precision floating point values are mapped to -- the second word in a single doubleword." -+ regcache_cooked_write_part (argpos->regcache, regnum, -+ offset, TYPE_LENGTH (type), val); -+ } - -- GDB then writes single precision floating point values -- at both words in a doubleword, to support both ABIs. */ -- if (TYPE_LENGTH (type) == 4) -+ argpos->freg++; -+ } -+ else if (TYPE_LENGTH (type) == 16 -+ && TYPE_CODE (type) == TYPE_CODE_FLT -+ && (gdbarch_long_double_format (gdbarch) -+ == floatformats_ibm_long_double)) -+ { -+ /* IBM long double stored in two consecutive FPRs. */ -+ if (argpos->regcache && argpos->freg <= 13) - { -- memcpy (regval, val, 4); -- memcpy (regval + 4, val, 4); -- p = regval; -+ int regnum = tdep->ppc_fp0_regnum + argpos->freg; -+ -+ regcache_cooked_write (argpos->regcache, regnum, val); -+ if (argpos->freg <= 12) -+ regcache_cooked_write (argpos->regcache, regnum + 1, val + 8); - } -- else -- p = val; - -- /* Write value in the stack's parameter save area. */ -- write_memory (gparam, p, 8); -+ argpos->freg += 2; -+ } -+ else if (TYPE_LENGTH (type) == 16 -+ && TYPE_CODE (type) == TYPE_CODE_DECFLOAT) -+ { -+ /* 128-bit decimal floating-point values are stored in and even/odd -+ pair of FPRs, with the even FPR holding the most significant half. */ -+ argpos->freg += argpos->freg & 1; - -- /* Floats and Doubles go in f1 .. f13. They also consume a left aligned -- GREG, and can end up in memory. */ -- if (freg <= 13) -+ if (argpos->regcache && argpos->freg <= 12) - { -- struct type *regtype; -+ int regnum = tdep->ppc_fp0_regnum + argpos->freg; - -- regtype = register_type (gdbarch, tdep->ppc_fp0_regnum + freg); -- convert_typed_floating (val, type, regval, regtype); -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + freg, regval); -+ regcache_cooked_write (argpos->regcache, regnum, val); -+ regcache_cooked_write (argpos->regcache, regnum + 1, val + 8); - } -- if (greg <= 10) -- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + greg, regval); -+ -+ argpos->freg += 2; - } -- else -+} -+ -+/* VAL is a value of AltiVec vector type. Load it into a vector register -+ if required by the ABI, and update ARGPOS. */ -+ -+static void -+ppc64_sysv_abi_push_vreg (struct gdbarch *gdbarch, const bfd_byte *val, -+ struct ppc64_sysv_argpos *argpos) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (argpos->regcache && argpos->vreg <= 13) -+ regcache_cooked_write (argpos->regcache, -+ tdep->ppc_vr0_regnum + argpos->vreg, val); -+ -+ argpos->vreg++; -+} -+ -+/* VAL is a value of TYPE. Load it into memory and/or registers -+ as required by the ABI, and update ARGPOS. */ -+ -+static void -+ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, -+ struct type *type, const bfd_byte *val, -+ struct ppc64_sysv_argpos *argpos) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ if (TYPE_CODE (type) == TYPE_CODE_FLT -+ || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) -+ { -+ /* Floating-point scalars are passed in floating-point registers. */ -+ ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); -+ ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); -+ } -+ else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) -+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC -+ && TYPE_LENGTH (type) == 16) -+ { -+ /* AltiVec vectors are passed aligned, and in vector registers. */ -+ ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos); -+ ppc64_sysv_abi_push_vreg (gdbarch, val, argpos); -+ } -+ else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) -+ && TYPE_LENGTH (type) >= 16) - { -- /* IBM long double stored in two doublewords of the -- parameter save area and corresponding registers. */ -- if (!tdep->soft_float && freg <= 13) -+ /* Non-Altivec vectors are passed by reference. */ -+ -+ /* Copy value onto the stack ... */ -+ CORE_ADDR addr = align_up (argpos->refparam, 16); -+ if (argpos->regcache) -+ write_memory (addr, val, TYPE_LENGTH (type)); -+ argpos->refparam = align_up (addr + TYPE_LENGTH (type), tdep->wordsize); -+ -+ /* ... and pass a pointer to the copy as parameter. */ -+ ppc64_sysv_abi_push_integer (gdbarch, addr, argpos); -+ } -+ else if ((TYPE_CODE (type) == TYPE_CODE_INT -+ || TYPE_CODE (type) == TYPE_CODE_ENUM -+ || TYPE_CODE (type) == TYPE_CODE_BOOL -+ || TYPE_CODE (type) == TYPE_CODE_CHAR -+ || TYPE_CODE (type) == TYPE_CODE_PTR -+ || TYPE_CODE (type) == TYPE_CODE_REF) -+ && TYPE_LENGTH (type) <= tdep->wordsize) -+ { -+ ULONGEST word = 0; -+ -+ if (argpos->regcache) - { -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + freg, val); -- if (freg <= 12) -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + freg + 1, -- val + 8); -+ /* Sign extend the value, then store it unsigned. */ -+ word = unpack_long (type, val); -+ -+ /* Convert any function code addresses into descriptors. */ -+ if (TYPE_CODE (type) == TYPE_CODE_PTR -+ || TYPE_CODE (type) == TYPE_CODE_REF) -+ { -+ struct type *target_type -+ = check_typedef (TYPE_TARGET_TYPE (type)); -+ -+ if (TYPE_CODE (target_type) == TYPE_CODE_FUNC -+ || TYPE_CODE (target_type) == TYPE_CODE_METHOD) -+ { -+ CORE_ADDR desc = word; -+ -+ convert_code_addr_to_desc_addr (word, &desc); -+ word = desc; -+ } -+ } - } -- if (greg <= 10) -+ -+ ppc64_sysv_abi_push_integer (gdbarch, word, argpos); -+ } -+ else -+ { -+ ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos); -+ -+ /* The ABI (version 1.9) specifies that structs containing a -+ single floating-point value, at any level of nesting of -+ single-member structs, are passed in floating-point registers. */ -+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT -+ && TYPE_NFIELDS (type) == 1) - { -- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + greg, val); -- if (greg <= 9) -- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + greg + 1, -- val + 8); -+ while (TYPE_CODE (type) == TYPE_CODE_STRUCT -+ && TYPE_NFIELDS (type) == 1) -+ type = check_typedef (TYPE_FIELD_TYPE (type, 0)); -+ -+ if (TYPE_CODE (type) == TYPE_CODE_FLT) -+ ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); - } -- write_memory (gparam, val, TYPE_LENGTH (type)); - } - } - -@@ -1237,20 +1443,11 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - for (write_pass = 0; write_pass < 2; write_pass++) - { - int argno; -- /* Next available floating point register for float and double -- arguments. */ -- int freg = 1; -- /* Next available general register for non-vector (but possibly -- float) arguments. */ -- int greg = 3; -- /* Next available vector register for vector arguments. */ -- int vreg = 2; -- /* The address, at which the next general purpose parameter -- (integer, struct, float, vector, ...) should be saved. */ -- CORE_ADDR gparam; -- /* The address, at which the next by-reference parameter -- (non-Altivec vector, variably-sized type) should be saved. */ -- CORE_ADDR refparam; -+ -+ struct ppc64_sysv_argpos argpos; -+ argpos.greg = 3; -+ argpos.freg = 1; -+ argpos.vreg = 2; - - if (!write_pass) - { -@@ -1258,19 +1455,21 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - offsets (start address zero) than addresses. That way - they accumulate the total stack space each region - requires. */ -- gparam = 0; -- refparam = 0; -+ argpos.regcache = NULL; -+ argpos.gparam = 0; -+ argpos.refparam = 0; - } - else - { - /* Decrement the stack pointer making space for the Altivec - and general on-stack parameters. Set refparam and gparam - to their corresponding regions. */ -- refparam = align_down (sp - refparam_size, 16); -- gparam = align_down (refparam - gparam_size, 16); -+ argpos.regcache = regcache; -+ argpos.refparam = align_down (sp - refparam_size, 16); -+ argpos.gparam = align_down (argpos.refparam - gparam_size, 16); - /* Add in space for the TOC, link editor double word, - compiler double word, LR save area, CR save area. */ -- sp = align_down (gparam - 48, 16); -+ sp = align_down (argpos.gparam - 48, 16); - } - - /* If the function is returning a `struct', then there is an -@@ -1279,14 +1478,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - should advance one word and start from r4 register to copy - parameters. This also consumes one on-stack parameter slot. */ - if (struct_return) -- { -- if (write_pass) -- regcache_cooked_write_signed (regcache, -- tdep->ppc_gp0_regnum + greg, -- struct_addr); -- greg++; -- gparam = align_up (gparam + tdep->wordsize, tdep->wordsize); -- } -+ ppc64_sysv_abi_push_integer (gdbarch, struct_addr, &argpos); - - for (argno = 0; argno < nargs; argno++) - { -@@ -1294,432 +1486,54 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - struct type *type = check_typedef (value_type (arg)); - const bfd_byte *val = value_contents (arg); - -- if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8) -+ if (TYPE_CODE (type) == TYPE_CODE_COMPLEX) - { -- if (write_pass) -- ppc64_sysv_abi_push_float (gdbarch, regcache, tdep, type, -- val, freg, greg, gparam); -- -- freg++; -- greg++; -- /* Always consume parameter stack space. */ -- gparam = align_up (gparam + 8, tdep->wordsize); -- } -- else if (TYPE_CODE (type) == TYPE_CODE_FLT -- && TYPE_LENGTH (type) == 16 -- && (gdbarch_long_double_format (gdbarch) -- == floatformats_ibm_long_double)) -- { -- if (write_pass) -- ppc64_sysv_abi_push_float (gdbarch, regcache, tdep, type, -- val, freg, greg, gparam); -- freg += 2; -- greg += 2; -- gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); -- } -- else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX -- && (TYPE_LENGTH (type) == 8 || TYPE_LENGTH (type) == 16)) -- { -- int i; -- -- for (i = 0; i < 2; i++) -- { -- if (write_pass) -- { -- struct type *target_type; -- -- target_type = check_typedef (TYPE_TARGET_TYPE (type)); -- ppc64_sysv_abi_push_float (gdbarch, regcache, tdep, -- target_type, val + i * -- TYPE_LENGTH (target_type), -- freg, greg, gparam); -- } -- freg++; -- greg++; -- /* Always consume parameter stack space. */ -- gparam = align_up (gparam + 8, tdep->wordsize); -- } -- } -- else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX -- && TYPE_LENGTH (type) == 32 -- && (gdbarch_long_double_format (gdbarch) -- == floatformats_ibm_long_double)) -- { -- int i; -- -- for (i = 0; i < 2; i++) -- { -- struct type *target_type; -- -- target_type = check_typedef (TYPE_TARGET_TYPE (type)); -- if (write_pass) -- ppc64_sysv_abi_push_float (gdbarch, regcache, tdep, -- target_type, val + i * -- TYPE_LENGTH (target_type), -- freg, greg, gparam); -- freg += 2; -- greg += 2; -- gparam = align_up (gparam + TYPE_LENGTH (target_type), -- tdep->wordsize); -- } -- } -- else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT -- && TYPE_LENGTH (type) <= 8) -- { -- /* 32-bit and 64-bit decimal floats go in f1 .. f13. They can -- end up in memory. */ -- if (write_pass) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- const gdb_byte *p; -- -- /* 32-bit decimal floats are right aligned in the -- doubleword. */ -- if (TYPE_LENGTH (type) == 4) -- { -- memcpy (regval + 4, val, 4); -- p = regval; -- } -- else -- p = val; -- -- /* Write value in the stack's parameter save area. */ -- write_memory (gparam, p, 8); -- -- if (freg <= 13) -- regcache_cooked_write (regcache, -- tdep->ppc_fp0_regnum + freg, p); -- } -- -- freg++; -- greg++; -- /* Always consume parameter stack space. */ -- gparam = align_up (gparam + 8, tdep->wordsize); -- } -- else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && -- TYPE_LENGTH (type) == 16) -- { -- /* 128-bit decimal floats go in f2 .. f12, always in even/odd -- pairs. They can end up in memory, using two doublewords. */ -- if (write_pass) -- { -- if (freg <= 12) -- { -- /* Make sure freg is even. */ -- freg += freg & 1; -- regcache_cooked_write (regcache, -- tdep->ppc_fp0_regnum + freg, val); -- regcache_cooked_write (regcache, -- tdep->ppc_fp0_regnum + freg + 1, val + 8); -- } -- -- write_memory (gparam, val, TYPE_LENGTH (type)); -- } -+ /* Complex types are passed as if two independent scalars. */ -+ struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); - -- freg += 2; -- greg += 2; -- gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); -+ ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos); -+ ppc64_sysv_abi_push_param (gdbarch, eltype, -+ val + TYPE_LENGTH (eltype), &argpos); - } -- else if (TYPE_LENGTH (type) < 16 -- && TYPE_CODE (type) == TYPE_CODE_ARRAY -- && TYPE_VECTOR (type) -+ else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type) - && opencl_abi) - { - /* OpenCL vectors shorter than 16 bytes are passed as if -- a series of independent scalars. */ -- struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type)); -- int i, nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype); -+ a series of independent scalars; OpenCL vectors 16 bytes -+ or longer are passed as if a series of AltiVec vectors. */ -+ struct type *eltype; -+ int i, nelt; - -+ if (TYPE_LENGTH (type) < 16) -+ eltype = check_typedef (TYPE_TARGET_TYPE (type)); -+ else -+ eltype = register_type (gdbarch, tdep->ppc_vr0_regnum); -+ -+ nelt = TYPE_LENGTH (type) / TYPE_LENGTH (eltype); - for (i = 0; i < nelt; i++) - { - const gdb_byte *elval = val + i * TYPE_LENGTH (eltype); - -- if (TYPE_CODE (eltype) == TYPE_CODE_FLT) -- { -- if (write_pass) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- const gdb_byte *p; -- -- if (TYPE_LENGTH (eltype) == 4) -- { -- memcpy (regval, elval, 4); -- memcpy (regval + 4, elval, 4); -- p = regval; -- } -- else -- p = elval; -- -- write_memory (gparam, p, 8); -- -- if (freg <= 13) -- { -- int regnum = tdep->ppc_fp0_regnum + freg; -- struct type *regtype -- = register_type (gdbarch, regnum); -- -- convert_typed_floating (elval, eltype, -- regval, regtype); -- regcache_cooked_write (regcache, regnum, regval); -- } -- -- if (greg <= 10) -- regcache_cooked_write (regcache, -- tdep->ppc_gp0_regnum + greg, -- regval); -- } -- -- freg++; -- greg++; -- gparam = align_up (gparam + 8, tdep->wordsize); -- } -- else -- { -- if (write_pass) -- { -- ULONGEST word = unpack_long (eltype, elval); -- if (greg <= 10) -- regcache_cooked_write_unsigned -- (regcache, tdep->ppc_gp0_regnum + greg, word); -- -- write_memory_unsigned_integer -- (gparam, tdep->wordsize, byte_order, word); -- } -- -- greg++; -- gparam = align_up (gparam + TYPE_LENGTH (eltype), -- tdep->wordsize); -- } -- } -- } -- else if (TYPE_LENGTH (type) >= 16 -- && TYPE_CODE (type) == TYPE_CODE_ARRAY -- && TYPE_VECTOR (type) -- && opencl_abi) -- { -- /* OpenCL vectors 16 bytes or longer are passed as if -- a series of AltiVec vectors. */ -- int i; -- -- for (i = 0; i < TYPE_LENGTH (type) / 16; i++) -- { -- const gdb_byte *elval = val + i * 16; -- -- gparam = align_up (gparam, 16); -- greg += greg & 1; -- -- if (write_pass) -- { -- if (vreg <= 13) -- regcache_cooked_write (regcache, -- tdep->ppc_vr0_regnum + vreg, -- elval); -- -- write_memory (gparam, elval, 16); -- } -- -- greg += 2; -- vreg++; -- gparam += 16; -- } -- } -- else if (TYPE_LENGTH (type) == 16 && TYPE_VECTOR (type) -- && TYPE_CODE (type) == TYPE_CODE_ARRAY -- && tdep->vector_abi == POWERPC_VEC_ALTIVEC) -- { -- /* In the Altivec ABI, vectors go in the vector registers -- v2 .. v13, as well as the parameter area -- always at -- 16-byte aligned addresses. */ -- -- gparam = align_up (gparam, 16); -- greg += greg & 1; -- -- if (write_pass) -- { -- if (vreg <= 13) -- regcache_cooked_write (regcache, -- tdep->ppc_vr0_regnum + vreg, val); -- -- write_memory (gparam, val, TYPE_LENGTH (type)); -- } -- -- greg += 2; -- vreg++; -- gparam += 16; -- } -- else if (TYPE_LENGTH (type) >= 16 && TYPE_VECTOR (type) -- && TYPE_CODE (type) == TYPE_CODE_ARRAY) -- { -- /* Non-Altivec vectors are passed by reference. */ -- -- /* Copy value onto the stack ... */ -- refparam = align_up (refparam, 16); -- if (write_pass) -- write_memory (refparam, val, TYPE_LENGTH (type)); -- -- /* ... and pass a pointer to the copy as parameter. */ -- if (write_pass) -- { -- if (greg <= 10) -- regcache_cooked_write_unsigned (regcache, -- tdep->ppc_gp0_regnum + -- greg, refparam); -- write_memory_unsigned_integer (gparam, tdep->wordsize, -- byte_order, refparam); -- } -- greg++; -- gparam = align_up (gparam + tdep->wordsize, tdep->wordsize); -- refparam = align_up (refparam + TYPE_LENGTH (type), tdep->wordsize); -- } -- else if ((TYPE_CODE (type) == TYPE_CODE_INT -- || TYPE_CODE (type) == TYPE_CODE_ENUM -- || TYPE_CODE (type) == TYPE_CODE_BOOL -- || TYPE_CODE (type) == TYPE_CODE_CHAR -- || TYPE_CODE (type) == TYPE_CODE_PTR -- || TYPE_CODE (type) == TYPE_CODE_REF) -- && TYPE_LENGTH (type) <= 8) -- { -- /* Scalars and Pointers get sign[un]extended and go in -- gpr3 .. gpr10. They can also end up in memory. */ -- if (write_pass) -- { -- /* Sign extend the value, then store it unsigned. */ -- ULONGEST word = unpack_long (type, val); -- /* Convert any function code addresses into -- descriptors. */ -- if (TYPE_CODE (type) == TYPE_CODE_PTR -- || TYPE_CODE (type) == TYPE_CODE_REF) -- { -- struct type *target_type; -- target_type = check_typedef (TYPE_TARGET_TYPE (type)); -- -- if (TYPE_CODE (target_type) == TYPE_CODE_FUNC -- || TYPE_CODE (target_type) == TYPE_CODE_METHOD) -- { -- CORE_ADDR desc = word; -- convert_code_addr_to_desc_addr (word, &desc); -- word = desc; -- } -- } -- if (greg <= 10) -- regcache_cooked_write_unsigned (regcache, -- tdep->ppc_gp0_regnum + -- greg, word); -- write_memory_unsigned_integer (gparam, tdep->wordsize, -- byte_order, word); -+ ppc64_sysv_abi_push_param (gdbarch, eltype, elval, &argpos); - } -- greg++; -- gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); - } - else - { -- int byte; -- for (byte = 0; byte < TYPE_LENGTH (type); -- byte += tdep->wordsize) -- { -- if (write_pass && greg <= 10) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- int len = TYPE_LENGTH (type) - byte; -- if (len > tdep->wordsize) -- len = tdep->wordsize; -- memset (regval, 0, sizeof regval); -- /* The ABI (version 1.9) specifies that values -- smaller than one doubleword are right-aligned -- and those larger are left-aligned. GCC -- versions before 3.4 implemented this -- incorrectly; see -- . */ -- if (byte == 0) -- memcpy (regval + tdep->wordsize - len, -- val + byte, len); -- else -- memcpy (regval, val + byte, len); -- regcache_cooked_write (regcache, greg, regval); -- } -- greg++; -- } -- if (write_pass) -- { -- /* WARNING: cagney/2003-09-21: Strictly speaking, this -- isn't necessary, unfortunately, GCC appears to get -- "struct convention" parameter passing wrong putting -- odd sized structures in memory instead of in a -- register. Work around this by always writing the -- value to memory. Fortunately, doing this -- simplifies the code. */ -- int len = TYPE_LENGTH (type); -- if (len < tdep->wordsize) -- write_memory (gparam + tdep->wordsize - len, val, len); -- else -- write_memory (gparam, val, len); -- } -- if (freg <= 13 -- && TYPE_CODE (type) == TYPE_CODE_STRUCT -- && TYPE_NFIELDS (type) == 1 -- && TYPE_LENGTH (type) <= 16) -- { -- /* The ABI (version 1.9) specifies that structs -- containing a single floating-point value, at any -- level of nesting of single-member structs, are -- passed in floating-point registers. */ -- while (TYPE_CODE (type) == TYPE_CODE_STRUCT -- && TYPE_NFIELDS (type) == 1) -- type = check_typedef (TYPE_FIELD_TYPE (type, 0)); -- if (TYPE_CODE (type) == TYPE_CODE_FLT) -- { -- if (TYPE_LENGTH (type) <= 8) -- { -- if (write_pass) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- struct type *regtype -- = register_type (gdbarch, -- tdep->ppc_fp0_regnum); -- convert_typed_floating (val, type, regval, -- regtype); -- regcache_cooked_write (regcache, -- (tdep->ppc_fp0_regnum -- + freg), -- regval); -- } -- freg++; -- } -- else if (TYPE_LENGTH (type) == 16 -- && (gdbarch_long_double_format (gdbarch) -- == floatformats_ibm_long_double)) -- { -- if (write_pass) -- { -- regcache_cooked_write (regcache, -- (tdep->ppc_fp0_regnum -- + freg), -- val); -- if (freg <= 12) -- regcache_cooked_write (regcache, -- (tdep->ppc_fp0_regnum -- + freg + 1), -- val + 8); -- } -- freg += 2; -- } -- } -- } -- /* Always consume parameter stack space. */ -- gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); -+ /* All other types are passed as single arguments. */ -+ ppc64_sysv_abi_push_param (gdbarch, type, val, &argpos); - } - } - - if (!write_pass) - { - /* Save the true region sizes ready for the second pass. */ -- refparam_size = refparam; -+ refparam_size = argpos.refparam; - /* Make certain that the general parameter save area is at - least the minimum 8 registers (or doublewords) in size. */ -- if (greg < 8) -+ if (argpos.greg < 8) - gparam_size = 8 * tdep->wordsize; - else -- gparam_size = gparam; -+ gparam_size = argpos.gparam; - } - } - -@@ -1755,271 +1569,252 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - return sp; - } - -+/* Subroutine of ppc64_sysv_abi_return_value that handles "base" types: -+ integer, floating-point, and AltiVec vector types. - --/* The 64 bit ABI return value convention. -- -- Return non-zero if the return-value is stored in a register, return -- 0 if the return-value is instead stored on the stack (a.k.a., -- struct return convention). -+ This routine also handles components of aggregate return types; -+ INDEX describes which part of the aggregate is to be handled. - -- For a return-value stored in a register: when WRITEBUF is non-NULL, -- copy the buffer to the corresponding register return-value location -- location; when READBUF is non-NULL, fill the buffer from the -- corresponding register return-value location. */ --enum return_value_convention --ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, -- struct type *valtype, struct regcache *regcache, -- gdb_byte *readbuf, const gdb_byte *writebuf) -+ Returns true if VALTYPE is some such base type that could be handled, -+ false otherwise. */ -+static int -+ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, -+ struct regcache *regcache, gdb_byte *readbuf, -+ const gdb_byte *writebuf, int index) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -- struct type *func_type = function ? value_type (function) : NULL; -- int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0; - -- /* This function exists to support a calling convention that -- requires floating-point registers. It shouldn't be used on -- processors that lack them. */ -- gdb_assert (ppc_floating_point_unit_p (gdbarch)); -- -- /* Floats and doubles in F1. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum); -- if (writebuf != NULL) -- { -- convert_typed_floating (writebuf, valtype, regval, regtype); -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval); -- } -- if (readbuf != NULL) -- { -- regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval); -- convert_typed_floating (regval, regtype, readbuf, valtype); -- } -- return RETURN_VALUE_REGISTER_CONVENTION; -- } -- if (TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) -- return get_decimal_float_return_value (gdbarch, valtype, regcache, readbuf, -- writebuf); -- /* Integers in r3. */ -+ /* Integers live in GPRs starting at r3. */ - if ((TYPE_CODE (valtype) == TYPE_CODE_INT - || TYPE_CODE (valtype) == TYPE_CODE_ENUM - || TYPE_CODE (valtype) == TYPE_CODE_CHAR - || TYPE_CODE (valtype) == TYPE_CODE_BOOL) - && TYPE_LENGTH (valtype) <= 8) - { -+ int regnum = tdep->ppc_gp0_regnum + 3 + index; -+ - if (writebuf != NULL) - { - /* Be careful to sign extend the value. */ -- regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3, -+ regcache_cooked_write_unsigned (regcache, regnum, - unpack_long (valtype, writebuf)); - } - if (readbuf != NULL) - { -- /* Extract the integer from r3. Since this is truncating the -+ /* Extract the integer from GPR. Since this is truncating the - value, there isn't a sign extension problem. */ - ULONGEST regval; -- regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3, -- ®val); -- store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), byte_order, -- regval); -+ -+ regcache_cooked_read_unsigned (regcache, regnum, ®val); -+ store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), -+ gdbarch_byte_order (gdbarch), regval); - } -- return RETURN_VALUE_REGISTER_CONVENTION; -+ return 1; - } -- /* All pointers live in r3. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_PTR -- || TYPE_CODE (valtype) == TYPE_CODE_REF) -+ -+ /* Floats and doubles go in f1 .. f13. 32-bit floats are converted -+ to double first. */ -+ if (TYPE_LENGTH (valtype) <= 8 -+ && TYPE_CODE (valtype) == TYPE_CODE_FLT) - { -- /* All pointers live in r3. */ -+ int regnum = tdep->ppc_fp0_regnum + 1 + index; -+ struct type *regtype = register_type (gdbarch, regnum); -+ gdb_byte regval[MAX_REGISTER_SIZE]; -+ - if (writebuf != NULL) -- regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3, writebuf); -+ { -+ convert_typed_floating (writebuf, valtype, regval, regtype); -+ regcache_cooked_write (regcache, regnum, regval); -+ } - if (readbuf != NULL) -- regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf); -- return RETURN_VALUE_REGISTER_CONVENTION; -+ { -+ regcache_cooked_read (regcache, regnum, regval); -+ convert_typed_floating (regval, regtype, readbuf, valtype); -+ } -+ return 1; - } -- /* OpenCL vectors < 16 bytes are returned as distinct -- scalars in f1..f2 or r3..r10. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY -- && TYPE_VECTOR (valtype) -- && TYPE_LENGTH (valtype) < 16 -- && opencl_abi) -- { -- struct type *eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); -- int i, nelt = TYPE_LENGTH (valtype) / TYPE_LENGTH (eltype); - -- for (i = 0; i < nelt; i++) -- { -- int offset = i * TYPE_LENGTH (eltype); -+ /* Floats and doubles go in f1 .. f13. 32-bit decimal floats are -+ placed in the least significant word. */ -+ if (TYPE_LENGTH (valtype) <= 8 -+ && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) -+ { -+ int regnum = tdep->ppc_fp0_regnum + 1 + index; -+ int offset = 8 - TYPE_LENGTH (valtype); - -- if (TYPE_CODE (eltype) == TYPE_CODE_FLT) -- { -- int regnum = tdep->ppc_fp0_regnum + 1 + i; -- gdb_byte regval[MAX_REGISTER_SIZE]; -- struct type *regtype = register_type (gdbarch, regnum); -+ if (writebuf != NULL) -+ regcache_cooked_write_part (regcache, regnum, -+ offset, TYPE_LENGTH (valtype), writebuf); -+ if (readbuf != NULL) -+ regcache_cooked_read_part (regcache, regnum, -+ offset, TYPE_LENGTH (valtype), readbuf); -+ return 1; -+ } - -- if (writebuf != NULL) -- { -- convert_typed_floating (writebuf + offset, eltype, -- regval, regtype); -- regcache_cooked_write (regcache, regnum, regval); -- } -- if (readbuf != NULL) -- { -- regcache_cooked_read (regcache, regnum, regval); -- convert_typed_floating (regval, regtype, -- readbuf + offset, eltype); -- } -- } -- else -- { -- int regnum = tdep->ppc_gp0_regnum + 3 + i; -- ULONGEST regval; -+ /* IBM long double stored in two consecutive FPRs. */ -+ if (TYPE_LENGTH (valtype) == 16 -+ && TYPE_CODE (valtype) == TYPE_CODE_FLT -+ && (gdbarch_long_double_format (gdbarch) -+ == floatformats_ibm_long_double)) -+ { -+ int regnum = tdep->ppc_fp0_regnum + 1 + 2 * index; - -- if (writebuf != NULL) -- { -- regval = unpack_long (eltype, writebuf + offset); -- regcache_cooked_write_unsigned (regcache, regnum, regval); -- } -- if (readbuf != NULL) -- { -- regcache_cooked_read_unsigned (regcache, regnum, ®val); -- store_unsigned_integer (readbuf + offset, -- TYPE_LENGTH (eltype), byte_order, -- regval); -- } -- } -+ if (writebuf != NULL) -+ { -+ regcache_cooked_write (regcache, regnum, writebuf); -+ regcache_cooked_write (regcache, regnum + 1, writebuf + 8); - } -- -- return RETURN_VALUE_REGISTER_CONVENTION; -+ if (readbuf != NULL) -+ { -+ regcache_cooked_read (regcache, regnum, readbuf); -+ regcache_cooked_read (regcache, regnum + 1, readbuf + 8); -+ } -+ return 1; - } -- /* OpenCL vectors >= 16 bytes are returned in v2..v9. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY -- && TYPE_VECTOR (valtype) -- && TYPE_LENGTH (valtype) >= 16 -- && opencl_abi) -+ -+ /* 128-bit decimal floating-point values are stored in an even/odd -+ pair of FPRs, with the even FPR holding the most significant half. */ -+ if (TYPE_LENGTH (valtype) == 16 -+ && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) - { -- int n_regs = TYPE_LENGTH (valtype) / 16; -- int i; -+ int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index; - -- for (i = 0; i < n_regs; i++) -+ if (writebuf != NULL) - { -- int offset = i * 16; -- int regnum = tdep->ppc_vr0_regnum + 2 + i; -- -- if (writebuf != NULL) -- regcache_cooked_write (regcache, regnum, writebuf + offset); -- if (readbuf != NULL) -- regcache_cooked_read (regcache, regnum, readbuf + offset); -+ regcache_cooked_write (regcache, regnum, writebuf); -+ regcache_cooked_write (regcache, regnum + 1, writebuf + 8); - } -- -- return RETURN_VALUE_REGISTER_CONVENTION; -+ if (readbuf != NULL) -+ { -+ regcache_cooked_read (regcache, regnum, readbuf); -+ regcache_cooked_read (regcache, regnum + 1, readbuf + 8); -+ } -+ return 1; - } -- /* Array type has more than one use. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY) -+ -+ /* AltiVec vectors are returned in VRs starting at v2. */ -+ if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) -+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC) - { -- /* Small character arrays are returned, right justified, in r3. */ -- if (TYPE_LENGTH (valtype) <= 8 -- && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT -- && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) -- { -- int offset = (register_size (gdbarch, tdep->ppc_gp0_regnum + 3) -- - TYPE_LENGTH (valtype)); -- if (writebuf != NULL) -- regcache_cooked_write_part (regcache, tdep->ppc_gp0_regnum + 3, -- offset, TYPE_LENGTH (valtype), writebuf); -- if (readbuf != NULL) -- regcache_cooked_read_part (regcache, tdep->ppc_gp0_regnum + 3, -- offset, TYPE_LENGTH (valtype), readbuf); -- return RETURN_VALUE_REGISTER_CONVENTION; -- } -- /* A VMX vector is returned in v2. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY -- && TYPE_VECTOR (valtype) -- && tdep->vector_abi == POWERPC_VEC_ALTIVEC) -- { -- if (readbuf) -- regcache_cooked_read (regcache, tdep->ppc_vr0_regnum + 2, readbuf); -- if (writebuf) -- regcache_cooked_write (regcache, tdep->ppc_vr0_regnum + 2, -- writebuf); -- return RETURN_VALUE_REGISTER_CONVENTION; -- } -+ int regnum = tdep->ppc_vr0_regnum + 2 + index; -+ -+ if (writebuf != NULL) -+ regcache_cooked_write (regcache, regnum, writebuf); -+ if (readbuf != NULL) -+ regcache_cooked_read (regcache, regnum, readbuf); -+ return 1; - } -- /* Big floating point values get stored in adjacent floating -- point registers, starting with F1. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_FLT -- && (TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 32)) -+ -+ return 0; -+} -+ -+/* The 64 bit ABI return value convention. -+ -+ Return non-zero if the return-value is stored in a register, return -+ 0 if the return-value is instead stored on the stack (a.k.a., -+ struct return convention). -+ -+ For a return-value stored in a register: when WRITEBUF is non-NULL, -+ copy the buffer to the corresponding register return-value location -+ location; when READBUF is non-NULL, fill the buffer from the -+ corresponding register return-value location. */ -+enum return_value_convention -+ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, -+ struct type *valtype, struct regcache *regcache, -+ gdb_byte *readbuf, const gdb_byte *writebuf) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ struct type *func_type = function ? value_type (function) : NULL; -+ int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0; -+ struct type *eltype; -+ int nelt, i, ok; -+ -+ /* This function exists to support a calling convention that -+ requires floating-point registers. It shouldn't be used on -+ processors that lack them. */ -+ gdb_assert (ppc_floating_point_unit_p (gdbarch)); -+ -+ /* Complex types are returned as if two independent scalars. */ -+ if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX) - { -- if (writebuf || readbuf != NULL) -+ eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); -+ -+ for (i = 0; i < 2; i++) - { -- int i; -- for (i = 0; i < TYPE_LENGTH (valtype) / 8; i++) -- { -- if (writebuf != NULL) -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, -- (const bfd_byte *) writebuf + i * 8); -- if (readbuf != NULL) -- regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, -- (bfd_byte *) readbuf + i * 8); -- } -+ ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache, -+ readbuf, writebuf, i); -+ gdb_assert (ok); -+ -+ if (readbuf) -+ readbuf += TYPE_LENGTH (eltype); -+ if (writebuf) -+ writebuf += TYPE_LENGTH (eltype); - } - return RETURN_VALUE_REGISTER_CONVENTION; - } -- /* Complex values get returned in f1:f2, need to convert. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX -- && (TYPE_LENGTH (valtype) == 8 || TYPE_LENGTH (valtype) == 16)) -+ -+ /* OpenCL vectors shorter than 16 bytes are returned as if -+ a series of independent scalars; OpenCL vectors 16 bytes -+ or longer are returned as if a series of AltiVec vectors. */ -+ if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) -+ && opencl_abi) - { -- if (regcache != NULL) -+ if (TYPE_LENGTH (valtype) < 16) -+ eltype = check_typedef (TYPE_TARGET_TYPE (valtype)); -+ else -+ eltype = register_type (gdbarch, tdep->ppc_vr0_regnum); -+ -+ nelt = TYPE_LENGTH (valtype) / TYPE_LENGTH (eltype); -+ for (i = 0; i < nelt; i++) - { -- int i; -- for (i = 0; i < 2; i++) -- { -- gdb_byte regval[MAX_REGISTER_SIZE]; -- struct type *regtype = -- register_type (gdbarch, tdep->ppc_fp0_regnum); -- struct type *target_type; -- target_type = check_typedef (TYPE_TARGET_TYPE (valtype)); -- if (writebuf != NULL) -- { -- convert_typed_floating ((const bfd_byte *) writebuf + -- i * TYPE_LENGTH (target_type), -- target_type, regval, regtype); -- regcache_cooked_write (regcache, -- tdep->ppc_fp0_regnum + 1 + i, -- regval); -- } -- if (readbuf != NULL) -- { -- regcache_cooked_read (regcache, -- tdep->ppc_fp0_regnum + 1 + i, -- regval); -- convert_typed_floating (regval, regtype, -- (bfd_byte *) readbuf + -- i * TYPE_LENGTH (target_type), -- target_type); -- } -- } -+ ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache, -+ readbuf, writebuf, i); -+ gdb_assert (ok); -+ -+ if (readbuf) -+ readbuf += TYPE_LENGTH (eltype); -+ if (writebuf) -+ writebuf += TYPE_LENGTH (eltype); - } - return RETURN_VALUE_REGISTER_CONVENTION; - } -- /* Big complex values get stored in f1:f4. */ -- if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX && TYPE_LENGTH (valtype) == 32) -+ -+ /* All pointers live in r3. */ -+ if (TYPE_CODE (valtype) == TYPE_CODE_PTR -+ || TYPE_CODE (valtype) == TYPE_CODE_REF) - { -- if (regcache != NULL) -- { -- int i; -- for (i = 0; i < 4; i++) -- { -- if (writebuf != NULL) -- regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1 + i, -- (const bfd_byte *) writebuf + i * 8); -- if (readbuf != NULL) -- regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1 + i, -- (bfd_byte *) readbuf + i * 8); -- } -- } -+ int regnum = tdep->ppc_gp0_regnum + 3; -+ -+ if (writebuf != NULL) -+ regcache_cooked_write (regcache, regnum, writebuf); -+ if (readbuf != NULL) -+ regcache_cooked_read (regcache, regnum, readbuf); - return RETURN_VALUE_REGISTER_CONVENTION; - } -+ -+ /* Small character arrays are returned, right justified, in r3. */ -+ if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY -+ && TYPE_LENGTH (valtype) <= 8 -+ && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT -+ && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) -+ { -+ int regnum = tdep->ppc_gp0_regnum + 3; -+ int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype)); -+ -+ if (writebuf != NULL) -+ regcache_cooked_write_part (regcache, regnum, -+ offset, TYPE_LENGTH (valtype), writebuf); -+ if (readbuf != NULL) -+ regcache_cooked_read_part (regcache, regnum, -+ offset, TYPE_LENGTH (valtype), readbuf); -+ return RETURN_VALUE_REGISTER_CONVENTION; -+ } -+ -+ /* Handle plain base types. */ -+ if (ppc64_sysv_abi_return_value_base (gdbarch, valtype, regcache, -+ readbuf, writebuf, 0)) -+ return RETURN_VALUE_REGISTER_CONVENTION; -+ - return RETURN_VALUE_STRUCT_CONVENTION; - } - diff --git a/gdb-upstream-ppc64le05of15.patch b/gdb-upstream-ppc64le05of15.patch deleted file mode 100644 index fa3fda0..0000000 --- a/gdb-upstream-ppc64le05of15.patch +++ /dev/null @@ -1,44 +0,0 @@ -commit d63167affc2a56189e3ba2cc47dd9a3451208b59 -Author: Ulrich Weigand -Date: Tue Feb 4 18:26:26 2014 +0100 - - PowerPC64 little-endian fixes: structure passing - - When passing a small structure in a GPR, the ABI specifies that it - should be passed in the least-significant bytes of the register - (or stack slot). On big-endian systems, this means the value - needs to be stored at an offset, which is what current code does. - - However, on little-endian systems, the least-significant bytes are - addresses with offset 0. This patch fixes that. - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct - offset on little-endian when passing small structures. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,10 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct -+ offset on little-endian when passing small structures. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (get_decimal_float_return_value): Update comment. - (struct ppc64_sysv_argpos): New data structure. - (ppc64_sysv_abi_push_float): Remove. ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1150,7 +1150,8 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, - doubleword are right-aligned and those larger are left-aligned. - GCC versions before 3.4 implemented this incorrectly; see - . */ -- if (len < tdep->wordsize) -+ if (len < tdep->wordsize -+ && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) - offset = tdep->wordsize - len; - - if (argpos->regcache) diff --git a/gdb-upstream-ppc64le06of15.patch b/gdb-upstream-ppc64le06of15.patch deleted file mode 100644 index d03258d..0000000 --- a/gdb-upstream-ppc64le06of15.patch +++ /dev/null @@ -1,67 +0,0 @@ -commit 6ed14ff33979bc48367c35b1b235fef8c5e2229b -Author: Ulrich Weigand -Date: Tue Feb 4 18:28:24 2014 +0100 - - PowerPC64 little-endian fixes: AltiVec tests - - A couple of AltiVec tests fail spuriously on powerpc64le-linux, because - they compare against an incorrect pattern. Note that those tests already - contain little-endian variants of the patterns, but those seem to have - bit-rotted a bit: when outputting a vector, GDB no longer omits trailing - zero elements (as it used to do in the past). - - This patch updates the pattern to the new GDB output behavior. - - In addition, the patch updates the endian test to use the new - gdb_test_multiple logic instead of gdb_expect. - - gdb/testsuite/ChangeLog: - - * gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test. - (decimal_vector): Fix for little-endian. - -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,3 +1,8 @@ -+2014-02-04 Ulrich Weigand -+ -+ * gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test. -+ (decimal_vector): Fix for little-endian. -+ - 2014-01-29 Jose E. Marchesi - - * gdb.arch/sparc-sysstep.exp: New file. ---- a/gdb/testsuite/gdb.arch/altivec-regs.exp -+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp -@@ -79,17 +79,16 @@ gdb_test "set \$vrsave = 1" "" "" - - gdb_test "next" "" "" - --send_gdb "show endian\n" - set endianness "" --gdb_expect { -+set msg "detect endianness" -+gdb_test_multiple "show endian" "$msg" { - -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" { -- pass "endianness" -- set endianness $expect_out(2,string) -+ pass "$msg" -+ set endianness $expect_out(2,string) - } - -re ".*$gdb_prompt $" { -- fail "couldn't get endianness" -+ fail "$msg" - } -- timeout { fail "(timeout) endianness" } - } - - # And then read the AltiVec registers back, to see that -@@ -118,7 +117,7 @@ gdb_test "info reg vscr" "vscr.*0x1\t1" "info reg vscr" - if {$endianness == "big"} { - set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.." - } else { -- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.." -+ set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.." - } - - for {set i 0} {$i < 32} {incr i 1} { diff --git a/gdb-upstream-ppc64le07of15.patch b/gdb-upstream-ppc64le07of15.patch deleted file mode 100644 index c48d419..0000000 --- a/gdb-upstream-ppc64le07of15.patch +++ /dev/null @@ -1,149 +0,0 @@ -commit 084ee54552f6c35d740e8b9bc81a4fe8d8bb178b -Author: Ulrich Weigand -Date: Tue Feb 4 18:31:38 2014 +0100 - - PowerPC64 little-endian fixes: VSX tests and pseudo-regs - - Many VSX test were failing on powerpc64le-linux, since -as opposed to the - AltiVec tests- there never were little-endian versions of the test patterns. - - This patch adds such patterns, along the lines of altivec-regs.exp. - - In addition, there is an actual code change required: For those VSX - registers that overlap a floating-point register, the FP register - overlaps the most-significant half of the VSX register both on big- - and little-endian systems. However, on little-endian systems, that - half is stored at an offset of 8 bytes (not 0). This works already - for the "real" FP registers, but current code gets it wrong for - the "extended" pseudo FP register GDB generates for the second - half of the VSX register bank. - - This patch updates the corresponding pseudo read/write routines - to take the appropriate offset into consideration. - - gdb/ChangeLog: - - * rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset - of the overlapped FP register within the VSX register on little- - endian platforms. - (efpr_pseudo_register_write): Likewise. - - gdb/testsuite/ChangeLog: - - * gdb.arch/vsx-regs.exp: Check target endianness. Provide variants - of the test patterns for use on little-endian systems. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,12 @@ - 2014-02-04 Ulrich Weigand  - -+ * rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset -+ of the overlapped FP register within the VSX register on little- -+ endian platforms. -+ (efpr_pseudo_register_write): Likewise. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_val): Use correct - offset on little-endian when passing small structures. - ---- a/gdb/rs6000-tdep.c -+++ b/gdb/rs6000-tdep.c -@@ -2779,10 +2779,12 @@ efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - int reg_index = reg_nr - tdep->ppc_efpr0_regnum; -+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8; - - /* Read the portion that overlaps the VMX register. */ -- return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0, -- register_size (gdbarch, reg_nr), buffer); -+ return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index, -+ offset, register_size (gdbarch, reg_nr), -+ buffer); - } - - /* Write method for POWER7 Extended FP pseudo-registers. */ -@@ -2792,10 +2794,12 @@ efpr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - int reg_index = reg_nr - tdep->ppc_efpr0_regnum; -+ int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8; - - /* Write the portion that overlaps the VMX register. */ -- regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, 0, -- register_size (gdbarch, reg_nr), buffer); -+ regcache_raw_write_part (regcache, tdep->ppc_vr0_regnum + reg_index, -+ offset, register_size (gdbarch, reg_nr), -+ buffer); - } - - static enum register_status -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,5 +1,10 @@ - 2014-02-04 Ulrich Weigand - -+ * gdb.arch/vsx-regs.exp: Check target endianness. Provide variants -+ of the test patterns for use on little-endian systems. -+ -+2014-02-04 Ulrich Weigand -+ - * gdb.arch/altivec-regs.exp: Use gdb_test_multiple for endian test. - (decimal_vector): Fix for little-endian. - ---- a/gdb/testsuite/gdb.arch/vsx-regs.exp -+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp -@@ -58,19 +58,45 @@ if ![runto_main] then { - gdb_suppress_tests - } - -+set endianness "" -+set msg "detect endianness" -+gdb_test_multiple "show endian" "$msg" { -+ -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" { -+ pass "$msg" -+ set endianness $expect_out(2,string) -+ } -+ -re ".*$gdb_prompt $" { -+ fail "$msg" -+ } -+} -+ - # Data sets used throughout the test - --set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.." -+if {$endianness == "big"} { -+ set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x1, 0x0., v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x0, 0x0., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x0, 0x0, 0x0., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0.." -+ -+ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." - --set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x1, 0xf99999a0, 0x0, 0x0., v4_int32 = .0x3ff4cccc, 0xcccccccc, 0x1, 0x1., v8_int16 = .0x3ff4, 0xcccc, 0xcccc, 0xcccc, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x3f, 0xf4, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." -+ set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." - --set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." -+ set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." - --set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.." -+ set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." -+ -+ set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." -+} else { -+ set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." - --set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." -+ set vector_register1_vr ".uint128 = 0x3ff4cccccccccccc0000000100000001, v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x1, 0x1, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.." - --set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.." -+ set vector_register2 "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v2_double = .0x1, 0x1., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." -+ -+ set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.." -+ -+ set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." -+ -+ set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.." -+} - - set float_register ".raw 0xdeadbeefdeadbeef." - diff --git a/gdb-upstream-ppc64le08of15.patch b/gdb-upstream-ppc64le08of15.patch deleted file mode 100644 index 292ff3b..0000000 --- a/gdb-upstream-ppc64le08of15.patch +++ /dev/null @@ -1,57 +0,0 @@ -commit 5b757e5ddbd9ad252d9c51103f1aa52b41c2e947 -Author: Ulrich Weigand -Date: Tue Feb 4 18:33:04 2014 +0100 - - PowerPC64 little-endian fixes: 32-bit DFP parameters - - Passing a 32-bit DFP in register needs to use the least-significant part - of the register. Like with a previous patch that addressed the same - issue for small structs, this patch makes sure the appropriate offset - is used on little-endian systems. - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct - offset on little-endian when passing _Decimal32. - (ppc64_sysv_abi_return_value_base): Likewise for return values. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,11 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct -+ offset on little-endian when passing _Decimal32. -+ (ppc64_sysv_abi_return_value_base): Likewise for return values. -+ -+2014-02-04 Ulrich Weigand  -+ - * rs6000-tdep.c (efpr_pseudo_register_read): Use correct offset - of the overlapped FP register within the VSX register on little- - endian platforms. ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1232,7 +1232,10 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, - if (argpos->regcache && argpos->freg <= 13) - { - int regnum = tdep->ppc_fp0_regnum + argpos->freg; -- int offset = 8 - TYPE_LENGTH (type); -+ int offset = 0; -+ -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) -+ offset = 8 - TYPE_LENGTH (type); - - regcache_cooked_write_part (argpos->regcache, regnum, - offset, TYPE_LENGTH (type), val); -@@ -1641,7 +1644,10 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, - && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) - { - int regnum = tdep->ppc_fp0_regnum + 1 + index; -- int offset = 8 - TYPE_LENGTH (valtype); -+ int offset = 0; -+ -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) -+ offset = 8 - TYPE_LENGTH (valtype); - - if (writebuf != NULL) - regcache_cooked_write_part (regcache, regnum, diff --git a/gdb-upstream-ppc64le09of15.patch b/gdb-upstream-ppc64le09of15.patch deleted file mode 100644 index 94f7edd..0000000 --- a/gdb-upstream-ppc64le09of15.patch +++ /dev/null @@ -1,140 +0,0 @@ -commit 0ff3e01fdc67a3842ee54224cf197e9a55f0a750 -Author: Ulrich Weigand -Date: Tue Feb 4 18:34:19 2014 +0100 - - PowerPC64 little-endian fixes: 128-bit DFP parameters / registers - - The powerpc64le-linux ABI specifies that when a 128-bit DFP value is - passed in a pair of floating-point registers, the first register holds - the most-significant part of the value. This is as opposed to the - usual rule on little-endian systems, where the first register would - hold the least-significant part. - - This affects two places in GDB, the read/write routines for the - 128-bit DFP pseudo-registers, and the function call / return - sequence. For the former, current code already distinguishes - between big- and little-endian targets, but gets the latter - wrong. This is presumably because *GCC* also got it wrong, - and GDB matches the old GCC behavior. But GCC is now fixed: - http://gcc.gnu.org/ml/gcc-patches/2013-11/msg02145.html - so GDB needs to be fixed too. (Old code shouldn't really be - an issue since there is no code "out there" so far that uses - dfp128 on little-endian ...) - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order - within a register pair holding a DFP 128-bit value on little-endian. - (ppc64_sysv_abi_return_value_base): Likewise. - * rs6000-tdep.c (dfp_pseudo_register_read): Likewise. - (dfp_pseudo_register_write): Likewise. - - gdb/testsuite/ChangeLog: - - * gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,13 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order -+ within a register pair holding a DFP 128-bit value on little-endian. -+ (ppc64_sysv_abi_return_value_base): Likewise. -+ * rs6000-tdep.c (dfp_pseudo_register_read): Likewise. -+ (dfp_pseudo_register_write): Likewise. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct - offset on little-endian when passing _Decimal32. - (ppc64_sysv_abi_return_value_base): Likewise for return values. ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1270,9 +1270,11 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, - if (argpos->regcache && argpos->freg <= 12) - { - int regnum = tdep->ppc_fp0_regnum + argpos->freg; -+ int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0; -+ int hipart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8; - -- regcache_cooked_write (argpos->regcache, regnum, val); -- regcache_cooked_write (argpos->regcache, regnum + 1, val + 8); -+ regcache_cooked_write (argpos->regcache, regnum, val + hipart); -+ regcache_cooked_write (argpos->regcache, regnum + 1, val + lopart); - } - - argpos->freg += 2; -@@ -1685,16 +1687,18 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, - && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) - { - int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index; -+ int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0; -+ int hipart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8; - - if (writebuf != NULL) - { -- regcache_cooked_write (regcache, regnum, writebuf); -- regcache_cooked_write (regcache, regnum + 1, writebuf + 8); -+ regcache_cooked_write (regcache, regnum, writebuf + hipart); -+ regcache_cooked_write (regcache, regnum + 1, writebuf + lopart); - } - if (readbuf != NULL) - { -- regcache_cooked_read (regcache, regnum, readbuf); -- regcache_cooked_read (regcache, regnum + 1, readbuf + 8); -+ regcache_cooked_read (regcache, regnum, readbuf + hipart); -+ regcache_cooked_read (regcache, regnum + 1, readbuf + lopart); - } - return 1; - } ---- a/gdb/rs6000-tdep.c -+++ b/gdb/rs6000-tdep.c -@@ -2672,10 +2672,10 @@ dfp_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, - else - { - status = regcache_raw_read (regcache, tdep->ppc_fp0_regnum + -- 2 * reg_index + 1, buffer + 8); -+ 2 * reg_index + 1, buffer); - if (status == REG_VALID) - status = regcache_raw_read (regcache, tdep->ppc_fp0_regnum + -- 2 * reg_index, buffer); -+ 2 * reg_index, buffer + 8); - } - - return status; -@@ -2701,9 +2701,9 @@ dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, - else - { - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + -- 2 * reg_index + 1, buffer + 8); -+ 2 * reg_index + 1, buffer); - regcache_raw_write (regcache, tdep->ppc_fp0_regnum + -- 2 * reg_index, buffer); -+ 2 * reg_index, buffer + 8); - } - } - -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,5 +1,9 @@ - 2014-02-04 Ulrich Weigand - -+ * gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*. -+ -+2014-02-04 Ulrich Weigand -+ - * gdb.arch/vsx-regs.exp: Check target endianness. Provide variants - of the test patterns for use on little-endian systems. - ---- a/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp -+++ b/gdb/testsuite/gdb.arch/powerpc-d128-regs.exp -@@ -20,7 +20,7 @@ - - # Testcase for ppc decimal128 pseudo-registers. - --if ![istarget "powerpc64-*"] then { -+if ![istarget "powerpc64*-*"] then { - verbose "Skipping powerpc Decimal128 pseudo-registers testcase." - return - } diff --git a/gdb-upstream-ppc64le10of15.patch b/gdb-upstream-ppc64le10of15.patch deleted file mode 100644 index 2e307d9..0000000 --- a/gdb-upstream-ppc64le10of15.patch +++ /dev/null @@ -1,159 +0,0 @@ -commit cd453cd072004d26ede355b850b3831acffaeddd -Author: Ulrich Weigand -Date: Tue Feb 4 18:38:56 2014 +0100 - - PowerPC64 ELFv2 ABI: base support - - This is the first patch of a series to implement support for the - PowerPC ELFv2 ABI. While powerpc64le-linux will use ELFv2, and - the existing powerpc64-linux code will continue to use ELFv1, - in theory ELFv2 is also defined for big-endian systems (and - ELFv1 was also defined for little-endian systems). - - Therefore this patch adds a new tdep->elf_abi variable to decide - which ABI version to use. This is detected from the ELF header - e_flags value; if this is not present, we default to ELFv2 on - little-endian and ELFv1 otherwise. - - This patch does not yet introduce any actual difference in GDB's - handling of the two ABIs. Those will be added by the remainder - of this patch series. - - For an overview of the changes in ELFv2, have a look at the - comments in the patch series that added ELFv2 to GCC, starting at: - http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01144.html - - gdb/ChangeLog: - - * ppc-tdep.h (enum powerpc_elf_abi): New data type. - (struct gdbarch_tdep): New member elf_abi. - - * rs6000-tdep.c: Include "elf/ppc64.h". - (rs6000_gdbarch_init): Detect ELF ABI version. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,13 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-tdep.h (enum powerpc_elf_abi): New data type. -+ (struct gdbarch_tdep): New member elf_abi. -+ -+ * rs6000-tdep.c: Include "elf/ppc64.h". -+ (rs6000_gdbarch_init): Detect ELF ABI version. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_freg): Use correct order - within a register pair holding a DFP 128-bit value on little-endian. - (ppc64_sysv_abi_return_value_base): Likewise. -Index: gdb-7.7.1/gdb/ppc-tdep.h -=================================================================== ---- gdb-7.7.1.orig/gdb/ppc-tdep.h 2014-05-09 19:23:40.892248064 +0200 -+++ gdb-7.7.1/gdb/ppc-tdep.h 2014-05-09 19:23:42.346248246 +0200 -@@ -182,6 +182,15 @@ extern void ppc_collect_vsxregset (const - - /* Private data that this module attaches to struct gdbarch. */ - -+/* ELF ABI version used by the inferior. */ -+enum powerpc_elf_abi -+{ -+ POWERPC_ELF_AUTO, -+ POWERPC_ELF_V1, -+ POWERPC_ELF_V2, -+ POWERPC_ELF_LAST -+}; -+ - /* Vector ABI used by the inferior. */ - enum powerpc_vector_abi - { -@@ -197,6 +206,8 @@ struct gdbarch_tdep - int wordsize; /* Size in bytes of fixed-point word. */ - int soft_float; /* Avoid FP registers for arguments? */ - -+ enum powerpc_elf_abi elf_abi; /* ELF ABI version. */ -+ - /* How to pass vector arguments. Never set to AUTO or LAST. */ - enum powerpc_vector_abi vector_abi; - -Index: gdb-7.7.1/gdb/rs6000-tdep.c -=================================================================== ---- gdb-7.7.1.orig/gdb/rs6000-tdep.c 2014-05-09 19:23:40.894248064 +0200 -+++ gdb-7.7.1/gdb/rs6000-tdep.c 2014-05-09 19:23:57.974250197 +0200 -@@ -48,6 +48,7 @@ - - #include "elf-bfd.h" - #include "elf/ppc.h" -+#include "elf/ppc64.h" - - #include "solib-svr4.h" - #include "ppc-tdep.h" -@@ -3554,6 +3555,7 @@ rs6000_gdbarch_init (struct gdbarch_info - enum auto_boolean soft_float_flag = powerpc_soft_float_global; - int soft_float; - enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global; -+ enum powerpc_elf_abi elf_abi = POWERPC_ELF_AUTO; - int have_fpu = 1, have_spe = 0, have_mq = 0, have_altivec = 0, have_dfp = 0, - have_vsx = 0; - int tdesc_wordsize = -1; -@@ -3860,6 +3862,21 @@ rs6000_gdbarch_init (struct gdbarch_info - } - - #ifdef HAVE_ELF -+ if (from_elf_exec) -+ { -+ switch (elf_elfheader (info.abfd)->e_flags & EF_PPC64_ABI) -+ { -+ case 1: -+ elf_abi = POWERPC_ELF_V1; -+ break; -+ case 2: -+ elf_abi = POWERPC_ELF_V2; -+ break; -+ default: -+ break; -+ } -+ } -+ - if (soft_float_flag == AUTO_BOOLEAN_AUTO && from_elf_exec) - { - switch (bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU, -@@ -3896,6 +3913,21 @@ rs6000_gdbarch_init (struct gdbarch_info - } - #endif - -+ /* At this point, the only supported ELF-based 64-bit little-endian -+ operating system is GNU/Linux, and this uses the ELFv2 ABI by -+ default. All other supported ELF-based operating systems use the -+ ELFv1 ABI by default. Therefore, if the ABI marker is missing, -+ e.g. because we run a legacy binary, or have attached to a process -+ and have not found any associated binary file, set the default -+ according to this heuristic. */ -+ if (elf_abi == POWERPC_ELF_AUTO) -+ { -+ if (wordsize == 8 && info.byte_order == BFD_ENDIAN_LITTLE) -+ elf_abi = POWERPC_ELF_V2; -+ else -+ elf_abi = POWERPC_ELF_V1; -+ } -+ - if (soft_float_flag == AUTO_BOOLEAN_TRUE) - soft_float = 1; - else if (soft_float_flag == AUTO_BOOLEAN_FALSE) -@@ -3938,6 +3970,8 @@ rs6000_gdbarch_init (struct gdbarch_info - meaningful, because 64-bit CPUs can run in 32-bit mode. So, perform - separate word size check. */ - tdep = gdbarch_tdep (arches->gdbarch); -+ if (tdep && tdep->elf_abi != elf_abi) -+ continue; - if (tdep && tdep->soft_float != soft_float) - continue; - if (tdep && tdep->vector_abi != vector_abi) -@@ -3960,6 +3994,7 @@ rs6000_gdbarch_init (struct gdbarch_info - - tdep = XCALLOC (1, struct gdbarch_tdep); - tdep->wordsize = wordsize; -+ tdep->elf_abi = elf_abi; - tdep->soft_float = soft_float; - tdep->vector_abi = vector_abi; - diff --git a/gdb-upstream-ppc64le11of15.patch b/gdb-upstream-ppc64le11of15.patch deleted file mode 100644 index fdbd7ab..0000000 --- a/gdb-upstream-ppc64le11of15.patch +++ /dev/null @@ -1,132 +0,0 @@ -commit d4094b6a8883ae481c7644c5a210254efe92e9ad -Author: Ulrich Weigand -Date: Tue Feb 4 18:40:16 2014 +0100 - - PowerPC64 ELFv2 ABI: no function descriptors - - This implements the most significant difference with the ELFv2 ABI: - we no longer use function descriptors. The patch consists mostly - of switching off code to deal with descriptors :-) - - In addition, when calling an inferior function, we no longer need - to provide its TOC in r2. Instead, ELFv2 code expects to be called - with r12 pointing to the code address itself. - - gdb/ChangeLog: - - * ppc-linux-tdep.c (ppc_linux_init_abi): Only call - set_gdbarch_convert_from_func_ptr_addr and - set_gdbarch_elf_make_msymbol_special for ELFv1. - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle - function descriptors on ELFv1. - (ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2, - set up r12 at function entry. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,15 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-linux-tdep.c (ppc_linux_init_abi): Only call -+ set_gdbarch_convert_from_func_ptr_addr and -+ set_gdbarch_elf_make_msymbol_special for ELFv1. -+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_param): Only handle -+ function descriptors on ELFv1. -+ (ppc64_sysv_abi_push_dummy_call): Likewise. On ELFv2, -+ set up r12 at function entry. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-tdep.h (enum powerpc_elf_abi): New data type. - (struct gdbarch_tdep): New member elf_abi. - ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -1339,13 +1339,16 @@ ppc_linux_init_abi (struct gdbarch_info info, - - if (tdep->wordsize == 8) - { -- /* Handle PPC GNU/Linux 64-bit function pointers (which are really -- function descriptors). */ -- set_gdbarch_convert_from_func_ptr_addr -- (gdbarch, ppc64_convert_from_func_ptr_addr); -+ if (tdep->elf_abi == POWERPC_ELF_V1) -+ { -+ /* Handle PPC GNU/Linux 64-bit function pointers (which are really -+ function descriptors). */ -+ set_gdbarch_convert_from_func_ptr_addr -+ (gdbarch, ppc64_convert_from_func_ptr_addr); - -- set_gdbarch_elf_make_msymbol_special (gdbarch, -- ppc64_elf_make_msymbol_special); -+ set_gdbarch_elf_make_msymbol_special -+ (gdbarch, ppc64_elf_make_msymbol_special); -+ } - - /* Shared library handling. */ - set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1352,8 +1352,9 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, - word = unpack_long (type, val); - - /* Convert any function code addresses into descriptors. */ -- if (TYPE_CODE (type) == TYPE_CODE_PTR -- || TYPE_CODE (type) == TYPE_CODE_REF) -+ if (tdep->elf_abi == POWERPC_ELF_V1 -+ && (TYPE_CODE (type) == TYPE_CODE_PTR -+ || TYPE_CODE (type) == TYPE_CODE_REF)) - { - struct type *target_type - = check_typedef (TYPE_TARGET_TYPE (type)); -@@ -1553,24 +1554,32 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - breakpoint. */ - regcache_cooked_write_signed (regcache, tdep->ppc_lr_regnum, bp_addr); - -- /* Use the func_addr to find the descriptor, and use that to find -- the TOC. If we're calling via a function pointer, the pointer -- itself identifies the descriptor. */ -- { -- struct type *ftype = check_typedef (value_type (function)); -- CORE_ADDR desc_addr = value_as_address (function); -- -- if (TYPE_CODE (ftype) == TYPE_CODE_PTR -- || convert_code_addr_to_desc_addr (func_addr, &desc_addr)) -- { -- /* The TOC is the second double word in the descriptor. */ -- CORE_ADDR toc = -- read_memory_unsigned_integer (desc_addr + tdep->wordsize, -- tdep->wordsize, byte_order); -- regcache_cooked_write_unsigned (regcache, -- tdep->ppc_gp0_regnum + 2, toc); -- } -- } -+ /* In the ELFv1 ABI, use the func_addr to find the descriptor, and use -+ that to find the TOC. If we're calling via a function pointer, -+ the pointer itself identifies the descriptor. */ -+ if (tdep->elf_abi == POWERPC_ELF_V1) -+ { -+ struct type *ftype = check_typedef (value_type (function)); -+ CORE_ADDR desc_addr = value_as_address (function); -+ -+ if (TYPE_CODE (ftype) == TYPE_CODE_PTR -+ || convert_code_addr_to_desc_addr (func_addr, &desc_addr)) -+ { -+ /* The TOC is the second double word in the descriptor. */ -+ CORE_ADDR toc = -+ read_memory_unsigned_integer (desc_addr + tdep->wordsize, -+ tdep->wordsize, byte_order); -+ -+ regcache_cooked_write_unsigned (regcache, -+ tdep->ppc_gp0_regnum + 2, toc); -+ } -+ } -+ -+ /* In the ELFv2 ABI, we need to pass the target address in r12 since -+ we may be calling a global entry point. */ -+ if (tdep->elf_abi == POWERPC_ELF_V2) -+ regcache_cooked_write_unsigned (regcache, -+ tdep->ppc_gp0_regnum + 12, func_addr); - - return sp; - } diff --git a/gdb-upstream-ppc64le12of15.patch b/gdb-upstream-ppc64le12of15.patch deleted file mode 100644 index 3b38682..0000000 --- a/gdb-upstream-ppc64le12of15.patch +++ /dev/null @@ -1,48 +0,0 @@ -commit 52f548e41f085550d7740c350c1c8a239532af77 -Author: Ulrich Weigand -Date: Tue Feb 4 18:41:36 2014 +0100 - - PowerPC64 ELFv2 ABI: stack frame layout changes - - This implementes another change in ELFv2: the stack frame no longer - contains the reserved double words for linker and compiler use - (which weren't really used for much of anything anyway). This - affects placement of on-stack parameters in inferior calls. - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct - offset to the stack parameter list for the ELFv2 ABI. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,10 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct -+ offset to the stack parameter list for the ELFv2 ABI. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-linux-tdep.c (ppc_linux_init_abi): Only call - set_gdbarch_convert_from_func_ptr_addr and - set_gdbarch_elf_make_msymbol_special for ELFv1. ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1474,9 +1474,13 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, - argpos.regcache = regcache; - argpos.refparam = align_down (sp - refparam_size, 16); - argpos.gparam = align_down (argpos.refparam - gparam_size, 16); -- /* Add in space for the TOC, link editor double word, -- compiler double word, LR save area, CR save area. */ -- sp = align_down (argpos.gparam - 48, 16); -+ /* Add in space for the TOC, link editor double word (v1 only), -+ compiler double word (v1 only), LR save area, CR save area, -+ and backchain. */ -+ if (tdep->elf_abi == POWERPC_ELF_V1) -+ sp = align_down (argpos.gparam - 48, 16); -+ else -+ sp = align_down (argpos.gparam - 32, 16); - } - - /* If the function is returning a `struct', then there is an diff --git a/gdb-upstream-ppc64le13of15.patch b/gdb-upstream-ppc64le13of15.patch deleted file mode 100644 index 79ce599..0000000 --- a/gdb-upstream-ppc64le13of15.patch +++ /dev/null @@ -1,309 +0,0 @@ -commit cc0e89c519912e0e4e75a2fc0d836f715cdc6806 -Author: Ulrich Weigand -Date: Tue Feb 4 18:42:35 2014 +0100 - - PowerPC64 ELFv2 ABI: structure passing / return - - Another significant difference in the ELFv2 ABI is that "homogeneous" - floating-point and vector aggregates, i.e. aggregates the consist - (recursively) only of members of the same floating-point or vector type, - are passed in a series of floating-point / vector registers, as if they - were seperate parameters. (This is similar to the ARM ABI.) This - applies to both calls and returns. - - In addition when returning any aggregate of up to 16 bytes, ELFv2 now - used general-purpose registers. - - This patch adds support for these aspects of the ABI, which is relatively - straightforward after the refactoring patch to ppc-sysv-tdep.c. - - gdb/ChangeLog: - - * ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine. - (ppc64_elfv2_abi_homogeneous_aggregate): Likewise. - (ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs. - (ppc64_sysv_abi_return_value): Likewise. Also, handle small - structures returned in GPRs. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,13 @@ - 2014-02-04 Ulrich Weigand  - -+ * ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine. -+ (ppc64_elfv2_abi_homogeneous_aggregate): Likewise. -+ (ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs. -+ (ppc64_sysv_abi_return_value): Likewise. Also, handle small -+ structures returned in GPRs. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (ppc64_sysv_abi_push_dummy_call): Use correct - offset to the stack parameter list for the ELFv2 ABI. - ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -1101,6 +1101,160 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) - return 1; - } - -+/* Walk down the type tree of TYPE counting consecutive base elements. -+ If *FIELD_TYPE is NULL, then set it to the first valid floating point -+ or vector type. If a non-floating point or vector type is found, or -+ if a floating point or vector type that doesn't match a non-NULL -+ *FIELD_TYPE is found, then return -1, otherwise return the count in the -+ sub-tree. */ -+ -+static LONGEST -+ppc64_aggregate_candidate (struct type *type, -+ struct type **field_type) -+{ -+ type = check_typedef (type); -+ -+ switch (TYPE_CODE (type)) -+ { -+ case TYPE_CODE_FLT: -+ case TYPE_CODE_DECFLOAT: -+ if (!*field_type) -+ *field_type = type; -+ if (TYPE_CODE (*field_type) == TYPE_CODE (type) -+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) -+ return 1; -+ break; -+ -+ case TYPE_CODE_COMPLEX: -+ type = TYPE_TARGET_TYPE (type); -+ if (TYPE_CODE (type) == TYPE_CODE_FLT -+ || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) -+ { -+ if (!*field_type) -+ *field_type = type; -+ if (TYPE_CODE (*field_type) == TYPE_CODE (type) -+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) -+ return 2; -+ } -+ break; -+ -+ case TYPE_CODE_ARRAY: -+ if (TYPE_VECTOR (type)) -+ { -+ if (!*field_type) -+ *field_type = type; -+ if (TYPE_CODE (*field_type) == TYPE_CODE (type) -+ && TYPE_LENGTH (*field_type) == TYPE_LENGTH (type)) -+ return 1; -+ } -+ else -+ { -+ LONGEST count, low_bound, high_bound; -+ -+ count = ppc64_aggregate_candidate -+ (TYPE_TARGET_TYPE (type), field_type); -+ if (count == -1) -+ return -1; -+ -+ if (!get_array_bounds (type, &low_bound, &high_bound)) -+ return -1; -+ count *= high_bound - low_bound; -+ -+ /* There must be no padding. */ -+ if (count == 0) -+ return TYPE_LENGTH (type) == 0 ? 0 : -1; -+ else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type)) -+ return -1; -+ -+ return count; -+ } -+ break; -+ -+ case TYPE_CODE_STRUCT: -+ case TYPE_CODE_UNION: -+ { -+ LONGEST count = 0; -+ int i; -+ -+ for (i = 0; i < TYPE_NFIELDS (type); i++) -+ { -+ LONGEST sub_count; -+ -+ if (field_is_static (&TYPE_FIELD (type, i))) -+ continue; -+ -+ sub_count = ppc64_aggregate_candidate -+ (TYPE_FIELD_TYPE (type, i), field_type); -+ if (sub_count == -1) -+ return -1; -+ -+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT) -+ count += sub_count; -+ else -+ count = max (count, sub_count); -+ } -+ -+ /* There must be no padding. */ -+ if (count == 0) -+ return TYPE_LENGTH (type) == 0 ? 0 : -1; -+ else if (TYPE_LENGTH (type) != count * TYPE_LENGTH (*field_type)) -+ return -1; -+ -+ return count; -+ } -+ break; -+ -+ default: -+ break; -+ } -+ -+ return -1; -+} -+ -+/* If an argument of type TYPE is a homogeneous float or vector aggregate -+ that shall be passed in FP/vector registers according to the ELFv2 ABI, -+ return the homogeneous element type in *ELT_TYPE and the number of -+ elements in *N_ELTS, and return non-zero. Otherwise, return zero. */ -+ -+static int -+ppc64_elfv2_abi_homogeneous_aggregate (struct type *type, -+ struct type **elt_type, int *n_elts) -+{ -+ /* Complex types at the top level are treated separately. However, -+ complex types can be elements of homogeneous aggregates. */ -+ if (TYPE_CODE (type) == TYPE_CODE_STRUCT -+ || TYPE_CODE (type) == TYPE_CODE_UNION -+ || (TYPE_CODE (type) == TYPE_CODE_ARRAY && !TYPE_VECTOR (type))) -+ { -+ struct type *field_type = NULL; -+ LONGEST field_count = ppc64_aggregate_candidate (type, &field_type); -+ -+ if (field_count > 0) -+ { -+ int n_regs = ((TYPE_CODE (field_type) == TYPE_CODE_FLT -+ || TYPE_CODE (field_type) == TYPE_CODE_DECFLOAT)? -+ (TYPE_LENGTH (field_type) + 7) >> 3 : 1); -+ -+ /* The ELFv2 ABI allows homogeneous aggregates to occupy -+ up to 8 registers. */ -+ if (field_count * n_regs <= 8) -+ { -+ if (elt_type) -+ *elt_type = field_type; -+ if (n_elts) -+ *n_elts = (int) field_count; -+ /* Note that field_count is LONGEST since it may hold the size -+ of an array, while *n_elts is int since its value is bounded -+ by the number of registers used for argument passing. The -+ cast cannot overflow due to the bounds checking above. */ -+ return 1; -+ } -+ } -+ } -+ -+ return 0; -+} -+ - /* Structure holding the next argument position. */ - struct ppc64_sysv_argpos - { -@@ -1389,6 +1543,29 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, - if (TYPE_CODE (type) == TYPE_CODE_FLT) - ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos); - } -+ -+ /* In the ELFv2 ABI, homogeneous floating-point or vector -+ aggregates are passed in a series of registers. */ -+ if (tdep->elf_abi == POWERPC_ELF_V2) -+ { -+ struct type *eltype; -+ int i, nelt; -+ -+ if (ppc64_elfv2_abi_homogeneous_aggregate (type, &eltype, &nelt)) -+ for (i = 0; i < nelt; i++) -+ { -+ const gdb_byte *elval = val + i * TYPE_LENGTH (eltype); -+ -+ if (TYPE_CODE (eltype) == TYPE_CODE_FLT -+ || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT) -+ ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos); -+ else if (TYPE_CODE (eltype) == TYPE_CODE_ARRAY -+ && TYPE_VECTOR (eltype) -+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC -+ && TYPE_LENGTH (eltype) == 16) -+ ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos); -+ } -+ } - } - } - -@@ -1834,6 +2011,72 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, - return RETURN_VALUE_REGISTER_CONVENTION; - } - -+ /* In the ELFv2 ABI, homogeneous floating-point or vector -+ aggregates are returned in registers. */ -+ if (tdep->elf_abi == POWERPC_ELF_V2 -+ && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)) -+ { -+ for (i = 0; i < nelt; i++) -+ { -+ ok = ppc64_sysv_abi_return_value_base (gdbarch, eltype, regcache, -+ readbuf, writebuf, i); -+ gdb_assert (ok); -+ -+ if (readbuf) -+ readbuf += TYPE_LENGTH (eltype); -+ if (writebuf) -+ writebuf += TYPE_LENGTH (eltype); -+ } -+ -+ return RETURN_VALUE_REGISTER_CONVENTION; -+ } -+ -+ /* In the ELFv2 ABI, aggregate types of up to 16 bytes are -+ returned in registers r3:r4. */ -+ if (tdep->elf_abi == POWERPC_ELF_V2 -+ && TYPE_LENGTH (valtype) <= 16 -+ && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT -+ || TYPE_CODE (valtype) == TYPE_CODE_UNION -+ || (TYPE_CODE (valtype) == TYPE_CODE_ARRAY -+ && !TYPE_VECTOR (valtype)))) -+ { -+ int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1) -+ / tdep->wordsize); -+ int i; -+ -+ for (i = 0; i < n_regs; i++) -+ { -+ gdb_byte regval[MAX_REGISTER_SIZE]; -+ int regnum = tdep->ppc_gp0_regnum + 3 + i; -+ int offset = i * tdep->wordsize; -+ int len = TYPE_LENGTH (valtype) - offset; -+ -+ if (len > tdep->wordsize) -+ len = tdep->wordsize; -+ -+ if (writebuf != NULL) -+ { -+ memset (regval, 0, sizeof regval); -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG -+ && offset == 0) -+ memcpy (regval + tdep->wordsize - len, writebuf, len); -+ else -+ memcpy (regval, writebuf + offset, len); -+ regcache_cooked_write (regcache, regnum, regval); -+ } -+ if (readbuf != NULL) -+ { -+ regcache_cooked_read (regcache, regnum, regval); -+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG -+ && offset == 0) -+ memcpy (readbuf, regval + tdep->wordsize - len, len); -+ else -+ memcpy (readbuf + offset, regval, len); -+ } -+ } -+ return RETURN_VALUE_REGISTER_CONVENTION; -+ } -+ - /* Handle plain base types. */ - if (ppc64_sysv_abi_return_value_base (gdbarch, valtype, regcache, - readbuf, writebuf, 0)) diff --git a/gdb-upstream-ppc64le14of15.patch b/gdb-upstream-ppc64le14of15.patch deleted file mode 100644 index abee983..0000000 --- a/gdb-upstream-ppc64le14of15.patch +++ /dev/null @@ -1,375 +0,0 @@ -commit 591a12a1d4c8843343eb999145d8bcc1efedf408 -Author: Ulrich Weigand -Date: Tue Feb 4 18:44:14 2014 +0100 - - PowerPC64 ELFv2 ABI: skip global entry point code - - This patch handles another aspect of the ELFv2 ABI, which unfortunately - requires common code changes. - - In ELFv2, functions may provide both a global and a local entry point. - The global entry point (where the function symbol points to) is intended - to be used for function-pointer or cross-module (PLT) calls, and requires - r12 to be set up to the entry point address itself. The local entry - point (which is found at a fixed offset after the global entry point, - as defined by bits in the symbol table entries' st_other field), instead - expects r2 to be set up to the current TOC. - - Now, when setting a breakpoint on a function by name, you really want - that breakpoint to trigger either way, no matter whether the function - is called via its local or global entry point. Since the global entry - point will always fall through into the local entry point, the way to - achieve that is to simply set the breakpoint at the local entry point. - - One way to do that would be to have prologue parsing skip the code - sequence that makes up the global entry point. Unfortunately, this - does not work reliably, since -for optimized code- GDB these days - will not actuall invoke the prologue parsing code but instead just - set the breakpoint at the symbol address and rely on DWARF being - correct at any point throughout the function ... - - Unfortunately, I don't really see any way to express the notion of - local entry points with the current set of gdbarch callbacks. - - Thus this patch adds a new callback, skip_entrypoint, that is - somewhat analogous to skip_prologue, but is called every time - GDB needs to determine a function start address, even in those - cases where GDB decides to not call skip_prologue. - - As a side effect, the skip_entrypoint implementation on ppc64 - does not need to perform any instruction parsing; it can simply - rely on the local entry point flags in the symbol table entry. - - With this implemented, two test cases would still fail to set - the breakpoint correctly, but that's because they use the construct: - - gdb_test "break *hello" - - Now, using "*hello" explicitly instructs GDB to set the breakpoint - at the numerical value of "hello" treated as function pointer, so - it will by definition only hit the global entry point. - - I think this behaviour is unavoidable, but acceptable -- most people - do not use this construct, and if they do, they get what they - asked for ... - - In one of those two test cases, use of this construct is really - not appropriate. I think this was added way back when as a means - to work around prologue skipping problems on some platforms. These - days that shouldn't really be necessary any more ... - - For the other (step-bt), we really want to make sure backtracing - works on the very first instruction of the routine. To enable that - test also on powerpc64le-linux, we can modify the code to call the - test function via function pointer (which makes it use the global - entry point in the ELFv2 ABI). - - gdb/ChangeLog: - - * gdbarch.sh (skip_entrypoint): New callback. - * gdbarch.c, gdbarch.h: Regenerate. - * symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint. - * infrun.c (fill_in_stop_func): Likewise. - * ppc-linux-tdep.c: Include "elf/ppc64.h". - (ppc_elfv2_elf_make_msymbol_special): New function. - (ppc_elfv2_skip_entrypoint): Likewise. - (ppc_linux_init_abi): Install them for ELFv2. - - gdb/testsuite/ChangeLog: - - * gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint - on a function. - * gdb.base/step-bt.c: Call hello via function pointer to make - sure its first instruction is executed on powerpc64le-linux. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,16 @@ - 2014-02-04 Ulrich Weigand  - -+ * gdbarch.sh (skip_entrypoint): New callback. -+ * gdbarch.c, gdbarch.h: Regenerate. -+ * symtab.c (skip_prologue_sal): Call gdbarch_skip_entrypoint. -+ * infrun.c (fill_in_stop_func): Likewise. -+ * ppc-linux-tdep.c: Include "elf/ppc64.h". -+ (ppc_elfv2_elf_make_msymbol_special): New function. -+ (ppc_elfv2_skip_entrypoint): Likewise. -+ (ppc_linux_init_abi): Install them for ELFv2. -+ -+2014-02-04 Ulrich Weigand  -+ - * ppc-sysv-tdep.c (ppc64_aggregate_candidate): New routine. - (ppc64_elfv2_abi_homogeneous_aggregate): Likewise. - (ppc64_sysv_abi_push_param): Handle ELFv2 homogeneous structs. ---- a/gdb/gdbarch.c -+++ b/gdb/gdbarch.c -@@ -229,6 +229,7 @@ struct gdbarch - gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p; - gdbarch_skip_prologue_ftype *skip_prologue; - gdbarch_skip_main_prologue_ftype *skip_main_prologue; -+ gdbarch_skip_entrypoint_ftype *skip_entrypoint; - gdbarch_inner_than_ftype *inner_than; - gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; - gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc; -@@ -405,6 +406,7 @@ struct gdbarch startup_gdbarch = - default_return_in_first_hidden_param_p, /* return_in_first_hidden_param_p */ - 0, /* skip_prologue */ - 0, /* skip_main_prologue */ -+ 0, /* skip_entrypoint */ - 0, /* inner_than */ - 0, /* breakpoint_from_pc */ - default_remote_breakpoint_from_pc, /* remote_breakpoint_from_pc */ -@@ -714,6 +716,7 @@ verify_gdbarch (struct gdbarch *gdbarch) - if (gdbarch->skip_prologue == 0) - fprintf_unfiltered (log, "\n\tskip_prologue"); - /* Skip verify of skip_main_prologue, has predicate. */ -+ /* Skip verify of skip_entrypoint, has predicate. */ - if (gdbarch->inner_than == 0) - fprintf_unfiltered (log, "\n\tinner_than"); - if (gdbarch->breakpoint_from_pc == 0) -@@ -1353,6 +1356,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) - "gdbarch_dump: single_step_through_delay = <%s>\n", - host_address_to_string (gdbarch->single_step_through_delay)); - fprintf_unfiltered (file, -+ "gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n", -+ gdbarch_skip_entrypoint_p (gdbarch)); -+ fprintf_unfiltered (file, -+ "gdbarch_dump: skip_entrypoint = <%s>\n", -+ host_address_to_string (gdbarch->skip_entrypoint)); -+ fprintf_unfiltered (file, - "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n", - gdbarch_skip_main_prologue_p (gdbarch)); - fprintf_unfiltered (file, -@@ -2703,6 +2712,30 @@ set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, - } - - int -+gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch) -+{ -+ gdb_assert (gdbarch != NULL); -+ return gdbarch->skip_entrypoint != NULL; -+} -+ -+CORE_ADDR -+gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip) -+{ -+ gdb_assert (gdbarch != NULL); -+ gdb_assert (gdbarch->skip_entrypoint != NULL); -+ if (gdbarch_debug >= 2) -+ fprintf_unfiltered (gdb_stdlog, "gdbarch_skip_entrypoint called\n"); -+ return gdbarch->skip_entrypoint (gdbarch, ip); -+} -+ -+void -+set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch, -+ gdbarch_skip_entrypoint_ftype skip_entrypoint) -+{ -+ gdbarch->skip_entrypoint = skip_entrypoint; -+} -+ -+int - gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs) - { - gdb_assert (gdbarch != NULL); ---- a/gdb/gdbarch.h -+++ b/gdb/gdbarch.h -@@ -486,6 +486,24 @@ typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch, C - extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip); - extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype *skip_main_prologue); - -+/* On some platforms, a single function may provide multiple entry points, -+ e.g. one that is used for function-pointer calls and a different one -+ that is used for direct function calls. -+ In order to ensure that breakpoints set on the function will trigger -+ no matter via which entry point the function is entered, a platform -+ may provide the skip_entrypoint callback. It is called with IP set -+ to the main entry point of a function (as determined by the symbol table), -+ and should return the address of the innermost entry point, where the -+ actual breakpoint needs to be set. Note that skip_entrypoint is used -+ by GDB common code even when debugging optimized code, where skip_prologue -+ is not used. */ -+ -+extern int gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch); -+ -+typedef CORE_ADDR (gdbarch_skip_entrypoint_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip); -+extern CORE_ADDR gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip); -+extern void set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch, gdbarch_skip_entrypoint_ftype *skip_entrypoint); -+ - typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs); - extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs); - extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than); ---- a/gdb/gdbarch.sh -+++ b/gdb/gdbarch.sh -@@ -530,6 +530,19 @@ m:int:return_in_first_hidden_param_p:struct type *type:type::default_return_in_f - - m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0 - M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip -+# On some platforms, a single function may provide multiple entry points, -+# e.g. one that is used for function-pointer calls and a different one -+# that is used for direct function calls. -+# In order to ensure that breakpoints set on the function will trigger -+# no matter via which entry point the function is entered, a platform -+# may provide the skip_entrypoint callback. It is called with IP set -+# to the main entry point of a function (as determined by the symbol table), -+# and should return the address of the innermost entry point, where the -+# actual breakpoint needs to be set. Note that skip_entrypoint is used -+# by GDB common code even when debugging optimized code, where skip_prologue -+# is not used. -+M:CORE_ADDR:skip_entrypoint:CORE_ADDR ip:ip -+ - f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 - m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0: - # Return the adjusted address and kind to use for Z0/Z1 packets. ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -3159,6 +3159,10 @@ fill_in_stop_func (struct gdbarch *gdbarch, - ecs->stop_func_start - += gdbarch_deprecated_function_start_offset (gdbarch); - -+ if (gdbarch_skip_entrypoint_p (gdbarch)) -+ ecs->stop_func_start = gdbarch_skip_entrypoint (gdbarch, -+ ecs->stop_func_start); -+ - ecs->stop_func_filled_in = 1; - } - } ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -44,6 +44,7 @@ - #include "observer.h" - #include "auxv.h" - #include "elf/common.h" -+#include "elf/ppc64.h" - #include "exceptions.h" - #include "arch-utils.h" - #include "spu-tdep.h" -@@ -876,6 +877,55 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, - } - } - -+ -+/* Implementation of `gdbarch_elf_make_msymbol_special', as defined in -+ gdbarch.h. This implementation is used for the ELFv2 ABI only. */ -+ -+static void -+ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) -+{ -+ elf_symbol_type *elf_sym = (elf_symbol_type *)sym; -+ -+ /* If the symbol is marked as having a local entry point, set a target -+ flag in the msymbol. We currently only support local entry point -+ offsets of 8 bytes, which is the only entry point offset ever used -+ by current compilers. If/when other offsets are ever used, we will -+ have to use additional target flag bits to store them. */ -+ switch (PPC64_LOCAL_ENTRY_OFFSET (elf_sym->internal_elf_sym.st_other)) -+ { -+ default: -+ break; -+ case 8: -+ MSYMBOL_TARGET_FLAG_1 (msym) = 1; -+ break; -+ } -+} -+ -+/* Implementation of `gdbarch_skip_entrypoint', as defined in -+ gdbarch.h. This implementation is used for the ELFv2 ABI only. */ -+ -+static CORE_ADDR -+ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc) -+{ -+ struct bound_minimal_symbol fun; -+ int local_entry_offset = 0; -+ -+ fun = lookup_minimal_symbol_by_pc (pc); -+ if (fun.minsym == NULL) -+ return pc; -+ -+ /* See ppc_elfv2_elf_make_msymbol_special for how local entry point -+ offset values are encoded. */ -+ if (MSYMBOL_TARGET_FLAG_1 (fun.minsym)) -+ local_entry_offset = 8; -+ -+ if (SYMBOL_VALUE_ADDRESS (fun.minsym) <= pc -+ && pc < SYMBOL_VALUE_ADDRESS (fun.minsym) + local_entry_offset) -+ return SYMBOL_VALUE_ADDRESS (fun.minsym) + local_entry_offset; -+ -+ return pc; -+} -+ - /* Implementation of `gdbarch_stap_is_single_operand', as defined in - gdbarch.h. */ - -@@ -1349,6 +1399,13 @@ ppc_linux_init_abi (struct gdbarch_info info, - set_gdbarch_elf_make_msymbol_special - (gdbarch, ppc64_elf_make_msymbol_special); - } -+ else -+ { -+ set_gdbarch_elf_make_msymbol_special -+ (gdbarch, ppc_elfv2_elf_make_msymbol_special); -+ -+ set_gdbarch_skip_entrypoint (gdbarch, ppc_elfv2_skip_entrypoint); -+ } - - /* Shared library handling. */ - set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code); ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -2950,6 +2950,8 @@ skip_prologue_sal (struct symtab_and_line *sal) - - /* Skip "first line" of function (which is actually its prologue). */ - pc += gdbarch_deprecated_function_start_offset (gdbarch); -+ if (gdbarch_skip_entrypoint_p (gdbarch)) -+ pc = gdbarch_skip_entrypoint (gdbarch, pc); - if (skip) - pc = gdbarch_skip_prologue (gdbarch, pc); - -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,5 +1,12 @@ - 2014-02-04 Ulrich Weigand - -+ * gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint -+ on a function. -+ * gdb.base/step-bt.c: Call hello via function pointer to make -+ sure its first instruction is executed on powerpc64le-linux. -+ -+2014-02-04 Ulrich Weigand -+ - * gdb.arch/powerpc-d128-regs.exp: Enable on powerpc64*-*. - - 2014-02-04 Ulrich Weigand ---- a/gdb/testsuite/gdb.base/sigbpt.exp -+++ b/gdb/testsuite/gdb.base/sigbpt.exp -@@ -76,7 +76,7 @@ gdb_test "break keeper" - set bowler_addrs bowler - set segv_addr none - gdb_test {display/i $pc} --gdb_test "advance *bowler" "bowler.*" "advance to the bowler" -+gdb_test "advance bowler" "bowler.*" "advance to the bowler" - set test "stepping to fault" - set signame "SIGSEGV" - gdb_test_multiple "stepi" "$test" { ---- a/gdb/testsuite/gdb.base/step-bt.c -+++ b/gdb/testsuite/gdb.base/step-bt.c -@@ -23,10 +23,19 @@ hello (void) - printf ("Hello world.\n"); - } - -+/* The test case uses "break *hello" to make sure to step at the very -+ first instruction of the function. This causes a problem running -+ the test on powerpc64le-linux, since the first instruction belongs -+ to the global entry point prologue, which is skipped when doing a -+ local direct function call. To make sure that first instruction is -+ indeed being executed and the breakpoint hits, we make sure to call -+ the routine via an indirect call. */ -+void (*ptr) (void) = hello; -+ - int - main (void) - { -- hello (); -+ ptr (); - - return 0; - } diff --git a/gdb-upstream-ppc64le15of15.patch b/gdb-upstream-ppc64le15of15.patch deleted file mode 100644 index 961bf68..0000000 --- a/gdb-upstream-ppc64le15of15.patch +++ /dev/null @@ -1,90 +0,0 @@ -commit bc9a55253ed7122cfeee90cd23d964f44c8b0e6a -Author: Ulrich Weigand -Date: Tue Mar 25 15:39:32 2014 +0100 - - Support gdb.asm/asm-source.exp on powerpc64le - - Add new powerpc64le.inc file appropriate for the ELFv2 ABI and - use it to support the asm-source.exp test case on powerpc64le. - - gdb/testsuite/ - 2014-03-25 Ulrich Weigand - - * gdb.asm/asm-source.exp: Handle powerpc64le-* targets. - * gdb.asm/powerpc64le.inc: New file. - -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,3 +1,8 @@ -+2014-03-25 Ulrich Weigand -+ -+ * gdb.asm/asm-source.exp: Handle powerpc64le-* targets. -+ * gdb.asm/powerpc64le.inc: New file. -+ - 2014-03-25 Pedro Alves - Doug Evans - ---- a/gdb/testsuite/gdb.asm/asm-source.exp -+++ b/gdb/testsuite/gdb.asm/asm-source.exp -@@ -97,6 +97,11 @@ switch -glob -- [istarget] { - "mips*-*" { - set asm-arch mips - } -+ "powerpc64le-*" { -+ set asm-arch powerpc64le -+ set asm-flags "-a64 -I${srcdir}/${subdir} $obj_include" -+ append link-flags " -m elf64lppc" -+ } - "powerpc*-*" { - if { [is_lp64_target] } { - set asm-arch powerpc64 ---- /dev/null -+++ b/gdb/testsuite/gdb.asm/powerpc64le.inc -@@ -0,0 +1,47 @@ -+ comment "subroutine prologue" -+ .macro gdbasm_enter -+ stdu 1, -32(1) -+ mflr 0 -+ std 0, 48(1) -+ .endm -+ -+ comment "subroutine epilogue" -+ .macro gdbasm_leave -+ ld 0, 48(1) -+ mtlr 0 -+ ld 1, 0(1) -+ blr -+ .endm -+ -+ .macro gdbasm_call subr -+ bl \subr -+ nop -+ .endm -+ -+ .macro gdbasm_several_nops -+ nop -+ nop -+ nop -+ nop -+ .endm -+ -+ comment "exit (0)" -+ .macro gdbasm_exit0 -+ comment "sys_exit" -+ li 0, 1 -+ sc -+ .endm -+ -+ comment "crt0 startup" -+ .macro gdbasm_startup -+ .abiversion 2 -+ .p2align 2 -+ .endm -+ -+ comment "Declare a data variable" -+ .purgem gdbasm_datavar -+ .macro gdbasm_datavar name value -+ .section ".data" -+\name: -+ .long \value -+ .endm diff --git a/gdb-upstream.patch b/gdb-upstream.patch index 538fe35..21a6d20 100644 --- a/gdb-upstream.patch +++ b/gdb-upstream.patch @@ -1,369 +1,321 @@ -http://sourceware.org/ml/gdb-patches/2014-02/msg00179.html -Subject: [obv] testsuite: Fix i386-sse-stack-align.exp regression since GDB_PARALLEL +http://sourceware.org/ml/gdb-patches/2014-06/msg00656.html +Subject: Re: Regression with default scheduler-locking=step [Re: [pushed] Consecutive step-overs trigger internal error.] +On 06/17/2014 08:24 PM, Jan Kratochvil wrote: +> On Tue, 22 Apr 2014 20:24:28 +0200, Pedro Alves wrote: +>> Tested on x86_64 Fedora 17, native and gdbserver, and also native on +>> top of my "software single-step on x86_64" series. +> +> 483805cf9ea5a6dace41415d8830e93fccc49c43 is the first bad commit +> commit 483805cf9ea5a6dace41415d8830e93fccc49c43 +> Author: Pedro Alves +> Date: Tue Apr 22 15:00:56 2014 +0100 +> Consecutive step-overs trigger internal error. +> +> (gdb) next^M +> [Thread 0x7ffff7fda700 (LWP 27168) exited]^M +> [New LWP 27168]^M +> [Thread 0x7ffff74ee700 (LWP 27174) exited]^M +> process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M +> [Thread debugging using libthread_db enabled]^M +> Using host libthread_db library "/lib64/libthread_db.so.1".^M +> infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M +> A problem internal to GDB has been detected,^M +> further debugging may prove unreliable.^M +> Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: get to main in new image (GDB internal error) +> Resyncing due to internal error. ---u3/rZRmxL6MmkK24 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline +Thanks Jan. -Hi Tom, +> +> The regressions happens only with the attached patch which I am not sure if it +> is considered as a valid FSF GDB regression or not but I think it is. -$ make check//unix/-m32 RUNTESTFLAGS="gdb.arch/i386-sse-stack-align.exp GDB_PARALLEL=1" -[...] -Running /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp ... -ERROR: (/home/jkratoch/redhat/gdb-clean/gdb/testsuite.unix.-m32/outputs/gdb.arch/i386-sse-stack-align/i386-sse-stack-align) No such file or directory +If it worked before, then it's certainly a regression. The user is +free to do "set scheduler-locking step" herself. +Here's a fix. Let me know what you think. -Checked in. +8<--------------------------------- +>From f717378c16cb04f8350935a1336767d2541b36a5 Mon Sep 17 00:00:00 2001 +From: Pedro Alves +Date: Wed, 18 Jun 2014 14:20:31 +0100 +Subject: [PATCH] Fix next over threaded execl with "set scheduler-locking +Subject: [PATCH] Fix next over threaded execl with "set scheduler-locking + step". +Running gdb.threads/thread-execl.exp with scheduler-locking set to +"step" reveals a problem: -Jan + (gdb) next^M + [Thread 0x7ffff7fda700 (LWP 27168) exited]^M + [New LWP 27168]^M + [Thread 0x7ffff74ee700 (LWP 27174) exited]^M + process 27168 is executing new program: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.threads/thread-execl^M + [Thread debugging using libthread_db enabled]^M + Using host libthread_db library "/lib64/libthread_db.so.1".^M + infrun.c:5225: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed.^M + A problem internal to GDB has been detected,^M + further debugging may prove unreliable.^M + Quit this debugging session? (y or n) FAIL: gdb.threads/thread-execl.exp: schedlock step: get to main in new image (GDB internal error) ---u3/rZRmxL6MmkK24 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename=1 +The assertion is correct. The issue is that GDB is mistakenly trying +to switch back to an exited thread, that was previously stepping when +it exited. This is exactly the sort of thing the test wants to make +sure doesn't happen: -commit 3c77faf33dc4c7bb693f05f44077ed687e9f8217 -Author: Jan Kratochvil -Date: Thu Feb 6 23:14:20 2014 +0100 + # Now set a breakpoint at `main', and step over the execl call. The + # breakpoint at main should be reached. GDB should not try to revert + # back to the old thread from the old image and resume stepping it - Fix i386-sse-stack-align.exp regression since GDB_PARALLEL. - - gdb/testsuite/ - 2014-02-06 Jan Kratochvil - - Fix i386-sse-stack-align.exp regression since GDB_PARALLEL. - * gdb.arch/i386-sse-stack-align.exp: Use standard_output_file. +We don't see this bug with schedlock off only because a different +sequence of events makes GDB manage to delete the thread instead of +marking it exited. -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog -index 8c846b8..13ccaf3 100644 -### a/gdb/testsuite/ChangeLog -### b/gdb/testsuite/ChangeLog -## -1,3 +1,8 @@ -+2014-02-06 Jan Kratochvil -+ -+ Fix i386-sse-stack-align.exp regression since GDB_PARALLEL. -+ * gdb.arch/i386-sse-stack-align.exp: Use standard_output_file. -+ - 2014-02-06 Doug Evans +This particular internal error can be fixed by making the loop over +all threads in switch_back_to_stepped_thread skip exited threads. +But, looking over other ALL_THREADS users, all either can or should be +skipping exited threads too. So for simplicity, this patch replaces +ALL_THREADS with a new macro that skips exited threads itself, and +updates everything to use it. + +Tested on x86_64 Fedora 20. + +gdb/ +2014-06-18 Pedro Alves + + * gdbthread.h (ALL_THREADS): Delete. + (ALL_NON_EXITED_THREADS): New macro. + * btrace.c (btrace_free_objfile): Use ALL_NON_EXITED_THREADS + instead of ALL_THREADS. + * infrun.c (find_thread_needs_step_over) + (switch_back_to_stepped_thread): Use ALL_NON_EXITED_THREADS + instead of ALL_THREADS. + * record-btrace.c (record_btrace_open) + (record_btrace_stop_recording, record_btrace_close) + (record_btrace_is_replaying, record_btrace_resume) + (record_btrace_find_thread_to_move, record_btrace_wait): Likewise. + * remote.c (append_pending_thread_resumptions): Likewise. + +gdb/testsuite/ +2014-06-18 Pedro Alves + + * gdb.threads/thread-execl.exp (do_test): New procedure, factored + out from ... + (top level): ... here. Iterate running tests under different + scheduler-locking settings. +--- + gdb/btrace.c | 2 +- + gdb/gdbthread.h | 8 ++++-- + gdb/infrun.c | 4 +-- + gdb/record-btrace.c | 14 +++++----- + gdb/remote.c | 2 +- + gdb/testsuite/gdb.threads/thread-execl.exp | 44 ++++++++++++++++++++---------- + gdb/thread.c | 2 +- + 7 files changed, 46 insertions(+), 30 deletions(-) + +diff --git a/gdb/btrace.c b/gdb/btrace.c +index 601eb41..87a171e 100644 +--- a/gdb/btrace.c ++++ b/gdb/btrace.c +@@ -958,7 +958,7 @@ btrace_free_objfile (struct objfile *objfile) - * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected -diff --git a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp -index b5a7e1e..462df1f 100644 ---- a/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp -+++ b/gdb/testsuite/gdb.arch/i386-sse-stack-align.exp -@@ -22,7 +22,7 @@ set testfile "i386-sse-stack-align" - set srcfile ${testfile}.S - set csrcfile ${testfile}.c - set executable ${testfile} --set binfile ${objdir}/${subdir}/${executable} -+set binfile [standard_output_file ${executable}] - set opts {} + DEBUG ("free objfile"); - if [info exists COMPILE] { - ---u3/rZRmxL6MmkK24-- - - - -commit 20dca09662aa0d2706fbe325b8f448ef74773028 -Author: Andreas Arnez -Date: Tue May 13 14:55:53 2014 +0200 - - PR target/16940 S390: Fix erroneous offset in fill_gregset. - - This fixes a bug that leads to various failures when debugging a - 31-bit inferior with a 64-bit gdb on s390x. - - Conflicts: - - gdb/ChangeLog - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,9 @@ -+2014-05-13 Andreas Arnez -+ -+ PR target/16940 -+ * s390-linux-nat.c (fill_gregset): Remove erroneous offset 4 in -+ call to regcache_raw_collect. -+ - 2014-05-05 Joel Brobecker - - * version.in: Set GDB version number to 7.7.1.DATE-cvs. ---- a/gdb/s390-linux-nat.c -+++ b/gdb/s390-linux-nat.c -@@ -164,7 +164,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno) - memset (p, 0, 4); - p += 4; - } -- regcache_raw_collect (regcache, reg, p + 4); -+ regcache_raw_collect (regcache, reg, p); - } - } - - - - -https://bugzilla.redhat.com/show_bug.cgi?id=1086894 -commit f2205de0080d999c9b67872c9db471c31b53e378 -Author: Hui Zhu -Date: Tue May 20 13:19:06 2014 +0800 - - Fix issue #15778: GDB Aarch64 signal frame unwinder issue - - The root cause of this issue is unwinder of "#3 " - doesn't supply right values of registers. - When GDB want to get the previous frame of "#3 ", - it will call cache init function of unwinder "aarch64_linux_sigframe_init". - The address or the value of the registers is get from this function. - So the bug is inside thie function. - - I check the asm code of "#3 ": - (gdb) frame 3 - (gdb) p $pc - $1 = (void (*)()) 0x7f931fa4d0 - (gdb) disassemble $pc, +10 - Dump of assembler code from 0x7f931fa4d0 to 0x7f931fa4da: - => 0x0000007f931fa4d0: mov x8, #0x8b // #139 - 0x0000007f931fa4d4: svc #0x0 - 0x0000007f931fa4d8: nop - - This is the syscall sys_rt_sigreturn, Linux kernel function "restore_sigframe" - will set the frame: - for (i = 0; i < 31; i++) - __get_user_error(regs->regs[i], &sf->uc.uc_mcontext.regs[i], - err); - __get_user_error(regs->sp, &sf->uc.uc_mcontext.sp, err); - __get_user_error(regs->pc, &sf->uc.uc_mcontext.pc, err); - The struct of uc_mcontext is: - struct sigcontext { - __u64 fault_address; - /* AArch64 registers */ - __u64 regs[31]; - __u64 sp; - __u64 pc; - __u64 pstate; - /* 4K reserved for FP/SIMD state and future expansion */ - __u8 __reserved[4096] __attribute__((__aligned__(16))); - }; - - But in GDB function "aarch64_linux_sigframe_init", the code the get address - of registers is: - for (i = 0; i < 31; i++) - { - trad_frame_set_reg_addr (this_cache, - AARCH64_X0_REGNUM + i, - sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET - + i * AARCH64_SIGCONTEXT_REG_SIZE); - } - - trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp); - trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8); - trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8); - - The code that get pc and sp is not right, so I change the code according - to Linux kernel code: - trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, - sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET - + 31 * AARCH64_SIGCONTEXT_REG_SIZE); - trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, - sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET - + 32 * AARCH64_SIGCONTEXT_REG_SIZE); - - The issue was fixed by this change, and I did the regression test. It - also fixed a lot of other XFAIL and FAIL. - - 2014-05-20 Hui Zhu - Yao Qi - - PR backtrace/16558 - * aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments - and change address of sp and pc. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,3 +1,10 @@ -+2014-05-20 Hui Zhu -+ Yao Qi -+ -+ PR backtrace/16558 -+ * aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Update comments -+ and change address of sp and pc. -+ - 2014-05-19 Tom Tromey - - * gdbtypes.c (rank_function): Use XNEWVEC. ---- a/gdb/aarch64-linux-tdep.c -+++ b/gdb/aarch64-linux-tdep.c -@@ -53,28 +53,30 @@ - - /* Signal frame handling. - -- +----------+ ^ -- | saved lr | | -- +->| saved fp |--+ -- | | | -- | | | -- | +----------+ -- | | saved lr | -- +--| saved fp | -- ^ | | -- | | | -- | +----------+ -- ^ | | -- | | signal | -- | | | -- | | saved lr |-->interrupted_function_pc -- +--| saved fp | -- | +----------+ -- | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0) -- +--| saved fp |<- FP -- | | -- | |<- SP -- +----------+ -+ +------------+ ^ -+ | saved lr | | -+ +->| saved fp |--+ -+ | | | -+ | | | -+ | +------------+ -+ | | saved lr | -+ +--| saved fp | -+ ^ | | -+ | | | -+ | +------------+ -+ ^ | | -+ | | signal | -+ | | | SIGTRAMP_FRAME (struct rt_sigframe) -+ | | saved regs | -+ +--| saved sp |--> interrupted_sp -+ | | saved pc |--> interrupted_pc -+ | | | -+ | +------------+ -+ | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0) -+ +--| saved fp |<- FP -+ | | NORMAL_FRAME -+ | |<- SP -+ +------------+ - - On signal delivery, the kernel will create a signal handler stack - frame and setup the return address in LR to point at restorer stub. -@@ -123,6 +125,8 @@ - d28015a8 movz x8, #0xad - d4000001 svc #0x0 - -+ This is a system call sys_rt_sigreturn. -+ - We detect signal frames by snooping the return code for the restorer - instruction sequence. - -@@ -146,7 +150,6 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, - { - struct gdbarch *gdbarch = get_frame_arch (this_frame); - CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM); -- CORE_ADDR fp = get_frame_register_unsigned (this_frame, AARCH64_FP_REGNUM); - CORE_ADDR sigcontext_addr = - sp - + AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET -@@ -160,12 +163,14 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, - sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET - + i * AARCH64_SIGCONTEXT_REG_SIZE); - } -- -- trad_frame_set_reg_addr (this_cache, AARCH64_FP_REGNUM, fp); -- trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, fp + 8); -- trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, fp + 8); -- -- trad_frame_set_id (this_cache, frame_id_build (fp, func)); -+ trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, -+ sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET -+ + 31 * AARCH64_SIGCONTEXT_REG_SIZE); -+ trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, -+ sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET -+ + 32 * AARCH64_SIGCONTEXT_REG_SIZE); -+ -+ trad_frame_set_id (this_cache, frame_id_build (sp, func)); +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + btrace_clear (tp); } - static const struct tramp_frame aarch64_linux_rt_sigframe = - - - -Bug 1102624 - latest gdb -15 build is FTBFS on aarch64 -https://bugzilla.redhat.com/show_bug.cgi?id=1102624 -commit 036cd38182bde32d8297b630cd5c861d53b8949e -Author: Ramana Radhakrishnan -Date: Thu May 22 16:07:20 2014 +0100 - - Include asm/ptrace.h in aarch64-linux-nat.c - - A recent change to glibc removed asm/ptrace.h from user.h for - AArch64. This meant that cross-native builds of gdb using trunk - glibc broke because aarch64-linux-nat.c because user_hwdebug_state - couldn't be found. - - Fixed by including asm/ptrace.h like other ports. - - 2014-05-22 Ramana Radhakrishnan - - * aarch64-linux-nat.c (asm/ptrace.h): Include. - -### a/gdb/ChangeLog -### b/gdb/ChangeLog -## -1,5 +1,9 @@ - 2014-05-22 Ramana Radhakrishnan +diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h +index 9f5dee6..64e37c3 100644 +--- a/gdb/gdbthread.h ++++ b/gdb/gdbthread.h +@@ -317,10 +317,12 @@ void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid); + typedef int (*thread_callback_func) (struct thread_info *, void *); + extern struct thread_info *iterate_over_threads (thread_callback_func, void *); -+ * aarch64-linux-nat.c (asm/ptrace.h): Include. +-/* Traverse all threads. */ ++/* Traverse all threads, except those that have THREAD_EXITED ++ state. */ + +-#define ALL_THREADS(T) \ +- for (T = thread_list; T; T = T->next) ++#define ALL_NON_EXITED_THREADS(T) \ ++ for (T = thread_list; T; T = T->next) \ ++ if ((T)->state != THREAD_EXITED) + + extern int thread_count (void); + +diff --git a/gdb/infrun.c b/gdb/infrun.c +index 4e808d9..e8e26e0 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -2160,7 +2160,7 @@ find_thread_needs_step_over (int step, struct thread_info *except) + return NULL; + } + +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + { + /* Ignore the EXCEPT thread. */ + if (tp == except) +@@ -5204,7 +5204,7 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs) + step/next/etc. */ + stepping_thread = NULL; + step_over = NULL; +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + { + /* Ignore threads of processes we're not resuming. */ + if (!sched_multi +diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c +index e0c537a8..6a9bfe1 100644 +--- a/gdb/record-btrace.c ++++ b/gdb/record-btrace.c +@@ -206,7 +206,7 @@ record_btrace_open (char *args, int from_tty) + gdb_assert (record_btrace_thread_observer == NULL); + + disable_chain = make_cleanup (null_cleanup, NULL); +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + if (args == NULL || *args == 0 || number_is_in_list (args, tp->num)) + { + btrace_enable (tp); +@@ -238,7 +238,7 @@ record_btrace_stop_recording (struct target_ops *self) + + record_btrace_auto_disable (); + +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + if (tp->btrace.target != NULL) + btrace_disable (tp); + } +@@ -259,7 +259,7 @@ record_btrace_close (struct target_ops *self) + + /* We should have already stopped recording. + Tear down btrace in case we have not. */ +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + btrace_teardown (tp); + } + +@@ -835,7 +835,7 @@ record_btrace_is_replaying (struct target_ops *self) + { + struct thread_info *tp; + +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + if (btrace_is_replaying (tp)) + return 1; + +@@ -1522,7 +1522,7 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step, + + /* Stop replaying other threads if the thread to resume is not replaying. */ + if (!btrace_is_replaying (tp) && execution_direction != EXEC_REVERSE) +- ALL_THREADS (other) ++ ALL_NON_EXITED_THREADS (other) + record_btrace_stop_replaying (other); + + /* As long as we're not replaying, just forward the request. */ +@@ -1572,7 +1572,7 @@ record_btrace_find_thread_to_move (ptid_t ptid) + return tp; + + /* Otherwise, find one other thread that has been resumed. */ +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + if ((tp->btrace.flags & BTHR_MOVE) != 0) + return tp; + +@@ -1777,7 +1777,7 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid, + + /* Stop all other threads. */ + if (!non_stop) +- ALL_THREADS (other) ++ ALL_NON_EXITED_THREADS (other) + other->btrace.flags &= ~BTHR_MOVE; + + /* Start record histories anew from the current position. */ +diff --git a/gdb/remote.c b/gdb/remote.c +index 6915dd8..b5318f1 100644 +--- a/gdb/remote.c ++++ b/gdb/remote.c +@@ -4626,7 +4626,7 @@ append_pending_thread_resumptions (char *p, char *endp, ptid_t ptid) + { + struct thread_info *thread; + +- ALL_THREADS (thread) ++ ALL_NON_EXITED_THREADS (thread) + if (ptid_match (thread->ptid, ptid) + && !ptid_equal (inferior_ptid, thread->ptid) + && thread->suspend.stop_signal != GDB_SIGNAL_0 +diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp b/gdb/testsuite/gdb.threads/thread-execl.exp +index d837fe4..14b96d2 100644 +--- a/gdb/testsuite/gdb.threads/thread-execl.exp ++++ b/gdb/testsuite/gdb.threads/thread-execl.exp +@@ -28,19 +28,33 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + return -1 + } + +-clean_restart ${binfile} +- +-runto_main +- +-# Get ourselves to the thread that execs +-gdb_breakpoint "thread_execler" +-gdb_test "continue" ".*thread_execler.*" "continue to thread start" +- +-# Now set a breakpoint at `main', and step over the execl call. The +-# breakpoint at main should be reached. GDB should not try to revert +-# back to the old thread from the old image and resume stepping it +-# (since it is gone). +-gdb_breakpoint "main" +-gdb_test "next" ".*main.*" "get to main in new image" ++# Run the test proper. SCHEDLOCK specifies what scheduler-locking ++# should be set to. + -+2014-05-22 Ramana Radhakrishnan ++proc do_test { schedlock } { ++ global binfile + - * MAINTAINERS (Write After Approval): Move self back from - paper trail. ++ with_test_prefix "schedlock $schedlock" { ++ clean_restart ${binfile} ++ ++ if ![runto_main] { ++ return 0 ++ } ++ ++ # Get ourselves to the thread that execs. ++ gdb_breakpoint "thread_execler" ++ gdb_test "continue" ".*thread_execler.*" "continue to thread start" ++ ++ # Now set a breakpoint at `main', and step over the execl call. The ++ # breakpoint at main should be reached. GDB should not try to revert ++ # back to the old thread from the old image and resume stepping it ++ # (since it is gone). ++ gdb_breakpoint "main" ++ gdb_test_no_output "set scheduler-locking $schedlock" ++ gdb_test "next" ".*main.*" "get to main in new image" ++ } ++} ---- a/gdb/aarch64-linux-nat.c -+++ b/gdb/aarch64-linux-nat.c -@@ -33,6 +33,7 @@ +-return 0 ++foreach schedlock {"off" "step" "on"} { ++ do_test $schedlock ++} +diff --git a/gdb/thread.c b/gdb/thread.c +index 7bc5271..532149d 100644 +--- a/gdb/thread.c ++++ b/gdb/thread.c +@@ -1243,7 +1243,7 @@ thread_apply_all_command (char *cmd, int from_tty) + ta_cleanup.tp_array = tp_array; + ta_cleanup.count = tc; - #include - #include -+#include - - #include "gregset.h" - -commit e9dae05e9c32efda9724330c6d5ade3ca848591d -Author: Ramana Radhakrishnan -Date: Fri May 23 09:01:14 2014 +0100 +- ALL_THREADS (tp) ++ ALL_NON_EXITED_THREADS (tp) + { + tp_array[i] = tp; + tp->refcount++; +-- +1.9.3 - Include asm/ptrace.h for linux-aarch64-low.c - - A recent change to glibc removed asm/ptrace.h from user.h for AArch64. - This meant that cross-native builds of gdbserver using trunk glibc broke - because linux-aarch64-low.c because user_hwdebug_state couldn't be found. - - This is like commit #036cd38182bde32d8297b630cd5c861d53b8949e - - 2014-05-23 Ramana Radhakrishnan - - * linux-aarch64-low.c (asm/ptrace.h): Include. -### a/gdb/gdbserver/ChangeLog -### b/gdb/gdbserver/ChangeLog -## -1,3 +1,7 @@ -+2014-05-23 Ramana Radhakrishnan -+ -+ * linux-aarch64-low.c (asm/ptrace.h): Include. -+ - 2014-05-21 Jan Kratochvil - - Fix TLS access for -static -pthread. ---- a/gdb/gdbserver/linux-aarch64-low.c -+++ b/gdb/gdbserver/linux-aarch64-low.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - - #include "gdb_proc_service.h" diff --git a/gdb-vla-intel-01of23.patch b/gdb-vla-intel-01of23.patch new file mode 100644 index 0000000..0b378a4 --- /dev/null +++ b/gdb-vla-intel-01of23.patch @@ -0,0 +1,270 @@ +Subject: [PATCH 01/23] dwarf: add dwarf3 DW_OP_push_object_address opcode +Message-Id: <1401861266-6240-2-git-send-email-keven.boell@intel.com> + +The opcode pushes the address of the object being evaluated. The semantic is +equivalent to the implicit push of the base address of a data member location. + +2014-05-28 Sanimir Agovic + Keven Boell + + * dwarf2expr.c (execute_stack_op) : New case. + * dwarf2expr.h (struct dwarf_expr_context_funcs) + : New function pointer get_object_addr. + * dwarf2loc.c (struct dwarf_expr_baton): Add obj_address. + (dwarf_expr_get_obj_addr): New function. + (struct dwarf_expr_context_funcs): Add + dwarf_expr_get_obj_addr to dwarf_expr_ctx_funcs. + (dwarf2_evaluate_loc_desc_full): Initialize baton.obj_address. + (dwarf2_locexpr_baton_eval): Set baton.obj_address to addr. + (needs_get_obj_addr): New function. + (struct dwarf_expr_context_funcs): Add needs_get_obj_addr to + needs_frame_ctx_funcs. + +Change-Id: Ied9e1ba632e8d35d0ec00cc832b96d432449fd82 + +Signed-off-by: Keven Boell +--- + gdb/dwarf2expr.c | 6 ++++++ + gdb/dwarf2expr.h | 4 ---- + gdb/dwarf2loc.c | 41 +++++++++++++++++++++++++++++++++++++---- + gdb/dwarf2loc.h | 1 + + gdb/gdbtypes.c | 16 ++++++++-------- + 5 files changed, 52 insertions(+), 16 deletions(-) + +Index: gdb-7.7.90.20140613/gdb/dwarf2expr.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2expr.c 2014-06-14 15:02:21.484551132 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2expr.c 2014-06-14 15:02:52.299575369 +0200 +@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_cont + } + break; + ++ case DW_OP_push_object_address: ++ /* Return the address of the object we are currently observing. */ ++ result = (ctx->funcs->get_object_address) (ctx->baton); ++ result_val = value_from_ulongest (address_type, result); ++ break; ++ + default: + error (_("Unhandled dwarf expression opcode 0x%x"), op); + } +Index: gdb-7.7.90.20140613/gdb/dwarf2expr.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2expr.h 2014-06-14 15:02:21.485551133 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2expr.h 2014-06-14 15:02:52.299575369 +0200 +@@ -84,12 +84,8 @@ struct dwarf_expr_context_funcs + This can throw an exception if the index is out of range. */ + CORE_ADDR (*get_addr_index) (void *baton, unsigned int index); + +-#if 0 +- /* Not yet implemented. */ +- + /* Return the `object address' for DW_OP_push_object_address. */ + CORE_ADDR (*get_object_address) (void *baton); +-#endif + }; + + /* The location of a value. */ +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-14 15:02:21.487551135 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-14 15:02:52.301575370 +0200 +@@ -306,6 +306,7 @@ struct dwarf_expr_baton + { + struct frame_info *frame; + struct dwarf2_per_cu_data *per_cu; ++ CORE_ADDR obj_address; + }; + + /* Helper functions for dwarf2_evaluate_loc_desc. */ +@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (s + + baton_local.frame = caller_frame; + baton_local.per_cu = caller_per_cu; ++ baton_local.obj_address = 0; + + saved_ctx.gdbarch = ctx->gdbarch; + saved_ctx.addr_size = ctx->addr_size; +@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton, + return dwarf2_read_addr_index (debaton->per_cu, index); + } + ++/* Callback function for get_object_address. Return the address of the VLA ++ object. */ ++ ++static CORE_ADDR ++dwarf_expr_get_obj_addr (void *baton) ++{ ++ struct dwarf_expr_baton *debaton = baton; ++ ++ gdb_assert (debaton != NULL); ++ ++ if (debaton->obj_address == 0) ++ error (_("Location address is not set.")); ++ ++ return debaton->obj_address; ++} ++ + /* VALUE must be of type lval_computed with entry_data_value_funcs. Perform + the indirect method on it, that is use its stored target value, the sole + purpose of entry_data_value_funcs.. */ +@@ -2206,7 +2224,8 @@ static const struct dwarf_expr_context_f + dwarf_expr_dwarf_call, + dwarf_expr_get_base_type, + dwarf_expr_push_dwarf_reg_entry_value, +- dwarf_expr_get_addr_index ++ dwarf_expr_get_addr_index, ++ dwarf_expr_get_obj_addr + }; + + /* Evaluate a location description, starting at DATA and with length +@@ -2235,6 +2254,7 @@ dwarf2_evaluate_loc_desc_full (struct ty + + baton.frame = frame; + baton.per_cu = per_cu; ++ baton.obj_address = 0; + + ctx = new_dwarf_expr_context (); + old_chain = make_cleanup_free_dwarf_expr_context (ctx); +@@ -2440,6 +2460,7 @@ dwarf2_evaluate_loc_desc (struct type *t + + static int + dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, ++ CORE_ADDR addr, + CORE_ADDR *valp) + { + struct dwarf_expr_context *ctx; +@@ -2455,6 +2476,7 @@ dwarf2_locexpr_baton_eval (const struct + + baton.frame = get_selected_frame (NULL); + baton.per_cu = dlbaton->per_cu; ++ baton.obj_address = addr; + + objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); + +@@ -2495,7 +2517,8 @@ dwarf2_locexpr_baton_eval (const struct + /* See dwarf2loc.h. */ + + int +-dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) ++dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address, ++ CORE_ADDR *value) + { + if (prop == NULL) + return 0; +@@ -2506,7 +2529,7 @@ dwarf2_evaluate_property (const struct d + { + const struct dwarf2_property_baton *baton = prop->data.baton; + +- if (dwarf2_locexpr_baton_eval (&baton->locexpr, value)) ++ if (dwarf2_locexpr_baton_eval (&baton->locexpr, address, value)) + { + if (baton->referenced_type) + { +@@ -2657,6 +2680,15 @@ needs_get_addr_index (void *baton, unsig + return 1; + } + ++/* DW_OP_push_object_address has a frame already passed thru. */ ++ ++static CORE_ADDR ++needs_get_obj_addr (void *baton) ++{ ++ /* Nothing to do. */ ++ return 1; ++} ++ + /* Virtual method table for dwarf2_loc_desc_needs_frame below. */ + + static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = +@@ -2671,7 +2703,8 @@ static const struct dwarf_expr_context_f + needs_frame_dwarf_call, + NULL, /* get_base_type */ + needs_dwarf_reg_entry_value, +- needs_get_addr_index ++ needs_get_addr_index, ++ needs_get_obj_addr + }; + + /* Return non-zero iff the location expression at DATA (length SIZE) +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.h 2014-06-14 15:02:21.488551135 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.h 2014-06-14 15:02:52.301575370 +0200 +@@ -96,6 +96,7 @@ struct value *dwarf2_evaluate_loc_desc ( + into VALUE, otherwise returns 0. */ + + int dwarf2_evaluate_property (const struct dynamic_prop *prop, ++ CORE_ADDR address, + CORE_ADDR *value); + + CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:02:21.490551137 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:03:37.919609955 +0200 +@@ -1657,7 +1657,7 @@ is_dynamic_type (struct type *type) + of that type. */ + + static struct type * +-resolve_dynamic_range (struct type *dyn_range_type) ++resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR addr) + { + CORE_ADDR value; + struct type *static_range_type; +@@ -1668,7 +1668,7 @@ resolve_dynamic_range (struct type *dyn_ + gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); + + prop = &TYPE_RANGE_DATA (dyn_range_type)->low; +- if (dwarf2_evaluate_property (prop, &value)) ++ if (dwarf2_evaluate_property (prop, addr, &value)) + { + low_bound.kind = PROP_CONST; + low_bound.data.const_val = value; +@@ -1680,7 +1680,7 @@ resolve_dynamic_range (struct type *dyn_ + } + + prop = &TYPE_RANGE_DATA (dyn_range_type)->high; +- if (dwarf2_evaluate_property (prop, &value)) ++ if (dwarf2_evaluate_property (prop, addr, &value)) + { + high_bound.kind = PROP_CONST; + high_bound.data.const_val = value; +@@ -1707,7 +1707,7 @@ resolve_dynamic_range (struct type *dyn_ + of the associated array. */ + + static struct type * +-resolve_dynamic_array (struct type *type) ++resolve_dynamic_array (struct type *type, CORE_ADDR addr) + { + CORE_ADDR value; + struct type *elt_type; +@@ -1718,12 +1718,12 @@ resolve_dynamic_array (struct type *type + + elt_type = type; + range_type = check_typedef (TYPE_INDEX_TYPE (elt_type)); +- range_type = resolve_dynamic_range (range_type); ++ range_type = resolve_dynamic_range (range_type, addr); + + ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); + + if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY) +- elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type)); ++ elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr); + else + elt_type = TYPE_TARGET_TYPE (type); + +@@ -1853,11 +1853,11 @@ resolve_dynamic_type (struct type *type, + } + + case TYPE_CODE_ARRAY: +- resolved_type = resolve_dynamic_array (type); ++ resolved_type = resolve_dynamic_array (type, addr); + break; + + case TYPE_CODE_RANGE: +- resolved_type = resolve_dynamic_range (type); ++ resolved_type = resolve_dynamic_range (type, addr); + break; + + case TYPE_CODE_UNION: diff --git a/gdb-vla-intel-02of23.patch b/gdb-vla-intel-02of23.patch new file mode 100644 index 0000000..b797ece --- /dev/null +++ b/gdb-vla-intel-02of23.patch @@ -0,0 +1,192 @@ +Subject: [PATCH 02/23] dwarf: add DW_AT_data_location support +Message-Id: <1401861266-6240-3-git-send-email-keven.boell@intel.com> + +An object might have a descriptor proceeding the actual value. +To point the debugger to the actually value of an object +DW_AT_data_location is used for. For example the compile may +emit for this entity: + + 1| int foo[N]; + +the following descriptor: + +struct array { + size_t size; + void* data; // DW_AT_data_location describes this location +} + +This allows GDB to print the actual data of an type. + +2014-05-28 Sanimir Agovic + Keven Boell + + * dwarf2read.c (set_die_type): Parse and save DW_AT_data_location + attribute. + * gdbtypes.c (is_dynamic_type): Consider a type being dynamic if + the data location has not yet been resolved. + (resolve_dynamic_type): Evaluate data location baton + if present and save its value. + * gdbtypes.h : Add data_location. + (TYPE_DATA_LOCATION): New macro. + (TYPE_DATA_LOCATION_ADDR): New macro. + (TYPE_DATA_LOCATION_IS_ADDRESS): New macro. + * value.c: Include dwarf2loc.h. + (value_fetch_lazy): Use data location addres to read value from + memory. + (coerce_ref): Construct new value from data location. + +Change-Id: Ic633fa125efdb5e438204e4f80bb3a1c97758b12 + +Signed-off-by: Keven Boell +--- + gdb/dwarf2read.c | 15 +++++++++++++++ + gdb/gdbtypes.c | 29 +++++++++++++++++++++++++++-- + gdb/gdbtypes.h | 14 ++++++++++++++ + gdb/value.c | 8 +++++++- + 4 files changed, 63 insertions(+), 3 deletions(-) + +Index: gdb-7.7.90.20140613/gdb/dwarf2read.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-14 15:06:00.834714409 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-14 15:06:08.326719753 +0200 +@@ -21642,6 +21642,7 @@ set_die_type (struct die_info *die, stru + { + struct dwarf2_per_cu_offset_and_type **slot, ofs; + struct objfile *objfile = cu->objfile; ++ struct attribute *attr; + + /* For Ada types, make sure that the gnat-specific data is always + initialized (if not already set). There are a few types where +@@ -21656,6 +21657,20 @@ set_die_type (struct die_info *die, stru + && !HAVE_GNAT_AUX_INFO (type)) + INIT_GNAT_SPECIFIC (type); + ++ /* Read DW_AT_data_location and set in type. */ ++ attr = dwarf2_attr (die, DW_AT_data_location, cu); ++ if (attr_form_is_block (attr)) ++ { ++ struct dynamic_prop prop; ++ ++ if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ { ++ TYPE_DATA_LOCATION (type) ++ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); ++ *TYPE_DATA_LOCATION (type) = prop; ++ } ++ } ++ + if (dwarf2_per_objfile->die_type_hash == NULL) + { + dwarf2_per_objfile->die_type_hash = +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:06:00.836714410 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:12:28.963986344 +0200 +@@ -1634,7 +1634,12 @@ is_dynamic_type (struct type *type) + or the elements it contains have a dynamic contents. */ + if (is_dynamic_type (TYPE_INDEX_TYPE (type))) + return 1; +- return is_dynamic_type (TYPE_TARGET_TYPE (type)); ++ else if (TYPE_DATA_LOCATION (type) != NULL ++ && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR ++ || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST)) ++ return 1; ++ else ++ return is_dynamic_type (TYPE_TARGET_TYPE (type)); + } + + case TYPE_CODE_STRUCT: +@@ -1830,6 +1835,8 @@ resolve_dynamic_type (struct type *type, + { + struct type *real_type = check_typedef (type); + struct type *resolved_type = type; ++ const struct dynamic_prop *prop; ++ CORE_ADDR value; + + if (!is_dynamic_type (real_type)) + return type; +@@ -1869,6 +1876,18 @@ resolve_dynamic_type (struct type *type, + break; + } + ++ type = resolved_type; ++ ++ /* Resolve data_location attribute. */ ++ prop = TYPE_DATA_LOCATION (type); ++ if (dwarf2_evaluate_property (prop, addr, &value)) ++ { ++ TYPE_DATA_LOCATION_ADDR (type) = value; ++ TYPE_DATA_LOCATION_KIND (type) = PROP_CONST; ++ } ++ else ++ TYPE_DATA_LOCATION (type) = NULL; ++ + return resolved_type; + } + +@@ -4078,6 +4097,13 @@ copy_type_recursive (struct objfile *obj + *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); + } + ++ /* Copy the data location information. */ ++ if (TYPE_DATA_LOCATION (type) != NULL) ++ { ++ TYPE_DATA_LOCATION (new_type) = xmalloc (sizeof (struct dynamic_prop)); ++ *TYPE_DATA_LOCATION (new_type) = *TYPE_DATA_LOCATION (type); ++ } ++ + /* Copy pointers to other types. */ + if (TYPE_TARGET_TYPE (type)) + TYPE_TARGET_TYPE (new_type) = +Index: gdb-7.7.90.20140613/gdb/gdbtypes.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.h 2014-06-14 15:06:00.837714411 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.h 2014-06-14 15:06:08.328719754 +0200 +@@ -725,6 +725,10 @@ struct main_type + + struct func_type *func_stuff; + } type_specific; ++ ++ /* * Indirection to actual data. */ ++ ++ struct dynamic_prop *data_location; + }; + + /* * A ``struct type'' describes a particular instance of a type, with +@@ -1204,6 +1208,16 @@ extern void allocate_gnat_aux_type (stru + #define TYPE_LOW_BOUND_KIND(range_type) \ + TYPE_RANGE_DATA(range_type)->low.kind + ++/* Attribute accessors for VLA support. */ ++#define TYPE_DATA_LOCATION(thistype) \ ++ TYPE_MAIN_TYPE(thistype)->data_location ++#define TYPE_DATA_LOCATION_BATON(thistype) \ ++ TYPE_DATA_LOCATION (thistype)->data.baton ++#define TYPE_DATA_LOCATION_ADDR(thistype) \ ++ TYPE_DATA_LOCATION (thistype)->data.const_val ++#define TYPE_DATA_LOCATION_KIND(thistype) \ ++ TYPE_DATA_LOCATION (thistype)->kind ++ + /* Moto-specific stuff for FORTRAN arrays. */ + + #define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \ +Index: gdb-7.7.90.20140613/gdb/value.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-14 15:06:00.838714412 +0200 ++++ gdb-7.7.90.20140613/gdb/value.c 2014-06-14 15:06:08.329719755 +0200 +@@ -3699,8 +3699,14 @@ value_fetch_lazy (struct value *val) + } + else if (VALUE_LVAL (val) == lval_memory) + { +- CORE_ADDR addr = value_address (val); + struct type *type = check_typedef (value_enclosing_type (val)); ++ CORE_ADDR addr; ++ ++ if (TYPE_DATA_LOCATION (type) != NULL ++ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) ++ addr = TYPE_DATA_LOCATION_ADDR (type); ++ else ++ addr = value_address (val); + + if (TYPE_LENGTH (type)) + read_value_memory (val, 0, value_stack (val), diff --git a/gdb-vla-intel-03of23.patch b/gdb-vla-intel-03of23.patch new file mode 100644 index 0000000..fb284e9 --- /dev/null +++ b/gdb-vla-intel-03of23.patch @@ -0,0 +1,115 @@ +Subject: [PATCH 03/23] vla: introduce allocated/associated flags +Message-Id: <1401861266-6240-4-git-send-email-keven.boell@intel.com> + +Fortran 90 provide types whose values may be dynamically +allocated or associated with a variable under explicit +program control. The purpose of this commit is to read +allocated/associated DWARF tags and store them to the +main_type. + +2014-05-28 Keven Boell + Sanimir Agovic + + * dwarf2read.c (set_die_type): Add reading of + allocated/associated flags. + * gdbtypes.h (struct main_type): Add allocated/ + associated dwarf2_prop attributes. + (TYPE_ALLOCATED_PROP): New macro. + (TYPE_ASSOCIATED_PROP): New macro. + (TYPE_NOT_ALLOCATED): New macro. + (TYPE_NOT_ASSOCIATED): New macro. + +Change-Id: I44a9e21986de16de061b3ea2a7689f1bfa28ed2e + +Signed-off-by: Keven Boell +--- + gdb/dwarf2read.c | 28 ++++++++++++++++++++++++++++ + gdb/gdbtypes.h | 26 ++++++++++++++++++++++++++ + 2 files changed, 54 insertions(+) + +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +index 7a0f7f4..ea66602 100644 +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -21514,6 +21514,34 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + && !HAVE_GNAT_AUX_INFO (type)) + INIT_GNAT_SPECIFIC (type); + ++ /* Read DW_AT_allocated and set in type. */ ++ attr = dwarf2_attr (die, DW_AT_allocated, cu); ++ if (attr_form_is_block (attr)) ++ { ++ struct dynamic_prop prop; ++ ++ if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ { ++ TYPE_ALLOCATED_PROP (type) ++ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); ++ *TYPE_ALLOCATED_PROP (type) = prop; ++ } ++ } ++ ++ /* Read DW_AT_associated and set in type. */ ++ attr = dwarf2_attr (die, DW_AT_associated, cu); ++ if (attr_form_is_block (attr)) ++ { ++ struct dynamic_prop prop; ++ ++ if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ { ++ TYPE_ASSOCIATED_PROP (type) ++ = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); ++ *TYPE_ASSOCIATED_PROP (type) = prop; ++ } ++ } ++ + /* Read DW_AT_data_location and set in type. */ + attr = dwarf2_attr (die, DW_AT_data_location, cu); + if (attr_form_is_block (attr)) +diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h +index c6d14d2..52e6233 100644 +--- a/gdb/gdbtypes.h ++++ b/gdb/gdbtypes.h +@@ -726,6 +726,18 @@ struct main_type + /* * Indirection to actual data. */ + + struct dynamic_prop *data_location; ++ ++ /* Structure for DW_AT_allocated. ++ The presence of this attribute indicates that the object of the type ++ can be allocated/deallocated. The value can be a dwarf expression, ++ reference, or a constant. */ ++ struct dynamic_prop *allocated; ++ ++ /* Structure for DW_AT_associated. ++ The presence of this attribute indicated that the object of the type ++ can be associated. The value can be a dwarf expression, ++ reference, or a constant. */ ++ struct dynamic_prop *associated; + }; + + /* * A ``struct type'' describes a particular instance of a type, with +@@ -1214,6 +1226,20 @@ extern void allocate_gnat_aux_type (struct type *); + TYPE_DATA_LOCATION (thistype)->data.const_val + #define TYPE_DATA_LOCATION_KIND(thistype) \ + TYPE_DATA_LOCATION (thistype)->kind ++#define TYPE_ALLOCATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->allocated ++#define TYPE_ASSOCIATED_PROP(thistype) TYPE_MAIN_TYPE(thistype)->associated ++ ++/* Allocated status of type object. If set to non-zero it means the object ++ is allocated. A zero value means it is not allocated. */ ++#define TYPE_NOT_ALLOCATED(t) (TYPE_ALLOCATED_PROP (t) \ ++ && TYPE_ALLOCATED_PROP (t)->kind == PROP_CONST \ ++ && !TYPE_ALLOCATED_PROP (t)->data.const_val) ++ ++/* Associated status of type object. If set to non-zero it means the object ++ is associated. A zero value means it is not associated. */ ++#define TYPE_NOT_ASSOCIATED(t) (TYPE_ASSOCIATED_PROP (t) \ ++ && TYPE_ASSOCIATED_PROP (t)->kind == PROP_CONST \ ++ && !TYPE_ASSOCIATED_PROP (t)->data.const_val) + + /* Moto-specific stuff for FORTRAN arrays. */ + +-- +1.7.9.5 + diff --git a/gdb-vla-intel-04of23-fix.patch b/gdb-vla-intel-04of23-fix.patch new file mode 100644 index 0000000..305c541 --- /dev/null +++ b/gdb-vla-intel-04of23-fix.patch @@ -0,0 +1,36 @@ +Re: [PATCH 04/23] vla: make dynamic fortran arrays functional. +https://sourceware.org/ml/gdb-patches/2014-06/msg00570.html + +Index: gdb-7.7.90.20140613/gdb/valarith.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:16:48.129164644 +0200 ++++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:17:52.544225452 +0200 +@@ -195,19 +195,19 @@ value_subscripted_rvalue (struct value * + struct type *array_type = check_typedef (value_type (array)); + struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); + unsigned int elt_size = TYPE_LENGTH (elt_type); +- unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); ++ unsigned int elt_offs; + struct value *v; + ++ if (TYPE_NOT_ASSOCIATED (array_type)) ++ error (_("no such vector element because not associated")); ++ if (TYPE_NOT_ALLOCATED (array_type)) ++ error (_("no such vector element because not allocated")); ++ ++ elt_offs = elt_size * longest_to_int (index - lowerbound); ++ + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) + && elt_offs >= TYPE_LENGTH (array_type))) +- { +- if (TYPE_NOT_ASSOCIATED (array_type)) +- error (_("no such vector element because not associated")); +- else if (TYPE_NOT_ALLOCATED (array_type)) +- error (_("no such vector element because not allocated")); +- else +- error (_("no such vector element")); +- } ++ error (_("no such vector element")); + + if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) + v = allocate_value_lazy (elt_type); diff --git a/gdb-vla-intel-04of23.patch b/gdb-vla-intel-04of23.patch new file mode 100644 index 0000000..f003ab3 --- /dev/null +++ b/gdb-vla-intel-04of23.patch @@ -0,0 +1,614 @@ +Subject: [PATCH 04/23] vla: make dynamic fortran arrays functional. +Message-Id: <1401861266-6240-5-git-send-email-keven.boell@intel.com> + +This patch enables GDB to print the value of a dynamic +array (VLA) if allocated/associated in fortran. If not the +allocation status will be printed to the command line. + +(gdb) p vla_not_allocated +$1 = + +(gdb) p vla_allocated +$1 = (1, 2, 3) + +(gdb) p vla_not_associated +$1 = + +(gdb) p vla_associated +$1 = (3, 2, 1) + +The patch covers various locations where the allocation/ +association status makes sense to print. + +2014-05-28 Keven Boell + Sanimir Agovic + + * dwarf2loc.c (dwarf2_address_data_valid): New + function. + * dwarf2loc.h (dwarf2_address_data_valid): New + function. + * f-typeprint.c (f_print_type): Print allocation/ + association status. + (f_type_print_varspec_suffix): Print allocation/ + association status for &-operator usages. + * gdbtypes.c (create_array_type_with_stride): Add + query for valid data location. + (is_dynamic_type): Extend dynamic type detection + with allocated/associated. Add type detection for + fields. + (resolve_dynamic_range): Copy type before resolving + it as dynamic attributes need to be preserved. + (resolve_dynamic_array): Copy type before resolving + it as dynamic attributes need to be preserved. Add + resolving of allocated/associated attributes. + (resolve_dynamic_type): Add call to nested + type resolving. + (copy_type_recursive): Add allocated/associated + attributes to be copied. + (copy_type): Copy allocated/associated/data_location + as well as the fields structure if available. + (resolve_dynamic_compound): New function. + * valarith.c (value_subscripted_rvalue): Print allocated/ + associated status when indexing a VLA. + * valprint.c (valprint_check_validity): Print allocated/ + associated status. + (val_print_not_allocated): New function. + (val_print_not_associated): New function. + * valprint.h (val_print_not_allocated): New function. + (val_print_not_associated): New function. + * value.c (set_value_component_location): Adjust the value + address for single value prints. + +Change-Id: Idfb44c8a6b38008f8e2c84cb0fdb13729ec160f4 + +Signed-off-by: Keven Boell +--- + gdb/dwarf2loc.c | 14 +++++ + gdb/dwarf2loc.h | 6 ++ + gdb/f-typeprint.c | 62 +++++++++++++------- + gdb/gdbtypes.c | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++-- + gdb/valarith.c | 9 ++- + gdb/valprint.c | 40 +++++++++++++ + gdb/valprint.h | 4 ++ + gdb/value.c | 20 +++++++ + 8 files changed, 292 insertions(+), 28 deletions(-) + +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.c 2014-06-14 15:12:43.797996885 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.c 2014-06-14 15:12:45.485998049 +0200 +@@ -2569,6 +2569,20 @@ dwarf2_evaluate_property (const struct d + return 0; + } + ++/* See dwarf2loc.h. */ ++ ++int ++dwarf2_address_data_valid (const struct type *type) ++{ ++ if (TYPE_NOT_ASSOCIATED (type)) ++ return 0; ++ ++ if (TYPE_NOT_ALLOCATED (type)) ++ return 0; ++ ++ return 1; ++} ++ + + /* Helper functions and baton for dwarf2_loc_desc_needs_frame. */ + +Index: gdb-7.7.90.20140613/gdb/dwarf2loc.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2loc.h 2014-06-14 15:12:43.797996885 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2loc.h 2014-06-14 15:12:45.486998064 +0200 +@@ -102,6 +102,12 @@ int dwarf2_evaluate_property (const stru + CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, + unsigned int addr_index); + ++/* Checks if a dwarf location definition is valid. ++ Returns 1 if valid; 0 otherwise. */ ++ ++extern int dwarf2_address_data_valid (const struct type *type); ++ ++ + /* The symbol location baton types used by the DWARF-2 reader (i.e. + SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct + dwarf2_locexpr_baton" is for a symbol with a single location +Index: gdb-7.7.90.20140613/gdb/f-typeprint.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/f-typeprint.c 2014-06-14 15:12:43.798996886 +0200 ++++ gdb-7.7.90.20140613/gdb/f-typeprint.c 2014-06-14 15:12:45.486998064 +0200 +@@ -30,6 +30,7 @@ + #include "gdbcore.h" + #include "target.h" + #include "f-lang.h" ++#include "valprint.h" + + #include + #include +@@ -56,6 +57,17 @@ f_print_type (struct type *type, const c + enum type_code code; + int demangled_args; + ++ if (TYPE_NOT_ASSOCIATED (type)) ++ { ++ val_print_not_associated (stream); ++ return; ++ } ++ if (TYPE_NOT_ALLOCATED (type)) ++ { ++ val_print_not_allocated (stream); ++ return; ++ } ++ + f_type_print_base (type, stream, show, level); + code = TYPE_CODE (type); + if ((varstring != NULL && *varstring != '\0') +@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type + if (arrayprint_recurse_level == 1) + fprintf_filtered (stream, "("); + +- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) +- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, +- arrayprint_recurse_level); +- +- lower_bound = f77_get_lowerbound (type); +- if (lower_bound != 1) /* Not the default. */ +- fprintf_filtered (stream, "%d:", lower_bound); +- +- /* Make sure that, if we have an assumed size array, we +- print out a warning and print the upperbound as '*'. */ +- +- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) +- fprintf_filtered (stream, "*"); ++ if (TYPE_NOT_ASSOCIATED (type)) ++ val_print_not_associated (stream); ++ else if (TYPE_NOT_ALLOCATED (type)) ++ val_print_not_allocated (stream); + else +- { +- upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "%d", upper_bound); +- } +- +- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) +- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, +- arrayprint_recurse_level); ++ { ++ ++ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) ++ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, ++ arrayprint_recurse_level); ++ ++ lower_bound = f77_get_lowerbound (type); ++ if (lower_bound != 1) /* Not the default. */ ++ fprintf_filtered (stream, "%d:", lower_bound); ++ ++ /* Make sure that, if we have an assumed size array, we ++ print out a warning and print the upperbound as '*'. */ ++ ++ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) ++ fprintf_filtered (stream, "*"); ++ else ++ { ++ upper_bound = f77_get_upperbound (type); ++ fprintf_filtered (stream, "%d", upper_bound); ++ } ++ ++ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) ++ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0, ++ arrayprint_recurse_level); ++ } + if (arrayprint_recurse_level == 1) + fprintf_filtered (stream, ")"); + else +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:12:43.801996888 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:14:34.837102369 +0200 +@@ -1003,7 +1003,8 @@ create_array_type_with_stride (struct ty + + TYPE_CODE (result_type) = TYPE_CODE_ARRAY; + TYPE_TARGET_TYPE (result_type) = element_type; +- if (has_static_range (TYPE_RANGE_DATA (range_type))) ++ if (has_static_range (TYPE_RANGE_DATA (range_type)) ++ && dwarf2_address_data_valid (result_type)) + { + LONGEST low_bound, high_bound; + +@@ -1616,11 +1617,30 @@ stub_noname_complaint (void) + int + is_dynamic_type (struct type *type) + { ++ int index; ++ ++ if (!type) ++ return 0; ++ + type = check_typedef (type); + + if (TYPE_CODE (type) == TYPE_CODE_REF) + type = check_typedef (TYPE_TARGET_TYPE (type)); + ++ if (TYPE_ASSOCIATED_PROP (type)) ++ return 1; ++ ++ if (TYPE_ALLOCATED_PROP (type)) ++ return 1; ++ ++ /* Scan field types in the Fortran case for nested dynamic types. ++ This will be done only for Fortran as in the C++ case an endless recursion ++ can occur in the area of classes. */ ++ if (current_language->la_language == language_fortran) ++ for (index = 0; index < TYPE_NFIELDS (type); index++) ++ if (is_dynamic_type (TYPE_FIELD_TYPE (type, index))) ++ return 1; ++ + switch (TYPE_CODE (type)) + { + case TYPE_CODE_RANGE: +@@ -1669,6 +1689,7 @@ resolve_dynamic_range (struct type *dyn_ + const struct dynamic_prop *prop; + const struct dwarf2_locexpr_baton *baton; + struct dynamic_prop low_bound, high_bound; ++ struct type *range_copy = copy_type (dyn_range_type); + + gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); + +@@ -1700,8 +1721,8 @@ resolve_dynamic_range (struct type *dyn_ + high_bound.data.const_val = 0; + } + +- static_range_type = create_range_type (copy_type (dyn_range_type), +- TYPE_TARGET_TYPE (dyn_range_type), ++ static_range_type = create_range_type (range_copy, ++ TYPE_TARGET_TYPE (range_copy), + &low_bound, &high_bound); + TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1; + return static_range_type; +@@ -1718,6 +1739,8 @@ resolve_dynamic_array (struct type *type + struct type *elt_type; + struct type *range_type; + struct type *ary_dim; ++ struct dynamic_prop *prop; ++ struct type *copy = copy_type (type); + + gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY); + +@@ -1725,18 +1748,93 @@ resolve_dynamic_array (struct type *type + range_type = check_typedef (TYPE_INDEX_TYPE (elt_type)); + range_type = resolve_dynamic_range (range_type, addr); + ++ prop = TYPE_ALLOCATED_PROP (type); ++ if (dwarf2_evaluate_property (prop, addr, &value)) ++ { ++ TYPE_ALLOCATED_PROP (copy)->kind = PROP_CONST; ++ TYPE_ALLOCATED_PROP (copy)->data.const_val = value; ++ } ++ ++ prop = TYPE_ASSOCIATED_PROP (type); ++ if (dwarf2_evaluate_property (prop, addr, &value)) ++ { ++ TYPE_ASSOCIATED_PROP (copy)->kind = PROP_CONST; ++ TYPE_ASSOCIATED_PROP (copy)->data.const_val = value; ++ } ++ + ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); + + if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY) +- elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (type), addr); ++ elt_type = resolve_dynamic_array (TYPE_TARGET_TYPE (copy), addr); + else + elt_type = TYPE_TARGET_TYPE (type); + +- return create_array_type (copy_type (type), ++ return create_array_type (copy, + elt_type, + range_type); + } + ++/* Resolves dynamic compound types, e.g. STRUCTS's to static ones. ++ ADDRESS is needed to resolve the compound type data location. */ ++ ++static struct type * ++resolve_dynamic_compound (struct type *type, CORE_ADDR addr) ++{ ++ struct type *cur_type, *prev_type, *copy; ++ int index, depth = 0; ++ ++ cur_type = type; ++ prev_type = cur_type; ++ while (cur_type) ++ { ++ switch (TYPE_CODE (cur_type)) ++ { ++ case TYPE_CODE_STRUCT: ++ { ++ copy = copy_type (cur_type); ++ for (index = 0; index < TYPE_NFIELDS (copy); index++) ++ { ++ struct type *index_type = TYPE_FIELD_TYPE (copy, index); ++ ++ if (index_type == NULL) ++ continue; ++ ++ if (TYPE_CODE (index_type) == TYPE_CODE_ARRAY ++ || TYPE_CODE (index_type) == TYPE_CODE_STRUCT) ++ { ++ if (TYPE_CODE (index_type) != TYPE_CODE_RANGE) ++ addr += ++ (TYPE_FIELD_BITPOS (copy, index) / 8); ++ ++ TYPE_FIELD_TYPE (copy, index) = ++ resolve_dynamic_type (TYPE_FIELD_TYPE (copy, index), ++ addr); ++ } ++ } ++ ++ /* If a struct type will be resolved as the first type, we need ++ to assign it back the resolved_type. In the other case it can ++ be that we have a struct, which is nested in another type. ++ Therefore we need to preserve the previous type, to assign the ++ new resolved type as the previous' target type. */ ++ if (depth == 0) ++ type = copy; ++ else ++ TYPE_TARGET_TYPE (prev_type) = copy; ++ } ++ break; ++ } ++ ++ /* Store the previous type, in order to assign resolved types back to ++ the right target type. */ ++ prev_type = cur_type; ++ cur_type = TYPE_TARGET_TYPE (cur_type); ++ depth++; ++ }; ++ ++ return type; ++} ++ + /* Resolve dynamic bounds of members of the union TYPE to static + bounds. */ + +@@ -1836,7 +1934,7 @@ resolve_dynamic_type (struct type *type, + struct type *real_type = check_typedef (type); + struct type *resolved_type = type; + const struct dynamic_prop *prop; +- CORE_ADDR value; ++ CORE_ADDR value, adjusted_address = addr; + + if (!is_dynamic_type (real_type)) + return type; +@@ -1882,12 +1980,15 @@ resolve_dynamic_type (struct type *type, + prop = TYPE_DATA_LOCATION (type); + if (dwarf2_evaluate_property (prop, addr, &value)) + { ++ adjusted_address = value; + TYPE_DATA_LOCATION_ADDR (type) = value; + TYPE_DATA_LOCATION_KIND (type) = PROP_CONST; + } + else + TYPE_DATA_LOCATION (type) = NULL; + ++ resolved_type = resolve_dynamic_compound (type, adjusted_address); ++ + return resolved_type; + } + +@@ -4104,6 +4205,20 @@ copy_type_recursive (struct objfile *obj + *TYPE_DATA_LOCATION (new_type) = *TYPE_DATA_LOCATION (type); + } + ++ /* Copy allocated information. */ ++ if (TYPE_ALLOCATED_PROP (type) != NULL) ++ { ++ TYPE_ALLOCATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop)); ++ *TYPE_ALLOCATED_PROP (new_type) = *TYPE_ALLOCATED_PROP (type); ++ } ++ ++ /* Copy associated information. */ ++ if (TYPE_ASSOCIATED_PROP (type) != NULL) ++ { ++ TYPE_ASSOCIATED_PROP (new_type) = xmalloc (sizeof (struct dynamic_prop)); ++ *TYPE_ASSOCIATED_PROP (new_type) = *TYPE_ASSOCIATED_PROP (type); ++ } ++ + /* Copy pointers to other types. */ + if (TYPE_TARGET_TYPE (type)) + TYPE_TARGET_TYPE (new_type) = +@@ -4150,6 +4265,44 @@ copy_type (const struct type *type) + memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), + sizeof (struct main_type)); + ++ if (TYPE_ALLOCATED_PROP (type)) ++ { ++ TYPE_ALLOCATED_PROP (new_type) ++ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack, ++ struct dynamic_prop); ++ memcpy (TYPE_ALLOCATED_PROP (new_type), TYPE_ALLOCATED_PROP (type), ++ sizeof (struct dynamic_prop)); ++ } ++ ++ if (TYPE_ASSOCIATED_PROP (type)) ++ { ++ TYPE_ASSOCIATED_PROP (new_type) ++ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack, ++ struct dynamic_prop); ++ memcpy (TYPE_ASSOCIATED_PROP (new_type), TYPE_ASSOCIATED_PROP (type), ++ sizeof (struct dynamic_prop)); ++ } ++ ++ if (TYPE_DATA_LOCATION (type)) ++ { ++ TYPE_DATA_LOCATION (new_type) ++ = OBSTACK_ZALLOC (&TYPE_OWNER (type).objfile->objfile_obstack, ++ struct dynamic_prop); ++ memcpy (TYPE_DATA_LOCATION (new_type), TYPE_DATA_LOCATION (type), ++ sizeof (struct dynamic_prop)); ++ } ++ ++ if (TYPE_NFIELDS (type)) ++ { ++ int nfields = TYPE_NFIELDS (type); ++ ++ TYPE_FIELDS (new_type) ++ = OBSTACK_CALLOC (&TYPE_OWNER (type).objfile->objfile_obstack, ++ nfields, struct field); ++ memcpy (TYPE_FIELDS (new_type), TYPE_FIELDS (type), ++ nfields * sizeof (struct field)); ++ } ++ + return new_type; + } + +Index: gdb-7.7.90.20140613/gdb/valarith.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-14 15:12:43.801996888 +0200 ++++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-14 15:12:45.488998075 +0200 +@@ -200,7 +200,14 @@ value_subscripted_rvalue (struct value * + + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) + && elt_offs >= TYPE_LENGTH (array_type))) +- error (_("no such vector element")); ++ { ++ if (TYPE_NOT_ASSOCIATED (array_type)) ++ error (_("no such vector element because not associated")); ++ else if (TYPE_NOT_ALLOCATED (array_type)) ++ error (_("no such vector element because not allocated")); ++ else ++ error (_("no such vector element")); ++ } + + if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) + v = allocate_value_lazy (elt_type); +Index: gdb-7.7.90.20140613/gdb/valprint.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/valprint.c 2014-06-14 15:12:43.802996888 +0200 ++++ gdb-7.7.90.20140613/gdb/valprint.c 2014-06-14 15:12:45.488998075 +0200 +@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file + { + CHECK_TYPEDEF (type); + ++ if (TYPE_NOT_ASSOCIATED (type)) ++ { ++ val_print_not_associated (stream); ++ return 0; ++ } ++ ++ if (TYPE_NOT_ALLOCATED (type)) ++ { ++ val_print_not_allocated (stream); ++ return 0; ++ } ++ + if (TYPE_CODE (type) != TYPE_CODE_UNION + && TYPE_CODE (type) != TYPE_CODE_STRUCT + && TYPE_CODE (type) != TYPE_CODE_ARRAY) +@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_fil + fprintf_filtered (stream, _("")); + } + ++void ++val_print_not_allocated (struct ui_file *stream) ++{ ++ fprintf_filtered (stream, _("")); ++} ++ ++void ++val_print_not_associated (struct ui_file *stream) ++{ ++ fprintf_filtered (stream, _("")); ++} ++ + /* A generic val_print that is suitable for use by language + implementations of the la_val_print method. This function can + handle most type codes, though not all, notably exception +@@ -803,12 +827,16 @@ static int + value_check_printable (struct value *val, struct ui_file *stream, + const struct value_print_options *options) + { ++ const struct type *type; ++ + if (val == 0) + { + fprintf_filtered (stream, _("
")); + return 0; + } + ++ type = value_type (val); ++ + if (value_entirely_optimized_out (val)) + { + if (options->summary && !val_print_scalar_type_p (value_type (val))) +@@ -834,6 +862,18 @@ value_check_printable (struct value *val + return 0; + } + ++ if (TYPE_NOT_ASSOCIATED (type)) ++ { ++ val_print_not_associated (stream); ++ return 0; ++ } ++ ++ if (TYPE_NOT_ALLOCATED (type)) ++ { ++ val_print_not_allocated (stream); ++ return 0; ++ } ++ + return 1; + } + +Index: gdb-7.7.90.20140613/gdb/valprint.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/valprint.h 2014-06-14 15:12:43.803996889 +0200 ++++ gdb-7.7.90.20140613/gdb/valprint.h 2014-06-14 15:12:45.489998073 +0200 +@@ -217,4 +217,8 @@ extern void output_command_const (const + + extern int val_print_scalar_type_p (struct type *type); + ++extern void val_print_not_allocated (struct ui_file *stream); ++ ++extern void val_print_not_associated (struct ui_file *stream); ++ + #endif +Index: gdb-7.7.90.20140613/gdb/value.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/value.c 2014-06-14 15:12:43.804996890 +0200 ++++ gdb-7.7.90.20140613/gdb/value.c 2014-06-14 15:12:45.490998069 +0200 +@@ -43,6 +43,7 @@ + #include "tracepoint.h" + #include "cp-abi.h" + #include "user-regs.h" ++#include "dwarf2loc.h" + + /* Prototypes for exported functions. */ + +@@ -1646,6 +1647,25 @@ set_value_component_location (struct val + if (funcs->copy_closure) + component->location.computed.closure = funcs->copy_closure (whole); + } ++ ++ /* For dynamic types compute the address of the component value location in ++ sub range types based on the location of the sub range type, if not being ++ an internal GDB variable or parts of it. */ ++ if (VALUE_LVAL (component) != lval_internalvar ++ && VALUE_LVAL (component) != lval_internalvar_component) ++ { ++ CORE_ADDR addr; ++ struct type *type = value_type (whole); ++ ++ addr = value_raw_address (component); ++ ++ if (TYPE_DATA_LOCATION (type) ++ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) ++ { ++ addr = TYPE_DATA_LOCATION_ADDR (type); ++ set_value_address (component, addr); ++ } ++ } + } + + diff --git a/gdb-vla-intel-05of23.patch b/gdb-vla-intel-05of23.patch new file mode 100644 index 0000000..3b09937 --- /dev/null +++ b/gdb-vla-intel-05of23.patch @@ -0,0 +1,65 @@ +Subject: [PATCH 05/23] vla: make field selection work with vla +Message-Id: <1401861266-6240-6-git-send-email-keven.boell@intel.com> + +In Fortran vla are pointers to arrays. Thus a +type only contains a pointer to such array and +we need to re-read the field to retrieve the +correct vla. + +old (wrong value): +(gdb) p type_var%vla(14) +$1 = 1 + +new (correct value): +(gdb) p type_var%vla(14) +$1 = 42 + +2014-05-28 Sanimir Agovic + Keven Boell + + * value.c (value_primitive_field): Re-evaluate + field value to get the actual value. + +Change-Id: Ic22c37324963aca520c52a80fbbd0042d1fddc05 + +Signed-off-by: Keven Boell +--- + gdb/value.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/gdb/value.c b/gdb/value.c +index 08593b6..1f0d9a4 100644 +--- a/gdb/value.c ++++ b/gdb/value.c +@@ -2929,13 +2929,22 @@ value_primitive_field (struct value *arg1, int offset, + v = allocate_value_lazy (type); + else + { +- v = allocate_value (type); +- value_contents_copy_raw (v, value_embedded_offset (v), +- arg1, value_embedded_offset (arg1) + offset, +- TYPE_LENGTH (type)); ++ if (TYPE_DATA_LOCATION (type) ++ && TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) ++ v = value_at_lazy (type, value_address (arg1) + offset); ++ else ++ { ++ v = allocate_value (type); ++ value_contents_copy_raw (v, value_embedded_offset (v), ++ arg1, value_embedded_offset (arg1) + offset, ++ TYPE_LENGTH (type)); ++ } + } +- v->offset = (value_offset (arg1) + offset +- + value_embedded_offset (arg1)); ++ ++ if (!TYPE_DATA_LOCATION (type) ++ || !TYPE_DATA_LOCATION_KIND (type) == PROP_CONST) ++ v->offset = (value_offset (arg1) + offset ++ + value_embedded_offset (arg1)); + } + set_value_component_location (v, arg1); + VALUE_REGNUM (v) = VALUE_REGNUM (arg1); +-- +1.7.9.5 + diff --git a/gdb-vla-intel-06of23.patch b/gdb-vla-intel-06of23.patch new file mode 100644 index 0000000..39c2d05 --- /dev/null +++ b/gdb-vla-intel-06of23.patch @@ -0,0 +1,67 @@ +Subject: [PATCH 06/23] vla: reconstruct value to compute bounds of target type +Message-Id: <1401861266-6240-7-git-send-email-keven.boell@intel.com> + +Printing a pointer to an array, gdb tries to print the +target type including its bounds. To follow this +semantic with vla, this patch re-constructs the value to +resolve the bounds of the target type. + +2014-05-28 Sanimir Agovic + Keven Boell + + * typeprint.c (whatis_exp): Re-construct value to + compute bounds of target type. + * c-valprint.c (c_value_print): Re-construct value + to compute bounds of target type. + +Change-Id: Ia8a25021c7cc206711ca6f359ae5566a367e3b3d + +Signed-off-by: Keven Boell +--- + gdb/c-valprint.c | 11 ++++++++++- + gdb/typeprint.c | 7 +++++++ + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c +index f4694b0..8c45276 100644 +--- a/gdb/c-valprint.c ++++ b/gdb/c-valprint.c +@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct ui_file *stream, + { + /* normal case */ + fprintf_filtered (stream, "("); +- type_print (value_type (val), "", stream, -1); ++ if (is_dynamic_type (TYPE_TARGET_TYPE (type))) ++ { ++ struct value *v; ++ ++ v = value_ind (val); ++ v = value_addr (v); ++ type_print (value_type (v), "", stream, -1); ++ } ++ else ++ type_print (value_type (val), "", stream, -1); + fprintf_filtered (stream, ") "); + } + } +diff --git a/gdb/typeprint.c b/gdb/typeprint.c +index b4ad431..b3c73a8 100644 +--- a/gdb/typeprint.c ++++ b/gdb/typeprint.c +@@ -459,6 +459,13 @@ whatis_exp (char *exp, int show) + + type = value_type (val); + ++ if (TYPE_CODE (type) == TYPE_CODE_PTR) ++ if (is_dynamic_type (TYPE_TARGET_TYPE (type))) ++ { ++ val = value_addr (value_ind (val)); ++ type = value_type (val); ++ } ++ + get_user_print_options (&opts); + if (opts.objectprint) + { +-- +1.7.9.5 + diff --git a/gdb-vla-intel-07of23.patch b/gdb-vla-intel-07of23.patch new file mode 100644 index 0000000..1eeebe2 --- /dev/null +++ b/gdb-vla-intel-07of23.patch @@ -0,0 +1,211 @@ +Subject: [PATCH 07/23] vla: use value constructor instead of raw-buffer manipulation +Message-Id: <1401861266-6240-8-git-send-email-keven.boell@intel.com> + +Instead of pre-computing indices into a fortran array re-use +the value_* interfaces to subscript a fortran array. + +2014-05-28 Sanimir Agovic + Keven Boell + + * f-valprint.c (f77_create_arrayprint_offset_tbl): Remove + function. + (F77_DIM_SIZE, F77_DIM_OFFSET): Remove macro. + (f77_print_array_1): Use value_subscript to subscript a + value array. + (f77_print_array): Remove call to f77_create_arrayprint_offset_tbl. + (f_val_print): Use value_field to construct a field value. + +Change-Id: I09e482ceb114eeb0f08b5528d40ffed8d79119ee + +Signed-off-by: Keven Boell +--- + gdb/f-valprint.c | 118 ++++++++++++++++++------------------------------------ + 1 file changed, 39 insertions(+), 79 deletions(-) + +diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c +index d8c767f..1ab5bd8 100644 +--- a/gdb/f-valprint.c ++++ b/gdb/f-valprint.c +@@ -39,8 +39,6 @@ + + extern void _initialize_f_valprint (void); + static void info_common_command (char *, int); +-static void f77_create_arrayprint_offset_tbl (struct type *, +- struct ui_file *); + static void f77_get_dynamic_length_of_aggregate (struct type *); + + int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; +@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; + /* Array which holds offsets to be applied to get a row's elements + for a given array. Array also holds the size of each subarray. */ + +-/* The following macro gives us the size of the nth dimension, Where +- n is 1 based. */ +- +-#define F77_DIM_SIZE(n) (f77_array_offset_tbl[n][1]) +- +-/* The following gives us the offset for row n where n is 1-based. */ +- +-#define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0]) +- + int + f77_get_lowerbound (struct type *type) + { +@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (struct type *type) + * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type))); + } + +-/* Function that sets up the array offset,size table for the array +- type "type". */ +- +-static void +-f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) +-{ +- struct type *tmp_type; +- int eltlen; +- int ndimen = 1; +- int upper, lower; +- +- tmp_type = type; +- +- while (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY) +- { +- upper = f77_get_upperbound (tmp_type); +- lower = f77_get_lowerbound (tmp_type); +- +- F77_DIM_SIZE (ndimen) = upper - lower + 1; +- +- tmp_type = TYPE_TARGET_TYPE (tmp_type); +- ndimen++; +- } +- +- /* Now we multiply eltlen by all the offsets, so that later we +- can print out array elements correctly. Up till now we +- know an offset to apply to get the item but we also +- have to know how much to add to get to the next item. */ +- +- ndimen--; +- eltlen = TYPE_LENGTH (tmp_type); +- F77_DIM_OFFSET (ndimen) = eltlen; +- while (--ndimen > 0) +- { +- eltlen *= F77_DIM_SIZE (ndimen + 1); +- F77_DIM_OFFSET (ndimen) = eltlen; +- } +-} +- +- +- + /* Actual function which prints out F77 arrays, Valaddr == address in + the superior. Address == the address in the inferior. */ + +@@ -167,41 +115,56 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, + const struct value_print_options *options, + int *elts) + { ++ struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type)); ++ CORE_ADDR addr = address + embedded_offset; ++ LONGEST lowerbound, upperbound; + int i; + ++ get_discrete_bounds (range_type, &lowerbound, &upperbound); ++ + if (nss != ndimensions) + { +- for (i = 0; +- (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); ++ size_t dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type)); ++ size_t offs = 0; ++ ++ for (i = lowerbound; ++ (i < upperbound + 1 && (*elts) < options->print_max); + i++) + { ++ struct value *subarray = value_from_contents_and_address ++ (TYPE_TARGET_TYPE (type), value_contents_for_printing_const (val) ++ + offs, addr + offs); ++ + fprintf_filtered (stream, "( "); +- f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), +- valaddr, +- embedded_offset + i * F77_DIM_OFFSET (nss), +- address, +- stream, recurse, val, options, elts); ++ f77_print_array_1 (nss + 1, ndimensions, value_type (subarray), ++ value_contents_for_printing (subarray), ++ value_embedded_offset (subarray), ++ value_address (subarray), ++ stream, recurse, subarray, options, elts); ++ offs += dim_size; + fprintf_filtered (stream, ") "); + } +- if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) ++ if (*elts >= options->print_max && i < upperbound) + fprintf_filtered (stream, "..."); + } + else + { +- for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max; ++ for (i = lowerbound; i < upperbound + 1 && (*elts) < options->print_max; + i++, (*elts)++) + { +- val_print (TYPE_TARGET_TYPE (type), +- valaddr, +- embedded_offset + i * F77_DIM_OFFSET (ndimensions), +- address, stream, recurse, +- val, options, current_language); ++ struct value *elt = value_subscript ((struct value *)val, i); ++ ++ val_print (value_type (elt), ++ value_contents_for_printing (elt), ++ value_embedded_offset (elt), ++ value_address (elt), stream, recurse, ++ elt, options, current_language); + +- if (i != (F77_DIM_SIZE (nss) - 1)) ++ if (i != upperbound) + fprintf_filtered (stream, ", "); + + if ((*elts == options->print_max - 1) +- && (i != (F77_DIM_SIZE (nss) - 1))) ++ && (i != upperbound)) + fprintf_filtered (stream, "..."); + } + } +@@ -228,12 +191,6 @@ f77_print_array (struct type *type, const gdb_byte *valaddr, + Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"), + ndimensions, MAX_FORTRAN_DIMS); + +- /* Since F77 arrays are stored column-major, we set up an +- offset table to get at the various row's elements. The +- offset table contains entries for both offset and subarray size. */ +- +- f77_create_arrayprint_offset_tbl (type, stream); +- + f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset, + address, stream, recurse, val, options, &elts); + } +@@ -378,12 +335,15 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, + fprintf_filtered (stream, "( "); + for (index = 0; index < TYPE_NFIELDS (type); index++) + { +- int offset = TYPE_FIELD_BITPOS (type, index) / 8; ++ struct value *field = value_field ++ ((struct value *)original_value, index); ++ ++ val_print (value_type (field), ++ value_contents_for_printing (field), ++ value_embedded_offset (field), ++ value_address (field), stream, recurse + 1, ++ field, options, current_language); + +- val_print (TYPE_FIELD_TYPE (type, index), valaddr, +- embedded_offset + offset, +- address, stream, recurse + 1, +- original_value, options, current_language); + if (index != TYPE_NFIELDS (type) - 1) + fputs_filtered (", ", stream); + } +-- +1.7.9.5 + diff --git a/gdb-vla-intel-08of23.patch b/gdb-vla-intel-08of23.patch new file mode 100644 index 0000000..7559d00 --- /dev/null +++ b/gdb-vla-intel-08of23.patch @@ -0,0 +1,49 @@ +Subject: [PATCH 08/23] vla: get dynamic array corner cases to work +Message-Id: <1401861266-6240-9-git-send-email-keven.boell@intel.com> + +This patch does not overwrite the value type in +case it is a dynamic type. For dynamic types GDB +resolved its dynamic values in a copy of the type. +The call to deprecated_set_value_type overwrites the +resolved type with the original type, which breaks +e.g. pointer to a Fortran type, which contains a dynamic +array. + +Old: +(gdb) print &vla1 +(PTR TO -> ( real(kind=4) (23959136:23959184))) 0x7fffffffd490 + +New: +(gdb) print &vla1 +(PTR TO -> ( real(kind=4) (5))) 0x7fffffffd490 + +2014-05-28 Keven Boell + Sanimir Agovic + + * value.c (readjust_indirect_value_type): Add + check for dynamic types. + +Change-Id: If1c6fb0bd3c1d04619e89a1b58850edb69bbfde0 + +Signed-off-by: Keven Boell +--- + gdb/value.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/value.c b/gdb/value.c +index 1f0d9a4..7abb20a 100644 +--- a/gdb/value.c ++++ b/gdb/value.c +@@ -3504,7 +3504,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, + struct value *original_value) + { + /* Re-adjust type. */ +- deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type)); ++ if (!is_dynamic_type (TYPE_TARGET_TYPE (original_type))) ++ deprecated_set_value_type (value, TYPE_TARGET_TYPE (original_type)); + + /* Add embedding info. */ + set_value_enclosing_type (value, enc_type); +-- +1.7.9.5 + diff --git a/gdb-vla-intel-09of23.patch b/gdb-vla-intel-09of23.patch new file mode 100644 index 0000000..b72bcc5 --- /dev/null +++ b/gdb-vla-intel-09of23.patch @@ -0,0 +1,316 @@ +Subject: [PATCH 09/23] vla: changed string length semantic. +Message-Id: <1401861266-6240-10-git-send-email-keven.boell@intel.com> + +This patch changes the semantic of the Dwarf string length +attribute to reflect the standard. This serves as pre-work +to get variable strings in Fortran to work. + +2014-05-28 Keven Boell + Sanimir Agovic + + * dwarf2read.c (read_tag_string_type): changed + semantic of DW_AT_string_length to be able to + handle Dwarf blocks as well. Support for + DW_AT_byte_length added to get correct length + if specified in combination with + DW_AT_string_length. + (attr_to_dynamic_prop): added + functionality to add Dwarf operators to baton + data attribute. Added post values to baton + as required by the string evaluation case. + (read_subrange_type): Adapt caller. + (set_die_type): Adapt caller. + (add_post_values_to_baton): New function. + * dwarf2loc.c (dwarf2_evaluate_property): Evaluate + post processing dwarf. + * dwarf2loc.h (struct dwarf2_property_baton): Add + post dwarf values attribute. + +Change-Id: I6edfa005f416cddc8e364d34891b9abf6b44f757 + +Signed-off-by: Keven Boell +--- + gdb/dwarf2loc.c | 10 +++++ + gdb/dwarf2loc.h | 3 ++ + gdb/dwarf2read.c | 129 +++++++++++++++++++++++++++++++++++++++++++++++------- + 3 files changed, 127 insertions(+), 15 deletions(-) + +diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c +index 7ab734d..2473f80 100644 +--- a/gdb/dwarf2loc.c ++++ b/gdb/dwarf2loc.c +@@ -2533,6 +2533,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address, + + *value = value_as_address (val); + } ++ if (baton->post_values.data && baton->post_values.size > 0) ++ { ++ CORE_ADDR new_addr = *value; ++ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value); ++ } + return 1; + } + } +@@ -2555,6 +2560,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR address, + if (!value_optimized_out (val)) + { + *value = value_as_address (val); ++ if (baton->post_values.data && baton->post_values.size > 0) ++ { ++ CORE_ADDR new_addr = *value; ++ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value); ++ } + return 1; + } + } +diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h +index fb65c5c..cf648eb 100644 +--- a/gdb/dwarf2loc.h ++++ b/gdb/dwarf2loc.h +@@ -168,6 +168,9 @@ struct dwarf2_property_baton + /* Location list to be evaluated in the context of REFERENCED_TYPE. */ + struct dwarf2_loclist_baton loclist; + }; ++ ++ /* Attributes, which will be pushed after evaluating locexpr or loclist. */ ++ struct dwarf2_locexpr_baton post_values; + }; + + extern const struct symbol_computed_ops dwarf2_locexpr_funcs; +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +index ea66602..0b23701 100644 +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -1842,6 +1842,15 @@ static void free_dwo_file_cleanup (void *); + static void process_cu_includes (void); + + static void check_producer (struct dwarf2_cu *cu); ++ ++static int ++attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, ++ struct dwarf2_cu *cu, struct dynamic_prop *prop, ++ const gdb_byte *additional_data, int additional_data_size); ++ ++static void add_post_values_to_baton (struct dwarf2_property_baton *baton, ++ const gdb_byte *data, int size, struct dwarf2_cu *cu); ++ + + /* Various complaints about symbol reading that don't abort the process. */ + +@@ -14029,29 +14038,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) + struct gdbarch *gdbarch = get_objfile_arch (objfile); + struct type *type, *range_type, *index_type, *char_type; + struct attribute *attr; +- unsigned int length; ++ unsigned int length = UINT_MAX; ++ ++ index_type = objfile_type (objfile)->builtin_int; ++ range_type = create_static_range_type (NULL, index_type, 1, length); + ++ /* If DW_AT_string_length is defined, the length is stored at some location ++ * in memory. */ + attr = dwarf2_attr (die, DW_AT_string_length, cu); + if (attr) + { +- length = DW_UNSND (attr); ++ if (attr_form_is_block (attr)) ++ { ++ struct attribute *byte_size, *bit_size; ++ struct dynamic_prop high; ++ ++ byte_size = dwarf2_attr (die, DW_AT_byte_size, cu); ++ bit_size = dwarf2_attr (die, DW_AT_bit_size, cu); ++ ++ /* DW_AT_byte_size should never occur together in combination with ++ DW_AT_string_length. */ ++ if ((byte_size == NULL && bit_size != NULL) || ++ (byte_size != NULL && bit_size == NULL)) ++ complaint (&symfile_complaints, _("DW_AT_byte_size AND " ++ "DW_AT_bit_size found together at the same time.")); ++ ++ /* If DW_AT_string_length AND DW_AT_byte_size exist together, it ++ describes the number of bytes that should be read from the length ++ memory location. */ ++ if (byte_size != NULL && bit_size == NULL) ++ { ++ /* Build new dwarf2_locexpr_baton structure with additions to the ++ data attribute, to reflect DWARF specialities to get address ++ sizes. */ ++ const gdb_byte append_ops[] = { ++ DW_OP_push_object_address, ++ /* DW_OP_deref_size: size of an address on the target machine ++ (bytes), where the size will be specified by the next ++ operand. */ ++ DW_OP_deref_size, ++ /* Operand for DW_OP_deref_size. */ ++ DW_UNSND (byte_size) }; ++ ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, ++ append_ops, ARRAY_SIZE (append_ops))) ++ complaint (&symfile_complaints, ++ _("Could not parse DW_AT_byte_size")); ++ } ++ else if (bit_size != NULL && byte_size == NULL) ++ complaint (&symfile_complaints, _("DW_AT_string_length AND " ++ "DW_AT_bit_size found but not supported yet.")); ++ /* If DW_AT_string_length WITHOUT DW_AT_byte_size exist, the default ++ is the address size of the target machine. */ ++ else ++ { ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) ++ complaint (&symfile_complaints, ++ _("Could not parse DW_AT_string_length")); ++ } ++ ++ TYPE_RANGE_DATA (range_type)->high = high; ++ } ++ else ++ { ++ TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr); ++ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; ++ } + } + else + { +- /* Check for the DW_AT_byte_size attribute. */ ++ /* Check for the DW_AT_byte_size attribute, which represents the length ++ in this case. */ + attr = dwarf2_attr (die, DW_AT_byte_size, cu); + if (attr) + { +- length = DW_UNSND (attr); ++ TYPE_HIGH_BOUND (range_type) = DW_UNSND (attr); ++ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; + } + else + { +- length = 1; ++ TYPE_HIGH_BOUND (range_type) = 1; ++ TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; + } + } + +- index_type = objfile_type (objfile)->builtin_int; +- range_type = create_static_range_type (NULL, index_type, 1, length); + char_type = language_string_char_type (cu->language_defn, gdbarch); + type = create_string_type (NULL, char_type, range_type); + +@@ -14368,13 +14438,36 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) + return set_die_type (die, type, cu); + } + ++/* Add post processing op-codes to a dwarf2_property_baton. */ ++ ++static void add_post_values_to_baton (struct dwarf2_property_baton *baton, ++ const gdb_byte *data, int size, struct dwarf2_cu *cu) ++{ ++ if (data != NULL && size > 0) ++ { ++ struct obstack *obstack = &cu->objfile->objfile_obstack; ++ gdb_byte *post_data; ++ ++ post_data = obstack_alloc (obstack, size); ++ memcpy(post_data, data, size); ++ baton->post_values.data = post_data; ++ baton->post_values.size = size; ++ baton->post_values.per_cu = cu->per_cu; ++ } else { ++ baton->post_values.data = NULL; ++ baton->post_values.size = 0; ++ baton->post_values.per_cu = NULL; ++ } ++} ++ + /* Parse dwarf attribute if it's a block, reference or constant and put the + resulting value of the attribute into struct bound_prop. + Returns 1 if ATTR could be resolved into PROP, 0 otherwise. */ + + static int + attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +- struct dwarf2_cu *cu, struct dynamic_prop *prop) ++ struct dwarf2_cu *cu, struct dynamic_prop *prop, ++ const gdb_byte *additional_data, int additional_data_size) + { + struct dwarf2_property_baton *baton; + struct obstack *obstack = &cu->objfile->objfile_obstack; +@@ -14387,8 +14480,10 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, + baton = obstack_alloc (obstack, sizeof (*baton)); + baton->referenced_type = NULL; + baton->locexpr.per_cu = cu->per_cu; +- baton->locexpr.size = DW_BLOCK (attr)->size; + baton->locexpr.data = DW_BLOCK (attr)->data; ++ baton->locexpr.size = DW_BLOCK (attr)->size; ++ add_post_values_to_baton (baton, additional_data, ++ additional_data_size, cu); + prop->data.baton = baton; + prop->kind = PROP_LOCEXPR; + gdb_assert (prop->data.baton != NULL); +@@ -14409,6 +14504,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, + baton = obstack_alloc (obstack, sizeof (*baton)); + baton->referenced_type = die_type (target_die, target_cu); + fill_in_loclist_baton (cu, &baton->loclist, target_attr); ++ add_post_values_to_baton (baton, additional_data, ++ additional_data_size, cu); + prop->data.baton = baton; + prop->kind = PROP_LOCLIST; + gdb_assert (prop->data.baton != NULL); +@@ -14420,6 +14517,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, + baton->locexpr.per_cu = cu->per_cu; + baton->locexpr.size = DW_BLOCK (target_attr)->size; + baton->locexpr.data = DW_BLOCK (target_attr)->data; ++ add_post_values_to_baton (baton, additional_data, ++ additional_data_size, cu); + prop->data.baton = baton; + prop->kind = PROP_LOCEXPR; + gdb_assert (prop->data.baton != NULL); +@@ -14509,17 +14608,17 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + + attr = dwarf2_attr (die, DW_AT_lower_bound, cu); + if (attr) +- attr_to_dynamic_prop (attr, die, cu, &low); ++ attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0); + else if (!low_default_is_valid) + complaint (&symfile_complaints, _("Missing DW_AT_lower_bound " + "- DIE at 0x%x [in module %s]"), + die->offset.sect_off, objfile_name (cu->objfile)); + + attr = dwarf2_attr (die, DW_AT_upper_bound, cu); +- if (!attr_to_dynamic_prop (attr, die, cu, &high)) ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) + { + attr = dwarf2_attr (die, DW_AT_count, cu); +- if (attr_to_dynamic_prop (attr, die, cu, &high)) ++ if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) + { + /* If bounds are constant do the final calculation here. */ + if (low.kind == PROP_CONST && high.kind == PROP_CONST) +@@ -21520,7 +21619,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + { + struct dynamic_prop prop; + +- if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + { + TYPE_ALLOCATED_PROP (type) + = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); +@@ -21534,7 +21633,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + { + struct dynamic_prop prop; + +- if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + { + TYPE_ASSOCIATED_PROP (type) + = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); +@@ -21548,7 +21647,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + { + struct dynamic_prop prop; + +- if (attr_to_dynamic_prop (attr, die, cu, &prop)) ++ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + { + TYPE_DATA_LOCATION (type) + = obstack_alloc (&objfile->objfile_obstack, sizeof (prop)); +-- +1.7.9.5 + diff --git a/gdb-vla-intel-10of23.patch b/gdb-vla-intel-10of23.patch new file mode 100644 index 0000000..1455978 --- /dev/null +++ b/gdb-vla-intel-10of23.patch @@ -0,0 +1,94 @@ +Subject: [PATCH 10/23] vla: get Fortran dynamic strings working. +Message-Id: <1401861266-6240-11-git-send-email-keven.boell@intel.com> + +This patch enables the correct calculation of dynamic +string length. + +Old: +(gdb) p my_dyn_string +$1 = (PTR TO -> ( character*23959136 )) 0x605fc0 + +(gdb) p *my_dyn_string +Cannot access memory at address 0x605fc0 + +New: +(gdb) p my_dyn_string +$1 = (PTR TO -> ( character*10 )) 0x605fc0 + +(gdb) p *my_dyn_string +$2 = 'foo' + +2014-05-28 Keven Boell + Sanimir Agovic + + * gdbtypes.c (resolve_dynamic_type): Add + conditions to support string types. + (resolve_dynamic_array): Add conditions for dynamic + strings and create a new string type. + (is_dynamic_type): Follow pointer if a string type + was detected, as Fortran strings are represented + as pointers to strings internally. + +Change-Id: I7d54d762a081ce034be37ac3e368bac8111dc4e6 + +Signed-off-by: Keven Boell +--- + gdb/gdbtypes.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-14 15:14:48.623115597 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-14 15:15:26.876151187 +0200 +@@ -1662,6 +1662,15 @@ is_dynamic_type (struct type *type) + return is_dynamic_type (TYPE_TARGET_TYPE (type)); + } + ++ case TYPE_CODE_PTR: ++ { ++ if (TYPE_TARGET_TYPE (type) ++ && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRING) ++ return is_dynamic_type (check_typedef (TYPE_TARGET_TYPE (type))); ++ ++ return 0; ++ break; ++ } + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + { +@@ -1742,7 +1751,8 @@ resolve_dynamic_array (struct type *type + struct dynamic_prop *prop; + struct type *copy = copy_type (type); + +- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY); ++ gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY ++ || TYPE_CODE (type) == TYPE_CODE_STRING); + + elt_type = type; + range_type = check_typedef (TYPE_INDEX_TYPE (elt_type)); +@@ -1769,9 +1779,14 @@ resolve_dynamic_array (struct type *type + else + elt_type = TYPE_TARGET_TYPE (type); + +- return create_array_type (copy, +- elt_type, +- range_type); ++ if (TYPE_CODE (type) == TYPE_CODE_STRING) ++ return create_string_type (copy, ++ elt_type, ++ range_type); ++ else ++ return create_array_type (copy, ++ elt_type, ++ range_type); + } + + /* Resolves dynamic compound types, e.g. STRUCTS's to static ones. +@@ -1958,6 +1973,7 @@ resolve_dynamic_type (struct type *type, + } + + case TYPE_CODE_ARRAY: ++ case TYPE_CODE_STRING: + resolved_type = resolve_dynamic_array (type, addr); + break; + diff --git a/gdb-vla-intel-11of23.patch b/gdb-vla-intel-11of23.patch new file mode 100644 index 0000000..6b18cf3 --- /dev/null +++ b/gdb-vla-intel-11of23.patch @@ -0,0 +1,272 @@ +Subject: [PATCH 11/23] vla: add stride support to fortran arrays. +Message-Id: <1401861266-6240-12-git-send-email-keven.boell@intel.com> + +2014-05-28 Sanimir Agovic + Keven Boell + + * dwarf2read.c (read_subrange_type): Read dynamic + stride attributes. + * gdbtypes.c (create_array_type_with_stride): Add + stride support + (create_range_type): Add stride parameter. + (create_static_range_type): Pass default stride + parameter. + (resolve_dynamic_range): Evaluate stride baton. + (resolve_dynamic_type): Adjust data location with + the value of byte stride. + * gdbtypes.h (TYPE_BYTE_STRIDE): New macro. + (TYPE_BYTE_STRIDE_BLOCK): New macro. + (TYPE_BYTE_STRIDE_LOCLIST): New macro. + (TYPE_BYTE_STRIDE_KIND): New macro. + * valarith.c (value_subscripted_rvalue): Use stride. + +Change-Id: I3d810c0dc37f9d9fd84dba4c764cdefc52d8501e + +Signed-off-by: Keven Boell +--- + gdb/dwarf2read.c | 13 +++++++++++-- + gdb/gdbtypes.c | 40 ++++++++++++++++++++++++++++++++++------ + gdb/gdbtypes.h | 17 +++++++++++++++++ + gdb/valarith.c | 14 +++++++++++++- + 4 files changed, 75 insertions(+), 9 deletions(-) + +Index: gdb-7.7.90.20140613/gdb/dwarf2read.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/dwarf2read.c 2014-06-16 23:24:12.741584315 +0200 ++++ gdb-7.7.90.20140613/gdb/dwarf2read.c 2014-06-16 23:25:12.702640910 +0200 +@@ -14696,7 +14696,7 @@ read_subrange_type (struct die_info *die + struct type *base_type, *orig_base_type; + struct type *range_type; + struct attribute *attr; +- struct dynamic_prop low, high; ++ struct dynamic_prop low, high, stride; + int low_default_is_valid; + int high_bound_is_count = 0; + const char *name; +@@ -14716,7 +14716,9 @@ read_subrange_type (struct die_info *die + + low.kind = PROP_CONST; + high.kind = PROP_CONST; ++ stride.kind = PROP_CONST; + high.data.const_val = 0; ++ stride.data.const_val = 0; + + /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow + omitting DW_AT_lower_bound. */ +@@ -14749,6 +14751,13 @@ read_subrange_type (struct die_info *die + break; + } + ++ attr = dwarf2_attr (die, DW_AT_byte_stride, cu); ++ if (attr) ++ if (!attr_to_dynamic_prop (attr, die, cu, &stride, NULL, 0)) ++ complaint (&symfile_complaints, _("Missing DW_AT_byte_stride " ++ "- DIE at 0x%x [in module %s]"), ++ die->offset.sect_off, objfile_name (cu->objfile)); ++ + attr = dwarf2_attr (die, DW_AT_lower_bound, cu); + if (attr) + attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0); +@@ -14825,7 +14834,7 @@ read_subrange_type (struct die_info *die + && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) + high.data.const_val |= negative_mask; + +- range_type = create_range_type (NULL, orig_base_type, &low, &high); ++ range_type = create_range_type (NULL, orig_base_type, &low, &high, &stride); + + if (high_bound_is_count) + TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1; +Index: gdb-7.7.90.20140613/gdb/gdbtypes.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.c 2014-06-16 23:24:12.741584315 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.c 2014-06-16 23:25:12.704640911 +0200 +@@ -805,7 +805,8 @@ allocate_stub_method (struct type *type) + struct type * + create_range_type (struct type *result_type, struct type *index_type, + const struct dynamic_prop *low_bound, +- const struct dynamic_prop *high_bound) ++ const struct dynamic_prop *high_bound, ++ const struct dynamic_prop *stride) + { + if (result_type == NULL) + result_type = alloc_type_copy (index_type); +@@ -820,6 +821,7 @@ create_range_type (struct type *result_t + TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); + TYPE_RANGE_DATA (result_type)->low = *low_bound; + TYPE_RANGE_DATA (result_type)->high = *high_bound; ++ TYPE_RANGE_DATA (result_type)->stride = *stride; + + if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0) + TYPE_UNSIGNED (result_type) = 1; +@@ -841,7 +843,7 @@ struct type * + create_static_range_type (struct type *result_type, struct type *index_type, + LONGEST low_bound, LONGEST high_bound) + { +- struct dynamic_prop low, high; ++ struct dynamic_prop low, high, stride; + + low.kind = PROP_CONST; + low.data.const_val = low_bound; +@@ -849,7 +851,11 @@ create_static_range_type (struct type *r + high.kind = PROP_CONST; + high.data.const_val = high_bound; + +- result_type = create_range_type (result_type, index_type, &low, &high); ++ stride.kind = PROP_CONST; ++ stride.data.const_val = 0; ++ ++ result_type = create_range_type (result_type, index_type, ++ &low, &high, &stride); + + return result_type; + } +@@ -1006,16 +1012,21 @@ create_array_type_with_stride (struct ty + if (has_static_range (TYPE_RANGE_DATA (range_type)) + && dwarf2_address_data_valid (result_type)) + { +- LONGEST low_bound, high_bound; ++ LONGEST low_bound, high_bound, byte_stride; + + if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) + low_bound = high_bound = 0; + CHECK_TYPEDEF (element_type); ++ ++ byte_stride = abs (TYPE_BYTE_STRIDE (range_type)); ++ + /* Be careful when setting the array length. Ada arrays can be + empty arrays with the high_bound being smaller than the low_bound. + In such cases, the array length should be zero. */ + if (high_bound < low_bound) + TYPE_LENGTH (result_type) = 0; ++ else if (byte_stride > 0) ++ TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1); + else if (bit_stride > 0) + TYPE_LENGTH (result_type) = + (bit_stride * (high_bound - low_bound + 1) + 7) / 8; +@@ -1697,7 +1708,7 @@ resolve_dynamic_range (struct type *dyn_ + struct type *static_range_type; + const struct dynamic_prop *prop; + const struct dwarf2_locexpr_baton *baton; +- struct dynamic_prop low_bound, high_bound; ++ struct dynamic_prop low_bound, high_bound, stride; + struct type *range_copy = copy_type (dyn_range_type); + + gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); +@@ -1729,10 +1740,17 @@ resolve_dynamic_range (struct type *dyn_ + high_bound.kind = PROP_UNDEFINED; + high_bound.data.const_val = 0; + } ++ ++ prop = &TYPE_RANGE_DATA (dyn_range_type)->stride; ++ if (dwarf2_evaluate_property (prop, addr, &value)) ++ { ++ stride.kind = PROP_CONST; ++ stride.data.const_val = value; ++ } + + static_range_type = create_range_type (range_copy, + TYPE_TARGET_TYPE (range_copy), +- &low_bound, &high_bound); ++ &low_bound, &high_bound, &stride); + TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1; + return static_range_type; + } +@@ -1996,7 +2014,17 @@ resolve_dynamic_type (struct type *type, + prop = TYPE_DATA_LOCATION (type); + if (dwarf2_evaluate_property (prop, addr, &value)) + { ++ struct type *range_type = TYPE_INDEX_TYPE (type); ++ ++ /* Adjust the data location with the value of byte stride if set, which ++ can describe the separation between successive elements along the ++ dimension. */ ++ if (TYPE_BYTE_STRIDE (range_type) < 0) ++ value += (TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type)) ++ * TYPE_BYTE_STRIDE (range_type); ++ + adjusted_address = value; ++ + TYPE_DATA_LOCATION_ADDR (type) = value; + TYPE_DATA_LOCATION_KIND (type) = PROP_CONST; + } +Index: gdb-7.7.90.20140613/gdb/gdbtypes.h +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/gdbtypes.h 2014-06-16 23:24:12.741584315 +0200 ++++ gdb-7.7.90.20140613/gdb/gdbtypes.h 2014-06-16 23:25:12.704640911 +0200 +@@ -670,6 +670,10 @@ struct main_type + + struct dynamic_prop high; + ++ /* * Stride of range. */ ++ ++ struct dynamic_prop stride; ++ + /* True if HIGH range bound contains the number of elements in the + subrange. This affects how the final hight bound is computed. */ + +@@ -1219,6 +1223,15 @@ extern void allocate_gnat_aux_type (stru + TYPE_RANGE_DATA(range_type)->high.kind + #define TYPE_LOW_BOUND_KIND(range_type) \ + TYPE_RANGE_DATA(range_type)->low.kind ++#define TYPE_BYTE_STRIDE(range_type) \ ++ TYPE_RANGE_DATA(range_type)->stride.data.const_val ++#define TYPE_BYTE_STRIDE_BLOCK(range_type) \ ++ TYPE_RANGE_DATA(range_type)->stride.data.locexpr ++#define TYPE_BYTE_STRIDE_LOCLIST(range_type) \ ++ TYPE_RANGE_DATA(range_type)->stride.data.loclist ++#define TYPE_BYTE_STRIDE_KIND(range_type) \ ++ TYPE_RANGE_DATA(range_type)->stride.kind ++ + + /* Attribute accessors for VLA support. */ + #define TYPE_DATA_LOCATION(thistype) \ +@@ -1250,6 +1263,9 @@ extern void allocate_gnat_aux_type (stru + TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) + #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ + TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) ++#define TYPE_ARRAY_STRIDE_IS_UNDEFINED(arraytype) \ ++ (TYPE_BYTE_STRIDE(TYPE_INDEX_TYPE(arraytype)) == 0) ++ + + #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ + (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) +@@ -1718,6 +1734,7 @@ extern struct type *create_array_type_wi + + extern struct type *create_range_type (struct type *, struct type *, + const struct dynamic_prop *, ++ const struct dynamic_prop *, + const struct dynamic_prop *); + + extern struct type *create_array_type (struct type *, struct type *, +Index: gdb-7.7.90.20140613/gdb/valarith.c +=================================================================== +--- gdb-7.7.90.20140613.orig/gdb/valarith.c 2014-06-16 23:24:12.741584315 +0200 ++++ gdb-7.7.90.20140613/gdb/valarith.c 2014-06-16 23:26:42.541725886 +0200 +@@ -196,6 +196,7 @@ value_subscripted_rvalue (struct value * + struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); + unsigned int elt_size = TYPE_LENGTH (elt_type); + unsigned int elt_offs; ++ LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)); + struct value *v; + + if (TYPE_NOT_ASSOCIATED (array_type)) +@@ -203,7 +204,18 @@ value_subscripted_rvalue (struct value * + if (TYPE_NOT_ALLOCATED (array_type)) + error (_("no such vector element because not allocated")); + +- elt_offs = elt_size * longest_to_int (index - lowerbound); ++ elt_offs = longest_to_int (index - lowerbound); ++ ++ if (elt_stride > 0) ++ elt_offs *= elt_stride; ++ else if (elt_stride < 0) ++ { ++ int offs = (elt_offs + 1) * elt_stride; ++ ++ elt_offs = TYPE_LENGTH (array_type) + offs; ++ } ++ else ++ elt_offs *= elt_size; + + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) + && elt_offs >= TYPE_LENGTH (array_type))) diff --git a/gdb-vla-intel-12of23.patch b/gdb-vla-intel-12of23.patch new file mode 100644 index 0000000..b12eab0 --- /dev/null +++ b/gdb-vla-intel-12of23.patch @@ -0,0 +1,243 @@ +Subject: [PATCH 12/23] test: basic tests for dynamic array evaluations in Fortran. +Message-Id: <1401861266-6240-13-git-send-email-keven.boell@intel.com> + +Tests ensure that values of Fortran dynamic arrays +can be evaluated correctly in various ways and states. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla.f90: New file. + * vla-value.exp: New file. + +Change-Id: I0229c3b58f72ae89c2ee42d1219e4538cb6bf023 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-value.exp | 148 +++++++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla.f90 | 56 ++++++++++++ + 2 files changed, 204 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-value.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp +new file mode 100644 +index 0000000..d7b8a1e +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-value.exp +@@ -0,0 +1,148 @@ ++# Copyright 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 "vla.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 ++} ++ ++# Try to access values in non allocated VLA ++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\\\(kind=4\\\) \\\(\\\)\\\)\\\) $hex" \ ++ "print non-allocated &vla1" ++gdb_test "print vla1(1,1,1)" "no such vector element because not allocated" \ ++ "print member in non-allocated vla1 (1)" ++gdb_test "print vla1(101,202,303)" \ ++ "no such vector element because not allocated" \ ++ "print member in non-allocated vla1 (2)" ++gdb_test "print vla1(5,2,18)=1" "no such vector element because not allocated" \ ++ "set member in non-allocated vla1" ++ ++# Try to access value in allocated VLA ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "next" "\\d+(\\t|\\s)+vla1\\\(3, 6, 9\\\) = 42" \ ++ "step over value assignment of vla1" ++gdb_test "print &vla1" \ ++ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \ ++ "print allocated &vla1" ++gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)" ++gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)" ++gdb_test "print vla1(9, 9, 9) = 999" " = 999" \ ++ "print allocated vla1(9,9,9)=1" ++ ++# Try to access values in allocated VLA after specific assignment ++gdb_breakpoint [gdb_get_line_number "vla1-filled"] ++gdb_continue_to_breakpoint "vla1-filled" ++gdb_test "print vla1(3, 6, 9)" " = 42" \ ++ "print allocated vla1(3,6,9) after specific assignment (filled)" ++gdb_test "print vla1(1, 3, 8)" " = 1001" \ ++ "print allocated vla1(1,3,8) after specific assignment (filled)" ++gdb_test "print vla1(9, 9, 9)" " = 999" \ ++ "print allocated vla1(9,9,9) after assignment in debugger (filled)" ++ ++# Try to access values in undefined pointer to VLA (dangling) ++gdb_test "print pvla" " = " "print undefined pvla" ++gdb_test "print &pvla" \ ++ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(\\\)\\\)\\\) $hex" \ ++ "print non-associated &pvla" ++gdb_test "print pvla(1, 3, 8)" "no such vector element because not associated" \ ++ "print undefined pvla(1,3,8)" ++ ++# Try to access values in pointer to VLA and compare them ++gdb_breakpoint [gdb_get_line_number "pvla-associated"] ++gdb_continue_to_breakpoint "pvla-associated" ++gdb_test "print &pvla" \ ++ " = \\\(PTR TO -> \\\( real\\\(kind=4\\\) \\\(10,10,10\\\)\\\)\\\) $hex" \ ++ "print associated &pvla" ++gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)" ++gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)" ++gdb_test "print pvla(9, 9, 9)" " = 999" "print associated pvla(9,9,9)" ++ ++# Fill values to VLA using pointer and check ++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"] ++gdb_continue_to_breakpoint "pvla-re-associated" ++gdb_test "print pvla(5, 45, 20)" \ ++ " = 1" "print pvla(5, 45, 20) after filled using pointer" ++gdb_test "print vla2(5, 45, 20)" \ ++ " = 1" "print vla2(5, 45, 20) after filled using pointer" ++gdb_test "print pvla(7, 45, 14)" " = 2" \ ++ "print pvla(7, 45, 14) after filled using pointer" ++gdb_test "print vla2(7, 45, 14)" " = 2" \ ++ "print vla2(7, 45, 14) after filled using pointer" ++ ++# Try to access values of deassociated VLA pointer ++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] ++gdb_continue_to_breakpoint "pvla-deassociated" ++gdb_test "print pvla(5, 45, 20)" \ ++ "no such vector element because not associated" \ ++ "print pvla(5, 45, 20) after deassociated" ++gdb_test "print pvla(7, 45, 14)" \ ++ "no such vector element because not associated" \ ++ "print pvla(7, 45, 14) after dissasociated" ++gdb_test "print pvla" " = " \ ++ "print vla1 after deassociated" ++ ++# Try to access values of deallocated VLA ++gdb_breakpoint [gdb_get_line_number "vla1-deallocated"] ++gdb_continue_to_breakpoint "vla1-deallocated" ++gdb_test "print vla1(3, 6, 9)" "no such vector element because not allocated" \ ++ "print allocated vla1(3,6,9) after specific assignment (deallocated)" ++gdb_test "print vla1(1, 3, 8)" "no such vector element because not allocated" \ ++ "print allocated vla1(1,3,8) after specific assignment (deallocated)" ++gdb_test "print vla1(9, 9, 9)" "no such vector element because not allocated" \ ++ "print allocated vla1(9,9,9) after assignment in debugger (deallocated)" ++ ++ ++# Try to assign VLA to user variable ++clean_restart ${testfile} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "next" "\\d+.*vla1\\(3, 6, 9\\) = 42" "next (1)" ++ ++gdb_test_no_output "set \$myvar = vla1" "set \$myvar = vla1" ++gdb_test "print \$myvar" \ ++ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \ ++ "print \$myvar set to vla1" ++ ++gdb_test "next" "\\d+.*vla1\\(1, 3, 8\\) = 1001" "next (2)" ++gdb_test "print \$myvar(3,6,9)" " = 1311" "print \$myvar(3,6,9)" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-associated"] ++gdb_continue_to_breakpoint "pvla-associated" ++gdb_test_no_output "set \$mypvar = pvla" "set \$mypvar = pvla" ++gdb_test "print \$mypvar(1,3,8)" " = 1001" "print \$mypvar(1,3,8)" ++ ++# deallocate pointer and make sure user defined variable still has the ++# right value. ++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] ++gdb_continue_to_breakpoint "pvla-deassociated" ++gdb_test "print \$mypvar(1,3,8)" " = 1001" \ ++ "print \$mypvar(1,3,8) after deallocated" +diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90 +new file mode 100644 +index 0000000..73425f3 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla.f90 +@@ -0,0 +1,56 @@ ++! Copyright 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 . ++ ++program vla ++ real, target, allocatable :: vla1 (:, :, :) ++ real, target, allocatable :: vla2 (:, :, :) ++ real, target, allocatable :: vla3 (:, :) ++ real, pointer :: pvla (:, :, :) ++ logical :: l ++ ++ allocate (vla1 (10,10,10)) ! vla1-init ++ l = allocated(vla1) ++ ++ allocate (vla2 (1:7,42:50,13:35)) ! vla1-allocated ++ l = allocated(vla2) ++ ++ vla1(:, :, :) = 1311 ! vla2-allocated ++ vla1(3, 6, 9) = 42 ++ vla1(1, 3, 8) = 1001 ++ vla1(6, 2, 7) = 13 ++ ++ vla2(:, :, :) = 1311 ! vla1-filled ++ vla2(5, 45, 20) = 42 ++ ++ pvla => vla1 ! vla2-filled ++ l = associated(pvla) ++ ++ pvla => vla2 ! pvla-associated ++ l = associated(pvla) ++ pvla(5, 45, 20) = 1 ++ pvla(7, 45, 14) = 2 ++ ++ pvla => null() ! pvla-re-associated ++ l = associated(pvla) ++ ++ deallocate (vla1) ! pvla-deassociated ++ l = allocated(vla1) ++ ++ deallocate (vla2) ! vla1-deallocated ++ l = allocated(vla2) ++ ++ allocate (vla3 (2,2)) ! vla2-deallocated ++ vla3(:,:) = 13 ++end program vla +-- +1.7.9.5 + diff --git a/gdb-vla-intel-13of23.patch b/gdb-vla-intel-13of23.patch new file mode 100644 index 0000000..314fdc8 --- /dev/null +++ b/gdb-vla-intel-13of23.patch @@ -0,0 +1,273 @@ +Subject: [PATCH 13/23] test: evaluate Fortran dynamic arrays of types. +Message-Id: <1401861266-6240-14-git-send-email-keven.boell@intel.com> + +Tests ensure that dynamic arrays of various Fortran +datatypes can be evaluated correctly. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-type.exp: New file. + * vla-type.f90: New file. + +Change-Id: I7c1a381c5cb0ad48872b77993e7c7fdac85bc756 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-type.exp | 127 ++++++++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-type.f90 | 107 +++++++++++++++++++++++++++ + 2 files changed, 234 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-type.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-type.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp +new file mode 100644 +index 0000000..ad50d9c +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-type.exp +@@ -0,0 +1,127 @@ ++# Copyright 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 ".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 ++} ++ ++# Check if not allocated VLA in type does not break ++# the debugger when accessing it. ++gdb_breakpoint [gdb_get_line_number "before-allocated"] ++gdb_continue_to_breakpoint "before-allocated" ++gdb_test "print twov" " = \\\( , \\\)" \ ++ "print twov before allocated" ++gdb_test "print twov%ivla1" " = " \ ++ "print twov%ivla1 before allocated" ++ ++# Check type with one VLA's inside ++gdb_breakpoint [gdb_get_line_number "onev-filled"] ++gdb_continue_to_breakpoint "onev-filled" ++gdb_test "print onev%ivla(5, 11, 23)" " = 1" "print onev%ivla(5, 11, 23)" ++gdb_test "print onev%ivla(1, 2, 3)" " = 123" "print onev%ivla(1, 2, 3)" ++gdb_test "print onev%ivla(3, 2, 1)" " = 321" "print onev%ivla(3, 2, 1)" ++gdb_test "ptype onev" \ ++ "type = Type one\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\)\r\nEnd Type one" \ ++ "ptype onev" ++ ++# Check type with two VLA's inside ++gdb_breakpoint [gdb_get_line_number "twov-filled"] ++gdb_continue_to_breakpoint "twov-filled" ++gdb_test "print twov%ivla1(5, 11, 23)" " = 1" \ ++ "print twov%ivla1(5, 11, 23)" ++gdb_test "print twov%ivla1(1, 2, 3)" " = 123" \ ++ "print twov%ivla1(1, 2, 3)" ++gdb_test "print twov%ivla1(3, 2, 1)" " = 321" \ ++ "print twov%ivla1(3, 2, 1)" ++gdb_test "ptype twov" \ ++ "type = Type two\r\n\\s+real\\\(kind=4\\\) :: ivla1\\\(5,12,99\\\)\r\n\\s+real\\\(kind=4\\\) :: ivla2\\\(9,12\\\)\r\nEnd Type two" \ ++ "ptype twov" ++ ++# Check type with attribute at beginn of type ++gdb_breakpoint [gdb_get_line_number "threev-filled"] ++gdb_continue_to_breakpoint "threev-filled" ++gdb_test "print threev%ivla(1)" " = 1" "print threev%ivla(1)" ++gdb_test "print threev%ivla(5)" " = 42" "print threev%ivla(5)" ++gdb_test "print threev%ivla(14)" " = 24" "print threev%ivla(14)" ++gdb_test "print threev%ivar" " = 3.14\\d+?" "print threev%ivar" ++gdb_test "ptype threev" \ ++ "type = Type three\r\n\\s+real\\\(kind=4\\\) :: ivar\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(20\\\)\r\nEnd Type three" \ ++ "ptype threev" ++ ++# Check type with attribute at end of type ++gdb_breakpoint [gdb_get_line_number "fourv-filled"] ++gdb_continue_to_breakpoint "fourv-filled" ++gdb_test "print fourv%ivla(1)" " = 1" "print fourv%ivla(1)" ++gdb_test "print fourv%ivla(2)" " = 2" "print fourv%ivla(2)" ++gdb_test "print fourv%ivla(7)" " = 7" "print fourv%ivla(7)" ++gdb_test "print fourv%ivla(12)" "no such vector element" "print fourv%ivla(12)" ++gdb_test "print fourv%ivar" " = 3.14\\d+?" "print fourv%ivar" ++gdb_test "ptype fourv" \ ++ "type = Type four\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(10\\\)\r\n\\s+real\\\(kind=4\\\) :: ivar\r\nEnd Type four" \ ++ "ptype fourv" ++ ++# Check VLA of types ++gdb_breakpoint [gdb_get_line_number "onevla-filled"] ++gdb_continue_to_breakpoint "onevla-filled" ++gdb_test "print onevla(2,2)%ivla(3, 6, 9)" \ ++ " = 369" "print onevla(2,2)%ivla(3, 6, 9)" ++gdb_test "print onevla(2,2)%ivla(9, 3, 6)" \ ++ " = 936" "print onevla(2,2)%ivla(9, 3, 6)" ++ ++# Check nested types containing a VLA ++gdb_breakpoint [gdb_get_line_number "fivev-filled"] ++gdb_continue_to_breakpoint "fivev-filled" ++gdb_test "print fivev%tone%ivla(5, 5, 1)" " = 1" \ ++ "print fivev%tone%ivla(5, 5, 1)" ++gdb_test "print fivev%tone%ivla(1, 2, 3)" " = 123" \ ++ "print fivev%tone%ivla(1, 2, 3)" ++gdb_test "print fivev%tone%ivla(3, 2, 1)" " = 321" \ ++ "print fivev%tone%ivla(3, 2, 1)" ++gdb_test "ptype fivev" \ ++ "type = Type five\r\n\\s+Type one\r\n\\s+real\\\(kind=4\\\) :: ivla\\\(10,10,10\\\)\r\n\\s+End Type one :: tone\r\nEnd Type five" \ ++ "ptype fivev" ++ ++# Check pointer to type, containing a VLA ++gdb_breakpoint [gdb_get_line_number "onep-associated"] ++gdb_continue_to_breakpoint "onep-associated" ++gdb_test "ptype onev" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \ ++ "ptype onev" ++gdb_test "ptype onep" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \ ++ "ptype onep" ++ ++gdb_test "print onev%ivla" " = \\( *\\( *\\( *2, *2, *2,\[()2, .\]*\\)" \ ++ "print onev%ivla" ++gdb_test "print onev" " = \\( *\\( *\\( *\\( *2, *2, *2,\[()2, .\]*\\)" \ ++ "print onev" ++gdb_test "print onep" ".*real\\\(kind=4\\\) :: ivla\\\(11,22,33\\\).*" \ ++ "print onep" ++ ++gdb_test "ptype onev%ivla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype onev%ivla" ++gdb_test "ptype onep%ivla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype onep%ivla" ++ ++gdb_test "ptype onev%ivla(1,1,1)" "type = real\\\(kind=4\\\)" \ ++ "ptype onev%ivla(1,1,1)" ++gdb_test "ptype onep%ivla(1,1,1)" "type = real\\\(kind=4\\\)" \ ++ "ptype onep%ivla(1,1,1)" +diff --git a/gdb/testsuite/gdb.fortran/vla-type.f90 b/gdb/testsuite/gdb.fortran/vla-type.f90 +new file mode 100644 +index 0000000..06600c9 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-type.f90 +@@ -0,0 +1,107 @@ ++! Copyright 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 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. ++ ++program vla_struct ++ type :: one ++ real, allocatable :: ivla (:, :, :) ++ end type one ++ type :: two ++ real, allocatable :: ivla1 (:, :, :) ++ real, allocatable :: ivla2 (:, :) ++ end type two ++ type :: three ++ real :: ivar ++ real, allocatable :: ivla (:) ++ end type three ++ type :: four ++ real, allocatable :: ivla (:) ++ real :: ivar ++ end type four ++ type :: five ++ type(one) :: tone ++ end type five ++ ++ type(one), target :: onev ++ type(two) :: twov ++ type(three) :: threev ++ type(four) :: fourv ++ type(five) :: fivev ++ type(one), allocatable :: onevla(:, :) ++ type(one), pointer :: onep ++ logical :: l ++ integer :: i, j ++ ++ allocate (onev%ivla (11,22,33)) ! before-allocated ++ l = allocated(onev%ivla) ++ ++ onev%ivla(:, :, :) = 1 ++ onev%ivla(1, 2, 3) = 123 ++ onev%ivla(3, 2, 1) = 321 ++ ++ allocate (twov%ivla1 (5,12,99)) ! onev-filled ++ l = allocated(twov%ivla1) ++ allocate (twov%ivla2 (9,12)) ++ l = allocated(twov%ivla2) ++ ++ twov%ivla1(:, :, :) = 1 ++ twov%ivla1(1, 2, 3) = 123 ++ twov%ivla1(3, 2, 1) = 321 ++ ++ twov%ivla2(:, :) = 1 ++ twov%ivla2(1, 2) = 12 ++ twov%ivla2(2, 1) = 21 ++ ++ threev%ivar = 3.14 ! twov-filled ++ allocate (threev%ivla (20)) ++ l = allocated(threev%ivla) ++ ++ threev%ivla(:) = 1 ++ threev%ivla(5) = 42 ++ threev%ivla(14) = 24 ++ ++ allocate (fourv%ivla (10)) ! threev-filled ++ l = allocated(fourv%ivla) ++ ++ fourv%ivar = 3.14 ++ fourv%ivla(:) = 1 ++ fourv%ivla(2) = 2 ++ fourv%ivla(7) = 7 ++ ++ ++ allocate (onevla (10, 10)) ! fourv-filled ++ do i = 1, 10 ++ do j = 1, 10 ++ allocate (onevla(i,j)%ivla(10,10,10)) ++ l = allocated(onevla(i,j)%ivla) ++ ++ onevla(i,j)%ivla(3, 6, 9) = 369 ++ onevla(i,j)%ivla(9, 3, 6) = 936 ++ end do ++ end do ++ ++ allocate (fivev%tone%ivla (10, 10, 10)) ! onevla-filled ++ l = allocated(fivev%tone%ivla) ++ fivev%tone%ivla(:, :, :) = 1 ++ fivev%tone%ivla(1, 2, 3) = 123 ++ fivev%tone%ivla(3, 2, 1) = 321 ++ ++ ++ onev%ivla(:,:,:) = 2 ! fivev-filled ++ onep => onev ++ ++ ! dummy statement for bp ++ l = allocated(fivev%tone%ivla) ! onep-associated ++end program vla_struct +-- +1.7.9.5 + diff --git a/gdb-vla-intel-14of23.patch b/gdb-vla-intel-14of23.patch new file mode 100644 index 0000000..65dd8f4 --- /dev/null +++ b/gdb-vla-intel-14of23.patch @@ -0,0 +1,172 @@ +Subject: [PATCH 14/23] test: evaluate dynamic arrays using Fortran primitives. +Message-Id: <1401861266-6240-15-git-send-email-keven.boell@intel.com> + +Tests ensure that Fortran primitives can be evaluated +correctly when used as a dynamic array. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-datatypes.f90: New file. + * vla-datatypes.exp: New file. + +Change-Id: I8e82fa3833d77bfd7e9b4bdc40e3f96ce5e72da2 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-datatypes.exp | 82 +++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-datatypes.f90 | 51 +++++++++++++++++ + 2 files changed, 133 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-datatypes.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-datatypes.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp +new file mode 100644 +index 0000000..20276d6 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp +@@ -0,0 +1,82 @@ ++# Copyright 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 ".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__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "vlas-allocated"] ++gdb_continue_to_breakpoint "vlas-allocated" ++gdb_test "next" " = allocated\\\(realvla\\\)" \ ++ "next to allocation status of intvla" ++gdb_test "print l" " = \\.TRUE\\." "intvla allocated" ++gdb_test "next" " = allocated\\\(complexvla\\\)" \ ++ "next to allocation status of realvla" ++gdb_test "print l" " = \\.TRUE\\." "realvla allocated" ++gdb_test "next" " = allocated\\\(logicalvla\\\)" \ ++ "next to allocation status of complexvla" ++gdb_test "print l" " = \\.TRUE\\." "complexvla allocated" ++gdb_test "next" " = allocated\\\(charactervla\\\)" \ ++ "next to allocation status of logicalvla" ++gdb_test "print l" " = \\.TRUE\\." "logicalvla allocated" ++gdb_test "next" "intvla\\\(:,:,:\\\) = 1" \ ++ "next to allocation status of charactervla" ++gdb_test "print l" " = \\.TRUE\\." "charactervla allocated" ++ ++gdb_breakpoint [gdb_get_line_number "vlas-initialized"] ++gdb_continue_to_breakpoint "vlas-initialized" ++gdb_test "ptype intvla" "type = integer\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype intvla" ++gdb_test "ptype realvla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype realvla" ++gdb_test "ptype complexvla" "type = complex\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype complexvla" ++gdb_test "ptype logicalvla" "type = logical\\\(kind=4\\\) \\\(11,22,33\\\)" \ ++ "ptype logicalvla" ++gdb_test "ptype charactervla" "type = character\\\*1 \\\(11,22,33\\\)" \ ++ "ptype charactervla" ++ ++gdb_test "print intvla(5,5,5)" " = 1" "print intvla(5,5,5) (1st)" ++gdb_test "print realvla(5,5,5)" " = 3.14\\d+" \ ++ "print realvla(5,5,5) (1st)" ++gdb_test "print complexvla(5,5,5)" " = \\\(2,-3\\\)" \ ++ "print complexvla(5,5,5) (1st)" ++gdb_test "print logicalvla(5,5,5)" " = \\.TRUE\\." \ ++ "print logicalvla(5,5,5) (1st)" ++gdb_test "print charactervla(5,5,5)" " = 'K'" \ ++ "print charactervla(5,5,5) (1st)" ++ ++gdb_breakpoint [gdb_get_line_number "vlas-modified"] ++gdb_continue_to_breakpoint "vlas-modified" ++gdb_test "print intvla(5,5,5)" " = 42" "print intvla(5,5,5) (2nd)" ++gdb_test "print realvla(5,5,5)" " = 4.13\\d+" \ ++ "print realvla(5,5,5) (2nd)" ++gdb_test "print complexvla(5,5,5)" " = \\\(-3,2\\\)" \ ++ "print complexvla(5,5,5) (2nd)" ++gdb_test "print logicalvla(5,5,5)" " = \\.FALSE\\." \ ++ "print logicalvla(5,5,5) (2nd)" ++gdb_test "print charactervla(5,5,5)" " = 'X'" \ ++ "print charactervla(5,5,5) (2nd)" +diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.f90 b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +new file mode 100644 +index 0000000..b11879a +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +@@ -0,0 +1,51 @@ ++! Copyright 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 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. ++ ++program vla_primitives ++ integer, allocatable :: intvla(:, :, :) ++ real, allocatable :: realvla(:, :, :) ++ complex, allocatable :: complexvla(:, :, :) ++ logical, allocatable :: logicalvla(:, :, :) ++ character, allocatable :: charactervla(:, :, :) ++ logical :: l ++ ++ allocate (intvla (11,22,33)) ++ allocate (realvla (11,22,33)) ++ allocate (complexvla (11,22,33)) ++ allocate (logicalvla (11,22,33)) ++ allocate (charactervla (11,22,33)) ++ ++ l = allocated(intvla) ! vlas-allocated ++ l = allocated(realvla) ++ l = allocated(complexvla) ++ l = allocated(logicalvla) ++ l = allocated(charactervla) ++ ++ intvla(:,:,:) = 1 ++ realvla(:,:,:) = 3.14 ++ complexvla(:,:,:) = cmplx(2.0,-3.0) ++ logicalvla(:,:,:) = .TRUE. ++ charactervla(:,:,:) = char(75) ++ ++ intvla(5,5,5) = 42 ! vlas-initialized ++ realvla(5,5,5) = 4.13 ++ complexvla(5,5,5) = cmplx(-3.0,2.0) ++ logicalvla(5,5,5) = .FALSE. ++ charactervla(5,5,5) = 'X' ++ ++ ! dummy statement for bp ++ l = .FALSE. ! vlas-modified ++end program vla_primitives +-- +1.7.9.5 + diff --git a/gdb-vla-intel-15of23.patch b/gdb-vla-intel-15of23.patch new file mode 100644 index 0000000..d46d5ae --- /dev/null +++ b/gdb-vla-intel-15of23.patch @@ -0,0 +1,409 @@ +Subject: [PATCH 15/23] test: dynamic arrays passed to subroutines. +Message-Id: <1401861266-6240-16-git-send-email-keven.boell@intel.com> + +Tests dynamic arrays passed to subroutines and handled +in different ways inside the routine. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-sub.f90: New file. + * vla-ptype-sub.exp: New file. + * vla-value-sub-arbitrary.exp: New file. + * vla-value-sub-finish.exp: New file. + * vla-value-sub.exp: New file. + +Change-Id: I76db950fbacbf15b1f5e887bfd164eb8f85c55d1 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-ptype-sub.exp | 87 +++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-sub.f90 | 82 ++++++++++++++++++ + .../gdb.fortran/vla-value-sub-arbitrary.exp | 35 ++++++++ + gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp | 49 +++++++++++ + gdb/testsuite/gdb.fortran/vla-value-sub.exp | 90 ++++++++++++++++++++ + 5 files changed, 343 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-ptype-sub.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-sub.f90 + create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-value-sub.exp + +diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +new file mode 100644 +index 0000000..2ee2914 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +@@ -0,0 +1,87 @@ ++# Copyright 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 "vla-sub.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 ++} ++ ++# Pass fixed array to function and handle them as vla in function. ++gdb_breakpoint [gdb_get_line_number "not-filled"] ++gdb_continue_to_breakpoint "not-filled (1st)" ++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \ ++ "ptype array1 (passed fixed)" ++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \ ++ "ptype array2 (passed fixed)" ++gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \ ++ "ptype array1(40, 10) (passed fixed)" ++gdb_test "ptype array2(13, 11, 5)" "type = real\\\(kind=4\\\)" \ ++ "ptype array2(13, 11, 5) (passed fixed)" ++ ++# Pass sub arrays to function and handle them as vla in function. ++gdb_continue_to_breakpoint "not-filled (2nd)" ++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \ ++ "ptype array1 (passed sub-array)" ++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \ ++ "ptype array2 (passed sub-array)" ++gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \ ++ "ptype array1(3, 3) (passed sub-array)" ++gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \ ++ "ptype array2(4, 4, 4) (passed sub-array)" ++ ++# Check ptype outside of bounds. This should not crash GDB. ++gdb_test "ptype array1(100, 100)" "no such vector element" \ ++ "ptype array1(100, 100) subarray do not crash (passed sub-array)" ++gdb_test "ptype array2(100, 100, 100)" "no such vector element" \ ++ "ptype array2(100, 100, 100) subarray do not crash (passed sub-array)" ++ ++# Pass vla to function. ++gdb_continue_to_breakpoint "not-filled (3rd)" ++gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \ ++ "ptype array1 (passed vla)" ++gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ ++ "ptype array2 (passed vla)" ++gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \ ++ "ptype array1(3, 3) (passed vla)" ++gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \ ++ "ptype array2(4, 4, 4) (passed vla)" ++ ++# Check ptype outside of bounds. This should not crash GDB. ++gdb_test "ptype array1(100, 100)" "no such vector element" \ ++ "ptype array1(100, 100) VLA do not crash (passed vla)" ++gdb_test "ptype array2(100, 100, 100)" "no such vector element" \ ++ "ptype array2(100, 100, 100) VLA do not crash (passed vla)" ++ ++# Pass fixed array to function and handle it as VLA of arbitrary length in ++# function. ++gdb_breakpoint [gdb_get_line_number "end-of-bar"] ++gdb_continue_to_breakpoint "end-of-bar" ++gdb_test "ptype array1" \ ++ "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \ ++ "ptype array1 (arbitrary length)" ++gdb_test "ptype array2" \ ++ "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \ ++ "ptype array2 (arbitrary length)" ++gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \ ++ "ptype array1(100) (arbitrary length)" ++gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \ ++ "ptype array2(4,100) (arbitrary length)" +diff --git a/gdb/testsuite/gdb.fortran/vla-sub.f90 b/gdb/testsuite/gdb.fortran/vla-sub.f90 +new file mode 100644 +index 0000000..8c2c9ff +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-sub.f90 +@@ -0,0 +1,82 @@ ++! Copyright 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 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. ++! ++! Original file written by Jakub Jelinek and ++! Jan Kratochvil . ++! Modified for the GDB testcases by Keven Boell . ++ ++subroutine foo (array1, array2) ++ integer :: array1 (:, :) ++ real :: array2 (:, :, :) ++ ++ array1(:,:) = 5 ! not-filled ++ array1(1, 1) = 30 ++ ++ array2(:,:,:) = 6 ! array1-filled ++ array2(:,:,:) = 3 ++ array2(1,1,1) = 30 ++ array2(3,3,3) = 90 ! array2-almost-filled ++end subroutine ++ ++subroutine bar (array1, array2) ++ integer :: array1 (*) ++ integer :: array2 (4:9, 10:*) ++ ++ array1(5:10) = 1311 ++ array1(7) = 1 ++ array1(100) = 100 ++ array2(4,10) = array1(7) ++ array2(4,100) = array1(7) ++ return ! end-of-bar ++end subroutine ++ ++program vla_sub ++ interface ++ subroutine foo (array1, array2) ++ integer :: array1 (:, :) ++ real :: array2 (:, :, :) ++ end subroutine ++ end interface ++ interface ++ subroutine bar (array1, array2) ++ integer :: array1 (*) ++ integer :: array2 (4:9, 10:*) ++ end subroutine ++ end interface ++ ++ real, allocatable :: vla1 (:, :, :) ++ integer, allocatable :: vla2 (:, :) ++ ++ ! used for subroutine ++ integer :: sub_arr1(42, 42) ++ real :: sub_arr2(42, 42, 42) ++ integer :: sub_arr3(42) ++ ++ sub_arr1(:,:) = 1 ! vla2-deallocated ++ sub_arr2(:,:,:) = 2 ++ sub_arr3(:) = 3 ++ ++ call foo(sub_arr1, sub_arr2) ++ call foo(sub_arr1(5:10, 5:10), sub_arr2(10:15,10:15,10:15)) ++ ++ allocate (vla1 (10,10,10)) ++ allocate (vla2 (20,20)) ++ vla1(:,:,:) = 1311 ++ vla2(:,:) = 42 ++ call foo(vla2, vla1) ++ ++ call bar(sub_arr3, sub_arr1) ++end program vla_sub +diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +new file mode 100644 +index 0000000..fd11adb +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +@@ -0,0 +1,35 @@ ++# Copyright 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 "vla-sub.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 ++} ++ ++# Check VLA with arbitary length and check that elements outside of ++# bounds of the passed VLA can be accessed correctly. ++gdb_breakpoint [gdb_get_line_number "end-of-bar"] ++gdb_continue_to_breakpoint "end-of-bar" ++gdb_test "p array1(42)" " = 3" "print arbitary array1(42)" ++gdb_test "p array1(100)" " = 100" "print arbitary array1(100)" ++gdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)" ++gdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)" +diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +new file mode 100644 +index 0000000..a163617 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +@@ -0,0 +1,49 @@ ++# Copyright 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 "vla-sub.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 ++} ++ ++# "up" works with GCC but other Fortran compilers may copy the values into the ++# outer function only on the exit of the inner function. ++# We need both variants as depending on the arch we optionally may still be ++# executing the caller line or not after `finish'. ++ ++gdb_breakpoint [gdb_get_line_number "array2-almost-filled"] ++gdb_continue_to_breakpoint "array2-almost-filled" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was filled" ++gdb_test "print array2(2,1,1)=20" " = 20" \ ++ "set array(2,2,2) to 20 in subroutine" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was mofified in debugger" ++ ++gdb_test "finish" \ ++ ".*foo\\\(sub_arr1\\\(5:10, 5:10\\\), sub_arr2\\\(10:15,10:15,10:15\\\)\\\)" \ ++ "finish function" ++gdb_test "p sub_arr1(5, 7)" " = 5" "sub_arr1(5, 7) after finish" ++gdb_test "p sub_arr1(1, 1)" " = 30" "sub_arr1(1, 1) after finish" ++gdb_test "p sub_arr2(1, 1, 1)" " = 30" "sub_arr2(1, 1, 1) after finish" ++gdb_test "p sub_arr2(2, 1, 1)" " = 20" "sub_arr2(2, 1, 1) after finish" ++ +diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp +new file mode 100644 +index 0000000..848f9d7 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp +@@ -0,0 +1,90 @@ ++# Copyright 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 "vla-sub.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 ++} ++ ++# Check the values of VLA's in subroutine can be evaluated correctly ++ ++# Try to access values from a fixed array handled as VLA in subroutine. ++gdb_breakpoint [gdb_get_line_number "not-filled"] ++gdb_continue_to_breakpoint "not-filled (1st)" ++gdb_test "print array1" " = \\(\[()1, .\]*\\)" \ ++ "print passed array1 in foo (passed fixed array)" ++ ++gdb_breakpoint [gdb_get_line_number "array1-filled"] ++gdb_continue_to_breakpoint "array1-filled (1st)" ++gdb_test "print array1(5, 7)" " = 5" \ ++ "print array1(5, 7) after filled in foo (passed fixed array)" ++gdb_test "print array1(1, 1)" " = 30" \ ++ "print array1(1, 1) after filled in foo (passed fixed array)" ++ ++gdb_breakpoint [gdb_get_line_number "array2-almost-filled"] ++gdb_continue_to_breakpoint "array2-almost-filled (1st)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was filled (passed fixed array)" ++gdb_test "print array2(2,1,1)=20" " = 20" \ ++ "set array(2,2,2) to 20 in subroutine (passed fixed array)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was mofified in debugger (passed fixed array)" ++ ++ ++# Try to access values from a fixed sub-array handled as VLA in subroutine. ++gdb_continue_to_breakpoint "not-filled (2nd)" ++gdb_test "print array1" " = \\(\[()5, .\]*\\)" \ ++ "print passed array1 in foo (passed sub-array)" ++ ++gdb_continue_to_breakpoint "array1-filled (2nd)" ++gdb_test "print array1(5, 5)" " = 5" \ ++ "print array1(5, 5) after filled in foo (passed sub-array)" ++gdb_test "print array1(1, 1)" " = 30" \ ++ "print array1(1, 1) after filled in foo (passed sub-array)" ++ ++gdb_continue_to_breakpoint "array2-almost-filled (2nd)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was filled (passed sub-array)" ++gdb_test "print array2(2,1,1)=20" " = 20" \ ++ "set array(2,2,2) to 20 in subroutine (passed sub-array)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was mofified in debugger (passed sub-array)" ++ ++ ++# Try to access values from a VLA passed to subroutine. ++gdb_continue_to_breakpoint "not-filled (3rd)" ++gdb_test "print array1" " = \\(\[()42, .\]*\\)" \ ++ "print passed array1 in foo (passed vla)" ++ ++gdb_continue_to_breakpoint "array1-filled (3rd)" ++gdb_test "print array1(5, 5)" " = 5" \ ++ "print array1(5, 5) after filled in foo (passed vla)" ++gdb_test "print array1(1, 1)" " = 30" \ ++ "print array1(1, 1) after filled in foo (passed vla)" ++ ++gdb_continue_to_breakpoint "array2-almost-filled (3rd)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was filled (passed vla)" ++gdb_test "print array2(2,1,1)=20" " = 20" \ ++ "set array(2,2,2) to 20 in subroutine (passed vla)" ++gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ ++ "print array2 in foo after it was mofified in debugger (passed vla)" +-- +1.7.9.5 + diff --git a/gdb-vla-intel-16of23.patch b/gdb-vla-intel-16of23.patch new file mode 100644 index 0000000..74fcafa --- /dev/null +++ b/gdb-vla-intel-16of23.patch @@ -0,0 +1,126 @@ +Subject: [PATCH 16/23] test: correct ptype of dynamic arrays in Fortran. +Message-Id: <1401861266-6240-17-git-send-email-keven.boell@intel.com> + +Tests ensure that the ptype of dynamic arrays in +Fortran can be printed in GDB correctly. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-ptype.exp: New file. + +Change-Id: I508a0537be7cac5739a263788be89b18e84d8f8f + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-ptype.exp | 96 +++++++++++++++++++++++++++++++ + 1 file changed, 96 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-ptype.exp + +diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp +new file mode 100644 +index 0000000..9267723 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp +@@ -0,0 +1,96 @@ ++# Copyright 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 "vla.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 ++} ++ ++# 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(3, 6, 9)" "no such vector element because not allocated" \ ++ "ptype vla1(3, 6, 9) not initialized" ++gdb_test "ptype vla2(5, 45, 20)" \ ++ "no such vector element because not allocated" \ ++ "ptype vla1(5, 45, 20) not initialized" ++ ++gdb_breakpoint [gdb_get_line_number "vla1-allocated"] ++gdb_continue_to_breakpoint "vla1-allocated" ++gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ ++ "ptype vla1 allocated" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ ++ "ptype vla2 allocated" ++ ++gdb_breakpoint [gdb_get_line_number "vla1-filled"] ++gdb_continue_to_breakpoint "vla1-filled" ++gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ ++ "ptype vla1 filled" ++gdb_test "ptype vla1(3, 6, 9)" "type = real\\\(kind=4\\\)" \ ++ "ptype vla1(3, 6, 9)" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-filled"] ++gdb_continue_to_breakpoint "vla2-filled" ++gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ ++ "ptype vla2 filled" ++gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \ ++ "ptype vla1(5, 45, 20) filled" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-associated"] ++gdb_continue_to_breakpoint "pvla-associated" ++gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \ ++ "ptype pvla associated" ++gdb_test "ptype pvla(3, 6, 9)" "type = real\\\(kind=4\\\)" \ ++ "ptype pvla(3, 6, 9)" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"] ++gdb_continue_to_breakpoint "pvla-re-associated" ++gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \ ++ "ptype pvla re-associated" ++gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \ ++ "ptype vla1(5, 45, 20) re-associated" ++ ++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(5, 45, 20)" \ ++ "no such vector element because 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(3, 6, 9)" "no such vector element because 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(5, 45, 20)" \ ++ "no such vector element because not allocated" \ ++ "ptype vla2(5, 45, 20) not allocated" +-- +1.7.9.5 + diff --git a/gdb-vla-intel-17of23.patch b/gdb-vla-intel-17of23.patch new file mode 100644 index 0000000..36a1633 --- /dev/null +++ b/gdb-vla-intel-17of23.patch @@ -0,0 +1,95 @@ +Subject: [PATCH 17/23] test: evaluating allocation/association status +Message-Id: <1401861266-6240-18-git-send-email-keven.boell@intel.com> + +Tests ensure that dynamic arrays in different states +(allocated/associated) can be evaluated. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-alloc-assoc.exp: New file. + +Change-Id: I6950473c3f1724ebf5c7b037706186b2cd6af5f0 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp | 65 +++++++++++++++++++++++++ + 1 file changed, 65 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp + +diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +new file mode 100644 +index 0000000..20607c3 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +@@ -0,0 +1,65 @@ ++# Copyright 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 "vla.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 ++} ++ ++# Check the association status of various types of VLA's ++# and pointer to VLA's. ++gdb_breakpoint [gdb_get_line_number "vla1-allocated"] ++gdb_continue_to_breakpoint "vla1-allocated" ++gdb_test "print l" " = \\.TRUE\\." \ ++ "print vla1 allocation status (allocated)" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "print l" " = \\.TRUE\\." \ ++ "print vla2 allocation status (allocated)" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-associated"] ++gdb_continue_to_breakpoint "pvla-associated" ++gdb_test "print l" " = \\.TRUE\\." \ ++ "print pvla associated status (associated)" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-re-associated"] ++gdb_continue_to_breakpoint "pvla-re-associated" ++gdb_test "print l" " = \\.TRUE\\." \ ++ "print pvla associated status (re-associated)" ++ ++gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] ++gdb_continue_to_breakpoint "pvla-deassociated" ++gdb_test "print l" " = \\.FALSE\\." \ ++ "print pvla allocation status (deassociated)" ++ ++gdb_breakpoint [gdb_get_line_number "vla1-deallocated"] ++gdb_continue_to_breakpoint "vla1-deallocated" ++gdb_test "print l" " = \\.FALSE\\." \ ++ "print vla1 allocation status (deallocated)" ++gdb_test "print vla1" " = " \ ++ "print deallocated vla1" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-deallocated"] ++gdb_continue_to_breakpoint "vla2-deallocated" ++gdb_test "print l" " = \\.FALSE\\." "print vla2 deallocated" ++gdb_test "print vla2" " = " "print deallocated vla2" +-- +1.7.9.5 + diff --git a/gdb-vla-intel-18of23.patch b/gdb-vla-intel-18of23.patch new file mode 100644 index 0000000..ee5b32f --- /dev/null +++ b/gdb-vla-intel-18of23.patch @@ -0,0 +1,171 @@ +Subject: [PATCH 18/23] test: dynamic arrays passed to functions. +Message-Id: <1401861266-6240-19-git-send-email-keven.boell@intel.com> + +Tests for dynamic arrays passed to functions +and returned from functions. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-func.f90: New file. + * vla-func.exp: New file. + +Change-Id: Ic3eb212f35f599e4c10a284c23125491653b17df + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-func.exp | 61 +++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-func.f90 | 71 ++++++++++++++++++++++++++++++++ + 2 files changed, 132 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-func.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-func.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp +new file mode 100644 +index 0000000..f0f236b +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-func.exp +@@ -0,0 +1,61 @@ ++# Copyright 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 ".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 ++} ++ ++# Check VLA passed to first Fortran function. ++gdb_breakpoint [gdb_get_line_number "func1-vla-passed"] ++gdb_continue_to_breakpoint "func1-vla-passed" ++gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \ ++ "print vla (func1)" ++gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \ ++ "ptype vla (func1)" ++ ++gdb_breakpoint [gdb_get_line_number "func1-vla-modified"] ++gdb_continue_to_breakpoint "func1-vla-modified" ++gdb_test "print vla(5,5)" " = 55" "print vla(5,5) (func1)" ++gdb_test "print vla(7,7)" " = 77" "print vla(5,5) (func1)" ++ ++# Check if the values are correct after returning from func1 ++gdb_breakpoint [gdb_get_line_number "func1-returned"] ++gdb_continue_to_breakpoint "func1-returned" ++gdb_test "print ret" " = .TRUE." "print ret after func1 returned" ++ ++# Check VLA passed to second Fortran function ++gdb_breakpoint [gdb_get_line_number "func2-vla-passed"] ++gdb_continue_to_breakpoint "func2-vla-passed" ++gdb_test "print vla" \ ++ " = \\\(44, 44, 44, 44, 44, 44, 44, 44, 44, 44\\\)" \ ++ "print vla (func2)" ++gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ ++ "ptype vla (func2)" ++ ++# Check if the returned VLA has the correct values and ptype. ++gdb_breakpoint [gdb_get_line_number "func2-returned"] ++gdb_continue_to_breakpoint "func2-returned" ++gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \ ++ "print vla3 (after func2)" ++gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ ++ "ptype vla3 (after func2)" +diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90 +new file mode 100644 +index 0000000..4f45da1 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-func.f90 +@@ -0,0 +1,71 @@ ++! Copyright 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 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. ++ ++logical function func1 (vla) ++ implicit none ++ integer, allocatable :: vla (:, :) ++ func1 = allocated(vla) ++ vla(5,5) = 55 ! func1-vla-passed ++ vla(7,7) = 77 ++ return ! func1-vla-modified ++end function func1 ++ ++function func2(vla) ++ implicit none ++ integer :: vla (:) ++ integer :: func2(size(vla)) ++ integer :: k ++ ++ vla(1) = 1 ! func2-vla-passed ++ vla(2) = 2 ++ vla(4) = 4 ++ vla(8) = 8 ++ ++ func2 = vla ++end function func2 ++ ++program vla_func ++ implicit none ++ interface ++ logical function func1 (vla) ++ integer :: vla (:, :) ++ end function ++ end interface ++ interface ++ function func2 (vla) ++ integer :: vla (:) ++ integer func2(size(vla)) ++ end function ++ end interface ++ ++ logical :: ret ++ integer, allocatable :: vla1 (:, :) ++ integer, allocatable :: vla2 (:) ++ integer, allocatable :: vla3 (:) ++ ++ ret = .FALSE. ++ ++ allocate (vla1 (10,10)) ++ vla1(:,:) = 22 ++ ++ allocate (vla2 (10)) ++ vla2(:) = 44 ++ ++ ret = func1(vla1) ++ vla3 = func2(vla2) ! func1-returned ++ ++ ret = .TRUE. ! func2-returned ++end program vla_func +-- +1.7.9.5 + diff --git a/gdb-vla-intel-19of23.patch b/gdb-vla-intel-19of23.patch new file mode 100644 index 0000000..61f91b8 --- /dev/null +++ b/gdb-vla-intel-19of23.patch @@ -0,0 +1,92 @@ +Subject: [PATCH 19/23] test: accessing dynamic array history values. +Message-Id: <1401861266-6240-20-git-send-email-keven.boell@intel.com> + +Tests if the history values of dynamic arrays can be +accessed and printed again with the correct values. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-history.exp: New file. + +Change-Id: Ib6d2d30272aefc24b6db5fa0633fe72274390e91 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-history.exp | 62 +++++++++++++++++++++++++++++ + 1 file changed, 62 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-history.exp + +diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp +new file mode 100644 +index 0000000..170e1eb +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-history.exp +@@ -0,0 +1,62 @@ ++# Copyright 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 "vla.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 ++} ++ ++# Set some breakpoints and print complete vla. ++gdb_breakpoint [gdb_get_line_number "vla1-init"] ++gdb_continue_to_breakpoint "vla1-init" ++gdb_test "print vla1" " = " "print non-allocated vla1" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "print vla1" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \ ++ "print vla1 allocated" ++gdb_test "print vla2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \ ++ "print vla2 allocated" ++ ++gdb_breakpoint [gdb_get_line_number "vla1-filled"] ++gdb_continue_to_breakpoint "vla1-filled" ++gdb_test "print vla1" \ ++ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" \ ++ "print vla1 filled" ++ ++# Try to access history values for full vla prints. ++gdb_test "print \$1" " = " "print \$1" ++gdb_test "print \$2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \ ++ "print \$2" ++gdb_test "print \$3" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \ ++ "print \$3" ++gdb_test "print \$4" \ ++ " = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$4" ++ ++gdb_breakpoint [gdb_get_line_number "vla2-filled"] ++gdb_continue_to_breakpoint "vla2-filled" ++gdb_test "print vla2(1,43,20)" " = 1311" "print vla2(1,43,20)" ++gdb_test "print vla1(1,3,8)" " = 1001" "print vla2(1,3,8)" ++ ++# Try to access history values for vla values. ++gdb_test "print \$9" " = 1311" "print \$9" ++gdb_test "print \$10" " = 1001" "print \$10" +-- +1.7.9.5 + diff --git a/gdb-vla-intel-20of23.patch b/gdb-vla-intel-20of23.patch new file mode 100644 index 0000000..1af5ac9 --- /dev/null +++ b/gdb-vla-intel-20of23.patch @@ -0,0 +1,181 @@ +Subject: [PATCH 20/23] test: dynamic string evaluations. +Message-Id: <1401861266-6240-21-git-send-email-keven.boell@intel.com> + +Tests various dynamic string evaluations. Dynamic strings +will be handled internally the same way as dynamic arrays. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-strings.f90: New file. + * vla-strings.exp: New file. + +Change-Id: Ib2f3dded2fbc5f0a9684050c5cfa22a450e18358 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-strings.exp | 104 +++++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-strings.f90 | 38 +++++++++++ + 2 files changed, 142 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-strings.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-strings.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp +new file mode 100644 +index 0000000..7fc1734 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-strings.exp +@@ -0,0 +1,104 @@ ++# Copyright 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 ".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__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] ++gdb_continue_to_breakpoint "var_char-allocated-1" ++gdb_test "print var_char" \ ++ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \ ++ "print var_char after allocated first time" ++gdb_test "print *var_char" \ ++ " = '\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000\\\\000'" \ ++ "print *var_char after allocated first time" ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \ ++ "whatis var_char first time" ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \ ++ "ptype var_char first time" ++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" ++gdb_test "print var_char" \ ++ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \ ++ "print var_char after filled first time" ++gdb_test "print *var_char" " = 'foo'" \ ++ "print *var_char after filled first time" ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \ ++ "whatis var_char after filled first time" ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \ ++ "ptype var_char after filled first time" ++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" ++gdb_test "print var_char" \ ++ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \ ++ "print var_char after allocated second time" ++gdb_test "print *var_char" " = 'foobar'" \ ++ "print *var_char after allocated second time" ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \ ++ "whatis var_char second time" ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \ ++ "ptype var_char second time" ++ ++gdb_breakpoint [gdb_get_line_number "var_char-empty"] ++gdb_continue_to_breakpoint "var_char-empty" ++gdb_test "print var_char" \ ++ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \ ++ "print var_char after set empty" ++gdb_test "print *var_char" " = \"\"" "print *var_char after set empty" ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \ ++ "whatis var_char after set empty" ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \ ++ "ptype var_char after set empty" ++ ++gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"] ++gdb_continue_to_breakpoint "var_char-allocated-3" ++gdb_test "print var_char" \ ++ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \ ++ "print var_char after allocated third time" ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \ ++ "whatis var_char after allocated third time" ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \ ++ "ptype var_char after allocated third time" ++ ++gdb_breakpoint [gdb_get_line_number "var_char_p-associated"] ++gdb_continue_to_breakpoint "var_char_p-associated" ++gdb_test "print var_char_p" \ ++ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \ ++ "print var_char_p after associated" ++gdb_test "print *var_char_p" " = 'johndoe'" \ ++ "print *var_char_ after associated" ++gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ ++ "whatis var_char_p after associated" ++gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ ++ "ptype var_char_p after associated" +diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90 +new file mode 100644 +index 0000000..6679043 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-strings.f90 +@@ -0,0 +1,38 @@ ++! Copyright 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 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. ++ ++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 ++ allocate(character(len=21) :: var_char) ! var_char-empty ++ 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 +-- +1.7.9.5 + diff --git a/gdb-vla-intel-21of23.patch b/gdb-vla-intel-21of23.patch new file mode 100644 index 0000000..9494b92 --- /dev/null +++ b/gdb-vla-intel-21of23.patch @@ -0,0 +1,262 @@ +Subject: [PATCH 21/23] test: basic MI test for the dynamic array support. +Message-Id: <1401861266-6240-22-git-send-email-keven.boell@intel.com> + +Tests dynamic array evaluations using MI protocol. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.mi/: + + * mi-vla-fortran.exp: New file. + * vla.f90: New file. + +Change-Id: I37caa85b1498478f5eff0f52d3fd431388aaab6f + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.mi/mi-vla-fortran.exp | 182 +++++++++++++++++++++++++++++++ + gdb/testsuite/gdb.mi/vla.f90 | 42 +++++++ + 2 files changed, 224 insertions(+) + create mode 100644 gdb/testsuite/gdb.mi/mi-vla-fortran.exp + create mode 100644 gdb/testsuite/gdb.mi/vla.f90 + +diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +new file mode 100644 +index 0000000..72b0be2 +--- /dev/null ++++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +@@ -0,0 +1,182 @@ ++# Copyright 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 . ++ ++# Verify that, using the MI, we can evaluate a simple C Variable Length ++# Array (VLA). ++ ++load_lib mi-support.exp ++set MIFLAGS "-i=mi" ++ ++gdb_exit ++if [mi_gdb_start] { ++ continue ++} ++ ++standard_testfile vla.f90 ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ ++ {debug f90}] != "" } { ++ untested mi-vla-fortran.exp ++ return -1 ++} ++ ++mi_delete_breakpoints ++mi_gdb_reinitialize_dir $srcdir/$subdir ++mi_gdb_load ${binfile} ++ ++set bp_lineno [gdb_get_line_number "vla1-not-allocated"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 1 "del" "vla" \ ++ ".*vla.f90" $bp_lineno $hex \ ++ "insert breakpoint at line $bp_lineno (vla not allocated)" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "500-data-evaluate-expression vla1" \ ++ "500\\^done,value=\"\"" "evaluate not allocated vla" ++ ++mi_create_varobj_checked vla1_not_allocated vla1 "" \ ++ "create local variable vla1_not_allocated" ++mi_gdb_test "501-var-info-type vla1_not_allocated" \ ++ "501\\^done,type=\"\"" \ ++ "info type variable vla1_not_allocated" ++mi_gdb_test "502-var-show-format vla1_not_allocated" \ ++ "502\\^done,format=\"natural\"" \ ++ "show format variable vla1_not_allocated" ++mi_gdb_test "503-var-evaluate-expression vla1_not_allocated" \ ++ "503\\^done,value=\"\\\[0\\\]\"" \ ++ "eval variable vla1_not_allocated" ++mi_list_array_varobj_children_with_index "vla1_not_allocated" "0" "1" \ ++ "real\\\(kind=4\\\)" "get children of vla1_not_allocated" ++ ++ ++ ++set bp_lineno [gdb_get_line_number "vla1-allocated"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 2 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno (vla allocated)" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "510-data-evaluate-expression vla1" \ ++ "510\\^done,value=\"\\(0, 0, 0, 0, 0\\)\"" "evaluate allocated vla" ++ ++mi_create_varobj_checked vla1_allocated vla1 "real\\\(kind=4\\\) \\\(5\\\)" \ ++ "create local variable vla1_allocated" ++mi_gdb_test "511-var-info-type vla1_allocated" \ ++ "511\\^done,type=\"real\\\(kind=4\\\) \\\(5\\\)\"" \ ++ "info type variable vla1_allocated" ++mi_gdb_test "512-var-show-format vla1_allocated" \ ++ "512\\^done,format=\"natural\"" \ ++ "show format variable vla1_allocated" ++mi_gdb_test "513-var-evaluate-expression vla1_allocated" \ ++ "513\\^done,value=\"\\\[5\\\]\"" \ ++ "eval variable vla1_allocated" ++mi_list_array_varobj_children_with_index "vla1_allocated" "5" "1" \ ++ "real\\\(kind=4\\\)" "get children of vla1_allocated" ++ ++ ++set bp_lineno [gdb_get_line_number "vla1-filled"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 3 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "520-data-evaluate-expression vla1" \ ++ "520\\^done,value=\"\\(1, 1, 1, 1, 1\\)\"" "evaluate filled vla" ++ ++ ++set bp_lineno [gdb_get_line_number "vla1-modified"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 4 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "530-data-evaluate-expression vla1" \ ++ "530\\^done,value=\"\\(1, 42, 1, 24, 1\\)\"" "evaluate filled vla" ++mi_gdb_test "540-data-evaluate-expression vla1(1)" \ ++ "540\\^done,value=\"1\"" "evaluate filled vla" ++mi_gdb_test "550-data-evaluate-expression vla1(2)" \ ++ "550\\^done,value=\"42\"" "evaluate filled vla" ++mi_gdb_test "560-data-evaluate-expression vla1(4)" \ ++ "560\\^done,value=\"24\"" "evaluate filled vla" ++ ++ ++set bp_lineno [gdb_get_line_number "vla1-deallocated"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 5 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "570-data-evaluate-expression vla1" \ ++ "570\\^done,value=\"\"" "evaluate not allocated vla" ++ ++ ++set bp_lineno [gdb_get_line_number "pvla2-not-associated"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 6 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "580-data-evaluate-expression pvla2" \ ++ "580\\^done,value=\"\"" "evaluate not associated vla" ++ ++mi_create_varobj_checked pvla2_not_associated pvla2 "" \ ++ "create local variable pvla2_not_associated" ++mi_gdb_test "581-var-info-type pvla2_not_associated" \ ++ "581\\^done,type=\"\"" \ ++ "info type variable pvla2_not_associated" ++mi_gdb_test "582-var-show-format pvla2_not_associated" \ ++ "582\\^done,format=\"natural\"" \ ++ "show format variable pvla2_not_associated" ++mi_gdb_test "583-var-evaluate-expression pvla2_not_associated" \ ++ "583\\^done,value=\"\\\[0\\\]\"" \ ++ "eval variable pvla2_not_associated" ++mi_list_array_varobj_children_with_index "pvla2_not_associated" "0" "1" \ ++ "real\\\(kind=4\\\)" "get children of pvla2_not_associated" ++ ++ ++set bp_lineno [gdb_get_line_number "pvla2-associated"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 7 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "590-data-evaluate-expression pvla2" \ ++ "590\\^done,value=\"\\(\\( 2, 2, 2, 2, 2\\) \\( 2, 2, 2, 2, 2\\) \\)\"" \ ++ "evaluate associated vla" ++ ++mi_create_varobj_checked pvla2_associated pvla2 \ ++ "real\\\(kind=4\\\) \\\(5,2\\\)" "create local variable pvla2_associated" ++mi_gdb_test "591-var-info-type pvla2_associated" \ ++ "591\\^done,type=\"real\\\(kind=4\\\) \\\(5,2\\\)\"" \ ++ "info type variable pvla2_associated" ++mi_gdb_test "592-var-show-format pvla2_associated" \ ++ "592\\^done,format=\"natural\"" \ ++ "show format variable pvla2_associated" ++mi_gdb_test "593-var-evaluate-expression pvla2_associated" \ ++ "593\\^done,value=\"\\\[2\\\]\"" \ ++ "eval variable pvla2_associated" ++ ++ ++set bp_lineno [gdb_get_line_number "pvla2-set-to-null"] ++mi_create_breakpoint "-t vla.f90:$bp_lineno" 8 "del" "vla" ".*vla.f90" \ ++ $bp_lineno $hex "insert breakpoint at line $bp_lineno" ++mi_run_cmd ++mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ ++ { "" "disp=\"del\"" } "run to breakpoint at line $bp_lineno" ++mi_gdb_test "600-data-evaluate-expression pvla2" \ ++ "600\\^done,value=\"\"" "evaluate vla pointer set to null" ++ ++mi_gdb_exit ++return 0 +diff --git a/gdb/testsuite/gdb.mi/vla.f90 b/gdb/testsuite/gdb.mi/vla.f90 +new file mode 100644 +index 0000000..46edad2 +--- /dev/null ++++ b/gdb/testsuite/gdb.mi/vla.f90 +@@ -0,0 +1,42 @@ ++! Copyright 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 . ++ ++program vla ++ real, allocatable :: vla1 (:) ++ real, target, allocatable :: vla2(:, :) ++ real, pointer :: pvla2 (:, :) ++ logical :: l ++ ++ allocate (vla1 (5)) ! vla1-not-allocated ++ l = allocated(vla1) ! vla1-allocated ++ ++ vla1(:) = 1 ++ vla1(2) = 42 ! vla1-filled ++ vla1(4) = 24 ++ ++ deallocate (vla1) ! vla1-modified ++ l = allocated(vla1) ! vla1-deallocated ++ ++ allocate (vla2 (5, 2)) ++ vla2(:, :) = 2 ++ ++ pvla2 => vla2 ! pvla2-not-associated ++ l = associated(pvla2) ! pvla2-associated ++ ++ pvla2(2, 1) = 42 ++ ++ pvla2 => null() ++ l = associated(pvla2) ! pvla2-set-to-null ++end program vla +-- +1.7.9.5 + diff --git a/gdb-vla-intel-22of23.patch b/gdb-vla-intel-22of23.patch new file mode 100644 index 0000000..1a0674c --- /dev/null +++ b/gdb-vla-intel-22of23.patch @@ -0,0 +1,75 @@ +Subject: [PATCH 22/23] test: test sizeof for dynamic fortran arrays. +Message-Id: <1401861266-6240-23-git-send-email-keven.boell@intel.com> + +Tests sizeof output of dynamic arrays in various states. + +2014-05-28 Keven Boell + Sanimir Agovic + +testsuite/gdb.fortran/: + + * vla-sizeof.exp: New file. + +Change-Id: I68d81d03ff2daa32ab87d2750873652d684e7389 + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-sizeof.exp | 46 ++++++++++++++++++++++++++++++ + 1 file changed, 46 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-sizeof.exp + +diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +new file mode 100644 +index 0000000..6053c17 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +@@ -0,0 +1,46 @@ ++# Copyright 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 "vla.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 ++} ++ ++# Try to access values in non allocated VLA ++gdb_breakpoint [gdb_get_line_number "vla1-init"] ++gdb_continue_to_breakpoint "vla1-init" ++gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1" ++ ++# Try to access value in allocated VLA ++gdb_breakpoint [gdb_get_line_number "vla2-allocated"] ++gdb_continue_to_breakpoint "vla2-allocated" ++gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1" ++ ++# Try to access values in undefined pointer to VLA (dangling) ++gdb_breakpoint [gdb_get_line_number "vla1-filled"] ++gdb_continue_to_breakpoint "vla1-filled" ++gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla" ++ ++# Try to access values in pointer to VLA and compare them ++gdb_breakpoint [gdb_get_line_number "pvla-associated"] ++gdb_continue_to_breakpoint "pvla-associated" ++gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" +-- +1.7.9.5 + diff --git a/gdb-vla-intel-23of23.patch b/gdb-vla-intel-23of23.patch new file mode 100644 index 0000000..c9657d0 --- /dev/null +++ b/gdb-vla-intel-23of23.patch @@ -0,0 +1,119 @@ +Subject: [PATCH 23/23] test: stride support for dynamic arrays. +Message-Id: <1401861266-6240-24-git-send-email-keven.boell@intel.com> + +Tests the usage of stride values in dynamic arrays. + +2014-05-28 Sanimir Agovic + Keven Boell + +testsuite/gdb.fortran/: + + * vla-stride.exp: New file. + * vla-stride.f90: New file. + +Change-Id: Ic4f68cf97046cc9f5f3664fe4c12d2b7528c22ee + +Signed-off-by: Keven Boell +--- + gdb/testsuite/gdb.fortran/vla-stride.exp | 51 ++++++++++++++++++++++++++++++ + gdb/testsuite/gdb.fortran/vla-stride.f90 | 30 ++++++++++++++++++ + 2 files changed, 81 insertions(+) + create mode 100644 gdb/testsuite/gdb.fortran/vla-stride.exp + create mode 100644 gdb/testsuite/gdb.fortran/vla-stride.f90 + +diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp +new file mode 100644 +index 0000000..e791115 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-stride.exp +@@ -0,0 +1,51 @@ ++# Copyright 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 ".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 "reverse-elements"] ++gdb_continue_to_breakpoint "reverse-elements" ++gdb_test "print pvla" " = \\\(10, 9, 8, 7, 6, 5, 4, 3, 2, 1\\\)" \ ++ "print reverse-elements" ++gdb_test "print pvla(1)" " = 10" "print first reverse-element" ++gdb_test "print pvla(10)" " = 1" "print last reverse-element" ++ ++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 +index 0000000..1f8cc55 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/vla-stride.f90 +@@ -0,0 +1,30 @@ ++! Copyright 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 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. ++ ++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) ! reverse-elements ++ pvla => vla(1:10:2) ! re-reverse-elements ++ pvla => vla(5:4:-2) ! odd-elements ++ ++ pvla => null() ! single-element ++end program vla_stride +-- +1.7.9.5 + diff --git a/gdb-watchpoint-fork-fix.patch b/gdb-watchpoint-fork-fix.patch new file mode 100644 index 0000000..388d3a8 --- /dev/null +++ b/gdb-watchpoint-fork-fix.patch @@ -0,0 +1,38 @@ +http://sourceware.org/ml/gdb-patches/2014-06/msg00710.html +Subject: Re: Regression for watchpoint-fork.exp [Re: [PATCH v3 2/5] PR breakpoints/7143 - Watchpoint does not trigger when first set] + +On 06/19/2014 04:02 PM, Pedro Alves wrote: + +>> Attaching gzipped gdb.threads/watchpoint-fork-parent-st +>> from gcc-4.9.0-9.fc21.x86_64. +> +> Thanks, I can reproduce it. + +Hmm, I suspect this might be related to kernel-side validation +of DR_CONTROL vs DR0-3, like what we already handle in amd64_linux_prepare_to_resume. +And indeed this below makes the error go away. Not exactly sure why yet. + +[ patch extended by Jan Kratochvil ] + +--- gdb-7.7.90.20140613/gdb/i386-linux-nat.c.orig 2014-06-19 21:42:00.788611544 +0200 ++++ gdb-7.7.90.20140613/gdb/i386-linux-nat.c 2014-06-19 21:42:04.556614401 +0200 +@@ -778,6 +778,8 @@ i386_linux_prepare_to_resume (struct lwp + /* See amd64_linux_prepare_to_resume for Linux kernel note on + i386_linux_dr_set calls ordering. */ + ++ i386_linux_dr_set (lwp->ptid, DR_CONTROL, 0); ++ + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) + if (state->dr_ref_count[i] > 0) + { +--- gdb-7.7.90.20140613/gdb/amd64-linux-nat.c.orig 2014-06-19 21:40:37.582534392 +0200 ++++ gdb-7.7.90.20140613/gdb/amd64-linux-nat.c 2014-06-19 21:41:17.192570902 +0200 +@@ -415,6 +415,8 @@ amd64_linux_prepare_to_resume (struct lw + + Ensure DR_CONTROL gets written as the very last register here. */ + ++ amd64_linux_dr_set (lwp->ptid, DR_CONTROL, 0); ++ + for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) + if (state->dr_ref_count[i] > 0) + { diff --git a/gdb.spec b/gdb.spec index 9e52275..657801c 100644 --- a/gdb.spec +++ b/gdb.spec @@ -17,17 +17,15 @@ Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages Name: %{?scl_prefix}gdb -# 6e5c95e6cf1e3c37bd3a822ca9e6721caab97a85 -#global snap 20140127 # Freeze it when GDB gets branched -%global snapsrc 20140108 +%global snapsrc 20140613 # See timestamp of source gnulib installed into gdb/gnulib/ . %global snapgnulib 20121213 -Version: 7.7.1 +Version: 7.7.90.20140613 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 21%{?dist} +Release: 1%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -221,20 +219,6 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. #Xdrop: Just backports. Patch232: gdb-upstream.patch -Patch868: gdb-upstream-ppc64le02of15.patch -Patch869: gdb-upstream-ppc64le03of15.patch -Patch870: gdb-upstream-ppc64le04of15.patch -Patch871: gdb-upstream-ppc64le05of15.patch -Patch872: gdb-upstream-ppc64le06of15.patch -Patch873: gdb-upstream-ppc64le07of15.patch -Patch874: gdb-upstream-ppc64le08of15.patch -Patch875: gdb-upstream-ppc64le09of15.patch -Patch876: gdb-upstream-ppc64le10of15.patch -Patch877: gdb-upstream-ppc64le11of15.patch -Patch878: gdb-upstream-ppc64le12of15.patch -Patch879: gdb-upstream-ppc64le13of15.patch -Patch880: gdb-upstream-ppc64le14of15.patch -Patch881: gdb-upstream-ppc64le15of15.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest+ppc @@ -287,10 +271,6 @@ Patch833: gdb-6.6-buildid-locate-rpm-scl.patch # but not corresponding binary pkg' (RH BZ 981154). Patch863: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch -# Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875). -#=push -Patch276: gdb-6.6-bfd-vdso8k.patch - # Fix displaying of numeric char arrays as strings (BZ 224128). #=fedoratest: But it is failing anyway, one should check the behavior more. Patch282: gdb-6.7-charsign-test.patch @@ -518,20 +498,44 @@ Patch832: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch # Fix crash on 'enable count' (Simon Marchi, BZ 993118). Patch843: gdb-enable-count-crash.patch -# Fix testsuite "ERROR: no fileid for". -Patch846: gdb-testsuite-nohostid.patch - # [rhel6] DTS backward Python compatibility API (BZ 1020004, Phil Muldoon). Patch848: gdb-dts-rhel6-python-compat.patch # Fix crash of -readnow /usr/lib/debug/usr/bin/gnatbind.debug (BZ 1069211). -Patch850: gdb-gnat-dwarf-crash-1of3.patch -Patch851: gdb-gnat-dwarf-crash-2of3.patch Patch852: gdb-gnat-dwarf-crash-3of3.patch -# Fix TLS access for -static -pthread (BZ 1080660). -Patch865: gdb-static-tls-1of2.patch -Patch866: gdb-static-tls-2of2.patch +# VLA (Fortran dynamic arrays) from Intel + archer-jankratochvil-vla tests. +Patch887: gdb-archer-vla-tests.patch +Patch888: gdb-vla-intel-01of23.patch +Patch889: gdb-vla-intel-02of23.patch +Patch890: gdb-vla-intel-03of23.patch +Patch891: gdb-vla-intel-04of23.patch +Patch912: gdb-vla-intel-04of23-fix.patch +Patch892: gdb-vla-intel-05of23.patch +Patch893: gdb-vla-intel-06of23.patch +Patch894: gdb-vla-intel-07of23.patch +Patch895: gdb-vla-intel-08of23.patch +Patch896: gdb-vla-intel-09of23.patch +Patch897: gdb-vla-intel-10of23.patch +Patch898: gdb-vla-intel-11of23.patch +Patch899: gdb-vla-intel-12of23.patch +Patch900: gdb-vla-intel-13of23.patch +Patch901: gdb-vla-intel-14of23.patch +Patch902: gdb-vla-intel-15of23.patch +Patch903: gdb-vla-intel-16of23.patch +Patch904: gdb-vla-intel-17of23.patch +Patch905: gdb-vla-intel-18of23.patch +Patch906: gdb-vla-intel-19of23.patch +Patch907: gdb-vla-intel-20of23.patch +Patch908: gdb-vla-intel-21of23.patch +Patch909: gdb-vla-intel-22of23.patch +Patch910: gdb-vla-intel-23of23.patch + +# Fix ASAN crash regression with demangled names copy (Tom Tromey). +Patch911: gdb-bfd-demangled-names.patch + +# Fix gdb-7.8 watchpoint-fork.exp regression (Pedro Alves). +Patch913: gdb-watchpoint-fork-fix.patch %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: @@ -707,20 +711,30 @@ find -name "*.info*"|xargs rm -f %patch349 -p1 %patch232 -p1 -%patch868 -p1 -%patch869 -p1 -%patch870 -p1 -%patch871 -p1 -%patch872 -p1 -%patch873 -p1 -%patch874 -p1 -%patch875 -p1 -%patch876 -p1 -%patch877 -p1 -%patch878 -p1 -%patch879 -p1 -%patch880 -p1 -%patch881 -p1 +%patch888 -p1 +%patch889 -p1 +%patch890 -p1 +%patch891 -p1 +%patch912 -p1 +%patch892 -p1 +%patch893 -p1 +%patch894 -p1 +%patch895 -p1 +%patch896 -p1 +%patch897 -p1 +%patch898 -p1 +%patch899 -p1 +%patch900 -p1 +%patch901 -p1 +%patch902 -p1 +%patch903 -p1 +%patch904 -p1 +%patch905 -p1 +%patch906 -p1 +%patch907 -p1 +%patch908 -p1 +%patch909 -p1 +%patch910 -p1 %patch1 -p1 %patch105 -p1 @@ -760,7 +774,6 @@ find -name "*.info*"|xargs rm -f %patch274 -p1 %patch659 -p1 %patch353 -p1 -%patch276 -p1 %patch282 -p1 %patch284 -p1 %patch289 -p1 @@ -817,13 +830,11 @@ find -name "*.info*"|xargs rm -f %patch818 -p1 %patch832 -p1 %patch843 -p1 -%patch846 -p1 -%patch850 -p1 -%patch851 -p1 %patch852 -p1 %patch863 -p1 -%patch865 -p1 -%patch866 -p1 +%patch887 -p1 +%patch911 -p1 +%patch913 -p1 %patch848 -p1 %if 0%{!?el6:1} @@ -910,6 +921,7 @@ export LDFLAGS="%{?__global_ldflags} %{?_with_asan:-fsanitize=address}" --with-separate-debug-dir=/usr/lib/debug \ --disable-sim \ --disable-rpath \ + --without-guile \ %if 0%{!?rhel:1} || 0%{?rhel} > 6 --with-system-readline \ %else @@ -1308,6 +1320,9 @@ then fi %changelog +* Thu Jun 19 2014 Jan Kratochvil - 7.7.90.20140613-1.fc21 +- Rebase to FSF GDB 7.7.90.20140613 (pre-7.8 snapshot). + * Sat Jun 07 2014 Fedora Release Engineering - 7.7.1-21 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild diff --git a/sources b/sources index 93afe54..f1c61d8 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 4981307aa9619bbec5b73261e4e41c8d gdb-libstdc++-v3-python-r155978.tar.bz2 -77b20b515e7c25f032cb9732a66620fe gdb-7.7.1.tar.bz2 +cf4ddceb79fef56b4146e14be72c8727 gdb-7.7.90.20140613.tar.bz2