diff --git a/.cvsignore b/.cvsignore
index 3b34e37..47c7cd6 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,2 +1,2 @@
-gdb-7.0.50.20100203.tar.bz2
+gdb-7.1.tar.bz2
libstdc++-v3-python-r155978.tar.bz2
diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch
index 0aa6426..100b877 100644
--- a/gdb-6.3-gstack-20050411.patch
+++ b/gdb-6.3-gstack-20050411.patch
@@ -4,10 +4,9 @@
to install and uninstall.
* gstack.sh, gstack.1: New files.
-Index: gdb-6.8.91.20090917/gdb/Makefile.in
-===================================================================
---- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200
-+++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200
+diff -up -ruNp gdb-7.0.1-empty/gdb/Makefile.in gdb-7.0.1/gdb/Makefile.in
+--- gdb-7.0.1-empty/gdb/Makefile.in 2010-04-07 20:36:04.000000000 +0200
++++ gdb-7.0.1/gdb/Makefile.in 2010-04-07 20:36:42.000000000 +0200
@@ -989,7 +989,7 @@ install: all install-only
# The "install-only" target also installs the syscalls' XML files in
@@ -63,10 +62,9 @@ Index: gdb-6.8.91.20090917/gdb/Makefile.in
# The C++ name parser can be built standalone for testing.
test-cp-name-parser.o: cp-name-parser.c
-Index: gdb-6.8.91.20090917/gdb/gstack.sh
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200
+diff -up -ruNp gdb-7.0.1-empty/gdb/gstack.sh gdb-7.0.1/gdb/gstack.sh
+--- gdb-7.0.1-empty/gdb/gstack.sh 1970-01-01 01:00:00.000000000 +0100
++++ gdb-7.0.1/gdb/gstack.sh 2010-04-07 20:36:47.000000000 +0200
@@ -0,0 +1,48 @@
+#!/bin/sh
+
@@ -87,17 +85,17 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+backtrace="bt"
+if test -d /proc/$1/task ; then
+ # Newer kernel; has a task/ directory.
-+ if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
++ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
+ backtrace="thread apply all bt"
+ fi
+elif test -f /proc/$1/maps ; then
+ # Older kernel; go by it loading libpthread.
-+ if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
++ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
+ backtrace="thread apply all bt"
+ fi
+fi
+
-+GDB=${GDB:-gdb}
++GDB=${GDB:-/usr/bin/gdb}
+
+if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
+ readnever=--readnever
@@ -112,7 +110,127 @@ Index: gdb-6.8.91.20090917/gdb/gstack.sh
+set pagination no
+$backtrace
+EOF
-+sed -n \
-+ -e 's/^(gdb) //' \
++/bin/sed -n \
++ -e 's/^\((gdb) \)*//' \
+ -e '/^#/p' \
+ -e '/^Thread/p'
+--- /dev/null 2010-04-07 06:20:52.289994508 +0200
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.exp 2010-04-07 21:53:57.000000000 +0200
+@@ -0,0 +1,71 @@
++# Copyright (C) 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 .
++
++set testfile gstack
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/$executable
++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} {
++ return -1
++}
++
++set test "spawn inferior"
++set command "${binfile}"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++ return
++}
++set pid [exp_pid -i $res]
++gdb_expect {
++ -re "looping\r\n" {
++ pass $test
++ }
++ eof {
++ fail "$test (eof)"
++ return
++ }
++ timeout {
++ fail "$test (timeout)"
++ return
++ }
++}
++gdb_exit
++
++# Testcase uses the most simple notification not to get caught by attach on
++# exiting the function. Still we could retry the gstack command if we fail.
++
++set test "spawn gstack"
++set command "sh -c GDB=$GDB\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END"
++set res [remote_spawn host $command];
++if { $res < 0 || $res == "" } {
++ perror "Spawning $command failed."
++ fail $test
++}
++set pid [exp_pid -i $res]
++gdb_expect {
++ -re {^#0 +0x[0-9a-f]+ in \.?func \(\)\r\n#1 +0x[0-9a-f]+ in \.?main \(\)\r\nGSTACK-END\r\n$} {
++ pass $test
++ }
++ eof {
++ fail "$test (eof)"
++ }
++ timeout {
++ fail "$test (timeout)"
++ }
++}
++gdb_exit
++
++remote_exec host "kill -9 $pid"
+--- /dev/null 2010-04-07 06:20:52.289994508 +0200
++++ gdb-7.0.1/gdb/testsuite/gdb.base/gstack.c 2010-04-07 21:46:52.000000000 +0200
+@@ -0,0 +1,43 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see . */
++
++#include
++#include
++#include
++
++void
++func (void)
++{
++ const char msg[] = "looping\n";
++
++ /* Use the most simple notification not to get caught by attach on exiting
++ the function. */
++ write (1, msg, strlen (msg));
++
++ for (;;);
++}
++
++int
++main (void)
++{
++ alarm (60);
++ nice (100);
++
++ func ();
++
++ return 0;
++}
diff --git a/gdb-6.3-gstack-without-path-20060414.patch b/gdb-6.3-gstack-without-path-20060414.patch
deleted file mode 100644
index 677f934..0000000
--- a/gdb-6.3-gstack-without-path-20060414.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Index: gdb-6.3/gdb/gstack.sh
-===================================================================
---- gdb-6.3.orig/gdb/gstack.sh 2006-02-14 17:21:05.000000000 -0200
-+++ gdb-6.3/gdb/gstack.sh 2006-04-14 03:17:12.000000000 -0300
-@@ -17,17 +17,17 @@ fi
- backtrace="bt"
- if test -d /proc/$1/task ; then
- # Newer kernel; has a task/ directory.
-- if test `ls /proc/$1/task | wc -l` -gt 1 2>/dev/null ; then
-+ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
- backtrace="thread apply all bt"
- fi
- elif test -f /proc/$1/maps ; then
- # Older kernel; go by it loading libpthread.
-- if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
-+ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
- backtrace="thread apply all bt"
- fi
- fi
-
--GDB=${GDB:-gdb}
-+GDB=${GDB:-/usr/bin/gdb}
-
- if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
- readnever=--readnever
-@@ -39,7 +39,7 @@ fi
- set pagination no
- $backtrace
- EOF
--sed -n \
-+/bin/sed -n \
- -e 's/^(gdb) //' \
- -e '/^#/p' \
- -e '/^Thread/p'
diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch
index bd89dd5..132f3bf 100644
--- a/gdb-6.3-readnever-20050907.patch
+++ b/gdb-6.3-readnever-20050907.patch
@@ -11,11 +11,11 @@
* gdb.texinfo (File Options): Document --readnever.
-Index: gdb-7.0.50.20100121/gdb/doc/gdb.texinfo
+Index: gdb-7.0.90.20100306/gdb/doc/gdb.texinfo
===================================================================
---- gdb-7.0.50.20100121.orig/gdb/doc/gdb.texinfo 2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/doc/gdb.texinfo 2010-01-21 15:13:02.000000000 +0100
-@@ -997,6 +997,12 @@ Read each symbol file's entire symbol ta
+--- gdb-7.0.90.20100306.orig/gdb/doc/gdb.texinfo 2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/doc/gdb.texinfo 2010-03-06 23:20:35.000000000 +0100
+@@ -995,6 +995,12 @@ Read each symbol file's entire symbol ta
the default, which is to read it incrementally as it is needed.
This makes startup slower, but makes future operations faster.
@@ -28,10 +28,10 @@ Index: gdb-7.0.50.20100121/gdb/doc/gdb.texinfo
@end table
@node Mode Options
-Index: gdb-7.0.50.20100121/gdb/main.c
+Index: gdb-7.0.90.20100306/gdb/main.c
===================================================================
---- gdb-7.0.50.20100121.orig/gdb/main.c 2010-01-21 15:11:18.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/main.c 2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/main.c 2010-03-06 23:20:23.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/main.c 2010-03-06 23:20:35.000000000 +0100
@@ -382,6 +382,7 @@ captured_main (void *data)
{"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
@@ -48,10 +48,10 @@ Index: gdb-7.0.50.20100121/gdb/main.c
"), stream);
fputs_unfiltered (_("\
--se=FILE Use FILE as symbol file and executable file.\n\
-Index: gdb-7.0.50.20100121/gdb/symfile.c
+Index: gdb-7.0.90.20100306/gdb/symfile.c
===================================================================
---- gdb-7.0.50.20100121.orig/gdb/symfile.c 2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/symfile.c 2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
@@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup (
/* Global variables owned by this file */
@@ -60,19 +60,19 @@ Index: gdb-7.0.50.20100121/gdb/symfile.c
/* External variables and functions referenced. */
-Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
+Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
===================================================================
---- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c 2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/dwarf2read.c 2010-01-21 15:13:15.000000000 +0100
-@@ -53,6 +53,7 @@
+--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:20:54.000000000 +0100
+@@ -52,6 +52,7 @@
+ #include "f-lang.h"
#include "typeprint.h"
#include "jv-lang.h"
- #include "vec.h"
+#include "top.h"
#include
#include "gdb_string.h"
-@@ -1237,7 +1238,8 @@ dwarf2_has_info (struct objfile *objfile
+@@ -1222,7 +1223,8 @@ dwarf2_has_info (struct objfile *objfile
bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL);
}
@@ -82,10 +82,10 @@ Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
&& dwarf2_per_objfile->abbrev.asection != NULL);
}
-Index: gdb-7.0.50.20100121/gdb/top.h
+Index: gdb-7.0.90.20100306/gdb/top.h
===================================================================
---- gdb-7.0.50.20100121.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/top.h 2010-01-21 15:13:02.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/top.h 2010-01-01 08:31:42.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/top.h 2010-03-06 23:20:35.000000000 +0100
@@ -63,6 +63,7 @@ extern void set_prompt (char *);
/* From random places. */
diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch
index e4227ef..f9d5bb4 100644
--- a/gdb-6.3-test-pie-20050107.patch
+++ b/gdb-6.3-test-pie-20050107.patch
@@ -1,29 +1,29 @@
-Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac
+Index: gdb-7.0.90.20100306/gdb/testsuite/configure.ac
===================================================================
---- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200
-+++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac 2009-09-09 19:06:01.000000000 +0200
+--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure.ac 2010-02-19 20:16:36.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/testsuite/configure.ac 2010-03-06 23:19:56.000000000 +0100
@@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \
gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \
- gdb.fortran/Makefile gdb.server/Makefile \
- gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \
+ gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
+ gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
- gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
+ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
gdb.python/Makefile gdb.reverse/Makefile \
gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
-Index: gdb-6.8.50.20090909/gdb/testsuite/configure
+Index: gdb-7.0.90.20100306/gdb/testsuite/configure
===================================================================
---- gdb-6.8.50.20090909.orig/gdb/testsuite/configure 2009-08-22 18:56:43.000000000 +0200
-+++ gdb-6.8.50.20090909/gdb/testsuite/configure 2009-09-09 19:06:27.000000000 +0200
+--- gdb-7.0.90.20100306.orig/gdb/testsuite/configure 2010-02-19 20:16:36.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/testsuite/configure 2010-03-06 23:20:12.000000000 +0100
@@ -3515,7 +3515,7 @@ done
--ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/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.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/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
-@@ -4231,6 +4231,7 @@ do
+@@ -4232,6 +4232,7 @@ do
"gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/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-6.8.50.20090909/gdb/testsuite/configure
"gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
"gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
"gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;;
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c 2010-03-06 23:19:31.000000000 +0100
@@ -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-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c
+ }
+ return 0;
+}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c 2010-03-06 23:19:31.000000000 +0100
@@ -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-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c
+ }
+ return (0);
+}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,146 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@@ -236,10 +236,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c
+ }
+ return 0;
+}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,44 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@@ -285,10 +285,10 @@ Index: gdb-6.8.50.20090909/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-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,142 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ Free Software Foundation, Inc.
@@ -432,10 +432,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c
+ return 0;
+}
+
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,433 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
@@ -870,10 +870,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
+do_call_attach_tests
+
+return 0
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,977 @@
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2002, 2003, 2004
@@ -1852,10 +1852,10 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp
+ send_gdb "set args main\n"
+ gdb_expect -re ".*$gdb_prompt $" {}
+}
-Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,243 @@
+# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
@@ -2100,10 +2100,10 @@ Index: gdb-6.8.50.20090909/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-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in
+Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in 2009-09-09 19:06:01.000000000 +0200
++++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in 2010-03-06 23:19:31.000000000 +0100
@@ -0,0 +1,19 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
diff --git a/gdb-6.5-bz203661-emit-relocs.patch b/gdb-6.5-bz203661-emit-relocs.patch
index f58cc9e..61e0d56 100644
--- a/gdb-6.5-bz203661-emit-relocs.patch
+++ b/gdb-6.5-bz203661-emit-relocs.patch
@@ -1,11 +1,11 @@
-Index: gdb-6.8.50.20090802/gdb/symfile.c
+Index: gdb-7.0.90.20100306/gdb/symfile.c
===================================================================
---- gdb-6.8.50.20090802.orig/gdb/symfile.c 2009-08-03 12:29:58.000000000 +0200
-+++ gdb-6.8.50.20090802/gdb/symfile.c 2009-08-03 12:40:58.000000000 +0200
-@@ -4012,6 +4012,12 @@ symfile_dummy_outputs (bfd *abfd, asecti
- bfd_byte *
- symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf)
+--- gdb-7.0.90.20100306.orig/gdb/symfile.c 2010-03-06 23:20:35.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/symfile.c 2010-03-06 23:26:25.000000000 +0100
+@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
{
+ bfd *abfd = objfile->obfd;
+
+ /* Executable files have all the relocations already resolved.
+ * Handle files linked with --emit-relocs.
+ * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */
diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch
index ab0c902..bd03985 100644
--- a/gdb-6.5-bz216711-clone-is-outermost.patch
+++ b/gdb-6.5-bz216711-clone-is-outermost.patch
@@ -164,7 +164,7 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
/* Floating-point registers. */
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
-@@ -2122,6 +2122,137 @@ static const struct frame_unwind ia64_frame_unwind =
+@@ -2122,6 +2122,138 @@ static const struct frame_unwind ia64_frame_unwind =
default_frame_sniffer
};
@@ -228,12 +228,13 @@ Index: gdb-6.8.50.20090802/gdb/amd64-tdep.c
+ if (minsym == NULL)
+ return 0;
+
-+ instr = slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], 2);
++ instr = slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], 2);
+ instr &= ~(((1L << 20) - 1) << 13);
+ /* Address is relative to the jump instruction slot, not the next one. */
+ instr |= (((SYMBOL_VALUE_ADDRESS (minsym) - (pc & ~0xfL)) >> 4)
+ & ((1L << 20) - 1)) << 13;
-+ replace_slotN_contents (&buf[LINUX_CLONE_PRE_SLOTS * 16], instr, 2);
++ replace_slotN_contents (&linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16], instr,
++ 2);
+
+ if (memcmp (&buf[LINUX_CLONE_PRE_SLOTS * 16],
+ &linux_clone2_code[LINUX_CLONE_PRE_SLOTS * 16],
diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
deleted file mode 100644
index 4fb26b0..0000000
--- a/gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379
-
-
-Index: gdb-6.8.50.20081128/gdb/minsyms.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/minsyms.c 2008-10-01 18:56:52.000000000 +0200
-+++ gdb-6.8.50.20081128/gdb/minsyms.c 2008-12-02 23:24:27.000000000 +0100
-@@ -544,6 +544,11 @@ lookup_minimal_symbol_by_pc_section_1 (C
- don't fill the bfd_section member, so don't
- throw away symbols on those platforms. */
- && SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
-+ /* Don't ignore symbols for solib trampolines.
-+ Limit its sideeffects - only for non-0 sized trampolines.
-+ Red Hat Bug 200533 with its regression Bug 218379. */
-+ && (MSYMBOL_TYPE (&msymbol[hi]) != mst_solib_trampoline
-+ || MSYMBOL_SIZE (&msymbol[hi]))
- && (!matching_obj_sections
- (SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
- {
diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch
index f2fd4fe..7809940 100644
--- a/gdb-6.6-buildid-locate-core-as-arg.patch
+++ b/gdb-6.6-buildid-locate-core-as-arg.patch
@@ -58,10 +58,8 @@ 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.0.50.20100128/gdb/exceptions.h
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/exceptions.h 2010-01-18 07:25:22.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/exceptions.h 2010-01-28 22:49:00.000000000 +0100
+--- ./gdb/exceptions.h 2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/exceptions.h 2010-04-11 22:31:47.000000000 +0200
@@ -78,6 +78,9 @@ enum errors {
/* Feature is not supported in this copy of GDB. */
UNSUPPORTED_ERROR,
@@ -72,40 +70,49 @@ Index: gdb-7.0.50.20100128/gdb/exceptions.h
/* Add more errors here. */
NR_ERRORS
};
-Index: gdb-7.0.50.20100128/gdb/exec.c
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/exec.c 2010-01-28 22:48:59.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/exec.c 2010-01-28 22:58:45.000000000 +0100
+--- ./gdb/exec.c 2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/exec.c 2010-04-11 22:41:26.000000000 +0200
@@ -34,6 +34,7 @@
+ #include "arch-utils.h"
#include "gdbthread.h"
#include "progspace.h"
- #include "solib.h"
+#include "exceptions.h"
#include
#include "readline/readline.h"
-@@ -258,6 +259,17 @@ exec_file_attach (char *filename, int fr
- /* Make sure to close exec_bfd, or else "run" might try to use
- it. */
- exec_close ();
+@@ -256,12 +257,27 @@ exec_file_attach (char *filename, int fr
+
+ if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
+ {
++ int is_core;
+
+ /* If the user accidentally did "gdb core", print a useful
+ error message. Check it only after bfd_object has been checked as
+ a valid executable may get recognized for example also as
+ "trad-core". */
-+ if (bfd_check_format (exec_bfd, bfd_core))
-+ throw_error (IS_CORE_ERROR,
-+ _("\"%s\" is a core file.\n"
-+ "Please specify an executable to debug."),
-+ scratch_pathname);
++ is_core = bfd_check_format (exec_bfd, bfd_core);
+
- error (_("\"%s\": not in executable format: %s"),
- scratch_pathname, bfd_errmsg (bfd_get_error ()));
+ /* Make sure to close exec_bfd, or else "run" might try to use
+ it. */
+ exec_close ();
+- error (_("\"%s\": not in executable format: %s"),
+- scratch_pathname,
+- gdb_bfd_errmsg (bfd_get_error (), matching));
++
++ if (is_core != 0)
++ throw_error (IS_CORE_ERROR,
++ _("\"%s\" is a core file.\n"
++ "Please specify an executable to debug."),
++ scratch_pathname);
++ else
++ error (_("\"%s\": not in executable format: %s"),
++ scratch_pathname,
++ gdb_bfd_errmsg (bfd_get_error (), matching));
}
-Index: gdb-7.0.50.20100128/gdb/main.c
-===================================================================
---- gdb-7.0.50.20100128.orig/gdb/main.c 2010-01-28 22:48:59.000000000 +0100
-+++ gdb-7.0.50.20100128/gdb/main.c 2010-01-28 22:49:00.000000000 +0100
+
+ /* FIXME - This should only be run for RS6000, but the ifdef is a poor
+--- ./gdb/main.c 2010-04-11 22:31:30.000000000 +0200
++++ ./gdb/main.c 2010-04-11 22:31:47.000000000 +0200
@@ -241,6 +241,36 @@ captured_command_loop (void *data)
return 1;
}
diff --git a/gdb-6.7-testsuite-stable-results-prelink.patch b/gdb-6.7-testsuite-stable-results-prelink.patch
new file mode 100644
index 0000000..3c51577
--- /dev/null
+++ b/gdb-6.7-testsuite-stable-results-prelink.patch
@@ -0,0 +1,68 @@
+http://sourceware.org/ml/gdb-patches/2010-03/msg01006.html
+Subject: [patch or FYI] testsuite: Fix prelink.exp on system w/unprelinked system libs
+
+Hi,
+
+this is a more conservative variant superseded by:
+ [patch 4/6] testsuite: Unify to lib/prelink-support.exp
+ http://sourceware.org/ml/gdb-patches/2010-03/msg01002.html
+where gdb.base/prelink.exp is reworked on generic lib/prelink-support.exp.
+
+I prefer the [patch 4/6] over this patch but this mail can serve also as an
+illustration of the current problem.
+
+------------------------------------------------------------------------------
+
+If your system for some reason currently does not have all the libraries
+prelinked gdb.base/prelink.exp will get UNRESOLVED randomly also affecting
+testsuite results diff.
+
+Apparently the testcase already tried to avoid any system libraries
+dependencies by "-nodefaultlibs". But currently it does has not worked that
+way.
+
+"-lm" is contained already even in dejagnu's default_target_compile (not just
+in gdb/testsuite/lib/ada.exp). But I do not know why it is there and which
+systems would get broken by some global gdb/testsuite/ "-lm" removal.
+
+
+Thanks,
+Jan
+
+
+2010-03-29 Jan Kratochvil
+
+ Fix testcase false UNRESOLVED if system libraries are not prelinked.
+ * gdb.base/prelink.exp: New variables compile, board, err and mathlib.
+ Set clear board mathlib for ${libfile} compilation.
+
+--- a/gdb/testsuite/gdb.base/prelink.exp
++++ b/gdb/testsuite/gdb.base/prelink.exp
+@@ -42,7 +42,25 @@ set testfile "prelink"
+
+ set libsrcfile ${testfile}-lib.c
+ set libfile ${objdir}/${subdir}/${testfile}.so
+-if { [gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]] != ""} {
++
++# default_target_compile would otherwise add "-lm" making the testcase
++# dependent on whether the system libraries are already prelinked.
++# prelink: Could not set /lib64/libm-2.11.1.so owner or mode: Operation not permitted
++set compile {
++ gdb_compile "${srcdir}/${subdir}/${libsrcfile}" "${libfile}" executable [list debug "additional_flags=-fpic -shared -nodefaultlibs"]
++}
++set board [target_info name]
++if [board_info $board exists mathlib] {
++ set mathlib [board_info $dest mathlib]
++ set_board_info mathlib ""
++ set err [eval $compile]
++ set_board_info mathlib $mathlib
++} else {
++ set_board_info mathlib ""
++ set err [eval $compile]
++ unset_board_info mathlib
++}
++if {$err != ""} {
+ # If creating the shared library fails, maybe we don't have the right tools
+ return -1
+ }
+
diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch
index e0e68b8..249aa81 100644
--- a/gdb-6.8-bz254229-gcore-prpsinfo.patch
+++ b/gdb-6.8-bz254229-gcore-prpsinfo.patch
@@ -1,8 +1,8 @@
-Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
+Index: gdb-7.1/bfd/elf-bfd.h
===================================================================
---- gdb-7.0.50.20100203.orig/bfd/elf-bfd.h 2010-02-02 13:37:39.000000000 +0100
-+++ gdb-7.0.50.20100203/bfd/elf-bfd.h 2010-02-03 07:28:20.000000000 +0100
-@@ -2140,7 +2140,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
+--- gdb-7.1.orig/bfd/elf-bfd.h 2010-02-09 13:14:42.000000000 +0100
++++ gdb-7.1/bfd/elf-bfd.h 2010-05-16 20:22:38.000000000 +0200
+@@ -2160,7 +2160,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find
extern char *elfcore_write_note
(bfd *, char *, int *, const char *, int, const void *, int);
extern char *elfcore_write_prpsinfo
@@ -11,11 +11,11 @@ Index: gdb-7.0.50.20100203/bfd/elf-bfd.h
extern char *elfcore_write_prstatus
(bfd *, char *, int *, long, int, const void *);
extern char * elfcore_write_pstatus
-Index: gdb-7.0.50.20100203/bfd/elf.c
+Index: gdb-7.1/bfd/elf.c
===================================================================
---- gdb-7.0.50.20100203.orig/bfd/elf.c 2010-02-02 13:37:39.000000000 +0100
-+++ gdb-7.0.50.20100203/bfd/elf.c 2010-02-03 07:28:20.000000000 +0100
-@@ -8459,6 +8459,7 @@ char *
+--- gdb-7.1.orig/bfd/elf.c 2010-02-18 01:09:06.000000000 +0100
++++ gdb-7.1/bfd/elf.c 2010-05-16 20:25:15.000000000 +0200
+@@ -8545,6 +8545,7 @@ char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
int *bufsiz,
@@ -23,7 +23,7 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
const char *fname,
const char *psargs)
{
-@@ -8485,9 +8486,15 @@ elfcore_write_prpsinfo (bfd *abfd,
+@@ -8571,26 +8572,40 @@ elfcore_write_prpsinfo (bfd *abfd,
int note_type = NT_PRPSINFO;
#endif
@@ -42,7 +42,16 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
-@@ -8502,9 +8509,15 @@ elfcore_write_prpsinfo (bfd *abfd,
+ else
+ #endif
+ {
++/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
+ #if defined (HAVE_PSINFO_T)
+ psinfo_t data;
++/* gdb-6.8-bz254229-gcore-prpsinfo.patch misapplication glue. */
+ int note_type = NT_PSINFO;
+ #else
+ prpsinfo_t data;
int note_type = NT_PRPSINFO;
#endif
@@ -61,10 +70,10 @@ Index: gdb-7.0.50.20100203/bfd/elf.c
return elfcore_write_note (abfd, buf, bufsiz,
note_name, note_type, &data, sizeof (data));
}
-Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
+Index: gdb-7.1/gdb/amd64-linux-nat.c
===================================================================
---- gdb-7.0.50.20100203.orig/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/amd64-linux-nat.c 2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
++++ gdb-7.1/gdb/amd64-linux-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off
static char *
@@ -98,10 +107,10 @@ Index: gdb-7.0.50.20100203/gdb/amd64-linux-nat.c
}
static void
-Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
+Index: gdb-7.1/gdb/fbsd-nat.c
===================================================================
---- gdb-7.0.50.20100203.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/fbsd-nat.c 2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/fbsd-nat.c 2010-01-01 08:31:31.000000000 +0100
++++ gdb-7.1/gdb/fbsd-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int
psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL);
@@ -110,10 +119,10 @@ Index: gdb-7.0.50.20100203/gdb/fbsd-nat.c
fname, psargs);
}
-Index: gdb-7.0.50.20100203/gdb/linux-nat.c
+Index: gdb-7.1/gdb/linux-nat.c
===================================================================
---- gdb-7.0.50.20100203.orig/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/linux-nat.c 2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
++++ gdb-7.1/gdb/linux-nat.c 2010-05-16 20:22:38.000000000 +0200
@@ -56,6 +56,7 @@
#include "terminal.h"
#include
@@ -131,7 +140,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus;
static char *
-@@ -4422,6 +4423,159 @@ linux_spu_make_corefile_notes (bfd *obfd
+@@ -4507,6 +4508,159 @@ linux_spu_make_corefile_notes (bfd *obfd
return args.note_data;
}
@@ -291,7 +300,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
/* Fills the "to_make_corefile_note" target vector. Builds the note
section for a corefile, and returns it in a malloc buffer. */
-@@ -4442,8 +4596,14 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -4527,8 +4681,14 @@ linux_nat_make_corefile_notes (bfd *obfd
if (get_exec_file (0))
{
@@ -306,7 +315,7 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
if (get_inferior_args ())
{
char *string_end;
-@@ -4459,9 +4619,15 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -4544,9 +4704,15 @@ linux_nat_make_corefile_notes (bfd *obfd
psargs_end - string_end);
}
}
@@ -324,10 +333,10 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.c
}
/* Dump information for threads. */
-Index: gdb-7.0.50.20100203/gdb/linux-nat.h
+Index: gdb-7.1/gdb/linux-nat.h
===================================================================
---- gdb-7.0.50.20100203.orig/gdb/linux-nat.h 2010-02-03 07:28:19.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/linux-nat.h 2010-02-03 07:28:20.000000000 +0100
+--- gdb-7.1.orig/gdb/linux-nat.h 2010-05-16 20:22:37.000000000 +0200
++++ gdb-7.1/gdb/linux-nat.h 2010-05-16 20:22:38.000000000 +0200
@@ -173,7 +173,7 @@ int linux_nat_core_of_thread_1 (ptid_t p
/* These functions make elfcore note sections.
They may get overriden by code adjusting data for multi-target builds. */
@@ -337,11 +346,11 @@ Index: gdb-7.0.50.20100203/gdb/linux-nat.h
extern char *(*linux_elfcore_write_prstatus)
(bfd *, char *, int *, long, int, const void *);
extern char *(*linux_elfcore_write_prfpreg)
-Index: gdb-7.0.50.20100203/gdb/procfs.c
+Index: gdb-7.1/gdb/procfs.c
===================================================================
---- gdb-7.0.50.20100203.orig/gdb/procfs.c 2010-01-28 09:19:29.000000000 +0100
-+++ gdb-7.0.50.20100203/gdb/procfs.c 2010-02-03 07:28:20.000000000 +0100
-@@ -6186,6 +6186,7 @@ procfs_make_note_section (bfd *obfd, int
+--- gdb-7.1.orig/gdb/procfs.c 2010-02-15 18:35:49.000000000 +0100
++++ gdb-7.1/gdb/procfs.c 2010-05-16 20:22:38.000000000 +0200
+@@ -6184,6 +6184,7 @@ procfs_make_note_section (bfd *obfd, int
note_data = (char *) elfcore_write_prpsinfo (obfd,
note_data,
note_size,
diff --git a/gdb-6.8-inlining-addon.patch b/gdb-6.8-inlining-addon.patch
deleted file mode 100644
index 7b84ef9..0000000
--- a/gdb-6.8-inlining-addon.patch
+++ /dev/null
@@ -1,571 +0,0 @@
-infcall.c :
-Revert the change of: gdb-6.8-inlining.patch
-causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound
-
-resume() -> target_resume() move of clear_inline_frame_state() is for:
-gdb.mi/mi-nsmoribund.exp
-
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-bt.c 2010-01-21 15:14:47.000000000 +0100
-@@ -13,10 +13,16 @@
- You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
-
--int x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+ gets optimized by CSE to just simple assignments of the results. */
-+volatile int x, y;
- volatile int result;
-
--void bar(void);
-+inline void bar(void)
-+{
-+ x += y; /* set breakpoint 1 here */
-+}
-+
-
- inline int func1(void)
- {
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.c 2010-01-21 15:14:47.000000000 +0100
-@@ -13,13 +13,19 @@
- You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
-
--int x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+ gets optimized by CSE to just simple assignments of the results. */
-+volatile int x, y;
- volatile int result;
-
--void bar(void);
- void marker(void);
- void noinline(void);
-
-+inline void bar(void)
-+{
-+ x += y; /* set breakpoint 1 here */
-+}
-+
- inline int func1(void)
- {
- bar ();
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-cmds.exp 2010-01-21 15:14:47.000000000 +0100
-@@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea
- gdb_breakpoint $line3
- gdb_continue_to_breakpoint "consecutive func1"
-
--gdb_test "next" ".*func1 .*first call.*" "next to first func1"
-+gdb_test "next" "func1 .*first call.*" "next to first func1"
- set msg "next to second func1"
- gdb_test_multiple "next" $msg {
- -re ".*func1 .*second call.*$gdb_prompt $" {
-@@ -253,16 +253,16 @@ set line4 [gdb_get_line_number "set brea
- gdb_breakpoint $line4
- gdb_continue_to_breakpoint "func1 then func3"
-
--gdb_test "next" ".*func1 \\\(\\\);" "next to func1 before func3"
--gdb_test "next" ".*func3 \\\(\\\);" "next to func3"
-+gdb_test "next" "func1 \\\(\\\);" "next to func1 before func3"
-+gdb_test "next" "func3 \\\(\\\);" "next to func3"
-
- # Test finishing out of one thing and into another.
- set line5 [gdb_get_line_number "set breakpoint 5 here"]
- gdb_breakpoint $line5
- gdb_continue_to_breakpoint "finish into func1"
-
--gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
--gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
-+gdb_test "next" "marker \\\(\\\);" "next to finish marker"
-+gdb_test "step" "set breakpoint 2 here.*" "step into finish marker"
- gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
-
- gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
-@@ -297,12 +297,12 @@ gdb_test "step" "noinline \\\(\\\) at .*
- gdb_test "bt" "#0 noinline.*#1 .*outer_inline1.*#2 .*outer_inline2.*#3 main.*" "backtrace at noinline from outer_inline1"
- gdb_test "step" "inlined_fn \\\(\\\) at .*" "enter inlined_fn from noinline"
- gdb_test "bt" "#0 inlined_fn.*#1 noinline.*#2 .*outer_inline1.*#3 .*outer_inline2.*#4 main.*" "backtrace at inlined_fn from noinline"
--gdb_test "info frame" ".*inlined into frame.*" "inlined_fn from noinline inlined"
--gdb_test "up" "#1 noinline.*" "up to noinline"
--gdb_test "info frame" ".*\n called by frame.*" "noinline from outer_inline1 not inlined"
--gdb_test "up" "#2 .*outer_inline1.*" "up to outer_inline1"
--gdb_test "info frame" ".*inlined into frame.*" "outer_inline1 inlined"
--gdb_test "up" "#3 .*outer_inline2.*" "up to outer_inline2"
--gdb_test "info frame" ".*inlined into frame.*" "outer_inline2 inlined"
--gdb_test "up" "#4 main.*" "up from outer_inline2"
--gdb_test "info frame" ".*\n caller of frame.*" "main not inlined"
-+gdb_test "info frame" "inlined into frame.*" "inlined_fn from noinline inlined"
-+gdb_test "fini" "" "up to noinline"
-+gdb_test "info frame" "\n called by frame.*" "noinline from outer_inline1 not inlined"
-+gdb_test "fini" "" "up to outer_inline1"
-+gdb_test "info frame" "inlined into frame.*" "outer_inline1 inlined"
-+gdb_test "fini" "" "up to outer_inline2"
-+gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined"
-+gdb_test "fini" "" "up from outer_inline2"
-+gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined"
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.c 2010-01-21 15:14:47.000000000 +0100
-@@ -13,11 +13,16 @@
- You should have received a copy of the GNU General Public License
- along with this program. If not, see . */
-
--int x, y;
-+/* VOLATILE forces all the inlining to happen as otherwise the whole program
-+ gets optimized by CSE to just simple assignments of the results. */
-+volatile int x, y;
- volatile int result;
- volatile int *array_p;
-
--void bar(void);
-+inline void bar(void)
-+{
-+ x += y; /* set breakpoint 1 here */
-+}
-
- inline int func1(int arg1)
- {
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-locals.exp 2010-01-21 15:14:47.000000000 +0100
-@@ -77,6 +77,9 @@ if { ! $no_frames } {
-
- # Make sure that locals on the stack are found. This is an array to
- # prevent it from living in a register.
-+if [test_compiler_info "gcc-4-3-*"] {
-+ setup_kfail *-*-* "gcc/debug.optimization"
-+}
- gdb_test "print array\[0\]" "\\\$$decimal = 0" "print local (2)"
-
- if { ! $no_frames } {
-@@ -115,4 +118,7 @@ if { ! $no_frames } {
- gdb_test "info locals" ".*arg2 = 184.*" "info locals above bar (3b)"
- }
-
-+if [test_compiler_info "gcc-4-3-*"] {
-+ setup_kfail *-*-* "gcc/debug.optimization"
-+}
- gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)"
-Index: gdb-7.0.50.20100121/gdb/frame.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/frame.c 2010-01-21 15:13:26.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/frame.c 2010-01-21 15:14:47.000000000 +0100
-@@ -316,7 +316,7 @@ fprint_frame (struct ui_file *file, stru
- static struct frame_info *
- skip_inlined_frames (struct frame_info *frame)
- {
-- while (get_frame_type (frame) == INLINE_FRAME)
-+ while (frame && get_frame_type (frame) == INLINE_FRAME)
- frame = get_prev_frame (frame);
-
- return frame;
-@@ -1792,6 +1792,7 @@ get_frame_address_in_block (struct frame
- {
- /* A draft address. */
- CORE_ADDR pc = get_frame_pc (this_frame);
-+ struct thread_info *tp = inferior_thread ();
-
- struct frame_info *next_frame = this_frame->next;
-
-@@ -1834,6 +1835,9 @@ get_frame_address_in_block (struct frame
- while in an inlined function, then the code address of the
- "calling" normal function should not be adjusted either. */
-
-+ if (tp->current_pc_is_notcurrent)
-+ return pc - 1;
-+
- while (get_frame_type (next_frame) == INLINE_FRAME)
- next_frame = next_frame->next;
-
-@@ -1865,7 +1869,7 @@ find_frame_sal (struct frame_info *frame
- sym = inline_skipped_symbol (inferior_ptid);
-
- init_sal (sal);
-- if (SYMBOL_LINE (sym) != 0)
-+ if (sym != NULL && SYMBOL_LINE (sym) != 0)
- {
- sal->symtab = SYMBOL_SYMTAB (sym);
- sal->line = SYMBOL_LINE (sym);
-Index: gdb-7.0.50.20100121/gdb/breakpoint.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/breakpoint.c 2010-01-21 15:14:41.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/breakpoint.c 2010-01-21 15:14:47.000000000 +0100
-@@ -62,6 +62,7 @@
- #include "jit.h"
- #include "xml-syscall.h"
- #include "parser-defs.h"
-+#include "inline-frame.h"
-
- /* readline include files */
- #include "readline/readline.h"
-@@ -3558,10 +3559,24 @@ bpstat_check_breakpoint_conditions (bpst
- const struct bp_location *bl = bs->breakpoint_at;
- struct breakpoint *b = bl->owner;
-
-- if (frame_id_p (b->frame_id)
-- && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
-- bs->stop = 0;
-- else if (bs->stop)
-+ if (frame_id_p (b->frame_id))
-+ {
-+ struct frame_info *b_frame, *frame;
-+ struct frame_id b_frame_id, current_frame_id;
-+
-+ b_frame = frame_find_by_id (b->frame_id);
-+
-+ /* get_stack_frame_id normalizes the id to the real non-inlined function
-+ by skip_inlined_frames. */
-+ b_frame_id = get_stack_frame_id (b_frame);
-+ current_frame_id = get_stack_frame_id (get_current_frame ());
-+
-+ /* Completely different (inlining notwithstanding) frames? */
-+ if (!frame_id_eq (b_frame_id, current_frame_id))
-+ bs->stop = 0;
-+ }
-+
-+ if (bs->stop)
- {
- int value_is_zero = 0;
-
-@@ -3729,6 +3744,12 @@ bpstat_stop_status (struct address_space
- bs->print = 0;
- }
- bs->commands = copy_command_lines (bs->commands);
-+
-+ /* Display the innermost inlined frame at a breakpont as it gives to
-+ most of the available information. */
-+ if (b->type != bp_until && b->type != bp_finish)
-+ while (inline_skipped_frames (ptid))
-+ step_into_inline_frame (ptid);
- }
-
- /* Print nothing for this entry if we dont stop or dont print. */
-@@ -6043,9 +6064,9 @@ set_momentary_breakpoint (struct gdbarch
- {
- struct breakpoint *b;
-
-- /* If FRAME_ID is valid, it should be a real frame, not an inlined
-- one. */
-- gdb_assert (!frame_id_inlined_p (frame_id));
-+ /* We can be returning even into an inline frame. While finish_command will
-+ shortcut the case of returning _from_ an inline frame we still may be
-+ returning from non-inlined frame _to_ an inlined frame. */
-
- b = set_raw_breakpoint (gdbarch, sal, type);
- b->enable_state = bp_enabled;
-Index: gdb-7.0.50.20100121/gdb/inline-frame.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/inline-frame.c 2010-01-01 08:31:36.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/inline-frame.c 2010-01-21 15:14:47.000000000 +0100
-@@ -213,6 +213,12 @@ inline_frame_sniffer (const struct frame
- if (frame_block == NULL)
- return 0;
-
-+ /* For >=2 inlined functions SKIPPED_SYMBOL needs to be different after each
-+ step_into_inline_frame call. But skip_inline_frames is called only once
-+ and thus SKIPPED_SYMBOL needs to be calculated by INLINE_FRAME_SNIFFER. */
-+ if (state)
-+ state->skipped_symbol = NULL;
-+
- /* Calculate DEPTH, the number of inlined functions at this
- location. */
- depth = 0;
-@@ -222,6 +228,10 @@ inline_frame_sniffer (const struct frame
- if (block_inlined_p (cur_block))
- depth++;
-
-+ if (state && depth == state->skipped_frames
-+ && state->skipped_symbol == NULL)
-+ state->skipped_symbol = BLOCK_FUNCTION (cur_block);
-+
- cur_block = BLOCK_SUPERBLOCK (cur_block);
- }
-
-@@ -300,7 +310,6 @@ skip_inline_frames (ptid_t ptid)
- {
- CORE_ADDR this_pc;
- struct block *frame_block, *cur_block;
-- struct symbol *last_sym = NULL;
- int skip_count = 0;
- struct inline_state *state;
-
-@@ -321,10 +330,7 @@ skip_inline_frames (ptid_t ptid)
- of BLOCK_START. */
- if (BLOCK_START (cur_block) == this_pc
- || block_starting_point_at (this_pc, cur_block))
-- {
-- skip_count++;
-- last_sym = BLOCK_FUNCTION (cur_block);
-- }
-+ skip_count++;
- else
- break;
- }
-@@ -336,7 +342,6 @@ skip_inline_frames (ptid_t ptid)
- state = allocate_inline_frame_state (ptid);
- state->skipped_frames = skip_count;
- state->saved_pc = this_pc;
-- state->skipped_symbol = last_sym;
-
- if (skip_count != 0)
- reinit_frame_cache ();
-@@ -354,6 +359,23 @@ step_into_inline_frame (ptid_t ptid)
- reinit_frame_cache ();
- }
-
-+/* Step out of an inlined function by hiding it. */
-+
-+void
-+step_out_of_inline_frame (ptid_t ptid)
-+{
-+ struct inline_state *state = find_inline_frame_state (ptid);
-+
-+ gdb_assert (state != NULL);
-+
-+ /* Simulate the caller adjustment. */
-+ if (state->skipped_frames == 0)
-+ state->saved_pc--;
-+
-+ state->skipped_frames++;
-+ reinit_frame_cache ();
-+}
-+
- /* Return the number of hidden functions inlined into the current
- frame. */
-
-Index: gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-01 08:32:04.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/testsuite/gdb.opt/inline-markers.c 2010-01-21 15:14:47.000000000 +0100
-@@ -15,11 +15,6 @@
-
- extern int x, y;
-
--void bar(void)
--{
-- x += y; /* set breakpoint 1 here */
--}
--
- void marker(void)
- {
- x += y; /* set breakpoint 2 here */
-Index: gdb-7.0.50.20100121/gdb/gdbthread.h
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/gdbthread.h 2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/gdbthread.h 2010-01-21 15:14:47.000000000 +0100
-@@ -195,6 +195,12 @@ struct thread_info
- /* Function that is called to free PRIVATE. If this is NULL, then
- xfree will be called on PRIVATE. */
- void (*private_dtor) (struct private_thread_info *);
-+
-+ /* Nonzero if the current frame PC should be unwound as the caller. It is
-+ used to keep the backtrace upper levels existing after finish_command into
-+ an inlined frame if the current inlined function/block was ending at the
-+ current PC. */
-+ int current_pc_is_notcurrent;
- };
-
- /* Create an empty thread list, or empty the existing one. */
-Index: gdb-7.0.50.20100121/gdb/infcmd.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/infcmd.c 2010-01-21 15:11:09.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/infcmd.c 2010-01-21 15:14:47.000000000 +0100
-@@ -1439,11 +1439,11 @@ finish_command_continuation (void *arg)
- struct type *value_type;
-
- value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function));
-- if (!value_type)
-+ if (!SYMBOL_INLINED (a->function) && !value_type)
- internal_error (__FILE__, __LINE__,
- _("finish_command: function has no target type"));
-
-- if (TYPE_CODE (value_type) != TYPE_CODE_VOID)
-+ if (value_type && TYPE_CODE (value_type) != TYPE_CODE_VOID)
- print_return_value (SYMBOL_TYPE (a->function), value_type);
- }
-
-@@ -1551,6 +1551,16 @@ finish_forward (struct symbol *function,
- tp->initiating_frame = get_frame_id (frame);
- make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
-
-+ /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the
-+ calling line with the message `Value returned is ...'. Currently it is
-+ seen only if at least one instruction is on that source line after the
-+ call instruction. We would also need to hook step_once and only clear
-+ CURRENT_PC_IS_NOTCURRENT on the first step. But it would be a change of
-+ general non-inlining behavior against upstream. */
-+
-+ if (get_frame_type (frame) == INLINE_FRAME)
-+ tp->current_pc_is_notcurrent = 1;
-+
- tp->proceed_to_finish = 1; /* We want stop_registers, please... */
- cargs = xmalloc (sizeof (*cargs));
-
-@@ -1571,7 +1581,9 @@ finish_forward (struct symbol *function,
- static void
- finish_command (char *arg, int from_tty)
- {
-- struct frame_info *frame;
-+ /* FIXME: Rename `current_frame' to `frame' upon a merge. */
-+ struct frame_info *current_frame, *prev_frame;
-+ CORE_ADDR frame_pc;
- struct symbol *function;
-
- int async_exec = 0;
-@@ -1602,45 +1614,63 @@ finish_command (char *arg, int from_tty)
- if (!target_has_execution)
- error (_("The program is not running."));
-
-- frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
-- if (frame == 0)
-+ current_frame = get_selected_frame (_("No selected frame."));
-+ frame_pc = get_frame_pc (current_frame);
-+ prev_frame = get_prev_frame (current_frame);
-+ if (prev_frame == 0)
- error (_("\"finish\" not meaningful in the outermost frame."));
-
-- clear_proceed_status ();
--
- /* Finishing from an inline frame is completely different. We don't
- try to show the "return value" - no way to locate it. So we do
- not need a completion. */
-- if (get_frame_type (get_selected_frame (_("No selected frame.")))
-- == INLINE_FRAME)
-+ if (get_frame_type (current_frame) == INLINE_FRAME)
- {
-- /* Claim we are stepping in the calling frame. An empty step
-- range means that we will stop once we aren't in a function
-- called by that frame. We don't use the magic "1" value for
-- step_range_end, because then infrun will think this is nexti,
-- and not step over the rest of this inlined function call. */
- struct thread_info *tp = inferior_thread ();
- struct symtab_and_line empty_sal;
-- init_sal (&empty_sal);
-- set_step_info (frame, empty_sal);
-- tp->step_range_start = tp->step_range_end = get_frame_pc (frame);
-- tp->step_over_calls = STEP_OVER_ALL;
-+ struct block *frame_block;
-
- /* Print info on the selected frame, including level number but not
- source. */
- if (from_tty)
- {
- printf_filtered (_("Run till exit from "));
-- print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
-+ print_stack_frame (current_frame, 1, LOCATION);
-+ }
-+
-+ /* Even just a single stepi would get us out of the caller function PC
-+ range. */
-+
-+ frame_block = get_frame_block (current_frame, NULL);
-+
-+ /* FRAME_BLOCK must be initialized and also the frame printing above must
-+ be done still with the original CURRENT_PC_IS_NOTCURRENT setting. */
-+ clear_proceed_status ();
-+
-+ if (frame_block && BLOCK_END (frame_block) == frame_pc)
-+ {
-+ step_out_of_inline_frame (tp->ptid);
-+ tp->current_pc_is_notcurrent = 1;
-+ normal_stop ();
-+ return;
- }
-
-+ /* Claim we are stepping in the calling frame. An empty step
-+ range means that we will stop once we aren't in a function
-+ called by that frame. We don't use the magic "1" value for
-+ step_range_end, because then infrun will think this is nexti,
-+ and not step over the rest of this inlined function call. */
-+ init_sal (&empty_sal);
-+ set_step_info (prev_frame, empty_sal);
-+ tp->step_range_start = tp->step_range_end = get_frame_pc (prev_frame);
-+ tp->step_over_calls = STEP_OVER_ALL;
-+
- proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
- return;
- }
-
- /* Find the function we will return from. */
-
-- function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
-+ function = find_pc_function (frame_pc);
-
- /* Print info on the selected frame, including level number but not
- source. */
-@@ -1654,10 +1684,14 @@ finish_command (char *arg, int from_tty)
- print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
- }
-
-+ /* Frames printing above must be done still with the original
-+ CURRENT_PC_IS_NOTCURRENT setting. */
-+ clear_proceed_status ();
-+
- if (execution_direction == EXEC_REVERSE)
- finish_backward (function);
- else
-- finish_forward (function, frame);
-+ finish_forward (function, prev_frame);
- }
-
-
-Index: gdb-7.0.50.20100121/gdb/target.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/target.c 2010-01-21 15:13:26.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/target.c 2010-01-21 15:14:47.000000000 +0100
-@@ -2216,6 +2216,7 @@ target_resume (ptid_t ptid, int step, en
- {
- struct target_ops *t;
-
-+ clear_inline_frame_state (ptid);
- target_dcache_invalidate ();
-
- for (t = current_target.beneath; t != NULL; t = t->beneath)
-Index: gdb-7.0.50.20100121/gdb/inline-frame.h
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/inline-frame.h 2010-01-01 08:31:36.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/inline-frame.h 2010-01-21 15:14:47.000000000 +0100
-@@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt
-
- void step_into_inline_frame (ptid_t ptid);
-
-+/* Step out of an inlined function by hiding it. */
-+
-+void step_out_of_inline_frame (ptid_t ptid);
-+
- /* Return the number of hidden functions inlined into the current
- frame. */
-
-Index: gdb-7.0.50.20100121/gdb/dwarf2read.c
-===================================================================
---- gdb-7.0.50.20100121.orig/gdb/dwarf2read.c 2010-01-21 15:14:41.000000000 +0100
-+++ gdb-7.0.50.20100121/gdb/dwarf2read.c 2010-01-21 15:15:09.000000000 +0100
-@@ -4137,6 +4137,7 @@ read_func_scope (struct die_info *die, s
- struct block *block;
- unsigned die_children = 0;
- int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
-+ struct type *type;
-
- if (inlined_func)
- {
-@@ -4178,7 +4179,10 @@ read_func_scope (struct die_info *die, s
- add_to_cu_func_list (name, lowpc, highpc, cu);
-
- new = push_context (0, lowpc);
-- new->name = new_symbol (die, read_type_die (die, cu), cu);
-+ type = read_type_die (die, cu);
-+ gdb_assert (type != NULL);
-+ new->name = new_symbol (die, type, cu);
-+ gdb_assert (TYPE_CODE (SYMBOL_TYPE (new->name)) == TYPE_CODE_FUNC);
-
- /* If there is a location expression for DW_AT_frame_base, record
- it. */
diff --git a/gdb-6.8-inlining-by-name.patch b/gdb-6.8-inlining-by-name.patch
deleted file mode 100644
index 6096247..0000000
--- a/gdb-6.8-inlining-by-name.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-Implement `b ' for with concete inlined instances by
-a multiple-PC breakpoint.
-
-Index: gdb-6.8.50.20081128/gdb/ada-lang.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/ada-lang.c 2008-11-25 00:21:15.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/ada-lang.c 2008-12-06 21:39:56.000000000 +0100
-@@ -4614,7 +4614,7 @@ remove_irrelevant_renamings (struct ada_
- if (current_block == NULL)
- return nsyms;
-
-- current_function = block_linkage_function (current_block);
-+ current_function = block_function (current_block);
- if (current_function == NULL)
- return nsyms;
-
-@@ -6625,7 +6625,7 @@ ada_find_renaming_symbol (const char *na
- static struct symbol *
- find_old_style_renaming_symbol (const char *name, struct block *block)
- {
-- const struct symbol *function_sym = block_linkage_function (block);
-+ const struct symbol *function_sym = block_function (block);
- char *rename;
-
- if (function_sym != NULL)
-Index: gdb-6.8.50.20081128/gdb/block.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/block.c 2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/block.c 2008-12-06 21:40:29.000000000 +0100
-@@ -75,6 +75,19 @@ block_linkage_function (const struct blo
- return BLOCK_FUNCTION (bl);
- }
-
-+/* Return the symbol for the function which contains a specified
-+ lexical block, described by a struct block BL. Inlined functions
-+ can be returned. */
-+
-+struct symbol *
-+block_function (const struct block *bl)
-+{
-+ while (BLOCK_FUNCTION (bl) == NULL && BLOCK_SUPERBLOCK (bl) != NULL)
-+ bl = BLOCK_SUPERBLOCK (bl);
-+
-+ return BLOCK_FUNCTION (bl);
-+}
-+
- /* Return one if BL represents an inlined function. */
-
- int
-Index: gdb-6.8.50.20081128/gdb/block.h
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/block.h 2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/block.h 2008-12-06 21:39:56.000000000 +0100
-@@ -133,6 +133,7 @@ struct blockvector
- enum { GLOBAL_BLOCK = 0, STATIC_BLOCK = 1, FIRST_LOCAL_BLOCK = 2 };
-
- extern struct symbol *block_linkage_function (const struct block *);
-+extern struct symbol *block_function (const struct block *bl);
-
- extern int block_inlined_p (const struct block *block);
-
-Index: gdb-6.8.50.20081128/gdb/blockframe.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/blockframe.c 2008-12-06 14:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/blockframe.c 2008-12-06 21:39:56.000000000 +0100
-@@ -143,7 +143,7 @@ find_pc_sect_function (CORE_ADDR pc, str
- struct block *b = block_for_pc_sect (pc, section);
- if (b == 0)
- return 0;
-- return block_linkage_function (b);
-+ return block_function (b);
- }
-
- /* Return the function containing pc value PC.
-Index: gdb-6.8.50.20081128/gdb/breakpoint.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/breakpoint.c 2008-12-06 14:06:17.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/breakpoint.c 2008-12-06 21:39:56.000000000 +0100
-@@ -5712,7 +5712,7 @@ resolve_sal_pc (struct symtab_and_line *
- bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab);
- if (bv != NULL)
- {
-- sym = block_linkage_function (b);
-+ sym = block_function (b);
- if (sym != NULL)
- {
- fixup_symbol_section (sym, sal->symtab->objfile);
-Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:37:27.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.opt/inline-cmds.exp 2008-12-06 21:41:37.000000000 +0100
-@@ -45,8 +45,10 @@ if { [skip_inline_frame_tests] } {
-
- # First, check that the things we expected to be inlined really were,
- # and those that shouldn't be weren't.
--set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
--gdb_breakpoint $srcfile2:$line1
-+# We test also inlining by the function name, otherwise we would use:
-+# set line1 [gdb_get_line_number "set breakpoint 1 here" ${srcfile2}]
-+# gdb_breakpoint $srcfile2:$line1
-+gdb_breakpoint "bar"
- set line2 [gdb_get_line_number "set breakpoint 2 here" ${srcfile2}]
- gdb_breakpoint $srcfile2:$line2
-
diff --git a/gdb-archer-ada.patch b/gdb-archer-ada.patch
new file mode 100644
index 0000000..128112b
--- /dev/null
+++ b/gdb-archer-ada.patch
@@ -0,0 +1,23 @@
+From: Keith Seitz
+Message-ID: <4B7F207A.7020102@redhat.com>
+
+[ read_partial_die part dropped in the port to Rawhide ]
+
+--- gdb-7.0.1-orig/gdb/dwarf2read.c 2010-02-20 01:06:44.000000000 +0100
++++ gdb-7.0.1/gdb/dwarf2read.c 2010-02-20 01:08:28.000000000 +0100
+@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
+ static char *
+ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
+ {
+- struct attribute *attr;
++ struct attribute *attr = NULL;
++
++ if (cu->language == language_ada)
++ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+
+- attr = dwarf2_attr (die, DW_AT_name, cu);
++ if (!attr)
++ attr = dwarf2_attr (die, DW_AT_name, cu);
+ if (!attr || !DW_STRING (attr))
+ return NULL;
+
diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch
new file mode 100644
index 0000000..41409f0
--- /dev/null
+++ b/gdb-archer-next-over-throw-cxx-exec.patch
@@ -0,0 +1,104 @@
+Archer-upstreamed:
+http://sourceware.org/ml/archer/2010-q2/msg00031.html
+
+--- ./gdb/breakpoint.c 2010-05-29 01:12:32.000000000 +0200
++++ ./gdb/breakpoint.c 2010-05-29 01:22:21.000000000 +0200
+@@ -1679,14 +1679,11 @@ create_exception_master_breakpoint (void
+ debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile);
+ if (debug_hook != NULL)
+ {
+- CORE_ADDR pc;
+ struct breakpoint *b;
+
+- pc = find_function_start_pc (get_objfile_arch (objfile),
+- SYMBOL_VALUE_ADDRESS (debug_hook),
+- SYMBOL_OBJ_SECTION (debug_hook));
+ b = create_internal_breakpoint (get_objfile_arch (objfile),
+- pc, bp_exception_master);
++ SYMBOL_VALUE_ADDRESS (debug_hook),
++ bp_exception_master);
+ b->addr_string = xstrdup ("_Unwind_DebugHook");
+ b->enable_state = bp_disabled;
+ }
+--- ./gdb/testsuite/gdb.cp/cxxexec.cc 1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.cp/cxxexec.cc 2010-05-29 01:18:56.000000000 +0200
+@@ -0,0 +1,25 @@
++/* This test script 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 . */
++
++#include
++
++int
++main()
++{
++ execlp ("true", "true", NULL);
++ return 1;
++}
+--- ./gdb/testsuite/gdb.cp/cxxexec.exp 1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.cp/cxxexec.exp 2010-05-29 01:29:25.000000000 +0200
+@@ -0,0 +1,51 @@
++# 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 .
++
++if { [skip_cplus_tests] } { continue }
++
++set testfile cxxexec
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
++ return -1
++}
++
++runto_main
++
++# We could stop after `continue' again at `main'.
++delete_breakpoints
++
++set test "p _Unwind_DebugHook"
++gdb_test_multiple $test $test {
++ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
++ pass $test
++ }
++ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
++ xfail $test
++ untested ${testfile}.exp
++ return -1
++ }
++}
++
++set test continue
++gdb_test_multiple $test $test {
++ -re "Cannot access memory at address 0x\[0-9a-f\]+\r\n$gdb_prompt $" {
++ fail $test
++ }
++ -re "\r\n$gdb_prompt $" {
++ pass $test
++ }
++}
++
++# `info inferiors' can show on older GDBs.
++gdb_test "info threads" "info threads" "program finished"
diff --git a/gdb-archer-pie-0315-breakpoint_address_match.patch b/gdb-archer-pie-0315-breakpoint_address_match.patch
deleted file mode 100644
index 0000597..0000000
--- a/gdb-archer-pie-0315-breakpoint_address_match.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-[ Forward-ported context. ]
-
-http://sourceware.org/ml/gdb-patches/2009-11/msg00170.html
-Subject: [patch 03/15] PIE: breakpoint_address_match gdbarch_addr_bit workaround
-
-Hi,
-
-there are already multiple cases of CORE_ADDR being masked by the width of
-gdbarch_addr_bit. This specific new case was required the PIE support.
-
-Please read the C comment in attached patch.
-
-Checked that CORE_ADDR math operations are present on 6000+ lines of code of
-GDB sources which makes it impossible to do some general fix by replacing all
- a->addr < b->addr
-by
- addr_less_than (a->addr, b->addr)
-etc.
-
-Even with this patch I think there are still many bugs left in the operation
-of x86_64 gdb debugging i386 targets. Do you find the C++ way as a viable
-one?
-
-
-Thanks,
-Jan
-
-
-gdb/
- * breakpoint.c (breakpoint_address_match): New variables addr_bit and
- addr_mask, initialize it. Mask addresses by ADDR_MASK.
- * defs.h (CORE_ADDR): Extend the comment.
-
---- a/gdb/breakpoint.c
-+++ b/gdb/breakpoint.c
-@@ -4559,9 +4559,15 @@ static int
- breakpoint_address_match (struct address_space *aspace1, CORE_ADDR addr1,
- struct address_space *aspace2, CORE_ADDR addr2)
- {
-+ int addr_bit = gdbarch_addr_bit (target_gdbarch);
-+ CORE_ADDR addr_mask = CORE_ADDR_MAX;
-+
-+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-+ addr_mask = ((CORE_ADDR) 1 << addr_bit) - 1;
-+
- return ((gdbarch_has_global_breakpoints (target_gdbarch)
- || aspace1 == aspace2)
-- && addr1 == addr2);
-+ && (addr1 & addr_mask) == (addr2 & addr_mask));
- }
-
- /* Assuming LOC1 and LOC2's types' have meaningful target addresses
---- a/gdb/defs.h
-+++ b/gdb/defs.h
-@@ -98,7 +98,20 @@
- /* A byte from the program being debugged. */
- typedef bfd_byte gdb_byte;
-
--/* An address in the program being debugged. Host byte order. */
-+/* An address in the program being debugged. Host byte order.
-+
-+ Its width is the maximum width of all the supported targets. That means
-+ 32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the
-+ bits 32...63 with random data from internal GDB calculations. GDB currently
-+ in general truncates the address width only when it is being presented/used
-+ externally (such as by the paddress function).
-+
-+ FIXME: This is still not right as any GDB internal comparisons (such as >=)
-+ of CORE_ADDR do not use the properly truncated width. As converting all the
-+ CORE_ADDR operations to width-aware functions is not feasible the way out
-+ could be a width-aware C++ class CORE_ADDR referencing gdbarch as its
-+ constructor parameter. */
-+
- typedef bfd_vma CORE_ADDR;
-
- /* The largest CORE_ADDR value. */
-
diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch
index 6575d5d..060b19e 100644
--- a/gdb-archer-pie-addons.patch
+++ b/gdb-archer-pie-addons.patch
@@ -1,8 +1,8 @@
-Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
+Index: gdb-7.0.90.20100306/gdb/dwarf2read.c
===================================================================
---- gdb-7.0.50.20100115.orig/gdb/dwarf2read.c 2010-01-15 21:41:32.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/dwarf2read.c 2010-01-15 21:42:19.000000000 +0100
-@@ -5821,7 +5821,12 @@ read_common_block (struct die_info *die,
+--- gdb-7.0.90.20100306.orig/gdb/dwarf2read.c 2010-03-06 23:27:30.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/dwarf2read.c 2010-03-06 23:28:43.000000000 +0100
+@@ -5910,7 +5910,12 @@ read_common_block (struct die_info *die,
{
struct attribute *attr;
struct symbol *sym;
@@ -16,7 +16,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
-@@ -5830,6 +5835,7 @@ read_common_block (struct die_info *die,
+@@ -5919,6 +5924,7 @@ read_common_block (struct die_info *die,
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
@@ -24,7 +24,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
}
else if (attr_form_is_section_offset (attr))
{
-@@ -5891,12 +5897,15 @@ read_common_block (struct die_info *die,
+@@ -5980,12 +5986,15 @@ read_common_block (struct die_info *die,
else
dwarf2_complex_location_expr_complaint ();
@@ -42,7 +42,7 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
-@@ -5910,7 +5919,7 @@ read_common_block (struct die_info *die,
+@@ -5999,7 +6008,7 @@ read_common_block (struct die_info *die,
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
@@ -51,60 +51,11 @@ Index: gdb-7.0.50.20100115/gdb/dwarf2read.c
set_die_type (die, type, cu);
}
-Index: gdb-7.0.50.20100115/gdb/exec.c
+Index: gdb-7.0.90.20100306/gdb/gdbtypes.h
===================================================================
---- gdb-7.0.50.20100115.orig/gdb/exec.c 2010-01-15 21:35:14.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/exec.c 2010-01-15 21:47:19.000000000 +0100
-@@ -35,6 +35,7 @@
- #include "arch-utils.h"
- #include "gdbthread.h"
- #include "progspace.h"
-+#include "solib.h"
-
- #include
- #include "readline/readline.h"
-@@ -225,6 +226,10 @@ exec_file_attach (char *filename, int fr
- char *scratch_pathname;
- int scratch_chan;
- struct target_section *sections = NULL, *sections_end = NULL;
-+ struct target_section *p;
-+ int addr_bit;
-+ CORE_ADDR mask = CORE_ADDR_MAX;
-+ CORE_ADDR displacement;
-
- scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
- write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
-@@ -293,12 +298,23 @@ exec_file_attach (char *filename, int fr
- scratch_pathname, bfd_errmsg (bfd_get_error ()));
- }
-
-+ set_gdbarch_from_file (exec_bfd);
-+
-+ addr_bit = gdbarch_addr_bit (target_gdbarch);
-+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
-+ mask = ((CORE_ADDR) 1 << addr_bit) - 1;
-+
-+ displacement = solib_exec_displacement ();
-+ for (p = sections; p < sections_end; p++)
-+ {
-+ p->addr = (p->addr + displacement) & mask;
-+ p->endaddr = (p->endaddr + displacement) & mask;
-+ }
-+
- exec_bfd_mtime = bfd_get_mtime (exec_bfd);
-
- validate_files ();
-
-- set_gdbarch_from_file (exec_bfd);
--
- /* Add the executable's sections to the current address spaces'
- list of sections. This possibly pushes the exec_ops
- target. */
-Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/gdbtypes.h 2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/gdbtypes.h 2010-01-15 21:44:24.000000000 +0100
-@@ -406,6 +406,7 @@ enum type_instance_flag_value
+--- gdb-7.0.90.20100306.orig/gdb/gdbtypes.h 2010-03-06 23:26:34.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/gdbtypes.h 2010-03-06 23:28:43.000000000 +0100
+@@ -412,6 +412,7 @@ enum type_instance_flag_value
enum field_loc_kind
{
FIELD_LOC_KIND_BITPOS, /* bitpos */
@@ -112,7 +63,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
FIELD_LOC_KIND_PHYSADDR, /* physaddr */
FIELD_LOC_KIND_PHYSNAME /* physname */
};
-@@ -582,6 +583,7 @@ struct main_type
+@@ -591,6 +592,7 @@ struct main_type
is the location (in the target) of the static field.
Otherwise, physname is the mangled label of the static field. */
@@ -120,7 +71,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
CORE_ADDR physaddr;
char *physname;
}
-@@ -1100,6 +1102,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1091,6 +1093,7 @@ extern void allocate_gnat_aux_type (stru
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
@@ -128,7 +79,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
-@@ -1107,6 +1110,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1098,6 +1101,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))
@@ -136,7 +87,7 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
-@@ -1119,6 +1123,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1110,6 +1114,7 @@ extern void allocate_gnat_aux_type (stru
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
@@ -144,10 +95,10 @@ Index: gdb-7.0.50.20100115/gdb/gdbtypes.h
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
-Index: gdb-7.0.50.20100115/gdb/jv-lang.c
+Index: gdb-7.0.90.20100306/gdb/jv-lang.c
===================================================================
---- gdb-7.0.50.20100115.orig/gdb/jv-lang.c 2010-01-15 21:35:13.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/jv-lang.c 2010-01-15 21:41:58.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/jv-lang.c 2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/jv-lang.c 2010-03-06 23:28:43.000000000 +0100
@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gd
fields = NULL;
@@ -168,142 +119,10 @@ Index: gdb-7.0.50.20100115/gdb/jv-lang.c
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
-Index: gdb-7.0.50.20100115/gdb/solib-svr4.c
+Index: gdb-7.0.90.20100306/gdb/value.c
===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib-svr4.c 2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib-svr4.c 2010-01-15 21:44:55.000000000 +0100
-@@ -1689,7 +1689,10 @@ svr4_exec_displacement (void)
- if (target_auxv_search (¤t_target, AT_ENTRY, &entry_point) == 1)
- return entry_point - bfd_get_start_address (exec_bfd);
-
-- return svr4_static_exec_displacement ();
-+ if (!ptid_equal (inferior_ptid, null_ptid))
-+ return svr4_static_exec_displacement ();
-+
-+ return 0;
- }
-
- /* Relocate the main executable. This function should be called upon
-@@ -1700,7 +1703,7 @@ svr4_exec_displacement (void)
- static void
- svr4_relocate_main_executable (void)
- {
-- CORE_ADDR displacement = svr4_exec_displacement ();
-+ CORE_ADDR displacement = solib_exec_displacement ();
-
- /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
- difference of in-memory vs. in-file addresses and we could already
-@@ -2054,6 +2057,7 @@ _initialize_svr4_solib (void)
- svr4_so_ops.free_so = svr4_free_so;
- svr4_so_ops.clear_solib = svr4_clear_solib;
- svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
-+ svr4_so_ops.exec_displacement = svr4_exec_displacement;
- svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
- svr4_so_ops.current_sos = svr4_current_sos;
- svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
-Index: gdb-7.0.50.20100115/gdb/solib.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib.c 2010-01-15 21:35:16.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib.c 2010-01-15 21:41:58.000000000 +0100
-@@ -1037,6 +1037,19 @@ solib_create_inferior_hook (int from_tty
- ops->solib_create_inferior_hook (from_tty);
- }
-
-+/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
-+
-+CORE_ADDR
-+solib_exec_displacement (void)
-+{
-+ struct target_so_ops *ops = solib_ops (target_gdbarch);
-+
-+ if (ops->exec_displacement != NULL)
-+ return (*ops->exec_displacement) ();
-+ else
-+ return 0;
-+}
-+
- /* GLOBAL FUNCTION
-
- in_solib_dynsym_resolve_code -- check to see if an address is in
-Index: gdb-7.0.50.20100115/gdb/solib.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solib.h 2010-01-08 23:52:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solib.h 2010-01-15 21:42:36.000000000 +0100
-@@ -44,6 +44,8 @@ extern int solib_read_symbols (struct so
-
- extern void solib_create_inferior_hook (int from_tty);
-
-+extern CORE_ADDR solib_exec_displacement (void);
-+
- /* If ADDR lies in a shared library, return its name. */
-
- extern char *solib_name_from_address (struct program_space *, CORE_ADDR);
-Index: gdb-7.0.50.20100115/gdb/solist.h
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/solist.h 2010-01-08 23:52:04.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/solist.h 2010-01-15 21:41:58.000000000 +0100
-@@ -92,6 +92,9 @@ struct target_so_ops
- /* Target dependent code to run after child process fork. */
- void (*solib_create_inferior_hook) (int from_tty);
-
-+ /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
-+ CORE_ADDR (*exec_displacement) (void);
-+
- /* Do additional symbol handling, lookup, etc. after symbols
- for a shared object have been loaded. */
- void (*special_symbol_handling) (void);
-Index: gdb-7.0.50.20100115/gdb/symfile.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/symfile.c 2010-01-15 21:35:14.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/symfile.c 2010-01-15 21:41:58.000000000 +0100
-@@ -832,15 +832,36 @@ syms_from_objfile (struct objfile *objfi
- if an error occurs during symbol reading. */
- old_chain = make_cleanup_free_objfile (objfile);
-
-- /* If ADDRS and OFFSETS are both NULL, put together a dummy address
-- list. We now establish the convention that an addr of zero means
-- no load address was specified. */
-+ /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list. */
-+
- if (! addrs && ! offsets)
- {
-- local_addr
-- = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
-- make_cleanup (xfree, local_addr);
-- addrs = local_addr;
-+ /* Relocateble files have an exception in default_symfile_offsets which
-+ applies only for ADDRS. But calling solib_exec_displacement is more
-+ suitable for OFFSETS. Fortunately we never need the both
-+ functionalities simultaneously and in other cases zeroed ADDRS and
-+ zeroed OFFSETS are equivalent. */
-+
-+ if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
-+ {
-+ local_addr
-+ = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
-+ make_cleanup (xfree, local_addr);
-+ addrs = local_addr;
-+ }
-+ else
-+ {
-+ CORE_ADDR displacement = 0;
-+ int i;
-+
-+ if (mainline)
-+ displacement = solib_exec_displacement ();
-+
-+ num_offsets = bfd_count_sections (objfile->obfd);
-+ offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
-+ for (i = 0; i < num_offsets; i++)
-+ offsets->offsets[i] = displacement;
-+ }
- }
-
- /* Now either addrs or offsets is non-zero. */
-Index: gdb-7.0.50.20100115/gdb/value.c
-===================================================================
---- gdb-7.0.50.20100115.orig/gdb/value.c 2010-01-15 21:35:13.000000000 +0100
-+++ gdb-7.0.50.20100115/gdb/value.c 2010-01-15 21:41:58.000000000 +0100
+--- gdb-7.0.90.20100306.orig/gdb/value.c 2010-03-06 23:19:13.000000000 +0100
++++ gdb-7.0.90.20100306/gdb/value.c 2010-03-06 23:28:43.000000000 +0100
@@ -1897,7 +1897,8 @@ value_static_field (struct type *type, i
if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
{
diff --git a/gdb-archer-vla-ref-optimizedout.patch b/gdb-archer-vla-ref-optimizedout.patch
new file mode 100644
index 0000000..6b86bda
--- /dev/null
+++ b/gdb-archer-vla-ref-optimizedout.patch
@@ -0,0 +1,105 @@
+commit a683bac73af74a757591672d89d720169c0b5ec9
+Author: Jan Kratochvil
+Date: Thu May 13 18:08:30 2010 +0200
+
+ Support DW_AT_upper_bound is referencing an optimized-out variable.
+ https://bugzilla.redhat.com/show_bug.cgi?id=591879
+
+--- a/gdb/dwarf2loc.c
++++ b/gdb/dwarf2loc.c
+@@ -383,6 +383,9 @@ dwarf_loclist_baton_eval (struct dwarf2_loclist_baton *dllbaton,
+ size_t size;
+ struct value *val;
+
++ if (!dllbaton)
++ return 0;
++
+ data = find_location_expression (dllbaton, &size,
+ get_frame_address_in_block (frame));
+ if (data == NULL)
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -11693,6 +11693,11 @@ dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
+ {
+ struct dwarf2_loclist_baton *baton;
+
++ /* DW_AT_location of the referenced DIE may be missing if the referenced
++ variable has been optimized out. */
++ if (!attr)
++ return NULL;
++
+ if (!(attr_form_is_section_offset (attr)
+ /* ".debug_loc" may not exist at all, or the offset may be outside
+ the section. If so, fall through to the complaint in the
+--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+@@ -51,6 +51,17 @@ vardata:
+ .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 */
++
+ .Luint_type:
+ .uleb128 4 /* Abbrev: DW_TAG_base_type */
+ .4byte .Luint_str /* DW_AT_name */
+@@ -69,9 +80,24 @@ vardata:
+ .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 */
++ .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 /* */
+@@ -164,6 +190,16 @@ vardata:
+ .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 */
++
+ .byte 0x0 /* Terminator */
+
+ /* String table */
+--- a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+@@ -46,3 +46,6 @@ if ![runto "*main"] {
+
+ 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 \[\]}
diff --git a/gdb-archer-vla-test-oom.patch b/gdb-archer-vla-test-oom.patch
new file mode 100644
index 0000000..dad5ca4
--- /dev/null
+++ b/gdb-archer-vla-test-oom.patch
@@ -0,0 +1,21 @@
+commit ec5a7769d5c05542d12fc21afa25f32360db7de4
+Author: Jan Kratochvil
+Date: Wed May 12 22:00:46 2010 +0200
+
+ Fix mb_reserve:
+ https://bugzilla.redhat.com/show_bug.cgi?id=590635
+
+diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
+index 7203a48..24a608f 100644
+--- a/gdb/testsuite/gdb.base/vla-overflow.exp
++++ b/gdb/testsuite/gdb.base/vla-overflow.exp
+@@ -66,7 +66,8 @@ proc memory_v_pages_get {} {
+
+ set pages_found [memory_v_pages_get]
+
+-set mb_reserve 10
++# 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]
diff --git a/gdb-archer.patch b/gdb-archer.patch
index 3ec58c3..c9b5c9b 100644
--- a/gdb-archer.patch
+++ b/gdb-archer.patch
@@ -2,17 +2,17 @@ http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot:
-commit 285cf618d9b90b7f8f201f094bcfead3c9ba8925
+commit 39998c496988faaa1509cc6ab76b5c4777659bf4
branch `archer' - the merge of branches:
-archer-tromey-delayed-symfile
+archer-tromey-delayed-symfile2
archer-tromey-python
-archer-pmuldoon-next-over-throw
-archer-jankratochvil-fortran-module
-archer-jankratochvil-watchpoint
+archer-pmuldoon-next-over-throw2
+archer-jankratochvil-fortran-module2
+archer-jankratochvil-watchpoint2
archer-jankratochvil-vla
archer-keiths-expr-cumulative
-archer-jankratochvil-ifunc
+# plus older archer-jankratochvil-ifunc
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
@@ -190,7 +190,7 @@ index 98f42b9..dbf8273 100644
# Dependency tracking. Most of this is conditional on GNU Make being
# found by configure; if GNU Make is not found, we fall back to a
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
-index 40b70ab..b291d40 100644
+index 7a2d2ca..4bf4e31 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4781,14 +4781,10 @@ ada_lookup_symbol (const char *name, const struct block *block0,
@@ -209,7 +209,7 @@ index 40b70ab..b291d40 100644
}
-@@ -10931,6 +10927,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
+@@ -10938,6 +10934,40 @@ ada_operator_length (struct expression *exp, int pc, int *oplenp, int *argsp)
}
}
@@ -250,7 +250,7 @@ index 40b70ab..b291d40 100644
static char *
ada_op_name (enum exp_opcode opcode)
{
-@@ -11319,6 +11349,7 @@ parse (void)
+@@ -11326,6 +11356,7 @@ parse (void)
static const struct exp_descriptor ada_exp_descriptor = {
ada_print_subexp,
ada_operator_length,
@@ -314,7 +314,7 @@ index 5c9e558..55a1873 100644
/* Override the GNU/Linux inferior startup hook. */
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
-index 01cc1ce..2a0fa84 100644
+index c28eef7..02c11e1 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1481,6 +1481,9 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -342,10 +342,10 @@ index af409f6..406c066 100644
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
-index 5776bb0..6099e99 100644
+index 3e151de..ddbcb6e 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
-@@ -1810,7 +1810,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
+@@ -1812,7 +1812,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */
@@ -432,7 +432,7 @@ index 7eedb6c..b147826 100644
+
#endif /* BLOCK_H */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index 0d55862..9258c6a 100644
+index 8c97949..0b66740 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -61,6 +61,7 @@
@@ -788,7 +788,7 @@ index 0d55862..9258c6a 100644
case bp_tracepoint:
case bp_fast_tracepoint:
case bp_jit_event:
-@@ -4818,6 +4906,8 @@ allocate_bp_location (struct breakpoint *bpt)
+@@ -4816,6 +4904,8 @@ allocate_bp_location (struct breakpoint *bpt)
case bp_finish:
case bp_longjmp:
case bp_longjmp_resume:
@@ -797,7 +797,7 @@ index 0d55862..9258c6a 100644
case bp_step_resume:
case bp_watchpoint_scope:
case bp_call_dummy:
-@@ -4826,6 +4916,7 @@ allocate_bp_location (struct breakpoint *bpt)
+@@ -4824,6 +4914,7 @@ allocate_bp_location (struct breakpoint *bpt)
case bp_overlay_event:
case bp_jit_event:
case bp_longjmp_master:
@@ -855,7 +855,7 @@ index 0d55862..9258c6a 100644
break;
}
-@@ -7508,6 +7602,7 @@ struct until_break_command_continuation_args
+@@ -7509,6 +7603,7 @@ struct until_break_command_continuation_args
{
struct breakpoint *breakpoint;
struct breakpoint *breakpoint2;
@@ -863,7 +863,7 @@ index 0d55862..9258c6a 100644
};
/* This function is called by fetch_inferior_event via the
-@@ -7522,6 +7617,7 @@ until_break_command_continuation (void *arg)
+@@ -7523,6 +7618,7 @@ until_break_command_continuation (void *arg)
delete_breakpoint (a->breakpoint);
if (a->breakpoint2)
delete_breakpoint (a->breakpoint2);
@@ -871,7 +871,7 @@ index 0d55862..9258c6a 100644
}
void
-@@ -7533,6 +7629,8 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7534,6 +7630,8 @@ until_break_command (char *arg, int from_tty, int anywhere)
struct breakpoint *breakpoint;
struct breakpoint *breakpoint2 = NULL;
struct cleanup *old_chain;
@@ -880,7 +880,7 @@ index 0d55862..9258c6a 100644
clear_proceed_status ();
-@@ -7571,6 +7669,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7572,6 +7670,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
old_chain = make_cleanup_delete_breakpoint (breakpoint);
@@ -890,7 +890,7 @@ index 0d55862..9258c6a 100644
/* Keep within the current frame, or in frames called by the current
one. */
-@@ -7583,6 +7684,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7584,6 +7685,10 @@ until_break_command (char *arg, int from_tty, int anywhere)
frame_unwind_caller_id (frame),
bp_until);
make_cleanup_delete_breakpoint (breakpoint2);
@@ -901,7 +901,7 @@ index 0d55862..9258c6a 100644
}
proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
-@@ -7599,6 +7704,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
+@@ -7600,6 +7705,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
args->breakpoint = breakpoint;
args->breakpoint2 = breakpoint2;
@@ -909,7 +909,7 @@ index 0d55862..9258c6a 100644
discard_cleanups (old_chain);
add_continuation (inferior_thread (),
-@@ -8784,6 +8890,7 @@ delete_command (char *arg, int from_tty)
+@@ -8796,6 +8902,7 @@ delete_command (char *arg, int from_tty)
&& b->type != bp_thread_event
&& b->type != bp_overlay_event
&& b->type != bp_longjmp_master
@@ -917,7 +917,7 @@ index 0d55862..9258c6a 100644
&& b->number >= 0)
{
breaks_to_delete = 1;
-@@ -8803,6 +8910,7 @@ delete_command (char *arg, int from_tty)
+@@ -8815,6 +8922,7 @@ delete_command (char *arg, int from_tty)
&& b->type != bp_jit_event
&& b->type != bp_overlay_event
&& b->type != bp_longjmp_master
@@ -925,7 +925,7 @@ index 0d55862..9258c6a 100644
&& b->number >= 0)
delete_breakpoint (b);
}
-@@ -9113,6 +9221,7 @@ breakpoint_re_set_one (void *bint)
+@@ -9125,6 +9233,7 @@ breakpoint_re_set_one (void *bint)
reset later by breakpoint_re_set. */
case bp_overlay_event:
case bp_longjmp_master:
@@ -933,7 +933,7 @@ index 0d55862..9258c6a 100644
delete_breakpoint (b);
break;
-@@ -9135,6 +9244,8 @@ breakpoint_re_set_one (void *bint)
+@@ -9147,6 +9256,8 @@ breakpoint_re_set_one (void *bint)
case bp_step_resume:
case bp_longjmp:
case bp_longjmp_resume:
@@ -942,7 +942,7 @@ index 0d55862..9258c6a 100644
case bp_jit_event:
break;
}
-@@ -9177,6 +9288,7 @@ breakpoint_re_set (void)
+@@ -9189,6 +9300,7 @@ breakpoint_re_set (void)
create_longjmp_master_breakpoint ("_longjmp");
create_longjmp_master_breakpoint ("siglongjmp");
create_longjmp_master_breakpoint ("_siglongjmp");
@@ -950,7 +950,7 @@ index 0d55862..9258c6a 100644
}
/* Reset the thread number of this breakpoint:
-@@ -10172,6 +10284,22 @@ all_tracepoints ()
+@@ -10187,6 +10299,22 @@ all_tracepoints ()
return tp_vec;
}
@@ -973,7 +973,7 @@ index 0d55862..9258c6a 100644
/* This help string is used for the break, hbreak, tbreak and thbreak commands.
It is defined as a macro to prevent duplication.
-@@ -10716,4 +10844,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
+@@ -10731,4 +10859,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
automatic_hardware_breakpoints = 1;
observer_attach_about_to_proceed (breakpoint_about_to_proceed);
@@ -1029,10 +1029,49 @@ index 6b373a3..59aa412 100644
extern struct breakpoint *get_tracepoint (int num);
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
-index 8e00979..b86fc8e 100644
+index 845771c..7a74d7e 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
-@@ -418,6 +418,24 @@ exp : exp '(' nonempty_typelist ')' const_or_volatile
+@@ -186,6 +186,7 @@ static struct stoken operator_stoken (const char *);
+ %token STRING
+ %token CHAR
+ %token NAME /* BLOCKNAME defined below to give it higher precedence. */
++%token UNKNOWN_CPP_NAME
+ %token COMPLETE
+ %token TYPENAME
+ %type name
+@@ -391,6 +392,30 @@ exp : exp '('
+ write_exp_elt_opcode (OP_FUNCALL); }
+ ;
+
++exp : UNKNOWN_CPP_NAME '('
++ {
++
++ /* This could potentially be a an argument defined
++ lookup function (Koenig). */
++ write_exp_elt_opcode (OP_ADL_FUNC);
++ write_exp_elt_block (expression_context_block);
++ write_exp_elt_sym (NULL); /* Place holder */
++ write_exp_string ($1.stoken);
++ write_exp_elt_opcode (OP_ADL_FUNC);
++
++ /* This is to save the value of arglist_len
++ being accumulated by an outer function call. */
++
++ start_arglist ();
++ }
++ arglist ')' %prec ARROW
++ {
++ write_exp_elt_opcode (OP_FUNCALL);
++ write_exp_elt_longcst ((LONGEST) end_arglist ());
++ write_exp_elt_opcode (OP_FUNCALL);
++ }
++ ;
++
+ lcurly : '{'
+ { start_arglist (); }
+ ;
+@@ -418,6 +443,24 @@ exp : exp '(' nonempty_typelist ')' const_or_volatile
}
;
@@ -1057,7 +1096,7 @@ index 8e00979..b86fc8e 100644
rcurly : '}'
{ $$ = end_arglist () - 1; }
;
-@@ -785,12 +803,13 @@ qualified_name: typebase COLONCOLON name
+@@ -785,12 +828,13 @@ qualified_name: typebase COLONCOLON name
;
variable: qualified_name
@@ -1072,10 +1111,19 @@ index 8e00979..b86fc8e 100644
sym =
lookup_symbol (name, (const struct block *) NULL,
VAR_DOMAIN, (int *) NULL);
-@@ -1298,6 +1317,14 @@ name_not_typename : NAME
+@@ -1286,6 +1330,7 @@ name : NAME { $$ = $1.stoken; }
+ | BLOCKNAME { $$ = $1.stoken; }
+ | TYPENAME { $$ = $1.stoken; }
+ | NAME_OR_INT { $$ = $1.stoken; }
++ | UNKNOWN_CPP_NAME { $$ = $1.stoken; }
+ | operator { $$ = $1; }
+ ;
+
+@@ -1298,6 +1343,15 @@ name_not_typename : NAME
context where only a name could occur, this might be useful.
| NAME_OR_INT
*/
++ | UNKNOWN_CPP_NAME
+ | operator
+ {
+ $$.stoken = $1;
@@ -1087,7 +1135,7 @@ index 8e00979..b86fc8e 100644
;
%%
-@@ -2033,6 +2060,13 @@ static int last_was_structop;
+@@ -2033,6 +2087,13 @@ static int last_was_structop;
static int
yylex (void)
{
@@ -1101,7 +1149,7 @@ index 8e00979..b86fc8e 100644
int c;
int namelen;
unsigned int i;
-@@ -2041,9 +2075,19 @@ yylex (void)
+@@ -2041,9 +2102,19 @@ yylex (void)
char *copy;
last_was_structop = 0;
@@ -1123,7 +1171,7 @@ index 8e00979..b86fc8e 100644
/* Check if this is a macro invocation that we need to expand. */
if (! scanning_macro_expansion ())
{
-@@ -2079,10 +2123,19 @@ yylex (void)
+@@ -2079,10 +2150,19 @@ yylex (void)
&& parse_language->la_language != language_cplus)
break;
@@ -1143,7 +1191,7 @@ index 8e00979..b86fc8e 100644
return tokentab2[i].token;
}
-@@ -2111,6 +2164,8 @@ yylex (void)
+@@ -2111,6 +2191,8 @@ yylex (void)
return 0;
case ' ':
@@ -1152,7 +1200,7 @@ index 8e00979..b86fc8e 100644
case '\t':
case '\n':
lexptr++;
-@@ -2268,11 +2323,13 @@ yylex (void)
+@@ -2268,11 +2350,13 @@ yylex (void)
error ("Invalid character '%c' in expression.", c);
/* It's a name. See how long it is. */
@@ -1166,7 +1214,7 @@ index 8e00979..b86fc8e 100644
/* Template parameter lists are part of the name.
FIXME: This mishandles `print $a<4&&$a>3'. */
-@@ -2357,14 +2414,29 @@ yylex (void)
+@@ -2357,14 +2441,33 @@ yylex (void)
currently as names of types; NAME for other symbols.
The caller is not constrained to care about the distinction. */
{
@@ -1177,7 +1225,11 @@ index 8e00979..b86fc8e 100644
- sym = lookup_symbol (copy, expression_context_block,
+ if (name_prefix != NULL)
-+ tmp = savestring (name_prefix, name_prefix_len+namelen);
++ {
++ tmp = alloca (name_prefix_len + namelen + 1);
++ memcpy (tmp, name_prefix, name_prefix_len + namelen);
++ tmp[name_prefix_len + namelen] = '\0';
++ }
+
+ sym = lookup_symbol (tmp, expression_context_block,
VAR_DOMAIN,
@@ -1197,11 +1249,16 @@ index 8e00979..b86fc8e 100644
/* Call lookup_symtab, not lookup_partial_symtab, in case there are
no psymtabs (coff, xcoff, or some future change to blow away the
psymtabs once once symbols are read). */
-@@ -2423,6 +2495,7 @@ yylex (void)
+@@ -2423,6 +2526,12 @@ yylex (void)
yylval.ssym.is_a_field_of_this = is_a_field_of_this;
if (in_parse_field && *lexptr == '\0')
saw_name_at_eof = 1;
+
++ if (sym == NULL
++ && parse_language->la_language == language_cplus
++ && !lookup_minimal_symbol (tmp, NULL, NULL))
++ return UNKNOWN_CPP_NAME;
++
return NAME;
}
}
@@ -1218,7 +1275,7 @@ index d620881..34cb34a 100644
dump_subexp_body_standard,
evaluate_subexp_c
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
-index 27746d9..d4da180 100644
+index ed98381..3061ab7 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -32,6 +32,7 @@
@@ -1301,12 +1358,13 @@ index 27746d9..d4da180 100644
printed_any = 1;
}
-@@ -558,7 +584,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+@@ -558,7 +584,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, ")");
fprintf_filtered (stream, "[");
- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
-+ if (TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK (type))
++ 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");
@@ -1315,7 +1373,7 @@ index 27746d9..d4da180 100644
&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
-@@ -591,7 +622,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+@@ -591,7 +623,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
@@ -1325,7 +1383,7 @@ index 27746d9..d4da180 100644
passed_a_ptr, 0);
break;
diff --git a/gdb/coffread.c b/gdb/coffread.c
-index 8e5dca9..7e7fb8b 100644
+index ba413ad..44676a8 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -2123,6 +2123,7 @@ static struct sym_fns coff_sym_fns =
@@ -1365,7 +1423,7 @@ index ebde876..907b275 100644
#undef RELOC_SRCDIR
diff --git a/gdb/configure b/gdb/configure
-index d444b08..d4ced89 100755
+index 1983d04..8dca37e 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -676,6 +676,8 @@ REPORT_BUGS_TO
@@ -1480,7 +1538,7 @@ index d444b08..d4ced89 100755
# Flags needed to compile Python code (taken from python-config --cflags).
diff --git a/gdb/configure.ac b/gdb/configure.ac
-index 8da6867..8e39254 100644
+index 6f873b5..77985c8 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
@@ -1656,7 +1714,7 @@ index 81f6a5d..097db65 100644
{ $$ = $1.comp;
if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); }
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
-index 8ca9c20..21e013a 100644
+index 5e894d4..6325ead 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -34,14 +34,17 @@
@@ -1683,8 +1741,8 @@ index 8ca9c20..21e013a 100644
anonymous namespace. So add symbols in it to the
namespace given by the previous component if there is
one, or to the global namespace if there isn't. */
-- cp_add_using_directive (dest, src);
-+ cp_add_using_directive (dest, src, "", "", 0);
+- cp_add_using_directive (dest, src, NULL);
++ cp_add_using_directive (dest, src, NULL, "", 0);
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;
@@ -1692,39 +1750,41 @@ index 8ca9c20..21e013a 100644
has already been added, don't add it twice. */
void
--cp_add_using_directive (const char *dest, const char *src)
-+cp_add_using_directive (const char *dest, const char *src, const char* alias,
+-cp_add_using_directive (const char *dest, const char *src, const char *alias)
++cp_add_using_directive (const char *dest, const char *src, const char *alias,
+ const char *declaration, const int line_number)
{
struct using_direct *current;
struct using_direct *new;
-@@ -146,7 +150,8 @@ cp_add_using_directive (const char *dest, const char *src)
+@@ -146,7 +150,8 @@ cp_add_using_directive (const char *dest, const char *src, const char *alias)
return;
}
-- using_directives = cp_add_using (dest, src, using_directives);
+- using_directives = cp_add_using (dest, src, alias, using_directives);
+ using_directives = cp_add_using (dest, src, alias, declaration,
+ line_number, using_directives);
}
-@@ -199,7 +204,10 @@ cp_is_anonymous (const char *namespace)
+@@ -198,9 +203,11 @@ cp_is_anonymous (const char *namespace)
+ != NULL);
}
- /* Create a new struct using direct which imports the namespace SRC
-- into the scope DEST.
+-/* Create a new struct using direct which imports the namespace SRC into the
+- scope DEST. ALIAS is the name of the imported namespace in the current
+- scope. If ALIAS is NULL then the namespace is known by its original name.
++/* Create a new struct using direct which imports the namespace SRC
+ into the scope DEST. ALIAS is the name of the imported namespace
-+ in the current scope. If ALIAS is an empty string then the
++ in the current scope. If ALIAS is NULL then the
+ namespace is known by its original name.
+
Set its next member in the linked list to NEXT; allocate all memory
using xmalloc. It copies the strings, so NAME can be a temporary
string. */
-@@ -207,13 +215,19 @@ cp_is_anonymous (const char *namespace)
- struct using_direct *
+@@ -209,19 +216,23 @@ struct using_direct *
cp_add_using (const char *dest,
const char *src,
-+ const char *alias,
+ const char *alias,
+ const char *declaration,
+ const int line_number,
struct using_direct *next)
@@ -1736,13 +1796,18 @@ index 8ca9c20..21e013a 100644
- retval->import_dest = savestring (dest, strlen(dest));
+ retval->import_src = savestring (src, strlen (src));
+ retval->import_dest = savestring (dest, strlen (dest));
-+ retval->alias = savestring (alias, strlen (alias));
+
+ if (alias != NULL)
+ retval->alias = savestring (alias, strlen (alias));
+ else
+ retval->alias = NULL;
+
+ retval->declaration = savestring (declaration, strlen (declaration));
+ retval->line_number = line_number;
retval->next = next;
retval->searched = 0;
-@@ -230,19 +244,100 @@ cp_add_using (const char *dest,
+@@ -238,19 +249,100 @@ cp_add_using (const char *dest,
struct symbol *
cp_lookup_symbol_nonlocal (const char *name,
@@ -1848,7 +1913,7 @@ index 8ca9c20..21e013a 100644
}
/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in
-@@ -250,25 +345,24 @@ cp_lookup_symbol_nonlocal (const char *name,
+@@ -258,25 +350,24 @@ cp_lookup_symbol_nonlocal (const char *name,
static struct symbol *
cp_lookup_symbol_in_namespace (const char *namespace,
@@ -1883,7 +1948,7 @@ index 8ca9c20..21e013a 100644
}
}
-@@ -283,9 +377,17 @@ reset_directive_searched (void *data)
+@@ -291,9 +382,17 @@ reset_directive_searched (void *data)
}
/* Search for NAME by applying all import statements belonging
@@ -1903,7 +1968,7 @@ index 8ca9c20..21e013a 100644
Example:
namespace A{
-@@ -299,26 +401,33 @@ reset_directive_searched (void *data)
+@@ -307,26 +406,33 @@ reset_directive_searched (void *data)
and Y will be considered. If SEARCH_PARENTS is false only the import of Y
is considered. */
@@ -1946,27 +2011,25 @@ index 8ca9c20..21e013a 100644
/* Go through the using directives. If any of them add new
names to the namespace we're searching in, see if we can find a
match by applying them. */
-@@ -327,123 +436,78 @@ cp_lookup_symbol_imports (const char *scope,
+@@ -335,7 +441,10 @@ cp_lookup_symbol_imports (const char *scope,
current != NULL;
current = current->next)
{
- len = strlen (current->import_dest);
-- directive_match = (search_parents
-- ? (strncmp (scope, current->import_dest,
-- strlen (current->import_dest)) == 0
-- && (len == 0
-- || scope[len] == ':' || scope[len] == '\0'))
-- : strcmp (scope, current->import_dest) == 0);
--
+
- /* If the import destination is the current scope or one of its ancestors then
- it is applicable. */
++ /* If the import destination is the current scope or one of its ancestors then
++ it is applicable. */
++ int len = strlen (current->import_dest);
+ directive_match = (search_parents
+ ? (strncmp (scope, current->import_dest,
+ strlen (current->import_dest)) == 0
+@@ -343,130 +452,70 @@ cp_lookup_symbol_imports (const char *scope,
+ || scope[len] == ':' || scope[len] == '\0'))
+ : strcmp (scope, current->import_dest) == 0);
+
+- /* If the import destination is the current scope or one of its ancestors then
+- it is applicable. */
- if (directive_match && !current->searched)
-+ directive_match = search_parents ?
-+ strncmp (scope, current->import_dest,
-+ strlen(current->import_dest)) == 0 :
-+ strcmp (scope, current->import_dest) == 0;
-+
+ if (directive_match &&
+ current->line_number < current_line &&
+ !current->searched)
@@ -1976,13 +2039,65 @@ index 8ca9c20..21e013a 100644
- current->searched = 1;
- searched_cleanup = make_cleanup (reset_directive_searched, current);
-
-- sym = cp_lookup_symbol_namespace (current->import_src,
-- name,
-- linkage_name,
-- block,
-- domain,
-- 0);
--
+- if (current->alias != NULL && strcmp (name, current->alias) == 0)
+- /* If the import is creating an alias and the alias matches the
+- sought name. Pass current->import_src as the NAME to direct the
+- search towards the aliased namespace. */
+- {
++ current->searched = 1;
++ searched_cleanup = make_cleanup (reset_directive_searched, current);
++
++ /* If there is an import of a single declaration, compare the imported
++ declaration with the sought out name. If there is a match pass
++ current->import_src as NAMESPACE to direct the search towards the
++ imported namespace. */
++ if (strcmp ("", current->declaration) != 0)
++ {
++ if (strcmp (name, current->declaration) == 0)
++ {
++ sym = cp_lookup_symbol_in_namespace (current->import_src,
++ name,
++ block,
++ domain);
++ }
++
++ current->searched = 0;
++ if (sym)
++ return sym;
++
++ continue;
++ }
++
++ if (declaration_only)
++ {
++ current->searched = 0;
++ discard_cleanups (searched_cleanup);
++ continue;
++ }
++
++ if (current->alias != NULL && strcmp (name, current->alias) == 0)
++ /* If the import is creating an alias and the alias matches the
++ sought name. Pass current->inner as the NAME to direct the
++ search towards the aliased namespace */
++ {
+ sym = cp_lookup_symbol_in_namespace (scope,
+ current->import_src,
+- linkage_name,
+ block,
+ domain);
+- }
+- else if (current->alias == NULL)
+- {
++ } else if (current->alias == NULL){
+ /* If this import statement creates no alias, pass current->inner as
+- NAMESPACE to direct the search towards the imported namespace. */
+- sym = cp_lookup_symbol_imports (current->import_src,
+- name,
+- linkage_name,
+- block,
+- domain,
+- 0);
+- }
- current->searched = 0;
- discard_cleanups (searched_cleanup);
-
@@ -2047,51 +2162,10 @@ index 8ca9c20..21e013a 100644
- int scope_len)
-{
- char *namespace;
-+ current->searched = 1;
-+ searched_cleanup = make_cleanup (reset_directive_searched, current);
-+
-+ /* If there is an import of a single declaration, compare the imported
-+ declaration with the sought out name. If there is a match pass
-+ current->import_src as NAMESPACE to direct the search towards the
-+ imported namespace. */
-+ if (strcmp ("", current->declaration) != 0)
-+ {
-+ if (strcmp (name, current->declaration) == 0)
-+ {
-+ sym = cp_lookup_symbol_in_namespace (current->import_src,
-+ name,
-+ block,
-+ domain);
-+ }
-+
-+ current->searched = 0;
-+ if (sym)
-+ return sym;
-+
-+ continue;
-+ }
-+
-+ if (declaration_only)
-+ {
-+ current->searched = 0;
-+ discard_cleanups (searched_cleanup);
-+ continue;
-+ }
-
+-
- if (scope[scope_len] != '\0')
- {
- /* Recursively search for names in child namespaces first. */
-+ if (strcmp (name, current->alias) == 0)
-+ /* If the import is creating an alias and the alias matches the
-+ sought name. Pass current->inner as the NAME to direct the
-+ search towards the aliased namespace */
-+ {
-+ sym = cp_lookup_symbol_in_namespace (scope,
-+ current->import_src,
-+ block,
-+ domain);
-+ } else if (strcmp ("", current->alias) == 0){
-+ /* If this import statement creates no alias, pass current->inner as
+ NAMESPACE to direct the search towards the imported namespace. */
+ sym = cp_lookup_symbol_imports (current->import_src,
+ name,
@@ -2133,7 +2207,7 @@ index 8ca9c20..21e013a 100644
}
/* Look up NAME in BLOCK's static block and in global blocks. If
-@@ -453,17 +517,15 @@ lookup_namespace_scope (const char *name,
+@@ -476,17 +525,15 @@ lookup_namespace_scope (const char *name,
static struct symbol *
lookup_symbol_file (const char *name,
@@ -2152,7 +2226,7 @@ index 8ca9c20..21e013a 100644
if (anonymous_namespace)
{
/* Symbols defined in anonymous namespaces have external linkage
-@@ -473,12 +535,11 @@ lookup_symbol_file (const char *name,
+@@ -496,12 +543,11 @@ lookup_symbol_file (const char *name,
const struct block *global_block = block_global_block (block);
if (global_block != NULL)
@@ -2167,7 +2241,7 @@ index 8ca9c20..21e013a 100644
}
if (sym != NULL)
-@@ -499,6 +560,7 @@ lookup_symbol_file (const char *name,
+@@ -522,6 +568,7 @@ lookup_symbol_file (const char *name,
sym = lookup_possible_namespace_symbol (name);
if (sym != NULL)
return sym;
@@ -2175,7 +2249,7 @@ index 8ca9c20..21e013a 100644
}
return NULL;
-@@ -527,10 +589,9 @@ cp_lookup_nested_type (struct type *parent_type,
+@@ -550,10 +597,9 @@ cp_lookup_nested_type (struct type *parent_type,
const char *parent_name = TYPE_TAG_NAME (parent_type);
struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name,
@@ -2189,7 +2263,7 @@ index 8ca9c20..21e013a 100644
if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
return NULL;
else
-@@ -774,7 +835,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
+@@ -797,7 +843,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
memcpy (name_copy, name, len);
name_copy[len] = '\0';
@@ -2198,7 +2272,7 @@ index 8ca9c20..21e013a 100644
if (sym == NULL)
{
-@@ -815,7 +876,7 @@ lookup_possible_namespace_symbol (const char *name)
+@@ -838,7 +884,7 @@ lookup_possible_namespace_symbol (const char *name)
struct symbol *sym;
sym = lookup_block_symbol (get_possible_namespace_block (objfile),
@@ -2208,9 +2282,18 @@ index 8ca9c20..21e013a 100644
if (sym != NULL)
return sym;
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
-index c31fcff..fc294ae 100644
+index c31fcff..8c5d56f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
+@@ -50,7 +50,7 @@ static void demangled_name_complaint (const char *name);
+
+ /* Functions/variables related to overload resolution. */
+
+-static int sym_return_val_size;
++static int sym_return_val_size = -1;
+ static int sym_return_val_index;
+ static struct symbol **sym_return_val;
+
@@ -190,7 +190,8 @@ mangled_name_to_comp (const char *mangled_name, int options,
return ret;
}
@@ -2221,7 +2304,112 @@ index c31fcff..fc294ae 100644
char *
cp_class_name_from_physname (const char *physname)
-@@ -840,9 +841,9 @@ read_in_psymtabs (const char *func_name)
+@@ -711,6 +712,82 @@ make_symbol_overload_list (const char *func_name,
+
+ return sym_return_val;
+ }
++/* Adds the function FUNC_NAME from NAMESPACE to the overload set. */
++
++static void
++make_symbol_overload_list_namespace (const char *func_name,
++ const char *namespace)
++{
++
++ if (namespace[0] == '\0')
++ {
++ make_symbol_overload_list_qualified (func_name);
++ }
++ else
++ {
++ char *concatenated_name
++ = alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
++ strcpy (concatenated_name, namespace);
++ strcat (concatenated_name, "::");
++ strcat (concatenated_name, func_name);
++ make_symbol_overload_list_qualified (concatenated_name);
++ }
++}
++
++/* Search the namespace of the given type and namespace of and public base
++ types. */
++static void make_symbol_overload_list_adl_namespace (struct type *type,
++ const char *func_name)
++{
++ char *namespace;
++ char *type_name;
++ int i, prefix_len;
++
++ if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_CODE (type) == TYPE_CODE_REF
++ || TYPE_CODE (type) == TYPE_CODE_ARRAY)
++ return make_symbol_overload_list_adl_namespace (TYPE_TARGET_TYPE (type),
++ func_name);
++
++ type_name = TYPE_NAME (type);
++
++ prefix_len = cp_entire_prefix_len (type_name);
++
++ if (prefix_len != 0)
++ {
++ namespace = alloca (prefix_len + 1);
++ strncpy (namespace, type_name, prefix_len);
++ namespace[prefix_len] = '\0';
++
++ make_symbol_overload_list_namespace (func_name, namespace);
++ }
++
++ /* Check public base type */
++ if (TYPE_CODE(type) == TYPE_CODE_CLASS)
++ for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
++ {
++ if (BASETYPE_VIA_PUBLIC (type, i))
++ make_symbol_overload_list_adl_namespace (TYPE_BASECLASS (type, i),
++ func_name);
++ }
++
++}
++
++/* Adds the the overload list overload candidates for FUNC_NAME found through
++ argument dependent lookup. */
++
++struct symbol **
++make_symbol_overload_list_adl (struct type **arg_types, int nargs,
++ const char *func_name)
++{
++ int i;
++
++ gdb_assert (sym_return_val_size != -1);
++
++ for (i = 1; i <= nargs; i++)
++ make_symbol_overload_list_adl_namespace (arg_types[i - 1], func_name);
++
++ return sym_return_val;
++}
+
+ /* This applies the using directives to add namespaces to search in,
+ and then searches for overloads in all of those namespaces. It
+@@ -739,20 +816,7 @@ make_symbol_overload_list_using (const char *func_name,
+ }
+
+ /* Now, add names for this namespace. */
+-
+- if (namespace[0] == '\0')
+- {
+- make_symbol_overload_list_qualified (func_name);
+- }
+- else
+- {
+- char *concatenated_name
+- = alloca (strlen (namespace) + 2 + strlen (func_name) + 1);
+- strcpy (concatenated_name, namespace);
+- strcat (concatenated_name, "::");
+- strcat (concatenated_name, func_name);
+- make_symbol_overload_list_qualified (concatenated_name);
+- }
++ make_symbol_overload_list_namespace (func_name, namespace);
+ }
+
+ /* This does the bulk of the work of finding overloaded symbols.
+@@ -840,9 +904,9 @@ read_in_psymtabs (const char *func_name)
if (ps->readin)
continue;
@@ -2234,43 +2422,41 @@ index c31fcff..fc294ae 100644
psymtab_to_symtab (ps);
}
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
-index 33b1b44..50f8fe9 100644
+index a6a9af1..57aa5e5 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
-@@ -38,14 +38,29 @@ struct demangle_component;
+@@ -38,20 +38,24 @@ struct demangle_component;
/* This struct is designed to store data from using directives. It
says that names from namespace IMPORT_SRC should be visible within
-- namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
-- substring of IMPORT_SRC. These form a linked list; NEXT is the next element
-- of the list. */
-+ namespace IMPORT_DEST. IMPORT_DEST should always be a strict initial
-+ substring of IMPORT_SRC. These form a linked list; NEXT is the next
+- namespace IMPORT_DEST. These form a linked list; NEXT is the next element
+- of the list. If the imported namespace has been aliased, ALIAS is set to a
+- string representing the alias. Otherwise, ALIAS is NULL.
+- Eg:
+- namespace C = A::B;
++ namespace IMPORT_DEST. These form a linked list; NEXT is the next
+ element of the list. ALIAS is set to a non empty string if the imported
+ namespace has been aliased.Eg:
+ namespace C=A::B;
-+ ALIAS = "C"
+ ALIAS = "C"
+ DECLARATION is the name of the imported declaration, if this import
+ statement represents one. Eg:
+ using A::x;
+ Where x is variable in namespace A. declaration is set to x.
-+*/
+ */
struct using_direct
{
char *import_src;
char *import_dest;
-+
-+ char *alias;
-+
+-
+ char *alias;
+ char *declaration;
-+
+ int line_number;
-+
+
struct using_direct *next;
- /* Used during import search to temporarily mark this node as searched. */
-@@ -57,6 +72,7 @@ struct using_direct
+@@ -64,6 +68,7 @@ struct using_direct
extern char *cp_canonicalize_string (const char *string);
@@ -2278,25 +2464,35 @@ index 33b1b44..50f8fe9 100644
extern char *cp_class_name_from_physname (const char *physname);
extern char *method_name_from_physname (const char *physname);
-@@ -82,10 +98,16 @@ extern int cp_validate_operator (const char *input);
- extern int cp_is_anonymous (const char *namespace);
+@@ -79,6 +84,10 @@ extern char *cp_remove_params (const char *demangled_name);
+ extern struct symbol **make_symbol_overload_list (const char *,
+ const char *);
+
++extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types,
++ int nargs,
++ const char *func_name);
++
+ extern struct type *cp_lookup_rtti_type (const char *name,
+ struct block *block);
+
+@@ -90,11 +99,15 @@ extern int cp_is_anonymous (const char *namespace);
extern void cp_add_using_directive (const char *dest,
-- const char *src);
-+ const char *src,
+ const char *src,
+- const char *alias);
+ const char *alias,
+ const char *declaration,
+ const int line_number);
extern struct using_direct *cp_add_using (const char *dest,
const char *src,
-+ const char *alias,
+ const char *alias,
+ const char *declaration,
+ const int line_number,
struct using_direct *next);
extern void cp_initialize_namespace (void);
-@@ -102,16 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol,
+@@ -111,16 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol,
extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol);
extern struct symbol *cp_lookup_symbol_nonlocal (const char *name,
@@ -2324,7 +2520,7 @@ index 33b1b44..50f8fe9 100644
extern struct type *cp_lookup_nested_type (struct type *parent_type,
const char *nested_name,
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
-index 6ef6767..5f4825c 100644
+index c9a5754..fc33da2 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -3565,6 +3565,7 @@ static struct sym_fns aout_sym_fns =
@@ -2336,7 +2532,7 @@ index 6ef6767..5f4825c 100644
default_symfile_offsets, /* sym_offsets: parse user's offsets to
internal form */
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
-index 2145f2b..84cadd4 100644
+index 0e3e093..661ba18 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1157,6 +1157,16 @@ for remote debugging.
@@ -2356,7 +2552,7 @@ index 2145f2b..84cadd4 100644
@c resolve the situation of these eventually
@item -tui
@cindex @code{--tui}
-@@ -19206,7 +19216,7 @@ using the @code{script-extension} setting.
+@@ -19215,7 +19225,7 @@ using the @code{script-extension} setting.
@table @code
@kindex source
@cindex execute commands from a file
@@ -2365,7 +2561,7 @@ index 2145f2b..84cadd4 100644
Execute the command file @var{filename}.
@end table
-@@ -19484,8 +19494,6 @@ containing @code{end}. For example:
+@@ -19493,8 +19503,6 @@ containing @code{end}. For example:
@smallexample
(@value{GDBP}) python
@@ -2374,7 +2570,7 @@ index 2145f2b..84cadd4 100644
>print 23
>end
23
-@@ -19498,6 +19506,14 @@ in a Python script. This can be controlled using @code{maint set
+@@ -19507,6 +19515,14 @@ in a Python script. This can be controlled using @code{maint set
python print-stack}: if @code{on}, the default, then Python stack
printing is enabled; if @code{off}, then Python stack printing is
disabled.
@@ -2389,7 +2585,7 @@ index 2145f2b..84cadd4 100644
@end table
It is also possible to execute a Python script from the @value{GDBN}
-@@ -19519,6 +19535,14 @@ and thus is always available.
+@@ -19528,6 +19544,14 @@ and thus is always available.
@cindex python api
@cindex programming in python
@@ -2404,7 +2600,7 @@ index 2145f2b..84cadd4 100644
@cindex python stdout
@cindex python pagination
At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
-@@ -19531,13 +19555,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
+@@ -19540,13 +19564,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
* Basic Python:: Basic Python Functions.
* Exception Handling::
* Auto-loading:: Automatically loading Python code.
@@ -2423,7 +2619,7 @@ index 2145f2b..84cadd4 100644
* Frames In Python:: Acessing inferior stack frames from Python.
* Lazy Strings In Python:: Python representation of lazy strings.
@end menu
-@@ -19565,6 +19593,12 @@ command as having originated from the user invoking it interactively.
+@@ -19574,6 +19602,12 @@ command as having originated from the user invoking it interactively.
It must be a boolean value. If omitted, it defaults to @code{False}.
@end defun
@@ -2436,7 +2632,7 @@ index 2145f2b..84cadd4 100644
@findex gdb.parameter
@defun parameter parameter
Return the value of a @value{GDBN} parameter. @var{parameter} is a
-@@ -19581,6 +19615,7 @@ a Python value of the appropriate type, and returned.
+@@ -19590,6 +19624,7 @@ a Python value of the appropriate type, and returned.
@defun history number
Return a value from @value{GDBN}'s value history (@pxref{Value
History}). @var{number} indicates which history element to return.
@@ -2444,7 +2640,7 @@ index 2145f2b..84cadd4 100644
If @var{number} is negative, then @value{GDBN} will take its absolute value
and count backward from the last element (i.e., the most recent element) to
find the value to return. If @var{number} is zero, then @value{GDBN} will
-@@ -19605,6 +19640,21 @@ compute values, for example, it is the only way to get the value of a
+@@ -19614,6 +19649,21 @@ compute values, for example, it is the only way to get the value of a
convenience variable (@pxref{Convenience Vars}) as a @code{gdb.Value}.
@end defun
@@ -2466,7 +2662,7 @@ index 2145f2b..84cadd4 100644
@findex gdb.write
@defun write string
Print a string to @value{GDBN}'s paginated standard output stream.
-@@ -19619,6 +19669,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing
+@@ -19628,6 +19678,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing
function.
@end defun
@@ -2478,7 +2674,7 @@ index 2145f2b..84cadd4 100644
@node Exception Handling
@subsubsection Exception Handling
@cindex python exceptions
-@@ -19857,6 +19912,9 @@ module:
+@@ -19866,6 +19921,9 @@ module:
This function looks up a type by name. @var{name} is the name of the
type to look up. It must be a string.
@@ -2488,7 +2684,7 @@ index 2145f2b..84cadd4 100644
Ordinarily, this function will return an instance of @code{gdb.Type}.
If the named type cannot be found, it will throw an exception.
@end defun
-@@ -19979,7 +20037,7 @@ If the type does not have a target, this method will throw an
+@@ -19988,7 +20046,7 @@ If the type does not have a target, this method will throw an
exception.
@end defmethod
@@ -2497,7 +2693,7 @@ index 2145f2b..84cadd4 100644
If this @code{gdb.Type} is an instantiation of a template, this will
return a new @code{gdb.Type} which represents the type of the
@var{n}th template argument.
-@@ -19987,7 +20045,8 @@ return a new @code{gdb.Type} which represents the type of the
+@@ -19996,7 +20054,8 @@ return a new @code{gdb.Type} which represents the type of the
If this @code{gdb.Type} is not a template type, this will throw an
exception. Ordinarily, only C@t{++} code will have template types.
@@ -2507,7 +2703,7 @@ index 2145f2b..84cadd4 100644
@end defmethod
@end table
-@@ -20341,6 +20400,121 @@ import gdb.libstdcxx.v6
+@@ -20350,6 +20409,121 @@ import gdb.libstdcxx.v6
gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
@end smallexample
@@ -2629,7 +2825,7 @@ index 2145f2b..84cadd4 100644
@node Commands In Python
@subsubsection Commands In Python
-@@ -20593,6 +20767,135 @@ registration of the command with @value{GDBN}. Depending on how the
+@@ -20602,6 +20776,135 @@ registration of the command with @value{GDBN}. Depending on how the
Python code is read into @value{GDBN}, you may need to import the
@code{gdb} module explicitly.
@@ -2765,7 +2961,7 @@ index 2145f2b..84cadd4 100644
@node Functions In Python
@subsubsection Writing new convenience functions
-@@ -20697,6 +21000,82 @@ which is used to format the value. @xref{Pretty Printing}, for more
+@@ -20706,6 +21009,82 @@ which is used to format the value. @xref{Pretty Printing}, for more
information.
@end defivar
@@ -2848,7 +3044,7 @@ index 2145f2b..84cadd4 100644
@node Frames In Python
@subsubsection Acessing inferior stack frames from Python.
-@@ -20761,6 +21140,14 @@ function to a string.
+@@ -20770,6 +21149,14 @@ function to a string.
Returns the frame's resume address.
@end defmethod
@@ -2863,7 +3059,7 @@ index 2145f2b..84cadd4 100644
@defmethod Frame older
Return the frame that called this frame.
@end defmethod
-@@ -20769,10 +21156,18 @@ Return the frame that called this frame.
+@@ -20778,10 +21165,18 @@ Return the frame that called this frame.
Return the frame called by this frame.
@end defmethod
@@ -2883,7 +3079,7 @@ index 2145f2b..84cadd4 100644
@node Lazy Strings In Python
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
-index 347c860..5d7002e 100644
+index 7741855..df3fc87 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -2107,6 +2107,18 @@ time, and so we attempt to handle symbols incrementally. For instance,
@@ -3089,10 +3285,23 @@ index 437ca39..f7fce92 100644
/* The current depth of dwarf expression recursion, via DW_OP_call*,
DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
-index 6679d74..54d2bae 100644
+index 1c4d057..20dcacd 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
-@@ -121,6 +121,9 @@ struct dwarf_expr_baton
+@@ -46,6 +46,12 @@ static void
+ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
+ gdb_byte **start, size_t *length);
+
++static struct value *dwarf2_evaluate_loc_desc (struct type *type,
++ struct frame_info *frame,
++ gdb_byte *data,
++ unsigned short size,
++ struct dwarf2_per_cu_data *per_cu);
++
+ /* A helper function for dealing with location lists. Given a
+ symbol baton (BATON) and a pc value (PC), find the appropriate
+ location expression, set *LOCEXPR_LENGTH, and return a pointer
+@@ -121,6 +127,9 @@ struct dwarf_expr_baton
{
struct frame_info *frame;
struct objfile *objfile;
@@ -3102,7 +3311,7 @@ index 6679d74..54d2bae 100644
};
/* Helper functions for dwarf2_evaluate_loc_desc. */
-@@ -189,22 +192,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
+@@ -189,22 +198,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
symbaton = SYMBOL_LOCATION_BATON (framefunc);
*start = find_location_expression (symbaton, length, pc);
}
@@ -3145,7 +3354,7 @@ index 6679d74..54d2bae 100644
}
/* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for
-@@ -227,6 +241,129 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
+@@ -227,6 +247,155 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
return target_translate_tls_address (debaton->objfile, offset);
}
@@ -3271,11 +3480,43 @@ index 6679d74..54d2bae 100644
+
+ return retval;
+}
++
++/* 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);
++ gdb_byte *data;
++ size_t size;
++ struct value *val;
++
++ data = 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;
++}
+
struct piece_closure
{
/* The number of pieces used to describe this variable. */
-@@ -408,9 +545,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+@@ -401,48 +570,31 @@ static struct lval_funcs pieced_value_funcs = {
+ SIZE, to find the current location of variable VAR in the context
+ of FRAME. */
+ static struct value *
+-dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
++dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
+ gdb_byte *data, unsigned short size,
struct dwarf2_per_cu_data *per_cu)
{
struct value *retval;
@@ -3286,7 +3527,10 @@ index 6679d74..54d2bae 100644
if (size == 0)
{
-@@ -420,22 +556,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+- retval = allocate_value (SYMBOL_TYPE (var));
++ retval = allocate_value (type);
+ VALUE_LVAL (retval) = not_lval;
+ set_value_optimized_out (retval, 1);
return retval;
}
@@ -3310,19 +3554,88 @@ index 6679d74..54d2bae 100644
if (ctx->num_pieces > 0)
{
struct piece_closure *c;
-@@ -465,6 +587,11 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ struct frame_id frame_id = get_frame_id (frame);
+
+ c = allocate_piece_closure (ctx->num_pieces, ctx->pieces, ctx->gdbarch);
+- retval = allocate_computed_value (SYMBOL_TYPE (var),
+- &pieced_value_funcs,
+- c);
++ retval = allocate_computed_value (type, &pieced_value_funcs, c);
+ VALUE_FRAME_ID (retval) = frame_id;
+ }
+ else
+@@ -454,7 +606,7 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ struct gdbarch *arch = get_frame_arch (frame);
+ CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
+- retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
++ retval = value_from_register (type, gdb_regnum, frame);
+ }
+ break;
+
+@@ -463,7 +615,12 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
+- retval = allocate_value (SYMBOL_TYPE (var));
+ /* 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 = allocate_value (SYMBOL_TYPE (var));
++ retval = allocate_value (type);
VALUE_LVAL (retval) = lval_memory;
set_value_lazy (retval, 1);
-@@ -872,7 +999,7 @@ static int
+ if (in_stack_memory)
+@@ -478,10 +635,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ bfd_byte *contents;
+ size_t n = ctx->addr_size;
+
+- retval = allocate_value (SYMBOL_TYPE (var));
++ retval = allocate_value (type);
+ contents = value_contents_raw (retval);
+- if (n > TYPE_LENGTH (SYMBOL_TYPE (var)))
+- n = TYPE_LENGTH (SYMBOL_TYPE (var));
++ if (n > TYPE_LENGTH (type))
++ n = TYPE_LENGTH (type);
+ store_unsigned_integer (contents, n,
+ gdbarch_byte_order (ctx->gdbarch),
+ value);
+@@ -493,10 +650,10 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+ bfd_byte *contents;
+ size_t n = ctx->len;
+
+- retval = allocate_value (SYMBOL_TYPE (var));
++ retval = allocate_value (type);
+ contents = value_contents_raw (retval);
+- if (n > TYPE_LENGTH (SYMBOL_TYPE (var)))
+- n = TYPE_LENGTH (SYMBOL_TYPE (var));
++ if (n > TYPE_LENGTH (type))
++ n = TYPE_LENGTH (type);
+ memcpy (contents, ctx->data, n);
+ }
+ break;
+@@ -720,8 +877,8 @@ locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
+ {
+ struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
+ struct value *val;
+- val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
+- dlbaton->per_cu);
++ val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, dlbaton->data,
++ dlbaton->size, dlbaton->per_cu);
+
+ return val;
+ }
+@@ -844,7 +1001,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
+ set_value_optimized_out (val, 1);
+ }
+ else
+- val = dwarf2_evaluate_loc_desc (symbol, frame, data, size,
++ val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
+ dlbaton->per_cu);
+
+ return val;
+@@ -868,7 +1025,7 @@ static int
loclist_describe_location (struct symbol *symbol, struct ui_file *stream)
{
/* FIXME: Could print the entire list of locations. */
@@ -3331,7 +3644,7 @@ index 6679d74..54d2bae 100644
return 1;
}
-@@ -888,16 +1015,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
+@@ -884,16 +1041,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
data = find_location_expression (dlbaton, &size, ax->scope);
if (data == NULL)
@@ -3392,10 +3705,10 @@ index 6679d74..54d2bae 100644
+ missing_tracepoint_var_ref
+};
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
-index fa0bd11..fdea2b4 100644
+index fa0bd11..3535c1f 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
-@@ -72,5 +72,11 @@ struct dwarf2_loclist_baton
+@@ -72,5 +72,14 @@ struct dwarf2_loclist_baton
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
extern const struct symbol_computed_ops dwarf2_loclist_funcs;
@@ -3405,13 +3718,16 @@ index fa0bd11..fdea2b4 100644
+
+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);
#endif /* dwarf2loc.h */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 86bfecb..ddf2189 100644
+index a05c946..9452844 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
-@@ -48,6 +48,11 @@
+@@ -48,6 +48,10 @@
#include "gdbcmd.h"
#include "block.h"
#include "addrmap.h"
@@ -3419,11 +3735,10 @@ index 86bfecb..ddf2189 100644
+#include "f-lang.h"
+#include "typeprint.h"
+#include "jv-lang.h"
-+#include "vec.h"
#include
#include "gdb_string.h"
-@@ -96,7 +101,7 @@ typedef struct pubnames_header
+@@ -96,7 +100,7 @@ typedef struct pubnames_header
_PUBNAMES_HEADER;
#define _ACTUAL_PUBNAMES_HEADER_SIZE 13
@@ -3432,7 +3747,7 @@ index 86bfecb..ddf2189 100644
Because of alignment constraints, this structure has padding and cannot
be mapped directly onto the beginning of the .debug_info section. */
typedef struct aranges_header
-@@ -153,7 +158,10 @@ struct dwarf2_section_info
+@@ -153,7 +157,10 @@ struct dwarf2_section_info
asection *asection;
gdb_byte *buffer;
bfd_size_type size;
@@ -3444,7 +3759,7 @@ index 86bfecb..ddf2189 100644
};
struct dwarf2_per_objfile
-@@ -333,6 +341,19 @@ struct dwarf2_cu
+@@ -333,6 +340,19 @@ struct dwarf2_cu
DIEs for namespaces, we don't need to try to infer them
from mangled names. */
unsigned int has_namespace_info : 1;
@@ -3464,7 +3779,7 @@ index 86bfecb..ddf2189 100644
};
/* Persistent data held for a compilation unit, even when not
-@@ -487,8 +508,7 @@ struct partial_die_info
+@@ -487,8 +507,7 @@ struct partial_die_info
unsigned int has_byte_size : 1;
/* The name of this DIE. Normally the value of DW_AT_name, but
@@ -3474,31 +3789,17 @@ index 86bfecb..ddf2189 100644
char *name;
/* The scope to prepend to our children. This is generally
-@@ -677,6 +697,11 @@ struct field_info
- int nfnfields;
- };
-
-+/* A vector used during linkage name generation. */
-+typedef struct die_info *die_info_p;
-+DEF_VEC_P (die_info_p);
-+static VEC(die_info_p) *die_list;
-+
- /* One item on the queue of compilation units to read in full symbols
- for. */
- struct dwarf2_queue_item
-@@ -788,7 +813,10 @@ static void scan_partial_symbols (struct partial_die_info *,
+@@ -788,7 +807,8 @@ static void scan_partial_symbols (struct partial_die_info *,
static void add_partial_symbol (struct partial_die_info *,
struct dwarf2_cu *);
-static int pdi_needs_namespace (enum dwarf_tag tag);
+static gdb_byte *read_comp_unit_head (struct comp_unit_head *, gdb_byte *,
+ bfd *);
-+
-+static int die_needs_namespace (struct die_info *, struct dwarf2_cu *);
static void add_partial_namespace (struct partial_die_info *pdi,
CORE_ADDR *lowpc, CORE_ADDR *highpc,
-@@ -813,6 +841,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
+@@ -813,6 +833,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
static void psymtab_to_symtab_1 (struct partial_symtab *);
@@ -3509,19 +3810,7 @@ index 86bfecb..ddf2189 100644
static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu);
static void dwarf2_free_abbrev_table (void *);
-@@ -940,6 +972,11 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *);
-
- static struct type *read_type_die (struct die_info *, struct dwarf2_cu *);
-
-+static char *physname_prefix (struct die_info *die, struct dwarf2_cu *);
-+
-+static void physname_prefix_1 (struct ui_file *, struct die_info *,
-+ struct dwarf2_cu *);
-+
- static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
-
- static char *typename_concat (struct obstack *,
-@@ -984,17 +1021,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *,
+@@ -984,17 +1008,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *,
static void process_structure_scope (struct die_info *, struct dwarf2_cu *);
@@ -3550,19 +3839,27 @@ index 86bfecb..ddf2189 100644
static const char *namespace_name (struct die_info *die,
int *is_anonymous, struct dwarf2_cu *);
-@@ -1028,7 +1073,10 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader,
+@@ -1028,7 +1060,8 @@ static gdb_byte *read_full_die (const struct die_reader_specs *reader,
static void process_die (struct die_info *, struct dwarf2_cu *);
-static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *);
-+static char *dwarf2_physname (struct die_info *, struct dwarf2_cu *);
-+
+static char *fortran_module_linkage_name (struct die_info *die,
+ struct dwarf2_cu *cu);
static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
struct obstack *);
-@@ -1144,6 +1192,9 @@ static void age_cached_comp_units (void);
+@@ -1114,6 +1147,9 @@ static int attr_form_is_section_offset (struct attribute *);
+
+ static int attr_form_is_constant (struct attribute *);
+
++static struct dwarf2_loclist_baton *dwarf2_attr_to_loclist_baton
++ (struct attribute *attr, struct dwarf2_cu *cu);
++
+ static void dwarf2_symbol_mark_computed (struct attribute *attr,
+ struct symbol *sym,
+ struct dwarf2_cu *cu);
+@@ -1144,6 +1180,9 @@ static void age_cached_comp_units (void);
static void free_one_cached_comp_unit (void *);
@@ -3572,7 +3869,7 @@ index 86bfecb..ddf2189 100644
static struct type *set_die_type (struct die_info *, struct type *,
struct dwarf2_cu *);
-@@ -1163,22 +1214,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
+@@ -1163,22 +1202,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
@@ -3613,7 +3910,7 @@ index 86bfecb..ddf2189 100644
}
/* When loading sections, we can either look for ".", or for
-@@ -1271,10 +1331,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
+@@ -1271,10 +1319,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
}
/* Decompress a section that was compressed using zlib. Store the
@@ -3629,7 +3926,7 @@ index 86bfecb..ddf2189 100644
gdb_byte **outbuf, bfd_size_type *outsize)
{
bfd *abfd = objfile->obfd;
-@@ -1291,6 +1354,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1291,6 +1342,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
z_stream strm;
int rc;
int header_size = 12;
@@ -3637,7 +3934,7 @@ index 86bfecb..ddf2189 100644
if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
|| bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size)
-@@ -1320,8 +1384,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1320,8 +1372,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
strm.avail_in = compressed_size - header_size;
strm.next_in = (Bytef*) compressed_buffer + header_size;
strm.avail_out = uncompressed_size;
@@ -3653,7 +3950,7 @@ index 86bfecb..ddf2189 100644
rc = inflateInit (&strm);
while (strm.avail_in > 0)
{
-@@ -1342,26 +1411,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
+@@ -1342,26 +1399,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp,
error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"),
bfd_get_filename (abfd), rc);
@@ -3835,7 +4132,7 @@ index 86bfecb..ddf2189 100644
if (info->asection == NULL || info->size == 0)
return;
-@@ -1374,7 +1593,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1374,7 +1581,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
/* Upon decompression, update the buffer and its size. */
if (strncmp (header, "ZLIB", sizeof (header)) == 0)
{
@@ -3844,7 +4141,7 @@ index 86bfecb..ddf2189 100644
&info->size);
return;
}
-@@ -1397,7 +1616,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1397,7 +1604,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
if (retbuf != MAP_FAILED)
{
@@ -3853,7 +4150,7 @@ index 86bfecb..ddf2189 100644
info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ;
return;
}
-@@ -1405,8 +1624,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1405,8 +1612,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
#endif
/* If we get here, we are a normal, not-compressed section. */
@@ -3871,8 +4168,8 @@ index 86bfecb..ddf2189 100644
/* When debugging .o files, we may need to apply relocations; see
http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html .
-@@ -1415,6 +1641,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
- retbuf = symfile_relocate_debug_section (abfd, sectp, buf);
+@@ -1415,6 +1629,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+ retbuf = symfile_relocate_debug_section (objfile, sectp, buf);
if (retbuf != NULL)
{
+ if (old)
@@ -3880,7 +4177,7 @@ index 86bfecb..ddf2189 100644
info->buffer = retbuf;
return;
}
-@@ -1423,6 +1651,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+@@ -1423,6 +1639,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
|| bfd_bread (buf, info->size, abfd) != info->size)
error (_("Dwarf Error: Can't read DWARF data from '%s'"),
bfd_get_filename (abfd));
@@ -3900,7 +4197,62 @@ index 86bfecb..ddf2189 100644
}
/* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and
-@@ -2389,11 +2630,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+@@ -2070,6 +2299,29 @@ build_type_psymtabs (struct objfile *objfile)
+ process_type_comp_unit, objfile);
+ }
+
++/* A cleanup function that clears an objfile's psymtabs. There are
++ two cases to consider. If we are reading symbols directly, then on
++ a failure the objfile will be destroyed. In this case, clearing
++ the psymtabs is fine -- a little wasted time, but nothing serious.
++ If we are reading symbols lazily, then it is too late to destroy
++ the objfile. Instead we just make it look like the objfile has no
++ psymtabs. */
++
++static void
++do_clear_psymtabs (void *arg)
++{
++ struct objfile *objfile = arg;
++
++ objfile->psymtabs_addrmap = NULL;
++ objfile->psymtabs = NULL;
++ bcache_xfree (objfile->psymbol_cache);
++ objfile->psymbol_cache = bcache_xmalloc ();
++ xfree (objfile->global_psymbols.list);
++ memset (&objfile->global_psymbols, 0, sizeof (objfile->global_psymbols));
++ xfree (objfile->static_psymbols.list);
++ memset (&objfile->static_psymbols, 0, sizeof (objfile->static_psymbols));
++}
++
+ /* Build the partial symbol table by doing a quick pass through the
+ .debug_info and .debug_abbrev sections. */
+
+@@ -2080,7 +2332,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+ mmap() on architectures that support it. (FIXME) */
+ bfd *abfd = objfile->obfd;
+ gdb_byte *info_ptr;
+- struct cleanup *back_to;
++ struct cleanup *back_to, *clear_psymtabs;
+
+ info_ptr = dwarf2_per_objfile->info.buffer;
+
+@@ -2094,6 +2346,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+
+ objfile->psymtabs_addrmap =
+ addrmap_create_mutable (&objfile->objfile_obstack);
++ clear_psymtabs = make_cleanup (do_clear_psymtabs, objfile);
+
+ /* Since the objects we're extracting from .debug_info vary in
+ length, only the individual functions to extract them (like
+@@ -2123,6 +2376,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile)
+ dwarf2_per_objfile->info.size);
+ }
+
++ discard_cleanups (clear_psymtabs);
+ objfile->psymtabs_addrmap = addrmap_create_fixed (objfile->psymtabs_addrmap,
+ &objfile->objfile_obstack);
+
+@@ -2389,11 +2643,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|| parent->tag == DW_TAG_union_type
|| parent->tag == DW_TAG_enumeration_type)
{
@@ -3921,7 +4273,7 @@ index 86bfecb..ddf2189 100644
}
else if (parent->tag == DW_TAG_enumerator)
/* Enumerators should not get the name of the enumeration as a prefix. */
-@@ -2405,7 +2653,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+@@ -2405,7 +2666,7 @@ partial_die_parent_scope (struct partial_die_info *pdi,
ignoring them. */
complaint (&symfile_complaints,
_("unhandled containing DIE tag %d for DIE at %d"),
@@ -3930,7 +4282,7 @@ index 86bfecb..ddf2189 100644
parent->scope = grandparent_scope;
}
-@@ -2420,12 +2668,22 @@ partial_die_full_name (struct partial_die_info *pdi,
+@@ -2420,12 +2681,22 @@ partial_die_full_name (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
{
char *parent_scope;
@@ -3957,7 +4309,7 @@ index 86bfecb..ddf2189 100644
}
static void
-@@ -2441,12 +2699,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2441,12 +2712,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -3973,7 +4325,7 @@ index 86bfecb..ddf2189 100644
if (actual_name == NULL)
actual_name = pdi->name;
-@@ -2543,6 +2798,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2543,6 +2811,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
&objfile->global_psymbols,
0, (CORE_ADDR) 0, cu->language, objfile);
break;
@@ -3987,7 +4339,7 @@ index 86bfecb..ddf2189 100644
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
-@@ -2586,34 +2848,17 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
+@@ -2586,49 +2861,10 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
break;
}
@@ -4014,50 +4366,30 @@ index 86bfecb..ddf2189 100644
-/* Determine whether a die of type TAG living in a C++ class or
- namespace needs to have the name of the scope prepended to the
- name listed in the die. */
-+/* Determine whether DIE needs to have the name of the scope prepended
-+ to the name listed in the die. */
-
- static int
+-
+-static int
-pdi_needs_namespace (enum dwarf_tag tag)
-+die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
- {
+-{
- switch (tag)
-+ switch (die->tag)
- {
- case DW_TAG_namespace:
- case DW_TAG_typedef:
-@@ -2623,7 +2868,30 @@ pdi_needs_namespace (enum dwarf_tag tag)
- case DW_TAG_union_type:
- case DW_TAG_enumeration_type:
- case DW_TAG_enumerator:
-+ case DW_TAG_subprogram:
-+ case DW_TAG_member:
- return 1;
-+
-+ case DW_TAG_variable:
-+ {
-+ struct attribute *attr;
-+ attr = dwarf2_attr (die, DW_AT_specification, cu);
-+ if (attr)
-+ return 1;
-+ attr = dwarf2_attr (die, DW_AT_external, cu);
-+ if (attr == NULL && die->parent->tag != DW_TAG_namespace)
-+ return 0;
-+ /* A variable in a lexical block of some kind does not need a
-+ namespace, even though in C++ such variables may be
-+ external and have a mangled name. */
-+ if (die->parent->tag == DW_TAG_lexical_block
-+ || die->parent->tag == DW_TAG_try_block
-+ || die->parent->tag == DW_TAG_catch_block)
-+ return 0;
-+ return 1;
-+ }
-+ break;
-+
- default:
- return 0;
- }
-@@ -2656,12 +2924,12 @@ static void
+- {
+- case DW_TAG_namespace:
+- case DW_TAG_typedef:
+- case DW_TAG_class_type:
+- case DW_TAG_interface_type:
+- case DW_TAG_structure_type:
+- case DW_TAG_union_type:
+- case DW_TAG_enumeration_type:
+- case DW_TAG_enumerator:
+- return 1;
+- default:
+- return 0;
+- }
+-}
+-
+ /* Read a partial die corresponding to a namespace; also, add a symbol
+ corresponding to that namespace to the symbol table. NAMESPACE is
+ the name of the enclosing namespace. */
+@@ -2656,12 +2892,12 @@ static void
add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc,
CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu)
{
@@ -4074,7 +4406,15 @@ index 86bfecb..ddf2189 100644
}
/* Read a partial die corresponding to a subprogram and create a partial
-@@ -2752,27 +3020,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
+@@ -2739,7 +2975,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
+ could fix this by only using the demangled name to get the
+ prefix (but see comment in read_structure_type). */
+
+- struct partial_die_info *child_pdi = struct_pdi->die_child;
+ struct partial_die_info *real_pdi;
+
+ /* If this DIE (this DIE's specification, if any) has a parent, then
+@@ -2752,27 +2987,6 @@ guess_structure_name (struct partial_die_info *struct_pdi,
if (real_pdi->die_parent != NULL)
return;
@@ -4091,7 +4431,7 @@ index 86bfecb..ddf2189 100644
- struct_pdi->name
- = obsavestring (actual_class_name,
- strlen (actual_class_name),
-- &cu->comp_unit_obstack);
+- &cu->objfile->objfile_obstack);
- xfree (actual_class_name);
- }
- break;
@@ -4102,7 +4442,7 @@ index 86bfecb..ddf2189 100644
}
}
-@@ -3325,6 +3572,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3325,6 +3539,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_imported_declaration:
case DW_TAG_imported_module:
processing_has_namespace_info = 1;
@@ -4117,31 +4457,81 @@ index 86bfecb..ddf2189 100644
if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
|| cu->language != language_fortran))
complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
-@@ -3340,41 +3595,71 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
- /* 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
-- not have a name. */
-+ not have a name.
+@@ -3337,42 +3559,183 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+ }
+ }
+
++/* A helper function for dwarf2_compute_name which determines whether DIE
++ needs to have the name of the scope prepended to the name listed in the
++ die. */
+
-+ The output string will be canonicalized (if C++/Java). */
-
- static const char *
- dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
- {
-- struct attribute *attr;
-- char *prefix, *name;
-- struct ui_file *buf = NULL;
-+ char *name;
-
- name = dwarf2_name (die, cu);
-- if (!name)
-- return NULL;
-
- /* These are the only languages we know how to qualify names in. */
-- if (cu->language != language_cplus
-- && cu->language != language_java)
-- return name;
++static int
++die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
++{
++ switch (die->tag)
++ {
++ case DW_TAG_namespace:
++ case DW_TAG_typedef:
++ case DW_TAG_class_type:
++ case DW_TAG_interface_type:
++ case DW_TAG_structure_type:
++ case DW_TAG_union_type:
++ case DW_TAG_enumeration_type:
++ case DW_TAG_enumerator:
++ case DW_TAG_subprogram:
++ case DW_TAG_member:
++ return 1;
++
++ case DW_TAG_variable:
++ {
++ struct attribute *attr;
++
++ /* We only need to prefix "globally" visible variables. These include
++ any variable marked with DW_AT_external or any variable that
++ lives in a namespace. [Variables in anonymous namespaces
++ require prefixing, but they are not DW_AT_external.] */
++
++ if (dwarf2_attr (die, DW_AT_specification, cu))
++ {
++ struct dwarf2_cu *spec_cu = cu;
++ return die_needs_namespace (die_specification (die, &spec_cu),
++ spec_cu);
++ }
++
++ /* A variable in a lexical block of some kind does not need
++ a namespace, even though in C++ such variables may be
++ external and have a mangled name. */
++ if (die->parent->tag == DW_TAG_lexical_block
++ || die->parent->tag == DW_TAG_try_block
++ || die->parent->tag == DW_TAG_catch_block)
++ return 0;
++
++ attr = dwarf2_attr (die, DW_AT_external, cu);
++ if (attr || die->parent->tag == DW_TAG_namespace)
++ return 1;
++
++ return 0;
++ }
++
++ default:
++ return 0;
++ }
++}
++
++/* Compute the fully qualified name of DIE in CU. If PHYSNAME is nonzero,
++ compute the physname for the object, which include a method's
++ formal parameters (C++/Java) and return type (Java).
++
++ The result is allocated on the objfile_obstack and canonicalized. */
++
++static const char *
++dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
++ int physname)
++{
++ if (name == NULL)
++ name = dwarf2_name (die, cu);
++
++ /* These are the only languages we know how to qualify names in. */
+ if (name != NULL
+ && (cu->language == language_cplus || cu->language == language_java))
+ {
@@ -4150,17 +4540,9 @@ index 86bfecb..ddf2189 100644
+ long length;
+ char *prefix;
+ struct ui_file *buf;
-
-- /* If no prefix is necessary for this type of DIE, return the
-- unqualified name. The other three tags listed could be handled
-- in pdi_needs_namespace, but that requires broader changes. */
-- if (!pdi_needs_namespace (die->tag)
-- && die->tag != DW_TAG_subprogram
-- && die->tag != DW_TAG_variable
-- && die->tag != DW_TAG_member)
-- return name;
-+ buf = mem_fileopen ();
++
+ prefix = determine_prefix (die, cu);
++ buf = mem_fileopen ();
+ if (*prefix != '\0')
+ {
+ char *prefixed_name = typename_concat (NULL, prefix, name, cu);
@@ -4168,12 +4550,36 @@ index 86bfecb..ddf2189 100644
+ xfree (prefixed_name);
+ }
+ else
-+ fputs_unfiltered (name, buf);
-
-- prefix = determine_prefix (die, cu);
-- if (*prefix != '\0')
-- name = typename_concat (&cu->objfile->objfile_obstack, prefix,
-- name, cu);
++ fputs_unfiltered (name ? name : "", buf);
++
++ /* For Java and C++ methods, append formal parameter type
++ information, if PHYSNAME. */
++
++ if (physname && die->tag == DW_TAG_subprogram
++ && (cu->language == language_cplus
++ || cu->language == language_java))
++ {
++ struct type *type = read_type_die (die, cu);
++
++ c_type_print_args (type, buf, 0, cu->language);
++
++ if (cu->language == language_java)
++ {
++ /* For java, we must append the return type to method
++ names. */
++ if (die->tag == DW_TAG_subprogram)
++ java_print_type (TYPE_TARGET_TYPE (type), "", buf,
++ 0, 0);
++ }
++ else if (cu->language == language_cplus)
++ {
++ if (TYPE_NFIELDS (type) > 0
++ && TYPE_FIELD_ARTIFICIAL (type, 0)
++ && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
++ fputs_unfiltered (" const", buf);
++ }
++ }
++
+ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack,
+ &length);
+ ui_file_delete (buf);
@@ -4188,10 +4594,64 @@ index 86bfecb..ddf2189 100644
+ }
+ }
+ }
++
++ return 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
+- not have a name. */
++ not have a name. NAME may either be from a previous call to
++ dwarf2_name or NULL.
++
++ The output string will be canonicalized (if C++/Java). */
- return name;
- }
+ static const char *
+-dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu)
++dwarf2_full_name (char *name, struct die_info *die, struct dwarf2_cu *cu)
+ {
+- struct attribute *attr;
+- char *prefix, *name;
+- struct ui_file *buf = NULL;
++ return dwarf2_compute_name (name, die, cu, 0);
++}
+- name = dwarf2_name (die, cu);
+- if (!name)
+- return NULL;
++/* Construct a physname for the given DIE in CU. NAME may either be
++ from a previous call to dwarf2_name or NULL. The result will be
++ allocated on teh objfile_objstack or NULL if the DIE does not have a
++ name.
+
+- /* These are the only languages we know how to qualify names in. */
+- if (cu->language != language_cplus
+- && cu->language != language_java)
+- return name;
+-
+- /* If no prefix is necessary for this type of DIE, return the
+- unqualified name. The other three tags listed could be handled
+- in pdi_needs_namespace, but that requires broader changes. */
+- if (!pdi_needs_namespace (die->tag)
+- && die->tag != DW_TAG_subprogram
+- && die->tag != DW_TAG_variable
+- && die->tag != DW_TAG_member)
+- return name;
+-
+- prefix = determine_prefix (die, cu);
+- if (*prefix != '\0')
+- name = typename_concat (&cu->objfile->objfile_obstack, prefix,
+- name, cu);
++ The output string will be canonicalized (if C++/Java). */
+
+- return name;
++static const char *
++dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu)
++{
++ return dwarf2_compute_name (name, die, cu, 1);
++}
++
+/* Read the given DIE's DW_AT_decl_line number. Return -1 if in case of an
+ error. */
+
@@ -4205,15 +4665,15 @@ index 86bfecb..ddf2189 100644
+ return DW_UNSND (line_attr);
+
+ return -1;
-+}
-+
- /* Read the import statement specified by the given die and record it. */
+ }
- static void
-@@ -3385,9 +3670,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+ /* Read the import statement specified by the given die and record it. */
+@@ -3385,11 +3748,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_cu *imported_cu;
const char *imported_name;
const char *imported_name_prefix;
+- char *import_alias;
+-
- const char *import_prefix;
char *canonical_name;
-
@@ -4228,18 +4688,14 @@ index 86bfecb..ddf2189 100644
import_attr = dwarf2_attr (die, DW_AT_import, cu);
if (import_attr == NULL)
{
-@@ -3436,17 +3727,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
- return;
+@@ -3439,19 +3806,25 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
}
-- /* FIXME: dwarf2_name (die); for the local name after import. */
--
-- /* Figure out where the statement is being imported to. */
-+ /* Figure out the local name after import. */
+ /* Figure out the local name after import. */
+- import_alias = dwarf2_name (die, cu);
+ import_alias = dwarf2_name(die, cu);
-+ if(import_alias == NULL){
-+ import_alias = "";
-+ }
+
+- /* Figure out where the statement is being imported to. */
+
+ /* Determine the line number at which the import was made */
+ line_number = dwarf2_read_decl_line(die, cu);
@@ -4249,38 +4705,38 @@ index 86bfecb..ddf2189 100644
/* Figure out what the scope of the imported die is and prepend it
to the name of the imported die. */
-- imported_name_prefix = determine_prefix (imported_die, imported_cu);
+ imported_name_prefix = determine_prefix (imported_die, imported_cu);
-
- if (strlen (imported_name_prefix) > 0)
- {
-+ imported_name_prefix = determine_prefix (imported_die, cu);
+- canonical_name = alloca (strlen (imported_name_prefix)
+- + 2 + strlen (imported_name) + 1);
+
+ if(imported_die->tag != DW_TAG_namespace){
+ imported_declaration = imported_name;
+ canonical_name = (char*)imported_name_prefix;
+ }else{
+ if(strlen (imported_name_prefix) > 0){
- canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
++ canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
strcpy (canonical_name, imported_name_prefix);
strcat (canonical_name, "::");
-@@ -3457,8 +3758,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+ strcat (canonical_name, imported_name);
+@@ -3461,10 +3834,13 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
canonical_name = alloca (strlen (imported_name) + 1);
strcpy (canonical_name, imported_name);
}
-
-- using_directives = cp_add_using (import_prefix,canonical_name, using_directives);
+ }
+
-+ using_directives = cp_add_using (import_prefix,
-+ canonical_name,
-+ import_alias,
+ using_directives = cp_add_using (import_prefix,
+ canonical_name,
+ import_alias,
+ imported_declaration,
+ line_number,
-+ using_directives);
+ using_directives);
}
- static void
-@@ -3727,6 +4034,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3734,6 +4110,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *attr;
attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
@@ -4295,7 +4751,7 @@ index 86bfecb..ddf2189 100644
if (!attr)
return;
-@@ -3825,6 +4140,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3832,6 +4216,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
char *name;
CORE_ADDR baseaddr;
struct block *block;
@@ -4303,7 +4759,7 @@ index 86bfecb..ddf2189 100644
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
if (inlined_func)
-@@ -3843,13 +4159,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3850,13 +4235,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -4330,7 +4786,7 @@ index 86bfecb..ddf2189 100644
lowpc += baseaddr;
highpc += baseaddr;
-@@ -3876,14 +4202,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3883,14 +4278,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
cu->list_in_scope = &local_symbols;
@@ -4357,7 +4813,7 @@ index 86bfecb..ddf2189 100644
}
inherit_abstract_dies (die, cu);
-@@ -3899,6 +4230,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3906,6 +4306,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
determine_prefix (die, cu),
processing_has_namespace_info);
@@ -4371,31 +4827,31 @@ index 86bfecb..ddf2189 100644
/* If we have address ranges, record them. */
dwarf2_record_block_ranges (die, block, baseaddr, cu);
-@@ -4517,7 +4855,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
+@@ -4524,7 +4931,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
return;
/* Get physical name. */
- physname = dwarf2_linkage_name (die, cu);
-+ physname = dwarf2_physname (die, cu);
++ physname = (char *) dwarf2_physname (fieldname, die, cu);
/* The name is already allocated along with this objfile, so we don't
need to duplicate it for the type. */
-@@ -4679,7 +5017,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4686,7 +5093,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
return;
/* Get the mangled name. */
- physname = dwarf2_linkage_name (die, cu);
-+ physname = dwarf2_physname (die, cu);
++ physname = (char *) dwarf2_physname (fieldname, die, cu);
/* Look up member function name in fieldlist. */
for (i = 0; i < fip->nfnfields; i++)
-@@ -4986,14 +5324,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4993,14 +5400,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
if (cu->language == language_cplus
|| cu->language == language_java)
{
- const char *new_prefix = determine_class_name (die, cu);
- TYPE_TAG_NAME (type) = (char *) new_prefix;
-+ TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (die, cu);
++ TYPE_TAG_NAME (type) = (char *) dwarf2_full_name (name, die, cu);
+ if (die->tag == DW_TAG_structure_type
+ || die->tag == DW_TAG_class_type)
+ TYPE_NAME (type) = TYPE_TAG_NAME (type);
@@ -4411,7 +4867,16 @@ index 86bfecb..ddf2189 100644
}
}
-@@ -5237,51 +5579,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5219,7 +5630,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+ type = alloc_type (objfile);
+
+ TYPE_CODE (type) = TYPE_CODE_ENUM;
+- name = dwarf2_full_name (die, cu);
++ name = dwarf2_full_name (NULL, die, cu);
+ if (name != NULL)
+ TYPE_TAG_NAME (type) = (char *) name;
+
+@@ -5244,51 +5655,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
return set_die_type (die, type, cu);
}
@@ -4463,7 +4928,7 @@ index 86bfecb..ddf2189 100644
/* Given a pointer to a die which begins an enumeration, process all
the dies that define the members of the enumeration, and create the
symbol for the enumeration type.
-@@ -5359,6 +5656,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5366,6 +5732,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
new_symbol (die, this_type, cu);
}
@@ -4493,7 +4958,7 @@ index 86bfecb..ddf2189 100644
/* 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. */
-@@ -5372,7 +5692,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5379,7 +5768,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;
@@ -4502,7 +4967,7 @@ index 86bfecb..ddf2189 100644
struct cleanup *back_to;
char *name;
-@@ -5419,16 +5739,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5426,16 +5815,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
type = element_type;
if (read_array_order (die, cu) == DW_ORD_col_major)
@@ -4524,16 +4989,16 @@ index 86bfecb..ddf2189 100644
/* Understand Dwarf2 support for vector types (like they occur on
the PowerPC w/ AltiVec). Gcc just adds another attribute to the
-@@ -5617,7 +5932,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5624,7 +6008,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
if (is_anonymous)
{
const char *previous_prefix = determine_prefix (die, cu);
-- cp_add_using_directive (previous_prefix, TYPE_NAME (type));
-+ cp_add_using_directive (previous_prefix, TYPE_NAME (type), "", "", dwarf2_read_decl_line(die, cu));
+- cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL);
++ cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL, "", dwarf2_read_decl_line(die, cu));
}
}
-@@ -5633,20 +5948,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5640,20 +6024,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
}
}
@@ -4546,14 +5011,13 @@ index 86bfecb..ddf2189 100644
{
- struct die_info *child_die = die->child;
+ struct type *type;
-
-- /* FIXME: Support the separate Fortran module namespaces. */
++
+ type = read_module_type (die, cu);
+
+ if (type)
+ new_symbol (die, type, cu);
+}
-
++
+/* Read a Fortran module as type.
+
+ Modules present only as declarations - being used only for DW_AT_import of
@@ -4590,9 +5054,10 @@ index 86bfecb..ddf2189 100644
+ save_global_symbols = global_symbols;
+ global_symbols = NULL;
+ save_list_in_scope = cu->list_in_scope;
-+
+
+- /* FIXME: Support the separate Fortran module namespaces. */
+ /* Process the child DIEs. */
-+
+
+ child_die = die->child;
while (child_die && child_die->tag)
{
@@ -4692,7 +5157,7 @@ index 86bfecb..ddf2189 100644
}
/* Return the name of the namespace represented by DIE. Set
-@@ -5811,29 +6261,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5818,29 +6337,115 @@ 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;
@@ -4777,7 +5242,8 @@ index 86bfecb..ddf2189 100644
+ }
+ }
+
-+ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++ 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;
+ }
@@ -4801,7 +5267,8 @@ index 86bfecb..ddf2189 100644
- }
+ if (attr && attr_form_is_block (attr))
+ {
-+ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++ 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;
@@ -4820,7 +5287,7 @@ index 86bfecb..ddf2189 100644
char_type = language_string_char_type (cu->language_defn, gdbarch);
type = create_string_type (NULL, char_type, range_type);
-@@ -5933,7 +6467,6 @@ static struct type *
+@@ -5940,11 +6545,10 @@ static struct type *
read_typedef (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
@@ -4828,7 +5295,12 @@ index 86bfecb..ddf2189 100644
const char *name = NULL;
struct type *this_type;
-@@ -6041,8 +6574,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+- name = dwarf2_full_name (die, cu);
++ name = dwarf2_full_name (NULL, die, cu);
+ this_type = init_type (TYPE_CODE_TYPEDEF, 0,
+ TYPE_FLAG_TARGET_STUB, NULL, objfile);
+ TYPE_NAME (this_type) = (char *) name;
+@@ -6048,8 +6652,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
struct type *base_type;
struct type *range_type;
struct attribute *attr;
@@ -4838,7 +5310,7 @@ index 86bfecb..ddf2189 100644
char *name;
LONGEST negative_mask;
-@@ -6056,49 +6588,101 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -6063,49 +6666,157 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
0, NULL, cu->objfile);
}
@@ -4861,13 +5333,32 @@ index 86bfecb..ddf2189 100644
- low = dwarf2_get_attr_constant_value (attr, 0);
+ if (attr && attr_form_is_block (attr))
+ {
-+ TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++ 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 && is_ref_attr (attr))
++ {
++ 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))
@@ -4911,9 +5402,8 @@ index 86bfecb..ddf2189 100644
- the lower bound we've computed above. */
- high = low - 1;
- }
-- else
-- high = dwarf2_get_attr_constant_value (attr, 1);
-+ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr)))
++ if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr)
++ && !is_ref_attr (attr)))
+ {
+ attr = dwarf2_attr (die, DW_AT_count, cu);
+ /* It does not hurt but it is needlessly ineffective in check_typedef. */
@@ -4923,21 +5413,32 @@ index 86bfecb..ddf2189 100644
+ TYPE_DYNAMIC (range_type) = 1;
+ }
+ /* Pass it now as the regular DW_AT_upper_bound. */
- }
-
-- 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;
++ }
++
+ if (attr && attr_form_is_block (attr))
+ {
-+ TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type) = 1;
++ 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 && is_ref_attr (attr))
++ {
++ 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
+ {
+ if (attr && attr_form_is_constant (attr))
@@ -4949,23 +5450,49 @@ index 86bfecb..ddf2189 100644
+ high |= negative_mask;
+ TYPE_HIGH_BOUND (range_type) = high;
+ }
-+ else
+ else
+- high = dwarf2_get_attr_constant_value (attr, 1);
+ {
+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
+ TYPE_HIGH_BOUND (range_type) = low - 1;
+ }
-+ }
+ }
-- range_type = create_range_type (NULL, base_type, low, high);
+- 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;
+ /* 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))
+ {
-+ TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (range_type) = 1;
++ 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 && is_ref_attr (attr))
++ {
++ struct die_info *target_die;
++ struct dwarf2_cu *target_cu = cu;
++ struct attribute *target_loc_attr;
+
+- range_type = create_range_type (NULL, base_type, low, high);
++ 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);
@@ -4976,7 +5503,7 @@ index 86bfecb..ddf2189 100644
name = dwarf2_name (die, cu);
if (name)
-@@ -6557,6 +7141,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
+@@ -6564,6 +7275,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
&& abbrev->tag != DW_TAG_lexical_block
&& abbrev->tag != DW_TAG_variable
&& abbrev->tag != DW_TAG_namespace
@@ -4984,18 +5511,17 @@ index 86bfecb..ddf2189 100644
&& abbrev->tag != DW_TAG_member)
{
/* Otherwise we skip to the next sibling, if any. */
-@@ -6765,8 +7350,8 @@ read_partial_die (struct partial_die_info *part_die,
+@@ -6772,7 +7484,8 @@ read_partial_die (struct partial_die_info *part_die,
}
break;
case DW_AT_MIPS_linkage_name:
- part_die->name = DW_STRING (&attr);
-- break;
+ if (cu->language == language_ada)
+ part_die->name = DW_STRING (&attr);
+ break;
case DW_AT_low_pc:
has_low_pc_attr = 1;
- part_die->lowpc = DW_ADDR (&attr);
-@@ -6963,7 +7548,8 @@ fixup_partial_die (struct partial_die_info *part_die,
+@@ -6970,7 +7683,8 @@ fixup_partial_die (struct partial_die_info *part_die,
/* If we found a reference attribute and the DIE has no name, try
to find a name in the referred to DIE. */
@@ -5005,7 +5531,7 @@ index 86bfecb..ddf2189 100644
{
struct partial_die_info *spec_die;
-@@ -8305,10 +8891,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -8312,10 +9026,12 @@ 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
@@ -5020,7 +5546,7 @@ index 86bfecb..ddf2189 100644
}
/* Given a pointer to a DWARF information entry, figure out if we need
-@@ -8330,21 +8918,29 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8337,21 +9053,27 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
@@ -5041,13 +5567,10 @@ index 86bfecb..ddf2189 100644
+ /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */
+ SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs;
-- /* Cache this symbol's name and the name's demangled form (if any). */
+ /* Cache this symbol's name and the name's demangled form (if any). */
SYMBOL_LANGUAGE (sym) = cu->language;
- SYMBOL_SET_NAMES (sym, name, strlen (name), 0, objfile);
-+
-+ /* Cache this symbol's name and the name's demangled form (if any). */
-+
-+ linkagename = dwarf2_physname (die, cu);
++ linkagename = dwarf2_physname (name, die, cu);
+ SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
+ if (cu->language == language_fortran)
+ {
@@ -5057,7 +5580,7 @@ index 86bfecb..ddf2189 100644
/* Default assumptions.
Use the passed type or decode it from the die. */
-@@ -8444,7 +9040,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8451,7 +9173,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
var_decode_location (attr, sym, cu);
attr2 = dwarf2_attr (die, DW_AT_external, cu);
if (attr2 && (DW_UNSND (attr2) != 0))
@@ -5083,7 +5606,27 @@ index 86bfecb..ddf2189 100644
else
add_symbol_to_list (sym, cu->list_in_scope);
}
-@@ -8605,6 +9218,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8576,7 +9315,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+ }
+ break;
+ case DW_TAG_typedef:
+- SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
++ SYMBOL_LINKAGE_NAME (sym)
++ = (char *) dwarf2_full_name (name, die, cu);
+ SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
+ add_symbol_to_list (sym, cu->list_in_scope);
+@@ -8588,7 +9328,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+ add_symbol_to_list (sym, cu->list_in_scope);
+ break;
+ case DW_TAG_enumerator:
+- SYMBOL_LINKAGE_NAME (sym) = (char *) dwarf2_full_name (die, cu);
++ SYMBOL_LINKAGE_NAME (sym)
++ = (char *) dwarf2_full_name (name, die, cu);
+ attr = dwarf2_attr (die, DW_AT_const_value, cu);
+ if (attr)
+ {
+@@ -8612,6 +9353,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
add_symbol_to_list (sym, &global_symbols);
break;
@@ -5095,7 +5638,7 @@ index 86bfecb..ddf2189 100644
default:
/* Not a tag we recognize. Hopefully we aren't processing
trash data, but since we must specifically ignore things
-@@ -8618,8 +9236,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8625,8 +9371,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
/* For the benefit of old versions of GCC, check for anonymous
namespaces based on the demangled name. */
if (!processing_has_namespace_info
@@ -5105,7 +5648,7 @@ index 86bfecb..ddf2189 100644
cp_scan_for_anonymous_namespaces (sym);
}
return (sym);
-@@ -8931,12 +9548,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8938,12 +9683,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_namespace:
this_type = read_namespace_type (die, cu);
break;
@@ -5124,7 +5667,18 @@ index 86bfecb..ddf2189 100644
return this_type;
}
-@@ -9018,10 +9641,103 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+@@ -9011,6 +9762,10 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+ case DW_TAG_namespace:
+ parent_type = read_type_die (parent, cu);
+ /* We give a name to even anonymous namespaces. */
++
++ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
++ if (strcmp (TYPE_TAG_NAME (parent_type), "::") == 0)
++ return "";
+ return TYPE_TAG_NAME (parent_type);
+ case DW_TAG_class_type:
+ case DW_TAG_interface_type:
+@@ -9025,7 +9780,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
So it does not need a prefix. */
return "";
default:
@@ -5133,192 +5687,19 @@ index 86bfecb..ddf2189 100644
}
}
-+/* Determines the prefix for a symbol's physname. Unlike determine_prefix,
-+ this method does not simply look at the DIE's immediate parent.
-+ It will compute the symbol's physname by scanning through all parent
-+ DIEs until it gets to the compilation unit's DIE. */
-+
-+static char *
-+physname_prefix (struct die_info *die, struct dwarf2_cu *cu)
-+{
-+ long length;
-+ struct ui_file *buf;
-+ struct die_info *d, *spec_die;
-+ struct dwarf2_cu *spec_cu;
-+ char *name;
-+
-+ /* Construct a stack containing all of the DIE's parents. Caution
-+ must be observed for dealing with DW_AT_specification. */
-+ spec_cu = cu;
-+ spec_die = die_specification (die, &spec_cu);
-+ if (spec_die != NULL)
-+ d = spec_die->parent;
-+ else
-+ d = die->parent;
-+ while (d != NULL && d->tag != DW_TAG_compile_unit)
-+ {
-+ struct attribute *attr;
-+
-+ spec_die = die_specification (d, &spec_cu);
-+ if (spec_die != NULL)
-+ d = spec_die;
-+
-+ VEC_quick_push (die_info_p, die_list, d);
-+ d = d->parent;
-+ }
-+
-+ /* Now pop all the elements, printing their names as we go. */
-+ buf = mem_fileopen ();
-+ while (!VEC_empty (die_info_p, die_list))
-+ {
-+ d = VEC_pop (die_info_p, die_list);
-+ physname_prefix_1 (buf, d, cu);
-+
-+ if (!VEC_empty (die_info_p, die_list))
-+ {
-+ if (cu->language == language_cplus)
-+ fputs_unfiltered ("::", buf);
-+ else
-+ fputs_unfiltered (".", buf);
-+ }
-+ }
-+
-+ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, &length);
-+ ui_file_delete (buf);
-+ return name;
-+}
-+
-+static void
-+physname_prefix_1 (struct ui_file *buf, struct die_info *die,
-+ struct dwarf2_cu *cu)
-+{
-+ const char *name = NULL;
-+ gdb_assert (buf != NULL);
-+
-+ if (die != NULL)
-+ {
-+ switch (die->tag)
-+ {
-+ case DW_TAG_namespace:
-+ name = dwarf2_name (die, cu);
-+ if (name == NULL)
-+ name = "(anonymous namespace)";
-+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
-+ else if (strcmp (name, "::") == 0)
-+ name = NULL;
-+ break;
-+
-+ case DW_TAG_class_type:
-+ case DW_TAG_structure_type:
-+ case DW_TAG_union_type:
-+ case DW_TAG_enumeration_type:
-+ case DW_TAG_interface_type:
-+ case DW_TAG_subprogram:
-+ name = dwarf2_name (die, cu);
-+ break;
-+
-+ default:
-+ break;
-+ }
-+ }
-+
-+ if (name != NULL)
-+ fputs_unfiltered (name, buf);
-+}
-+
- /* Return a newly-allocated string formed by concatenating PREFIX and
- SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or empty, then
- simply copy the SUFFIX or PREFIX, respectively. If OBS is non-null,
-@@ -9071,17 +9787,111 @@ sibling_die (struct die_info *die)
+@@ -9078,17 +9833,37 @@ sibling_die (struct die_info *die)
return die->sibling;
}
-/* Get linkage name of a die, return NULL if not found. */
-+/* Construct a physname for the given DIE in CU. */
++/* Return the fully qualified .symtab name for symbols contained in Fortran
++ modules. Return DWARF2_NAME otherwise. */
static char *
-dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
-+dwarf2_physname (struct die_info *die, struct dwarf2_cu *cu)
- {
- struct attribute *attr;
-+ char *name;
-
-- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
-- if (attr && DW_STRING (attr))
-- return DW_STRING (attr);
-- return dwarf2_name (die, cu);
-+ name = dwarf2_name (die, cu);
-+
-+ /* These are the only languages we know how to qualify names in. */
-+ if (cu->language != language_cplus
-+ && cu->language != language_java)
-+ return name;
-+
-+ if (die_needs_namespace (die, cu))
-+ {
-+ long length;
-+ char *prefix;
-+ struct ui_file *buf;
-+
-+ prefix = physname_prefix (die, cu);
-+ buf = mem_fileopen ();
-+ if (*prefix != '\0')
-+ {
-+ char *prefixed_name = typename_concat (NULL, prefix, name, cu);
-+ fputs_unfiltered (prefixed_name, buf);
-+ xfree (prefixed_name);
-+ }
-+ else
-+ fputs_unfiltered (name ? name : "", buf);
-+
-+ /* For Java and C++ methods, append formal parameter type
-+ information. */
-+ if ((cu->language == language_cplus || cu->language == language_java)
-+ && die->tag == DW_TAG_subprogram)
-+ {
-+ struct type *type = read_type_die (die, cu);
-+
-+ c_type_print_args (type, buf, 0, cu->language);
-+
-+ if (cu->language == language_java)
-+ {
-+ /* For java, we must append the return type to method names. */
-+ if (die->tag == DW_TAG_subprogram)
-+ java_print_type (TYPE_TARGET_TYPE (type), "", buf, 0, 0);
-+ }
-+ else if (cu->language == language_cplus)
-+ {
-+ /* c_type_print_args adds argument types, but it does
-+ not add any necessary "const". */
-+ if (TYPE_NFIELDS (type) > 0 && TYPE_FIELD_ARTIFICIAL (type, 0)
-+ && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
-+ fputs_unfiltered (" const", buf);
-+ }
-+ }
-+
-+ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack,
-+ &length);
-+ ui_file_delete (buf);
-+
-+ if (cu->language == language_cplus)
-+ {
-+ char *cname
-+ = dwarf2_canonicalize_name (name, cu,
-+ &cu->objfile->objfile_obstack);
-+ if (cname != NULL)
-+ name = cname;
-+ }
-+ }
-+
-+ return name;
-+}
-+
-+/* Return the fully qualified .symtab name for symbols contained in Fortran
-+ modules. Return DWARF2_NAME otherwise. */
-+
-+static char *
+fortran_module_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
-+{
+ {
+- struct attribute *attr;
+ char *name;
+
+ gdb_assert (cu->language == language_fortran);
@@ -5332,7 +5713,11 @@ index 86bfecb..ddf2189 100644
+ if (module_name)
+ {
+ char *retval;
-+
+
+- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
+- if (attr && DW_STRING (attr))
+- return DW_STRING (attr);
+- return dwarf2_name (die, cu);
+ /* `__modulename_MOD_variablename0'. */
+ retval = obstack_alloc (&cu->objfile->objfile_obstack,
+ 2 + strlen (module_name) + 5 + strlen (name)
@@ -5347,7 +5732,7 @@ index 86bfecb..ddf2189 100644
}
/* Get name of a die, return NULL if not found. */
-@@ -11429,6 +12239,34 @@ attr_form_is_constant (struct attribute *attr)
+@@ -11436,64 +12211,94 @@ attr_form_is_constant (struct attribute *attr)
}
}
@@ -5377,20 +5762,76 @@ index 86bfecb..ddf2189 100644
+ return baton;
+}
+
++static struct dwarf2_loclist_baton *
++dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
++{
++ struct dwarf2_loclist_baton *baton;
++
++ if (!(attr_form_is_section_offset (attr)
++ /* ".debug_loc" 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_per_objfile->loc.size))
++ return NULL;
++
++ baton = obstack_alloc (&cu->objfile->objfile_obstack,
++ sizeof (struct dwarf2_loclist_baton));
++ baton->per_cu = cu->per_cu;
++ gdb_assert (baton->per_cu);
++
++ /* We don't know how long the location list is, but make sure we
++ don't run off the edge of the section. */
++ baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr);
++ baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr);
++ baton->base_address = 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 (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
-@@ -11458,35 +12296,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+ {
+- if (attr_form_is_section_offset (attr)
+- /* ".debug_loc" 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_per_objfile->loc.size)
+- {
+- struct dwarf2_loclist_baton *baton;
+-
+- baton = obstack_alloc (&cu->objfile->objfile_obstack,
+- sizeof (struct dwarf2_loclist_baton));
+- baton->per_cu = cu->per_cu;
+- gdb_assert (baton->per_cu);
+-
+- /* We don't know how long the location list is, but make sure we
+- don't run off the edge of the section. */
+- baton->size = dwarf2_per_objfile->loc.size - DW_UNSND (attr);
+- baton->data = dwarf2_per_objfile->loc.buffer + DW_UNSND (attr);
+- baton->base_address = cu->base_address;
+- if (cu->base_known == 0)
+- complaint (&symfile_complaints,
+- _("Location list used without specifying the CU base address."));
++ struct dwarf2_loclist_baton *loclist_baton;
+
++ loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu);
++ if (loclist_baton)
++ {
SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs;
- SYMBOL_LOCATION_BATON (sym) = baton;
- }
+- SYMBOL_LOCATION_BATON (sym) = baton;
++ SYMBOL_LOCATION_BATON (sym) = loclist_baton;
++ }
+ else if (attr_form_is_block (attr))
+ {
+ SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs;
+ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu);
-+ }
+ }
else
{
- struct dwarf2_locexpr_baton *baton;
@@ -5433,7 +5874,7 @@ index 86bfecb..ddf2189 100644
}
}
-@@ -11774,6 +12602,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+@@ -11781,6 +12586,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
return ofs_lhs->offset == ofs_rhs->offset;
}
@@ -5465,7 +5906,7 @@ index 86bfecb..ddf2189 100644
/* Set the type associated with DIE to TYPE. Save it in CU's hash
table if necessary. For convenience, return TYPE. */
-@@ -11782,6 +12635,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -11789,6 +12619,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct dwarf2_offset_and_type **slot, ofs;
@@ -5474,7 +5915,7 @@ index 86bfecb..ddf2189 100644
/* 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
-@@ -11937,23 +12792,13 @@ show_dwarf2_cmd (char *args, int from_tty)
+@@ -11944,23 +12776,13 @@ show_dwarf2_cmd (char *args, int from_tty)
cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
}
@@ -5502,7 +5943,7 @@ index 86bfecb..ddf2189 100644
}
/* munmap debug sections for OBJFILE, if necessary. */
-@@ -11962,15 +12807,15 @@ static void
+@@ -11969,15 +12791,15 @@ static void
dwarf2_per_objfile_free (struct objfile *objfile, void *d)
{
struct dwarf2_per_objfile *data = d;
@@ -5527,16 +5968,8 @@ index 86bfecb..ddf2189 100644
}
void _initialize_dwarf2_read (void);
-@@ -11978,6 +12823,7 @@ void _initialize_dwarf2_read (void);
- void
- _initialize_dwarf2_read (void)
- {
-+ die_list = VEC_alloc (die_info_p, 32);
- dwarf2_objfile_data_key
- = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
-
diff --git a/gdb/elfread.c b/gdb/elfread.c
-index 78e9163..dc8a752 100644
+index 9a2a1e3..72b1d13 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -179,7 +179,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name,
@@ -5615,7 +6048,7 @@ index 78e9163..dc8a752 100644
default_symfile_offsets, /* sym_offsets: Translate ext. to int. relocation */
elf_symfile_segments, /* sym_segments: Get segment information from
diff --git a/gdb/eval.c b/gdb/eval.c
-index a0556cf..abe6a06 100644
+index e2ceea7..1bcb4a7 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -43,6 +43,7 @@
@@ -5631,10 +6064,18 @@ index a0556cf..abe6a06 100644
struct type **arg_types;
int save_pos1;
+ struct cleanup *old_chain;
+ struct symbol *function = NULL;
+ char *function_name = NULL;
- pc = (*pos)++;
- op = exp->elts[pc].opcode;
-@@ -1332,7 +1334,6 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -731,6 +733,7 @@ evaluate_subexp_standard (struct type *expect_type,
+ return value_from_decfloat (exp->elts[pc + 1].type,
+ exp->elts[pc + 2].decfloatconst);
+
++ case OP_ADL_FUNC:
+ case OP_VAR_VALUE:
+ (*pos) += 3;
+ if (noside == EVAL_SKIP)
+@@ -1334,7 +1337,6 @@ evaluate_subexp_standard (struct type *expect_type,
argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 3));
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
{
@@ -5642,7 +6083,7 @@ index a0556cf..abe6a06 100644
/* First, evaluate the structure into arg2 */
pc2 = (*pos)++;
-@@ -1356,21 +1357,40 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1358,21 +1360,40 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
@@ -5695,7 +6136,71 @@ index a0556cf..abe6a06 100644
}
else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
{
-@@ -1496,8 +1516,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1412,6 +1433,17 @@ evaluate_subexp_standard (struct type *expect_type,
+ /* Now, say which argument to start evaluating from */
+ tem = 2;
+ }
++ else if (op == OP_ADL_FUNC)
++ {
++ /* Save the function position and move pos so that the arguments
++ can be evaluated. */
++ int func_name_len;
++ save_pos1 = *pos;
++ tem = 1;
++
++ func_name_len = longest_to_int (exp->elts[save_pos1 + 3].longconst);
++ (*pos) += 6 + BYTES_TO_EXP_ELEM (func_name_len + 1);
++ }
+ else if (op == OP_SCOPE
+ && overload_resolution
+ && (exp->language_defn->la_language == language_cplus))
+@@ -1433,9 +1465,9 @@ evaluate_subexp_standard (struct type *expect_type,
+ if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ {
+ function = cp_lookup_symbol_namespace (TYPE_TAG_NAME (type),
+- name, NULL,
++ name,
+ get_selected_block (0),
+- VAR_DOMAIN, 1);
++ VAR_DOMAIN);
+ if (function == NULL)
+ error (_("No symbol \"%s\" in namespace \"%s\"."),
+ name, TYPE_TAG_NAME (type));
+@@ -1484,6 +1516,33 @@ evaluate_subexp_standard (struct type *expect_type,
+ /* signal end of arglist */
+ argvec[tem] = 0;
+
++ if (op == OP_ADL_FUNC)
++ {
++ struct symbol *symp;
++ char *func_name;
++ int name_len;
++ int string_pc = save_pos1 + 3;
++
++ /* Extract the function name. */
++ name_len = longest_to_int (exp->elts[string_pc].longconst);
++ func_name = (char *) alloca (name_len + 1);
++ strcpy (func_name, &exp->elts[string_pc + 1].string);
++
++ /* Prepare list of argument types for overload resolution */
++ arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
++ for (ix = 1; ix <= nargs; ix++)
++ arg_types[ix - 1] = value_type (argvec[ix]);
++
++ find_overload_match (arg_types, nargs, func_name,
++ 0 /* not method */ , 0 /* strict match */ ,
++ NULL, NULL /* pass NULL symbol since symbol is unknown */ ,
++ NULL, &symp, NULL);
++
++ /* Now fix the expression being evaluated */
++ exp->elts[save_pos1 + 2].symbol = symp;
++ argvec[0] = evaluate_subexp_with_coercion (exp, &save_pos1, noside);
++ }
++
+ if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR
+ || (op == OP_SCOPE && function_name != NULL))
+ {
+@@ -1552,8 +1611,7 @@ evaluate_subexp_standard (struct type *expect_type,
}
else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
{
@@ -5703,9 +6208,9 @@ index a0556cf..abe6a06 100644
- argvec[0] = arg1;
+ /* Pointer to member. argvec is already set up. */
}
- else if (op == OP_VAR_VALUE)
+ else if (op == OP_VAR_VALUE || (op == OP_SCOPE && function != NULL))
{
-@@ -1588,6 +1607,8 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1653,6 +1711,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);
@@ -5714,7 +6219,7 @@ index a0556cf..abe6a06 100644
type = check_typedef (value_type (arg1));
code = TYPE_CODE (type);
-@@ -1608,6 +1629,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1673,6 +1733,7 @@ evaluate_subexp_standard (struct type *expect_type,
code = TYPE_CODE (type);
}
}
@@ -5722,7 +6227,7 @@ index a0556cf..abe6a06 100644
switch (code)
{
-@@ -1769,6 +1791,27 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1834,6 +1895,26 @@ evaluate_subexp_standard (struct type *expect_type,
xfree (expect_type);
return arg1;
@@ -5732,7 +6237,6 @@ index a0556cf..abe6a06 100644
+ struct symbol *sym;
+ struct type **arg_types;
+ (*pos) += 3;
-+ printf ("TYPE_INSTANCE_LOOKUP\n");
+ arg_types = (struct type **) alloca (TYPE_NFIELDS (expect_type)
+ * sizeof (struct type *));
+ for (i = 0; i < TYPE_NFIELDS (expect_type); ++i)
@@ -5750,7 +6254,7 @@ index a0556cf..abe6a06 100644
case BINOP_CONCAT:
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-@@ -2040,13 +2083,19 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2105,13 +2186,19 @@ evaluate_subexp_standard (struct type *expect_type,
{
int subscript_array[MAX_FORTRAN_DIMS];
int array_size_array[MAX_FORTRAN_DIMS];
@@ -5770,7 +6274,7 @@ index a0556cf..abe6a06 100644
tmp_type = check_typedef (value_type (arg1));
ndimensions = calc_f77_array_dims (type);
-@@ -2076,6 +2125,9 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2141,6 +2228,9 @@ evaluate_subexp_standard (struct type *expect_type,
upper = f77_get_upperbound (tmp_type);
lower = f77_get_lowerbound (tmp_type);
@@ -5780,7 +6284,7 @@ index a0556cf..abe6a06 100644
array_size_array[nargs - i - 1] = upper - lower + 1;
/* Zero-normalize subscripts so that offsetting will work. */
-@@ -2094,13 +2146,25 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2159,13 +2249,25 @@ evaluate_subexp_standard (struct type *expect_type,
tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
}
@@ -5810,7 +6314,7 @@ index a0556cf..abe6a06 100644
/* Let us now play a dirty trick: we will take arg1
which is a value node pointing to the topmost level
-@@ -2110,7 +2174,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2175,7 +2277,7 @@ evaluate_subexp_standard (struct type *expect_type,
returns the correct type value */
deprecated_set_value_type (arg1, tmp_type);
@@ -5819,7 +6323,7 @@ index a0556cf..abe6a06 100644
}
case BINOP_LOGICAL_AND:
-@@ -2344,14 +2408,22 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2409,14 +2511,22 @@ 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);
@@ -5844,7 +6348,7 @@ index a0556cf..abe6a06 100644
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
type = check_typedef (value_type (arg1));
-@@ -2360,12 +2432,18 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2425,12 +2535,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
)
@@ -5868,7 +6372,7 @@ index a0556cf..abe6a06 100644
else
error (_("Attempt to take contents of a non-pointer value."));
}
-@@ -2375,9 +2453,14 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2440,9 +2556,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)
@@ -5886,7 +6390,7 @@ index a0556cf..abe6a06 100644
case UNOP_ADDR:
/* C++: check for and handle pointer to members. */
-@@ -2712,7 +2795,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2777,7 +2898,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
{
enum exp_opcode op;
int pc;
@@ -5895,7 +6399,7 @@ index a0556cf..abe6a06 100644
struct symbol *var;
struct type *type;
-@@ -2723,12 +2806,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -2788,12 +2909,17 @@ evaluate_subexp_with_coercion (struct expression *exp,
{
case OP_VAR_VALUE:
var = exp->elts[pc + 2].symbol;
@@ -5914,7 +6418,7 @@ index a0556cf..abe6a06 100644
return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
val);
}
-@@ -2780,9 +2868,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
+@@ -2845,9 +2971,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
case OP_VAR_VALUE:
(*pos) += 4;
@@ -5931,8 +6435,21 @@ index a0556cf..abe6a06 100644
default:
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
+diff --git a/gdb/expprint.c b/gdb/expprint.c
+index e378831..45deffe 100644
+--- a/gdb/expprint.c
++++ b/gdb/expprint.c
+@@ -816,6 +816,8 @@ op_name_standard (enum exp_opcode opcode)
+ return "OP_TYPE";
+ case OP_LABELED:
+ return "OP_LABELED";
++ case OP_ADL_FUNC:
++ return "OP_ADL_FUNC";
+ }
+ }
+
diff --git a/gdb/expression.h b/gdb/expression.h
-index ca216cf..2195fef 100644
+index ca216cf..6be0b1e 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -95,6 +95,11 @@ enum exp_opcode
@@ -5947,7 +6464,18 @@ index ca216cf..2195fef 100644
/* end of C++. */
/* For Modula-2 integer division DIV */
-@@ -451,4 +456,5 @@ extern char *op_string (enum exp_opcode);
+@@ -347,6 +352,10 @@ enum exp_opcode
+ Then comes another OP_DECFLOAT. */
+ OP_DECFLOAT,
+
++ /* OP_ADL_FUNC specifies that the argument is to be looked up in an
++ Argument Dependent manner (Koenig lookup) */
++ OP_ADL_FUNC,
++
+ /* First extension operator. Individual language modules define
+ extra operators in *.inc include files below always starting with
+ numbering at OP_EXTENDED0:
+@@ -451,4 +460,5 @@ extern char *op_string (enum exp_opcode);
extern void dump_raw_expression (struct expression *, struct ui_file *, char *);
extern void dump_prefix_expression (struct expression *, struct ui_file *);
@@ -6749,7 +7277,7 @@ index cd24eaf..119af7d 100644
once for each known thread. */
typedef int (*thread_callback_func) (struct thread_info *, void *);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
-index 46846c4..bf6e891 100644
+index 46846c4..95bcca4 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -39,6 +39,9 @@
@@ -6878,8 +7406,8 @@ index 46846c4..bf6e891 100644
+ /* DWARF blocks may depend on runtime information like
+ DW_OP_PUSH_OBJECT_ADDRESS not being available during the
+ CREATE_ARRAY_TYPE time. */
-+ if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (range_type)
-+ || TYPE_HIGH_BOUND_IS_DWARF_BLOCK (range_type)
++ if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT
++ || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT
+ || TYPE_LOW_BOUND_UNDEFINED (range_type)
+ || TYPE_HIGH_BOUND_UNDEFINED (range_type)
+ || get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
@@ -7211,7 +7739,7 @@ index 46846c4..bf6e891 100644
if (TYPE_NAME (type))
TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
if (TYPE_TAG_NAME (type))
-@@ -3053,12 +3241,45 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3053,12 +3241,48 @@ copy_type_recursive (struct objfile *objfile,
TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
@@ -7252,12 +7780,15 @@ index 46846c4..bf6e891 100644
{
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++)
{
-@@ -3067,8 +3288,8 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3067,8 +3291,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)
@@ -7268,7 +7799,7 @@ index 46846c4..bf6e891 100644
if (TYPE_FIELD_NAME (type, i))
TYPE_FIELD_NAME (new_type, i) =
xstrdup (TYPE_FIELD_NAME (type, i));
-@@ -3095,24 +3316,75 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3095,24 +3319,166 @@ copy_type_recursive (struct objfile *objfile,
}
}
@@ -7277,55 +7808,147 @@ index 46846c4..bf6e891 100644
+ TYPE_DYNAMIC (new_type) = 0;
+
/* For range types, copy the bounds information. */
- if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+- 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);
+
-+ if (TYPE_LOW_BOUND_IS_DWARF_BLOCK (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. */
-+ if (TYPE_NOT_ALLOCATED (type)
-+ || TYPE_NOT_ASSOCIATED (type))
-+ TYPE_RANGE_DATA (new_type)->low.u.dwarf_block = NULL;
++ 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);
-+ TYPE_LOW_BOUND_IS_DWARF_BLOCK (new_type) = 0;
++ 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;
++ 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;
+ }
+
-+ if (TYPE_HIGH_BOUND_IS_DWARF_BLOCK (type))
++ 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. */
-+ if (TYPE_NOT_ALLOCATED (type)
-+ || TYPE_NOT_ASSOCIATED (type))
-+ TYPE_RANGE_DATA (new_type)->high.u.dwarf_block = NULL;
++ 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_HIGH_BOUND_IS_DWARF_BLOCK (new_type) = 0;
++ 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;
+ }
+
-+ if (TYPE_BYTE_STRIDE_IS_DWARF_BLOCK (type))
++ 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. */
-+ if (TYPE_NOT_ALLOCATED (type)
-+ || TYPE_NOT_ASSOCIATED (type))
-+ TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block = NULL;
++ 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_BYTE_STRIDE_IS_DWARF_BLOCK (new_type) = 0;
++ 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 (type))
++ if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type))
+ {
-+ TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (type)
-+ + TYPE_HIGH_BOUND (type) - 1;
++ 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;
+ }
}
@@ -7350,7 +7973,7 @@ index 46846c4..bf6e891 100644
/* Maybe copy the type_specific bits.
NOTE drow/2005-12-09: We do not copy the C++-specific bits like
-@@ -3130,6 +3402,17 @@ copy_type_recursive (struct objfile *objfile,
+@@ -3130,6 +3496,17 @@ copy_type_recursive (struct objfile *objfile,
return new_type;
}
@@ -7368,7 +7991,7 @@ index 46846c4..bf6e891 100644
/* Make a copy of the given TYPE, except that the pointer & reference
types are not preserved.
-@@ -3152,6 +3435,211 @@ copy_type (const struct type *type)
+@@ -3152,6 +3529,211 @@ copy_type (const struct type *type)
return new_type;
}
@@ -7580,7 +8203,7 @@ index 46846c4..bf6e891 100644
/* Helper functions to initialize architecture-specific types. */
-@@ -3475,6 +3963,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
+@@ -3475,6 +4057,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
= lookup_pointer_type (builtin_type->builtin_void);
builtin_type->builtin_func_ptr
= lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
@@ -7589,7 +8212,7 @@ index 46846c4..bf6e891 100644
/* This type represents a GDB internal function. */
builtin_type->internal_fn
-@@ -3588,6 +4078,11 @@ objfile_type (struct objfile *objfile)
+@@ -3588,6 +4172,11 @@ objfile_type (struct objfile *objfile)
"", objfile);
TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
= objfile_type->builtin_int;
@@ -7601,7 +8224,7 @@ index 46846c4..bf6e891 100644
objfile_type->nodebug_data_symbol
= init_type (TYPE_CODE_INT,
gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
-@@ -3642,6 +4137,11 @@ void
+@@ -3642,6 +4231,11 @@ void
_initialize_gdbtypes (void)
{
gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
@@ -7614,7 +8237,7 @@ index 46846c4..bf6e891 100644
add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
-index 643fa03..6381dcf 100644
+index 643fa03..efe5512 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -138,6 +138,8 @@ enum type_code
@@ -7772,7 +8395,7 @@ index 643fa03..6381dcf 100644
}
loc;
-@@ -544,13 +615,22 @@ struct main_type
+@@ -544,13 +615,34 @@ struct main_type
struct range_bounds
{
@@ -7780,11 +8403,23 @@ index 643fa03..6381dcf 100644
+ {
+ union
+ {
-+ struct dwarf2_locexpr_baton *dwarf_block;
+ LONGEST constant;
++ struct dwarf2_locexpr_baton *dwarf_block;
++ struct
++ {
++ struct dwarf2_loclist_baton *loclist;
++ struct type *type;
++ }
++ dwarf_loclist;
+ }
+ u;
-+ unsigned is_dwarf_block : 1;
++ enum range_bound_kind
++ {
++ RANGE_BOUND_KIND_CONSTANT,
++ RANGE_BOUND_KIND_DWARF_BLOCK,
++ RANGE_BOUND_KIND_DWARF_LOCLIST
++ }
++ kind;
+ }
/* Low bound of range. */
-
@@ -7800,7 +8435,7 @@ index 643fa03..6381dcf 100644
/* Flags indicating whether the values of low and high are
valid. When true, the respective range value is
-@@ -602,6 +682,9 @@ struct main_type
+@@ -602,6 +694,9 @@ struct main_type
supporting multiple ABIs. Right now this is only fetched from
the Dwarf-2 DW_AT_calling_convention attribute. */
unsigned calling_convention;
@@ -7810,7 +8445,7 @@ index 643fa03..6381dcf 100644
} type_specific;
};
-@@ -838,13 +921,6 @@ struct cplus_struct_type
+@@ -838,13 +933,6 @@ struct cplus_struct_type
int is_dynamic : 2;
};
@@ -7824,7 +8459,7 @@ index 643fa03..6381dcf 100644
/* Struct used for ranking a function for overload resolution */
struct badness_vector
{
-@@ -899,9 +975,9 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -899,9 +987,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
@@ -7837,7 +8472,7 @@ index 643fa03..6381dcf 100644
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
-@@ -910,15 +986,26 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -910,11 +998,16 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
#define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
@@ -7856,26 +8491,7 @@ index 643fa03..6381dcf 100644
#define TYPE_LOW_BOUND_UNDEFINED(range_type) \
TYPE_RANGE_DATA(range_type)->low_undefined
#define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
- TYPE_RANGE_DATA(range_type)->high_undefined
-+#define TYPE_LOW_BOUND_IS_DWARF_BLOCK(range_type) \
-+ TYPE_RANGE_DATA(range_type)->low.is_dwarf_block
-+#define TYPE_HIGH_BOUND_IS_DWARF_BLOCK(range_type) \
-+ TYPE_RANGE_DATA(range_type)->high.is_dwarf_block
-+#define TYPE_BYTE_STRIDE_IS_DWARF_BLOCK(range_type) \
-+ TYPE_RANGE_DATA(range_type)->byte_stride.is_dwarf_block
-
- /* Moto-specific stuff for FORTRAN arrays */
-
-@@ -927,11 +1014,23 @@ extern void allocate_gnat_aux_type (struct type *);
- #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
- TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
-
-+#define TYPE_ARRAY_UPPER_BOUND_IS_DWARF_BLOCK(arraytype) \
-+ TYPE_HIGH_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype))
-+#define TYPE_ARRAY_LOWER_BOUND_IS_DWARF_BLOCK(arraytype) \
-+ TYPE_LOW_BOUND_IS_DWARF_BLOCK(TYPE_INDEX_TYPE(arraytype))
-+
- #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
+@@ -931,7 +1024,14 @@ extern void allocate_gnat_aux_type (struct type *);
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
#define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
@@ -7891,7 +8507,7 @@ index 643fa03..6381dcf 100644
/* C++ */
-@@ -959,6 +1058,7 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -959,6 +1059,7 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
#define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention
@@ -7899,7 +8515,7 @@ index 643fa03..6381dcf 100644
#define TYPE_BASECLASS(thistype,index) TYPE_FIELD_TYPE(thistype, index)
#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
#define TYPE_BASECLASS_NAME(thistype,index) TYPE_FIELD_NAME(thistype, index)
-@@ -977,7 +1077,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -977,7 +1078,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
@@ -7907,7 +8523,7 @@ index 643fa03..6381dcf 100644
#define SET_FIELD_BITPOS(thisfld, bitpos) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \
FIELD_BITPOS (thisfld) = (bitpos))
-@@ -987,9 +1086,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -987,9 +1087,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -7917,7 +8533,7 @@ index 643fa03..6381dcf 100644
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
-@@ -1000,7 +1096,6 @@ extern void allocate_gnat_aux_type (struct type *);
+@@ -1000,7 +1097,6 @@ extern void allocate_gnat_aux_type (struct type *);
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
@@ -7925,7 +8541,7 @@ index 643fa03..6381dcf 100644
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
-@@ -1139,6 +1234,10 @@ struct builtin_type
+@@ -1139,6 +1235,10 @@ struct builtin_type
(*) () can server as a generic function pointer. */
struct type *builtin_func_ptr;
@@ -7936,7 +8552,7 @@ index 643fa03..6381dcf 100644
/* Special-purpose types. */
-@@ -1179,6 +1278,7 @@ struct objfile_type
+@@ -1179,6 +1279,7 @@ struct objfile_type
/* Types used for symbols with no debug information. */
struct type *nodebug_text_symbol;
@@ -7944,7 +8560,7 @@ index 643fa03..6381dcf 100644
struct type *nodebug_data_symbol;
struct type *nodebug_unknown_symbol;
struct type *nodebug_tls_symbol;
-@@ -1333,6 +1433,18 @@ extern struct type *create_array_type (struct type *, struct type *,
+@@ -1333,6 +1434,18 @@ extern struct type *create_array_type (struct type *, struct type *,
struct type *);
extern struct type *lookup_array_range_type (struct type *, int, int);
@@ -7963,7 +8579,7 @@ index 643fa03..6381dcf 100644
extern struct type *create_string_type (struct type *, struct type *,
struct type *);
extern struct type *lookup_string_range_type (struct type *, int, int);
-@@ -1375,6 +1487,8 @@ extern int is_public_ancestor (struct type *, struct type *);
+@@ -1375,6 +1488,8 @@ extern int is_public_ancestor (struct type *, struct type *);
extern int is_unique_ancestor (struct type *, struct value *);
@@ -7972,7 +8588,7 @@ index 643fa03..6381dcf 100644
/* Overload resolution */
#define LENGTH_MATCH(bv) ((bv)->rank[0])
-@@ -1437,10 +1551,11 @@ extern void maintenance_print_type (char *, int);
+@@ -1437,10 +1552,11 @@ extern void maintenance_print_type (char *, int);
extern htab_t create_copied_types_hash (struct objfile *objfile);
@@ -8258,10 +8874,10 @@ index e642894..6ac95cc 100644
}
else if (code == TYPE_CODE_INT)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
-index f99a4ae..5599908 100644
+index 29cf427..0ec598e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
-@@ -806,7 +806,7 @@ nexti_command (char *count_string, int from_tty)
+@@ -808,7 +808,7 @@ nexti_command (char *count_string, int from_tty)
step_1 (1, 1, count_string);
}
@@ -8270,7 +8886,7 @@ index f99a4ae..5599908 100644
delete_longjmp_breakpoint_cleanup (void *arg)
{
int thread = * (int *) arg;
-@@ -846,10 +846,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
+@@ -848,10 +848,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
if (!single_inst || skip_subroutines) /* leave si command alone */
{
@@ -8284,7 +8900,7 @@ index f99a4ae..5599908 100644
make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
}
-@@ -1198,6 +1201,15 @@ signal_command (char *signum_exp, int from_tty)
+@@ -1200,6 +1203,15 @@ signal_command (char *signum_exp, int from_tty)
proceed ((CORE_ADDR) -1, oursig, 0);
}
@@ -8300,7 +8916,7 @@ index f99a4ae..5599908 100644
/* Proceed until we reach a different source line with pc greater than
our current one or exit the function. We skip calls in both cases.
-@@ -1214,6 +1226,8 @@ until_next_command (int from_tty)
+@@ -1216,6 +1228,8 @@ until_next_command (int from_tty)
struct symbol *func;
struct symtab_and_line sal;
struct thread_info *tp = inferior_thread ();
@@ -8309,7 +8925,7 @@ index f99a4ae..5599908 100644
clear_proceed_status ();
set_step_frame ();
-@@ -1249,7 +1263,19 @@ until_next_command (int from_tty)
+@@ -1251,7 +1265,19 @@ until_next_command (int from_tty)
tp->step_multi = 0; /* Only one call to proceed */
@@ -8329,7 +8945,7 @@ index f99a4ae..5599908 100644
}
static void
-@@ -1426,6 +1452,7 @@ finish_command_continuation (void *arg)
+@@ -1428,6 +1454,7 @@ finish_command_continuation (void *arg)
if (bs != NULL && tp->proceed_to_finish)
observer_notify_normal_stop (bs, 1 /* print frame */);
delete_breakpoint (a->breakpoint);
@@ -8337,7 +8953,7 @@ index f99a4ae..5599908 100644
}
static void
-@@ -1509,6 +1536,7 @@ finish_forward (struct symbol *function, struct frame_info *frame)
+@@ -1511,6 +1538,7 @@ finish_forward (struct symbol *function, struct frame_info *frame)
struct breakpoint *breakpoint;
struct cleanup *old_chain;
struct finish_command_continuation_args *cargs;
@@ -8345,7 +8961,7 @@ index f99a4ae..5599908 100644
sal = find_pc_line (get_frame_pc (frame), 0);
sal.pc = get_frame_pc (frame);
-@@ -1519,6 +1547,10 @@ finish_forward (struct symbol *function, struct frame_info *frame)
+@@ -1521,6 +1549,10 @@ finish_forward (struct symbol *function, struct frame_info *frame)
old_chain = make_cleanup_delete_breakpoint (breakpoint);
@@ -8370,7 +8986,7 @@ index e557d6c..d4ae1df 100644
extern void notice_new_inferior (ptid_t, int, int);
diff --git a/gdb/infrun.c b/gdb/infrun.c
-index 8307986..b4110a8 100644
+index 9a5c3a8..ed2f530 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -45,6 +45,8 @@
@@ -8382,7 +8998,7 @@ index 8307986..b4110a8 100644
#include "gdb_assert.h"
#include "mi/mi-common.h"
#include "event-top.h"
-@@ -2013,6 +2015,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch,
+@@ -2024,6 +2026,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch,
struct symtab_and_line sr_sal,
struct frame_id sr_id);
static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
@@ -8391,7 +9007,7 @@ index 8307986..b4110a8 100644
static void stop_stepping (struct execution_control_state *ecs);
static void prepare_to_wait (struct execution_control_state *ecs);
-@@ -2958,6 +2962,10 @@ handle_inferior_event (struct execution_control_state *ecs)
+@@ -2971,6 +2975,10 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
@@ -8402,7 +9018,7 @@ index 8307986..b4110a8 100644
ecs->event_thread->stop_bpstat
= bpstat_stop_status (get_regcache_aspace (get_current_regcache ()),
stop_pc, ecs->ptid);
-@@ -3042,6 +3050,10 @@ handle_inferior_event (struct execution_control_state *ecs)
+@@ -3055,6 +3063,10 @@ handle_inferior_event (struct execution_control_state *ecs)
stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid));
@@ -8413,7 +9029,7 @@ index 8307986..b4110a8 100644
/* Do whatever is necessary to the parent branch of the vfork. */
handle_vfork_child_exec_or_exit (1);
-@@ -3780,23 +3792,33 @@ process_event_stop_test:
+@@ -3793,23 +3805,33 @@ process_event_stop_test:
ecs->event_thread->stepping_over_breakpoint = 1;
@@ -8459,7 +9075,7 @@ index 8307986..b4110a8 100644
keep_going (ecs);
return;
-@@ -3808,6 +3830,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
+@@ -3821,6 +3843,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
delete_step_resume_breakpoint (ecs->event_thread);
@@ -8513,7 +9129,7 @@ index 8307986..b4110a8 100644
ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs);
-@@ -4827,6 +4896,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
+@@ -4840,6 +4909,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
}
@@ -8635,14 +9251,14 @@ index 4f78a28..e0096f5 100644
const domain_enum);
diff --git a/gdb/linespec.c b/gdb/linespec.c
-index 74902b6..4e54a3a 100644
+index 75a74e2..ec4d569 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -40,6 +40,7 @@
#include "interps.h"
#include "mi/mi-cmds.h"
#include "target.h"
-+#include
++#include "arch-utils.h"
/* We share this one with symtab.c, but it is not exported widely. */
@@ -8655,7 +9271,57 @@ index 74902b6..4e54a3a 100644
static struct symtabs_and_lines decode_indirect (char **argptr);
static char *locate_first_half (char **argptr, int *is_quote_enclosed);
-@@ -688,9 +687,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -313,10 +312,7 @@ add_matching_methods (int method_counter, struct type *t,
+ NULL, VAR_DOMAIN,
+ language,
+ (int *) NULL);
+- /* See PR10966. Remove check on symbol domain and class when
+- we stop using (bad) linkage names on constructors. */
+- if (sym_arr[i1] && (SYMBOL_DOMAIN (sym_arr[i1]) == VAR_DOMAIN
+- && SYMBOL_CLASS (sym_arr[i1]) == LOC_BLOCK))
++ if (sym_arr[i1])
+ i1++;
+ else
+ {
+@@ -631,6 +627,37 @@ See set/show multiple-symbol."));
+ discard_cleanups (old_chain);
+ return return_values;
+ }
++
++/* A helper function for decode_line_1 and friends which skips P
++ past any method overload information at the beginning of P, e.g.,
++ "(const struct foo *)".
++
++ This function assumes that P has already been validated to contain
++ overload information, and it will assert if *P != '('. */
++static char *
++find_method_overload_end (char *p)
++{
++ int depth = 0;
++
++ gdb_assert (*p == '(');
++
++ while (*p)
++ {
++ if (*p == '(')
++ ++depth;
++ else if (*p == ')')
++ {
++ if (--depth == 0)
++ {
++ ++p;
++ break;
++ }
++ }
++ ++p;
++ }
++
++ return p;
++}
+
+ /* The parser of linespec itself. */
+
+@@ -691,18 +718,17 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
struct symtab *file_symtab = NULL;
char *copy;
@@ -8665,7 +9331,19 @@ index 74902b6..4e54a3a 100644
/* This says whether or not something in *ARGPTR is quoted with
completer_quotes (i.e. with single quotes). */
int is_quoted;
-@@ -711,12 +707,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+- /* Is part of *ARGPTR is enclosed in double quotes? */
++ /* Is *ARGPTR is enclosed in double quotes? */
+ int is_quote_enclosed;
+ int is_objc_method = 0;
+ char *saved_arg = *argptr;
+ /* If IS_QUOTED, the end of the quoted bit. */
+ char *end_quote = NULL;
++ /* The "first half" of the linespec. */
++ char *first_half;
+
+ if (not_found_ptr)
+ *not_found_ptr = 0;
+@@ -716,12 +742,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
if (**argptr == '*')
return decode_indirect (argptr);
@@ -8678,10 +9356,16 @@ index 74902b6..4e54a3a 100644
+ is_quoted = (*argptr
+ && strchr (get_gdb_completer_quote_characters (),
+ **argptr) != NULL);
+ if (is_quoted)
+ end_quote = skip_quoted (*argptr);
+
+@@ -734,15 +757,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+ will point to "". If this is a C++ name, like "A::B::foo", p will
+ point to "::B::foo". Argptr is not changed by this call. */
+
+- p = locate_first_half (argptr, &is_quote_enclosed);
++ first_half = p = locate_first_half (argptr, &is_quote_enclosed);
- /* Check to see if it's a multipart linespec (with colons or
- periods). */
-@@ -732,10 +725,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
/* Check if this is an Objective-C method (anything that starts with
a '+' or '-' and a '['). */
if (is_objc_method_format (p))
@@ -8693,43 +9377,53 @@ index 74902b6..4e54a3a 100644
/* Check if the symbol could be an Objective-C selector. */
-@@ -749,11 +739,11 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -754,9 +774,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+ return values;
+ }
+- if (is_quoted)
+- *argptr = *argptr + 1;
+-
/* Does it look like there actually were two parts? */
-- if ((p[0] == ':' || p[0] == '.') && paren_pointer == NULL)
-+ if (p[0] == ':' || p[0] == '.')
- {
- if (is_quoted)
- *argptr = *argptr + 1;
--
-+
- /* Is it a C++ or Java compound data structure?
- The check on p[1] == ':' is capturing the case of "::",
- since p[0]==':' was checked above.
-@@ -762,48 +752,31 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
- can return now. */
+ if (p[0] == ':' || p[0] == '.')
+@@ -770,67 +787,48 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
if (p[0] == '.' || p[1] == ':')
-- return decode_compound (argptr, funfirstline, canonical,
-- saved_arg, p, not_found_ptr);
-+ {
+ {
+- if (paren_pointer == NULL)
+- return decode_compound (argptr, funfirstline, canonical,
+ struct symtabs_and_lines values;
+
+ if (is_quote_enclosed)
+ ++saved_arg;
+ values = decode_compound (argptr, funfirstline, canonical,
-+ saved_arg, p, not_found_ptr);
+ saved_arg, p, not_found_ptr);
+- /* Otherwise, fall through to decode_variable below. */
+ if (is_quoted && **argptr == '\'')
+ *argptr = *argptr + 1;
+ return values;
-+ }
+ }
+- else
+- {
+- /* No, the first part is a filename; set file_symtab to be that file's
+- symtab. Also, move argptr past the filename. */
- /* No, the first part is a filename; set file_symtab to be that file's
- symtab. Also, move argptr past the filename. */
+- file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
+- not_found_ptr);
++ /* No, the first part is a filename; set file_symtab to be that file's
++ symtab. Also, move argptr past the filename. */
- file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
- not_found_ptr);
+- /* Check for single quotes on the non-filename part. */
+- if (!is_quoted)
+- {
+- is_quoted = (**argptr
+- && strchr (get_gdb_completer_quote_characters (),
+- **argptr) != NULL);
+- if (is_quoted)
+- end_quote = skip_quoted (*argptr);
+- }
+- }
- }
-#if 0
- /* No one really seems to know why this was added. It certainly
@@ -8742,7 +9436,9 @@ index 74902b6..4e54a3a 100644
- else
- {
- /* Check if what we have till now is a symbol name */
--
++ file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
++ not_found_ptr);
+
- /* We may be looking at a template instantiation such
- as "foo". Check here whether we know about it,
- instead of falling through to the code below which
@@ -8756,14 +9452,16 @@ index 74902b6..4e54a3a 100644
- copy[p - *argptr] = '\000';
- sym = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
- if (sym)
-+ if (file_symtab != NULL)
++ /* Check for single quotes on the non-filename part. */
++ if (!is_quoted)
{
- *argptr = (*p == '\'') ? p + 1 : p;
- return symbol_found (funfirstline, canonical, copy, sym, NULL);
-+ /* Double-check if the remainder of the argument is quoted.
-+ The rbreak command uses syntax like this. */
-+ if (**argptr == '\'')
-+ is_quoted = 1;
++ is_quoted = (**argptr
++ && strchr (get_gdb_completer_quote_characters (),
++ **argptr) != NULL);
++ if (is_quoted)
++ end_quote = skip_quoted (*argptr);
}
- /* Otherwise fall out from here and go to file/line spec
- processing, etc. */
@@ -8772,7 +9470,22 @@ index 74902b6..4e54a3a 100644
/* file_symtab is specified file's symtab, or 0 if no file specified.
arg no longer contains the file name. */
-@@ -838,10 +811,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+
++ /* If the filename was quoted, we must re-check the quotation. */
++
++ if (end_quote == first_half && *end_quote!= '\0')
++ {
++ is_quoted = (**argptr
++ && strchr (get_gdb_completer_quote_characters (),
++ **argptr) != NULL);
++ if (is_quoted)
++ end_quote = skip_quoted (*argptr);
++ }
++
+ /* Check whether arg is all digits (and sign). */
+
+ q = *argptr;
+@@ -861,10 +859,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
/* allow word separators in method names for Obj-C */
p = skip_quoted_chars (*argptr, NULL, "");
}
@@ -8783,20 +9496,13 @@ index 74902b6..4e54a3a 100644
else
{
p = skip_quoted (*argptr);
-@@ -851,6 +820,21 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+@@ -874,6 +868,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
if (*p == '<')
p = find_template_name_end (p);
+ /* Keep method overload information. */
-+ q = strchr (p, '(');
-+ if (q != NULL)
-+ {
-+ /* Ignore '(' used after " if". */
-+ while (q > p && isspace (q[-1]))
-+ q--;
-+ if (!(q >= p + 3 && strncmp (&q[-2], "if", 2) == 0 && isspace (q[-3])))
-+ p = strrchr (q, ')') + 1;
-+ }
++ if (*p == '(')
++ p = find_method_overload_end (p);
+
+ /* Make sure we keep important kewords like "const" */
+ if (strncmp (p, " const", 6) == 0)
@@ -8805,7 +9511,21 @@ index 74902b6..4e54a3a 100644
copy = (char *) alloca (p - *argptr + 1);
memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0';
-@@ -926,44 +910,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
+@@ -921,10 +923,9 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
+ function is passed ARGPTR as an argument, it modifies what ARGPTR
+ points to; typically, it advances *ARGPTR past whatever substring
+ it has just looked at. (If it doesn't modify *ARGPTR, then the
+- function gets passed *ARGPTR instead, which is then called ARG: see
+- set_flags, for example.) Also, functions that return a struct
+- symtabs_and_lines may modify CANONICAL, as in the description of
+- decode_line_1.
++ function gets passed *ARGPTR instead, which is then called ARG.)
++ Also, functions that return a struct symtabs_and_lines may modify
++ CANONICAL, as in the description of decode_line_1.
+
+ If a function returns a struct symtabs_and_lines, then that struct
+ will immediately make its way up the call chain to be returned by
+@@ -951,44 +952,6 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
}
}
@@ -8850,7 +9570,43 @@ index 74902b6..4e54a3a 100644
/* Decode arg of the form *PC. */
-@@ -1264,7 +1210,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1059,7 +1022,14 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
+ p++;
+ }
+ else
+- *is_quote_enclosed = 0;
++ {
++ *is_quote_enclosed = 0;
++ if (strchr (get_gdb_completer_quote_characters (), *p))
++ {
++ ++(*argptr);
++ ++p;
++ }
++ }
+ for (; *p; p++)
+ {
+ if (p[0] == '<')
+@@ -1088,8 +1058,9 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
+ if (p[0] == '.' && strchr (p, ':') == NULL)
+ {
+ /* Java qualified method. Find the *last* '.', since the
+- others are package qualifiers. */
+- for (p1 = p; *p1; p1++)
++ others are package qualifiers. Stop at any open parenthesis
++ which might provide overload information. */
++ for (p1 = p; *p1 && *p1 != '('; p1++)
+ {
+ if (*p1 == '.')
+ p = p1;
+@@ -1241,6 +1212,7 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+ struct symbol *sym_class;
+ struct symbol **sym_arr;
+ struct type *t;
++ char *saved_java_argptr = NULL;
+
+ /* First check for "global" namespace specification, of the form
+ "::foo". If found, skip over the colons and jump to normal
+@@ -1289,7 +1261,8 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
/* PASS2: p2->"::fun", p->":fun" */
/* Move pointer ahead to next double-colon. */
@@ -8860,7 +9616,7 @@ index 74902b6..4e54a3a 100644
{
if (current_language->la_language == language_cplus)
p += cp_validate_operator (p);
-@@ -1342,8 +1289,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1367,8 +1340,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
else
{
/* At this point argptr->"fun". */
@@ -8872,7 +9628,7 @@ index 74902b6..4e54a3a 100644
p++;
/* At this point p->"". String ended. */
/* Nope, C++ operators could have spaces in them
-@@ -1355,6 +1304,19 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+@@ -1380,6 +1355,42 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
/* The above loop has already swallowed "operator". */
p += cp_validate_operator (p - 8) - 8;
}
@@ -8884,15 +9640,68 @@ index 74902b6..4e54a3a 100644
+ /* Keep method overload information. */
+ a = strchr (p, '(');
+ if (a != NULL)
-+ p = strrchr (a, ')') + 1;
++ p = find_method_overload_end (a);
+
+ /* Make sure we keep important kewords like "const" */
+ if (strncmp (p, " const", 6) == 0)
+ p += 6;
++
++ /* Java may append typenames, so assume that if there is
++ anything else left in *argptr, it must be a typename. */
++ if (*p && current_language->la_language == language_java)
++ {
++ struct type *type;
++ p2 = p;
++ while (*p2)
++ ++p2;
++ copy = (char *) alloca (p2 - p + 1);
++ memcpy (copy, p, p2 - p);
++ copy[p2 - p] = '\0';
++ type = lookup_typename (current_language, get_current_arch (),
++ copy, NULL, 1);
++ if (type != NULL)
++ {
++ /* Save the location of this just in case this
++ method/type combination isn't actually defined.
++ It will be checked later. */
++ saved_java_argptr = p;
++ p = p2;
++ }
++ }
}
/* Allocate our own copy of the substring between argptr and
-@@ -1509,8 +1471,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
+@@ -1408,9 +1419,26 @@ decode_compound (char **argptr, int funfirstline, char ***canonical,
+ here, we return. If not, and we are at the and of the string,
+ we'll lookup the whole string in the symbol tables. */
+
+- return find_method (funfirstline, canonical, saved_arg,
+- copy, t, sym_class, not_found_ptr);
+-
++ values = find_method (funfirstline, canonical, saved_arg,
++ copy, t, sym_class, not_found_ptr);
++ if (saved_java_argptr != NULL && values.nelts == 1)
++ {
++ /* The user specified a specific return type for a java method.
++ Double-check that it really is the one the user specified.
++ [This is a necessary evil because strcmp_iw_ordered stops
++ comparisons too prematurely.] */
++ sym = find_pc_sect_function (values.sals[0].pc,
++ values.sals[0].section);
++ /* We just found a SAL, we had better be able to go backwards! */
++ gdb_assert (sym != NULL);
++ if (strcmp_iw (SYMBOL_LINKAGE_NAME (sym), saved_arg) != 0)
++ {
++ xfree (values.sals);
++ error (_("the class `%s' does not have any method instance named %s\n"),
++ SYMBOL_PRINT_NAME (sym_class), copy);
++ }
++ }
++ return values;
+ } /* End if symbol found */
+
+
+@@ -1534,8 +1562,39 @@ find_method (int funfirstline, char ***canonical, char *saved_arg,
}
if (i1 > 0)
{
@@ -8928,13 +9737,23 @@ index 74902b6..4e54a3a 100644
+ }
+
+ error (_("the class `%s' does not have any method instance named %s\n"),
-+ SYMBOL_PRINT_NAME (sym_class), copy);
++ SYMBOL_PRINT_NAME (sym_class), copy);
+ }
+
return decode_line_2 (sym_arr, i1, funfirstline, canonical);
}
else
-@@ -1815,7 +1808,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
+@@ -1577,7 +1636,8 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
+ copy = (char *) alloca (p - *argptr + 1);
+ memcpy (copy, *argptr, p - *argptr);
+ /* It may have the ending quote right after the file name. */
+- if (is_quote_enclosed && copy[p - *argptr - 1] == '"')
++ if ((is_quote_enclosed && copy[p - *argptr - 1] == '"')
++ || copy[p - *argptr - 1] == '\'')
+ copy[p - *argptr - 1] = 0;
+ else
+ copy[p - *argptr] = 0;
+@@ -1840,7 +1900,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy,
{
struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym));
struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
@@ -8944,10 +9763,10 @@ index 74902b6..4e54a3a 100644
}
return values;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
-index 7fc9584..b286dfd 100644
+index e55d958..e41ed74 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
-@@ -2624,6 +2624,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+@@ -2618,6 +2618,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
return lp->stopped_data_address_p;
}
@@ -8987,7 +9806,7 @@ index 7fc9584..b286dfd 100644
/* Wait until LP is stopped. */
static int
-@@ -5500,6 +5533,8 @@ linux_nat_add_target (struct target_ops *t)
+@@ -5584,6 +5617,8 @@ linux_nat_add_target (struct target_ops *t)
t->to_thread_address_space = linux_nat_thread_address_space;
t->to_stopped_by_watchpoint = linux_nat_stopped_by_watchpoint;
t->to_stopped_data_address = linux_nat_stopped_data_address;
@@ -9104,10 +9923,10 @@ index 6804609..2cb1bf9 100644
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/machoread.c b/gdb/machoread.c
-index 02b61d3..13ab595 100644
+index a810bb2..b416970 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
-@@ -755,6 +755,7 @@ static struct sym_fns macho_sym_fns = {
+@@ -842,6 +842,7 @@ static struct sym_fns macho_sym_fns = {
macho_new_init, /* sym_new_init: init anything gbl to entire symtab */
macho_symfile_init, /* sym_init: read initial info, setup for sym_read() */
macho_symfile_read, /* sym_read: read a symbol file into symtab */
@@ -9369,7 +10188,7 @@ index 287f9de..1fe0fbe 100644
SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
return SYMBOL_VALUE_ADDRESS (msymbol);
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
-index 6bb4eb6..2b07942 100644
+index 5924b30..2957024 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -38,6 +38,7 @@
@@ -9380,7 +10199,7 @@ index 6bb4eb6..2b07942 100644
static struct target_so_ops mips_svr4_so_ops;
-@@ -1225,6 +1226,9 @@ mips_linux_init_abi (struct gdbarch_info info,
+@@ -1222,6 +1223,9 @@ mips_linux_init_abi (struct gdbarch_info info,
tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
"restart");
}
@@ -9391,7 +10210,7 @@ index 6bb4eb6..2b07942 100644
/* Provide a prototype to silence -Wmissing-prototypes. */
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
-index 4ef817e..1c53574 100644
+index 093313e..9144d00 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -394,6 +394,7 @@ static struct sym_fns ecoff_sym_fns =
@@ -9464,10 +10283,10 @@ index a050f15..04d1f1c 100644
if (sym != NULL)
{
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
-index 0b07e37..5de5300 100644
+index c2763c2..5d62020 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
-@@ -789,6 +789,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
+@@ -792,6 +792,10 @@ objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
}
}
@@ -9478,7 +10297,7 @@ index 0b07e37..5de5300 100644
{
struct partial_symbol **psym;
-@@ -914,7 +918,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+@@ -917,7 +921,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
int
objfile_has_partial_symbols (struct objfile *objfile)
{
@@ -9487,7 +10306,7 @@ index 0b07e37..5de5300 100644
}
/* Return non-zero if OBJFILE has full symbols. */
-@@ -954,6 +958,20 @@ have_partial_symbols (void)
+@@ -957,6 +961,20 @@ have_partial_symbols (void)
if (objfile_has_partial_symbols (ofp))
return 1;
}
@@ -9555,7 +10374,7 @@ index c689622..eb3ae10 100644
ALL_PSPACE_OBJFILES (ss, objfile) \
ALL_OBJFILE_PSYMTABS (objfile, p)
diff --git a/gdb/parse.c b/gdb/parse.c
-index d5a199b..c3ef9e1 100644
+index aabc461..e2ab8d9 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -62,6 +62,7 @@ const struct exp_descriptor exp_descriptor_standard =
@@ -9566,7 +10385,7 @@ index d5a199b..c3ef9e1 100644
op_name_standard,
dump_subexp_body_standard,
evaluate_subexp_standard
-@@ -511,6 +512,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
+@@ -523,6 +524,11 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
break;
@@ -9578,7 +10397,7 @@ index d5a199b..c3ef9e1 100644
case mst_data:
case mst_file_data:
case mst_bss:
-@@ -841,6 +847,10 @@ operator_length_standard (struct expression *expr, int endpos,
+@@ -853,6 +859,10 @@ operator_length_standard (struct expression *expr, int endpos,
args = 1;
break;
@@ -9589,7 +10408,21 @@ index d5a199b..c3ef9e1 100644
case OP_OBJC_MSGCALL: /* Objective C message (method) call */
oplen = 4;
args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
-@@ -1361,6 +1371,151 @@ parser_fprintf (FILE *x, const char *y, ...)
+@@ -889,6 +899,13 @@ operator_length_standard (struct expression *expr, int endpos,
+ args = 1;
+ break;
+
++ case OP_ADL_FUNC:
++ oplen = longest_to_int (expr->elts[endpos - 2].longconst);
++ oplen = 4 + BYTES_TO_EXP_ELEM (oplen + 1);
++ oplen++;
++ oplen++;
++ break;
++
+ case OP_LABELED:
+ case STRUCTOP_STRUCT:
+ case STRUCTOP_PTR:
+@@ -1373,6 +1390,151 @@ parser_fprintf (FILE *x, const char *y, ...)
va_end (args);
}
@@ -9742,10 +10575,10 @@ index d5a199b..c3ef9e1 100644
_initialize_parse (void)
{
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
-index 6fcf7ae..3f5efe8 100644
+index c4eb1a0..2a43fe3 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
-@@ -190,6 +190,13 @@ extern void operator_length (struct expression *, int, int *, int *);
+@@ -192,6 +192,13 @@ extern void operator_length (struct expression *, int, int *, int *);
extern void operator_length_standard (struct expression *, int, int *, int *);
@@ -9759,7 +10592,7 @@ index 6fcf7ae..3f5efe8 100644
extern char *op_name_standard (enum exp_opcode);
extern struct type *follow_types (struct type *);
-@@ -268,6 +275,20 @@ struct exp_descriptor
+@@ -270,6 +277,20 @@ struct exp_descriptor
the number of subexpressions it takes. */
void (*operator_length) (struct expression*, int, int*, int *);
@@ -9780,7 +10613,7 @@ index 6fcf7ae..3f5efe8 100644
/* Name of this operator for dumping purposes. */
char *(*op_name) (enum exp_opcode);
-@@ -300,4 +321,8 @@ extern void print_subexp_standard (struct expression *, int *,
+@@ -302,4 +323,8 @@ extern void print_subexp_standard (struct expression *, int *,
extern void parser_fprintf (FILE *, const char *, ...) ATTR_FORMAT (printf, 2 ,3);
@@ -15451,7 +16284,7 @@ index a792819..bdac80e 100644
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
-index 9196f08..5230a8c 100644
+index 1bfa700..52f9b39 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -61,36 +61,79 @@ typedef int Py_ssize_t;
@@ -16166,10 +16999,10 @@ index 94a77fb..7ea68d2 100644
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
-index 5689bf3..2b609af 100644
+index 8edc889..5ea1779 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
-@@ -1218,7 +1218,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
+@@ -1241,7 +1241,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
&& pc < info->interp_text_sect_high)
|| (pc >= info->interp_plt_sect_low
&& pc < info->interp_plt_sect_high)
@@ -16179,7 +17012,7 @@ index 5689bf3..2b609af 100644
}
/* Given an executable's ABFD and target, compute the entry-point
-@@ -1971,7 +1972,6 @@ struct target_so_ops svr4_so_ops;
+@@ -2038,7 +2039,6 @@ struct target_so_ops svr4_so_ops;
static struct symbol *
elf_lookup_lib_symbol (const struct objfile *objfile,
const char *name,
@@ -16187,7 +17020,7 @@ index 5689bf3..2b609af 100644
const domain_enum domain)
{
bfd *abfd;
-@@ -1989,8 +1989,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
+@@ -2056,8 +2056,7 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
return NULL;
@@ -16237,7 +17070,7 @@ index 573f736..51bfce9 100644
#endif
diff --git a/gdb/somread.c b/gdb/somread.c
-index c7beaba..e31164c 100644
+index 3d93c5e..a943806 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -432,6 +432,7 @@ static struct sym_fns som_sym_fns =
@@ -16353,10 +17186,10 @@ index 2caf9d2..7adc399 100644
for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi))
{
diff --git a/gdb/symfile.c b/gdb/symfile.c
-index bc52406..5d5d83f 100644
+index 8705420..16f96a1 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
-@@ -966,13 +966,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+@@ -968,13 +968,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
/* Give user a chance to burp if we'd be
interactively wiping out any existing symbols. */
@@ -16375,7 +17208,7 @@ index bc52406..5d5d83f 100644
discard_cleanups (my_cleanups);
/* We either created a new mapped symbol table, mapped an existing
-@@ -999,6 +1002,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+@@ -1001,6 +1004,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
if ((flags & OBJF_READNOW) || readnow_symbol_files)
{
@@ -16384,7 +17217,7 @@ index bc52406..5d5d83f 100644
if (from_tty || info_verbose)
{
printf_unfiltered (_("expanding to full symbols..."));
-@@ -2321,6 +2326,7 @@ reread_symbols (void)
+@@ -2323,6 +2328,7 @@ reread_symbols (void)
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
objfile->psymtabs_addrmap = NULL;
@@ -16392,7 +17225,7 @@ index bc52406..5d5d83f 100644
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;
-@@ -2331,6 +2337,8 @@ reread_symbols (void)
+@@ -2333,6 +2339,8 @@ reread_symbols (void)
memset (&objfile->msymbol_demangled_hash, 0,
sizeof (objfile->msymbol_demangled_hash));
@@ -16402,10 +17235,10 @@ index bc52406..5d5d83f 100644
objfile->macro_cache = bcache_xmalloc ();
objfile->filename_cache = bcache_xmalloc ();
diff --git a/gdb/symfile.h b/gdb/symfile.h
-index efa069e..b520b93 100644
+index fe95255..075610b 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
-@@ -139,6 +139,12 @@ struct sym_fns
+@@ -141,6 +141,12 @@ struct sym_fns
void (*sym_read) (struct objfile *, int);
@@ -16418,7 +17251,7 @@ index efa069e..b520b93 100644
/* Called when we are finished with an objfile. Should do all
cleanup that is specific to the object file format for the
particular objfile. */
-@@ -315,8 +321,7 @@ extern int auto_solib_limit;
+@@ -330,8 +336,7 @@ extern int auto_solib_limit;
extern void set_initial_language (void);
@@ -16428,7 +17261,7 @@ index efa069e..b520b93 100644
extern void discard_psymtab (struct partial_symtab *);
-@@ -387,7 +392,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
+@@ -402,7 +407,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data);
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
@@ -19178,18 +20011,18 @@ index 0000000..5da7378
+gdb_test "p temp2" " = '2' " "second: print temp2"
+gdb_test "p temp3" " = '3' " "second: print temp3"
diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in
-index c990a64..c964db9 100644
+index d78258e..1774244 100644
--- a/gdb/testsuite/gdb.cp/Makefile.in
+++ b/gdb/testsuite/gdb.cp/Makefile.in
@@ -4,7 +4,7 @@ srcdir = @srcdir@
EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
derivation inherit local member-ptr method misc \
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
-- ref-types ref-params method2 pr9594 gdb2495 virtfunc2
-+ ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2
+- ref-types ref-params method2 pr9594 gdb2495 virtfunc2 pr9067 \
++ ref-types ref-params method2 pr9594 gdb2495 gdb9593 virtfunc2 pr9067 \
+ pr1072
all info install-info dvi install uninstall installcheck check:
- @echo "Nothing to be done for $@..."
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index f81a212..30d362a 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -19213,6 +20046,1173 @@ index f81a212..30d362a 100644
-gdb_test "break *'$func2_name'" \
+gdb_test "break *$func2_name" \
"Breakpoint $decimal at 0x2....: file .*"
+diff --git a/gdb/testsuite/gdb.cp/cpexprs.cc b/gdb/testsuite/gdb.cp/cpexprs.cc
+new file mode 100644
+index 0000000..2bca4cd
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cpexprs.cc
+@@ -0,0 +1,431 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
++
++ Contributed by Red Hat, originally written by Keith Seitz.
++
++ 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 .
++
++ Please email any bugs, comments, and/or additions to this file to:
++ bug-gdb@gnu.org */
++
++#include
++#include
++
++// Forward decls
++class base;
++class derived;
++
++// A simple template with specializations
++template
++class tclass
++{
++public:
++ void do_something () { } // tclass::do_something
++};
++
++template <>
++void tclass::do_something () { } // tclass::do_something
++
++template <>
++void tclass::do_something () { } // tclass::do_something
++
++template<>
++void tclass::do_something () { } // tclass::do_something
++
++template<>
++void tclass::do_something () { } // tclass::do_something
++
++// A simple template with multiple template parameters
++template
++void flubber (void) // flubber
++{
++ A a;
++ B b;
++ C c;
++ D d;
++ E e;
++
++ ++a;
++ ++b;
++ ++c;
++ ++d;
++ ++e;
++}
++
++// Some contrived policies
++template
++struct operation_1
++{
++ static void function (void) { } // operation_1::function
++};
++
++template
++struct operation_2
++{
++ static void function (void) { } // operation_2::function
++};
++
++template
++struct operation_3
++{
++ static void function (void) { } // operation_3::function
++};
++
++template
++struct operation_4
++{
++ static void function (void) { } // operation_4::function
++};
++
++// A policy-based class w/ and w/o default policy
++template
++class policy : public Policy
++{
++public:
++ policy (T obj) : obj_ (obj) { } // policy::policy
++
++private:
++ T obj_;
++};
++
++template >
++class policyd : public Policy
++{
++public:
++ policyd (T obj) : obj_ (obj) { } // policyd::policyd
++ ~policyd (void) { } // policyd::~policyd
++
++private:
++ T obj_;
++};
++
++typedef policy > policy1;
++typedef policy > policy2;
++typedef policy > policy3;
++typedef policy > policy4;
++
++typedef policyd policyd1;
++typedef policyd policyd2;
++typedef policyd policyd3;
++typedef policyd policyd4;
++typedef policyd > policyd5;
++
++class fluff { };
++static fluff *g_fluff = new fluff ();
++
++class base
++{
++protected:
++ int foo_;
++
++public:
++ base (void) : foo_ (42) { } // base::base(void)
++ base (int foo) : foo_ (foo) { } // base::base(int)
++ ~base (void) { } // base::~base
++
++ // Some overloaded methods
++ int overload (void) const { return 0; } // base::overload(void) const
++ int overload (int i) const { return 1; } // base::overload(int) const
++ int overload (short s) const { return 2; } // base::overload(short) const
++ int overload (long l) const { return 3; } // base::overload(long) const
++ int overload (char* a) const { return 4; } // base::overload(char*) const
++ int overload (base& b) const { return 5; } // base::overload(base&) const
++
++ // Operators
++ int operator+ (base const& o) const // base::operator+
++ { return foo_ + o.foo_; }
++
++ base operator++ (void) // base::operator++
++ { ++foo_; return *this; }
++
++ base operator+=(base const& o) // base::operator+=
++ { foo_ += o.foo_; return *this; }
++
++ int operator- (base const& o) const // base::operator-
++ { return foo_ - o.foo_; }
++
++ base operator-- (void) // base::operator--
++ { --foo_; return *this; }
++
++ base operator-= (base const& o) // base::operator-=
++ { foo_ -= o.foo_; return *this; }
++
++ int operator* (base const& o) const // base::operator*
++ { return foo_ * o.foo_; }
++
++ base operator*= (base const& o) // base::operator*=
++ { foo_ *= o.foo_; return *this; }
++
++ int operator/ (base const& o) const // base::operator/
++ { return foo_ / o.foo_; }
++
++ base operator/= (base const& o) // base::operator/=
++ { foo_ /= o.foo_; return *this; }
++
++ int operator% (base const& o) const // base::operator%
++ { return foo_ % o.foo_; }
++
++ base operator%= (base const& o) // base::operator%=
++ { foo_ %= o.foo_; return *this; }
++
++ bool operator< (base const& o) const // base::operator<
++ { return foo_ < o.foo_; }
++
++ bool operator<= (base const& o) const // base::operator<=
++ { return foo_ <= o.foo_; }
++
++ bool operator> (base const& o) const // base::operator>
++ { return foo_ > o.foo_; }
++
++ bool operator>= (base const& o) const // base::operator>=
++ { return foo_ >= o.foo_; }
++
++ bool operator!= (base const& o) const // base::operator!=
++ { return foo_ != o.foo_; }
++
++ bool operator== (base const& o) const // base::operator==
++ { return foo_ == o.foo_; }
++
++ bool operator! (void) const // base::operator!
++ { return !foo_; }
++
++ bool operator&& (base const& o) const // base::operator&&
++ { return foo_ && o.foo_; }
++
++ bool operator|| (base const& o) const // base::operator||
++ { return foo_ || o.foo_; }
++
++ int operator<< (int value) const // base::operator<<
++ { return foo_ << value; }
++
++ base operator<<= (int value) // base::operator<<=
++ { foo_ <<= value; return *this; }
++
++ int operator>> (int value) const // base::operator>>
++ { return foo_ >> value; }
++
++ base operator>>= (int value) // base::operator>>=
++ { foo_ >>= value; return *this; }
++
++ int operator~ (void) const // base::operator~
++ { return ~foo_; }
++
++ int operator& (base const& o) const // base::operator&
++ { return foo_ & o.foo_; }
++
++ base operator&= (base const& o) // base::operator&=
++ { foo_ &= o.foo_; return *this; }
++
++ int operator| (base const& o) const // base::operator|
++ { return foo_ | o.foo_; }
++
++ base operator|= (base const& o) // base::operator|=
++ { foo_ |= o.foo_; return *this; }
++
++ int operator^ (base const& o) const // base::operator^
++ { return foo_ ^ o.foo_; }
++
++ base operator^= (base const& o) // base::operator^=
++ { foo_ ^= o.foo_; return *this; }
++
++ base operator= (base const& o) // base::operator=
++ { foo_ = o.foo_; return *this; }
++
++ void operator() (void) const // base::operator()
++ { return; }
++
++ int operator[] (int idx) const // base::operator[]
++ { return idx; }
++
++ void* operator new (size_t size) throw () // base::operator new
++ { return malloc (size); }
++
++ void operator delete (void* ptr) // base::operator delete
++ { free (ptr); }
++
++ void* operator new[] (size_t size) throw () // base::operator new[]
++ { return malloc (size); }
++
++ void operator delete[] (void* ptr) // base::operator delete[]
++ { free (ptr); }
++
++ base const* operator-> (void) const // base::opeartor->
++ { return this; }
++
++ int operator->* (base const& b) const // base::operator->*
++ { return foo_ * b.foo_; }
++
++ operator char* () const { return const_cast ("hello"); } // base::operator char*
++ operator int () const { return 21; } // base::operator int
++ operator fluff* () const { return new fluff (); } // base::operator fluff*
++ operator fluff** () const { return &g_fluff; } // base::operator fluff**
++};
++
++class base1 : public virtual base
++{
++public:
++ base1 (void) : foo_ (21) { } // base1::base1(void)
++ base1 (int a) : foo_(a) { } // base1::base1(int)
++ void a_function (void) const { } // base1::a_function
++
++protected:
++ int foo_;
++};
++
++class base2 : public virtual base
++{
++public:
++ base2 () : foo_ (3) { } // base2::base2
++
++protected:
++ void a_function (void) const { } // base2::a_function
++ int foo_;
++};
++
++class derived : public base1, public base2
++{
++ public:
++ derived(void) : foo_ (4) { } // derived::derived
++ void a_function (void) const // derived::a_function
++ {
++ this->base1::a_function ();
++ this->base2::a_function ();
++ }
++
++ protected:
++ int foo_;
++};
++
++int
++main (int argc, char* argv[]) // main
++{ // main
++ derived d;
++ void (derived::*pfunc) (void) const = &derived::a_function;
++ (d.*pfunc) ();
++
++ base a (1), b (3), c (8);
++ (void) a.overload ();
++ (void) a.overload (static_cast (0));
++ (void) a.overload (static_cast (0));
++ (void) a.overload (static_cast (0));
++ (void) a.overload (static_cast (0));
++ (void) a.overload (a);
++
++ int r;
++ r = b + c;
++ ++a;
++ a += b;
++ r = b - c;
++ --a;
++ a -= b;
++ r = b * c;
++ a *= b;
++ r = b / c;
++ a /= b;
++ r = b % c;
++ a %= b;
++ bool x = (b < c);
++ x = (b <= c);
++ x = (b > c);
++ x = (b >= c);
++ x = (b != c);
++ x = (b == c);
++ x = (!b);
++ x = (b && c);
++ x = (b || c);
++ r = b << 2;
++ a <<= 1;
++ r = b >> 2;
++ a >>= 1;
++ r = ~b;
++ r = b & c;
++ a &= c;
++ r = b | c;
++ a |= c;
++ r = b ^ c;
++ a ^= c;
++ a = c;
++ a ();
++ int i = a[3];
++ derived* f = new derived ();
++ derived* g = new derived[3];
++ delete f;
++ delete[] g;
++ a->overload ();
++ r = a->*b;
++
++ tclass char_tclass;
++ tclass int_tclass;
++ tclass short_tclass;
++ tclass long_tclass;
++ tclass base_tclass;
++ char_tclass.do_something ();
++ int_tclass.do_something ();
++ short_tclass.do_something ();
++ long_tclass.do_something ();
++ base_tclass.do_something ();
++
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++ flubber ();
++
++ policy1 p1 (1);
++ p1.function ();
++ policy2 p2 (2);
++ p2.function ();
++ policy3 p3 (3);
++ p3.function ();
++ policy4 p4 (4);
++ p4.function ();
++
++ policyd1 pd1 (5);
++ pd1.function ();
++ policyd2 pd2 (6);
++ pd2.function ();
++ policyd3 pd3 (7);
++ pd3.function ();
++ policyd4 pd4 (d);
++ pd4.function ();
++ policyd5 pd5 (int_tclass);
++ pd5.function ();
++
++ base1 b1 (3);
++
++ r = a;
++ char* str = a;
++ fluff* flp = a;
++ fluff** flpp = a;
++}
++
+diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp
+new file mode 100644
+index 0000000..6074763
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/cpexprs.exp
+@@ -0,0 +1,724 @@
++# cpexprs.exp - C++ expressions tests
++#
++# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
++#
++# Contributed by Red Hat, originally written by Keith Seitz.
++#
++# 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 file is part of the gdb testsuite.
++
++# A helper proc which sets a breakpoint at FUNC and attempts to
++# run to the breakpoint.
++proc test_breakpoint {func} {
++ global DEC
++
++ # Restart every time
++ if {![runto_main]} {
++ perror "could not run to main when attempting to break at $func"
++ } else {
++ gdb_breakpoint "$func"
++ set i [expr {[string last : $func] + 1}]
++ set efunc [string_to_regexp [string range $func $i end]]
++ gdb_test "continue" \
++ "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \
++ "continue to $func"
++ }
++}
++
++# Add a function to the list of tested functions
++# FUNC is the name of the function (which will be passed to gdb commands)
++# TYPE is the type of the function, as expected from the "print" command
++# PRINT is the name of the function, as expected result of the print command
++# *OR* "-", indicating that FUNC should be used (needed for virtual/inherited
++# funcs)
++# LST is either the expected result of the list command (the comment from
++# the source code) *OR* "-", in which case FUNC will be used
++#
++# Usage:
++# add NAME TYPE PRINT LST
++# add NAME TYPE PRINT -
++proc add {func type print lst} {
++ global all_functions CONVAR ADDR
++
++ set all_functions($func,type) $type
++ if {$print == "-"} {
++ set print $func
++ }
++
++ # An exception: since gdb canonicalizes C++ output,
++ # "(void)" must be mutated to "()".
++ regsub {\(void\)} $print {()} print
++
++ set all_functions($func,print) \
++ "$CONVAR = {[string_to_regexp $type]} $ADDR <[string_to_regexp $print].*>"
++ if {$lst == "-"} {
++ set lst "$func"
++ }
++ set all_functions($func,list) ".*// [string_to_regexp $lst]"
++}
++
++proc get {func cmd} {
++ global all_functions
++ return $all_functions($func,$cmd)
++}
++
++# Returns a list of function names for a given command
++proc get_functions {cmd} {
++ global all_functions
++ set result {}
++ foreach i [array names all_functions *,$cmd] {
++ if {$all_functions($i) != ""} {
++ set idx [string last , $i]
++ if {$idx != -1} {
++ lappend result [string range $i 0 [expr {$idx - 1}]]
++ }
++ }
++ }
++
++ return [lsort $result]
++}
++
++# Some convenience variables for this test
++set DEC {[0-9]}; # a decimal number
++set HEX {[0-9a-fA-F]}; # a hexidecimal number
++set CONVAR "\\\$$DEC+"; # convenience variable regexp
++set ADDR "0x$HEX+"; # address
++
++# An array of functions/methods that we are testing...
++# Each element consists is indexed by NAME,COMMAND, where
++# NAME is the function name and COMMAND is the gdb command that
++# we are testing. The value of the array for any index pair is
++# the expected result of running COMMAND with the NAME as argument.
++
++# The array holding all functions/methods to test. Valid subindexes
++# are (none need character escaping -- "add" will take care of that):
++
++# add name type print_name list
++# NAME,type: value is type of function
++# NAME,print: value is print name of function (careful w/inherited/virtual!)
++# NAME,list: value is comment in source code on first line of function
++# (without the leading "//")
++array set all_functions {}
++
++# "Normal" functions/methods
++add {main} \
++ {int (int, char **)} \
++ - \
++ -
++add {derived::a_function} \
++ {void (const derived * const)} \
++ - \
++ -
++add {base1::a_function} \
++ {void (const base1 * const)} \
++ - \
++ -
++add {base2::a_function} \
++ {void (const base2 * const)} \
++ - \
++ -
++
++# Constructors
++
++# On targets using the ARM EABI, the constructor is expected to return
++# "this".
++proc ctor { type arglist } {
++ if { [istarget arm*-*eabi*] } {
++ set ret "$type *"
++ } else {
++ set ret "void "
++ }
++ if { $arglist != "" } {
++ set arglist ", $arglist"
++ }
++ return "${ret}($type * const$arglist)"
++}
++
++add {derived::derived} \
++ [ctor derived ""] \
++ - \
++ -
++add {base1::base1(void)} \
++ [ctor base1 "const void ** const"] \
++ - \
++ -
++add {base1::base1(int)} \
++ [ctor base1 "int"] \
++ - \
++ -
++add {base2::base2} \
++ [ctor base2 "const void ** const"] \
++ - \
++ -
++add {base::base(void)} \
++ [ctor base ""] \
++ - \
++ -
++add {base::base(int)} \
++ [ctor base "int"] \
++ - \
++ -
++
++# Destructors
++
++# On targets using the ARM EABI, some destructors are expected
++# to return "this". Others are void. For internal reasons,
++# GCC returns void * instead of $type *; RealView appears to do
++# the same.
++proc dtor { type } {
++ if { [istarget arm*-*eabi*] } {
++ set ret "void *"
++ } else {
++ set ret "void "
++ }
++ return "${ret}($type * const)"
++}
++
++add {base::~base} \
++ [dtor base] \
++ - \
++ -
++
++# Overloaded methods (all are const -- we try to use the void
++# method with and without specifying "const")
++add {base::overload(void)} \
++ {int (const base * const)} \
++ - \
++ {base::overload(void) const}
++add {base::overload(void) const} \
++ {int (const base * const)} \
++ - \
++ {base::overload(void) const}
++add {base::overload(int) const} \
++ {int (const base * const, int)} \
++ - \
++ -
++add {base::overload(short) const} \
++ {int (const base * const, short)} \
++ - \
++ -
++add {base::overload(long) const} \
++ {int (const base * const, long)} \
++ - \
++ -
++add {base::overload(char*) const} \
++ {int (const base * const, char *)} \
++ - \
++ -
++add {base::overload(base&) const} \
++ {int (const base * const, base &)} \
++ - \
++ -
++
++# Operators
++add {base::operator+} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator++} \
++ {base (base * const)} \
++ - \
++ -
++add {base::operator+=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator-} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator--} \
++ {base (base * const)} \
++ - \
++ -
++add {base::operator-=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator*} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator*=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator/} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator/=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator%} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator%=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator<} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator<=} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator>} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator>=} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator!=} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator==} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator!} \
++ {bool (const base * const)} \
++ - \
++ -
++add {base::operator&&} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator||} \
++ {bool (const base * const, const base &)} \
++ - \
++ -
++add {base::operator<<} \
++ {int (const base * const, int)} \
++ - \
++ -
++add {base::operator<<=} \
++ {base (base * const, int)} \
++ - \
++ -
++add {base::operator>>} \
++ {int (const base * const, int)} \
++ - \
++ -
++add {base::operator>>=} \
++ {base (base * const, int)} \
++ - \
++ -
++add {base::operator~} \
++ {int (const base * const)} \
++ - \
++ -
++add {base::operator&} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator&=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator|} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator|=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator^} \
++ {int (const base * const, const base &)} \
++ - \
++ -
++add {base::operator^=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator=} \
++ {base (base * const, const base &)} \
++ - \
++ -
++add {base::operator()} \
++ {void (const base * const)} \
++ - \
++ -
++add {base::operator[]} \
++ {int (const base * const, int)} \
++ - \
++ -
++add {base::operator new} \
++ {void *(size_t)} \
++ - \
++ -
++add {base::operator delete} \
++ {void (void *)} \
++ - \
++ -
++add {base::operator new[]} \
++ {void *(size_t)} \
++ - \
++ -
++add {base::operator delete[]} \
++ {void (void *)} \
++ - \
++ -
++add {base::operator char*} \
++ {char *(const base * const)} \
++ - \
++ -
++add {base::operator fluff*} \
++ {fluff *(const base * const)} \
++ - \
++ -
++add {base::operator fluff**} \
++ {fluff **(const base * const)} \
++ - \
++ -
++add {base::operator int} \
++ {int (const base * const)} \
++ - \
++ -
++
++# Templates
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ -
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ -
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ -
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ -
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ -
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {flubber} \
++ {void (void)} \
++ - \
++ flubber
++add {tclass::do_something} \
++ {void (tclass * const)} \
++ - \
++ {tclass::do_something}
++add {policy1::policy} \
++ [ctor "policy >" "int"] \
++ {policy >::policy} \
++ {policy::policy}
++add {policy2::policy} \
++ [ctor "policy >" int] \
++ {policy >::policy} \
++ {policy::policy}
++add {policy3::policy} \
++ [ctor "policy >" "int"] \
++ {policy >::policy} \
++ {policy::policy}
++add {policy4::policy} \
++ [ctor "policy >" "int"] \
++ {policy >::policy} \
++ {policy::policy}
++add {policy1::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policy2::function} \
++ {void (void)} \
++ {operation_2::function} \
++ {operation_2::function}
++add {policy3::function} \
++ {void (void)} \
++ {operation_3::function} \
++ {operation_3::function}
++add {policy4::function} \
++ {void (void)} \
++ {operation_4::function} \
++ {operation_4::function}
++add {policyd >::policyd} \
++ [ctor "policyd >" "int"] \
++ - \
++ {policyd::policyd}
++add {policyd1::policyd} \
++ [ctor "policyd >" "int"] \
++ {policyd >::policyd} \
++ {policyd::policyd}
++add {policyd >::~policyd} \
++ [dtor "policyd >"] \
++ - \
++ {policyd::~policyd}
++add {policyd1::~policyd} \
++ [dtor "policyd >"] \
++ {policyd >::~policyd} \
++ {policyd::~policyd}
++add {policyd >::policyd} \
++ [ctor "policyd >" "long"] \
++ - \
++ {policyd::policyd}
++add {policyd2::policyd} \
++ [ctor "policyd >" "long"] \
++ {policyd >::policyd} \
++ {policyd::policyd}
++add {policyd >::~policyd} \
++ [dtor "policyd >"] \
++ - \
++ {policyd::~policyd}
++add {policyd2::~policyd} \
++ [dtor "policyd >"] \
++ {policyd >::~policyd} \
++ {policyd::~policyd}
++add {policyd >::policyd} \
++ [ctor "policyd >" "char"] \
++ - \
++ {policyd::policyd}
++add {policyd3::policyd} \
++ [ctor "policyd >" "char"] \
++ {policyd >::policyd} \
++ {policyd::policyd}
++add {policyd >::~policyd} \
++ [dtor "policyd >"] \
++ - \
++ {policyd::~policyd}
++add {policyd3::~policyd} \
++ [dtor "policyd >"] \
++ {policyd >::~policyd} \
++ {policyd::~policyd}
++add {policyd >::policyd} \
++ [ctor "policyd >" "base"] \
++ - \
++ {policyd::policyd}
++add {policyd4::policyd} \
++ [ctor "policyd >" "base"] \
++ {policyd >::policyd} \
++ {policyd::policyd}
++add {policyd >::~policyd} \
++ [dtor "policyd >"] \
++ - \
++ {policyd::~policyd}
++add {policyd4::~policyd} \
++ [dtor "policyd >"] \
++ {policyd >::~policyd} \
++ {policyd::~policyd}
++add {policyd, operation_1 > >::policyd} \
++ [ctor "policyd, operation_1 > >" "tclass"] \
++ - \
++ {policyd::policyd}
++add {policyd5::policyd} \
++ [ctor "policyd, operation_1 > >" "tclass"] \
++ {policyd, operation_1 > >::policyd} \
++ {policyd::policyd}
++add {policyd, operation_1 > >::~policyd} \
++ [dtor "policyd, operation_1 > >"] \
++ - \
++ {policyd::~policyd}
++add {policyd5::~policyd} \
++ [dtor "policyd, operation_1 > >"] \
++ {policyd, operation_1 > >::~policyd} \
++ {policyd::~policyd}
++add {policyd >::function} \
++ {void (void)} \
++ {operation_1::function}\
++ {operation_1::function}
++add {policyd1::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd2::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd >::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd3::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd >::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd4::function} \
++ {void (void)} \
++ {operation_1::function} \
++ {operation_1::function}
++add {policyd, operation_1 > >::function} \
++ {void (void)} \
++ {operation_1 >::function} \
++ {operation_1::function}
++add {policyd5::function} \
++ {void (void)} \
++ {operation_1 >::function} \
++ {operation_1::function}
++
++# Start the test
++if {$tracelevel} {
++ strace $tracelevel
++}
++
++if {[skip_cplus_tests]} { continue }
++
++#
++# test running programs
++#
++set prms_id 0
++set bug_id 0
++
++set testfile "cpexprs"
++set srcfile "${testfile}.cc"
++set binfile [file join $objdir $subdir $testfile]
++
++if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
++ executable {debug c++}] != "" } {
++ untested "$testfile.exp"
++ return -1
++}
++
++if {[get_compiler_info $binfile "c++"]} {
++ return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir [file join $srcdir $subdir]
++gdb_load $binfile
++
++if {![runto_main]} {
++ perror "couldn't run to breakpoint"
++ continue
++}
++
++# Set the listsize to one. This will help with testing "list".
++gdb_test "set listsize 1"
++
++# "print METHOD"
++foreach name [get_functions print] {
++ gdb_test "print $name" [get $name print] "print $name"
++}
++
++# "list METHOD"
++foreach name [get_functions list] {
++ gdb_test "list $name" [get $name list] "list $name"
++}
++
++# Running to breakpoint -- use any function we can "list"
++foreach name [get_functions list] {
++ # Skip "main", since test_breakpoint uses it
++ if {[string compare $name "main"] != 0} {
++ test_breakpoint $name
++ }
++}
++
++gdb_exit
++return 0
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc
index f4f78a6..11dba06 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.cc
@@ -20134,6 +22134,362 @@ index 6832f3b..baf08d7 100644
-gdb_test "print null_pmf = &A::foo" "$vhn = $hex "
+gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex "
gdb_test "print null_pmf = 0" "$vhn = NULL"
+diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.cc b/gdb/testsuite/gdb.cp/namespace-koenig.cc
+new file mode 100644
+index 0000000..3c30cb2
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-koenig.cc
+@@ -0,0 +1,232 @@
++namespace A
++{
++ class C
++ {
++ public:
++ static const int x = 11;
++ };
++
++ int
++ first (C c)
++ {
++ return 11;
++ }
++
++ int
++ first (int a, C c)
++ {
++ return 22;
++ }
++
++ int
++ second (int a, int b, C cc, int c, int d)
++ {
++ return 33;
++ }
++
++}
++
++struct B
++{
++ A::C c;
++};
++
++//------------
++
++namespace E
++{
++ class O{};
++ int foo (O o){return 1; }
++ int foo (O o, O o2){return 2; }
++ int foo (O o, O o2, int i){return 3; }
++}
++
++namespace F
++{
++ class O{};
++ int foo ( O fo, ::E::O eo){ return 4;}
++ int foo (int i, O fo, ::E::O eo){ return 5;}
++}
++
++namespace G
++{
++ class O{};
++ int foo (O go, ::F::O fo, ::E::O eo){ return 6; }
++}
++
++//------------
++
++namespace H
++{
++ class O{};
++ int foo (O){ return 7;}
++}
++
++namespace I
++{
++ class O: public H::O {};
++ class X: H::O{};
++}
++
++//------------
++
++namespace J
++{
++ union U{};
++ struct S{};
++ enum E{};
++
++ class A{
++ public:
++ class B{};
++ };
++
++ class C{};
++
++ int foo (U){ return 8;}
++ int foo (S){ return 9;}
++ int foo (E){ return 10;}
++ int foo (A::B){ return 11;}
++ int foo (A*){ return 12;}
++ int foo (A**){ return 13;}
++ int foo (C[]){ return 14;}
++
++}
++//------------
++
++namespace K{
++ class O{};
++
++ int foo(O, int){
++ return 15;
++ }
++
++ int bar(O, int){
++ return 15;
++ }
++}
++
++int foo(K::O, float){
++ return 16;
++}
++
++int bar(K::O, int){
++ return 16;
++}
++//------------
++
++namespace L {
++ namespace A{
++ namespace B{
++ class O {};
++
++ int foo (O){
++ return 17;
++ }
++
++ }
++ }
++}
++
++//------------
++
++namespace M {
++ class O{
++ public:
++ int operator== (int){
++ return 18;
++ }
++
++ int operator== (float){
++ return 19;
++ }
++
++ int operator+ (float){
++ return 22;
++ }
++
++ };
++
++ int operator!= (O, int){
++ return 20;
++ }
++
++ int operator!= (O, double){
++ return 21;
++ }
++
++ int operator+ (O, int){
++ return 23;
++ }
++
++ int operator++ (O){
++ return 24;
++ }
++
++}
++//------------
++int
++main ()
++{
++ A::C c;
++ B b;
++
++ A::first (c);
++ first (0, c);
++ second (0, 0, c, 0, 0);
++ A::first (b.c);
++
++ E::O eo;
++ F::O fo;
++ G::O go;
++
++ foo (eo);
++ foo (eo, eo);
++ foo (eo, eo, 1);
++ foo (fo, eo);
++ foo (1 ,fo, eo);
++ foo (go, fo, eo);
++
++ I::O io;
++ I::X ix;
++
++ foo (io);
++//foo (ix);
++
++ J::U ju;
++ J::S js;
++ J::E je;
++ J::A::B jab;
++ J::A *jap;
++ J::A **japp;
++ J::C jca[3];
++
++ foo (ju);
++ foo (js);
++ foo (je);
++ foo (jab);
++ foo (jap);
++ foo (japp);
++ foo (jca);
++
++ K::O ko;
++ foo (ko, 1);
++ foo (ko, 1.0f);
++ //bar(ko,1);
++
++ L::A::B::O labo;
++ foo (labo);
++
++ M::O o;
++ o == 5;
++ o == 5.0f;
++ o != 5;
++ o != 5.0f;
++ o + 5;
++ o + 5.0f;
++
++ return first (0, c) + foo (eo) +
++ foo (eo, eo) + foo (eo, eo, 1) +
++ foo (fo, eo) + foo (1 ,fo, eo) +
++ foo (go, fo, eo);
++}
+diff --git a/gdb/testsuite/gdb.cp/namespace-koenig.exp b/gdb/testsuite/gdb.cp/namespace-koenig.exp
+new file mode 100644
+index 0000000..c73e239
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-koenig.exp
+@@ -0,0 +1,112 @@
++# 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 $tracelevel then {
++ strace $tracelevel
++}
++
++set prms_id 0
++set bug_id 0
++
++set testfile namespace-koenig
++set srcfile ${testfile}.cc
++set binfile ${objdir}/${subdir}/${testfile}
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
++ untested "Couldn't compile test program"
++ return -1
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++############################################
++
++if ![runto_main] then {
++ perror "couldn't run to breakpoint main"
++ continue
++}
++
++# Test that koenig lookup finds correct function
++gdb_test "p first(c)" "= 11"
++
++# Change the number of parameters and position of
++# the qualifying parameter
++gdb_test "p second(0,0,c,0,0)" "= 33"
++
++# Test that koenig lookup finds correct function
++# even if it is overloaded
++gdb_test "p first(0,c)" "= 22"
++
++# Test that koenig lookup finds correct function
++# when the argument is an expression
++gdb_test "p first(b.c)" "= 11"
++
++# test that resolutions can be made across namespaces
++gdb_test "p foo(eo)" "= 1"
++gdb_test "p foo(eo, eo)" "= 2"
++gdb_test "p foo(eo, eo, 1)" "= 3"
++gdb_test "p foo(fo, eo)" "= 4"
++gdb_test "p foo(1 ,fo, eo)" "= 5"
++gdb_test "p foo(go, fo, eo)" "= 6"
++
++#test that gdb fails gracefully
++gdb_test "p fake(eo)" "No symbol \"fake\" in current context."
++
++#test that namespaces of base classes are searched
++gdb_test "p foo(io)" "= 7"
++gdb_test "p foo(ix)" "Cannot resolve function foo to any overloaded instance"
++
++#test for other types
++gdb_test "p foo(ju)" "= 8"
++gdb_test "p foo(js)" "= 9"
++gdb_test "p foo(je)" "= 10"
++
++#test for class members
++setup_xfail "*-*-*"
++gdb_test "p foo(jab)" "= 11"
++
++gdb_test "p foo(jap)" "= 12"
++gdb_test "p foo(japp)" "= 13"
++gdb_test "p foo(jca)" "= 14"
++
++#test overload resolution
++gdb_test "p foo(ko,1)" "= 15"
++gdb_test "p foo(ko,1.0f)" "= 16"
++setup_xfail "*-*-*"
++gdb_test "p bar(ko,1)" "= -1"
++
++#test lookup of objects belonging to nested namespaces
++gdb_test "p foo(labo)" "= 17"
++
++# test lookup of namespace user-defined operators
++# and overload resolution:
++
++# within class
++gdb_test "p o == 5" "= 18"
++gdb_test "p o == 5.0f" "= 19"
++
++# within namespace
++gdb_test "p o != 5" "= 20"
++gdb_test "p o != 5.0f" "= 21"
++
++# across namespace and class
++gdb_test "p o + 5.0f" "= 22"
++gdb_test "p o + 5" "= 23"
++
++gdb_test "p o++" "= 24"
diff --git a/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc b/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc
new file mode 100644
index 0000000..6b180d6
@@ -20907,7 +23263,7 @@ index 4362fd8..f7cfd57 100644
# Some anonymous namespace tests.
diff --git a/gdb/testsuite/gdb.cp/nsusing.exp b/gdb/testsuite/gdb.cp/nsusing.exp
-index bd115c4..5f80f7d 100644
+index 72a616e..fd99f87 100644
--- a/gdb/testsuite/gdb.cp/nsusing.exp
+++ b/gdb/testsuite/gdb.cp/nsusing.exp
@@ -30,7 +30,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
@@ -20920,7 +23276,7 @@ index bd115c4..5f80f7d 100644
diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp
-index 1bfa0f3..9fd31a8 100644
+index ae8fd26..8291022 100644
--- a/gdb/testsuite/gdb.cp/overload.exp
+++ b/gdb/testsuite/gdb.cp/overload.exp
@@ -74,12 +74,12 @@ set re_methods "${re_methods}${ws}int overload1arg\\((void|)\\);"
@@ -22749,6 +25105,242 @@ index 0000000..39632d5
+
+# Failed gdb_load would abort the testcase execution earlier.
+pass "file loaded"
+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..9353698
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+@@ -0,0 +1,176 @@
++/* 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 */
++
++.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 */
++
++ .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:
++
++ .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 */
++
++ .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..28db005
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+@@ -0,0 +1,48 @@
++# 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\]}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
new file mode 100644
index 0000000..7b03ff1
@@ -23875,6 +26467,43 @@ index 9e787f0..5ca15d5 100644
-re ".*time_at_startup = get_run_time.*$gdb_prompt $" {
set description "next over get_run_time and everything it calls"
set command "next"
+diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp
+index ab95247..9814921 100644
+--- a/gdb/testsuite/gdb.java/jmain.exp
++++ b/gdb/testsuite/gdb.java/jmain.exp
+@@ -65,7 +65,7 @@ gdb_test "break jmain.main" "${bpmain}"
+
+ # Check that a fully qualified "main" works.
+ gdb_load "${binfile}"
+-set cmd "break \'${testfile}.main(java.lang.String\[\])\'"
++set cmd "break ${testfile}.main(java.lang.String\[\])"
+ set msg $cmd
+ gdb_test_multiple $cmd $msg {
+ -re "${bpmain}\r\n$gdb_prompt $" {
+@@ -79,7 +79,7 @@ gdb_test_multiple $cmd $msg {
+ gdb_test "n" "" ""
+
+ # Check again with a method signature at the end.
+- set cmd "break \'${testfile}.main(java.lang.String\[\])void\'"
++ set cmd "break ${testfile}.main(java.lang.String\[\])void"
+ set msg $cmd
+ gdb_test_multiple $cmd $msg {
+ -re "${bpmain}\r\n$gdb_prompt $" {
+diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp
+index 6f7188d..e3ab657 100644
+--- a/gdb/testsuite/gdb.java/jmisc.exp
++++ b/gdb/testsuite/gdb.java/jmisc.exp
+@@ -71,8 +71,8 @@ if ![set_lang_java] then {
+ # signature.
+ runto_main
+ set function "${testfile}.main(java.lang.String\[\])"
+- gdb_breakpoint "\'$function\'" { allow-pending }
+- gdb_breakpoint "\'${function}void\'" { allow-pending }
++ gdb_breakpoint "$function" { allow-pending }
++ gdb_breakpoint "${function}void" { allow-pending }
+ gdb_continue_to_breakpoint $function
+
+ send_gdb "ptype jmisc\n"
diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
new file mode 100644
index 0000000..e71391e
@@ -24002,6 +26631,21 @@ index 0000000..3524830
+ }
+ }
+}
+diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp
+index 29dbf4b..447ca73 100644
+--- a/gdb/testsuite/gdb.java/jprint.exp
++++ b/gdb/testsuite/gdb.java/jprint.exp
+@@ -70,8 +70,8 @@ if ![set_lang_java] then {
+ # signature.
+ runto_main
+ set function "${testfile}.main(java.lang.String\[\])"
+- gdb_breakpoint "\'$function\'" { allow-pending }
+- gdb_breakpoint "\'${function}void\'" { allow-pending }
++ gdb_breakpoint "$function" { allow-pending }
++ gdb_breakpoint "${function}void" { allow-pending }
+ gdb_continue_to_breakpoint $function
+
+ gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call"
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
@@ -24792,10 +27436,10 @@ index 713ad5f..5d17b26 100644
global testfile srcdir subdir srcfile binfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
-index aa4e519..f87277d 100644
+index d980a3d..6a75595 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
-@@ -305,6 +305,15 @@ proc test_value_after_death {} {
+@@ -307,6 +307,15 @@ proc test_value_after_death {} {
"print value's type"
}
@@ -24811,7 +27455,7 @@ index aa4e519..f87277d 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.
-@@ -390,16 +399,23 @@ proc test_parse_and_eval {} {
+@@ -392,16 +401,23 @@ proc test_parse_and_eval {} {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -24842,7 +27486,7 @@ index aa4e519..f87277d 100644
test_value_creation
test_value_numeric_ops
test_value_boolean
-@@ -417,6 +433,7 @@ if ![runto_main] then {
+@@ -419,6 +435,7 @@ if ![runto_main] then {
test_value_in_inferior
test_lazy_strings
test_value_after_death
@@ -25415,7 +28059,7 @@ index 6fbee84..1189cfd 100644
# Check the actual key. It would be nice to require that it match
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
-index 9b06a2f..419d5a9 100644
+index 627941d..1f9b228 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -27,6 +27,7 @@ if {$tool == ""} {
@@ -25662,36 +28306,19 @@ index 6155699..bb94f4b 100644
extern long ui_file_read (struct ui_file *file, char *buf, long length_buf);
-diff --git a/gdb/utils.c b/gdb/utils.c
-index 82a66a1..c305506 100644
---- a/gdb/utils.c
-+++ b/gdb/utils.c
-@@ -2656,7 +2656,10 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name,
- As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO".
- This "feature" is useful when searching for matching C++ function names
- (such as if the user types 'break FOO', where FOO is a mangled C++
-- function). */
-+ function).
-+
-+ As an extra-special hack, we do the same with ' ', so that
-+ "FOO(ARGS) const" can match "FOO", too. */
-
- int
- strcmp_iw (const char *string1, const char *string2)
-@@ -2681,7 +2684,7 @@ strcmp_iw (const char *string1, const char *string2)
- string2++;
- }
- }
-- return (*string1 != '\0' && *string1 != '(') || (*string2 != '\0');
-+ return (*string1 != ' ' && *string1 != '\0' && *string1 != '(') || (*string2 != '\0' && *string2 != '(');
- }
-
- /* This is like strcmp except that it ignores whitespace and treats
diff --git a/gdb/valarith.c b/gdb/valarith.c
-index ed76b09..8bf3634 100644
+index 9f91f4e..753927f 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
-@@ -139,7 +139,6 @@ an integer nor a pointer of the same type."));
+@@ -31,6 +31,7 @@
+ #include "dfp.h"
+ #include
+ #include "infcall.h"
++#include "exceptions.h"
+
+ /* Define whether or not the C operator '/' truncates towards zero for
+ differently signed operands (truncation direction is undefined in C). */
+@@ -146,7 +147,6 @@ an integer nor a pointer of the same type."));
struct value *
value_subscript (struct value *array, LONGEST index)
{
@@ -25699,7 +28326,7 @@ index ed76b09..8bf3634 100644
int c_style = current_language->c_style_arrays;
struct type *tarray;
-@@ -154,12 +153,26 @@ value_subscript (struct value *array, LONGEST index)
+@@ -161,12 +161,26 @@ value_subscript (struct value *array, LONGEST index)
get_discrete_bounds (range_type, &lowerbound, &upperbound);
if (VALUE_LVAL (array) != lval_memory)
@@ -25728,7 +28355,7 @@ index ed76b09..8bf3634 100644
/* Emit warning unless we have an array of unknown size.
An array of unknown size has lowerbound 0 and upperbound -1. */
if (upperbound > -1)
-@@ -178,33 +191,37 @@ value_subscript (struct value *array, LONGEST index)
+@@ -185,33 +199,37 @@ value_subscript (struct value *array, LONGEST index)
error (_("not an array or string"));
}
@@ -25777,8 +28404,97 @@ index ed76b09..8bf3634 100644
return v;
}
+@@ -318,6 +336,68 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
+ }
+ }
+
++/* Try to find OPERATOR as through argument dependent lookup. */
++
++static struct value *
++value_user_defined_adl_op (struct value **args, int nargs, char *operator)
++{
++
++ struct symbol *symp;
++ struct type **arg_types;
++ int i;
++
++ /* This function, if found, will not be a member function
++ and does not expect a pointer as its first argument
++ rather the explicit structure. */
++ args[0] = value_ind (args[0]);
++
++ arg_types = (struct type **)alloca (nargs * (sizeof (struct type *)));
++ /* Prepare list of argument types for overload resolution */
++ for (i = 0; i < nargs; i++)
++ arg_types [i] = value_type (args [i]);
++
++ find_overload_match (arg_types, nargs, operator, 0 /* not method */,
++ 0 /* strict match */, NULL,
++ NULL /* pass NULL symbol since symbol is unknown */,
++ NULL, &symp, NULL);
++
++ if (symp)
++ return value_of_variable (symp, 0);
++
++ return NULL;
++}
++
++/* Lookup user defined operator NAME. First try to find it as a member
++ of the struct ARGP[0]. If not found try to find the operator through
++ argument dependent lookup. */
++
++static struct value *
++value_user_defined_op (struct value **argp, struct value **args, char *name,
++ int *static_memfuncp, int nargs)
++{
++ struct value *result = NULL;
++ volatile struct gdb_exception except;
++
++ TRY_CATCH (except, RETURN_MASK_ERROR)
++ {
++ result = value_struct_elt (argp, args, name, static_memfuncp,
++ "structure");
++ }
++
++ if (except.reason < 0)
++ {
++
++ if (current_language->la_language == language_cplus)
++ /* Try ADL. */
++ result = value_user_defined_adl_op (args, nargs, name);
++
++ if (!result)
++ error ("%s", except.message);
++ }
++
++ return result;
++}
++
+ /* We know either arg1 or arg2 is a structure, so try to find the right
+ user defined function. Create an argument vector that calls
+ arg1.operator @ (arg1,arg2) and return that value (where '@' is any
+@@ -458,7 +538,8 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
+ error (_("Invalid binary operation specified."));
+ }
+
+- argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure");
++ argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
++ &static_memfuncp, 2);
+
+ if (argvec[0])
+ {
+@@ -555,7 +636,8 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
+ error (_("Invalid unary operation specified."));
+ }
+
+- argvec[0] = value_struct_elt (&arg1, argvec + 1, tstr, &static_memfuncp, "structure");
++ argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
++ &static_memfuncp, 1);
+
+ if (argvec[0])
+ {
diff --git a/gdb/valops.c b/gdb/valops.c
-index cee10fb..b08cb21 100644
+index b94c411..9875f96 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -38,6 +38,7 @@
@@ -25934,7 +28650,16 @@ index cee10fb..b08cb21 100644
}
/* Given a value which is a function, return a value which is a pointer
-@@ -2352,12 +2431,25 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2336,7 +2415,7 @@ find_overload_match (struct type **arg_types, int nargs,
+ int boffset;
+ int ix;
+ int static_offset;
+- struct cleanup *old_cleanups = NULL;
++ struct cleanup *old_cleanups = make_cleanup (null_cleanup, NULL);
+
+ const char *obj_type_name = NULL;
+ char *func_name = NULL;
+@@ -2346,12 +2425,25 @@ find_overload_match (struct type **arg_types, int nargs,
if (method)
{
gdb_assert (obj);
@@ -25965,45 +28690,108 @@ index cee10fb..b08cb21 100644
fns_ptr = value_find_oload_method_list (&temp, name,
0, &num_fns,
-@@ -2377,16 +2469,29 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2371,23 +2463,45 @@ find_overload_match (struct type **arg_types, int nargs,
}
else
{
- const char *qualified_name = SYMBOL_CPLUS_DEMANGLED_NAME (fsym);
-+ const char *qualified_name = SYMBOL_NATURAL_NAME (fsym);
++ const char *qualified_name = NULL;
- /* If we have a C++ name, try to extract just the function
- part. */
- if (qualified_name)
- func_name = cp_func_name (qualified_name);
-+ /* If we have a function with a C++ name, try to extract just
-+ the function part. Do not try this for non-functions (e.g.
-+ function pointers). */
-+ if (qualified_name
-+ && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC)
-+ {
-+ func_name = cp_func_name (qualified_name);
-+
-+ /* If cp_func_name did not remove anything, the name of the
-+ symbol did not include scope or argument types - it was
-+ probably a C-style function. */
-+ if (func_name && strcmp (func_name, qualified_name) == 0)
-+ {
-+ xfree (func_name);
-+ func_name = NULL;
-+ }
-+ }
-
+-
- /* If there was no C++ name, this must be a C-style function.
- Just return the same symbol. Do the same if cp_func_name
- fails for some reason. */
++ if (fsym)
++ {
++ qualified_name = SYMBOL_NATURAL_NAME (fsym);
++
++ /* If we have a function with a C++ name, try to extract just
++ the function part. Do not try this for non-functions (e.g.
++ function pointers). */
++ if (qualified_name
++ && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym))) == TYPE_CODE_FUNC)
++ {
++ func_name = cp_func_name (qualified_name);
++
++ /* If cp_func_name did not remove anything, the name of the
++ symbol did not include scope or argument types - it was
++ probably a C-style function. */
++ if (func_name && strcmp (func_name, qualified_name) == 0)
++ {
++ xfree (func_name);
++ func_name = NULL;
++ }
++ }
++ }
++ else
++ {
++ func_name = (char *) name;
++ qualified_name = name;
++ }
++
+ /* If there was no C++ name, this must be a C-style function or
+ not a function at all. Just return the same symbol. Do the
+ same if cp_func_name fails for some reason. */
if (func_name == NULL)
{
*symp = fsym;
-@@ -3123,9 +3228,9 @@ value_maybe_namespace_elt (const struct type *curtype,
+ return 0;
+ }
+
+- old_cleanups = make_cleanup (xfree, func_name);
+ make_cleanup (xfree, oload_syms);
+ make_cleanup (xfree, oload_champ_bv);
+
+@@ -2398,8 +2512,11 @@ find_overload_match (struct type **arg_types, int nargs,
+ &oload_champ_bv);
+ }
+
+- /* Check how bad the best match is. */
++ /* Did we find a match ? */
++ if (oload_champ == -1)
++ error ("No symbol \"%s\" in current context.", name);
+
++ /* Check how bad the best match is. */
+ match_quality =
+ classify_oload_match (oload_champ_bv, nargs,
+ oload_method_static (method, fns_ptr,
+@@ -2456,8 +2573,8 @@ find_overload_match (struct type **arg_types, int nargs,
+ }
+ *objp = temp;
+ }
+- if (old_cleanups != NULL)
+- do_cleanups (old_cleanups);
++
++ do_cleanups (old_cleanups);
+
+ switch (match_quality)
+ {
+@@ -2565,6 +2682,12 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
+ new_namespace[namespace_len] = '\0';
+ new_oload_syms = make_symbol_overload_list (func_name,
+ new_namespace);
++
++ /* If we have reached the deepesst level perform argument
++ determined lookup. */
++ if (!searched_deeper)
++ make_symbol_overload_list_adl (arg_types, nargs, func_name);
++
+ while (new_oload_syms[num_fns])
+ ++num_fns;
+
+@@ -2597,7 +2720,6 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs,
+ }
+ else
+ {
+- gdb_assert (new_oload_champ != -1);
+ *oload_syms = new_oload_syms;
+ *oload_champ = new_oload_champ;
+ *oload_champ_bv = new_oload_champ_bv;
+@@ -3117,9 +3239,9 @@ value_maybe_namespace_elt (const struct type *curtype,
struct symbol *sym;
struct value *result;
@@ -26016,7 +28804,7 @@ index cee10fb..b08cb21 100644
if (sym == NULL)
return NULL;
-@@ -3267,7 +3372,7 @@ value_of_local (const char *name, int complain)
+@@ -3261,7 +3383,7 @@ value_of_local (const char *name, int complain)
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */
@@ -26025,7 +28813,7 @@ index cee10fb..b08cb21 100644
if (sym == NULL)
{
if (complain)
-@@ -3321,8 +3426,6 @@ value_slice (struct value *array, int lowbound, int length)
+@@ -3315,8 +3437,6 @@ value_slice (struct value *array, int lowbound, int length)
|| lowbound + length - 1 > upperbound)
error (_("slice out of range"));
@@ -26318,7 +29106,7 @@ index a462ee4..968cdf4 100644
+ observer_attach_mark_used (value_types_mark_used);
}
diff --git a/gdb/value.h b/gdb/value.h
-index 42b4497..6f9923c 100644
+index 1f2086e..dd503ad 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -342,11 +342,16 @@ extern LONGEST unpack_field_as_long (struct type *type,
@@ -26338,7 +29126,7 @@ index 42b4497..6f9923c 100644
extern struct value *value_at (struct type *type, CORE_ADDR addr);
extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
-@@ -689,7 +694,7 @@ extern struct value *value_allocate_space_in_inferior (int);
+@@ -694,7 +699,7 @@ extern struct value *value_allocate_space_in_inferior (int);
extern struct value *value_of_local (const char *name, int complain);
extern struct value *value_subscripted_rvalue (struct value *array,
@@ -26348,7 +29136,7 @@ index 42b4497..6f9923c 100644
/* User function handler. */
diff --git a/gdb/varobj.c b/gdb/varobj.c
-index 6ec87b3..b274ade 100644
+index b4b2461..3a7a884 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -26,6 +26,8 @@
@@ -26360,17 +29148,8 @@ index 6ec87b3..b274ade 100644
#include "gdb_assert.h"
#include "gdb_string.h"
-@@ -3495,7 +3497,7 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data)
- (*func) (var_root->rootvar, data);
- }
- }
--
-+
- extern void _initialize_varobj (void);
- void
- _initialize_varobj (void)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
-index 25cc2d9..6784654 100644
+index acd7b50..0929a33 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -3030,6 +3030,7 @@ static struct sym_fns xcoff_sym_fns =
diff --git a/gdb-bz539590-gnu-ifunc-fix-cond.patch b/gdb-bz539590-gnu-ifunc-fix-cond.patch
new file mode 100644
index 0000000..98bf5c0
--- /dev/null
+++ b/gdb-bz539590-gnu-ifunc-fix-cond.patch
@@ -0,0 +1,14 @@
+--- ./gdb/breakpoint.c 2010-04-26 02:35:53.000000000 +0200
++++ ./gdb/breakpoint.c 2010-04-26 02:33:26.000000000 +0200
+@@ -8499,6 +8499,11 @@ update_breakpoint_locations (struct brea
+ {
+ struct gdb_exception e;
+
++ /* Temporary workaround before the non-intrusive ifunc patch gets in.
++ exp parsing can now call inferior function invalidating
++ EXISTING_LOCATIONS. */
++ existing_locations = NULL;
++
+ s = b->cond_string;
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
diff --git a/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch b/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
new file mode 100644
index 0000000..8729a62
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
@@ -0,0 +1,43 @@
+2010-06-01 Chris Moller
+
+ * python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
+ detection for matrices as nested vectors.
+
+Index: libstdc++-v3/python/libstdcxx/v6/printers.py
+===================================================================
+--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937)
++++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy)
+@@ -19,6 +19,9 @@
+ import itertools
+ import re
+
++vector_sig = 'std::vector'
++vector_regex = re.compile('^' + vector_sig + '<.*>$')
++
+ class StdPointerPrinter:
+ "Print a smart pointer of some kind"
+
+@@ -186,7 +189,13 @@
+ % (self.typename, int (finish - start), int (end - start)))
+
+ def display_hint(self):
+- return 'array'
++ itype0 = self.val.type.template_argument(0)
++ itag = itype0.tag
++ if itag and re.match(vector_regex, itag):
++ rc = 'matrix'
++ else:
++ rc = 'array'
++ return rc
+
+ class StdVectorIteratorPrinter:
+ "Print std::vector::iterator"
+@@ -692,7 +701,7 @@
+ pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
+ pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
+ pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
+- pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
++ pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
+ # vector
+
+ # Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.
diff --git a/gdb-bz562763-pretty-print-2d-vectors-prereq.patch b/gdb-bz562763-pretty-print-2d-vectors-prereq.patch
new file mode 100644
index 0000000..3cc1e17
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors-prereq.patch
@@ -0,0 +1,427 @@
+commit e5ea8d026015c2a0c7774788b425914857de1ffb
+Author: pmuldoon
+Date: Wed Apr 14 12:02:42 2010 +0000
+
+ 2010-04-14 Phil Muldoon
+
+ PR python/11381
+
+ * python/py-prettyprint.c (pretty_print_one_value): Test for
+ Py_None.
+ (print_string_repr): Test for Py_None. Set flags accordingly.
+ Return value depending on return type.
+ (print_children): Take a value indicating whether data was printed
+ before this function was called. Alter output accordingly.
+ (apply_val_pretty_printer): Capture return value from
+ print_string_repr and pass to print_children.
+
+ 2010-04-14 Phil Muldoon
+
+ * gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
+ * gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
+ * gdb.python/py-prettyprint.exp: New test for to_string returning None.
+ * gdb.python/py-mi.exp: New test for to_string returning None.
+
+ 2010-04-14 Phil Muldoon
+
+ * gdb.texinfo (Pretty Printing): Document behaviour when to_string
+ returns None.
+
+### a/gdb/ChangeLog
+### b/gdb/ChangeLog
+## -1,3 +1,16 @@
++2010-04-14 Phil Muldoon
++
++ PR python/11381
++
++ * python/py-prettyprint.c (pretty_print_one_value): Test for
++ Py_None.
++ (print_string_repr): Test for Py_None. Set flags accordingly.
++ Return value depending on return type.
++ (print_children): Take a value indicating whether data was printed
++ before this function was called. Alter output accordingly.
++ (apply_val_pretty_printer): Capture return value from
++ print_string_repr and pass to print_children.
++
+ 2010-04-13 Mark Kettenis
+
+ PR corefiles/11481
+### a/gdb/doc/ChangeLog
+### b/gdb/doc/ChangeLog
+## -1,3 +1,8 @@
++2010-04-14 Phil Muldoon
++
++ * gdb.texinfo (Pretty Printing): Document behaviour when to_string
++ returns None.
++
+ 2010-04-09 Stan Shebs
+
+ * gdb.texinfo (gdb/mi Tracepoint Commands) <-trace-status>:
+Index: gdb-7.1/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.1.orig/gdb/doc/gdb.texinfo 2010-06-30 03:22:07.000000000 +0200
++++ gdb-7.1/gdb/doc/gdb.texinfo 2010-06-30 03:22:20.000000000 +0200
+@@ -20344,6 +20344,9 @@ the resulting value. Again, this may re
+ pretty-printer. Python scalars (integers, floats, and booleans) and
+ strings are convertible to @code{gdb.Value}; other types are not.
+
++Finally, if this method returns @code{None} then no further operations
++are peformed in this method and nothing is printed.
++
+ If the result is not one of these types, an exception is raised.
+ @end defop
+
+Index: gdb-7.1/gdb/python/py-prettyprint.c
+===================================================================
+--- gdb-7.1.orig/gdb/python/py-prettyprint.c 2010-06-30 03:22:02.000000000 +0200
++++ gdb-7.1/gdb/python/py-prettyprint.c 2010-06-30 03:23:38.000000000 +0200
+@@ -125,9 +125,12 @@ find_pretty_printer (PyObject *value)
+
+ /* Pretty-print a single value, via the printer object PRINTER.
+ If the function returns a string, a PyObject containing the string
+- is returned. Otherwise, if the function returns a value,
+- *OUT_VALUE is set to the value, and NULL is returned. On error,
+- *OUT_VALUE is set to NULL, and NULL is returned. */
++ is returned. If the function returns Py_NONE that means the pretty
++ printer returned the Python None as a value. Otherwise, if the
++ function returns a value, *OUT_VALUE is set to the value, and NULL
++ is returned. On error, *OUT_VALUE is set to NULL, and NULL is
++ returned. */
++
+ static PyObject *
+ pretty_print_one_value (PyObject *printer, struct value **out_value)
+ {
+@@ -140,7 +143,8 @@ pretty_print_one_value (PyObject *printe
+ result = PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst, NULL);
+ if (result)
+ {
+- if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result))
++ if (! gdbpy_is_string (result) && ! gdbpy_is_lazy_string (result)
++ && result != Py_None)
+ {
+ *out_value = convert_value_from_python (result);
+ if (PyErr_Occurred ())
+@@ -184,8 +188,11 @@ gdbpy_get_display_hint (PyObject *printe
+ }
+
+ /* Helper for apply_val_pretty_printer which calls to_string and
+- formats the result. */
+-static void
++ formats the result. If the value returnd is Py_None, nothing is
++ printed and the function returns a 1; in all other cases data is
++ printed as given by the pretty printer and the function returns 0.
++*/
++static int
+ print_string_repr (PyObject *printer, const char *hint,
+ struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+@@ -194,52 +201,58 @@ print_string_repr (PyObject *printer, co
+ {
+ struct value *replacement = NULL;
+ PyObject *py_str = NULL;
++ int is_py_none = 0;
+
+ py_str = pretty_print_one_value (printer, &replacement);
+ if (py_str)
+ {
+- gdb_byte *output = NULL;
+- long length;
+- struct type *type;
+- char *encoding = NULL;
+- PyObject *string = NULL;
+- int is_lazy;
+-
+- is_lazy = gdbpy_is_lazy_string (py_str);
+- if (is_lazy)
+- output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
++ if (py_str == Py_None)
++ is_py_none = 1;
+ else
+ {
+- string = python_string_to_target_python_string (py_str);
+- if (string)
++ gdb_byte *output = NULL;
++ long length;
++ struct type *type;
++ char *encoding = NULL;
++ PyObject *string = NULL;
++ int is_lazy;
++
++ is_lazy = gdbpy_is_lazy_string (py_str);
++ if (is_lazy)
++ output = gdbpy_extract_lazy_string (py_str, &type, &length, &encoding);
++ else
+ {
+- output = PyString_AsString (string);
+- length = PyString_Size (string);
+- type = builtin_type (gdbarch)->builtin_char;
++ string = python_string_to_target_python_string (py_str);
++ if (string)
++ {
++ output = PyString_AsString (string);
++ length = PyString_Size (string);
++ type = builtin_type (gdbarch)->builtin_char;
++ }
++ else
++ gdbpy_print_stack ();
++
++ }
++
++ if (output)
++ {
++ if (is_lazy || (hint && !strcmp (hint, "string")))
++ LA_PRINT_STRING (stream, type, output, length, encoding,
++ 0, options);
++ else
++ fputs_filtered (output, stream);
+ }
+ else
+ gdbpy_print_stack ();
+
+- }
+-
+- if (output)
+- {
+- if (is_lazy || (hint && !strcmp (hint, "string")))
+- LA_PRINT_STRING (stream, type, output, length, encoding,
+- 0, options);
++ if (string)
++ Py_DECREF (string);
+ else
+- fputs_filtered (output, stream);
+- }
+- else
+- gdbpy_print_stack ();
+-
+- if (string)
+- Py_DECREF (string);
+- else
+- xfree (output);
++ xfree (output);
+
+- xfree (encoding);
+- Py_DECREF (py_str);
++ xfree (encoding);
++ Py_DECREF (py_str);
++ }
+ }
+ else if (replacement)
+ {
+@@ -250,6 +263,8 @@ print_string_repr (PyObject *printer, co
+ }
+ else
+ gdbpy_print_stack ();
++
++ return is_py_none;
+ }
+
+ static void
+@@ -328,12 +343,14 @@ push_dummy_python_frame ()
+ }
+
+ /* Helper for apply_val_pretty_printer that formats children of the
+- printer, if any exist. */
++ printer, if any exist. If is_py_none is true, then nothing has
++ been printed by to_string, and format output accordingly. */
+ static void
+ print_children (PyObject *printer, const char *hint,
+ struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+- const struct language_defn *language)
++ const struct language_defn *language,
++ int is_py_none)
+ {
+ int is_map, is_array, done_flag, pretty;
+ unsigned int i;
+@@ -413,7 +430,13 @@ print_children (PyObject *printer, const
+ 2. Arrays. Always print a ",".
+ 3. Other. Always print a ",". */
+ if (i == 0)
+- fputs_filtered (" = {", stream);
++ {
++ if (is_py_none)
++ fputs_filtered ("{", stream);
++ else
++ fputs_filtered (" = {", stream);
++ }
++
+ else if (! is_map || i % 2 == 0)
+ fputs_filtered (pretty ? "," : ", ", stream);
+
+@@ -537,7 +560,7 @@ apply_val_pretty_printer (struct type *t
+ char *hint = NULL;
+ struct cleanup *cleanups;
+ int result = 0;
+-
++ int is_py_none = 0;
+ cleanups = ensure_python_env (gdbarch, language);
+
+ /* Instantiate the printer. */
+@@ -562,9 +585,11 @@ apply_val_pretty_printer (struct type *t
+ make_cleanup (free_current_contents, &hint);
+
+ /* Print the section */
+- print_string_repr (printer, hint, stream, recurse, options, language,
+- gdbarch);
+- print_children (printer, hint, stream, recurse, options, language);
++ is_py_none = print_string_repr (printer, hint, stream, recurse,
++ options, language, gdbarch);
++ print_children (printer, hint, stream, recurse, options, language,
++ is_py_none);
++
+ result = 1;
+
+
+Index: gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp
+===================================================================
+--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-mi.exp 2010-01-14 09:03:37.000000000 +0100
++++ gdb-7.1/gdb/testsuite/gdb.python/py-mi.exp 2010-06-30 03:22:20.000000000 +0200
+@@ -61,6 +61,16 @@ mi_list_varobj_children container {
+
+ mi_delete_varobj container "delete varobj"
+
++mi_create_dynamic_varobj nscont nstype \
++ "create nscont varobj, no pretty-printing"
++
++mi_list_varobj_children nscont {
++ { nscont.len len 0 int }
++ { nscont.elements elements 1 "int ." }
++} "examine nscont children=0, no pretty-printing"
++
++mi_delete_varobj nscont "delete varobj"
++
+ mi_gdb_test "-enable-pretty-printing" ""
+
+ mi_create_varobj_checked string string_1 \
+@@ -239,4 +249,29 @@ mi_continue_to_line \
+
+ mi_varobj_update_with_type_change container int 0 "update after type change"
+
++
++mi_continue_to_line \
++ [gdb_get_line_number {break to inspect struct and union} ${testfile}.c] \
++ "step to outer breakpoint"
++
++mi_create_dynamic_varobj nscont nstype \
++ "create nstype varobj"
++
++mi_list_varobj_children nscont {
++ { {nscont.\[0\]} {\[0\]} 0 int }
++ { {nscont.\[1\]} {\[1\]} 0 int }
++} "list children after setting update range"
++
++mi_gdb_test "-var-set-visualizer nscont None" \
++ "\\^done" \
++ "clear visualizer"
++
++mi_gdb_test "-var-update nscont" \
++ "\\^done,changelist=\\\[\\\]" \
++ "varobj update after clearing"
++
++mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \
++ "\\^done" \
++ "choose default visualizer"
++
+ remote_file host delete ${remote_python_file}
+Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c
+===================================================================
+--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2010-01-14 09:03:37.000000000 +0100
++++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.c 2010-06-30 03:22:20.000000000 +0200
+@@ -119,6 +119,15 @@ typedef struct string_repr
+
+ /* This lets us avoid malloc. */
+ int array[100];
++int narray[10];
++
++struct justchildren
++{
++ int len;
++ int *elements;
++};
++
++typedef struct justchildren nostring_type;
+
+ struct container
+ {
+@@ -196,7 +205,9 @@ main ()
+ const struct string_repr cstring = { { "const string" } };
+ /* Clearing by being `static' could invoke an other GDB C++ bug. */
+ struct nullstr nullstr;
+-
++ nostring_type nstype;
++ nstype.elements = narray;
++ nstype.len = 0;
+
+ init_ss(&ss, 1, 2);
+ init_ss(ssa+0, 3, 4);
+@@ -249,5 +260,9 @@ main ()
+ do_nothing ();
+ #endif
+
++ nstype.elements[0] = 7;
++ nstype.elements[1] = 42;
++ nstype.len = 2;
++
+ return 0; /* break to inspect struct and union */
+ }
+Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp
+===================================================================
+--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:22:02.000000000 +0200
++++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.exp 2010-06-30 03:24:14.000000000 +0200
+@@ -115,6 +115,7 @@ proc run_lang_tests {lang} {
+
+ gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*"
+
++ gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
+ gdb_test "continue" "Program exited normally\."
+
+ remote_file host delete ${remote_python_file}
+Index: gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py
+===================================================================
+--- gdb-7.1.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2010-01-14 09:03:37.000000000 +0100
++++ gdb-7.1/gdb/testsuite/gdb.python/py-prettyprint.py 2010-06-30 03:22:20.000000000 +0200
+@@ -53,6 +53,33 @@ class ContainerPrinter:
+ def children(self):
+ return self._iterator(self.val['elements'], self.val['len'])
+
++# Test a printer where to_string is None
++class NoStringContainerPrinter:
++ class _iterator:
++ def __init__ (self, pointer, len):
++ self.start = pointer
++ self.pointer = pointer
++ self.end = pointer + len
++
++ def __iter__(self):
++ return self
++
++ def next(self):
++ if self.pointer == self.end:
++ raise StopIteration
++ result = self.pointer
++ self.pointer = self.pointer + 1
++ return ('[%d]' % int (result - self.start), result.dereference())
++
++ def __init__(self, val):
++ self.val = val
++
++ def to_string(self):
++ return None
++
++ def children(self):
++ return self._iterator(self.val['elements'], self.val['len'])
++
+ class pp_s:
+ def __init__(self, val):
+ self.val = val
+@@ -190,8 +217,10 @@ def register_pretty_printers ():
+ # both the C and C++ cases.
+ pretty_printers_dict[re.compile ('^struct string_repr$')] = string_print
+ pretty_printers_dict[re.compile ('^struct container$')] = ContainerPrinter
++ pretty_printers_dict[re.compile ('^struct justchildren$')] = NoStringContainerPrinter
+ pretty_printers_dict[re.compile ('^string_repr$')] = string_print
+ pretty_printers_dict[re.compile ('^container$')] = ContainerPrinter
++ pretty_printers_dict[re.compile ('^justchildren$')] = NoStringContainerPrinter
+
+ pretty_printers_dict[re.compile ('^struct ns$')] = pp_ns
+ pretty_printers_dict[re.compile ('^ns$')] = pp_ns
diff --git a/gdb-bz562763-pretty-print-2d-vectors.patch b/gdb-bz562763-pretty-print-2d-vectors.patch
new file mode 100644
index 0000000..f1a8973
--- /dev/null
+++ b/gdb-bz562763-pretty-print-2d-vectors.patch
@@ -0,0 +1,404 @@
+2010-05-31 Chris Moller
+
+ * python/py-prettyprint.c (print_children): Add formatting for
+ matrices. (apply_val_pretty_printer): Detect and deal with matrix
+ hints.
+
+
+2010-05-31 Chris Moller
+
+ * gdb.python/Makefile.in (EXECUTABLES): Added pr10659.
+ * gdb.python/pr10659.cc: New file.
+ * gdb.python/pr10659.exp. New file.
+ * gdb.python/pr10659.py: New file.
+
+Index: gdb-7.1/gdb/valprint.h
+===================================================================
+--- gdb-7.1.orig/gdb/valprint.h 2010-06-30 14:02:16.000000000 +0200
++++ gdb-7.1/gdb/valprint.h 2010-06-30 14:35:24.000000000 +0200
+@@ -90,6 +90,9 @@ struct value_print_options
+
+ /* If nonzero, print the value in "summary" form. */
+ int summary;
++
++ /* Affects pretty printing of matrices. */
++ int prettyprint_matrix;
+ };
+
+ /* The global print options set by the user. In general this should
+Index: gdb-7.1/gdb/python/py-prettyprint.c
+===================================================================
+--- gdb-7.1.orig/gdb/python/py-prettyprint.c 2010-06-30 14:01:40.000000000 +0200
++++ gdb-7.1/gdb/python/py-prettyprint.c 2010-06-30 14:34:49.000000000 +0200
+@@ -385,7 +385,8 @@ print_children (PyObject *printer, const
+
+ /* Use the prettyprint_arrays option if we are printing an array,
+ and the pretty option otherwise. */
+- pretty = is_array ? options->prettyprint_arrays : options->pretty;
++ pretty = (is_array || options->prettyprint_matrix) ?
++ options->prettyprint_arrays : options->pretty;
+
+ /* Manufacture a dummy Python frame to work around Python 2.4 bug,
+ where it insists on having a non-NULL tstate->frame when
+@@ -397,6 +398,9 @@ print_children (PyObject *printer, const
+ goto done;
+ }
+ make_cleanup_py_decref (frame);
++
++ if (options->prettyprint_matrix && recurse == 0)
++ fputs_filtered ("\n", stream);
+
+ done_flag = 0;
+ for (i = 0; i < options->print_max; ++i)
+@@ -431,12 +435,23 @@ print_children (PyObject *printer, const
+ 3. Other. Always print a ",". */
+ if (i == 0)
+ {
+- if (is_py_none)
+- fputs_filtered ("{", stream);
+- else
+- fputs_filtered (" = {", stream);
++ if (options->prettyprint_matrix && recurse == 0)
++ print_spaces_filtered (2 + 2 * recurse, stream);
++ if (is_py_none)
++ {
++ if (options->prettyprint_matrix && strcmp (hint, "array"))
++ {
++ fputs_filtered ("{\n", stream);
++ print_spaces_filtered (4 + 2 * recurse, stream);
++ }
++ else
++ fputs_filtered ("{", stream);
++ }
++ else
++ fputs_filtered (" = {", stream);
+ }
+-
++ else if (options->prettyprint_matrix)
++ print_spaces_filtered (4 + 2 * recurse, stream);
+ else if (! is_map || i % 2 == 0)
+ fputs_filtered (pretty ? "," : ", ", stream);
+
+@@ -465,6 +480,10 @@ print_children (PyObject *printer, const
+
+ if (is_map && i % 2 == 0)
+ fputs_filtered ("[", stream);
++ else if (options->prettyprint_matrix)
++ {
++ /* Force a do-nothing. */
++ }
+ else if (is_array)
+ {
+ /* We print the index, not whatever the child method
+@@ -539,7 +558,12 @@ print_children (PyObject *printer, const
+ fputs_filtered ("\n", stream);
+ print_spaces_filtered (2 * recurse, stream);
+ }
+- fputs_filtered ("}", stream);
++ if (options->prettyprint_matrix)
++ {
++ print_spaces_filtered (4 * recurse, stream);
++ fputs_filtered ("}\n", stream);
++ }
++ else fputs_filtered ("}", stream);
+ }
+
+ done:
+@@ -561,6 +585,7 @@ apply_val_pretty_printer (struct type *t
+ struct cleanup *cleanups;
+ int result = 0;
+ int is_py_none = 0;
++ struct value_print_options *options_copy;
+ cleanups = ensure_python_env (gdbarch, language);
+
+ /* Instantiate the printer. */
+@@ -582,12 +607,23 @@ apply_val_pretty_printer (struct type *t
+
+ /* If we are printing a map, we want some special formatting. */
+ hint = gdbpy_get_display_hint (printer);
++
++ if (recurse == 0)
++ {
++ options_copy = alloca (sizeof (struct value_print_options));
++ memcpy (options_copy, options, sizeof (struct value_print_options));
++ options_copy->prettyprint_matrix = hint && !strcmp (hint, "matrix");
++ }
++ else options_copy = (struct value_print_options *)options;
++
+ make_cleanup (free_current_contents, &hint);
+
+ /* Print the section */
+- is_py_none = print_string_repr (printer, hint, stream, recurse,
+- options, language, gdbarch);
+- print_children (printer, hint, stream, recurse, options, language,
++ is_py_none = options_copy->prettyprint_matrix ?
++ 1 : print_string_repr (printer, hint, stream,
++ recurse, options_copy,
++ language, gdbarch);
++ print_children (printer, hint, stream, recurse, options_copy, language,
+ is_py_none);
+
+ result = 1;
+Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc 2010-06-30 14:34:49.000000000 +0200
+@@ -0,0 +1,43 @@
++#include
++#include // /usr/include/c++/4.4.1/bits/vector.tcc
++#include
++
++using namespace std;
++
++int use_windows = 9999;
++
++int
++main(){
++ vector test1(2,0);
++ test1[0]=8;
++ test1[1]=9;
++
++ vector< vector > test2(3, vector(2,0));
++ test2[0][0]=0;
++ test2[0][1]=1;
++ test2[1][0]=2;
++ test2[1][1]=3;
++ test2[2][0]=4;
++ test2[2][1]=5;
++
++#define NR_ROWS 2
++#define NR_COLS 3
++#define NR_PLANES 4
++ vector