diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 8d09e63..73d4f82 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -4,20 +4,20 @@ to install and uninstall. * gstack.sh, gstack.1: New files. -Index: gdb-6.8.50.20090802/gdb/Makefile.in +Index: gdb-6.8.91.20090917/gdb/Makefile.in =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/Makefile.in 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/Makefile.in 2009-08-03 11:09:49.000000000 +0200 -@@ -947,7 +947,7 @@ gdb.z:gdb.1 - # time it takes for make to check that all is up to date. - # install-only is intended to address that need. - install: all install-only --install-only: $(CONFIG_INSTALL) -+install-only: install-gstack $(CONFIG_INSTALL) +--- gdb-6.8.91.20090917.orig/gdb/Makefile.in 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/Makefile.in 2009-09-17 12:47:38.000000000 +0200 +@@ -989,7 +989,7 @@ install: all install-only + + # The "install-only" target also installs the syscalls' XML files in + # the system. +-install-only: $(CONFIG_INSTALL) xml-syscall-install ++install-only: install-gstack $(CONFIG_INSTALL) xml-syscall-install transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -979,9 +979,26 @@ install-tui: +@@ -1021,9 +1021,26 @@ install-tui: $(DESTDIR)$(man1dir) ; \ $(INSTALL_DATA) $(srcdir)/gdb.1 \ $(DESTDIR)$(man1dir)/$$transformed_name.1 @@ -45,7 +45,7 @@ Index: gdb-6.8.50.20090802/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1003,6 +1020,17 @@ uninstall-tui: +@@ -1045,6 +1062,17 @@ uninstall-tui: fi ; \ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ $(DESTDIR)$(man1dir)/$$transformed_name.1 @@ -63,10 +63,10 @@ Index: gdb-6.8.50.20090802/gdb/Makefile.in # The C++ name parser can be built standalone for testing. test-cp-name-parser.o: cp-name-parser.c -Index: gdb-6.8.50.20090802/gdb/gstack.sh +Index: gdb-6.8.91.20090917/gdb/gstack.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/gstack.sh 2009-08-03 11:08:52.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/gstack.sh 2009-09-17 12:47:14.000000000 +0200 @@ -0,0 +1,48 @@ +#!/bin/sh + diff --git a/gdb-6.3-ia64-sigtramp-fp-20050926.patch b/gdb-6.3-ia64-sigtramp-fp-20050926.patch deleted file mode 100644 index 8dbdac9..0000000 --- a/gdb-6.3-ia64-sigtramp-fp-20050926.patch +++ /dev/null @@ -1,163 +0,0 @@ -2005-09-27 Jeff Johnston - - * libunwind-frame.c (libunwind_frame_cache): Save the current - stack pointer in the cache. - (libunwind_sigtramp_frame_this_id): New function. - (libunwind_sigtramp_frame_unwind): New unwinder. - (libunwind_sigtramp_frame_sniffer): Return - libunwind_sigtramp_frame_unwind address. - * libunwind-frame.h (libunwind_sigtramp_frame_this_id): New - prototype. - * ia64-tdep.c (ia64_libunwind_sigtramp_frame_this_id): Calculate - the base address using the current stack pointer plus a fixed - offset. - -2007-10-14 Jan Kratochvil - - Port to GDB-6.7. - -2008-02-24 Jan Kratochvil - - Port to GDB-6.8pre. - -2008-04-16 Yi Zhan - - Fix a compilation error on a typo. - -Index: gdb-6.8.50.20090803/gdb/libunwind-frame.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/libunwind-frame.c 2009-01-03 06:57:52.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/libunwind-frame.c 2009-08-04 06:31:34.000000000 +0200 -@@ -62,6 +62,7 @@ static unw_word_t (*unw_find_dyn_list_p) - struct libunwind_frame_cache - { - CORE_ADDR base; -+ CORE_ADDR sp; - CORE_ADDR func_addr; - unw_cursor_t cursor; - unw_addr_space_t as; -@@ -134,6 +135,7 @@ libunwind_frame_cache (struct frame_info - unw_accessors_t *acc; - unw_addr_space_t as; - unw_word_t fp; -+ unw_word_t sp; - unw_regnum_t uw_sp_regnum; - struct libunwind_frame_cache *cache; - struct libunwind_descr *descr; -@@ -175,14 +177,30 @@ libunwind_frame_cache (struct frame_info - : __LITTLE_ENDIAN); - - unw_init_remote_p (&cache->cursor, as, this_frame); -+ -+ /* For the base address, we have a small problem. The majority -+ of the time, we can get the stack pointer of the previous -+ frame to use as a frame pointer. In the case where we have -+ a signal trampoline, the stack may change due to a sigaltstack -+ being set up. In that case, the normal mechanism will give us -+ an address in the regular stack which is not at the end of the -+ sigaltstack as we want. To handle this, we record the stack -+ address so the caller may calculate a more correct base address -+ to use. */ -+ uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (gdbarch)); -+ ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &sp); -+ if (ret < 0) -+ { -+ unw_destroy_addr_space_p (as); -+ error (_("Can't get libunwind sp register.")); -+ } -+ - if (unw_step_p (&cache->cursor) < 0) - { - unw_destroy_addr_space_p (as); - return NULL; - } - -- /* To get base address, get sp from previous frame. */ -- uw_sp_regnum = descr->gdb2uw (gdbarch_sp_regnum (gdbarch)); - ret = unw_get_reg_p (&cache->cursor, uw_sp_regnum, &fp); - if (ret < 0) - { -@@ -190,6 +208,7 @@ libunwind_frame_cache (struct frame_info - error (_("Can't get libunwind sp register.")); - } - -+ cache->sp = (CORE_ADDR)sp; - cache->base = (CORE_ADDR)fp; - cache->as = as; - -@@ -377,6 +396,31 @@ libunwind_search_unwind_table (void *as, - di, pi, need_unwind_info, args); - } - -+void -+libunwind_sigtramp_frame_this_id (struct frame_info *this_frame, -+ void **this_cache, -+ struct frame_id *this_id) -+{ -+ struct libunwind_frame_cache *cache = -+ libunwind_frame_cache (this_frame, this_cache); -+ -+ /* Unlike a regular frame, we can't use the normal frame pointer -+ mechanism because a sigaltstack may have been used. Instead, -+ we return the current stack pointer for the caller to use -+ to calculate the base address. */ -+ if (cache != NULL) -+ (*this_id) = frame_id_build (cache->sp, cache->func_addr); -+ else -+ (*this_id) = null_frame_id; -+} -+ -+static const struct frame_unwind libunwind_sigtramp_frame_unwind = -+{ -+ SIGTRAMP_FRAME, -+ libunwind_sigtramp_frame_this_id, -+ libunwind_frame_prev_register -+}; -+ - /* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */ - int - libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self, -Index: gdb-6.8.50.20090803/gdb/libunwind-frame.h -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/libunwind-frame.h 2009-01-03 06:57:52.000000000 +0100 -+++ gdb-6.8.50.20090803/gdb/libunwind-frame.h 2009-08-04 06:31:34.000000000 +0200 -@@ -52,6 +52,9 @@ void libunwind_frame_set_descr (struct g - - void libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache, - struct frame_id *this_id); -+void libunwind_sigtramp_frame_this_id (struct frame_info *this_frame, -+ void **this_cache, -+ struct frame_id *this_id); - struct value *libunwind_frame_prev_register (struct frame_info *this_frame, - void **this_cache, int regnum); - void libunwind_frame_dealloc_cache (struct frame_info *self, void *cache); -Index: gdb-6.8.50.20090803/gdb/ia64-tdep.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/ia64-tdep.c 2009-08-04 06:30:45.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/ia64-tdep.c 2009-08-04 06:31:34.000000000 +0200 -@@ -3023,7 +3023,7 @@ ia64_libunwind_sigtramp_frame_this_id (s - struct frame_id id; - CORE_ADDR prev_ip; - -- libunwind_frame_this_id (this_frame, this_cache, &id); -+ libunwind_sigtramp_frame_this_id (this_frame, this_cache, &id); - if (frame_id_eq (id, null_frame_id)) - { - (*this_id) = null_frame_id; -@@ -3035,8 +3035,14 @@ ia64_libunwind_sigtramp_frame_this_id (s - get_frame_register (this_frame, IA64_BSP_REGNUM, buf); - bsp = extract_unsigned_integer (buf, 8, byte_order); - -- /* For a sigtramp frame, we don't make the check for previous ip being 0. */ -- (*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp); -+ /* For a sigtramp frame, we don't make the check for previous ip being 0. -+ We also must calculate the frame pointer because libunwind will give -+ us back the current stack pointer instead of the frame pointer since -+ it cannot figure this out when in a sigaltstack. We make a basic -+ assumption of 16 (default size) + 8 bytes for sigcontext address. -+ FIXME: if libunwind were to export the frame pointer address, we -+ could eliminate the assumption and get the actual value. */ -+ (*this_id) = frame_id_build_special (id.stack_addr + 24, id.code_addr, bsp); - - if (gdbarch_debug >= 1) - fprintf_unfiltered (gdb_stdlog, diff --git a/gdb-6.3-ia64-sigtramp-frame-20050708.patch b/gdb-6.3-ia64-sigtramp-frame-20050708.patch index 243b80c..6127ff9 100644 --- a/gdb-6.3-ia64-sigtramp-frame-20050708.patch +++ b/gdb-6.3-ia64-sigtramp-frame-20050708.patch @@ -13,11 +13,11 @@ Port to gdb-6.8.50.20081128, follow the upstream change: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ia64-tdep.c.diff?cvsroot=src&r1=1.176&r2=1.177 -Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c +Index: gdb-6.8.50.20090818/gdb/ia64-tdep.c =================================================================== ---- gdb-6.8.50.20081128.orig/gdb/ia64-tdep.c 2008-11-26 06:27:48.000000000 +0100 -+++ gdb-6.8.50.20081128/gdb/ia64-tdep.c 2008-12-02 19:04:32.000000000 +0100 -@@ -2107,6 +2107,94 @@ ia64_sigtramp_frame_prev_register (struc +--- gdb-6.8.50.20090818.orig/gdb/ia64-tdep.c 2009-07-30 18:29:53.000000000 +0200 ++++ gdb-6.8.50.20090818/gdb/ia64-tdep.c 2009-08-24 17:03:11.000000000 +0200 +@@ -2153,6 +2153,94 @@ ia64_sigtramp_frame_prev_register (struc return frame_unwind_got_constant (this_frame, regnum, pc); } @@ -29,7 +29,7 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c + ULONGEST unatN_val; + ULONGEST unat; + read_memory (cache->saved_regs[IA64_UNAT_REGNUM], (char *) &unat, -+ register_size (current_gdbarch, IA64_UNAT_REGNUM)); ++ register_size (gdbarch, IA64_UNAT_REGNUM)); + unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0; + return frame_unwind_got_constant (this_frame, regnum, unatN_val); + } @@ -45,9 +45,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c + CORE_ADDR gr_addr = 0, nat_addr = 0; + + read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp, -+ register_size (current_gdbarch, IA64_BSP_REGNUM)); ++ register_size (gdbarch, IA64_BSP_REGNUM)); + read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm, -+ register_size (current_gdbarch, IA64_CFM_REGNUM)); ++ register_size (gdbarch, IA64_CFM_REGNUM)); + + /* The bsp points at the end of the register frame so we + subtract the size of frame from it to get start of register frame. */ @@ -71,10 +71,10 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c + nat_addr = cache->saved_regs[IA64_RNAT_REGNUM]; + if (nat_addr != 0) + read_memory (nat_addr, (char *) &nat_collection, -+ register_size (current_gdbarch, IA64_RNAT_REGNUM)); ++ register_size (gdbarch, IA64_RNAT_REGNUM)); + } + else -+ nat_collection = read_memory_integer (nat_addr, 8); ++ nat_collection = read_memory_integer (nat_addr, 8, byte_order); + if (nat_addr != 0) + { + nat_bit = (gr_addr >> 3) & 0x3f; @@ -97,9 +97,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c + ULONGEST bof; + + read_memory (cache->saved_regs[IA64_BSP_REGNUM], (char *) &bsp, -+ register_size (current_gdbarch, IA64_BSP_REGNUM)); ++ register_size (gdbarch, IA64_BSP_REGNUM)); + read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm, -+ register_size (current_gdbarch, IA64_CFM_REGNUM)); ++ register_size (gdbarch, IA64_CFM_REGNUM)); + + /* The bsp points at the end of the register frame so we + subtract the size of frame from it to get beginning of frame. */ @@ -112,7 +112,7 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c else if ((regnum >= IA64_GR32_REGNUM && regnum <= IA64_GR127_REGNUM) || (regnum >= V32_REGNUM && regnum <= V127_REGNUM)) { -@@ -2121,7 +2209,42 @@ ia64_sigtramp_frame_prev_register (struc +@@ -2167,7 +2255,42 @@ ia64_sigtramp_frame_prev_register (struc return frame_unwind_got_constant (this_frame, regnum, 0); } @@ -133,9 +133,9 @@ Index: gdb-6.8.50.20081128/gdb/ia64-tdep.c + ULONGEST cfm; + ULONGEST prN_val; + read_memory (pr_addr, (char *) &pr, -+ register_size (current_gdbarch, IA64_PR_REGNUM)); ++ register_size (gdbarch, IA64_PR_REGNUM)); + read_memory (cache->saved_regs[IA64_CFM_REGNUM], (char *) &cfm, -+ register_size (current_gdbarch, IA64_CFM_REGNUM)); ++ register_size (gdbarch, IA64_CFM_REGNUM)); + + /* Get the register rename base for this frame and adjust the + * register name to take rotation into account. */ diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch index 0abf47e..da6e3e7 100644 --- a/gdb-6.3-inheritancetest-20050726.patch +++ b/gdb-6.3-inheritancetest-20050726.patch @@ -5,8 +5,10 @@ * gdb.cp/b146835b.cc: Ditto. * gdb.cp/b146835.h: Ditto. ---- gdb-6.3/gdb/testsuite/gdb.cp/b146835b.cc.fix3 2005-07-26 16:47:12.000000000 -0400 -+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835b.cc 2005-07-26 16:53:31.000000000 -0400 +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835b.cc 2009-08-12 06:07:50.000000000 +0200 @@ -0,0 +1,11 @@ +#include "b146835.h" + @@ -19,8 +21,10 @@ +void A::funcD (class E *e, class D *d) {} +void A::funcE (E *e, D *d) {} +void A::funcF (unsigned long x, D *d) {} ---- gdb-6.3/gdb/testsuite/gdb.cp/b146835.cc.fix3 2005-07-26 16:47:20.000000000 -0400 -+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.cc 2005-07-26 16:46:50.000000000 -0400 +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.cc 2009-08-12 06:07:50.000000000 +0200 @@ -0,0 +1,32 @@ +#include "b146835.h" +#include @@ -54,9 +58,11 @@ + f.foo(); +} + ---- gdb-6.3/gdb/testsuite/gdb.cp/b146835.exp.fix3 2005-07-26 16:47:26.000000000 -0400 -+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.exp 2005-07-26 16:46:50.000000000 -0400 -@@ -0,0 +1,55 @@ +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.exp 2009-08-12 06:58:28.000000000 +0200 +@@ -0,0 +1,54 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2005 Free Software Foundation, Inc. @@ -110,10 +116,11 @@ +gdb_continue_to_breakpoint "First line foo" + +# Verify that we can access the inherited member d -+gdb_test "p d" ".*(struct D \*.).*0x0" "Verify inherited member d accessible" -+ ---- gdb-6.3/gdb/testsuite/gdb.cp/b146835.h.fix3 2005-07-26 16:47:36.000000000 -0400 -+++ gdb-6.3/gdb/testsuite/gdb.cp/b146835.h 2005-07-26 16:53:18.000000000 -0400 ++gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible" +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.cp/b146835.h 2009-08-12 06:07:50.000000000 +0200 @@ -0,0 +1,36 @@ + +class A { diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch index 51c5fb9..aa1e80a 100644 --- a/gdb-6.3-large-core-20051206.patch +++ b/gdb-6.3-large-core-20051206.patch @@ -25,10 +25,10 @@ Port to GDB-6.7. -Index: gdb-6.8.50.20090803/gdb/symfile-mem.c +Index: gdb-6.8.50.20090909/gdb/symfile-mem.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/symfile-mem.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/symfile-mem.c 2009-08-03 16:03:17.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/symfile-mem.c 2009-07-02 19:21:06.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/symfile-mem.c 2009-09-09 19:06:57.000000000 +0200 @@ -56,6 +56,14 @@ #include "elf/common.h" @@ -53,10 +53,10 @@ Index: gdb-6.8.50.20090803/gdb/symfile-mem.c if (nbfd == NULL) error (_("Failed to read a valid object file image from memory.")); -Index: gdb-6.8.50.20090803/gdb/target.c +Index: gdb-6.8.50.20090909/gdb/target.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/target.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/target.c 2009-08-03 16:03:17.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/target.c 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/target.c 2009-09-09 19:08:11.000000000 +0200 @@ -59,7 +59,7 @@ static int nosymbol (char *, CORE_ADDR * static void tcomplain (void) ATTR_NORETURN; @@ -66,7 +66,7 @@ Index: gdb-6.8.50.20090803/gdb/target.c static int return_zero (void); -@@ -452,7 +452,7 @@ target_terminal_inferior (void) +@@ -492,7 +492,7 @@ target_terminal_inferior (void) (*current_target.to_terminal_inferior) (); } @@ -75,7 +75,7 @@ Index: gdb-6.8.50.20090803/gdb/target.c nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write, struct target_ops *t) { -@@ -670,7 +670,7 @@ update_current_target (void) +@@ -711,7 +711,7 @@ update_current_target (void) (void (*) (struct regcache *)) noprocess); de_fault (deprecated_xfer_memory, @@ -84,7 +84,7 @@ Index: gdb-6.8.50.20090803/gdb/target.c nomemory); de_fault (to_files_info, (void (*) (struct target_ops *)) -@@ -1381,7 +1381,7 @@ target_xfer_partial (struct target_ops * +@@ -1443,7 +1443,7 @@ target_xfer_partial (struct target_ops * it makes no progress, and then return how much was transferred). */ int @@ -93,7 +93,16 @@ Index: gdb-6.8.50.20090803/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -1394,7 +1394,7 @@ target_read_memory (CORE_ADDR memaddr, g +@@ -1459,7 +1459,7 @@ target_read_memory (CORE_ADDR memaddr, g + the target's stack. This may trigger different cache behavior. */ + + int +-target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len) ++target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len) + { + /* Dispatch to the topmost target, not the flattened current_target. + Memory accesses check target->to_has_(all_)memory, and the +@@ -1473,7 +1473,7 @@ target_read_stack (CORE_ADDR memaddr, gd } int @@ -102,7 +111,7 @@ Index: gdb-6.8.50.20090803/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -2861,8 +2861,8 @@ debug_to_prepare_to_store (struct regcac +@@ -2964,8 +2964,8 @@ debug_to_prepare_to_store (struct regcac fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); } @@ -113,7 +122,7 @@ Index: gdb-6.8.50.20090803/gdb/target.c int write, struct mem_attrib *attrib, struct target_ops *target) { -@@ -2872,8 +2872,8 @@ deprecated_debug_xfer_memory (CORE_ADDR +@@ -2975,8 +2975,8 @@ deprecated_debug_xfer_memory (CORE_ADDR attrib, target); fprintf_unfiltered (gdb_stdlog, @@ -124,11 +133,11 @@ Index: gdb-6.8.50.20090803/gdb/target.c write ? "write" : "read", retval); if (retval > 0) -Index: gdb-6.8.50.20090803/gdb/target.h +Index: gdb-6.8.50.20090909/gdb/target.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/target.h 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/target.h 2009-08-03 16:03:17.000000000 +0200 -@@ -363,10 +363,10 @@ struct target_ops +--- gdb-6.8.50.20090909.orig/gdb/target.h 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/target.h 2009-09-09 19:07:36.000000000 +0200 +@@ -366,10 +366,10 @@ struct target_ops NOTE: cagney/2004-10-01: This has been entirely superseeded by to_xfer_partial and inferior inheritance. */ @@ -143,53 +152,58 @@ Index: gdb-6.8.50.20090803/gdb/target.h void (*to_files_info) (struct target_ops *); int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); -@@ -675,10 +675,10 @@ extern DCACHE *target_dcache; +@@ -680,12 +680,12 @@ extern void target_dcache_invalidate (vo extern int target_read_string (CORE_ADDR, char **, int, int *); -extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len); +extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len); +-extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len); ++extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len); + extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, - int len); + LONGEST len); /* Fetches the target's memory map. If one is found it is sorted and returned, after some consistency checking. Otherwise, NULL -Index: gdb-6.8.50.20090803/gdb/dcache.c +Index: gdb-6.8.50.20090909/gdb/dcache.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/dcache.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/dcache.c 2009-08-03 16:03:17.000000000 +0200 -@@ -524,9 +524,9 @@ dcache_free (DCACHE *dcache) +--- gdb-6.8.50.20090909.orig/gdb/dcache.c 2009-08-31 22:18:45.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/dcache.c 2009-09-09 19:09:21.000000000 +0200 +@@ -390,10 +390,10 @@ dcache_free (DCACHE *dcache) - This routine is indended to be called by remote_xfer_ functions. */ + The meaning of the result is the same as for target_write. */ -int +LONGEST - dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, + dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache, + CORE_ADDR memaddr, gdb_byte *myaddr, - int len, int should_write) + LONGEST len, int should_write) { int i; - int (*xfunc) (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr); -Index: gdb-6.8.50.20090803/gdb/dcache.h + int res; +Index: gdb-6.8.50.20090909/gdb/dcache.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/dcache.h 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/dcache.h 2009-08-03 16:03:17.000000000 +0200 -@@ -35,7 +35,7 @@ void dcache_free (DCACHE *); +--- gdb-6.8.50.20090909.orig/gdb/dcache.h 2009-08-31 22:18:45.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/dcache.h 2009-09-09 19:08:54.000000000 +0200 +@@ -35,8 +35,8 @@ void dcache_free (DCACHE *); /* Simple to call from _xfer_memory */ --int dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my, -- int len, int should_write); -+LONGEST dcache_xfer_memory (DCACHE *cache, CORE_ADDR mem, gdb_byte *my, -+ LONGEST len, int should_write); +-int dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem, +- gdb_byte *my, int len, int should_write); ++LONGEST dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem, ++ gdb_byte *my, LONGEST len, int should_write); - #endif /* DCACHE_H */ -Index: gdb-6.8.50.20090803/gdb/exec.c + void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, + int len); +Index: gdb-6.8.50.20090909/gdb/exec.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/exec.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/exec.c 2009-08-03 16:03:17.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/exec.c 2009-07-02 19:21:06.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/exec.c 2009-09-09 19:06:57.000000000 +0200 @@ -560,7 +560,7 @@ map_vmap (bfd *abfd, bfd *arch) } @@ -199,11 +213,11 @@ Index: gdb-6.8.50.20090803/gdb/exec.c section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len, struct target_section *sections, -Index: gdb-6.8.50.20090803/gdb/linux-nat.c +Index: gdb-6.8.50.20090909/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 16:03:17.000000000 +0200 -@@ -4516,7 +4516,7 @@ linux_xfer_partial (struct target_ops *o +--- gdb-6.8.50.20090909.orig/gdb/linux-nat.c 2009-09-09 19:06:46.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/linux-nat.c 2009-09-09 19:06:57.000000000 +0200 +@@ -4622,7 +4622,7 @@ linux_xfer_partial (struct target_ops *o #endif if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL) { /* This region contains ia64 rse registers, we have to re-read. */ @@ -212,10 +226,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c /* Re-read register stack area. */ xxfer = super_xfer_partial (ops, object, annex, -Index: gdb-6.8.50.20090803/gdb/remote.c +Index: gdb-6.8.50.20090909/gdb/remote.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/remote.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/remote.c 2009-08-03 16:03:17.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/remote.c 2009-08-18 18:17:16.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/remote.c 2009-09-09 19:06:57.000000000 +0200 @@ -25,6 +25,7 @@ #include "gdb_string.h" #include @@ -224,7 +238,7 @@ Index: gdb-6.8.50.20090803/gdb/remote.c #include "inferior.h" #include "bfd.h" #include "symfile.h" -@@ -5785,12 +5786,19 @@ handle_notification (char *buf, size_t l +@@ -5764,12 +5765,19 @@ handle_notification (char *buf, size_t l if SHOULD_WRITE is nonzero. Returns length of data written or read; 0 for error. TARGET is unused. */ @@ -246,7 +260,7 @@ Index: gdb-6.8.50.20090803/gdb/remote.c set_general_thread (inferior_ptid); -@@ -5799,7 +5807,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, +@@ -5778,7 +5786,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, else res = remote_read_bytes (mem_addr, buffer, mem_len); @@ -255,10 +269,10 @@ Index: gdb-6.8.50.20090803/gdb/remote.c } /* Sends a packet with content determined by the printf format string -Index: gdb-6.8.50.20090803/gdb/remote-sim.c +Index: gdb-6.8.50.20090909/gdb/remote-sim.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/remote-sim.c 2009-08-03 16:03:00.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/remote-sim.c 2009-08-03 16:03:17.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/remote-sim.c 2009-07-02 19:21:06.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/remote-sim.c 2009-09-09 19:06:57.000000000 +0200 @@ -752,11 +752,14 @@ gdbsim_prepare_to_store (struct regcache Returns the number of bytes transferred. */ @@ -276,10 +290,10 @@ Index: gdb-6.8.50.20090803/gdb/remote-sim.c /* If no program is running yet, then ignore the simulator for memory. Pass the request down to the next target, hopefully an exec file. */ -Index: gdb-6.8.50.20090803/gdb/exec.h +Index: gdb-6.8.50.20090909/gdb/exec.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/exec.h 2009-06-12 20:38:36.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/exec.h 2009-08-03 16:03:57.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/exec.h 2009-06-12 20:38:36.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/exec.h 2009-09-09 19:06:57.000000000 +0200 @@ -56,7 +56,7 @@ extern int resize_section_table (struct One, and only one, of readbuf or writebuf must be non-NULL. */ diff --git a/gdb-6.3-pie-20050110.patch b/gdb-6.3-pie-20050110.patch index ea42d95..908786f 100644 --- a/gdb-6.3-pie-20050110.patch +++ b/gdb-6.3-pie-20050110.patch @@ -26,10 +26,10 @@ Fix scan_dyntag() for binaries provided by valgrind (BZ 460319). -Index: gdb-6.8.50.20090809/gdb/amd64-tdep.c +Index: gdb-6.8.91.20090917/gdb/amd64-tdep.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/amd64-tdep.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/amd64-tdep.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/amd64-tdep.c 2009-09-17 12:48:49.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/amd64-tdep.c 2009-09-17 12:50:07.000000000 +0200 @@ -36,6 +36,7 @@ #include "regcache.h" #include "regset.h" @@ -138,10 +138,10 @@ Index: gdb-6.8.50.20090809/gdb/amd64-tdep.c return pc; } -Index: gdb-6.8.50.20090809/gdb/auxv.c +Index: gdb-6.8.91.20090917/gdb/auxv.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/auxv.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/auxv.c 2009-07-02 19:25:52.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/auxv.c 2009-09-17 12:50:07.000000000 +0200 @@ -78,7 +78,7 @@ procfs_xfer_auxv (struct target_ops *ops Return 1 if an entry was read into *TYPEP and *VALP. */ static int @@ -230,10 +230,10 @@ Index: gdb-6.8.50.20090809/gdb/auxv.c break; } -Index: gdb-6.8.50.20090809/gdb/auxv.h +Index: gdb-6.8.91.20090917/gdb/auxv.h =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/auxv.h 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/auxv.h 2009-06-07 21:07:08.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/auxv.h 2009-09-17 12:50:07.000000000 +0200 @@ -31,14 +31,14 @@ Return 1 if an entry was read into *TYPEP and *VALP. */ extern int target_auxv_parse (struct target_ops *ops, @@ -251,11 +251,11 @@ Index: gdb-6.8.50.20090809/gdb/auxv.h /* Print the contents of the target's AUXV on the specified file. */ extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops); -Index: gdb-6.8.50.20090809/gdb/dwarf2read.c +Index: gdb-6.8.91.20090917/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/dwarf2read.c 2009-08-10 14:59:28.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/dwarf2read.c 2009-08-10 14:59:58.000000000 +0200 -@@ -1659,7 +1659,7 @@ dwarf2_build_psymtabs (struct objfile *o +--- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:49:20.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:50:07.000000000 +0200 +@@ -1717,7 +1717,7 @@ dwarf2_build_psymtabs (struct objfile *o dwarf2_read_section (objfile, &dwarf2_per_objfile->eh_frame); dwarf2_read_section (objfile, &dwarf2_per_objfile->frame); @@ -264,10 +264,10 @@ Index: gdb-6.8.50.20090809/gdb/dwarf2read.c || (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)) { -Index: gdb-6.8.50.20090809/gdb/elfread.c +Index: gdb-6.8.91.20090917/gdb/elfread.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/elfread.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/elfread.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/elfread.c 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/elfread.c 2009-09-17 12:50:07.000000000 +0200 @@ -681,7 +681,7 @@ elf_symfile_read (struct objfile *objfil /* If we are reinitializing, or if we have never loaded syms yet, set table to empty. MAINLINE is cleared so that *_read_psymtab @@ -277,11 +277,11 @@ Index: gdb-6.8.50.20090809/gdb/elfread.c { init_psymbol_list (objfile, 0); mainline = 0; -Index: gdb-6.8.50.20090809/gdb/infrun.c +Index: gdb-6.8.91.20090917/gdb/infrun.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/infrun.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/infrun.c 2009-08-10 14:59:58.000000000 +0200 -@@ -3531,6 +3531,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( +--- gdb-6.8.91.20090917.orig/gdb/infrun.c 2009-09-17 12:48:50.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/infrun.c 2009-09-17 12:50:07.000000000 +0200 +@@ -3659,6 +3659,10 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( #endif target_terminal_inferior (); @@ -292,13 +292,13 @@ Index: gdb-6.8.50.20090809/gdb/infrun.c /* If requested, stop when the dynamic linker notifies gdb of events. This allows the user to get control and place breakpoints in initializer routines for -Index: gdb-6.8.50.20090809/gdb/objfiles.c +Index: gdb-6.8.91.20090917/gdb/objfiles.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/objfiles.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/objfiles.c 2009-08-10 14:59:58.000000000 +0200 -@@ -52,6 +52,9 @@ - #include "exec.h" +--- gdb-6.8.91.20090917.orig/gdb/objfiles.c 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/objfiles.c 2009-09-17 12:50:20.000000000 +0200 +@@ -53,6 +53,9 @@ #include "observer.h" + #include "complaints.h" +#include "auxv.h" +#include "elf/common.h" @@ -306,7 +306,7 @@ Index: gdb-6.8.50.20090809/gdb/objfiles.c /* Prototypes for local functions */ static void objfile_alloc_data (struct objfile *objfile); -@@ -279,9 +282,17 @@ init_entry_point_info (struct objfile *o +@@ -280,9 +283,17 @@ init_entry_point_info (struct objfile *o CORE_ADDR entry_point_address (void) { @@ -324,20 +324,10 @@ Index: gdb-6.8.50.20090809/gdb/objfiles.c if (symfile_objfile == NULL) return 0; -@@ -465,6 +476,9 @@ free_objfile (struct objfile *objfile) - if (objfile == symfile_objfile) - symfile_objfile = NULL; - -+ if (objfile == symfile_objfile) -+ symfile_objfile = NULL; -+ - /* Before the symbol table code was redone to make it easier to - selectively load and remove information particular to a specific - linkage unit, gdb used to do these things whenever the monolithic -Index: gdb-6.8.50.20090809/gdb/solib-svr4.c +Index: gdb-6.8.91.20090917/gdb/solib-svr4.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/solib-svr4.c 2009-08-10 14:56:11.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/solib-svr4.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/solib-svr4.c 2009-09-17 12:48:50.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/solib-svr4.c 2009-09-17 12:50:07.000000000 +0200 @@ -47,6 +47,7 @@ #include "exec.h" #include "auxv.h" @@ -905,16 +895,17 @@ Index: gdb-6.8.50.20090809/gdb/solib-svr4.c xfree (interp_name); return 1; } -@@ -1753,6 +2022,8 @@ svr4_solib_create_inferior_hook (void) +@@ -1753,6 +2022,9 @@ svr4_solib_create_inferior_hook (void) while (tp->stop_signal != TARGET_SIGNAL_TRAP); inf->stop_soon = NO_STOP_QUIETLY; #endif /* defined(_SCO_DS) */ + -+ disable_breakpoints_before_startup (); ++ if (bfd_get_start_address (exec_bfd) != entry_point_address ()) ++ disable_breakpoints_before_startup (); } static void -@@ -1929,6 +2200,76 @@ svr4_lp64_fetch_link_map_offsets (void) +@@ -1929,6 +2201,76 @@ svr4_lp64_fetch_link_map_offsets (void) return lmp; } @@ -991,7 +982,7 @@ Index: gdb-6.8.50.20090809/gdb/solib-svr4.c struct target_so_ops svr4_so_ops; -@@ -1969,4 +2310,7 @@ _initialize_svr4_solib (void) +@@ -1969,4 +2311,7 @@ _initialize_svr4_solib (void) svr4_so_ops.same = svr4_same; observer_attach_inferior_exit (solib_svr4_inferior_exit); @@ -999,11 +990,11 @@ Index: gdb-6.8.50.20090809/gdb/solib-svr4.c + add_info ("linkmap", info_linkmap_command, + "Display the inferior's linkmap."); } -Index: gdb-6.8.50.20090809/gdb/solib.c +Index: gdb-6.8.91.20090917/gdb/solib.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/solib.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/solib.c 2009-08-10 15:07:13.000000000 +0200 -@@ -81,6 +81,8 @@ set_solib_ops (struct gdbarch *gdbarch, +--- gdb-6.8.91.20090917.orig/gdb/solib.c 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/solib.c 2009-09-17 12:50:07.000000000 +0200 +@@ -82,6 +82,8 @@ set_solib_ops (struct gdbarch *gdbarch, /* external data declarations */ @@ -1012,7 +1003,7 @@ Index: gdb-6.8.50.20090809/gdb/solib.c /* FIXME: gdbarch needs to control this variable, or else every configuration needs to call set_solib_ops. */ struct target_so_ops *current_target_so_ops; -@@ -104,6 +106,8 @@ The search path for loading non-absolute +@@ -105,6 +107,8 @@ The search path for loading non-absolute value); } @@ -1021,7 +1012,7 @@ Index: gdb-6.8.50.20090809/gdb/solib.c /* GLOBAL FUNCTION -@@ -453,14 +453,38 @@ symbol_add_stub (struct so_list *so, int +@@ -449,14 +453,38 @@ symbol_add_stub (struct so_list *so, int /* Have we already loaded this shared object? */ ALL_OBJFILES (so->objfile) { @@ -1059,10 +1050,10 @@ Index: gdb-6.8.50.20090809/gdb/solib.c + else + so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED); + - p_refcount = xmalloc (sizeof (*p_refcount)); - *p_refcount = 2; /* Both solib and objfile refer to this abfd. */ - bfd_usrdata (so->abfd) = p_refcount; -@@ -600,6 +628,10 @@ update_solib_list (int from_tty, struct + free_section_addr_info (sap); + + return; +@@ -596,6 +624,10 @@ update_solib_list (int from_tty, struct } else { @@ -1073,7 +1064,7 @@ Index: gdb-6.8.50.20090809/gdb/solib.c if (! strcmp (gdb->so_original_name, i->so_original_name)) break; } -@@ -654,18 +686,7 @@ update_solib_list (int from_tty, struct +@@ -650,18 +682,7 @@ update_solib_list (int from_tty, struct /* Fill in the rest of each of the `struct so_list' nodes. */ for (i = inferior; i; i = i->next) { @@ -1093,7 +1084,7 @@ Index: gdb-6.8.50.20090809/gdb/solib.c /* Notify any observer that the shared object has been loaded now that we've added it to GDB's tables. */ -@@ -775,6 +796,32 @@ solib_add (char *pattern, int from_tty, +@@ -771,6 +792,32 @@ solib_add (char *pattern, int from_tty, } } @@ -1126,7 +1117,7 @@ Index: gdb-6.8.50.20090809/gdb/solib.c /* -@@ -1128,4 +1175,12 @@ This takes precedence over the environme +@@ -1189,4 +1236,12 @@ This takes precedence over the environme reload_shared_libraries, show_solib_search_path, &setlist, &showlist); @@ -1139,10 +1130,10 @@ Index: gdb-6.8.50.20090809/gdb/solib.c + NULL, NULL, + &setdebuglist, &showdebuglist); } -Index: gdb-6.8.50.20090809/gdb/solist.h +Index: gdb-6.8.91.20090917/gdb/solist.h =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/solist.h 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/solist.h 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/solist.h 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/solist.h 2009-09-17 12:50:07.000000000 +0200 @@ -61,6 +61,8 @@ struct so_list bfd *abfd; char symbols_loaded; /* flag: symbols read in yet? */ @@ -1163,10 +1154,10 @@ Index: gdb-6.8.50.20090809/gdb/solist.h +extern int debug_solib; + #endif -Index: gdb-6.8.50.20090809/gdb/symfile-mem.c +Index: gdb-6.8.91.20090917/gdb/symfile-mem.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/symfile-mem.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/symfile-mem.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/symfile-mem.c 2009-09-17 12:48:49.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/symfile-mem.c 2009-09-17 12:50:07.000000000 +0200 @@ -115,7 +115,7 @@ symbol_file_add_from_memory (struct bfd ++i; } @@ -1176,10 +1167,10 @@ Index: gdb-6.8.50.20090809/gdb/symfile-mem.c sai, OBJF_SHARED); /* This might change our ideas about frames already looked at. */ -Index: gdb-6.8.50.20090809/gdb/symfile.c +Index: gdb-6.8.91.20090917/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/symfile.c 2009-08-10 14:59:28.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/symfile.c 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/symfile.c 2009-09-17 12:48:50.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/symfile.c 2009-09-17 12:50:07.000000000 +0200 @@ -49,6 +49,7 @@ #include "readline/readline.h" #include "gdb_assert.h" @@ -1188,7 +1179,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c #include "observer.h" #include "exec.h" #include "parser-defs.h" -@@ -785,7 +786,7 @@ syms_from_objfile (struct objfile *objfi +@@ -779,7 +780,7 @@ syms_from_objfile (struct objfile *objfi /* Now either addrs or offsets is non-zero. */ @@ -1197,7 +1188,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c { /* We will modify the main symbol table, make sure that all its users will be cleaned up if an error occurs during symbol reading. */ -@@ -813,7 +814,7 @@ syms_from_objfile (struct objfile *objfi +@@ -807,7 +808,7 @@ syms_from_objfile (struct objfile *objfi We no longer warn if the lowest section is not a text segment (as happens for the PA64 port. */ @@ -1206,7 +1197,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c { asection *lower_sect; asection *sect; -@@ -896,7 +897,7 @@ syms_from_objfile (struct objfile *objfi +@@ -890,7 +891,7 @@ syms_from_objfile (struct objfile *objfi init_objfile_sect_indices (objfile); } @@ -1215,7 +1206,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* Discard cleanups as symbol reading was successful. */ -@@ -915,17 +916,22 @@ new_symfile_objfile (struct objfile *obj +@@ -909,17 +910,22 @@ new_symfile_objfile (struct objfile *obj /* If this is the main symbol file we have to clean up all users of the old main symbol file. Otherwise it is sufficient to fixup all the breakpoints that may have been redefined by this symbol file. */ @@ -1240,7 +1231,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* We're done reading the symbol file; finish off complaints. */ clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE); -@@ -982,7 +988,7 @@ symbol_file_add_with_addrs_or_offsets (b +@@ -973,7 +979,7 @@ symbol_file_add_with_addrs_or_offsets (b /* Give user a chance to burp if we'd be interactively wiping out any existing symbols. */ @@ -1249,7 +1240,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c && (have_full_symbols () || have_partial_symbols ()) && from_tty && (have_full_symbols () || have_partial_symbols ()) -@@ -1183,6 +1189,9 @@ symbol_file_clear (int from_tty) +@@ -1163,6 +1169,9 @@ symbol_file_clear (int from_tty) symfile_objfile->name) : !query (_("Discard symbol table? ")))) error (_("Not confirmed.")); @@ -1259,7 +1250,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c free_all_objfiles (); -@@ -3387,6 +3396,8 @@ reread_symbols (void) +@@ -3369,6 +3378,8 @@ reread_symbols (void) /* Discard cleanups as symbol reading was successful. */ discard_cleanups (old_cleanups); @@ -1268,11 +1259,11 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* If the mtime has changed between the time we set new_modtime and now, we *want* this to be out of date, so don't call stat again now. */ -Index: gdb-6.8.50.20090809/gdb/target.h +Index: gdb-6.8.91.20090917/gdb/target.h =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/target.h 2009-08-10 14:59:28.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/target.h 2009-08-10 14:59:58.000000000 +0200 -@@ -524,7 +524,7 @@ struct target_ops +--- gdb-6.8.91.20090917.orig/gdb/target.h 2009-09-17 12:48:49.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/target.h 2009-09-17 12:50:07.000000000 +0200 +@@ -545,7 +545,7 @@ struct target_ops Return -1 if there is insufficient buffer for a whole entry. Return 1 if an entry was read into *TYPEP and *VALP. */ int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr, @@ -1281,10 +1272,10 @@ Index: gdb-6.8.50.20090809/gdb/target.h /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the sequence of bytes in PATTERN with length PATTERN_LEN. -Index: gdb-6.8.50.20090809/gdb/symfile.h +Index: gdb-6.8.91.20090917/gdb/symfile.h =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/symfile.h 2009-08-10 14:59:28.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/symfile.h 2009-08-10 14:59:58.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/symfile.h 2009-09-17 12:48:50.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/symfile.h 2009-09-17 12:50:07.000000000 +0200 @@ -229,7 +229,13 @@ enum symfile_add_flags SYMFILE_MAINLINE = 1 << 2, @@ -1300,3 +1291,29 @@ Index: gdb-6.8.50.20090809/gdb/symfile.h }; extern void syms_from_objfile (struct objfile *, +Index: gdb-6.8.91.20090917/gdb/infcmd.c +=================================================================== +--- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:50:07.000000000 +0200 +@@ -2308,6 +2308,9 @@ attach_command_post_wait (char *args, in + + post_create_inferior (¤t_target, from_tty); + ++ /* Undo the disable from post_create_inferior. */ ++ enable_breakpoints_after_startup (); ++ + /* Install inferior's terminal modes. */ + target_terminal_inferior (); + +Index: gdb-6.8.91.20090917/gdb/linux-tdep.c +=================================================================== +--- gdb-6.8.91.20090917.orig/gdb/linux-tdep.c 2009-08-04 22:41:13.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/linux-tdep.c 2009-09-17 12:50:07.000000000 +0200 +@@ -163,5 +163,7 @@ in this session.\n")); + void + _initialize_linux_tdep (void) + { ++#if 0 /* gdb-6.3-pie-20050110.patch */ + observer_attach_executable_changed (check_is_pie_binary); ++#endif + } diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index f6aa625..e12f74f 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.20090802/gdb/doc/gdb.texinfo +Index: gdb-6.8.50.20090811/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/doc/gdb.texinfo 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/doc/gdb.texinfo 2009-08-03 12:29:58.000000000 +0200 +--- gdb-6.8.50.20090811.orig/gdb/doc/gdb.texinfo 2009-08-13 10:14:15.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/doc/gdb.texinfo 2009-08-13 10:14:18.000000000 +0200 @@ -991,6 +991,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.20090802/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-6.8.50.20090802/gdb/main.c +Index: gdb-6.8.50.20090811/gdb/main.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/main.c 2009-08-03 12:29:03.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/main.c 2009-08-03 12:29:58.000000000 +0200 +--- gdb-6.8.50.20090811.orig/gdb/main.c 2009-08-13 10:14:15.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/main.c 2009-08-13 10:14:18.000000000 +0200 @@ -382,6 +382,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, @@ -48,11 +48,11 @@ Index: gdb-6.8.50.20090802/gdb/main.c "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-6.8.50.20090802/gdb/symfile.c +Index: gdb-6.8.50.20090811/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/symfile.c 2009-08-03 12:28:14.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/symfile.c 2009-08-03 12:29:58.000000000 +0200 -@@ -78,6 +78,7 @@ static void clear_symtab_users_cleanup ( +--- gdb-6.8.50.20090811.orig/gdb/symfile.c 2009-08-13 10:14:15.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/symfile.c 2009-08-13 10:14:18.000000000 +0200 +@@ -79,6 +79,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file */ int readnow_symbol_files; /* Read full symbols immediately */ @@ -60,19 +60,19 @@ Index: gdb-6.8.50.20090802/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-6.8.50.20090802/gdb/dwarf2read.c +Index: gdb-6.8.50.20090811/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/dwarf2read.c 2009-08-03 09:50:57.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/dwarf2read.c 2009-08-03 12:31:01.000000000 +0200 -@@ -52,6 +52,7 @@ - #include "jv-lang.h" +--- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:15.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:14:29.000000000 +0200 +@@ -53,6 +53,7 @@ #include "typeprint.h" #include "vec.h" + #include "block.h" +#include "top.h" #include #include "gdb_string.h" -@@ -1225,7 +1226,8 @@ dwarf2_has_info (struct objfile *objfile +@@ -1245,7 +1246,8 @@ dwarf2_has_info (struct objfile *objfile bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); } @@ -82,10 +82,10 @@ Index: gdb-6.8.50.20090802/gdb/dwarf2read.c && dwarf2_per_objfile->abbrev.asection != NULL); } -Index: gdb-6.8.50.20090802/gdb/top.h +Index: gdb-6.8.50.20090811/gdb/top.h =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100 -+++ gdb-6.8.50.20090802/gdb/top.h 2009-08-03 12:29:58.000000000 +0200 +--- gdb-6.8.50.20090811.orig/gdb/top.h 2009-01-03 06:57:53.000000000 +0100 ++++ gdb-6.8.50.20090811/gdb/top.h 2009-08-13 10:14:18.000000000 +0200 @@ -59,6 +59,7 @@ extern void set_prompt (char *); /* From random places. */ diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index f54f0a5..ff270bb 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -1,7 +1,7 @@ -Index: gdb-6.8.50.20090802/gdb/testsuite/configure.ac +Index: gdb-6.8.50.20090909/gdb/testsuite/configure.ac =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/testsuite/configure.ac 2009-08-03 11:10:45.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure.ac 2009-07-31 17:38:16.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/configure.ac 2009-09-09 19:06:01.000000000 +0200 @@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \ gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \ gdb.fortran/Makefile gdb.server/Makefile \ @@ -10,31 +10,31 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/configure.ac + gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ gdb.python/Makefile gdb.reverse/Makefile \ gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) -Index: gdb-6.8.50.20090802/gdb/testsuite/configure +Index: gdb-6.8.50.20090909/gdb/testsuite/configure =================================================================== ---- gdb-6.8.50.20090802.orig/gdb/testsuite/configure 2009-07-31 17:38:16.000000000 +0200 -+++ gdb-6.8.50.20090802/gdb/testsuite/configure 2009-08-03 11:11:27.000000000 +0200 -@@ -3239,7 +3239,7 @@ done +--- gdb-6.8.50.20090909.orig/gdb/testsuite/configure 2009-08-22 18:56:43.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/configure 2009-09-09 19:06:27.000000000 +0200 +@@ -3515,7 +3515,7 @@ done -- ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" +-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" ++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure - # tests run on this system so they can be shared between configure -@@ -3813,6 +3813,7 @@ do - "gdb.objc/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;; - "gdb.opt/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; - "gdb.pascal/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;; -+ "gdb.pie/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;; - "gdb.python/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; - "gdb.reverse/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; - "gdb.threads/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;; -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.c +@@ -4231,6 +4231,7 @@ do + "gdb.objc/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;; + "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; + "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;; ++ "gdb.pie/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pie/Makefile" ;; + "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; + "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; + "gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;; +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.c 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.c 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,20 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -56,10 +56,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.c + } + return 0; +} -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach2.c +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach2.c 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach2.c 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,24 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -85,10 +85,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach2.c + } + return (0); +} -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.c +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.c 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.c 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,146 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -236,10 +236,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.c + } + return 0; +} -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break1.c +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break1.c 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break1.c 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -285,10 +285,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break1.c +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ +void marker4 (d) long d; {} /* set breakpoint 13 here */ +#endif -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/coremaker.c +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/coremaker.c 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/coremaker.c 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,142 @@ +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 + Free Software Foundation, Inc. @@ -432,10 +432,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/coremaker.c + return 0; +} + -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.exp 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,432 @@ +# Copyright 1997, 1999, 2002 Free Software Foundation, Inc. + @@ -869,10 +869,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/attach.exp +do_call_attach_tests + +return 0 -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.exp 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/break.exp 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,977 @@ +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2002, 2003, 2004 @@ -1851,10 +1851,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/break.exp + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} +} -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/corefile.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/corefile.exp 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/corefile.exp 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,243 @@ +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. @@ -2099,10 +2099,10 @@ Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/corefile.exp +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp (reinit)" + +gdb_test "core" "No core file now." -Index: gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/Makefile.in +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090802/gdb/testsuite/gdb.pie/Makefile.in 2009-08-03 11:10:12.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/Makefile.in 2009-09-09 19:06:01.000000000 +0200 @@ -0,0 +1,19 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ diff --git a/gdb-6.5-bz190810-gdbserver-arch-advice.patch b/gdb-6.5-bz190810-gdbserver-arch-advice.patch index 1428471..b6a6437 100644 --- a/gdb-6.5-bz190810-gdbserver-arch-advice.patch +++ b/gdb-6.5-bz190810-gdbserver-arch-advice.patch @@ -7,23 +7,22 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=190810 (remote_async_wait): Likewise. -Index: gdb-6.8.50.20081128/gdb/remote.c +Index: gdb-6.8.50.20090818/gdb/remote.c =================================================================== ---- gdb-6.8.50.20081128.orig/gdb/remote.c 2008-12-09 16:59:51.000000000 +0100 -+++ gdb-6.8.50.20081128/gdb/remote.c 2008-12-09 17:00:04.000000000 +0100 -@@ -4329,8 +4329,13 @@ Packet: '%s'\n"), - VEC_safe_push (cached_reg_t, event->regcache, &cached_reg); - } +--- gdb-6.8.50.20090818.orig/gdb/remote.c 2009-08-18 21:00:35.000000000 +0200 ++++ gdb-6.8.50.20090818/gdb/remote.c 2009-08-18 21:04:46.000000000 +0200 +@@ -4408,8 +4408,13 @@ Packet: '%s'\n"), + VEC_safe_push (cached_reg_t, event->regcache, &cached_reg); + } -- if (*p != ';') -- error (_("Remote register badly formatted: %s\nhere: %s"), -+ /* It may also occur on amd64 which defaults to 32-bit i386 -+ target. gdbserver(1) is not aware of the `set architecture' -+ name itself as it is not using libbfd. */ -+ if (*p != ';') -+ error (_("Remote register badly formatted: %s\nhere: %s" -+ "\nTry to load the executable by `file' first," -+ "\nyou may also check `set/show architecture'."), - buf, p); - ++p; - } ++ /* It may also occur on amd64 which defaults to 32-bit i386 ++ target. gdbserver(1) is not aware of the `set architecture' ++ name itself as it is not using libbfd. */ + if (*p != ';') +- error (_("Remote register badly formatted: %s\nhere: %s"), ++ error (_("Remote register badly formatted: %s\nhere: %s" ++ "\nTry to load the executable by `file' first," ++ "\nyou may also check `set/show architecture'."), + buf, p); + ++p; + } diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index feabbae..2344406 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,7 +1,7 @@ -Index: gdb-6.8.50.20090803/gdb/event-top.c +Index: gdb-6.8.50.20090909/gdb/event-top.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/event-top.c 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/event-top.c 2009-08-03 16:17:59.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/event-top.c 2009-09-09 20:05:48.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/event-top.c 2009-09-09 20:08:04.000000000 +0200 @@ -33,6 +33,7 @@ #include "cli/cli-script.h" /* for reset_command_nest_depth */ #include "main.h" @@ -28,11 +28,11 @@ Index: gdb-6.8.50.20090803/gdb/event-top.c /* Each interpreter has its own rules on displaying the command prompt. */ if (!current_interp_display_prompt_p ()) -Index: gdb-6.8.50.20090803/gdb/symfile.c +Index: gdb-6.8.50.20090909/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/symfile.c 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/symfile.c 2009-08-03 16:17:59.000000000 +0200 -@@ -56,6 +56,7 @@ +--- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 20:08:04.000000000 +0200 +@@ -57,6 +57,7 @@ #include "solib.h" #include "remote.h" #include "libbfd.h" @@ -40,7 +40,7 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c #include #include -@@ -64,6 +65,7 @@ +@@ -65,6 +66,7 @@ #include #include #include @@ -48,7 +48,7 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c int (*deprecated_ui_load_progress_hook) (const char *section, unsigned long num); -@@ -1692,8 +1694,352 @@ build_id_to_filename (struct build_id *b +@@ -1673,8 +1675,352 @@ build_id_to_filename (struct build_id *b return retval; } @@ -402,7 +402,7 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c avoidance. */ struct missing_filepair -@@ -1747,11 +2093,17 @@ missing_filepair_change (void) +@@ -1728,11 +2074,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -420,7 +420,7 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c missing_filepair_change (); } -@@ -1818,14 +2170,33 @@ debug_print_missing (const char *binary, +@@ -1799,14 +2151,33 @@ debug_print_missing (const char *binary, *slot = missing_filepair; @@ -461,11 +461,11 @@ Index: gdb-6.8.50.20090803/gdb/symfile.c } static char * -Index: gdb-6.8.50.20090803/gdb/symfile.h +Index: gdb-6.8.50.20090909/gdb/symfile.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/symfile.h 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/symfile.h 2009-08-03 16:17:59.000000000 +0200 -@@ -394,6 +394,7 @@ extern struct build_id *build_id_addr_ge +--- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 20:08:04.000000000 +0200 +@@ -387,6 +387,7 @@ extern struct build_id *build_id_addr_ge extern char *build_id_to_filename (struct build_id *build_id, char **link_return, int add_debug_suffix); extern void debug_print_missing (const char *binary, const char *debug); @@ -473,10 +473,10 @@ Index: gdb-6.8.50.20090803/gdb/symfile.h /* From dwarf2read.c */ -Index: gdb-6.8.50.20090803/gdb/testsuite/lib/gdb.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/lib/gdb.exp 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/lib/gdb.exp 2009-08-03 16:17:59.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 20:08:04.000000000 +0200 @@ -1248,7 +1248,7 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -486,10 +486,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/lib/gdb.exp send_gdb "set build-id-verbose 0\n" gdb_expect 10 { -re "$gdb_prompt $" { -Index: gdb-6.8.50.20090803/gdb/testsuite/lib/mi-support.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/lib/mi-support.exp 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/lib/mi-support.exp 2009-08-03 16:17:59.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 20:08:04.000000000 +0200 @@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } { } } @@ -499,10 +499,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/lib/mi-support.exp send_gdb "190-gdb-set build-id-verbose 0\n" gdb_expect 10 { -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { -Index: gdb-6.8.50.20090803/gdb/tui/tui-interp.c +Index: gdb-6.8.50.20090909/gdb/tui/tui-interp.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/tui/tui-interp.c 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/tui/tui-interp.c 2009-08-03 16:17:59.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/tui/tui-interp.c 2009-09-09 20:05:48.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/tui/tui-interp.c 2009-09-09 20:08:04.000000000 +0200 @@ -30,6 +30,7 @@ #include "tui/tui.h" #include "tui/tui-io.h" @@ -520,13 +520,13 @@ Index: gdb-6.8.50.20090803/gdb/tui/tui-interp.c /* Tell readline what the prompt to display is and what function it will need to call after a whole line is read. This also displays the first prompt. */ -Index: gdb-6.8.50.20090803/gdb/aclocal.m4 +Index: gdb-6.8.50.20090909/gdb/aclocal.m4 =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/aclocal.m4 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/aclocal.m4 2009-08-03 16:19:22.000000000 +0200 -@@ -11,6 +11,162 @@ - # even the implied warranty of MERCHANTABILITY or FITNESS FOR A - # PARTICULAR PURPOSE. +--- gdb-6.8.50.20090909.orig/gdb/aclocal.m4 2009-09-09 20:05:48.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/aclocal.m4 2009-09-09 20:09:32.000000000 +0200 +@@ -19,6 +19,162 @@ You have another version of autoconf. I + If you have problems, you may need to regenerate the build system entirely. + To do so, use the procedure documented by the package, typically `autoreconf'.])]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# @@ -684,14 +684,14 @@ Index: gdb-6.8.50.20090803/gdb/aclocal.m4 +fi[]dnl +])# PKG_CHECK_MODULES + - # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. + # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation -Index: gdb-6.8.50.20090803/gdb/config.in +Index: gdb-6.8.50.20090909/gdb/config.in =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/config.in 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/config.in 2009-08-03 16:17:59.000000000 +0200 -@@ -39,6 +39,9 @@ +--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 +@@ -42,6 +42,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -701,7 +701,7 @@ Index: gdb-6.8.50.20090803/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -218,6 +221,9 @@ +@@ -221,6 +224,9 @@ /* Define if Python 2.6 is being used. */ #undef HAVE_LIBPYTHON2_6 @@ -711,58 +711,58 @@ Index: gdb-6.8.50.20090803/gdb/config.in /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND -Index: gdb-6.8.50.20090803/gdb/configure +Index: gdb-6.8.50.20090909/gdb/configure =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/configure 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/configure 2009-08-03 16:20:09.000000000 +0200 -@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc test - ac_subdirs_all="$ac_subdirs_all gdbtk" - 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 DEBUGDIR GDB_DATADIR GDB_DATADIR_PATH pythondir 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 SYSTEM_GDBINIT 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir 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 DEBUGDIR GDB_DATADIR GDB_DATADIR_PATH pythondir PKG_CONFIG ac_pt_PKG_CONFIG RPM_CFLAGS RPM_LIBS 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 SYSTEM_GDBINIT 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' - ac_subst_files='host_makefile_frag' - ac_pwd=`pwd` - -@@ -776,6 +776,18 @@ ac_env_CPP_set=${CPP+set} - ac_env_CPP_value=$CPP - ac_cv_env_CPP_set=${CPP+set} - ac_cv_env_CPP_value=$CPP -+ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} -+ac_env_PKG_CONFIG_value=$PKG_CONFIG -+ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} -+ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG -+ac_env_RPM_CFLAGS_set=${RPM_CFLAGS+set} -+ac_env_RPM_CFLAGS_value=$RPM_CFLAGS -+ac_cv_env_RPM_CFLAGS_set=${RPM_CFLAGS+set} -+ac_cv_env_RPM_CFLAGS_value=$RPM_CFLAGS -+ac_env_RPM_LIBS_set=${RPM_LIBS+set} -+ac_env_RPM_LIBS_value=$RPM_LIBS -+ac_cv_env_RPM_LIBS_set=${RPM_LIBS+set} -+ac_cv_env_RPM_LIBS_value=$RPM_LIBS - - # - # Report the --help message. -@@ -895,6 +907,8 @@ Optional Packages: +--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:09:35.000000000 +0200 +@@ -676,6 +676,9 @@ REPORT_BUGS_TO + PKGVERSION + TARGET_OBS + subdirs ++RPM_LIBS ++RPM_CFLAGS ++PKG_CONFIG + pythondir + GDB_DATADIR_PATH + GDB_DATADIR +@@ -886,6 +889,7 @@ with_separate_debug_dir + with_gdb_datadir + with_relocated_sources + with_pythondir ++with_rpm + enable_targets + enable_64_bit_bfd + enable_gdbcli +@@ -925,6 +929,9 @@ LDFLAGS + LIBS + CPPFLAGS + CPP ++PKG_CONFIG ++RPM_CFLAGS ++RPM_LIBS + YACC + YFLAGS + XMKMF' +@@ -1588,6 +1595,8 @@ Optional Packages: [DATADIR/gdb] --with-pythondir install Python data files in this path [DATADIR/gdb/python] -+ --with-rpm query rpm database for missing debuginfos -+ [yes/no,], [def.], [auto=librpm.so] ++ --with-rpm query rpm database for missing debuginfos (yes/no, ++ def. auto=librpm.so) --with-libunwind use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library -@@ -932,6 +946,9 @@ Some influential environment variables: - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory +@@ -1621,6 +1630,9 @@ Some influential environment variables: + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor + PKG_CONFIG path to pkg-config utility + RPM_CFLAGS C compiler flags for RPM, overriding pkg-config + RPM_LIBS linker flags for RPM, overriding pkg-config - - Use these variables to override the choices made by `configure' or to help - it to find libraries and programs with nonstandard names/locations. -@@ -7290,6 +7307,559 @@ _ACEOF + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. + YFLAGS The list of arguments that will be passed by default to $YACC. +@@ -6675,6 +6687,486 @@ _ACEOF fi @@ -783,13 +783,13 @@ Index: gdb-6.8.50.20090803/gdb/configure +# cannot find librpm use to the rpmless compilation (like `--without-rpm'). + + -+# Check whether --with-rpm or --without-rpm was given. -+if test "${with_rpm+set}" = set; then -+ withval="$with_rpm" -+ ++# Check whether --with-rpm was given. ++if test "${with_rpm+set}" = set; then : ++ withval=$with_rpm; +else + with_rpm="auto" -+fi; ++fi ++ + + + @@ -809,25 +809,18 @@ Index: gdb-6.8.50.20090803/gdb/configure + fi + LIBRPM_STRING='"'"$LIBRPM"'"' + -+ echo "$as_me:$LINENO: checking specific librpm version" >&5 -+echo $ECHO_N "checking specific librpm version... $ECHO_C" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 ++$as_echo_n "checking specific librpm version... " >&6; } + HAVE_DLOPEN_LIBRPM=false + save_LIBS="$LIBS" + LIBS="$LIBS -ldl" -+ if test "$cross_compiling" = yes; then -+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -+echo "$as_me: error: in \`$ac_pwd':" >&2;} -+{ { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -+See \`config.log' for more details." >&5 -+echo "$as_me: error: cannot run test program while cross compiling -+See \`config.log' for more details." >&2;} -+ { (exit 1); exit 1; }; }; } ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error "cannot run test program while cross compiling ++See \`config.log' for more details." "$LINENO" 5; } +else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include @@ -910,49 +903,32 @@ Index: gdb-6.8.50.20090803/gdb/configure + return 0; +} +_ACEOF -+rm -f conftest$ac_exeext -+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 -+ (eval $ac_link) 2>&5 -+ ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext' -+ { (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 ++if ac_fn_c_try_run "$LINENO"; then : + + DLOPEN_LIBRPM="`cat conftest.out`" + if test "x$DLOPEN_LIBRPM" != "x"; then + HAVE_DLOPEN_LIBRPM=true -+ echo "$as_me:$LINENO: result: $DLOPEN_LIBRPM" >&5 -+echo "${ECHO_T}$DLOPEN_LIBRPM" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 ++$as_echo "$DLOPEN_LIBRPM" >&6; } + fi + -+else -+ echo "$as_me: program exited with status $ac_status" >&5 -+echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi + -+fi -+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -+fi + rm -f conftest.out + + + + if $HAVE_DLOPEN_LIBRPM; then + -+ echo "$as_me:$LINENO: checking rpm library API compatibility" >&5 -+echo $ECHO_N "checking rpm library API compatibility... $ECHO_C" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } + # The compilation requires -Werror to verify anything. + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Duplicate here the declarations to verify they match "symfile.c". */ @@ -977,44 +953,20 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 ++if ac_fn_c_try_compile "$LINENO"; then : + + LIBRPM_COMPAT=true -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } + +else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ + + LIBRPM_COMPAT=false -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } + +fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if ! $LIBRPM_COMPAT; then @@ -1030,18 +982,14 @@ Index: gdb-6.8.50.20090803/gdb/configure +_ACEOF + + -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_LIBRPM 1 -+_ACEOF ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + + else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } + LIBS="$save_LIBS" + if $DLOPEN_REQUIRE; then -+ { { echo "$as_me:$LINENO: error: Specific name $LIBRPM was requested but it could not be opened." >&5 -+echo "$as_me: error: Specific name $LIBRPM was requested but it could not be opened." >&2;} -+ { (exit 1); exit 1; }; } ++ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 + fi + + @@ -1049,10 +997,10 @@ Index: gdb-6.8.50.20090803/gdb/configure + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) @@ -1064,37 +1012,38 @@ Index: gdb-6.8.50.20090803/gdb/configure +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done -+done ++ done ++IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG -+ +if test -n "$PKG_CONFIG"; then -+ echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -+echo "${ECHO_T}$PKG_CONFIG" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } +else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } +fi + ++ +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 -+echo "$as_me:$LINENO: checking for $ac_word" >&5 -+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then -+ echo $ECHO_N "(cached) $ECHO_C" >&6 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) @@ -1106,29 +1055,39 @@ Index: gdb-6.8.50.20090803/gdb/configure +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. -+ for ac_exec_ext in '' $ac_executable_extensions; do -+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" -+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done -+done ++ done ++IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -+ +if test -n "$ac_pt_PKG_CONFIG"; then -+ echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 -+echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } +fi + -+ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi @@ -1136,32 +1095,32 @@ Index: gdb-6.8.50.20090803/gdb/configure +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 -+ echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 -+echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } + else -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi + +pkg_failed=no -+echo "$as_me:$LINENO: checking for RPM" >&5 -+echo $ECHO_N "checking for RPM... $ECHO_C" >&6 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 ++$as_echo_n "checking for RPM... " >&6; } + +if test -n "$RPM_CFLAGS"; then + pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ -+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"rpm\"") >&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 + ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then + pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` +else + pkg_failed=yes @@ -1173,11 +1132,11 @@ Index: gdb-6.8.50.20090803/gdb/configure + pkg_cv_RPM_LIBS="$RPM_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ -+ { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"rpm\"") >&5 ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 + ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 + ac_status=$? -+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; then ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then + pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` +else + pkg_failed=yes @@ -1203,31 +1162,27 @@ Index: gdb-6.8.50.20090803/gdb/configure + # Put the nasty error message in config.log where it belongs + echo "$RPM_PKG_ERRORS" >&5 + -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } + HAVE_LIBRPM=false +elif test $pkg_failed = untried; then + HAVE_LIBRPM=false +else + RPM_CFLAGS=$pkg_cv_RPM_CFLAGS + RPM_LIBS=$pkg_cv_RPM_LIBS -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } + HAVE_LIBRPM=true +fi + + if $HAVE_LIBRPM; then + -+ echo "$as_me:$LINENO: checking rpm library API compatibility" >&5 -+echo $ECHO_N "checking rpm library API compatibility... $ECHO_C" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } + # The compilation requires -Werror to verify anything. + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Duplicate here the declarations to verify they match "symfile.c". */ @@ -1252,44 +1207,20 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 ++if ac_fn_c_try_compile "$LINENO"; then : + + LIBRPM_COMPAT=true -+ echo "$as_me:$LINENO: result: yes" >&5 -+echo "${ECHO_T}yes" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } + +else -+ echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ + + LIBRPM_COMPAT=false -+ echo "$as_me:$LINENO: result: no" >&5 -+echo "${ECHO_T}no" >&6 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } + +fi -+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + + if ! $LIBRPM_COMPAT; then @@ -1300,20 +1231,16 @@ Index: gdb-6.8.50.20090803/gdb/configure + + if $HAVE_LIBRPM; then + -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_LIBRPM 1 -+_ACEOF ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + + CFLAGS="$CFLAGS $RPM_CFLAGS" + LIBS="$LIBS $RPM_LIBS" + else + if $RPM_REQUIRE; then -+ { { echo "$as_me:$LINENO: error: $RPM_PKG_ERRORS" >&5 -+echo "$as_me: error: $RPM_PKG_ERRORS" >&2;} -+ { (exit 1); exit 1; }; } ++ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 + else -+ { echo "$as_me:$LINENO: WARNING: $RPM_PKG_ERRORS" >&5 -+echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 ++$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} + fi + fi + fi @@ -1322,22 +1249,287 @@ Index: gdb-6.8.50.20090803/gdb/configure -@@ -22513,6 +23083,10 @@ s,@DEBUGDIR@,$DEBUGDIR,;t t - s,@GDB_DATADIR@,$GDB_DATADIR,;t t - s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t - s,@pythondir@,$pythondir,;t t -+s,@PKG_CONFIG@,$PKG_CONFIG,;t t -+s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t -+s,@RPM_CFLAGS@,$RPM_CFLAGS,;t t -+s,@RPM_LIBS@,$RPM_LIBS,;t t - s,@subdirs@,$subdirs,;t t - s,@TARGET_OBS@,$TARGET_OBS,;t t - s,@PKGVERSION@,$PKGVERSION,;t t -Index: gdb-6.8.50.20090803/gdb/configure.ac +@@ -9721,265 +10213,25 @@ $as_echo "#define STDC_HEADERS 1" >>conf + + fi + +- +- + for ac_header in sys/user32.h sys/procfs32.h +-do +-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +-if eval "test \"\${$as_ac_Header+set}\" = set"; then +- echo "$as_me:$LINENO: checking for $ac_header" >&5 +-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +-if eval "test \"\${$as_ac_Header+set}\" = set"; then +- echo $ECHO_N "(cached) $ECHO_C" >&6 +-fi +-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +-else +- # Is the header compilable? +-echo "$as_me:$LINENO: checking $ac_header usability" >&5 +-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +-$ac_includes_default +-#include <$ac_header> +-_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_header_compiler=yes +-else +- echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-ac_header_compiler=no +-fi +-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +-echo "${ECHO_T}$ac_header_compiler" >&6 +- +-# Is the header present? +-echo "$as_me:$LINENO: checking $ac_header presence" >&5 +-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +-#include <$ac_header> +-_ACEOF +-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 +- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then +- if test -s conftest.err; then +- ac_cpp_err=$ac_c_preproc_warn_flag +- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag +- else +- ac_cpp_err= +- fi +-else +- ac_cpp_err=yes +-fi +-if test -z "$ac_cpp_err"; then +- ac_header_preproc=yes +-else +- echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +- ac_header_preproc=no +-fi +-rm -f conftest.err conftest.$ac_ext +-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +-echo "${ECHO_T}$ac_header_preproc" >&6 +- +-# So? What about this header? +-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in +- yes:no: ) +- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} +- ac_header_preproc=yes +- ;; +- no:yes:* ) +- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} +- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} +- ( +- cat <<\_ASBOX +-## ------------------------------------------ ## +-## Report this to the AC_PACKAGE_NAME lists. ## +-## ------------------------------------------ ## +-_ASBOX +- ) | +- sed "s/^/$as_me: WARNING: /" >&2 +- ;; +-esac +-echo "$as_me:$LINENO: checking for $ac_header" >&5 +-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +-if eval "test \"\${$as_ac_Header+set}\" = set"; then +- echo $ECHO_N "(cached) $ECHO_C" >&6 +-else +- eval "$as_ac_Header=\$ac_header_preproc" +-fi +-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +- +-fi +-if test `eval echo '${'$as_ac_Header'}'` = yes; then ++do : ++ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ++ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" ++eval as_val=\$$as_ac_Header ++ if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 ++#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 + _ACEOF + + fi + + done + +-echo "$as_me:$LINENO: checking for struct elf_prstatus32.pr_reg" >&5 +-echo $ECHO_N "checking for struct elf_prstatus32.pr_reg... $ECHO_C" >&6 +-if test "${ac_cv_member_struct_elf_prstatus32_pr_reg+set}" = set; then +- echo $ECHO_N "(cached) $ECHO_C" >&6 +-else +- cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +-#include +- +-int +-main () +-{ +-static struct elf_prstatus32 ac_aggr; +-if (ac_aggr.pr_reg) +-return 0; +- ; +- 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_member_struct_elf_prstatus32_pr_reg=yes +-else +- echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-cat >conftest.$ac_ext <<_ACEOF +-/* confdefs.h. */ +-_ACEOF +-cat confdefs.h >>conftest.$ac_ext +-cat >>conftest.$ac_ext <<_ACEOF +-/* end confdefs.h. */ +-#include +- +-int +-main () +-{ +-static struct elf_prstatus32 ac_aggr; +-if (sizeof ac_aggr.pr_reg) +-return 0; +- ; +- 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_member_struct_elf_prstatus32_pr_reg=yes +-else +- echo "$as_me: failed program was:" >&5 +-sed 's/^/| /' conftest.$ac_ext >&5 +- +-ac_cv_member_struct_elf_prstatus32_pr_reg=no +-fi +-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +-fi +-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +-fi +-echo "$as_me:$LINENO: result: $ac_cv_member_struct_elf_prstatus32_pr_reg" >&5 +-echo "${ECHO_T}$ac_cv_member_struct_elf_prstatus32_pr_reg" >&6 +-if test $ac_cv_member_struct_elf_prstatus32_pr_reg = yes; then ++ac_fn_c_check_member "$LINENO" "struct elf_prstatus32" "pr_reg" "ac_cv_member_struct_elf_prstatus32_pr_reg" "#include ++" ++if test "x$ac_cv_member_struct_elf_prstatus32_pr_reg" = x""yes; then : + +-cat >>confdefs.h <<\_ACEOF +-#define HAVE_ELF_PRSTATUS32 1 +-_ACEOF ++$as_echo "#define HAVE_ELF_PRSTATUS32 1" >>confdefs.h + + fi + +Index: gdb-6.8.50.20090909/gdb/configure.ac =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/configure.ac 2009-08-03 16:17:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/configure.ac 2009-08-03 16:17:59.000000000 +0200 -@@ -153,6 +153,199 @@ else +--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 +@@ -151,6 +151,199 @@ else fi AC_SUBST(pythondir) @@ -1359,7 +1551,7 @@ Index: gdb-6.8.50.20090803/gdb/configure.ac + +AC_ARG_WITH([rpm], + [AS_HELP_STRING([--with-rpm], -+ [query rpm database for missing debuginfos [yes/no, def. auto=librpm.so]])], [], [with_rpm="auto"]) ++ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) + +m4_pattern_allow([^AC_MSG_ERROR$]) +m4_pattern_allow([^AC_MSG_WARN$]) @@ -1537,3 +1729,22 @@ Index: gdb-6.8.50.20090803/gdb/configure.ac AC_CONFIG_SUBDIRS(doc testsuite) +Index: gdb-6.8.50.20090909/gdb/acinclude.m4 +=================================================================== +--- gdb-6.8.50.20090909.orig/gdb/acinclude.m4 2009-09-09 20:05:48.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/acinclude.m4 2009-09-09 20:08:04.000000000 +0200 +@@ -1,3 +1,5 @@ ++# serial 1 ++ + dnl written by Rob Savoye for Cygnus Support + dnl major rewriting for Tcl 7.5 by Don Libes + +@@ -79,8 +81,6 @@ AC_MSG_RESULT(yes) + # Foundation, Inc., 51 Franklin Street, Fifth Floor, + # Boston, MA 02110-1301, USA. + +-# serial 1 +- + # @defmac AC_PROG_CC_STDC + # @maindex PROG_CC_STDC + # @ovindex CC diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index e373c95..d644fca 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,7 +1,7 @@ -Index: gdb-6.8.50.20090809/gdb/corelow.c +Index: gdb-6.8.50.20090909/gdb/corelow.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/corelow.c 2009-08-10 14:56:11.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/corelow.c 2009-09-09 19:09:35.000000000 +0200 @@ -45,6 +45,10 @@ #include "exceptions.h" #include "solib.h" @@ -89,11 +89,11 @@ Index: gdb-6.8.50.20090809/gdb/corelow.c + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-6.8.50.20090809/gdb/doc/gdb.texinfo +Index: gdb-6.8.50.20090909/gdb/doc/gdb.texinfo =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/doc/gdb.texinfo 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/doc/gdb.texinfo 2009-08-10 14:56:11.000000000 +0200 -@@ -13733,6 +13733,27 @@ information files. +--- gdb-6.8.50.20090909.orig/gdb/doc/gdb.texinfo 2009-09-09 19:09:31.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/doc/gdb.texinfo 2009-09-09 19:09:35.000000000 +0200 +@@ -13764,6 +13764,27 @@ information files. @end table @@ -121,10 +121,10 @@ Index: gdb-6.8.50.20090809/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named -Index: gdb-6.8.50.20090809/gdb/solib-svr4.c +Index: gdb-6.8.50.20090909/gdb/solib-svr4.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/solib-svr4.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/solib-svr4.c 2009-08-10 14:56:11.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/solib-svr4.c 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/solib-svr4.c 2009-09-09 19:09:35.000000000 +0200 @@ -1101,9 +1101,33 @@ svr4_current_sos (void) safe_strerror (errcode)); else @@ -162,11 +162,11 @@ Index: gdb-6.8.50.20090809/gdb/solib-svr4.c } xfree (buffer); -Index: gdb-6.8.50.20090809/gdb/symfile.c +Index: gdb-6.8.50.20090909/gdb/symfile.c =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/symfile.c 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/symfile.c 2009-08-10 14:58:53.000000000 +0200 -@@ -55,6 +55,7 @@ +--- gdb-6.8.50.20090909.orig/gdb/symfile.c 2009-09-09 19:09:31.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/symfile.c 2009-09-09 19:09:55.000000000 +0200 +@@ -56,6 +56,7 @@ #include "elf-bfd.h" #include "solib.h" #include "remote.h" @@ -174,7 +174,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c #include #include -@@ -1195,16 +1196,65 @@ symbol_file_clear (int from_tty) +@@ -1174,16 +1175,65 @@ symbol_file_clear (int from_tty) printf_unfiltered (_("No symbol file now.\n")); } @@ -242,7 +242,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c { struct build_id *retval; -@@ -1220,6 +1270,348 @@ build_id_bfd_get (bfd *abfd) +@@ -1199,6 +1249,348 @@ build_id_bfd_get (bfd *abfd) return retval; } @@ -591,7 +591,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -@@ -1237,7 +1629,7 @@ build_id_verify (const char *filename, s +@@ -1216,7 +1608,7 @@ build_id_verify (const char *filename, s if (abfd == NULL) return 0; @@ -600,7 +600,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), filename); -@@ -1256,8 +1648,9 @@ build_id_verify (const char *filename, s +@@ -1235,8 +1627,9 @@ build_id_verify (const char *filename, s return retval; } @@ -612,7 +612,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c { char *link, *s, *retval = NULL; gdb_byte *data = build_id->data; -@@ -1265,7 +1658,9 @@ build_id_to_debug_filename (struct build +@@ -1244,7 +1637,9 @@ build_id_to_debug_filename (struct build /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 @@ -623,7 +623,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c s = link + sprintf (link, "%s/.build-id/", debug_file_directory); if (size > 0) { -@@ -1276,12 +1671,14 @@ build_id_to_debug_filename (struct build +@@ -1255,12 +1650,14 @@ build_id_to_debug_filename (struct build *s++ = '/'; while (size-- > 0) s += sprintf (s, "%02x", (unsigned) *data++); @@ -640,7 +640,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c if (retval != NULL && !build_id_verify (retval, build_id)) { -@@ -1289,9 +1686,150 @@ build_id_to_debug_filename (struct build +@@ -1268,9 +1665,150 @@ build_id_to_debug_filename (struct build retval = NULL; } @@ -791,7 +791,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c static char * get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) { -@@ -1374,32 +1912,36 @@ static char * +@@ -1353,32 +1891,36 @@ static char * find_separate_debug_file (struct objfile *objfile) { asection *sect; @@ -836,7 +836,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c } basename = get_debug_link_info (objfile, &crc32); -@@ -1407,7 +1949,7 @@ find_separate_debug_file (struct objfile +@@ -1386,7 +1928,7 @@ find_separate_debug_file (struct objfile if (basename == NULL) /* There's no separate debug info, hence there's no way we could load it => no warning. */ @@ -845,7 +845,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c dir = xstrdup (objfile->name); -@@ -1429,24 +1971,19 @@ find_separate_debug_file (struct objfile +@@ -1408,24 +1950,19 @@ find_separate_debug_file (struct objfile if (canon_name && strlen (canon_name) > i) i = strlen (canon_name); @@ -877,7 +877,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */ strcpy (debugfile, dir); -@@ -1455,12 +1992,7 @@ find_separate_debug_file (struct objfile +@@ -1434,12 +1971,7 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -891,7 +891,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* Then try in the global debugfile directory. */ strcpy (debugfile, debug_file_directory); -@@ -1469,12 +2001,7 @@ find_separate_debug_file (struct objfile +@@ -1448,12 +1980,7 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -905,7 +905,7 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c /* If the file is in the sysroot, try using its base path in the global debugfile directory. */ -@@ -1488,21 +2015,18 @@ find_separate_debug_file (struct objfile +@@ -1467,20 +1994,18 @@ find_separate_debug_file (struct objfile strcat (debugfile, basename); if (separate_debug_file_exists (debugfile, crc32, objfile->name)) @@ -913,7 +913,6 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c - xfree (canon_name); - xfree (basename); - xfree (dir); -- xfree (canon_name); - return xstrdup (debugfile); - } + goto cleanup_return_debugfile; @@ -934,28 +933,28 @@ Index: gdb-6.8.50.20090809/gdb/symfile.c } -@@ -4254,4 +4778,16 @@ Show printing of symbol loading messages - NULL, - NULL, - &setprintlist, &showprintlist); -+ -+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, -+ _("\ -+Set debugging level of the build-id locator."), _("\ -+Show debugging level of the build-id locator."), _("\ -+Level 1 (default) enables printing the missing debug filenames,\n\ -+level 2 also prints the parsing of binaries to find the identificators."), -+ NULL, -+ show_build_id_verbose, -+ &setlist, &showlist); -+ -+ observer_attach_executable_changed (debug_print_executable_changed); +@@ -4231,4 +4756,16 @@ the global debug-file directory prepende + NULL, + show_debug_file_directory, + &setlist, &showlist); ++ ++ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, ++ _("\ ++ Set debugging level of the build-id locator."), _("\ ++ Show debugging level of the build-id locator."), _("\ ++ Level 1 (default) enables printing the missing debug filenames,\n\ ++ level 2 also prints the parsing of binaries to find the identificators."), ++ NULL, ++ show_build_id_verbose, ++ &setlist, &showlist); ++ ++ observer_attach_executable_changed (debug_print_executable_changed); } -Index: gdb-6.8.50.20090809/gdb/symfile.h +Index: gdb-6.8.50.20090909/gdb/symfile.h =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/symfile.h 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/symfile.h 2009-08-10 14:56:11.000000000 +0200 -@@ -388,6 +388,13 @@ extern int symfile_map_offsets_to_segmen +--- gdb-6.8.50.20090909.orig/gdb/symfile.h 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/symfile.h 2009-09-09 19:09:35.000000000 +0200 +@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); void free_symfile_segment_data (struct symfile_segment_data *data); @@ -969,10 +968,10 @@ Index: gdb-6.8.50.20090809/gdb/symfile.h /* From dwarf2read.c */ extern int dwarf2_has_info (struct objfile *); -Index: gdb-6.8.50.20090809/gdb/testsuite/lib/gdb.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/testsuite/lib/gdb.exp 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/testsuite/lib/gdb.exp 2009-08-10 14:56:11.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/gdb.exp 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/lib/gdb.exp 2009-09-09 19:09:35.000000000 +0200 @@ -1248,6 +1248,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -990,10 +989,10 @@ Index: gdb-6.8.50.20090809/gdb/testsuite/lib/gdb.exp return 0; } -Index: gdb-6.8.50.20090809/gdb/testsuite/lib/mi-support.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-6.8.50.20090809.orig/gdb/testsuite/lib/mi-support.exp 2009-08-10 00:50:30.000000000 +0200 -+++ gdb-6.8.50.20090809/gdb/testsuite/lib/mi-support.exp 2009-08-10 14:56:11.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:05:56.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/lib/mi-support.exp 2009-09-09 19:09:35.000000000 +0200 @@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } { } } diff --git a/gdb-6.6-multifork-debugreg.patch b/gdb-6.6-multifork-debugreg.patch deleted file mode 100644 index d9a6ae3..0000000 --- a/gdb-6.6-multifork-debugreg.patch +++ /dev/null @@ -1,1331 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2008-01/msg00042.html -[ Backported for GDB-6.6 (only removed the new file inclusion). ] - -+ - -2007-09-16 Daniel Jacobowitz - Jeff Johnston - - * gdb.texinfo (Setting Watchpoints): Adjust warning text about - multi-threaded watchpoints. - -2007-12-15 Jan Kratochvil - - * gdb.texinfo (Setting Watchpoints): New paragraph on the software - watchpoints safety wrt `set scheduler-locking'. - -2008-03-01 Jan Kratochvil - - Port to GDB-6.8pre. - -2008-03-31 Jan Kratochvil - - * gdb.threads/watchpoint-fork-forkoff.c (forkoff): New delay after the - parent/child messages to fix a race. - -2008-05-28 Jan Kratochvil - - * s390-nat.c (s390_fix_watch_points): Fix its compilation failure - - rename it to S390_FIX_WATCH_POINTS_LIST. - -Index: gdb-6.8.50.20090803/gdb/amd64-linux-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/amd64-linux-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/amd64-linux-nat.c 2009-08-04 07:17:58.000000000 +0200 -@@ -411,25 +411,43 @@ amd64_linux_dr_set (ptid_t ptid, int reg - static void - amd64_linux_dr_set_control (unsigned long control) - { -- struct lwp_info *lp; -- ptid_t ptid; -- - amd64_linux_dr[DR_CONTROL] = control; -- ALL_LWPS (lp, ptid) -- amd64_linux_dr_set (ptid, DR_CONTROL, control); -+ -+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process -+ not listed for ALL_LWPS. */ -+ -+ if (ptid_get_lwp (inferior_ptid) == 0) -+ amd64_linux_dr_set (inferior_ptid, DR_CONTROL, control); -+ else -+ { -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ amd64_linux_dr_set (ptid, DR_CONTROL, control); -+ } - } - - static void - amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) - { -- struct lwp_info *lp; -- ptid_t ptid; -- - gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); - - amd64_linux_dr[DR_FIRSTADDR + regnum] = addr; -- ALL_LWPS (lp, ptid) -- amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ -+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process -+ not listed for ALL_LWPS. */ -+ -+ if (ptid_get_lwp (inferior_ptid) == 0) -+ amd64_linux_dr_set (inferior_ptid, DR_FIRSTADDR + regnum, addr); -+ else -+ { -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ } - } - - static void -@@ -454,6 +472,42 @@ amd64_linux_new_thread (ptid_t ptid) - - amd64_linux_dr_set (ptid, DR_CONTROL, amd64_linux_dr[DR_CONTROL]); - } -+ -+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child -+ process of traced FORK. We must clear such watchpoints only once during -+ DETACH_BREAKPOINTS. */ -+ -+static int amd64_linux_detach_breakpoints_pid; -+ -+/* Remove a watchpoint that watched the memory region which starts at -+ address ADDR, whose length is LEN bytes, and for accesses of the -+ type TYPE. Return 0 on success, -1 on failure. */ -+int -+amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) -+{ -+ if (ptid_get_pid (inferior_ptid) == amd64_linux_detach_breakpoints_pid) -+ return 0; -+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ -+ amd64_linux_detach_breakpoints_pid = 0; -+ -+ return target_remove_watchpoint (addr, len, type); -+} -+ -+static void -+amd64_linux_detach_breakpoints (int detached_pid) -+{ -+ struct cleanup *old_chain = save_inferior_ptid (); -+ int i; -+ extern void i386_detach_breakpoints (int detached_pid); -+ -+ amd64_linux_detach_breakpoints_pid = detached_pid; -+ /* Depend on `!is_lwp (inferior_ptid)' for the I386_* macros. */ -+ inferior_ptid = pid_to_ptid (detached_pid); -+ -+ i386_detach_breakpoints (detached_pid); -+ -+ do_cleanups (old_chain); -+} - - - /* This function is called by libthread_db as part of its handling of -@@ -767,6 +821,42 @@ amd64_linux_siginfo_fixup (struct siginf - return 0; - } - -+static int (*amd64_linux_super_follow_fork) (struct target_ops *ops, -+ int follow_child); -+ -+/* We need to duplicate the LINUX_CHILD_FOLLOW_FORK behavior here and catch its -+ called DETACH_BREAKPOINTS to avoid corrupting our local registers mirror. */ -+ -+static int -+amd64_linux_follow_fork (struct target_ops *ops, int follow_child) -+{ -+ ptid_t last_ptid; -+ struct target_waitstatus last_status; -+ int has_vforked; -+ int parent_pid, child_pid; -+ -+ get_last_target_status (&last_ptid, &last_status); -+ has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED); -+ parent_pid = ptid_get_lwp (last_ptid); -+ if (parent_pid == 0) -+ parent_pid = ptid_get_pid (last_ptid); -+ child_pid = ptid_get_lwp (last_status.value.related_pid); -+ if (child_pid == 0) -+ child_pid = ptid_get_pid (last_status.value.related_pid); -+ -+ if (! follow_child) -+ { -+ amd64_linux_detach_breakpoints (child_pid); -+ } -+ else -+ { -+ if (! has_vforked) -+ amd64_linux_detach_breakpoints (child_pid); -+ } -+ -+ return (*amd64_linux_super_follow_fork) (ops, follow_child); -+} -+ - /* Provide a prototype to silence -Wmissing-prototypes. */ - void _initialize_amd64_linux_nat (void); - -@@ -809,6 +899,9 @@ _initialize_amd64_linux_nat (void) - linux_elfcore_write_prstatus = amd64_linux_elfcore_write_prstatus; - linux_elfcore_write_prfpreg = amd64_linux_elfcore_write_prfpreg; - -+ amd64_linux_super_follow_fork = t->to_follow_fork; -+ t->to_follow_fork = amd64_linux_follow_fork; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, amd64_linux_new_thread); -Index: gdb-6.8.50.20090803/gdb/i386-linux-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/i386-linux-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/i386-linux-nat.c 2009-08-04 07:26:43.000000000 +0200 -@@ -637,21 +637,42 @@ i386_linux_dr_set_control (unsigned long - ptid_t ptid; - - i386_linux_dr[DR_CONTROL] = control; -- ALL_LWPS (lp, ptid) -- i386_linux_dr_set (ptid, DR_CONTROL, control); -+ -+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process -+ not listed for ALL_LWPS. */ -+ -+ if (ptid_get_lwp (inferior_ptid) == 0) -+ i386_linux_dr_set (inferior_ptid, DR_CONTROL, control); -+ else -+ { -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ i386_linux_dr_set (ptid, DR_CONTROL, control); -+ } - } - - static void - i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) - { -- struct lwp_info *lp; -- ptid_t ptid; -- - gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); - - i386_linux_dr[DR_FIRSTADDR + regnum] = addr; -- ALL_LWPS (lp, ptid) -- i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ -+ /* I386_DETACH_BREAKPOINTS may need to reset the registers on single process -+ not listed for ALL_LWPS. */ -+ -+ if (ptid_get_lwp (inferior_ptid) == 0) -+ i386_linux_dr_set (inferior_ptid, DR_FIRSTADDR + regnum, addr); -+ else -+ { -+ struct lwp_info *lp; -+ ptid_t ptid; -+ -+ ALL_LWPS (lp, ptid) -+ i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); -+ } - } - - static void -@@ -676,6 +697,42 @@ i386_linux_new_thread (ptid_t ptid) - - i386_linux_dr_set (ptid, DR_CONTROL, i386_linux_dr[DR_CONTROL]); - } -+ -+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child -+ process of traced FORK. We must clear such watchpoints only once during -+ DETACH_BREAKPOINTS. */ -+ -+static int i386_linux_detach_breakpoints_pid; -+ -+/* Remove a watchpoint that watched the memory region which starts at -+ address ADDR, whose length is LEN bytes, and for accesses of the -+ type TYPE. Return 0 on success, -1 on failure. */ -+int -+i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) -+{ -+ if (ptid_get_pid (inferior_ptid) == i386_linux_detach_breakpoints_pid) -+ return 0; -+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ -+ i386_linux_detach_breakpoints_pid = 0; -+ -+ return target_remove_watchpoint (addr, len, type); -+} -+ -+static void -+i386_linux_detach_breakpoints (int detached_pid) -+{ -+ struct cleanup *old_chain = save_inferior_ptid (); -+ int i; -+ extern void i386_detach_breakpoints (int detached_pid); -+ -+ i386_linux_detach_breakpoints_pid = detached_pid; -+ /* Depend on `!is_lwp (inferior_ptid)' for the I386_* macros. */ -+ inferior_ptid = pid_to_ptid (detached_pid); -+ -+ i386_detach_breakpoints (detached_pid); -+ -+ do_cleanups (old_chain); -+} - - - /* Called by libthread_db. Returns a pointer to the thread local -@@ -818,6 +875,40 @@ i386_linux_child_post_startup_inferior ( - super_post_startup_inferior (ptid); - } - -+static int (*i386_linux_super_follow_fork) (struct target_ops *ops, -+ int follow_child); -+ -+/* We need to duplicate the LINUX_CHILD_FOLLOW_FORK behavior here and catch its -+ called DETACH_BREAKPOINTS to avoid corrupting our local registers mirror. */ -+ -+static int -+i386_linux_follow_fork (struct target_ops *ops, int follow_child) -+{ -+ ptid_t last_ptid; -+ struct target_waitstatus last_status; -+ int has_vforked; -+ int parent_pid, child_pid; -+ -+ get_last_target_status (&last_ptid, &last_status); -+ has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED); -+ parent_pid = ptid_get_lwp (last_ptid); -+ if (parent_pid == 0) -+ parent_pid = ptid_get_pid (last_ptid); -+ child_pid = ptid_get_pid (last_status.value.related_pid); -+ -+ if (! follow_child) -+ { -+ i386_linux_detach_breakpoints (child_pid); -+ } -+ else -+ { -+ if (! has_vforked) -+ i386_linux_detach_breakpoints (child_pid); -+ } -+ -+ return (*i386_linux_super_follow_fork) (ops, follow_child); -+} -+ - void - _initialize_i386_linux_nat (void) - { -@@ -845,6 +936,9 @@ _initialize_i386_linux_nat (void) - t->to_fetch_registers = i386_linux_fetch_inferior_registers; - t->to_store_registers = i386_linux_store_inferior_registers; - -+ i386_linux_super_follow_fork = t->to_follow_fork; -+ t->to_follow_fork = i386_linux_follow_fork; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, i386_linux_new_thread); -Index: gdb-6.8.50.20090803/gdb/i386-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/i386-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/i386-nat.c 2009-08-04 07:17:58.000000000 +0200 -@@ -520,6 +520,18 @@ i386_remove_watchpoint (CORE_ADDR addr, - return retval; - } - -+void -+i386_detach_breakpoints (int detached_pid) -+{ -+ int i; -+ -+ /* Do not touch any DR_MIRROR or DR_CONTROL_MIRROR mirrors here. */ -+ i386_dr_low.set_control (0); -+ if (i386_dr_low.reset_addr) -+ ALL_DEBUG_REGISTERS(i) -+ i386_dr_low.reset_addr (i); -+} -+ - /* Return non-zero if we can watch a memory region that starts at - address ADDR and whose length is LEN bytes. */ - -Index: gdb-6.8.50.20090803/gdb/ia64-linux-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/ia64-linux-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/ia64-linux-nat.c 2009-08-04 07:17:58.000000000 +0200 -@@ -583,6 +583,12 @@ ia64_linux_insert_watchpoint (CORE_ADDR - return 0; - } - -+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child -+ process of traced FORK. We must clear such watchpoints only once during -+ DETACH_BREAKPOINTS. */ -+ -+static int ia64_linux_detach_breakpoints_pid; -+ - static int - ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type) - { -@@ -590,6 +596,11 @@ ia64_linux_remove_watchpoint (CORE_ADDR - long dbr_addr, dbr_mask; - int max_watchpoints = 4; - -+ if (ptid_get_pid (inferior_ptid) == ia64_linux_detach_breakpoints_pid) -+ return 0; -+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ -+ ia64_linux_detach_breakpoints_pid = 0; -+ - if (len <= 0 || !is_power_of_2 (len)) - return -1; - -@@ -617,6 +628,22 @@ ia64_linux_remove_watchpoint (CORE_ADDR - } - - static void -+ia64_linux_detach_breakpoints (int detached_pid) -+{ -+ int idx, i; -+ long dbr_addr, dbr_mask; -+ int max_watchpoints = 4; -+ -+ ia64_linux_detach_breakpoints_pid = detached_pid; -+ -+ /* Do not touch any DEBUG_REGISTERS mirrors here. */ -+ dbr_addr = 0; -+ dbr_mask = 0; -+ for (idx = 0; idx < max_watchpoints; idx++) -+ store_debug_register_pair (ptid_build (detached_pid, 0, 0), idx, &dbr_addr, &dbr_mask); -+} -+ -+static void - ia64_linux_new_thread (ptid_t ptid) - { - int i, any; -@@ -807,6 +834,40 @@ ia64_linux_xfer_partial (struct target_o - offset, len); - } - -+static int (*ia64_linux_super_follow_fork) (struct target_ops *ops, -+ int follow_child); -+ -+/* We need to duplicate the LINUX_CHILD_FOLLOW_FORK behavior here and catch its -+ called DETACH_BREAKPOINTS to avoid corrupting our local registers mirror. */ -+ -+int -+ia64_linux_follow_fork (struct target_ops *ops, int follow_child) -+{ -+ ptid_t last_ptid; -+ struct target_waitstatus last_status; -+ int has_vforked; -+ int parent_pid, child_pid; -+ -+ get_last_target_status (&last_ptid, &last_status); -+ has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED); -+ parent_pid = ptid_get_lwp (last_ptid); -+ if (parent_pid == 0) -+ parent_pid = ptid_get_pid (last_ptid); -+ child_pid = ptid_get_pid (last_status.value.related_pid); -+ -+ if (! follow_child) -+ { -+ ia64_linux_detach_breakpoints (child_pid); -+ } -+ else -+ { -+ if (! has_vforked) -+ ia64_linux_detach_breakpoints (child_pid); -+ } -+ -+ return (*ia64_linux_super_follow_fork) (ops, follow_child); -+} -+ - void _initialize_ia64_linux_nat (void); - - /* -@@ -901,6 +962,9 @@ _initialize_ia64_linux_nat (void) - t->to_insert_watchpoint = ia64_linux_insert_watchpoint; - t->to_remove_watchpoint = ia64_linux_remove_watchpoint; - -+ ia64_linux_super_follow_fork = t->to_follow_fork; -+ t->to_follow_fork = ia64_linux_follow_fork; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, ia64_linux_new_thread); -Index: gdb-6.8.50.20090803/gdb/ppc-linux-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/ppc-linux-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/ppc-linux-nat.c 2009-08-04 07:17:58.000000000 +0200 -@@ -1377,6 +1377,12 @@ ppc_linux_insert_watchpoint (CORE_ADDR a - return 0; - } - -+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child -+ process of traced FORK. We must clear such watchpoints only once during -+ DETACH_BREAKPOINTS. */ -+ -+static int ppc_linux_detach_breakpoints_pid; -+ - static int - ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) - { -@@ -1384,6 +1390,11 @@ ppc_linux_remove_watchpoint (CORE_ADDR a - ptid_t ptid; - long dabr_value = 0; - -+ if (ptid_get_pid (inferior_ptid) == ppc_linux_detach_breakpoints_pid) -+ return 0; -+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ -+ ppc_linux_detach_breakpoints_pid = 0; -+ - saved_dabr_value = 0; - ALL_LWPS (lp, ptid) - if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0) -@@ -1397,6 +1408,15 @@ ppc_linux_new_thread (ptid_t ptid) - ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value); - } - -+static void -+ppc_linux_detach_breakpoints (int detached_pid) -+{ -+ ppc_linux_detach_breakpoints_pid = detached_pid; -+ -+ /* Do not touch the SAVED_DABR_VALUE mirror here. */ -+ ptrace (PTRACE_SET_DEBUGREG, detached_pid, 0, 0); -+} -+ - static int - ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) - { -@@ -1629,6 +1649,40 @@ ppc_linux_read_description (struct targe - return isa205? tdesc_powerpc_isa205_32l : tdesc_powerpc_32l; - } - -+static int (*ppc_linux_super_follow_fork) (struct target_ops *ops, -+ int follow_child); -+ -+/* We need to duplicate the LINUX_CHILD_FOLLOW_FORK behavior here and catch its -+ called DETACH_BREAKPOINTS to avoid corrupting our local registers mirror. */ -+ -+int -+ppc_linux_follow_fork (struct target_ops *ops, int follow_child) -+{ -+ ptid_t last_ptid; -+ struct target_waitstatus last_status; -+ int has_vforked; -+ int parent_pid, child_pid; -+ -+ get_last_target_status (&last_ptid, &last_status); -+ has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED); -+ parent_pid = ptid_get_lwp (last_ptid); -+ if (parent_pid == 0) -+ parent_pid = ptid_get_pid (last_ptid); -+ child_pid = ptid_get_pid (last_status.value.related_pid); -+ -+ if (! follow_child) -+ { -+ ppc_linux_detach_breakpoints (child_pid); -+ } -+ else -+ { -+ if (! has_vforked) -+ ppc_linux_detach_breakpoints (child_pid); -+ } -+ -+ return (*ppc_linux_super_follow_fork) (ops, follow_child); -+} -+ - void _initialize_ppc_linux_nat (void); - - void -@@ -1655,6 +1709,9 @@ _initialize_ppc_linux_nat (void) - t->to_read_description = ppc_linux_read_description; - t->to_auxv_parse = ppc_linux_auxv_parse; - -+ ppc_linux_super_follow_fork = t->to_follow_fork; -+ t->to_follow_fork = ppc_linux_follow_fork; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, ppc_linux_new_thread); -Index: gdb-6.8.50.20090803/gdb/s390-nat.c -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/s390-nat.c 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/s390-nat.c 2009-08-04 07:17:58.000000000 +0200 -@@ -285,21 +285,15 @@ s390_stopped_by_watchpoint (void) - } - - static void --s390_fix_watch_points (ptid_t ptid) -+s390_fix_watch_points_list (int tid, struct watch_area *area_list) - { -- int tid; -- - per_struct per_info; - ptrace_area parea; - - CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0; - struct watch_area *area; - -- tid = TIDGET (ptid); -- if (tid == 0) -- tid = PIDGET (ptid); -- -- for (area = watch_base; area; area = area->next) -+ for (area = area_list; area; area = area->next) - { - watch_lo_addr = min (watch_lo_addr, area->lo_addr); - watch_hi_addr = max (watch_hi_addr, area->hi_addr); -@@ -311,7 +305,7 @@ s390_fix_watch_points (ptid_t ptid) - if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea) < 0) - perror_with_name (_("Couldn't retrieve watchpoint status")); - -- if (watch_base) -+ if (area_list) - { - per_info.control_regs.bits.em_storage_alteration = 1; - per_info.control_regs.bits.storage_alt_space_ctl = 1; -@@ -328,6 +322,18 @@ s390_fix_watch_points (ptid_t ptid) - perror_with_name (_("Couldn't modify watchpoint status")); - } - -+static void -+s390_fix_watch_points (ptid_t ptid) -+{ -+ int tid; -+ -+ tid = TIDGET (ptid); -+ if (tid == 0) -+ tid = PIDGET (ptid); -+ -+ s390_fix_watch_points_list (tid, watch_base); -+} -+ - static int - s390_insert_watchpoint (CORE_ADDR addr, int len, int type) - { -@@ -349,6 +355,12 @@ s390_insert_watchpoint (CORE_ADDR addr, - return 0; - } - -+/* TO_FOLLOW_FORK stores here the PID under DETACH_BREAKPOINTS for the child -+ process of traced FORK. We must clear such watchpoints only once during -+ DETACH_BREAKPOINTS. */ -+ -+static int s390_detach_breakpoints_pid; -+ - static int - s390_remove_watchpoint (CORE_ADDR addr, int len, int type) - { -@@ -356,6 +368,11 @@ s390_remove_watchpoint (CORE_ADDR addr, - ptid_t ptid; - struct watch_area *area, **parea; - -+ if (ptid_get_pid (inferior_ptid) == s390_detach_breakpoints_pid) -+ return 0; -+ /* FOLLOW-FORK-MODE CHILD runs later the CHILD with no restrictions. */ -+ s390_detach_breakpoints_pid = 0; -+ - for (parea = &watch_base; *parea; parea = &(*parea)->next) - if ((*parea)->lo_addr == addr - && (*parea)->hi_addr == addr + len - 1) -@@ -363,8 +380,10 @@ s390_remove_watchpoint (CORE_ADDR addr, - - if (!*parea) - { -+#if 0 /* Red Hat fork/threads watchpoints changes may trigger it. */ - fprintf_unfiltered (gdb_stderr, - "Attempt to remove nonexistent watchpoint.\n"); -+#endif - return -1; - } - -@@ -377,6 +396,15 @@ s390_remove_watchpoint (CORE_ADDR addr, - return 0; - } - -+static void -+s390_detach_breakpoints (int detached_pid) -+{ -+ s390_detach_breakpoints_pid = detached_pid; -+ -+ /* Do not touch the WATCH_BASE here. */ -+ s390_fix_watch_points_list (detached_pid, NULL); -+} -+ - static int - s390_can_use_hw_breakpoint (int type, int cnt, int othertype) - { -@@ -389,6 +417,39 @@ s390_region_ok_for_hw_watchpoint (CORE_A - return 1; - } - -+static int (*s390_super_follow_fork) (struct target_ops *ops, int follow_child); -+ -+/* We need to duplicate the LINUX_CHILD_FOLLOW_FORK behavior here and catch its -+ called DETACH_BREAKPOINTS to avoid corrupting our local registers mirror. */ -+ -+int -+s390_follow_fork (struct target_ops *ops, int follow_child) -+{ -+ ptid_t last_ptid; -+ struct target_waitstatus last_status; -+ int has_vforked; -+ int parent_pid, child_pid; -+ -+ get_last_target_status (&last_ptid, &last_status); -+ has_vforked = (last_status.kind == TARGET_WAITKIND_VFORKED); -+ parent_pid = ptid_get_lwp (last_ptid); -+ if (parent_pid == 0) -+ parent_pid = ptid_get_pid (last_ptid); -+ child_pid = ptid_get_pid (last_status.value.related_pid); -+ -+ if (! follow_child) -+ { -+ s390_detach_breakpoints (child_pid); -+ } -+ else -+ { -+ if (! has_vforked) -+ s390_detach_breakpoints (child_pid); -+ } -+ -+ return (*s390_super_follow_fork) (ops, follow_child); -+} -+ - - void _initialize_s390_nat (void); - -@@ -412,6 +473,9 @@ _initialize_s390_nat (void) - t->to_insert_watchpoint = s390_insert_watchpoint; - t->to_remove_watchpoint = s390_remove_watchpoint; - -+ s390_super_follow_fork = t->to_follow_fork; -+ t->to_follow_fork = s390_follow_fork; -+ - /* Register the target. */ - linux_nat_add_target (t); - linux_nat_set_new_thread (t, s390_fix_watch_points); -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c 2009-08-04 07:17:58.000000000 +0200 -@@ -0,0 +1,172 @@ -+/* Test case for forgotten hw-watchpoints after fork()-off of a process. -+ -+ Copyright 2008 -+ Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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. */ -+ -+#include -+#include -+ -+static void delay (void) -+{ -+ int i = usleep (1000000 / 100); -+ assert (i == 0 || errno == EINTR); -+} -+ -+#if defined FOLLOW_PARENT -+ -+static void forkoff (int nr) -+{ -+ pid_t child, pid_got; -+ int exit_code = 42 + nr; -+ int status, i; -+ -+ child = fork (); -+ switch (child) -+ { -+ case -1: -+ assert (0); -+ case 0: -+ printf ("child%d: %d\n", nr, (int) getpid ()); -+ /* Delay to get both the "child%d" and "parent%d" message printed without -+ a race breaking expect by its endless wait on `$gdb_prompt$': -+ Breakpoint 3, breakpoint () at ../../../gdb/testsuite/gdb.threads/watchpoint-fork.c:33 -+ 33 } -+ (gdb) parent2: 14223 */ -+ i = sleep (1); -+ assert (i == 0); -+ -+ /* We must not get caught here (against a forgotten breakpoint). */ -+ var++; -+ breakpoint (); -+ -+ _exit (exit_code); -+ default: -+ printf ("parent%d: %d\n", nr, (int) child); -+ /* Delay to get both the "child%d" and "parent%d" message printed, see -+ above. */ -+ i = sleep (1); -+ assert (i == 0); -+ -+ pid_got = wait (&status); -+ assert (pid_got == child); -+ assert (WIFEXITED (status)); -+ assert (WEXITSTATUS (status) == exit_code); -+ -+ /* We must get caught here (against a false watchpoint removal). */ -+ breakpoint (); -+ } -+} -+ -+#elif defined FOLLOW_CHILD -+ -+static volatile int usr1_got; -+ -+static void handler_usr1 (int signo) -+{ -+ usr1_got++; -+} -+ -+static void forkoff (int nr) -+{ -+ pid_t child; -+ int i, loop; -+ struct sigaction act, oldact; -+#ifdef THREAD -+ void *thread_result; -+#endif -+ -+ memset (&act, 0, sizeof act); -+ act.sa_flags = SA_RESTART; -+ act.sa_handler = handler_usr1; -+ sigemptyset (&act.sa_mask); -+ i = sigaction (SIGUSR1, &act, &oldact); -+ assert (i == 0); -+ -+ child = fork (); -+ switch (child) -+ { -+ case -1: -+ assert (0); -+ default: -+ printf ("parent%d: %d\n", nr, (int) child); -+ -+ /* Sleep for a while to possibly get incorrectly ATTACH_THREADed by GDB -+ tracing the child fork with no longer valid thread/lwp entries of the -+ parent. */ -+ -+ i = sleep (2); -+ assert (i == 0); -+ -+ /* We must not get caught here (against a forgotten breakpoint). */ -+ -+ var++; -+ breakpoint (); -+ -+#ifdef THREAD -+ /* And neither got caught our thread. */ -+ -+ step = 99; -+ i = pthread_join (thread, &thread_result); -+ assert (i == 0); -+ assert (thread_result == (void *) 99UL); -+#endif -+ -+ /* Be sure our child knows we did not get caught above. */ -+ -+ i = kill (child, SIGUSR1); -+ assert (i == 0); -+ -+ /* Sleep for a while to check GDB's `info threads' no longer tracks us in -+ the child fork. */ -+ -+ i = sleep (2); -+ assert (i == 0); -+ -+ _exit (0); -+ case 0: -+ printf ("child%d: %d\n", nr, (int) getpid ()); -+ -+ /* Let the parent signal us about its success. Be careful of races. */ -+ -+ for (loop = 0; loop < 1000; loop++) -+ { -+ /* Parent either died (and USR1_GOT is zero) or it succeeded. */ -+ if (kill (getppid (), 0) != 0) -+ break; -+ /* Parent succeeded? */ -+ if (usr1_got) -+ break; -+ -+ delay (); -+ } -+ assert (usr1_got); -+ -+ /* We must get caught here (against a false watchpoint removal). */ -+ -+ breakpoint (); -+ } -+ -+ i = sigaction (SIGUSR1, &oldact, NULL); -+ assert (i == 0); -+} -+ -+#else -+# error "!FOLLOW_PARENT && !FOLLOW_CHILD" -+#endif -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c 2009-08-04 07:17:58.000000000 +0200 -@@ -0,0 +1,154 @@ -+/* Test case for forgotten hw-watchpoints after fork()-off of a process. -+ -+ Copyright 2008 -+ Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#define gettid() syscall (__NR_gettid) -+ -+/* Non-atomic `var++' should not hurt as we synchronize the threads by the STEP -+ variable. Hit-comments need to be duplicite there to catch both at-stops -+ and behind-stops, depending on the target. */ -+ -+static volatile int var; -+ -+static void dummy (void) -+{ -+} -+ -+static void breakpoint (void) -+{ -+} -+ -+/* Include here the functions: -+ static void forkoff (int nr); -+ static void delay (void); */ -+ -+static pthread_t thread; -+static volatile int step; -+#define THREAD -+ -+#include "watchpoint-fork-forkoff.c" -+ -+static void *start (void *arg) -+{ -+ if (step >= 3) -+ goto step_3; -+ -+ while (step != 1) -+ delay (); -+ -+ var++; /* validity-thread-B */ -+ dummy (); /* validity-thread-B */ -+ step = 2; -+ while (step != 3) -+ { -+ if (step == 99) -+ goto step_99; -+ delay (); -+ } -+ -+step_3: -+ if (step >= 5) -+ goto step_5; -+ -+ var++; /* after-fork1-B */ -+ dummy (); /* after-fork1-B */ -+ step = 4; -+ while (step != 5) -+ { -+ if (step == 99) -+ goto step_99; -+ delay (); -+ } -+ -+step_5: -+ var++; /* after-fork2-B */ -+ dummy (); /* after-fork2-B */ -+ return (void *) 5UL; -+ -+step_99: -+ /* We must not get caught here (against a forgotten breakpoint). */ -+ var++; -+ breakpoint (); -+ return (void *) 99UL; -+} -+ -+int main (void) -+{ -+ int i; -+ void *thread_result; -+ -+ setbuf (stdout, NULL); -+ printf ("main: %d\n", (int) gettid ()); -+ -+ /* General watchpoints validity. */ -+ var++; /* validity-first */ -+ dummy (); /* validity-first */ -+ -+ i = pthread_create (&thread, NULL, start, NULL); -+ assert (i == 0); -+ -+ var++; /* validity-thread-A */ -+ dummy (); /* validity-thread-A */ -+ step = 1; -+ while (step != 2) -+ delay (); -+ -+ /* Hardware watchpoints got disarmed here. */ -+ forkoff (1); -+ -+ var++; /* after-fork1-A */ -+ dummy (); /* after-fork1-A */ -+ step = 3; -+#ifdef FOLLOW_CHILD -+ /* Spawn new thread as it was deleted in the child of FORK. */ -+ i = pthread_create (&thread, NULL, start, NULL); -+ assert (i == 0); -+#endif -+ while (step != 4) -+ delay (); -+ -+ /* A sanity check for double hardware watchpoints removal. */ -+ forkoff (2); -+ -+ var++; /* after-fork2-A */ -+ dummy (); /* after-fork2-A */ -+ step = 5; -+#ifdef FOLLOW_CHILD -+ /* Spawn new thread as it was deleted in the child of FORK. */ -+ i = pthread_create (&thread, NULL, start, NULL); -+ assert (i == 0); -+#endif -+ -+ i = pthread_join (thread, &thread_result); -+ assert (i == 0); -+ assert (thread_result == (void *) 5UL); -+ -+ return 0; -+} -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork.c 2009-08-04 07:17:58.000000000 +0200 -@@ -0,0 +1,56 @@ -+/* Test case for forgotten hw-watchpoints after fork()-off of a process. -+ -+ Copyright 2008 -+ Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 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. */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static volatile int var; -+ -+static void breakpoint (void) -+{ -+} -+ -+/* Include here the function: -+ static void forkoff (int nr); */ -+ -+#include "watchpoint-fork-forkoff.c" -+ -+int main (void) -+{ -+ setbuf (stdout, NULL); -+ printf ("main: %d\n", (int) getpid ()); -+ -+ /* General watchpoints validity. */ -+ var++; -+ /* Hardware watchpoints got disarmed here. */ -+ forkoff (1); -+ /* This watchpoint got lost before. */ -+ var++; -+ /* A sanity check for double hardware watchpoints removal. */ -+ forkoff (2); -+ var++; -+ -+ return 0; -+} -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.threads/watchpoint-fork.exp 2009-08-04 07:17:58.000000000 +0200 -@@ -0,0 +1,140 @@ -+# 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 . -+ -+# Test case for forgotten hw-watchpoints after fork()-off of a process. -+ -+proc test {type symbol} { -+ global objdir subdir srcdir -+ -+ global pf_prefix -+ set prefix_test $pf_prefix -+ lappend pf_prefix "$type:" -+ set prefix_mt $pf_prefix -+ -+ # no threads -+ -+ set pf_prefix $prefix_mt -+ lappend pf_prefix "singlethreaded:" -+ -+ set testfile watchpoint-fork -+ set srcfile ${testfile}.c -+ set binfile ${objdir}/${subdir}/${testfile} -+ -+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug additional_flags=-D$symbol"] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+ } -+ -+ gdb_exit -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ gdb_test "set follow-fork-mode $type" -+ # Testcase uses it for the `follow-fork-mode child' type. -+ gdb_test "handle SIGUSR1 nostop noprint pass" -+ -+ if { ![runto_main] } then { -+ gdb_suppress_tests -+ return -+ } -+ -+ # Install the watchpoint only after getting into MAIN - workaround some PPC -+ # problem. -+ gdb_test "watch var" "atchpoint 2: var" "Set the watchpoint" -+ -+ # It is never hit but it should not be left over in the fork()ed-off child. -+ gdb_breakpoint "breakpoint" -+ -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 0.*New value = 1.*forkoff *\\(1\\).*" "watchpoints work" -+ gdb_test "continue" \ -+ "reakpoint 3, breakpoint.*" "breakpoint after the first fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 1.*New value = 2.*forkoff *\\(2\\).*" "watchpoint after the first fork" -+ gdb_test "continue" \ -+ "reakpoint 3, breakpoint.*" "breakpoint after the second fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 2.*New value = 3.*return *0;" "watchpoint after the second fork" -+ gdb_test "continue" "Continuing..*Program exited normally." "finish" -+ -+ -+ # threads -+ -+ set pf_prefix $prefix_mt -+ lappend pf_prefix "multithreaded:" -+ -+ set testfile watchpoint-fork-mt -+ set srcfile ${testfile}.c -+ set binfile ${objdir}/${subdir}/${testfile} -+ -+ if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug additional_flags=-D$symbol"] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+ } -+ -+ gdb_exit -+ gdb_start -+ gdb_reinitialize_dir $srcdir/$subdir -+ gdb_load ${binfile} -+ -+ gdb_test "set follow-fork-mode $type" -+ # Testcase uses it for the `follow-fork-mode child' type. -+ gdb_test "handle SIGUSR1 nostop noprint pass" -+ -+ if { ![runto_main] } then { -+ gdb_suppress_tests -+ return -+ } -+ -+ # Install the watchpoint only after getting into MAIN - workaround some PPC -+ # problem. -+ gdb_test "watch var" "atchpoint 2: var" "Set the watchpoint" -+ -+ # It is never hit but it should not be left over in the fork()ed-off child. -+ gdb_breakpoint "breakpoint" -+ -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 0.*New value = 1.*validity-first.*" "singlethread watchpoints work" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 1.*New value = 2.*validity-thread-A.*" "multithreaded watchpoints work at A" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 2.*New value = 3.*validity-thread-B.*" "multithreaded watchpoints work at B" -+ gdb_test "continue" \ -+ "reakpoint 3, breakpoint.*" "breakpoint (A) after the first fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 3.*New value = 4.*after-fork1-A.*" "watchpoint A after the first fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 4.*New value = 5.*after-fork1-B.*" "watchpoint B after the first fork" -+ gdb_test "continue" \ -+ "reakpoint 3, breakpoint.*" "breakpoint (A) after the second fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 5.*New value = 6.*after-fork2-A.*" "watchpoint A after the second fork" -+ gdb_test "continue" \ -+ "atchpoint 2: var.*Old value = 6.*New value = 7.*after-fork2-B.*" "watchpoint B after the second fork" -+ gdb_test "continue" "Continuing..*Program exited normally." "finish" -+ -+ -+ # cleanup -+ -+ set pf_prefix $prefix_test -+} -+ -+test parent FOLLOW_PARENT -+ -+# Only GNU/Linux is known to support `set follow-fork-mode child'. -+if {[istarget "*-*-linux*"]} { -+ test child FOLLOW_CHILD -+} -Index: gdb-6.8.50.20090803/gdb/doc/gdb.texinfo -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/doc/gdb.texinfo 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/doc/gdb.texinfo 2009-08-04 07:17:58.000000000 +0200 -@@ -3625,6 +3625,14 @@ confident that no other thread can becom - software watchpoints as usual. However, @value{GDBN} may not notice - when a non-current thread's activity changes the expression. (Hardware - watchpoints, in contrast, watch an expression in all threads.) -+ -+Software watchpoints single-step the current thread to track the changes. -+Other threads are left freely running on @code{continue}; therefore, their -+changes cannot be caught. To get more reliable software watchpoints, please -+use @code{set scheduler-locking on}. The default for Red Hat/Fedora -+@value{GDBN} is @code{set scheduler-locking step}, which makes the software -+watchpoints safe for the @code{step} command, but not for the @code{continue} -+command. @xref{Thread Stops}. - @end quotation - - @xref{set remote hardware-watchpoint-limit}. -Index: gdb-6.8.50.20090803/gdb/config/i386/nm-linux.h -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/config/i386/nm-linux.h 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/config/i386/nm-linux.h 2009-08-04 07:17:58.000000000 +0200 -@@ -29,4 +29,14 @@ - #define FILL_FPXREGSET - #endif - -+/* Remove a watchpoint that watched the memory region which starts at -+ * address ADDR, whose length is LEN bytes, and for accesses of the -+ * type TYPE. Return 0 on success, -1 on failure. */ -+extern int i386_linux_remove_watchpoint (CORE_ADDR addr, int len, int type); -+ -+/* Override basic i386 macros for watchpoint and hardware breakpoint -+ insertion/removal to support threads. */ -+#define target_remove_watchpoint(addr, len, type) \ -+ i386_linux_remove_watchpoint (addr, len, type) -+ - #endif /* nm-linux.h */ -Index: gdb-6.8.50.20090803/gdb/config/i386/nm-linux64.h -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/config/i386/nm-linux64.h 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/config/i386/nm-linux64.h 2009-08-04 07:17:58.000000000 +0200 -@@ -51,4 +51,14 @@ extern unsigned long amd64_linux_dr_get_ - #define I386_DR_LOW_GET_STATUS() \ - amd64_linux_dr_get_status () - -+/* Remove a watchpoint that watched the memory region which starts at -+ * address ADDR, whose length is LEN bytes, and for accesses of the -+ * type TYPE. Return 0 on success, -1 on failure. */ -+extern int amd64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type); -+ -+/* Override basic amd64 macros for watchpoint and hardware breakpoint -+ insertion/removal to support threads. */ -+#define target_remove_watchpoint(addr, len, type) \ -+ amd64_linux_remove_watchpoint (addr, len, type) -+ - #endif /* nm-linux64.h */ -Index: gdb-6.8.50.20090803/gdb/target.h -=================================================================== ---- gdb-6.8.50.20090803.orig/gdb/target.h 2009-08-04 07:17:19.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/target.h 2009-08-04 07:35:13.000000000 +0200 -@@ -1114,11 +1114,15 @@ extern char *normal_pid_to_str (ptid_t p - for write, 1 for read, and 2 for read/write accesses. Returns 0 for - success, non-zero for failure. */ - -+#ifndef target_insert_watchpoint - #define target_insert_watchpoint(addr, len, type) \ - (*current_target.to_insert_watchpoint) (addr, len, type) -+#endif - -+#ifndef target_remove_watchpoint - #define target_remove_watchpoint(addr, len, type) \ - (*current_target.to_remove_watchpoint) (addr, len, type) -+#endif - - #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ - (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch index c91d360..80a24f9 100644 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ b/gdb-6.6-scheduler_locking-step-is-default.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20081128/gdb/infrun.c +Index: gdb-6.8.50.20090811/gdb/infrun.c =================================================================== ---- gdb-6.8.50.20081128.orig/gdb/infrun.c 2008-12-09 15:56:16.000000000 +0100 -+++ gdb-6.8.50.20081128/gdb/infrun.c 2008-12-09 15:56:59.000000000 +0100 -@@ -931,7 +931,7 @@ static const char *scheduler_enums[] = { +--- gdb-6.8.50.20090811.orig/gdb/infrun.c 2009-08-12 06:56:29.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/infrun.c 2009-08-12 07:13:08.000000000 +0200 +@@ -1075,7 +1075,7 @@ static const char *scheduler_enums[] = { schedlock_step, NULL }; @@ -11,10 +11,10 @@ Index: gdb-6.8.50.20081128/gdb/infrun.c static void show_scheduler_mode (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi-console.exp +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi-console.exp =================================================================== ---- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.mi/mi-console.exp 2008-08-06 14:52:08.000000000 +0200 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi-console.exp 2008-12-09 15:59:34.000000000 +0100 +--- gdb-6.8.50.20090811.orig/gdb/testsuite/gdb.mi/mi-console.exp 2009-08-12 06:56:29.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi-console.exp 2009-08-12 06:58:45.000000000 +0200 @@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ mi_run_to_main @@ -25,10 +25,10 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi-console.exp # Next over the hello() call which will produce lots of output mi_gdb_test "220-exec-next" \ "220\\^running(\r\n\\*running,thread-id=\"all\")?" \ -Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi2-console.exp +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi2-console.exp =================================================================== ---- gdb-6.8.50.20081128.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2008-08-06 14:52:08.000000000 +0200 -+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi2-console.exp 2008-12-09 16:00:33.000000000 +0100 +--- gdb-6.8.50.20090811.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2009-08-12 06:56:29.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi2-console.exp 2009-08-12 06:58:45.000000000 +0200 @@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ mi_run_to_main @@ -39,3 +39,16 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.mi/mi2-console.exp # Next over the hello() call which will produce lots of output send_gdb "220-exec-next\n" gdb_expect { +Index: gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi-cli.exp +=================================================================== +--- gdb-6.8.50.20090811.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2009-06-09 19:12:42.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/testsuite/gdb.mi/mi-cli.exp 2009-08-12 07:13:32.000000000 +0200 +@@ -173,7 +173,7 @@ mi_execute_to "exec-continue" "breakpoin + # Test that the token is output even for CLI commands + # Also test that *stopped includes frame information. + mi_gdb_test "34 next" \ +- ".*34\\\^running.*\\*running,thread-id=\"all\"" \ ++ ".*34\\\^running.*\\*running,thread-id=\"1\"" \ + "34 next: run" + + if {!$async} { diff --git a/gdb-6.6-step-thread-exit.patch b/gdb-6.6-step-thread-exit.patch new file mode 100644 index 0000000..220884f --- /dev/null +++ b/gdb-6.6-step-thread-exit.patch @@ -0,0 +1,60 @@ +Index: gdb-6.8.50.20090811/gdb/linux-nat.c +=================================================================== +--- gdb-6.8.50.20090811.orig/gdb/linux-nat.c 2009-08-12 07:21:20.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/linux-nat.c 2009-08-12 08:11:25.000000000 +0200 +@@ -1656,16 +1656,18 @@ resume_set_callback (struct lwp_info *lp + + static void + linux_nat_resume (struct target_ops *ops, +- ptid_t ptid, int step, enum target_signal signo) ++ ptid_t ptid, int step_int, enum target_signal signo) + { + sigset_t prev_mask; + struct lwp_info *lp; + int resume_many; ++ enum resume_step step = step_int; + + if (debug_linux_nat) + fprintf_unfiltered (gdb_stdlog, + "LLR: Preparing to %s %s, %s, inferior_ptid %s\n", +- step ? "step" : "resume", ++ (step == RESUME_STEP_NEEDED ++ ? "needed" : (step ? "step" : "resume")), + target_pid_to_str (ptid), + signo ? strsignal (signo) : "0", + target_pid_to_str (inferior_ptid)); +@@ -2625,10 +2627,34 @@ linux_nat_filter_event (int lwpid, int s + + if (num_lwps (GET_PID (lp->ptid)) > 1) + { ++ enum resume_step step = lp->step; ++ pid_t pid = GET_PID (lp->ptid); ++ + /* If there is at least one more LWP, then the exit signal + was not the end of the debugged application and should be + ignored. */ + exit_lwp (lp); ++ ++ if (step == RESUME_STEP_USER) ++ { ++ /* Now stop the closest LWP's ... */ ++ lp = find_lwp_pid (pid_to_ptid (pid)); ++ if (!lp) ++ lp = lwp_list; ++ gdb_assert (lp != NULL); ++ errno = 0; ++ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, ++ (void *) (unsigned long) SIGSTOP); ++ if (debug_linux_nat) ++ fprintf_unfiltered (gdb_stdlog, ++ "PTRACE_CONT %s, 0, 0 (%s)\n", ++ target_pid_to_str (lp->ptid), ++ errno ? safe_strerror (errno) ++ : "OK"); ++ /* Avoid the silent `delayed SIGSTOP' handling. */ ++ lp->signalled = 0; ++ } ++ + return NULL; + } + } diff --git a/gdb-6.8-bz254229-gcore-prpsinfo.patch b/gdb-6.8-bz254229-gcore-prpsinfo.patch index c58a39c..e2b3065 100644 --- a/gdb-6.8-bz254229-gcore-prpsinfo.patch +++ b/gdb-6.8-bz254229-gcore-prpsinfo.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090803/bfd/elf-bfd.h +Index: gdb-6.8.50.20090910/bfd/elf-bfd.h =================================================================== ---- gdb-6.8.50.20090803.orig/bfd/elf-bfd.h 2009-07-23 15:00:20.000000000 +0200 -+++ gdb-6.8.50.20090803/bfd/elf-bfd.h 2009-08-03 17:21:25.000000000 +0200 -@@ -2115,7 +2115,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find +--- gdb-6.8.50.20090910.orig/bfd/elf-bfd.h 2009-09-09 23:38:57.000000000 +0200 ++++ gdb-6.8.50.20090910/bfd/elf-bfd.h 2009-09-10 23:01:15.000000000 +0200 +@@ -2121,7 +2121,7 @@ extern Elf_Internal_Phdr * _bfd_elf_find extern char *elfcore_write_note (bfd *, char *, int *, const char *, int, const void *, int); extern char *elfcore_write_prpsinfo @@ -11,11 +11,11 @@ Index: gdb-6.8.50.20090803/bfd/elf-bfd.h extern char *elfcore_write_prstatus (bfd *, char *, int *, long, int, const void *); extern char * elfcore_write_pstatus -Index: gdb-6.8.50.20090803/bfd/elf.c +Index: gdb-6.8.50.20090910/bfd/elf.c =================================================================== ---- gdb-6.8.50.20090803.orig/bfd/elf.c 2009-07-23 15:00:20.000000000 +0200 -+++ gdb-6.8.50.20090803/bfd/elf.c 2009-08-03 17:23:13.000000000 +0200 -@@ -8381,6 +8381,7 @@ char * +--- gdb-6.8.50.20090910.orig/bfd/elf.c 2009-09-09 23:38:57.000000000 +0200 ++++ gdb-6.8.50.20090910/bfd/elf.c 2009-09-10 23:04:17.000000000 +0200 +@@ -8398,6 +8398,7 @@ char * elfcore_write_prpsinfo (bfd *abfd, char *buf, int *bufsiz, @@ -23,7 +23,7 @@ Index: gdb-6.8.50.20090803/bfd/elf.c const char *fname, const char *psargs) { -@@ -8407,9 +8408,15 @@ elfcore_write_prpsinfo (bfd *abfd, +@@ -8424,9 +8425,15 @@ elfcore_write_prpsinfo (bfd *abfd, int note_type = NT_PRPSINFO; #endif @@ -42,7 +42,7 @@ Index: gdb-6.8.50.20090803/bfd/elf.c return elfcore_write_note (abfd, buf, bufsiz, note_name, note_type, &data, sizeof (data)); } -@@ -8424,9 +8431,15 @@ elfcore_write_prpsinfo (bfd *abfd, +@@ -8441,9 +8448,15 @@ elfcore_write_prpsinfo (bfd *abfd, int note_type = NT_PRPSINFO; #endif @@ -61,10 +61,10 @@ Index: gdb-6.8.50.20090803/bfd/elf.c return elfcore_write_note (abfd, buf, bufsiz, note_name, note_type, &data, sizeof (data)); } -Index: gdb-6.8.50.20090803/gdb/amd64-linux-nat.c +Index: gdb-6.8.50.20090910/gdb/amd64-linux-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/amd64-linux-nat.c 2009-08-03 17:19:57.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/amd64-linux-nat.c 2009-08-03 17:21:25.000000000 +0200 +--- gdb-6.8.50.20090910.orig/gdb/amd64-linux-nat.c 2009-09-10 23:01:07.000000000 +0200 ++++ gdb-6.8.50.20090910/gdb/amd64-linux-nat.c 2009-09-10 23:01:15.000000000 +0200 @@ -140,6 +140,7 @@ static int amd64_linux_gregset32_reg_off static char * @@ -98,10 +98,10 @@ Index: gdb-6.8.50.20090803/gdb/amd64-linux-nat.c } static void -Index: gdb-6.8.50.20090803/gdb/fbsd-nat.c +Index: gdb-6.8.50.20090910/gdb/fbsd-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/fbsd-nat.c 2009-07-02 19:21:06.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/fbsd-nat.c 2009-08-03 17:21:25.000000000 +0200 +--- gdb-6.8.50.20090910.orig/gdb/fbsd-nat.c 2009-07-02 19:21:06.000000000 +0200 ++++ gdb-6.8.50.20090910/gdb/fbsd-nat.c 2009-09-10 23:01:15.000000000 +0200 @@ -211,6 +211,7 @@ fbsd_make_corefile_notes (bfd *obfd, int psargs = reconcat (psargs, psargs, " ", get_inferior_args (), NULL); @@ -110,10 +110,10 @@ Index: gdb-6.8.50.20090803/gdb/fbsd-nat.c fname, psargs); } -Index: gdb-6.8.50.20090803/gdb/linux-nat.c +Index: gdb-6.8.50.20090910/gdb/linux-nat.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.c 2009-08-03 17:19:56.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.c 2009-08-03 17:24:03.000000000 +0200 +--- gdb-6.8.50.20090910.orig/gdb/linux-nat.c 2009-09-10 23:01:06.000000000 +0200 ++++ gdb-6.8.50.20090910/gdb/linux-nat.c 2009-09-10 23:01:15.000000000 +0200 @@ -55,6 +55,7 @@ #include "xml-support.h" #include "terminal.h" @@ -131,7 +131,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c char *(*linux_elfcore_write_prstatus) (bfd *, char *, int *, long, int, const void *) = elfcore_write_prstatus; static char * -@@ -3840,6 +3841,159 @@ linux_spu_make_corefile_notes (bfd *obfd +@@ -3946,6 +3947,159 @@ linux_spu_make_corefile_notes (bfd *obfd return args.note_data; } @@ -291,7 +291,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c /* Fills the "to_make_corefile_note" target vector. Builds the note section for a corefile, and returns it in a malloc buffer. */ -@@ -3860,8 +4014,14 @@ linux_nat_make_corefile_notes (bfd *obfd +@@ -3966,8 +4120,14 @@ linux_nat_make_corefile_notes (bfd *obfd if (get_exec_file (0)) { @@ -306,7 +306,7 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c if (get_inferior_args ()) { char *string_end; -@@ -3877,9 +4037,15 @@ linux_nat_make_corefile_notes (bfd *obfd +@@ -3983,9 +4143,15 @@ linux_nat_make_corefile_notes (bfd *obfd psargs_end - string_end); } } @@ -324,11 +324,11 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.c } /* Dump information for threads. */ -Index: gdb-6.8.50.20090803/gdb/linux-nat.h +Index: gdb-6.8.50.20090910/gdb/linux-nat.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/linux-nat.h 2009-08-03 17:19:56.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/linux-nat.h 2009-08-03 17:21:25.000000000 +0200 -@@ -148,7 +148,7 @@ struct siginfo *linux_nat_get_siginfo (p +--- gdb-6.8.50.20090910.orig/gdb/linux-nat.h 2009-09-10 23:01:06.000000000 +0200 ++++ gdb-6.8.50.20090910/gdb/linux-nat.h 2009-09-10 23:01:15.000000000 +0200 +@@ -154,7 +154,7 @@ struct siginfo *linux_nat_get_siginfo (p /* These functions make elfcore note sections. They may get overriden by code adjusting data for multi-target builds. */ extern char *(*linux_elfcore_write_prpsinfo) @@ -337,10 +337,10 @@ Index: gdb-6.8.50.20090803/gdb/linux-nat.h extern char *(*linux_elfcore_write_prstatus) (bfd *, char *, int *, long, int, const void *); extern char *(*linux_elfcore_write_prfpreg) -Index: gdb-6.8.50.20090803/gdb/procfs.c +Index: gdb-6.8.50.20090910/gdb/procfs.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/procfs.c 2009-08-01 02:02:04.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/procfs.c 2009-08-03 17:21:25.000000000 +0200 +--- gdb-6.8.50.20090910.orig/gdb/procfs.c 2009-08-01 02:02:04.000000000 +0200 ++++ gdb-6.8.50.20090910/gdb/procfs.c 2009-09-10 23:01:15.000000000 +0200 @@ -6147,6 +6147,7 @@ procfs_make_note_section (bfd *obfd, int note_data = (char *) elfcore_write_prpsinfo (obfd, note_data, diff --git a/gdb-6.8-bz457187-largefile.patch b/gdb-6.8-bz457187-largefile.patch index 18cd3b3..7fcfe91 100644 --- a/gdb-6.8-bz457187-largefile.patch +++ b/gdb-6.8-bz457187-largefile.patch @@ -5,33 +5,30 @@ gdb/ * config.in: Regenerate. * configure: Regenerate. -Index: gdb-6.8.50.20090803/gdb/configure.ac +Index: gdb-6.8.50.20090909/gdb/configure.ac =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/configure.ac 2009-08-04 06:32:39.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/configure.ac 2009-08-04 06:33:51.000000000 +0200 -@@ -30,6 +30,7 @@ AC_GNU_SOURCE - AC_AIX - AC_ISC_POSIX +--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200 +@@ -28,6 +28,7 @@ AM_MAINTAINER_MODE + AC_PROG_CC + AC_USE_SYSTEM_EXTENSIONS gl_EARLY +AC_SYS_LARGEFILE AM_PROG_CC_STDC AC_CONFIG_AUX_DIR(..) -Index: gdb-6.8.50.20090803/gdb/config.in +Index: gdb-6.8.50.20090909/gdb/config.in =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/config.in 2009-08-04 06:32:39.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/config.in 2009-08-04 06:33:51.000000000 +0200 -@@ -744,6 +744,9 @@ - # undef _ALL_SOURCE +--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:08:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:11:33.000000000 +0200 +@@ -751,10 +751,16 @@ + # endif #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 -@@ -753,6 +756,9 @@ + /* Define to 1 so gets a definition of anon_hdl. Works around a problem on IRIX 5. */ #undef _KMEMUSER @@ -41,11 +38,19 @@ Index: gdb-6.8.50.20090803/gdb/config.in /* Define to 1 if on MINIX. */ #undef _MINIX -Index: gdb-6.8.50.20090803/gdb/configure +Index: gdb-6.8.50.20090909/gdb/configure =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/configure 2009-08-04 06:32:39.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/configure 2009-08-04 06:33:51.000000000 +0200 -@@ -874,6 +874,7 @@ Optional Features: +--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:10:45.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:07.000000000 +0200 +@@ -884,6 +884,7 @@ ac_subst_files='host_makefile_frag' + ac_user_opts=' + enable_option_checking + enable_maintainer_mode ++enable_largefile + enable_dependency_tracking + with_separate_debug_dir + with_gdb_datadir +@@ -1562,6 +1563,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 @@ -53,33 +58,29 @@ Index: gdb-6.8.50.20090803/gdb/configure --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-targets=TARGETS -@@ -3347,6 +3348,370 @@ _ACEOF +@@ -4100,6 +4102,204 @@ fi -+# Check whether --enable-largefile or --disable-largefile was given. -+if test "${enable_largefile+set}" = set; then -+ enableval="$enable_largefile" ++# Check whether --enable-largefile was given. ++if test "${enable_largefile+set}" = set; then : ++ enableval=$enable_largefile; ++fi + -+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 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 ++$as_echo_n "checking for special C compiler options needed for large files... " >&6; } ++if test "${ac_cv_sys_largefile_CC+set}" = set; then : ++ $as_echo_n "(cached) " >&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 ++ # IRIX 6.2 and later do not support large files by default, ++ # so use the C compiler's -n32 option if that helps. ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. @@ -98,89 +99,34 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 ++ if ac_fn_c_try_compile "$LINENO"; 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 ++rm -f core conftest.err conftest.$ac_objext ++ CC="$CC -n32" ++ if ac_fn_c_try_compile "$LINENO"; 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 ++rm -f core 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 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 ++$as_echo "$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 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 ++$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } ++if test "${ac_cv_sys_file_offset_bits+set}" = set; then : ++ $as_echo_n "(cached) " >&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 ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. @@ -199,40 +145,11 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 -+ ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_cv_sys_file_offset_bits=no; break +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 ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include @@ -252,60 +169,33 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 ++if ac_fn_c_try_compile "$LINENO"; 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 ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ ac_cv_sys_file_offset_bits=unknown + 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 -+ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 ++$as_echo "$ac_cv_sys_file_offset_bits" >&6; } ++case $ac_cv_sys_file_offset_bits in #( ++ no | unknown) ;; ++ *) +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 ++;; ++esac ++rm -rf conftest* ++ if test $ac_cv_sys_file_offset_bits = unknown; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 ++$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } ++if test "${ac_cv_sys_large_files+set}" = set; then : ++ $as_echo_n "(cached) " >&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 ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. @@ -324,40 +214,11 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 -+ ++if ac_fn_c_try_compile "$LINENO"; then : ++ ac_cv_sys_large_files=no; break +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 ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include @@ -377,48 +238,26 @@ Index: gdb-6.8.50.20090803/gdb/configure + 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 ++if ac_fn_c_try_compile "$LINENO"; 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 ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ ac_cv_sys_large_files=unknown + 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 -+ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 ++$as_echo "$ac_cv_sys_large_files" >&6; } ++case $ac_cv_sys_large_files in #( ++ no | unknown) ;; ++ *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF -+ -+fi -+rm -f conftest* ++;; ++esac ++rm -rf conftest* ++ fi +fi + diff --git a/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/gdb-6.8-bz466901-backtrace-full-prelinked.patch index 45f4df2..f01a49f 100644 --- a/gdb-6.8-bz466901-backtrace-full-prelinked.patch +++ b/gdb-6.8-bz466901-backtrace-full-prelinked.patch @@ -1,9 +1,9 @@ Fix resolving of variables at locations lists in prelinked libs (BZ 466901). -Index: gdb-6.8.50.20090803/gdb/dwarf2loc.c +Index: gdb-6.8.50.20090909/gdb/dwarf2loc.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/dwarf2loc.c 2009-08-04 06:29:47.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/dwarf2loc.c 2009-08-04 06:33:35.000000000 +0200 +--- gdb-6.8.50.20090909.orig/gdb/dwarf2loc.c 2009-09-09 20:08:03.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/dwarf2loc.c 2009-09-09 20:10:35.000000000 +0200 @@ -56,7 +56,9 @@ find_location_expression (struct dwarf2_ CORE_ADDR low, high; gdb_byte *loc_ptr, *buf_end; @@ -15,10 +15,10 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2loc.c struct gdbarch *gdbarch = get_objfile_arch (objfile); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu); -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp 2009-08-04 06:33:35.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp 2009-09-09 20:10:35.000000000 +0200 @@ -0,0 +1,102 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -122,10 +122,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp + +# `abort' can get expressed as `*__GI_abort'. +gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()" -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c 2009-08-04 06:33:35.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c 2009-09-09 20:10:35.000000000 +0200 @@ -0,0 +1,26 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -153,10 +153,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c + func (); + return 0; +} -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S +Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S 2009-08-04 06:33:35.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S 2009-09-09 20:10:35.000000000 +0200 @@ -0,0 +1,328 @@ +/* This testcase is part of GDB, the GNU debugger. + diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch index cd19d65..341b080 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.20090803/gdb/dwarf2read.c +Index: gdb-6.8.50.20090811/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/dwarf2read.c 2009-08-04 06:32:58.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/dwarf2read.c 2009-08-04 06:33:18.000000000 +0200 -@@ -2459,6 +2459,7 @@ scan_partial_symbols (struct partial_die +--- gdb-6.8.50.20090811.orig/gdb/dwarf2read.c 2009-08-13 10:14:45.000000000 +0200 ++++ gdb-6.8.50.20090811/gdb/dwarf2read.c 2009-08-13 10:22:36.000000000 +0200 +@@ -2480,6 +2480,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.20090803/gdb/dwarf2read.c case DW_TAG_typedef: case DW_TAG_union_type: if (!pdi->is_declaration) -@@ -2654,6 +2655,7 @@ add_partial_symbol (struct partial_die_i +@@ -2675,6 +2676,7 @@ add_partial_symbol (struct partial_die_i } break; case DW_TAG_variable: @@ -18,7 +18,15 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c if (pdi->is_external) { /* Global Variable. -@@ -4790,7 +4792,8 @@ dwarf2_add_field (struct field_info *fip +@@ -2805,6 +2807,7 @@ die_needs_namespace (struct die_info *di + return 1; + + case DW_TAG_variable: ++ case DW_TAG_constant: + { + struct attribute *attr; + attr = dwarf2_attr (die, DW_AT_specification, cu); +@@ -4741,7 +4744,8 @@ dwarf2_add_field (struct field_info *fip fip->non_public_fields = 1; } } @@ -28,7 +36,7 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c { /* C++ static member. */ -@@ -5297,7 +5300,8 @@ read_structure_type (struct die_info *di +@@ -5233,7 +5237,8 @@ read_structure_type (struct die_info *di while (child_die && child_die->tag) { if (child_die->tag == DW_TAG_member @@ -38,7 +46,7 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c { /* NOTE: carlton/2002-11-05: A C++ static data member should be a DW_TAG_member that is a declaration, but -@@ -5416,6 +5420,7 @@ process_structure_scope (struct die_info +@@ -5352,6 +5357,7 @@ process_structure_scope (struct die_info { if (child_die->tag == DW_TAG_member || child_die->tag == DW_TAG_variable @@ -46,15 +54,15 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c || child_die->tag == DW_TAG_inheritance) { /* Do nothing. */ -@@ -6926,6 +6931,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -6980,6 +6986,7 @@ load_partial_dies (bfd *abfd, gdb_byte * && abbrev->tag != DW_TAG_subprogram && abbrev->tag != DW_TAG_lexical_block && abbrev->tag != DW_TAG_variable + && abbrev->tag != DW_TAG_constant && abbrev->tag != DW_TAG_namespace + && abbrev->tag != DW_TAG_module && abbrev->tag != DW_TAG_member) - { -@@ -7033,6 +7039,7 @@ load_partial_dies (bfd *abfd, gdb_byte * +@@ -7088,6 +7095,7 @@ load_partial_dies (bfd *abfd, gdb_byte * if (load_all || abbrev->tag == DW_TAG_subprogram || abbrev->tag == DW_TAG_variable @@ -62,7 +70,7 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c || abbrev->tag == DW_TAG_namespace || part_die->is_declaration) { -@@ -8840,6 +8847,11 @@ new_symbol (struct die_info *die, struct +@@ -8901,6 +8909,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-addon.patch b/gdb-6.8-inlining-addon.patch index 649c69e..d6c5170 100644 --- a/gdb-6.8-inlining-addon.patch +++ b/gdb-6.8-inlining-addon.patch @@ -5,10 +5,10 @@ causing: FAIL: gdb.base/unwindonsignal.exp: unwindonsignal, stack unwound resume() -> target_resume() move of clear_inline_frame_state() is for: gdb.mi/mi-nsmoribund.exp -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-bt.c +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-bt.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-bt.c 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-bt.c 2009-06-28 02:20:24.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-bt.c 2009-09-17 12:49:01.000000000 +0200 @@ -13,10 +13,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -28,10 +28,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-bt.c inline int func1(void) { -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.c +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.c 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.c 2009-06-28 02:20:24.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.c 2009-09-17 12:49:01.000000000 +0200 @@ -13,13 +13,19 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -54,10 +54,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.c inline int func1(void) { bar (); -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.exp +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-06-28 02:20:24.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-cmds.exp 2009-09-17 12:49:01.000000000 +0200 @@ -230,7 +230,7 @@ set line3 [gdb_get_line_number "set brea gdb_breakpoint $line3 gdb_continue_to_breakpoint "consecutive func1" @@ -110,10 +110,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-cmds.exp +gdb_test "info frame" "inlined into frame.*" "outer_inline2 inlined" +gdb_test "fini" "" "up from outer_inline2" +gdb_test "info frame" " in main \[^\n\]*\n source language.*" "main not inlined" -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.c +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-locals.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.c 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.c 2009-06-28 02:20:24.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.c 2009-09-17 12:49:01.000000000 +0200 @@ -13,11 +13,16 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -133,10 +133,10 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.c inline int func1(int arg1) { -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.exp +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2009-06-30 17:50:27.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.exp 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-locals.exp 2009-06-30 17:50:27.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-locals.exp 2009-09-17 12:49:01.000000000 +0200 @@ -77,6 +77,9 @@ if { ! $no_frames } { # Make sure that locals on the stack are found. This is an array to @@ -155,11 +155,11 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-locals.exp + setup_kfail *-*-* "gcc/debug.optimization" +} gdb_test "print array\[0\]" "\\\$$decimal = 184" "print local (3)" -Index: gdb-6.8.50.20090803/gdb/frame.c +Index: gdb-6.8.91.20090917/gdb/frame.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/frame.c 2009-08-03 15:56:08.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/frame.c 2009-08-03 16:57:40.000000000 +0200 -@@ -276,7 +276,7 @@ fprint_frame (struct ui_file *file, stru +--- gdb-6.8.91.20090917.orig/gdb/frame.c 2009-09-17 12:48:49.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/frame.c 2009-09-17 12:49:01.000000000 +0200 +@@ -310,7 +310,7 @@ fprint_frame (struct ui_file *file, stru static struct frame_info * skip_inlined_frames (struct frame_info *frame) { @@ -168,7 +168,7 @@ Index: gdb-6.8.50.20090803/gdb/frame.c frame = get_prev_frame (frame); return frame; -@@ -1715,6 +1715,7 @@ get_frame_address_in_block (struct frame +@@ -1778,6 +1778,7 @@ get_frame_address_in_block (struct frame { /* A draft address. */ CORE_ADDR pc = get_frame_pc (this_frame); @@ -176,7 +176,7 @@ Index: gdb-6.8.50.20090803/gdb/frame.c struct frame_info *next_frame = this_frame->next; -@@ -1757,6 +1758,9 @@ get_frame_address_in_block (struct frame +@@ -1820,6 +1821,9 @@ get_frame_address_in_block (struct frame while in an inlined function, then the code address of the "calling" normal function should not be adjusted either. */ @@ -186,7 +186,7 @@ Index: gdb-6.8.50.20090803/gdb/frame.c while (get_frame_type (next_frame) == INLINE_FRAME) next_frame = next_frame->next; -@@ -1788,7 +1792,7 @@ find_frame_sal (struct frame_info *frame +@@ -1851,7 +1855,7 @@ find_frame_sal (struct frame_info *frame sym = inline_skipped_symbol (inferior_ptid); init_sal (sal); @@ -195,19 +195,19 @@ Index: gdb-6.8.50.20090803/gdb/frame.c { sal->symtab = SYMBOL_SYMTAB (sym); sal->line = SYMBOL_LINE (sym); -Index: gdb-6.8.50.20090803/gdb/breakpoint.c +Index: gdb-6.8.91.20090917/gdb/breakpoint.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/breakpoint.c 2009-08-03 16:56:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/breakpoint.c 2009-08-03 17:19:24.000000000 +0200 -@@ -60,6 +60,7 @@ - #include "wrapper.h" - #include "valprint.h" +--- gdb-6.8.91.20090917.orig/gdb/breakpoint.c 2009-09-17 12:48:51.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/breakpoint.c 2009-09-17 12:49:12.000000000 +0200 +@@ -62,6 +62,7 @@ + #include "jit.h" + #include "xml-syscall.h" #include "parser-defs.h" +#include "inline-frame.h" /* readline include files */ #include "readline/readline.h" -@@ -3065,10 +3066,24 @@ bpstat_check_breakpoint_conditions (bpst +@@ -3220,10 +3221,24 @@ bpstat_check_breakpoint_conditions (bpst const struct bp_location *bl = bs->breakpoint_at; struct breakpoint *b = bl->owner; @@ -236,7 +236,7 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c { int value_is_zero = 0; -@@ -3215,6 +3230,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p +@@ -3383,6 +3398,12 @@ bpstat_stop_status (CORE_ADDR bp_addr, p bs->print = 0; } bs->commands = copy_command_lines (bs->commands); @@ -249,7 +249,7 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c } /* Print nothing for this entry if we dont stop or if we dont print. */ -@@ -5164,9 +5185,9 @@ set_momentary_breakpoint (struct gdbarch +@@ -5572,9 +5593,9 @@ set_momentary_breakpoint (struct gdbarch { struct breakpoint *b; @@ -262,11 +262,11 @@ Index: gdb-6.8.50.20090803/gdb/breakpoint.c b = set_raw_breakpoint (gdbarch, sal, type); b->enable_state = bp_enabled; -Index: gdb-6.8.50.20090803/gdb/inline-frame.c +Index: gdb-6.8.91.20090917/gdb/inline-frame.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/inline-frame.c 2009-06-28 02:20:22.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/inline-frame.c 2009-08-03 16:57:40.000000000 +0200 -@@ -195,6 +195,12 @@ inline_frame_sniffer (const struct frame +--- gdb-6.8.91.20090917.orig/gdb/inline-frame.c 2009-09-13 18:28:28.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/inline-frame.c 2009-09-17 12:49:01.000000000 +0200 +@@ -199,6 +199,12 @@ inline_frame_sniffer (const struct frame if (frame_block == NULL) return 0; @@ -279,7 +279,7 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c /* Calculate DEPTH, the number of inlined functions at this location. */ depth = 0; -@@ -204,6 +210,10 @@ inline_frame_sniffer (const struct frame +@@ -208,6 +214,10 @@ inline_frame_sniffer (const struct frame if (block_inlined_p (cur_block)) depth++; @@ -290,7 +290,7 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c cur_block = BLOCK_SUPERBLOCK (cur_block); } -@@ -287,7 +297,6 @@ skip_inline_frames (ptid_t ptid) +@@ -291,7 +301,6 @@ skip_inline_frames (ptid_t ptid) { CORE_ADDR this_pc; struct block *frame_block, *cur_block; @@ -298,7 +298,7 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c int skip_count = 0; struct inline_state *state; -@@ -308,10 +317,7 @@ skip_inline_frames (ptid_t ptid) +@@ -312,10 +321,7 @@ skip_inline_frames (ptid_t ptid) of BLOCK_START. */ if (BLOCK_START (cur_block) == this_pc || block_starting_point_at (this_pc, cur_block)) @@ -310,7 +310,7 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c else break; } -@@ -323,7 +329,6 @@ skip_inline_frames (ptid_t ptid) +@@ -327,7 +333,6 @@ skip_inline_frames (ptid_t ptid) state = allocate_inline_frame_state (ptid); state->skipped_frames = skip_count; state->saved_pc = this_pc; @@ -318,7 +318,7 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c if (skip_count != 0) reinit_frame_cache (); -@@ -341,6 +346,23 @@ step_into_inline_frame (ptid_t ptid) +@@ -345,6 +350,23 @@ step_into_inline_frame (ptid_t ptid) reinit_frame_cache (); } @@ -342,10 +342,10 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.c /* Return the number of hidden functions inlined into the current frame. */ -Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-markers.c +Index: gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/testsuite/gdb.opt/inline-markers.c 2009-06-28 02:20:24.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-markers.c 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/testsuite/gdb.opt/inline-markers.c 2009-06-28 02:20:24.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/testsuite/gdb.opt/inline-markers.c 2009-09-17 12:49:01.000000000 +0200 @@ -15,11 +15,6 @@ extern int x, y; @@ -358,11 +358,11 @@ Index: gdb-6.8.50.20090803/gdb/testsuite/gdb.opt/inline-markers.c void marker(void) { x += y; /* set breakpoint 2 here */ -Index: gdb-6.8.50.20090803/gdb/gdbthread.h +Index: gdb-6.8.91.20090917/gdb/gdbthread.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/gdbthread.h 2009-08-03 15:55:53.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/gdbthread.h 2009-08-03 16:57:40.000000000 +0200 -@@ -187,6 +187,12 @@ struct thread_info +--- gdb-6.8.91.20090917.orig/gdb/gdbthread.h 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/gdbthread.h 2009-09-17 12:49:01.000000000 +0200 +@@ -191,6 +191,12 @@ struct thread_info /* Private data used by the target vector implementation. */ struct private_thread_info *private; @@ -375,11 +375,11 @@ Index: gdb-6.8.50.20090803/gdb/gdbthread.h }; /* Create an empty thread list, or empty the existing one. */ -Index: gdb-6.8.50.20090803/gdb/infcmd.c +Index: gdb-6.8.91.20090917/gdb/infcmd.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/infcmd.c 2009-07-02 23:57:27.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/infcmd.c 2009-08-03 17:17:24.000000000 +0200 -@@ -1408,11 +1408,11 @@ finish_command_continuation (void *arg) +--- gdb-6.8.91.20090917.orig/gdb/infcmd.c 2009-09-17 12:47:07.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/infcmd.c 2009-09-17 12:49:01.000000000 +0200 +@@ -1434,11 +1434,11 @@ finish_command_continuation (void *arg) struct type *value_type; value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (a->function)); @@ -393,9 +393,9 @@ Index: gdb-6.8.50.20090803/gdb/infcmd.c print_return_value (SYMBOL_TYPE (a->function), value_type); } -@@ -1514,6 +1514,16 @@ finish_forward (struct symbol *function, - - old_chain = make_cleanup_delete_breakpoint (breakpoint); +@@ -1546,6 +1546,16 @@ finish_forward (struct symbol *function, + tp->initiating_frame = get_frame_id (frame); + make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); + /* We should _always_ set CURRENT_PC_IS_NOTCURRENT here to always see the + calling line with the message `Value returned is ...'. Currently it is @@ -410,7 +410,7 @@ Index: gdb-6.8.50.20090803/gdb/infcmd.c tp->proceed_to_finish = 1; /* We want stop_registers, please... */ proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); -@@ -1535,7 +1545,9 @@ finish_forward (struct symbol *function, +@@ -1567,7 +1577,9 @@ finish_forward (struct symbol *function, static void finish_command (char *arg, int from_tty) { @@ -421,7 +421,7 @@ Index: gdb-6.8.50.20090803/gdb/infcmd.c struct symbol *function; int async_exec = 0; -@@ -1566,45 +1578,63 @@ finish_command (char *arg, int from_tty) +@@ -1598,45 +1610,63 @@ finish_command (char *arg, int from_tty) if (!target_has_execution) error (_("The program is not running.")); @@ -502,7 +502,7 @@ Index: gdb-6.8.50.20090803/gdb/infcmd.c /* Print info on the selected frame, including level number but not source. */ -@@ -1618,10 +1648,14 @@ finish_command (char *arg, int from_tty) +@@ -1650,10 +1680,14 @@ finish_command (char *arg, int from_tty) print_stack_frame (get_selected_frame (NULL), 1, LOCATION); } @@ -518,22 +518,22 @@ Index: gdb-6.8.50.20090803/gdb/infcmd.c } -Index: gdb-6.8.50.20090803/gdb/target.c +Index: gdb-6.8.91.20090917/gdb/target.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/target.c 2009-08-03 16:04:15.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/target.c 2009-08-03 16:57:40.000000000 +0200 -@@ -2079,6 +2079,7 @@ target_resume (ptid_t ptid, int step, en +--- gdb-6.8.91.20090917.orig/gdb/target.c 2009-09-17 12:48:49.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/target.c 2009-09-17 12:49:01.000000000 +0200 +@@ -2187,6 +2187,7 @@ target_resume (ptid_t ptid, int step, en { struct target_ops *t; + clear_inline_frame_state (ptid); - dcache_invalidate (target_dcache); + target_dcache_invalidate (); for (t = current_target.beneath; t != NULL; t = t->beneath) -Index: gdb-6.8.50.20090803/gdb/inline-frame.h +Index: gdb-6.8.91.20090917/gdb/inline-frame.h =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/inline-frame.h 2009-06-28 02:20:22.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/inline-frame.h 2009-08-03 16:57:40.000000000 +0200 +--- gdb-6.8.91.20090917.orig/gdb/inline-frame.h 2009-06-28 02:20:22.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/inline-frame.h 2009-09-17 12:49:01.000000000 +0200 @@ -43,6 +43,10 @@ void clear_inline_frame_state (ptid_t pt void step_into_inline_frame (ptid_t ptid); @@ -545,11 +545,11 @@ Index: gdb-6.8.50.20090803/gdb/inline-frame.h /* Return the number of hidden functions inlined into the current frame. */ -Index: gdb-6.8.50.20090803/gdb/dwarf2read.c +Index: gdb-6.8.91.20090917/gdb/dwarf2read.c =================================================================== ---- gdb-6.8.50.20090803.orig/gdb/dwarf2read.c 2009-08-03 16:56:10.000000000 +0200 -+++ gdb-6.8.50.20090803/gdb/dwarf2read.c 2009-08-03 16:57:40.000000000 +0200 -@@ -4107,6 +4107,7 @@ read_func_scope (struct die_info *die, s +--- gdb-6.8.91.20090917.orig/gdb/dwarf2read.c 2009-09-17 12:48:51.000000000 +0200 ++++ gdb-6.8.91.20090917/gdb/dwarf2read.c 2009-09-17 12:49:01.000000000 +0200 +@@ -4128,6 +4128,7 @@ read_func_scope (struct die_info *die, s struct block *block; unsigned die_children = 0; int inlined_func = (die->tag == DW_TAG_inlined_subroutine); @@ -557,7 +557,7 @@ Index: gdb-6.8.50.20090803/gdb/dwarf2read.c if (inlined_func) { -@@ -4148,7 +4149,10 @@ read_func_scope (struct die_info *die, s +@@ -4169,7 +4170,10 @@ read_func_scope (struct die_info *die, s add_to_cu_func_list (name, lowpc, highpc, cu); new = push_context (0, lowpc); diff --git a/gdb-6.8.50.20090811.tar.bz2 b/gdb-6.8.50.20090811.tar.bz2 deleted file mode 100644 index c1c565c..0000000 --- a/gdb-6.8.50.20090811.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:03dec5c2840b0edb1cbca5ad2946327fab075e5c896f9afd830250fad3767a25 -size 18139711 diff --git a/gdb-6.8.50.20090921-upstream.patch b/gdb-6.8.50.20090921-upstream.patch new file mode 100644 index 0000000..85c293d --- /dev/null +++ b/gdb-6.8.50.20090921-upstream.patch @@ -0,0 +1,965 @@ +=================================================================== +RCS file: /cvs/src/src/gdb/ChangeLog,v +retrieving revision 1.10874.2.11 +retrieving revision 1.10874.2.12 +diff -u -r1.10874.2.11 -r1.10874.2.12 +--- src/gdb/ChangeLog 2009/09/19 16:36:08 1.10874.2.11 ++++ src/gdb/ChangeLog 2009/09/21 06:57:02 1.10874.2.12 +@@ -1,3 +1,47 @@ ++2009-09-21 Hui Zhu ++ Michael Snyder ++ ++ * amd64-linux-tdep.c (amd64_all_but_ip_registers_record): New ++ function. ++ (amd64_linux_syscall_record): Call ++ amd64_all_but_ip_registers_record if syscall is ++ sys_rt_sigreturn. ++ (AMD64_LINUX_redzone, AMD64_LINUX_xstate, ++ AMD64_LINUX_frame_size): New macros. ++ (amd64_linux_record_signal): New function. ++ (amd64_linux_init_abi): Call set_gdbarch_process_record_signal. ++ ++2009-09-21 Hui Zhu ++ Michael Snyder ++ ++ * i386-linux-tdep.c (i386_all_but_ip_registers_record): New ++ function. ++ (i386_linux_intx80_sysenter_record): Call ++ i386_all_but_ip_registers_record if syscall is sys_sigreturn ++ or sys_rt_sigreturn. ++ (I386_LINUX_xstate, I386_LINUX_frame_size): New macros. ++ (i386_linux_record_signal): New function. ++ (i386_linux_init_abi): Call set_gdbarch_process_record_signal. ++ ++2009-09-21 Hui Zhu ++ Michael Snyder ++ ++ * record.c (record_end_entry): New struct. ++ (record_type): Add end. ++ (record_arch_list_add_end): Set rec->u.end.sigval to ++ TARGET_SIGNAL_0. ++ (record_message_args): New struct. ++ (record_message): Call gdbarch_process_record_signal. ++ (do_record_message): Add argument "signal". ++ (record_resume): Ditto. ++ (record_wait): Ditto. Check record_list->u.end.sigval ++ in replay mode. ++ ++2009-09-21 Hui Zhu ++ Michael Snyder ++ ++ * gdbarch.sh (process_record_signal): New interface. ++ + 2009-09-19 Maxim Grigoriev + + * xtensa-tdep.c (call0_analyze_prologue): Replace INT_MAX by UNIT_MAX. +=================================================================== +RCS file: /cvs/src/src/gdb/gdbarch.sh,v +retrieving revision 1.496 +retrieving revision 1.496.2.1 +diff -u -r1.496 -r1.496.2.1 +--- src/gdb/gdbarch.sh 2009/09/15 03:30:05 1.496 ++++ src/gdb/gdbarch.sh 2009/09/21 06:57:02 1.496.2.1 +@@ -709,6 +709,10 @@ + # Return -1 if something goes wrong, 0 otherwise. + M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr + ++# Save process state after a signal. ++# Return -1 if something goes wrong, 0 otherwise. ++M:int:process_record_signal:struct regcache *regcache, enum target_signal signal:regcache, signal ++ + # Signal translation: translate inferior's signal (host's) number into + # GDB's representation. + m:enum target_signal:target_signal_from_host:int signo:signo::default_target_signal_from_host::0 +=================================================================== +RCS file: /cvs/src/src/gdb/gdbarch.c,v +retrieving revision 1.453 +retrieving revision 1.453.2.1 +diff -u -r1.453 -r1.453.2.1 +--- src/gdb/gdbarch.c 2009/09/15 03:30:05 1.453 ++++ src/gdb/gdbarch.c 2009/09/21 06:57:02 1.453.2.1 +@@ -240,6 +240,7 @@ + gdbarch_static_transform_name_ftype *static_transform_name; + int sofun_address_maybe_missing; + gdbarch_process_record_ftype *process_record; ++ gdbarch_process_record_signal_ftype *process_record_signal; + gdbarch_target_signal_from_host_ftype *target_signal_from_host; + gdbarch_target_signal_to_host_ftype *target_signal_to_host; + gdbarch_get_siginfo_type_ftype *get_siginfo_type; +@@ -378,6 +379,7 @@ + 0, /* static_transform_name */ + 0, /* sofun_address_maybe_missing */ + 0, /* process_record */ ++ 0, /* process_record_signal */ + default_target_signal_from_host, /* target_signal_from_host */ + default_target_signal_to_host, /* target_signal_to_host */ + 0, /* get_siginfo_type */ +@@ -635,6 +637,7 @@ + /* Skip verify of static_transform_name, has predicate */ + /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */ + /* Skip verify of process_record, has predicate */ ++ /* Skip verify of process_record_signal, has predicate */ + /* Skip verify of target_signal_from_host, invalid_p == 0 */ + /* Skip verify of target_signal_to_host, invalid_p == 0 */ + /* Skip verify of get_siginfo_type, has predicate */ +@@ -971,6 +974,12 @@ + "gdbarch_dump: process_record = <%s>\n", + host_address_to_string (gdbarch->process_record)); + fprintf_unfiltered (file, ++ "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n", ++ gdbarch_process_record_signal_p (gdbarch)); ++ fprintf_unfiltered (file, ++ "gdbarch_dump: process_record_signal = <%s>\n", ++ host_address_to_string (gdbarch->process_record_signal)); ++ fprintf_unfiltered (file, + "gdbarch_dump: ps_regnum = %s\n", + plongest (gdbarch->ps_regnum)); + fprintf_unfiltered (file, +@@ -3307,6 +3316,30 @@ + gdbarch->process_record = process_record; + } + ++int ++gdbarch_process_record_signal_p (struct gdbarch *gdbarch) ++{ ++ gdb_assert (gdbarch != NULL); ++ return gdbarch->process_record_signal != NULL; ++} ++ ++int ++gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal) ++{ ++ gdb_assert (gdbarch != NULL); ++ gdb_assert (gdbarch->process_record_signal != NULL); ++ if (gdbarch_debug >= 2) ++ fprintf_unfiltered (gdb_stdlog, "gdbarch_process_record_signal called\n"); ++ return gdbarch->process_record_signal (gdbarch, regcache, signal); ++} ++ ++void ++set_gdbarch_process_record_signal (struct gdbarch *gdbarch, ++ gdbarch_process_record_signal_ftype process_record_signal) ++{ ++ gdbarch->process_record_signal = process_record_signal; ++} ++ + enum target_signal + gdbarch_target_signal_from_host (struct gdbarch *gdbarch, int signo) + { +=================================================================== +RCS file: /cvs/src/src/gdb/gdbarch.h,v +retrieving revision 1.403 +retrieving revision 1.403.2.1 +diff -u -r1.403 -r1.403.2.1 +--- src/gdb/gdbarch.h 2009/09/15 03:30:05 1.403 ++++ src/gdb/gdbarch.h 2009/09/21 06:57:02 1.403.2.1 +@@ -822,6 +822,15 @@ + extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr); + extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record); + ++/* Save process state after a signal. ++ Return -1 if something goes wrong, 0 otherwise. */ ++ ++extern int gdbarch_process_record_signal_p (struct gdbarch *gdbarch); ++ ++typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal); ++extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum target_signal signal); ++extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal); ++ + /* Signal translation: translate inferior's signal (host's) number into + GDB's representation. */ + +=================================================================== +RCS file: /cvs/src/src/gdb/record.c,v +retrieving revision 1.17 +retrieving revision 1.17.2.1 +diff -u -r1.17 -r1.17.2.1 +--- src/gdb/record.c 2009/09/08 00:50:42 1.17 ++++ src/gdb/record.c 2009/09/21 06:57:03 1.17.2.1 +@@ -59,6 +59,11 @@ + gdb_byte *val; + }; + ++struct record_end_entry ++{ ++ enum target_signal sigval; ++}; ++ + enum record_type + { + record_end = 0, +@@ -77,6 +82,8 @@ + struct record_reg_entry reg; + /* mem */ + struct record_mem_entry mem; ++ /* end */ ++ struct record_end_entry end; + } u; + }; + +@@ -314,6 +321,7 @@ + rec->prev = NULL; + rec->next = NULL; + rec->type = record_end; ++ rec->u.end.sigval = TARGET_SIGNAL_0; + + record_arch_list_add (rec); + +@@ -360,11 +368,17 @@ + record_list_release (record_arch_list_tail); + } + ++struct record_message_args { ++ struct regcache *regcache; ++ enum target_signal signal; ++}; ++ + static int + record_message (void *args) + { + int ret; +- struct regcache *regcache = args; ++ struct record_message_args *myargs = args; ++ struct gdbarch *gdbarch = get_regcache_arch (myargs->regcache); + struct cleanup *old_cleanups = make_cleanup (record_message_cleanups, 0); + + record_arch_list_head = NULL; +@@ -373,9 +387,44 @@ + /* Check record_insn_num. */ + record_check_insn_num (1); + +- ret = gdbarch_process_record (get_regcache_arch (regcache), +- regcache, +- regcache_read_pc (regcache)); ++ /* If gdb sends a signal value to target_resume, ++ save it in the 'end' field of the previous instruction. ++ ++ Maybe process record should record what really happened, ++ rather than what gdb pretends has happened. ++ ++ So if Linux delivered the signal to the child process during ++ the record mode, we will record it and deliver it again in ++ the replay mode. ++ ++ If user says "ignore this signal" during the record mode, then ++ it will be ignored again during the replay mode (no matter if ++ the user says something different, like "deliver this signal" ++ during the replay mode). ++ ++ User should understand that nothing he does during the replay ++ mode will change the behavior of the child. If he tries, ++ then that is a user error. ++ ++ But we should still deliver the signal to gdb during the replay, ++ if we delivered it during the recording. Therefore we should ++ record the signal during record_wait, not record_resume. */ ++ if (record_list != &record_first) /* FIXME better way to check */ ++ { ++ gdb_assert (record_list->type == record_end); ++ record_list->u.end.sigval = myargs->signal; ++ } ++ ++ if (myargs->signal == TARGET_SIGNAL_0 ++ || !gdbarch_process_record_signal_p (gdbarch)) ++ ret = gdbarch_process_record (gdbarch, ++ myargs->regcache, ++ regcache_read_pc (myargs->regcache)); ++ else ++ ret = gdbarch_process_record_signal (gdbarch, ++ myargs->regcache, ++ myargs->signal); ++ + if (ret > 0) + error (_("Process record: inferior program stopped.")); + if (ret < 0) +@@ -396,9 +445,14 @@ + } + + static int +-do_record_message (struct regcache *regcache) ++do_record_message (struct regcache *regcache, ++ enum target_signal signal) + { +- return catch_errors (record_message, regcache, NULL, RETURN_MASK_ALL); ++ struct record_message_args args; ++ ++ args.regcache = regcache; ++ args.signal = signal; ++ return catch_errors (record_message, &args, NULL, RETURN_MASK_ALL); + } + + /* Set to 1 if record_store_registers and record_xfer_partial +@@ -520,13 +574,13 @@ + + static void + record_resume (struct target_ops *ops, ptid_t ptid, int step, +- enum target_signal siggnal) ++ enum target_signal signal) + { + record_resume_step = step; + + if (!RECORD_IS_REPLAY) + { +- if (do_record_message (get_current_regcache ())) ++ if (do_record_message (get_current_regcache (), signal)) + { + record_resume_error = 0; + } +@@ -536,7 +590,7 @@ + return; + } + record_beneath_to_resume (record_beneath_to_resume_ops, ptid, 1, +- siggnal); ++ signal); + } + } + +@@ -611,15 +665,16 @@ + ret = record_beneath_to_wait (record_beneath_to_wait_ops, + ptid, status, options); + ++ /* Is this a SIGTRAP? */ + if (status->kind == TARGET_WAITKIND_STOPPED + && status->value.sig == TARGET_SIGNAL_TRAP) + { +- /* Check if there is a breakpoint. */ ++ /* Yes -- check if there is a breakpoint. */ + registers_changed (); + tmp_pc = regcache_read_pc (get_current_regcache ()); + if (breakpoint_inserted_here_p (tmp_pc)) + { +- /* There is a breakpoint. */ ++ /* There is a breakpoint. GDB will want to stop. */ + CORE_ADDR decr_pc_after_break = + gdbarch_decr_pc_after_break + (get_regcache_arch (get_current_regcache ())); +@@ -631,8 +686,12 @@ + } + else + { +- /* There is not a breakpoint. */ +- if (!do_record_message (get_current_regcache ())) ++ /* There is not a breakpoint, and gdb is not ++ stepping, therefore gdb will not stop. ++ Therefore we will not return to gdb. ++ Record the insn and resume. */ ++ if (!do_record_message (get_current_regcache (), ++ TARGET_SIGNAL_0)) + { + break; + } +@@ -827,6 +886,10 @@ + gdbarch_decr_pc_after_break (gdbarch)); + continue_flag = 0; + } ++ /* Check target signal */ ++ if (record_list->u.end.sigval != TARGET_SIGNAL_0) ++ /* FIXME: better way to check */ ++ continue_flag = 0; + } + } + +@@ -851,6 +914,9 @@ + replay_out: + if (record_get_sig) + status->value.sig = TARGET_SIGNAL_INT; ++ else if (record_list->u.end.sigval != TARGET_SIGNAL_0) ++ /* FIXME: better way to check */ ++ status->value.sig = record_list->u.end.sigval; + else + status->value.sig = TARGET_SIGNAL_TRAP; + +=================================================================== +RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v +retrieving revision 1.68 +retrieving revision 1.68.2.1 +diff -u -r1.68 -r1.68.2.1 +--- src/gdb/i386-linux-tdep.c 2009/09/15 03:30:06 1.68 ++++ src/gdb/i386-linux-tdep.c 2009/09/21 06:57:03 1.68.2.1 +@@ -358,7 +358,32 @@ + regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1); + } + +-static struct linux_record_tdep i386_linux_record_tdep; ++/* Record all registers but IP register for process-record. */ ++ ++static int ++i386_all_but_ip_registers_record (struct regcache *regcache) ++{ ++ if (record_arch_list_add_reg (regcache, I386_EAX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_ECX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_EDX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_EBX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_ESP_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_EBP_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_ESI_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_EDI_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM)) ++ return -1; ++ ++ return 0; ++} + + /* i386_canonicalize_syscall maps from the native i386 Linux set + of syscall ids into a canonical set of syscall ids used by +@@ -383,6 +408,8 @@ + + Return -1 if something wrong. */ + ++static struct linux_record_tdep i386_linux_record_tdep; ++ + static int + i386_linux_intx80_sysenter_record (struct regcache *regcache) + { +@@ -402,6 +429,14 @@ + return -1; + } + ++ if (syscall_gdb == gdb_sys_sigreturn ++ || syscall_gdb == gdb_sys_rt_sigreturn) ++ { ++ if (i386_all_but_ip_registers_record (regcache)) ++ return -1; ++ return 0; ++ } ++ + ret = record_linux_system_call (syscall_gdb, regcache, + &i386_linux_record_tdep); + if (ret) +@@ -413,6 +448,40 @@ + + return 0; + } ++ ++#define I386_LINUX_xstate 270 ++#define I386_LINUX_frame_size 732 ++ ++int ++i386_linux_record_signal (struct gdbarch *gdbarch, ++ struct regcache *regcache, ++ enum target_signal signal) ++{ ++ ULONGEST esp; ++ ++ if (i386_all_but_ip_registers_record (regcache)) ++ return -1; ++ ++ if (record_arch_list_add_reg (regcache, I386_EIP_REGNUM)) ++ return -1; ++ ++ /* Record the change in the stack. */ ++ regcache_raw_read_unsigned (regcache, I386_ESP_REGNUM, &esp); ++ /* This is for xstate. ++ sp -= sizeof (struct _fpstate); */ ++ esp -= I386_LINUX_xstate; ++ /* This is for frame_size. ++ sp -= sizeof (struct rt_sigframe); */ ++ esp -= I386_LINUX_frame_size; ++ if (record_arch_list_add_mem (esp, ++ I386_LINUX_xstate + I386_LINUX_frame_size)) ++ return -1; ++ ++ if (record_arch_list_add_end ()) ++ return -1; ++ ++ return 0; ++} + + + static LONGEST +@@ -529,6 +598,7 @@ + tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); + + set_gdbarch_process_record (gdbarch, i386_process_record); ++ set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal); + + /* Initialize the i386_linux_record_tdep. */ + /* These values are the size of the type that will be used in a system +=================================================================== +RCS file: /cvs/src/src/gdb/amd64-linux-tdep.c,v +retrieving revision 1.29 +retrieving revision 1.29.2.1 +diff -u -r1.29 -r1.29.2.1 +--- src/gdb/amd64-linux-tdep.c 2009/09/15 03:30:04 1.29 ++++ src/gdb/amd64-linux-tdep.c 2009/09/21 06:57:03 1.29.2.1 +@@ -289,16 +289,48 @@ + regcache_cooked_write_unsigned (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, -1); + } + +-/* Parse the arguments of current system call instruction and record +- the values of the registers and memory that will be changed into +- "record_arch_list". This instruction is "syscall". +- +- Return -1 if something wrong. */ ++/* Record all registers but IP register for process-record. */ + +-static struct linux_record_tdep amd64_linux_record_tdep; ++static int ++amd64_all_but_ip_registers_record (struct regcache *regcache) ++{ ++ if (record_arch_list_add_reg (regcache, AMD64_RAX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RCX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RDX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RBX_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RSP_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RBP_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RSI_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_RDI_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R8_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R9_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R10_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R12_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R13_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R14_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_R15_REGNUM)) ++ return -1; ++ if (record_arch_list_add_reg (regcache, AMD64_EFLAGS_REGNUM)) ++ return -1; + +-#define RECORD_ARCH_GET_FS 0x1003 +-#define RECORD_ARCH_GET_GS 0x1004 ++ return 0; ++} + + /* amd64_canonicalize_syscall maps from the native amd64 Linux set + of syscall ids into a canonical set of syscall ids used by +@@ -1111,6 +1143,17 @@ + } + } + ++/* Parse the arguments of current system call instruction and record ++ the values of the registers and memory that will be changed into ++ "record_arch_list". This instruction is "syscall". ++ ++ Return -1 if something wrong. */ ++ ++static struct linux_record_tdep amd64_linux_record_tdep; ++ ++#define RECORD_ARCH_GET_FS 0x1003 ++#define RECORD_ARCH_GET_GS 0x1004 ++ + static int + amd64_linux_syscall_record (struct regcache *regcache) + { +@@ -1120,27 +1163,39 @@ + + regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native); + +- syscall_gdb = amd64_canonicalize_syscall (syscall_native); +- +- if (syscall_native == amd64_sys_arch_prctl) ++ switch (syscall_native) + { +- ULONGEST arg3; +- +- regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3, +- &arg3); +- if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS) +- { +- CORE_ADDR addr; +- +- regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg2, +- &addr); +- if (record_arch_list_add_mem (addr, +- amd64_linux_record_tdep.size_ulong)) +- return -1; +- } +- goto record_regs; ++ case amd64_sys_rt_sigreturn: ++ if (amd64_all_but_ip_registers_record (regcache)) ++ return -1; ++ return 0; ++ break; ++ ++ case amd64_sys_arch_prctl: ++ if (syscall_native == amd64_sys_arch_prctl) ++ { ++ ULONGEST arg3; ++ ++ regcache_raw_read_unsigned (regcache, amd64_linux_record_tdep.arg3, ++ &arg3); ++ if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS) ++ { ++ CORE_ADDR addr; ++ ++ regcache_raw_read_unsigned (regcache, ++ amd64_linux_record_tdep.arg2, ++ &addr); ++ if (record_arch_list_add_mem (addr, ++ amd64_linux_record_tdep.size_ulong)) ++ return -1; ++ } ++ goto record_regs; ++ } ++ break; + } + ++ syscall_gdb = amd64_canonicalize_syscall (syscall_native); ++ + if (syscall_gdb < 0) + { + printf_unfiltered (_("Process record and replay target doesn't " +@@ -1163,6 +1218,44 @@ + if (record_arch_list_add_reg (regcache, AMD64_R11_REGNUM)) + return -1; + ++ return 0; ++} ++ ++#define AMD64_LINUX_redzone 128 ++#define AMD64_LINUX_xstate 512 ++#define AMD64_LINUX_frame_size 560 ++ ++int ++amd64_linux_record_signal (struct gdbarch *gdbarch, ++ struct regcache *regcache, ++ enum target_signal signal) ++{ ++ ULONGEST rsp; ++ ++ if (amd64_all_but_ip_registers_record (regcache)) ++ return -1; ++ ++ if (record_arch_list_add_reg (regcache, AMD64_RIP_REGNUM)) ++ return -1; ++ ++ /* Record the change in the stack. */ ++ regcache_raw_read_unsigned (regcache, AMD64_RSP_REGNUM, &rsp); ++ /* redzone ++ sp -= 128; */ ++ rsp -= AMD64_LINUX_redzone; ++ /* This is for xstate. ++ sp -= sizeof (struct _fpstate); */ ++ rsp -= AMD64_LINUX_xstate; ++ /* This is for frame_size. ++ sp -= sizeof (struct rt_sigframe); */ ++ rsp -= AMD64_LINUX_frame_size; ++ if (record_arch_list_add_mem (rsp, AMD64_LINUX_redzone ++ + AMD64_LINUX_xstate ++ + AMD64_LINUX_frame_size)) ++ return -1; ++ ++ if (record_arch_list_add_end ()) ++ return -1; + + return 0; + } +@@ -1218,6 +1311,7 @@ + set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type); + + set_gdbarch_process_record (gdbarch, i386_process_record); ++ set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal); + + /* Initialize the amd64_linux_record_tdep. */ + /* These values are the size of the type that will be used in a system +=================================================================== +RCS file: /cvs/src/src/gdb/ChangeLog,v +retrieving revision 1.10874.2.12 +retrieving revision 1.10874.2.13 +diff -u -r1.10874.2.12 -r1.10874.2.13 +--- src/gdb/ChangeLog 2009/09/21 06:57:02 1.10874.2.12 ++++ src/gdb/ChangeLog 2009/09/21 10:19:59 1.10874.2.13 +@@ -1,3 +1,8 @@ ++2009-09-21 Phil Muldoon ++ ++ * python/py-value.c (valpy_getitem): Test value before allowing ++ subscript operation. ++ + 2009-09-21 Hui Zhu + Michael Snyder + +=================================================================== +RCS file: /cvs/src/src/gdb/python/py-value.c,v +retrieving revision 1.1 +retrieving revision 1.1.2.1 +diff -u -r1.1 -r1.1.2.1 +--- src/gdb/python/py-value.c 2009/09/09 17:45:40 1.1 ++++ src/gdb/python/py-value.c 2009/09/21 10:20:00 1.1.2.1 +@@ -324,7 +324,18 @@ + type. */ + struct value *idx = convert_value_from_python (key); + if (idx != NULL) +- res_val = value_subscript (tmp, value_as_long (idx)); ++ { ++ /* Check the value's type is something that can be accessed via ++ a subscript. */ ++ struct type *type; ++ tmp = coerce_ref (tmp); ++ type = check_typedef (value_type (tmp)); ++ if (TYPE_CODE (type) != TYPE_CODE_ARRAY ++ && TYPE_CODE (type) != TYPE_CODE_PTR) ++ error( _("Cannot subscript requested type")); ++ else ++ res_val = value_subscript (tmp, value_as_long (idx)); ++ } + } + } + +=================================================================== +RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v +retrieving revision 1.1960 +retrieving revision 1.1960.2.1 +diff -u -r1.1960 -r1.1960.2.1 +--- src/gdb/testsuite/ChangeLog 2009/09/15 18:51:25 1.1960 ++++ src/gdb/testsuite/ChangeLog 2009/09/21 10:20:00 1.1960.2.1 +@@ -1,3 +1,10 @@ ++2009-09-21 Phil Muldoon ++ ++ * gdb.python/py-value.exp (test_subscript_regression): New ++ function. Test for invalid subscripts. ++ * gdb.python/py-value.c (main): Add test array, and pointer to it. ++ (ptr_ref): New function. ++ + 2009-09-15 Tom Tromey + + * lib/mi-support.exp (mi_create_varobj): Update. +=================================================================== +RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value.c,v +retrieving revision 1.1 +retrieving revision 1.1.2.1 +diff -u -r1.1 -r1.1.2.1 +--- src/gdb/testsuite/gdb.python/py-value.c 2009/09/09 17:45:42 1.1 ++++ src/gdb/testsuite/gdb.python/py-value.c 2009/09/21 10:20:00 1.1.2.1 +@@ -37,6 +37,13 @@ + + enum e evalue = TWO; + ++#ifdef __cplusplus ++void ptr_ref(int*& rptr_int) ++{ ++ return; /* break to inspect pointer by reference. */ ++} ++#endif ++ + int + main (int argc, char *argv[]) + { +@@ -46,10 +53,18 @@ + PTR x = &s; + char st[17] = "divide et impera"; + char nullst[17] = "divide\0et\0impera"; ++ int a[3] = {1,2,3}; ++ int *p = a; ++ int i = 2; ++ int *ptr_i = &i; + + s.a = 3; + s.b = 5; + u.a = 7; + ++#ifdef __cplusplus ++ ptr_ref(ptr_i); ++#endif ++ + return 0; /* break to inspect struct and union */ + } +=================================================================== +RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-value.exp,v +retrieving revision 1.1 +retrieving revision 1.1.2.1 +diff -u -r1.1 -r1.1.2.1 +--- src/gdb/testsuite/gdb.python/py-value.exp 2009/09/09 17:45:42 1.1 ++++ src/gdb/testsuite/gdb.python/py-value.exp 2009/09/21 10:20:00 1.1.2.1 +@@ -292,6 +292,75 @@ + "print value's type" + } + ++# Regression test for invalid subscript operations. The bug was that ++# the type of the value was not being checked before allowing a ++# subscript operation to proceed. ++ ++proc test_subscript_regression {lang} { ++ ++ global srcdir subdir srcfile binfile testfile hex ++ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug $lang"] != "" } { ++ untested "Couldn't compile ${srcfile} in $lang mode" ++ return -1 ++ } ++ ++ # Start with a fresh gdb. ++ gdb_exit ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir ++ gdb_load ${binfile} ++ ++ if ![runto_main ] then { ++ perror "couldn't run to breakpoint" ++ return ++ } ++ ++ if {$lang == "c++"} { ++ gdb_breakpoint [gdb_get_line_number "break to inspect pointer by reference"] ++ gdb_continue_to_breakpoint "break to inspect pointer by reference" ++ ++ gdb_py_test_silent_cmd "print rptr_int" \ ++ "Obtain address" 1 ++ gdb_py_test_silent_cmd "python rptr = gdb.history(0)" \ ++ "Obtains value from GDB" 1 ++ gdb_test "python print rptr\[0\]" "2" "Check pointer passed as reference" ++ } ++ ++ gdb_breakpoint [gdb_get_line_number "break to inspect struct and union"] ++ gdb_continue_to_breakpoint "break to inspect struct and union" ++ ++ gdb_py_test_silent_cmd "python intv = gdb.Value(1)" \ ++ "Create a value for subscript test" 1 ++ gdb_py_test_silent_cmd "python stringv = gdb.Value(\"foo\")" \ ++ "Create a value for subscript test" 1 ++ ++ # Try to access an int with a subscript. This should fail. ++ gdb_test "python print intv" "1" "Baseline print of a Python value" ++ gdb_test "python print intv\[0\]" "RuntimeError: Cannot subscript requested type.*" \ ++ "Attempt to access an integer with a subscript" ++ ++ # Try to access a string with a subscript. This should pass. ++ gdb_test "python print stringv" "foo." "Baseline print of a Python value" ++ gdb_test "python print stringv\[0\]" "f." "Attempt to access a string with a subscript" ++ ++ # Try to access an int array via a pointer with a subscript. This should pass. ++ gdb_py_test_silent_cmd "print p" "Build pointer to array" 1 ++ gdb_py_test_silent_cmd "python pointer = gdb.history(0)" "" 1 ++ gdb_test "python print pointer\[0\]" "1" "Access array via pointer with int subscript" ++ gdb_test "python print pointer\[intv\]" "2" "Access array via pointer with value subscript" ++ ++ # Try to access a single dimension array with a subscript to the ++ # result. This should fail. ++ gdb_test "python print pointer\[intv\]\[0\]" "RuntimeError: Cannot subscript requested type.*" \ ++ "Attempt to access an integer with a subscript" ++ ++ # Lastly, test subscript access to an array with multiple ++ # dimensions. This should pass. ++ gdb_py_test_silent_cmd "print {\"fu \",\"foo\",\"bar\"}" "Build array" 1 ++ gdb_py_test_silent_cmd "python marray = gdb.history(0)" "" 1 ++ gdb_test "python print marray\[1\]\[2\]" "o." "Test multiple subscript" ++} ++ + # Start with a fresh gdb. + + gdb_exit +@@ -322,3 +391,8 @@ + + test_value_in_inferior + test_value_after_death ++ ++# The following test recompiles the binary to test either C or C++ ++# values. ++test_subscript_regression "c++" ++test_subscript_regression "c" +=================================================================== +RCS file: /cvs/src/src/gdb/ChangeLog,v +retrieving revision 1.10874.2.13 +retrieving revision 1.10874.2.14 +diff -u -r1.10874.2.13 -r1.10874.2.14 +--- src/gdb/ChangeLog 2009/09/21 10:19:59 1.10874.2.13 ++++ src/gdb/ChangeLog 2009/09/21 10:25:29 1.10874.2.14 +@@ -1,5 +1,12 @@ + 2009-09-21 Phil Muldoon + ++ PR python/10633 ++ ++ * c-lang.c (c_printstr): Do not loop past options->print_max when ++ iterating with wchar_iterate. ++ ++2009-09-21 Phil Muldoon ++ + * python/py-value.c (valpy_getitem): Test value before allowing + subscript operation. + +=================================================================== +RCS file: /cvs/src/src/gdb/c-lang.c,v +retrieving revision 1.75 +retrieving revision 1.75.4.1 +diff -u -r1.75 -r1.75.4.1 +--- src/gdb/c-lang.c 2009/07/10 10:35:16 1.75 ++++ src/gdb/c-lang.c 2009/09/21 10:25:29 1.75.4.1 +@@ -459,7 +459,7 @@ + single character in isolation. This makes the code simpler + and probably does the sensible thing in the majority of + cases. */ +- while (num_chars == 1) ++ while (num_chars == 1 && things_printed < options->print_max) + { + /* Count the number of repetitions. */ + unsigned int reps = 0; +=================================================================== +RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v +retrieving revision 1.1960.2.1 +retrieving revision 1.1960.2.2 +diff -u -r1.1960.2.1 -r1.1960.2.2 +--- src/gdb/testsuite/ChangeLog 2009/09/21 10:20:00 1.1960.2.1 ++++ src/gdb/testsuite/ChangeLog 2009/09/21 10:25:29 1.1960.2.2 +@@ -1,5 +1,13 @@ + 2009-09-21 Phil Muldoon + ++ PR python/10633 ++ ++ * gdb.python/py-prettyprint.exp (gdb_py_test_silent_cmd): New ++ Function. ++ (run_lang_tests): Add print elements test. ++ ++2009-09-21 Phil Muldoon ++ + * gdb.python/py-value.exp (test_subscript_regression): New + function. Test for invalid subscripts. + * gdb.python/py-value.c (main): Add test array, and pointer to it. +=================================================================== +RCS file: /cvs/src/src/gdb/testsuite/gdb.python/py-prettyprint.exp,v +retrieving revision 1.1 +retrieving revision 1.1.2.1 +diff -u -r1.1 -r1.1.2.1 +--- src/gdb/testsuite/gdb.python/py-prettyprint.exp 2009/09/09 17:45:42 1.1 ++++ src/gdb/testsuite/gdb.python/py-prettyprint.exp 2009/09/21 10:25:30 1.1.2.1 +@@ -35,6 +35,17 @@ + -re "$gdb_prompt $" {} + } + ++# Run a command in GDB, and report a failure if a Python exception is thrown. ++# If report_pass is true, report a pass if no exception is thrown. ++proc gdb_py_test_silent_cmd {cmd name report_pass} { ++ global gdb_prompt ++ ++ gdb_test_multiple $cmd $name { ++ -re "Traceback.*$gdb_prompt $" { fail $name } ++ -re "$gdb_prompt $" { if $report_pass { pass $name } } ++ } ++} ++ + proc run_lang_tests {lang} { + global srcdir subdir srcfile binfile testfile hex + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug $lang"] != "" } { +@@ -79,6 +90,11 @@ + gdb_test "print derived" \ + " = \{.* = pp class name: Vbase1.* = \{.* = pp value variable is: 1,.*members of Vbase2:.*_vptr.Vbase2 = $hex.* = \{.*members of Vbase3.*members of Derived:.*value = 2.*" + gdb_test "print ns " "\"embedded\\\\000null\\\\000string\"" ++ gdb_py_test_silent_cmd "set print elements 3" "" 1 ++ gdb_test "print ns" "emb\.\.\.." ++ gdb_py_test_silent_cmd "set print elements 10" "" 1 ++ gdb_test "print ns" "embedded\\\\000n\.\.\.." ++ gdb_py_test_silent_cmd "set print elements 200" "" 1 + } + + gdb_test "print x" " = $hex \"this is x\"" diff --git a/gdb-6.8.91.20090921.tar.bz2 b/gdb-6.8.91.20090921.tar.bz2 new file mode 100644 index 0000000..832dd34 --- /dev/null +++ b/gdb-6.8.91.20090921.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4584a07edf7b86c65a0a4a435455aff464d20611dbc388de95b3fc2faaa8c7c +size 18453563 diff --git a/gdb-archer.patch b/gdb-archer.patch index 781f192..2f62e80 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 93f5e942bdcdcc376ece452c309bedabae71def9 +commit 0d5c38dd89050c0ee1cf049656f177c170d675d4 branch `archer' - the merge of branches: archer-tromey-call-frame-cfa @@ -12,19 +12,20 @@ archer-jankratochvil-vla archer-jankratochvil-misc archer-keiths-expr-cumulative archer-tromey-python +archer-jankratochvil-fortran-module +archer-jankratochvil-watchpoint +archer-jankratochvil-bp_location-accel +archer-pmuldoon-next-over-throw diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index ccc4db8..496c9f2 100644 +index f5e1dde..73ee55c 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -166,6 +166,13 @@ INTL_CFLAGS = @INCINTL@ - TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ - TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ +@@ -169,6 +169,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ + # Did the user give us a --with-gdb-datadir option? + GDB_DATADIR_PATH = @GDB_DATADIR_PATH@ -+# Did the user give us a --with-gdb-datadir option? -+GDB_DATADIR_PATH = @GDB_DATADIR_PATH@ -+ +# The argument to --with-pythondir. If not given, this is +# GDB_DATADIR_PATH/python. +pythondir = @pythondir@ @@ -32,67 +33,67 @@ index ccc4db8..496c9f2 100644 # Helper code from gnulib. LIBGNU = gnulib/libgnu.a INCGNU = -I$(srcdir)/gnulib -Ignulib -@@ -264,21 +271,37 @@ SUBDIR_TUI_CFLAGS= \ +@@ -267,21 +271,37 @@ SUBDIR_TUI_CFLAGS= \ # SUBDIR_PYTHON_OBS = \ python.o \ -+ python-block.o \ -+ python-breakpoint.o \ - python-cmd.o \ - python-frame.o \ - python-function.o \ -+ python-hooks.o \ -+ python-inferior.o \ -+ python-infthread.o \ - python-objfile.o \ -+ python-param.o \ - python-prettyprint.o \ -+ python-symbol.o \ -+ python-symtab.o \ - python-type.o \ - python-utils.o \ - python-value.o ++ py-block.o \ ++ py-breakpoint.o \ + py-cmd.o \ + py-frame.o \ + py-function.o \ ++ py-hooks.o \ ++ py-inferior.o \ ++ py-infthread.o \ + py-objfile.o \ ++ py-param.o \ + py-prettyprint.o \ ++ py-symbol.o \ ++ py-symtab.o \ + py-type.o \ + py-utils.o \ + py-value.o SUBDIR_PYTHON_SRCS = \ python/python.c \ -+ python/python-block.c \ -+ python/python-breakpoint.c \ - python/python-cmd.c \ - python/python-frame.c \ - python/python-function.c \ -+ python/python-hooks.c \ -+ python/python-inferior.c \ -+ python/python-infthread.c \ - python/python-objfile.c \ -+ python/python-param.c \ - python/python-prettyprint.c \ -+ python/python-symbol.c \ -+ python/python-symtab.c \ - python/python-type.c \ - python/python-utils.c \ - python/python-value.c -@@ -746,7 +769,7 @@ config/rs6000/nm-rs6000.h top.h bsd-kvm.h gdb-stabs.h reggroups.h \ ++ python/py-block.c \ ++ python/py-breakpoint.c \ + python/py-cmd.c \ + python/py-frame.c \ + python/py-function.c \ ++ python/py-hooks.c \ ++ python/py-inferior.c \ ++ python/py-infthread.c \ + python/py-objfile.c \ ++ python/py-param.c \ + python/py-prettyprint.c \ ++ python/py-symbol.c \ ++ python/py-symtab.c \ + python/py-type.c \ + python/py-utils.c \ + python/py-value.c +@@ -750,7 +770,7 @@ 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 \ sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \ --gdb_usleep.h -+gdb_usleep.h python/python.h python/python-internal.h +-gdb_usleep.h jit.h xml-syscall.h ada-operator.inc ++gdb_usleep.h jit.h xml-syscall.h ada-operator.inc python/python.h python/python-internal.h # Header files that already have srcdir in them, or which are in objdir. -@@ -863,7 +886,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c \ +@@ -874,7 +894,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c \ $(COMPILE) $< $(POSTCOMPILE) --all: gdb$(EXEEXT) $(CONFIG_ALL) -+all: gdb$(EXEEXT) $(CONFIG_ALL) .gdbinit +-all: gdb$(EXEEXT) $(CONFIG_ALL) xml-syscall-copy ++all: gdb$(EXEEXT) $(CONFIG_ALL) xml-syscall-copy .gdbinit @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do .PHONY: all-tui all-tui: $(TUI)$(EXEEXT) -@@ -1219,6 +1242,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -1264,6 +1284,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status -+.gdbinit: gdbinit.in config.status ++.gdbinit: $(srcdir)/gdbinit.in config.status + CONFIG_FILES=".gdbinit:gdbinit.in" \ + CONFIG_COMMANDS= \ + CONFIG_HEADERS= \ @@ -101,62 +102,62 @@ index ccc4db8..496c9f2 100644 config.status: $(srcdir)/configure configure.tgt configure.host $(SHELL) config.status --recheck -@@ -1918,6 +1947,14 @@ python.o: $(srcdir)/python/python.c +@@ -1963,6 +1989,14 @@ python.o: $(srcdir)/python/python.c $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python.c $(POSTCOMPILE) -+python-block.o: $(srcdir)/python/python-block.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-block.c ++py-block.o: $(srcdir)/python/py-block.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-block.c + $(POSTCOMPILE) + -+python-breakpoint.o: $(srcdir)/python/python-breakpoint.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-breakpoint.c ++py-breakpoint.o: $(srcdir)/python/py-breakpoint.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-breakpoint.c + $(POSTCOMPILE) + - python-cmd.o: $(srcdir)/python/python-cmd.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-cmd.c + py-cmd.o: $(srcdir)/python/py-cmd.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-cmd.c $(POSTCOMPILE) -@@ -1930,14 +1967,38 @@ python-function.o: $(srcdir)/python/python-function.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-function.c +@@ -1975,14 +2009,38 @@ py-function.o: $(srcdir)/python/py-function.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c $(POSTCOMPILE) -+python-hooks.o: $(srcdir)/python/python-hooks.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-hooks.c ++py-hooks.o: $(srcdir)/python/py-hooks.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-hooks.c + $(POSTCOMPILE) + -+python-inferior.o: $(srcdir)/python/python-inferior.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-inferior.c ++py-inferior.o: $(srcdir)/python/py-inferior.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c + $(POSTCOMPILE) + -+python-infthread.o: $(srcdir)/python/python-infthread.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-infthread.c ++py-infthread.o: $(srcdir)/python/py-infthread.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-infthread.c + $(POSTCOMPILE) + - python-objfile.o: $(srcdir)/python/python-objfile.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-objfile.c + py-objfile.o: $(srcdir)/python/py-objfile.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-objfile.c $(POSTCOMPILE) -+python-param.o: $(srcdir)/python/python-param.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-param.c ++py-param.o: $(srcdir)/python/py-param.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-param.c + $(POSTCOMPILE) + - python-prettyprint.o: $(srcdir)/python/python-prettyprint.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-prettyprint.c + py-prettyprint.o: $(srcdir)/python/py-prettyprint.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-prettyprint.c $(POSTCOMPILE) -+python-symbol.o: $(srcdir)/python/python-symbol.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-symbol.c ++py-symbol.o: $(srcdir)/python/py-symbol.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symbol.c + $(POSTCOMPILE) + -+python-symtab.o: $(srcdir)/python/python-symtab.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-symtab.c ++py-symtab.o: $(srcdir)/python/py-symtab.c ++ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-symtab.c + $(POSTCOMPILE) + - python-type.o: $(srcdir)/python/python-type.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-type.c + py-type.o: $(srcdir)/python/py-type.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-type.c $(POSTCOMPILE) -@@ -1950,6 +2011,36 @@ python-value.o: $(srcdir)/python/python-value.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/python-value.c +@@ -1995,6 +2053,36 @@ py-value.o: $(srcdir)/python/py-value.c + $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-value.c $(POSTCOMPILE) +# All python library files, with the "python/lib" stripped off. @@ -193,10 +194,10 @@ index ccc4db8..496c9f2 100644 # Dependency tracking. Most of this is conditional on GNU Make being # found by configure; if GNU Make is not found, we fall back to a diff --git a/gdb/NEWS b/gdb/NEWS -index 0b8e3af..446246f 100644 +index 4fc6dcd..6744b23 100644 --- a/gdb/NEWS +++ b/gdb/NEWS -@@ -425,6 +425,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin* +@@ -462,6 +462,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin* x86_64 MinGW x86_64-*-mingw* @@ -288,11 +289,107 @@ index 9b5d2c6..61676a9 100644 ada_op_name, ada_dump_subexp_body, ada_evaluate_subexp +diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c +index 7d8461c..a6d35d7 100644 +--- a/gdb/amd64-linux-nat.c ++++ b/gdb/amd64-linux-nat.c +@@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum) + return value; + } + ++/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ ++ + static void + amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) + { +@@ -286,6 +288,8 @@ amd64_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) + perror_with_name (_("Couldn't write debug register")); + } + ++/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ ++ + static void + amd64_linux_dr_set_control (unsigned long control) + { +@@ -297,6 +301,8 @@ amd64_linux_dr_set_control (unsigned long control) + amd64_linux_dr_set (ptid, DR_CONTROL, control); + } + ++/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ ++ + static void + amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) + { +@@ -310,18 +316,55 @@ amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr) + amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); + } + ++/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ ++ + static void + amd64_linux_dr_reset_addr (int regnum) + { + amd64_linux_dr_set_addr (regnum, 0); + } + ++/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */ ++ + static unsigned long + amd64_linux_dr_get_status (void) + { + return amd64_linux_dr_get (inferior_ptid, DR_STATUS); + } + ++/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST. */ ++ ++static void ++amd64_linux_dr_unset_status (unsigned long mask) ++{ ++ struct lwp_info *lp; ++ ptid_t ptid; ++ ++ ALL_LWPS (lp, ptid) ++ { ++ unsigned long value; ++ ++ value = amd64_linux_dr_get (ptid, DR_STATUS); ++ value &= ~mask; ++ amd64_linux_dr_set (ptid, DR_STATUS, value); ++ } ++} ++ ++/* See i386_dr_low_type.detach. Do not use wrappers amd64_linux_dr_set_control ++ or amd64_linux_dr_reset_addr as they would modify the register cache ++ (amd64_linux_dr). */ ++ ++static void ++amd64_linux_dr_detach (void) ++{ ++ int regnum; ++ ++ amd64_linux_dr_set (inferior_ptid, DR_CONTROL, 0); ++ amd64_linux_dr_unset_status (~0UL); ++ for (regnum = DR_FIRSTADDR; regnum <= DR_LASTADDR; regnum++) ++ amd64_linux_dr_set (inferior_ptid, regnum, 0); ++} ++ + static void + amd64_linux_new_thread (ptid_t ptid) + { +@@ -672,6 +715,8 @@ _initialize_amd64_linux_nat (void) + i386_dr_low.set_addr = amd64_linux_dr_set_addr; + i386_dr_low.reset_addr = amd64_linux_dr_reset_addr; + i386_dr_low.get_status = amd64_linux_dr_get_status; ++ i386_dr_low.unset_status = amd64_linux_dr_unset_status; ++ i386_dr_low.detach = amd64_linux_dr_detach; + i386_set_debug_register_length (8); + + /* Override the GNU/Linux inferior startup hook. */ diff --git a/gdb/block.c b/gdb/block.c -index 1889ecd..498e710 100644 +index 97ea67a..b20beeb 100644 --- a/gdb/block.c +++ b/gdb/block.c -@@ -223,8 +223,9 @@ block_set_scope (struct block *block, const char *scope, +@@ -227,8 +227,9 @@ block_set_scope (struct block *block, const char *scope, BLOCK_NAMESPACE (block)->scope = scope; } @@ -304,7 +401,11 @@ index 1889ecd..498e710 100644 struct using_direct * block_using (const struct block *block) -@@ -317,3 +318,21 @@ allocate_block (struct obstack *obstack) +@@ -318,6 +319,25 @@ allocate_block (struct obstack *obstack) + BLOCK_SUPERBLOCK (bl) = NULL; + BLOCK_DICT (bl) = NULL; + BLOCK_NAMESPACE (bl) = NULL; ++ BLOCK_FORTRAN_USE (bl) = NULL; return bl; } @@ -327,10 +428,34 @@ index 1889ecd..498e710 100644 + return SYMBOL_SYMTAB (func)->objfile; +} diff --git a/gdb/block.h b/gdb/block.h -index 53e7371..8290adc 100644 +index 53e7371..d373f8a 100644 --- a/gdb/block.h +++ b/gdb/block.h -@@ -166,4 +166,6 @@ extern const struct block *block_global_block (const struct block *block); +@@ -96,6 +96,15 @@ struct block + cplus_specific; + } + language_specific; ++ ++ /* FIXME: It should be in the LANGUAGE_SPECIFIC region but the ++ BLOCK_NAMESPACE accessor is not protected by the C language check. */ ++ ++ struct ++ { ++ struct fortran_using *use; ++ } ++ fortran_specific; + }; + + #define BLOCK_START(bl) (bl)->startaddr +@@ -104,6 +113,7 @@ struct block + #define BLOCK_SUPERBLOCK(bl) (bl)->superblock + #define BLOCK_DICT(bl) (bl)->dict + #define BLOCK_NAMESPACE(bl) (bl)->language_specific.cplus_specific.namespace ++#define BLOCK_FORTRAN_USE(bl) (bl)->fortran_specific.use + + /* Macro to loop through all symbols in a block BL, in no particular + order. ITER helps keep track of the iteration, and should be a +@@ -166,4 +176,6 @@ extern const struct block *block_global_block (const struct block *block); extern struct block *allocate_block (struct obstack *obstack); @@ -338,18 +463,83 @@ index 53e7371..8290adc 100644 + #endif /* BLOCK_H */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index f3940e1..70222a4 100644 +index 811cdfb..b0bf314 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -59,6 +59,7 @@ - #include "top.h" - #include "wrapper.h" +@@ -61,6 +61,7 @@ #include "valprint.h" + #include "jit.h" + #include "xml-syscall.h" +#include "parser-defs.h" /* readline include files */ #include "readline/readline.h" -@@ -578,6 +579,53 @@ get_breakpoint (int num) +@@ -112,8 +113,6 @@ struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, + struct symtab_and_line, + enum bptype); + +-static void check_duplicates (struct breakpoint *); +- + static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); + + static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch, +@@ -337,14 +336,14 @@ static int executing_startup; + B ? (TMP=B->next, 1): 0; \ + B = TMP) + +-/* Similar iterators for the low-level breakpoints. */ +- +-#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->global_next) ++/* Similar iterator for the low-level breakpoints. SAFE variant is not ++ provided so update_global_location_list must not be called while executing ++ the block of ALL_BP_LOCATIONS. */ + +-#define ALL_BP_LOCATIONS_SAFE(B,TMP) \ +- for (B = bp_location_chain; \ +- B ? (TMP=B->global_next, 1): 0; \ +- B = TMP) ++#define ALL_BP_LOCATIONS(B,BP_TMP) \ ++ for (BP_TMP = bp_location; \ ++ BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \ ++ BP_TMP++) + + /* Iterator for tracepoints only. */ + +@@ -356,10 +355,31 @@ static int executing_startup; + + struct breakpoint *breakpoint_chain; + +-struct bp_location *bp_location_chain; ++/* Array is sorted by bp_location_compare - primarily by the ADDRESS. */ ++ ++static struct bp_location **bp_location; ++ ++/* Number of elements of BP_LOCATION. */ ++ ++static unsigned bp_location_count; ++ ++/* Maximum alignment offset between bp_target_info.PLACED_ADDRESS and ADDRESS ++ for the current elements of BP_LOCATION which get a valid result from ++ bp_location_has_shadow. You can use it for roughly limiting the subrange of ++ BP_LOCATION to scan for shadow bytes for an address you need to read. */ ++ ++static CORE_ADDR bp_location_placed_address_before_address_max; ++ ++/* Maximum offset plus alignment between ++ bp_target_info.PLACED_ADDRESS + bp_target_info.SHADOW_LEN and ADDRESS for ++ the current elements of BP_LOCATION which get a valid result from ++ bp_location_has_shadow. You can use it for roughly limiting the subrange of ++ BP_LOCATION to scan for shadow bytes for an address you need to read. */ ++ ++static CORE_ADDR bp_location_shadow_len_after_address_max; + + /* The locations that no longer correspond to any breakpoint, +- unlinked from bp_location_chain, but for which a hit ++ unlinked from bp_location array, but for which a hit + may still be reported by a target. */ + VEC(bp_location_p) *moribund_locations = NULL; + +@@ -582,6 +602,53 @@ get_breakpoint (int num) } @@ -403,7 +593,7 @@ index f3940e1..70222a4 100644 /* condition N EXP -- set break condition of breakpoint N to EXP. */ static void -@@ -598,42 +646,7 @@ condition_command (char *arg, int from_tty) +@@ -602,42 +669,7 @@ condition_command (char *arg, int from_tty) ALL_BREAKPOINTS (b) if (b->number == bnum) { @@ -447,7 +637,1205 @@ index f3940e1..70222a4 100644 return; } -@@ -8843,6 +8856,22 @@ all_tracepoints () +@@ -735,35 +767,88 @@ commands_from_control_command (char *arg, struct command_line *cmd) + } + error (_("No breakpoint number %d."), bnum); + } +- ++ ++/* Return non-zero if BL->TARGET_INFO contains valid information. */ ++ ++static int ++bp_location_has_shadow (struct bp_location *bl) ++{ ++ if (bl->loc_type != bp_loc_software_breakpoint) ++ return 0; ++ if (!bl->inserted) ++ return 0; ++ if (bl->target_info.shadow_len == 0) ++ /* bp isn't valid, or doesn't shadow memory. */ ++ return 0; ++ return 1; ++} ++ + /* Update BUF, which is LEN bytes read from the target address MEMADDR, +- by replacing any memory breakpoints with their shadowed contents. */ ++ by replacing any memory breakpoints with their shadowed contents. ++ ++ The range of shadowed area by each bp_location is: ++ b->address - bp_location_placed_address_before_address_max ++ up to b->address + bp_location_shadow_len_after_address_max ++ The range we were requested to resolve shadows for is: ++ memaddr ... memaddr + le ++ Thus the safe cutoff boundaries for performance optimization are ++ memaddr + len <= b->address - bp_location_placed_address_before_address_max ++ and: ++ b->address + bp_location_shadow_len_after_address_max <= memaddr */ + + void + breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len) + { +- struct bp_location *b; +- CORE_ADDR bp_addr = 0; +- int bp_size = 0; +- int bptoffset = 0; ++ /* Left boundary, right boundary and media element of our binary search. */ ++ unsigned bc_l, bc_r, bc; ++ ++ /* Find BC_L which is a leftmost element which may affect BUF content. It is ++ safe to report lower value but a failure to report higher one. */ ++ ++ bc_l = 0; ++ bc_r = bp_location_count; ++ while (bc_l + 1 < bc_r) ++ { ++ struct bp_location *b; + +- ALL_BP_LOCATIONS (b) ++ bc = (bc_l + bc_r) / 2; ++ b = bp_location[bc]; ++ ++ if (b->address + bp_location_shadow_len_after_address_max >= b->address ++ && b->address + bp_location_shadow_len_after_address_max <= memaddr) ++ bc_l = bc; ++ else ++ bc_r = bc; ++ } ++ ++ /* Now do full processing of the found relevant range of elements. */ ++ ++ for (bc = bc_l; bc < bp_location_count; bc++) + { ++ struct bp_location *b = bp_location[bc]; ++ CORE_ADDR bp_addr = 0; ++ int bp_size = 0; ++ int bptoffset = 0; ++ + if (b->owner->type == bp_none) + warning (_("reading through apparently deleted breakpoint #%d?"), + b->owner->number); + +- if (b->loc_type != bp_loc_software_breakpoint) +- continue; +- if (!b->inserted) ++ /* Performance optimization: any futher element can no longer affect BUF ++ content. */ ++ ++ if (b->address >= bp_location_placed_address_before_address_max ++ && memaddr + len <= b->address ++ - bp_location_placed_address_before_address_max) ++ break; ++ ++ if (!bp_location_has_shadow (b)) + continue; ++ + /* Addresses and length of the part of the breakpoint that + we need to copy. */ + bp_addr = b->target_info.placed_address; + bp_size = b->target_info.shadow_len; +- if (bp_size == 0) +- /* bp isn't valid, or doesn't shadow memory. */ +- continue; + + if (bp_addr + bp_size <= memaddr) + /* The breakpoint is entirely before the chunk of memory we +@@ -912,7 +997,7 @@ update_watchpoint (struct breakpoint *b, int reparse) + struct bp_location *loc; + bpstat bs; + +- /* We don't free locations. They are stored in bp_location_chain and ++ /* We don't free locations. They are stored in bp_location array and + update_global_locations will eventually delete them and remove + breakpoints if needed. */ + b->loc = NULL; +@@ -1347,7 +1432,7 @@ static void + insert_breakpoint_locations (void) + { + struct breakpoint *bpt; +- struct bp_location *b, *temp; ++ struct bp_location *b, **bp_tmp; + int error = 0; + int val = 0; + int disabled_breaks = 0; +@@ -1360,7 +1445,7 @@ insert_breakpoint_locations (void) + there was an error. */ + fprintf_unfiltered (tmp_error_stream, "Warning:\n"); + +- ALL_BP_LOCATIONS_SAFE (b, temp) ++ ALL_BP_LOCATIONS (b, bp_tmp) + { + if (!should_be_inserted (b) || b->inserted) + continue; +@@ -1434,10 +1519,10 @@ You may have requested too many hardware breakpoints/watchpoints.\n"); + int + remove_breakpoints (void) + { +- struct bp_location *b; ++ struct bp_location *b, **bp_tmp; + int val = 0; + +- ALL_BP_LOCATIONS (b) ++ ALL_BP_LOCATIONS (b, bp_tmp) + { + if (b->inserted) + val |= remove_breakpoint (b, mark_uninserted); +@@ -1448,10 +1533,10 @@ remove_breakpoints (void) + int + remove_hw_watchpoints (void) + { +- struct bp_location *b; ++ struct bp_location *b, **bp_tmp; + int val = 0; + +- ALL_BP_LOCATIONS (b) ++ ALL_BP_LOCATIONS (b, bp_tmp) + { + if (b->inserted && b->loc_type == bp_loc_hardware_watchpoint) + val |= remove_breakpoint (b, mark_uninserted); +@@ -1462,7 +1547,7 @@ remove_hw_watchpoints (void) + int + reattach_breakpoints (int pid) + { +- struct bp_location *b; ++ struct bp_location *b, **bp_tmp; + int val; + struct cleanup *old_chain = save_inferior_ptid (); + struct ui_file *tmp_error_stream = mem_fileopen (); +@@ -1471,7 +1556,7 @@ reattach_breakpoints (int pid) + make_cleanup_ui_file_delete (tmp_error_stream); + + inferior_ptid = pid_to_ptid (pid); +- ALL_BP_LOCATIONS (b) ++ ALL_BP_LOCATIONS (b, bp_tmp) + { + if (b->inserted) + { +@@ -1569,12 +1654,42 @@ create_longjmp_master_breakpoint (char *func_name) + update_global_location_list (1); + } + ++/* Install a master breakpoint on the unwinder's debug hook. */ ++ ++void ++create_exception_master_breakpoint (void) ++{ ++ struct objfile *objfile; ++ ++ ALL_OBJFILES (objfile) ++ { ++ struct minimal_symbol *debug_hook; ++ ++ debug_hook = lookup_minimal_symbol_text ("_Unwind_DebugHook", objfile); ++ if (debug_hook != NULL) ++ { ++ CORE_ADDR pc; ++ struct breakpoint *b; ++ ++ pc = find_function_start_pc (get_objfile_arch (objfile), ++ SYMBOL_VALUE_ADDRESS (debug_hook), ++ SYMBOL_OBJ_SECTION (debug_hook)); ++ b = create_internal_breakpoint (get_objfile_arch (objfile), ++ pc, bp_exception_master); ++ b->addr_string = xstrdup ("_Unwind_DebugHook"); ++ b->enable_state = bp_disabled; ++ } ++ } ++ ++ update_global_location_list (1); ++} ++ + void + update_breakpoints_after_exec (void) + { + struct breakpoint *b; + struct breakpoint *temp; +- struct bp_location *bploc; ++ struct bp_location *bploc, **bplocp_tmp; + + /* We're about to delete breakpoints from GDB's lists. If the + INSERTED flag is true, GDB will try to lift the breakpoints by +@@ -1584,7 +1699,7 @@ update_breakpoints_after_exec (void) + breakpoints out as soon as it detects an exec. We don't do that + here instead, because there may be other attempts to delete + breakpoints after detecting an exec and before reaching here. */ +- ALL_BP_LOCATIONS (bploc) ++ ALL_BP_LOCATIONS (bploc, bplocp_tmp) + gdb_assert (!bploc->inserted); + + ALL_BREAKPOINTS_SAFE (b, temp) +@@ -1606,7 +1721,7 @@ update_breakpoints_after_exec (void) + /* Thread event breakpoints must be set anew after an exec(), + as must overlay event and longjmp master breakpoints. */ + if (b->type == bp_thread_event || b->type == bp_overlay_event +- || b->type == bp_longjmp_master) ++ || b->type == bp_longjmp_master || b->type == bp_exception_master) + { + delete_breakpoint (b); + continue; +@@ -1621,7 +1736,8 @@ update_breakpoints_after_exec (void) + + /* Longjmp and longjmp-resume breakpoints are also meaningless + after an exec. */ +- if (b->type == bp_longjmp || b->type == bp_longjmp_resume) ++ if (b->type == bp_longjmp || b->type == bp_longjmp_resume ++ || b->type == bp_exception || b->type == bp_exception_resume) + { + delete_breakpoint (b); + continue; +@@ -1682,12 +1798,13 @@ update_breakpoints_after_exec (void) + create_longjmp_master_breakpoint ("_longjmp"); + create_longjmp_master_breakpoint ("siglongjmp"); + create_longjmp_master_breakpoint ("_siglongjmp"); ++ create_exception_master_breakpoint (); + } + + int + detach_breakpoints (int pid) + { +- struct bp_location *b; ++ struct bp_location *b, **bp_tmp; + int val = 0; + struct cleanup *old_chain = save_inferior_ptid (); + +@@ -1696,11 +1813,12 @@ detach_breakpoints (int pid) + + /* Set inferior_ptid; remove_breakpoint uses this global. */ + inferior_ptid = pid_to_ptid (pid); +- ALL_BP_LOCATIONS (b) ++ ALL_BP_LOCATIONS (b, bp_tmp) + { + if (b->inserted) + val |= remove_breakpoint (b, mark_inserted); + } ++ val |= target_detach_watchpoints (); + do_cleanups (old_chain); + return val; + } +@@ -1793,12 +1911,14 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) + return val; + b->inserted = (is == mark_inserted); + } +- else if (b->loc_type == bp_loc_hardware_watchpoint) ++ /* bp_loc_hardware_watchpoint with mark_inserted is being handled by ++ target_detach_watchpoints. */ ++ else if (b->loc_type == bp_loc_hardware_watchpoint && is == mark_uninserted) + { + struct value *v; + struct value *n; + +- b->inserted = (is == mark_inserted); ++ b->inserted = 0; + val = target_remove_watchpoint (b->address, b->length, + b->watchpoint_type); + +@@ -1827,9 +1947,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) + void + mark_breakpoints_out (void) + { +- struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + bpt->inserted = 0; + } + +@@ -1849,7 +1969,7 @@ void + breakpoint_init_inferior (enum inf_context context) + { + struct breakpoint *b, *temp; +- struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + int ix; + + /* If breakpoint locations are shared across processes, then there's +@@ -1857,7 +1977,7 @@ breakpoint_init_inferior (enum inf_context context) + if (gdbarch_has_global_breakpoints (target_gdbarch)) + return; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + if (bpt->owner->enable_state != bp_permanent) + bpt->inserted = 0; + +@@ -1918,10 +2038,10 @@ breakpoint_init_inferior (enum inf_context context) + enum breakpoint_here + breakpoint_here_p (CORE_ADDR pc) + { +- const struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + int any_breakpoint_here = 0; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + { + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) +@@ -1961,16 +2081,16 @@ moribund_breakpoint_here_p (CORE_ADDR pc) + } + + /* Returns non-zero if there's a breakpoint inserted at PC, which is +- inserted using regular breakpoint_chain/bp_location_chain mechanism. ++ inserted using regular breakpoint_chain / bp_location array mechanism. + This does not check for single-step breakpoints, which are + inserted and removed using direct target manipulation. */ + + int + regular_breakpoint_inserted_here_p (CORE_ADDR pc) + { +- const struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + { + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) +@@ -2011,10 +2131,10 @@ breakpoint_inserted_here_p (CORE_ADDR pc) + int + software_breakpoint_inserted_here_p (CORE_ADDR pc) + { +- const struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + int any_breakpoint_here = 0; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + { + if (bpt->loc_type != bp_loc_software_breakpoint) + continue; +@@ -2044,12 +2164,12 @@ software_breakpoint_inserted_here_p (CORE_ADDR pc) + int + breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) + { +- const struct bp_location *bpt; ++ struct bp_location *bpt, **bptp_tmp; + /* The thread and task IDs associated to PTID, computed lazily. */ + int thread = -1; + int task = 0; + +- ALL_BP_LOCATIONS (bpt) ++ ALL_BP_LOCATIONS (bpt, bptp_tmp) + { + if (bpt->loc_type != bp_loc_software_breakpoint + && bpt->loc_type != bp_loc_hardware_breakpoint) +@@ -2503,6 +2623,12 @@ print_it_typical (bpstat bs) + result = PRINT_NOTHING; + break; + ++ case bp_exception_master: ++ /* These should never be enabled. */ ++ printf_filtered (_("Exception Master Breakpoint: gdb should not stop!\n")); ++ result = PRINT_NOTHING; ++ break; ++ + case bp_watchpoint: + case bp_hardware_watchpoint: + annotate_watchpoint (b->number); +@@ -2590,6 +2716,8 @@ print_it_typical (bpstat bs) + case bp_none: + case bp_longjmp: + case bp_longjmp_resume: ++ case bp_exception: ++ case bp_exception_resume: + case bp_step_resume: + case bp_watchpoint_scope: + case bp_call_dummy: +@@ -2973,8 +3101,12 @@ bpstat_check_location (const struct bp_location *bl, CORE_ADDR bp_addr) + + /* If BS refers to a watchpoint, determine if the watched values + has actually changed, and we should stop. If not, set BS->stop +- to 0. */ +-static void ++ to 0. ++ Return 0 for watchpoints which could not be the cause of this trap. ++ In such case PRINT_IT will be print_it_noop and STOP will be 0. ++ Otherwise return 1 but in such case it is not guaranteed whether this ++ breakpoint did or did not trigger this trap. */ ++static int + bpstat_check_watchpoint (bpstat bs) + { + const struct bp_location *bl = bs->breakpoint_at; +@@ -3063,8 +3195,10 @@ bpstat_check_watchpoint (bpstat bs) + anything for this watchpoint. */ + bs->print_it = print_it_noop; + bs->stop = 0; ++ return 0; + } + } ++ return 1; + } + + +@@ -3157,17 +3291,19 @@ bpstat + bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) + { + struct breakpoint *b = NULL; +- const struct bp_location *bl; ++ struct bp_location *bl, **blp_tmp; + struct bp_location *loc; + /* Root of the chain of bpstat's */ + struct bpstats root_bs[1]; + /* Pointer to the last thing in the chain currently. */ + bpstat bs = root_bs; + int ix; +- int need_remove_insert; ++ int need_remove_insert, update_locations = 0; + +- ALL_BP_LOCATIONS (bl) ++ ALL_BP_LOCATIONS (bl, blp_tmp) + { ++ bpstat bs_prev = bs; ++ + b = bl->owner; + gdb_assert (b); + if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) +@@ -3188,6 +3324,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) + /* Come here if it's a watchpoint, or if the break address matches */ + + bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ ++ gdb_assert (bs_prev->next == bs); + + /* Assume we stop. Should we find watchpoint that is not actually + triggered, or if condition of breakpoint is false, we'll reset +@@ -3195,12 +3332,21 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) + bs->stop = 1; + bs->print = 1; + +- bpstat_check_watchpoint (bs); +- if (!bs->stop) +- continue; ++ if (!bpstat_check_watchpoint (bs)) ++ { ++ /* Ensure bpstat_explains_signal stays false if this BL could not be ++ the cause of this trap. */ ++ ++ gdb_assert (bs->print_it == print_it_noop); ++ gdb_assert (!bs->stop); ++ xfree (bs); ++ bs = bs_prev; ++ bs->next = NULL; ++ continue; ++ } + + if (b->type == bp_thread_event || b->type == bp_overlay_event +- || b->type == bp_longjmp_master) ++ || b->type == bp_longjmp_master || b->type == bp_exception_master) + /* We do not stop for these. */ + bs->stop = 0; + else +@@ -3208,14 +3354,15 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) + + if (bs->stop) + { +- ++(b->hit_count); ++ if (b->enable_state != bp_disabled) ++ ++(b->hit_count); + + /* We will stop here */ + if (b->disposition == disp_disable) + { + if (b->enable_state != bp_permanent) + b->enable_state = bp_disabled; +- update_global_location_list (0); ++ update_locations = 1; + } + if (b->silent) + bs->print = 0; +@@ -3235,6 +3382,10 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) + bs->print_it = print_it_noop; + } + ++ /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */ ++ if (update_locations) ++ update_global_location_list (0); ++ + for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix) + { + if (loc->address == bp_addr) +@@ -3412,6 +3563,7 @@ bpstat_what (bpstat bs) + struct bpstat_what retval; + + retval.call_dummy = 0; ++ retval.is_longjmp = 0; + for (; bs != NULL; bs = bs->next) + { + enum class bs_class = no_effect; +@@ -3458,10 +3610,15 @@ bpstat_what (bpstat bs) + bs_class = no_effect; + break; + case bp_longjmp: ++ case bp_exception: + bs_class = long_jump; ++ retval.is_longjmp = bs->breakpoint_at->owner->type == bp_longjmp; + break; + case bp_longjmp_resume: ++ case bp_exception_resume: + bs_class = long_resume; ++ retval.is_longjmp ++ = bs->breakpoint_at->owner->type == bp_longjmp_resume; + break; + case bp_step_resume: + if (bs->stop) +@@ -3484,6 +3641,7 @@ bpstat_what (bpstat bs) + case bp_thread_event: + case bp_overlay_event: + case bp_longjmp_master: ++ case bp_exception_master: + bs_class = bp_nostop; + break; + case bp_catchpoint: +@@ -3605,6 +3763,8 @@ print_one_breakpoint_location (struct breakpoint *b, + {bp_access_watchpoint, "acc watchpoint"}, + {bp_longjmp, "longjmp"}, + {bp_longjmp_resume, "longjmp resume"}, ++ {bp_exception, "exception"}, ++ {bp_exception_resume, "exception resume"}, + {bp_step_resume, "step resume"}, + {bp_watchpoint_scope, "watchpoint scope"}, + {bp_call_dummy, "call dummy"}, +@@ -3612,6 +3772,7 @@ print_one_breakpoint_location (struct breakpoint *b, + {bp_thread_event, "thread events"}, + {bp_overlay_event, "overlay events"}, + {bp_longjmp_master, "longjmp master"}, ++ {bp_exception_master, "exception master"}, + {bp_catchpoint, "catchpoint"}, + {bp_tracepoint, "tracepoint"}, + {bp_jit_event, "jit events"}, +@@ -3735,6 +3896,8 @@ print_one_breakpoint_location (struct breakpoint *b, + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: ++ case bp_exception: ++ case bp_exception_resume: + case bp_step_resume: + case bp_watchpoint_scope: + case bp_call_dummy: +@@ -3742,6 +3905,7 @@ print_one_breakpoint_location (struct breakpoint *b, + case bp_thread_event: + case bp_overlay_event: + case bp_longjmp_master: ++ case bp_exception_master: + case bp_tracepoint: + case bp_jit_event: + if (opts.addressprint) +@@ -4197,9 +4361,8 @@ set_default_breakpoint (int valid, CORE_ADDR addr, struct symtab *symtab, + (or use it for any other purpose either). + + More specifically, each of the following breakpoint types will always +- have a zero valued address and we don't want check_duplicates() to mark +- breakpoints of any of these types to be a duplicate of an actual +- breakpoint at address zero: ++ have a zero valued address and we don't want to mark breakpoints of any of ++ these types to be a duplicate of an actual breakpoint at address zero: + + bp_watchpoint + bp_hardware_watchpoint +@@ -4219,88 +4382,6 @@ breakpoint_address_is_meaningful (struct breakpoint *bpt) + && type != bp_catchpoint); + } + +-/* Rescan breakpoints at the same address and section as BPT, +- marking the first one as "first" and any others as "duplicates". +- This is so that the bpt instruction is only inserted once. +- If we have a permanent breakpoint at the same place as BPT, make +- that one the official one, and the rest as duplicates. */ +- +-static void +-check_duplicates_for (CORE_ADDR address, struct obj_section *section) +-{ +- struct bp_location *b; +- int count = 0; +- struct bp_location *perm_bp = 0; +- +- ALL_BP_LOCATIONS (b) +- if (b->owner->enable_state != bp_disabled +- && b->owner->enable_state != bp_call_disabled +- && b->owner->enable_state != bp_startup_disabled +- && b->enabled +- && !b->shlib_disabled +- && b->address == address /* address / overlay match */ +- && (!overlay_debugging || b->section == section) +- && breakpoint_address_is_meaningful (b->owner)) +- { +- /* Have we found a permanent breakpoint? */ +- if (b->owner->enable_state == bp_permanent) +- { +- perm_bp = b; +- break; +- } +- +- count++; +- b->duplicate = count > 1; +- } +- +- /* If we found a permanent breakpoint at this address, go over the +- list again and declare all the other breakpoints there (except +- other permanent breakpoints) to be the duplicates. */ +- if (perm_bp) +- { +- perm_bp->duplicate = 0; +- +- /* Permanent breakpoint should always be inserted. */ +- if (! perm_bp->inserted) +- internal_error (__FILE__, __LINE__, +- _("allegedly permanent breakpoint is not " +- "actually inserted")); +- +- ALL_BP_LOCATIONS (b) +- if (b != perm_bp) +- { +- if (b->owner->enable_state != bp_permanent +- && b->owner->enable_state != bp_disabled +- && b->owner->enable_state != bp_call_disabled +- && b->owner->enable_state != bp_startup_disabled +- && b->enabled && !b->shlib_disabled +- && b->address == address /* address / overlay match */ +- && (!overlay_debugging || b->section == section) +- && breakpoint_address_is_meaningful (b->owner)) +- { +- if (b->inserted) +- internal_error (__FILE__, __LINE__, +- _("another breakpoint was inserted on top of " +- "a permanent breakpoint")); +- +- b->duplicate = 1; +- } +- } +- } +-} +- +-static void +-check_duplicates (struct breakpoint *bpt) +-{ +- struct bp_location *bl = bpt->loc; +- +- if (! breakpoint_address_is_meaningful (bpt)) +- return; +- +- for (; bl; bl = bl->next) +- check_duplicates_for (bl->address, bl->section); +-} +- + static void + breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, + int bnum, int have_bnum) +@@ -4382,6 +4463,8 @@ allocate_bp_location (struct breakpoint *bpt) + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: ++ case bp_exception: ++ case bp_exception_resume: + case bp_step_resume: + case bp_watchpoint_scope: + case bp_call_dummy: +@@ -4390,6 +4473,7 @@ allocate_bp_location (struct breakpoint *bpt) + case bp_overlay_event: + case bp_jit_event: + case bp_longjmp_master: ++ case bp_exception_master: + loc->loc_type = bp_loc_software_breakpoint; + break; + case bp_hardware_breakpoint: +@@ -4568,8 +4652,7 @@ make_breakpoint_permanent (struct breakpoint *b) + } + + /* Call this routine when stepping and nexting to enable a breakpoint +- if we do a longjmp() in THREAD. When we hit that breakpoint, call +- set_longjmp_resume_breakpoint() to figure out where we are going. */ ++ if we do a longjmp() or 'throw' in THREAD. */ + + void + set_longjmp_breakpoint (int thread) +@@ -4581,10 +4664,10 @@ set_longjmp_breakpoint (int thread) + longjmp "master" breakpoints. Here, we simply create momentary + clones of those and enable them for the requested thread. */ + ALL_BREAKPOINTS_SAFE (b, temp) +- if (b->type == bp_longjmp_master) ++ if (b->type == bp_longjmp_master || b->type == bp_exception_master) + { + struct breakpoint *clone = clone_momentary_breakpoint (b); +- clone->type = bp_longjmp; ++ clone->type = b->type == bp_longjmp_master ? bp_longjmp : bp_exception; + clone->thread = thread; + } + } +@@ -4596,7 +4679,7 @@ delete_longjmp_breakpoint (int thread) + struct breakpoint *b, *temp; + + ALL_BREAKPOINTS_SAFE (b, temp) +- if (b->type == bp_longjmp) ++ if (b->type == bp_longjmp || b->type == bp_exception) + { + if (b->thread == thread) + delete_breakpoint (b); +@@ -4710,9 +4793,9 @@ create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) + void + disable_breakpoints_in_shlibs (void) + { +- struct bp_location *loc; ++ struct bp_location *loc, **locp_tmp; + +- ALL_BP_LOCATIONS (loc) ++ ALL_BP_LOCATIONS (loc, locp_tmp) + { + struct breakpoint *b = loc->owner; + /* We apply the check to all breakpoints, including disabled +@@ -4742,7 +4825,7 @@ disable_breakpoints_in_shlibs (void) + static void + disable_breakpoints_in_unloaded_shlib (struct so_list *solib) + { +- struct bp_location *loc; ++ struct bp_location *loc, **locp_tmp; + int disabled_shlib_breaks = 0; + + /* SunOS a.out shared libraries are always mapped, so do not +@@ -4753,7 +4836,7 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib) + && bfd_get_flavour (exec_bfd) == bfd_target_aout_flavour) + return; + +- ALL_BP_LOCATIONS (loc) ++ ALL_BP_LOCATIONS (loc, locp_tmp) + { + struct breakpoint *b = loc->owner; + if ((loc->loc_type == bp_loc_hardware_breakpoint +@@ -5648,6 +5731,8 @@ mention (struct breakpoint *b) + case bp_finish: + case bp_longjmp: + case bp_longjmp_resume: ++ case bp_exception: ++ case bp_exception_resume: + case bp_step_resume: + case bp_call_dummy: + case bp_watchpoint_scope: +@@ -5656,6 +5741,7 @@ mention (struct breakpoint *b) + case bp_overlay_event: + case bp_jit_event: + case bp_longjmp_master: ++ case bp_exception_master: + break; + } + +@@ -6958,6 +7044,7 @@ struct until_break_command_continuation_args + { + struct breakpoint *breakpoint; + struct breakpoint *breakpoint2; ++ int thread_num; + }; + + /* This function is called by fetch_inferior_event via the +@@ -6972,6 +7059,7 @@ until_break_command_continuation (void *arg) + delete_breakpoint (a->breakpoint); + if (a->breakpoint2) + delete_breakpoint (a->breakpoint2); ++ delete_longjmp_breakpoint (a->thread_num); + } + + void +@@ -6983,6 +7071,8 @@ until_break_command (char *arg, int from_tty, int anywhere) + struct breakpoint *breakpoint; + struct breakpoint *breakpoint2 = NULL; + struct cleanup *old_chain; ++ int thread; ++ struct thread_info *tp; + + clear_proceed_status (); + +@@ -7021,6 +7111,9 @@ until_break_command (char *arg, int from_tty, int anywhere) + + old_chain = make_cleanup_delete_breakpoint (breakpoint); + ++ tp = inferior_thread (); ++ thread = tp->num; ++ + /* Keep within the current frame, or in frames called by the current + one. */ + +@@ -7033,6 +7126,10 @@ until_break_command (char *arg, int from_tty, int anywhere) + frame_unwind_caller_id (frame), + bp_until); + make_cleanup_delete_breakpoint (breakpoint2); ++ ++ set_longjmp_breakpoint (thread); ++ tp->initiating_frame = frame_unwind_caller_id (frame); ++ make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); + } + + proceed (-1, TARGET_SIGNAL_DEFAULT, 0); +@@ -7049,6 +7146,7 @@ until_break_command (char *arg, int from_tty, int anywhere) + + args->breakpoint = breakpoint; + args->breakpoint2 = breakpoint2; ++ args->thread_num = thread; + + discard_cleanups (old_chain); + add_continuation (inferior_thread (), +@@ -7758,6 +7856,82 @@ do_vec_free (void *p) + VEC_free (bp_location_p, *vec); + } + ++/* A comparison function for bp_location A and B being interfaced to qsort. ++ Sort elements primarily by their ADDRESS (no matter what does ++ breakpoint_address_is_meaningful say for its OWNER), secondarily by ordering ++ first bp_permanent OWNERed elements and terciarily just ensuring the array ++ is sorted stable way despite qsort being an instable algorithm. */ ++ ++static int ++bp_location_compare (struct bp_location *a, struct bp_location *b) ++{ ++ int a_perm = a->owner->enable_state == bp_permanent; ++ int b_perm = b->owner->enable_state == bp_permanent; ++ ++ if (a->address != b->address) ++ return (a->address > b->address) - (a->address < b->address); ++ ++ /* Sort permanent breakpoints first. */ ++ if (a_perm != b_perm) ++ return (a_perm < b_perm) - (a_perm > b_perm); ++ ++ /* Make the user-visible order stable across GDB runs. Locations of the same ++ breakpoint can be sorted in arbitrary order. */ ++ ++ if (a->owner->number != b->owner->number) ++ return (a->owner->number > b->owner->number) ++ - (a->owner->number < b->owner->number); ++ ++ return (a > b) - (a < b); ++} ++ ++/* Interface bp_location_compare as the COMPAR parameter of qsort function. */ ++ ++static int ++bp_location_compare_for_qsort (const void *ap, const void *bp) ++{ ++ struct bp_location *a = *(void **) ap; ++ struct bp_location *b = *(void **) bp; ++ ++ return bp_location_compare (a, b); ++} ++ ++/* Set bp_location_placed_address_before_address_max and ++ bp_location_shadow_len_after_address_max according to the current content of ++ the bp_location array. */ ++ ++static void ++bp_location_target_extensions_update (void) ++{ ++ struct bp_location *bl, **blp_tmp; ++ ++ bp_location_placed_address_before_address_max = 0; ++ bp_location_shadow_len_after_address_max = 0; ++ ++ ALL_BP_LOCATIONS (bl, blp_tmp) ++ { ++ CORE_ADDR start, end, addr; ++ ++ if (!bp_location_has_shadow (bl)) ++ continue; ++ ++ start = bl->target_info.placed_address; ++ end = start + bl->target_info.shadow_len; ++ ++ gdb_assert (bl->address >= start); ++ addr = bl->address - start; ++ if (addr > bp_location_placed_address_before_address_max) ++ bp_location_placed_address_before_address_max = addr; ++ ++ /* Zero SHADOW_LEN would not pass bp_location_has_shadow. */ ++ ++ gdb_assert (bl->address < end); ++ addr = end - bl->address; ++ if (addr > bp_location_shadow_len_after_address_max) ++ bp_location_shadow_len_after_address_max = addr; ++ } ++} ++ + /* If SHOULD_INSERT is false, do not insert any breakpoint locations + into the inferior, only remove already-inserted locations that no + longer should be inserted. Functions that delete a breakpoint or +@@ -7777,49 +7951,66 @@ static void + update_global_location_list (int should_insert) + { + struct breakpoint *b; +- struct bp_location **next = &bp_location_chain; +- struct bp_location *loc; +- struct bp_location *loc2; +- VEC(bp_location_p) *old_locations = NULL; +- int ret; +- int ix; ++ struct bp_location **locp, *loc; + struct cleanup *cleanups; + +- cleanups = make_cleanup (do_vec_free, &old_locations); +- /* Store old locations for future reference. */ +- for (loc = bp_location_chain; loc; loc = loc->global_next) +- VEC_safe_push (bp_location_p, old_locations, loc); ++ /* The first bp_location being the only one non-DUPLICATE for the current run ++ of the same ADDRESS. */ ++ struct bp_location *loc_first; ++ ++ /* Saved former bp_location array which we compare against the newly built ++ bp_location from the current state of ALL_BREAKPOINTS. */ ++ struct bp_location **old_location, **old_locp; ++ unsigned old_location_count; ++ ++ old_location = bp_location; ++ old_location_count = bp_location_count; ++ bp_location = NULL; ++ bp_location_count = 0; ++ cleanups = make_cleanup (xfree, old_location); + +- bp_location_chain = NULL; + ALL_BREAKPOINTS (b) +- { +- for (loc = b->loc; loc; loc = loc->next) +- { +- *next = loc; +- next = &(loc->global_next); +- *next = NULL; +- } +- } ++ for (loc = b->loc; loc; loc = loc->next) ++ bp_location_count++; ++ ++ bp_location = xmalloc (sizeof (*bp_location) * bp_location_count); ++ locp = bp_location; ++ ALL_BREAKPOINTS (b) ++ for (loc = b->loc; loc; loc = loc->next) ++ *locp++ = loc; ++ qsort (bp_location, bp_location_count, sizeof (*bp_location), ++ bp_location_compare_for_qsort); ++ ++ bp_location_target_extensions_update (); + + /* Identify bp_location instances that are no longer present in the new + list, and therefore should be freed. Note that it's not necessary that + those locations should be removed from inferior -- if there's another + location at the same address (previously marked as duplicate), +- we don't need to remove/insert the location. */ +- for (ix = 0; VEC_iterate(bp_location_p, old_locations, ix, loc); ++ix) ++ we don't need to remove/insert the location. ++ ++ LOCP is kept in sync with OLD_LOCP, each pointing to the current and ++ former bp_location array state respectively. */ ++ ++ locp = bp_location; ++ for (old_locp = old_location; old_locp < old_location + old_location_count; ++ old_locp++) + { +- /* Tells if 'loc' is found amoung the new locations. If not, we ++ struct bp_location *old_loc = *old_locp; ++ ++ /* Tells if 'old_loc' is found amoung the new locations. If not, we + have to free it. */ +- int found_object = 0; ++ int found_object; + /* Tells if the location should remain inserted in the target. */ + int keep_in_target = 0; + int removed = 0; +- for (loc2 = bp_location_chain; loc2; loc2 = loc2->global_next) +- if (loc2 == loc) +- { +- found_object = 1; +- break; +- } ++ ++ /* Skip LOCP entries which will definitely never be needed. Stop either ++ at or being the one matching OLD_LOC. */ ++ while (locp < bp_location + bp_location_count ++ && bp_location_compare (*locp, old_loc) < 0) ++ locp++; ++ found_object = locp < bp_location + bp_location_count && *locp == old_loc; + + /* If this location is no longer present, and inserted, look if there's + maybe a new location at the same address. If so, mark that one +@@ -7827,11 +8018,11 @@ update_global_location_list (int should_insert) + don't have a time window where a breakpoint at certain location is not + inserted. */ + +- if (loc->inserted) ++ if (old_loc->inserted) + { + /* If the location is inserted now, we might have to remove it. */ + +- if (found_object && should_be_inserted (loc)) ++ if (found_object && should_be_inserted (old_loc)) + { + /* The location is still present in the location list, and still + should be inserted. Don't do anything. */ +@@ -7842,37 +8033,46 @@ update_global_location_list (int should_insert) + /* The location is either no longer present, or got disabled. + See if there's another location at the same address, in which + case we don't need to remove this one from the target. */ +- if (breakpoint_address_is_meaningful (loc->owner)) +- for (loc2 = bp_location_chain; loc2; loc2 = loc2->global_next) +- { +- /* For the sake of should_insert_location. The +- call to check_duplicates will fix up this later. */ +- loc2->duplicate = 0; +- if (should_be_inserted (loc2) +- && loc2 != loc && loc2->address == loc->address) +- { +- loc2->inserted = 1; +- loc2->target_info = loc->target_info; +- keep_in_target = 1; +- break; +- } +- } ++ ++ if (breakpoint_address_is_meaningful (old_loc->owner)) ++ { ++ struct bp_location **loc2p; ++ ++ for (loc2p = locp; ++ loc2p < bp_location + bp_location_count ++ && (*loc2p)->address == old_loc->address; ++ loc2p++) ++ { ++ struct bp_location *loc2 = *loc2p; ++ ++ /* For the sake of should_be_inserted. ++ Duplicates check below will fix up this later. */ ++ loc2->duplicate = 0; ++ if (loc2 != old_loc && should_be_inserted (loc2)) ++ { ++ loc2->inserted = 1; ++ loc2->target_info = old_loc->target_info; ++ keep_in_target = 1; ++ break; ++ } ++ } ++ } + } + + if (!keep_in_target) + { +- if (remove_breakpoint (loc, mark_uninserted)) ++ if (remove_breakpoint (old_loc, mark_uninserted)) + { + /* This is just about all we can do. We could keep this + location on the global list, and try to remove it next + time, but there's no particular reason why we will + succeed next time. + +- Note that at this point, loc->owner is still valid, ++ Note that at this point, old_loc->owner is still valid, + as delete_breakpoint frees the breakpoint only + after calling us. */ + printf_filtered (_("warning: Error removing breakpoint %d\n"), +- loc->owner->number); ++ old_loc->owner->number); + } + removed = 1; + } +@@ -7894,19 +8094,59 @@ update_global_location_list (int should_insert) + longer need to keep this breakpoint. This is just a + heuristic, but if it's wrong, we'll report unexpected SIGTRAP, + which is usability issue, but not a correctness problem. */ +- loc->events_till_retirement = 3 * (thread_count () + 1); +- loc->owner = NULL; ++ old_loc->events_till_retirement = 3 * (thread_count () + 1); ++ old_loc->owner = NULL; + +- VEC_safe_push (bp_location_p, moribund_locations, loc); ++ VEC_safe_push (bp_location_p, moribund_locations, old_loc); + } + else +- free_bp_location (loc); ++ free_bp_location (old_loc); + } + } + +- ALL_BREAKPOINTS (b) ++ /* Rescan breakpoints at the same address and section, ++ marking the first one as "first" and any others as "duplicates". ++ This is so that the bpt instruction is only inserted once. ++ If we have a permanent breakpoint at the same place as BPT, make ++ that one the official one, and the rest as duplicates. Permanent ++ breakpoints are sorted first for the same address. */ ++ ++ loc_first = NULL; ++ ALL_BP_LOCATIONS (loc, locp) + { +- check_duplicates (b); ++ struct breakpoint *b = loc->owner; ++ ++ if (b->enable_state == bp_disabled ++ || b->enable_state == bp_call_disabled ++ || b->enable_state == bp_startup_disabled ++ || !loc->enabled ++ || loc->shlib_disabled ++ || !breakpoint_address_is_meaningful (b)) ++ continue; ++ ++ /* Permanent breakpoint should always be inserted. */ ++ if (b->enable_state == bp_permanent && ! loc->inserted) ++ internal_error (__FILE__, __LINE__, ++ _("allegedly permanent breakpoint is not " ++ "actually inserted")); ++ ++ if (loc_first == NULL ++ /* address / overlay match */ ++ || loc->address != loc_first->address ++ || (overlay_debugging && loc->section != loc_first->section)) ++ { ++ loc_first = loc; ++ loc->duplicate = 0; ++ continue; ++ } ++ ++ loc->duplicate = 1; ++ ++ if (loc_first->owner->enable_state == bp_permanent && loc->inserted ++ && b->enable_state != bp_permanent) ++ internal_error (__FILE__, __LINE__, ++ _("another breakpoint was inserted on top of " ++ "a permanent breakpoint")); + } + + if (breakpoints_always_inserted_mode () && should_insert +@@ -8083,6 +8323,7 @@ delete_command (char *arg, int from_tty) + && b->type != bp_thread_event + && b->type != bp_overlay_event + && b->type != bp_longjmp_master ++ && b->type != bp_exception_master + && b->number >= 0) + { + breaks_to_delete = 1; +@@ -8102,6 +8343,7 @@ delete_command (char *arg, int from_tty) + && b->type != bp_jit_event + && b->type != bp_overlay_event + && b->type != bp_longjmp_master ++ && b->type != bp_exception_master + && b->number >= 0) + delete_breakpoint (b); + } +@@ -8404,6 +8646,7 @@ breakpoint_re_set_one (void *bint) + reset later by breakpoint_re_set. */ + case bp_overlay_event: + case bp_longjmp_master: ++ case bp_exception_master: + delete_breakpoint (b); + break; + +@@ -8427,6 +8670,8 @@ breakpoint_re_set_one (void *bint) + case bp_longjmp: + case bp_longjmp_resume: + case bp_jit_event: ++ case bp_exception: ++ case bp_exception_resume: + break; + } + +@@ -8462,6 +8707,7 @@ breakpoint_re_set (void) + create_longjmp_master_breakpoint ("_longjmp"); + create_longjmp_master_breakpoint ("siglongjmp"); + create_longjmp_master_breakpoint ("_siglongjmp"); ++ create_exception_master_breakpoint (); + } + + /* Reset the thread number of this breakpoint: +@@ -9327,6 +9573,22 @@ all_tracepoints () return tp_vec; } @@ -470,17 +1858,63 @@ index f3940e1..70222a4 100644 /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -9345,4 +9374,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), +@@ -9850,4 +10112,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed); + observer_attach_mark_used (breakpoint_types_mark_used); } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h -index d93c6b6..a555c16 100644 +index ba499c6..80f702f 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h -@@ -918,6 +918,9 @@ extern void breakpoint_retire_moribund (void); +@@ -56,6 +56,13 @@ enum bptype + bp_longjmp, /* secret breakpoint to find longjmp() */ + bp_longjmp_resume, /* secret breakpoint to escape longjmp() */ + ++ /* An internal breakpoint that is installed on the unwinder's ++ debug hook. */ ++ bp_exception, ++ /* An internal breakpoint that is set at the point where an ++ exception will land. */ ++ bp_exception_resume, ++ + /* Used by wait_for_inferior for stepping over subroutine calls, for + stepping over signal handlers, and for skipping prologues. */ + bp_step_resume, +@@ -118,6 +125,9 @@ enum bptype + + bp_longjmp_master, + ++ /* Like bp_longjmp_master, but for exceptions. */ ++ bp_exception_master, ++ + bp_catchpoint, + + bp_tracepoint, +@@ -228,10 +238,6 @@ struct bp_location + the same parent breakpoint. */ + struct bp_location *next; + +- /* Pointer to the next breakpoint location, in a global +- list of all breakpoint locations. */ +- struct bp_location *global_next; +- + /* Type of this breakpoint location. */ + enum bp_loc_type loc_type; + +@@ -583,6 +589,10 @@ struct bpstat_what + continuing from a call dummy without popping the frame is not a + useful one). */ + int call_dummy; ++ ++ /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME. True if we are ++ handling a longjmp, false if we are handling an exception. */ ++ int is_longjmp; + }; + + /* The possible return values for print_bpstat, print_it_normal, +@@ -946,6 +956,9 @@ extern int catching_syscall_number (int syscall_number); /* Tell a breakpoint to be quiet. */ extern void make_breakpoint_silent (struct breakpoint *); @@ -491,7 +1925,7 @@ index d93c6b6..a555c16 100644 extern struct breakpoint *get_tracepoint (int num); diff --git a/gdb/c-exp.y b/gdb/c-exp.y -index aacc112..e206983 100644 +index f8e4f12..5b47e2e 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -117,6 +117,8 @@ static int yylex (void); @@ -524,33 +1958,6 @@ index aacc112..e206983 100644 /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -@@ -232,7 +238,7 @@ static int parse_number (char *, int, int, YYSTYPE *); - %left '+' '-' - %left '*' '/' '%' - %right UNARY INCREMENT DECREMENT --%right ARROW '.' '[' '(' -+%right ARROW ARROW_STAR '.' DOT_STAR '[' '(' - %token BLOCKNAME - %token FILENAME - %type block -@@ -333,7 +339,7 @@ exp : exp ARROW qualified_name - write_exp_elt_opcode (STRUCTOP_MPTR); } - ; - --exp : exp ARROW '*' exp -+exp : exp ARROW_STAR exp - { write_exp_elt_opcode (STRUCTOP_MPTR); } - ; - -@@ -368,7 +374,7 @@ exp : exp '.' qualified_name - write_exp_elt_opcode (STRUCTOP_MEMBER); } - ; - --exp : exp '.' '*' exp -+exp : exp DOT_STAR exp - { write_exp_elt_opcode (STRUCTOP_MEMBER); } - ; - @@ -401,6 +407,36 @@ arglist : arglist ',' exp %prec ABOVE_COMMA { arglist_len++; } ; @@ -801,27 +2208,7 @@ index aacc112..e206983 100644 /* Take care of parsing a number (anything that starts with a digit). Set yylval and return the token type; update lexptr. LEN is the number of characters in it. */ -@@ -1664,7 +1845,8 @@ struct token - static const struct token tokentab3[] = - { - {">>=", ASSIGN_MODIFY, BINOP_RSH, 0}, -- {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0} -+ {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0}, -+ {"->*", ARROW_STAR, BINOP_END, 1} - }; - - static const struct token tokentab2[] = -@@ -1688,7 +1870,8 @@ static const struct token tokentab2[] = - {"==", EQUAL, BINOP_END, 0}, - {"!=", NOTEQUAL, BINOP_END, 0}, - {"<=", LEQ, BINOP_END, 0}, -- {">=", GEQ, BINOP_END, 0} -+ {">=", GEQ, BINOP_END, 0}, -+ {".*", DOT_STAR, BINOP_END, 0} - }; - - /* Identifier-like tokens. */ -@@ -1710,6 +1893,9 @@ static const struct token ident_tokens[] = +@@ -1714,6 +1895,9 @@ static const struct token ident_tokens[] = {"long", LONG, OP_NULL, 0}, {"true", TRUEKEYWORD, OP_NULL, 1}, {"int", INT_KEYWORD, OP_NULL, 0}, @@ -831,7 +2218,7 @@ index aacc112..e206983 100644 {"and", ANDAND, BINOP_END, 1}, {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, 1}, -@@ -1818,6 +2004,13 @@ static int last_was_structop; +@@ -1822,6 +2006,13 @@ static int last_was_structop; static int yylex (void) { @@ -845,7 +2232,7 @@ index aacc112..e206983 100644 int c; int namelen; unsigned int i; -@@ -1826,9 +2019,19 @@ yylex (void) +@@ -1830,9 +2021,19 @@ yylex (void) char *copy; last_was_structop = 0; @@ -867,10 +2254,10 @@ index aacc112..e206983 100644 /* Check if this is a macro invocation that we need to expand. */ if (! scanning_macro_expansion ()) { -@@ -1856,10 +2059,19 @@ yylex (void) - for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) - { +@@ -1868,10 +2069,19 @@ yylex (void) + && parse_language->la_language != language_cplus) + break; + + if (tokentab2[i].token == COLONCOLON) + { + name_prefix_len += 2; @@ -887,7 +2274,7 @@ index aacc112..e206983 100644 return tokentab2[i].token; } -@@ -1888,6 +2100,8 @@ yylex (void) +@@ -1900,6 +2110,8 @@ yylex (void) return 0; case ' ': @@ -896,7 +2283,7 @@ index aacc112..e206983 100644 case '\t': case '\n': lexptr++; -@@ -2045,11 +2259,13 @@ yylex (void) +@@ -2057,11 +2269,13 @@ yylex (void) error ("Invalid character '%c' in expression.", c); /* It's a name. See how long it is. */ @@ -910,7 +2297,7 @@ index aacc112..e206983 100644 /* Template parameter lists are part of the name. FIXME: This mishandles `print $a<4&&$a>3'. */ -@@ -2113,14 +2329,29 @@ yylex (void) +@@ -2125,14 +2339,29 @@ yylex (void) currently as names of types; NAME for other symbols. The caller is not constrained to care about the distinction. */ { @@ -941,7 +2328,7 @@ index aacc112..e206983 100644 /* Call lookup_symtab, not lookup_partial_symtab, in case there are no psymtabs (coff, xcoff, or some future change to blow away the psymtabs once once symbols are read). */ -@@ -2179,6 +2410,7 @@ yylex (void) +@@ -2191,6 +2420,7 @@ yylex (void) yylval.ssym.is_a_field_of_this = is_a_field_of_this; if (in_parse_field && *lexptr == '\0') saw_name_at_eof = 1; @@ -950,7 +2337,7 @@ index aacc112..e206983 100644 } } diff --git a/gdb/c-lang.c b/gdb/c-lang.c -index 4ba81ba..053f685 100644 +index d01490c..bc35a3e 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -715,7 +715,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length, @@ -1244,10 +2631,10 @@ index 888f8b4..65494b8 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 f2d56a0..0909c80 100644 +index 4716524..0745c65 100644 --- a/gdb/config.in +++ b/gdb/config.in -@@ -43,11 +43,10 @@ +@@ -46,11 +46,10 @@ language is requested. */ #undef ENABLE_NLS @@ -1261,7 +2648,7 @@ index f2d56a0..0909c80 100644 #undef GDB_DATADIR_RELOCATABLE /* Define to be a string naming the default host character set. */ -@@ -641,6 +640,9 @@ +@@ -647,6 +646,9 @@ 'ptrdiff_t'. */ #undef PTRDIFF_T_SUFFIX @@ -1513,19 +2900,27 @@ index 0000000..49ac420 +#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1 + diff --git a/gdb/configure b/gdb/configure -index 93f7f4b..a6580e2 100755 +index 99acc2f..a2ea1ae 100755 --- a/gdb/configure +++ b/gdb/configure -@@ -314,7 +314,7 @@ ac_subdirs_all="$ac_subdirs_all doc testsuite" - ac_subdirs_all="$ac_subdirs_all gdbtk" - 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 DEBUGDIR GDB_DATADIR 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 SYSTEM_GDBINIT 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir 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 DEBUGDIR GDB_DATADIR GDB_DATADIR_PATH pythondir 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 SYSTEM_GDBINIT 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 GDB_NM_FILE datarootdir docdir htmldir pdfdir LIBOBJS LTLIBOBJS gl_LIBOBJS gl_LTLIBOBJS gltests_LIBOBJS gltests_LTLIBOBJS' - ac_subst_files='host_makefile_frag' - ac_pwd=`pwd` - -@@ -891,6 +891,10 @@ Optional Packages: +@@ -676,6 +676,8 @@ REPORT_BUGS_TO + PKGVERSION + TARGET_OBS + subdirs ++pythondir ++GDB_DATADIR_PATH + GDB_DATADIR + DEBUGDIR + am__fastdepCC_FALSE +@@ -883,6 +885,7 @@ enable_dependency_tracking + with_separate_debug_dir + with_gdb_datadir + with_relocated_sources ++with_pythondir + enable_targets + enable_64_bit_bfd + enable_gdbcli +@@ -1581,6 +1584,10 @@ Optional Packages: [DATADIR/gdb] --with-relocated-sources=PATH automatically relocate this path for source files @@ -1536,20 +2931,20 @@ index 93f7f4b..a6580e2 100755 --with-libunwind use libunwind frame unwinding support --with-curses use the curses library instead of the termcap library -@@ -7218,6 +7222,75 @@ _ACEOF +@@ -6602,6 +6609,73 @@ _ACEOF + fi - fi; +# GDB's datadir relocation + +gdbdatadir=${datadir}/gdb + + -+# Check whether --with-gdb-datadir or --without-gdb-datadir was given. -+if test "${with_gdb_datadir+set}" = set; then -+ withval="$with_gdb_datadir" -+ gdbdatadir="${withval}" -+fi; ++# Check whether --with-gdb-datadir was given. ++if test "${with_gdb_datadir+set}" = set; then : ++ withval=$with_gdb_datadir; gdbdatadir="${withval}" ++fi ++ + + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" @@ -1577,9 +2972,7 @@ index 93f7f4b..a6580e2 100755 + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + -+cat >>confdefs.h <<\_ACEOF -+#define GDB_DATADIR_RELOCATABLE 1 -+_ACEOF ++$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h + + ;; +esac @@ -1587,13 +2980,13 @@ index 93f7f4b..a6580e2 100755 + + + -+# Check whether --with-pythondir or --without-pythondir was given. -+if test "${with_pythondir+set}" = set; then -+ withval="$with_pythondir" -+ pythondir="${withval}" ++# Check whether --with-pythondir was given. ++if test "${with_pythondir+set}" = set; then : ++ withval=$with_pythondir; pythondir="${withval}" +else + pythondir=no -+fi; ++fi ++ + +# If the user passed in a path, define it. Otherwise, compute it at +# runtime based on the possibly-relocatable datadir. @@ -1612,7 +3005,7 @@ index 93f7f4b..a6580e2 100755 subdirs="$subdirs doc testsuite" -@@ -11837,6 +11910,8 @@ _ACEOF +@@ -9282,6 +9356,8 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" @@ -1621,20 +3014,11 @@ index 93f7f4b..a6580e2 100755 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" # Flags needed to compile Python code (taken from python-config --cflags). -@@ -22174,6 +22249,8 @@ s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t - s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t - s,@DEBUGDIR@,$DEBUGDIR,;t t - s,@GDB_DATADIR@,$GDB_DATADIR,;t t -+s,@GDB_DATADIR_PATH@,$GDB_DATADIR_PATH,;t t -+s,@pythondir@,$pythondir,;t t - s,@subdirs@,$subdirs,;t t - s,@TARGET_OBS@,$TARGET_OBS,;t t - s,@PKGVERSION@,$PKGVERSION,;t t diff --git a/gdb/configure.ac b/gdb/configure.ac -index 77f8436..bca368c 100644 +index b31d9b7..a1969bc 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -109,6 +109,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat +@@ -107,6 +107,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat [Relocated directory for source files. ]) ]) @@ -1686,7 +3070,7 @@ index 77f8436..bca368c 100644 AC_CONFIG_SUBDIRS(doc testsuite) # Check whether to support alternative target configurations -@@ -660,6 +705,8 @@ if test "${have_libpython}" = yes; then +@@ -658,6 +703,8 @@ if test "${have_libpython}" = yes; then CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)" CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" @@ -1718,26 +3102,30 @@ index 62800b8..97d587b 100644 { $$ = $1.comp; if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); } diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c -index d2d8f2e..cc259e7 100644 +index d2d8f2e..af0ba28 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c -@@ -35,15 +35,7 @@ - static struct using_direct *cp_copy_usings (struct using_direct *using, +@@ -36,14 +36,17 @@ static struct using_direct *cp_copy_usings (struct using_direct *using, struct obstack *obstack); --static struct symbol *lookup_namespace_scope (const char *name, + 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); -- + const struct block *block, + const domain_enum domain, + const char *scope, + int scope_len); + ++static struct symbol *cp_lookup_symbol_in_namespace (const char *namespace, ++ const char *name, ++ const struct block *block, ++ const domain_enum domain); ++ static struct symbol *lookup_symbol_file (const char *name, - const char *linkage_name, const struct block *block, const domain_enum domain, int anonymous_namespace); -@@ -119,7 +111,7 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) +@@ -119,7 +122,7 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) 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. */ @@ -1746,7 +3134,7 @@ index d2d8f2e..cc259e7 100644 } /* The "+ 2" is for the "::". */ previous_component = next_component + 2; -@@ -134,7 +126,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) +@@ -134,7 +137,8 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol) has already been added, don't add it twice. */ void @@ -1756,7 +3144,7 @@ index d2d8f2e..cc259e7 100644 { struct using_direct *current; struct using_direct *new; -@@ -148,7 +141,8 @@ cp_add_using_directive (const char *dest, const char *src) +@@ -148,7 +152,8 @@ cp_add_using_directive (const char *dest, const char *src) return; } @@ -1766,7 +3154,7 @@ index d2d8f2e..cc259e7 100644 } -@@ -201,7 +195,10 @@ cp_is_anonymous (const char *namespace) +@@ -201,7 +206,10 @@ cp_is_anonymous (const char *namespace) } /* Create a new struct using direct which imports the namespace SRC @@ -1778,7 +3166,7 @@ index d2d8f2e..cc259e7 100644 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. */ -@@ -209,13 +206,19 @@ cp_is_anonymous (const char *namespace) +@@ -209,14 +217,21 @@ cp_is_anonymous (const char *namespace) struct using_direct * cp_add_using (const char *dest, const char *src, @@ -1798,9 +3186,11 @@ index d2d8f2e..cc259e7 100644 + retval->declaration = savestring (declaration, strlen (declaration)); + retval->line_number = line_number; retval->next = next; ++ retval->searched = 0; return retval; -@@ -241,10 +244,16 @@ cp_copy_usings (struct using_direct *using, + } +@@ -241,10 +256,18 @@ cp_copy_usings (struct using_direct *using, obstack); retval->import_dest = obsavestring (using->import_dest, strlen (using->import_dest), obstack); @@ -1810,6 +3200,8 @@ index d2d8f2e..cc259e7 100644 + obstack); retval->next = cp_copy_usings (using->next, obstack); ++ retval->searched = using->searched; ++ xfree (using->import_src); xfree (using->import_dest); + xfree (using->alias); @@ -1817,7 +3209,7 @@ index d2d8f2e..cc259e7 100644 xfree (using); return retval; -@@ -261,12 +270,42 @@ cp_copy_usings (struct using_direct *using, +@@ -261,12 +284,48 @@ cp_copy_usings (struct using_direct *using, struct symbol * cp_lookup_symbol_nonlocal (const char *name, @@ -1827,31 +3219,37 @@ index d2d8f2e..cc259e7 100644 { - return lookup_namespace_scope (name, linkage_name, block, domain, - block_scope (block), 0); -+ struct symbol *sym; -+ const char* scope = block_scope (block); ++ struct symbol *sym; ++ const char *scope = block_scope (block); + -+ sym = lookup_namespace_scope (name, block, domain, scope , 0, 0); -+ if ( sym != NULL) ++ sym = lookup_namespace_scope (name, block, domain, scope, 0); ++ if (sym != NULL) + return sym; + -+ return cp_lookup_symbol_namespace_incremental(scope, name, block, domain); ++ return cp_lookup_symbol_namespace(scope, name, block, domain); +} + ++/* Searches for NAME in the current namespace, and by applying relevant import ++ statements belonging to BLOCK and its parents. SCOPE is the namespace ++ scope of the context in which the search is being evaluated. */ ++ +struct symbol* -+cp_lookup_symbol_namespace_incremental (const char *scope, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain) ++cp_lookup_symbol_namespace (const char *scope, ++ const char *name, ++ const struct block *block, ++ const domain_enum domain) +{ + struct symbol *sym; + -+ sym = cp_lookup_symbol_namespace (scope, name, block, domain, 0); ++ /* First, try to find the symbol in the given namespace. */ ++ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain); + if ( sym != NULL) + return sym; -+ ++ ++ /* Search for name in namespaces imported to this and parent blocks. */ + while (block != NULL) + { -+ sym = cp_lookup_symbol_imports(scope, name, block, domain,0); ++ sym = cp_lookup_symbol_imports(scope,name, block, domain,0,1); + + if (sym) + return sym; @@ -1863,7 +3261,7 @@ index d2d8f2e..cc259e7 100644 } /* Lookup NAME at namespace scope (or, in C terms, in static and -@@ -284,13 +323,13 @@ cp_lookup_symbol_nonlocal (const char *name, +@@ -284,9 +343,8 @@ cp_lookup_symbol_nonlocal (const char *name, "A::x", and if that call fails, then the first call looks for "x". */ @@ -1874,30 +3272,23 @@ index d2d8f2e..cc259e7 100644 const struct block *block, const domain_enum domain, const char *scope, -- int scope_len) -+ int scope_len, -+ int declaration_only) - { - char *namespace; - -@@ -308,8 +347,8 @@ lookup_namespace_scope (const char *name, +@@ -308,8 +366,7 @@ lookup_namespace_scope (const char *name, new_scope_len += 2; } new_scope_len += cp_find_first_component (scope + new_scope_len); - sym = lookup_namespace_scope (name, linkage_name, block, - domain, scope, new_scope_len); -+ sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len, -+ declaration_only); ++ sym = lookup_namespace_scope (name, block, domain, scope, new_scope_len); if (sym != NULL) return sym; } -@@ -320,25 +359,50 @@ lookup_namespace_scope (const char *name, +@@ -320,25 +377,87 @@ 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, - block, domain); -+ return cp_lookup_symbol_namespace (namespace, name, block, domain, declaration_only); ++ return cp_lookup_symbol_in_namespace (namespace, name,block, domain); } -/* Look up NAME in the C++ namespace NAMESPACE, applying the using @@ -1905,14 +3296,11 @@ index d2d8f2e..cc259e7 100644 +/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in cp_lookup_symbol_nonlocal. */ - struct symbol * - cp_lookup_symbol_namespace (const char *namespace, - const char *name, -- const char *linkage_name, - const struct block *block, -- const domain_enum domain) -+ const domain_enum domain, -+ int declaration_only) ++static struct symbol * ++cp_lookup_symbol_in_namespace (const char *namespace, ++ const char *name, ++ const struct block *block, ++ const domain_enum domain) +{ + + if (namespace[0] == '\0') @@ -1932,41 +3320,91 @@ index d2d8f2e..cc259e7 100644 +} + +/* Search for NAME by applying all import statements belonging -+ to BLOCK which are applicable in SCOPE. */ ++ to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search ++ is restricted to using declarations. ++ Example: + -+struct symbol * ++ namespace A{ ++ int x; ++ } ++ using A::x; ++ ++ If SEARCH_PARENTS the search will include imports which are applicable in ++ parents of scopes. ++ Example: ++ ++ namespace A{ ++ using namespace X; ++ namespace B{ ++ using namespace Y; ++ } ++ } ++ ++ If SCOPE is "A::B" and SEARCH_PARENTS is true the imports of namespaces X ++ and Y will be considered. If SEARCH_PARENTS is false only the import of Y ++ is considered. */ ++ + struct symbol * +-cp_lookup_symbol_namespace (const char *namespace, +- const char *name, +- const char *linkage_name, +- const struct block *block, +- const domain_enum domain) +cp_lookup_symbol_imports (const char *scope, + const char *name, + const struct block *block, + const domain_enum domain, -+ int declaration_only) ++ int declaration_only, ++ int search_parents) { - const struct using_direct *current; +- const struct using_direct *current; - struct symbol *sym; ++ struct using_direct *current; + struct symbol *sym = NULL; ++ int directive_match; ++ int current_line; ++ ++ if(!declaration_only) ++ /* First, try to find the symbol in the given namespace. */ ++ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain); - /* First, go through the using directives. If any of them add new ++ if ( sym != NULL) ++ return sym; ++ ++ if (has_stack_frames ()) ++ current_line = find_pc_line (get_frame_pc (get_selected_frame (NULL)), ++ 0).line; ++ else ++ current_line = 0; ++ + /* Go through the using directives. If any of them add new names to the namespace we're searching in, see if we can find a match by applying them. */ -@@ -346,39 +410,65 @@ cp_lookup_symbol_namespace (const char *namespace, +@@ -346,39 +465,74 @@ cp_lookup_symbol_namespace (const char *namespace, current != NULL; current = current->next) { - if (strcmp (namespace, current->import_dest) == 0) -+ int current_line = find_pc_line (get_frame_pc (get_current_frame ()), 0).line; -+ ++ + /* If the import destination is the current scope or one of its ancestors then + it is applicable. */ -+ if (strncmp (scope, current->import_dest, strlen(current->import_dest)) == 0 && current->line_number < current_line ) ++ directive_match = search_parents ? ++ strncmp (scope, current->import_dest, ++ strlen(current->import_dest)) == 0 : ++ strcmp (scope, current->import_dest) == 0; ++ ++ if (directive_match && ++ current->line_number < current_line && ++ !current->searched) { - sym = cp_lookup_symbol_namespace (current->import_src, - name, - linkage_name, - block, - domain); -- if (sym != NULL) ++ current->searched = 1; + /* If there is an import of a single declaration, compare the imported + declaration with the sought out name. If there is a match pass + current->import_src as NAMESPACE to direct the search towards the @@ -1975,16 +3413,16 @@ index d2d8f2e..cc259e7 100644 + { + if (strcmp (name, current->declaration) == 0) + { -+ sym = cp_lookup_symbol_namespace (current->import_src, ++ sym = cp_lookup_symbol_in_namespace (current->import_src, + name, + block, -+ domain, -+ declaration_only); ++ domain); + } + } + + if (declaration_only) + { ++ current->searched = 0; + if (sym) + { + return sym; @@ -1998,24 +3436,27 @@ index d2d8f2e..cc259e7 100644 + sought name. Pass current->inner as the NAME to direct the + search towards the aliased namespace */ + { -+ sym = cp_lookup_symbol_namespace (scope, ++ sym = cp_lookup_symbol_in_namespace (scope, + current->import_src, + block, -+ domain, -+ declaration_only); ++ domain); + } else if (strcmp ("", current->alias) == 0){ + /* If this import statement creates no alias, pass current->inner as + NAMESPACE to direct the search towards the imported namespace. */ -+ sym = cp_lookup_symbol_namespace (current->import_src, ++ sym = cp_lookup_symbol_imports (current->import_src, + name, + block, + domain, -+ declaration_only); ++ 0, ++ 0); + } + -+ if (sym != NULL){ - return sym; -+ } ++ current->searched = 0; + if (sym != NULL) +- return sym; ++ { ++ return sym; ++ } } } @@ -2044,7 +3485,7 @@ index d2d8f2e..cc259e7 100644 } /* Look up NAME in BLOCK's static block and in global blocks. If -@@ -388,17 +478,15 @@ cp_lookup_symbol_namespace (const char *namespace, +@@ -388,17 +542,15 @@ cp_lookup_symbol_namespace (const char *namespace, static struct symbol * lookup_symbol_file (const char *name, @@ -2063,7 +3504,7 @@ index d2d8f2e..cc259e7 100644 if (anonymous_namespace) { /* Symbols defined in anonymous namespaces have external linkage -@@ -408,12 +496,11 @@ lookup_symbol_file (const char *name, +@@ -408,12 +560,11 @@ lookup_symbol_file (const char *name, const struct block *global_block = block_global_block (block); if (global_block != NULL) @@ -2078,7 +3519,7 @@ index d2d8f2e..cc259e7 100644 } if (sym != NULL) -@@ -434,6 +521,7 @@ lookup_symbol_file (const char *name, +@@ -434,6 +585,7 @@ lookup_symbol_file (const char *name, sym = lookup_possible_namespace_symbol (name); if (sym != NULL) return sym; @@ -2086,18 +3527,18 @@ index d2d8f2e..cc259e7 100644 } return NULL; -@@ -463,9 +551,8 @@ cp_lookup_nested_type (struct type *parent_type, +@@ -461,9 +613,8 @@ cp_lookup_nested_type (struct type *parent_type, + lookup_symbol_namespace works when looking them up. */ + const char *parent_name = TYPE_TAG_NAME (parent_type); - struct symbol *sym = cp_lookup_symbol_namespace (parent_name, +- struct symbol *sym = cp_lookup_symbol_namespace (parent_name, ++ struct symbol *sym = cp_lookup_symbol_in_namespace (parent_name, nested_name, - NULL, block, -- VAR_DOMAIN); -+ VAR_DOMAIN,0); + VAR_DOMAIN); if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF) - return NULL; - else -@@ -709,7 +796,7 @@ check_one_possible_namespace_symbol (const char *name, int len, +@@ -709,7 +860,7 @@ check_one_possible_namespace_symbol (const char *name, int len, memcpy (name_copy, name, len); name_copy[len] = '\0'; @@ -2106,7 +3547,7 @@ index d2d8f2e..cc259e7 100644 if (sym == NULL) { -@@ -749,7 +836,7 @@ lookup_possible_namespace_symbol (const char *name) +@@ -749,7 +900,7 @@ lookup_possible_namespace_symbol (const char *name) struct symbol *sym; sym = lookup_block_symbol (get_possible_namespace_block (objfile), @@ -2237,10 +3678,10 @@ index f12d785..ca10007 100644 _initialize_cp_support (void) { diff --git a/gdb/cp-support.h b/gdb/cp-support.h -index b5a5c5f..f126bed 100644 +index b5a5c5f..3f48f98 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h -@@ -38,14 +38,29 @@ struct demangle_component; +@@ -38,15 +38,33 @@ struct demangle_component; /* This struct is designed to store data from using directives. It says that names from namespace IMPORT_SRC should be visible within @@ -2271,9 +3712,13 @@ index b5a5c5f..f126bed 100644 + int line_number; + struct using_direct *next; ++ ++ /* Used during import search to temporarly mark this node as searced. */ ++ int searched; }; -@@ -54,6 +69,7 @@ struct using_direct + +@@ -54,6 +72,7 @@ struct using_direct extern char *cp_canonicalize_string (const char *string); @@ -2281,7 +3726,7 @@ index b5a5c5f..f126bed 100644 extern char *cp_class_name_from_physname (const char *physname); extern char *method_name_from_physname (const char *physname); -@@ -72,15 +88,23 @@ extern struct symbol **make_symbol_overload_list (const char *, +@@ -72,15 +91,23 @@ extern struct symbol **make_symbol_overload_list (const char *, extern struct type *cp_lookup_rtti_type (const char *name, struct block *block); @@ -2306,7 +3751,7 @@ index b5a5c5f..f126bed 100644 struct using_direct *next); extern void cp_initialize_namespace (void); -@@ -97,15 +121,32 @@ extern void cp_set_block_scope (const struct symbol *symbol, +@@ -97,15 +124,20 @@ extern void cp_set_block_scope (const struct symbol *symbol, extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol); extern struct symbol *cp_lookup_symbol_nonlocal (const char *name, @@ -2314,23 +3759,12 @@ index b5a5c5f..f126bed 100644 const struct block *block, const domain_enum domain); -+extern struct symbol *lookup_namespace_scope (const char *name, -+ const struct block *block, -+ const domain_enum domain, -+ const char *scope, -+ int scope_len, -+ int declaration_only); -+ -+extern struct symbol* cp_lookup_symbol_namespace_incremental (const char *scope, -+ const char *name, -+ const struct block *block, -+ const domain_enum domain); -+ +struct symbol *cp_lookup_symbol_imports (const char *scope, + const char *name, + const struct block *block, + const domain_enum domain, -+ int declaration_only); ++ int declaration_only, ++ int search_parents); + extern struct symbol *cp_lookup_symbol_namespace (const char *namespace, - const char *name, @@ -2339,8 +3773,7 @@ index b5a5c5f..f126bed 100644 - const domain_enum domain); + const char *name, + const struct block *block, -+ const domain_enum domain, -+ int declaration_only); ++ const domain_enum domain); extern struct type *cp_lookup_nested_type (struct type *parent_type, const char *nested_name, @@ -2357,10 +3790,10 @@ index 7cb016d..bb9e35a 100644 default_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 4016acc..1042303 100644 +index f16b6e2..fe328c7 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -958,8 +958,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. +@@ -959,8 +959,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. @itemx -x @var{file} @cindex @code{--command} @cindex @code{-x} @@ -2373,7 +3806,7 @@ index 4016acc..1042303 100644 @item -eval-command @var{command} @itemx -ex @var{command} -@@ -1151,6 +1153,16 @@ for remote debugging. +@@ -1152,6 +1154,16 @@ for remote debugging. Run using @var{device} for your program's standard input and output. @c FIXME: kingdon thinks there is more to -tty. Investigate. @@ -2390,7 +3823,7 @@ index 4016acc..1042303 100644 @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -@@ -18465,7 +18477,7 @@ command: +@@ -18650,7 +18662,7 @@ command: @table @code @kindex source @cindex execute commands from a file @@ -2399,7 +3832,7 @@ index 4016acc..1042303 100644 Execute the command file @var{filename}. @end table -@@ -18482,6 +18494,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays +@@ -18667,6 +18679,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays each command as it is executed. The option must be given before @var{filename}, and is interpreted as part of the filename anywhere else. @@ -2411,7 +3844,7 @@ index 4016acc..1042303 100644 Commands that would ask for confirmation if used interactively proceed without asking when used in a command file. Many @value{GDBN} commands that normally print messages to say what they are doing omit the messages -@@ -18743,8 +18760,6 @@ containing @code{end}. For example: +@@ -18928,8 +18945,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -2420,7 +3853,7 @@ index 4016acc..1042303 100644 >print 23 >end 23 -@@ -18757,6 +18772,14 @@ in a Python script. This can be controlled using @code{maint set +@@ -18942,6 +18957,14 @@ in a Python script. This can be controlled using @code{maint set python print-stack}: if @code{on}, the default, then Python stack printing is enabled; if @code{off}, then Python stack printing is disabled. @@ -2435,7 +3868,7 @@ index 4016acc..1042303 100644 @end table @node Python API -@@ -18764,6 +18787,14 @@ disabled. +@@ -18949,6 +18972,14 @@ disabled. @cindex python api @cindex programming in python @@ -2450,7 +3883,7 @@ index 4016acc..1042303 100644 @cindex python stdout @cindex python pagination At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -@@ -18776,13 +18807,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. +@@ -18961,13 +18992,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. * Basic Python:: Basic Python Functions. * Exception Handling:: * Auto-loading:: Automatically loading Python code. @@ -2469,7 +3902,7 @@ index 4016acc..1042303 100644 * Frames In Python:: Acessing inferior stack frames from Python. @end menu -@@ -18809,6 +18844,12 @@ command as having originated from the user invoking it interactively. +@@ -18994,6 +19029,12 @@ command as having originated from the user invoking it interactively. It must be a boolean value. If omitted, it defaults to @code{False}. @end defun @@ -2482,7 +3915,7 @@ index 4016acc..1042303 100644 @findex gdb.parameter @defun parameter parameter Return the value of a @value{GDBN} parameter. @var{parameter} is a -@@ -18825,6 +18866,7 @@ a Python value of the appropriate type, and returned. +@@ -19010,6 +19051,7 @@ a Python value of the appropriate type, and returned. @defun history number Return a value from @value{GDBN}'s value history (@pxref{Value History}). @var{number} indicates which history element to return. @@ -2490,7 +3923,7 @@ index 4016acc..1042303 100644 If @var{number} is negative, then @value{GDBN} will take its absolute value and count backward from the last element (i.e., the most recent element) to find the value to return. If @var{number} is zero, then @value{GDBN} will -@@ -18836,6 +18878,28 @@ If no exception is raised, the return value is always an instance of +@@ -19021,6 +19063,28 @@ If no exception is raised, the return value is always an instance of @code{gdb.Value} (@pxref{Values From Inferior}). @end defun @@ -2519,7 +3952,7 @@ index 4016acc..1042303 100644 @findex gdb.write @defun write string Print a string to @value{GDBN}'s paginated standard output stream. -@@ -18850,6 +18914,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing +@@ -19035,6 +19099,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing function. @end defun @@ -2531,7 +3964,7 @@ index 4016acc..1042303 100644 @node Exception Handling @subsubsection Exception Handling @cindex python exceptions -@@ -18986,6 +19055,13 @@ The type of this @code{gdb.Value}. The value of this attribute is a +@@ -19171,6 +19240,13 @@ The type of this @code{gdb.Value}. The value of this attribute is a The following methods are provided: @table @code @@ -2545,7 +3978,7 @@ index 4016acc..1042303 100644 @defmethod Value dereference For pointer data types, this method returns a new @code{gdb.Value} object whose contents is the object pointed to by the pointer. For example, if -@@ -19057,6 +19133,9 @@ module: +@@ -19242,6 +19318,9 @@ module: This function looks up a type by name. @var{name} is the name of the type to look up. It must be a string. @@ -2555,7 +3988,7 @@ index 4016acc..1042303 100644 Ordinarily, this function will return an instance of @code{gdb.Type}. If the named type cannot be found, it will throw an exception. @end defun -@@ -19109,6 +19188,12 @@ This is @code{True} if the field is artificial, usually meaning that +@@ -19294,6 +19373,12 @@ This is @code{True} if the field is artificial, usually meaning that it was provided by the compiler and not the user. This attribute is always provided, and is @code{False} if the field is not artificial. @@ -2568,7 +4001,7 @@ index 4016acc..1042303 100644 @item bitsize If the field is packed, or is a bitfield, then this will have a non-zero value, which is the size of the field in bits. Otherwise, -@@ -19161,7 +19246,7 @@ If the type does not have a target, this method will throw an +@@ -19346,7 +19431,7 @@ If the type does not have a target, this method will throw an exception. @end defmethod @@ -2577,7 +4010,7 @@ index 4016acc..1042303 100644 If this @code{gdb.Type} is an instantiation of a template, this will return a new @code{gdb.Type} which represents the type of the @var{n}th template argument. -@@ -19169,7 +19254,8 @@ return a new @code{gdb.Type} which represents the type of the +@@ -19354,7 +19439,8 @@ return a new @code{gdb.Type} which represents the type of the If this @code{gdb.Type} is not a template type, this will throw an exception. Ordinarily, only C@t{++} code will have template types. @@ -2587,7 +4020,7 @@ index 4016acc..1042303 100644 @end defmethod @end table -@@ -19523,6 +19609,121 @@ import gdb.libstdcxx.v6 +@@ -19708,6 +19794,121 @@ import gdb.libstdcxx.v6 gdb.libstdcxx.v6.register_printers (gdb.current_objfile ()) @end smallexample @@ -2709,7 +4142,7 @@ index 4016acc..1042303 100644 @node Commands In Python @subsubsection Commands In Python -@@ -19775,6 +19976,135 @@ registration of the command with @value{GDBN}. Depending on how the +@@ -19960,6 +20161,135 @@ registration of the command with @value{GDBN}. Depending on how the Python code is read into @value{GDBN}, you may need to import the @code{gdb} module explicitly. @@ -2845,7 +4278,7 @@ index 4016acc..1042303 100644 @node Functions In Python @subsubsection Writing new convenience functions -@@ -19879,6 +20209,82 @@ which is used to format the value. @xref{Pretty Printing}, for more +@@ -20064,6 +20394,82 @@ which is used to format the value. @xref{Pretty Printing}, for more information. @end defivar @@ -2928,7 +4361,7 @@ index 4016acc..1042303 100644 @node Frames In Python @subsubsection Acessing inferior stack frames from Python. -@@ -19943,6 +20349,14 @@ function to a string. +@@ -20128,6 +20534,14 @@ function to a string. Returns the frame's resume address. @end defmethod @@ -2943,7 +4376,7 @@ index 4016acc..1042303 100644 @defmethod Frame older Return the frame that called this frame. @end defmethod -@@ -19951,10 +20365,18 @@ Return the frame that called this frame. +@@ -20136,10 +20550,18 @@ Return the frame that called this frame. Return the frame called by this frame. @end defmethod @@ -2962,133 +4395,11 @@ index 4016acc..1042303 100644 @end table @node Interpreters -@@ -23306,6 +23728,8 @@ access this functionality: - @item @strong{Operation} - @tab @strong{Description} - -+@item @code{-enable-pretty-printing} -+@tab enable Python-based pretty-printing - @item @code{-var-create} - @tab create a variable object - @item @code{-var-delete} -@@ -23334,6 +23758,8 @@ access this functionality: - @tab update the variable and its children - @item @code{-var-set-frozen} - @tab set frozeness attribute -+@item @code{-var-set-update-range} -+@tab set range of children to display on update - @end multitable - - In the next subsection we describe each operation in detail and suggest -@@ -23341,6 +23767,23 @@ how it can be used. - - @subheading Description And Use of Operations on Variable Objects - -+@subheading The @code{-enable-pretty-printing} Command -+@findex -enable-pretty-printing -+ -+@smallexample -+-enable-pretty-printing -+@end smallexample -+ -+@var{GDBN} allows Python-based visualizers to affect the output of the -+MI variable object commands. However, because there was no way to -+implement this in a fully backward-compatible way, a front end must -+request that this functionality be enabled. -+ -+Once sent, this command cannot be undone. -+ -+Note that if Python support has not been compiled into @var{GDBN}, -+this command will still succeed. -+ - @subheading The @code{-var-create} Command - @findex -var-create - -@@ -23473,7 +23916,7 @@ Returns the number of children of a variable object @var{name}: - @subsubheading Synopsis - - @smallexample -- -var-list-children [@var{print-values}] @var{name} -+ -var-list-children [@var{print-values}] @var{name} [@var{from} @var{to}] - @end smallexample - @anchor{-var-list-children} - -@@ -23486,6 +23929,12 @@ values; and if it is 2 or @code{--simple-values} print the name and - value for simple data types and just the name for arrays, structures - and unions. - -+@var{from} and @var{to}, if specified, indicate the range of children -+to report. If @var{from} or @var{to} is less than zero, the range is -+reset and all children will be reported. Otherwise, children starting -+at @var{from} (zero-based) and ending just before @var{to} will be -+reported. -+ - For each child the following results are returned: - - @table @var -@@ -23519,6 +23968,14 @@ Otherwise this result is not present. - If the variable object is frozen, this variable will be present with a value of 1. - @end table - -+The result may have its own attributes: -+ -+@table @var -+@item has_more -+This is an integer attribute which is nonzero if there are children -+remaining after the end of the selected range. -+@end table -+ - @subsubheading Example - - @smallexample -@@ -23700,6 +24157,9 @@ With the @samp{*} parameter, if a variable object is bound to a - currently running thread, it will not be updated, without any - diagnostic. - -+If @code{-var-set-update-range} was previously used on a varobj, then -+only the selected range of children will be reported. -+ - @subsubheading Example - - @smallexample -@@ -23767,6 +24227,32 @@ Unfreezing a variable does not update it, only subsequent - (gdb) - @end smallexample - -+@subheading The @code{-var-set-update-range} command -+@findex -var-set-update-range -+@anchor{-var-set-update-range} -+ -+@subsubheading Synopsis -+ -+@smallexample -+ -var-set-update-range @var{name} @var{from} @var{to} -+@end smallexample -+ -+Set the range of children to be returned by future invocations of -+@code{-var-update}. -+ -+@var{from} and @var{to} indicate the range of children to report. If -+@var{from} or @var{to} is less than zero, the range is reset and all -+children will be reported. Otherwise, children starting at @var{from} -+(zero-based) and ending just before @var{to} will be reported. -+ -+@subsubheading Example -+ -+@smallexample -+(gdb) -+-var-set-update-range V 1 2 -+^done -+@end smallexample -+ - @subheading The @code{-var-set-visualizer} command - @findex -var-set-visualizer - @anchor{-var-set-visualizer} diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index b1c0452..da24b98 100644 +index c2be3f7..a7811ab 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo -@@ -2106,6 +2106,18 @@ time, and so we attempt to handle symbols incrementally. For instance, +@@ -2114,6 +2114,18 @@ time, and so we attempt to handle symbols incrementally. For instance, we create @dfn{partial symbol tables} consisting of only selected symbols, and only expand them to full symbol tables when necessary. @@ -3107,7 +4418,7 @@ index b1c0452..da24b98 100644 @section Symbol Reading @cindex symbol reading -@@ -2198,6 +2210,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and +@@ -2206,6 +2218,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and zero if there were no symbols in that part of the symbol file. @end table @@ -3115,7 +4426,7 @@ index b1c0452..da24b98 100644 @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2293,6 +2306,7 @@ and all the psymbols themselves are allocated in a pair of large arrays +@@ -2301,6 +2314,7 @@ and all the psymbols themselves are allocated in a pair of large arrays on an obstack, so there is little to be gained by trying to free them unless you want to do a lot more work. @@ -3123,7 +4434,7 @@ index b1c0452..da24b98 100644 @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2315,6 +2329,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by +@@ -2323,6 +2337,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by other members of the type struct, such as whether the type is signed or unsigned, and how many bits it uses. @@ -3131,7 +4442,7 @@ index b1c0452..da24b98 100644 @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2329,6 +2344,7 @@ only one instance exists, while @file{c-lang.c} builds as many +@@ -2337,6 +2352,7 @@ only one instance exists, while @file{c-lang.c} builds as many @code{TYPE_CODE_INT} types as needed, with each one associated with some particular objfile. @@ -3139,7 +4450,7 @@ index b1c0452..da24b98 100644 @section Object File Formats @cindex object file formats -@@ -2414,6 +2430,7 @@ SOM, which is a cross-language ABI). +@@ -2422,6 +2438,7 @@ SOM, which is a cross-language ABI). The SOM reader is in @file{somread.c}. @@ -3147,7 +4458,7 @@ index b1c0452..da24b98 100644 @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2485,6 +2502,7 @@ DWARF 3 is an improved version of DWARF 2. +@@ -2493,6 +2510,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -3155,7 +4466,7 @@ index b1c0452..da24b98 100644 @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2507,6 +2525,7 @@ will only ever be implemented by one object file format may be called +@@ -2515,6 +2533,7 @@ will only ever be implemented by one object file format may be called directly. This interface should be described in a file @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. @@ -3163,7 +4474,7 @@ index b1c0452..da24b98 100644 @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2518,10 +2537,45 @@ released when the objfile is unloaded or reloaded. Therefore one +@@ -2526,10 +2545,45 @@ released when the objfile is unloaded or reloaded. Therefore one objfile must not reference symbol or type data from another objfile; they could be unloaded at different times. @@ -3214,26 +4525,10 @@ index b1c0452..da24b98 100644 @node Language Support diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi -index 4984f31..4bbbe4e 100644 +index 4984f31..fcf1b5d 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi -@@ -130,6 +130,15 @@ Called with @var{objfile} equal to @code{NULL} to indicate - previously loaded symbol table data has now been invalidated. - @end deftypefun - -+@deftypefun void objfile_unloading (struct objfile *@var{objfile}) -+The file specified by @var{objfile} is going to be removed from @value{GDBN}. -+@end deftypefun -+ -+@deftypefun void objfile_unloaded (void) -+Removal of @var{objfile} started by @code{objfile_unloading} finished and -+@var{objfile} is no longer known to @value{GDBN}. -+@end deftypefun -+ - @deftypefun void new_thread (struct thread_info *@var{t}) - The thread specified by @var{t} has been created. - @end deftypefun -@@ -206,6 +215,11 @@ Either @value{GDBN} detached from the inferior, or the inferior +@@ -206,6 +206,11 @@ Either @value{GDBN} detached from the inferior, or the inferior exited. The argument @var{pid} identifies the inferior. @end deftypefun @@ -3246,7 +4541,7 @@ index 4984f31..4bbbe4e 100644 This observer is used for internal testing. Do not use. See testsuite/gdb.gdb/observer.exp. diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c -index 0f6da40..fc70309 100644 +index 668c434..c29c3a5 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -38,6 +38,7 @@ @@ -3257,68 +4552,7 @@ index 0f6da40..fc70309 100644 struct comp_unit; -@@ -310,6 +311,13 @@ no_get_frame_base (void *baton, gdb_byte **start, size_t *length) - } - - static CORE_ADDR -+no_get_frame_cfa (void *baton) -+{ -+ internal_error (__FILE__, __LINE__, -+ _("Support for DW_OP_call_frame_cfa is unimplemented")); -+} -+ -+static CORE_ADDR - no_get_tls_address (void *baton, CORE_ADDR offset) - { - internal_error (__FILE__, __LINE__, -@@ -352,24 +360,29 @@ execute_stack_op (gdb_byte *exp, ULONGEST len, int addr_size, - { - struct dwarf_expr_context *ctx; - CORE_ADDR result; -+ struct cleanup *old_chain; - - ctx = new_dwarf_expr_context (); -+ old_chain = make_cleanup_free_dwarf_expr_context (ctx); -+ - ctx->gdbarch = get_frame_arch (this_frame); - ctx->addr_size = addr_size; - ctx->baton = this_frame; - ctx->read_reg = read_reg; - ctx->read_mem = read_mem; - ctx->get_frame_base = no_get_frame_base; -+ ctx->get_frame_cfa = no_get_frame_cfa; - ctx->get_tls_address = no_get_tls_address; - - dwarf_expr_push (ctx, initial); - dwarf_expr_eval (ctx, exp, len); - result = dwarf_expr_fetch (ctx, 0); - -- if (ctx->in_reg) -+ if (ctx->location == DWARF_VALUE_REGISTER) - result = read_reg (this_frame, result); -+ /* FIXME */ - -- free_dwarf_expr_context (ctx); -+ do_cleanups (old_chain); - - return result; - } -@@ -1247,6 +1260,14 @@ dwarf2_frame_base_sniffer (struct frame_info *this_frame) - - return NULL; - } -+ -+CORE_ADDR -+dwarf2_frame_cfa (struct frame_info *this_frame) -+{ -+ if (! frame_unwinder_is (this_frame, &dwarf2_frame_unwind)) -+ error (_("can't compute CFA for this frame")); -+ return get_frame_base (this_frame); -+} - - const struct objfile_data *dwarf2_frame_objfile_data; - -@@ -1536,6 +1557,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) +@@ -1574,6 +1575,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) CORE_ADDR offset; CORE_ADDR seek_pc; @@ -3333,195 +4567,11 @@ index 0f6da40..fc70309 100644 fde_table = objfile_data (objfile, dwarf2_frame_objfile_data); if (fde_table == NULL) continue; -diff --git a/gdb/dwarf2-frame.h b/gdb/dwarf2-frame.h -index b203661..dd03d59 100644 ---- a/gdb/dwarf2-frame.h -+++ b/gdb/dwarf2-frame.h -@@ -118,4 +118,8 @@ extern const struct frame_base * - - void dwarf2_frame_build_info (struct objfile *objfile); - -+/* Compute the DWARF CFA for a frame. */ -+ -+CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame); -+ - #endif /* dwarf2-frame.h */ diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 8dbf976..228eae7 100644 +index 46bc9d7..e675575 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c -@@ -61,6 +61,22 @@ free_dwarf_expr_context (struct dwarf_expr_context *ctx) - xfree (ctx); - } - -+/* Helper for make_cleanup_free_dwarf_expr_context. */ -+ -+static void -+free_dwarf_expr_context_cleanup (void *arg) -+{ -+ free_dwarf_expr_context (arg); -+} -+ -+/* Return a cleanup that calls free_dwarf_expr_context. */ -+ -+struct cleanup * -+make_cleanup_free_dwarf_expr_context (struct dwarf_expr_context *ctx) -+{ -+ return make_cleanup (free_dwarf_expr_context_cleanup, ctx); -+} -+ - /* Expand the memory allocated to CTX's stack to contain at least - NEED more elements than are currently used. */ - -@@ -109,8 +125,7 @@ dwarf_expr_fetch (struct dwarf_expr_context *ctx, int n) - - /* Add a new piece to CTX's piece list. */ - static void --add_piece (struct dwarf_expr_context *ctx, -- int in_reg, CORE_ADDR value, ULONGEST size) -+add_piece (struct dwarf_expr_context *ctx, ULONGEST size) - { - struct dwarf_expr_piece *p; - -@@ -125,9 +140,15 @@ add_piece (struct dwarf_expr_context *ctx, - * sizeof (struct dwarf_expr_piece)); - - p = &ctx->pieces[ctx->num_pieces - 1]; -- p->in_reg = in_reg; -- p->value = value; -+ p->location = ctx->location; - p->size = size; -+ if (p->location == DWARF_VALUE_LITERAL) -+ { -+ p->v.literal.data = ctx->data; -+ p->v.literal.length = ctx->len; -+ } -+ else -+ p->v.value = dwarf_expr_fetch (ctx, 0); - } - - /* Evaluate the expression at ADDR (LEN bytes long) using the context -@@ -271,6 +292,21 @@ signed_address_type (struct gdbarch *gdbarch, int addr_size) - } - } - -+ -+/* Check that the current operator is either at the end of an -+ expression, or that it is followed by a composition operator. */ -+ -+static void -+require_composition (gdb_byte *op_ptr, gdb_byte *op_end, const char *op_name) -+{ -+ /* FIXME: DW_OP_GNU_uninit? */ -+ if (op_ptr != op_end && *op_ptr != DW_OP_piece && *op_ptr != DW_OP_bit_piece) -+ error (_("DWARF-2 expression error: `%s' operations must be " -+ "used either alone or in conjuction with DW_OP_piece " -+ "or DW_OP_bit_piece."), -+ op_name); -+} -+ - /* The engine for the expression evaluator. Using the context in CTX, - evaluate the expression between OP_PTR and OP_END. */ - -@@ -279,8 +315,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, - gdb_byte *op_ptr, gdb_byte *op_end) - { - enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch); -- -- ctx->in_reg = 0; -+ ctx->location = DWARF_VALUE_MEMORY; - ctx->initialized = 1; /* Default is initialized. */ - - if (ctx->recursion_depth > ctx->max_recursion_depth) -@@ -420,20 +455,36 @@ execute_stack_op (struct dwarf_expr_context *ctx, - "used either alone or in conjuction with DW_OP_piece.")); - - result = op - DW_OP_reg0; -- ctx->in_reg = 1; -- -+ ctx->location = DWARF_VALUE_REGISTER; - break; - - case DW_OP_regx: - op_ptr = read_uleb128 (op_ptr, op_end, ®); -- if (op_ptr != op_end && *op_ptr != DW_OP_piece) -- error (_("DWARF-2 expression error: DW_OP_reg operations must be " -- "used either alone or in conjuction with DW_OP_piece.")); -+ require_composition (op_ptr, op_end, "DW_OP_regx"); - - result = reg; -- ctx->in_reg = 1; -+ ctx->location = DWARF_VALUE_REGISTER; - break; - -+ case DW_OP_implicit_value: -+ { -+ ULONGEST len; -+ op_ptr = read_uleb128 (op_ptr, op_end, &len); -+ if (op_ptr + len >= op_end) -+ error (_("DW_OP_implicit_value: too few bytes available.")); -+ ctx->len = len; -+ ctx->data = op_ptr; -+ ctx->location = DWARF_VALUE_LITERAL; -+ op_ptr += len; -+ require_composition (op_ptr, op_end, "DW_OP_implicit_value"); -+ } -+ goto no_push; -+ -+ case DW_OP_stack_value: -+ ctx->location = DWARF_VALUE_STACK; -+ require_composition (op_ptr, op_end, "DW_OP_stack_value"); -+ goto no_push; -+ - case DW_OP_breg0: - case DW_OP_breg1: - case DW_OP_breg2: -@@ -498,11 +549,12 @@ execute_stack_op (struct dwarf_expr_context *ctx, - (ctx->get_frame_base) (ctx->baton, &datastart, &datalen); - dwarf_expr_eval (ctx, datastart, datalen); - result = dwarf_expr_fetch (ctx, 0); -- if (ctx->in_reg) -+ if (ctx->location == DWARF_VALUE_REGISTER) - result = (ctx->read_reg) (ctx->baton, result); -+ /* FIXME: other DWARF_VALUE_*?? */ - result = result + offset; - ctx->stack_len = before_stack_len; -- ctx->in_reg = 0; -+ ctx->location = DWARF_VALUE_MEMORY; - } - break; - case DW_OP_dup: -@@ -700,6 +752,10 @@ execute_stack_op (struct dwarf_expr_context *ctx, - } - break; - -+ case DW_OP_call_frame_cfa: -+ result = (ctx->get_frame_cfa) (ctx->baton); -+ break; -+ - case DW_OP_GNU_push_tls_address: - /* Variable is at a constant offset in the thread-local - storage block into the objfile for the current thread and -@@ -738,12 +794,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, - - /* Record the piece. */ - op_ptr = read_uleb128 (op_ptr, op_end, &size); -- addr_or_regnum = dwarf_expr_fetch (ctx, 0); -- add_piece (ctx, ctx->in_reg, addr_or_regnum, size); -+ add_piece (ctx, size); - -- /* Pop off the address/regnum, and clear the in_reg flag. */ -- dwarf_expr_pop (ctx); -- ctx->in_reg = 0; -+ /* Pop off the address/regnum, and reset the location -+ type. */ -+ if (ctx->location != DWARF_VALUE_LITERAL) -+ dwarf_expr_pop (ctx); -+ ctx->location = DWARF_VALUE_MEMORY; - } - goto no_push; - -@@ -755,6 +812,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, +@@ -848,6 +848,13 @@ execute_stack_op (struct dwarf_expr_context *ctx, ctx->initialized = 0; goto no_push; @@ -3536,40 +4586,10 @@ index 8dbf976..228eae7 100644 error (_("Unhandled dwarf expression opcode 0x%x"), op); } diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 7047922..597c2de 100644 +index a9a8a05..d449012 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h -@@ -23,6 +23,19 @@ - #if !defined (DWARF2EXPR_H) - #define DWARF2EXPR_H - -+/* The location of a value. */ -+enum dwarf_value_location -+{ -+ /* The piece is in memory. */ -+ DWARF_VALUE_MEMORY, -+ /* The piece is in a register. */ -+ DWARF_VALUE_REGISTER, -+ /* The piece is on the stack. */ -+ DWARF_VALUE_STACK, -+ /* The piece is a literal. */ -+ DWARF_VALUE_LITERAL -+}; -+ - /* The expression evaluator works with a dwarf_expr_context, describing - its current state and its callbacks. */ - struct dwarf_expr_context -@@ -55,6 +68,9 @@ struct dwarf_expr_context - expression evaluation is complete. */ - void (*get_frame_base) (void *baton, gdb_byte **start, size_t *length); - -+ /* Return the CFA for the frame. */ -+ CORE_ADDR (*get_frame_cfa) (void *baton); -+ - /* Return the thread-local storage address for - DW_OP_GNU_push_tls_address. */ - CORE_ADDR (*get_tls_address) (void *baton, CORE_ADDR offset); -@@ -67,19 +83,23 @@ struct dwarf_expr_context +@@ -102,10 +102,10 @@ struct dwarf_expr_context The result must be live until the current expression evaluation is complete. */ unsigned char *(*get_subr) (void *baton, off_t offset, size_t *length); @@ -3581,105 +4601,11 @@ index 7047922..597c2de 100644 /* The current depth of dwarf expression recursion, via DW_OP_call*, DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum - depth we'll tolerate before raising an error. */ - int recursion_depth, max_recursion_depth; - -- /* Non-zero if the result is in a register. The register number -- will be on the expression stack. */ -- int in_reg; -+ /* Location of the value. */ -+ enum dwarf_value_location location; -+ -+ /* For VALUE_LITERAL, a the current literal value's length and -+ data. */ -+ ULONGEST len; -+ gdb_byte *data; - - /* Initialization status of variable: Non-zero if variable has been - initialized; zero otherwise. */ -@@ -90,9 +110,9 @@ struct dwarf_expr_context - - Each time DW_OP_piece is executed, we add a new element to the - end of this array, recording the current top of the stack, the -- current in_reg flag, and the size given as the operand to -- DW_OP_piece. We then pop the top value from the stack, clear the -- in_reg flag, and resume evaluation. -+ current location, and the size given as the operand to -+ DW_OP_piece. We then pop the top value from the stack, rest the -+ location, and resume evaluation. - - The Dwarf spec doesn't say whether DW_OP_piece pops the top value - from the stack. We do, ensuring that clients of this interface -@@ -103,12 +123,11 @@ struct dwarf_expr_context - - If an expression never uses DW_OP_piece, num_pieces will be zero. - (It would be nice to present these cases as expressions yielding -- a single piece, with in_reg clear, so that callers need not -- distinguish between the no-DW_OP_piece and one-DW_OP_piece cases. -- But expressions with no DW_OP_piece operations have no value to -- place in a piece's 'size' field; the size comes from the -- surrounding data. So the two cases need to be handled -- separately.) */ -+ a single piece, so that callers need not distinguish between the -+ no-DW_OP_piece and one-DW_OP_piece cases. But expressions with -+ no DW_OP_piece operations have no value to place in a piece's -+ 'size' field; the size comes from the surrounding data. So the -+ two cases need to be handled separately.) */ - int num_pieces; - struct dwarf_expr_piece *pieces; - }; -@@ -117,13 +136,22 @@ struct dwarf_expr_context - /* A piece of an object, as recorded by DW_OP_piece. */ - struct dwarf_expr_piece - { -- /* If IN_REG is zero, then the piece is in memory, and VALUE is its address. -- If IN_REG is non-zero, then the piece is in a register, and VALUE -- is the register number. */ -- int in_reg; -- -- /* This piece's address or register number. */ -- CORE_ADDR value; -+ enum dwarf_value_location location; -+ -+ union -+ { -+ /* This piece's address or register number. */ -+ CORE_ADDR value; -+ -+ struct -+ { -+ /* A pointer to the data making up this piece, for literal -+ pieces. */ -+ gdb_byte *data; -+ /* The length of the available data. */ -+ ULONGEST length; -+ } literal; -+ } v; - - /* The length of the piece, in bytes. */ - ULONGEST size; -@@ -131,6 +159,8 @@ struct dwarf_expr_piece - - struct dwarf_expr_context *new_dwarf_expr_context (void); - void free_dwarf_expr_context (struct dwarf_expr_context *ctx); -+struct cleanup * -+ make_cleanup_free_dwarf_expr_context (struct dwarf_expr_context *ctx); - - void dwarf_expr_push (struct dwarf_expr_context *ctx, CORE_ADDR value); - void dwarf_expr_pop (struct dwarf_expr_context *ctx); diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index 071b5ac..7b2e488 100644 +index 3a81202..85f4487 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -36,6 +36,7 @@ - #include "dwarf2.h" - #include "dwarf2expr.h" - #include "dwarf2loc.h" -+#include "dwarf2-frame.h" - - #include "gdb_string.h" - #include "gdb_assert.h" -@@ -115,6 +116,9 @@ struct dwarf_expr_baton +@@ -116,6 +116,9 @@ struct dwarf_expr_baton { struct frame_info *frame; struct objfile *objfile; @@ -3689,7 +4615,7 @@ index 071b5ac..7b2e488 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -176,22 +180,40 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length) +@@ -177,22 +180,33 @@ dwarf_expr_frame_base (void *baton, gdb_byte **start, size_t * length) *start = find_location_expression (symbaton, length, get_frame_address_in_block (frame)); } @@ -3709,7 +4635,7 @@ index 071b5ac..7b2e488 100644 + gdb_assert (symbaton != NULL); + *start = symbaton->data; + *length = symbaton->size; -+ } + } + else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_missing_funcs) + { + struct dwarf2_locexpr_baton *symbaton; @@ -3718,7 +4644,7 @@ index 071b5ac..7b2e488 100644 + gdb_assert (symbaton == NULL); + *start = NULL; + *length = 0; /* unused */ - } ++ } + else + internal_error (__FILE__, __LINE__, + _("Unsupported SYMBOL_COMPUTED_OPS %p for \"%s\""), @@ -3729,17 +4655,10 @@ index 071b5ac..7b2e488 100644 error (_("Could not find the frame base for \"%s\"."), - SYMBOL_NATURAL_NAME (framefunc)); + SYMBOL_PRINT_NAME (framefunc)); -+} -+ -+static CORE_ADDR -+dwarf_expr_frame_cfa (void *baton) -+{ -+ struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton; -+ return dwarf2_frame_cfa (debaton->frame); } - /* Using the objfile specified in BATON, find the address for the -@@ -204,6 +226,118 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) + /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for +@@ -215,6 +229,129 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) return target_translate_tls_address (debaton->objfile, offset); } @@ -3813,6 +4732,8 @@ index 071b5ac..7b2e488 100644 + baton.object_address = object_address; + + ctx = new_dwarf_expr_context (); ++ make_cleanup_free_dwarf_expr_context (ctx); ++ + ctx->gdbarch = get_objfile_arch (baton.objfile); + ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); + ctx->baton = &baton; @@ -3823,8 +4744,6 @@ index 071b5ac..7b2e488 100644 + ctx->get_tls_address = dwarf_expr_tls_address; + ctx->get_object_address = dwarf_expr_object_address; + -+ make_cleanup ((make_cleanup_ftype *) free_dwarf_expr_context, ctx); -+ + dwarf_expr_eval (ctx, data, size); + + /* It was used only during dwarf_expr_eval. */ @@ -3850,25 +4769,37 @@ index 071b5ac..7b2e488 100644 + + retval = dwarf_expr_fetch (ctx, 0); + ++ if (ctx->location == DWARF_VALUE_REGISTER) ++ { ++ /* Inlined dwarf_expr_read_reg as we no longer have the baton. */ ++ ++ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (ctx->gdbarch, retval); ++ struct type *type = builtin_type (ctx->gdbarch)->builtin_data_ptr; ++ struct frame_info *frame = get_selected_frame (NULL); ++ ++ retval = address_from_register (type, gdb_regnum, frame); ++ } ++ + do_cleanups (back_to); + + return retval; +} + - /* Evaluate a location description, starting at DATA and with length - SIZE, to find the current location of variable VAR in the context - of FRAME. */ -@@ -213,8 +347,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, + struct piece_closure + { + /* The number of pieces used to describe this variable. */ +@@ -382,9 +519,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, struct dwarf2_per_cu_data *per_cu) { struct value *retval; - struct dwarf_expr_baton baton; struct dwarf_expr_context *ctx; -+ struct cleanup *back_to = make_cleanup (null_cleanup, 0); +- struct cleanup *old_chain; ++ struct cleanup *old_chain = make_cleanup (null_cleanup, 0); if (size == 0) { -@@ -224,19 +358,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, +@@ -394,22 +530,8 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, return retval; } @@ -3877,221 +4808,34 @@ index 071b5ac..7b2e488 100644 + ctx = dwarf_expr_prep_ctx (frame, data, size, per_cu); - ctx = new_dwarf_expr_context (); +- old_chain = make_cleanup_free_dwarf_expr_context (ctx); +- - ctx->gdbarch = get_objfile_arch (baton.objfile); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); - ctx->baton = &baton; - ctx->read_reg = dwarf_expr_read_reg; - ctx->read_mem = dwarf_expr_read_mem; - ctx->get_frame_base = dwarf_expr_frame_base; +- ctx->get_frame_cfa = dwarf_expr_frame_cfa; - ctx->get_tls_address = dwarf_expr_tls_address; - - dwarf_expr_eval (ctx, data, size); if (ctx->num_pieces > 0) { - int i; -@@ -248,41 +371,120 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, - for (i = 0; i < ctx->num_pieces; i++) - { - struct dwarf_expr_piece *p = &ctx->pieces[i]; -- if (p->in_reg) -- { -- struct gdbarch *arch = get_frame_arch (frame); -- bfd_byte regval[MAX_REGISTER_SIZE]; -- int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->value); -- get_frame_register (frame, gdb_regnum, regval); -- memcpy (contents + offset, regval, p->size); -- } -- else /* In memory? */ -+ switch (p->location) - { -- read_memory (p->value, contents + offset, p->size); -+ case DWARF_VALUE_REGISTER: -+ { -+ struct gdbarch *arch = get_frame_arch (frame); -+ bfd_byte regval[MAX_REGISTER_SIZE]; -+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, -+ p->v.value); -+ get_frame_register (frame, gdb_regnum, regval); -+ memcpy (contents + offset, regval, p->size); -+ } -+ break; -+ -+ case DWARF_VALUE_MEMORY: -+ read_memory (p->v.value, contents + offset, p->size); -+ break; -+ -+ case DWARF_VALUE_STACK: -+ { -+ gdb_byte bytes[sizeof (ULONGEST)]; -+ size_t n; -+ store_unsigned_integer (bytes, ctx->addr_size, -+ gdbarch_byte_order (ctx->gdbarch), -+ p->v.value); -+ n = p->size; -+ if (n > ctx->addr_size) -+ n = ctx->addr_size; -+ memcpy (contents + offset, bytes, n); -+ } -+ break; -+ -+ case DWARF_VALUE_LITERAL: -+ { -+ size_t n = p->size; -+ if (n > p->v.literal.length) -+ n = p->v.literal.length; -+ memcpy (contents + offset, p->v.literal.data, n); -+ } -+ break; -+ -+ default: -+ internal_error (__FILE__, __LINE__, _("invalid location type")); - } - offset += p->size; - } - } -- else if (ctx->in_reg) -- { -- struct gdbarch *arch = get_frame_arch (frame); -- CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0); -- int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum); -- retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame); -- } - else - { -- CORE_ADDR address = dwarf_expr_fetch (ctx, 0); -- -- retval = allocate_value (SYMBOL_TYPE (var)); -- VALUE_LVAL (retval) = lval_memory; -- set_value_lazy (retval, 1); -- set_value_address (retval, address); -+ switch (ctx->location) -+ { -+ case DWARF_VALUE_REGISTER: -+ { -+ struct gdbarch *arch = get_frame_arch (frame); -+ CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0); -+ int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum); -+ retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame); -+ } -+ break; -+ -+ case DWARF_VALUE_MEMORY: -+ { -+ CORE_ADDR address = dwarf_expr_fetch (ctx, 0); -+ + struct piece_closure *c; +@@ -439,6 +561,11 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, + CORE_ADDR address = dwarf_expr_fetch (ctx, 0); + int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); + + /* object_address_set called here is required in ALLOCATE_VALUE's + CHECK_TYPEDEF for the object's possible + DW_OP_push_object_address. */ + object_address_set (address); + -+ retval = allocate_value (SYMBOL_TYPE (var)); -+ VALUE_LVAL (retval) = lval_memory; -+ set_value_lazy (retval, 1); -+ set_value_address (retval, address); -+ } -+ break; -+ -+ case DWARF_VALUE_STACK: -+ { -+ gdb_byte bytes[sizeof (ULONGEST)]; -+ ULONGEST value = (ULONGEST) dwarf_expr_fetch (ctx, 0); -+ bfd_byte *contents; -+ size_t n = ctx->addr_size; -+ -+ store_unsigned_integer (bytes, ctx->addr_size, -+ gdbarch_byte_order (ctx->gdbarch), -+ value); -+ retval = allocate_value (SYMBOL_TYPE (var)); -+ contents = value_contents_raw (retval); -+ if (n > TYPE_LENGTH (SYMBOL_TYPE (var))) -+ n = TYPE_LENGTH (SYMBOL_TYPE (var)); -+ memcpy (contents, bytes, n); -+ } -+ break; -+ -+ case DWARF_VALUE_LITERAL: -+ { -+ bfd_byte *contents; -+ size_t n = ctx->len; -+ -+ retval = allocate_value (SYMBOL_TYPE (var)); -+ contents = value_contents_raw (retval); -+ if (n > TYPE_LENGTH (SYMBOL_TYPE (var))) -+ n = TYPE_LENGTH (SYMBOL_TYPE (var)); -+ memcpy (contents, ctx->data, n); -+ } -+ break; -+ -+ default: -+ internal_error (__FILE__, __LINE__, _("invalid location type")); -+ } - } - - set_value_initialized (retval, ctx->initialized); - -- free_dwarf_expr_context (ctx); -+ do_cleanups (back_to); - - return retval; - } -@@ -327,6 +529,15 @@ needs_frame_frame_base (void *baton, gdb_byte **start, size_t * length) - nf_baton->needs_frame = 1; - } - -+/* CFA accesses require a frame. */ -+static CORE_ADDR -+needs_frame_frame_cfa (void *baton) -+{ -+ struct needs_frame_baton *nf_baton = baton; -+ nf_baton->needs_frame = 1; -+ return 1; -+} -+ - /* Thread-local accesses do require a frame. */ - static CORE_ADDR - needs_frame_tls_address (void *baton, CORE_ADDR offset) -@@ -346,21 +557,25 @@ dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size, - struct needs_frame_baton baton; - struct dwarf_expr_context *ctx; - int in_reg; -+ struct cleanup *old_chain; - - baton.needs_frame = 0; - - ctx = new_dwarf_expr_context (); -+ old_chain = make_cleanup_free_dwarf_expr_context (ctx); -+ - ctx->gdbarch = get_objfile_arch (dwarf2_per_cu_objfile (per_cu)); - ctx->addr_size = dwarf2_per_cu_addr_size (per_cu); - ctx->baton = &baton; - ctx->read_reg = needs_frame_read_reg; - ctx->read_mem = needs_frame_read_mem; - ctx->get_frame_base = needs_frame_frame_base; -+ ctx->get_frame_cfa = needs_frame_frame_cfa; - ctx->get_tls_address = needs_frame_tls_address; - - dwarf_expr_eval (ctx, data, size); - -- in_reg = ctx->in_reg; -+ in_reg = ctx->location == DWARF_VALUE_REGISTER; - - if (ctx->num_pieces > 0) - { -@@ -369,11 +584,11 @@ dwarf2_loc_desc_needs_frame (gdb_byte *data, unsigned short size, - /* If the location has several pieces, and any of them are in - registers, then we will need a frame to fetch them from. */ - for (i = 0; i < ctx->num_pieces; i++) -- if (ctx->pieces[i].in_reg) -+ if (ctx->pieces[i].location == DWARF_VALUE_REGISTER) - in_reg = 1; - } - -- free_dwarf_expr_context (ctx); -+ do_cleanups (old_chain); - - return baton.needs_frame || in_reg; - } -@@ -601,7 +816,7 @@ static int + retval = allocate_value (SYMBOL_TYPE (var)); + VALUE_LVAL (retval) = lval_memory; + set_value_lazy (retval, 1); +@@ -815,7 +942,7 @@ static int loclist_describe_location (struct symbol *symbol, struct ui_file *stream) { /* FIXME: Could print the entire list of locations. */ @@ -4100,7 +4844,7 @@ index 071b5ac..7b2e488 100644 return 1; } -@@ -617,16 +832,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, +@@ -831,16 +958,56 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, data = find_location_expression (dlbaton, &size, ax->scope); if (data == NULL) @@ -4177,20 +4921,10 @@ index 0bfcfca..01018d6 100644 #endif /* dwarf2loc.h */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 445bab8..65556c9 100644 +index 4cce36b..d394887 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -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 -@@ -48,6 +47,11 @@ +@@ -48,6 +48,12 @@ #include "gdbcmd.h" #include "block.h" #include "addrmap.h" @@ -4199,10 +4933,11 @@ index 445bab8..65556c9 100644 +#include "jv-lang.h" +#include "typeprint.h" +#include "vec.h" ++#include "block.h" #include #include "gdb_string.h" -@@ -93,7 +97,7 @@ typedef struct pubnames_header +@@ -93,7 +99,7 @@ typedef struct pubnames_header _PUBNAMES_HEADER; #define _ACTUAL_PUBNAMES_HEADER_SIZE 13 @@ -4211,7 +4946,7 @@ index 445bab8..65556c9 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 -@@ -150,7 +154,10 @@ struct dwarf2_section_info +@@ -150,7 +156,10 @@ struct dwarf2_section_info asection *asection; gdb_byte *buffer; bfd_size_type size; @@ -4223,18 +4958,27 @@ index 445bab8..65556c9 100644 }; struct dwarf2_per_objfile -@@ -474,8 +481,8 @@ struct partial_die_info - /* DWARF-2 tag for this DIE. */ - ENUM_BITFIELD(dwarf_tag) tag : 16; +@@ -336,6 +345,19 @@ struct dwarf2_cu -- /* Language code associated with this DIE. This is only used -- for the compilation unit DIE. */ -+ /* Language code associated with this DIE. This is only used -+ for the compilation unit DIE. */ - unsigned int language : 8; + /* Field `ranges_offset' is filled in; flag as the value may be zero. */ + unsigned int has_ranges_offset : 1; ++ ++ /* Fields are valid according to the LANGUAGE field. */ ++ union ++ { ++ /* language_fortran */ ++ struct ++ { ++ /* Module names imported to the block being currently read in. */ ++ struct fortran_using *use; ++ } ++ fortran; ++ } ++ language_specific; + }; - /* Assorted flags describing the data found in this DIE. */ -@@ -495,8 +502,7 @@ struct partial_die_info + /* Persistent data held for a compilation unit, even when not +@@ -495,8 +517,7 @@ struct partial_die_info unsigned int has_byte_size : 1; /* The name of this DIE. Normally the value of DW_AT_name, but @@ -4244,7 +4988,7 @@ index 445bab8..65556c9 100644 char *name; char *dirname; -@@ -691,6 +697,11 @@ struct field_info +@@ -689,6 +710,11 @@ struct field_info int nfnfields; }; @@ -4256,7 +5000,7 @@ index 445bab8..65556c9 100644 /* One item on the queue of compilation units to read in full symbols for. */ struct dwarf2_queue_item -@@ -802,7 +813,10 @@ static void scan_partial_symbols (struct partial_die_info *, +@@ -800,7 +826,10 @@ static void scan_partial_symbols (struct partial_die_info *, static void add_partial_symbol (struct partial_die_info *, struct dwarf2_cu *); @@ -4268,7 +5012,7 @@ index 445bab8..65556c9 100644 static void add_partial_namespace (struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, -@@ -827,6 +841,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); +@@ -825,6 +854,10 @@ static void dwarf2_psymtab_to_symtab (struct partial_symtab *); static void psymtab_to_symtab_1 (struct partial_symtab *); @@ -4279,7 +5023,7 @@ index 445bab8..65556c9 100644 static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu); static void dwarf2_free_abbrev_table (void *); -@@ -947,8 +965,13 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *); +@@ -945,8 +978,13 @@ static struct type *tag_type_to_type (struct die_info *, struct dwarf2_cu *); static struct type *read_type_die (struct die_info *, struct dwarf2_cu *); @@ -4293,7 +5037,7 @@ index 445bab8..65556c9 100644 static char *typename_concat (struct obstack *, const char *prefix, const char *suffix, -@@ -966,7 +989,8 @@ static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *, +@@ -964,7 +1002,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 *, @@ -4303,7 +5047,7 @@ index 445bab8..65556c9 100644 static void get_scope_pc_bounds (struct die_info *, CORE_ADDR *, CORE_ADDR *, -@@ -990,13 +1014,12 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *, +@@ -988,17 +1027,25 @@ static void dwarf2_attach_fn_fields_to_type (struct field_info *, static void process_structure_scope (struct die_info *, struct dwarf2_cu *); @@ -4319,17 +5063,39 @@ index 445bab8..65556c9 100644 static void read_module (struct die_info *die, struct dwarf2_cu *cu); static void read_import_statement (struct die_info *die, struct dwarf2_cu *); -@@ -1078,7 +1101,8 @@ static int is_ref_attr (struct attribute *); + ++static struct type *read_module_type (struct die_info *die, ++ struct dwarf2_cu *cu); ++ ++static void read_fortran_imported_module (struct die_info *die, ++ struct dwarf2_cu *cu); ++ ++static void read_fortran_imported_declaration (struct die_info *die, ++ struct dwarf2_cu *cu); ++ + static const char *namespace_name (struct die_info *die, + int *is_anonymous, struct dwarf2_cu *); + +@@ -1034,6 +1081,9 @@ static void process_die (struct die_info *, struct dwarf2_cu *); + + static char *dwarf2_linkage_name (struct die_info *, struct dwarf2_cu *); + ++static char *fortran_module_linkage_name (struct die_info *die, ++ struct dwarf2_cu *cu); ++ + static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *, + struct obstack *); + +@@ -1076,7 +1126,7 @@ static int is_ref_attr (struct attribute *); static unsigned int dwarf2_get_ref_die_offset (struct attribute *); -static int dwarf2_get_attr_constant_value (struct attribute *, int); -+static CORE_ADDR dwarf2_get_attr_constant_value (struct attribute *, CORE_ADDR, -+ struct dwarf2_cu *); ++static CORE_ADDR dwarf2_get_attr_constant_value (struct attribute *, CORE_ADDR); static struct die_info *follow_die_ref_or_sig (struct die_info *, struct attribute *, -@@ -1150,6 +1174,9 @@ static void age_cached_comp_units (void); +@@ -1148,6 +1198,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -4339,7 +5105,7 @@ index 445bab8..65556c9 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1169,22 +1196,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); +@@ -1167,22 +1220,31 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -4380,7 +5146,7 @@ index 445bab8..65556c9 100644 } /* When loading sections, we can either look for ".", or for -@@ -1277,10 +1313,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) +@@ -1275,10 +1337,13 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) } /* Decompress a section that was compressed using zlib. Store the @@ -4396,7 +5162,7 @@ index 445bab8..65556c9 100644 gdb_byte **outbuf, bfd_size_type *outsize) { bfd *abfd = objfile->obfd; -@@ -1297,6 +1336,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1295,6 +1360,7 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, z_stream strm; int rc; int header_size = 12; @@ -4404,7 +5170,7 @@ index 445bab8..65556c9 100644 if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 || bfd_bread (compressed_buffer, compressed_size, abfd) != compressed_size) -@@ -1326,8 +1366,13 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1324,8 +1390,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; @@ -4420,7 +5186,7 @@ index 445bab8..65556c9 100644 rc = inflateInit (&strm); while (strm.avail_in > 0) { -@@ -1348,26 +1393,136 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, +@@ -1346,26 +1417,176 @@ zlib_decompress_section (struct objfile *objfile, asection *sectp, error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), bfd_get_filename (abfd), rc); @@ -4476,9 +5242,28 @@ index 445bab8..65556c9 100644 + unsigned int bytes_read, segment_size, delta; + LONGEST info_offset; + struct dwarf2_cu cu; ++ char *end_ptr; + + cu_header.initial_length_size = 0; ++ end_ptr = aranges_ptr; + aranges_ptr = read_comp_unit_head (&cu_header, aranges_ptr, abfd); ++ end_ptr += cu_header.initial_length_size + cu_header.length; ++ ++ /* Sanity check. */ ++ if (end_ptr - aranges_ptr >= dwarf2_per_objfile->aranges.size) ++ { ++ do_cleanups (old); ++ complaint (&symfile_complaints, ++ _("aranges entry runs off end of `.debug_aranges' section, ignored")); ++ return; ++ } ++ if (cu_header.addr_size == 0) ++ { ++ do_cleanups (old); ++ complaint (&symfile_complaints, ++ _("aranges entry has zero addr_size, ignored")); ++ return; ++ } + + segment_size = read_1_byte (abfd, aranges_ptr); + aranges_ptr += 1; @@ -4505,9 +5290,30 @@ index 445bab8..65556c9 100644 + if (address == 0 && length == 0) + break; + ++ if (length == 0) ++ { ++ do_cleanups (old); ++ complaint (&symfile_complaints, ++ _("aranges entry has zero length, ignored")); ++ return; ++ } ++ + address += baseaddr; + -+ addrmap_set_empty (mutable_map, address, address + length, objfile); ++ addrmap_set_empty (mutable_map, address, address + length - 1, ++ objfile); ++ } ++ ++ /* Some older versions of GCC incorrectly started the arange ++ with a (0,0) pair. If we encounter any oddity while reading ++ the section, just abandon the attempt; falling back to the ++ slower code is always safe. */ ++ if (aranges_ptr != end_ptr) ++ { ++ do_cleanups (old); ++ complaint (&symfile_complaints, ++ _("aranges entry ends early, ignored")); ++ return; + } + } + @@ -4562,7 +5368,7 @@ index 445bab8..65556c9 100644 if (info->asection == NULL || info->size == 0) return; -@@ -1380,7 +1535,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1378,7 +1599,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) /* Upon decompression, update the buffer and its size. */ if (strncmp (header, "ZLIB", sizeof (header)) == 0) { @@ -4571,7 +5377,7 @@ index 445bab8..65556c9 100644 &info->size); return; } -@@ -1403,7 +1558,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1401,7 +1622,7 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) if (retbuf != MAP_FAILED) { @@ -4580,7 +5386,7 @@ index 445bab8..65556c9 100644 info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ; return; } -@@ -1411,8 +1566,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1409,8 +1630,15 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) #endif /* If we get here, we are a normal, not-compressed section. */ @@ -4598,7 +5404,7 @@ index 445bab8..65556c9 100644 /* When debugging .o files, we may need to apply relocations; see http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -@@ -1421,6 +1583,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1419,6 +1647,8 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) retbuf = symfile_relocate_debug_section (abfd, sectp, buf); if (retbuf != NULL) { @@ -4607,7 +5413,7 @@ index 445bab8..65556c9 100644 info->buffer = retbuf; return; } -@@ -1429,6 +1593,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) +@@ -1427,6 +1657,19 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) || bfd_bread (buf, info->size, abfd) != info->size) error (_("Dwarf Error: Can't read DWARF data from '%s'"), bfd_get_filename (abfd)); @@ -4627,20 +5433,7 @@ index 445bab8..65556c9 100644 } /* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and -@@ -1666,11 +1843,7 @@ 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, -@@ -1812,6 +1985,37 @@ lookup_signatured_type (struct objfile *objfile, ULONGEST sig) +@@ -1810,6 +2053,37 @@ lookup_signatured_type (struct objfile *objfile, ULONGEST sig) return entry; } @@ -4678,27 +5471,7 @@ index 445bab8..65556c9 100644 /* Subroutine of process_type_comp_unit and dwarf2_build_psymtabs_hard to combine the common parts. Process a compilation unit for a psymtab. -@@ -1878,7 +2082,7 @@ process_psymtab_comp_unit (struct objfile *objfile, - } - - /* Set the language we're debugging. */ -- set_cu_language (comp_unit_die.language, &cu); -+ set_cu_language (comp_unit_die.language, &cu); - - /* Allocate a new partial symbol table structure. */ - pst = start_psymtab_common (objfile, objfile->section_offsets, -@@ -1929,8 +2133,8 @@ process_psymtab_comp_unit (struct objfile *objfile, - } - 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. */ -+ /* Store the contiguous range; `DW_AT_ranges' range is stored above. The -+ range can be also empty for CUs with no code. */ - addrmap_set_empty (objfile->psymtabs_addrmap, - comp_unit_die.lowpc + baseaddr, - comp_unit_die.highpc + baseaddr - 1, pst); -@@ -2361,7 +2565,7 @@ partial_die_parent_scope (struct partial_die_info *pdi, +@@ -2359,7 +2633,7 @@ partial_die_parent_scope (struct partial_die_info *pdi, ignoring them. */ complaint (&symfile_complaints, _("unhandled containing DIE tag %d for DIE at %d"), @@ -4707,7 +5480,7 @@ index 445bab8..65556c9 100644 parent->scope = grandparent_scope; } -@@ -2376,12 +2580,22 @@ partial_die_full_name (struct partial_die_info *pdi, +@@ -2374,12 +2648,22 @@ partial_die_full_name (struct partial_die_info *pdi, struct dwarf2_cu *cu) { char *parent_scope; @@ -4734,7 +5507,7 @@ index 445bab8..65556c9 100644 } static void -@@ -2397,12 +2611,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) +@@ -2395,12 +2679,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -4750,7 +5523,20 @@ index 445bab8..65556c9 100644 if (actual_name == NULL) actual_name = pdi->name; -@@ -2534,22 +2745,6 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) +@@ -2491,6 +2772,12 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) + &objfile->global_psymbols, + 0, (CORE_ADDR) 0, cu->language, objfile); + break; ++ case DW_TAG_module: ++ add_psymbol_to_list (actual_name, strlen (actual_name), ++ MODULE_DOMAIN, LOC_STATIC, ++ &objfile->global_psymbols, ++ 0, (CORE_ADDR) 0, cu->language, objfile); ++ break; + case DW_TAG_class_type: + case DW_TAG_interface_type: + case DW_TAG_structure_type: +@@ -2532,22 +2819,6 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) break; } @@ -4773,7 +5559,7 @@ index 445bab8..65556c9 100644 if (built_actual_name) xfree (actual_name); } -@@ -2559,9 +2754,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) +@@ -2557,9 +2828,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) name listed in the die. */ static int @@ -4785,7 +5571,7 @@ index 445bab8..65556c9 100644 { case DW_TAG_namespace: case DW_TAG_typedef: -@@ -2571,7 +2766,23 @@ pdi_needs_namespace (enum dwarf_tag tag) +@@ -2569,7 +2840,23 @@ pdi_needs_namespace (enum dwarf_tag tag) case DW_TAG_union_type: case DW_TAG_enumeration_type: case DW_TAG_enumerator: @@ -4809,7 +5595,24 @@ index 445bab8..65556c9 100644 default: return 0; } -@@ -2700,27 +2911,6 @@ guess_structure_name (struct partial_die_info *struct_pdi, +@@ -2602,12 +2889,12 @@ static void + add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc, + CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu) + { +- /* Now scan partial symbols in that module. ++ /* Add a symbol for the module. */ + +- FIXME: Support the separate Fortran module namespaces. */ ++ add_partial_symbol (pdi, cu); + +- if (pdi->has_children) +- scan_partial_symbols (pdi->die_child, lowpc, highpc, need_pc, cu); ++ /* Partial symbols in that module are not scanned as they are never globally ++ visible. They get imported to the specific scopes on the full read. */ + } + + /* Read a partial die corresponding to a subprogram and create a partial +@@ -2698,27 +2985,6 @@ guess_structure_name (struct partial_die_info *struct_pdi, if (real_pdi->die_parent != NULL) return; @@ -4837,55 +5640,22 @@ index 445bab8..65556c9 100644 } } -@@ -3170,7 +3360,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)); -@@ -3180,30 +3369,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); -@@ -3234,6 +3400,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: -@@ -3312,42 +3479,69 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) +@@ -3295,6 +3561,14 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) + case DW_TAG_imported_declaration: + case DW_TAG_imported_module: + processing_has_namespace_info = 1; ++ if (cu->language == language_fortran) ++ { ++ if (die->tag == DW_TAG_imported_declaration) ++ read_fortran_imported_declaration (die, cu); ++ else ++ read_fortran_imported_module (die, cu); ++ break; ++ } + if (die->child != NULL && (die->tag == DW_TAG_imported_declaration + || cu->language != language_fortran)) + complaint (&symfile_complaints, _("Tag '%s' has unexpected children"), +@@ -3310,41 +3584,68 @@ process_die (struct die_info *die, struct dwarf2_cu *cu) /* Return the fully qualified name of DIE, based on its DW_AT_name. If scope qualifiers are appropriate they will be added. The result will be allocated on the objfile_obstack, or NULL if the DIE does @@ -4960,7 +5730,6 @@ index 445bab8..65556c9 100644 return name; } --/* Read the import statement specified by the given die and record it. */ +/* 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; @@ -4973,11 +5742,10 @@ index 445bab8..65556c9 100644 + return -1; +} + -+/* Read the import statement specified by the given die and record it. */ + /* 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) -@@ -3356,9 +3550,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) +@@ -3354,9 +3655,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) struct die_info *imported_die; const char *imported_name; const char *imported_name_prefix; @@ -4995,7 +5763,7 @@ index 445bab8..65556c9 100644 import_attr = dwarf2_attr (die, DW_AT_import, cu); if (import_attr == NULL) { -@@ -3406,29 +3606,45 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) +@@ -3404,17 +3711,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) return; } @@ -5014,12 +5782,8 @@ index 445bab8..65556c9 100644 + /* 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. */ -+ /* -+ Figure out what the scope of the imported die is and prepend it -+ to the name of the imported die -+ */ + /* 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 (strlen (imported_name_prefix) > 0) @@ -5033,11 +5797,7 @@ index 445bab8..65556c9 100644 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 -- { -+ }else{ +@@ -3425,8 +3742,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu) canonical_name = alloca (strlen (imported_name) + 1); strcpy (canonical_name, imported_name); } @@ -5054,16 +5814,7 @@ index 445bab8..65556c9 100644 } static void -@@ -3676,7 +3892,7 @@ unsigned_int_compar (const void *ap, const void *bp) - - return (a > b) - (b > a); - } -- -+ - /* DW_AT_abstract_origin inherits whole DIEs (not just their attributes). - Inherit only the children of the DW_AT_abstract_origin DIE not being already - referenced by DW_AT_abstract_origin from the children of the current DIE. */ -@@ -3697,6 +3913,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) +@@ -3695,6 +4018,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) struct attribute *attr; attr = dwarf2_attr (die, DW_AT_abstract_origin, cu); @@ -5078,7 +5829,7 @@ index 445bab8..65556c9 100644 if (!attr) return; -@@ -3795,6 +4019,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3793,6 +4124,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) char *name; CORE_ADDR baseaddr; struct block *block; @@ -5086,7 +5837,7 @@ index 445bab8..65556c9 100644 int inlined_func = (die->tag == DW_TAG_inlined_subroutine); if (inlined_func) -@@ -3813,13 +4038,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3811,13 +4143,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -5113,13 +5864,12 @@ index 445bab8..65556c9 100644 lowpc += baseaddr; highpc += baseaddr; -@@ -3846,14 +4081,12 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3844,14 +4186,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) cu->list_in_scope = &local_symbols; - if (die->child != NULL) -+ child_die = die->child; -+ while (child_die && child_die->tag) ++ switch (cu->language) { - child_die = die->child; - while (child_die && child_die->tag) @@ -5127,13 +5877,35 @@ index 445bab8..65556c9 100644 - process_die (child_die, cu); - child_die = sibling_die (child_die); - } ++ case language_fortran: ++ cu->language_specific.fortran.use = NULL; ++ break; ++ } ++ ++ child_die = die->child; ++ while (child_die && child_die->tag) ++ { + process_die (child_die, cu); + child_die = sibling_die (child_die); + die_children++; } inherit_abstract_dies (die, cu); -@@ -3905,7 +4138,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3867,6 +4214,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) + determine_prefix (die, cu), + processing_has_namespace_info); + ++ switch (cu->language) ++ { ++ case language_fortran: ++ BLOCK_FORTRAN_USE (block) = cu->language_specific.fortran.use; ++ break; ++ } ++ + /* If we have address ranges, record them. */ + dwarf2_record_block_ranges (die, block, baseaddr, cu); + +@@ -3903,7 +4257,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. */ @@ -5142,7 +5914,7 @@ index 445bab8..65556c9 100644 return; lowpc += baseaddr; highpc += baseaddr; -@@ -3922,7 +4155,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -3920,7 +4274,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) } new = pop_context (); @@ -5151,7 +5923,7 @@ index 445bab8..65556c9 100644 { struct block *block = finish_block (0, &local_symbols, new->old_blocks, new->start_addr, -@@ -4077,7 +4310,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, +@@ -4075,7 +4429,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, @@ -5161,7 +5933,7 @@ index 445bab8..65556c9 100644 { struct attribute *attr; CORE_ADDR low = 0; -@@ -4105,7 +4339,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, +@@ -4103,7 +4458,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. */ @@ -5170,7 +5942,7 @@ index 445bab8..65556c9 100644 return 0; /* Found discontinuous range of addresses. */ ret = -1; -@@ -4144,7 +4378,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die, +@@ -4142,7 +4497,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die, CORE_ADDR low, high; struct die_info *child = die->child; @@ -5179,7 +5951,7 @@ index 445bab8..65556c9 100644 { *lowpc = min (*lowpc, low); *highpc = max (*highpc, high); -@@ -4181,7 +4415,7 @@ get_scope_pc_bounds (struct die_info *die, +@@ -4179,7 +4534,7 @@ get_scope_pc_bounds (struct die_info *die, CORE_ADDR best_high = (CORE_ADDR) 0; CORE_ADDR current_low, current_high; @@ -5188,66 +5960,7 @@ index 445bab8..65556c9 100644 { best_low = current_low; best_high = current_high; -@@ -4384,21 +4618,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, - /* Get bit offset of field. */ - attr = dwarf2_attr (die, DW_AT_data_member_location, cu); - if (attr) -- { -- int byte_offset; -- -- if (attr_form_is_section_offset (attr)) -- { -- dwarf2_complex_location_expr_complaint (); -- byte_offset = 0; -- } -- else if (attr_form_is_constant (attr)) -- byte_offset = dwarf2_get_attr_constant_value (attr, 0); -- else -- byte_offset = decode_locdesc (DW_BLOCK (attr), cu); -- -- SET_FIELD_BITPOS (*fp, byte_offset * bits_per_byte); -- } -+ SET_FIELD_BITPOS (*fp, dwarf2_get_attr_constant_value (attr, 0, cu) -+ * bits_per_byte); - attr = dwarf2_attr (die, DW_AT_bit_offset, cu); - if (attr) - { -@@ -4476,7 +4697,11 @@ 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); - - /* The name is already allocated along with this objfile, so we don't -@@ -4490,7 +4715,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, - /* C++ base class field. */ - attr = dwarf2_attr (die, DW_AT_data_member_location, cu); - if (attr) -- SET_FIELD_BITPOS (*fp, decode_locdesc (DW_BLOCK (attr), cu) -+ SET_FIELD_BITPOS (*fp, dwarf2_get_attr_constant_value (attr, 0, cu) - * bits_per_byte); - FIELD_BITSIZE (*fp) = 0; - FIELD_TYPE (*fp) = die_type (die, cu); -@@ -4607,7 +4832,11 @@ 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); - - /* Look up member function name in fieldlist. */ -@@ -4652,7 +4881,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, +@@ -4661,7 +5016,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 : ""; @@ -5256,31 +5969,33 @@ index 445bab8..65556c9 100644 this_type = read_type_die (die, cu); if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC) { -@@ -4709,22 +4938,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, - /* Get index in virtual function table if it is a virtual member function. */ - attr = dwarf2_attr (die, DW_AT_vtable_elem_location, cu); - if (attr) -- { -- /* Support the .debug_loc offsets */ -- if (attr_form_is_block (attr)) +@@ -4721,18 +5076,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die, + { + /* Support the .debug_loc offsets */ + if (attr_form_is_block (attr)) - { - fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2; - } -- else if (attr_form_is_section_offset (attr)) ++ { ++ fnp->voffset = decode_locdesc (DW_BLOCK (attr), cu) + 2; ++ } + else if (attr_form_is_section_offset (attr)) - { -- dwarf2_complex_location_expr_complaint (); ++ { + dwarf2_complex_location_expr_complaint (); - } -- else ++ } + else - { -- dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location", -- fieldname); ++ { + dwarf2_invalid_attrib_class_complaint ("DW_AT_vtable_elem_location", + fieldname); - } -- } -+ fnp->voffset = dwarf2_get_attr_constant_value (attr, -2, cu) + 2; ++ } + } } - /* Create the vector of member function fields, and attach it to the type. */ -@@ -4836,7 +5050,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu) +@@ -4845,7 +5200,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)); @@ -5289,7 +6004,7 @@ index 445bab8..65556c9 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)); -@@ -4889,7 +5103,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4898,7 +5253,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) return set_die_type (die, type, cu); } @@ -5298,7 +6013,7 @@ index 445bab8..65556c9 100644 INIT_CPLUS_SPECIFIC (type); name = dwarf2_name (die, cu); -@@ -4898,14 +5112,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -4907,14 +5262,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) if (cu->language == language_cplus || cu->language == language_java) { @@ -5320,7 +6035,7 @@ index 445bab8..65556c9 100644 } } -@@ -5115,7 +5333,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5124,7 +5483,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) return set_die_type (die, type, cu); } @@ -5329,7 +6044,7 @@ index 445bab8..65556c9 100644 TYPE_CODE (type) = TYPE_CODE_ENUM; name = dwarf2_full_name (die, cu); -@@ -5143,51 +5361,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5152,51 +5511,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) return set_die_type (die, type, cu); } @@ -5381,7 +6096,7 @@ index 445bab8..65556c9 100644 /* Given a pointer to a die which begins an enumeration, process all the dies that define the members of the enumeration, and create the symbol for the enumeration type. -@@ -5265,6 +5438,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -5274,6 +5588,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -5411,7 +6126,7 @@ index 445bab8..65556c9 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. */ -@@ -5278,7 +5474,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5287,7 +5624,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; @@ -5420,7 +6135,7 @@ index 445bab8..65556c9 100644 struct cleanup *back_to; char *name; -@@ -5325,16 +5521,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5334,16 +5671,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) @@ -5442,7 +6157,7 @@ index 445bab8..65556c9 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -5401,49 +5592,83 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5410,12 +5742,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu) return set_die_type (die, set_type, cu); } @@ -5459,26 +6174,30 @@ index 445bab8..65556c9 100644 struct attribute *attr; struct symbol *sym; CORE_ADDR base = (CORE_ADDR) 0; - - attr = dwarf2_attr (die, DW_AT_location, cu); - if (attr) -- { -- /* Support the .debug_loc offsets */ -- if (attr_form_is_block (attr)) +@@ -5425,25 +5759,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) + { + /* Support the .debug_loc offsets */ + if (attr_form_is_block (attr)) - { - base = decode_locdesc (DW_BLOCK (attr), cu); - } -- else if (attr_form_is_section_offset (attr)) ++ { ++ base = decode_locdesc (DW_BLOCK (attr), cu); ++ } + else if (attr_form_is_section_offset (attr)) - { -- dwarf2_complex_location_expr_complaint (); ++ { + dwarf2_complex_location_expr_complaint (); - } -- else ++ } + else - { -- dwarf2_invalid_attrib_class_complaint ("DW_AT_location", -- "common block member"); ++ { + dwarf2_invalid_attrib_class_complaint ("DW_AT_location", + "common block member"); - } -- } -+ base = dwarf2_get_attr_constant_value (attr, 0, cu); ++ } + } if (die->child != NULL) { + struct objfile *objfile = cu->objfile; @@ -5518,9 +6237,8 @@ index 445bab8..65556c9 100644 attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); if (attr) { - SYMBOL_VALUE_ADDRESS (sym) = -- base + decode_locdesc (DW_BLOCK (attr), cu); -+ base + dwarf2_get_attr_constant_value (attr, 0, cu); +@@ -5461,8 +5825,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu) + SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset; add_symbol_to_list (sym, &global_symbols); } + @@ -5545,7 +6263,7 @@ index 445bab8..65556c9 100644 } } -@@ -5511,7 +5736,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) +@@ -5530,7 +5911,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) if (is_anonymous) { const char *previous_prefix = determine_prefix (die, cu); @@ -5554,7 +6272,166 @@ index 445bab8..65556c9 100644 } } -@@ -5705,29 +5930,93 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5546,20 +5927,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) + } + } + +-/* Read a Fortran module. */ ++/* Read a Fortran module as global symbol which can be later looked up by ++ f_lookup_symbol_nonlocal. */ + + static void + read_module (struct die_info *die, struct dwarf2_cu *cu) + { +- struct die_info *child_die = die->child; ++ struct type *type; ++ ++ type = read_module_type (die, cu); ++ ++ if (type) ++ new_symbol (die, type, cu); ++} ++ ++/* Read a Fortran module as type. ++ ++ Modules present only as declarations - being used only for DW_AT_import of ++ DW_TAG_imported_module - are ignored here. They are read in only in form of ++ the module name by read_fortran_imported_module. */ ++ ++static struct type * ++read_module_type (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ struct objfile *objfile = cu->objfile; ++ struct die_info *child_die; ++ struct type *type; ++ char *module_name; ++ struct context_stack *new; ++ struct pending *save_file_symbols; ++ struct pending *save_global_symbols; ++ struct pending **save_list_in_scope; ++ ++ if (die_is_declaration (die, cu)) ++ return NULL; ++ ++ module_name = dwarf2_name (die, cu); ++ if (!module_name) ++ complaint (&symfile_complaints, _("DW_TAG_module has no name, offset 0x%x"), ++ die->offset); ++ type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile); ++ ++ /* Create a context for reading the module variables. */ + +- /* FIXME: Support the separate Fortran module namespaces. */ ++ new = push_context (0, 0); + ++ save_file_symbols = file_symbols; ++ file_symbols = NULL; ++ save_global_symbols = global_symbols; ++ global_symbols = NULL; ++ save_list_in_scope = cu->list_in_scope; ++ ++ /* Process the child DIEs. */ ++ ++ child_die = die->child; + while (child_die && child_die->tag) + { ++ /* Any DW_TAG_subprogram will reset LIST_IN_SCOPE to LOCAL_SYMBOLS. */ ++ cu->list_in_scope = &global_symbols; ++ + process_die (child_die, cu); + child_die = sibling_die (child_die); + } ++ ++ /* Finish this module and restore the context. */ ++ ++ TYPE_MODULE_BLOCK (type) = finish_block (NULL, &global_symbols, ++ new->old_blocks, 0, 0, objfile); ++ ++ if (file_symbols) ++ complaint (&symfile_complaints, _("DW_TAG_module contains static symbols")); ++ if (local_symbols) ++ complaint (&symfile_complaints, _("DW_TAG_module contains local symbols")); ++ if (param_symbols) ++ complaint (&symfile_complaints, _("DW_TAG_module contains function " ++ "parameters")); ++ ++ file_symbols = save_file_symbols; ++ global_symbols = save_global_symbols; ++ cu->list_in_scope = save_list_in_scope; ++ ++ pop_context (); ++ ++ set_die_type (die, type, cu); ++ ++ return type; ++} ++ ++/* Import a Fortran module. Only store the module name for its later lookup by ++ f_lookup_symbol_nonlocal. */ ++ ++static void ++read_fortran_imported_module (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ struct objfile *objfile = cu->objfile; ++ struct attribute *attr; ++ struct die_info *module_die; ++ char *module_name; ++ struct fortran_using *use; ++ ++ attr = dwarf2_attr (die, DW_AT_import, cu); ++ if (attr == NULL) ++ return; ++ ++ module_die = follow_die_ref (die, attr, &cu); ++ module_name = dwarf2_name (module_die, cu); ++ if (module_name == NULL) ++ { ++ complaint (&symfile_complaints, ++ _("Imported DIE at offset 0x%x has no name"), die->offset); ++ return; ++ } ++ ++ /* Fortran does not allow any duplicity between local and any of the imported ++ symbols. Therefore the order of the USE statements is not portant. ++ gfortran prints: ++ Error: Name 'X' at (1) is an ambiguous reference to 'X' from module 'Y' */ ++ ++ use = obstack_alloc (&objfile->objfile_obstack, sizeof (*use) ++ + strlen (module_name)); ++ strcpy (use->module_name, module_name); ++ gdb_assert (cu->language == language_fortran); ++ use->next = cu->language_specific.fortran.use; ++ cu->language_specific.fortran.use = use; ++} ++ ++/* Import a single Fortran declaration and possibly rename it. */ ++ ++static void ++read_fortran_imported_declaration (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ struct attribute *attr; ++ struct die_info *imported_die; ++ struct symbol *sym; ++ char *rename = dwarf2_name (die, cu); ++ ++ attr = dwarf2_attr (die, DW_AT_import, cu); ++ if (attr == NULL) ++ { ++ complaint (&symfile_complaints, ++ _("Fortran DW_TAG_imported_declaration is missing " ++ "DW_AT_import at offset 0x%x"), die->offset); ++ return; ++ } ++ imported_die = follow_die_ref (die, attr, &cu); ++ ++ sym = new_symbol (imported_die, NULL, cu); ++ ++ if (sym && rename) ++ (sym)->ginfo.language_specific.cplus_specific.demangled_name = rename; + } + + /* Return the name of the namespace represented by DIE. Set +@@ -5724,29 +6240,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -5585,37 +6462,58 @@ index 445bab8..65556c9 100644 + its value. */ + else + { -+ struct dwarf2_locexpr_baton *length_baton; -+ struct attribute *size_attr; ++ struct dwarf2_locexpr_baton *length_baton = NULL; ++ struct dwarf_block *blk = DW_BLOCK (attr); + -+ length_baton = obstack_alloc (&cu->comp_unit_obstack, -+ sizeof (*length_baton)); -+ length_baton->per_cu = cu->per_cu; -+ length_baton->data = obstack_alloc (&cu->comp_unit_obstack, -+ DW_BLOCK (attr)->size + 2); -+ memcpy (length_baton->data, DW_BLOCK (attr)->data, -+ DW_BLOCK (attr)->size); ++ /* Turn any single DW_OP_reg* into DW_OP_breg*(0) but clearing ++ DW_OP_deref* in such case. */ + -+ /* DW_AT_BYTE_SIZE existing together with DW_AT_STRING_LENGTH -+ specifies the size of an integer to fetch. */ -+ -+ size_attr = dwarf2_attr (die, DW_AT_byte_size, cu); -+ if (size_attr) ++ if (blk->size == 1 && blk->data[0] >= DW_OP_reg0 ++ && blk->data[0] <= DW_OP_reg31) ++ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); ++ else if (blk->size > 1 && blk->data[0] == DW_OP_regx) + { -+ length_baton->size = DW_BLOCK (attr)->size + 2; -+ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref_size; -+ length_baton->data[DW_BLOCK (attr)->size + 1] -+ = DW_UNSND (size_attr); -+ if (length_baton->data[DW_BLOCK (attr)->size + 1] -+ != DW_UNSND (size_attr)) -+ complaint (&symfile_complaints, -+ _("DW_AT_string_length's DW_AT_byte_size integer " -+ "exceeds the byte size storage")); ++ ULONGEST ulongest; ++ gdb_byte *end; ++ ++ end = read_uleb128 (&blk->data[1], &blk->data[blk->size], ++ &ulongest); ++ if (end == &blk->data[blk->size]) ++ length_baton = dwarf2_attr_to_locexpr_baton (attr, cu); + } -+ else ++ ++ if (length_baton == NULL) + { -+ length_baton->size = DW_BLOCK (attr)->size + 1; -+ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref; ++ struct attribute *size_attr; ++ ++ length_baton = obstack_alloc (&cu->comp_unit_obstack, ++ sizeof (*length_baton)); ++ length_baton->per_cu = cu->per_cu; ++ length_baton->size = DW_BLOCK (attr)->size + 2; ++ length_baton->data = obstack_alloc (&cu->comp_unit_obstack, ++ length_baton->size); ++ memcpy (length_baton->data, DW_BLOCK (attr)->data, ++ DW_BLOCK (attr)->size); ++ ++ /* DW_AT_BYTE_SIZE existing together with DW_AT_STRING_LENGTH ++ specifies the size of an integer to fetch. */ ++ size_attr = dwarf2_attr (die, DW_AT_byte_size, cu); ++ if (size_attr) ++ { ++ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref_size; ++ length_baton->data[DW_BLOCK (attr)->size + 1] = ++ DW_UNSND (size_attr); ++ if (length_baton->data[DW_BLOCK (attr)->size + 1] ++ != DW_UNSND (size_attr)) ++ complaint (&symfile_complaints, ++ _("DW_AT_string_length's DW_AT_byte_size " ++ "integer exceeds the byte size storage")); ++ } ++ else ++ { ++ length_baton->data[DW_BLOCK (attr)->size] = DW_OP_deref; ++ length_baton->data[DW_BLOCK (attr)->size + 1] = DW_OP_nop; ++ } + } + + TYPE_RANGE_BOUND_SET_DWARF_BLOCK (range_type, 1); @@ -5648,8 +6546,7 @@ index 445bab8..65556c9 100644 + TYPE_DYNAMIC (range_type) = 1; + } + else if (attr && attr_form_is_constant (attr)) -+ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0, -+ cu); ++ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0); else - { - length = 1; @@ -5662,7 +6559,7 @@ index 445bab8..65556c9 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -5822,7 +6111,6 @@ static struct type * +@@ -5841,7 +6441,6 @@ static struct type * read_typedef (struct die_info *die, struct dwarf2_cu *cu) { struct objfile *objfile = cu->objfile; @@ -5670,7 +6567,7 @@ index 445bab8..65556c9 100644 const char *name = NULL; struct type *this_type; -@@ -5930,8 +6218,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5949,8 +6548,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -5680,7 +6577,7 @@ index 445bab8..65556c9 100644 char *name; base_type = die_type (die, cu); -@@ -5944,42 +6231,91 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -5963,42 +6561,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) 0, NULL, cu->objfile); } @@ -5710,7 +6607,7 @@ index 445bab8..65556c9 100644 + else + { + if (attr && attr_form_is_constant (attr)) -+ low = dwarf2_get_attr_constant_value (attr, 0, cu); ++ low = dwarf2_get_attr_constant_value (attr, 0); + else + { + if (cu->language == language_fortran) @@ -5770,8 +6667,7 @@ index 445bab8..65556c9 100644 + else + { + if (attr && attr_form_is_constant (attr)) -+ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0, -+ cu); ++ TYPE_HIGH_BOUND (range_type) = dwarf2_get_attr_constant_value (attr, 0); else - high = dwarf2_get_attr_constant_value (attr, 1); + { @@ -5792,8 +6688,7 @@ index 445bab8..65556c9 100644 + } + else if (attr && attr_form_is_constant (attr)) + { -+ TYPE_BYTE_STRIDE (range_type) = dwarf2_get_attr_constant_value (attr, 0, -+ cu); ++ TYPE_BYTE_STRIDE (range_type) = dwarf2_get_attr_constant_value (attr, 0); + if (TYPE_BYTE_STRIDE (range_type) == 0) + complaint (&symfile_complaints, + _("Found DW_AT_byte_stride with unsupported value 0")); @@ -5801,7 +6696,15 @@ index 445bab8..65556c9 100644 name = dwarf2_name (die, cu); if (name) -@@ -6670,9 +7006,6 @@ read_partial_die (struct partial_die_info *part_die, +@@ -6469,6 +7114,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr, + && abbrev->tag != DW_TAG_lexical_block + && abbrev->tag != DW_TAG_variable + && abbrev->tag != DW_TAG_namespace ++ && abbrev->tag != DW_TAG_module + && abbrev->tag != DW_TAG_member) + { + /* Otherwise we skip to the next sibling, if any. */ +@@ -6689,9 +7335,6 @@ read_partial_die (struct partial_die_info *part_die, if (part_die->dirname == NULL) part_die->dirname = DW_STRING (&attr); break; @@ -5811,36 +6714,7 @@ index 445bab8..65556c9 100644 case DW_AT_low_pc: has_low_pc_attr = 1; part_die->lowpc = DW_ADDR (&attr); -@@ -6744,10 +7077,10 @@ read_partial_die (struct partial_die_info *part_die, - else - part_die->sibling = 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_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; -@@ -6789,13 +7122,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; - } - -@@ -6904,7 +7230,8 @@ fixup_partial_die (struct partial_die_info *part_die, +@@ -6923,7 +7566,8 @@ fixup_partial_die (struct partial_die_info *part_die, /* If we found a reference attribute and the DIE has no name, try to find a name in the referred to DIE. */ @@ -5850,7 +6724,7 @@ index 445bab8..65556c9 100644 { struct partial_die_info *spec_die; -@@ -8244,10 +8571,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, +@@ -8265,10 +8909,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 @@ -5865,7 +6739,7 @@ index 445bab8..65556c9 100644 } /* Given a pointer to a DWARF information entry, figure out if we need -@@ -8269,21 +8598,24 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -8290,21 +8936,30 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -5894,10 +6768,16 @@ index 445bab8..65556c9 100644 + + linkagename = dwarf2_linkage_name (die, cu); + SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), objfile); ++ if (cu->language == language_fortran) ++ { ++ (sym)->ginfo.language_specific.cplus_specific.demangled_name = ++ SYMBOL_LINKAGE_NAME (sym); ++ SYMBOL_LINKAGE_NAME (sym) = fortran_module_linkage_name (die, cu); ++ } /* Default assumptions. Use the passed type or decode it from the die. */ -@@ -8381,7 +8713,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -8402,9 +9057,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (attr) { var_decode_location (attr, sym, cu); @@ -5911,9 +6791,23 @@ index 445bab8..65556c9 100644 + attr2 = NULL; + if (attr2 && (DW_UNSND (attr2) != 0)) - add_symbol_to_list (sym, &global_symbols); +- add_symbol_to_list (sym, &global_symbols); ++ { ++ /* Workaround gfortran PR debug/40040 - it uses ++ DW_AT_location for variables in -fPIC libraries which may ++ get overriden by other libraries/executable and get ++ a different address. Resolve it by .dynsym instead. */ ++ ++ if (cu->language == language_fortran && die->parent ++ && die->parent->tag == DW_TAG_module) ++ SYMBOL_CLASS (sym) = LOC_UNRESOLVED; ++ ++ add_symbol_to_list (sym, &global_symbols); ++ } else -@@ -8513,7 +8853,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + add_symbol_to_list (sym, cu->list_in_scope); + } +@@ -8534,7 +9208,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) add_symbol_to_list (sym, cu->list_in_scope); break; case DW_TAG_enumerator: @@ -5922,7 +6816,7 @@ index 445bab8..65556c9 100644 attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) { -@@ -8537,6 +8877,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -8558,6 +9232,16 @@ 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; @@ -5930,11 +6824,16 @@ index 445bab8..65556c9 100644 + SYMBOL_CLASS (sym) = LOC_STATIC; + SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; + add_symbol_to_list (sym, cu->list_in_scope); ++ break; ++ case DW_TAG_module: ++ SYMBOL_CLASS (sym) = LOC_STATIC; ++ SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; ++ add_symbol_to_list (sym, &global_symbols); + break; default: /* Not a tag we recognize. Hopefully we aren't processing trash data, but since we must specifically ignore things -@@ -8550,8 +8895,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -8571,8 +9255,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) /* For the benefit of old versions of GCC, check for anonymous namespaces based on the demangled name. */ if (!processing_has_namespace_info @@ -5944,7 +6843,16 @@ index 445bab8..65556c9 100644 cp_scan_for_anonymous_namespaces (sym); } return (sym); -@@ -8808,6 +9152,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) +@@ -8823,12 +9506,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) + case DW_TAG_namespace: + this_type = read_namespace_type (die, cu); + break; ++ case DW_TAG_module: ++ this_type = read_module_type (die, cu); ++ break; + default: + complaint (&symfile_complaints, _("unexpected tag in read_type_die: '%s'"), + dwarf_tag_name (die->tag)); break; } @@ -5954,7 +6862,7 @@ index 445bab8..65556c9 100644 return this_type; } -@@ -8889,10 +9236,97 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) +@@ -8910,10 +9599,97 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu) So it does not need a prefix. */ return ""; default: @@ -6053,18 +6961,14 @@ index 445bab8..65556c9 100644 /* Return a newly-allocated string formed by concatenating PREFIX and SUFFIX with appropriate separator. If PREFIX or SUFFIX is NULL or empty, then simply copy the SUFFIX or PREFIX, respectively. If OBS is non-null, -@@ -8948,14 +9382,75 @@ static char * +@@ -8969,11 +9745,105 @@ static char * dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu) { struct attribute *attr; + char *name; + + name = dwarf2_name (die, cu); - -- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); -- if (attr && DW_STRING (attr)) -- return DW_STRING (attr); -- return dwarf2_name (die, cu); ++ + /* These are the only languages we know how to qualify names in. */ + if (cu->language != language_cplus + && cu->language != language_java) @@ -6111,7 +7015,11 @@ index 445bab8..65556c9 100644 + fputs_unfiltered (" const", buf); + } + } -+ + +- attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); +- if (attr && DW_STRING (attr)) +- return DW_STRING (attr); +- return dwarf2_name (die, cu); + name = ui_file_obsavestring (buf, &cu->objfile->objfile_obstack, + &length); + ui_file_delete (buf); @@ -6126,15 +7034,44 @@ index 445bab8..65556c9 100644 + } + } + ++ return name; ++} ++ ++/* Return the fully qualified .symtab name for symbols contained in Fortran ++ modules. Return DWARF2_NAME otherwise. */ ++ ++static char * ++fortran_module_linkage_name (struct die_info *die, struct dwarf2_cu *cu) ++{ ++ char *name; ++ ++ gdb_assert (cu->language == language_fortran); ++ ++ name = dwarf2_name (die, cu); ++ ++ if (name && die->parent && die->parent->tag == DW_TAG_module) ++ { ++ char *module_name = dwarf2_name (die->parent, cu); ++ ++ if (module_name) ++ { ++ char *retval; ++ ++ /* `__modulename_MOD_variablename0'. */ ++ retval = obstack_alloc (&cu->objfile->objfile_obstack, ++ 2 + strlen (module_name) + 5 + strlen (name) ++ + 1); ++ sprintf (retval, "__%s_MOD_%s", module_name, name); ++ ++ return retval; ++ } ++ } ++ + return name; } --/* Get name of a die, return NULL if not found. */ -+/* Canonicalize the name of the given DIE. */ - - static char * - dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu, -@@ -10181,11 +10676,12 @@ dwarf2_get_ref_die_offset (struct attribute *attr) + /* Get name of a die, return NULL if not found. */ +@@ -10200,11 +11070,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr) return 0; } @@ -6145,21 +7082,11 @@ index 445bab8..65556c9 100644 -static int -dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) +static CORE_ADDR -+dwarf2_get_attr_constant_value (struct attribute *attr, CORE_ADDR default_value, -+ struct dwarf2_cu *cu) ++dwarf2_get_attr_constant_value (struct attribute *attr, CORE_ADDR default_value) { if (attr->form == DW_FORM_sdata) return DW_SND (attr); -@@ -10195,6 +10691,8 @@ dwarf2_get_attr_constant_value (struct attribute *attr, int default_value) - || attr->form == DW_FORM_data4 - || attr->form == DW_FORM_data8) - return DW_UNSND (attr); -+ else if (attr_form_is_block (attr)) -+ return decode_locdesc (DW_BLOCK (attr), cu); - else - { - complaint (&symfile_complaints, _("Attribute value is not a constant (%s)"), -@@ -10990,8 +11488,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11009,8 +11879,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, { gdb_byte *mac_ptr, *mac_end; struct macro_source_file *current_file = 0; @@ -6168,7 +7095,7 @@ index 445bab8..65556c9 100644 if (dwarf2_per_objfile->macinfo.buffer == NULL) { -@@ -10999,29 +11495,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11018,29 +11886,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, return; } @@ -6203,7 +7130,7 @@ index 445bab8..65556c9 100644 } macinfo_type = read_1_byte (abfd, mac_ptr); -@@ -11032,92 +11518,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11051,92 +11909,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, /* A zero macinfo type indicates the end of the macro information. */ case 0: @@ -6297,7 +7224,7 @@ index 445bab8..65556c9 100644 case DW_MACINFO_define: case DW_MACINFO_undef: -@@ -11132,31 +11533,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11151,31 +11924,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, mac_ptr += bytes_read; if (! current_file) @@ -6340,7 +7267,7 @@ index 445bab8..65556c9 100644 } break; -@@ -11170,22 +11559,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11189,22 +11950,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read); mac_ptr += bytes_read; @@ -6366,7 +7293,7 @@ index 445bab8..65556c9 100644 } break; -@@ -11239,7 +11615,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, +@@ -11258,7 +12006,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset, } break; } @@ -6375,7 +7302,7 @@ index 445bab8..65556c9 100644 } /* Check if the attribute's form is a DW_FORM_block* -@@ -11299,6 +11675,34 @@ attr_form_is_constant (struct attribute *attr) +@@ -11318,6 +12066,34 @@ attr_form_is_constant (struct attribute *attr) } } @@ -6410,7 +7337,7 @@ index 445bab8..65556c9 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu) -@@ -11328,35 +11732,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, +@@ -11347,35 +12123,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs; SYMBOL_LOCATION_BATON (sym) = baton; } @@ -6461,7 +7388,7 @@ index 445bab8..65556c9 100644 } } -@@ -11644,6 +12038,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -11663,6 +12429,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -6493,7 +7420,7 @@ index 445bab8..65556c9 100644 /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. */ -@@ -11652,6 +12071,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -11671,6 +12462,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { struct dwarf2_offset_and_type **slot, ofs; @@ -6502,7 +7429,7 @@ index 445bab8..65556c9 100644 if (cu->type_hash == NULL) { gdb_assert (cu->per_cu != NULL); -@@ -11794,23 +12215,13 @@ show_dwarf2_cmd (char *args, int from_tty) +@@ -11813,23 +12606,13 @@ show_dwarf2_cmd (char *args, int from_tty) cmd_show_list (show_dwarf2_cmdlist, from_tty, ""); } @@ -6530,8 +7457,8 @@ index 445bab8..65556c9 100644 } /* munmap debug sections for OBJFILE, if necessary. */ -@@ -11819,15 +12230,15 @@ static void - dwarf2_per_objfile_cleanup (struct objfile *objfile, void *d) +@@ -11838,15 +12621,15 @@ static void + dwarf2_per_objfile_free (struct objfile *objfile, void *d) { struct dwarf2_per_objfile *data = d; - munmap_section_buffer (&data->info); @@ -6555,13 +7482,13 @@ index 445bab8..65556c9 100644 } void _initialize_dwarf2_read (void); -@@ -11835,6 +12246,7 @@ void _initialize_dwarf2_read (void); +@@ -11854,6 +12637,7 @@ void _initialize_dwarf2_read (void); void _initialize_dwarf2_read (void) { + die_list = VEC_alloc (die_info_p, 32); dwarf2_objfile_data_key - = register_objfile_data_with_cleanup (dwarf2_per_objfile_cleanup); + = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free); diff --git a/gdb/elfread.c b/gdb/elfread.c index 6e79d4a..198bae3 100644 @@ -6910,7 +7837,7 @@ index 7e41d39..37ffe23 100644 default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); diff --git a/gdb/expression.h b/gdb/expression.h -index 12163e3..bf2b518 100644 +index effe1f0..3e083ca 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -88,6 +88,16 @@ enum exp_opcode @@ -6930,7 +7857,7 @@ index 12163e3..bf2b518 100644 /* end of C++. */ /* For Modula-2 integer division DIV */ -@@ -435,4 +445,5 @@ extern char *op_string (enum exp_opcode); +@@ -438,4 +448,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 *); @@ -6966,10 +7893,19 @@ index c04c8f4..ddcd460 100644 { "integer", INT_KEYWORD, BINOP_END }, { "logical", LOGICAL_KEYWORD, BINOP_END }, diff --git a/gdb/f-lang.c b/gdb/f-lang.c -index 19c1316..8d2a538 100644 +index 19c1316..4cc2a40 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c -@@ -55,20 +55,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR; +@@ -31,6 +31,8 @@ + #include "f-lang.h" + #include "valprint.h" + #include "value.h" ++#include "block.h" ++#include "gdb_assert.h" + + + /* Following is dubious stuff that had been in the xcoff reader. */ +@@ -55,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR; /* Local functions */ extern void _initialize_f_language (void); @@ -6990,7 +7926,7 @@ index 19c1316..8d2a538 100644 static void f_printchar (int c, struct type *type, struct ui_file * stream); static void f_emit_char (int c, struct type *type, -@@ -259,6 +245,7 @@ enum f_primitive_types { +@@ -259,6 +247,7 @@ enum f_primitive_types { f_primitive_type_logical, f_primitive_type_logical_s1, f_primitive_type_logical_s2, @@ -6998,7 +7934,7 @@ index 19c1316..8d2a538 100644 f_primitive_type_integer, f_primitive_type_integer_s2, f_primitive_type_real, -@@ -289,6 +276,8 @@ f_language_arch_info (struct gdbarch *gdbarch, +@@ -289,6 +278,8 @@ f_language_arch_info (struct gdbarch *gdbarch, = builtin->builtin_logical_s1; lai->primitive_type_vector [f_primitive_type_logical_s2] = builtin->builtin_logical_s2; @@ -7007,7 +7943,63 @@ index 19c1316..8d2a538 100644 lai->primitive_type_vector [f_primitive_type_real] = builtin->builtin_real; lai->primitive_type_vector [f_primitive_type_real_s8] -@@ -372,6 +361,10 @@ build_fortran_types (struct gdbarch *gdbarch) +@@ -306,6 +297,46 @@ f_language_arch_info (struct gdbarch *gdbarch, + lai->bool_type_default = builtin->builtin_logical_s2; + } + ++/* Find if NAME is not contained in any of the Fortran modules imported by the ++ Fortran USE statement. ++ ++ As Fortran has no nested blocks such lookup can be processed from ++ lookup_symbol_nonlocal - when no local blocks could satisfy the lookup. */ ++ ++static struct symbol * ++f_lookup_symbol_nonlocal (const char *name, ++ const struct block *block, ++ const domain_enum domain) ++{ ++ struct fortran_using *use; ++ ++ if (!block) ++ return NULL; ++ ++ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next) ++ { ++ struct symbol *sym; ++ struct type *type; ++ struct symbol *retval; ++ ++ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN); ++ ++ /* Module name lookup should not fail with correct debug info. */ ++ if (sym == NULL) ++ continue; ++ ++ type = SYMBOL_TYPE (sym); ++ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE); ++ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL); ++ ++ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain); ++ if (retval) ++ return retval; ++ } ++ ++ return NULL; ++} ++ + /* This is declared in c-lang.h but it is silly to import that file for what + is already just a hack. */ + extern int c_value_print (struct value *, struct ui_file *, +@@ -333,7 +364,7 @@ const struct language_defn f_language_defn = + c_value_print, /* FIXME */ + NULL, /* Language specific skip_trampoline */ + NULL, /* name_of_this */ +- basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ ++ f_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ + basic_lookup_transparent_type,/* lookup_transparent_type */ + NULL, /* Language specific symbol demangler */ + NULL, /* Language specific class_name_from_physname */ +@@ -372,6 +403,10 @@ build_fortran_types (struct gdbarch *gdbarch) = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2"); @@ -7018,7 +8010,7 @@ index 19c1316..8d2a538 100644 builtin_f_type->builtin_integer = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer"); -@@ -418,395 +411,3 @@ _initialize_f_language (void) +@@ -418,395 +453,3 @@ _initialize_f_language (void) add_language (&f_language_defn); } @@ -7415,7 +8407,7 @@ index 19c1316..8d2a538 100644 -} -#endif diff --git a/gdb/f-lang.h b/gdb/f-lang.h -index 711bdba..cd2f804 100644 +index 711bdba..9d7d92b 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined in f-exp.y */ @@ -7479,6 +8471,17 @@ index 711bdba..cd2f804 100644 struct type *builtin_real; struct type *builtin_real_s8; struct type *builtin_real_s16; +@@ -125,3 +97,10 @@ struct builtin_f_type + /* Return the Fortran type table for the specified architecture. */ + extern const struct builtin_f_type *builtin_f_type (struct gdbarch *gdbarch); + ++/* List of module names being imported by a block though BLOCK_FORTRAN_USE. */ ++ ++struct fortran_using ++ { ++ struct fortran_using *next; ++ char module_name[1]; ++ }; diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 6c9668f..852b9a8 100644 --- a/gdb/f-typeprint.c @@ -8314,10 +9317,10 @@ index 8c027c9..d201f76 100644 else { diff --git a/gdb/frame.c b/gdb/frame.c -index 67e0607..49c3013 100644 +index 7932b48..4e7c434 100644 --- a/gdb/frame.c +++ b/gdb/frame.c -@@ -1109,6 +1109,14 @@ has_stack_frames (void) +@@ -1171,6 +1171,14 @@ has_stack_frames (void) if (ptid_equal (inferior_ptid, null_ptid)) return 0; @@ -8332,37 +9335,6 @@ index 67e0607..49c3013 100644 /* Don't try to read from a dead thread. */ if (is_exited (inferior_ptid)) return 0; -@@ -1843,6 +1851,15 @@ get_frame_args_address (struct frame_info *fi) - return fi->base->this_args (fi, &fi->base_cache); - } - -+/* Return true if the frame base for frame FI is BASE; false -+ otherwise. */ -+ -+int -+frame_unwinder_is (struct frame_info *fi, const struct frame_unwind *unwinder) -+{ -+ return fi->unwind == unwinder; -+} -+ - /* Level of the selected frame: 0 for innermost, 1 for its caller, ... - or -1 for a NULL frame. */ - -diff --git a/gdb/frame.h b/gdb/frame.h -index febef5c..611c6d3 100644 ---- a/gdb/frame.h -+++ b/gdb/frame.h -@@ -696,4 +696,10 @@ extern struct frame_info *deprecated_safe_get_selected_frame (void); - - extern struct frame_info *create_new_frame (CORE_ADDR base, CORE_ADDR pc); - -+/* Return true if the frame unwinder for frame FI is UNWINDER; false -+ otherwise. */ -+ -+extern int frame_unwinder_is (struct frame_info *fi, -+ const struct frame_unwind *unwinder); -+ - #endif /* !defined (FRAME_H) */ diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in index ffb7f53..a2e7e94 100644 --- a/gdb/gdbinit.in @@ -8790,10 +9762,21 @@ index 0000000..b8213f5 + NULL, +}; diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h -index 79d33fe..aecd820 100644 +index 79d33fe..d3b4fa1 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h -@@ -249,6 +249,9 @@ extern struct thread_info *any_thread_of_process (int pid); +@@ -185,6 +185,10 @@ struct thread_info + /* True if this thread has been explicitly requested to stop. */ + int stop_requested; + ++ /* The initiating frame of a nexting operation, used for deciding ++ which exceptions to intercept. */ ++ struct frame_id initiating_frame; ++ + /* Private data used by the target vector implementation. */ + struct private_thread_info *private; + }; +@@ -249,6 +253,9 @@ extern struct thread_info *any_thread_of_process (int pid); /* Change the ptid of thread OLD_PTID to NEW_PTID. */ void thread_change_ptid (ptid_t old_ptid, ptid_t new_ptid); @@ -9626,10 +10609,19 @@ index 2f77dca..8146175 100644 add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index be6ed55..cf8c4d8 100644 +index be6ed55..6a51a4e 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -213,6 +213,11 @@ enum type_instance_flag_value +@@ -137,6 +137,8 @@ enum type_code + + TYPE_CODE_DECFLOAT, /* Decimal floating point. */ + ++ TYPE_CODE_MODULE, /* Fortran module. */ ++ + /* Internal function type. */ + TYPE_CODE_INTERNAL_FUNCTION + }; +@@ -213,6 +215,11 @@ enum type_instance_flag_value #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) @@ -9641,7 +10633,7 @@ index be6ed55..cf8c4d8 100644 /* Static type. If this is set, the corresponding type had * a static modifier. * Note: This may be unnecessary, since static data members -@@ -278,6 +283,48 @@ enum type_instance_flag_value +@@ -278,6 +285,48 @@ enum type_instance_flag_value #define TYPE_OWNER(t) TYPE_MAIN_TYPE(t)->owner #define TYPE_OBJFILE(t) (TYPE_OBJFILE_OWNED(t)? TYPE_OWNER(t).objfile : NULL) @@ -9690,7 +10682,7 @@ index be6ed55..cf8c4d8 100644 /* Constant type. If this is set, the corresponding type has a * const modifier. */ -@@ -365,6 +412,13 @@ struct main_type +@@ -365,6 +414,13 @@ struct main_type unsigned int flag_nottext : 1; unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; @@ -9704,7 +10696,7 @@ index be6ed55..cf8c4d8 100644 /* Number of fields described for this type. This field appears at this location because it packs nicely here. */ -@@ -431,6 +485,20 @@ struct main_type +@@ -431,6 +487,20 @@ struct main_type struct type *target_type; @@ -9725,7 +10717,17 @@ index be6ed55..cf8c4d8 100644 /* For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. -@@ -812,9 +880,9 @@ extern void allocate_cplus_struct_type (struct type *); +@@ -538,6 +608,9 @@ struct main_type + supporting multiple ABIs. Right now this is only fetched from + the Dwarf-2 DW_AT_calling_convention attribute. */ + unsigned calling_convention; ++ ++ /* For TYPE_CODE_MODULE, the list of symbols contained in the module. */ ++ struct block *module_block; + } type_specific; + }; + +@@ -812,9 +885,9 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_CHAIN(thistype) (thistype)->chain @@ -9738,7 +10740,7 @@ index be6ed55..cf8c4d8 100644 calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ #define TYPE_LENGTH(thistype) (thistype)->length /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -823,23 +891,44 @@ extern void allocate_cplus_struct_type (struct type *); +@@ -823,23 +896,44 @@ extern void allocate_cplus_struct_type (struct type *); #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->fields #define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args @@ -9793,7 +10795,15 @@ index be6ed55..cf8c4d8 100644 /* C++ */ -@@ -1131,7 +1220,7 @@ extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN +@@ -855,6 +949,7 @@ extern void allocate_cplus_struct_type (struct type *); + #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff + #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat + #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.calling_convention ++#define TYPE_MODULE_BLOCK(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.module_block + #define TYPE_BASECLASS(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].type + #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses + #define TYPE_BASECLASS_NAME(thistype,index) TYPE_MAIN_TYPE(thistype)->fields[index].name +@@ -1131,7 +1226,7 @@ extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN Use alloc_type_arch to allocate a type owned by an architecture. Use alloc_type_copy to allocate a type with the same owner as a pre-existing template type, no matter whether objfile or gdbarch. */ @@ -9802,7 +10812,7 @@ index be6ed55..cf8c4d8 100644 extern struct type *alloc_type_arch (struct gdbarch *); extern struct type *alloc_type_copy (const struct type *); -@@ -1226,6 +1315,18 @@ extern struct type *create_array_type (struct type *, struct type *, +@@ -1226,6 +1321,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -9821,7 +10831,7 @@ index be6ed55..cf8c4d8 100644 extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1262,6 +1363,8 @@ extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *); +@@ -1262,6 +1369,8 @@ extern int get_discrete_bounds (struct type *, LONGEST *, LONGEST *); extern int is_ancestor (struct type *, struct type *); @@ -9830,7 +10840,7 @@ index be6ed55..cf8c4d8 100644 /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1324,10 +1427,15 @@ extern void maintenance_print_type (char *, int); +@@ -1324,10 +1433,15 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -9899,21 +10909,610 @@ index 0f9d44e..c910e88 100644 /* We didn't find it; print the raw data. */ if (vbit) -diff --git a/gdb/gnulib/Makefile.in b/gdb/gnulib/Makefile.in -index 5e55573..5439aba 100644 ---- a/gdb/gnulib/Makefile.in -+++ b/gdb/gnulib/Makefile.in -@@ -1,8 +1,8 @@ - # Makefile.in generated by automake 1.9.6 from Makefile.am. - # @configure_input@ +diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c +index fe848ff..170e6cd 100644 +--- a/gdb/i386-linux-nat.c ++++ b/gdb/i386-linux-nat.c +@@ -586,6 +586,8 @@ i386_linux_store_inferior_registers (struct target_ops *ops, --# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, --# 2003, 2004, 2005 Free Software Foundation, Inc. -+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -+# 2004, 2005, 2009 Free Software Foundation, Inc. - # This Makefile.in is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. + static unsigned long i386_linux_dr[DR_CONTROL + 1]; + ++/* Get debug register REGNUM value from only the one LWP of PTID. */ ++ + static unsigned long + i386_linux_dr_get (ptid_t ptid, int regnum) + { +@@ -614,6 +616,8 @@ i386_linux_dr_get (ptid_t ptid, int regnum) + return value; + } + ++/* Set debug register REGNUM to VALUE in only the one LWP of PTID. */ ++ + static void + i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) + { +@@ -630,6 +634,8 @@ i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) + perror_with_name (_("Couldn't write debug register")); + } + ++/* Set DR_CONTROL to ADDR in all LWPs of LWP_LIST. */ ++ + static void + i386_linux_dr_set_control (unsigned long control) + { +@@ -641,6 +647,8 @@ i386_linux_dr_set_control (unsigned long control) + i386_linux_dr_set (ptid, DR_CONTROL, control); + } + ++/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */ ++ + static void + i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) + { +@@ -654,18 +662,55 @@ i386_linux_dr_set_addr (int regnum, CORE_ADDR addr) + i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr); + } + ++/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */ ++ + static void + i386_linux_dr_reset_addr (int regnum) + { + i386_linux_dr_set_addr (regnum, 0); + } + ++/* Get DR_STATUS from only the one LWP of INFERIOR_PTID. */ ++ + static unsigned long + i386_linux_dr_get_status (void) + { + return i386_linux_dr_get (inferior_ptid, DR_STATUS); + } + ++/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST. */ ++ ++static void ++i386_linux_dr_unset_status (unsigned long mask) ++{ ++ struct lwp_info *lp; ++ ptid_t ptid; ++ ++ ALL_LWPS (lp, ptid) ++ { ++ unsigned long value; ++ ++ value = i386_linux_dr_get (ptid, DR_STATUS); ++ value &= ~mask; ++ i386_linux_dr_set (ptid, DR_STATUS, value); ++ } ++} ++ ++/* See i386_dr_low_type.detach. Do not use wrappers i386_linux_dr_set_control ++ or i386_linux_dr_reset_addr as they would modify the register cache ++ (i386_linux_dr). */ ++ ++static void ++i386_linux_dr_detach (void) ++{ ++ int regnum; ++ ++ i386_linux_dr_set (inferior_ptid, DR_CONTROL, 0); ++ i386_linux_dr_unset_status (~0UL); ++ for (regnum = DR_FIRSTADDR; regnum <= DR_LASTADDR; regnum++) ++ i386_linux_dr_set (inferior_ptid, regnum, 0); ++} ++ + static void + i386_linux_new_thread (ptid_t ptid) + { +@@ -837,6 +882,8 @@ _initialize_i386_linux_nat (void) + i386_dr_low.set_addr = i386_linux_dr_set_addr; + i386_dr_low.reset_addr = i386_linux_dr_reset_addr; + i386_dr_low.get_status = i386_linux_dr_get_status; ++ i386_dr_low.unset_status = i386_linux_dr_unset_status; ++ i386_dr_low.detach = i386_linux_dr_detach; + i386_set_debug_register_length (4); + + /* Override the default ptrace resume method. */ +diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c +index ab1bd8a..ee330b8 100644 +--- a/gdb/i386-nat.c ++++ b/gdb/i386-nat.c +@@ -137,8 +137,11 @@ struct i386_dr_low_type i386_dr_low; + #define I386_DR_GET_RW_LEN(i) \ + ((dr_control_mirror >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f) + ++/* Mask that this I'th watchpoint has triggered. */ ++#define I386_DR_WATCH_MASK(i) (1 << (i)) ++ + /* Did the watchpoint whose address is in the I'th register break? */ +-#define I386_DR_WATCH_HIT(i) (dr_status_mirror & (1 << (i))) ++#define I386_DR_WATCH_HIT(i) (dr_status_mirror & I386_DR_WATCH_MASK (i)) + + /* A macro to loop over all debug registers. */ + #define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++) +@@ -358,6 +361,10 @@ i386_insert_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) + i386_dr_low.set_addr (i, addr); + i386_dr_low.set_control (dr_control_mirror); + ++ /* Only a sanity check for leftover bits (set possibly only by inferior). */ ++ if (i386_dr_low.unset_status) ++ i386_dr_low.unset_status (I386_DR_WATCH_MASK (i)); ++ + return 0; + } + +@@ -387,6 +394,11 @@ i386_remove_aligned_watchpoint (CORE_ADDR addr, unsigned len_rw_bits) + i386_dr_low.set_control (dr_control_mirror); + if (i386_dr_low.reset_addr) + i386_dr_low.reset_addr (i); ++ ++ /* Status must be already queried for each LWP. Otherwise it will ++ be lost in all-stop mode + breakpoint always-inserted off. */ ++ if (i386_dr_low.unset_status) ++ i386_dr_low.unset_status (I386_DR_WATCH_MASK (i)); + } + retval = 0; + } +@@ -520,6 +532,17 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type) + return retval; + } + ++/* See target_detach_watchpoints. */ ++ ++static int ++i386_detach_watchpoints (void) ++{ ++ if (i386_dr_low.detach) ++ i386_dr_low.detach (); ++ ++ return 0; ++} ++ + /* Return non-zero if we can watch a memory region that starts at + address ADDR and whose length is LEN bytes. */ + +@@ -575,28 +598,7 @@ static int + i386_stopped_by_watchpoint (void) + { + CORE_ADDR addr = 0; +- return i386_stopped_data_address (¤t_target, &addr); +-} +- +-/* Return non-zero if the inferior has some break/watchpoint that +- triggered. */ +- +-static int +-i386_stopped_by_hwbp (void) +-{ +- int i; +- +- dr_status_mirror = i386_dr_low.get_status (); +- if (maint_show_dr) +- i386_show_dr ("stopped_by_hwbp", 0, 0, hw_execute); +- +- ALL_DEBUG_REGISTERS(i) +- { +- if (I386_DR_WATCH_HIT (i)) +- return 1; +- } +- +- return 0; ++ return target_stopped_data_address (¤t_target, &addr); + } + + /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. +@@ -690,6 +692,7 @@ i386_use_watchpoints (struct target_ops *t) + t->to_stopped_data_address = i386_stopped_data_address; + t->to_insert_watchpoint = i386_insert_watchpoint; + t->to_remove_watchpoint = i386_remove_watchpoint; ++ t->to_detach_watchpoints = i386_detach_watchpoints; + t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint; + t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint; + } +diff --git a/gdb/i386-nat.h b/gdb/i386-nat.h +index f49b9f6..cd31958 100644 +--- a/gdb/i386-nat.h ++++ b/gdb/i386-nat.h +@@ -49,16 +49,23 @@ extern void i386_use_watchpoints (struct target_ops *); + functions are: + + set_control -- set the debug control (DR7) +- register to a given value ++ register to a given value for all LWPs + + set_addr -- put an address into one debug +- register ++ register for all LWPs + + reset_addr -- reset the address stored in +- one debug register ++ one debug register for all LWPs + + get_status -- return the value of the debug +- status (DR6) register. ++ status (DR6) register for current LWP ++ ++ unset_status -- unset the specified bits of the debug ++ status (DR6) register for all LWPs ++ ++ detach -- clear all debug registers of only the ++ INFERIOR_PTID task without affecting any ++ register caches. + + Additionally, the native file should set the debug_register_length + field to 4 or 8 depending on the number of bytes used for +@@ -70,6 +77,8 @@ struct i386_dr_low_type + void (*set_addr) (int, CORE_ADDR); + void (*reset_addr) (int); + unsigned long (*get_status) (void); ++ void (*unset_status) (unsigned long); ++ void (*detach) (void); + int debug_register_length; + }; + +diff --git a/gdb/infcmd.c b/gdb/infcmd.c +index 9e98290..fab1892 100644 +--- a/gdb/infcmd.c ++++ b/gdb/infcmd.c +@@ -801,7 +801,7 @@ nexti_command (char *count_string, int from_tty) + step_1 (1, 1, count_string); + } + +-static void ++void + delete_longjmp_breakpoint_cleanup (void *arg) + { + int thread = * (int *) arg; +@@ -841,10 +841,13 @@ step_1 (int skip_subroutines, int single_inst, char *count_string) + + if (!single_inst || skip_subroutines) /* leave si command alone */ + { ++ struct thread_info *tp = inferior_thread (); ++ + if (in_thread_list (inferior_ptid)) + thread = pid_to_thread_id (inferior_ptid); + + set_longjmp_breakpoint (thread); ++ tp->initiating_frame = get_frame_id (get_current_frame ()); + + make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); + } +@@ -1193,6 +1196,15 @@ signal_command (char *signum_exp, int from_tty) + proceed ((CORE_ADDR) -1, oursig, 0); + } + ++/* A continuation callback for until_next_command. */ ++ ++static void ++until_next_continuation (void *arg) ++{ ++ struct thread_info *tp = arg; ++ delete_longjmp_breakpoint (tp->num); ++} ++ + /* Proceed until we reach a different source line with pc greater than + our current one or exit the function. We skip calls in both cases. + +@@ -1209,6 +1221,8 @@ until_next_command (int from_tty) + struct symbol *func; + struct symtab_and_line sal; + struct thread_info *tp = inferior_thread (); ++ int thread = tp->num; ++ struct cleanup *old_chain; + + clear_proceed_status (); + set_step_frame (); +@@ -1244,7 +1258,19 @@ until_next_command (int from_tty) + + tp->step_multi = 0; /* Only one call to proceed */ + ++ set_longjmp_breakpoint (thread); ++ tp->initiating_frame = get_frame_id (frame); ++ old_chain = make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); ++ + proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1); ++ ++ if (target_can_async_p () && is_running (inferior_ptid)) ++ { ++ discard_cleanups (old_chain); ++ add_continuation (tp, until_next_continuation, tp, NULL); ++ } ++ else ++ do_cleanups (old_chain); + } + + static void +@@ -1421,6 +1447,7 @@ finish_command_continuation (void *arg) + if (bs != NULL && tp->proceed_to_finish) + observer_notify_normal_stop (bs, 1 /* print frame */); + delete_breakpoint (a->breakpoint); ++ delete_longjmp_breakpoint (inferior_thread ()->num); + } + + static void +@@ -1504,6 +1531,7 @@ finish_forward (struct symbol *function, struct frame_info *frame) + struct breakpoint *breakpoint; + struct cleanup *old_chain; + struct finish_command_continuation_args *cargs; ++ int thread = tp->num; + + sal = find_pc_line (get_frame_pc (frame), 0); + sal.pc = get_frame_pc (frame); +@@ -1514,6 +1542,10 @@ finish_forward (struct symbol *function, struct frame_info *frame) + + old_chain = make_cleanup_delete_breakpoint (breakpoint); + ++ set_longjmp_breakpoint (thread); ++ tp->initiating_frame = get_frame_id (frame); ++ make_cleanup (delete_longjmp_breakpoint_cleanup, &thread); ++ + tp->proceed_to_finish = 1; /* We want stop_registers, please... */ + proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0); + +diff --git a/gdb/inferior.h b/gdb/inferior.h +index f1b5d17..31add7d 100644 +--- a/gdb/inferior.h ++++ b/gdb/inferior.h +@@ -272,6 +272,8 @@ extern void interrupt_target_command (char *args, int from_tty); + + extern void interrupt_target_1 (int all_threads); + ++extern void delete_longjmp_breakpoint_cleanup (void *arg); ++ + extern void detach_command (char *, int); + + extern void notice_new_inferior (ptid_t, int, int); +diff --git a/gdb/infrun.c b/gdb/infrun.c +index 1a83a25..2ee2164 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -45,6 +45,8 @@ + #include "language.h" + #include "solib.h" + #include "main.h" ++#include "dictionary.h" ++#include "block.h" + #include "gdb_assert.h" + #include "mi/mi-common.h" + #include "event-top.h" +@@ -1782,6 +1784,8 @@ static void insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch, + struct symtab_and_line sr_sal, + struct frame_id sr_id); + static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR); ++static void check_exception_resume (struct execution_control_state *, ++ struct frame_info *, struct symbol *); + + static void stop_stepping (struct execution_control_state *ecs); + static void prepare_to_wait (struct execution_control_state *ecs); +@@ -2687,6 +2691,10 @@ handle_inferior_event (struct execution_control_state *ecs) + + stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); + ++ /* Clear WATCHPOINT_TRIGGERED values from previous stop which could ++ confuse bpstat_stop_status and bpstat_explains_signal. */ ++ watchpoints_triggered (&ecs->ws); ++ + ecs->event_thread->stop_bpstat = bpstat_stop_status (stop_pc, ecs->ptid); + + ecs->random_signal = !bpstat_explains_signal (ecs->event_thread->stop_bpstat); +@@ -2724,6 +2732,10 @@ handle_inferior_event (struct execution_control_state *ecs) + + stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); + ++ /* Clear WATCHPOINT_TRIGGERED values from previous stop which could ++ confuse bpstat_stop_status and bpstat_explains_signal. */ ++ watchpoints_triggered (&ecs->ws); ++ + /* This causes the eventpoints and symbol table to be reset. + Must do this now, before trying to determine whether to + stop. */ +@@ -3468,23 +3480,33 @@ process_event_stop_test: + + ecs->event_thread->stepping_over_breakpoint = 1; + +- if (!gdbarch_get_longjmp_target_p (gdbarch) +- || !gdbarch_get_longjmp_target (gdbarch, frame, &jmp_buf_pc)) ++ if (what.is_longjmp) + { +- if (debug_infrun) +- fprintf_unfiltered (gdb_stdlog, "\ ++ if (!gdbarch_get_longjmp_target_p (gdbarch) ++ || !gdbarch_get_longjmp_target (gdbarch, ++ frame, &jmp_buf_pc)) ++ { ++ if (debug_infrun) ++ fprintf_unfiltered (gdb_stdlog, "\ + infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); +- keep_going (ecs); +- return; +- } ++ keep_going (ecs); ++ return; ++ } + +- /* We're going to replace the current step-resume breakpoint +- with a longjmp-resume breakpoint. */ +- delete_step_resume_breakpoint (ecs->event_thread); ++ /* We're going to replace the current step-resume breakpoint ++ with a longjmp-resume breakpoint. */ ++ delete_step_resume_breakpoint (ecs->event_thread); + +- /* Insert a breakpoint at resume address. */ +- insert_longjmp_resume_breakpoint (gdbarch, jmp_buf_pc); ++ /* Insert a breakpoint at resume address. */ ++ insert_longjmp_resume_breakpoint (gdbarch, jmp_buf_pc); ++ } ++ else ++ { ++ struct symbol *func = get_frame_function (frame); + ++ if (func) ++ check_exception_resume (ecs, frame, func); ++ } + keep_going (ecs); + return; + +@@ -3496,6 +3518,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); + gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); + delete_step_resume_breakpoint (ecs->event_thread); + ++ if (!what.is_longjmp) ++ { ++ /* There are several cases to consider. ++ ++ 1. The initiating frame no longer exists. In this case ++ we must stop, because the exception has gone too far. ++ ++ 2. The initiating frame exists, and is the same as the ++ current frame. ++ ++ 2.1. If we are stepping, defer to the stepping logic. ++ ++ 2.2. Otherwise, we are not stepping, so we are doing a ++ "finish" and we have reached the calling frame. So, ++ stop. ++ ++ 3. The initiating frame exists and is different from ++ the current frame. This means the exception has been ++ caught beneath the initiating frame, so keep going. */ ++ struct frame_info *init_frame ++ = frame_find_by_id (ecs->event_thread->initiating_frame); ++ if (init_frame) ++ { ++ struct frame_id current_id ++ = get_frame_id (get_current_frame ()); ++ if (frame_id_eq (current_id, ++ ecs->event_thread->initiating_frame)) ++ { ++ if (ecs->event_thread->step_range_start) ++ { ++ /* Case 2.1. */ ++ break; ++ } ++ else ++ { ++ /* Case 2.2: fall through. */ ++ } ++ } ++ else ++ { ++ /* Case 3. */ ++ keep_going (ecs); ++ return; ++ } ++ } ++ } ++ + ecs->event_thread->stop_step = 1; + print_stop_reason (END_STEPPING_RANGE, 0); + stop_stepping (ecs); +@@ -4500,6 +4569,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) + set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); + } + ++/* Insert an exception resume breakpoint. TP is the thread throwing ++ the exception. The block B is the block of the unwinder debug hook ++ function. FRAME is the frame corresponding to the call to this ++ function. SYM is the symbol of the function argument holding the ++ target PC of the exception. */ ++ ++static void ++insert_exception_resume_breakpoint (struct thread_info *tp, ++ struct block *b, ++ struct frame_info *frame, ++ struct symbol *sym) ++{ ++ struct gdb_exception e; ++ ++ /* We want to ignore errors here. */ ++ TRY_CATCH (e, RETURN_MASK_ALL) ++ { ++ struct symbol *vsym; ++ struct value *value; ++ CORE_ADDR handler; ++ struct breakpoint *bp; ++ ++ vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL); ++ value = read_var_value (vsym, frame); ++ handler = value_as_address (value); ++ ++ /* We're going to replace the current step-resume breakpoint ++ with an exception-resume breakpoint. */ ++ delete_step_resume_breakpoint (tp); ++ ++ if (debug_infrun) ++ fprintf_unfiltered (gdb_stdlog, ++ "infrun: exception resume at %lx\n", ++ (unsigned long) handler); ++ ++ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), ++ handler, bp_exception_resume); ++ inferior_thread ()->step_resume_breakpoint = bp; ++ } ++} ++ ++/* This is called when an exception has been intercepted. Check to ++ see whether the exception's destination is of interest, and if so, ++ set an exception resume breakpoint there. */ ++ ++static void ++check_exception_resume (struct execution_control_state *ecs, ++ struct frame_info *frame, struct symbol *func) ++{ ++ struct gdb_exception e; ++ ++ TRY_CATCH (e, RETURN_MASK_ALL) ++ { ++ struct block *b; ++ struct dict_iterator iter; ++ struct symbol *sym; ++ int argno = 0; ++ ++ /* The exception breakpoint is a thread-specific breakpoint on ++ the unwinder's debug hook, declared as: ++ ++ void _Unwind_DebugHook (void *cfa, void *handler); ++ ++ The CFA argument indicates the frame to which control is ++ about to be transferred. HANDLER is the destination PC. ++ ++ We ignore the CFA and set a temporary breakpoint at HANDLER. ++ This is not extremely efficient but it avoids issues in gdb ++ with computing the DWARF CFA, and it also works even in weird ++ cases such as throwing an exception from inside a signal ++ handler. */ ++ ++ b = SYMBOL_BLOCK_VALUE (func); ++ ALL_BLOCK_SYMBOLS (b, iter, sym) ++ { ++ if (!SYMBOL_IS_ARGUMENT (sym)) ++ continue; ++ ++ if (argno == 0) ++ ++argno; ++ else ++ { ++ insert_exception_resume_breakpoint (ecs->event_thread, ++ b, frame, sym); ++ break; ++ } ++ } ++ } ++} ++ + static void + stop_stepping (struct execution_control_state *ecs) + { +@@ -4568,6 +4727,8 @@ keep_going (struct execution_control_state *ecs) + } + if (e.reason < 0) + { ++ if (debug_infrun) ++ exception_fprintf (gdb_stdlog, e, "infrun: exception while inserting breakpoints: "); + stop_stepping (ecs); + return; + } diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 6b68e7d..5095180 100644 --- a/gdb/jv-lang.c @@ -9927,7 +11526,7 @@ index 6b68e7d..5095180 100644 dump_subexp_body_standard, evaluate_subexp_java diff --git a/gdb/language.h b/gdb/language.h -index ba37faa..a8e41d2 100644 +index c650e07..660fdf6 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -237,7 +237,6 @@ struct language_defn @@ -9939,7 +11538,7 @@ index ba37faa..a8e41d2 100644 const domain_enum); diff --git a/gdb/linespec.c b/gdb/linespec.c -index debe86f..e17a0b6 100644 +index 3e943a1..3b8956c 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -30,6 +30,7 @@ @@ -9950,7 +11549,7 @@ index debe86f..e17a0b6 100644 #include "parser-defs.h" #include "block.h" #include "objc-lang.h" -@@ -840,13 +841,33 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, +@@ -839,13 +840,33 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab, } else if (paren_pointer != NULL) { @@ -9985,7 +11584,7 @@ index debe86f..e17a0b6 100644 /* Keep any template parameters */ if (*p == '<') p = find_template_name_end (p); -@@ -1258,7 +1279,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, +@@ -1257,7 +1278,10 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, /* Move pointer ahead to next double-colon. */ while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')) { @@ -9997,7 +11596,7 @@ index debe86f..e17a0b6 100644 { temp_end = find_template_name_end (p); if (!temp_end) -@@ -1335,6 +1359,16 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, +@@ -1334,6 +1358,16 @@ decode_compound (char **argptr, int funfirstline, char ***canonical, while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':') p++; /* At this point p->"". String ended. */ @@ -10014,7 +11613,7 @@ index debe86f..e17a0b6 100644 } /* Allocate our own copy of the substring between argptr and -@@ -1408,6 +1442,7 @@ lookup_prefix_sym (char **argptr, char *p) +@@ -1407,6 +1441,7 @@ lookup_prefix_sym (char **argptr, char *p) { char *p1; char *copy; @@ -10022,7 +11621,7 @@ index debe86f..e17a0b6 100644 /* Extract the class name. */ p1 = p; -@@ -1426,7 +1461,26 @@ lookup_prefix_sym (char **argptr, char *p) +@@ -1425,7 +1460,26 @@ lookup_prefix_sym (char **argptr, char *p) /* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA", argptr->"inA::fun" */ @@ -10050,7 +11649,7 @@ index debe86f..e17a0b6 100644 } /* This finds the method COPY in the class whose type is T and whose -@@ -1781,7 +1835,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy, +@@ -1780,7 +1834,7 @@ symbol_found (int funfirstline, char ***canonical, char *copy, { struct blockvector *bv = BLOCKVECTOR (SYMBOL_SYMTAB (sym)); struct block *b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); @@ -10059,6 +11658,159 @@ index debe86f..e17a0b6 100644 build_canonical_line_spec (values.sals, copy, canonical); } return values; +diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c +index 98f6347..0907f03 100644 +--- a/gdb/linux-nat.c ++++ b/gdb/linux-nat.c +@@ -1710,6 +1710,7 @@ resume_callback (struct lwp_info *lp, void *data) + lp->stopped = 0; + lp->step = 0; + memset (&lp->siginfo, 0, sizeof (lp->siginfo)); ++ lp->watchpoint_hit_set = 0; + } + else if (lp->stopped && debug_linux_nat) + fprintf_unfiltered (gdb_stdlog, "RC: Not resuming sibling %s (has pending)\n", +@@ -1847,6 +1848,7 @@ linux_nat_resume (struct target_ops *ops, + + linux_ops->to_resume (linux_ops, ptid, step, signo); + memset (&lp->siginfo, 0, sizeof (lp->siginfo)); ++ lp->watchpoint_hit_set = 0; + + if (debug_linux_nat) + fprintf_unfiltered (gdb_stdlog, +@@ -2286,6 +2288,78 @@ maybe_clear_ignore_sigint (struct lwp_info *lp) + } + } + ++/* Fetch the possible triggered data watchpoint info and store it to LP. ++ The hardware data watchpoint trigger gets cleared during this fetch. */ ++ ++static void ++save_sigtrap (struct lwp_info *lp) ++{ ++ struct cleanup *old_chain; ++ ++ /* linux_nat_stopped_data_address is not even installed in this case. */ ++ if (linux_ops->to_stopped_data_address == NULL) ++ return; ++ ++ old_chain = save_inferior_ptid (); ++ inferior_ptid = lp->ptid; ++ ++ lp->watchpoint_hit_set = ++ linux_ops->to_stopped_data_address (¤t_target, &lp->watchpoint_hit); ++ ++ do_cleanups (old_chain); ++} ++ ++/* Wrap target_stopped_data_address where the GNU/Linux native target may be ++ directed by the watchpoint/debug register number. Base the reported value ++ on the triggered data address instead. During inferior stop the assignment ++ of watchpoint/debug registers may change making the register number specific ++ trigger info stale. */ ++ ++static int ++linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) ++{ ++ struct lwp_info *lp = find_lwp_pid (inferior_ptid); ++ ++ gdb_assert (lp != NULL); ++ ++ *addr_p = lp->watchpoint_hit; ++ ++ return lp->watchpoint_hit_set; ++} ++ ++/* In `set follow-fork-mode child' with multithreaded parent we need to detach ++ watchpoints from all the LWPs. In such case INFERIOR_PTID will be the ++ non-threaded new child while LWP_LIST will still contain all the threads of ++ the parent being detached. */ ++ ++static int ++linux_nat_detach_watchpoints (void) ++{ ++ struct lwp_info *lp; ++ int found = 0, retval = 0; ++ ptid_t filter = pid_to_ptid (ptid_get_pid (inferior_ptid)); ++ struct cleanup *old_chain = save_inferior_ptid (); ++ ++ for (lp = lwp_list; lp; lp = lp->next) ++ if (ptid_match (lp->ptid, filter)) ++ { ++ inferior_ptid = lp->ptid; ++ retval |= linux_ops->to_detach_watchpoints (); ++ found = 1; ++ } ++ ++ do_cleanups (old_chain); ++ ++ if (!found) ++ { ++ gdb_assert (!is_lwp (inferior_ptid)); ++ ++ retval |= linux_ops->to_detach_watchpoints (); ++ } ++ ++ return retval; ++} ++ + /* Wait until LP is stopped. */ + + static int +@@ -2337,6 +2411,8 @@ stop_wait_callback (struct lwp_info *lp, void *data) + /* Save the trap's siginfo in case we need it later. */ + save_siginfo (lp); + ++ save_sigtrap (lp); ++ + /* Now resume this LWP and get the SIGSTOP event. */ + errno = 0; + ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); +@@ -2701,10 +2777,14 @@ linux_nat_filter_event (int lwpid, int status, int options) + add_thread (lp->ptid); + } + +- /* Save the trap's siginfo in case we need it later. */ + if (WIFSTOPPED (status) + && (WSTOPSIG (status) == SIGTRAP || WSTOPSIG (status) == TRAP_IS_SYSCALL)) +- save_siginfo (lp); ++ { ++ /* Save the trap's siginfo in case we need it later. */ ++ save_siginfo (lp); ++ ++ save_sigtrap (lp); ++ } + + /* Handle GNU/Linux's extended waitstatus for trace events. + It is necessary to check if WSTOPSIG is signaling that +@@ -4999,6 +5079,10 @@ linux_nat_add_target (struct target_ops *t) + t->to_thread_alive = linux_nat_thread_alive; + t->to_pid_to_str = linux_nat_pid_to_str; + t->to_has_thread_control = tc_schedlock; ++ if (linux_ops->to_stopped_data_address) ++ t->to_stopped_data_address = linux_nat_stopped_data_address; ++ if (linux_ops->to_detach_watchpoints) ++ t->to_detach_watchpoints = linux_nat_detach_watchpoints; + + t->to_can_async_p = linux_nat_can_async_p; + t->to_is_async_p = linux_nat_is_async_p; +diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h +index eae74f3..73204fc 100644 +--- a/gdb/linux-nat.h ++++ b/gdb/linux-nat.h +@@ -62,6 +62,12 @@ struct lwp_info + be the address of a hardware watchpoint. */ + struct siginfo siginfo; + ++ /* WATCHPOINT_HIT_SET is non-zero if this LWP stopped with a trap and a data ++ watchpoint has been found as triggered. In such case WATCHPOINT_HIT ++ contains data address of the triggered data watchpoint. */ ++ unsigned watchpoint_hit_set : 1; ++ CORE_ADDR watchpoint_hit; ++ + /* Non-zero if we expect a duplicated SIGINT. */ + int ignore_sigint; + diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 88c7e5e..2d0b3ca 100644 --- a/gdb/m2-lang.c @@ -10084,7 +11836,7 @@ index 5f9a0fe..66fa067 100644 macho_symfile_offsets, /* sym_offsets: xlate external to internal form */ NULL /* next: pointer to next struct sym_fns */ diff --git a/gdb/main.c b/gdb/main.c -index 8b66f78..ddeab6f 100644 +index 55411a8..ac9a540 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -40,6 +40,7 @@ @@ -10265,94 +12017,10 @@ index aac82e9..626292c 100644 TYPE_CPLUS_SPECIFIC (t) = (struct cplus_struct_type *) &cplus_struct_default; return t; diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c -index 0cf03d9..1913c49 100644 +index 0baaa83..94ebfeb 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c -@@ -369,24 +369,35 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) - struct varobj *var; - VEC(varobj_p) *children; - struct varobj *child; -- struct cleanup *cleanup_children; - int numchild; - enum print_values print_values; - int ix; -+ int from, to; - char *display_hint; - -- if (argc != 1 && argc != 2) -- error (_("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME")); -+ if (argc < 1 || argc > 4) -+ error (_("mi_cmd_var_list_children: Usage: [PRINT_VALUES] NAME [FROM TO]")); - - /* Get varobj handle, if a valid var obj name was specified */ -- if (argc == 1) -+ if (argc == 1 || argc == 3) - var = varobj_get_handle (argv[0]); - else - var = varobj_get_handle (argv[1]); - -- children = varobj_list_children (var); -+ if (argc > 2) -+ { -+ from = atoi (argv[argc - 2]); -+ to = atoi (argv[argc - 1]); -+ } -+ else -+ { -+ from = -1; -+ to = -1; -+ } -+ -+ children = varobj_list_children (var, &from, &to); - ui_out_field_int (uiout, "numchild", VEC_length (varobj_p, children)); -- if (argc == 2) -+ if (argc == 2 || argc == 4) - print_values = mi_parse_values_option (argv[0]); - else - print_values = PRINT_NO_VALUES; -@@ -398,21 +409,28 @@ mi_cmd_var_list_children (char *command, char **argv, int argc) - xfree (display_hint); - } - -- if (VEC_length (varobj_p, children) == 0) -- return; -- -- if (mi_version (uiout) == 1) -- cleanup_children = make_cleanup_ui_out_tuple_begin_end (uiout, "children"); -- else -- cleanup_children = make_cleanup_ui_out_list_begin_end (uiout, "children"); -- for (ix = 0; VEC_iterate (varobj_p, children, ix, child); ++ix) -+ if (from < to) - { -- struct cleanup *cleanup_child; -- cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child"); -- print_varobj (child, print_values, 1 /* print expression */); -- do_cleanups (cleanup_child); -+ struct cleanup *cleanup_children; -+ if (mi_version (uiout) == 1) -+ cleanup_children -+ = make_cleanup_ui_out_tuple_begin_end (uiout, "children"); -+ else -+ cleanup_children -+ = make_cleanup_ui_out_list_begin_end (uiout, "children"); -+ for (ix = from; -+ ix < to && VEC_iterate (varobj_p, children, ix, child); -+ ++ix) -+ { -+ struct cleanup *cleanup_child; -+ cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child"); -+ print_varobj (child, print_values, 1 /* print expression */); -+ do_cleanups (cleanup_child); -+ } -+ do_cleanups (cleanup_children); - } -- do_cleanups (cleanup_children); -+ -+ ui_out_field_int (uiout, "has_more", varobj_has_more (var, to)); - } - - void -@@ -644,7 +662,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) +@@ -697,7 +697,6 @@ mi_cmd_var_update (char *command, char **argv, int argc) } else { @@ -10360,146 +12028,19 @@ index 0cf03d9..1913c49 100644 struct varobj *var = varobj_get_handle (name); varobj_update_one (var, print_values, 1 /* explicit */); -@@ -699,11 +716,11 @@ varobj_update_one (struct varobj *var, enum print_values print_values, - } - - if (r->type_changed) -- { -- ui_out_field_string (uiout, "new_type", varobj_get_type (r->varobj)); -- ui_out_field_int (uiout, "new_num_children", -- varobj_get_num_children (r->varobj)); -- } -+ ui_out_field_string (uiout, "new_type", varobj_get_type (r->varobj)); -+ -+ if (r->type_changed || r->children_changed) -+ ui_out_field_int (uiout, "new_num_children", -+ varobj_get_num_children (r->varobj)); - - display_hint = varobj_get_display_hint (var); - if (display_hint) -@@ -714,26 +731,58 @@ varobj_update_one (struct varobj *var, enum print_values print_values, - - if (r->children_changed) - { -- int ix; -- struct varobj *child; -- struct cleanup *cleanup = -- make_cleanup_ui_out_list_begin_end (uiout, "children"); -+ int from, to; -+ varobj_get_child_range (r->varobj, &from, &to); -+ ui_out_field_int (uiout, "has_more", -+ varobj_has_more (r->varobj, to)); -+ } - -- VEC (varobj_p)* children = varobj_list_children (r->varobj); -+ if (r->new) -+ { -+ int j; -+ varobj_p child; -+ struct cleanup *cleanup; - -- for (ix = 0; VEC_iterate (varobj_p, children, ix, child); ++ix) -+ cleanup = make_cleanup_ui_out_list_begin_end (uiout, "new_children"); -+ for (j = 0; VEC_iterate (varobj_p, r->new, j, child); ++j) - { - struct cleanup *cleanup_child; - cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); -- print_varobj (child, print_values, 1 /* print expression */); -+ print_varobj (child, print_values, 1 /* print_expression */); - do_cleanups (cleanup_child); - } - - do_cleanups (cleanup); -+ VEC_free (varobj_p, r->new); -+ r->new = NULL; /* Paranoia. */ - } -- -+ - if (mi_version (uiout) > 1) - do_cleanups (cleanup); - } - VEC_free (varobj_update_result, changes); - } -+ -+void -+mi_cmd_enable_pretty_printing (char *command, char **argv, int argc) -+{ -+ if (argc != 0) -+ error (_("mi_cmd_enable_pretty_printing: no arguments allowed")); -+ varobj_enable_pretty_printing (); -+} -+ -+void -+mi_cmd_var_set_update_range (char *command, char **argv, int argc) -+{ -+ struct varobj *var; -+ int from, to; -+ -+ if (argc != 3) -+ error (_("mi_cmd_var_set_update_range: Usage: VAROBJ FROM TO")); -+ -+ var = varobj_get_handle (argv[0]); -+ from = atoi (argv[1]); -+ to = atoi (argv[2]); -+ -+ varobj_set_child_range (var, from, to); -+} -diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c -index dd3d803..8ba086c 100644 ---- a/gdb/mi/mi-cmds.c -+++ b/gdb/mi/mi-cmds.c -@@ -52,6 +52,7 @@ struct mi_cmd mi_cmds[] = - { "data-write-memory", { NULL, 0 }, mi_cmd_data_write_memory}, - { "data-write-register-values", { NULL, 0 }, mi_cmd_data_write_register_values}, - { "enable-timings", { NULL, 0 }, mi_cmd_enable_timings}, -+ { "enable-pretty-printing", { NULL, 0 }, mi_cmd_enable_pretty_printing}, - { "environment-cd", { NULL, 0 }, mi_cmd_env_cd}, - { "environment-directory", { NULL, 0 }, mi_cmd_env_dir}, - { "environment-path", { NULL, 0 }, mi_cmd_env_path}, -@@ -112,6 +113,7 @@ struct mi_cmd mi_cmds[] = - { "var-list-children", { NULL, 0 }, mi_cmd_var_list_children}, - { "var-set-format", { NULL, 0 }, mi_cmd_var_set_format}, - { "var-set-frozen", { NULL, 0 }, mi_cmd_var_set_frozen}, -+ { "var-set-update-range", { NULL, 0 }, mi_cmd_var_set_update_range }, - { "var-set-visualizer", { NULL, 0 }, mi_cmd_var_set_visualizer}, - { "var-show-attributes", { NULL, 0 }, mi_cmd_var_show_attributes}, - { "var-show-format", { NULL, 0 }, mi_cmd_var_show_format}, -diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h -index 85ad0c4..dfab411 100644 ---- a/gdb/mi/mi-cmds.h -+++ b/gdb/mi/mi-cmds.h -@@ -99,6 +99,8 @@ extern mi_cmd_argv_ftype mi_cmd_var_set_visualizer; - extern mi_cmd_argv_ftype mi_cmd_var_show_attributes; - extern mi_cmd_argv_ftype mi_cmd_var_show_format; - extern mi_cmd_argv_ftype mi_cmd_var_update; -+extern mi_cmd_argv_ftype mi_cmd_enable_pretty_printing; -+extern mi_cmd_argv_ftype mi_cmd_var_set_update_range; - - /* Description of a single command. */ - diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c -index 6aa1d08..448d10a 100644 +index 857a5d5..6181002 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c -@@ -1130,6 +1130,10 @@ mi_cmd_list_features (char *command, char **argv, int argc) +@@ -1130,7 +1130,7 @@ mi_cmd_list_features (char *command, char **argv, int argc) ui_out_field_string (uiout, NULL, "frozen-varobjs"); ui_out_field_string (uiout, NULL, "pending-breakpoints"); ui_out_field_string (uiout, NULL, "thread-info"); +- + -+#if HAVE_PYTHON -+ ui_out_field_string (uiout, NULL, "python"); -+#endif - #if HAVE_PYTHON ui_out_field_string (uiout, NULL, "python"); -@@ -1354,6 +1358,7 @@ mi_cmd_execute (struct mi_parse *parse) - int i; - - free_all_values (); -+ free_all_types (); - cleanup = make_cleanup (null_cleanup, NULL); - - if (parse->frame != -1 && parse->thread == -1) + #endif diff --git a/gdb/mipsread.c b/gdb/mipsread.c index a84003f..924c1c5 100644 --- a/gdb/mipsread.c @@ -10513,43 +12054,12 @@ index a84003f..924c1c5 100644 default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */ default_symfile_segments, /* sym_segments: Get segment information from diff --git a/gdb/objfiles.c b/gdb/objfiles.c -index 586f5d0..a4bf719 100644 +index 8dcca70..4b25a5a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c -@@ -432,10 +432,9 @@ free_objfile (struct objfile *objfile) - doesn't reference it. */ - objfile->separate_debug_objfile_backlink->separate_debug_objfile = NULL; - } -- -- /* Remove any references to this objfile in the global value -- lists. */ -- preserve_values (objfile); -+ -+ /* Remove any references to this objfile in the global value lists. */ -+ observer_notify_objfile_unloading (objfile); - - /* First do any symbol file specific actions required when we are - finished with a particular symbol file. Note that if the objfile -@@ -458,12 +457,14 @@ free_objfile (struct objfile *objfile) - - unlink_objfile (objfile); - -- /* If we are going to free the runtime common objfile, mark it -- as unallocated. */ -+ /* If we are going to free any existing OBJFILE reference, clear it. */ - - if (objfile == rt_common_objfile) - rt_common_objfile = NULL; - -+ if (objfile == symfile_objfile) -+ symfile_objfile = NULL; -+ - /* Before the symbol table code was redone to make it easier to - selectively load and remove information particular to a specific - linkage unit, gdb used to do these things whenever the monolithic -@@ -714,6 +715,20 @@ have_partial_symbols (void) - return 1; - } +@@ -731,6 +731,20 @@ have_partial_symbols (void) + if (objfile_has_partial_symbols (ofp)) + return 1; } + + /* Try again, after reading partial symbols. We do this in two @@ -10569,7 +12079,7 @@ index 586f5d0..a4bf719 100644 } diff --git a/gdb/objfiles.h b/gdb/objfiles.h -index aecf8d8..9a7d635 100644 +index 62fa498..1fc9c6a 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -212,6 +212,11 @@ struct objfile @@ -10600,7 +12110,7 @@ index aecf8d8..9a7d635 100644 /* The object file that the main symbol table was loaded from (e.g. the argument to the "symbol-file" or "file" command). */ -@@ -554,6 +568,13 @@ extern void gdb_bfd_unref (struct bfd *abfd); +@@ -568,6 +582,13 @@ extern void gdb_bfd_unref (struct bfd *abfd); ALL_OBJFILES (objfile) \ ALL_OBJFILE_PSYMTABS (objfile, p) @@ -10841,8 +12351,45 @@ index cbda9c3..a07e6f2 100644 +extern void exp_types_mark_used (struct expression *exp); + #endif /* PARSER_DEFS_H */ +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c +index 47b74ad..22fb2fc 100644 +--- a/gdb/ppc-linux-nat.c ++++ b/gdb/ppc-linux-nat.c +@@ -1391,6 +1391,24 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) + return 0; + } + ++/* See target_detach_watchpoints. Do not use wrapper ++ ppc_linux_remove_watchpoint as it would modify the register cache ++ (saved_dabr_value). */ ++ ++static int ++ppc_linux_detach_watchpoints (void) ++{ ++ pid_t tid; ++ ++ tid = TIDGET (inferior_ptid); ++ if (tid == 0) ++ tid = PIDGET (inferior_ptid); ++ ++ if (ptrace (PTRACE_SET_DEBUGREG, tid, NULL, NULL) < 0) ++ return -1; ++ return 0; ++} ++ + static void + ppc_linux_new_thread (ptid_t ptid) + { +@@ -1648,6 +1666,7 @@ _initialize_ppc_linux_nat (void) + t->to_region_ok_for_hw_watchpoint = ppc_linux_region_ok_for_hw_watchpoint; + t->to_insert_watchpoint = ppc_linux_insert_watchpoint; + t->to_remove_watchpoint = ppc_linux_remove_watchpoint; ++ t->to_detach_watchpoints = ppc_linux_detach_watchpoints; + t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint; + t->to_stopped_data_address = ppc_linux_stopped_data_address; + t->to_watchpoint_addr_within_range = ppc_linux_watchpoint_addr_within_range; diff --git a/gdb/printcmd.c b/gdb/printcmd.c -index 5d8b936..49c575d 100644 +index 5d8b936..fb0a455 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -46,7 +46,6 @@ @@ -10939,13 +12486,11 @@ index 5d8b936..49c575d 100644 /* display_chain items point to blocks and expressions. Some expressions in turn may point to symbols. Both symbols and blocks are obstack_alloc'd on objfile_stack, and are -@@ -1851,20 +1827,18 @@ display_uses_solib_p (const struct display *d, - an item by re-parsing .exp_string field in the new execution context. */ - +@@ -1853,18 +1829,20 @@ display_uses_solib_p (const struct display *d, static void --clear_dangling_display_expressions (struct so_list *solib) -+clear_dangling_display_expressions (struct objfile *objfile) + clear_dangling_display_expressions (struct so_list *solib) { ++ struct objfile *objfile = solib->objfile; struct display *d; - struct objfile *objfile = NULL; @@ -10958,6 +12503,9 @@ index 5d8b936..49c575d 100644 - d->block = NULL; - } - } ++ if (objfile == NULL) ++ return; ++ + for (d = display_chain; d != NULL; d = d->next) + if (block_objfile (d->block) == objfile + || (d->exp && exp_uses_objfile (d->exp, objfile))) @@ -10969,16 +12517,7 @@ index 5d8b936..49c575d 100644 } -@@ -2593,7 +2567,7 @@ _initialize_printcmd (void) - - current_display_number = -1; - -- observer_attach_solib_unloaded (clear_dangling_display_expressions); -+ observer_attach_objfile_unloading (clear_dangling_display_expressions); - - add_info ("address", address_info, - _("Describe where symbol SYM is stored.")); -@@ -2749,4 +2723,6 @@ Show printing of source filename and line number with ."), NULL, +@@ -2749,4 +2727,6 @@ Show printing of source filename and line number with ."), NULL, NULL, show_print_symbol_filename, &setprintlist, &showprintlist); @@ -11916,11 +13455,11 @@ index 0000000..debb3bb + return wanted == found + +InScope () -diff --git a/gdb/python/python-block.c b/gdb/python/python-block.c +diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c new file mode 100644 index 0000000..8019e9d --- /dev/null -+++ b/gdb/python/python-block.c ++++ b/gdb/python/py-block.c @@ -0,0 +1,265 @@ +/* Python interface to blocks. + @@ -12187,11 +13726,11 @@ index 0000000..8019e9d + blpy_block_syms_iternext, /* tp_iternext */ + 0 /* tp_methods */ +}; -diff --git a/gdb/python/python-breakpoint.c b/gdb/python/python-breakpoint.c +diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c new file mode 100644 index 0000000..afa9526 --- /dev/null -+++ b/gdb/python/python-breakpoint.c ++++ b/gdb/python/py-breakpoint.c @@ -0,0 +1,665 @@ +/* Python interface to breakpoints + @@ -12858,10 +14397,10 @@ index 0000000..afa9526 + 0, /* tp_members */ + breakpoint_object_getset /* tp_getset */ +}; -diff --git a/gdb/python/python-cmd.c b/gdb/python/python-cmd.c +diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 528aca6..04b3fd1 100644 ---- a/gdb/python/python-cmd.c -+++ b/gdb/python/python-cmd.c +--- a/gdb/python/py-cmd.c ++++ b/gdb/python/py-cmd.c @@ -49,8 +49,7 @@ static struct cmdpy_completer completers[] = #define N_COMPLETERS (sizeof (completers) / sizeof (completers[0])) @@ -12923,11 +14462,11 @@ index 528aca6..04b3fd1 100644 if (! cmd_name) return -1; -diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c -index a97009f..3d2f61f 100644 ---- a/gdb/python/python-frame.c -+++ b/gdb/python/python-frame.c -@@ -203,10 +203,59 @@ frapy_pc (PyObject *self, PyObject *args) +diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c +index 279415c..5d8ce0a 100644 +--- a/gdb/python/py-frame.c ++++ b/gdb/python/py-frame.c +@@ -202,10 +202,59 @@ frapy_pc (PyObject *self, PyObject *args) return PyLong_FromUnsignedLongLong (pc); } @@ -12988,7 +14527,7 @@ index a97009f..3d2f61f 100644 frame_info_to_frame_object (struct frame_info *frame) { frame_object *frame_obj; -@@ -236,7 +285,7 @@ frame_info_to_frame_object (struct frame_info *frame) +@@ -235,7 +284,7 @@ frame_info_to_frame_object (struct frame_info *frame) frame_obj->gdbarch = get_frame_arch (frame); @@ -12997,7 +14536,7 @@ index a97009f..3d2f61f 100644 } /* Implementation of gdb.Frame.older (self) -> gdb.Frame. -@@ -297,7 +346,30 @@ frapy_newer (PyObject *self, PyObject *args) +@@ -296,7 +345,30 @@ frapy_newer (PyObject *self, PyObject *args) return next_obj; } @@ -13029,7 +14568,7 @@ index a97009f..3d2f61f 100644 Returns the value of the given variable in this frame. The argument must be a string. Returns None if GDB can't find the specified variable. */ -@@ -313,7 +385,9 @@ frapy_read_var (PyObject *self, PyObject *args) +@@ -312,7 +384,9 @@ frapy_read_var (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "O", &sym_obj)) return NULL; @@ -13040,7 +14579,7 @@ index a97009f..3d2f61f 100644 { char *var_name; struct block *block = NULL; -@@ -366,6 +440,25 @@ frapy_read_var (PyObject *self, PyObject *args) +@@ -365,6 +439,25 @@ frapy_read_var (PyObject *self, PyObject *args) Py_RETURN_NONE; } @@ -13066,7 +14605,7 @@ index a97009f..3d2f61f 100644 /* Implementation of gdb.selected_frame () -> gdb.Frame. Returns the selected frame object. */ -@@ -373,7 +466,7 @@ PyObject * +@@ -372,7 +465,7 @@ PyObject * gdbpy_selected_frame (PyObject *self, PyObject *args) { struct frame_info *frame; @@ -13075,7 +14614,7 @@ index a97009f..3d2f61f 100644 volatile struct gdb_exception except; TRY_CATCH (except, RETURN_MASK_ALL) -@@ -383,7 +476,7 @@ gdbpy_selected_frame (PyObject *self, PyObject *args) +@@ -382,7 +475,7 @@ gdbpy_selected_frame (PyObject *self, PyObject *args) } GDB_PY_HANDLE_EXCEPTION (except); @@ -13084,7 +14623,7 @@ index a97009f..3d2f61f 100644 } /* Implementation of gdb.stop_reason_string (Integer) -> String. -@@ -485,15 +578,26 @@ Return the reason why it's not possible to find frames older than this." }, +@@ -484,15 +577,26 @@ Return the reason why it's not possible to find frames older than this." }, { "pc", frapy_pc, METH_NOARGS, "pc () -> Long.\n\ Return the frame's resume address." }, @@ -13111,11 +14650,11 @@ index a97009f..3d2f61f 100644 {NULL} /* Sentinel */ }; -diff --git a/gdb/python/python-hooks.c b/gdb/python/python-hooks.c +diff --git a/gdb/python/py-hooks.c b/gdb/python/py-hooks.c new file mode 100644 index 0000000..a3140bc --- /dev/null -+++ b/gdb/python/python-hooks.c ++++ b/gdb/python/py-hooks.c @@ -0,0 +1,50 @@ +/* Notifications from gdb to Python + @@ -13167,11 +14706,11 @@ index 0000000..a3140bc + Py_DECREF (hooks); + return result; +} -diff --git a/gdb/python/python-inferior.c b/gdb/python/python-inferior.c +diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c new file mode 100644 index 0000000..5e90cc2 --- /dev/null -+++ b/gdb/python/python-inferior.c ++++ b/gdb/python/py-inferior.c @@ -0,0 +1,926 @@ +/* Python interface to inferiors. + @@ -14099,11 +15638,11 @@ index 0000000..5e90cc2 + 0, /* tp_alloc */ + PyType_GenericNew /* tp_new */ +}; -diff --git a/gdb/python/python-infthread.c b/gdb/python/python-infthread.c +diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c new file mode 100644 index 0000000..21e4eab --- /dev/null -+++ b/gdb/python/python-infthread.c ++++ b/gdb/python/py-infthread.c @@ -0,0 +1,285 @@ +/* Python interface to inferior threads. + @@ -14390,149 +15929,11 @@ index 0000000..21e4eab + 0, /* tp_init */ + 0 /* tp_alloc */ +}; -diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h -index 67a78af..47662d9 100644 ---- a/gdb/python/python-internal.h -+++ b/gdb/python/python-internal.h -@@ -61,33 +61,76 @@ typedef int Py_ssize_t; - #define PyEval_ReleaseLock() 0 - #endif - -+#include "command.h" -+ -+struct block; -+struct symbol; -+struct symtab_and_line; - struct value; - struct language_defn; - - extern PyObject *gdb_module; -+extern PyTypeObject block_object_type; - extern PyTypeObject value_object_type; -+extern PyTypeObject symbol_object_type; -+ -+/* Used in python-inferior.c. */ -+typedef struct -+{ -+ PyObject_HEAD -+ -+ /* The thread we represent. */ -+ struct thread_info *thread; -+ -+ /* The Inferior object to which this thread belongs. */ -+ PyObject *inf_obj; -+} thread_object; - - PyObject *gdbpy_history (PyObject *self, PyObject *args); -+PyObject *gdbpy_breakpoints (PyObject *, PyObject *); - PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *); -+PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw); - PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args); -+PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args); - PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw); -+PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2); -+PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args); - -+PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal); -+PyObject *symtab_to_symtab_object (struct symtab *symtab); -+PyObject *symbol_to_symbol_object (struct symbol *sym); -+PyObject *block_to_block_object (struct block *block); - PyObject *value_to_value_object (struct value *v); - PyObject *type_to_type_object (struct type *); - PyObject *objfile_to_objfile_object (struct objfile *); -+PyObject *frame_info_to_frame_object (struct frame_info *frame); -+thread_object *create_thread_object (struct thread_info *tp); -+thread_object *find_thread_object (ptid_t ptid); -+PyObject *find_inferior_object (int pid); - - PyObject *objfpy_get_printers (PyObject *, void *); - -+struct block *block_object_to_block (PyObject *obj); -+struct symbol *symbol_object_to_symbol (PyObject *obj); - struct value *value_object_to_value (PyObject *self); - struct value *convert_value_from_python (PyObject *obj); - struct type *type_object_to_type (PyObject *obj); - -+PyObject *gdbpy_get_hook_function (const char *); -+ - void gdbpy_initialize_values (void); -+void gdbpy_initialize_breakpoints (void); - void gdbpy_initialize_frames (void); -+void gdbpy_initialize_symtabs (void); - void gdbpy_initialize_commands (void); -+void gdbpy_initialize_symbols (void); - void gdbpy_initialize_types (void); -+void gdbpy_initialize_blocks (void); - void gdbpy_initialize_functions (void); - void gdbpy_initialize_objfile (void); -+void gdbpy_initialize_parameters (void); -+void gdbpy_initialize_thread (void); -+void gdbpy_initialize_inferior (void); - - struct cleanup *make_cleanup_py_decref (PyObject *py); - -@@ -97,6 +140,12 @@ struct cleanup *ensure_python_env (struct gdbarch *gdbarch, - extern struct gdbarch *python_gdbarch; - extern const struct language_defn *python_language; - -+char *gdbpy_parse_command_name (char *text, -+ struct cmd_list_element ***base_list, -+ struct cmd_list_element **start_list); -+ -+PyObject *gdbpy_parameter_value (enum var_types, void *); -+ - /* Use this after a TRY_EXCEPT to throw the appropriate Python - exception. */ - #define GDB_PY_HANDLE_EXCEPTION(Exception) \ -@@ -107,6 +156,19 @@ extern const struct language_defn *python_language; - "%s", Exception.message); \ - } while (0) - -+/* Use this after a TRY_EXCEPT to throw the appropriate Python -+ exception. This macro is for use inside setter functions. */ -+#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \ -+ do { \ -+ if (Exception.reason < 0) \ -+ { \ -+ PyErr_Format (Exception.reason == RETURN_QUIT \ -+ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \ -+ "%s", Exception.message); \ -+ return -1; \ -+ } \ -+ } while (0) -+ - - void gdbpy_print_stack (void); - -@@ -118,17 +180,22 @@ char *python_string_to_host_string (PyObject *obj); - PyObject *target_string_to_unicode (const gdb_byte *str, int length); - int gdbpy_is_string (PyObject *obj); - -+int gdbpy_is_value_object (PyObject *obj); -+ - /* Note that these are declared here, and not in python.h with the - other pretty-printer functions, because they refer to PyObject. */ - PyObject *apply_varobj_pretty_printer (PyObject *print_obj, - struct value **replacement); - PyObject *gdbpy_get_varobj_pretty_printer (struct value *value); -+PyObject *gdbpy_instantiate_printer (PyObject *cons, PyObject *value); - char *gdbpy_get_display_hint (PyObject *printer); - PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args); - --extern PyObject *gdbpy_doc_cst; - extern PyObject *gdbpy_children_cst; - extern PyObject *gdbpy_to_string_cst; - extern PyObject *gdbpy_display_hint_cst; -+extern PyObject *gdbpy_doc_cst; -+ -+int get_addr_from_python (PyObject *obj, CORE_ADDR *addr); - - #endif /* GDB_PYTHON_INTERNAL_H */ -diff --git a/gdb/python/python-membuf.c b/gdb/python/python-membuf.c +diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c new file mode 100644 index 0000000..7bc294c --- /dev/null -+++ b/gdb/python/python-membuf.c ++++ b/gdb/python/py-membuf.c @@ -0,0 +1,268 @@ +/* Python interface to the inferior memory. + @@ -14802,11 +16203,11 @@ index 0000000..7bc294c + Py_INCREF (&membuf_object_type); + PyModule_AddObject (gdb_module, "Membuf", (PyObject *) &membuf_object_type); +} -diff --git a/gdb/python/python-param.c b/gdb/python/python-param.c +diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c new file mode 100644 index 0000000..1f591a8 --- /dev/null -+++ b/gdb/python/python-param.c ++++ b/gdb/python/py-param.c @@ -0,0 +1,606 @@ +/* gdb parameters implemented in Python + @@ -15414,10 +16815,10 @@ index 0000000..1f591a8 + 0, /* tp_alloc */ + PyType_GenericNew /* tp_new */ +}; -diff --git a/gdb/python/python-prettyprint.c b/gdb/python/python-prettyprint.c -index 5d696c8..5be54b4 100644 ---- a/gdb/python/python-prettyprint.c -+++ b/gdb/python/python-prettyprint.c +diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c +index 5d696c8..a6348ba 100644 +--- a/gdb/python/py-prettyprint.c ++++ b/gdb/python/py-prettyprint.c @@ -121,6 +121,7 @@ find_pretty_printer (PyObject *value) return function; @@ -15440,7 +16841,7 @@ index 5d696c8..5be54b4 100644 + /* We must increment the value's refcount, because we + are about to decref RESULT, and this may result in + the value being destroyed. */ -+ release_value (*out_value); ++ value_incref (*out_value); + Py_DECREF (result); + result = NULL; } @@ -15461,11 +16862,11 @@ index 5d696c8..5be54b4 100644 val_obj = value_to_value_object (value); if (! val_obj) return NULL; -diff --git a/gdb/python/python-symbol.c b/gdb/python/python-symbol.c +diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c new file mode 100644 index 0000000..03d43c1 --- /dev/null -+++ b/gdb/python/python-symbol.c ++++ b/gdb/python/py-symbol.c @@ -0,0 +1,336 @@ +/* Python interface to symbols. + @@ -15803,11 +17204,11 @@ index 0000000..03d43c1 + 0, /* tp_members */ + symbol_object_getset /* tp_getset */ +}; -diff --git a/gdb/python/python-symtab.c b/gdb/python/python-symtab.c +diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c new file mode 100644 index 0000000..830e586 --- /dev/null -+++ b/gdb/python/python-symtab.c ++++ b/gdb/python/py-symtab.c @@ -0,0 +1,322 @@ +/* Python interface to symbol tables. + @@ -16131,10 +17532,10 @@ index 0000000..830e586 + 0, /* tp_members */ + sal_object_getset /* tp_getset */ +}; -diff --git a/gdb/python/python-type.c b/gdb/python/python-type.c -index e185112..b55ce9a 100644 ---- a/gdb/python/python-type.c -+++ b/gdb/python/python-type.c +diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c +index 590d90a..f512248 100644 +--- a/gdb/python/py-type.c ++++ b/gdb/python/py-type.c @@ -27,6 +27,8 @@ #include "demangle.h" #include "objfiles.h" @@ -16313,9 +17714,9 @@ index e185112..b55ce9a 100644 +} + static void - clean_up_objfile_types (struct objfile *objfile, void *datum) + save_objfile_types (struct objfile *objfile, void *datum) { -@@ -543,12 +621,13 @@ clean_up_objfile_types (struct objfile *objfile, void *datum) +@@ -543,12 +621,13 @@ save_objfile_types (struct objfile *objfile, void *datum) { type_object *next = obj->next; @@ -16333,7 +17734,7 @@ index e185112..b55ce9a 100644 obj = next; } -@@ -559,41 +638,25 @@ clean_up_objfile_types (struct objfile *objfile, void *datum) +@@ -559,41 +638,25 @@ save_objfile_types (struct objfile *objfile, void *datum) } static void @@ -16440,10 +17841,10 @@ index e185112..b55ce9a 100644 } -diff --git a/gdb/python/python-utils.c b/gdb/python/python-utils.c +diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index 49c0437..84a476e 100644 ---- a/gdb/python/python-utils.c -+++ b/gdb/python/python-utils.c +--- a/gdb/python/py-utils.c ++++ b/gdb/python/py-utils.c @@ -19,6 +19,7 @@ #include "defs.h" @@ -16501,28 +17902,19 @@ index 49c0437..84a476e 100644 + + return 1; +} -diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c -index dd3c919..dc76692 100644 ---- a/gdb/python/python-value.c -+++ b/gdb/python/python-value.c -@@ -25,15 +25,7 @@ +diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c +index 714aa11..9fa1c44 100644 +--- a/gdb/python/py-value.c ++++ b/gdb/python/py-value.c +@@ -25,6 +25,7 @@ #include "language.h" #include "dfp.h" #include "valprint.h" -- --/* List of all values which are currently exposed to Python. It is -- maintained so that when an objfile is discarded, preserve_values -- can copy the values' types if needed. This is declared -- unconditionally to reduce the number of uses of HAVE_PYTHON in the -- generic code. */ --/* This variable is unnecessarily initialized to NULL in order to -- work around a linker bug on MacOS. */ --struct value *values_in_python = NULL; +#include "observer.h" #ifdef HAVE_PYTHON -@@ -52,26 +44,43 @@ struct value *values_in_python = NULL; +@@ -43,6 +44,10 @@ /* Python's long type corresponds to C's long long type. */ #define builtin_type_pylong builtin_type (python_gdbarch)->builtin_long_long @@ -16533,106 +17925,7 @@ index dd3c919..dc76692 100644 #define builtin_type_pybool \ language_bool_type (python_language, python_gdbarch) - #define builtin_type_pychar \ - language_string_char_type (python_language, python_gdbarch) - --typedef struct { -+typedef struct value_object { - PyObject_HEAD -+ struct value_object *next; - struct value *value; - PyObject *address; - PyObject *type; - } value_object; - -+/* List of all values which are currently exposed to Python. It is -+ maintained so that when an objfile is discarded, preserve_values -+ can copy the values' types if needed. */ -+/* This variable is unnecessarily initialized to NULL in order to -+ work around a linker bug on MacOS. */ -+static value_object *values_in_python = NULL; -+ - /* Called by the Python interpreter when deallocating a value object. */ - static void - valpy_dealloc (PyObject *obj) - { - value_object *self = (value_object *) obj; -+ value_object **iter; - -- value_remove_from_list (&values_in_python, self->value); -+ /* Remove OBJ from the global list. */ -+ iter = &values_in_python; -+ while (*iter != self) -+ iter = &(*iter)->next; -+ *iter = (*iter)->next; - - value_free (self->value); - -@@ -122,11 +131,23 @@ valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords) - value_obj->address = NULL; - value_obj->type = NULL; - release_value (value); -- value_prepend_to_list (&values_in_python, value); -+ value_obj->next = values_in_python; -+ values_in_python = value_obj; - - return (PyObject *) value_obj; - } - -+/* Iterate over all the Value objects, calling preserve_one_value on -+ each. */ -+void -+preserve_python_values (struct objfile *objfile, htab_t copied_types) -+{ -+ value_object *iter; -+ -+ for (iter = values_in_python; iter; iter = iter->next) -+ preserve_one_value (iter->value, objfile, copied_types); -+} -+ - /* Given a value of a pointer type, apply the C unary * operator to it. */ - static PyObject * - valpy_dereference (PyObject *self, PyObject *args) -@@ -543,9 +564,7 @@ valpy_negative (PyObject *self) - static PyObject * - valpy_positive (PyObject *self) - { -- struct value *copy = value_copy (((value_object *) self)->value); -- -- return value_to_value_object (copy); -+ return value_to_value_object (((value_object *) self)->value); - } - - static PyObject * -@@ -803,13 +822,15 @@ value_to_value_object (struct value *val) - val_obj->address = NULL; - val_obj->type = NULL; - release_value (val); -- value_prepend_to_list (&values_in_python, val); -+ val_obj->next = values_in_python; -+ values_in_python = val_obj; - } - - return (PyObject *) val_obj; - } - --/* Returns value structure corresponding to the given value object. */ -+/* Returns a borrowed reference to the struct value corresponding to -+ the given value object. */ - struct value * - value_object_to_value (PyObject *self) - { -@@ -821,7 +842,8 @@ value_object_to_value (PyObject *self) - } - - /* Try to convert a Python value to a gdb value. If the value cannot -- be converted, set a Python exception and return NULL. */ -+ be converted, set a Python exception and return NULL. Returns a -+ borrowed reference to the resulting struct value. */ - - struct value * - convert_value_from_python (PyObject *obj) -@@ -853,7 +875,34 @@ convert_value_from_python (PyObject *obj) +@@ -902,7 +907,34 @@ convert_value_from_python (PyObject *obj) { LONGEST l = PyLong_AsLongLong (obj); @@ -16668,21 +17961,7 @@ index dd3c919..dc76692 100644 value = value_from_longest (builtin_type_pylong, l); } else if (PyFloat_Check (obj)) -@@ -876,7 +925,12 @@ convert_value_from_python (PyObject *obj) - } - } - else if (PyObject_TypeCheck (obj, &value_object_type)) -- value = value_copy (((value_object *) obj)->value); -+ { -+ /* This lets callers freely decref the Value wrapper object -+ and not worry about whether or not the value will -+ disappear. */ -+ value = value_copy (((value_object *) obj)->value); -+ } - else - PyErr_Format (PyExc_TypeError, _("Could not convert Python object: %s"), - PyString_AsString (PyObject_Str (obj))); -@@ -912,6 +966,25 @@ gdbpy_history (PyObject *self, PyObject *args) +@@ -961,6 +993,25 @@ gdbpy_history (PyObject *self, PyObject *args) return value_to_value_object (res_val); } @@ -16708,7 +17987,7 @@ index dd3c919..dc76692 100644 void gdbpy_initialize_values (void) { -@@ -922,6 +995,8 @@ gdbpy_initialize_values (void) +@@ -971,6 +1022,8 @@ gdbpy_initialize_values (void) PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); values_in_python = NULL; @@ -16717,19 +17996,144 @@ index dd3c919..dc76692 100644 } -@@ -1019,4 +1094,12 @@ PyTypeObject value_object_type = { - valpy_new /* tp_new */ - }; +diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h +index 67a78af..47662d9 100644 +--- a/gdb/python/python-internal.h ++++ b/gdb/python/python-internal.h +@@ -61,33 +61,76 @@ typedef int Py_ssize_t; + #define PyEval_ReleaseLock() 0 + #endif -+#else ++#include "command.h" + -+void -+preserve_python_values (struct objfile *objfile, htab_t copied_types) ++struct block; ++struct symbol; ++struct symtab_and_line; + struct value; + struct language_defn; + + extern PyObject *gdb_module; ++extern PyTypeObject block_object_type; + extern PyTypeObject value_object_type; ++extern PyTypeObject symbol_object_type; ++ ++/* Used in python-inferior.c. */ ++typedef struct +{ -+ /* Nothing. */ -+} ++ PyObject_HEAD + - #endif /* HAVE_PYTHON */ ++ /* The thread we represent. */ ++ struct thread_info *thread; ++ ++ /* The Inferior object to which this thread belongs. */ ++ PyObject *inf_obj; ++} thread_object; + + PyObject *gdbpy_history (PyObject *self, PyObject *args); ++PyObject *gdbpy_breakpoints (PyObject *, PyObject *); + PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *); ++PyObject *gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw); + PyObject *gdbpy_selected_frame (PyObject *self, PyObject *args); ++PyObject *gdbpy_block_for_pc (PyObject *self, PyObject *args); + PyObject *gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw); ++PyObject *gdbpy_inferiors (PyObject *unused, PyObject *unused2); ++PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args); + ++PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal); ++PyObject *symtab_to_symtab_object (struct symtab *symtab); ++PyObject *symbol_to_symbol_object (struct symbol *sym); ++PyObject *block_to_block_object (struct block *block); + PyObject *value_to_value_object (struct value *v); + PyObject *type_to_type_object (struct type *); + PyObject *objfile_to_objfile_object (struct objfile *); ++PyObject *frame_info_to_frame_object (struct frame_info *frame); ++thread_object *create_thread_object (struct thread_info *tp); ++thread_object *find_thread_object (ptid_t ptid); ++PyObject *find_inferior_object (int pid); + + PyObject *objfpy_get_printers (PyObject *, void *); + ++struct block *block_object_to_block (PyObject *obj); ++struct symbol *symbol_object_to_symbol (PyObject *obj); + struct value *value_object_to_value (PyObject *self); + struct value *convert_value_from_python (PyObject *obj); + struct type *type_object_to_type (PyObject *obj); + ++PyObject *gdbpy_get_hook_function (const char *); ++ + void gdbpy_initialize_values (void); ++void gdbpy_initialize_breakpoints (void); + void gdbpy_initialize_frames (void); ++void gdbpy_initialize_symtabs (void); + void gdbpy_initialize_commands (void); ++void gdbpy_initialize_symbols (void); + void gdbpy_initialize_types (void); ++void gdbpy_initialize_blocks (void); + void gdbpy_initialize_functions (void); + void gdbpy_initialize_objfile (void); ++void gdbpy_initialize_parameters (void); ++void gdbpy_initialize_thread (void); ++void gdbpy_initialize_inferior (void); + + struct cleanup *make_cleanup_py_decref (PyObject *py); + +@@ -97,6 +140,12 @@ struct cleanup *ensure_python_env (struct gdbarch *gdbarch, + extern struct gdbarch *python_gdbarch; + extern const struct language_defn *python_language; + ++char *gdbpy_parse_command_name (char *text, ++ struct cmd_list_element ***base_list, ++ struct cmd_list_element **start_list); ++ ++PyObject *gdbpy_parameter_value (enum var_types, void *); ++ + /* Use this after a TRY_EXCEPT to throw the appropriate Python + exception. */ + #define GDB_PY_HANDLE_EXCEPTION(Exception) \ +@@ -107,6 +156,19 @@ extern const struct language_defn *python_language; + "%s", Exception.message); \ + } while (0) + ++/* Use this after a TRY_EXCEPT to throw the appropriate Python ++ exception. This macro is for use inside setter functions. */ ++#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \ ++ do { \ ++ if (Exception.reason < 0) \ ++ { \ ++ PyErr_Format (Exception.reason == RETURN_QUIT \ ++ ? PyExc_KeyboardInterrupt : PyExc_RuntimeError, \ ++ "%s", Exception.message); \ ++ return -1; \ ++ } \ ++ } while (0) ++ + + void gdbpy_print_stack (void); + +@@ -118,17 +180,22 @@ char *python_string_to_host_string (PyObject *obj); + PyObject *target_string_to_unicode (const gdb_byte *str, int length); + int gdbpy_is_string (PyObject *obj); + ++int gdbpy_is_value_object (PyObject *obj); ++ + /* Note that these are declared here, and not in python.h with the + other pretty-printer functions, because they refer to PyObject. */ + PyObject *apply_varobj_pretty_printer (PyObject *print_obj, + struct value **replacement); + PyObject *gdbpy_get_varobj_pretty_printer (struct value *value); ++PyObject *gdbpy_instantiate_printer (PyObject *cons, PyObject *value); + char *gdbpy_get_display_hint (PyObject *printer); + PyObject *gdbpy_default_visualizer (PyObject *self, PyObject *args); + +-extern PyObject *gdbpy_doc_cst; + extern PyObject *gdbpy_children_cst; + extern PyObject *gdbpy_to_string_cst; + extern PyObject *gdbpy_display_hint_cst; ++extern PyObject *gdbpy_doc_cst; ++ ++int get_addr_from_python (PyObject *obj, CORE_ADDR *addr); + + #endif /* GDB_PYTHON_INTERNAL_H */ diff --git a/gdb/python/python.c b/gdb/python/python.c index 254bd28..5a2a9ae 100644 --- a/gdb/python/python.c @@ -17246,15 +18650,11 @@ index 254bd28..5a2a9ae 100644 "Write a string using gdb's filtered stream." }, { "flush", gdbpy_flush, METH_NOARGS, diff --git a/gdb/python/python.h b/gdb/python/python.h -index 33b0437..bbb6184 100644 +index e970180..bbb6184 100644 --- a/gdb/python/python.h +++ b/gdb/python/python.h -@@ -22,14 +22,18 @@ +@@ -24,6 +24,10 @@ - #include "value.h" - --extern struct value *values_in_python; -- void eval_python_from_control_command (struct command_line *); +void source_python_script (FILE *stream, char *file); @@ -17264,12 +18664,6 @@ index 33b0437..bbb6184 100644 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, - const struct value_print_options *options, - const struct language_defn *language); - -+void preserve_python_values (struct objfile *objfile, htab_t copied_types); -+ - #endif /* GDB_PYTHON_H */ diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index de34894..07518b0 100644 --- a/gdb/scm-lang.c @@ -17355,10 +18749,10 @@ index 6cfaa85..68aadc0 100644 extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */ diff --git a/gdb/solib.c b/gdb/solib.c -index aad2d59..def02f8 100644 +index c7fd0fc..6f31852 100644 --- a/gdb/solib.c +++ b/gdb/solib.c -@@ -1066,13 +1066,12 @@ show_auto_solib_add (struct ui_file *file, int from_tty, +@@ -1127,13 +1127,12 @@ show_auto_solib_add (struct ui_file *file, int from_tty, struct symbol * solib_global_lookup (const struct objfile *objfile, const char *name, @@ -17497,26 +18891,13 @@ index 1c37801..594eb16 100644 print_variable_and_value (NULL, sym, frame, stream, 4 * num_tabs); break; diff --git a/gdb/symfile.c b/gdb/symfile.c -index c182faa..8b971fb 100644 +index 2458201..c31b72a 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c -@@ -52,7 +52,6 @@ - #include "observer.h" - #include "exec.h" - #include "parser-defs.h" --#include "varobj.h" - #include "elf-bfd.h" - #include "solib.h" - #include "remote.h" -@@ -926,6 +925,20 @@ new_symfile_objfile (struct objfile *objfile, int add_flags) - - /* We're done reading the symbol file; finish off complaints. */ +@@ -921,6 +921,17 @@ new_symfile_objfile (struct objfile *objfile, int add_flags) clear_complaints (&symfile_complaints, 0, add_flags & SYMFILE_VERBOSE); -+ -+ /* We have finished unloading of OBJFILE. */ -+ observer_notify_objfile_unloaded (); -+} -+ + } + +/* A helper function which returns true if OBJFILE has any debug + symbols, and false otherwise. */ +static int @@ -17526,10 +18907,12 @@ index c182faa..8b971fb 100644 + || (objfile->separate_debug_objfile + && (objfile->separate_debug_objfile->psymtabs + || objfile->separate_debug_objfile->quick_addrmap))); - } - ++} ++ /* Process a symbol file, as either the main file or as a dynamically -@@ -965,13 +978,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, + loaded file. + +@@ -958,13 +969,16 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, /* Give user a chance to burp if we'd be interactively wiping out any existing symbols. */ @@ -17548,16 +18931,16 @@ index c182faa..8b971fb 100644 discard_cleanups (my_cleanups); if (addrs) -@@ -1007,6 +1023,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, +@@ -997,6 +1011,8 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, if ((flags & OBJF_READNOW) || readnow_symbol_files) { + require_partial_symbols (objfile); + - if ((from_tty || info_verbose) && print_symbol_loading) + if (from_tty || info_verbose) { printf_unfiltered (_("expanding to full symbols...")); -@@ -1025,7 +1043,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, +@@ -1015,7 +1031,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, /* If the file has its own symbol tables it has no separate debug info. `.dynsym'/`.symtab' go to MSYMBOLS, `.debug_info' goes to SYMTABS/PSYMTABS. `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */ @@ -17566,45 +18949,25 @@ index c182faa..8b971fb 100644 debugfile = find_separate_debug_file (objfile); if (debugfile) { -@@ -1049,8 +1067,11 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, +@@ -1039,9 +1055,10 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, xfree (debugfile); } -- if (!have_partial_symbols () && !have_full_symbols () -- && print_symbol_loading) + /* has_any_debug_symbols is not fully compatible with the former calls which + would just be needlessly expensive here. */ -+ if ((from_tty || info_verbose) && print_symbol_loading -+ && (add_flags & SYMFILE_MAINLINE) + if ((from_tty || info_verbose) +- && !objfile_has_partial_symbols (objfile) +- && !objfile_has_full_symbols (objfile)) + && !has_any_debug_symbols (objfile)) { wrap_here (""); - printf_unfiltered (_("(no debugging symbols found)")); -@@ -1166,7 +1187,9 @@ symbol_file_clear (int from_tty) - descriptors as well. */ - no_shared_libraries (NULL, from_tty); - -- symfile_objfile = NULL; -+ /* free_objfile should have cleared it. */ -+ gdb_assert (symfile_objfile == NULL); -+ - if (from_tty) - printf_unfiltered (_("No symbol file now.\n")); - } -@@ -2349,7 +2372,7 @@ reread_symbols (void) - - /* Remove any references to this objfile in the global - value lists. */ -- preserve_values (objfile); -+ observer_notify_objfile_unloading (objfile); - - /* Nuke all the state that we will re-read. Much of the following - code which sets things to NULL really is necessary to tell -@@ -2437,13 +2460,15 @@ reread_symbols (void) + printf_unfiltered (_("(no debugging symbols found)...")); +@@ -2422,14 +2439,15 @@ reread_symbols (void) zero is OK since dbxread.c also does what it needs to do if objfile->global_psymbols.size is 0. */ (*objfile->sf->sym_read) (objfile, 0); -- if (!have_partial_symbols () && !have_full_symbols ()) +- if (!objfile_has_partial_symbols (objfile) +- && !objfile_has_full_symbols (objfile)) + if (!has_any_debug_symbols (objfile)) { wrap_here (""); @@ -17617,17 +18980,7 @@ index c182faa..8b971fb 100644 /* We're done reading the symbol file; finish off complaints. */ clear_complaints (&symfile_complaints, 0, 1); -@@ -2452,6 +2477,9 @@ reread_symbols (void) - - reinit_frame_cache (); - -+ /* We have finished reloading of OBJFILE. */ -+ observer_notify_objfile_unloaded (); -+ - /* Discard cleanups as symbol reading was successful. */ - discard_cleanups (old_cleanups); - -@@ -2741,7 +2769,7 @@ allocate_symtab (char *filename, struct objfile *objfile) +@@ -2727,7 +2745,7 @@ allocate_symtab (char *filename, struct objfile *objfile) } struct partial_symtab * @@ -17636,18 +18989,7 @@ index c182faa..8b971fb 100644 { struct partial_symtab *psymtab; -@@ -2832,10 +2860,6 @@ clear_symtab_users (void) - between expressions and which ought to be reset each time. */ - expression_context_block = NULL; - innermost_block = NULL; -- -- /* Varobj may refer to old symbols, perform a cleanup. */ -- varobj_invalidate (); -- - } - - static void -@@ -3055,7 +3079,8 @@ again2: +@@ -3041,7 +3059,8 @@ again2: struct partial_symtab * start_psymtab_common (struct objfile *objfile, @@ -17658,7 +19000,7 @@ index c182faa..8b971fb 100644 struct partial_symbol **static_syms) { diff --git a/gdb/symfile.h b/gdb/symfile.h -index bba242c..58bd2d8 100644 +index 8c9249c..bf9d9e7 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -140,6 +140,12 @@ struct sym_fns @@ -17683,7 +19025,7 @@ index bba242c..58bd2d8 100644 struct partial_symbol **, struct partial_symbol **); -@@ -316,7 +322,7 @@ extern int auto_solib_limit; +@@ -309,7 +315,7 @@ extern int auto_solib_limit; extern void set_initial_language (void); @@ -17692,7 +19034,7 @@ index bba242c..58bd2d8 100644 extern void discard_psymtab (struct partial_symtab *); -@@ -385,7 +391,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data); +@@ -378,7 +384,7 @@ void free_symfile_segment_data (struct symfile_segment_data *data); /* From dwarf2read.c */ extern int dwarf2_has_info (struct objfile *); @@ -17724,7 +19066,7 @@ index eb35369..dfd8c8c 100644 { printf_filtered ("Global symbol `"); diff --git a/gdb/symtab.c b/gdb/symtab.c -index c88156a..b269491 100644 +index 8d9d72c..82e0163 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -42,6 +42,7 @@ @@ -17776,7 +19118,17 @@ index c88156a..b269491 100644 { if (FILENAME_CMP (name, pst->filename) == 0) { -@@ -474,7 +473,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, +@@ -414,7 +413,8 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol, + gsymbol->language = language; + if (gsymbol->language == language_cplus + || gsymbol->language == language_java +- || gsymbol->language == language_objc) ++ || gsymbol->language == language_objc ++ || gsymbol->language == language_fortran) + { + gsymbol->language_specific.cplus_specific.demangled_name = NULL; + } +@@ -474,7 +474,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, || gsymbol->language == language_auto) { demangled = @@ -17785,7 +19137,23 @@ index c88156a..b269491 100644 if (demangled != NULL) { gsymbol->language = language_cplus; -@@ -868,7 +867,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -633,6 +633,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol) + case language_cplus: + case language_java: + case language_objc: ++ case language_fortran: + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) + return gsymbol->language_specific.cplus_specific.demangled_name; + break; +@@ -658,6 +659,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol) + case language_cplus: + case language_java: + case language_objc: ++ case language_fortran: + if (gsymbol->language_specific.cplus_specific.demangled_name != NULL) + return gsymbol->language_specific.cplus_specific.demangled_name; + break; +@@ -868,7 +870,13 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) than the later used TEXTLOW/TEXTHIGH one. */ ALL_OBJFILES (objfile) @@ -17800,7 +19168,7 @@ index c88156a..b269491 100644 { struct partial_symtab *pst; -@@ -901,6 +906,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) +@@ -901,6 +909,7 @@ find_pc_sect_psymtab (CORE_ADDR pc, struct obj_section *section) return pst; } } @@ -17808,7 +19176,7 @@ index c88156a..b269491 100644 /* Existing PSYMTABS_ADDRMAP mapping is present even for PARTIAL_SYMTABs which still have no corresponding full SYMTABs read. But it is not -@@ -1168,6 +1174,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) +@@ -1168,6 +1177,22 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile) return psym; } @@ -17831,7 +19199,7 @@ index c88156a..b269491 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. -@@ -1194,10 +1216,14 @@ lookup_symbol_in_language (const char *name, const struct block *block, +@@ -1194,10 +1219,14 @@ lookup_symbol_in_language (const char *name, const struct block *block, { char *demangled_name = NULL; const char *modified_name = NULL; @@ -17847,7 +19215,7 @@ index c88156a..b269491 100644 modified_name = name; /* If we are using C++ or Java, demangle the name before doing a lookup, so -@@ -1207,7 +1233,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, +@@ -1207,7 +1236,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); if (demangled_name) { @@ -17855,7 +19223,7 @@ index c88156a..b269491 100644 modified_name = demangled_name; make_cleanup (xfree, demangled_name); } -@@ -1229,7 +1254,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, +@@ -1229,7 +1257,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, DMGL_ANSI | DMGL_PARAMS | DMGL_JAVA); if (demangled_name) { @@ -17863,7 +19231,7 @@ index c88156a..b269491 100644 modified_name = demangled_name; make_cleanup (xfree, demangled_name); } -@@ -1248,8 +1272,8 @@ lookup_symbol_in_language (const char *name, const struct block *block, +@@ -1248,8 +1275,8 @@ lookup_symbol_in_language (const char *name, const struct block *block, modified_name = copy; } @@ -17874,7 +19242,7 @@ index c88156a..b269491 100644 do_cleanups (cleanup); return returnval; -@@ -1273,9 +1297,9 @@ lookup_symbol (const char *name, const struct block *block, +@@ -1273,9 +1300,9 @@ lookup_symbol (const char *name, const struct block *block, well. */ static struct symbol * @@ -17887,7 +19255,7 @@ index c88156a..b269491 100644 { struct symbol *sym; const struct language_defn *langdef; -@@ -1291,55 +1315,19 @@ lookup_symbol_aux (const char *name, const char *linkage_name, +@@ -1291,55 +1318,19 @@ lookup_symbol_aux (const char *name, const char *linkage_name, /* Search specified block and its superiors. Don't search STATIC_BLOCK or GLOBAL_BLOCK. */ @@ -17950,7 +19318,7 @@ index c88156a..b269491 100644 if (sym != NULL) return sym; -@@ -1349,11 +1337,11 @@ lookup_symbol_aux (const char *name, const char *linkage_name, +@@ -1349,11 +1340,11 @@ lookup_symbol_aux (const char *name, const char *linkage_name, desired name as a file-level static, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ @@ -17964,7 +19332,7 @@ index c88156a..b269491 100644 if (sym != NULL) return sym; -@@ -1364,30 +1352,81 @@ lookup_symbol_aux (const char *name, const char *linkage_name, +@@ -1364,30 +1355,81 @@ lookup_symbol_aux (const char *name, const char *linkage_name, Don't search STATIC_BLOCK or GLOBAL_BLOCK. */ static struct symbol * @@ -18006,7 +19374,7 @@ index c88156a..b269491 100644 + if (language == language_cplus ) + { + sym = cp_lookup_symbol_imports (block_scope (block_iterator), name, -+ block_iterator, domain, 1); ++ block_iterator, domain, 1, 1); + + if (sym != NULL) + return sym; @@ -18058,7 +19426,7 @@ index c88156a..b269491 100644 return NULL; } -@@ -1416,13 +1455,12 @@ lookup_objfile_from_block (const struct block *block) +@@ -1416,13 +1458,12 @@ lookup_objfile_from_block (const struct block *block) block_found appropriately. */ struct symbol * @@ -18074,7 +19442,7 @@ index c88156a..b269491 100644 if (sym) { block_found = block; -@@ -1438,7 +1476,6 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name, +@@ -1438,7 +1479,6 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name, struct symbol * lookup_global_symbol_from_objfile (const struct objfile *objfile, const char *name, @@ -18082,7 +19450,7 @@ index c88156a..b269491 100644 const domain_enum domain) { struct symbol *sym; -@@ -1452,7 +1489,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, +@@ -1452,7 +1492,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -18091,7 +19459,7 @@ index c88156a..b269491 100644 if (sym) { block_found = block; -@@ -1461,23 +1498,23 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, +@@ -1461,23 +1501,23 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, } /* Now go through psymtabs. */ @@ -18119,7 +19487,7 @@ index c88156a..b269491 100644 return NULL; } -@@ -1488,8 +1525,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, +@@ -1488,8 +1528,7 @@ lookup_global_symbol_from_objfile (const struct objfile *objfile, static symbols. */ static struct symbol * @@ -18129,7 +19497,7 @@ index c88156a..b269491 100644 const domain_enum domain) { struct symbol *sym; -@@ -1502,7 +1538,7 @@ lookup_symbol_aux_symtabs (int block_index, +@@ -1502,7 +1541,7 @@ lookup_symbol_aux_symtabs (int block_index, { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, block_index); @@ -18138,7 +19506,7 @@ index c88156a..b269491 100644 if (sym) { block_found = block; -@@ -1520,7 +1556,6 @@ lookup_symbol_aux_symtabs (int block_index, +@@ -1520,7 +1559,6 @@ lookup_symbol_aux_symtabs (int block_index, static struct symbol * lookup_symbol_aux_psymtabs (int block_index, const char *name, @@ -18146,7 +19514,7 @@ index c88156a..b269491 100644 const domain_enum domain) { struct symbol *sym; -@@ -1531,16 +1566,15 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, +@@ -1531,16 +1569,15 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, struct symtab *s; const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); @@ -18166,7 +19534,7 @@ index c88156a..b269491 100644 if (!sym) { /* This shouldn't be necessary, but as a last resort try -@@ -1557,7 +1591,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, +@@ -1557,7 +1594,7 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, block = BLOCKVECTOR_BLOCK (bv, block_index == GLOBAL_BLOCK ? STATIC_BLOCK : GLOBAL_BLOCK); @@ -18175,7 +19543,7 @@ index c88156a..b269491 100644 if (!sym) error (_("Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n%s may be an inlined function, or may be a template function\n(if a template, try specifying an instantiation: %s)."), block_index == GLOBAL_BLOCK ? "global" : "static", -@@ -1576,7 +1610,6 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, +@@ -1576,7 +1613,6 @@ lookup_symbol_aux_psymtabs (int block_index, const char *name, struct symbol * basic_lookup_symbol_nonlocal (const char *name, @@ -18183,7 +19551,7 @@ index c88156a..b269491 100644 const struct block *block, const domain_enum domain) { -@@ -1610,11 +1643,11 @@ basic_lookup_symbol_nonlocal (const char *name, +@@ -1610,11 +1646,11 @@ basic_lookup_symbol_nonlocal (const char *name, than that one, so I don't think we should worry about that for now. */ @@ -18197,7 +19565,7 @@ index c88156a..b269491 100644 } /* Lookup a symbol in the static block associated to BLOCK, if there -@@ -1622,14 +1655,13 @@ basic_lookup_symbol_nonlocal (const char *name, +@@ -1622,14 +1658,13 @@ basic_lookup_symbol_nonlocal (const char *name, struct symbol * lookup_symbol_static (const char *name, @@ -18213,7 +19581,7 @@ index c88156a..b269491 100644 else return NULL; } -@@ -1639,7 +1671,6 @@ lookup_symbol_static (const char *name, +@@ -1639,7 +1674,6 @@ lookup_symbol_static (const char *name, struct symbol * lookup_symbol_global (const char *name, @@ -18221,7 +19589,7 @@ index c88156a..b269491 100644 const struct block *block, const domain_enum domain) { -@@ -1649,15 +1680,15 @@ lookup_symbol_global (const char *name, +@@ -1649,15 +1683,15 @@ lookup_symbol_global (const char *name, /* Call library-specific lookup procedure. */ objfile = lookup_objfile_from_block (block); if (objfile != NULL) @@ -18240,7 +19608,7 @@ index c88156a..b269491 100644 } int -@@ -1681,14 +1712,11 @@ symbol_matches_domain (enum language symbol_language, +@@ -1681,14 +1715,11 @@ symbol_matches_domain (enum language symbol_language, } /* Look, in partial_symtab PST, for symbol whose natural name is NAME. @@ -18257,7 +19625,7 @@ index c88156a..b269491 100644 { struct partial_symbol *temp; struct partial_symbol **start, **psym; -@@ -1740,9 +1768,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, +@@ -1740,9 +1771,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, internal_error (__FILE__, __LINE__, _("failed internal consistency check")); while (top <= real_top @@ -18268,7 +19636,7 @@ index c88156a..b269491 100644 { if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), SYMBOL_DOMAIN (*top), domain)) -@@ -1759,15 +1785,9 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, +@@ -1759,15 +1788,9 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, for (psym = start; psym < start + length; psym++) { if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), @@ -18287,7 +19655,7 @@ index c88156a..b269491 100644 } } -@@ -1809,22 +1829,25 @@ basic_lookup_transparent_type (const char *name) +@@ -1809,22 +1832,25 @@ basic_lookup_transparent_type (const char *name) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -18318,7 +19686,7 @@ index c88156a..b269491 100644 if (!sym) { /* This shouldn't be necessary, but as a last resort -@@ -1833,7 +1856,7 @@ basic_lookup_transparent_type (const char *name) +@@ -1833,7 +1859,7 @@ basic_lookup_transparent_type (const char *name) * the psymtab gets it wrong in some cases. */ block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); @@ -18327,7 +19695,7 @@ index c88156a..b269491 100644 if (!sym) error (_("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\ %s may be an inlined function, or may be a template function\n\ -@@ -1857,21 +1880,26 @@ basic_lookup_transparent_type (const char *name) +@@ -1857,21 +1883,26 @@ basic_lookup_transparent_type (const char *name) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); @@ -18358,7 +19726,7 @@ index c88156a..b269491 100644 if (!sym) { /* This shouldn't be necessary, but as a last resort -@@ -1880,7 +1908,7 @@ basic_lookup_transparent_type (const char *name) +@@ -1880,7 +1911,7 @@ basic_lookup_transparent_type (const char *name) * the psymtab gets it wrong in some cases. */ block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -18367,7 +19735,7 @@ index c88156a..b269491 100644 if (!sym) error (_("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\ %s may be an inlined function, or may be a template function\n\ -@@ -1905,9 +1933,23 @@ find_main_psymtab (void) +@@ -1905,9 +1936,23 @@ find_main_psymtab (void) struct partial_symtab *pst; struct objfile *objfile; @@ -18393,7 +19761,7 @@ index c88156a..b269491 100644 { return (pst); } -@@ -1925,14 +1967,10 @@ find_main_psymtab (void) +@@ -1925,14 +1970,10 @@ find_main_psymtab (void) search on the symbols. Each symbol which is marked as being a ObjC/C++ symbol (language_cplus or language_objc set) has both the encoded and non-encoded names tested for a match. @@ -18408,7 +19776,7 @@ index c88156a..b269491 100644 const domain_enum domain) { struct dict_iterator iter; -@@ -1945,9 +1983,7 @@ lookup_block_symbol (const struct block *block, const char *name, +@@ -1945,9 +1986,7 @@ lookup_block_symbol (const struct block *block, const char *name, sym = dict_iter_name_next (name, &iter)) { if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), @@ -18419,7 +19787,7 @@ index c88156a..b269491 100644 return sym; } return NULL; -@@ -1967,9 +2003,7 @@ lookup_block_symbol (const struct block *block, const char *name, +@@ -1967,9 +2006,7 @@ lookup_block_symbol (const struct block *block, const char *name, sym = dict_iter_name_next (name, &iter)) { if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), @@ -18430,7 +19798,7 @@ index c88156a..b269491 100644 { sym_found = sym; if (!SYMBOL_IS_ARGUMENT (sym)) -@@ -3172,7 +3206,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], +@@ -3172,7 +3209,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. */ @@ -18440,7 +19808,7 @@ index c88156a..b269491 100644 struct partial_symbol **bound, **gbound, **sbound; int keep_going = 1; diff --git a/gdb/symtab.h b/gdb/symtab.h -index 740d4e0..13e521a 100644 +index 740d4e0..461ff95 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -171,9 +171,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *); @@ -18453,7 +19821,7 @@ index 740d4e0..13e521a 100644 /* 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 +@@ -394,7 +391,13 @@ typedef enum domain_enum_tag FUNCTIONS_DOMAIN, /* All defined types */ @@ -18461,11 +19829,14 @@ index 740d4e0..13e521a 100644 + TYPES_DOMAIN, + + /* Fortran common blocks. Their naming must be separate from VAR_DOMAIN. */ -+ COMMON_BLOCK_DOMAIN ++ COMMON_BLOCK_DOMAIN, ++ ++ /* Fortran module. Their naming must be separate. */ ++ MODULE_DOMAIN } domain_enum; -@@ -990,7 +990,6 @@ extern struct symbol *lookup_symbol (const char *, const struct block *, +@@ -990,7 +993,6 @@ extern struct symbol *lookup_symbol (const char *, const struct block *, that can't think of anything better to do. */ extern struct symbol *basic_lookup_symbol_nonlocal (const char *, @@ -18473,7 +19844,7 @@ index 740d4e0..13e521a 100644 const struct block *, const domain_enum); -@@ -1001,7 +1000,6 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *, +@@ -1001,7 +1003,6 @@ extern struct symbol *basic_lookup_symbol_nonlocal (const char *, is one; do nothing if BLOCK is NULL or a global block. */ extern struct symbol *lookup_symbol_static (const char *name, @@ -18481,7 +19852,7 @@ index 740d4e0..13e521a 100644 const struct block *block, const domain_enum domain); -@@ -1009,7 +1007,6 @@ extern struct symbol *lookup_symbol_static (const char *name, +@@ -1009,7 +1010,6 @@ extern struct symbol *lookup_symbol_static (const char *name, necessary). */ extern struct symbol *lookup_symbol_global (const char *name, @@ -18489,7 +19860,7 @@ index 740d4e0..13e521a 100644 const struct block *block, const domain_enum domain); -@@ -1018,21 +1015,18 @@ extern struct symbol *lookup_symbol_global (const char *name, +@@ -1018,21 +1018,18 @@ extern struct symbol *lookup_symbol_global (const char *name, will fix up the symbol if necessary. */ extern struct symbol *lookup_symbol_aux_block (const char *name, @@ -18511,7 +19882,7 @@ index 740d4e0..13e521a 100644 const domain_enum); /* lookup a [struct, union, enum] by name, within a specified block */ -@@ -1062,6 +1056,8 @@ extern void clear_pc_function_cache (void); +@@ -1062,6 +1059,8 @@ extern void clear_pc_function_cache (void); /* from symtab.c: */ @@ -18520,7 +19891,7 @@ index 740d4e0..13e521a 100644 /* lookup partial symbol table by filename */ extern struct partial_symtab *lookup_partial_symtab (const char *); -@@ -1356,7 +1352,6 @@ extern /*const */ char *main_name (void); +@@ -1356,7 +1355,6 @@ extern /*const */ char *main_name (void); /* Check global symbols in objfile. */ struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile, const char *name, @@ -18528,11 +19899,94 @@ index 740d4e0..13e521a 100644 const domain_enum domain); extern struct symtabs_and_lines +diff --git a/gdb/target.c b/gdb/target.c +index e5d14fd..37fab72 100644 +--- a/gdb/target.c ++++ b/gdb/target.c +@@ -124,6 +124,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int); + + static int debug_to_remove_watchpoint (CORE_ADDR, int, int); + ++static int debug_to_detach_watchpoints (void); ++ + static int debug_to_stopped_by_watchpoint (void); + + static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); +@@ -622,6 +624,7 @@ update_current_target (void) + INHERIT (to_remove_hw_breakpoint, t); + INHERIT (to_insert_watchpoint, t); + INHERIT (to_remove_watchpoint, t); ++ INHERIT (to_detach_watchpoints, t); + INHERIT (to_stopped_data_address, t); + INHERIT (to_have_steppable_watchpoint, t); + INHERIT (to_have_continuable_watchpoint, t); +@@ -733,6 +736,9 @@ update_current_target (void) + de_fault (to_remove_watchpoint, + (int (*) (CORE_ADDR, int, int)) + return_minus_one); ++ de_fault (to_detach_watchpoints, ++ (int (*) (void)) ++ return_zero); + de_fault (to_stopped_by_watchpoint, + (int (*) (void)) + return_zero); +@@ -3173,6 +3179,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type) + return retval; + } + ++static int ++debug_to_detach_watchpoints (void) ++{ ++ int retval; ++ ++ retval = debug_target.to_detach_watchpoints (); ++ ++ fprintf_unfiltered (gdb_stdlog, ++ "target_detach_watchpoints () = %ld\n", ++ (unsigned long) retval); ++ return retval; ++} ++ + static void + debug_to_terminal_init (void) + { +@@ -3420,6 +3439,7 @@ setup_target_debug (void) + current_target.to_remove_hw_breakpoint = debug_to_remove_hw_breakpoint; + current_target.to_insert_watchpoint = debug_to_insert_watchpoint; + current_target.to_remove_watchpoint = debug_to_remove_watchpoint; ++ current_target.to_detach_watchpoints = debug_to_detach_watchpoints; + current_target.to_stopped_by_watchpoint = debug_to_stopped_by_watchpoint; + current_target.to_stopped_data_address = debug_to_stopped_data_address; + current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range; diff --git a/gdb/target.h b/gdb/target.h -index 2c743e9..ef29610 100644 +index b1cb852..adff946 100644 --- a/gdb/target.h +++ b/gdb/target.h -@@ -1157,6 +1157,20 @@ extern int target_search_memory (CORE_ADDR start_addr, +@@ -395,6 +395,7 @@ struct target_ops + int (*to_remove_hw_breakpoint) (struct gdbarch *, struct bp_target_info *); + int (*to_remove_watchpoint) (CORE_ADDR, int, int); + int (*to_insert_watchpoint) (CORE_ADDR, int, int); ++ int (*to_detach_watchpoints) (void); + int (*to_stopped_by_watchpoint) (void); + int to_have_steppable_watchpoint; + int to_have_continuable_watchpoint; +@@ -1166,6 +1167,15 @@ extern char *normal_pid_to_str (ptid_t ptid); + #define target_remove_watchpoint(addr, len, type) \ + (*current_target.to_remove_watchpoint) (addr, len, type) + ++/* Clear all debug registers without affecting any register caches. Function ++ acts on INFERIOR_PTID which should be the forked-off process, either the ++ non-threaded child one or the threaded parent one, depending on `set ++ follow-fork-mode'. Both watchpoints and hardware breakpoints get removed. ++ Return 0 on success, -1 on failure. */ ++ ++#define target_detach_watchpoints() \ ++ (*current_target.to_detach_watchpoints) () ++ + #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ + (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) + +@@ -1203,6 +1213,20 @@ extern int target_search_memory (CORE_ADDR start_addr, ULONGEST pattern_len, CORE_ADDR *found_addrp); @@ -18553,7 +20007,7 @@ index 2c743e9..ef29610 100644 /* Command logging facility. */ #define target_log_command(p) \ -@@ -1276,6 +1290,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *); +@@ -1322,6 +1346,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *); extern char *target_get_osdata (const char *type); @@ -18568,114 +20022,6 @@ index 2c743e9..ef29610 100644 /* Stuff that should be shared among the various remote targets. */ -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog -index 7993ac5..181b752 100644 ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1263,6 +1263,103 @@ - gdb_start_cmd. - Use runto_main before any test that requires execution. - -+2008-10-23 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp (run_lang_tests): Test -+ printing a reference. -+ * gdb.python/python-prettyprint.c (main): Add reference. -+ -+2008-10-23 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp (run_lang_tests): Test -+ printing 'cstring'. -+ * gdb.python/python-prettyprint.c (main): New local 'cstring'. -+ -+2008-10-22 Tom Tromey -+ -+ * lib/mi-support.exp (mi_list_varobj_children_range): New proc. -+ (mi_list_varobj_children): Use it. -+ * gdb.python/python-mi.exp: Add -var-set-visualizer tests, -+ -var-set-child-range tests. -+ -+2008-10-22 Tom Tromey -+ -+ * gdb.python/python-prettyprint.py (ContainerPrinter.to_string): -+ Rename from 'header'. -+ -+2008-10-22 Tom Tromey -+ -+ * gdb.python/python-prettyprint.py: Add MI pretty printer. -+ * gdb.python/python-mi.exp: New file. -+ * lib/mi-support.exp (mi_child_regexp): New proc. -+ (mi_list_varobj_children): Use it. -+ (mi_varobj_update_dynamic): New proc. -+ (mi_get_features): New proc. -+ -+2008-10-21 Paul Pluzhnikov -+ -+ * gdb.python/python-prettyprint.exp, -+ gdb.python/python-prettyprint.c, -+ gdb.python/python-prettyprint.py: More C++ tests. -+ -+2008-10-21 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp (run_lang_tests): Don't expect -+ quotes. -+ -+2008-10-20 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp: Fixed comment. -+ -+2008-10-20 Tom Tromey -+ -+ * gdb.python/Makefile.in (EXECUTABLES): Add python-prettyprint. -+ -+2008-10-20 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp (run_lang_tests): Add tests. -+ * gdb.python/python-prettyprint.c (string_repr, container): New -+ types. -+ (array): New global. -+ (zzz_type): New typedef. -+ (make_string, make_container, add_item): New functions. -+ (main): Add variables. -+ * gdb.python/python-prettyprint.py (string_print): New function. -+ (ContainerPrinter): New class. -+ -+2008-10-20 Tom Tromey -+ -+ * gdb.python/python-prettyprint.exp (run_lang_tests): Use python's -+ execfile to read .py file. -+ * gdb.python/python-prettyprint.py: Remove 'python' command. -+ -+2008-10-17 Paul Pluzhnikov -+ -+ * gdb.python/python-prettyprint.exp, -+ gdb.python/python-prettyprint.c, -+ gdb.python/python-prettyprint.py: Add C++ tests. -+ -+2008-10-17 Paul Pluzhnikov -+ -+ * gdb.python/python-prettyprint.exp, -+ gdb.python/python-prettyprint.c, -+ gdb.python/python-prettyprint.py: New test for pretty -+ printing. -+ -+2008-10-16 Tom Tromey -+ -+ * gdb.python/Makefile.in: New file. -+ * configure: Rebuild. -+ * configure.ac: Add gdb.python/Makefile. -+ -+2008-10-14 Paul Pluzhnikov -+ -+ * gdb.python/python-value.c: Prevent gcc from optimizing argv[] out. -+ -+2008-10-14 Paul Pluzhnikov -+ -+ * Makefile.in: Add gdb.python to ALL_SUBDIRS -+ - 2008-10-23 Pedro Alves - - * lib/mi-support.exp (mi_expect_interrupt): Expect signal 0 diff --git a/gdb/testsuite/gdb.arch/powerpc-power7.exp b/gdb/testsuite/gdb.arch/powerpc-power7.exp new file mode 100644 index 0000000..ae301db @@ -19587,10 +20933,10 @@ index 71ce4aa..af0e5f8 100644 + } +} diff --git a/gdb/testsuite/gdb.base/help.exp b/gdb/testsuite/gdb.base/help.exp -index 5fc680b..d271c81 100644 +index d76cc36..496ff18 100644 --- a/gdb/testsuite/gdb.base/help.exp +++ b/gdb/testsuite/gdb.base/help.exp -@@ -605,7 +605,7 @@ gdb_test "help stepi" "Step one instruction exactly\.\[\r\n\]+Argument N means d +@@ -606,7 +606,7 @@ gdb_test "help stepi" "Step one instruction exactly\.\[\r\n\]+Argument N means d gdb_test "help signal" "Continue program giving it signal.*" "help signal" # test help source # vxgdb reads .vxgdbinit @@ -20227,6 +21573,104 @@ index 0000000..5da7378 +gdb_test "p temp1" " = '1' " "second: print temp1" +gdb_test "p temp2" " = '2' " "second: print temp2" +gdb_test "p temp3" " = '3' " "second: print temp3" +diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.c b/gdb/testsuite/gdb.base/watchpoint-hw.c +index 8da9af5..e2de53a 100644 +--- a/gdb/testsuite/gdb.base/watchpoint-hw.c ++++ b/gdb/testsuite/gdb.base/watchpoint-hw.c +@@ -20,5 +20,11 @@ int watchee; + int + main (void) + { ++ volatile int dummy; ++ ++ dummy = watchee; ++ dummy = 1; ++ dummy = 2; /* break-at-exit */ ++ + return 0; + } +diff --git a/gdb/testsuite/gdb.base/watchpoint-hw.exp b/gdb/testsuite/gdb.base/watchpoint-hw.exp +index a2bb731..d74d6c7 100644 +--- a/gdb/testsuite/gdb.base/watchpoint-hw.exp ++++ b/gdb/testsuite/gdb.base/watchpoint-hw.exp +@@ -21,19 +21,12 @@ if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] + return + } + +-set testfile watchpoint-hw +-set srcfile ${testfile}.c +-set binfile ${objdir}/${subdir}/${testfile} +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +- untested "Couldn't compile test program" ++set test watchpoint-hw ++set srcfile ${test}.c ++if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } { + return -1 + } + +-gdb_exit +-gdb_start +-gdb_reinitialize_dir $srcdir/$subdir +-gdb_load ${binfile} +- + # Create the watchpoint before the inferior gets started. Now the native CPU + # target is still not active and its `to_can_use_hw_breakpoint' is not + # installed, therefore only a software watchpoint gets created. +@@ -43,10 +36,40 @@ gdb_test "watch watchee" "atchpoint 1: watchee" + # `runto_main' or `runto main' would delete the watchpoint created above. + + if { [gdb_start_cmd] < 0 } { +- untested start ++ untested ${test}.exp + return -1 + } + gdb_test "" "main .* at .*" "start" + + # Check it is really a `hw'-watchpoint. + gdb_test "info watchpoints" "1 *hw watchpoint .* watchee" ++ ++# Before the inferior gets started we would get: ++# Target does not support this type of hardware watchpoint. ++gdb_test "delete 1" ++gdb_test "rwatch watchee" ++ ++set breakline [gdb_get_line_number "break-at-exit"] ++gdb_breakpoint $breakline ++ ++gdb_test "continue" "Continuing.\r\nHardware read watchpoint 3: watchee\r\n\r\nValue = 0\r\n.*" ++ ++# Here should be no repeated notification of the read watchpoint. ++gdb_test "continue" \ ++ "Continuing\\.\[ \r\n\]+Breakpoint \[0-9\]+, .*break-at-exit.*" \ ++ "continue to break-at-exit after rwatch" ++ ++clean_restart ${test} ++ ++if ![runto_main] { ++ untested ${test}.exp ++ return -1 ++} ++ ++gdb_test "hbreak ${srcfile}:${breakline}" \ ++ "Hardware assisted breakpoint 2 at 0x\[0-9a-f\]+: file .*${srcfile}, line ${breakline}\\." \ ++ "hbreak" ++ ++gdb_test "continue" \ ++ "Continuing\\.\[ \r\n\]+Breakpoint \[0-9\]+, .*break-at-exit.*" \ ++ "continue to break-at-exit after hbreak" +diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in +index 0a087c7..b4880f2 100644 +--- a/gdb/testsuite/gdb.cp/Makefile.in ++++ b/gdb/testsuite/gdb.cp/Makefile.in +@@ -4,7 +4,7 @@ srcdir = @srcdir@ + EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \ + derivation inherit local member-ptr method misc \ + overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \ +- ref-types ref-params method2 pr9594 gdb2495 ++ ref-types ref-params method2 pr9594 gdb2495 gdb9593 + + all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp index 4095ccf..03c07d5 100644 --- a/gdb/testsuite/gdb.cp/cp-relocate.exp @@ -20569,6 +22013,383 @@ index 3c302c3..cd0496d 100644 "bt from A" gdb_continue_to_breakpoint "next caller func" ".*func-line.*" +diff --git a/gdb/testsuite/gdb.cp/gdb9593.cc b/gdb/testsuite/gdb.cp/gdb9593.cc +new file mode 100644 +index 0000000..783c962 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/gdb9593.cc +@@ -0,0 +1,180 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ */ ++#include ++ ++using namespace std; ++ ++class NextOverThrowDerivates ++{ ++ ++public: ++ ++ ++ // Single throw an exception in this function. ++ void function1() ++ { ++ throw 20; ++ } ++ ++ // Throw an exception in another function. ++ void function2() ++ { ++ function1(); ++ } ++ ++ // Throw an exception in another function, but handle it ++ // locally. ++ void function3 () ++ { ++ { ++ try ++ { ++ function1 (); ++ } ++ catch (...) ++ { ++ cout << "Caught and handled function1 exception" << endl; ++ } ++ } ++ } ++ ++ void rethrow () ++ { ++ try ++ { ++ function1 (); ++ } ++ catch (...) ++ { ++ throw; ++ } ++ } ++ ++ void finish () ++ { ++ // We use this to test that a "finish" here does not end up in ++ // this frame, but in the one above. ++ try ++ { ++ function1 (); ++ } ++ catch (int x) ++ { ++ } ++ function1 (); // marker for until ++ } ++ ++ void until () ++ { ++ function1 (); ++ function1 (); // until here ++ } ++ ++}; ++NextOverThrowDerivates next_cases; ++ ++ ++int main () ++{ ++ try ++ { ++ next_cases.function1 (); ++ } ++ catch (...) ++ { ++ // Discard ++ } ++ ++ try ++ { ++ next_cases.function2 (); ++ } ++ catch (...) ++ { ++ // Discard ++ } ++ ++ try ++ { ++ // This is duplicated so we can next over one but step into ++ // another. ++ next_cases.function2 (); ++ } ++ catch (...) ++ { ++ // Discard ++ } ++ ++ next_cases.function3 (); ++ ++ try ++ { ++ next_cases.rethrow (); ++ } ++ catch (...) ++ { ++ // Discard ++ } ++ ++ try ++ { ++ // Another duplicate so we can test "finish". ++ next_cases.function2 (); ++ } ++ catch (...) ++ { ++ // Discard ++ } ++ ++ // Another test for "finish". ++ try ++ { ++ next_cases.finish (); ++ } ++ catch (...) ++ { ++ } ++ ++ // Test of "until". ++ try ++ { ++ next_cases.finish (); ++ } ++ catch (...) ++ { ++ } ++ ++ // Test of "until" with an argument. ++ try ++ { ++ next_cases.until (); ++ } ++ catch (...) ++ { ++ } ++ ++ // Test of "advance". ++ try ++ { ++ next_cases.until (); ++ } ++ catch (...) ++ { ++ } ++} ++ +diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp +new file mode 100644 +index 0000000..ee9aeff +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/gdb9593.exp +@@ -0,0 +1,185 @@ ++# Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++if { [skip_cplus_tests] } { continue } ++ ++set prms_id 9593 ++set bug_id 0 ++ ++set testfile "gdb9593" ++set srcfile ${testfile}.cc ++set binfile $objdir/$subdir/$testfile ++ ++# Create and source the file that provides information about the compiler ++# used to compile the test case. ++if [get_compiler_info ${binfile} "c++"] { ++ untested gdb9593.exp ++ return -1 ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { ++ untested gdb9593.exp ++ return -1 ++} ++ ++# Some targets can't do function calls, so don't even bother with this ++# test. ++if [target_info exists gdb,cannot_call_functions] { ++ setup_xfail "*-*-*" 9593 ++ fail "This target can not call functions" ++ continue ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++if ![runto_main] then { ++ perror "couldn't run to main" ++ continue ++} ++ ++# See whether we have the needed unwinder hooks. ++set ok 1 ++gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" { ++ -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" { ++ pass "check for unwinder hook" ++ } ++ -re "No symbol .* in current context.\r\n$gdb_prompt $" { ++ # Pass the test so we don't get bogus fails in the results. ++ pass "check for unwinder hook" ++ set ok 0 ++ } ++} ++if {!$ok} { ++ untested gdb9593.exp ++ return -1 ++} ++ ++# See http://sourceware.org/bugzilla/show_bug.cgi?id=9593 ++ ++gdb_test "next" \ ++ ".*catch (...).*" \ ++ "next over a throw 1" ++ ++gdb_test "next" \ ++ ".*next_cases.function2.*" \ ++ "next past catch 1" ++ ++gdb_test "next" \ ++ ".*catch (...).*" \ ++ "next over a throw 2" ++ ++gdb_test "next" \ ++ ".*next_cases.function2.*" \ ++ "next past catch 2" ++ ++gdb_test "step" \ ++ ".*function1().*" \ ++ "step into function2 1" ++ ++gdb_test "next" \ ++ ".*catch (...).*" \ ++ "next over a throw 3" ++ ++gdb_test "next" \ ++ ".*next_cases.function3.*" \ ++ "next past catch 3" ++ ++gdb_test "next" \ ++ ".*next_cases.rethrow.*" \ ++ "next over a throw 4" ++ ++gdb_test "next" \ ++ ".*catch (...).*" \ ++ "next over a rethrow" ++ ++gdb_test "next" \ ++ ".*next_cases.function2.*" \ ++ "next after a rethrow" ++ ++gdb_test "step" \ ++ ".*function1().*" \ ++ "step into function2 2" ++ ++gdb_test "finish" \ ++ ".*catch (...).*" \ ++ "finish 1" ++ ++gdb_test "next" \ ++ ".*next_cases.finish ().*" \ ++ "next past catch 4" ++ ++gdb_test "step" \ ++ ".*function1 ().*" \ ++ "step into finish method" ++ ++gdb_test "finish" \ ++ ".*catch (...).*" \ ++ "finish 2" ++ ++gdb_test "next" \ ++ ".*next_cases.finish ().*" \ ++ "next past catch 5" ++ ++gdb_test "step" \ ++ ".*function1 ().*" \ ++ "step into finish, for until" ++ ++gdb_test "until" \ ++ ".*catch .int x.*" \ ++ "until with no argument 1" ++ ++set line [gdb_get_line_number "marker for until" $testfile.cc] ++ ++gdb_test "until $line" \ ++ ".*function1 ().*" \ ++ "next past catch 6" ++ ++gdb_test "until" \ ++ ".*catch (...).*" \ ++ "until with no argument 2" ++ ++set line [gdb_get_line_number "until here" $testfile.cc] ++ ++gdb_test "next" \ ++ ".*next_cases.until ().*" \ ++ "next past catch 6" ++ ++gdb_test "step" \ ++ ".*function1 ().*" \ ++ "step into until" ++ ++gdb_test "until $line" \ ++ ".*catch (...).*" \ ++ "until-over-throw" ++ ++gdb_test "next" \ ++ ".*next_cases.until ().*" \ ++ "next past catch 7" ++ ++gdb_test "step" \ ++ ".*function1 ().*" \ ++ "step into until, for advance" ++ ++gdb_test "advance $line" \ ++ ".*catch (...).*" \ ++ "advance-over-throw" 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 @@ -21007,10 +22828,10 @@ index 0000000..e508103 +gdb_test "print abc" "= 33" diff --git a/gdb/testsuite/gdb.cp/namespace-recursive.cc b/gdb/testsuite/gdb.cp/namespace-recursive.cc new file mode 100644 -index 0000000..cb712fa +index 0000000..46d4c18 --- /dev/null +++ b/gdb/testsuite/gdb.cp/namespace-recursive.cc -@@ -0,0 +1,16 @@ +@@ -0,0 +1,47 @@ +namespace A{ + int ax = 9; +} @@ -21023,17 +22844,47 @@ index 0000000..cb712fa + using namespace B; +} + -+int main(){ -+ using namespace C; -+ return ax; ++using namespace C; ++ ++//--------------- ++namespace D{ ++ using namespace D; ++ int dx = 99; ++} ++using namespace D; ++ ++//--------------- ++namespace{ ++ namespace{ ++ int xx = 999; ++ } ++} ++ ++//--------------- ++namespace E{ ++ int ex = 9999; ++} ++ ++namespace F{ ++ namespace FE = E; ++} ++ ++namespace G{ ++ namespace GF = F; ++} ++ ++//---------------- ++int main(){ ++ using namespace D; ++ namespace GX = G; ++ return ax + dx + xx + G::GF::FE::ex; +} -\ No newline at end of file diff --git a/gdb/testsuite/gdb.cp/namespace-recursive.exp b/gdb/testsuite/gdb.cp/namespace-recursive.exp new file mode 100644 -index 0000000..4e6ad20 +index 0000000..5543757 --- /dev/null +++ b/gdb/testsuite/gdb.cp/namespace-recursive.exp -@@ -0,0 +1,53 @@ +@@ -0,0 +1,75 @@ +# Copyright 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -21076,17 +22927,162 @@ index 0000000..4e6ad20 +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + ++if ![runto_main] then { ++ perror "couldn't run to breakpoint main" ++ continue ++} ++ +############################################ -+# test printing of namespace imported within -+# the function. ++# test printing from namespace imported into ++# imported namespace ++ ++gdb_test "print ax" "= 9" ++ ++############################################ ++# test that gdb can print without falling ++# into search loop ++ ++gdb_test "print dx" "= 99" ++ ++############################################ ++# test printing from namespace imported into ++# imported namespace where imports are implicit ++# anonymous namespace imports. ++ ++gdb_test "print xx" "= 999" ++ ++############################################ ++# Test printing using recursive namespace ++# aliases. ++ ++setup_kfail "gdb/10541" "*-*-*" ++gdb_test "ptype G::GF" "= namespace F" ++ ++setup_kfail "gdb/10541" "*-*-*" ++gdb_test "print G::GF::FE::ex" "= 9999" +diff --git a/gdb/testsuite/gdb.cp/namespace-stress.cc b/gdb/testsuite/gdb.cp/namespace-stress.cc +new file mode 100644 +index 0000000..f34083e +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-stress.cc +@@ -0,0 +1,60 @@ ++ ++namespace A{ int x; } ++namespace B{ int x; } ++namespace C{ int x; } ++namespace D{ int x; } ++namespace E{ int x; } ++namespace F{ int x; } ++namespace G{ int x; } ++namespace H{ int x; } ++namespace I{ int x; } ++namespace J{ int x; } ++namespace K{ int x; } ++namespace L{ int x; } ++namespace M{ int x; } ++namespace N{ int x; } ++namespace O{ int x; } ++namespace P{ int x; } ++namespace Q{ int x; } ++namespace R{ int x; } ++namespace S{ int x; } ++namespace T{ int x; } ++namespace U{ int x; } ++namespace V{ int x; } ++namespace W{ int x; } ++namespace X{ int x; } ++namespace Y{ int x; } ++namespace Z{ int x; } ++ ++ ++int main(){ ++ ++ using namespace A; ++ using namespace B; ++ using namespace C; ++ using namespace D; ++ using namespace E; ++ using namespace F; ++ using namespace G; ++ using namespace H; ++ using namespace I; ++ using namespace J; ++ using namespace K; ++ using namespace L; ++ using namespace M; ++ using namespace N; ++ using namespace O; ++ using namespace P; ++ using namespace Q; ++ using namespace R; ++ using namespace S; ++ using namespace T; ++ using namespace U; ++ using namespace V; ++ using namespace W; ++ using namespace X; ++ using namespace Y; ++ using namespace Z; ++ ++ return 0; ++} +\ No newline at end of file +diff --git a/gdb/testsuite/gdb.cp/namespace-stress.exp b/gdb/testsuite/gdb.cp/namespace-stress.exp +new file mode 100644 +index 0000000..1806523 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/namespace-stress.exp +@@ -0,0 +1,50 @@ ++# 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-stress ++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 ++} ++ ++if [get_compiler_info ${binfile}] { ++ return -1; ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} + +if ![runto_main] then { + perror "couldn't run to breakpoint main" + continue +} + -+setup_xfail *-*-* -+gdb_test "print ax" "= 9" ++############################################ ++# Test that the search can fail efficiently ++ ++gdb_test "print y" "No symbol \"y\" in current context." diff --git a/gdb/testsuite/gdb.cp/namespace-using.cc b/gdb/testsuite/gdb.cp/namespace-using.cc index 4786fd5..8ff5622 100644 --- a/gdb/testsuite/gdb.cp/namespace-using.cc @@ -21253,7 +23249,7 @@ index 4786fd5..8ff5622 100644 + return marker1 (); } diff --git a/gdb/testsuite/gdb.cp/namespace-using.exp b/gdb/testsuite/gdb.cp/namespace-using.exp -index f24973f..c015ef7 100644 +index f24973f..fc23115 100644 --- a/gdb/testsuite/gdb.cp/namespace-using.exp +++ b/gdb/testsuite/gdb.cp/namespace-using.exp @@ -28,6 +28,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb @@ -21268,7 +23264,7 @@ index f24973f..c015ef7 100644 # Get things started. gdb_exit -@@ -46,15 +51,61 @@ if ![runto_main] then { +@@ -46,42 +51,155 @@ if ![runto_main] then { gdb_test "print _a" "= 1" @@ -21330,7 +23326,9 @@ index f24973f..c015ef7 100644 ############################################ # Test printing of namespace aliases -@@ -64,16 +115,32 @@ if ![runto marker2] then { +-setup_kfail "gdb/7935" "*-*-*" + if ![runto marker2] then { + perror "couldn't run to breakpoint marker2" continue } @@ -21367,7 +23365,10 @@ index f24973f..c015ef7 100644 ############################################ # Test printing of individually imported elements -@@ -84,4 +151,57 @@ if ![runto marker4] then { + +-setup_kfail "gdb/7936" "*-*-*" + if ![runto marker4] then { + perror "couldn't run to breakpoint marker4" continue } @@ -21740,14 +23741,15 @@ index 0000000..6922eed +if [test_compiler_info gcc-4-3-*] then { setup_xfail *-*-* } + +gdb_test "print x" "= 11" "Print imported namespace x" -diff --git a/gdb/testsuite/gdb.dwarf2/callframecfa.S b/gdb/testsuite/gdb.dwarf2/callframecfa.S +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S new file mode 100644 -index 0000000..6d0421a +index 0000000..d5b9ca5 --- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/callframecfa.S -@@ -0,0 +1,309 @@ -+/* -+ Copyright 2009 Free Software Foundation, Inc. ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +@@ -0,0 +1,140 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by @@ -21760,308 +23762,138 @@ index 0000000..6d0421a + 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 . -+ */ ++ along with this program. If not, see . */ + -+/* This was compiled from a trivial program just to test the -+ DW_OP_call_frame_cfa operator: ++/* Test .debug_aranges containing zero address_size. */ + -+ int func (int arg) { -+ return arg + 23; -+ } ++/* Dummy function to provide debug information for. */ + -+ int main(int argc, char *argv[]) { -+ func (77); -+ } -+*/ -+ -+ .file "q.c" -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .section .debug_line,"",@progbits -+.Ldebug_line0: + .text -+.Ltext0: -+.globl func -+ .type func, @function -+func: -+.LFB0: -+ .file 1 "q.c" -+ .loc 1 2 0 -+ .cfi_startproc -+ pushl %ebp -+ .cfi_def_cfa_offset 8 -+ movl %esp, %ebp -+ .cfi_offset 5, -8 -+ .cfi_def_cfa_register 5 -+ .loc 1 3 0 -+ movl 8(%ebp), %eax -+ addl $23, %eax -+ .loc 1 4 0 -+ popl %ebp -+ .cfi_restore 5 -+ .cfi_def_cfa 4, 4 -+ ret -+ .cfi_endproc -+.LFE0: -+ .size func, .-func -+.globl _start -+ .type _start, @function -+_start: -+.LFB1: -+ .loc 1 6 0 -+ .cfi_startproc -+ pushl %ebp -+ .cfi_def_cfa_offset 8 -+ movl %esp, %ebp -+ .cfi_offset 5, -8 -+ .cfi_def_cfa_register 5 -+ subl $4, %esp -+ .loc 1 7 0 -+ movl $77, (%esp) -+ call func -+ .loc 1 8 0 -+ leave -+ .cfi_restore 5 -+ .cfi_def_cfa 4, 4 -+ ret -+ .cfi_endproc -+.LFE1: -+ .size _start, .-_start -+.Letext0: -+ .section .debug_info -+ .long 0x9e -+ .value 0x3 -+ .long .Ldebug_abbrev0 -+ .byte 0x4 -+ .uleb128 0x1 -+ .long .LASF5 -+ .byte 0x1 -+ .string "q.c" -+ .long .LASF6 -+ .long .Ltext0 -+ .long .Letext0 -+ .long .Ldebug_line0 -+ .uleb128 0x2 -+ .byte 0x1 -+ .long .LASF0 -+ .byte 0x1 -+ .byte 0x1 -+ .byte 0x1 -+ .long 0x4f -+ .long .LFB0 -+ .long .LFE0 -+ .byte 0x1 -+ .byte 0x9c -+ .long 0x4f -+ .uleb128 0x3 -+ .string "arg" -+ .byte 0x1 -+ .byte 0x1 -+ .long 0x4f -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .byte 0x4 -+ .byte 0x5 -+ .string "int" -+ .uleb128 0x2 -+ .byte 0x1 -+ .long .LASF1 -+ .byte 0x1 -+ .byte 0x6 -+ .byte 0x1 -+ .long 0x4f -+ .long .LFB1 -+ .long .LFE1 -+ .byte 0x1 -+ .byte 0x9c -+ .long 0x8e -+ .uleb128 0x5 -+ .long .LASF2 -+ .byte 0x1 -+ .byte 0x6 -+ .long 0x4f -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 0 -+ .uleb128 0x5 -+ .long .LASF3 -+ .byte 0x1 -+ .byte 0x6 -+ .long 0x8e -+ .byte 0x2 -+ .byte 0x91 -+ .sleb128 4 -+ .byte 0x0 -+ .uleb128 0x6 -+ .byte 0x4 -+ .long 0x94 -+ .uleb128 0x6 -+ .byte 0x4 -+ .long 0x9a -+ .uleb128 0x7 -+ .byte 0x1 -+ .byte 0x6 -+ .long .LASF4 -+ .byte 0x0 -+ .section .debug_abbrev -+ .uleb128 0x1 -+ .uleb128 0x11 -+ .byte 0x1 -+ .uleb128 0x25 -+ .uleb128 0xe -+ .uleb128 0x13 -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x1b -+ .uleb128 0xe -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x10 -+ .uleb128 0x6 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 -+ .uleb128 0x2e -+ .byte 0x1 -+ .uleb128 0x3f -+ .uleb128 0xc -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x27 -+ .uleb128 0xc -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x11 -+ .uleb128 0x1 -+ .uleb128 0x12 -+ .uleb128 0x1 -+ .uleb128 0x40 -+ .uleb128 0xa -+ .uleb128 0x1 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0x8 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 -+ .uleb128 0x5 -+ .byte 0x0 -+ .uleb128 0x3 -+ .uleb128 0xe -+ .uleb128 0x3a -+ .uleb128 0xb -+ .uleb128 0x3b -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .uleb128 0x2 -+ .uleb128 0xa -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 -+ .uleb128 0xf -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x49 -+ .uleb128 0x13 -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 -+ .uleb128 0x24 -+ .byte 0x0 -+ .uleb128 0xb -+ .uleb128 0xb -+ .uleb128 0x3e -+ .uleb128 0xb -+ .uleb128 0x3 -+ .uleb128 0xe -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_pubnames,"",@progbits -+ .long 0x20 -+ .value 0x2 -+ .long .Ldebug_info0 -+ .long 0xa2 -+ .long 0x25 -+ .string "func" -+ .long 0x56 -+ .string "main" -+ .long 0x0 -+ .section .debug_aranges,"",@progbits -+ .long 0x1c -+ .value 0x2 -+ .long .Ldebug_info0 -+ .byte 0x4 -+ .byte 0x0 -+ .value 0x0 -+ .value 0x0 -+ .long .Ltext0 -+ .long .Letext0-.Ltext0 -+ .long 0x0 -+ .long 0x0 -+ .section .debug_str,"MS",@progbits,1 -+.LASF5: -+ .string "GNU C 4.5.0 20090810 (experimental) [trunk revision 150633]" -+.LASF2: -+ .string "argc" -+.LASF6: -+ .string "/tmp" -+.LASF0: -+ .string "func" -+.LASF3: -+ .string "argv" -+.LASF1: -+ .string "main" -+.LASF4: -+ .string "char" -+ .ident "GCC: (GNU) 4.5.0 20090810 (experimental) [trunk revision 150633]" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.dwarf2/callframecfa.exp b/gdb/testsuite/gdb.dwarf2/callframecfa.exp ++.Lbegin_text1: ++ .globl main ++ .type main, %function ++main: ++.Lbegin_main: ++ .int 0 ++.Lend_main: ++ .size main, .-main ++.Lend_text1: ++ ++/* Debug information */ ++ ++ .section .debug_info ++.Lcu1_begin: ++ /* CU header */ ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF Version */ ++ .4byte .Labbrev1_begin /* Offset into abbrev section */ ++ .byte 4 /* Pointer size */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .4byte .Lend_text1 /* DW_AT_high_pc */ ++ .4byte .Lbegin_text1 /* DW_AT_low_pc */ ++ .ascii "file1.txt\0" /* DW_AT_name */ ++ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ ++ .byte 1 /* DW_AT_language (C) */ ++ ++ /* main */ ++ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ ++ .byte 1 /* DW_AT_external */ ++ .byte 1 /* DW_AT_decl_file */ ++ .byte 2 /* DW_AT_decl_line */ ++ .ascii "main\0" /* DW_AT_name */ ++ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ ++ .4byte .Lbegin_main /* DW_AT_low_pc */ ++ .4byte .Lend_main /* DW_AT_high_pc */ ++ .byte 1 /* DW_AT_frame_base: length */ ++ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ ++ ++.Ltype_int: ++ .uleb128 3 /* Abbrev: DW_TAG_base_type */ ++ .ascii "int\0" /* DW_AT_name */ ++ .byte 4 /* DW_AT_byte_size */ ++ .byte 5 /* DW_AT_encoding */ ++ ++ .byte 0 /* End of children of CU */ ++ ++.Lcu1_end: ++ ++/* Abbrev table */ ++ .section .debug_abbrev ++.Labbrev1_begin: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 1 /* has_children */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x2e /* DW_TAG_subprogram */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3f /* DW_AT_external */ ++ .uleb128 0xc /* DW_FORM_flag */ ++ .uleb128 0x3a /* DW_AT_decl_file */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3b /* DW_AT_decl_line */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x40 /* DW_AT_frame_base */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 3 /* Abbrev code */ ++ .uleb128 0x24 /* DW_TAG_base_type */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0xb /* DW_AT_byte_size */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3e /* DW_AT_encoding */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++/* aranges table */ ++ .section .debug_aranges ++ .long .Laranges_end - 1f ++1: ++ .2byte 2 /* aranges Version */ ++ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */ ++ /* The GDB crasher is this zero value. */ ++ .byte 0 /* aranges address_size */ ++ .byte 0 /* aranges segment_size */ ++ ++.Laranges_end: +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp new file mode 100644 -index 0000000..00d67fc +index 0000000..39632d5 --- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/callframecfa.exp -@@ -0,0 +1,55 @@ -+# Copyright 2009 Free Software Foundation, Inc. ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp +@@ -0,0 +1,40 @@ ++# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -22076,7 +23908,7 @@ index 0000000..00d67fc +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + -+# Test DW_OP_call_frame_cfa. ++# Test .debug_aranges containing zero address_size. + +# This test can only be run on targets which support DWARF-2 and use gas. +# For now pick a sampling of likely targets. @@ -22088,34 +23920,19 @@ index 0000000..00d67fc + && ![istarget powerpc-*-eabi*]} { + return 0 +} -+# This test can only be run on x86 targets. -+if {![istarget i?86-*]} { -+ return 0 -+} + -+set testfile "callframecfa" ++set testfile "dw2-aranges" +set srcfile ${testfile}.S -+set binfile ${objdir}/${subdir}/${testfile}.x ++set binfile ${objdir}/${subdir}/${testfile} + -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ -+ [list {additional_flags=-nostdlib}]] != "" } { ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } { + return -1 +} + -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} ++clean_restart $testfile + -+gdb_test "break *func" "Breakpoint 1.*" "set breakpoint for call-frame-cfa" -+gdb_test "run" "" "run for call-frame-cfa" -+gdb_test "display arg" "arg = 77" "set display for call-frame-cfa" -+ -+# We know how many instructions are in the function. Note that we -+# can't handle the "ret" instruction due to the epilogue unwinder. -+for {set i 1} {$i < 5} {incr i} { -+ gdb_test "si" "arg = 77" "step $i for call-frame-cfa" -+} ++# Failed gdb_load would abort the testcase execution earlier. ++pass "file loaded" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c new file mode 100644 index 0000000..1f02d90 @@ -22657,10 +24474,10 @@ index 0000000..e492b3a +end program repro diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp new file mode 100644 -index 0000000..f89cf6b +index 0000000..0ccebe0 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/dynamic.exp -@@ -0,0 +1,158 @@ +@@ -0,0 +1,145 @@ +# Copyright 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -22806,19 +24623,6 @@ index 0000000..f89cf6b +gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9" +# maps to foo::vary(1,3) +gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10" -+ -+set test "quit #1" -+gdb_test_multiple "quit" $test { -+ -re "The program is running. Quit anyway \\(and kill it\\)\\? \\(y or n\\) " { -+ pass $test -+ } -+} -+set test "quit #2" -+gdb_test_multiple "y" $test { -+ eof { -+ pass $test -+ } -+} diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90 new file mode 100644 index 0000000..0f43564 @@ -22923,6 +24727,128 @@ index 0000000..0f43564 + if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort + if (x (3, 1) .ne. 10) call abort +end +diff --git a/gdb/testsuite/gdb.fortran/library-module-lib.f90 b/gdb/testsuite/gdb.fortran/library-module-lib.f90 +new file mode 100644 +index 0000000..6369d34 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/library-module-lib.f90 +@@ -0,0 +1,28 @@ ++! Copyright 2009 Free Software Foundation, Inc. ++! ++! This program is free software; you can redistribute it and/or modify ++! it under the terms of the GNU General Public License as published by ++! the Free Software Foundation; either version 3 of the License, or ++! (at your option) any later version. ++! ++! This program is distributed in the hope that it will be useful, ++! but WITHOUT ANY WARRANTY; without even the implied warranty of ++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++! GNU General Public License for more details. ++! ++! You should have received a copy of the GNU General Public License ++! along with this program. If not, see . ++ ++module lib ++ integer :: var_i = 1 ++contains ++ subroutine lib_func ++ if (var_i .ne. 1) call abort ++ var_i = 2 ++ end subroutine lib_func ++end module lib ++ ++module libmany ++ integer :: var_j = 3 ++ integer :: var_k = 4 ++end module libmany +diff --git a/gdb/testsuite/gdb.fortran/library-module-main.f90 b/gdb/testsuite/gdb.fortran/library-module-main.f90 +new file mode 100644 +index 0000000..de63a65 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/library-module-main.f90 +@@ -0,0 +1,23 @@ ++! Copyright 2009 Free Software Foundation, Inc. ++! ++! This program is free software; you can redistribute it and/or modify ++! it under the terms of the GNU General Public License as published by ++! the Free Software Foundation; either version 3 of the License, or ++! (at your option) any later version. ++! ++! This program is distributed in the hope that it will be useful, ++! but WITHOUT ANY WARRANTY; without even the implied warranty of ++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++! GNU General Public License for more details. ++! ++! You should have received a copy of the GNU General Public License ++! along with this program. If not, see . ++ ++ use lib ++ use libmany, only: var_j ++ if (var_i .ne. 1) call abort ++ call lib_func ++ if (var_i .ne. 2) call abort ++ if (var_j .ne. 3) call abort ++ var_i = var_i ! i-is-2 ++end +diff --git a/gdb/testsuite/gdb.fortran/library-module.exp b/gdb/testsuite/gdb.fortran/library-module.exp +new file mode 100644 +index 0000000..4b4ea4c +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/library-module.exp +@@ -0,0 +1,53 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile "library-module" ++set srcfile ${testfile}-main.f90 ++set srclibfile ${testfile}-lib.f90 ++set libfile ${testfile}-lib.so ++set binfile ${testfile} ++ ++# Required for -fPIC by gdb_compile_shlib. ++if [get_compiler_info not-used] { ++ warning "Could not get compiler info" ++ return -1 ++} ++ ++if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}] != "" } { ++ untested "Couldn't compile ${srclibfile}" ++ return -1 ++} ++ ++# prepare_for_testing cannot be used as linking with $libfile cannot be passed ++# just for the linking phase (and not the source compilation phase). And any ++# warnings on ignored $libfile abort the process. ++ ++if { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++clean_restart $binfile ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "i-is-2"] ++gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*" ++gdb_test "print var_i" " = 2" ++gdb_test "print var_j" " = 3" ++gdb_test "print var_k" "No symbol \"var_k\" in current context\\." diff --git a/gdb/testsuite/gdb.fortran/logical.exp b/gdb/testsuite/gdb.fortran/logical.exp new file mode 100644 index 0000000..ef76f43 @@ -23012,12 +24938,104 @@ index 0000000..4229304 + l8 = .TRUE. + l = .FALSE. ! stop-here +end +diff --git a/gdb/testsuite/gdb.fortran/module.exp b/gdb/testsuite/gdb.fortran/module.exp +index 342ccee..c836c3c 100644 +--- a/gdb/testsuite/gdb.fortran/module.exp ++++ b/gdb/testsuite/gdb.fortran/module.exp +@@ -15,21 +15,31 @@ + + set testfile "module" + set srcfile ${testfile}.f90 +-set binfile ${objdir}/${subdir}/${testfile} + +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } { +- untested "Couldn't compile ${srcfile}" ++if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } { + return -1 + } + +-gdb_exit +-gdb_start +-gdb_reinitialize_dir $srcdir/$subdir +-gdb_load ${binfile} +- + if ![runto MAIN__] then { + perror "couldn't run to breakpoint MAIN__" + continue + } + +-gdb_test "print i" " = 42" ++# Do not use simple single-letter names as GDB would pick up for expectedly ++# nonexisting symbols some static variables from system libraries debuginfos. ++ ++gdb_breakpoint [gdb_get_line_number "i-is-1"] ++gdb_continue_to_breakpoint "i-is-1" ".*i-is-1.*" ++gdb_test "print var_i" " = 1" "print var_i value 1" ++ ++gdb_breakpoint [gdb_get_line_number "i-is-2"] ++gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*" ++gdb_test "print var_i" " = 2" "print var_i value 2" ++ ++gdb_breakpoint [gdb_get_line_number "a-b-c-d"] ++gdb_continue_to_breakpoint "a-b-c-d" ".*a-b-c-d.*" ++gdb_test "print var_a" "No symbol \"var_a\" in current context\\." ++gdb_test "print var_b" " = 11" ++gdb_test "print var_c" "No symbol \"var_c\" in current context\\." ++gdb_test "print var_d" " = 12" ++gdb_test "print var_i" " = 14" "print var_i value 14" +diff --git a/gdb/testsuite/gdb.fortran/module.f90 b/gdb/testsuite/gdb.fortran/module.f90 +index 501ccc8..118931d 100644 +--- a/gdb/testsuite/gdb.fortran/module.f90 ++++ b/gdb/testsuite/gdb.fortran/module.f90 +@@ -13,10 +13,37 @@ + ! You should have received a copy of the GNU General Public License + ! along with this program. If not, see . + +-module mod +- integer :: i = 42 +-end module mod ++module mod1 ++ integer :: var_i = 1 ++end module mod1 + +- use mod +- print *, i ++module mod2 ++ integer :: var_i = 2 ++end module mod2 ++ ++module modmany ++ integer :: var_a = 10, var_b = 11, var_c = 12, var_i = 14 ++end module modmany ++ ++ subroutine sub1 ++ use mod1 ++ if (var_i .ne. 1) call abort ++ var_i = var_i ! i-is-1 ++ end ++ ++ subroutine sub2 ++ use mod2 ++ if (var_i .ne. 2) call abort ++ var_i = var_i ! i-is-2 ++ end ++ ++ use modmany, only: var_b, var_d => var_c, var_i ++ ++ call sub1 ++ call sub2 ++ ++ if (var_b .ne. 11) call abort ++ if (var_d .ne. 12) call abort ++ if (var_i .ne. 14) call abort ++ var_b = var_b ! a-b-c-d + end diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp new file mode 100644 -index 0000000..ab72206 +index 0000000..b1120c3 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/string.exp -@@ -0,0 +1,72 @@ +@@ -0,0 +1,59 @@ +# Copyright 2008 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -23077,19 +25095,6 @@ index 0000000..ab72206 +gdb_continue_to_breakpoint "var-finish" +gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set" +gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set" -+ -+set test "quit #1" -+gdb_test_multiple "quit" $test { -+ -re "The program is running. Quit anyway \\(and kill it\\)\\? \\(y or n\\) " { -+ pass $test -+ } -+} -+set test "quit #2" -+gdb_test_multiple "y" $test { -+ eof { -+ pass $test -+ } -+} diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90 new file mode 100644 index 0000000..226dc5d @@ -23148,63 +25153,128 @@ index 495ae45..d08d7a4 100644 -re ".*time_at_startup = get_run_time.*$gdb_prompt $" { set description "next over get_run_time and everything it calls" set command "next" -diff --git a/gdb/testsuite/gdb.mi/gdb701.exp b/gdb/testsuite/gdb.mi/gdb701.exp -index d4acdc2..244c731 100644 ---- a/gdb/testsuite/gdb.mi/gdb701.exp -+++ b/gdb/testsuite/gdb.mi/gdb701.exp -@@ -54,7 +54,7 @@ mi_gdb_test "-var-list-children fooPtr" \ - - foreach i [list x y z] { - mi_gdb_test "-var-list-children fooPtr.$i" \ -- "(&\".*\"\r\n)*\\^done,numchild=\"0\"" \ -+ "(&\".*\"\r\n)*\\^done,numchild=\"0\",has_more=\"0\"" \ - "list children of fooPtr.$i" - } - -diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp -index 4b02e50..faa9172 100644 ---- a/gdb/testsuite/gdb.mi/mi-var-display.exp -+++ b/gdb/testsuite/gdb.mi/mi-var-display.exp -@@ -558,7 +558,7 @@ mi_gdb_test "-var-info-num-children e" \ - # Test: c_variable-7.55 - # Desc: children of e - mi_gdb_test "-var-list-children e" \ -- "\\^done,numchild=\"0\"" \ -+ "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of e" - - # Test: c_variable-7.60 -@@ -600,7 +600,7 @@ mi_gdb_test "-var-info-num-children anone" \ - # Test: c_variable-7.75 - # Desc: children of anone - mi_gdb_test "-var-list-children anone" \ -- "\\^done,numchild=\"0\"" \ -+ "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of anone" - - -diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp -index d6ce673..17e208a 100644 ---- a/gdb/testsuite/gdb.mi/mi2-var-display.exp -+++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp -@@ -557,7 +557,7 @@ mi_gdb_test "-var-info-num-children e" \ - # Test: c_variable-7.55 - # Desc: children of e - mi_gdb_test "-var-list-children e" \ -- "\\^done,numchild=\"0\"" \ -+ "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of e" - - # Test: c_variable-7.60 -@@ -599,7 +599,7 @@ mi_gdb_test "-var-info-num-children anone" \ - # Test: c_variable-7.75 - # Desc: children of anone - mi_gdb_test "-var-list-children anone" \ -- "\\^done,numchild=\"0\"" \ -+ "\\^done,numchild=\"0\",has_more=\"0\"" \ - "get children of anone" - - +diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp +new file mode 100644 +index 0000000..74d4d58 +--- /dev/null ++++ b/gdb/testsuite/gdb.java/jnpe.exp +@@ -0,0 +1,72 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++load_lib "java.exp" ++ ++set testfile "jnpe" ++set srcfile ${srcdir}/$subdir/${testfile}.java ++set binfile ${objdir}/${subdir}/${testfile} ++if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } { ++ untested "Couldn't compile ${srcfile}" ++ return -1 ++} ++ ++set prms_id 0 ++set bug_id 0 ++ ++# Start with a fresh gdb. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set line [gdb_get_line_number "break here" $testfile.java] ++gdb_test "break $testfile.java:$line" "" ++ ++gdb_test "run" \ ++ "Current language.*java" \ ++ "run java next-over-throw" ++ ++# See whether we have the needed unwinder hooks. ++set ok 1 ++gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook in java" { ++ -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" { ++ pass "check for unwinder hook in java" ++ } ++ -re "No symbol .* in current context.\r\n$gdb_prompt $" { ++ # Pass the test so we don't get bogus fails in the results. ++ pass "check for unwinder hook in java" ++ set ok 0 ++ } ++} ++if {!$ok} { ++ untested jnpe.exp ++ return -1 ++} ++ ++gdb_test "handle SIGSEGV nostop noprint" \ ++ "SIGSEGV.*fault" \ ++ "disable SIGSEGV for next-over-NPE" ++ ++# We sometimes stop at line 37, not line 35. This seems to be a gcj ++# oddity -- another next will solve it. ++gdb_test "next" \ ++ "3\[57\].*" \ ++ "next over NPE" +diff --git a/gdb/testsuite/gdb.java/jnpe.java b/gdb/testsuite/gdb.java/jnpe.java +new file mode 100644 +index 0000000..ffca3ab +--- /dev/null ++++ b/gdb/testsuite/gdb.java/jnpe.java +@@ -0,0 +1,38 @@ ++// Test next-over-NPE. ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ */ ++ ++public class jnpe ++{ ++ public static String npe () ++ { ++ return ((Object) null).toString(); ++ } ++ ++ public static void main (String[] args) ++ { ++ try ++ { ++ System.out.println (npe ()); // break here ++ } ++ catch (NullPointerException n) ++ { ++ System.out.println ("success"); ++ } ++ } ++} diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c new file mode 100644 index 0000000..729f457 @@ -23306,23 +25376,91 @@ index 0000000..f2de718 +# Seen regression: +# Address requested for identifier "arr" which is in register $rdi +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" -diff --git a/gdb/testsuite/gdb.python/Makefile.in b/gdb/testsuite/gdb.python/Makefile.in -index 79be9e7..c49f713 100644 ---- a/gdb/testsuite/gdb.python/Makefile.in -+++ b/gdb/testsuite/gdb.python/Makefile.in -@@ -1,7 +1,7 @@ - VPATH = @srcdir@ - srcdir = @srcdir@ - --EXECUTABLES = python-value -+EXECUTABLES = python-value python-prettyprint python-template - - all info install-info dvi install uninstall installcheck check: - @echo "Nothing to be done for $@..." -diff --git a/gdb/testsuite/gdb.python/python-cmd.exp b/gdb/testsuite/gdb.python/python-cmd.exp +diff --git a/gdb/testsuite/gdb.opt/fortran-string.exp b/gdb/testsuite/gdb.opt/fortran-string.exp +new file mode 100644 +index 0000000..f997eec +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/fortran-string.exp +@@ -0,0 +1,41 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This file was written by Jan Kratochvil . ++ ++# Test GDB can cope with Fortran strings having their length present in a CPU ++# register. With -O0 the string length is passed on the stack. To make this ++# test meaningful the follow assertion should pass. It is not being checked ++# here as the "_s" symbol is compiler dependent: ++# (gdb) info address _s ++# Symbol "_s" is a variable in register XX. ++ ++set test fortran-string ++set srcfile ${test}.f90 ++if { [prepare_for_testing ${test}.exp ${test} ${srcfile} {debug f77 additional_flags=-O2}] } { ++ return -1 ++} ++ ++if ![runto MAIN__] then { ++ perror "couldn't run to breakpoint MAIN__" ++ continue ++} ++ ++gdb_breakpoint [gdb_get_line_number "s = s"] ++gdb_continue_to_breakpoint "s = s" ++gdb_test "frame" ".*s='foo'.*" ++gdb_test "ptype s" "type = character\\*3" ++gdb_test "p s" "\\$\[0-9\]* = 'foo'" +diff --git a/gdb/testsuite/gdb.opt/fortran-string.f90 b/gdb/testsuite/gdb.opt/fortran-string.f90 +new file mode 100644 +index 0000000..e48d520 +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/fortran-string.f90 +@@ -0,0 +1,28 @@ ++! 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. ++! ++! Ihis file is the Fortran source file for dynamic.exp. ++! Original file written by Jakub Jelinek . ++! Modified for the GDB testcase by Jan Kratochvil . ++ ++ subroutine f(s) ++ character*(*) s ++ s = s ++ end ++ ++ program main ++ call f ('foo') ++ end +diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index f6ef938..1032a2d 100644 ---- a/gdb/testsuite/gdb.python/python-cmd.exp -+++ b/gdb/testsuite/gdb.python/python-cmd.exp +--- a/gdb/testsuite/gdb.python/py-cmd.exp ++++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -20,36 +20,15 @@ if $tracelevel then { strace $tracelevel } @@ -23363,10 +25501,10 @@ index f6ef938..1032a2d 100644 } # Test a simple command. -diff --git a/gdb/testsuite/gdb.python/python-frame.exp b/gdb/testsuite/gdb.python/python-frame.exp -index 82b526e..82ae814 100644 ---- a/gdb/testsuite/gdb.python/python-frame.exp -+++ b/gdb/testsuite/gdb.python/python-frame.exp +diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp +index a67eaa3..5380c0f 100644 +--- a/gdb/testsuite/gdb.python/py-frame.exp ++++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -20,40 +20,28 @@ if $tracelevel then { strace $tracelevel } @@ -23382,7 +25520,7 @@ index 82b526e..82ae814 100644 + return -1 +} + - set testfile "python-frame" + set testfile "py-frame" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} + @@ -23453,10 +25591,10 @@ index 82b526e..82ae814 100644 gdb_test "python print 'result =', gdb.selected_frame () == 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 +diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp index 7feca2b..4ae519f 100644 ---- a/gdb/testsuite/gdb.python/python-function.exp -+++ b/gdb/testsuite/gdb.python/python-function.exp +--- a/gdb/testsuite/gdb.python/py-function.exp ++++ b/gdb/testsuite/gdb.python/py-function.exp @@ -20,36 +20,15 @@ if $tracelevel then { strace $tracelevel } @@ -23497,11 +25635,11 @@ index 7feca2b..4ae519f 100644 } gdb_py_test_multiple "input convenience function" \ -diff --git a/gdb/testsuite/gdb.python/python-inferior.c b/gdb/testsuite/gdb.python/python-inferior.c +diff --git a/gdb/testsuite/gdb.python/py-inferior.c b/gdb/testsuite/gdb.python/py-inferior.c new file mode 100644 index 0000000..0b48299 --- /dev/null -+++ b/gdb/testsuite/gdb.python/python-inferior.c ++++ b/gdb/testsuite/gdb.python/py-inferior.c @@ -0,0 +1,49 @@ +#include +#include @@ -23552,11 +25690,11 @@ index 0000000..0b48299 + + return f1 (1, 2); +} -diff --git a/gdb/testsuite/gdb.python/python-inferior.exp b/gdb/testsuite/gdb.python/python-inferior.exp +diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp new file mode 100644 -index 0000000..ea413c6 +index 0000000..719b178 --- /dev/null -+++ b/gdb/testsuite/gdb.python/python-inferior.exp ++++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -0,0 +1,201 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + @@ -23591,7 +25729,7 @@ index 0000000..ea413c6 + return -1 +} + -+set testfile "python-inferior" ++set testfile "py-inferior" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + @@ -23759,11 +25897,11 @@ index 0000000..ea413c6 + gdb_test "py print gdb.inferiors()\[0\].search_memory (start_addr, length, 0xfdb97531, 4)" \ + "${one_pattern_found}" "find pattern straddling chunk boundary" +} -diff --git a/gdb/testsuite/gdb.python/python-infthread.c b/gdb/testsuite/gdb.python/python-infthread.c +diff --git a/gdb/testsuite/gdb.python/py-infthread.c b/gdb/testsuite/gdb.python/py-infthread.c new file mode 100644 index 0000000..22eb9f2 --- /dev/null -+++ b/gdb/testsuite/gdb.python/python-infthread.c ++++ b/gdb/testsuite/gdb.python/py-infthread.c @@ -0,0 +1,14 @@ +int f2 (int a) +{ @@ -23779,11 +25917,11 @@ index 0000000..22eb9f2 +{ + return f1 (1, 2); +} -diff --git a/gdb/testsuite/gdb.python/python-infthread.exp b/gdb/testsuite/gdb.python/python-infthread.exp +diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp new file mode 100644 -index 0000000..d444554 +index 0000000..e9d18b7 --- /dev/null -+++ b/gdb/testsuite/gdb.python/python-infthread.exp ++++ b/gdb/testsuite/gdb.python/py-infthread.exp @@ -0,0 +1,58 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + @@ -23818,7 +25956,7 @@ index 0000000..d444554 + return -1 +} + -+set testfile "python-infthread" ++set testfile "py-infthread" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + @@ -23843,190 +25981,11 @@ index 0000000..d444554 +gdb_py_test_silent_cmd "python t0 = gdb.selected_thread ()" "test gdb.selected_thread" 1 +gdb_test "python print t0" "\\" "verify InferiorThread object" +gdb_test "python print 'result =', t0.num" " = \[0-9\]+" "test Inferior.num" -diff --git a/gdb/testsuite/gdb.python/python-mi.exp b/gdb/testsuite/gdb.python/python-mi.exp -index 3258810..095ee78 100644 ---- a/gdb/testsuite/gdb.python/python-mi.exp -+++ b/gdb/testsuite/gdb.python/python-mi.exp -@@ -48,23 +48,42 @@ mi_gdb_test "python execfile ('${srcdir}/${subdir}/${testfile}.py')" "" - mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${testfile}.c] \ - "step to breakpoint" - --mi_create_floating_varobj container c "create container varobj" -+mi_create_floating_varobj container c \ -+ "create container varobj, no pretty-printing" -+ -+mi_list_varobj_children container { -+ { container.name name 1 string } -+ { container.len len 0 int } -+ { container.elements elements 1 "int ." } -+} "examine container children=0, no pretty-printing" -+ -+mi_delete_varobj container "delete varobj" -+ -+mi_gdb_test "-enable-pretty-printing" "" -+ -+mi_create_floating_varobj container c \ -+ "create container varobj" - - mi_list_varobj_children container { - } "examine container children=0" - - mi_next "next over update 1" - --mi_varobj_update_dynamic container { -- { {container.\[0\]} {\[0\]} 0 int } --} "varobj update 1" -+mi_varobj_update_dynamic container "varobj update 1" { -+ type_changed false new_num_children 1 has_more 0 -+} { -+} { -+ { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } -+} - - mi_next "next over update 2" - --mi_varobj_update_dynamic container { -- { {container.\[0\]} {\[0\]} 0 int } -- { {container.\[1\]} {\[1\]} 0 int } --} "varobj update 2" -+mi_varobj_update_dynamic container "varobj update 2" { -+ type_changed false new_num_children 2 has_more 0 -+} { -+} { -+ { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } -+} - - mi_gdb_test "-var-set-visualizer container None" \ - "\\^done" \ -@@ -78,19 +97,68 @@ mi_gdb_test "-var-set-visualizer container gdb.default_visualizer" \ - "\\^done" \ - "choose default visualizer" - --mi_varobj_update_dynamic container { -- { {container.\[0\]} {\[0\]} 0 int } -- { {container.\[1\]} {\[1\]} 0 int } --} "varobj update after choosing default" -+mi_varobj_update_dynamic container "varobj update after choosing default" { -+ type_changed false new_num_children 2 has_more 0 -+} { -+} { -+ { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } -+ { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } -+} - - mi_gdb_test "-var-set-visualizer container ContainerPrinter" \ - "\\^done" \ - "choose visualizer using expression" - --mi_varobj_update_dynamic container { -+mi_varobj_update_dynamic container \ -+ "varobj update after choosing via expression" { -+ type_changed false new_num_children 2 has_more 0 -+ } { -+ } { -+ { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 } -+ { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 } -+ } -+ -+mi_list_varobj_children_range container 1 2 2 { -+ { {container.\[1\]} {\[1\]} 0 int } -+} "list varobj children after selecting child range" -+ -+mi_list_varobj_children_range container -1 -1 2 { - { {container.\[0\]} {\[0\]} 0 int } - { {container.\[1\]} {\[1\]} 0 int } --} "varobj update after choosing via expression" -+} "list varobj children after resetting child range" -+ -+mi_next "next over update 3" -+ -+mi_gdb_test "-var-set-update-range container 0 1" \ -+ "\\^done" \ -+ "set update range" -+ -+# This should truncate the list. -+mi_list_varobj_children container { -+ { {container.\[0\]} {\[0\]} 0 int } -+} "list children after setting update range" -+ -+# This should return just the items in [1,2). -+mi_list_varobj_children_range container 1 2 2 { -+ { {container.\[1\]} {\[1\]} 0 int } -+} "list selected children after setting range" -+ -+# This should not be affected by the previous list-children request. -+mi_list_varobj_children container { -+ { {container.\[0\]} {\[0\]} 0 int } -+} "list children after listing selected range" -+ -+mi_next "next over update 4" -+ -+# This should only show the first child, because the update range has -+# been set. -+mi_varobj_update_dynamic container \ -+ "update after next with restricted range" { -+ type_changed false new_num_children 1 has_more 1 -+ } { -+ { name {container.\[0\]} in_scope true type_changed false } -+ } { -+ } - - mi_continue_to_line \ - [gdb_get_line_number {Another MI breakpoint} ${testfile}.c] \ -diff --git a/gdb/testsuite/gdb.python/python-prettyprint.c b/gdb/testsuite/gdb.python/python-prettyprint.c -index 3cafc48..6bbbf1d 100644 ---- a/gdb/testsuite/gdb.python/python-prettyprint.c -+++ b/gdb/testsuite/gdb.python/python-prettyprint.c -@@ -15,6 +15,8 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -+#include -+ - struct s - { - int a; -@@ -148,6 +150,11 @@ void do_nothing(void) - c = 23; /* Another MI breakpoint */ - } - -+struct nullstr -+{ -+ char *s; -+}; -+ - int - main () - { -@@ -156,10 +163,13 @@ main () - string x = make_string ("this is x"); - zzz_type c = make_container ("container"); - const struct string_repr cstring = { { "const string" } }; -+ /* Clearing by being `static' could invoke an other GDB C++ bug. */ -+ struct nullstr nullstr; - - init_ss(&ss, 1, 2); - init_ss(ssa+0, 3, 4); - init_ss(ssa+1, 5, 6); -+ memset (&nullstr, 0, sizeof nullstr); - - struct ns ns; - ns.null_str = "embedded\0null\0string"; -@@ -193,6 +203,9 @@ main () - add_item (&c, 72); - - #ifdef MI -+ add_item (&c, 1011); -+ c.elements[0] = 1023; -+ - do_nothing (); - #endif - -diff --git a/gdb/testsuite/gdb.python/python-prettyprint.exp b/gdb/testsuite/gdb.python/python-prettyprint.exp -index 01d4a06..b2dc85d 100644 ---- a/gdb/testsuite/gdb.python/python-prettyprint.exp -+++ b/gdb/testsuite/gdb.python/python-prettyprint.exp -@@ -27,12 +27,9 @@ set binfile ${objdir}/${subdir}/${testfile} +diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp +index b4b3776..359c4ed 100644 +--- a/gdb/testsuite/gdb.python/py-prettyprint.exp ++++ b/gdb/testsuite/gdb.python/py-prettyprint.exp +@@ -27,12 +27,20 @@ set binfile ${objdir}/${subdir}/${testfile} # Start with a fresh gdb. gdb_exit gdb_start @@ -24039,10 +25998,21 @@ index 01d4a06..b2dc85d 100644 +if ![python_supported] then { + unsupported "python support is disabled" + return -1 ++} ++ ++# Run a command in GDB, and report a failure if a Python exception is thrown. ++# If report_pass is true, report a pass if no exception is thrown. ++proc gdb_py_test_silent_cmd {cmd name report_pass} { ++ global gdb_prompt ++ ++ gdb_test_multiple $cmd $name { ++ -re "Traceback.*$gdb_prompt $" { fail $name } ++ -re "$gdb_prompt $" { if $report_pass { pass $name } } ++ } } - proc run_lang_tests {lang} { -@@ -86,6 +83,8 @@ proc run_lang_tests {lang} { + # Run a command in GDB, and report a failure if a Python exception is thrown. +@@ -102,6 +110,8 @@ proc run_lang_tests {lang} { gdb_test "print c" " = container $hex \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" @@ -24051,47 +26021,10 @@ index 01d4a06..b2dc85d 100644 gdb_test "continue" "Program exited normally\." } -diff --git a/gdb/testsuite/gdb.python/python-prettyprint.py b/gdb/testsuite/gdb.python/python-prettyprint.py -index bf009a1..c3e0dc4 100644 ---- a/gdb/testsuite/gdb.python/python-prettyprint.py -+++ b/gdb/testsuite/gdb.python/python-prettyprint.py -@@ -92,6 +92,13 @@ class pp_vbase1: - def to_string (self): - return "pp class name: " + self.val.type.tag - -+class pp_nullstr: -+ def __init__(self, val): -+ self.val = val -+ -+ def to_string(self): -+ return self.val['s'].string(gdb.parameter('target-charset')) -+ - class pp_ns: - "Print a std::basic_string of some kind" - -@@ -109,7 +116,7 @@ def lookup_function (val): - "Look-up and return a pretty-printer that can print val." - - # Get the type. -- type = val.type; -+ type = val.type - - # If it points to a reference, get the reference. - if type.code == gdb.TYPE_CODE_REF: -@@ -148,6 +155,9 @@ def register_pretty_printers (): - - pretty_printers_dict[re.compile ('^VirtualTest$')] = pp_multiple_virtual - pretty_printers_dict[re.compile ('^Vbase1$')] = pp_vbase1 -+ -+ pretty_printers_dict[re.compile ('^struct nullstr$')] = pp_nullstr -+ pretty_printers_dict[re.compile ('^nullstr$')] = pp_nullstr - - # Note that we purposely omit the typedef names here. - # Printer lookup is based on canonical name. -diff --git a/gdb/testsuite/gdb.python/python-template.exp b/gdb/testsuite/gdb.python/python-template.exp -index 1ace5d6..b80f56e 100644 ---- a/gdb/testsuite/gdb.python/python-template.exp -+++ b/gdb/testsuite/gdb.python/python-template.exp +diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp +index cea6ae0..c9a63d4 100644 +--- a/gdb/testsuite/gdb.python/py-template.exp ++++ b/gdb/testsuite/gdb.python/py-template.exp @@ -20,6 +20,17 @@ if $tracelevel then { strace $tracelevel } @@ -24107,7 +26040,7 @@ index 1ace5d6..b80f56e 100644 + return -1 +} + - set testfile "python-template" + set testfile "py-template" set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} @@ -29,20 +40,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ @@ -24131,55 +26064,11 @@ index 1ace5d6..b80f56e 100644 proc test_template_arg {type} { global testfile srcdir subdir srcfile binfile if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ -diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp -index 19cabeb..ccf438f 100644 ---- a/gdb/testsuite/gdb.python/python-value.exp -+++ b/gdb/testsuite/gdb.python/python-value.exp -@@ -20,43 +20,6 @@ if $tracelevel then { - strace $tracelevel - } - --set testfile "python-value" --set srcfile ${testfile}.c --set binfile ${objdir}/${subdir}/${testfile} --if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -- untested "Couldn't compile ${srcfile}" -- return -1 --} -- --# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}... --# Run a test named NAME, consisting of multiple lines of input. --# After each input line INPUT, search for result line RESULT. --# Succeed if all results are seen; fail otherwise. --proc gdb_py_test_multiple {name args} { -- global gdb_prompt -- foreach {input result} $args { -- if {[gdb_test_multiple $input "$name - $input" { -- -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { -- pass "$name - $input" -- } -- }]} { -- return 1 -- } -- } -- return 0 --} -- --# Run a command in GDB, and report a failure if a Python exception is thrown. --# If report_pass is true, report a pass if no exception is thrown. --proc gdb_py_test_silent_cmd {cmd name report_pass} { -- global gdb_prompt -- -- gdb_test_multiple $cmd $name { -- -re "Traceback.*$gdb_prompt $" { fail $name } -- -re "$gdb_prompt $" { if $report_pass { pass $name } } -- } --} -- - proc test_value_creation {} { - global gdb_prompt - -@@ -292,21 +255,37 @@ proc test_value_after_death {} { +diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp +index 2958233..0de1cae 100644 +--- a/gdb/testsuite/gdb.python/py-value.exp ++++ b/gdb/testsuite/gdb.python/py-value.exp +@@ -292,6 +292,15 @@ proc test_value_after_death {} { "print value's type" } @@ -24192,8 +26081,10 @@ index 19cabeb..ccf438f 100644 + gdb_test "python print v" "5" "print value for cast test" +} + - # Start with a fresh gdb. - + # Regression test for invalid subscript operations. The bug was that + # the type of the value was not being checked before allowing a + # subscript operation to proceed. +@@ -366,16 +375,23 @@ proc test_subscript_regression {lang} { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -24210,7 +26101,7 @@ index 19cabeb..ccf438f 100644 + return -1 } -+set testfile "python-value" ++set testfile "py-value" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + @@ -24224,11 +26115,14 @@ index 19cabeb..ccf438f 100644 test_value_creation test_value_numeric_ops test_value_boolean -@@ -322,3 +301,4 @@ if ![runto_main] then { +@@ -391,6 +407,7 @@ if ![runto_main] then { test_value_in_inferior test_value_after_death +test_cast_regression + + # The following test recompiles the binary to test either C or C++ + # values. diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 5223fc8..03e1eab 100644 --- a/gdb/testsuite/gdb.python/python.exp @@ -24267,6 +26161,1028 @@ index 5223fc8..03e1eab 100644 } gdb_py_test_multiple "multi-line python command" \ +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c b/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c +new file mode 100644 +index 0000000..4dc308b +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-forkoff.c +@@ -0,0 +1,175 @@ ++/* Test case for forgotten hw-watchpoints after fork()-off of a process. ++ ++ Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 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. */ ++ ++#include ++#include ++ ++static void ++delay (void) ++{ ++ int i = usleep (1000000 / 100); ++ assert (i == 0 || errno == EINTR); ++} ++ ++#if defined FOLLOW_PARENT ++ ++static void ++forkoff (int nr) ++{ ++ pid_t child, pid_got; ++ int exit_code = 42 + nr; ++ int status, i; ++ ++ child = fork (); ++ switch (child) ++ { ++ case -1: ++ assert (0); ++ case 0: ++ printf ("child%d: %d\n", nr, (int) getpid ()); ++ /* Delay to get both the "child%d" and "parent%d" message printed without ++ a race breaking expect by its endless wait on `$gdb_prompt$': ++ Breakpoint 3, breakpoint () at ../../../gdb/testsuite/gdb.threads/watchpoint-fork.c:33 ++ 33 } ++ (gdb) parent2: 14223 */ ++ i = sleep (1); ++ assert (i == 0); ++ ++ /* We must not get caught here (against a forgotten breakpoint). */ ++ var++; ++ breakpoint (); ++ ++ _exit (exit_code); ++ default: ++ printf ("parent%d: %d\n", nr, (int) child); ++ /* Delay to get both the "child%d" and "parent%d" message printed, see ++ above. */ ++ i = sleep (1); ++ assert (i == 0); ++ ++ pid_got = wait (&status); ++ assert (pid_got == child); ++ assert (WIFEXITED (status)); ++ assert (WEXITSTATUS (status) == exit_code); ++ ++ /* We must get caught here (against a false watchpoint removal). */ ++ breakpoint (); ++ } ++} ++ ++#elif defined FOLLOW_CHILD ++ ++static volatile int usr1_got; ++ ++static void ++handler_usr1 (int signo) ++{ ++ usr1_got++; ++} ++ ++static void ++forkoff (int nr) ++{ ++ pid_t child; ++ int i, loop; ++ struct sigaction act, oldact; ++#ifdef THREAD ++ void *thread_result; ++#endif ++ ++ memset (&act, 0, sizeof act); ++ act.sa_flags = SA_RESTART; ++ act.sa_handler = handler_usr1; ++ sigemptyset (&act.sa_mask); ++ i = sigaction (SIGUSR1, &act, &oldact); ++ assert (i == 0); ++ ++ child = fork (); ++ switch (child) ++ { ++ case -1: ++ assert (0); ++ default: ++ printf ("parent%d: %d\n", nr, (int) child); ++ ++ /* Sleep for a while to possibly get incorrectly ATTACH_THREADed by GDB ++ tracing the child fork with no longer valid thread/lwp entries of the ++ parent. */ ++ ++ i = sleep (2); ++ assert (i == 0); ++ ++ /* We must not get caught here (against a forgotten breakpoint). */ ++ ++ var++; ++ breakpoint (); ++ ++#ifdef THREAD ++ /* And neither got caught our thread. */ ++ ++ step = 99; ++ i = pthread_join (thread, &thread_result); ++ assert (i == 0); ++ assert (thread_result == (void *) 99UL); ++#endif ++ ++ /* Be sure our child knows we did not get caught above. */ ++ ++ i = kill (child, SIGUSR1); ++ assert (i == 0); ++ ++ /* Sleep for a while to check GDB's `info threads' no longer tracks us in ++ the child fork. */ ++ ++ i = sleep (2); ++ assert (i == 0); ++ ++ _exit (0); ++ case 0: ++ printf ("child%d: %d\n", nr, (int) getpid ()); ++ ++ /* Let the parent signal us about its success. Be careful of races. */ ++ ++ for (loop = 0; loop < 1000; loop++) ++ { ++ /* Parent either died (and USR1_GOT is zero) or it succeeded. */ ++ if (kill (getppid (), 0) != 0) ++ break; ++ /* Parent succeeded? */ ++ if (usr1_got) ++ break; ++ ++ delay (); ++ } ++ assert (usr1_got); ++ ++ /* We must get caught here (against a false watchpoint removal). */ ++ ++ breakpoint (); ++ } ++ ++ i = sigaction (SIGUSR1, &oldact, NULL); ++ assert (i == 0); ++} ++ ++#else ++# error "!FOLLOW_PARENT && !FOLLOW_CHILD" ++#endif +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +new file mode 100644 +index 0000000..edacfc0 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c +@@ -0,0 +1,157 @@ ++/* Test case for forgotten hw-watchpoints after fork()-off of a process. ++ ++ Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 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. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#define gettid() syscall (__NR_gettid) ++ ++/* Non-atomic `var++' should not hurt as we synchronize the threads by the STEP ++ variable. Hit-comments need to be duplicite there to catch both at-stops ++ and behind-stops, depending on the target. */ ++ ++static volatile int var; ++ ++static void ++dummy (void) ++{ ++} ++ ++static void ++breakpoint (void) ++{ ++} ++ ++/* Include here the functions: ++ static void forkoff (int nr); ++ static void delay (void); */ ++ ++static pthread_t thread; ++static volatile int step; ++#define THREAD ++ ++#include "watchpoint-fork-forkoff.c" ++ ++static void * ++start (void *arg) ++{ ++ if (step >= 3) ++ goto step_3; ++ ++ while (step != 1) ++ delay (); ++ ++ var++; /* validity-thread-B */ ++ dummy (); /* validity-thread-B */ ++ step = 2; ++ while (step != 3) ++ { ++ if (step == 99) ++ goto step_99; ++ delay (); ++ } ++ ++step_3: ++ if (step >= 5) ++ goto step_5; ++ ++ var++; /* after-fork1-B */ ++ dummy (); /* after-fork1-B */ ++ step = 4; ++ while (step != 5) ++ { ++ if (step == 99) ++ goto step_99; ++ delay (); ++ } ++ ++step_5: ++ var++; /* after-fork2-B */ ++ dummy (); /* after-fork2-B */ ++ return (void *) 5UL; ++ ++step_99: ++ /* We must not get caught here (against a forgotten breakpoint). */ ++ var++; ++ breakpoint (); ++ return (void *) 99UL; ++} ++ ++int ++main (void) ++{ ++ int i; ++ void *thread_result; ++ ++ setbuf (stdout, NULL); ++ printf ("main: %d\n", (int) gettid ()); ++ ++ /* General watchpoints validity. */ ++ var++; /* validity-first */ ++ dummy (); /* validity-first */ ++ ++ i = pthread_create (&thread, NULL, start, NULL); ++ assert (i == 0); ++ ++ var++; /* validity-thread-A */ ++ dummy (); /* validity-thread-A */ ++ step = 1; ++ while (step != 2) ++ delay (); ++ ++ /* Hardware watchpoints got disarmed here. */ ++ forkoff (1); ++ ++ var++; /* after-fork1-A */ ++ dummy (); /* after-fork1-A */ ++ step = 3; ++#ifdef FOLLOW_CHILD ++ /* Spawn new thread as it was deleted in the child of FORK. */ ++ i = pthread_create (&thread, NULL, start, NULL); ++ assert (i == 0); ++#endif ++ while (step != 4) ++ delay (); ++ ++ /* A sanity check for double hardware watchpoints removal. */ ++ forkoff (2); ++ ++ var++; /* after-fork2-A */ ++ dummy (); /* after-fork2-A */ ++ step = 5; ++#ifdef FOLLOW_CHILD ++ /* Spawn new thread as it was deleted in the child of FORK. */ ++ i = pthread_create (&thread, NULL, start, NULL); ++ assert (i == 0); ++#endif ++ ++ i = pthread_join (thread, &thread_result); ++ assert (i == 0); ++ assert (thread_result == (void *) 5UL); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.c b/gdb/testsuite/gdb.threads/watchpoint-fork.c +new file mode 100644 +index 0000000..5f62e7f +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork.c +@@ -0,0 +1,57 @@ ++/* Test case for forgotten hw-watchpoints after fork()-off of a process. ++ ++ Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 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. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static volatile int var; ++ ++static void ++breakpoint (void) ++{ ++} ++ ++/* Include here the function: ++ static void forkoff (int nr); */ ++ ++#include "watchpoint-fork-forkoff.c" ++ ++int ++main (void) ++{ ++ setbuf (stdout, NULL); ++ printf ("main: %d\n", (int) getpid ()); ++ ++ /* General watchpoints validity. */ ++ var++; ++ /* Hardware watchpoints got disarmed here. */ ++ forkoff (1); ++ /* This watchpoint got lost before. */ ++ var++; ++ /* A sanity check for double hardware watchpoints removal. */ ++ forkoff (2); ++ var++; ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp +new file mode 100644 +index 0000000..1dc93ab +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp +@@ -0,0 +1,130 @@ ++# Copyright 2008, 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test case for forgotten hw-watchpoints after fork()-off of a process. ++ ++proc test {type symbol} { ++ global objdir subdir srcdir ++ ++ set test watchpoint-fork ++ ++ global pf_prefix ++ set prefix_test $pf_prefix ++ lappend pf_prefix "$type:" ++ set prefix_mt $pf_prefix ++ ++ # no threads ++ ++ set pf_prefix $prefix_mt ++ lappend pf_prefix "singlethreaded:" ++ ++ set executable ${test}-${type} ++ if { [gdb_compile ${srcdir}/${subdir}/${test}.c ${objdir}/${subdir}/${executable} executable [list debug additional_flags=-D$symbol]] != "" } { ++ untested ${test}.exp ++ return -1 ++ } ++ clean_restart $executable ++ ++ gdb_test "show detach-on-fork" "Whether gdb will detach the child of a fork is on." ++ gdb_test "set follow-fork-mode $type" ++ gdb_test "show follow-fork-mode" "Debugger response to a program call of fork or vfork is \"$type\"." ++ # Testcase uses it for the `follow-fork-mode child' type. ++ gdb_test "handle SIGUSR1 nostop noprint pass" ++ ++ if { ![runto_main] } then { ++ gdb_suppress_tests ++ return ++ } ++ ++ # Install the watchpoint only after getting into MAIN - workaround some PPC ++ # problem. ++ gdb_test "watch var" "atchpoint 2: var" "Set the watchpoint" ++ ++ # It is never hit but it should not be left over in the fork()ed-off child. ++ gdb_breakpoint "breakpoint" ++ ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 0.*New value = 1.*forkoff *\\(1\\).*" "watchpoints work" ++ gdb_test "continue" \ ++ "reakpoint 3, breakpoint.*" "breakpoint after the first fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 1.*New value = 2.*forkoff *\\(2\\).*" "watchpoint after the first fork" ++ gdb_test "continue" \ ++ "reakpoint 3, breakpoint.*" "breakpoint after the second fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 2.*New value = 3.*return *0;" "watchpoint after the second fork" ++ gdb_test "continue" "Continuing..*Program exited normally." "finish" ++ ++ ++ # threads ++ ++ set pf_prefix $prefix_mt ++ lappend pf_prefix "multithreaded:" ++ ++ set executable ${test}-mt-${type} ++ if { [gdb_compile_pthreads ${srcdir}/${subdir}/${test}-mt.c ${objdir}/${subdir}/${executable} executable [list debug additional_flags=-D$symbol]] != "" } { ++ untested ${test}.exp ++ return -1 ++ } ++ clean_restart $executable ++ ++ gdb_test "set follow-fork-mode $type" ++ # Testcase uses it for the `follow-fork-mode child' type. ++ gdb_test "handle SIGUSR1 nostop noprint pass" ++ ++ if { ![runto_main] } then { ++ gdb_suppress_tests ++ return ++ } ++ ++ # Install the watchpoint only after getting into MAIN - workaround some PPC ++ # problem. ++ gdb_test "watch var" "atchpoint 2: var" "Set the watchpoint" ++ ++ # It is never hit but it should not be left over in the fork()ed-off child. ++ gdb_breakpoint "breakpoint" ++ ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 0.*New value = 1.*validity-first.*" "singlethread watchpoints work" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 1.*New value = 2.*validity-thread-A.*" "multithreaded watchpoints work at A" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 2.*New value = 3.*validity-thread-B.*" "multithreaded watchpoints work at B" ++ gdb_test "continue" \ ++ "reakpoint 3, breakpoint.*" "breakpoint (A) after the first fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 3.*New value = 4.*after-fork1-A.*" "watchpoint A after the first fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 4.*New value = 5.*after-fork1-B.*" "watchpoint B after the first fork" ++ gdb_test "continue" \ ++ "reakpoint 3, breakpoint.*" "breakpoint (A) after the second fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 5.*New value = 6.*after-fork2-A.*" "watchpoint A after the second fork" ++ gdb_test "continue" \ ++ "atchpoint 2: var.*Old value = 6.*New value = 7.*after-fork2-B.*" "watchpoint B after the second fork" ++ gdb_test "continue" "Continuing..*Program exited normally." "finish" ++ ++ ++ # cleanup ++ ++ set pf_prefix $prefix_test ++} ++ ++test parent FOLLOW_PARENT ++ ++# Only GNU/Linux is known to support `set follow-fork-mode child'. ++if {[istarget "*-*-linux*"]} { ++ test child FOLLOW_CHILD ++} +diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.c b/gdb/testsuite/gdb.threads/watchthreads-reorder.c +new file mode 100644 +index 0000000..14f42d6 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.c +@@ -0,0 +1,366 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#define _GNU_SOURCE ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define gettid() syscall (__NR_gettid) ++ ++/* Terminate always in the main task, it can lock up with SIGSTOPped GDB ++ otherwise. */ ++#define TIMEOUT (gettid () == getpid() ? 10 : 15) ++ ++static pthread_mutex_t gdbstop_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; ++ ++static pid_t thread1_tid; ++static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER; ++static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; ++ ++static pid_t thread2_tid; ++static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER; ++static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; ++ ++static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; ++ ++static volatile int thread1_rwatch; ++static volatile int thread2_rwatch; ++ ++static int unused1_rwatch; ++static int unused2_rwatch; ++ ++/* Do not use alarm as it would create a ptrace event which would hang up us if ++ * we are being traced by GDB which we stopped ourselves. */ ++ ++static void timed_mutex_lock (pthread_mutex_t *mutex) ++{ ++ int i; ++ struct timespec start, now; ++ ++ i = clock_gettime (CLOCK_MONOTONIC, &start); ++ assert (i == 0); ++ ++ do ++ { ++ i = pthread_mutex_trylock (mutex); ++ if (i == 0) ++ return; ++ assert (i == EBUSY); ++ ++ i = clock_gettime (CLOCK_MONOTONIC, &now); ++ assert (i == 0); ++ assert (now.tv_sec >= start.tv_sec); ++ } ++ while (now.tv_sec - start.tv_sec < TIMEOUT); ++ ++ fprintf (stderr, "Timed out waiting for internal lock!\n"); ++ exit (EXIT_FAILURE); ++} ++ ++static void * ++thread1_func (void *unused) ++{ ++ int i; ++ volatile int rwatch_store; ++ ++ thread1_tid = gettid (); ++ i = pthread_cond_signal (&thread1_tid_cond); ++ assert (i == 0); ++ ++ /* Be sure GDB is already stopped before continuing. */ ++ timed_mutex_lock (&gdbstop_mutex); ++ i = pthread_mutex_unlock (&gdbstop_mutex); ++ assert (i == 0); ++ ++ rwatch_store = thread1_rwatch; ++ ++ /* Be sure the "T (tracing stop)" test can proceed for both threads. */ ++ timed_mutex_lock (&terminate_mutex); ++ i = pthread_mutex_unlock (&terminate_mutex); ++ assert (i == 0); ++ ++ return NULL; ++} ++ ++static void * ++thread2_func (void *unused) ++{ ++ int i; ++ volatile int rwatch_store; ++ ++ thread2_tid = gettid (); ++ i = pthread_cond_signal (&thread2_tid_cond); ++ assert (i == 0); ++ ++ /* Be sure GDB is already stopped before continuing. */ ++ timed_mutex_lock (&gdbstop_mutex); ++ i = pthread_mutex_unlock (&gdbstop_mutex); ++ assert (i == 0); ++ ++ rwatch_store = thread2_rwatch; ++ ++ /* Be sure the "T (tracing stop)" test can proceed for both threads. */ ++ timed_mutex_lock (&terminate_mutex); ++ i = pthread_mutex_unlock (&terminate_mutex); ++ assert (i == 0); ++ ++ return NULL; ++} ++ ++static const char * ++proc_string (const char *filename, const char *line) ++{ ++ FILE *f; ++ static char buf[LINE_MAX]; ++ size_t line_len = strlen (line); ++ ++ f = fopen (filename, "r"); ++ if (f == NULL) ++ { ++ fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line, ++ strerror (errno)); ++ exit (EXIT_FAILURE); ++ } ++ while (errno = 0, fgets (buf, sizeof (buf), f)) ++ { ++ char *s; ++ ++ s = strchr (buf, '\n'); ++ assert (s != NULL); ++ *s = 0; ++ ++ if (strncmp (buf, line, line_len) != 0) ++ continue; ++ ++ if (fclose (f)) ++ { ++ fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line, ++ strerror (errno)); ++ exit (EXIT_FAILURE); ++ } ++ ++ return &buf[line_len]; ++ } ++ if (errno != 0) ++ { ++ fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno)); ++ exit (EXIT_FAILURE); ++ } ++ fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line); ++ exit (EXIT_FAILURE); ++} ++ ++static unsigned long ++proc_ulong (const char *filename, const char *line) ++{ ++ const char *s = proc_string (filename, line); ++ long retval; ++ char *end; ++ ++ errno = 0; ++ retval = strtol (s, &end, 10); ++ if (retval < 0 || retval >= LONG_MAX || (end && *end)) ++ { ++ fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval, ++ strerror (errno)); ++ exit (EXIT_FAILURE); ++ } ++ return retval; ++} ++ ++static void ++state_wait (pid_t process, const char *wanted) ++{ ++ char *filename; ++ int i; ++ struct timespec start, now; ++ const char *state; ++ ++ i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process); ++ assert (i > 0); ++ ++ i = clock_gettime (CLOCK_MONOTONIC, &start); ++ assert (i == 0); ++ ++ do ++ { ++ state = proc_string (filename, "State:\t"); ++ if (strcmp (state, wanted) == 0) ++ { ++ free (filename); ++ return; ++ } ++ ++ if (sched_yield ()) ++ { ++ perror ("sched_yield()"); ++ exit (EXIT_FAILURE); ++ } ++ ++ i = clock_gettime (CLOCK_MONOTONIC, &now); ++ assert (i == 0); ++ assert (now.tv_sec >= start.tv_sec); ++ } ++ while (now.tv_sec - start.tv_sec < TIMEOUT); ++ ++ fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n", ++ (unsigned long) process, wanted, state); ++ exit (EXIT_FAILURE); ++} ++ ++static volatile pid_t tracer = 0; ++static pthread_t thread1, thread2; ++ ++static void ++cleanup (void) ++{ ++ printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer); ++ ++ if (tracer) ++ { ++ int i; ++ int tracer_save = tracer; ++ ++ tracer = 0; ++ ++ i = kill (tracer_save, SIGCONT); ++ assert (i == 0); ++ } ++} ++ ++int ++main (int argc, char **argv) ++{ ++ int i; ++ int standalone = 0; ++ ++ if (argc == 2 && strcmp (argv[1], "-s") == 0) ++ standalone = 1; ++ else ++ assert (argc == 1); ++ ++ setbuf (stdout, NULL); ++ ++ timed_mutex_lock (&gdbstop_mutex); ++ ++ timed_mutex_lock (&terminate_mutex); ++ ++ i = pthread_create (&thread1, NULL, thread1_func, NULL); ++ assert (i == 0); ++ ++ i = pthread_create (&thread2, NULL, thread2_func, NULL); ++ assert (i == 0); ++ ++ if (!standalone) ++ { ++ tracer = proc_ulong ("/proc/self/status", "TracerPid:\t"); ++ if (tracer == 0) ++ { ++ fprintf (stderr, "The testcase must be run by GDB!\n"); ++ exit (EXIT_FAILURE); ++ } ++ if (tracer != getppid ()) ++ { ++ fprintf (stderr, "The testcase parent must be our GDB tracer!\n"); ++ exit (EXIT_FAILURE); ++ } ++ } ++ ++ /* SIGCONT our debugger in the case of our crash as we would deadlock ++ otherwise. */ ++ ++ atexit (cleanup); ++ ++ printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer); ++ ++ if (tracer) ++ { ++ i = kill (tracer, SIGSTOP); ++ assert (i == 0); ++ state_wait (tracer, "T (stopped)"); ++ } ++ ++ timed_mutex_lock (&thread1_tid_mutex); ++ timed_mutex_lock (&thread2_tid_mutex); ++ ++ /* Let the threads start. */ ++ i = pthread_mutex_unlock (&gdbstop_mutex); ++ assert (i == 0); ++ ++ printf ("Waiting till the threads initialize their TIDs.\n"); ++ ++ if (thread1_tid == 0) ++ { ++ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex); ++ assert (i == 0); ++ ++ assert (thread1_tid > 0); ++ } ++ ++ if (thread2_tid == 0) ++ { ++ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex); ++ assert (i == 0); ++ ++ assert (thread2_tid > 0); ++ } ++ ++ printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n", ++ (unsigned long) thread1_tid, (unsigned long) thread2_tid, ++ (unsigned long) getpid ()); ++ ++ printf ("Waiting till the threads get trapped by the watchpoints.\n"); ++ ++ if (tracer) ++ { ++ /* s390x-unknown-linux-gnu will fail with "R (running)". */ ++ ++ state_wait (thread1_tid, "T (tracing stop)"); ++ ++ state_wait (thread2_tid, "T (tracing stop)"); ++ } ++ ++ cleanup (); ++ ++ printf ("Joining the threads.\n"); ++ ++ i = pthread_mutex_unlock (&terminate_mutex); ++ assert (i == 0); ++ ++ i = pthread_join (thread1, NULL); ++ assert (i == 0); ++ ++ i = pthread_join (thread2, NULL); ++ assert (i == 0); ++ ++ printf ("Exiting.\n"); /* break-at-exit */ ++ ++ /* Just prevent compiler `warning: $B!F(BunusedX_rwatch$B!G(B defined but not used'. */ ++ unused1_rwatch = 1; ++ unused2_rwatch = 2; ++ ++ return EXIT_SUCCESS; ++} +diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp +new file mode 100644 +index 0000000..8f65364 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp +@@ -0,0 +1,101 @@ ++# This testcase is part of GDB, the GNU debugger. ++ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test GDB can cope with two watchpoints being hit by different threads at the ++# same time, GDB reports one of them and after "continue" to report the other ++# one GDB should not be confused by differently set watchpoints that time. ++# This is the goal of "reorder1". "reorder0" tests the basic functionality of ++# two watchpoint being hit at the same time, without reordering them during the ++# stop. The formerly broken functionality is due to the all-stop mode default ++# "show breakpoint always-inserted" being "off". Formerly the remembered hit ++# could be assigned during continuation of a thread with pending SIGTRAP to the ++# different/new watchpoint, just based on the watchpoint/debug register number. ++ ++if {[target_info exists gdb,no_hardware_watchpoints] ++ || ![istarget *-*-linux*]} { ++ return 0; ++} ++ ++set testfile "watchthreads-reorder" ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } { ++ return -1 ++} ++ ++foreach reorder {0 1} { ++ ++ global pf_prefix ++ set prefix_test $pf_prefix ++ lappend pf_prefix "reorder$reorder:" ++ ++ clean_restart $testfile ++ ++ gdb_test "set can-use-hw-watchpoints 1" ++ ++ if ![runto_main] { ++ gdb_suppress_tests ++ } ++ ++ # Use "rwatch" as "watch" would report the watchpoint changed just based on its ++ # read memory value during a stop by unrelated event. We are interested to not ++ # to lose the hardware watchpoint trigger. ++ ++ gdb_test "rwatch thread1_rwatch" "Hardware read watchpoint \[0-9\]+: thread1_rwatch" ++ gdb_test {set $rwatch1=$bpnum} ++ set test "rwatch thread2_rwatch" ++ gdb_test_multiple $test $test { ++ -re "Target does not support this type of hardware watchpoint\\.\r\n$gdb_prompt $" { ++ # ppc64 supports at most 1 hw watchpoints. ++ unsupported $test ++ return ++ } ++ -re "Hardware read watchpoint \[0-9\]+: thread2_rwatch\r\n$gdb_prompt $" { ++ pass $test ++ } ++ } ++ gdb_test {set $rwatch2=$bpnum} ++ gdb_breakpoint [gdb_get_line_number "break-at-exit"] ++ ++ # The watchpoints can happen in arbitrary order depending on random: ++ # SEL: Found 2 SIGTRAP events, selecting #[01] ++ # As GDB contains no srand() on the specific host/OS it will behave always the ++ # same. Such order cannot be guaranteed for GDB in general. ++ ++ gdb_test "continue" \ ++ "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \ ++ "continue a" ++ ++ if $reorder { ++ gdb_test {delete $rwatch1} ++ gdb_test {delete $rwatch2} ++ ++ gdb_test "rwatch unused1_rwatch" "Hardware read watchpoint \[0-9\]+: unused1_rwatch" ++ gdb_test "rwatch unused2_rwatch" "Hardware read watchpoint \[0-9\]+: unused2_rwatch" ++ ++ gdb_test "rwatch thread1_rwatch" "Hardware read watchpoint \[0-9\]+: thread1_rwatch" ++ gdb_test "rwatch thread2_rwatch" "Hardware read watchpoint \[0-9\]+: thread2_rwatch" ++ } ++ ++ gdb_test "continue" \ ++ "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \ ++ "continue b" ++ ++ gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*" ++ ++ set pf_prefix $prefix_test ++} 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 @@ -24300,131 +27216,6 @@ index 0c93a73..d0c3493 100644 global GDB -diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp -index e691232..64bc28e 100644 ---- a/gdb/testsuite/lib/mi-support.exp -+++ b/gdb/testsuite/lib/mi-support.exp -@@ -1201,7 +1201,7 @@ proc mi_create_varobj { name expression testname } { - - proc mi_create_floating_varobj { name expression testname } { - mi_gdb_test "-var-create $name @ $expression" \ -- "\\^done,name=\"$name\",numchild=\"\[0-9\]+\",value=\".*\",type=.*" \ -+ "\\^done,name=\"$name\",numchild=\"\(-1\|\[0-9\]+\)\",value=\".*\",type=.*" \ - $testname - } - -@@ -1250,16 +1250,64 @@ proc mi_varobj_update_with_type_change { name new_type new_children testname } { - mi_gdb_test "-var-update $name" $er $testname - } - --# Update a dynamic varobj named NAME. CHILDREN is a list of children, --# in the same form as mi_list_varobj_children. TESTNAME is the name --# of the test. --proc mi_varobj_update_dynamic {name children testname} { -- set children_exp_j [mi_child_regexp $children 0] -+# A helper that turns a key/value list into a regular expression -+# matching some MI output. -+proc mi_varobj_update_kv_helper {list} { -+ set first 1 -+ set rx "" -+ foreach {key value} $list { -+ if {!$first} { -+ append rx , -+ } -+ set first 0 -+ if {$key == "new_children"} { -+ append rx "$key=\\\[$value\\\]" -+ } else { -+ append rx "$key=\"$value\"" -+ } -+ } -+ return $rx -+} -+ -+# A helper for mi_varobj_update_dynamic that computes a match -+# expression given a child list. -+proc mi_varobj_update_dynamic_helper {children} { -+ set crx "" - -- set er "\\^done,changelist=\\\[" -+ set first 1 -+ foreach child $children { -+ if {!$first} { -+ append crx , -+ } -+ set first 0 -+ append crx "{" -+ append crx [mi_varobj_update_kv_helper $child] -+ append crx "}" -+ } -+ -+ return $crx -+} -+ -+# Update a dynamic varobj named NAME. CHILDREN is a list of children -+# that have been updated; NEW_CHILDREN is a list of children that were -+# added to the primary varobj. Each child is a list of key/value -+# pairs that are expected. SELF is a key/value list holding -+# information about the varobj itself. TESTNAME is the name of the -+# test. -+proc mi_varobj_update_dynamic {name testname self children new_children} { -+ if {[llength $new_children]} { -+ set newrx [mi_varobj_update_dynamic_helper $new_children] -+ lappend self new_children $newrx -+ } -+ set selfrx [mi_varobj_update_kv_helper $self] -+ set crx [mi_varobj_update_dynamic_helper $children] - -- append er "{name=\"$name\",in_scope=\"true\",type_changed=\"false\"" -- append er ",children=\\\[$children_exp_j.*\\\]}\\\]" -+ set er "\\^done,changelist=\\\[\{name=\"$name\",in_scope=\"true\"" -+ append er ",$selfrx\}" -+ if {"$crx" != ""} { -+ append er ",$crx" -+ } -+ append er "\\\]" - - verbose -log "Expecting: $er" - mi_gdb_test "-var-update $name" $er $testname -@@ -1329,14 +1377,13 @@ proc mi_child_regexp {children add_child} { - # have no value. - # - proc mi_list_varobj_children { varname children testname } { -- mi_list_varobj_children_range $varname [llength $children] $children \ -+ mi_list_varobj_children_range $varname "" "" [llength $children] $children \ - $testname - } - --# Like mi_list_varobj_children, but assumes that a subrange has been --# selected with -var-set-child-range. NUMCHILDREN is the total number --# of children. --proc mi_list_varobj_children_range {varname numchildren children testname} { -+# Like mi_list_varobj_children, but sets a subrange. NUMCHILDREN is -+# the total number of children. -+proc mi_list_varobj_children_range {varname from to numchildren children testname} { - set options "" - if {[llength $varname] == 2} { - set options [lindex $varname 1] -@@ -1352,9 +1399,18 @@ proc mi_list_varobj_children_range {varname numchildren children testname} { - set expected "\\^done,numchild=\"0\"" - } - -+ if {"$to" == ""} { -+ append expected ",has_more=\"0\"" -+ } elseif {$to >= 0 && $numchildren > $to} { -+ append expected ",has_more=\"1\"" -+ } else { -+ append expected ",has_more=\"0\"" -+ } -+ - verbose -log "Expecting: $expected" - -- mi_gdb_test "-var-list-children $options $varname" $expected $testname -+ mi_gdb_test "-var-list-children $options $varname $from $to" \ -+ $expected $testname - } - - # Verifies that variable object VARNAME has NUMBER children, diff --git a/gdb/testsuite/lib/python-support.exp b/gdb/testsuite/lib/python-support.exp new file mode 100644 index 0000000..b8e9836 @@ -24485,7 +27276,7 @@ index 0000000..b8e9836 + return 0 +} diff --git a/gdb/thread.c b/gdb/thread.c -index a7ac3c8..815c82d 100644 +index 55b4b96..e0ad2d3 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -61,7 +61,6 @@ static int thread_alive (struct thread_info *); @@ -24526,19 +27317,19 @@ index a7ac3c8..815c82d 100644 } diff --git a/gdb/top.c b/gdb/top.c -index de49418..237e575 100644 +index 1b4aa9d..3cfe57e 100644 --- a/gdb/top.c +++ b/gdb/top.c -@@ -378,6 +378,7 @@ execute_command (char *p, int from_tty) - } - +@@ -349,6 +349,7 @@ void + prepare_execute_command (void) + { free_all_values (); + free_all_types (); - /* Force cleanup of any alloca areas if using C alloca instead of - a builtin alloca. */ + /* With multiple threads running while the one we're examining is stopped, + the dcache can get stale without us being able to detect it. diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index 8133ad0..0af62e1 100644 +index f090231..fc15ec1 100644 --- a/gdb/typeprint.c +++ b/gdb/typeprint.c @@ -35,6 +35,8 @@ @@ -24560,7 +27351,7 @@ index 8133ad0..0af62e1 100644 LA_PRINT_TYPE (type, varstring, stream, show, 0); } -@@ -115,7 +120,8 @@ whatis_exp (char *exp, int show) +@@ -114,7 +119,8 @@ whatis_exp (char *exp, int show) { struct expression *expr; struct value *val; @@ -24570,7 +27361,7 @@ index 8133ad0..0af62e1 100644 struct type *real_type = NULL; struct type *type; int full = 0; -@@ -126,12 +132,13 @@ whatis_exp (char *exp, int show) +@@ -125,12 +131,13 @@ whatis_exp (char *exp, int show) if (exp) { expr = parse_expression (exp); @@ -24585,7 +27376,7 @@ index 8133ad0..0af62e1 100644 type = value_type (val); get_user_print_options (&opts); -@@ -168,8 +175,7 @@ whatis_exp (char *exp, int show) +@@ -167,8 +174,7 @@ whatis_exp (char *exp, int show) type_print (type, "", gdb_stdout, show); printf_filtered ("\n"); @@ -24614,7 +27405,7 @@ index f561310..d261c79 100644 +void c_type_print_args (struct type *, struct ui_file *, int, enum language); #endif diff --git a/gdb/ui-file.c b/gdb/ui-file.c -index 02a0314..5c8c96e 100644 +index 527917c..07d959a 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -22,6 +22,7 @@ @@ -24634,8 +27425,8 @@ index 02a0314..5c8c96e 100644 struct accumulated_ui_file { -@@ -297,6 +298,23 @@ ui_file_xstrdup (struct ui_file *file, - *length = acc.length; +@@ -297,6 +298,23 @@ ui_file_xstrdup (struct ui_file *file, long *length) + *length = acc.length; return acc.buffer; } + @@ -24659,7 +27450,7 @@ index 02a0314..5c8c96e 100644 /* 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 +index bf9915c..233206c 100644 --- a/gdb/ui-file.h +++ b/gdb/ui-file.h @@ -19,6 +19,7 @@ @@ -24671,7 +27462,7 @@ index 1562d5a..d86a7eb 100644 /* 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. */ + minus that appended NUL. */ extern char *ui_file_xstrdup (struct ui_file *file, long *length); - @@ -24683,10 +27474,10 @@ index 1562d5a..d86a7eb 100644 extern long ui_file_read (struct ui_file *file, char *buf, long length_buf); diff --git a/gdb/utils.c b/gdb/utils.c -index a266b02..3d953e3 100644 +index 16ad084..3021a43 100644 --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -2605,7 +2605,10 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name, +@@ -2610,7 +2610,10 @@ fprintf_symbol_filtered (struct ui_file *stream, char *name, As an extra hack, string1=="FOO(ARGS)" matches string2=="FOO". This "feature" is useful when searching for matching C++ function names (such as if the user types 'break FOO', where FOO is a mangled C++ @@ -24698,7 +27489,7 @@ index a266b02..3d953e3 100644 int strcmp_iw (const char *string1, const char *string2) -@@ -2630,7 +2633,7 @@ strcmp_iw (const char *string1, const char *string2) +@@ -2635,7 +2638,7 @@ strcmp_iw (const char *string1, const char *string2) string2++; } } @@ -24798,7 +27589,7 @@ index a9c875d..12f6f07 100644 } diff --git a/gdb/valops.c b/gdb/valops.c -index 5e5c4ed..446a4d1 100644 +index b64cb21..b7d31cc 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -38,6 +38,7 @@ @@ -24880,34 +27671,39 @@ index 5e5c4ed..446a4d1 100644 + return 1; +} + - /* Return a value with type TYPE located at ADDR. + /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ - Call value_at only if the data needs to be fetched immediately; -@@ -652,11 +709,19 @@ value_fetch_lazy (struct value *val) + static struct value * +@@ -656,15 +713,21 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { - CORE_ADDR addr = value_address (val); - int length = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); + CORE_ADDR addr = value_raw_address (val); -+ -+ if (object_address_get_data (value_type (val), &addr)) -+ { -+ struct type *type = value_enclosing_type (val); -+ int length = TYPE_LENGTH (check_typedef (type)); - if (length) -- read_memory (addr, value_contents_all_raw (val), length); ++ if (object_address_get_data (value_type (val), &addr)) + { +- if (value_stack (val)) +- read_stack (addr, value_contents_all_raw (val), length); +- else +- read_memory (addr, value_contents_all_raw (val), length); ++ struct type *type = value_enclosing_type (val); ++ int length = TYPE_LENGTH (check_typedef (type)); ++ + if (length) + { + addr += value_offset (val); -+ read_memory (addr, value_contents_all_raw (val), length); ++ if (value_stack (val)) ++ read_stack (addr, value_contents_all_raw (val), length); ++ else ++ read_memory (addr, value_contents_all_raw (val), length); + } -+ } + } } else if (VALUE_LVAL (val) == lval_register) - { -@@ -1061,7 +1126,18 @@ address_of_variable (struct symbol *var, struct block *b) +@@ -1070,7 +1133,18 @@ address_of_variable (struct symbol *var, struct block *b) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) || TYPE_CODE (type) == TYPE_CODE_FUNC) { @@ -24927,7 +27723,7 @@ index 5e5c4ed..446a4d1 100644 return value_from_pointer (lookup_pointer_type (type), addr); } -@@ -1167,6 +1243,7 @@ struct value * +@@ -1176,6 +1250,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -24935,7 +27731,7 @@ index 5e5c4ed..446a4d1 100644 /* If the user tries to do something requiring a pointer with an array that has not yet been pushed to the target, then this would -@@ -1176,8 +1253,12 @@ value_coerce_array (struct value *arg1) +@@ -1185,8 +1260,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -24949,7 +27745,7 @@ index 5e5c4ed..446a4d1 100644 } /* Given a value which is a function, return a value which is a pointer -@@ -2060,12 +2141,25 @@ find_overload_match (struct type **arg_types, int nargs, +@@ -2069,12 +2148,25 @@ find_overload_match (struct type **arg_types, int nargs, if (method) { gdb_assert (obj); @@ -24980,7 +27776,7 @@ index 5e5c4ed..446a4d1 100644 fns_ptr = value_find_oload_method_list (&temp, name, 0, &num_fns, -@@ -2085,16 +2179,29 @@ find_overload_match (struct type **arg_types, int nargs, +@@ -2094,16 +2186,29 @@ find_overload_match (struct type **arg_types, int nargs, } else { @@ -25018,7 +27814,7 @@ index 5e5c4ed..446a4d1 100644 if (func_name == NULL) { *symp = fsym; -@@ -2525,8 +2632,8 @@ check_field (struct type *type, const char *name) +@@ -2534,8 +2639,8 @@ check_field (struct type *type, const char *name) the comment before value_struct_elt_for_reference. */ struct value * @@ -25029,7 +27825,7 @@ index 5e5c4ed..446a4d1 100644 enum noside noside) { switch (TYPE_CODE (curtype)) -@@ -2534,7 +2641,7 @@ value_aggregate_elt (struct type *curtype, +@@ -2543,7 +2648,7 @@ value_aggregate_elt (struct type *curtype, case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: return value_struct_elt_for_reference (curtype, 0, curtype, @@ -25038,7 +27834,7 @@ index 5e5c4ed..446a4d1 100644 want_address, noside); case TYPE_CODE_NAMESPACE: return value_namespace_elt (curtype, name, -@@ -2545,6 +2652,56 @@ value_aggregate_elt (struct type *curtype, +@@ -2554,6 +2659,56 @@ value_aggregate_elt (struct type *curtype, } } @@ -25095,7 +27891,7 @@ index 5e5c4ed..446a4d1 100644 /* C++: Given an aggregate type CURTYPE, and a member name NAME, return the address of this member as a "pointer to member" type. If INTYPE is non-null, then it will be the type of the member we -@@ -2622,23 +2779,46 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -2631,23 +2786,46 @@ value_struct_elt_for_reference (struct type *domain, int offset, } if (t_field_name && strcmp (t_field_name, name) == 0) { @@ -25152,16 +27948,16 @@ index 5e5c4ed..446a4d1 100644 if (TYPE_FN_FIELD_STATIC_P (f, j)) { -@@ -2752,7 +2932,7 @@ value_maybe_namespace_elt (const struct type *curtype, +@@ -2761,7 +2939,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, ++ sym = cp_lookup_symbol_namespace(namespace_name, name, get_selected_block (0), VAR_DOMAIN); -@@ -2896,7 +3076,7 @@ value_of_local (const char *name, int complain) +@@ -2905,7 +3083,7 @@ value_of_local (const char *name, int complain) /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER symbol instead of the LOC_ARG one (if both exist). */ @@ -25170,7 +27966,7 @@ index 5e5c4ed..446a4d1 100644 if (sym == NULL) { if (complain) -@@ -2950,8 +3130,6 @@ value_slice (struct value *array, int lowbound, int length) +@@ -2959,8 +3137,6 @@ value_slice (struct value *array, int lowbound, int length) || lowbound + length - 1 > upperbound) error (_("slice out of range")); @@ -25180,10 +27976,18 @@ index 5e5c4ed..446a4d1 100644 TYPE_TARGET_TYPE (range_type), lowbound, diff --git a/gdb/valprint.c b/gdb/valprint.c -index cbb5d94..cf35bf0 100644 +index cbb5d94..f9634ea 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c -@@ -1153,6 +1153,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -236,7 +236,6 @@ scalar_type_p (struct type *type) + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_SET: +- case TYPE_CODE_STRING: + case TYPE_CODE_BITSTRING: + return 0; + default: +@@ -1153,6 +1152,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, for (; i < len && things_printed < options->print_max; i++) { @@ -25191,7 +27995,7 @@ index cbb5d94..cf35bf0 100644 if (i != 0) { if (options->prettyprint_arrays) -@@ -1172,7 +1173,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1172,7 +1172,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, rep1 = i + 1; reps = 1; while ((rep1 < len) && @@ -25201,7 +28005,7 @@ index cbb5d94..cf35bf0 100644 ++reps; ++rep1; diff --git a/gdb/value.c b/gdb/value.c -index 65a5aa9..c943781 100644 +index 589e03b..66013b7 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -37,8 +37,10 @@ @@ -25230,7 +28034,7 @@ index 65a5aa9..c943781 100644 /* Register number if the value is from a register. */ short regnum; -@@ -257,7 +267,9 @@ allocate_value_lazy (struct type *type) +@@ -261,7 +271,9 @@ allocate_value_lazy (struct type *type) val->next = all_values; all_values = val; val->type = type; @@ -25240,7 +28044,7 @@ index 65a5aa9..c943781 100644 VALUE_LVAL (val) = not_lval; val->location.address = 0; VALUE_FRAME_ID (val) = null_frame_id; -@@ -367,6 +379,8 @@ value_type (struct value *value) +@@ -346,6 +358,8 @@ value_type (struct value *value) void deprecated_set_value_type (struct value *value, struct type *type) { @@ -25249,91 +28053,17 @@ index 65a5aa9..c943781 100644 value->type = type; } -@@ -623,27 +637,28 @@ value_free (struct value *val) - { - if (val) - { -- gdb_assert (val->reference_count > 0); -- val->reference_count--; -- if (val->reference_count > 0) -- return; -+ /* If the count was already 0, then the value was on the -+ all_values list, and we must be freeing back to some -+ point. */ -+ if (val->refcount <= 1) -+ { -+ type_decref (val->type); -+ type_decref (val->enclosing_type); +@@ -624,6 +638,9 @@ value_free (struct value *val) + if (val->parent != NULL) + value_free (val->parent); -- /* If there's an associated parent value, drop our reference to -- it. */ -- if (val->parent != NULL) -- value_free (val->parent); -+ if (VALUE_LVAL (val) == lval_computed) -+ { -+ struct lval_funcs *funcs = val->location.computed.funcs; - -- if (VALUE_LVAL (val) == lval_computed) -- { -- struct lval_funcs *funcs = val->location.computed.funcs; -+ if (funcs->free_closure) -+ funcs->free_closure (val); -+ } - -- if (funcs->free_closure) -- funcs->free_closure (val); -+ xfree (val->contents); -+ xfree (val); - } -- -- xfree (val->contents); -+ else -+ --val->refcount; - } -- xfree (val); - } - - /* Free all values allocated since MARK was obtained by value_mark -@@ -686,22 +701,26 @@ free_all_values (void) - void - release_value (struct value *val) - { -- struct value *v; -- -- if (all_values == val) -- { -- all_values = val->next; -- return; -- } -- -- for (v = all_values; v; v = v->next) -+ /* If the reference count is nonzero, then we have already removed -+ the item from the list, so there is no reason to do it again. */ -+ if (val->refcount == 0) - { -- if (v->next == val) -+ if (all_values == val) -+ all_values = val->next; -+ else ++ type_decref (val->type); ++ type_decref (val->enclosing_type); ++ + if (VALUE_LVAL (val) == lval_computed) { -- v->next = val->next; -- break; -+ struct value *v; -+ for (v = all_values; v; v = v->next) -+ { -+ if (v->next == val) -+ { -+ v->next = val->next; -+ break; -+ } -+ } - } - } -+ ++val->refcount; - } - - /* Release all values up to mark */ -@@ -736,6 +755,9 @@ value_copy (struct value *arg) + struct lval_funcs *funcs = val->location.computed.funcs; +@@ -728,6 +745,9 @@ value_copy (struct value *arg) val = allocate_value_lazy (encl_type); else val = allocate_value (encl_type); @@ -25343,7 +28073,7 @@ index 65a5aa9..c943781 100644 val->type = arg->type; VALUE_LVAL (val) = VALUE_LVAL (arg); val->location = arg->location; -@@ -771,12 +793,15 @@ value_copy (struct value *arg) +@@ -763,12 +783,15 @@ value_copy (struct value *arg) void set_value_component_location (struct value *component, struct value *whole) { @@ -25359,7 +28089,7 @@ index 65a5aa9..c943781 100644 if (VALUE_LVAL (whole) == lval_computed) { struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -784,6 +809,10 @@ set_value_component_location (struct value *component, struct value *whole) +@@ -776,6 +799,10 @@ set_value_component_location (struct value *component, struct value *whole) if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -25370,7 +28100,7 @@ index 65a5aa9..c943781 100644 } -@@ -914,6 +943,29 @@ show_values (char *num_exp, int from_tty) +@@ -906,6 +933,29 @@ show_values (char *num_exp, int from_tty) num_exp[1] = '\0'; } } @@ -25400,7 +28130,7 @@ index 65a5aa9..c943781 100644 /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -1388,6 +1440,37 @@ call_internal_function (struct gdbarch *gdbarch, +@@ -1381,6 +1431,40 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -25419,10 +28149,13 @@ index 65a5aa9..c943781 100644 + type_mark_used (value_type (var->u.value)); + break; + -+ case INTERNALVAR_SCALAR: -+ type_mark_used (var->u.scalar.type); ++ case INTERNALVAR_INTEGER: ++ type_mark_used (var->u.integer.type); + break; + ++ case INTERNALVAR_POINTER: ++ type_mark_used (var->u.pointer.type); ++ break; + } + + for (chunk = value_history_chain; chunk != NULL; chunk = chunk->next) @@ -25438,13 +28171,7 @@ index 65a5aa9..c943781 100644 /* The 'function' command. This does nothing -- it is just a placeholder to let "help function NAME" work. This is also used as the implementation of the sub-command that is created when -@@ -1430,16 +1513,15 @@ add_internal_function (const char *name, const char *doc, - /* Update VALUE before discarding OBJFILE. COPIED_TYPES is used to - prevent cycles / duplicates. */ - --static void -+void - preserve_one_value (struct value *value, struct objfile *objfile, +@@ -1428,11 +1512,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -25458,35 +28185,23 @@ index 65a5aa9..c943781 100644 copied_types); } -@@ -1454,7 +1536,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, - case INTERNALVAR_SCALAR: - if (var->u.scalar.type && TYPE_OBJFILE (var->u.scalar.type) == objfile) - var->u.scalar.type -- = copy_type_recursive (objfile, var->u.scalar.type, copied_types); -+ = copy_type_recursive (var->u.scalar.type, copied_types); +@@ -1447,13 +1530,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, + case INTERNALVAR_INTEGER: + if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) + var->u.integer.type +- = copy_type_recursive (objfile, var->u.integer.type, copied_types); ++ = copy_type_recursive (var->u.integer.type, copied_types); + break; + + case INTERNALVAR_POINTER: + if (TYPE_OBJFILE (var->u.pointer.type) == objfile) + var->u.pointer.type +- = copy_type_recursive (objfile, var->u.pointer.type, copied_types); ++ = copy_type_recursive (var->u.pointer.type, copied_types); break; case INTERNALVAR_VALUE: -@@ -1469,7 +1551,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, - this objfile's types, and the convenience variables will be adjusted to - use the new global types. */ - --void -+static void - preserve_values (struct objfile *objfile) - { - htab_t copied_types; -@@ -1490,8 +1572,7 @@ preserve_values (struct objfile *objfile) - for (var = internalvars; var; var = var->next) - preserve_one_internalvar (var, objfile, copied_types); - -- for (val = values_in_python; val; val = val->next) -- preserve_one_value (val, objfile, copied_types); -+ preserve_python_values (objfile, copied_types); - - htab_delete (copied_types); - } -@@ -1857,6 +1938,8 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type) +@@ -1855,6 +1938,8 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type) val->contents = (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); @@ -25495,7 +28210,7 @@ index 65a5aa9..c943781 100644 val->enclosing_type = new_encl_type; return val; } -@@ -1921,6 +2004,8 @@ value_primitive_field (struct value *arg1, int offset, +@@ -1919,6 +2004,8 @@ value_primitive_field (struct value *arg1, int offset, memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1), TYPE_LENGTH (value_enclosing_type (arg1))); } @@ -25504,7 +28219,7 @@ index 65a5aa9..c943781 100644 v->type = type; v->offset = value_offset (arg1); v->embedded_offset = (offset + value_embedded_offset (arg1) -@@ -2171,6 +2256,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) +@@ -2177,6 +2264,42 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num) } @@ -25547,7 +28262,7 @@ index 65a5aa9..c943781 100644 /* Convert C numbers into newly allocated values. */ struct value * -@@ -2184,6 +2305,19 @@ value_from_longest (struct type *type, LONGEST num) +@@ -2190,6 +2313,19 @@ value_from_longest (struct type *type, LONGEST num) } @@ -25567,21 +28282,20 @@ index 65a5aa9..c943781 100644 /* Create a value representing a pointer of type TYPE to the address ADDR. */ struct value * -@@ -2342,4 +2476,9 @@ VARIABLE is already initialized.")); +@@ -2348,4 +2484,8 @@ VARIABLE is already initialized.")); add_prefix_cmd ("function", no_class, function_command, _("\ Placeholder command for showing help on convenience functions."), &functionlist, "function ", 0, &cmdlist); + + make_final_cleanup (value_history_cleanup, NULL); + -+ observer_attach_objfile_unloading (preserve_values); + observer_attach_mark_used (value_types_mark_used); } diff --git a/gdb/value.h b/gdb/value.h -index 29ad783..ee8440b 100644 +index 51e6960..48b30e4 100644 --- a/gdb/value.h +++ b/gdb/value.h -@@ -344,11 +344,16 @@ extern LONGEST unpack_field_as_long (struct type *type, +@@ -342,11 +342,16 @@ extern LONGEST unpack_field_as_long (struct type *type, extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num); extern struct value *value_from_longest (struct type *type, LONGEST num); @@ -25598,7 +28312,7 @@ index 29ad783..ee8440b 100644 extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); -@@ -438,6 +443,7 @@ extern struct value *value_struct_elt (struct value **argp, +@@ -436,6 +441,7 @@ extern struct value *value_struct_elt (struct value **argp, extern struct value *value_aggregate_elt (struct type *curtype, char *name, @@ -25606,21 +28320,6 @@ index 29ad783..ee8440b 100644 int want_address, enum noside noside); -@@ -658,12 +664,12 @@ extern void typedef_print (struct type *type, struct symbol *news, - - extern char *internalvar_name (struct internalvar *var); - --extern void preserve_values (struct objfile *); -- - /* From values.c */ - - extern struct value *value_copy (struct value *); - -+extern void preserve_one_value (struct value *, struct objfile *, htab_t); -+ - /* From valops.c */ - - extern struct value *varying_to_slice (struct value *); @@ -681,7 +687,7 @@ extern struct value *value_allocate_space_in_inferior (int); extern struct value *value_of_local (const char *name, int complain); @@ -25631,10 +28330,10 @@ index 29ad783..ee8440b 100644 /* User function handler. */ diff --git a/gdb/varobj.c b/gdb/varobj.c -index 4a94988..34333fb 100644 +index 8f22156..8fe72ca 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c -@@ -26,14 +26,18 @@ +@@ -26,6 +26,8 @@ #include "gdbcmd.h" #include "block.h" #include "valprint.h" @@ -25643,65 +28342,7 @@ index 4a94988..34333fb 100644 #include "gdb_assert.h" #include "gdb_string.h" -+#include "gdb_regex.h" - - #include "varobj.h" - #include "vec.h" - #include "gdbthread.h" - #include "inferior.h" -+#include "observer.h" - - #if HAVE_PYTHON - #include "python/python.h" -@@ -59,6 +63,15 @@ char *varobj_format_string[] = - /* String representations of gdb's known languages */ - char *varobj_language_string[] = { "unknown", "C", "C++", "Java" }; - -+/* True if we want to allow Python-based pretty-printing. */ -+static int pretty_printing = 0; -+ -+void -+varobj_enable_pretty_printing (void) -+{ -+ pretty_printing = 1; -+} -+ - /* Data structures */ - - /* Every root variable has one of these structures saved in its -@@ -173,9 +186,31 @@ struct varobj - frozen. */ - int not_fetched; - -+ /* Sub-range of children which the MI consumer has requested. If -+ FROM < 0 or TO < 0, means that all children have been -+ requested. */ -+ int from; -+ int to; -+ -+ /* The pretty-printer constructor. If NULL, then the default -+ pretty-printer will be looked up. If None, then no -+ pretty-printer will be installed. */ -+ PyObject *constructor; -+ - /* The pretty-printer that has been constructed. If NULL, then a - new printer object is needed, and one will be constructed. */ - PyObject *pretty_printer; -+ -+ /* The iterator returned by the printer's 'children' method, or NULL -+ if not available. */ -+ PyObject *child_iter; -+ -+ /* We request one extra item from the iterator, so that we can -+ report to the caller whether there are more items than we have -+ already reported. However, we don't want to install this value -+ when we read it, because that will mess up future updates. So, -+ we stash it here instead. */ -+ PyObject *saved_item; - }; - - struct cpstack -@@ -221,6 +256,8 @@ static void free_variable (struct varobj *var); +@@ -253,6 +255,8 @@ static void free_variable (struct varobj *var); static struct cleanup *make_cleanup_free_variable (struct varobj *var); @@ -25710,16 +28351,7 @@ index 4a94988..34333fb 100644 static struct type *get_type (struct varobj *var); static struct type *get_value_type (struct varobj *var); -@@ -236,8 +273,6 @@ static char *cppop (struct cpstack **pstack); - static int install_new_value (struct varobj *var, struct value *value, - int initial); - --static void install_default_visualizer (struct varobj *var); -- - /* Language-specific routines. */ - - static enum varobj_languages variable_language (struct varobj *var); -@@ -450,6 +485,8 @@ is_root_p (struct varobj *var) +@@ -480,6 +484,8 @@ is_root_p (struct varobj *var) struct cleanup * varobj_ensure_python_env (struct varobj *var) { @@ -25728,34 +28360,15 @@ index 4a94988..34333fb 100644 return ensure_python_env (var->root->exp->gdbarch, var->root->exp->language_defn); } -@@ -614,9 +651,9 @@ varobj_create (char *objname, +@@ -651,6 +657,7 @@ varobj_create (char *objname, do_cleanups (old_chain); return NULL; } + make_cleanup_uninstall_variable (var); } -- install_default_visualizer (var); discard_cleanups (old_chain); - return var; - } -@@ -731,15 +768,8 @@ instantiate_pretty_printer (PyObject *constructor, struct value *value) - #if HAVE_PYTHON - PyObject *val_obj = NULL; - PyObject *printer; -- volatile struct gdb_exception except; - -- TRY_CATCH (except, RETURN_MASK_ALL) -- { -- value = value_copy (value); -- } -- GDB_PY_HANDLE_EXCEPTION (except); - val_obj = value_to_value_object (value); -- - if (! val_obj) - return NULL; - -@@ -792,7 +822,12 @@ varobj_get_display_hint (struct varobj *var) +@@ -821,7 +828,12 @@ varobj_get_display_hint (struct varobj *var) char *result = NULL; #if HAVE_PYTHON @@ -25769,650 +28382,7 @@ index 4a94988..34333fb 100644 if (var->pretty_printer) result = gdbpy_get_display_hint (var->pretty_printer); -@@ -803,6 +838,17 @@ varobj_get_display_hint (struct varobj *var) - return result; - } - -+/* Return true if the varobj has items after TO, false otherwise. */ -+ -+int -+varobj_has_more (struct varobj *var, int to) -+{ -+ if (VEC_length (varobj_p, var->children) > to) -+ return 1; -+ return (VEC_length (varobj_p, var->children) == to -+ && var->saved_item != NULL); -+} -+ - /* If the variable object is bound to a specific thread, that - is its evaluation can always be done in context of a frame - inside that thread, returns GDB id of the thread -- which -@@ -835,22 +881,73 @@ varobj_get_frozen (struct varobj *var) - return var->frozen; - } - -+/* A helper function that restricts a range to what is actually -+ available in a VEC. This follows the usual rules for the meaning -+ of FROM and TO -- if either is negative, the entire range is -+ used. */ -+ -+static void -+restrict_range (VEC (varobj_p) *children, int *from, int *to) -+{ -+ if (*from < 0 || *to < 0) -+ { -+ *from = 0; -+ *to = VEC_length (varobj_p, children); -+ } -+ else -+ { -+ if (*from > VEC_length (varobj_p, children)) -+ *from = VEC_length (varobj_p, children); -+ if (*to > VEC_length (varobj_p, children)) -+ *to = VEC_length (varobj_p, children); -+ if (*from > *to) -+ *from = *to; -+ } -+} -+ -+/* A helper for update_dynamic_varobj_children that installs a new -+ child when needed. */ -+ -+static void -+install_dynamic_child (struct varobj *var, -+ VEC (varobj_p) **changed, -+ VEC (varobj_p) **new, -+ int *cchanged, -+ int index, -+ const char *name, -+ struct value *value) -+{ -+ if (VEC_length (varobj_p, var->children) < index + 1) -+ { -+ /* There's no child yet. */ -+ struct varobj *child = varobj_add_child (var, name, value); -+ if (new) -+ VEC_safe_push (varobj_p, *new, child); -+ *cchanged = 1; -+ } -+ else -+ { -+ varobj_p existing = VEC_index (varobj_p, var->children, index); -+ if (install_new_value (existing, value, 0)) -+ { -+ if (changed) -+ VEC_safe_push (varobj_p, *changed, existing); -+ } -+ } -+} -+ - static int - update_dynamic_varobj_children (struct varobj *var, - VEC (varobj_p) **changed, -- VEC (varobj_p) **new_and_unchanged, -- int *cchanged) -- -+ VEC (varobj_p) **new, -+ int *cchanged, -+ int update_children, -+ int to) - { - #if HAVE_PYTHON -- /* FIXME: we *might* want to provide this functionality as -- a standalone function, so that other interested parties -- than varobj code can benefit for this. */ - struct cleanup *back_to; - PyObject *children; -- PyObject *iterator; - int i; -- int children_changed = 0; - PyObject *printer = var->pretty_printer; - - back_to = varobj_ensure_python_env (var); -@@ -862,96 +959,103 @@ update_dynamic_varobj_children (struct varobj *var, - return 0; - } - -- children = PyObject_CallMethodObjArgs (printer, gdbpy_children_cst, -- NULL); -- -- if (!children) -+ if (update_children || !var->child_iter) - { -- gdbpy_print_stack (); -- error (_("Null value returned for children")); -- } -+ children = PyObject_CallMethodObjArgs (printer, gdbpy_children_cst, -+ NULL); - -- make_cleanup_py_decref (children); -+ if (!children) -+ { -+ gdbpy_print_stack (); -+ error (_("Null value returned for children")); -+ } - -- if (!PyIter_Check (children)) -- error (_("Returned value is not iterable")); -+ make_cleanup_py_decref (children); - -- iterator = PyObject_GetIter (children); -- if (!iterator) -- { -- gdbpy_print_stack (); -- error (_("Could not get children iterator")); -+ if (!PyIter_Check (children)) -+ error (_("Returned value is not iterable")); -+ -+ Py_XDECREF (var->child_iter); -+ var->child_iter = PyObject_GetIter (children); -+ if (!var->child_iter) -+ { -+ gdbpy_print_stack (); -+ error (_("Could not get children iterator")); -+ } -+ -+ Py_XDECREF (var->saved_item); -+ var->saved_item = NULL; -+ -+ i = 0; - } -- make_cleanup_py_decref (iterator); -+ else -+ i = VEC_length (varobj_p, var->children); - -- for (i = 0; ; ++i) -+ /* We ask for one extra child, so that MI can report whether there -+ are more children. */ -+ for (; to < 0 || i < to + 1; ++i) - { -- PyObject *item = PyIter_Next (iterator); -- PyObject *py_v; -- struct value *v; -- char *name; -- struct cleanup *inner; -- -- if (!item) -- break; -- inner = make_cleanup_py_decref (item); -+ PyObject *item; - -- if (!PyArg_ParseTuple (item, "sO", &name, &py_v)) -- error (_("Invalid item from the child list")); -- -- if (PyObject_TypeCheck (py_v, &value_object_type)) -+ /* See if there was a leftover from last time. */ -+ if (var->saved_item) - { -- /* If we just call convert_value_from_python for this type, -- we won't know who owns the result. For this one case we -- need to copy the resulting value. */ -- v = value_object_to_value (py_v); -- v = value_copy (v); -+ item = var->saved_item; -+ var->saved_item = NULL; - } - else -- v = convert_value_from_python (py_v); -+ item = PyIter_Next (var->child_iter); - -- /* TODO: This assume the name of the i-th child never changes. */ -+ if (!item) -+ break; - -- /* Now see what to do here. */ -- if (VEC_length (varobj_p, var->children) < i + 1) -+ /* We don't want to push the extra child on any report list. */ -+ if (to < 0 || i < to) - { -- /* There's no child yet. */ -- struct varobj *child = varobj_add_child (var, name, v); -- if (new_and_unchanged) -- VEC_safe_push (varobj_p, *new_and_unchanged, child); -- children_changed = 1; -+ PyObject *py_v; -+ char *name; -+ struct value *v; -+ struct cleanup *inner; -+ -+ inner = make_cleanup_py_decref (item); -+ -+ if (!PyArg_ParseTuple (item, "sO", &name, &py_v)) -+ error (_("Invalid item from the child list")); -+ -+ v = convert_value_from_python (py_v); -+ install_dynamic_child (var, changed, new, -+ cchanged, i, name, v); -+ do_cleanups (inner); - } -- else -+ else - { -- varobj_p existing = VEC_index (varobj_p, var->children, i); -- if (install_new_value (existing, v, 0) && changed) -- { -- if (changed) -- VEC_safe_push (varobj_p, *changed, existing); -- } -- else -- { -- if (new_and_unchanged) -- VEC_safe_push (varobj_p, *new_and_unchanged, existing); -- } -- } -+ Py_XDECREF (var->saved_item); -+ var->saved_item = item; - -- do_cleanups (inner); -+ /* We want to truncate the child list just before this -+ element. */ -+ break; -+ } - } - - if (i < VEC_length (varobj_p, var->children)) - { -- int i; -- children_changed = 1; -- for (i = 0; i < VEC_length (varobj_p, var->children); ++i) -- varobj_delete (VEC_index (varobj_p, var->children, i), NULL, 0); -+ int j; -+ *cchanged = 1; -+ for (j = i; j < VEC_length (varobj_p, var->children); ++j) -+ varobj_delete (VEC_index (varobj_p, var->children, j), NULL, 0); -+ VEC_truncate (varobj_p, var->children, i); - } -- VEC_truncate (varobj_p, var->children, i); -+ -+ /* If there are fewer children than requested, note that the list of -+ children changed. */ -+ if (to >= 0 && VEC_length (varobj_p, var->children) < to) -+ *cchanged = 1; -+ - var->num_children = VEC_length (varobj_p, var->children); - - do_cleanups (back_to); - -- *cchanged = children_changed; - return 1; - #else - gdb_assert (0 && "should never be called if Python is not enabled"); -@@ -964,8 +1068,7 @@ varobj_get_num_children (struct varobj *var) - if (var->num_children == -1) - { - int changed; -- if (!var->pretty_printer -- || !update_dynamic_varobj_children (var, NULL, NULL, &changed)) -+ if (!var->pretty_printer) - var->num_children = number_of_children (var); - } - -@@ -976,7 +1079,7 @@ varobj_get_num_children (struct varobj *var) - the return code is the number of such children or -1 on error */ - - VEC (varobj_p)* --varobj_list_children (struct varobj *var) -+varobj_list_children (struct varobj *var, int *from, int *to) - { - struct varobj *child; - char *name; -@@ -988,8 +1091,12 @@ varobj_list_children (struct varobj *var) - /* This, in theory, can result in the number of children changing without - frontend noticing. But well, calling -var-list-children on the same - varobj twice is not something a sane frontend would do. */ -- && update_dynamic_varobj_children (var, NULL, NULL, &children_changed)) -- return var->children; -+ && update_dynamic_varobj_children (var, NULL, NULL, &children_changed, -+ 0, *to)) -+ { -+ restrict_range (var->children, from, to); -+ return var->children; -+ } - - if (var->num_children == -1) - var->num_children = number_of_children (var); -@@ -1015,10 +1122,10 @@ varobj_list_children (struct varobj *var) - name = name_of_child (var, i); - existing = create_child (var, i, name); - VEC_replace (varobj_p, var->children, i, existing); -- install_default_visualizer (existing); - } - } - -+ restrict_range (var->children, from, to); - return var->children; - } - -@@ -1029,7 +1136,6 @@ varobj_add_child (struct varobj *var, const char *name, struct value *value) - VEC_length (varobj_p, var->children), - name, value); - VEC_safe_push (varobj_p, var->children, v); -- install_default_visualizer (v); - return v; - } - -@@ -1168,6 +1274,115 @@ varobj_set_value (struct varobj *var, char *expression) - return 1; - } - -+#if HAVE_PYTHON -+ -+/* A helper function to install a constructor function and visualizer -+ in a varobj. */ -+ -+static void -+install_visualizer (struct varobj *var, PyObject *constructor, -+ PyObject *visualizer) -+{ -+ Py_XDECREF (var->constructor); -+ var->constructor = constructor; -+ -+ Py_XDECREF (var->pretty_printer); -+ var->pretty_printer = visualizer; -+ -+ Py_XDECREF (var->child_iter); -+ var->child_iter = NULL; -+} -+ -+/* Install the default visualizer for VAR. */ -+ -+static void -+install_default_visualizer (struct varobj *var) -+{ -+ if (pretty_printing) -+ { -+ PyObject *pretty_printer = NULL; -+ -+ if (var->value) -+ { -+ pretty_printer = gdbpy_get_varobj_pretty_printer (var->value); -+ if (! pretty_printer) -+ { -+ gdbpy_print_stack (); -+ error (_("Cannot instantiate printer for default visualizer")); -+ } -+ } -+ -+ if (pretty_printer == Py_None) -+ { -+ Py_DECREF (pretty_printer); -+ pretty_printer = NULL; -+ } -+ -+ install_visualizer (var, NULL, pretty_printer); -+ } -+} -+ -+/* Instantiate and install a visualizer for VAR using CONSTRUCTOR to -+ make a new object. */ -+ -+static void -+construct_visualizer (struct varobj *var, PyObject *constructor) -+{ -+ PyObject *pretty_printer; -+ -+ Py_INCREF (constructor); -+ if (constructor == Py_None) -+ pretty_printer = NULL; -+ else -+ { -+ pretty_printer = instantiate_pretty_printer (constructor, var->value); -+ if (! pretty_printer) -+ { -+ gdbpy_print_stack (); -+ Py_DECREF (constructor); -+ constructor = Py_None; -+ Py_INCREF (constructor); -+ } -+ -+ if (pretty_printer == Py_None) -+ { -+ Py_DECREF (pretty_printer); -+ pretty_printer = NULL; -+ } -+ } -+ -+ install_visualizer (var, constructor, pretty_printer); -+} -+ -+#endif /* HAVE_PYTHON */ -+ -+/* A helper function for install_new_value. This creates and installs -+ a visualizer for VAR, if appropriate. */ -+ -+static void -+install_new_value_visualizer (struct varobj *var) -+{ -+#if HAVE_PYTHON -+ /* If the constructor is None, then we want the raw value. */ -+ if (var->constructor != Py_None) -+ { -+ struct cleanup *cleanup; -+ PyObject *pretty_printer = NULL; -+ -+ cleanup = varobj_ensure_python_env (var); -+ -+ if (!var->constructor) -+ install_default_visualizer (var); -+ else -+ construct_visualizer (var, var->constructor); -+ -+ do_cleanups (cleanup); -+ } -+#else -+ /* Do nothing. */ -+#endif -+} -+ - /* Assign a new value to a variable object. If INITIAL is non-zero, - this is the first assignement after the variable object was just - created, or changed type. In that case, just assign the value -@@ -1274,7 +1489,7 @@ install_new_value (struct varobj *var, struct value *value, int initial) - { - changed = 1; - } -- else -+ else if (! var->pretty_printer) - { - /* Try to compare the values. That requires that both - values are non-lazy. */ -@@ -1328,65 +1543,32 @@ install_new_value (struct varobj *var, struct value *value, int initial) - var->not_fetched = 0; - var->updated = 0; - -+ install_new_value_visualizer (var); -+ - gdb_assert (!var->value || value_type (var->value)); - - return changed; - } - --static void --install_visualizer (struct varobj *var, PyObject *visualizer) -+/* Return the requested range for a varobj. VAR is the varobj. FROM -+ and TO are out parameters; *FROM and *TO will be set to the -+ selected sub-range of VAR. If no range was selected using -+ -var-set-update-range, then both will be -1. */ -+void -+varobj_get_child_range (struct varobj *var, int *from, int *to) - { --#if HAVE_PYTHON -- /* If there are any children now, wipe them. */ -- varobj_delete (var, NULL, 1 /* children only */); -- var->num_children = -1; -- -- Py_XDECREF (var->pretty_printer); -- var->pretty_printer = visualizer; -- -- install_new_value (var, var->value, 1); -- -- /* If we removed the visualizer, and the user ever requested the -- object's children, then we must compute the list of children. -- Note that we needn't do this when installing a visualizer, -- because updating will recompute dynamic children. */ -- if (!visualizer && var->children_requested) -- varobj_list_children (var); --#else -- error (_("Python support required")); --#endif -+ *from = var->from; -+ *to = var->to; - } - --static void --install_default_visualizer (struct varobj *var) -+/* Set the selected sub-range of children of VAR to start at index -+ FROM and end at index TO. If either FROM or TO is less than zero, -+ this is interpreted as a request for all children. */ -+void -+varobj_set_child_range (struct varobj *var, int from, int to) - { --#if HAVE_PYTHON -- struct cleanup *cleanup; -- PyObject *pretty_printer = NULL; -- -- cleanup = varobj_ensure_python_env (var); -- -- if (var->value) -- { -- pretty_printer = gdbpy_get_varobj_pretty_printer (var->value); -- if (! pretty_printer) -- { -- gdbpy_print_stack (); -- error (_("Cannot instantiate printer for default visualizer")); -- } -- } -- -- if (pretty_printer == Py_None) -- { -- Py_DECREF (pretty_printer); -- pretty_printer = NULL; -- } -- -- install_visualizer (var, pretty_printer); -- do_cleanups (cleanup); --#else -- /* No error is right as this function is inserted just as a hook. */ --#endif -+ var->from = from; -+ var->to = to; - } - - void -@@ -1404,31 +1586,19 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer) - make_cleanup_py_decref (globals); - - constructor = PyRun_String (visualizer, Py_eval_input, globals, globals); -- -- /* Do not instantiate NoneType. */ -- if (constructor == Py_None) -- { -- pretty_printer = Py_None; -- Py_INCREF (pretty_printer); -- } -- else -- pretty_printer = instantiate_pretty_printer (constructor, var->value); -- -- Py_XDECREF (constructor); - -- if (! pretty_printer) -+ if (! constructor) - { - gdbpy_print_stack (); - error (_("Could not evaluate visualizer expression: %s"), visualizer); - } - -- if (pretty_printer == Py_None) -- { -- Py_DECREF (pretty_printer); -- pretty_printer = NULL; -- } -+ construct_visualizer (var, constructor); -+ Py_XDECREF (constructor); - -- install_visualizer (var, pretty_printer); -+ /* If there are any children now, wipe them. */ -+ varobj_delete (var, NULL, 1 /* children only */); -+ var->num_children = -1; - - do_cleanups (back_to); - #else -@@ -1543,7 +1713,7 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit) - UI, so we need not bother getting it. */ - if (v->pretty_printer) - { -- VEC (varobj_p) *changed = 0, *new_and_unchanged = 0; -+ VEC (varobj_p) *changed = 0, *new = 0; - int i, children_changed; - varobj_p tmp; - -@@ -1555,28 +1725,28 @@ VEC(varobj_update_result) *varobj_update (struct varobj **varp, int explicit) - - /* If update_dynamic_varobj_children returns 0, then we have - a non-conforming pretty-printer, so we skip it. */ -- if (update_dynamic_varobj_children (v, &changed, &new_and_unchanged, -- &children_changed)) -+ if (update_dynamic_varobj_children (v, &changed, &new, -+ &children_changed, 1, v->to)) - { -- if (children_changed) -- r.children_changed = 1; -- for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i) -+ if (children_changed || new) - { -- varobj_update_result r = {tmp}; -- r.changed = 1; -- r.value_installed = 1; -- VEC_safe_push (varobj_update_result, stack, &r); -+ r.children_changed = 1; -+ r.new = new; - } -- for (i = 0; -- VEC_iterate (varobj_p, new_and_unchanged, i, tmp); -- ++i) -+ for (i = 0; VEC_iterate (varobj_p, changed, i, tmp); ++i) - { - varobj_update_result r = {tmp}; -+ r.changed = 1; - r.value_installed = 1; - VEC_safe_push (varobj_update_result, stack, &r); - } - if (r.changed || r.children_changed) - VEC_safe_push (varobj_update_result, result, &r); -+ -+ /* Free CHANGED, but not NEW, because NEW has been put -+ into the result vector. */ -+ VEC_free (varobj_p, changed); -+ - continue; - } - } -@@ -1864,7 +2034,12 @@ new_variable (void) - var->frozen = 0; - var->not_fetched = 0; - var->children_requested = 0; -+ var->from = -1; -+ var->to = -1; -+ var->constructor = 0; - var->pretty_printer = 0; -+ var->child_iter = 0; -+ var->saved_item = 0; - - return var; - } -@@ -1894,7 +2069,10 @@ free_variable (struct varobj *var) - if (var->pretty_printer) - { - struct cleanup *cleanup = varobj_ensure_python_env (var); -- Py_DECREF (var->pretty_printer); -+ Py_XDECREF (var->constructor); -+ Py_XDECREF (var->pretty_printer); -+ Py_XDECREF (var->child_iter); -+ Py_XDECREF (var->saved_item); - do_cleanups (cleanup); - } - #endif -@@ -1927,6 +2105,18 @@ make_cleanup_free_variable (struct varobj *var) +@@ -2186,6 +2198,18 @@ make_cleanup_free_variable (struct varobj *var) return make_cleanup (do_free_variable_cleanup, var); } @@ -26431,16 +28401,7 @@ index 4a94988..34333fb 100644 /* This returns the type of the variable. It also skips past typedefs to return the real type of the variable. -@@ -2141,6 +2331,8 @@ value_of_root (struct varobj **var_handle, int *type_changed) - else - { - tmp_var->obj_name = xstrdup (var->obj_name); -+ tmp_var->from = var->from; -+ tmp_var->to = var->to; - varobj_delete (var, NULL, 0); - - install_variable (tmp_var); -@@ -3173,6 +3365,19 @@ java_value_of_variable (struct varobj *var, enum varobj_display_formats format) +@@ -3442,6 +3466,19 @@ java_value_of_variable (struct varobj *var, enum varobj_display_formats format) return cplus_value_of_variable (var, format); } @@ -26460,41 +28421,26 @@ index 4a94988..34333fb 100644 /* Iterate all the existing _root_ VAROBJs and call the FUNC callback for them with an arbitrary caller supplied DATA pointer. */ -@@ -3190,48 +3395,110 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) +@@ -3459,6 +3496,43 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) (*func) (var_root->rootvar, data); } } -- --extern void _initialize_varobj (void); --void --_initialize_varobj (void) + +/* Helper for varobj_types_mark_used. Call type_mark_used for any TYPEs + referenced from this VAR. */ + +static void +varobj_types_mark_used_iter (struct varobj *var, void *unused) - { -- int sizeof_table = sizeof (struct vlist *) * VAROBJ_TABLE_SIZE; ++{ + /* Even FLOATING or IS_INVALID VARs with non-NULL TYPE references will + free them in free_variable. Still EXP may also reference TYPEs + but these belong to SYMBOLs which should be always associated with + an OBJFILE (and therefore not useful to be type_mark_used). */ - -- varobj_table = xmalloc (sizeof_table); -- memset (varobj_table, 0, sizeof_table); ++ + type_mark_used (var->type); + if (var->value) + type_mark_used (value_type (var->value)); - -- add_setshow_zinteger_cmd ("debugvarobj", class_maintenance, -- &varobjdebug, _("\ --Set varobj debugging."), _("\ --Show varobj debugging."), _("\ --When non-zero, varobj debugging is enabled."), -- NULL, -- show_varobjdebug, -- &setlist, &showlist); ++ + /* Check VAROBJROOTs only once during the varobj_types_mark_used pass. */ + + if (var->root->rootvar == var) @@ -26502,20 +28448,13 @@ index 4a94988..34333fb 100644 + if (var->root->exp) + exp_types_mark_used (var->root->exp); + } - } - --/* Invalidate varobj VAR if it is tied to locals and re-create it if it is -- defined on globals. It is a helper for varobj_invalidate. */ ++} ++ +/* Call type_mark_used for any TYPEs referenced from this GDB source file. */ - - static void --varobj_invalidate_iter (struct varobj *var, void *unused) ++ ++static void +varobj_types_mark_used (void) - { -- /* Floating varobjs are reparsed on each stop, so we don't care if the -- presently parsed expression refers to something that's gone. */ -- if (var->root->floating) -- return; ++{ + /* Check all the VAROBJs, even non-root ones. Child VAROBJs can reference + types from other OBJFILEs through TYPE_IS_OPAQUE resolutions by + check_typedef. Such types references will not be interconnected into the @@ -26523,218 +28462,9 @@ index 4a94988..34333fb 100644 + + all_varobjs (varobj_types_mark_used_iter, NULL); +} -+ -+/* Invalidate VAR if it is tied to the specified OBJFILE. Call this function -+ before you start removing OBJFILE. -+ -+ Call varobj_revalidate_iter after the OBJFILE update get finished. -+ -+ Invalidated varobjs will be always printed in_scope="invalid". */ -+ -+static void -+varobj_invalidate_iter (struct varobj *var, void *objfile_voidp) -+{ -+ struct objfile *objfile = objfile_voidp; -+ -+ /* Check VAROBJROOTs only once during the varobj_invalidate pass. */ -+ -+ if (var->root->rootvar == var) -+ { -+ /* Check even FLOATING VAROBJROOTs as their data will be still checked -+ during varobj_update by varobj_get_type. */ -+ -+ if (var->root->is_valid -+ && block_objfile (var->root->valid_block) == objfile) -+ var->root->is_valid = 0; -+ -+ if (var->root->exp && exp_uses_objfile (var->root->exp, objfile)) -+ { -+ var->root->is_valid = 0; -+ -+ /* No one touches EXP for !IS_VALID varobj. */ -+ xfree (var->root->exp); -+ var->root->exp = NULL; -+ } -+ } -+ -+ if (var->type && TYPE_OBJFILE (var->type) == objfile) -+ { -+ var->root->is_valid = 0; -+ -+ var->type = NULL; -+ } -+ -+ if (var->value && TYPE_OBJFILE (value_type (var->value)) == objfile) -+ { -+ var->root->is_valid = 0; -+ -+ value_free (var->value); -+ var->value = NULL; -+ } -+} -+ -+/* Recreate any global varobjs possibly previously invalidated. If the -+ expressions are no longer evaluatable set/keep the VAR invalid. */ -+ -+static void -+varobj_revalidate_iter (struct varobj *var, void *unused) -+{ -+ /* Global VAR must be re-evaluated. */ - -- /* global var must be re-evaluated. */ - if (var->root->valid_block == NULL) - { - struct varobj *tmp_var; - - /* Try to create a varobj with same expression. If we succeed - replace the old varobj, otherwise invalidate it. */ -- tmp_var = varobj_create (NULL, var->name, (CORE_ADDR) 0, -- USE_CURRENT_FRAME); -- if (tmp_var != NULL) -- { -+ tmp_var = varobj_create (NULL, var->name, 0, USE_CURRENT_FRAME); -+ if (tmp_var != NULL) -+ { - tmp_var->obj_name = xstrdup (var->obj_name); - varobj_delete (var, NULL, 0); - install_variable (tmp_var); -@@ -3239,16 +3506,64 @@ varobj_invalidate_iter (struct varobj *var, void *unused) - else - var->root->is_valid = 0; - } -- else /* locals must be invalidated. */ -- var->root->is_valid = 0; - } - --/* Invalidate the varobjs that are tied to locals and re-create the ones that -- are defined on globals. -- Invalidated varobjs will be always printed in_scope="invalid". */ -+/* Call varobj_invalidate_iter for all the VAROBJs. */ - --void --varobj_invalidate (void) -+static void -+varobj_invalidate (struct objfile *objfile) -+{ -+ /* Check all the VAROBJs, even non-root ones. Child VAROBJs can reference -+ types from other OBJFILEs through TYPE_IS_OPAQUE resolutions by -+ check_typedef. */ -+ -+ all_varobjs (varobj_invalidate_iter, objfile); -+} -+ -+/* Call varobj_revalidate_iter for all the root VAROBJs. */ -+ -+static void -+varobj_revalidate (void) -+{ -+ /* Check only root VAROBJs. Any successful revalidation will replace the -+ whole VAROBJs tree starting with root VAROBJs and its children get created -+ later on-demand. So there is no point trying to revalidate the child -+ VAROBJs. */ -+ -+ all_root_varobjs (varobj_revalidate_iter, NULL); -+} -+ -+/* Call varobj_revalidate just providing a different function prototype. -+ Currently existing VAROBJs may become valid or change with new symbols -+ loaded. */ -+ -+static void -+varobj_revalidate_for_objfile (struct objfile *objfile) - { -- all_root_varobjs (varobj_invalidate_iter, NULL); -+ varobj_revalidate (); -+} -+ -+extern void _initialize_varobj (void); -+void -+_initialize_varobj (void) -+{ -+ int sizeof_table = sizeof (struct vlist *) * VAROBJ_TABLE_SIZE; -+ -+ varobj_table = xmalloc (sizeof_table); -+ memset (varobj_table, 0, sizeof_table); -+ -+ add_setshow_zinteger_cmd ("debugvarobj", class_maintenance, -+ &varobjdebug, _("\ -+Set varobj debugging."), _("\ -+Show varobj debugging."), _("\ -+When non-zero, varobj debugging is enabled."), -+ NULL, -+ show_varobjdebug, -+ &setlist, &showlist); -+ -+ -+ observer_attach_objfile_unloading (varobj_invalidate ); -+ observer_attach_objfile_unloaded (varobj_revalidate); -+ observer_attach_new_objfile (varobj_revalidate_for_objfile); -+ observer_attach_mark_used (varobj_types_mark_used); - } -diff --git a/gdb/varobj.h b/gdb/varobj.h -index 7297243..fbe2f2f 100644 ---- a/gdb/varobj.h -+++ b/gdb/varobj.h -@@ -78,6 +78,12 @@ typedef struct varobj_update_result_t - new value of varobj is already computed and installed, or has to - be yet installed. Don't use this outside varobj.c */ - int value_installed; -+ -+ /* This will be non-NULL when new children were added to the varobj. -+ It lists the new children (which must necessarily come at the end -+ of the child list) added during an update. The caller is -+ responsible for freeing this vector. */ -+ VEC (varobj_p) *new; - } varobj_update_result; - - DEF_VEC_O (varobj_update_result); -@@ -112,13 +118,24 @@ extern void varobj_set_frozen (struct varobj *var, int frozen); - - extern int varobj_get_frozen (struct varobj *var); - -+extern void varobj_get_child_range (struct varobj *var, int *from, int *to); -+ -+extern void varobj_set_child_range (struct varobj *var, int from, int to); -+ - extern char *varobj_get_display_hint (struct varobj *var); - - extern int varobj_get_num_children (struct varobj *var); - --/* Return the list of children of VAR. The returned vector -- should not be modified in any way. */ --extern VEC (varobj_p)* varobj_list_children (struct varobj *var); -+/* Return the list of children of VAR. The returned vector should not -+ be modified in any way. FROM and TO are in/out parameters -+ indicating the range of children to return. If either *FROM or *TO -+ is less than zero on entry, then all children will be returned. On -+ return, *FROM and *TO will be updated to indicate the real range -+ that was returned. The resulting VEC will contain at least the -+ children from *FROM to just before *TO; it might contain more -+ children, depending on whether any more were available. */ -+extern VEC (varobj_p)* varobj_list_children (struct varobj *var, -+ int *from, int *to); - - extern char *varobj_get_type (struct varobj *var); - -@@ -143,12 +160,15 @@ extern void all_root_varobjs (void (*func) (struct varobj *var, void *data), - extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, - int explicit); - --extern void varobj_invalidate (void); -- - extern int varobj_editable_p (struct varobj *var); - - extern int varobj_floating_p (struct varobj *var); - --extern void varobj_set_visualizer (struct varobj *var, const char *visualizer); -+extern void -+varobj_set_visualizer (struct varobj *var, const char *visualizer); -+ -+extern void varobj_enable_pretty_printing (void); -+ -+extern int varobj_has_more (struct varobj *var, int to); - - #endif /* VAROBJ_H */ + + extern void _initialize_varobj (void); + void diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index c56ab86..dacf913 100644 --- a/gdb/xcoffread.c diff --git a/gdb-readline-6.0.patch b/gdb-readline-6.0.patch index 1d02d29..e5da75d 100644 --- a/gdb-readline-6.0.patch +++ b/gdb-readline-6.0.patch @@ -7,9 +7,11 @@ gdb/ * config.in: Regenerate. * configure: Regenerate. ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -536,6 +536,21 @@ if test "$with_system_readline" = yes; then +Index: gdb-6.8.50.20090909/gdb/configure.ac +=================================================================== +--- gdb-6.8.50.20090909.orig/gdb/configure.ac 2009-09-09 20:11:04.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure.ac 2009-09-09 20:11:54.000000000 +0200 +@@ -773,6 +773,21 @@ if test "$with_system_readline" = yes; t READLINE=-lreadline READLINE_DEPS= READLINE_CFLAGS= @@ -31,9 +33,11 @@ gdb/ else READLINE='$(READLINE_DIR)/libreadline.a' READLINE_DEPS='$(READLINE)' ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -790,6 +790,9 @@ +Index: gdb-6.8.50.20090909/gdb/config.in +=================================================================== +--- gdb-6.8.50.20090909.orig/gdb/config.in 2009-09-09 20:11:33.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/config.in 2009-09-09 20:12:00.000000000 +0200 +@@ -815,6 +815,9 @@ /* Define to `int' if does not define. */ #undef pid_t @@ -43,9 +47,11 @@ gdb/ /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported directly. */ ---- a/gdb/configure -+++ b/gdb/configure -@@ -10763,6 +10763,69 @@ if test "$with_system_readline" = yes; then +Index: gdb-6.8.50.20090909/gdb/configure +=================================================================== +--- gdb-6.8.50.20090909.orig/gdb/configure 2009-09-09 20:11:07.000000000 +0200 ++++ gdb-6.8.50.20090909/gdb/configure 2009-09-09 20:11:54.000000000 +0200 +@@ -9197,6 +9197,69 @@ if test "$with_system_readline" = yes; t READLINE=-lreadline READLINE_DEPS= READLINE_CFLAGS= diff --git a/gdb.changes b/gdb.changes index da55165..cc5a00f 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Thu Sep 24 11:40:44 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.91.20090921-1.fc12.src.rpm. + +------------------------------------------------------------------- +Mon Sep 14 14:29:20 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090910-1.fc12.src.rpm. + +------------------------------------------------------------------- +Mon Aug 24 17:30:30 CEST 2009 - rguenther@suse.de + +- Fix gdb-6.3-ia64-sigtramp-frame-20050708.patch patch to allow + ia64 to build again. + +------------------------------------------------------------------- +Mon Aug 24 14:07:52 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090818-4.fc12.src.rpm. + ------------------------------------------------------------------- Mon Aug 17 14:04:46 CEST 2009 - rguenther@suse.de diff --git a/gdb.spec b/gdb.spec index 976f0f5..8eabd28 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,5 +1,5 @@ # -# spec file for package gdb (Version 6.8.50.20090811) +# spec file for package gdb (Version 6.8.91.20090921) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -22,13 +22,13 @@ Name: gdb # 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.20090811 +Version: 6.8.91.20090921 Release: 1 # 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. License: GPLv3+ Group: Development/Debuggers -Source: ftp://sourceware.org/pub/gdb/snapshots/current/gdb-%{version}.tar.bz2 +Source: ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://gnu.org/software/gdb/ # For our convenience @@ -51,6 +51,9 @@ Obsoletes: gdb64 < 5.3.91 Source2: gdb-orphanripper.c # Man page for gstack(1). Source3: gdb-gstack.man +# libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental). +%define libstdcxxpython libstdc++-v3-python-r151798 +Source4: %{libstdcxxpython}.tar.bz2 # Work around out-of-date dejagnu that does not have KFAIL Patch1: gdb-6.3-rh-dummykfail-20041202.patch # Match the Fedora's version info. @@ -88,6 +91,7 @@ Patch136: gdb-6.3-test-movedir-20050125.patch # Fix gcore for threads Patch140: gdb-6.3-gcore-thread-20050204.patch # Stop while intentionally stepping and the thread exit is met. +Patch141: gdb-6.6-step-thread-exit.patch Patch259: gdb-6.3-step-thread-exit-20050211-test.patch # Prevent gdb from being pushed into background Patch142: gdb-6.3-terminal-fix-20050214.patch @@ -114,8 +118,6 @@ Patch162: gdb-6.3-ia64-info-frame-fix-20050725.patch Patch163: gdb-6.3-inheritancetest-20050726.patch # Add readnever option Patch164: gdb-6.3-readnever-20050907.patch -# Fix frame pointer for ia64 sigtramp frame -Patch166: gdb-6.3-ia64-sigtramp-fp-20050926.patch # Fix ia64 gdb problem with user-specified SIGILL handling Patch169: gdb-6.3-ia64-sigill-20051115.patch # Allow option to continue backtracing past a zero pc value @@ -161,6 +163,8 @@ Patch225: gdb-6.5-bz109921-DW_AT_decl_file-test.patch Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch # Testcase for exec() from threaded program (BZ 202689). Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch +# Backported post gdb-6.8.50.20090991 snapshot fixups. +Patch232: gdb-6.8.50.20090921-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch # Temporary support for shared libraries >2GB on 64bit hosts. (BZ 231832) @@ -191,10 +195,6 @@ Patch271: gdb-6.5-bz243845-stale-testing-zombie-test.patch # New locating of the matching binaries from the pure core file (build-id). Patch274: gdb-6.6-buildid-locate.patch Patch353: gdb-6.6-buildid-locate-rpm.patch -# Fix hardware watchpoints after inferior forks-off some process. -# Threaded `set follow-fork-mode child' still not fixed there, glibc fixes reqd. -# `set detach-on-fork off' not fixed there in general - it already assert-fails. -Patch280: gdb-6.6-multifork-debugreg.patch # Fix displaying of numeric char arrays as strings (BZ 224128). Patch282: gdb-6.7-charsign-test.patch # Test PPC hiding of call-volatile parameter register. @@ -260,6 +260,8 @@ Patch352: gdb-6.8-bz457187-largefile.patch Patch360: gdb-6.8-bz457187-largefile-test.patch # Fix compatibility of --with-system-readline and readline-6.0+. Patch375: gdb-readline-6.0.patch +# Fix python pretty printers lookup on x86_64. +Patch376: libstdc++-v3-python-common-prefix.patch # Fix readline 5.1 warnings Patch1000: readline-5.1-random.patch Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch @@ -277,6 +279,8 @@ BuildRequires: rpm-devel %if 0%{!?_without_python:1} %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} BuildRequires: python-devel +# Temporarily before it gets moved to libstdc++.rpm +BuildRequires: libstdc++ %endif # 0%{!?_without_python:1} %if 0%{?_with_testsuite:1} BuildRequires: dejagnu sharutils @@ -326,6 +330,8 @@ This package provides a program that allows you to run GDB on a different machin # This allows the tarball name to be different from our # version-release name. %setup -q -n %{gdb_src} +# libstdc++ pretty printers. +bzip2 -dc %{SOURCE4} | tar xf - # Files have `# ' statements breaking VPATH / find-debuginfo.sh . rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c @@ -333,6 +339,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c # Match the Fedora's version info. %patch2 -p1 %if 0%{!?_with_upstream:1} +%patch232 -p1 %patch349 -p1 %patch1 -p1 %patch3 -p1 @@ -348,6 +355,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch133 -p1 %patch136 -p1 %patch140 -p1 +%patch141 -p1 %patch259 -p1 %patch142 -p1 %patch145 -p1 @@ -362,7 +370,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch162 -p1 %patch163 -p1 %patch164 -p1 -%patch166 -p1 %patch169 -p1 %patch170 -p1 %patch176 -p1 @@ -401,7 +408,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch271 -p1 %patch274 -p1 %patch353 -p1 -%patch280 -p1 %patch282 -p1 %patch284 -p1 %patch287 -p1 @@ -434,6 +440,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch352 -p1 %patch360 -p1 %patch375 -p1 +%patch376 -p1 %patch124 -p1 %patch1000 %patch1002 -p1 @@ -613,6 +620,21 @@ test -x $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui ln -sf gdb $RPM_BUILD_ROOT%{_prefix}/bin/gdbtui cmp $RPM_BUILD_ROOT%{_mandir}/*/gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1 ln -sf gdb.1 $RPM_BUILD_ROOT%{_mandir}/*/gdbtui.1 +%if 0%{!?_without_python:1} +# Temporarily now: +for LIB in lib lib64;do + LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix}/$LIB" + mkdir -p $LIBPATH + # basename is being run only for the native (non-biarch) file. + sed -e 's,@pythondir@,%{python_sitelib}/gdb,' \ + -e 's,@toolexeclibdir@,%{_prefix}/'"$LIB," \ + < $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in \ + > $LIBPATH/$(basename %{_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py +done +test ! -e $RPM_BUILD_ROOT%{python_sitelib}/gdb/libstdcxx +cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \ + $RPM_BUILD_ROOT%{python_sitelib}/gdb/libstdcxx +%endif # 0%{!?_without_python:1} # Remove the files that are part of a gdb build but that are owned and # provided by other packages. # These are part of binutils @@ -665,6 +687,7 @@ fi %{python_sitelib}/gdb %endif # 0%{!?_without_python:1} %endif # 0%{!?_with_upstream:1} +%{_datadir}/gdb %{_infodir}/annotate.info* %{_infodir}/gdb.info* %{_infodir}/gdbint.info* diff --git a/libstdc++-v3-python-common-prefix.patch b/libstdc++-v3-python-common-prefix.patch new file mode 100644 index 0000000..8f85c35 --- /dev/null +++ b/libstdc++-v3-python-common-prefix.patch @@ -0,0 +1,18 @@ +On x86_64 host with: +pythondir: /usr/lib/python2.6/site-packages/gdb +libdir: /usr/lib64 + +prefix got set to "/usr/lib" but the code expects a trailing "/" (missing then +one "../" path component). + +--- ./libstdc++-v3-python-r151798/hook.in-orig 2009-06-18 21:12:37.000000000 +0200 ++++ ./libstdc++-v3-python-r151798/hook.in 2009-09-17 23:37:35.000000000 +0200 +@@ -40,7 +40,7 @@ if gdb.current_objfile () is not None: + # In some bizarre configuration we might have found a match in the + # middle of a directory name. + if prefix[-1] != '/': +- prefix = os.path.dirname (prefix) ++ prefix = os.path.dirname (prefix) + '/' + + # Strip off the prefix. + pythondir = pythondir[len (prefix):] diff --git a/libstdc++-v3-python-r151798.tar.bz2 b/libstdc++-v3-python-r151798.tar.bz2 new file mode 100644 index 0000000..c1401fb --- /dev/null +++ b/libstdc++-v3-python-r151798.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fc7a531f1fdb64a48fc92262b219b31575e2726b4f4d4768b7b947c4032785a +size 10953