diff --git a/.cvsignore b/.cvsignore index ade223c..d1d65dc 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -gdb-6.8.50.20090228.tar.bz2 +gdb-6.8.50.20090302.tar.bz2 diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index 6c61c25..ab645b4 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -11,10 +11,10 @@ * gdb.texinfo (File Options): Document --readnever. -Index: gdb-6.8.50.20090226/gdb/doc/gdb.texinfo +Index: gdb-6.8.50.20090228/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/doc/gdb.texinfo 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/doc/gdb.texinfo 2009-02-28 07:19:50.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/doc/gdb.texinfo 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/doc/gdb.texinfo 2009-03-02 01:01:23.000000000 +0100 @@ -988,6 +988,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-6.8.50.20090226/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-6.8.50.20090226/gdb/main.c +Index: gdb-6.8.50.20090228/gdb/main.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/main.c 2009-02-28 07:15:57.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/main.c 2009-02-28 07:20:20.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/main.c 2009-03-02 01:01:17.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/main.c 2009-03-02 01:01:23.000000000 +0100 @@ -427,6 +427,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, @@ -48,10 +48,10 @@ Index: gdb-6.8.50.20090226/gdb/main.c "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-6.8.50.20090226/gdb/symfile.c +Index: gdb-6.8.50.20090228/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/symfile.c 2009-02-27 07:51:56.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/symfile.c 2009-02-28 07:19:50.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/symfile.c 2009-03-02 01:01:17.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/symfile.c 2009-03-02 01:01:23.000000000 +0100 @@ -77,6 +77,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file */ @@ -60,19 +60,19 @@ Index: gdb-6.8.50.20090226/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-6.8.50.20090226/gdb/dwarf2read.c +Index: gdb-6.8.50.20090228/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/dwarf2read.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/dwarf2read.c 2009-02-28 07:21:27.000000000 +0100 -@@ -48,6 +48,7 @@ - #include "gdbcmd.h" - #include "addrmap.h" +--- gdb-6.8.50.20090228.orig/gdb/dwarf2read.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/dwarf2read.c 2009-03-02 01:01:36.000000000 +0100 +@@ -49,6 +49,7 @@ #include "f-lang.h" + #include "c-lang.h" + #include "typeprint.h" +#include "top.h" #include #include "gdb_string.h" -@@ -1169,7 +1170,8 @@ dwarf2_has_info (struct objfile *objfile +@@ -1161,7 +1162,8 @@ dwarf2_has_info (struct objfile *objfile dwarf_aranges_section = 0; bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, &update_sizes); @@ -82,10 +82,10 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c } /* When loading sections, we can either look for ".", or for -Index: gdb-6.8.50.20090226/gdb/top.h +Index: gdb-6.8.50.20090228/gdb/top.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/top.h 2009-02-28 07:19:50.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/top.h 2009-03-02 01:01:23.000000000 +0100 @@ -59,6 +59,7 @@ extern void set_prompt (char *); /* From random places. */ diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index e3487c1..f183f6d 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -30,52 +30,11 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location -Index: gdb-6.8.50.20090226/gdb/dwarf2read.c +Index: gdb-6.8.50.20090228/gdb/gdbtypes.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/dwarf2read.c 2009-02-28 07:22:44.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/dwarf2read.c 2009-02-28 07:31:33.000000000 +0100 -@@ -6376,6 +6376,8 @@ read_partial_die (struct partial_die_inf - switch (attr.name) - { - case DW_AT_name: -+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */ -+if (cu->language == language_c || part_die->name == NULL) - switch (part_die->tag) - { - case DW_TAG_compile_unit: -@@ -6399,7 +6401,9 @@ read_partial_die (struct partial_die_inf - part_die->dirname = DW_STRING (&attr); - break; - case DW_AT_MIPS_linkage_name: -- part_die->name = DW_STRING (&attr); -+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */ -+ if (cu->language != language_c || part_die->name == NULL) -+ part_die->name = DW_STRING (&attr); - break; - case DW_AT_low_pc: - has_low_pc_attr = 1; -@@ -8650,9 +8654,13 @@ dwarf2_linkage_name (struct die_info *di - { - struct attribute *attr; - -- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); -- if (attr && DW_STRING (attr)) -- return DW_STRING (attr); -+ /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name for non-C. */ -+ if (cu->language != language_c) -+ { -+ attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); -+ if (attr && DW_STRING (attr)) -+ return DW_STRING (attr); -+ } - return dwarf2_name (die, cu); - } - -Index: gdb-6.8.50.20090226/gdb/gdbtypes.c -=================================================================== ---- gdb-6.8.50.20090226.orig/gdb/gdbtypes.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/gdbtypes.c 2009-02-28 07:22:55.000000000 +0100 -@@ -3643,6 +3643,8 @@ gdbtypes_post_init (struct gdbarch *gdba +--- gdb-6.8.50.20090228.orig/gdb/gdbtypes.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/gdbtypes.c 2009-03-02 01:01:53.000000000 +0100 +@@ -3633,6 +3633,8 @@ gdbtypes_post_init (struct gdbarch *gdba init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, 0, "int", OBJFILE_INTERNAL); @@ -84,7 +43,7 @@ Index: gdb-6.8.50.20090226/gdb/gdbtypes.c builtin_type->builtin_unsigned_int = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, -@@ -3752,6 +3754,12 @@ gdbtypes_post_init (struct gdbarch *gdba +@@ -3742,6 +3744,12 @@ gdbtypes_post_init (struct gdbarch *gdba "", OBJFILE_INTERNAL); TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol) = builtin_type->builtin_int; @@ -97,10 +56,10 @@ Index: gdb-6.8.50.20090226/gdb/gdbtypes.c builtin_type->nodebug_data_symbol = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0, -Index: gdb-6.8.50.20090226/gdb/gdbtypes.h +Index: gdb-6.8.50.20090228/gdb/gdbtypes.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/gdbtypes.h 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/gdbtypes.h 2009-02-28 07:22:55.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/gdbtypes.h 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/gdbtypes.h 2009-03-02 01:01:53.000000000 +0100 @@ -1053,6 +1053,7 @@ struct builtin_type /* Types used for symbols with no debug information. */ @@ -117,10 +76,10 @@ Index: gdb-6.8.50.20090226/gdb/gdbtypes.h struct type *builtin_long; struct type *builtin_signed_char; struct type *builtin_unsigned_char; -Index: gdb-6.8.50.20090226/gdb/parse.c +Index: gdb-6.8.50.20090228/gdb/parse.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/parse.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/parse.c 2009-02-28 07:22:55.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/parse.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/parse.c 2009-03-02 01:01:53.000000000 +0100 @@ -508,7 +508,12 @@ write_exp_msymbol (struct minimal_symbol case mst_text: case mst_file_text: @@ -135,10 +94,10 @@ Index: gdb-6.8.50.20090226/gdb/parse.c break; case mst_data: -Index: gdb-6.8.50.20090226/gdb/target.c +Index: gdb-6.8.50.20090228/gdb/target.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/target.c 2009-02-28 07:22:09.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/target.c 2009-02-28 07:22:55.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/target.c 2009-03-02 01:01:44.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/target.c 2009-03-02 01:01:53.000000000 +0100 @@ -827,6 +827,25 @@ pop_all_targets (int quitting) pop_all_targets_above (dummy_stratum, quitting); } @@ -195,10 +154,10 @@ Index: gdb-6.8.50.20090226/gdb/target.c return addr; } -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.dwarf2/dw2-errno.c +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.dwarf2/dw2-errno.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2009-02-28 07:22:55.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2009-03-02 01:01:53.000000000 +0100 @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -228,10 +187,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.dwarf2/dw2-errno.c + + return 0; /* breakpoint */ +} -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.dwarf2/dw2-errno.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2009-02-28 07:22:55.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2009-03-02 01:01:53.000000000 +0100 @@ -0,0 +1,67 @@ +# Copyright 2007 Free Software Foundation, Inc. + diff --git a/gdb-6.8-bz457187-largefile.patch b/gdb-6.8-bz457187-largefile.patch new file mode 100644 index 0000000..6e297d7 --- /dev/null +++ b/gdb-6.8-bz457187-largefile.patch @@ -0,0 +1,423 @@ +gdb/ +2009-03-02 Jan Kratochvil + + * configure.ac: Call AC_SYS_LARGEFILE. + * config.in: Regenerate. + * configure: Regenerate. + +diff -up -rup gdb-orig/configure.ac gdb/configure.ac +--- ./gdb-orig/configure.ac 2009-03-02 23:39:01.000000000 +0100 ++++ ./gdb/configure.ac 2009-03-02 23:40:46.000000000 +0100 +@@ -30,6 +30,7 @@ AC_GNU_SOURCE + AC_AIX + AC_ISC_POSIX + gl_EARLY ++AC_SYS_LARGEFILE + AM_PROG_CC_STDC + + AC_CONFIG_AUX_DIR(..) +diff -up -rup gdb-orig/config.in gdb/config.in +--- ./gdb-orig/config.in 2009-03-02 23:39:01.000000000 +0100 ++++ ./gdb/config.in 2009-03-02 23:40:53.000000000 +0100 +@@ -725,6 +725,9 @@ + # undef _ALL_SOURCE + #endif + ++/* Number of bits in a file offset, on hosts where this is settable. */ ++#undef _FILE_OFFSET_BITS ++ + /* Enable GNU extensions on systems that have them. */ + #ifndef _GNU_SOURCE + # undef _GNU_SOURCE +@@ -734,6 +737,9 @@ + problem on IRIX 5. */ + #undef _KMEMUSER + ++/* Define for large files, on AIX-style hosts. */ ++#undef _LARGE_FILES ++ + /* Define to 1 if on MINIX. */ + #undef _MINIX + +diff -up -rup gdb-orig/configure gdb/configure +--- ./gdb-orig/configure 2009-03-02 23:39:01.000000000 +0100 ++++ ./gdb/configure 2009-03-02 23:40:49.000000000 +0100 +@@ -862,6 +862,7 @@ Optional Features: + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer ++ --disable-largefile omit support for large files + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-targets alternative target configurations +@@ -3313,6 +3314,370 @@ _ACEOF + + + ++# Check whether --enable-largefile or --disable-largefile was given. ++if test "${enable_largefile+set}" = set; then ++ enableval="$enable_largefile" ++ ++fi; ++if test "$enable_largefile" != no; then ++ ++ echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 ++echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 ++if test "${ac_cv_sys_largefile_CC+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ ac_cv_sys_largefile_CC=no ++ if test "$GCC" != yes; then ++ ac_save_CC=$CC ++ while :; do ++ # IRIX 6.2 and later do not support large files by default, ++ # so use the C compiler's -n32 option if that helps. ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include ++ /* Check that off_t can represent 2**63 - 1 correctly. ++ We can't simply define LARGE_OFF_T to be 9223372036854775807, ++ since some C++ compilers masquerading as C compilers ++ incorrectly reject 9223372036854775807. */ ++#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 ++ && LARGE_OFF_T % 2147483647 == 1) ++ ? 1 : -1]; ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++ rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext ++ CC="$CC -n32" ++ rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sys_largefile_CC=' -n32'; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext ++ break ++ done ++ CC=$ac_save_CC ++ rm -f conftest.$ac_ext ++ fi ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 ++echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 ++ if test "$ac_cv_sys_largefile_CC" != no; then ++ CC=$CC$ac_cv_sys_largefile_CC ++ fi ++ ++ echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 ++echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 ++if test "${ac_cv_sys_file_offset_bits+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ while :; do ++ ac_cv_sys_file_offset_bits=no ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include ++ /* Check that off_t can represent 2**63 - 1 correctly. ++ We can't simply define LARGE_OFF_T to be 9223372036854775807, ++ since some C++ compilers masquerading as C compilers ++ incorrectly reject 9223372036854775807. */ ++#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 ++ && LARGE_OFF_T % 2147483647 == 1) ++ ? 1 : -1]; ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#define _FILE_OFFSET_BITS 64 ++#include ++ /* Check that off_t can represent 2**63 - 1 correctly. ++ We can't simply define LARGE_OFF_T to be 9223372036854775807, ++ since some C++ compilers masquerading as C compilers ++ incorrectly reject 9223372036854775807. */ ++#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 ++ && LARGE_OFF_T % 2147483647 == 1) ++ ? 1 : -1]; ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sys_file_offset_bits=64; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ break ++done ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 ++echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 ++if test "$ac_cv_sys_file_offset_bits" != no; then ++ ++cat >>confdefs.h <<_ACEOF ++#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits ++_ACEOF ++ ++fi ++rm -f conftest* ++ echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 ++echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 ++if test "${ac_cv_sys_large_files+set}" = set; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ while :; do ++ ac_cv_sys_large_files=no ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include ++ /* Check that off_t can represent 2**63 - 1 correctly. ++ We can't simply define LARGE_OFF_T to be 9223372036854775807, ++ since some C++ compilers masquerading as C compilers ++ incorrectly reject 9223372036854775807. */ ++#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 ++ && LARGE_OFF_T % 2147483647 == 1) ++ ? 1 : -1]; ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#define _LARGE_FILES 1 ++#include ++ /* Check that off_t can represent 2**63 - 1 correctly. ++ We can't simply define LARGE_OFF_T to be 9223372036854775807, ++ since some C++ compilers masquerading as C compilers ++ incorrectly reject 9223372036854775807. */ ++#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) ++ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 ++ && LARGE_OFF_T % 2147483647 == 1) ++ ? 1 : -1]; ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext ++if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ++ (eval $ac_compile) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest.$ac_objext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ac_cv_sys_large_files=1; break ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++fi ++rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++ break ++done ++fi ++echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 ++echo "${ECHO_T}$ac_cv_sys_large_files" >&6 ++if test "$ac_cv_sys_large_files" != no; then ++ ++cat >>confdefs.h <<_ACEOF ++#define _LARGE_FILES $ac_cv_sys_large_files ++_ACEOF ++ ++fi ++rm -f conftest* ++fi ++ + + + diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch index a2a693e..5140d25 100644 --- a/gdb-6.8-fortran-tag-constant.patch +++ b/gdb-6.8-fortran-tag-constant.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090210/gdb/dwarf2read.c +Index: gdb-6.8.50.20090228/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090210.orig/gdb/dwarf2read.c 2009-02-11 01:25:45.000000000 +0100 -+++ gdb-6.8.50.20090210/gdb/dwarf2read.c 2009-02-11 01:26:25.000000000 +0100 -@@ -1845,6 +1845,7 @@ scan_partial_symbols (struct partial_die +--- gdb-6.8.50.20090228.orig/gdb/dwarf2read.c 2009-03-02 01:07:36.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/dwarf2read.c 2009-03-02 01:07:50.000000000 +0100 +@@ -1996,6 +1996,7 @@ scan_partial_symbols (struct partial_die add_partial_subprogram (pdi, lowpc, highpc, need_pc, cu); break; case DW_TAG_variable: @@ -10,7 +10,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c case DW_TAG_typedef: case DW_TAG_union_type: if (!pdi->is_declaration) -@@ -2030,6 +2031,7 @@ add_partial_symbol (struct partial_die_i +@@ -2211,6 +2212,7 @@ add_partial_symbol (struct partial_die_i } break; case DW_TAG_variable: @@ -18,15 +18,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c if (pdi->is_external) { /* Global Variable. -@@ -2895,6 +2897,7 @@ dwarf2_full_name (struct die_info *die, - if (!pdi_needs_namespace (die->tag) - && die->tag != DW_TAG_subprogram - && die->tag != DW_TAG_variable -+ && die->tag != DW_TAG_constant - && die->tag != DW_TAG_member) - return name; - -@@ -3735,7 +3738,8 @@ dwarf2_add_field (struct field_info *fip +@@ -4213,7 +4215,8 @@ dwarf2_add_field (struct field_info *fip fip->non_public_fields = 1; } } @@ -36,7 +28,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c { /* C++ static member. */ -@@ -4213,7 +4217,8 @@ read_structure_type (struct die_info *di +@@ -4703,7 +4706,8 @@ read_structure_type (struct die_info *di while (child_die && child_die->tag) { if (child_die->tag == DW_TAG_member @@ -46,7 +38,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c { /* NOTE: carlton/2002-11-05: A C++ static data member should be a DW_TAG_member that is a declaration, but -@@ -4332,6 +4337,7 @@ process_structure_scope (struct die_info +@@ -4822,6 +4826,7 @@ process_structure_scope (struct die_info { if (child_die->tag == DW_TAG_member || child_die->tag == DW_TAG_variable @@ -54,7 +46,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c || child_die->tag == DW_TAG_inheritance) { /* Do nothing. */ -@@ -5862,6 +5868,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -6455,6 +6460,7 @@ load_partial_dies (bfd *abfd, gdb_byte * && abbrev->tag != DW_TAG_subprogram && abbrev->tag != DW_TAG_lexical_block && abbrev->tag != DW_TAG_variable @@ -62,7 +54,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c && abbrev->tag != DW_TAG_namespace && abbrev->tag != DW_TAG_member) { -@@ -5969,6 +5976,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -6562,6 +6568,7 @@ load_partial_dies (bfd *abfd, gdb_byte * if (load_all || abbrev->tag == DW_TAG_subprogram || abbrev->tag == DW_TAG_variable @@ -70,7 +62,7 @@ Index: gdb-6.8.50.20090210/gdb/dwarf2read.c || abbrev->tag == DW_TAG_namespace || part_die->is_declaration) { -@@ -7759,6 +7767,11 @@ new_symbol (struct die_info *die, struct +@@ -8341,6 +8348,11 @@ new_symbol (struct die_info *die, struct /* Do not add the symbol to any lists. It will be found via BLOCK_FUNCTION from the blockvector. */ break; diff --git a/gdb-6.8-inlining.patch b/gdb-6.8-inlining.patch index 15df6d6..2e688ef 100644 --- a/gdb-6.8-inlining.patch +++ b/gdb-6.8-inlining.patch @@ -5,10 +5,10 @@ http://sourceware.org/ml/gdb-patches/2008-07/msg00317.html Removed dwarf_expr_frame_base NULL check duplicity with *-vla.patch. -Index: gdb-6.8.50.20090226/gdb/NEWS +Index: gdb-6.8.50.20090228/gdb/NEWS =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/NEWS 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/NEWS 2009-02-28 07:34:29.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/NEWS 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/NEWS 2009-03-02 01:04:45.000000000 +0100 @@ -1,6 +1,11 @@ What has changed in GDB? (Organized release by release) @@ -21,10 +21,10 @@ Index: gdb-6.8.50.20090226/gdb/NEWS *** Changes since GDB 6.8 * GDB now has support for multi-byte and wide character sets on the -Index: gdb-6.8.50.20090226/gdb/block.c +Index: gdb-6.8.50.20090228/gdb/block.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/block.c 2009-01-03 06:57:50.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/block.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/block.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/block.c 2009-03-02 01:04:45.000000000 +0100 @@ -47,8 +47,16 @@ contained_in (const struct block *a, con { if (!a || !b) @@ -67,10 +67,10 @@ Index: gdb-6.8.50.20090226/gdb/block.c /* Return the blockvector immediately containing the innermost lexical block containing the specified pc value and section, or 0 if there is none. PBLOCK is a pointer to the block. If PBLOCK is NULL, we -Index: gdb-6.8.50.20090226/gdb/block.h +Index: gdb-6.8.50.20090228/gdb/block.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/block.h 2009-01-03 06:57:50.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/block.h 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/block.h 2009-01-03 06:57:50.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/block.h 2009-03-02 01:04:45.000000000 +0100 @@ -65,7 +65,7 @@ struct block CORE_ADDR endaddr; @@ -89,10 +89,10 @@ Index: gdb-6.8.50.20090226/gdb/block.h extern int contained_in (const struct block *, const struct block *); extern struct blockvector *blockvector_for_pc (CORE_ADDR, struct block **); -Index: gdb-6.8.50.20090226/gdb/blockframe.c +Index: gdb-6.8.50.20090228/gdb/blockframe.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/blockframe.c 2009-01-03 06:57:50.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/blockframe.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/blockframe.c 2009-01-03 06:57:50.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/blockframe.c 2009-03-02 01:04:45.000000000 +0100 @@ -36,6 +36,7 @@ #include "command.h" #include "gdbcmd.h" @@ -161,10 +161,10 @@ Index: gdb-6.8.50.20090226/gdb/blockframe.c return frame; frame = get_prev_frame (frame); -Index: gdb-6.8.50.20090226/gdb/breakpoint.c +Index: gdb-6.8.50.20090228/gdb/breakpoint.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/breakpoint.c 2009-02-28 07:33:47.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/breakpoint.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/breakpoint.c 2009-03-02 01:04:33.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/breakpoint.c 2009-03-02 01:04:45.000000000 +0100 @@ -2641,19 +2641,21 @@ watchpoint_check (void *p) within_current_scope = 1; else @@ -342,11 +342,11 @@ Index: gdb-6.8.50.20090226/gdb/breakpoint.c bp_until); make_cleanup_delete_breakpoint (breakpoint2); } -Index: gdb-6.8.50.20090226/gdb/buildsym.c +Index: gdb-6.8.50.20090228/gdb/buildsym.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/buildsym.c 2009-01-03 06:57:50.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/buildsym.c 2009-02-28 07:34:09.000000000 +0100 -@@ -1159,6 +1159,12 @@ end_symtab (CORE_ADDR end_addr, struct o +--- gdb-6.8.50.20090228.orig/gdb/buildsym.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/buildsym.c 2009-03-02 01:04:45.000000000 +0100 +@@ -1155,6 +1155,12 @@ end_symtab (CORE_ADDR end_addr, struct o struct symbol *sym; struct dict_iterator iter; @@ -359,10 +359,10 @@ Index: gdb-6.8.50.20090226/gdb/buildsym.c for (sym = dict_iterator_first (BLOCK_DICT (block), &iter); sym != NULL; sym = dict_iterator_next (&iter)) -Index: gdb-6.8.50.20090226/gdb/doc/gdb.texinfo +Index: gdb-6.8.50.20090228/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/doc/gdb.texinfo 2009-02-28 07:33:47.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/doc/gdb.texinfo 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/doc/gdb.texinfo 2009-03-02 01:04:33.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/doc/gdb.texinfo 2009-03-02 01:04:45.000000000 +0100 @@ -137,6 +137,7 @@ software in general. We will miss him. * Stack:: Examining the stack * Source:: Examining source files @@ -512,10 +512,10 @@ Index: gdb-6.8.50.20090226/gdb/doc/gdb.texinfo @node Macros @chapter C Preprocessor Macros -Index: gdb-6.8.50.20090226/gdb/dwarf2loc.c +Index: gdb-6.8.50.20090228/gdb/dwarf2loc.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/dwarf2loc.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/dwarf2loc.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/dwarf2loc.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/dwarf2loc.c 2009-03-02 01:04:45.000000000 +0100 @@ -31,6 +31,7 @@ #include "regcache.h" #include "objfiles.h" @@ -536,19 +536,19 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2loc.c /* If we found a frame-relative symbol then it was certainly within some function associated with a frame. If we can't find the frame, -Index: gdb-6.8.50.20090226/gdb/dwarf2read.c +Index: gdb-6.8.50.20090228/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/dwarf2read.c 2009-02-28 07:33:47.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/dwarf2read.c 2009-02-28 07:36:45.000000000 +0100 -@@ -49,6 +49,7 @@ - #include "addrmap.h" - #include "f-lang.h" +--- gdb-6.8.50.20090228.orig/gdb/dwarf2read.c 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/dwarf2read.c 2009-03-02 01:07:36.000000000 +0100 +@@ -50,6 +50,7 @@ + #include "c-lang.h" + #include "typeprint.h" #include "top.h" +#include "block.h" #include #include "gdb_string.h" -@@ -2947,12 +2948,8 @@ process_die (struct die_info *die, struc +@@ -2984,12 +2985,8 @@ process_die (struct die_info *die, struc read_file_scope (die, cu); break; case DW_TAG_subprogram: @@ -562,10 +562,10 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c break; case DW_TAG_lexical_block: case DW_TAG_try_block: -@@ -3233,6 +3230,22 @@ read_func_scope (struct die_info *die, s +@@ -3464,6 +3461,22 @@ read_func_scope (struct die_info *die, s CORE_ADDR baseaddr; struct block *block; - unsigned die_children; + unsigned die_children = 0; + struct attribute *call_line, *call_file; + int inlined_func = (die->tag == DW_TAG_inlined_subroutine); + @@ -585,7 +585,7 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -@@ -7310,6 +7323,9 @@ die_specification (struct die_info *die, +@@ -7526,6 +7539,9 @@ die_specification (struct die_info *die, *spec_cu); if (spec_attr == NULL) @@ -595,7 +595,7 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c return NULL; else return follow_die_ref (die, spec_attr, spec_cu); -@@ -7993,6 +8009,7 @@ new_symbol (struct die_info *die, struct +@@ -8209,6 +8225,7 @@ new_symbol (struct die_info *die, struct struct attribute *attr = NULL; struct attribute *attr2 = NULL; CORE_ADDR baseaddr; @@ -603,7 +603,7 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -@@ -8022,13 +8039,17 @@ new_symbol (struct die_info *die, struct +@@ -8259,13 +8276,17 @@ new_symbol (struct die_info *die, struct SYMBOL_TYPE (sym) = type; else SYMBOL_TYPE (sym) = die_type (die, cu); @@ -623,7 +623,7 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c if (attr) { int file_index = DW_UNSND (attr); -@@ -8075,6 +8096,14 @@ new_symbol (struct die_info *die, struct +@@ -8312,6 +8333,14 @@ new_symbol (struct die_info *die, struct add_symbol_to_list (sym, cu->list_in_scope); } break; @@ -638,7 +638,7 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c case DW_TAG_variable: /* Compilation with minimal debug info may result in variables with missing type entries. Change the misleading `void' type -@@ -8130,7 +8159,14 @@ new_symbol (struct die_info *die, struct +@@ -8367,7 +8396,14 @@ new_symbol (struct die_info *die, struct } break; case DW_TAG_formal_parameter: @@ -654,10 +654,10 @@ Index: gdb-6.8.50.20090226/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) { -Index: gdb-6.8.50.20090226/gdb/frame-unwind.c +Index: gdb-6.8.50.20090228/gdb/frame-unwind.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/frame-unwind.c 2009-01-03 06:57:51.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/frame-unwind.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/frame-unwind.c 2009-01-03 06:57:51.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/frame-unwind.c 2009-03-02 01:04:45.000000000 +0100 @@ -21,6 +21,7 @@ #include "frame.h" #include "frame-unwind.h" @@ -678,10 +678,10 @@ Index: gdb-6.8.50.20090226/gdb/frame-unwind.c return table; } -Index: gdb-6.8.50.20090226/gdb/frame.c +Index: gdb-6.8.50.20090228/gdb/frame.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/frame.c 2009-02-28 07:22:02.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/frame.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/frame.c 2009-03-02 01:01:44.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/frame.c 2009-03-02 01:04:45.000000000 +0100 @@ -41,8 +41,14 @@ #include "objfiles.h" #include "exceptions.h" @@ -1038,10 +1038,10 @@ Index: gdb-6.8.50.20090226/gdb/frame.c } /* Per "frame.h", return the ``address'' of the frame. Code should -Index: gdb-6.8.50.20090226/gdb/frame.h +Index: gdb-6.8.50.20090228/gdb/frame.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/frame.h 2009-02-05 18:28:20.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/frame.h 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/frame.h 2009-02-05 18:28:20.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/frame.h 2009-03-02 01:04:45.000000000 +0100 @@ -34,6 +34,9 @@ frame_unwind_WHAT...(): Unwind THIS frame's WHAT from the NEXT frame. @@ -1103,10 +1103,10 @@ Index: gdb-6.8.50.20090226/gdb/frame.h extern struct frame_id frame_unwind_id (struct frame_info *next_frame); /* Assuming that a frame is `normal', return its base-address, or 0 if -Index: gdb-6.8.50.20090226/gdb/gdbthread.h +Index: gdb-6.8.50.20090228/gdb/gdbthread.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/gdbthread.h 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/gdbthread.h 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/gdbthread.h 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/gdbthread.h 2009-03-02 01:04:45.000000000 +0100 @@ -83,6 +83,13 @@ struct thread_info This is how we know when we step into a subroutine call, and how to set the frame for the breakpoint used to step out. */ @@ -1121,10 +1121,10 @@ Index: gdb-6.8.50.20090226/gdb/gdbthread.h int current_line; struct symtab *current_symtab; -Index: gdb-6.8.50.20090226/gdb/infcall.c +Index: gdb-6.8.50.20090228/gdb/infcall.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/infcall.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/infcall.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/infcall.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/infcall.c 2009-03-02 01:04:45.000000000 +0100 @@ -898,15 +898,8 @@ The program being debugged exited while if (unwind_on_signal_p) @@ -1143,10 +1143,10 @@ Index: gdb-6.8.50.20090226/gdb/infcall.c /* FIXME: Insert a bunch of wrap_here; name can be very long if it's a C++ name with arguments and stuff. */ -Index: gdb-6.8.50.20090226/gdb/infcmd.c +Index: gdb-6.8.50.20090228/gdb/infcmd.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/infcmd.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/infcmd.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/infcmd.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/infcmd.c 2009-03-02 01:04:45.000000000 +0100 @@ -52,6 +52,7 @@ #include "cli/cli-decode.h" #include "gdbthread.h" @@ -1248,10 +1248,10 @@ Index: gdb-6.8.50.20090226/gdb/infcmd.c /* Find the function we will return from. */ function = find_pc_function (get_frame_pc (get_selected_frame (NULL))); -Index: gdb-6.8.50.20090226/gdb/inferior.h +Index: gdb-6.8.50.20090228/gdb/inferior.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/inferior.h 2009-02-27 00:04:34.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/inferior.h 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/inferior.h 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/inferior.h 2009-03-02 01:04:45.000000000 +0100 @@ -259,6 +259,9 @@ extern void error_is_running (void); /* Calls error_is_running if the current thread is running. */ extern void ensure_not_running (void); @@ -1262,10 +1262,10 @@ Index: gdb-6.8.50.20090226/gdb/inferior.h /* From infcmd.c */ extern void tty_command (char *, int); -Index: gdb-6.8.50.20090226/gdb/infrun.c +Index: gdb-6.8.50.20090228/gdb/infrun.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/infrun.c 2009-02-28 07:31:50.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/infrun.c 2009-02-28 07:37:36.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/infrun.c 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/infrun.c 2009-03-02 01:04:45.000000000 +0100 @@ -48,6 +48,7 @@ #include "gdb_assert.h" #include "mi/mi-common.h" @@ -1538,10 +1538,10 @@ Index: gdb-6.8.50.20090226/gdb/infrun.c tp->step_over_calls = inf_status->step_over_calls; stop_after_trap = inf_status->stop_after_trap; inf->stop_soon = inf_status->stop_soon; -Index: gdb-6.8.50.20090226/gdb/inline-frame.c +Index: gdb-6.8.50.20090228/gdb/inline-frame.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/inline-frame.c 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/inline-frame.c 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,382 @@ +/* Inline frame unwinder for GDB. + @@ -1925,10 +1925,10 @@ Index: gdb-6.8.50.20090226/gdb/inline-frame.c + + return inline_count; +} -Index: gdb-6.8.50.20090226/gdb/inline-frame.h +Index: gdb-6.8.50.20090228/gdb/inline-frame.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/inline-frame.h 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/inline-frame.h 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,62 @@ +/* Definitions for inline frame support. + @@ -1992,11 +1992,11 @@ Index: gdb-6.8.50.20090226/gdb/inline-frame.h +int frame_inlined_callees (struct frame_info *this_frame); + +#endif /* !defined (INLINE_FRAME_H) */ -Index: gdb-6.8.50.20090226/gdb/minsyms.c +Index: gdb-6.8.50.20090228/gdb/minsyms.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/minsyms.c 2009-02-28 07:31:49.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/minsyms.c 2009-02-28 07:34:09.000000000 +0100 -@@ -767,7 +767,7 @@ prim_record_minimal_symbol_and_info (con +--- gdb-6.8.50.20090228.orig/gdb/minsyms.c 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/minsyms.c 2009-03-02 01:04:45.000000000 +0100 +@@ -795,7 +795,7 @@ prim_record_minimal_symbol_and_info (con if (msym_bunch_index == BUNCH_SIZE) { @@ -2005,10 +2005,10 @@ Index: gdb-6.8.50.20090226/gdb/minsyms.c msym_bunch_index = 0; new->next = msym_bunch; msym_bunch = new; -Index: gdb-6.8.50.20090226/gdb/s390-tdep.c +Index: gdb-6.8.50.20090228/gdb/s390-tdep.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/s390-tdep.c 2009-02-22 02:02:19.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/s390-tdep.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/s390-tdep.c 2009-02-22 02:02:19.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/s390-tdep.c 2009-03-02 01:04:45.000000000 +0100 @@ -1182,6 +1182,7 @@ s390_prologue_frame_unwind_cache (struct CORE_ADDR prev_sp; int frame_pointer; @@ -2042,10 +2042,10 @@ Index: gdb-6.8.50.20090226/gdb/s390-tdep.c || get_frame_type (get_next_frame (this_frame)) != NORMAL_FRAME)) { /* See the comment in s390_in_function_epilogue_p on why this is -Index: gdb-6.8.50.20090226/gdb/stack.c +Index: gdb-6.8.50.20090228/gdb/stack.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/stack.c 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/stack.c 2009-02-28 07:35:20.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/stack.c 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/stack.c 2009-03-02 01:04:45.000000000 +0100 @@ -45,6 +45,7 @@ #include "valprint.h" #include "gdbthread.h" @@ -2192,26 +2192,27 @@ Index: gdb-6.8.50.20090226/gdb/stack.c /* Compute the return value. If the computation triggers an error, let it bail. If the return type can't be handled, set RETURN_VALUE to NULL, and QUERY_PREFIX to an informational -Index: gdb-6.8.50.20090226/gdb/symtab.c +Index: gdb-6.8.50.20090228/gdb/symtab.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/symtab.c 2009-02-28 07:31:49.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/symtab.c 2009-02-28 07:34:09.000000000 +0100 -@@ -1408,10 +1408,13 @@ lookup_symbol_aux_local (const char *nam +--- gdb-6.8.50.20090228.orig/gdb/symtab.c 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/symtab.c 2009-03-02 01:06:36.000000000 +0100 +@@ -1414,11 +1414,14 @@ lookup_symbol_aux_local (const char *nam sym = lookup_symbol_aux_block (name, linkage_name, block, domain); if (sym != NULL) return sym; + + if (BLOCK_FUNCTION (block) != NULL && block_inlined_p (block)) + break; + block = BLOCK_SUPERBLOCK (block); } -- /* We've reached the static block without finding a result. */ +- /* We've reached the global block without finding a result. */ + /* We've reached the edge of the function without finding a result. */ return NULL; } -@@ -2668,6 +2671,7 @@ find_function_start_sal (struct symbol * +@@ -2675,6 +2678,7 @@ find_function_start_sal (struct symbol * CORE_ADDR pc; struct symtab_and_line sal; @@ -2219,7 +2220,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c pc = BLOCK_START (block); fixup_symbol_section (sym, objfile); -@@ -2706,6 +2710,25 @@ find_function_start_sal (struct symbol * +@@ -2713,6 +2717,25 @@ find_function_start_sal (struct symbol * sal.pc = pc; @@ -2245,7 +2246,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c return sal; } -@@ -3728,6 +3751,24 @@ add_macro_name (const char *name, const +@@ -3735,6 +3758,24 @@ add_macro_name (const char *name, const datum->text, datum->word); } @@ -2270,7 +2271,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c char ** default_make_symbol_completion_list (char *text, char *word) { -@@ -3740,9 +3781,9 @@ default_make_symbol_completion_list (cha +@@ -3747,9 +3788,9 @@ default_make_symbol_completion_list (cha struct partial_symtab *ps; struct minimal_symbol *msymbol; struct objfile *objfile; @@ -2282,7 +2283,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c struct partial_symbol **psym; /* The symbol we are completing on. Points in same buffer as text. */ char *sym_text; -@@ -3852,41 +3893,43 @@ default_make_symbol_completion_list (cha +@@ -3859,41 +3900,43 @@ default_make_symbol_completion_list (cha } /* Search upwards from currently selected frame (so that we can @@ -2357,7 +2358,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c /* Go through the symtabs and check the externs and statics for symbols which match. */ -@@ -3905,9 +3948,6 @@ default_make_symbol_completion_list (cha +@@ -3912,9 +3955,6 @@ default_make_symbol_completion_list (cha { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); @@ -2367,7 +2368,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c ALL_BLOCK_SYMBOLS (b, iter, sym) { COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); -@@ -4374,6 +4414,25 @@ skip_prologue_using_sal (CORE_ADDR func_ +@@ -4381,6 +4421,25 @@ skip_prologue_using_sal (CORE_ADDR func_ line mark the prologue -> body transition. */ if (sal.line >= prologue_sal.line) break; @@ -2393,11 +2394,11 @@ Index: gdb-6.8.50.20090226/gdb/symtab.c /* The case in which compiler's optimizer/scheduler has moved instructions into the prologue. We look ahead in the function looking for address ranges whose -Index: gdb-6.8.50.20090226/gdb/symtab.h +Index: gdb-6.8.50.20090228/gdb/symtab.h =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/symtab.h 2009-02-27 00:04:32.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/symtab.h 2009-02-28 07:34:09.000000000 +0100 -@@ -559,9 +559,18 @@ struct symbol +--- gdb-6.8.50.20090228.orig/gdb/symtab.h 2009-03-02 01:01:15.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/symtab.h 2009-03-02 01:04:45.000000000 +0100 +@@ -556,9 +556,18 @@ struct symbol unsigned is_argument : 1; @@ -2419,7 +2420,7 @@ Index: gdb-6.8.50.20090226/gdb/symtab.h unsigned short line; -@@ -592,6 +601,7 @@ struct symbol +@@ -589,6 +598,7 @@ struct symbol #define SYMBOL_DOMAIN(symbol) (symbol)->domain #define SYMBOL_CLASS(symbol) (symbol)->aclass #define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument @@ -2427,10 +2428,10 @@ Index: gdb-6.8.50.20090226/gdb/symtab.h #define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_SYMTAB(symbol) (symbol)->symtab -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/break.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.base/break.exp =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.base/break.exp 2009-01-19 20:05:01.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.base/break.exp 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/testsuite/gdb.base/break.exp 2009-01-19 20:05:01.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.base/break.exp 2009-03-02 01:04:45.000000000 +0100 @@ -880,6 +880,13 @@ gdb_expect { # marker4() is defined at line 46 when compiled with -DPROTOTYPES pass "run until breakpoint set at small function, optimized file (line bp_location14)" @@ -2445,10 +2446,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.base/break.exp -re ".*$gdb_prompt " { fail "run until breakpoint set at small function, optimized file" } -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.cp/annota2.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.cp/annota2.exp =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.cp/annota2.exp 2009-01-03 06:58:04.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.cp/annota2.exp 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/testsuite/gdb.cp/annota2.exp 2009-01-03 06:58:04.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.cp/annota2.exp 2009-03-02 01:04:45.000000000 +0100 @@ -119,10 +119,11 @@ gdb_expect { # continue until exit # this will test: @@ -2462,10 +2463,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.cp/annota2.exp { pass "continue until exit" } -re ".*$gdb_prompt$" { fail "continue to exit" } timeout { fail "continue to exit (timeout)" } -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.c +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-bt.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.c 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-bt.c 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,47 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + @@ -2514,10 +2515,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.c + + return 0; +} -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-bt.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.exp 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-bt.exp 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,63 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -2582,10 +2583,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-bt.exp +gdb_test "info frame" ".*inlined into frame.*" "func1 inlined (3)" +gdb_test "up" "#2 .*func2.*" "up from func1 (3)" +gdb_test "info frame" ".*inlined into frame.*" "func2 inlined (3)" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.c +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-cmds.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.c 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-cmds.c 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,85 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + @@ -2672,10 +2673,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.c + + return 0; +} -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-cmds.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,279 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -2956,10 +2957,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-cmds.exp +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" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.c +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-locals.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.c 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-locals.c 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,52 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + @@ -3013,10 +3014,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.c + + return 0; +} -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-locals.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.exp 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-locals.exp 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,118 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -3136,10 +3137,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-locals.exp +} + +gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)" -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-markers.c +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-markers.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-markers.c 2009-02-28 07:34:09.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/inline-markers.c 2009-03-02 01:04:45.000000000 +0100 @@ -0,0 +1,36 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + @@ -3177,10 +3178,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/inline-markers.c +{ + inlined_fn (); /* inlined */ +} -Index: gdb-6.8.50.20090226/gdb/testsuite/lib/gdb.exp +Index: gdb-6.8.50.20090228/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/lib/gdb.exp 2009-02-28 07:31:58.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/testsuite/lib/gdb.exp 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/testsuite/lib/gdb.exp 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/testsuite/lib/gdb.exp 2009-03-02 01:04:45.000000000 +0100 @@ -1474,6 +1474,37 @@ proc skip_hp_tests {} { return $skip_hp } @@ -3219,10 +3220,10 @@ Index: gdb-6.8.50.20090226/gdb/testsuite/lib/gdb.exp set compiler_info "unknown" set gcc_compiled 0 set hp_cc_compiler 0 -Index: gdb-6.8.50.20090226/gdb/valops.c +Index: gdb-6.8.50.20090228/gdb/valops.c =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/valops.c 2009-02-27 07:51:56.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/valops.c 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/valops.c 2009-03-02 01:01:17.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/valops.c 2009-03-02 01:04:45.000000000 +0100 @@ -1072,7 +1072,7 @@ value_of_variable (struct symbol *var, s frame = block_innermost_frame (b); if (!frame) @@ -3232,11 +3233,11 @@ Index: gdb-6.8.50.20090226/gdb/valops.c && SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b))) error (_("No frame is currently executing in block %s."), SYMBOL_PRINT_NAME (BLOCK_FUNCTION (b))); -Index: gdb-6.8.50.20090226/gdb/Makefile.in +Index: gdb-6.8.50.20090228/gdb/Makefile.in =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/Makefile.in 2009-02-28 07:31:58.000000000 +0100 -+++ gdb-6.8.50.20090226/gdb/Makefile.in 2009-02-28 07:34:09.000000000 +0100 -@@ -663,6 +663,7 @@ SFILES = ada-exp.y ada-lang.c ada-typepr +--- gdb-6.8.50.20090228.orig/gdb/Makefile.in 2009-03-02 01:04:32.000000000 +0100 ++++ gdb-6.8.50.20090228/gdb/Makefile.in 2009-03-02 01:04:45.000000000 +0100 +@@ -665,6 +665,7 @@ SFILES = ada-exp.y ada-lang.c ada-typepr inf-loop.c \ infcall.c \ infcmd.c inflow.c infrun.c \ @@ -3244,7 +3245,7 @@ Index: gdb-6.8.50.20090226/gdb/Makefile.in interps.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ language.c linespec.c \ -@@ -835,6 +836,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $ +@@ -837,6 +838,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $ user-regs.o \ frame.o frame-unwind.o doublest.o \ frame-base.o \ @@ -3252,10 +3253,10 @@ Index: gdb-6.8.50.20090226/gdb/Makefile.in gnu-v2-abi.o gnu-v3-abi.o cp-abi.o cp-support.o \ cp-namespace.o \ reggroups.o regset.o \ -Index: gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/Makefile.in +Index: gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/Makefile.in =================================================================== ---- gdb-6.8.50.20090226.orig/gdb/testsuite/gdb.opt/Makefile.in 2008-04-18 01:06:54.000000000 +0200 -+++ gdb-6.8.50.20090226/gdb/testsuite/gdb.opt/Makefile.in 2009-02-28 07:34:09.000000000 +0100 +--- gdb-6.8.50.20090228.orig/gdb/testsuite/gdb.opt/Makefile.in 2008-04-18 01:06:54.000000000 +0200 ++++ gdb-6.8.50.20090228/gdb/testsuite/gdb.opt/Makefile.in 2009-03-02 01:04:45.000000000 +0100 @@ -1,7 +1,7 @@ VPATH = @srcdir@ srcdir = @srcdir@ diff --git a/gdb-archer.patch b/gdb-archer.patch index 56fcb11..c05498e 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -1,8 +1,30 @@ +http://sourceware.org/gdb/wiki/ProjectArcher +http://sourceware.org/gdb/wiki/ArcherBranchManagement + +GIT snapshot: +commit 8cc3753a9aad85bf53bef54c04334c60d16cb251 + +branch `archer' - the merge of branches: +archer-jankratochvil-merge-expr + archer-keiths-expr-cumulative + (archer-swagiaal-using-directive) +archer-jankratochvil-misc +archer-jankratochvil-python + archer-jankratochvil-type-refcount + archer-tromey-python +archer-jankratochvil-vla + archer-jankratochvil-type-refcount +archer-pmuldoon-exception-rewind-master +archer-sergio-catch-syscall +archer-tromey-charset +archer-tromey-delayed-symfile + + diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index af3f534..716884d 100644 +index 74aa72e..fdb0582 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -167,11 +167,16 @@ INTL_CFLAGS = @INCINTL@ +@@ -167,11 +167,18 @@ INTL_CFLAGS = @INCINTL@ # Where is the ICONV library? This can be empty if libc has iconv. LIBICONV = @LIBICONV@ @@ -15,11 +37,13 @@ index af3f534..716884d 100644 +# Did the user give us a --with-gdb-datadir option? +GDB_DATADIR_PATH = @GDB_DATADIR_PATH@ ++ ++GDB_PYTHONDIR_PATH = @GDB_PYTHONDIR_PATH@ + # Helper code from gnulib. LIBGNU = gnulib/libgnu.a INCGNU = -I$(srcdir)/gnulib -Ignulib -@@ -270,12 +275,34 @@ SUBDIR_TUI_CFLAGS= \ +@@ -270,12 +277,34 @@ SUBDIR_TUI_CFLAGS= \ # SUBDIR_PYTHON_OBS = \ python.o \ @@ -54,7 +78,7 @@ index af3f534..716884d 100644 python/python-utils.c \ python/python-value.c SUBDIR_PYTHON_DEPS = -@@ -389,7 +416,8 @@ INTERNAL_CFLAGS_BASE = \ +@@ -390,7 +419,8 @@ INTERNAL_CFLAGS_BASE = \ $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \ $(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \ $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \ @@ -64,7 +88,7 @@ index af3f534..716884d 100644 INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS) INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS) -@@ -401,7 +429,7 @@ LDFLAGS = @LDFLAGS@ +@@ -402,7 +432,7 @@ LDFLAGS = @LDFLAGS@ # I think it's perfectly reasonable for a user to set -pg in CFLAGS # and have it work; that's why CFLAGS is here. # PROFILE_CFLAGS is _not_ included, however, because we use monstartup. @@ -73,7 +97,7 @@ index af3f534..716884d 100644 # If your system is missing alloca(), or, more likely, it's there but # it doesn't work, then refer to libiberty. -@@ -662,6 +690,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ +@@ -663,6 +693,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ valarith.c valops.c valprint.c value.c varobj.c vec.c \ wrapper.c \ xml-tdesc.c xml-support.c \ @@ -81,7 +105,7 @@ index af3f534..716884d 100644 inferior.c LINTFILES = $(SFILES) $(YYFILES) $(CONFIG_SRCS) init.c -@@ -732,7 +761,8 @@ config/sparc/nm-sol2.h config/nm-linux.h config/mips/nm-irix5.h \ +@@ -733,7 +764,8 @@ config/sparc/nm-sol2.h config/nm-linux.h config/mips/nm-irix5.h \ config/rs6000/nm-rs6000.h top.h bsd-kvm.h gdb-stabs.h reggroups.h \ annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \ remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \ @@ -91,7 +115,7 @@ index af3f534..716884d 100644 # Header files that already have srcdir in them, or which are in objdir. -@@ -811,10 +841,16 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ +@@ -812,10 +844,16 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ trad-frame.o \ tramp-frame.o \ solib.o solib-null.o \ @@ -109,7 +133,7 @@ index af3f534..716884d 100644 TSOBS = inflow.o SUBDIRS = @subdirs@ -@@ -848,11 +884,38 @@ generated_files = config.h observer.h observer.inc ada-lex.c \ +@@ -849,11 +887,38 @@ generated_files = config.h observer.h observer.inc ada-lex.c \ $(COMPILE) $< $(POSTCOMPILE) @@ -149,7 +173,7 @@ index af3f534..716884d 100644 installcheck: # The check target can not use subdir_do, because subdir_do does not -@@ -906,8 +969,11 @@ gdb.z:gdb.1 +@@ -907,8 +972,11 @@ gdb.z:gdb.1 # source file and doesn't care about rebuilding or just wants to save the # time it takes for make to check that all is up to date. # install-only is intended to address that need. @@ -163,7 +187,7 @@ index af3f534..716884d 100644 transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1200,6 +1266,12 @@ stamp-h: config.in config.status +@@ -1202,6 +1270,12 @@ stamp-h: config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -176,7 +200,7 @@ index af3f534..716884d 100644 config.status: configure configure.tgt configure.host $(SHELL) config.status --recheck -@@ -1843,10 +1915,54 @@ python.o: $(srcdir)/python/python.c +@@ -1845,10 +1919,54 @@ python.o: $(srcdir)/python/python.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python.c $(POSTCOMPILE) @@ -231,7 +255,7 @@ index af3f534..716884d 100644 python-utils.o: $(srcdir)/python/python-utils.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-utils.c $(POSTCOMPILE) -@@ -1855,6 +1971,30 @@ python-value.o: $(srcdir)/python/python-value.c +@@ -1857,6 +1975,39 @@ python-value.o: $(srcdir)/python/python-value.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-value.c $(POSTCOMPILE) @@ -242,22 +266,31 @@ index af3f534..716884d 100644 + gdb/command/pahole.py gdb/command/__init__.py \ + gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \ + gdb/libstdcxx/v6/printers.py gdb/libstdcxx/v6/__init__.py \ -+ gdb/libstdcxx/__init__.py gdb/function/caller_is.py \ ++ gdb/libstdcxx/__init__.py gdb/function/caller_is.py \ + gdb/function/in_scope.py gdb/function/__init__.py gdb/backtrace.py \ + gdb/__init__.py + +# Install the Python library. Python library files go under -+# $(GDB_DATADIR_PATH)/python. ++# $(GDB_PYTHONDIR_PATH)/python. +install-python: + files='$(PY_FILES)'; for file in $$files; do \ + dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ -+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$dir; \ -+ $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_DATADIR_PATH)/python/$$file; \ ++ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir; \ ++ $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \ + done + -+# Brute force. ++# Other packages may have their files installed in $(GDB_PYTHONDIR_PATH). +uninstall-python: -+ rm -rf $(DESTDIR)/$(GDB_DATADIR_PATH)/python ++ rm -rf $(DESTDIR)/$(GDB_PYTHONDIR_PATH)/python ++ files='$(PY_FILES)'; for file in $$files; do \ ++ dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ ++ rm -f $(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$file; \ ++ while test "x$$file" != "x$$dir"; do \ ++ rmdir 2>/dev/null "$(DESTDIR)$(GDB_PYTHONDIR_PATH)/$$dir"; \ ++ file="$$dir"; \ ++ dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ ++ done \ ++ done + # # Dependency tracking. Most of this is conditional on GNU Make being @@ -798,6 +831,39 @@ index 5007cd0..241a6ac 100644 fprintf_filtered (file, "\n"); } break; +diff --git a/gdb/block.c b/gdb/block.c +index 8f0140c..d451769 100644 +--- a/gdb/block.c ++++ b/gdb/block.c +@@ -207,24 +207,16 @@ block_set_scope (struct block *block, const char *scope, + } + + /* This returns the first using directives associated to BLOCK, if +- any. */ +- +-/* FIXME: carlton/2003-04-23: This uses the fact that we currently +- only have using directives in static blocks, because we only +- generate using directives from anonymous namespaces. Eventually, +- when we support using directives everywhere, we'll want to replace +- this by some iterator functions. */ ++ any. Each BLOCK_NAMESPACE()->USING already contains all the namespaces ++ imported at that code point - even those from its parent blocks. */ + + struct using_direct * + block_using (const struct block *block) + { +- const struct block *static_block = block_static_block (block); +- +- if (static_block == NULL +- || BLOCK_NAMESPACE (static_block) == NULL) ++ if (block == NULL || BLOCK_NAMESPACE (block) == NULL) + return NULL; + else +- return BLOCK_NAMESPACE (static_block)->using; ++ return BLOCK_NAMESPACE (block)->using; + } + + /* Set BLOCK's using member to USING; if needed, allocate memory via diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b23b294..e9bc53f 100644 --- a/gdb/breakpoint.c @@ -1638,11 +1704,92 @@ index 94287de..8552e1b 100644 +extern void set_breakpoint_condition (struct breakpoint *b, char *exp, int from_tty); + #endif /* !defined (BREAKPOINT_H) */ +diff --git a/gdb/buildsym.c b/gdb/buildsym.c +index 55ace15..2722daa 100644 +--- a/gdb/buildsym.c ++++ b/gdb/buildsym.c +@@ -384,6 +384,8 @@ finish_block (struct symbol *symbol, struct pending **listhead, + opblock = pblock; + } + ++ block_set_using (block, using_directives, &objfile->objfile_obstack); ++ + record_pending_block (objfile, block, opblock); + + return block; +@@ -815,10 +817,6 @@ start_symtab (char *name, char *dirname, CORE_ADDR start_addr) + /* We shouldn't have any address map at this point. */ + gdb_assert (! pending_addrmap); + +- /* Set up support for C++ namespace support, in case we need it. */ +- +- cp_initialize_namespace (); +- + /* Initialize the list of sub source files with one entry for this + file (the top-level source file). */ + +@@ -1015,8 +1013,6 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) + finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr, + objfile); + blockvector = make_blockvector (objfile); +- cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK), +- &objfile->objfile_obstack); + } + + /* Read the line table if it has to be read separately. */ +@@ -1202,10 +1198,12 @@ push_context (int desc, CORE_ADDR valu) + new->params = param_symbols; + new->old_blocks = pending_blocks; + new->start_addr = valu; ++ new->using_directives = using_directives; + new->name = NULL; + + local_symbols = NULL; + param_symbols = NULL; ++ using_directives = NULL; + + return new; + } +diff --git a/gdb/buildsym.h b/gdb/buildsym.h +index bf23ecc..f542aca 100644 +--- a/gdb/buildsym.h ++++ b/gdb/buildsym.h +@@ -125,6 +125,10 @@ EXTERN struct pending *local_symbols; + + EXTERN struct pending *param_symbols; + ++/* using directives local to lexical context */ ++ ++EXTERN struct using_direct *using_directives; ++ + /* Stack representing unclosed lexical contexts (that will become + blocks, eventually). */ + +@@ -138,6 +142,10 @@ struct context_stack + + struct pending *params; + ++ /* Pending using directives at the time we entered */ ++ ++ struct using_direct *using_directives; ++ + /* Pointer into blocklist as of entry */ + + struct pending_block *old_blocks; diff --git a/gdb/c-exp.y b/gdb/c-exp.y -index d4bbbcc..45cd282 100644 +index d4bbbcc..107452a 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y -@@ -143,6 +143,7 @@ void yyerror (char *); +@@ -119,6 +119,8 @@ static int yylex (void); + + void yyerror (char *); + ++/* Cleanup for 'nonempty_typelist' */ ++static struct cleanup *typelist_cleanup; + %} + + /* Although the yacc "value" of an expression is not used, +@@ -143,6 +145,7 @@ void yyerror (char *); struct symbol *sym; struct type *tval; struct stoken sval; @@ -1650,7 +1797,7 @@ index d4bbbcc..45cd282 100644 struct ttype tsym; struct symtoken ssym; int voidval; -@@ -150,6 +151,7 @@ void yyerror (char *); +@@ -150,6 +153,7 @@ void yyerror (char *); enum exp_opcode opcode; struct internalvar *ivar; @@ -1658,7 +1805,7 @@ index d4bbbcc..45cd282 100644 struct type **tvec; int *ivec; } -@@ -182,11 +184,13 @@ static int parse_number (char *, int, int, YYSTYPE *); +@@ -182,11 +186,13 @@ static int parse_number (char *, int, int, YYSTYPE *); Contexts where this distinction is not important can use the nonterminal "name", which matches either NAME or TYPENAME. */ @@ -1674,7 +1821,46 @@ index d4bbbcc..45cd282 100644 %type name_not_typename %type typename -@@ -524,6 +528,15 @@ exp : INT +@@ -399,6 +405,38 @@ arglist : arglist ',' exp %prec ABOVE_COMMA + { arglist_len++; } + ; + ++exp : exp '(' nonempty_typelist ')' ++ { int i; ++ /* What to do about freeing memory if ++ there is an error during parsing? */ ++ write_exp_elt_opcode (TYPE_INSTANCE); ++ write_exp_elt_longcst ((LONGEST) $3[0]); ++ for (i = 0; i < $3[0]; ++i) ++ write_exp_elt_type ($3[i + 1]); ++ write_exp_elt_longcst((LONGEST) $3[0]); ++ write_exp_elt_opcode (TYPE_INSTANCE); ++ do_cleanups (typelist_cleanup); ++ } ++ ; ++ ++/* ++exp : BLOCKNAME '(' nonempty_typelist ')' ++ { int i; ++ write_exp_elt_opcode (TYPE_INSTANCE_LOOKUP); ++ write_exp_elt_sym ($1.sym); ++ write_exp_elt_opcode (TYPE_INSTANCE_LOOKUP); ++ ++ write_exp_elt_opcode (TYPE_INSTANCE); ++ write_exp_elt_longcst ((LONGEST) $3[0]); ++ for (i = 0; i < $3[0]; ++i) ++ write_exp_elt_type ($3[i + 1]); ++ write_exp_elt_longcst((LONGEST) $3[0]); ++ write_exp_elt_opcode (TYPE_INSTANCE); ++ do_cleanups (typelist_cleanup); ++ } ++ ; ++*/ ++ + rcurly : '}' + { $$ = end_arglist () - 1; } + ; +@@ -524,6 +562,15 @@ exp : INT write_exp_elt_opcode (OP_LONG); } ; @@ -1690,7 +1876,7 @@ index d4bbbcc..45cd282 100644 exp : NAME_OR_INT { YYSTYPE val; parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val); -@@ -572,48 +585,64 @@ string_exp: +@@ -572,48 +619,64 @@ string_exp: string. Note that we follow the NUL-termination convention of the lexer. */ @@ -1785,7 +1971,47 @@ index d4bbbcc..45cd282 100644 } ; -@@ -1361,6 +1390,263 @@ parse_number (p, len, parsed_float, putithere) +@@ -713,12 +776,13 @@ qualified_name: typebase COLONCOLON name + ; + + variable: qualified_name ++ | COLONCOLON qualified_name + | COLONCOLON name + { + char *name = copy_name ($2); + struct symbol *sym; + struct minimal_symbol *msymbol; +- ++ + sym = + lookup_symbol (name, (const struct block *) NULL, + VAR_DOMAIN, (int *) NULL); +@@ -856,7 +920,7 @@ array_mod: '[' ']' + func_mod: '(' ')' + { $$ = 0; } + | '(' nonempty_typelist ')' +- { free ($2); $$ = 0; } ++ { do_cleanups (typelist_cleanup); $$ = 0; } + ; + + /* We used to try to recognize pointer to member types here, but +@@ -1057,12 +1121,15 @@ typename: TYPENAME + nonempty_typelist + : type + { $$ = (struct type **) malloc (sizeof (struct type *) * 2); ++ typelist_cleanup = make_cleanup (free, $$); + $$[0] = 1; /* Number of types in vector */ + $$[1] = $1; + } + | nonempty_typelist ',' type + { int len = sizeof (struct type *) * (++($1[0]) + 1); + $$ = (struct type **) realloc ((char *) $1, len); ++ discard_cleanups (typelist_cleanup); ++ typelist_cleanup = make_cleanup (free, $$); + $$[$$[0]] = $3; + } + ; +@@ -1361,6 +1428,263 @@ parse_number (p, len, parsed_float, putithere) return INT; } @@ -2049,7 +2275,18 @@ index d4bbbcc..45cd282 100644 struct token { char *operator; -@@ -1530,12 +1816,6 @@ yylex () +@@ -1526,23 +1850,33 @@ static int last_was_structop; + static int + yylex () + { ++ /* name_prefix stores the full qualification of a variable that is ++ specified in the expression. It is used to eleminate confusion ++ during lookup.*/ ++ static char* name_prefix = NULL; ++ static int name_prefix_len = 0; ++ static int terminate_prefix = 0; ++ + int c; int namelen; unsigned int i; char *tokstart; @@ -2062,7 +2299,52 @@ index d4bbbcc..45cd282 100644 int saw_structop = last_was_structop; char *copy; -@@ -1607,46 +1887,6 @@ yylex () + last_was_structop = 0; +- ++ + retry: +- ++ ++ if(terminate_prefix || ++ lexptr != name_prefix + name_prefix_len // Some token was skiped so clear name_prefix ++ ){ ++ name_prefix = NULL; ++ name_prefix_len = 0; ++ } ++ ++ terminate_prefix = 1; ++ + /* Check if this is a macro invocation that we need to expand. */ + if (! scanning_macro_expansion ()) + { +@@ -1570,10 +1904,19 @@ yylex () + for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) + if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) + { ++ ++ if(tokentab2[i].token == COLONCOLON){ ++ name_prefix_len += 2; ++ terminate_prefix = 0; ++ if(name_prefix == NULL){ ++ name_prefix = lexptr; ++ } ++ } + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + if (in_parse_field && tokentab2[i].token == ARROW) + last_was_structop = 1; ++ + return tokentab2[i].token; + } + +@@ -1602,51 +1945,13 @@ yylex () + return 0; + + case ' ': ++ name_prefix_len++; ++ terminate_prefix = 0; + case '\t': + case '\n': lexptr++; goto retry; @@ -2109,7 +2391,7 @@ index d4bbbcc..45cd282 100644 case '(': paren_depth++; lexptr++; -@@ -1764,70 +2004,33 @@ yylex () +@@ -1764,70 +2069,33 @@ yylex () lexptr++; return c; @@ -2202,6 +2484,59 @@ index d4bbbcc..45cd282 100644 } if (!(c == '_' || c == '$' +@@ -1836,11 +2104,13 @@ yylex () + error ("Invalid character '%c' in expression.", c); + + /* It's a name. See how long it is. */ ++ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) + { ++ + /* Template parameter lists are part of the name. + FIXME: This mishandles `print $a<4&&$a>3'. */ + +@@ -1904,14 +2174,29 @@ yylex () + currently as names of types; NAME for other symbols. + The caller is not constrained to care about the distinction. */ + { ++ char *tmp = copy; + struct symbol *sym; + int is_a_field_of_this = 0; + int hextype; + +- sym = lookup_symbol (copy, expression_context_block, ++ if(name_prefix != NULL){ ++ tmp = savestring (name_prefix, name_prefix_len+namelen); ++ } ++ ++ sym = lookup_symbol (tmp, expression_context_block, + VAR_DOMAIN, + parse_language->la_language == language_cplus + ? &is_a_field_of_this : (int *) NULL); ++ ++ /* keep this name as prefix for the next name */ ++ if(sym){ ++ if(name_prefix == NULL){ ++ name_prefix = tokstart; ++ } ++ name_prefix_len += namelen; ++ terminate_prefix = 0; ++ } ++ + /* 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). */ +@@ -1970,6 +2255,7 @@ yylex () + yylval.ssym.is_a_field_of_this = is_a_field_of_this; + if (in_parse_field && *lexptr == '\0') + saw_name_at_eof = 1; ++ + return NAME; + } + } diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 8b5410f..188755b 100644 --- a/gdb/c-lang.c @@ -3213,10 +3548,69 @@ index 06c5767..ba9d996 100644 const struct value_print_options *options); diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index 0929516..2aaf9ad 100644 +index 0929516..c005fe4 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c -@@ -559,7 +559,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -40,8 +40,6 @@ static void cp_type_print_method_args (struct type *mtype, char *prefix, + char *varstring, int staticp, + struct ui_file *stream); + +-static void c_type_print_args (struct type *, struct ui_file *); +- + static void cp_type_print_derivation_info (struct ui_file *, struct type *); + + static void c_type_print_varspec_prefix (struct type *, struct ui_file *, int, +@@ -199,6 +197,23 @@ cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring, + fprintf_filtered (stream, "void"); + + fprintf_filtered (stream, ")"); ++ ++ /* For non-static methods, read qualifiers from the type of ++ THIS. */ ++ if (!staticp) ++ { ++ struct type *domain; ++ ++ gdb_assert (nargs > 0); ++ gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR); ++ domain = TYPE_TARGET_TYPE (args[0].type); ++ ++ if (TYPE_CONST (domain)) ++ fprintf_filtered (stream, " const"); ++ ++ if (TYPE_VOLATILE (domain)) ++ fprintf_filtered (stream, " volatile"); ++ } + } + + +@@ -354,10 +369,12 @@ c_type_print_modifier (struct type *type, struct ui_file *stream, + + /* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD + or TYPE_CODE_FUNC, to STREAM. Artificial arguments, such as "this" +- in non-static methods, are displayed. */ ++ in non-static methods, are displayed if SHOW_ARTIFICIAL is ++ non-zero. */ + +-static void +-c_type_print_args (struct type *type, struct ui_file *stream) ++void ++c_type_print_args (struct type *type, struct ui_file *stream, ++ int show_artificial) + { + int i, len; + struct field *args; +@@ -369,6 +386,9 @@ c_type_print_args (struct type *type, struct ui_file *stream) + + for (i = 0; i < TYPE_NFIELDS (type); i++) + { ++ if (TYPE_FIELD_ARTIFICIAL (type, i) && !show_artificial) ++ continue; ++ + if (printed_any) + { + fprintf_filtered (stream, ", "); +@@ -559,7 +579,12 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, fprintf_filtered (stream, ")"); fprintf_filtered (stream, "["); @@ -3230,6 +3624,15 @@ index 0929516..2aaf9ad 100644 && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) fprintf_filtered (stream, "%d", (TYPE_LENGTH (type) +@@ -592,7 +617,7 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, + if (passed_a_ptr) + fprintf_filtered (stream, ")"); + if (!demangled_args) +- c_type_print_args (type, stream); ++ c_type_print_args (type, stream, 1); + c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, show, + passed_a_ptr, 0); + break; diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 0b616f7..3433da2 100644 --- a/gdb/c-valprint.c @@ -6696,7 +7099,7 @@ index 6059d68..47ee601 100644 default_symfile_offsets, /* sym_offsets: xlate external to internal form */ default_symfile_segments, /* sym_segments: Get segment information from diff --git a/gdb/config.in b/gdb/config.in -index 6aaf77a..3ef5bbd 100644 +index 6aaf77a..1cfb12b 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -42,6 +42,12 @@ @@ -6712,7 +7115,17 @@ index 6aaf77a..3ef5bbd 100644 /* Define to be a string naming the default host character set. */ #undef GDB_DEFAULT_HOST_CHARSET -@@ -169,12 +175,18 @@ +@@ -60,6 +66,9 @@ + /* Define to the default OS ABI for this configuration. */ + #undef GDB_OSABI_DEFAULT + ++/* Base directory for GDB Python modules. */ ++#undef GDB_PYTHONDIR_PATH ++ + /* Define to 1 if you have `alloca', as a function or macro. */ + #undef HAVE_ALLOCA + +@@ -169,12 +178,18 @@ /* Define if you have the iconv() function. */ #undef HAVE_ICONV @@ -6732,7 +7145,7 @@ index 6aaf77a..3ef5bbd 100644 #undef HAVE_LC_MESSAGES diff --git a/gdb/configure b/gdb/configure -index 7579c84..9eb9a8d 100755 +index 7579c84..aa1dd84 100755 --- a/gdb/configure +++ b/gdb/configure @@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite" @@ -6740,7 +7153,7 @@ index 7579c84..9eb9a8d 100755 ac_subdirs_all="$ac_subdirs_all multi-ice" ac_subdirs_all="$ac_subdirs_all gdbserver" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBICONV LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' -+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' ++ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os am__leading_dot DEPDIR CCDEPMODE MAKE GMAKE_TRUE GMAKE_FALSE SET_MAKE USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT localedir GL_COND_LIBTOOL_TRUE GL_COND_LIBTOOL_FALSE GNULIB_MEMMEM GNULIB_MEMPCPY GNULIB_MEMRCHR GNULIB_STPCPY GNULIB_STPNCPY GNULIB_STRCHRNUL GNULIB_STRDUP GNULIB_STRNDUP GNULIB_STRNLEN GNULIB_STRPBRK GNULIB_STRSEP GNULIB_STRSTR GNULIB_STRCASESTR GNULIB_STRTOK_R GNULIB_MBSLEN GNULIB_MBSNLEN GNULIB_MBSCHR GNULIB_MBSRCHR GNULIB_MBSSTR GNULIB_MBSCASECMP GNULIB_MBSNCASECMP GNULIB_MBSPCASECMP GNULIB_MBSCASESTR GNULIB_MBSCSPN GNULIB_MBSPBRK GNULIB_MBSSPN GNULIB_MBSSEP GNULIB_MBSTOK_R GNULIB_STRERROR GNULIB_STRSIGNAL HAVE_DECL_MEMMEM HAVE_MEMPCPY HAVE_DECL_MEMRCHR HAVE_STPCPY HAVE_STPNCPY HAVE_STRCHRNUL HAVE_DECL_STRDUP HAVE_STRNDUP HAVE_DECL_STRNDUP HAVE_DECL_STRNLEN HAVE_STRPBRK HAVE_STRSEP HAVE_STRCASESTR HAVE_DECL_STRTOK_R HAVE_DECL_STRERROR HAVE_DECL_STRSIGNAL REPLACE_STRERROR REPLACE_STRSIGNAL REPLACE_MEMMEM REPLACE_STRCASESTR REPLACE_STRSTR HAVE_LONG_LONG_INT HAVE_UNSIGNED_LONG_LONG_INT HAVE_INTTYPES_H HAVE_SYS_TYPES_H INCLUDE_NEXT NEXT_STDINT_H HAVE_STDINT_H HAVE_SYS_INTTYPES_H HAVE_SYS_BITYPES_H BITSIZEOF_PTRDIFF_T BITSIZEOF_SIG_ATOMIC_T BITSIZEOF_SIZE_T BITSIZEOF_WCHAR_T BITSIZEOF_WINT_T HAVE_SIGNED_SIG_ATOMIC_T HAVE_SIGNED_WCHAR_T HAVE_SIGNED_WINT_T PTRDIFF_T_SUFFIX SIG_ATOMIC_T_SUFFIX SIZE_T_SUFFIX WCHAR_T_SUFFIX WINT_T_SUFFIX STDINT_H NEXT_STRING_H GNULIB_WCWIDTH HAVE_DECL_WCWIDTH REPLACE_WCWIDTH WCHAR_H HAVE_WCHAR_H NEXT_WCHAR_H LIBGNU_LIBDEPS LIBGNU_LTLIBDEPS GNULIB_STDINT_H PACKAGE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK AMTAR am__tar am__untar am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH am__fastdepCC_TRUE am__fastdepCC_FALSE GDB_DATADIR_PATH subdirs TARGET_OBS PKGVERSION REPORT_BUGS_TO REPORT_BUGS_TEXI LN_S YACC AR ac_ct_AR DLLTOOL ac_ct_DLLTOOL WINDRES ac_ct_WINDRES MIG ac_ct_MIG LIBICONV LIBICONV_INCLUDE LIBICONV_LIBDIR READLINE READLINE_DEPS READLINE_CFLAGS HAVE_LIBEXPAT LIBEXPAT LTLIBEXPAT GDB_PYTHONDIR_PATH PYTHON_CFLAGS ALLOCA CONFIG_LDFLAGS TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE WARN_CFLAGS WERROR_CFLAGS SER_HARDWIRE WIN32LIBS LIBGUI GUI_CFLAGS_X WIN32LDAPP TCL_VERSION TCL_PATCH_LEVEL TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_INCLUDE TCL_LIBRARY TCL_DEPS TK_VERSION TK_BIN_DIR TK_SRC_DIR TK_LIB_FILE TK_LIB_FLAG TK_LIB_SPEC TK_STUB_LIB_FILE TK_STUB_LIB_FLAG TK_STUB_LIB_SPEC TK_INCLUDE TK_LIBRARY TK_DEPS TK_XINCLUDES X_CFLAGS X_LDFLAGS X_LIBS GDBTKLIBS GDBTK_CFLAGS GDBTK_SRC_DIR SIM SIM_OBS ENABLE_CFLAGS PROFILE_CFLAGS CONFIG_OBS CONFIG_DEPS CONFIG_SRCS CONFIG_ALL CONFIG_CLEAN CONFIG_INSTALL CONFIG_UNINSTALL target_subdir frags nm_h LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' ac_subst_files='host_makefile_frag' ac_pwd=`pwd` @@ -7045,7 +7458,46 @@ index 7579c84..9eb9a8d 100755 # On alpha-osf, it appears that libtermcap and libcurses are not compatible. # There is a very specific comment in /usr/include/curses.h explaining that # termcap routines built into libcurses must not be used. -@@ -11418,6 +11686,8 @@ _ACEOF +@@ -11156,6 +11424,7 @@ echo $ECHO_N "checking whether to use python... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: $with_python" >&5 + echo "${ECHO_T}$with_python" >&6 + ++GDB_PYTHONDIR_PATH= + if test "${with_python}" = no; then + { echo "$as_me:$LINENO: WARNING: python support disabled; some features may be unavailable." >&5 + echo "$as_me: WARNING: python support disabled; some features may be unavailable." >&2;} +@@ -11387,7 +11656,20 @@ _ACEOF + + fi + fi +- if test ${have_libpython} = no; then ++ if test ${have_libpython} != no; then ++ GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`" ++ ++ test "x$prefix" = xNONE && prefix="$ac_default_prefix" ++ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ++ ac_define_dir=`eval echo $GDB_PYTHONDIR_PATH` ++ ac_define_dir=`eval echo $ac_define_dir` ++ ++cat >>confdefs.h <<_ACEOF ++#define GDB_PYTHONDIR_PATH "$ac_define_dir" ++_ACEOF ++ ++ ++ else + case "${with_python}" in + yes) + { { echo "$as_me:$LINENO: error: python is missing or unusable" >&5 +@@ -11409,6 +11691,8 @@ echo "$as_me: error: no usable python found at ${with_python}" >&2;} + fi + fi + ++ ++PYTHON_CFLAGS= + if test "${have_libpython}" = yes; then + + cat >>confdefs.h <<\_ACEOF +@@ -11418,6 +11702,8 @@ _ACEOF CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" @@ -7054,7 +7506,7 @@ index 7579c84..9eb9a8d 100755 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" # Flags needed to compile Python code (taken from python-config --cflags). -@@ -15445,10 +15715,11 @@ fi +@@ -15445,10 +15731,11 @@ fi @@ -7067,7 +7519,7 @@ index 7579c84..9eb9a8d 100755 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 -@@ -15550,6 +15821,70 @@ fi +@@ -15550,6 +15837,70 @@ fi done @@ -7138,7 +7590,7 @@ index 7579c84..9eb9a8d 100755 # Check the return and argument types of ptrace. No canned test for # this, so roll our own. gdb_ptrace_headers=' -@@ -20776,230 +21111,11 @@ done +@@ -20776,230 +21127,11 @@ done @@ -7370,7 +7822,7 @@ index 7579c84..9eb9a8d 100755 ac_config_files="$ac_config_files Makefile .gdbinit:gdbinit.in gnulib/Makefile" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF -@@ -21865,6 +21981,7 @@ s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +@@ -21865,6 +21997,7 @@ s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t @@ -7378,7 +7830,7 @@ index 7579c84..9eb9a8d 100755 s,@subdirs@,$subdirs,;t t s,@TARGET_OBS@,$TARGET_OBS,;t t s,@PKGVERSION@,$PKGVERSION,;t t -@@ -21880,6 +21997,9 @@ s,@WINDRES@,$WINDRES,;t t +@@ -21880,12 +22013,16 @@ s,@WINDRES@,$WINDRES,;t t s,@ac_ct_WINDRES@,$ac_ct_WINDRES,;t t s,@MIG@,$MIG,;t t s,@ac_ct_MIG@,$ac_ct_MIG,;t t @@ -7388,7 +7840,14 @@ index 7579c84..9eb9a8d 100755 s,@READLINE@,$READLINE,;t t s,@READLINE_DEPS@,$READLINE_DEPS,;t t s,@READLINE_CFLAGS@,$READLINE_CFLAGS,;t t -@@ -21944,7 +22064,6 @@ s,@CONFIG_UNINSTALL@,$CONFIG_UNINSTALL,;t t + s,@HAVE_LIBEXPAT@,$HAVE_LIBEXPAT,;t t + s,@LIBEXPAT@,$LIBEXPAT,;t t + s,@LTLIBEXPAT@,$LTLIBEXPAT,;t t ++s,@GDB_PYTHONDIR_PATH@,$GDB_PYTHONDIR_PATH,;t t + s,@PYTHON_CFLAGS@,$PYTHON_CFLAGS,;t t + s,@ALLOCA@,$ALLOCA,;t t + s,@CONFIG_LDFLAGS@,$CONFIG_LDFLAGS,;t t +@@ -21944,7 +22081,6 @@ s,@CONFIG_UNINSTALL@,$CONFIG_UNINSTALL,;t t s,@target_subdir@,$target_subdir,;t t s,@frags@,$frags,;t t s,@nm_h@,$nm_h,;t t @@ -7397,7 +7856,7 @@ index 7579c84..9eb9a8d 100755 s,@LTLIBOBJS@,$LTLIBOBJS,;t t s,@gl_LIBOBJS@,$gl_LIBOBJS,;t t diff --git a/gdb/configure.ac b/gdb/configure.ac -index 3f81ff2..5892c59 100644 +index 3f81ff2..857a7cd 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1,6 +1,6 @@ @@ -7454,7 +7913,36 @@ index 3f81ff2..5892c59 100644 # On alpha-osf, it appears that libtermcap and libcurses are not compatible. # There is a very specific comment in /usr/include/curses.h explaining that # termcap routines built into libcurses must not be used. -@@ -649,6 +681,8 @@ if test "${have_libpython}" = yes; then +@@ -585,6 +617,7 @@ AC_ARG_WITH(python, + AC_MSG_CHECKING([whether to use python]) + AC_MSG_RESULT([$with_python]) + ++GDB_PYTHONDIR_PATH= + if test "${with_python}" = no; then + AC_MSG_WARN([python support disabled; some features may be unavailable.]) + have_libpython=no +@@ -627,7 +660,11 @@ else + AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.]) + fi + fi +- if test ${have_libpython} = no; then ++ if test ${have_libpython} != no; then ++ GDB_PYTHONDIR_PATH="`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib();"`" ++ AC_DEFINE_DIR(GDB_PYTHONDIR_PATH, GDB_PYTHONDIR_PATH, ++ [Base directory for GDB Python modules.]) ++ else + case "${with_python}" in + yes) + AC_MSG_ERROR([python is missing or unusable]) +@@ -643,12 +680,16 @@ else + LIBS=$save_LIBS + fi + fi ++AC_SUBST(GDB_PYTHONDIR_PATH) + ++PYTHON_CFLAGS= + if test "${have_libpython}" = yes; then + AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.]) CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" @@ -7463,7 +7951,7 @@ index 3f81ff2..5892c59 100644 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" # Flags needed to compile Python code (taken from python-config --cflags). -@@ -776,7 +810,8 @@ AC_FUNC_VFORK +@@ -776,7 +817,8 @@ AC_FUNC_VFORK AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \ getgid poll pread64 sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ @@ -7473,7 +7961,7 @@ index 3f81ff2..5892c59 100644 # Check the return and argument types of ptrace. No canned test for # this, so roll our own. -@@ -1930,17 +1965,10 @@ dnl Check for exe extension set on certain hosts (e.g. Win32) +@@ -1930,17 +1972,10 @@ dnl Check for exe extension set on certain hosts (e.g. Win32) AC_EXEEXT dnl Detect the character set used by this host. @@ -7609,6 +8097,455 @@ index 65c3e25..f0cca7d 100644 build_gdbserver=yes ;; xtensa*) +diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y +index 5f5ee3a..a8f8f30 100644 +--- a/gdb/cp-name-parser.y ++++ b/gdb/cp-name-parser.y +@@ -1,7 +1,6 @@ + /* YACC parser for C++ names, for GDB. + +- Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 +- Free Software Foundation, Inc. ++ Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + + Parts of the lexer are based on c-exp.y from GDB. + +@@ -501,7 +500,7 @@ operator : OPERATOR NEW + | OPERATOR ARROW + { $$ = make_operator ("->", 2); } + | OPERATOR '(' ')' +- { $$ = make_operator ("()", 0); } ++ { $$ = make_operator ("()", 2); } + | OPERATOR '[' ']' + { $$ = make_operator ("[]", 2); } + ; +diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c +index c6c5617..4b84348 100644 +--- a/gdb/cp-namespace.c ++++ b/gdb/cp-namespace.c +@@ -30,26 +30,13 @@ + #include "dictionary.h" + #include "command.h" + #include "frame.h" ++#include "buildsym.h" + + /* List of using directives that are active in the current file. */ + +-static struct using_direct *using_list; +- +-static struct using_direct *cp_add_using (const char *name, +- unsigned int inner_len, +- unsigned int outer_len, +- struct using_direct *next); +- + static struct using_direct *cp_copy_usings (struct using_direct *using, + struct obstack *obstack); + +-static struct symbol *lookup_namespace_scope (const char *name, +- const char *linkage_name, +- const struct block *block, +- const domain_enum domain, +- const char *scope, +- int scope_len); +- + static struct symbol *lookup_symbol_file (const char *name, + const char *linkage_name, + const struct block *block, +@@ -78,31 +65,6 @@ static struct symbol *lookup_possible_namespace_symbol (const char *name); + + static void maintenance_cplus_namespace (char *args, int from_tty); + +-/* Set up support for dealing with C++ namespace info in the current +- symtab. */ +- +-void cp_initialize_namespace () +-{ +- using_list = NULL; +-} +- +-/* Add all the using directives we've gathered to the current symtab. +- STATIC_BLOCK should be the symtab's static block; OBSTACK is used +- for allocation. */ +- +-void +-cp_finalize_namespace (struct block *static_block, +- struct obstack *obstack) +-{ +- if (using_list != NULL) +- { +- block_set_using (static_block, +- cp_copy_usings (using_list, obstack), +- obstack); +- using_list = NULL; +- } +-} +- + /* Check to see if SYMBOL refers to an object contained within an + anonymous namespace; if so, add an appropriate using directive. */ + +@@ -136,14 +98,17 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) + "(anonymous namespace)", + ANONYMOUS_NAMESPACE_LEN) == 0) + { ++ int outer_len = (previous_component == 0 ? 0 : previous_component - 2); ++ char outer[outer_len+1]; ++ ++ strncpy(outer, name, outer_len); ++ ++ outer[outer_len] = '\0'; + /* We've found a component of the name that's an + 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 (name, +- previous_component == 0 +- ? 0 : previous_component - 2, +- next_component); ++ cp_add_using_directive (outer, name, "", "", 0); + } + /* The "+ 2" is for the "::". */ + previous_component = next_component + 2; +@@ -154,32 +119,27 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) + } + } + +-/* Add a using directive to using_list. NAME is the start of a string +- that should contain the namespaces we want to add as initial +- substrings, OUTER_LENGTH is the end of the outer namespace, and +- INNER_LENGTH is the end of the inner namespace. If the using +- directive in question has already been added, don't add it +- twice. */ ++/* Add a using directive to using_list. If the using directive in question ++ has already been added, don't add it twice. */ + + void +-cp_add_using_directive (const char *name, unsigned int outer_length, +- unsigned int inner_length) ++cp_add_using_directive (const char *outer, const char *inner, const char* alias, ++ const char *declaration, const int line_number) + { + struct using_direct *current; + struct using_direct *new; + + /* Has it already been added? */ + +- for (current = using_list; current != NULL; current = current->next) ++ for (current = using_directives; current != NULL; current = current->next) + { +- if ((strncmp (current->inner, name, inner_length) == 0) +- && (strlen (current->inner) == inner_length) +- && (strlen (current->outer) == outer_length)) ++ if (strcmp (current->inner, inner) == 0 ++ && strcmp (current->outer, outer) == 0) + return; + } + +- using_list = cp_add_using (name, inner_length, outer_length, +- using_list); ++ using_directives = cp_add_using (outer, inner, alias, declaration, ++ line_number,using_directives); + } + + /* Record the namespace that the function defined by SYMBOL was +@@ -230,26 +190,31 @@ cp_is_anonymous (const char *namespace) + != NULL); + } + +-/* Create a new struct using direct whose inner namespace is the +- initial substring of NAME of leng INNER_LEN and whose outer +- namespace is the initial substring of NAME of length OUTER_LENGTH. ++/* Create a new struct using direct whose inner namespace is INNER ++ and whose outer namespace is OUTER. ALIAS is the name of the imported ++ namespace in the current scope. If ALIAS is an empty string 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. */ + +-static struct using_direct * +-cp_add_using (const char *name, +- unsigned int inner_len, +- unsigned int outer_len, ++struct using_direct * ++cp_add_using (const char *outer, ++ const char *inner, ++ const char *alias, ++ const char *declaration, ++ const int line_number, + struct using_direct *next) + { + struct using_direct *retval; + +- gdb_assert (outer_len < inner_len); +- + retval = xmalloc (sizeof (struct using_direct)); +- retval->inner = savestring (name, inner_len); +- retval->outer = savestring (name, outer_len); ++ retval->inner = savestring (inner, strlen(inner)); ++ retval->outer = savestring (outer, strlen(outer)); ++ retval->alias = savestring (alias, strlen(alias)); ++ retval->declaration = savestring (declaration, strlen(declaration)); ++ retval->line_number = line_number; ++ + retval->next = next; + + return retval; +@@ -274,7 +239,11 @@ cp_copy_usings (struct using_direct *using, + retval->inner = obsavestring (using->inner, strlen (using->inner), + obstack); + retval->outer = obsavestring (using->outer, strlen (using->outer), +- obstack); ++ obstack); ++ retval->alias = obsavestring (using->alias, strlen (using->alias), ++ obstack); ++ retval->declaration = obsavestring (using->declaration, strlen (using->declaration), ++ obstack); + retval->next = cp_copy_usings (using->next, obstack); + + xfree (using->inner); +@@ -299,8 +268,14 @@ cp_lookup_symbol_nonlocal (const char *name, + const struct block *block, + const domain_enum domain) + { +- return lookup_namespace_scope (name, linkage_name, block, domain, +- block_scope (block), 0); ++ ++ struct symbol* sym = lookup_namespace_scope(name, linkage_name, block, ++ domain, block_scope(block), 0); ++ ++ if (sym != NULL) ++ return sym; ++ ++ return lookup_symbol_file(name, linkage_name, block, domain, 0); + } + + /* Lookup NAME at namespace scope (or, in C terms, in static and +@@ -318,7 +293,7 @@ cp_lookup_symbol_nonlocal (const char *name, + "A::x", and if that call fails, then the first call looks for + "x". */ + +-static struct symbol * ++struct symbol * + lookup_namespace_scope (const char *name, + const char *linkage_name, + const struct block *block, +@@ -354,10 +329,43 @@ lookup_namespace_scope (const char *name, + namespace = alloca (scope_len + 1); + strncpy (namespace, scope, scope_len); + namespace[scope_len] = '\0'; +- return cp_lookup_symbol_namespace (namespace, name, linkage_name, ++ return cp_lookup_symbol_namespace_incremental (namespace, name, linkage_name, + block, domain); + } + ++/* Searches the for the given NAME in the given NAMESPACE, using import ++ statements implied by the given BLOCK, *and its' parents*. */ ++struct symbol * ++cp_lookup_symbol_namespace_incremental (const char *namespace, ++ const char *name, ++ const char *linkage_name, ++ const struct block *block, ++ const domain_enum domain) ++{ ++ struct symbol *sym; ++ const struct block *global_block = block_global_block (block); ++ ++ /* Check if either no block is specified or it's a global block. */ ++ ++ if (global_block == NULL) ++ return NULL; ++ ++ while (block != global_block) ++ { ++ sym = cp_lookup_symbol_namespace (namespace, name, linkage_name, block, domain); ++ ++ if (sym != NULL) ++ return sym; ++ ++ block = BLOCK_SUPERBLOCK (block); ++ } ++ ++ /* We've reached the global block without finding a result. */ ++ ++ return NULL; ++} ++ ++ + /* Look up NAME in the C++ namespace NAMESPACE, applying the using + directives that are active in BLOCK. Other arguments are as in + cp_lookup_symbol_nonlocal. */ +@@ -370,7 +378,7 @@ cp_lookup_symbol_namespace (const char *namespace, + const domain_enum domain) + { + const struct using_direct *current; +- struct symbol *sym; ++ struct symbol *sym = NULL; + + /* First, 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 +@@ -380,15 +388,42 @@ cp_lookup_symbol_namespace (const char *namespace, + current != NULL; + current = current->next) + { +- if (strcmp (namespace, current->outer) == 0) ++ ++ int current_line = find_pc_line (get_frame_pc (get_current_frame ()), 0).line; ++ ++ if (strcmp (namespace, current->outer) == 0 && current->line_number < current_line) + { +- sym = cp_lookup_symbol_namespace (current->inner, +- name, +- linkage_name, +- block, +- domain); +- if (sym != NULL) ++ ++ if(strcmp ("", current->declaration) != 0){ ++ if(strcmp (name, current->declaration) == 0){ ++ sym = cp_lookup_symbol_namespace (current->inner, ++ name, ++ linkage_name, ++ block, ++ domain); ++ } ++ ++ }else{ ++ /* Check for aliases */ ++ if(strcmp (name, current->alias) == 0){ ++ sym = cp_lookup_symbol_namespace (namespace, ++ current->inner, ++ linkage_name, ++ block, ++ domain); ++ }else{ ++ if(strcmp ("", current->alias) == 0){ ++ sym = cp_lookup_symbol_namespace (current->inner, ++ name, ++ linkage_name, ++ block, ++ domain); ++ } ++ } ++ } ++ if (sym != NULL){ + return sym; ++ } + } + } + +@@ -398,8 +433,10 @@ cp_lookup_symbol_namespace (const char *namespace, + + if (namespace[0] == '\0') + { +- return lookup_symbol_file (name, linkage_name, block, +- domain, 0); ++ sym = lookup_symbol_file (name, linkage_name, ++ block, domain, ++ cp_is_anonymous (namespace)); ++ return sym; + } + else + { +diff --git a/gdb/cp-support.c b/gdb/cp-support.c +index bf42636..9f04c86 100644 +--- a/gdb/cp-support.c ++++ b/gdb/cp-support.c +@@ -175,7 +175,8 @@ mangled_name_to_comp (const char *mangled_name, int options, + return ret; + } + +-/* Return the name of the class containing method PHYSNAME. */ ++/* Return the name of the class or namespace containing ++ function, method, or variable PHYSNAME. */ + + char * + cp_class_name_from_physname (const char *physname) +diff --git a/gdb/cp-support.h b/gdb/cp-support.h +index 837ca6c..23f8d5b 100644 +--- a/gdb/cp-support.h ++++ b/gdb/cp-support.h +@@ -38,14 +38,28 @@ struct demangle_component; + + /* This struct is designed to store data from using directives. It + says that names from namespace INNER should be visible within +- namespace OUTER. OUTER should always be a strict initial substring +- of INNER. These form a linked list; NEXT is the next element of +- the list. */ ++ namespace OUTER 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" ++ 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 *inner; + char *outer; ++ ++ char *alias; ++ ++ char *declaration; ++ ++ int line_number; ++ + struct using_direct *next; + }; + +@@ -54,6 +68,7 @@ struct using_direct + + extern char *cp_canonicalize_string (const char *string); + ++ + extern char *cp_class_name_from_physname (const char *physname); + + extern char *method_name_from_physname (const char *physname); +@@ -76,9 +91,18 @@ extern struct type *cp_lookup_rtti_type (const char *name, + + extern int cp_is_anonymous (const char *namespace); + +-extern void cp_add_using_directive (const char *name, +- unsigned int outer_length, +- unsigned int inner_length); ++extern void cp_add_using_directive (const char *outer, ++ const char *inner, ++ const char *alias, ++ const char *declaration, ++ const int line_number); ++ ++extern struct using_direct *cp_add_using (const char *outer, ++ const char *inner, ++ const char *alias, ++ const char *declaration, ++ const int line_number, ++ struct using_direct *next); + + extern void cp_initialize_namespace (void); + +@@ -98,6 +122,19 @@ extern struct symbol *cp_lookup_symbol_nonlocal (const char *name, + const struct block *block, + const domain_enum domain); + ++extern struct symbol *lookup_namespace_scope (const char *name, ++ const char *linkage_name, ++ const struct block *block, ++ const domain_enum domain, ++ const char *scope, ++ int scope_len); ++ ++extern struct symbol *cp_lookup_symbol_namespace_incremental (const char *namespace, ++ const char *name, ++ const char *linkage_name, ++ const struct block *block, ++ const domain_enum domain); ++ + extern struct symbol *cp_lookup_symbol_namespace (const char *namespace, + const char *name, + const char *linkage_name, diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 8b7d868..dcd32cb 100644 --- a/gdb/cp-valprint.c @@ -7656,9 +8593,17 @@ index 8b7d868..dcd32cb 100644 } diff --git a/gdb/dbxread.c b/gdb/dbxread.c -index 115bdef..2d39ba0 100644 +index 115bdef..7f756af 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c +@@ -1,6 +1,6 @@ + /* Read dbx symbol tables and convert to internal format, for GDB. + Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, +- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008. ++ 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009. + Free Software Foundation, Inc. + + This file is part of GDB. @@ -1188,6 +1188,8 @@ read_dbx_symtab (struct objfile *objfile) struct internal_nlist nlist; CORE_ADDR text_addr; @@ -7672,27 +8617,27 @@ index 115bdef..2d39ba0 100644 if (!p) continue; /* Not a debugging symbol. */ -+ sym_len = 0; -+ if (psymtab_language == language_cplus) -+ { -+ char *new_name, *name = alloca (p - namestring + 1); -+ memcpy (name, namestring, p - namestring); -+ name[p - namestring] = '\0'; -+ new_name = cp_canonicalize_string (name); -+ if (new_name != NULL) -+ { -+ sym_len = strlen (new_name); -+ sym_name = obsavestring (new_name, sym_len, -+ &objfile->objfile_obstack); -+ xfree (new_name); -+ } -+ } ++ sym_len = 0; ++ if (psymtab_language == language_cplus) ++ { ++ char *new_name, *name = alloca (p - namestring + 1); ++ memcpy (name, namestring, p - namestring); ++ name[p - namestring] = '\0'; ++ new_name = cp_canonicalize_string (name); ++ if (new_name != NULL) ++ { ++ sym_len = strlen (new_name); ++ sym_name = obsavestring (new_name, sym_len, ++ &objfile->objfile_obstack); ++ xfree (new_name); ++ } ++ } + -+ if (sym_len == 0) -+ { -+ sym_name = namestring; -+ sym_len = p - namestring; -+ } ++ if (sym_len == 0) ++ { ++ sym_name = namestring; ++ sym_len = p - namestring; ++ } + /* Main processing section for debugging symbols which the initial read through the symbol tables needs to worry @@ -7802,7 +8747,7 @@ index 845b320..ad6e7d7 100644 extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *); diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 10e7388..c506fb7 100644 +index 10e7388..ef41312 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -955,8 +955,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. @@ -8224,7 +9169,7 @@ index 10e7388..c506fb7 100644 @findex gdb.write @defun write string Print a string to @value{GDBN}'s paginated standard output stream. -@@ -18193,6 +18382,61 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing +@@ -18193,6 +18382,66 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing function. @end defun @@ -8282,11 +9227,16 @@ index 10e7388..c506fb7 100644 +which is typically four bytes. @var{max_count} is the highest number of matches +to search for. +@end defun ++ ++@findex gdb.solib_address ++@defun solib_address @var{address} ++Return the name of the shared library holding the given address, or None. ++@end defun + @node Exception Handling @subsubsection Exception Handling @cindex python exceptions -@@ -18224,6 +18468,38 @@ message as its value, and the Python call stack backtrace at the +@@ -18224,6 +18473,38 @@ message as its value, and the Python call stack backtrace at the Python statement closest to where the @value{GDBN} error occured as the traceback. @@ -8325,7 +9275,7 @@ index 10e7388..c506fb7 100644 @node Values From Inferior @subsubsection Values From Inferior @cindex values from inferior, with Python -@@ -18258,8 +18534,21 @@ bar = some_val['foo'] +@@ -18258,8 +18539,21 @@ bar = some_val['foo'] Again, @code{bar} will also be a @code{gdb.Value} object. @@ -8349,7 +9299,7 @@ index 10e7388..c506fb7 100644 @defmethod Value dereference This method returns a new @code{gdb.Value} object whose contents is -@@ -18282,7 +18571,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the +@@ -18282,7 +18576,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the value pointed to by @code{foo}. @end defmethod @@ -8358,7 +9308,7 @@ index 10e7388..c506fb7 100644 If this @code{gdb.Value} represents a string, then this method converts the contents to a Python string. Otherwise, this method will throw an exception. -@@ -18309,6 +18598,468 @@ The optional @var{errors} argument is the same as the corresponding +@@ -18309,6 +18603,468 @@ The optional @var{errors} argument is the same as the corresponding argument to Python's @code{string.decode} method. @end defmethod @@ -8827,7 +9777,7 @@ index 10e7388..c506fb7 100644 @node Commands In Python @subsubsection Commands In Python -@@ -18320,7 +19071,7 @@ You can implement new @value{GDBN} CLI commands in Python. A CLI +@@ -18320,7 +19076,7 @@ You can implement new @value{GDBN} CLI commands in Python. A CLI command is implemented using an instance of the @code{gdb.Command} class, most commonly using a subclass. @@ -8836,7 +9786,7 @@ index 10e7388..c506fb7 100644 The object initializer for @code{Command} registers the new command with @value{GDBN}. This initializer is normally invoked from the subclass' own @code{__init__} method. -@@ -18332,11 +19083,11 @@ an exception is raised. +@@ -18332,11 +19088,11 @@ an exception is raised. There is no support for multi-line commands. @@ -8850,7 +9800,7 @@ index 10e7388..c506fb7 100644 one of the @samp{COMPLETE_} constants defined below. This argument tells @value{GDBN} how to perform completion for this command. If not given, @value{GDBN} will attempt to complete using the object's -@@ -18563,6 +19314,363 @@ registration of the command with @value{GDBN}. Depending on how the +@@ -18563,6 +19319,374 @@ 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. @@ -9186,10 +10136,20 @@ index 10e7388..c506fb7 100644 +or @code{gdb.SENTINEL_FRAME}. +@end defmethod + ++@defmethod Frame unwind_stop_reason ++Return an integer representing the reason why it's not possible to find ++frames older than this. Use @code{gdb.frame_stop_reason_string} to convert ++the value returned by this function to a string. ++@end defmethod ++ +@defmethod Frame pc +Returns the frame's resume address. +@end defmethod + ++@defmethod Frame block ++Returns the frame's code block. @c (see @xref{Block,,Code Blocks and Scopes}). ++@end defmethod ++ +@defmethod Frame address_in_block +Returns an address which falls within the frame's code block. +@end defmethod @@ -9206,15 +10166,16 @@ index 10e7388..c506fb7 100644 +Return the frame's symtab and line object. @c (see @xref{Symtab_and_line,, Symtab and line}). +@end defmethod + -+@defmethod Frame read_var_value @var{symbol} -+Return the value of the variable corresponding to the given symbol in this frame. ++@defmethod Frame read_var_value @var{variable} ++Return the value of the given variable in this frame. @code{variable} can be ++either a string or a @code{gdb.Symbol} object. @c (@pxref{Symbols In Python}). +@end defmethod +@end table + @node Interpreters @chapter Command Interpreters @cindex command interpreters -@@ -22273,6 +23381,103 @@ Unfreezing a variable does not update it, only subsequent +@@ -22273,6 +23397,103 @@ Unfreezing a variable does not update it, only subsequent (gdb) @end smallexample @@ -9318,7 +10279,7 @@ index 10e7388..c506fb7 100644 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @node GDB/MI Data Manipulation -@@ -23832,6 +25037,10 @@ as possible presense of the @code{frozen} field in the output +@@ -23832,6 +25053,10 @@ as possible presense of the @code{frozen} field in the output of @code{-varobj-create}. @item pending-breakpoints Indicates presence of the @option{-f} option to the @code{-break-insert} command. @@ -9705,18 +10666,30 @@ index 76577f1..bf46761 100644 #endif /* dwarf2loc.h */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 55868da..8a39bcf 100644 +index 55868da..f9d1c41 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -47,6 +47,7 @@ +@@ -1,8 +1,7 @@ + /* DWARF 2 debugging format support for GDB. + + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +- 2004, 2005, 2006, 2007, 2008, 2009 +- Free Software Foundation, Inc. ++ 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. + + Adapted by Gary Funck (gary@intrepid.com), Intrepid Technology, + Inc. with support from Florida State University (under contract +@@ -47,6 +46,9 @@ #include "command.h" #include "gdbcmd.h" #include "addrmap.h" +#include "f-lang.h" ++#include "c-lang.h" ++#include "typeprint.h" #include #include "gdb_string.h" -@@ -103,7 +104,7 @@ typedef struct pubnames_header +@@ -103,7 +105,7 @@ typedef struct pubnames_header _PUBNAMES_HEADER; #define _ACTUAL_PUBNAMES_HEADER_SIZE 13 @@ -9725,7 +10698,71 @@ index 55868da..8a39bcf 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 -@@ -523,6 +524,15 @@ struct attr_abbrev +@@ -299,9 +301,6 @@ struct dwarf2_cu + /* Hash table holding all the loaded partial DIEs. */ + htab_t partial_dies; + +- /* `.debug_ranges' offset for this `DW_TAG_compile_unit' DIE. */ +- unsigned int ranges_offset; +- + /* Storage for things with the same lifetime as this read-in compilation + unit, including partial DIEs. */ + struct obstack comp_unit_obstack; +@@ -349,9 +348,6 @@ struct dwarf2_cu + DIEs for namespaces, we don't need to try to infer them + from mangled names. */ + unsigned int has_namespace_info : 1; +- +- /* Field `ranges_offset' is filled in; flag as the value may be zero. */ +- unsigned int has_ranges_offset : 1; + }; + + /* Persistent data held for a compilation unit, even when not +@@ -451,17 +447,12 @@ struct partial_die_info + /* DWARF-2 tag for this DIE. */ + ENUM_BITFIELD(dwarf_tag) tag : 16; + +- /* Language code associated with this DIE. This is only used +- for the compilation unit DIE. */ +- unsigned int language : 8; +- + /* Assorted flags describing the data found in this DIE. */ + unsigned int has_children : 1; + unsigned int is_external : 1; + unsigned int is_declaration : 1; + unsigned int has_type : 1; + unsigned int has_specification : 1; +- unsigned int has_stmt_list : 1; + unsigned int has_pc_info : 1; + + /* Flag set if the SCOPE field of this structure has been +@@ -472,10 +463,12 @@ struct partial_die_info + unsigned int has_byte_size : 1; + + /* The name of this DIE. Normally the value of DW_AT_name, but +- sometimes DW_TAG_MIPS_linkage_name or a string computed in some +- other fashion. */ ++ sometimes a default name for unnamed DIEs. */ + char *name; +- char *dirname; ++ ++ /* The linkage name of this DIE, from DW_AT_MIPS_linkage_name, or ++ NULL if no linkage name was present. */ ++ char *linkage_name; + + /* The scope to prepend to our children. This is generally + allocated on the comp_unit_obstack, so will disappear +@@ -498,9 +491,6 @@ struct partial_die_info + DW_AT_extension). */ + unsigned int spec_offset; + +- /* If HAS_STMT_LIST, the offset of the Line Number Information data. */ +- unsigned int line_offset; +- + /* Pointers to this DIE's parent, first child, and next sibling, + if any. */ + struct partial_die_info *die_parent, *die_child, *die_sibling; +@@ -523,6 +513,15 @@ struct attr_abbrev ENUM_BITFIELD(dwarf_form) form : 16; }; @@ -9741,7 +10778,16 @@ index 55868da..8a39bcf 100644 /* Attributes have a name and a value */ struct attribute { -@@ -768,6 +778,9 @@ static void scan_partial_symbols (struct partial_die_info *, +@@ -756,7 +755,7 @@ static void dwarf2_create_include_psymtab (char *, struct partial_symtab *, + struct objfile *); + + static void dwarf2_build_include_psymtabs (struct dwarf2_cu *, +- struct partial_die_info *, ++ struct die_info *, + struct partial_symtab *); + + static void dwarf2_build_psymtabs_hard (struct objfile *, int); +@@ -768,6 +767,9 @@ static void scan_partial_symbols (struct partial_die_info *, static void add_partial_symbol (struct partial_die_info *, struct dwarf2_cu *); @@ -9751,7 +10797,7 @@ index 55868da..8a39bcf 100644 static int pdi_needs_namespace (enum dwarf_tag tag); static void add_partial_namespace (struct partial_die_info *pdi, -@@ -794,6 +807,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); +@@ -794,6 +796,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); static void psymtab_to_symtab_1 (struct partial_symtab *); @@ -9762,7 +10808,26 @@ index 55868da..8a39bcf 100644 gdb_byte *dwarf2_read_section (struct objfile *, asection *); static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); -@@ -993,6 +1010,9 @@ static void process_die (struct die_info *, struct dwarf2_cu *); +@@ -929,7 +935,8 @@ static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *, + struct dwarf2_cu *, struct partial_symtab *); + + static int dwarf2_get_pc_bounds (struct die_info *, +- CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *); ++ CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *, ++ struct partial_symtab *pst); + + static void get_scope_pc_bounds (struct die_info *, + CORE_ADDR *, CORE_ADDR *, +@@ -962,6 +969,8 @@ static void read_namespace (struct die_info *die, struct dwarf2_cu *); + + static void read_module (struct die_info *die, struct dwarf2_cu *cu); + ++static void read_import_statement (struct die_info *die, struct dwarf2_cu *); ++ + static const char *namespace_name (struct die_info *die, + int *is_anonymous, struct dwarf2_cu *); + +@@ -993,6 +1002,9 @@ static void process_die (struct die_info *, struct dwarf2_cu *); static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); @@ -9772,7 +10837,7 @@ index 55868da..8a39bcf 100644 static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *); static struct die_info *dwarf2_extension (struct die_info *die, -@@ -1030,7 +1050,14 @@ static void store_in_ref_table (struct die_info *, +@@ -1030,7 +1042,14 @@ static void store_in_ref_table (struct die_info *, static unsigned int dwarf2_get_ref_die_offset (struct attribute *); @@ -9788,7 +10853,7 @@ index 55868da..8a39bcf 100644 static struct die_info *follow_die_ref (struct die_info *, struct attribute *, -@@ -1085,6 +1112,9 @@ static void age_cached_comp_units (void); +@@ -1085,6 +1104,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -9798,7 +10863,7 @@ index 55868da..8a39bcf 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1104,19 +1134,28 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); +@@ -1104,19 +1126,28 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -9832,7 +10897,7 @@ index 55868da..8a39bcf 100644 dwarf_info_section = 0; dwarf_abbrev_section = 0; -@@ -1127,8 +1166,9 @@ dwarf2_has_info (struct objfile *objfile) +@@ -1127,8 +1158,9 @@ dwarf2_has_info (struct objfile *objfile) dwarf_eh_frame_section = 0; dwarf_ranges_section = 0; dwarf_loc_section = 0; @@ -9843,7 +10908,7 @@ index 55868da..8a39bcf 100644 return (dwarf_info_section != NULL && dwarf_abbrev_section != NULL); } -@@ -1149,51 +1189,61 @@ section_is_p (asection *sectp, const char *name) +@@ -1149,51 +1181,61 @@ section_is_p (asection *sectp, const char *name) in. */ static void @@ -9915,7 +10980,7 @@ index 55868da..8a39bcf 100644 dwarf_frame_section = sectp; } else if (section_is_p (sectp, EH_FRAME_SECTION)) -@@ -1201,13 +1251,15 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) +@@ -1201,13 +1243,15 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) flagword aflag = bfd_get_section_flags (ignore_abfd, sectp); if (aflag & SEC_HAS_CONTENTS) { @@ -9933,7 +10998,7 @@ index 55868da..8a39bcf 100644 dwarf_ranges_section = sectp; } -@@ -1250,6 +1302,86 @@ dwarf2_resize_section (asection *sectp, bfd_size_type new_size) +@@ -1250,6 +1294,86 @@ dwarf2_resize_section (asection *sectp, bfd_size_type new_size) sectp->name); } @@ -10020,7 +11085,423 @@ index 55868da..8a39bcf 100644 /* Build a partial symbol table. */ void -@@ -2849,6 +2981,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) +@@ -1453,22 +1577,24 @@ dwarf2_create_include_psymtab (char *name, struct partial_symtab *pst, + + /* Read the Line Number Program data and extract the list of files + included by the source file represented by PST. Build an include +- partial symtab for each of these included files. +- +- This procedure assumes that there *is* a Line Number Program in +- the given CU. Callers should check that PDI->HAS_STMT_LIST is set +- before calling this procedure. */ ++ partial symtab for each of these included files. */ + + static void + dwarf2_build_include_psymtabs (struct dwarf2_cu *cu, +- struct partial_die_info *pdi, ++ struct die_info *die, + struct partial_symtab *pst) + { + struct objfile *objfile = cu->objfile; + bfd *abfd = objfile->obfd; +- struct line_header *lh; ++ struct line_header *lh = NULL; ++ struct attribute *attr; + +- lh = dwarf_decode_line_header (pdi->line_offset, abfd, cu); ++ attr = dwarf2_attr (die, DW_AT_stmt_list, cu); ++ if (attr) ++ { ++ unsigned int line_offset = DW_UNSND (attr); ++ lh = dwarf_decode_line_header (line_offset, abfd, cu); ++ } + if (lh == NULL) + return; /* No linetable, so no includes. */ + +@@ -1477,6 +1603,36 @@ dwarf2_build_include_psymtabs (struct dwarf2_cu *cu, + free_line_header (lh); + } + ++/* Find the base address of the compilation unit for range lists and ++ location lists. It will normally be specified by DW_AT_low_pc. ++ In DWARF-3 draft 4, the base address could be overridden by ++ DW_AT_entry_pc. It's been removed, but GCC still uses this for ++ compilation units with discontinuous ranges. */ ++ ++static void ++dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ struct attribute *attr; ++ ++ cu->base_known = 0; ++ cu->base_address = 0; ++ ++ attr = dwarf2_attr (die, DW_AT_entry_pc, cu); ++ if (attr) ++ { ++ cu->base_address = DW_ADDR (attr); ++ cu->base_known = 1; ++ } ++ else ++ { ++ attr = dwarf2_attr (die, DW_AT_low_pc, cu); ++ if (attr) ++ { ++ cu->base_address = DW_ADDR (attr); ++ cu->base_known = 1; ++ } ++ } ++} + + /* Build the partial symbol table by doing a quick pass through the + .debug_info and .debug_abbrev sections. */ +@@ -1489,7 +1645,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + bfd *abfd = objfile->obfd; + gdb_byte *info_ptr; + gdb_byte *beg_of_comp_unit; +- struct partial_die_info comp_unit_die; ++ struct die_info *comp_unit_die; + struct partial_symtab *pst; + struct cleanup *back_to; + CORE_ADDR baseaddr; +@@ -1523,9 +1679,12 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + { + struct cleanup *back_to_inner; + struct dwarf2_cu cu; +- struct abbrev_info *abbrev; + unsigned int bytes_read; + struct dwarf2_per_cu_data *this_cu; ++ int has_children, has_pc_info; ++ struct attribute *attr; ++ const char *name; ++ CORE_ADDR best_lowpc, best_highpc; + + beg_of_comp_unit = info_ptr; + +@@ -1551,11 +1710,10 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + this_cu = dwarf2_find_comp_unit (cu.header.offset, objfile); + + /* Read the compilation unit die */ +- abbrev = peek_die_abbrev (info_ptr, &bytes_read, &cu); +- info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read, +- abfd, info_ptr, &cu); ++ info_ptr = read_full_die (&comp_unit_die, abfd, info_ptr, &cu, ++ &has_children); + +- if (comp_unit_die.tag == DW_TAG_partial_unit) ++ if (comp_unit_die->tag == DW_TAG_partial_unit) + { + info_ptr = (beg_of_comp_unit + cu.header.length + + cu.header.initial_length_size); +@@ -1564,20 +1722,27 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + } + + /* Set the language we're debugging */ +- set_cu_language (comp_unit_die.language, &cu); ++ attr = dwarf2_attr (comp_unit_die, DW_AT_language, &cu); ++ if (attr != NULL) ++ set_cu_language (DW_UNSND (attr), &cu); ++ else ++ set_cu_language (language_minimal, &cu); + + /* Allocate a new partial symbol table structure */ +- pst = start_psymtab_common (objfile, objfile->section_offsets, +- comp_unit_die.name ? comp_unit_die.name : "", ++ attr = dwarf2_attr (comp_unit_die, DW_AT_name, &cu); ++ if (attr != NULL) ++ name = DW_STRING (attr); ++ else ++ name = ""; ++ pst = start_psymtab_common (objfile, objfile->section_offsets, name, + /* TEXTLOW and TEXTHIGH are set below. */ + 0, + objfile->global_psymbols.next, + objfile->static_psymbols.next); + +- if (comp_unit_die.dirname) +- pst->dirname = obsavestring (comp_unit_die.dirname, +- strlen (comp_unit_die.dirname), +- &objfile->objfile_obstack); ++ attr = dwarf2_attr (comp_unit_die, DW_AT_comp_dir, &cu); ++ if (attr != NULL) ++ pst->dirname = xstrdup (DW_STRING (attr)); + + pst->read_symtab_private = (char *) this_cu; + +@@ -1607,24 +1772,17 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + + /* Possibly set the default values of LOWPC and HIGHPC from + `DW_AT_ranges'. */ +- if (cu.has_ranges_offset) +- { +- if (dwarf2_ranges_read (cu.ranges_offset, &comp_unit_die.lowpc, +- &comp_unit_die.highpc, &cu, pst)) +- comp_unit_die.has_pc_info = 1; +- } +- else if (comp_unit_die.has_pc_info +- && comp_unit_die.lowpc < comp_unit_die.highpc) +- /* Store the contiguous range if it is not empty; it can be empty for +- CUs with no code. */ +- addrmap_set_empty (objfile->psymtabs_addrmap, +- comp_unit_die.lowpc + baseaddr, +- comp_unit_die.highpc + baseaddr - 1, pst); ++ has_pc_info = 0; ++ ++ if (dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc, &best_highpc, &cu, ++ pst)) ++ has_pc_info = 1; ++ dwarf2_find_base_address (comp_unit_die, &cu); + + /* Check if comp unit has_children. + If so, read the rest of the partial symbols from this comp unit. + If not, there's no more debug_info for this comp unit. */ +- if (comp_unit_die.has_children) ++ if (has_children) + { + struct partial_die_info *first_die; + CORE_ADDR lowpc, highpc; +@@ -1634,8 +1792,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + + first_die = load_partial_dies (abfd, info_ptr, 1, &cu); + +- scan_partial_symbols (first_die, &lowpc, &highpc, +- ! comp_unit_die.has_pc_info, &cu); ++ scan_partial_symbols (first_die, &lowpc, &highpc, ! has_pc_info, &cu); + + /* If we didn't find a lowpc, set it to highpc to avoid + complaints from `maint check'. */ +@@ -1644,14 +1801,14 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + + /* If the compilation unit didn't have an explicit address range, + then use the information extracted from its child dies. */ +- if (! comp_unit_die.has_pc_info) ++ if (! has_pc_info) + { +- comp_unit_die.lowpc = lowpc; +- comp_unit_die.highpc = highpc; ++ best_lowpc = lowpc; ++ best_highpc = highpc; + } + } +- pst->textlow = comp_unit_die.lowpc + baseaddr; +- pst->texthigh = comp_unit_die.highpc + baseaddr; ++ pst->textlow = best_lowpc + baseaddr; ++ pst->texthigh = best_highpc + baseaddr; + + pst->n_global_syms = objfile->global_psymbols.next - + (objfile->global_psymbols.list + pst->globals_offset); +@@ -1667,12 +1824,9 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline) + info_ptr = beg_of_comp_unit + cu.header.length + + cu.header.initial_length_size; + +- if (comp_unit_die.has_stmt_list) +- { +- /* Get the list of files included in the current compilation unit, +- and build a psymtab for each of them. */ +- dwarf2_build_include_psymtabs (&cu, &comp_unit_die, pst); +- } ++ /* Get the list of files included in the current compilation unit, ++ and build a psymtab for each of them. */ ++ dwarf2_build_include_psymtabs (&cu, comp_unit_die, pst); + + do_cleanups (back_to_inner); + } +@@ -1690,11 +1844,12 @@ load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) + { + bfd *abfd = objfile->obfd; + gdb_byte *info_ptr, *beg_of_comp_unit; +- struct partial_die_info comp_unit_die; ++ struct die_info *comp_unit_die; + struct dwarf2_cu *cu; +- struct abbrev_info *abbrev; + unsigned int bytes_read; + struct cleanup *back_to; ++ struct attribute *attr; ++ int has_children; + + info_ptr = dwarf2_per_objfile->info_buffer + this_cu->offset; + beg_of_comp_unit = info_ptr; +@@ -1716,12 +1871,15 @@ load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) + back_to = make_cleanup (dwarf2_free_abbrev_table, cu); + + /* Read the compilation unit die. */ +- abbrev = peek_die_abbrev (info_ptr, &bytes_read, cu); +- info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read, +- abfd, info_ptr, cu); ++ info_ptr = read_full_die (&comp_unit_die, abfd, info_ptr, cu, ++ &has_children); + + /* Set the language we're debugging. */ +- set_cu_language (comp_unit_die.language, cu); ++ attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu); ++ if (attr) ++ set_cu_language (DW_UNSND (attr), cu); ++ else ++ set_cu_language (language_minimal, cu); + + /* Link this compilation unit into the compilation unit tree. */ + this_cu->cu = cu; +@@ -1731,7 +1889,7 @@ load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile) + /* Check if comp unit has_children. + If so, read the rest of the partial symbols from this comp unit. + If not, there's no more debug_info for this comp unit. */ +- if (comp_unit_die.has_children) ++ if (has_children) + load_partial_dies (abfd, info_ptr, 0, cu); + + do_cleanups (back_to); +@@ -1948,7 +2106,7 @@ partial_die_parent_scope (struct partial_die_info *pdi, + ignoring them. */ + complaint (&symfile_complaints, + _("unhandled containing DIE tag %d for DIE at %d"), +- parent->tag, pdi->offset); ++ parent->tag, real_pdi->offset); + parent->scope = grandparent_scope; + } + +@@ -1963,12 +2121,37 @@ partial_die_full_name (struct partial_die_info *pdi, + struct dwarf2_cu *cu) + { + char *parent_scope; ++ struct partial_die_info *real_pdi; + +- parent_scope = partial_die_parent_scope (pdi, cu); +- if (parent_scope == NULL) +- return NULL; +- else ++ /* We need to look at our parent DIE; if we have a DW_AT_specification, ++ then this means the parent of the specification DIE. ++ partial_die_parent_scope does this loop also, but we do it here ++ since we need to examine real_pdi->parent ourselves. */ ++ ++ real_pdi = pdi; ++ while (real_pdi->has_specification) ++ real_pdi = find_partial_die (real_pdi->spec_offset, cu); ++ ++ parent_scope = partial_die_parent_scope (real_pdi, cu); ++ if (parent_scope != NULL) + return typename_concat (NULL, parent_scope, pdi->name, cu); ++ ++ if (!cu->has_namespace_info && pdi->linkage_name ++ && !real_pdi->die_parent) ++ { ++ char *actual_scope ++ = language_class_name_from_physname (cu->language_defn, ++ pdi->linkage_name); ++ if (actual_scope != NULL) ++ { ++ char *actual_name = typename_concat (NULL, actual_scope, ++ pdi->name, cu); ++ xfree (actual_scope); ++ return actual_name; ++ } ++ } ++ ++ return NULL; + } + + static void +@@ -1984,7 +2167,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); + +- if (pdi_needs_namespace (pdi->tag)) ++ if (pdi->linkage_name != NULL) ++ actual_name = pdi->linkage_name; ++ else if (pdi_needs_namespace (pdi->tag)) + { + actual_name = partial_die_full_name (pdi, cu); + if (actual_name) +@@ -2133,9 +2318,8 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) + if (cu->language == language_cplus + && cu->has_namespace_info == 0 + && psym != NULL +- && SYMBOL_CPLUS_DEMANGLED_NAME (psym) != NULL) +- cp_check_possible_namespace_symbols (SYMBOL_CPLUS_DEMANGLED_NAME (psym), +- objfile); ++ && pdi->linkage_name != NULL) ++ cp_check_possible_namespace_symbols (actual_name, objfile); + + if (built_actual_name) + xfree (actual_name); +@@ -2158,6 +2342,14 @@ 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_variable: ++ return 1; ++ case DW_TAG_member: ++ /* The only time we will encounter member variables in this ++ function is when we are creating a "linkage" name for them; ++ therefore they must be static members, so they do need a ++ class prefix. */ + return 1; + default: + return 0; +@@ -2290,11 +2482,11 @@ guess_structure_name (struct partial_die_info *struct_pdi, + + while (child_pdi != NULL) + { +- if (child_pdi->tag == DW_TAG_subprogram) ++ if (child_pdi->tag == DW_TAG_subprogram && child_pdi->linkage_name) + { + char *actual_class_name + = language_class_name_from_physname (cu->language_defn, +- child_pdi->name); ++ child_pdi->linkage_name); + if (actual_class_name != NULL) + { + struct_pdi->name +@@ -2741,7 +2933,6 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) + CORE_ADDR lowpc, highpc; + struct symtab *symtab; + struct cleanup *back_to; +- struct attribute *attr; + CORE_ADDR baseaddr; + + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +@@ -2751,30 +2942,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) + + cu->list_in_scope = &file_symbols; + +- /* Find the base address of the compilation unit for range lists and +- location lists. It will normally be specified by DW_AT_low_pc. +- In DWARF-3 draft 4, the base address could be overridden by +- DW_AT_entry_pc. It's been removed, but GCC still uses this for +- compilation units with discontinuous ranges. */ +- +- cu->base_known = 0; +- cu->base_address = 0; +- +- attr = dwarf2_attr (cu->dies, DW_AT_entry_pc, cu); +- if (attr) +- { +- cu->base_address = DW_ADDR (attr); +- cu->base_known = 1; +- } +- else +- { +- attr = dwarf2_attr (cu->dies, DW_AT_low_pc, cu); +- if (attr) +- { +- cu->base_address = DW_ADDR (attr); +- cu->base_known = 1; +- } +- } ++ dwarf2_find_base_address (cu->dies, cu); + + /* Do line number decoding in read_file_scope () */ + process_die (cu->dies, cu); +@@ -2805,6 +2973,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) + static void + process_die (struct die_info *die, struct dwarf2_cu *cu) + { ++ + switch (die->tag) + { + case DW_TAG_padding: +@@ -2849,6 +3018,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) case DW_TAG_base_type: case DW_TAG_subrange_type: @@ -10028,7 +11509,166 @@ index 55868da..8a39bcf 100644 /* Add a typedef symbol for the type definition, if it has a DW_AT_name. */ new_symbol (die, read_type_die (die, cu), cu); -@@ -3076,6 +3209,15 @@ add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc, +@@ -2867,14 +3037,12 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) + break; + case DW_TAG_imported_declaration: + case DW_TAG_imported_module: +- /* FIXME: carlton/2002-10-16: Eventually, we should use the +- information contained in these. DW_TAG_imported_declaration +- dies shouldn't have children; DW_TAG_imported_module dies +- shouldn't in the C++ case, but conceivably could in the +- Fortran case. */ + processing_has_namespace_info = 1; +- complaint (&symfile_complaints, _("unsupported tag: '%s'"), +- dwarf_tag_name (die->tag)); ++ if (die->child != NULL && (die->tag == DW_TAG_imported_declaration ++ || cu->language != language_fortran)) ++ complaint (&symfile_complaints, _("Tag '%s' has unexpected children"), ++ dwarf_tag_name (die->tag)); ++ read_import_statement (die, cu); + break; + default: + new_symbol (die, NULL, cu); +@@ -2904,22 +3072,130 @@ dwarf2_full_name (struct die_info *die, struct dwarf2_cu *cu) + 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) ++ unqualified name. */ ++ if (!pdi_needs_namespace (die->tag)) + return name; + + prefix = determine_prefix (die, cu); + if (*prefix != '\0') +- name = typename_concat (&cu->objfile->objfile_obstack, prefix, +- name, cu); ++ { ++ char *prefixed_name = typename_concat (NULL, prefix, name, cu); ++ buf = mem_fileopen (); ++ fputs_unfiltered (prefixed_name, buf); ++ xfree (prefixed_name); ++ } ++ ++ if (cu->language == language_cplus && die->tag == DW_TAG_subprogram) ++ { ++ struct type *type = read_type_die (die, cu); ++ ++ if (buf == NULL) ++ { ++ buf = mem_fileopen (); ++ fputs_unfiltered (name, buf); ++ } ++ ++ c_type_print_args (type, buf, 0); ++ } ++ ++ if (buf != NULL) ++ { ++ long length; ++ name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, ++ &length); ++ ui_file_delete (buf); ++ } + + return name; + } + ++/* read the given die's decl_line number. Return -1 if in case of an error */ ++static const int dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu){ ++ struct attribute *line_attr; ++ ++ line_attr = dwarf2_attr (die, DW_AT_decl_line, cu); ++ if (line_attr){ ++ return DW_UNSND (line_attr); ++ } ++ ++ return -1; ++} ++ ++/* Read the import statement specified by the given die and record it. */ ++ ++static void ++read_import_statement (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ struct attribute *import_attr; ++ struct die_info *imported_die; ++ const char *imported_name; ++ const char *imported_name_prefix; ++ char *canonical_name; ++ const char *import_alias; ++ const char *imported_declaration = ""; ++ const char *import_prefix; ++ ++ int line_number = -1; ++ ++ int is_anonymous = 0; ++ ++ import_attr = dwarf2_attr (die, DW_AT_import, cu); ++ if (import_attr == NULL) ++ { ++ complaint (&symfile_complaints, _("Tag '%s' has no DW_AT_import"), ++ dwarf_tag_name (die->tag)); ++ return; ++ } ++ ++ imported_die = follow_die_ref (die, import_attr, &cu); ++ imported_name = namespace_name (imported_die, &is_anonymous, cu); ++ if (imported_name == NULL) ++ { ++ /* C++ imports from std:: DW_TAG_base_type with no DW_AT_name - why? */ ++ return; ++ } ++ ++ /* Figure out the local name after import. */ ++ import_alias = dwarf2_name(die, cu); ++ if(import_alias == NULL){ ++ import_alias = ""; ++ } ++ ++ /* Determine the line number at which the import was made */ ++ line_number = dwarf2_read_decl_line(die, cu); ++ ++ /* Figure out where the statement is being imported to */ ++ import_prefix = determine_prefix (die, cu); ++ ++ /* ++ 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, cu); ++ ++ 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); ++ strcpy (canonical_name, imported_name_prefix); ++ strcat (canonical_name, "::"); ++ strcat (canonical_name, imported_name); ++ }else{ ++ canonical_name = alloca (strlen (imported_name) + 1); ++ strcpy (canonical_name, imported_name); ++ } ++ } ++ ++ using_directives = cp_add_using (import_prefix, ++ canonical_name, ++ import_alias, ++ imported_declaration, ++ line_number, ++ using_directives); ++} ++ + static void + initialize_cu_func_list (struct dwarf2_cu *cu) + { +@@ -3076,6 +3352,103 @@ add_to_cu_func_list (const char *name, CORE_ADDR lowpc, CORE_ADDR highpc, cu->last_fn = thisfn; } @@ -10040,19 +11680,130 @@ index 55868da..8a39bcf 100644 + + return (a > b) - (b > a); +} ++ ++static void explore_abstract_origin(struct die_info *die, struct dwarf2_cu *cu, unsigned* die_children_p){ ++ struct attribute *attr; ++ unsigned die_children = *die_children_p; ++ struct die_info *child_die; ++ ++ attr = dwarf2_attr (die, DW_AT_abstract_origin, cu); ++ ++ /* GCC currently uses DW_AT_specification to indicate die inheritence ++ in the case of import statements. The following is to accommodate that */ ++ if(!attr){ ++ attr = dwarf2_attr (die, DW_AT_specification, cu); ++ } ++ ++ if (attr) ++ { ++ /* For the list of CHILD_DIEs. */ ++ unsigned *offsets; ++ unsigned *offsets_end, *offsetp; ++ struct die_info *origin_die, *origin_child_die; ++ struct cleanup *cleanups; ++ ++ origin_die = follow_die_ref (die, attr, &cu); ++ if (die->tag != origin_die->tag) ++ complaint (&symfile_complaints, ++ _("DIE 0x%x and its abstract origin 0x%x have different " ++ "tags"), ++ die->offset, origin_die->offset); ++ ++ offsets = xmalloc (sizeof (*offsets) * die_children); ++ cleanups = make_cleanup (xfree, offsets); ++ ++ offsets_end = offsets; ++ child_die = die->child; ++ while (child_die && child_die->tag) ++ { ++ attr = dwarf2_attr (child_die, DW_AT_abstract_origin, cu); ++ if (!attr) ++ complaint (&symfile_complaints, ++ _("Child DIE 0x%x of DIE 0x%x has missing " ++ "DW_AT_abstract_origin"), ++ child_die->offset, die->offset); ++ else ++ { ++ struct die_info *child_origin_die; ++ ++ child_origin_die = follow_die_ref (child_die, attr, &cu); ++ if (child_die->tag != child_origin_die->tag) ++ complaint (&symfile_complaints, ++ _("Child DIE 0x%x and its abstract origin 0x%x have " ++ "different tags"), ++ child_die->offset, child_origin_die->offset); ++ *offsets_end++ = child_origin_die->offset; ++ } ++ child_die = sibling_die (child_die); ++ } ++ qsort (offsets, offsets_end - offsets, sizeof (*offsets), ++ unsigned_int_compar); ++ /* Disabled as excessively expensive - check if we may ever complain. */ ++ if (0) ++ { ++ for (offsetp = offsets + 1; offsetp < offsets_end; offsetp++) ++ if (offsetp[-1] == *offsetp) ++ complaint (&symfile_complaints, ++ _("Child DIEs of DIE 0x%x duplicitly abstract-origin " ++ "referenced DIE 0x%x"), ++ die->offset, *offsetp); ++ } ++ ++ offsetp = offsets; ++ origin_child_die = origin_die->child; ++ while (origin_child_die && origin_child_die->tag) ++ { ++ /* Is origin_child_die referenced by any of the DIE children? */ ++ while (offsetp < offsets_end && *offsetp < origin_child_die->offset) ++ offsetp++; ++ if (offsetp >= offsets_end || *offsetp > origin_child_die->offset) ++ { ++ /* Found that origin_child_die is really not referenced. */ ++ process_die (origin_child_die, cu); ++ } ++ origin_child_die = sibling_die (origin_child_die); ++ } ++ ++ do_cleanups (cleanups); ++ } ++ ++} + static void read_func_scope (struct die_info *die, struct dwarf2_cu *cu) { -@@ -3088,6 +3230,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3088,16 +3461,27 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) char *name; CORE_ADDR baseaddr; struct block *block; -+ unsigned die_children; ++ unsigned die_children = 0; baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -@@ -3124,14 +3267,87 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +- name = dwarf2_linkage_name (die, cu); ++ name = dwarf2_name (die, cu); + + /* Ignore functions with missing or empty names and functions with + missing or invalid low and high pc attributes. */ +- if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) ++ if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)){ ++ /* explore abstract origins if present. They might contain useful information ++ such as import statements. */ ++ child_die = die->child; ++ while (child_die && child_die->tag) ++ { ++ child_die = sibling_die (child_die); ++ die_children++; ++ } ++ explore_abstract_origin(die, cu, &die_children); + return; +- ++ } ++ + lowpc += baseaddr; + highpc += baseaddr; + +@@ -3124,16 +3508,91 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) cu->list_in_scope = &local_symbols; @@ -10060,7 +11811,7 @@ index 55868da..8a39bcf 100644 + child_die = die->child; + die_children = 0; + while (child_die && child_die->tag) - { ++ { + process_die (child_die, cu); + child_die = sibling_die (child_die); + die_children++; @@ -10068,7 +11819,7 @@ index 55868da..8a39bcf 100644 + + attr = dwarf2_attr (die, DW_AT_abstract_origin, cu); + if (attr) -+ { + { + /* For the list of CHILD_DIEs. */ + unsigned *offsets; + unsigned *offsets_end, *offsetp; @@ -10141,8 +11892,106 @@ index 55868da..8a39bcf 100644 + do_cleanups (cleanups); } ++ explore_abstract_origin(die, cu, &die_children); ++ new = pop_context (); -@@ -3926,7 +4142,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, + /* Make a block for the local symbols within. */ + block = finish_block (new->name, &local_symbols, new->old_blocks, +@@ -3154,6 +3613,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) + back to building a containing block's symbol lists. */ + local_symbols = new->locals; + param_symbols = new->params; ++ using_directives = new->using_directives; + + /* If we've finished processing a top-level function, subsequent + symbols go in the file symbol list. */ +@@ -3180,7 +3640,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) + as multiple lexical blocks? Handling children in a sane way would + be nasty. Might be easier to properly extend generic blocks to + describe ranges. */ +- if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu)) ++ if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)) + return; + lowpc += baseaddr; + highpc += baseaddr; +@@ -3216,6 +3676,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) + dwarf2_record_block_ranges (die, block, baseaddr, cu); + } + local_symbols = new->locals; ++ using_directives = new->using_directives; + } + + /* Get low and high pc attributes from DW_AT_ranges attribute value OFFSET. +@@ -3351,7 +3812,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, + discontinuous, i.e. derived from DW_AT_ranges information. */ + static int + dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, +- CORE_ADDR *highpc, struct dwarf2_cu *cu) ++ CORE_ADDR *highpc, struct dwarf2_cu *cu, ++ struct partial_symtab *pst) + { + struct attribute *attr; + CORE_ADDR low = 0; +@@ -3379,7 +3841,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, + { + /* Value of the DW_AT_ranges attribute is the offset in the + .debug_ranges section. */ +- if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu, NULL)) ++ if (!dwarf2_ranges_read (DW_UNSND (attr), &low, &high, cu, pst)) + return 0; + /* Found discontinuous range of addresses. */ + ret = -1; +@@ -3418,7 +3880,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die, + CORE_ADDR low, high; + struct die_info *child = die->child; + +- if (dwarf2_get_pc_bounds (die, &low, &high, cu)) ++ if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)) + { + *lowpc = min (*lowpc, low); + *highpc = max (*highpc, high); +@@ -3455,7 +3917,7 @@ get_scope_pc_bounds (struct die_info *die, + CORE_ADDR best_high = (CORE_ADDR) 0; + CORE_ADDR current_low, current_high; + +- if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu)) ++ if (dwarf2_get_pc_bounds (die, ¤t_low, ¤t_high, cu, NULL)) + { + best_low = current_low; + best_high = current_high; +@@ -3750,8 +4212,14 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, + if (fieldname == NULL) + return; + +- /* Get physical name. */ ++ /* Get physical name. We prefer the linkage name if one was specified, ++ because this lets GDB find a non-debugging version of the symbol. ++ Otherwise construct the full name from type information. Ideally, ++ when GDB supports canonicalization of C++ symbol names, we will not ++ need the linkage name for anything. */ + physname = dwarf2_linkage_name (die, cu); ++ if (physname == NULL) ++ physname = (char *) dwarf2_full_name (die, cu); + + /* The name is already allocated along with this objfile, so we don't + need to duplicate it for the type. */ +@@ -3881,8 +4349,14 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, + if (fieldname == NULL) + return; + +- /* Get the mangled name. */ ++ /* Get physical name. We prefer the linkage name if one was specified, ++ because this lets GDB find a non-debugging version of the symbol. ++ Otherwise construct the full name from type information. Ideally, ++ when GDB supports canonicalization of C++ symbol names, we will not ++ need the linkage name for anything. */ + physname = dwarf2_linkage_name (die, cu); ++ if (physname == NULL) ++ physname = (char *) dwarf2_full_name (die, cu); + + /* Look up member function name in fieldlist. */ + for (i = 0; i < fip->nfnfields; i++) +@@ -3926,7 +4400,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, /* The name is already allocated along with this objfile, so we don't need to duplicate it for the type. */ fnp->physname = physname ? physname : ""; @@ -10151,7 +12000,7 @@ index 55868da..8a39bcf 100644 this_type = read_type_die (die, cu); if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC) { -@@ -4110,7 +4326,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu) +@@ -4110,7 +4584,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu) return NULL; domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0)); @@ -10160,7 +12009,7 @@ index 55868da..8a39bcf 100644 smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type), TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type), TYPE_VARARGS (pfn_type)); -@@ -4147,7 +4363,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4147,7 +4621,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) if (type) return type; @@ -10169,7 +12018,7 @@ index 55868da..8a39bcf 100644 INIT_CPLUS_SPECIFIC (type); name = dwarf2_name (die, cu); if (name != NULL) -@@ -4360,7 +4576,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4360,7 +4834,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) struct attribute *attr; const char *name; @@ -10178,7 +12027,26 @@ index 55868da..8a39bcf 100644 TYPE_CODE (type) = TYPE_CODE_ENUM; name = dwarf2_full_name (die, cu); -@@ -4510,6 +4726,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -4410,10 +4884,15 @@ determine_class_name (struct die_info *die, struct dwarf2_cu *cu) + { + if (child->tag == DW_TAG_subprogram) + { +- char *phys_prefix ++ char *phys_prefix; ++ char *linkage_name = dwarf2_linkage_name (child, cu); ++ ++ if (linkage_name == NULL) ++ continue; ++ ++ phys_prefix + = language_class_name_from_physname (cu->language_defn, +- dwarf2_linkage_name +- (child, cu)); ++ linkage_name); + + if (phys_prefix != NULL) + { +@@ -4510,6 +4989,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -10208,7 +12076,7 @@ index 55868da..8a39bcf 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. */ -@@ -4523,7 +4762,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4523,7 +5025,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; @@ -10217,7 +12085,7 @@ index 55868da..8a39bcf 100644 struct cleanup *back_to; char *name; -@@ -4570,16 +4809,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4570,16 +5072,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) @@ -10239,7 +12107,7 @@ index 55868da..8a39bcf 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -4646,12 +4880,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4646,12 +5143,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) return set_die_type (die, set_type, cu); } @@ -10256,7 +12124,7 @@ index 55868da..8a39bcf 100644 struct attribute *attr; struct symbol *sym; CORE_ADDR base = (CORE_ADDR) 0; -@@ -4676,10 +4912,40 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) +@@ -4676,10 +5175,40 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) } if (die->child != NULL) { @@ -10297,7 +12165,7 @@ index 55868da..8a39bcf 100644 attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); if (attr) { -@@ -4687,8 +4953,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) +@@ -4687,8 +5216,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) base + decode_locdesc (DW_BLOCK (attr), cu); add_symbol_to_list (sym, &global_symbols); } @@ -10323,7 +12191,18 @@ index 55868da..8a39bcf 100644 } } -@@ -4951,29 +5234,95 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4756,9 +5302,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 (TYPE_NAME (type), +- strlen (previous_prefix), +- strlen (TYPE_NAME (type))); ++ cp_add_using_directive (previous_prefix, TYPE_NAME (type), "", "", dwarf2_read_decl_line(die, cu)); + } + } + +@@ -4951,29 +5495,95 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct objfile *objfile = cu->objfile; struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -10437,7 +12316,7 @@ index 55868da..8a39bcf 100644 type = create_string_type (NULL, range_type); return set_die_type (die, type, cu); -@@ -5067,7 +5416,6 @@ static struct type * +@@ -5067,7 +5677,6 @@ static struct type * read_typedef (struct die_info *die, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; @@ -10445,7 +12324,7 @@ index 55868da..8a39bcf 100644 const char *name = NULL; struct type *this_type; -@@ -5175,8 +5523,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5175,8 +5784,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -10456,7 +12335,7 @@ index 55868da..8a39bcf 100644 char *name; base_type = die_type (die, cu); -@@ -5189,42 +5537,90 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5189,42 +5798,90 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) 0, NULL, cu->objfile); } @@ -10577,7 +12456,7 @@ index 55868da..8a39bcf 100644 name = dwarf2_name (die, cu); if (name) -@@ -5386,10 +5782,13 @@ read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd, +@@ -5386,10 +6043,13 @@ read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd, } /* Decompress a section that was compressed using zlib. Store the @@ -10593,7 +12472,7 @@ index 55868da..8a39bcf 100644 gdb_byte **outbuf, bfd_size_type *outsize) { bfd *abfd = objfile->obfd; -@@ -5405,6 +5804,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -5405,6 +6065,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, z_stream strm; int rc; int header_size = 12; @@ -10601,7 +12480,7 @@ index 55868da..8a39bcf 100644 if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 || bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size) -@@ -5434,8 +5834,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -5434,8 +6095,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; @@ -10617,7 +12496,7 @@ index 55868da..8a39bcf 100644 rc = inflateInit (&strm); while (strm.avail_in > 0) { -@@ -5456,6 +5861,8 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -5456,6 +6122,8 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), bfd_get_filename (abfd), rc); @@ -10626,7 +12505,7 @@ index 55868da..8a39bcf 100644 xfree (compressed_buffer); *outbuf = uncompressed_buffer; *outsize = uncompressed_size; -@@ -5463,17 +5870,20 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -5463,17 +6131,20 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, } @@ -10652,7 +12531,7 @@ index 55868da..8a39bcf 100644 if (size == 0) return NULL; -@@ -5486,30 +5896,49 @@ dwarf2_read_section (struct objfile *objfile, asection *sectp) +@@ -5486,30 +6157,49 @@ dwarf2_read_section (struct objfile *objfile, asection *sectp) /* Upon decompression, update the buffer and its size. */ if (strncmp (header, "ZLIB", sizeof (header)) == 0) { @@ -10705,7 +12584,23 @@ index 55868da..8a39bcf 100644 /* In DWARF version 2, the description of the debugging information is stored in a separate .debug_abbrev section. Before we read any dies from a section we read in all abbreviations and install them -@@ -5945,10 +6374,23 @@ read_partial_die (struct partial_die_info *part_die, +@@ -5914,15 +6604,6 @@ read_partial_die (struct partial_die_info *part_die, + struct attribute attr; + int has_low_pc_attr = 0; + int has_high_pc_attr = 0; +- CORE_ADDR base_address = 0; +- enum +- { +- base_address_none, +- base_address_low_pc, +- /* Overrides BASE_ADDRESS_LOW_PC. */ +- base_address_entry_pc +- } +- base_address_type = base_address_none; + + memset (part_die, 0, sizeof (struct partial_die_info)); + +@@ -5945,47 +6626,35 @@ read_partial_die (struct partial_die_info *part_die, switch (attr.name) { case DW_AT_name: @@ -10713,6 +12608,10 @@ index 55868da..8a39bcf 100644 - /* Prefer DW_AT_MIPS_linkage_name over DW_AT_name. */ - if (part_die->name == NULL) - part_die->name = DW_STRING (&attr); +- break; +- case DW_AT_comp_dir: +- if (part_die->dirname == NULL) +- part_die->dirname = DW_STRING (&attr); + switch (part_die->tag) + { + case DW_TAG_compile_unit: @@ -10731,9 +12630,99 @@ index 55868da..8a39bcf 100644 + break; + } break; - case DW_AT_comp_dir: - if (part_die->dirname == NULL) -@@ -7512,10 +7954,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, + case DW_AT_MIPS_linkage_name: +- part_die->name = DW_STRING (&attr); ++ part_die->linkage_name = DW_STRING (&attr); + break; + case DW_AT_low_pc: + has_low_pc_attr = 1; + part_die->lowpc = DW_ADDR (&attr); +- if (part_die->tag == DW_TAG_compile_unit +- && base_address_type < base_address_low_pc) +- { +- base_address = DW_ADDR (&attr); +- base_address_type = base_address_low_pc; +- } + break; + case DW_AT_high_pc: + has_high_pc_attr = 1; + part_die->highpc = DW_ADDR (&attr); + break; +- case DW_AT_entry_pc: +- if (part_die->tag == DW_TAG_compile_unit +- && base_address_type < base_address_entry_pc) +- { +- base_address = DW_ADDR (&attr); +- base_address_type = base_address_entry_pc; +- } +- break; +- case DW_AT_ranges: +- if (part_die->tag == DW_TAG_compile_unit) +- { +- cu->ranges_offset = DW_UNSND (&attr); +- cu->has_ranges_offset = 1; +- } +- break; + case DW_AT_location: + /* Support the .debug_loc offsets */ + if (attr_form_is_block (&attr)) +@@ -6002,9 +6671,6 @@ read_partial_die (struct partial_die_info *part_die, + "partial symbol information"); + } + break; +- case DW_AT_language: +- part_die->language = DW_UNSND (&attr); +- break; + case DW_AT_external: + part_die->is_external = DW_UNSND (&attr); + break; +@@ -6029,10 +6695,6 @@ read_partial_die (struct partial_die_info *part_die, + part_die->sibling = dwarf2_per_objfile->info_buffer + + dwarf2_get_ref_die_offset (&attr); + break; +- case DW_AT_stmt_list: +- part_die->has_stmt_list = 1; +- part_die->line_offset = DW_UNSND (&attr); +- break; + case DW_AT_byte_size: + part_die->has_byte_size = 1; + break; +@@ -6074,13 +6736,6 @@ read_partial_die (struct partial_die_info *part_die, + || dwarf2_per_objfile->has_section_at_zero)) + part_die->has_pc_info = 1; + +- if (base_address_type != base_address_none && !cu->base_known) +- { +- gdb_assert (part_die->tag == DW_TAG_compile_unit); +- cu->base_known = 1; +- cu->base_address = base_address; +- } +- + return info_ptr; + } + +@@ -6173,7 +6828,9 @@ 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. */ + +- if (part_die->name == NULL && part_die->has_specification) ++ if (part_die->has_specification ++ && (part_die->name == NULL || part_die->linkage_name == NULL ++ || !part_die->is_external)) + { + struct partial_die_info *spec_die; + +@@ -6189,6 +6846,9 @@ fixup_partial_die (struct partial_die_info *part_die, + if (spec_die->is_external) + part_die->is_external = spec_die->is_external; + } ++ ++ if (spec_die->linkage_name) ++ part_die->linkage_name = spec_die->linkage_name; + } + + /* Set default names for some unnamed DIEs. */ +@@ -7512,10 +8172,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 @@ -10748,16 +12737,54 @@ index 55868da..8a39bcf 100644 } /* Given a pointer to a DWARF information entry, figure out if we need -@@ -7548,6 +7992,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -7538,20 +8200,43 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); + + if (die->tag != DW_TAG_namespace) +- name = dwarf2_linkage_name (die, cu); ++ name = dwarf2_name (die, cu); + else + name = TYPE_NAME (type); + + if (name) + { ++ const char *linkagename; ++ + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); + /* Some methods are called without checking SYMBOL_OPS validity. */ + SYMBOL_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; -@@ -7637,7 +8083,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +- SYMBOL_SET_NAMES (sym, name, strlen (name), objfile); ++ ++ /* Cache this symbol's name and the name's demangled form (if any). */ ++ ++ linkagename = dwarf2_linkage_name (die, cu); ++ if (linkagename) ++ /* We use the linkage name if available, for the same reason ++ we used it for TYPE_FN_FIELD_PHYSNAME earlier in this file. ++ This usage can be removed someday. */ ++ SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), objfile); ++ else if (die->tag == DW_TAG_namespace) ++ SYMBOL_SET_LINKAGE_NAME (sym, name); ++ else ++ { ++ linkagename = dwarf2_full_name (die, cu); ++ ++ /* Set just the "linkage" name to the fully qualified name. ++ While this is not really a linkage name, it should match ++ the demangled version of the corresponding minimal symbol ++ if there is one. */ ++ SYMBOL_SET_LINKAGE_NAME (sym, (char *) linkagename); ++ } + + /* Default assumptions. + Use the passed type or decode it from the die. */ +@@ -7637,7 +8322,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (attr) { var_decode_location (attr, sym, cu); @@ -10774,7 +12801,7 @@ index 55868da..8a39bcf 100644 if (attr2 && (DW_UNSND (attr2) != 0)) add_symbol_to_list (sym, &global_symbols); else -@@ -7780,6 +8234,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -7780,6 +8473,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; @@ -10786,20 +12813,39 @@ index 55868da..8a39bcf 100644 default: /* Not a tag we recognize. Hopefully we aren't processing trash data, but since we must specifically ignore things -@@ -8192,10 +8651,29 @@ dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) +@@ -8128,6 +8826,19 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) + members; no typedefs, no member functions, et cetera. + So it does not need a prefix. */ + return ""; ++ ++ case DW_TAG_subprogram: ++ /* A class's symbol, or a variable's symbol, will live ++ directly in a function's block, so no prefix is ++ appropriate. However, what about methods of a ++ function-local class? They end up in the global symbol ++ table because they are separate functions... their mangling ++ normally would make them inaccessible. They'll show up ++ wrong in breakpoints too. This is a symptom of the ++ inconsistent way we handle symbol tables. Namespaces and ++ classes should have dictionaries just like blocks do. */ ++ return ""; ++ + default: + return determine_prefix (parent, cu); + } +@@ -8192,23 +8903,62 @@ dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); if (attr && DW_STRING (attr)) return DW_STRING (attr); - attr = dwarf2_attr (die, DW_AT_name, cu); - if (attr && DW_STRING (attr)) - return DW_STRING (attr); -- return NULL; -+ return dwarf2_name (die, cu); -+} -+ -+/* Get name of a die, return NULL if not found. */ -+ -+static char * + return NULL; + } + + /* Get name of a die, return NULL if not found. */ + + static char * +dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu, + struct obstack *obstack) +{ @@ -10817,10 +12863,13 @@ index 55868da..8a39bcf 100644 + } + + return name; - } - - /* Get name of a die, return NULL if not found. */ -@@ -8206,9 +8684,29 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) ++} ++ ++/* Get name of a die, return NULL if not found. */ ++ ++static char * + dwarf2_name (struct die_info *die, struct dwarf2_cu *cu) + { struct attribute *attr; attr = dwarf2_attr (die, DW_AT_name, cu); @@ -10853,7 +12902,7 @@ index 55868da..8a39bcf 100644 } /* Return the die that this die in an extension of, or NULL if there -@@ -8703,6 +9201,8 @@ dwarf_form_name (unsigned form) +@@ -8703,6 +9453,8 @@ dwarf_form_name (unsigned form) return "DW_FORM_ref_udata"; case DW_FORM_indirect: return "DW_FORM_indirect"; @@ -10862,7 +12911,7 @@ index 55868da..8a39bcf 100644 default: return "DW_FORM_"; } -@@ -9248,6 +9748,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) +@@ -9248,6 +10000,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) break; case DW_FORM_string: case DW_FORM_strp: @@ -10870,7 +12919,7 @@ index 55868da..8a39bcf 100644 fprintf_unfiltered (f, "string: \"%s\"", DW_STRING (&die->attrs[i]) ? DW_STRING (&die->attrs[i]) : ""); -@@ -9353,26 +9854,35 @@ dwarf2_get_ref_die_offset (struct attribute *attr) +@@ -9353,26 +10106,35 @@ dwarf2_get_ref_die_offset (struct attribute *attr) return result; } @@ -10900,7 +12949,7 @@ index 55868da..8a39bcf 100644 - return default_value; + *val_return = DW_SND (attr); + return dwarf2_attr_const; -+ } + } + if (attr->form == DW_FORM_udata + || attr->form == DW_FORM_data1 + || attr->form == DW_FORM_data2 @@ -10909,7 +12958,7 @@ index 55868da..8a39bcf 100644 + { + *val_return = DW_UNSND (attr); + return dwarf2_attr_const; - } ++ } + if (attr->form == DW_FORM_block + || attr->form == DW_FORM_block1 + || attr->form == DW_FORM_block2 @@ -10921,7 +12970,7 @@ index 55868da..8a39bcf 100644 } /* THIS_CU has a reference to PER_CU. If necessary, load the new compilation -@@ -9963,6 +10473,17 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -9963,6 +10725,17 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, { gdb_byte *mac_ptr, *mac_end; struct macro_source_file *current_file = 0; @@ -10939,7 +12988,7 @@ index 55868da..8a39bcf 100644 if (dwarf2_per_objfile->macinfo_buffer == NULL) { -@@ -9970,19 +10491,24 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -9970,19 +10743,24 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, return; } @@ -10968,7 +13017,7 @@ index 55868da..8a39bcf 100644 } macinfo_type = read_1_byte (abfd, mac_ptr); -@@ -9993,7 +10519,81 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -9993,7 +10771,81 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, /* A zero macinfo type indicates the end of the macro information. */ case 0: @@ -11051,7 +13100,7 @@ index 55868da..8a39bcf 100644 case DW_MACINFO_define: case DW_MACINFO_undef: -@@ -10008,19 +10608,31 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -10008,19 +10860,31 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, mac_ptr += bytes_read; if (! current_file) @@ -11094,7 +13143,7 @@ index 55868da..8a39bcf 100644 } break; -@@ -10034,9 +10646,22 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -10034,9 +10898,22 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; @@ -11120,7 +13169,7 @@ index 55868da..8a39bcf 100644 } break; -@@ -10090,7 +10715,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -10090,7 +10967,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, } break; } @@ -11129,7 +13178,7 @@ index 55868da..8a39bcf 100644 } /* Check if the attribute's form is a DW_FORM_block* -@@ -10150,6 +10775,34 @@ attr_form_is_constant (struct attribute *attr) +@@ -10150,6 +11027,34 @@ attr_form_is_constant (struct attribute *attr) } } @@ -11164,7 +13213,7 @@ index 55868da..8a39bcf 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) -@@ -10179,35 +10832,24 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, +@@ -10179,35 +11084,24 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, SYMBOL_OPS (sym) = &dwarf2_loclist_funcs; SYMBOL_LOCATION_BATON (sym) = baton; } @@ -11214,7 +13263,7 @@ index 55868da..8a39bcf 100644 } } -@@ -10482,6 +11124,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -10482,6 +11376,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -11246,7 +13295,7 @@ index 55868da..8a39bcf 100644 /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. */ -@@ -10490,6 +11157,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -10490,6 +11409,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct dwarf2_offset_and_type **slot, ofs; @@ -11288,16 +13337,18 @@ index ff220a2..13158f4 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 1d35571..f3c9564 100644 +index 1d35571..b2a1931 100644 --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -39,10 +39,14 @@ +@@ -39,10 +39,16 @@ #include "exceptions.h" #include "regcache.h" #include "user-regs.h" +#include "python/python.h" #include "valprint.h" +#include "dwarf2loc.h" ++#include "gdb_obstack.h" ++#include "objfiles.h" #include "gdb_assert.h" @@ -11306,7 +13357,72 @@ index 1d35571..f3c9564 100644 /* This is defined in valops.c */ extern int overload_resolution; -@@ -671,6 +675,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -651,6 +657,64 @@ ptrmath_type_p (struct type *type) + } + } + ++/* Compares the two method/function types T1 and T2 for "equality" ++ with respect to the the methods' parameters. If the types of the ++ two parameter lists are the same, returns 1; 0 otherwise. This ++ comparison ignores any artificial this pointer. */ ++int ++compare_parameters (struct type *t1, struct type *t2) ++{ ++ int i, has_this; ++ /* Hacky: we don't know a priori whether or not t1 is a static ++ method, so we skip any artificial "this" pointer and hope ++ for the best. t2, which comes as user input, never contains a ++ "this" pointer (a user would never enter it into expressions. */ ++ if (TYPE_NFIELDS (t1) > 0) ++ has_this = TYPE_FIELD_ARTIFICIAL (t1, 0) ? 1 : 0; ++ else ++ has_this = 0; ++ ++ /* Special case: a method taking void. t1 will contain either ++ no fields or just "this". t2 will contain TYPE_CODE_VOID. */ ++ if ((TYPE_NFIELDS (t1) - has_this) == 0 && TYPE_NFIELDS (t2) == 1 ++ && TYPE_CODE (TYPE_FIELD_TYPE (t2, 0)) == TYPE_CODE_VOID) ++ return 1; ++ ++ if ((TYPE_NFIELDS (t1) - has_this) == TYPE_NFIELDS (t2)) ++ { ++ for (i = has_this; i < TYPE_NFIELDS (t1); ++i) ++ { ++ if (rank_one_type (TYPE_FIELD_TYPE (t1, i), ++ TYPE_FIELD_TYPE (t2, i - has_this)) ++ != 0) ++ return 0; ++ } ++ ++ return 1; ++ } ++ ++ return 0; ++} ++ ++/* Constructs a fake method with the given parameter types. */ ++ ++static struct type * ++make_params (int num_types, struct type **param_types) ++{ ++ struct type *type = alloc_type (NULL, NULL); ++ TYPE_LENGTH (type) = 1; ++ TYPE_CODE (type) = TYPE_CODE_METHOD; ++ TYPE_NFIELDS (type) = num_types; ++ TYPE_FIELDS (type) = (struct field *) ++ TYPE_ALLOC (type, sizeof (struct field) * num_types); ++ memset (TYPE_FIELDS (type), 0, sizeof (struct field) * num_types); ++ ++ while (num_types-- > 0) ++ TYPE_FIELD_TYPE (type, num_types) = param_types[num_types]; ++ ++ return type; ++} ++ + struct value * + evaluate_subexp_standard (struct type *expect_type, + struct expression *exp, int *pos, +@@ -671,6 +735,7 @@ evaluate_subexp_standard (struct type *expect_type, long mem_offset; struct type **arg_types; int save_pos1; @@ -11314,7 +13430,16 @@ index 1d35571..f3c9564 100644 pc = (*pos)++; op = exp->elts[pc].opcode; -@@ -1208,9 +1213,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -684,7 +749,7 @@ evaluate_subexp_standard (struct type *expect_type, + goto nosideret; + arg1 = value_aggregate_elt (exp->elts[pc + 1].type, + &exp->elts[pc + 3].string, +- 0, noside); ++ expect_type, 0, noside); + if (arg1 == NULL) + error (_("There is no field named %s"), &exp->elts[pc + 3].string); + return arg1; +@@ -1208,9 +1273,9 @@ evaluate_subexp_standard (struct type *expect_type, if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC) error (_("method address has symbol information with non-function type; skipping")); if (struct_return) @@ -11326,7 +13451,68 @@ index 1d35571..f3c9564 100644 called_method = method; } else -@@ -1434,7 +1439,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1284,7 +1349,6 @@ evaluate_subexp_standard (struct type *expect_type, + argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 3)); + if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR) + { +- nargs++; + /* First, evaluate the structure into arg2 */ + pc2 = (*pos)++; + +@@ -1308,21 +1372,40 @@ evaluate_subexp_standard (struct type *expect_type, + + arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); + +- if (TYPE_CODE (check_typedef (value_type (arg1))) +- != TYPE_CODE_METHODPTR) +- error (_("Non-pointer-to-member value used in pointer-to-member " +- "construct")); +- +- if (noside == EVAL_AVOID_SIDE_EFFECTS) ++ type = check_typedef (value_type (arg1)); ++ switch (TYPE_CODE (type)) + { +- struct type *method_type = check_typedef (value_type (arg1)); +- arg1 = value_zero (method_type, not_lval); ++ case TYPE_CODE_METHODPTR: ++ if (noside == EVAL_AVOID_SIDE_EFFECTS) ++ arg1 = value_zero (TYPE_TARGET_TYPE (type), not_lval); ++ else ++ arg1 = cplus_method_ptr_to_value (&arg2, arg1); ++ ++ /* Now, say which argument to start evaluating from */ ++ nargs++; ++ tem = 2; ++ argvec[1] = arg2; ++ break; ++ ++ case TYPE_CODE_MEMBERPTR: ++ /* Now, convert these values to an address. */ ++ arg2 = value_cast (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)), ++ arg2); ++ ++ mem_offset = value_as_long (arg1); ++ ++ arg1 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)), ++ value_as_long (arg2) + mem_offset); ++ arg1 = value_ind (arg1); ++ tem = 1; ++ break; ++ ++ default: ++ error (_("Non-pointer-to-member value used in pointer-to-member " ++ "construct")); + } +- else +- arg1 = cplus_method_ptr_to_value (&arg2, arg1); + +- /* Now, say which argument to start evaluating from */ +- tem = 2; ++ argvec[0] = arg1; + } + else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR) + { +@@ -1434,7 +1517,7 @@ evaluate_subexp_standard (struct type *expect_type, of the ``this'' pointer if necessary, so modify argvec[1] to reflect any ``this'' changes. */ arg2 = value_from_longest (lookup_pointer_type(value_type (temp)), @@ -11335,7 +13521,17 @@ index 1d35571..f3c9564 100644 + value_embedded_offset (temp)); argvec[1] = arg2; /* the ``this'' pointer */ } -@@ -1512,6 +1517,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1448,8 +1531,7 @@ evaluate_subexp_standard (struct type *expect_type, + } + else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR) + { +- argvec[1] = arg2; +- argvec[0] = arg1; ++ /* Pointer to member. argvec is already set up. */ + } + else if (op == OP_VAR_VALUE) + { +@@ -1512,6 +1594,9 @@ evaluate_subexp_standard (struct type *expect_type, else error (_("Expression of type other than \"Function returning ...\" used as function")); } @@ -11345,7 +13541,7 @@ index 1d35571..f3c9564 100644 return call_function_by_hand (argvec[0], nargs, argvec + 1); /* pai: FIXME save value from call_function_by_hand, then adjust pc by adjust_fn_pc if +ve */ -@@ -1529,7 +1537,10 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1529,7 +1614,10 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -11356,7 +13552,45 @@ index 1d35571..f3c9564 100644 code = TYPE_CODE (type); if (code == TYPE_CODE_PTR) -@@ -1963,13 +1974,19 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1696,6 +1784,37 @@ evaluate_subexp_standard (struct type *expect_type, + error (_("non-pointer-to-member value used in pointer-to-member construct")); + } + ++ case TYPE_INSTANCE: ++ nargs = longest_to_int (exp->elts[pc + 1].longconst); ++ arg_types = (struct type **) alloca (nargs * sizeof (struct type *)); ++ for (ix = 0; ix < nargs; ++ix) ++ arg_types[ix] = exp->elts[pc + 1 + ix + 1].type; ++ ++ expect_type = make_params (nargs, arg_types); ++ *(pos) += 3 + nargs; ++ return evaluate_subexp_standard (expect_type, exp, pos, noside); ++ ++ case TYPE_INSTANCE_LOOKUP: ++ { ++ int i; ++ 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) ++ arg_types[i] = TYPE_FIELD_TYPE (expect_type, i); ++ (void) find_overload_match (arg_types, TYPE_NFIELDS (expect_type), ++ NULL /* no need for name */, ++ 0 /* not method */, ++ 0 /* strict match */, ++ NULL, exp->elts[pc + 1].symbol, NULL, ++ &sym, NULL); ++ i = 0; ++ } ++ break; ++ + case BINOP_CONCAT: + arg1 = evaluate_subexp_with_coercion (exp, pos, noside); + arg2 = evaluate_subexp_with_coercion (exp, pos, noside); +@@ -1963,13 +2082,19 @@ evaluate_subexp_standard (struct type *expect_type, { int subscript_array[MAX_FORTRAN_DIMS]; int array_size_array[MAX_FORTRAN_DIMS]; @@ -11376,7 +13610,7 @@ index 1d35571..f3c9564 100644 tmp_type = check_typedef (value_type (arg1)); ndimensions = calc_f77_array_dims (type); -@@ -1999,6 +2016,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1999,6 +2124,9 @@ evaluate_subexp_standard (struct type *expect_type, upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -11386,7 +13620,7 @@ index 1d35571..f3c9564 100644 array_size_array[nargs - i - 1] = upper - lower + 1; /* Zero-normalize subscripts so that offsetting will work. */ -@@ -2017,17 +2037,25 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2017,17 +2145,25 @@ evaluate_subexp_standard (struct type *expect_type, tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); } @@ -11419,7 +13653,7 @@ index 1d35571..f3c9564 100644 /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level -@@ -2037,7 +2065,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2037,7 +2173,7 @@ evaluate_subexp_standard (struct type *expect_type, returns the correct type value */ deprecated_set_value_type (arg1, tmp_type); @@ -11428,7 +13662,7 @@ index 1d35571..f3c9564 100644 } case BINOP_LOGICAL_AND: -@@ -2475,7 +2503,17 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2475,7 +2611,17 @@ evaluate_subexp_standard (struct type *expect_type, if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) @@ -11447,7 +13681,16 @@ index 1d35571..f3c9564 100644 else error (_("Attempt to use a type name as an expression")); -@@ -2624,12 +2662,13 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -2568,7 +2714,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos, + (*pos) += 5 + BYTES_TO_EXP_ELEM (tem + 1); + x = value_aggregate_elt (exp->elts[pc + 1].type, + &exp->elts[pc + 3].string, +- 1, noside); ++ NULL, 1, noside); + if (x == NULL) + error (_("There is no field named %s"), &exp->elts[pc + 3].string); + return x; +@@ -2624,12 +2770,13 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -11462,7 +13705,7 @@ index 1d35571..f3c9564 100644 return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -2681,9 +2720,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) +@@ -2681,9 +2828,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -11517,10 +13760,36 @@ index 89bae03..f768940 100644 } else diff --git a/gdb/expression.h b/gdb/expression.h -index 12163e3..978dc73 100644 +index 12163e3..789cb89 100644 --- a/gdb/expression.h +++ b/gdb/expression.h -@@ -435,4 +435,5 @@ extern char *op_string (enum exp_opcode); +@@ -88,6 +88,16 @@ enum exp_opcode + when X is a pointer instead of an aggregate. */ + STRUCTOP_MPTR, + ++ /* TYPE_INSTANCE is used when the user specifies a specific ++ type instantiation for overloaded methods/functions. The format ++ is: TYPE_INSTANCE num_types type0 ... typeN num_types TYPE_INSTANCE*/ ++ TYPE_INSTANCE, ++ ++ /* TYPE_INSTANCE_LOOKUP is used when the user specifies a specific ++ type instantiation of a function (not a method). In this case, ++ we must toss the results of the parser and manually do the lookup. */ ++ TYPE_INSTANCE_LOOKUP, ++ + /* end of C++. */ + + /* For Modula-2 integer division DIV */ +@@ -426,6 +436,8 @@ enum noside + extern struct value *evaluate_subexp_standard + (struct type *, struct expression *, int *, enum noside); + ++extern int compare_parameters (struct type *, struct type *); ++ + /* From expprint.c */ + + extern void print_expression (struct expression *, struct ui_file *); +@@ -435,4 +447,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 *); @@ -14900,7 +17169,7 @@ index 7cacac1..a456228 100644 vtbl = value_as_address (value_field (v, known_type_vptr_fieldno)); diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c -index 3a52df3..ece910b 100644 +index 3a52df3..6cdf716 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -269,8 +269,7 @@ gnuv3_rtti_type (struct value *value, @@ -14913,6 +17182,36 @@ index 3a52df3..ece910b 100644 + value_embedded_offset (vtable)); if (! vtable_symbol) return NULL; +@@ -487,10 +486,8 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset, + LONGEST adjustment) + { + int i; +- const char *physname; + + /* Search this class first. */ +- physname = NULL; + if (adjustment == 0) + { + int len; +@@ -615,13 +612,15 @@ gnuv3_print_method_ptr (const gdb_byte *contents, + { + char *demangled_name = cplus_demangle (physname, + DMGL_ANSI | DMGL_PARAMS); +- if (demangled_name != NULL) ++ fprintf_filtered (stream, "&virtual "); ++ if (demangled_name == NULL) ++ fputs_filtered (physname, stream); ++ else + { +- fprintf_filtered (stream, "&virtual "); + fputs_filtered (demangled_name, stream); + xfree (demangled_name); +- return; + } ++ return; + } + } + diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 2366474..f83de32 100644 --- a/gdb/i386-linux-nat.c @@ -15223,7 +17522,7 @@ index 0a17dab..d48f4b1 100644 this function should probably be moved into target_pre_inferior. */ target_pre_inferior (from_tty); diff --git a/gdb/infrun.c b/gdb/infrun.c -index e5c2971..cdc4303 100644 +index ee5f987..2f627ea 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1046,7 +1046,7 @@ a command like `return' or `jump' to continue execution.")); @@ -15256,7 +17555,7 @@ index e5c2971..cdc4303 100644 pending_follow.kind = TARGET_WAITKIND_SPURIOUS; /* I.e., none. */ clear_proceed_status (); -@@ -2129,6 +2134,50 @@ ensure_not_running (void) +@@ -2155,6 +2160,50 @@ ensure_not_running (void) error_is_running (); } @@ -15307,7 +17606,7 @@ index e5c2971..cdc4303 100644 /* Given an execution control state that has been freshly filled in by an event from the inferior, figure out what it means and take appropriate action. */ -@@ -2423,9 +2472,11 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -2449,9 +2498,11 @@ handle_inferior_event (struct execution_control_state *ecs) case TARGET_WAITKIND_SYSCALL_ENTRY: if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_ENTRY\n"); @@ -15322,7 +17621,7 @@ index e5c2971..cdc4303 100644 /* Before examining the threads further, step this thread to get it entirely out of the syscall. (We get notice of the -@@ -2435,9 +2486,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -2461,9 +2512,10 @@ handle_inferior_event (struct execution_control_state *ecs) case TARGET_WAITKIND_SYSCALL_RETURN: if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SYSCALL_RETURN\n"); @@ -15336,7 +17635,7 @@ index e5c2971..cdc4303 100644 case TARGET_WAITKIND_STOPPED: if (debug_infrun) -@@ -5140,6 +5192,25 @@ inferior_has_execd (ptid_t pid, char **execd_pathname) +@@ -5166,6 +5218,25 @@ inferior_has_execd (ptid_t pid, char **execd_pathname) return 1; } @@ -15575,6 +17874,45 @@ index 85826fd..e5f80ab 100644 #define LA_GET_STRING(value, buffer, length, encoding) \ (current_language->la_get_string(value, buffer, length, encoding)) +diff --git a/gdb/linespec.c b/gdb/linespec.c +index 6579d42..b3ae6c0 100644 +--- a/gdb/linespec.c ++++ b/gdb/linespec.c +@@ -842,13 +842,33 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, + } + else if (paren_pointer != NULL) + { +- p = paren_pointer + 1; ++ /* We need to deal with method and function overloads ++ with no parameters. Gdb and gcc (and who knows about other ++ compilers) are very inconsistent with the keyword "void". ++ Canonicalizing C++ types is insufficient in this case, since ++ we still need to enforce the presence (or lack thereof) of ++ "void". For simplicity, omit the keyword "void" if present. */ ++ if (strncmp (paren_pointer - 5, "(void)", 6) == 0) ++ { ++ char *a, *b; ++ a = paren_pointer - 4; ++ b = paren_pointer; ++ while ((*(a++) = *(b++)) != '\0') ; ++ *a = '\0'; ++ p = paren_pointer - 3; ++ } ++ else ++ p = paren_pointer + 1; + } + else + { + p = skip_quoted (*argptr); + } + ++ /* Make sure we keep important kewords like "const" */ ++ if (strncmp (p, " const", 6) == 0) ++ p += 6; ++ + copy = (char *) alloca (p - *argptr + 1); + memcpy (copy, *argptr, p - *argptr); + copy[p - *argptr] = '\0'; diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 12b786e..e30bf9a 100644 --- a/gdb/linux-nat.c @@ -16592,6 +18930,78 @@ index b905a9e..eaa5f12 100644 current_token = xstrdup (parse->token); cleanup = make_cleanup (free_current_contents, ¤t_token); +diff --git a/gdb/minsyms.c b/gdb/minsyms.c +index bf776b3..e4b0f31 100644 +--- a/gdb/minsyms.c ++++ b/gdb/minsyms.c +@@ -48,6 +48,8 @@ + #include "value.h" + #include "cp-abi.h" + #include "target.h" ++#include "cp-support.h" ++#include "language.h" + + /* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE. + At the end, copy them all into one newly allocated location on an objfile's +@@ -187,6 +189,9 @@ lookup_minimal_symbol (const char *name, const char *sfile, + unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; + unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE; + ++ int needtofreename = 0; ++ const char *modified_name; ++ + if (sfile != NULL) + { + char *p = strrchr (sfile, '/'); +@@ -194,6 +199,18 @@ lookup_minimal_symbol (const char *name, const char *sfile, + sfile = p + 1; + } + ++ /* For C++, canonicalize the input name. */ ++ modified_name = name; ++ if (current_language->la_language == language_cplus) ++ { ++ char *cname = cp_canonicalize_string (name); ++ if (cname) ++ { ++ modified_name = cname; ++ needtofreename = 1; ++ } ++ } ++ + for (objfile = object_files; + objfile != NULL && found_symbol == NULL; + objfile = objfile->next) +@@ -218,9 +235,16 @@ lookup_minimal_symbol (const char *name, const char *sfile, + int match; + + if (pass == 1) +- match = strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0; ++ { ++ match = strcmp (SYMBOL_LINKAGE_NAME (msymbol), ++ modified_name) == 0; ++ } + else +- match = SYMBOL_MATCHES_SEARCH_NAME (msymbol, name); ++ { ++ match = SYMBOL_MATCHES_SEARCH_NAME (msymbol, ++ modified_name); ++ } ++ + if (match) + { + switch (MSYMBOL_TYPE (msymbol)) +@@ -259,6 +283,10 @@ lookup_minimal_symbol (const char *name, const char *sfile, + } + } + } ++ ++ if (needtofreename) ++ xfree ((void *) modified_name); ++ + /* External symbols are best. */ + if (found_symbol) + return found_symbol; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 6c8c4c0..7d283a4 100644 --- a/gdb/mips-tdep.c @@ -17001,7 +19411,7 @@ index 27ae619..29f0e6d 100644 return; } diff --git a/gdb/parse.c b/gdb/parse.c -index eee1f8e..96dc1c5 100644 +index eee1f8e..66aaf6a 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -306,7 +306,7 @@ write_exp_elt_intern (struct internalvar *expelt) @@ -17079,6 +19489,22 @@ index eee1f8e..96dc1c5 100644 /* Add a bitstring constant to the end of the expression. Bitstring constants are stored by first writing an expression element +@@ -777,6 +836,15 @@ operator_length_standard (struct expression *expr, int endpos, + args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); + break; + ++ case TYPE_INSTANCE: ++ oplen = 4 + longest_to_int (expr->elts[endpos - 2].longconst); ++ args = 1; ++ break; ++ ++ case TYPE_INSTANCE_LOOKUP: ++ oplen = 3; ++ break; ++ + case OP_OBJC_MSGCALL: /* Objective C message (method) call */ + oplen = 4; + args = 1 + longest_to_int (expr->elts[endpos - 2].longconst); diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 2c4b755..cbda9c3 100644 --- a/gdb/parser-defs.h @@ -20013,10 +22439,10 @@ index 36cde34..e6e3ac0 100644 diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c new file mode 100644 -index 0000000..ef1c178 +index 0000000..7305199 --- /dev/null +++ b/gdb/python/python-frame.c -@@ -0,0 +1,656 @@ +@@ -0,0 +1,668 @@ +/* Python interface to stack frames + + Copyright (C) 2008, 2009 Free Software Foundation, Inc. @@ -20420,7 +22846,7 @@ index 0000000..ef1c178 +{ + struct frame_info *frame; + PyObject *sym_obj; -+ struct symbol *var; ++ struct symbol *var = NULL; /* gcc-4.3.2 false warning. */ + struct value *val = NULL; + volatile struct gdb_exception except; + @@ -20432,20 +22858,32 @@ index 0000000..ef1c178 + else if (gdbpy_is_string (sym_obj)) + { + char *var_name; -+ struct block *block; ++ struct block *block = NULL; ++ struct cleanup *cleanup; + volatile struct gdb_exception except; + ++ var_name = python_string_to_target_string (sym_obj); ++ cleanup = make_cleanup (xfree, var_name); ++ + TRY_CATCH (except, RETURN_MASK_ALL) + { -+ struct block *block; -+ + FRAPY_REQUIRE_VALID ((frame_object *) self, frame); + + block = block_for_pc (get_frame_address_in_block (frame)); -+ var = lookup_symbol (python_string_to_target_string (sym_obj), block, -+ VAR_DOMAIN, NULL); ++ var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL); + } + GDB_PY_HANDLE_EXCEPTION (except); ++ ++ if (!var) ++ { ++ PyErr_Format (PyExc_ValueError, ++ _("variable '%s' not found"), var_name); ++ do_cleanups (cleanup); ++ ++ return NULL; ++ } ++ ++ do_cleanups (cleanup); + } + else + { @@ -20592,7 +23030,7 @@ index 0000000..ef1c178 + if (PyType_Ready (&frame_object_type) < 0) + return; + -+ /* FIXME: These would probably be best exposed as class attributes of Frame, ++ /* Note: These would probably be best exposed as class attributes of Frame, + but I don't know how to do it except by messing with the type's dictionary. + That seems too messy. */ + PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME); @@ -21057,7 +23495,7 @@ index 02dbfc4..4aae0aa 100644 #endif /* GDB_PYTHON_INTERNAL_H */ diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c new file mode 100644 -index 0000000..04bf3b4 +index 0000000..57836f9 --- /dev/null +++ b/gdb/python/python-membuf.c @@ -0,0 +1,227 @@ @@ -21189,7 +23627,7 @@ index 0000000..04bf3b4 + membuf_object *membuf_obj = (membuf_object *) self; + + return PyString_FromFormat ("memory buffer for address %p, %u bytes long", -+ (void *) membuf_obj->addr, ++ (void *) (uintptr_t) membuf_obj->addr, + (unsigned int) membuf_obj->length); +} + @@ -22789,7 +25227,7 @@ index 0000000..a48c38c +}; diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c new file mode 100644 -index 0000000..c39ff27 +index 0000000..772a011 --- /dev/null +++ b/gdb/python/python-type.c @@ -0,0 +1,821 @@ @@ -23372,7 +25810,7 @@ index 0000000..c39ff27 + obj->type = type; + type_incref (type); + obj->prev = NULL; -+ if (type && TYPE_OBJFILE (type)) ++ if (type && !OBJFILE_IS_VIRTUAL (TYPE_OBJFILE (type))) + { + struct objfile *objfile = TYPE_OBJFILE (type); + @@ -23436,7 +25874,7 @@ index 0000000..c39ff27 + + if (type->prev) + type->prev->next = type->next; -+ else if (type->type && TYPE_OBJFILE (type->type)) ++ else if (type->type && !OBJFILE_IS_VIRTUAL (TYPE_OBJFILE (type->type))) + { + /* Must reset head of list. */ + struct objfile *objfile = TYPE_OBJFILE (type->type); @@ -23869,7 +26307,7 @@ index bc077b6..de54b9d 100644 }; diff --git a/gdb/python/python.c b/gdb/python/python.c -index b3a27d6..a38ea92 100644 +index b3a27d6..18578f0 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -22,6 +22,12 @@ @@ -25402,12 +27840,8 @@ index b3a27d6..a38ea92 100644 #ifdef HAVE_PYTHON Py_Initialize (); PyEval_InitThreads (); -@@ -410,11 +1768,32 @@ Enables or disables printing of Python stack traces."), - PyModule_AddStringConstant (gdb_module, "VERSION", (char*) version); - PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", (char*) host_name); +@@ -412,9 +1770,28 @@ Enables or disables printing of Python stack traces."), PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", (char*) target_name); -+ if (gdb_datadir) -+ PyModule_AddStringConstant (gdb_module, "datadir", gdb_datadir); gdbpy_initialize_values (); + gdbpy_initialize_breakpoints (); @@ -25435,22 +27869,21 @@ index b3a27d6..a38ea92 100644 gdbpy_doc_cst = PyString_FromString ("__doc__"); -@@ -442,6 +1821,14 @@ class GdbOutputFile:\n\ +@@ -442,6 +1819,13 @@ class GdbOutputFile:\n\ \n\ sys.stderr = GdbOutputFile()\n\ sys.stdout = GdbOutputFile()\n\ -+if hasattr (gdb, 'datadir'):\n\ -+ gdb.pythonlibdir = gdb.datadir + '/python'\n\ -+ sys.path.insert(0, gdb.pythonlibdir)\n\ -+ gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\ -+ from os.path import exists\n\ -+ ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\ -+ if exists (ipy):\n\ -+ execfile (ipy)\n\ ++# FIXME: gdb.pythonlibdir is deprecated as it is just the standard libdir.\n\ ++gdb.pythonlibdir = '" GDB_PYTHONDIR_PATH "'\n\ ++gdb.__path__ = [gdb.pythonlibdir + '/gdb']\n\ ++from os.path import exists\n\ ++ipy = gdb.pythonlibdir + '/gdb/__init__.py'\n\ ++if exists (ipy):\n\ ++ execfile (ipy)\n\ "); /* Release the GIL while gdb runs. */ -@@ -461,9 +1848,74 @@ static PyMethodDef GdbMethods[] = +@@ -461,9 +1845,74 @@ static PyMethodDef GdbMethods[] = "Get a value from history" }, { "execute", execute_gdb_command, METH_VARARGS, "Execute a gdb command" }, @@ -25545,6 +27978,98 @@ index e63c447..767af86 100644 + const struct language_defn *language); + #endif /* GDB_PYTHON_H */ +diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c +index 926d0b6..1c59a42 100644 +--- a/gdb/rs6000-tdep.c ++++ b/gdb/rs6000-tdep.c +@@ -117,6 +117,9 @@ static const char *powerpc_vector_strings[] = + NULL + }; + ++/* The configurable `disassemble_info.disassembler_options' string. */ ++static char *disassembler_options; ++ + /* A variable that can be configured by the user. */ + static enum powerpc_vector_abi powerpc_vector_abi_global = POWERPC_VEC_AUTO; + static const char *powerpc_vector_abi_string = "auto"; +@@ -2993,15 +2996,17 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach) + } + + static int +-gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info) ++gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info_pointer) + { +- if (!info->disassembler_options) +- info->disassembler_options = "any"; ++ disassemble_info info = *info_pointer; + +- if (info->endian == BFD_ENDIAN_BIG) +- return print_insn_big_powerpc (memaddr, info); ++ if (disassembler_options && disassembler_options[0]) ++ info.disassembler_options = disassembler_options; ++ ++ if (info.endian == BFD_ENDIAN_BIG) ++ return print_insn_big_powerpc (memaddr, &info); + else +- return print_insn_little_powerpc (memaddr, info); ++ return print_insn_little_powerpc (memaddr, &info); + } + + static CORE_ADDR +@@ -3326,7 +3331,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + enum bfd_architecture arch; + unsigned long mach; + bfd abfd; +- asection *sect; + enum auto_boolean soft_float_flag = powerpc_soft_float_global; + int soft_float; + enum powerpc_vector_abi vector_abi = powerpc_vector_abi_global; +@@ -3375,26 +3379,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) + arch = info.bfd_arch_info->arch; + mach = info.bfd_arch_info->mach; + +- /* For e500 executables, the apuinfo section is of help here. Such +- section contains the identifier and revision number of each +- Application-specific Processing Unit that is present on the +- chip. The content of the section is determined by the assembler +- which looks at each instruction and determines which unit (and +- which version of it) can execute it. In our case we just look for +- the existance of the section. */ +- +- if (info.abfd) +- { +- sect = bfd_get_section_by_name (info.abfd, ".PPC.EMB.apuinfo"); +- if (sect) +- { +- arch = info.bfd_arch_info->arch; +- mach = bfd_mach_ppc_e500; +- bfd_default_set_arch_mach (&abfd, arch, mach); +- info.bfd_arch_info = bfd_get_arch_info (&abfd); +- } +- } +- + /* Find a default target description which describes our register + layout, if we do not already have one. */ + if (! tdesc_has_registers (tdesc)) +@@ -4058,4 +4042,18 @@ _initialize_rs6000_tdep (void) + _("Show the vector ABI."), + NULL, powerpc_set_vector_abi, NULL, + &setpowerpccmdlist, &showpowerpccmdlist); ++ ++ /* Arches list is taken from opcodes/ppc-dis.c powerpc_init_dialect. */ ++ disassembler_options = xstrdup ("any"); ++ add_setshow_string_cmd ("disassembler-options", class_support, ++ &disassembler_options, _("\ ++Pass the text on to disassembler."), _("\ ++Show the text passed on to disassembler."), _("\ ++This is the objdump option -M to specify the PowerPC model. The possible\n\ ++(sub)strings are: ppcps, booke, e500mc, e500, efs, e300, 440, 464, power4,\n\ ++power5, cell, power6, power7, vsx, any, 32 and 64. Unlike objdump GDB uses\n\ ++the default value `any'."), ++ NULL, ++ NULL, ++ &setpowerpccmdlist, &showpowerpccmdlist); + } diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index 345befd..e2568c8 100644 --- a/gdb/scm-lang.c @@ -25595,7 +28120,7 @@ index f0a7642..a32add5 100644 } else if (SCM_IFLAGP (svalue) diff --git a/gdb/stabsread.c b/gdb/stabsread.c -index 2d7eb15..4cd33ed 100644 +index 2d7eb15..7423b32 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -322,7 +322,7 @@ dbx_alloc_type (int typenums[2], struct objfile *objfile) @@ -25624,11 +28149,27 @@ index 2d7eb15..4cd33ed 100644 /* We would like to eliminate nameless symbols, but keep their types. E.g. stab entry ":t10=*2" should produce a type 10, which is a pointer -@@ -683,9 +684,21 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, +@@ -683,9 +684,37 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { normal: SYMBOL_LANGUAGE (sym) = current_subfile->language; - SYMBOL_SET_NAMES (sym, string, p - string, objfile); ++ if (current_subfile->language == language_cplus) ++ { ++ char *name = alloca (p - string + 1); ++ memcpy (name, string, p - string); ++ name[p - string] = '\0'; ++ new_name = cp_canonicalize_string (name); ++ } ++ ++ if (new_name != NULL) ++ { ++ SYMBOL_SET_NAMES (sym, new_name, strlen (new_name), objfile); ++ xfree (new_name); ++ } ++ else ++ SYMBOL_SET_NAMES (sym, string, p - string, objfile); ++ if (SYMBOL_LANGUAGE (sym) == language_cplus) - cp_scan_for_anonymous_namespaces (sym); + { @@ -25648,7 +28189,7 @@ index 2d7eb15..4cd33ed 100644 } p++; -@@ -1519,18 +1532,35 @@ again: +@@ -1519,18 +1548,35 @@ again: if (*p != ':') return error_type (pp, objfile); } @@ -25974,7 +28515,7 @@ index 973a57f..56b1d91 100644 + #endif /* #ifndef STACK_H */ diff --git a/gdb/symfile.c b/gdb/symfile.c -index 63b5c1d..a95a8c1 100644 +index 63b5c1d..8ca5457 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -929,6 +929,17 @@ new_symfile_objfile (struct objfile *objfile, int mainline, int verbo) @@ -26060,8 +28601,27 @@ index 63b5c1d..a95a8c1 100644 /* We're done reading the symbol file; finish off complaints. */ clear_complaints (&symfile_complaints, 0, 1); +@@ -2726,7 +2744,7 @@ allocate_symtab (char *filename, struct objfile *objfile) + } + + struct partial_symtab * +-allocate_psymtab (char *filename, struct objfile *objfile) ++allocate_psymtab (const char *filename, struct objfile *objfile) + { + struct partial_symtab *psymtab; + +@@ -3040,7 +3058,8 @@ again2: + + struct partial_symtab * + start_psymtab_common (struct objfile *objfile, +- struct section_offsets *section_offsets, char *filename, ++ struct section_offsets *section_offsets, ++ const char *filename, + CORE_ADDR textlow, struct partial_symbol **global_syms, + struct partial_symbol **static_syms) + { diff --git a/gdb/symfile.h b/gdb/symfile.h -index 88f8326..109fadc 100644 +index 88f8326..50671c1 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -140,6 +140,12 @@ struct sym_fns @@ -26077,6 +28637,24 @@ index 88f8326..109fadc 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. */ +@@ -250,7 +256,7 @@ extern void free_section_addr_info (struct section_addr_info *); + + extern struct partial_symtab *start_psymtab_common (struct objfile *, + struct section_offsets *, +- char *, CORE_ADDR, ++ const char *, CORE_ADDR, + struct partial_symbol **, + struct partial_symbol **); + +@@ -300,7 +306,7 @@ extern int auto_solib_limit; + + extern void set_initial_language (void); + +-extern struct partial_symtab *allocate_psymtab (char *, struct objfile *); ++extern struct partial_symtab *allocate_psymtab (const char *, struct objfile *); + + extern void discard_psymtab (struct partial_symtab *); + @@ -369,7 +375,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data); /* From dwarf2read.c */ @@ -26087,10 +28665,18 @@ index 88f8326..109fadc 100644 extern void dwarf2_build_frame_info (struct objfile *); diff --git a/gdb/symtab.c b/gdb/symtab.c -index d51c7aa..559f436 100644 +index d2ba1f3..593cded 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c -@@ -55,6 +55,7 @@ +@@ -42,6 +42,7 @@ + #include "ada-lang.h" + #include "p-lang.h" + #include "addrmap.h" ++#include "cp-support.h" + + #include "hashtab.h" + +@@ -55,6 +56,7 @@ #include "gdb_stat.h" #include #include "cp-abi.h" @@ -26098,7 +28684,7 @@ index d51c7aa..559f436 100644 #include "observer.h" #include "gdb_assert.h" #include "solist.h" -@@ -273,7 +274,7 @@ lookup_partial_symtab (const char *name) +@@ -273,7 +275,7 @@ lookup_partial_symtab (const char *name) make_cleanup (xfree, real_path); } @@ -26107,7 +28693,7 @@ index d51c7aa..559f436 100644 { if (FILENAME_CMP (name, pst->filename) == 0) { -@@ -870,7 +871,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -870,7 +872,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) than the later used TEXTLOW/TEXTHIGH one. */ ALL_OBJFILES (objfile) @@ -26122,7 +28708,7 @@ index d51c7aa..559f436 100644 { struct partial_symtab *pst; -@@ -903,6 +910,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -903,6 +911,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) return pst; } } @@ -26130,7 +28716,7 @@ index d51c7aa..559f436 100644 /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs which still have no corresponding full SYMTABs read. But it is not -@@ -1170,6 +1178,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) +@@ -1170,6 +1179,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) return psym; } @@ -26153,7 +28739,19 @@ index d51c7aa..559f436 100644 /* Find the definition for a specified symbol name NAME in domain DOMAIN, visible from lexical block BLOCK. Returns the struct symbol pointer, or zero if no symbol is found. -@@ -1213,6 +1237,17 @@ lookup_symbol_in_language (const char *name, const struct block *block, +@@ -1200,6 +1225,11 @@ lookup_symbol_in_language (const char *name, const struct block *block, + int needtofreename = 0; + struct symbol *returnval; + ++ if(strncmp(name, "::", 2) == 0){/* this must be a global name */ ++ name = name+2; ++ block = NULL; ++ } ++ + modified_name = name; + + /* If we are using C++ or Java, demangle the name before doing a lookup, so +@@ -1213,6 +1243,17 @@ lookup_symbol_in_language (const char *name, const struct block *block, modified_name = demangled_name; needtofreename = 1; } @@ -26171,7 +28769,35 @@ index d51c7aa..559f436 100644 } else if (lang == language_java) { -@@ -1450,6 +1485,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, +@@ -1361,22 +1402,23 @@ lookup_symbol_aux_local (const char *name, const char *linkage_name, + const domain_enum domain) + { + struct symbol *sym; +- const struct block *static_block = block_static_block (block); ++ const struct block *global_block = block_global_block (block); + + /* Check if either no block is specified or it's a global block. */ + +- if (static_block == NULL) ++ if (global_block == NULL) + return NULL; + +- while (block != static_block) ++ while (block != global_block) + { + sym = lookup_symbol_aux_block (name, linkage_name, block, domain); + if (sym != NULL) + return sym; ++ + block = BLOCK_SUPERBLOCK (block); + } + +- /* We've reached the static block without finding a result. */ ++ /* We've reached the global block without finding a result. */ + + return NULL; + } +@@ -1450,6 +1492,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, } /* Now go through psymtabs. */ @@ -26179,7 +28805,7 @@ index d51c7aa..559f436 100644 ALL_OBJFILE_PSYMTABS (objfile, ps) { if (!ps->readin -@@ -1520,7 +1556,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, +@@ -1520,7 +1563,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, struct symtab *s; const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); @@ -26188,7 +28814,7 @@ index d51c7aa..559f436 100644 { if (!ps->readin && lookup_partial_symbol (ps, name, linkage_name, -@@ -1805,7 +1841,11 @@ basic_lookup_transparent_type (const char *name) +@@ -1805,7 +1848,11 @@ basic_lookup_transparent_type (const char *name) } } @@ -26201,7 +28827,7 @@ index d51c7aa..559f436 100644 { if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 1, STRUCT_DOMAIN)) -@@ -1853,7 +1893,12 @@ basic_lookup_transparent_type (const char *name) +@@ -1853,7 +1900,12 @@ basic_lookup_transparent_type (const char *name) } } @@ -26215,7 +28841,7 @@ index d51c7aa..559f436 100644 { if (!ps->readin && lookup_partial_symbol (ps, name, NULL, 0, STRUCT_DOMAIN)) { -@@ -1894,7 +1939,21 @@ find_main_psymtab (void) +@@ -1894,7 +1946,21 @@ find_main_psymtab (void) struct partial_symtab *pst; struct objfile *objfile; @@ -26238,7 +28864,7 @@ index d51c7aa..559f436 100644 { if (lookup_partial_symbol (pst, main_name (), NULL, 1, VAR_DOMAIN)) { -@@ -3085,7 +3144,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], +@@ -3085,7 +3151,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], matching the regexp. That way we don't have to reproduce all of the machinery below. */ @@ -26248,10 +28874,20 @@ index d51c7aa..559f436 100644 struct partial_symbol **bound, **gbound, **sbound; int keep_going = 1; diff --git a/gdb/symtab.h b/gdb/symtab.h -index 8b086f3..e59d5c6 100644 +index 8b086f3..06bf7e8 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h -@@ -394,7 +394,10 @@ typedef enum domain_enum_tag +@@ -171,9 +171,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); + #define SYMBOL_SECTION(symbol) (symbol)->ginfo.section + #define SYMBOL_OBJ_SECTION(symbol) (symbol)->ginfo.obj_section + +-#define SYMBOL_CPLUS_DEMANGLED_NAME(symbol) \ +- (symbol)->ginfo.language_specific.cplus_specific.demangled_name +- + /* Initializes the language dependent portion of a symbol + depending upon the language for the symbol. */ + #define SYMBOL_INIT_LANGUAGE_SPECIFIC(symbol,language) \ +@@ -394,7 +391,10 @@ typedef enum domain_enum_tag FUNCTIONS_DOMAIN, /* All defined types */ @@ -26263,7 +28899,7 @@ index 8b086f3..e59d5c6 100644 } domain_enum; -@@ -1027,6 +1030,8 @@ extern void clear_pc_function_cache (void); +@@ -1027,6 +1027,8 @@ extern void clear_pc_function_cache (void); /* from symtab.c: */ @@ -27286,10 +29922,10 @@ index b89d551..831070c 100644 return xstrprintf ("%sspurious", kind_str); case TARGET_WAITKIND_IGNORE: diff --git a/gdb/target.h b/gdb/target.h -index 276af1d..9f37f16 100644 +index 7f4cd8f..8dcc3d6 100644 --- a/gdb/target.h +++ b/gdb/target.h -@@ -139,18 +139,34 @@ struct target_waitstatus +@@ -140,18 +140,34 @@ struct target_waitstatus { enum target_waitkind kind; @@ -27326,7 +29962,7 @@ index 276af1d..9f37f16 100644 /* Return a pretty printed form of target_waitstatus. Space for the result is malloc'd, caller must free. */ extern char *target_waitstatus_to_string (const struct target_waitstatus *); -@@ -400,6 +416,8 @@ struct target_ops +@@ -392,6 +408,8 @@ struct target_ops int (*to_follow_fork) (struct target_ops *, int); void (*to_insert_exec_catchpoint) (int); int (*to_remove_exec_catchpoint) (int); @@ -27335,7 +29971,7 @@ index 276af1d..9f37f16 100644 int (*to_has_exited) (int, int, int *); void (*to_mourn_inferior) (struct target_ops *); int (*to_can_run) (void); -@@ -731,6 +749,8 @@ extern int inferior_has_vforked (ptid_t pid, ptid_t *child_pid); +@@ -723,6 +741,8 @@ extern int inferior_has_vforked (ptid_t pid, ptid_t *child_pid); extern int inferior_has_execd (ptid_t pid, char **execd_pathname); @@ -27344,7 +29980,7 @@ index 276af1d..9f37f16 100644 /* From exec.c */ extern void print_section_info (struct target_ops *, bfd *); -@@ -889,6 +909,21 @@ int target_follow_fork (int follow_child); +@@ -881,6 +901,21 @@ int target_follow_fork (int follow_child); #define target_remove_exec_catchpoint(pid) \ (*current_target.to_remove_exec_catchpoint) (pid) @@ -27366,7 +30002,7 @@ index 276af1d..9f37f16 100644 /* Returns TRUE if PID has exited. And, also sets EXIT_STATUS to the exit code of PID, if any. */ -@@ -1154,6 +1189,20 @@ extern int target_search_memory (CORE_ADDR start_addr, +@@ -1146,6 +1181,20 @@ extern int target_search_memory (CORE_ADDR start_addr, ULONGEST pattern_len, CORE_ADDR *found_addrp); @@ -27400,6 +30036,301 @@ index 3d8fae4..5fb9067 100644 # Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify +diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp +new file mode 100644 +index 0000000..e1fc23f +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-power7.exp +@@ -0,0 +1,176 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Test PowerPC Power7 instructions disassembly. ++ ++if {![istarget "powerpc*-*-*"]} then { ++ verbose "Skipping PowerPC Power7 instructions disassembly." ++ return ++} ++ ++set testfile "powerpc-power7" ++set srcfile ${testfile}.s ++set objfile ${objdir}/${subdir}/${testfile}.o ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" } { ++ untested "PowerPC Power7 instructions disassembly" ++ return -1 ++} ++ ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${objfile} ++ ++ ++# Setup the disassembler. With the default `any' flavor the instruction: ++# 0x20: xxmrghd vs3,vs4,vs5 ++# (incl. many others) would get disassembled as: ++# 0x20: stfq f3,10320(r4) ++ ++gdb_test "set powerpc disassembler-options power7" ++gdb_test "show powerpc disassembler-options power7" \ ++ "The text passed on to disassembler is \"power7\"." ++ ++ ++# Disassemble the function. ++ ++set test "disass func" ++gdb_test_multiple $test $test { ++ -re "\r\nDump of assembler code for function func:(\r\n.*\r\n)End of assembler dump.\r\n$gdb_prompt $" { ++ set func $expect_out(1,string) ++ pass $test ++ } ++} ++ ++proc func_check {offset instr} { ++ global func ++ ++ # 0x0000000000000018 : stxvd2x vs43,r4,r5 ++ set patt ".*\r\n[string map {0x 0x0*} $offset] :\[ \t\]*[string map [list { } "\[ \t\]+" . {\.}] $instr]\[ \t\]*\r\n.*" ++ set test "Found $offset: $instr" ++ if [regexp -nocase -line $patt $func] { ++ pass $test ++ } else { ++ fail $test ++ } ++} ++ ++func_check 0x0 "lxvd2x vs3,r4,r5" ++func_check 0x4 "lxvd2ux vs3,r4,r5" ++func_check 0x8 "lxvd2x vs43,r4,r5" ++func_check 0xc "lxvd2ux vs43,r4,r5" ++func_check 0x10 "stxvd2x vs3,r4,r5" ++func_check 0x14 "stxvd2ux vs3,r4,r5" ++func_check 0x18 "stxvd2x vs43,r4,r5" ++func_check 0x1c "stxvd2ux vs43,r4,r5" ++func_check 0x20 "xxmrghd vs3,vs4,vs5" ++func_check 0x24 "xxmrghd vs43,vs44,vs45" ++func_check 0x28 "xxmrgld vs3,vs4,vs5" ++func_check 0x2c "xxmrgld vs43,vs44,vs45" ++func_check 0x30 "xxmrghd vs3,vs4,vs5" ++func_check 0x34 "xxmrghd vs43,vs44,vs45" ++func_check 0x38 "xxmrgld vs3,vs4,vs5" ++func_check 0x3c "xxmrgld vs43,vs44,vs45" ++func_check 0x40 "xxpermdi vs3,vs4,vs5,1" ++func_check 0x44 "xxpermdi vs43,vs44,vs45,1" ++func_check 0x48 "xxpermdi vs3,vs4,vs5,2" ++func_check 0x4c "xxpermdi vs43,vs44,vs45,2" ++func_check 0x50 "xvmovdp vs3,vs4" ++func_check 0x54 "xvmovdp vs43,vs44" ++func_check 0x58 "xvmovdp vs3,vs4" ++func_check 0x5c "xvmovdp vs43,vs44" ++func_check 0x60 "xvcpsgndp vs3,vs4,vs5" ++func_check 0x64 "xvcpsgndp vs43,vs44,vs45" ++func_check 0x68 "wait" ++func_check 0x6c "wait" ++func_check 0x70 "waitrsv" ++func_check 0x74 "waitrsv" ++func_check 0x78 "waitimpl" ++func_check 0x7c "waitimpl" ++func_check 0x80 "doze" ++func_check 0x84 "nap" ++func_check 0x88 "sleep" ++func_check 0x8c "rvwinkle" ++func_check 0x90 "prtyw r3,r4" ++func_check 0x94 "prtyd r13,r14" ++func_check 0x98 "mfcfar r10" ++func_check 0x9c "mtcfar r11" ++func_check 0xa0 "cmpb r3,r4,r5" ++func_check 0xa4 "lwzcix r10,r11,r12" ++func_check 0xa8 "dadd f16,f17,f18" ++func_check 0xac "daddq f20,f22,f24" ++func_check 0xb0 "dss 3" ++func_check 0xb4 "dssall" ++func_check 0xb8 "dst r5,r4,1" ++func_check 0xbc "dstt r8,r7,0" ++func_check 0xc0 "dstst r5,r6,3" ++func_check 0xc4 "dststt r4,r5,2" ++func_check 0xc8 "divwe r10,r11,r12" ++func_check 0xcc "divwe. r11,r12,r13" ++func_check 0xd0 "divweo r12,r13,r14" ++func_check 0xd4 "divweo. r13,r14,r15" ++func_check 0xd8 "divweu r10,r11,r12" ++func_check 0xdc "divweu. r11,r12,r13" ++func_check 0xe0 "divweuo r12,r13,r14" ++func_check 0xe4 "divweuo. r13,r14,r15" ++func_check 0xe8 "bpermd r7,r17,r27" ++func_check 0xec "popcntw r10,r20" ++func_check 0xf0 "popcntd r10,r20" ++func_check 0xf4 "ldbrx r20,r21,r22" ++func_check 0xf8 "stdbrx r20,r21,r22" ++func_check 0xfc "lfiwzx f10,0,r10" ++func_check 0x100 "lfiwzx f10,r9,r10" ++func_check 0x104 "fcfids f4,f5" ++func_check 0x108 "fcfids. f4,f5" ++func_check 0x10c "fcfidus f4,f5" ++func_check 0x110 "fcfidus. f4,f5" ++func_check 0x114 "fctiwu f4,f5" ++func_check 0x118 "fctiwu. f4,f5" ++func_check 0x11c "fctiwuz f4,f5" ++func_check 0x120 "fctiwuz. f4,f5" ++func_check 0x124 "fctidu f4,f5" ++func_check 0x128 "fctidu. f4,f5" ++func_check 0x12c "fctiduz f4,f5" ++func_check 0x130 "fctiduz. f4,f5" ++func_check 0x134 "fcfidu f4,f5" ++func_check 0x138 "fcfidu. f4,f5" ++func_check 0x13c "ftdiv cr0,f10,f11" ++func_check 0x140 "ftdiv cr7,f10,f11" ++func_check 0x144 "ftsqrt cr0,f10" ++func_check 0x148 "ftsqrt cr7,f10" ++func_check 0x14c "dcbtt r8,r9" ++func_check 0x150 "dcbtstt r8,r9" ++func_check 0x154 "dcffix f10,f12" ++func_check 0x158 "dcffix. f20,f22" ++func_check 0x15c "lbarx r10,r11,r12" ++func_check 0x160 "lbarx r10,r11,r12" ++func_check 0x164 "lbarx r10,r11,r12,1" ++func_check 0x168 "lharx r20,r21,r22" ++func_check 0x16c "lharx r20,r21,r22" ++func_check 0x170 "lharx r20,r21,r22,1" ++func_check 0x174 "stbcx. r10,r11,r12" ++func_check 0x178 "sthcx. r10,r11,r12" ++func_check 0x17c "fre f14,f15" ++func_check 0x180 "fre. f14,f15" ++func_check 0x184 "fres f14,f15" ++func_check 0x188 "fres. f14,f15" ++func_check 0x18c "frsqrte f14,f15" ++func_check 0x190 "frsqrte. f14,f15" ++func_check 0x194 "frsqrtes f14,f15" ++func_check 0x198 "frsqrtes. f14,f15" ++func_check 0x19c "isel r2,r3,r4,28" +diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.s b/gdb/testsuite/gdb.arch/powerpc-power7.s +new file mode 100644 +index 0000000..98b2e79 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/powerpc-power7.s +@@ -0,0 +1,107 @@ ++ .text ++ .globl func ++func: ++ .long 0x7c642e98 /* 0: lxvd2x vs3,r4,r5 */ ++ .long 0x7c642ed8 /* 4: lxvd2ux vs3,r4,r5 */ ++ .long 0x7d642e99 /* 8: lxvd2x vs43,r4,r5 */ ++ .long 0x7d642ed9 /* c: lxvd2ux vs43,r4,r5 */ ++ .long 0x7c642f98 /* 10: stxvd2x vs3,r4,r5 */ ++ .long 0x7c642fd8 /* 14: stxvd2ux vs3,r4,r5 */ ++ .long 0x7d642f99 /* 18: stxvd2x vs43,r4,r5 */ ++ .long 0x7d642fd9 /* 1c: stxvd2ux vs43,r4,r5 */ ++ .long 0xf0642850 /* 20: xxmrghd vs3,vs4,vs5 */ ++ .long 0xf16c6857 /* 24: xxmrghd vs43,vs44,vs45 */ ++ .long 0xf0642b50 /* 28: xxmrgld vs3,vs4,vs5 */ ++ .long 0xf16c6b57 /* 2c: xxmrgld vs43,vs44,vs45 */ ++ .long 0xf0642850 /* 30: xxmrghd vs3,vs4,vs5 */ ++ .long 0xf16c6857 /* 34: xxmrghd vs43,vs44,vs45 */ ++ .long 0xf0642b50 /* 38: xxmrgld vs3,vs4,vs5 */ ++ .long 0xf16c6b57 /* 3c: xxmrgld vs43,vs44,vs45 */ ++ .long 0xf0642950 /* 40: xxpermdi vs3,vs4,vs5,1 */ ++ .long 0xf16c6957 /* 44: xxpermdi vs43,vs44,vs45,1 */ ++ .long 0xf0642a50 /* 48: xxpermdi vs3,vs4,vs5,2 */ ++ .long 0xf16c6a57 /* 4c: xxpermdi vs43,vs44,vs45,2 */ ++ .long 0xf0642780 /* 50: xvmovdp vs3,vs4 */ ++ .long 0xf16c6787 /* 54: xvmovdp vs43,vs44 */ ++ .long 0xf0642780 /* 58: xvmovdp vs3,vs4 */ ++ .long 0xf16c6787 /* 5c: xvmovdp vs43,vs44 */ ++ .long 0xf0642f80 /* 60: xvcpsgndp vs3,vs4,vs5 */ ++ .long 0xf16c6f87 /* 64: xvcpsgndp vs43,vs44,vs45 */ ++ .long 0x7c00007c /* 68: wait */ ++ .long 0x7c00007c /* 6c: wait */ ++ .long 0x7c20007c /* 70: waitrsv */ ++ .long 0x7c20007c /* 74: waitrsv */ ++ .long 0x7c40007c /* 78: waitimpl */ ++ .long 0x7c40007c /* 7c: waitimpl */ ++ .long 0x4c000324 /* 80: doze */ ++ .long 0x4c000364 /* 84: nap */ ++ .long 0x4c0003a4 /* 88: sleep */ ++ .long 0x4c0003e4 /* 8c: rvwinkle */ ++ .long 0x7c830134 /* 90: prtyw r3,r4 */ ++ .long 0x7dcd0174 /* 94: prtyd r13,r14 */ ++ .long 0x7d5c02a6 /* 98: mfcfar r10 */ ++ .long 0x7d7c03a6 /* 9c: mtcfar r11 */ ++ .long 0x7c832bf8 /* a0: cmpb r3,r4,r5 */ ++ .long 0x7d4b662a /* a4: lwzcix r10,r11,r12 */ ++ .long 0xee119004 /* a8: dadd f16,f17,f18 */ ++ .long 0xfe96c004 /* ac: daddq f20,f22,f24 */ ++ .long 0x7c60066c /* b0: dss 3 */ ++ .long 0x7e00066c /* b4: dssall */ ++ .long 0x7c2522ac /* b8: dst r5,r4,1 */ ++ .long 0x7e083aac /* bc: dstt r8,r7,0 */ ++ .long 0x7c6532ec /* c0: dstst r5,r6,3 */ ++ .long 0x7e442aec /* c4: dststt r4,r5,2 */ ++ .long 0x7d4b6356 /* c8: divwe r10,r11,r12 */ ++ .long 0x7d6c6b57 /* cc: divwe. r11,r12,r13 */ ++ .long 0x7d8d7756 /* d0: divweo r12,r13,r14 */ ++ .long 0x7dae7f57 /* d4: divweo. r13,r14,r15 */ ++ .long 0x7d4b6316 /* d8: divweu r10,r11,r12 */ ++ .long 0x7d6c6b17 /* dc: divweu. r11,r12,r13 */ ++ .long 0x7d8d7716 /* e0: divweuo r12,r13,r14 */ ++ .long 0x7dae7f17 /* e4: divweuo. r13,r14,r15 */ ++ .long 0x7e27d9f8 /* e8: bpermd r7,r17,r27 */ ++ .long 0x7e8a02f4 /* ec: popcntw r10,r20 */ ++ .long 0x7e8a03f4 /* f0: popcntd r10,r20 */ ++ .long 0x7e95b428 /* f4: ldbrx r20,r21,r22 */ ++ .long 0x7e95b528 /* f8: stdbrx r20,r21,r22 */ ++ .long 0x7d4056ee /* fc: lfiwzx f10,0,r10 */ ++ .long 0x7d4956ee /* 100: lfiwzx f10,r9,r10 */ ++ .long 0xec802e9c /* 104: fcfids f4,f5 */ ++ .long 0xec802e9d /* 108: fcfids. f4,f5 */ ++ .long 0xec802f9c /* 10c: fcfidus f4,f5 */ ++ .long 0xec802f9d /* 110: fcfidus. f4,f5 */ ++ .long 0xfc80291c /* 114: fctiwu f4,f5 */ ++ .long 0xfc80291d /* 118: fctiwu. f4,f5 */ ++ .long 0xfc80291e /* 11c: fctiwuz f4,f5 */ ++ .long 0xfc80291f /* 120: fctiwuz. f4,f5 */ ++ .long 0xfc802f5c /* 124: fctidu f4,f5 */ ++ .long 0xfc802f5d /* 128: fctidu. f4,f5 */ ++ .long 0xfc802f5e /* 12c: fctiduz f4,f5 */ ++ .long 0xfc802f5f /* 130: fctiduz. f4,f5 */ ++ .long 0xfc802f9c /* 134: fcfidu f4,f5 */ ++ .long 0xfc802f9d /* 138: fcfidu. f4,f5 */ ++ .long 0xfc0a5900 /* 13c: ftdiv cr0,f10,f11 */ ++ .long 0xff8a5900 /* 140: ftdiv cr7,f10,f11 */ ++ .long 0xfc005140 /* 144: ftsqrt cr0,f10 */ ++ .long 0xff805140 /* 148: ftsqrt cr7,f10 */ ++ .long 0x7e084a2c /* 14c: dcbtt r8,r9 */ ++ .long 0x7e0849ec /* 150: dcbtstt r8,r9 */ ++ .long 0xed406644 /* 154: dcffix f10,f12 */ ++ .long 0xee80b645 /* 158: dcffix. f20,f22 */ ++ .long 0x7d4b6068 /* 15c: lbarx r10,r11,r12 */ ++ .long 0x7d4b6068 /* 160: lbarx r10,r11,r12 */ ++ .long 0x7d4b6069 /* 164: lbarx r10,r11,r12,1 */ ++ .long 0x7e95b0e8 /* 168: lharx r20,r21,r22 */ ++ .long 0x7e95b0e8 /* 16c: lharx r20,r21,r22 */ ++ .long 0x7e95b0e9 /* 170: lharx r20,r21,r22,1 */ ++ .long 0x7d4b656d /* 174: stbcx. r10,r11,r12 */ ++ .long 0x7d4b65ad /* 178: sthcx. r10,r11,r12 */ ++ .long 0xfdc07830 /* 17c: fre f14,f15 */ ++ .long 0xfdc07831 /* 180: fre. f14,f15 */ ++ .long 0xedc07830 /* 184: fres f14,f15 */ ++ .long 0xedc07831 /* 188: fres. f14,f15 */ ++ .long 0xfdc07834 /* 18c: frsqrte f14,f15 */ ++ .long 0xfdc07835 /* 190: frsqrte. f14,f15 */ ++ .long 0xedc07834 /* 194: frsqrtes f14,f15 */ ++ .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ ++ .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S new file mode 100644 index 0000000..66f7a39 @@ -30018,8 +32949,314 @@ index 0000000..92cc23c + +# The Bug was: No symbol "problem" in current context. +gdb_test "p problem" " = \\(int \\*\\) 0x.*" +diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc +index 7f033d6..1a50a32 100644 +--- a/gdb/testsuite/gdb.cp/cplusfuncs.cc ++++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc +@@ -191,6 +191,12 @@ char * dm_type_char_star (char * p) { return p; } + int dm_type_foo_ref (foo & foo) { return foo.ifoo; } + int * dm_type_int_star (int * p) { return p; } + long * dm_type_long_star (long * p) { return p; } ++int dm_type_short (short i) { return i; } ++int dm_type_long (long i) { return i; } + int dm_type_unsigned_int (unsigned int i) { return i; } ++int dm_type_unsigned_short (unsigned short i) { return i; } ++int dm_type_unsigned_long (unsigned long i) { return i; } + int dm_type_void (void) { return 0; } + void * dm_type_void_star (void * p) { return p; } ++typedef int myint; ++int dm_type_typedef (myint i) { return i; } +diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp +index 5e08768..8c8e038 100644 +--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp ++++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp +@@ -66,9 +66,25 @@ set dm_type_unsigned_int "unsigned" + set dm_type_void "" + set dm_type_void_star "void*" + ++# Some other vagaries of GDB's type printing machinery. The integer types ++# may have unsigned before or after their length, and may have "int" ++# appended. The char* conversion operator may have name "char*" even if ++# the type is "char *", because the name comes from the debug information ++# and the type from GDB. Function types may not see through typedefs. ++ ++set dm_type_short "short" ++set dm_type_long "long" ++set dm_type_unsigned_short "unsigned short" ++set dm_type_unsigned_long "unsigned long" ++set dm_operator_char_star "char*" ++set dm_operator_char_star_quoted "char\\*" ++set dm_type_typedef 0 ++ + proc probe_demangler { } { + global gdb_prompt + global dm_operator_comma ++ global dm_operator_char_star ++ global dm_operator_char_star_quoted + global dm_type_char_star + global dm_type_char_star_quoted + global dm_type_foo_ref +@@ -77,6 +93,11 @@ proc probe_demangler { } { + global dm_type_unsigned_int + global dm_type_void + global dm_type_void_star ++ global dm_type_short ++ global dm_type_unsigned_short ++ global dm_type_long ++ global dm_type_unsigned_long ++ global dm_type_typedef + + send_gdb "print &'foo::operator,(foo&)'\n" + gdb_expect { +@@ -97,6 +118,26 @@ proc probe_demangler { } { + } + } + ++ send_gdb "print &'foo::operator char*()'\n" ++ gdb_expect { ++ -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" { ++ # v2 demangler or GDB type printer ++ set dm_operator_char_star "char *" ++ set dm_operator_char_star_quoted "char \\*" ++ pass "detect dm_operator_char_star" ++ } ++ -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" { ++ # v3 demangler ++ pass "detect dm_operator_char_star" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_operator_char_star" ++ } ++ timeout { ++ fail "detect dm_operator_char_star" ++ } ++ } ++ + send_gdb "print &'dm_type_char_star'\n" + gdb_expect { + -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" { +@@ -166,6 +207,11 @@ proc probe_demangler { } { + # v3 demangler + pass "detect dm_type_long_star" + } ++ -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" { ++ # GCC v3 and GDB's type printer ++ set dm_type_long_star "long int *" ++ pass "detect dm_type_long_star" ++ } + -re ".*$gdb_prompt $" { + fail "detect dm_type_long_star" + } +@@ -230,6 +276,101 @@ proc probe_demangler { } { + fail "detect dm_type_void_star (timeout)" + } + } ++ ++ send_gdb "print &'dm_type_short'\n" ++ gdb_expect { ++ -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" { ++ # v2 and v3 demanglers ++ pass "detect dm_type_short" ++ } ++ -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" { ++ # GDB type printer ++ set dm_type_short "short int" ++ pass "detect dm_type_short" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_type_short" ++ } ++ timeout { ++ fail "detect dm_type_short (timeout)" ++ } ++ } ++ ++ send_gdb "print &'dm_type_unsigned_short'\n" ++ gdb_expect { ++ -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" { ++ # v2 and v3 demanglers ++ pass "detect dm_type_unsigned_short" ++ } ++ -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" { ++ # GDB type printer ++ set dm_type_unsigned_short "short unsigned int" ++ pass "detect dm_type_unsigned_short" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_type_unsigned_short" ++ } ++ timeout { ++ fail "detect dm_type_unsigned_short (timeout)" ++ } ++ } ++ ++ send_gdb "print &'dm_type_long'\n" ++ gdb_expect { ++ -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" { ++ # v2 and v3 demanglers ++ pass "detect dm_type_long" ++ } ++ -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" { ++ # GDB type printer ++ set dm_type_long "long int" ++ pass "detect dm_type_long" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_type_long" ++ } ++ timeout { ++ fail "detect dm_type_long (timeout)" ++ } ++ } ++ ++ send_gdb "print &'dm_type_unsigned_long'\n" ++ gdb_expect { ++ -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" { ++ # v2 and v3 demanglers ++ pass "detect dm_type_unsigned_long" ++ } ++ -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" { ++ # GDB type printer ++ set dm_type_unsigned_long "long unsigned int" ++ pass "detect dm_type_unsigned_long" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_type_unsigned_long" ++ } ++ timeout { ++ fail "detect dm_type_unsigned_long (timeout)" ++ } ++ } ++ ++ send_gdb "print &'dm_type_typedef'\n" ++ gdb_expect { ++ -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" { ++ # v2 and v3 demanglers ++ pass "detect dm_type_typedef" ++ } ++ -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" { ++ # GDB type printer ++ set dm_type_typedef 1 ++ pass "detect dm_type_typedef" ++ } ++ -re ".*$gdb_prompt $" { ++ fail "detect dm_type_typedef" ++ } ++ timeout { ++ fail "detect dm_type_typedef (timeout)" ++ } ++ } + } + + # +@@ -345,8 +486,9 @@ proc print_addr { name } { + + proc test_lookup_operator_functions {} { + global dm_operator_comma ++ global dm_operator_char_star + global dm_type_char_star +- global dm_type_char_star_quoted ++ global dm_operator_char_star_quoted + global dm_type_foo_ref + global dm_type_void + global dm_type_void_star +@@ -404,8 +546,8 @@ proc test_lookup_operator_functions {} { + + info_func "operator int(" "int foo::operator int($dm_type_void);" + info_func "operator()(" "void foo::operator()($dm_type_foo_ref);" +- info_func "operator $dm_type_char_star_quoted\(" \ +- "char *foo::operator $dm_type_char_star\($dm_type_void);" ++ info_func "operator $dm_operator_char_star_quoted\(" \ ++ "char *foo::operator $dm_operator_char_star\($dm_type_void);" + + } + +@@ -420,6 +562,7 @@ proc test_paddr_operator_functions {} { + global dm_type_unsigned_int + global dm_type_void + global dm_type_void_star ++ global dm_operator_char_star + + print_addr "foo::operator*($dm_type_foo_ref)" + print_addr "foo::operator%($dm_type_foo_ref)" +@@ -470,7 +613,7 @@ proc test_paddr_operator_functions {} { + } + + print_addr "foo::operator int($dm_type_void)" +- print_addr "foo::operator $dm_type_char_star\($dm_type_void)" ++ print_addr "foo::operator $dm_operator_char_star\($dm_type_void)" + } + + # +@@ -480,17 +623,21 @@ proc test_paddr_operator_functions {} { + proc test_paddr_overloaded_functions {} { + global dm_type_unsigned_int + global dm_type_void ++ global dm_type_short ++ global dm_type_unsigned_short ++ global dm_type_long ++ global dm_type_unsigned_long + + print_addr "overload1arg($dm_type_void)" + print_addr "overload1arg(char)" + print_addr "overload1arg(signed char)" + print_addr "overload1arg(unsigned char)" +- print_addr "overload1arg(short)" +- print_addr "overload1arg(unsigned short)" ++ print_addr "overload1arg($dm_type_short)" ++ print_addr "overload1arg($dm_type_unsigned_short)" + print_addr "overload1arg(int)" + print_addr "overload1arg($dm_type_unsigned_int)" +- print_addr "overload1arg(long)" +- print_addr "overload1arg(unsigned long)" ++ print_addr "overload1arg($dm_type_long)" ++ print_addr "overload1arg($dm_type_unsigned_long)" + print_addr "overload1arg(float)" + print_addr "overload1arg(double)" + +@@ -513,17 +660,31 @@ proc test_paddr_hairy_functions {} { + global dm_type_char_star + global dm_type_int_star + global dm_type_long_star ++ global dm_type_typedef + + print_addr_2 "hairyfunc1" "hairyfunc1(int)" +- print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" +- print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" +- print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" +- +- # gdb-gnats bug gdb/19: +- # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" +- print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" +- print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" +- print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" ++ ++ if {$dm_type_typedef == 0} { ++ print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" ++ print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" ++ print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" ++ ++ # gdb-gnats bug gdb/19: ++ # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" ++ print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" ++ print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" ++ print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" ++ } else { ++ print_addr_2 "hairyfunc2" "hairyfunc2(PFPc_i)" ++ print_addr_2 "hairyfunc3" "hairyfunc3(PFPFPl_s_i)" ++ print_addr_2 "hairyfunc4" "hairyfunc4(PFPFPc_s_i)" ++ ++ # gdb-gnats bug gdb/19: ++ # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" ++ print_addr_2 "hairyfunc5" "hairyfunc5(PFPc_PFl_i)" ++ print_addr_2 "hairyfunc6" "hairyfunc6(PFPi_PFl_i)" ++ print_addr_2 "hairyfunc7" "hairyfunc7(PFPFPc_i_PFl_i)" ++ } + } + + proc do_tests {} { diff --git a/gdb/testsuite/gdb.cp/gdb1355.exp b/gdb/testsuite/gdb.cp/gdb1355.exp -index 77687a6..8028bce 100644 +index 77687a6..66d16cf 100644 --- a/gdb/testsuite/gdb.cp/gdb1355.exp +++ b/gdb/testsuite/gdb.cp/gdb1355.exp @@ -68,11 +68,11 @@ set s_tail ".*" @@ -30027,14 +33264,14 @@ index 77687a6..8028bce 100644 set f_i "${ws}int m_int;" set f_c "${ws}char m_char;" -set f_li "${ws}long int m_long_int;" -+set f_li "${ws}long( int)? m_long_int;" ++set f_li "${ws}long m_long_int;" set f_ui "${ws}unsigned int m_unsigned_int;" -set f_lui "${ws}long unsigned int m_long_unsigned_int;" -set f_si "${ws}short int m_short_int;" -set f_sui "${ws}short unsigned int m_short_unsigned_int;" -+set f_lui "${ws}(long unsigned int|unsigned long) m_long_unsigned_int;" -+set f_si "${ws}short( int)? m_short_int;" -+set f_sui "${ws}(short unsigned int|unsigned short) m_short_unsigned_int;" ++set f_lui "${ws}unsigned long m_long_unsigned_int;" ++set f_si "${ws}short m_short_int;" ++set f_sui "${ws}unsigned short m_short_unsigned_int;" set f_uc "${ws}unsigned char m_unsigned_char;" set f_f "${ws}float m_float;" set f_d "${ws}double m_double;" @@ -30300,6 +33537,688 @@ index 0000000..62c09c2 +# normal signal handling in inferior function calls. +gdb_test "p exceptions.raise_signal(1)" \ + "To change this behavior use \"set unwindonsignal on\".*" +diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc +index 1dff70a..648b2af 100644 +--- a/gdb/testsuite/gdb.cp/member-ptr.cc ++++ b/gdb/testsuite/gdb.cp/member-ptr.cc +@@ -138,6 +138,7 @@ class Diamond : public Padding, public Left, public Right + { + public: + virtual int vget_base (); ++ int (*func_ptr) (int); + }; + + int Diamond::vget_base () +@@ -145,6 +146,12 @@ int Diamond::vget_base () + return this->Left::x + 2000; + } + ++int ++func (int x) ++{ ++ return 19 + x; ++} ++ + int main () + { + A a; +@@ -162,6 +169,7 @@ int main () + int (Diamond::*right_vpmf) (); + int (Base::*base_vpmf) (); + int Diamond::*diamond_pmi; ++ int (* Diamond::*diamond_pfunc_ptr) (int); + + PMI null_pmi; + PMF null_pmf; +@@ -179,6 +187,7 @@ int main () + + diamond.Left::x = 77; + diamond.Right::x = 88; ++ diamond.func_ptr = func; + + /* Some valid pointer to members from a base class. */ + left_pmf = (int (Diamond::*) ()) (int (Left::*) ()) (&Base::get_x); +@@ -193,11 +202,19 @@ int main () + /* A pointer to data member from a base class. */ + diamond_pmi = (int Diamond::*) (int Left::*) &Base::x; + ++ /* A pointer to data member, where the member is itself a pointer to ++ a function. */ ++ diamond_pfunc_ptr = (int (* Diamond::*) (int)) &Diamond::func_ptr; ++ + null_pmi = NULL; + null_pmf = NULL; + + pmi = NULL; /* Breakpoint 1 here. */ + ++ // Invalid (uses diamond_pfunc_ptr as a function): ++ // diamond.*diamond_pfunc_ptr (20); ++ (diamond.*diamond_pfunc_ptr) (20); ++ + k = (a.*pmf)(3); + + pmi = &A::jj; +diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp +index b69d4ad..476711f 100644 +--- a/gdb/testsuite/gdb.cp/member-ptr.exp ++++ b/gdb/testsuite/gdb.cp/member-ptr.exp +@@ -390,6 +390,33 @@ gdb_test_multiple "print ((int) pmi) == ((char *) &a.j - (char *) & a)" $name { + } + } + ++# Check pointers to data members, which are themselves pointers to ++# functions. These behave like data members, not like pointers to ++# member functions. ++ ++gdb_test "ptype diamond_pfunc_ptr" \ ++ "type = int \\(\\*Diamond::\\*\\)\\(int\\)" ++ ++gdb_test "ptype diamond.*diamond_pfunc_ptr" \ ++ "type = int \\(\\*\\)\\(int\\)" ++ ++# This one is invalid; () binds more tightly than .*, so it tries to ++# call the member pointer as a normal pointer-to-function. ++ ++gdb_test "print diamond.*diamond_pfunc_ptr (20)" \ ++ "Invalid data type for function to be called." ++ ++# With parentheses, it is valid. ++ ++gdb_test "print (diamond.*diamond_pfunc_ptr) (20)" \ ++ "$vhn = 39" ++ ++# Make sure that we do not interpret this as either a member pointer ++# call or a member function call. ++ ++gdb_test "print diamond.func_ptr (20)" \ ++ "$vhn = 39" ++ + # ========================== + # pointer to member function + # ========================== +@@ -608,6 +635,9 @@ gdb_test_multiple "print (a.*pmf)(3)" $name { + } + } + ++gdb_test "ptype a.*pmf" "type = int \\(A \\*, int\\)" ++gdb_test "ptype (a.*pmf)(3)" "type = int" ++ + # Print out a pointer to data member which requires looking into + # a base class. + gdb_test "print diamond_pmi" "$vhn = &Base::x" +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 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-multiple-imports.cc +@@ -0,0 +1,20 @@ ++namespace A { ++ int x = 11; ++ namespace{ ++ int xx = 22; ++ } ++} ++ ++using namespace A; ++ ++namespace{ ++ int xxx = 33; ++}; ++ ++int main() ++{ ++ x; ++ xx; ++ xxx; ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp b/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp +new file mode 100644 +index 0000000..e4bb9f8 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-multiple-imports.exp +@@ -0,0 +1,49 @@ ++# 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-multiple-imports ++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} ++ ++############################################ ++# test printing of namespace imported within ++# the function. ++ ++if ![runto_main] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_test "print x" "\\$\[0-9\].* = 11" ++gdb_test "print xx" "\\$\[0-9\].* = 22" ++gdb_test "print xxx" "\\$\[0-9\].* = 33" +diff --git a/gdb/testsuite/gdb.cp/namespace-using.cc b/gdb/testsuite/gdb.cp/namespace-using.cc +new file mode 100644 +index 0000000..97af850 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-using.cc +@@ -0,0 +1,131 @@ ++//-------------------------- ++namespace M{ ++ int x = 911; ++} ++ ++namespace N{ ++ int x = 912; ++} ++ ++int marker10(){ ++ using namespace M; ++ int y = x+1; // marker10 stop ++ using namespace N; ++ return y; ++} ++//-------------------------- ++namespace J { ++ int jx = 44; ++} ++ ++namespace K{ ++ int marker9(){ ++ //x; ++ return marker10(); ++ } ++} ++ ++namespace L{ ++ using namespace J; ++ int marker8(){ ++ jx; ++ return K::marker9(); ++ } ++} ++//-------------------------- ++ ++//-------------------------- ++namespace G{ ++ namespace H { ++ int ghx = 6; ++ } ++} ++ ++namespace I{ ++ ++ int marker7(){ ++ using namespace G::H; ++ ghx; ++ return L::marker8(); ++ } ++} ++//-------------------------- ++ ++//-------------------------- ++namespace E{ ++ namespace F{ ++ int efx = 5; ++ } ++} ++using namespace E::F; ++int marker6(){ ++ efx; ++ return I::marker7(); ++} ++//-------------------------- ++ ++namespace A ++{ ++ int _a = 1; ++ int x = 2; ++ ++} ++ ++namespace C ++{ ++ int cc = 3; ++} ++ ++namespace D ++{ ++ int dx = 4; ++} ++ ++using namespace C; ++int marker5() ++{ ++ cc; ++ return marker6(); ++} ++ ++int marker4() ++{ ++ using D::dx; ++ return marker5(); ++} ++ ++int marker3() ++{ ++ return marker4(); ++} ++ ++int marker2() ++{ ++ namespace B = A; ++ B::_a; ++ return marker3(); ++} ++ ++int marker1() ++{ ++ int total = 0; ++ { ++ int b = 1; ++ { ++ using namespace A; ++ int c = 2; ++ { ++ int d = 3; ++ total = _a + b + c + d + marker2(); // marker1 stop ++ } ++ } ++ } ++ return total; ++} ++ ++int main() ++{ ++ using namespace A; ++ _a; ++ return marker1(); ++} +diff --git a/gdb/testsuite/gdb.cp/namespace-using.exp b/gdb/testsuite/gdb.cp/namespace-using.exp +new file mode 100644 +index 0000000..f73fa67 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-using.exp +@@ -0,0 +1,186 @@ ++# 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-using ++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} ++ ++############################################ ++# test printing of namespace imported within ++# the function. ++ ++if ![runto_main] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_test "print _a" "= 1" ++ ++# Test that names are not printed when they ++# are not imported ++ ++gdb_breakpoint marker3 ++gdb_continue_to_breakpoint "marker3" ++ ++#send_gdb "break marker3\n" ++#send_gdb "continue\n" ++ ++gdb_test "print _a" "No symbol \"_a\" in current context." "Print _a without import" ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++ ++############################################ ++# test printing of namespace imported into ++# a scope containing the pc. ++ ++if ![runto_main] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "marker1 stop"] ++gdb_continue_to_breakpoint "marker1 stop" ++ ++gdb_test "print _a" "= 1" "print _a in a nested scope" ++ ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++############################################ ++# test printing of namespace imported into ++# file scope. ++ ++ ++if ![runto marker5] then { ++ perror "couldn't run to breakpoint marker5" ++ continue ++} ++ ++gdb_test "print cc" "= 3" ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++ ++############################################ ++# Test printing of namespace aliases ++ ++if ![runto marker2] then { ++ perror "couldn't run to breakpoint marker2" ++ continue ++} ++ ++gdb_test "print B::_a" "= 1" ++ ++gdb_test "print _a" "No symbol \"_a\" in current context." "print _a in namespace alias scope" ++gdb_test "print x" "No symbol \"x\" in current context." "print x in namespace alias scope" ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++ ++############################################ ++# Test printing of namespace aliases ++ ++if ![runto marker4] then { ++ perror "couldn't run to breakpoint marker4" ++ continue ++} ++ ++gdb_test "print dx" "= 4" ++ ++############################################ ++# Test printing of namespace aliases ++ ++if ![runto marker6] then { ++ perror "couldn't run to breakpoint marker6" ++ continue ++} ++ ++gdb_test "print efx" "= 5" ++ ++############################################ ++# Test printing of variables imported from ++# nested namespaces ++ ++if ![runto I::marker7] then { ++ perror "couldn't run to breakpoint I::marker7" ++ continue ++} ++ ++gdb_test "print ghx" "= 6" ++ ++############################################ ++# Test that variables are not printed in a namespace ++# that is sibling to the namespace containing an import ++ ++if ![runto L::marker8] then { ++ perror "couldn't run to breakpoint L::marker8" ++ continue ++} ++ ++gdb_test "print jx" "= 44" ++ ++gdb_breakpoint "K::marker9" ++gdb_continue_to_breakpoint "K::marker9" ++ ++gdb_test "print jx" "No symbol \"jx\" in current context." ++ ++############################################ ++# Test that variables are only printed after the line ++# containing the import ++ ++if ![runto_main] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "marker10 stop"] ++gdb_continue_to_breakpoint "marker10 stop" ++ ++gdb_test "print x" "= 911" "print x (from M::x)" ++ ++gdb_test "next" "" ++ ++gdb_test "print x" "= 912" "print x (from M::x)" +diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp +index 76b1b82..2042db2 100644 +--- a/gdb/testsuite/gdb.cp/namespace.exp ++++ b/gdb/testsuite/gdb.cp/namespace.exp +@@ -24,6 +24,7 @@ + # for namespaces. + # Note: As of 2000-06-03, they passed under g++ - djb + ++load_lib "cp-support.exp" + + if $tracelevel then { + strace $tracelevel +@@ -259,11 +260,16 @@ gdb_test "ptype E" "type = namespace C::D::E" + gdb_test "ptype CClass" "type = (class C::CClass \{\r\n public:|struct C::CClass \{)\r\n int x;\r\n\}" + gdb_test "ptype CClass::NestedClass" "type = (class C::CClass::NestedClass \{\r\n public:|struct C::CClass::NestedClass \{)\r\n int y;\r\n\}" + gdb_test "ptype NestedClass" "No symbol \"NestedClass\" in current context." +-setup_kfail "gdb/1448" "*-*-*" +-gdb_test "ptype ::C::CClass" "type = class C::CClass \{\r\n public:\r\n int x;\r\n\}" +-setup_kfail "gdb/1448" "*-*-*" +-gdb_test "ptype ::C::CClass::NestedClass" "type = class C::CClass::NestedClass \{\r\n public:\r\n int y;\r\n\}" +-setup_kfail "gdb/1448" "*-*-*" ++cp_test_ptype_class \ ++ "ptype ::C::CClass" "" "class" "C::CClass" \ ++ { ++ { field public "int x;" } ++ } ++cp_test_ptype_class \ ++ "ptype ::C::CClass::NestedClass" "" "class" "C::CClass::NestedClass" \ ++ { ++ { field public "int y;" } ++ } + gdb_test "ptype ::C::NestedClass" "No symbol \"NestedClass\" in namespace \"C\"." + gdb_test "ptype C::CClass" "No symbol \"CClass\" in namespace \"C::C\"." + gdb_test "ptype C::CClass::NestedClass" "No type \"CClass\" within class or namespace \"C::C\"." +@@ -273,8 +279,11 @@ gdb_test "ptype C::NestedClass" "No symbol \"NestedClass\" in namespace \"C::C\" + + gdb_test "print cOtherFile" "\\$\[0-9\].* = 316" + gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n\}" +-setup_kfail "gdb/1448" "*-*-*" +-gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n public:\r\n int z;\r\n\}" ++cp_test_ptype_class \ ++ "ptype ::C::OtherFileClass" "" "class" "C::OtherFileClass" \ ++ { ++ { field public "int z;" } ++ } + gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"." + + # Some anonymous namespace tests. +diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp +index 24025a2..a72932e 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|)\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(char\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(signed char\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(unsigned char\\);" +-set re_methods "${re_methods}${ws}int overload1arg\\(short\\);" +-set re_methods "${re_methods}${ws}int overload1arg\\(unsigned short\\);" ++set re_methods "${re_methods}${ws}int overload1arg\\(short( int)?\\);" ++set re_methods "${re_methods}${ws}int overload1arg\\((unsigned short|short unsigned)( int)?\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(int\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(unsigned int\\);" +-set re_methods "${re_methods}${ws}int overload1arg\\(long\\);" +-set re_methods "${re_methods}${ws}int overload1arg\\(unsigned long\\);" ++set re_methods "${re_methods}${ws}int overload1arg\\(long( int)?\\);" ++set re_methods "${re_methods}${ws}int overload1arg\\((unsigned long|long unsigned)( int)?\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(float\\);" + set re_methods "${re_methods}${ws}int overload1arg\\(double\\);" + set re_methods "${re_methods}${ws}int overloadfnarg\\((void|)\\);" +diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp +index 8a6b795..897171c 100644 +--- a/gdb/testsuite/gdb.cp/ovldbreak.exp ++++ b/gdb/testsuite/gdb.cp/ovldbreak.exp +@@ -127,10 +127,24 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { + } + + # This is the expected menu for overload1arg. +-# Note the arg type variations on lines 6 and 13. ++# Note the arg type variations for void and integer types. + # This accommodates different versions of g++. + +-set menu_overload1arg "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n> $" ++set menu_overload1arg "\\\[0\\\] cancel\r\n" ++append menu_overload1arg "\\\[1\\\] all\r\n" ++append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n" ++append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n" ++append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n" ++append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n" ++append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n" ++append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n" ++append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n" ++append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n" ++append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n" ++append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n" ++append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n" ++append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n" ++append menu_overload1arg "> $" + + # Set multiple-symbols to "ask", to allow us to test the use + # of the multiple-choice menu when breaking on an overloaded method. +@@ -157,17 +171,17 @@ set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110 + + gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\(void\\))? at.*$srcfile:49\r + \[\t \]+breakpoint already hit 1 time\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ +@@ -215,17 +229,17 @@ gdb_expect { + + gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\(void\\))? at.*$srcfile:49\r + \[\t \]+breakpoint already hit 1 time\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ +@@ -296,12 +310,12 @@ gdb_test "info break" \ + "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r ++\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r + \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp index 4784cb2..b2e55cf 100644 --- a/gdb/testsuite/gdb.cp/ref-types.exp @@ -31524,10 +35443,10 @@ index 0000000..22eb9f2 +} diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp new file mode 100644 -index 0000000..cfa2226 +index 0000000..f62f63d --- /dev/null +++ b/gdb/testsuite/gdb.python/python-frame.exp -@@ -0,0 +1,83 @@ +@@ -0,0 +1,92 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -31593,6 +35512,7 @@ index 0000000..cfa2226 + +gdb_breakpoint "f2" +gdb_continue_to_breakpoint "breakpoint at f2" ++gdb_test "up" "" "" + +gdb_py_test_silent_cmd "python frames = gdb.frames ()" "get frames list" 1 +gdb_test "python print frames" "\\(, , \\)" "verify frames list" @@ -31605,10 +35525,18 @@ index 0000000..cfa2226 +gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name" +gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type" +gdb_test "python print 'result =', f0.unwind_stop_reason () == gdb.FRAME_UNWIND_NO_REASON" " = True" "test Frame.type" ++gdb_test "python print 'result =', gdb.frame_stop_reason_string (gdb.FRAME_UNWIND_INNER_ID)" " = previous frame inner to this frame \\(corrupt stack\\?\\)" "test gdb.frame_stop_reason_string" +gdb_test "python print 'result =', f0.pc ()" " = \[0-9\]+" "test Frame.pc" +gdb_test "python print 'result =', f0.addr_in_block ()" " = \[0-9\]+" "test Frame.addr_in_block" +gdb_test "python print 'result =', f0.older ().equals (f1)" " = True" "test Frame.older" +gdb_test "python print 'result =', f1.newer ().equals (f0)" " = True" "test Frame.newer" ++gdb_test "python print 'result =', f0.read_var_value ('b')" \ ++ "ValueError: variable 'b' not found.*Error while executing Python code." \ ++ "test Frame.read_var_value - error" ++gdb_test "python print 'result =', f0.read_var_value ('a')" " = 1" "test Frame.read_var_value - success" ++ ++gdb_test "python print 'result =', gdb.newest_frame ().equals (f0)" " = True" "test gdb.newest_frame" ++gdb_test "python print 'result =', gdb.selected_frame ().equals (f1)" " = True" "test gdb.selected_frame" + +gdb_test "python print 'result =', f0.block ()" "" "test Frame.block" diff --git a/gdb/testsuite/gdb.python/python-function.exp b/gdb/testsuite/gdb.python/python-function.exp @@ -32413,6 +36341,27 @@ index 8f5e0ab..9ca9593 100644 test_value_in_inferior +test_value_after_death +diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp +index dbd2f59..44e1b51 100644 +--- a/gdb/testsuite/lib/cp-support.exp ++++ b/gdb/testsuite/lib/cp-support.exp +@@ -222,7 +222,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { + + set parse_okay 0 + gdb_test_multiple "$in_command" "$in_testname // parse failed" { +- -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { ++ -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_:\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { + set parse_okay 1 + set actual_key $expect_out(1,string) + set actual_tag $expect_out(2,string) +@@ -231,6 +231,7 @@ proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { + set actual_tail $expect_out(6,string) + } + } ++ + if { ! $parse_okay } then { return } + + # 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 820ab20..8b8e7c6 100644 --- a/gdb/testsuite/lib/gdb.exp @@ -32705,6 +36654,86 @@ index 1f824fa..4a92a13 100644 break; case TYPE_CODE_BOOL: +diff --git a/gdb/typeprint.h b/gdb/typeprint.h +index f561310..b39fd17 100644 +--- a/gdb/typeprint.h ++++ b/gdb/typeprint.h +@@ -26,4 +26,6 @@ void print_type_scalar (struct type * type, LONGEST, struct ui_file *); + + void c_type_print_varspec_suffix (struct type *, struct ui_file *, int, + int, int); ++ ++void c_type_print_args (struct type *, struct ui_file *, int); + #endif +diff --git a/gdb/ui-file.c b/gdb/ui-file.c +index 02a0314..5c8c96e 100644 +--- a/gdb/ui-file.c ++++ b/gdb/ui-file.c +@@ -22,6 +22,7 @@ + + #include "defs.h" + #include "ui-file.h" ++#include "gdb_obstack.h" + #include "gdb_string.h" + + #include +@@ -263,7 +264,7 @@ set_ui_file_data (struct ui_file *file, void *data, + } + + /* ui_file utility function for converting a ``struct ui_file'' into +- a memory buffer''. */ ++ a memory buffer. */ + + struct accumulated_ui_file + { +@@ -297,6 +298,23 @@ ui_file_xstrdup (struct ui_file *file, + *length = acc.length; + return acc.buffer; + } ++ ++static void ++do_ui_file_obsavestring (void *context, const char *buffer, long length) ++{ ++ struct obstack *obstack = (struct obstack *) context; ++ obstack_grow (obstack, buffer, length); ++} ++ ++char * ++ui_file_obsavestring (struct ui_file *file, struct obstack *obstack, ++ long *length) ++{ ++ ui_file_put (file, do_ui_file_obsavestring, obstack); ++ *length = obstack_object_size (obstack); ++ obstack_1grow (obstack, '\0'); ++ return obstack_finish (obstack); ++} + + /* A pure memory based ``struct ui_file'' that can be used an output + buffer. The buffers accumulated contents are available via +diff --git a/gdb/ui-file.h b/gdb/ui-file.h +index 1562d5a..d86a7eb 100644 +--- a/gdb/ui-file.h ++++ b/gdb/ui-file.h +@@ -19,6 +19,7 @@ + #ifndef UI_FILE_H + #define UI_FILE_H + ++struct obstack; + struct ui_file; + + /* Create a generic ui_file object with null methods. */ +@@ -77,7 +78,10 @@ extern void ui_file_put (struct ui_file *src, ui_file_put_method_ftype *write, v + appended NUL. */ + extern char *ui_file_xstrdup (struct ui_file *file, long *length); + +- ++/* Similar to ui_file_xstrdup, but return a new string allocated on ++ OBSTACK. */ ++extern char *ui_file_obsavestring (struct ui_file *file, ++ struct obstack *obstack, long *length); + + 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 9224839..88a9a39 100644 --- a/gdb/utils.c @@ -33030,7 +37059,7 @@ index f38cdb8..8e103cf 100644 } diff --git a/gdb/valops.c b/gdb/valops.c -index 9810f2b..3f8d92c 100644 +index 9810f2b..14c562e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -38,6 +38,7 @@ @@ -33356,7 +37385,105 @@ index 9810f2b..3f8d92c 100644 if (base_offset == -1) error (_("virtual baseclass botch")); } -@@ -2725,7 +2808,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -2083,12 +2166,25 @@ find_overload_match (struct type **arg_types, int nargs, + if (method) + { + gdb_assert (obj); ++ ++ /* OBJ may be a pointer value rather than the object itself. */ ++ obj = coerce_ref (obj); ++ while (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_PTR) ++ obj = coerce_ref (value_ind (obj)); + obj_type_name = TYPE_NAME (value_type (obj)); +- /* Hack: evaluate_subexp_standard often passes in a pointer +- value rather than the object itself, so try again. */ +- if ((!obj_type_name || !*obj_type_name) +- && (TYPE_CODE (value_type (obj)) == TYPE_CODE_PTR)) +- obj_type_name = TYPE_NAME (TYPE_TARGET_TYPE (value_type (obj))); ++ ++ /* First check whether this is a data member, e.g. a pointer to ++ a function. */ ++ if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT) ++ { ++ *valp = search_struct_field (name, obj, 0, ++ check_typedef (value_type (obj)), 0); ++ if (*valp) ++ { ++ *staticp = 1; ++ return 0; ++ } ++ } + + fns_ptr = value_find_oload_method_list (&temp, name, + 0, &num_fns, +@@ -2108,16 +2204,29 @@ 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); + +- /* 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 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; +@@ -2558,8 +2667,8 @@ check_field (struct type *type, const char *name) + the comment before value_struct_elt_for_reference. */ + + struct value * +-value_aggregate_elt (struct type *curtype, +- char *name, int want_address, ++value_aggregate_elt (struct type *curtype, char *name, ++ struct type *expect_type, int want_address, + enum noside noside) + { + switch (TYPE_CODE (curtype)) +@@ -2567,7 +2676,7 @@ value_aggregate_elt (struct type *curtype, + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + return value_struct_elt_for_reference (curtype, 0, curtype, +- name, NULL, ++ name, expect_type, + want_address, noside); + case TYPE_CODE_NAMESPACE: + return value_namespace_elt (curtype, name, +@@ -2671,7 +2780,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, + if (intype) + { + while (j--) +- if (TYPE_FN_FIELD_TYPE (f, j) == intype) ++ if (compare_parameters (TYPE_FN_FIELD_TYPE (f, j), intype)) + break; + if (j < 0) + error (_("no member function matches that type instantiation")); +@@ -2725,7 +2834,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j))); cplus_make_method_ptr (value_type (result), value_contents_writeable (result), @@ -33365,7 +37492,16 @@ index 9810f2b..3f8d92c 100644 } } return result; -@@ -2884,7 +2967,7 @@ value_full_object (struct value *argp, +@@ -2791,7 +2900,7 @@ value_maybe_namespace_elt (const struct type *curtype, + struct symbol *sym; + struct value *result; + +- sym = cp_lookup_symbol_namespace (namespace_name, name, NULL, ++ sym = cp_lookup_symbol_namespace_incremental (namespace_name, name, NULL, + get_selected_block (0), + VAR_DOMAIN); + +@@ -2884,7 +2993,7 @@ value_full_object (struct value *argp, /* Go back by the computed top_offset from the beginning of the object, adjusting for the embedded offset of argp if that's what value_rtti_type used for its computation. */ @@ -33374,7 +37510,7 @@ index 9810f2b..3f8d92c 100644 (using_enc ? 0 : value_embedded_offset (argp))); deprecated_set_value_type (new_val, value_type (argp)); set_value_embedded_offset (new_val, (using_enc -@@ -2989,8 +3072,6 @@ value_slice (struct value *array, int lowbound, int length) +@@ -2989,8 +3098,6 @@ value_slice (struct value *array, int lowbound, int length) || lowbound + length - 1 > upperbound) error (_("slice out of range")); @@ -34079,7 +38215,7 @@ index 4d4329e..9312468 100644 + make_final_cleanup (value_history_cleanup, NULL); } diff --git a/gdb/value.h b/gdb/value.h -index aa43365..fdb22d2 100644 +index aa43365..f41def9 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -272,12 +272,23 @@ extern void set_value_component_location (struct value *component, @@ -34136,7 +38272,15 @@ index aa43365..fdb22d2 100644 extern struct value *value_string (char *ptr, int len); extern struct value *value_bitstring (char *ptr, int len); -@@ -533,14 +551,14 @@ extern void set_internalvar_component (struct internalvar *var, +@@ -435,6 +453,7 @@ extern struct value *value_struct_elt (struct value **argp, + + extern struct value *value_aggregate_elt (struct type *curtype, + char *name, ++ struct type *expect_type, + int want_address, + enum noside noside); + +@@ -533,14 +552,14 @@ extern void set_internalvar_component (struct internalvar *var, int bitpos, int bitsize, struct value *newvalue); @@ -34154,7 +38298,7 @@ index aa43365..fdb22d2 100644 extern int value_equal (struct value *arg1, struct value *arg2); -@@ -619,7 +637,7 @@ extern int common_val_print (struct value *val, +@@ -619,7 +638,7 @@ extern int common_val_print (struct value *val, const struct value_print_options *options, const struct language_defn *language); @@ -34163,7 +38307,7 @@ index aa43365..fdb22d2 100644 struct ui_file *stream, const struct value_print_options *options); -@@ -658,5 +676,22 @@ extern struct value *value_allocate_space_in_inferior (int); +@@ -658,5 +677,22 @@ extern struct value *value_allocate_space_in_inferior (int); extern struct value *value_of_local (const char *name, int complain); diff --git a/gdb.spec b/gdb.spec index 8708894..beb4c12 100644 --- a/gdb.spec +++ b/gdb.spec @@ -9,7 +9,7 @@ Name: gdb%{?_with_debug:-debug} # Set version to contents of gdb/version.in. # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). -Version: 6.8.50.20090228 +Version: 6.8.50.20090302 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. @@ -370,11 +370,16 @@ Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch # The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher Patch349: gdb-archer.patch +# Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). +# - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. +Patch352: gdb-6.8-bz457187-largefile.patch + BuildRequires: ncurses-devel texinfo gettext flex bison expat-devel Requires: readline BuildRequires: readline-devel Requires: rpm-libs BuildRequires: rpm-devel +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Requires: python-libs BuildRequires: python-devel @@ -556,6 +561,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch337 -p1 %patch343 -p1 %patch348 -p1 +%patch352 -p1 %patch124 -p1 find -name "*.orig" | xargs rm -f @@ -629,6 +635,7 @@ CFLAGS="$CFLAGS -O0 -ggdb2" %else --without-libunwind \ %endif + --enable-64-bit-bfd \ %if 0%{?_with_debug:1} --enable-static --disable-shared --enable-debug \ %endif @@ -806,7 +813,8 @@ fi %{_bindir}/pstack %{_mandir}/*/gstack.1* %{_mandir}/*/pstack.1* -%{_datadir}/%{name} +%{python_sitelib}/gdb +%{_datadir}/gdb %endif # 0%{!?_with_upstream:1} %{_infodir}/annotate.info* %{_infodir}/gdb.info* @@ -822,18 +830,22 @@ fi %endif %changelog -* Sat Feb 28 2009 Jan Kratochvil - 6.8.50.20090228-1 +* Mon Mar 2 2009 Jan Kratochvil - 6.8.50.20090302-1 - Include the Archer Project: http://sourceware.org/gdb/wiki/ProjectArcher * [python] Python scripting support: http://sourceware.org/gdb/wiki/PythonGdb * [catch-syscall] Trap and display syscalls. * [delayed-symfile] Improve startup performance by lazily read psymtabs. * [exception-rewind] Fix fatal C++ exceptions in an inferior function call. + * [expr] Expressions, single-quote elimination, C++ input canonicalization. + * [using-directive] C++ namespaces. * [vla] C variable length arrays / DW_FORM_block / Fortran dynamic arrays. * [misc] Fix debuginfoless `return' (BZ 365111), fix command-line macros for expected GCC (BZ 479914), new testcase for valgrind (for BZ 483262), implement `info common' for Fortran, fix Fortran logical-kind=8 (BZ 465310), - fix static variable in C++ constructors (BZ 445912) + fix static variable in C++ constructors (BZ 445912), fix power7 (BZ 485319). - Upgrade to the FSF GDB gdb-6.8.50 snapshot. +- Fix parsing elf64-i386 files for kdump PAE vmcore dumps (BZ 457187). + - Turn on 64-bit BFD support, globally enable AC_SYS_LARGEFILE. * Tue Feb 24 2009 Fedora Release Engineering - 6.8.50.20090210-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild diff --git a/sources b/sources index 9222445..d211e26 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -4cde9c3dd1df54ec819af6407ec9d61b gdb-6.8.50.20090228.tar.bz2 +a8eae0d4ef955ebcecfc7511af31070a gdb-6.8.50.20090302.tar.bz2