From e00e5eae57c22a7c6fce5dfc2d49f75bbe1e3579 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Wed, 17 Nov 2010 03:58:16 +0100 Subject: [PATCH] - Rebase to FSF GDB 7.2.50.20101117 (which is a 7.3 pre-release). --- .gitignore | 2 +- gdb-6.3-bz231832-obstack-2gb.patch | 24 +- gdb-6.3-gstack-20050411.patch | 32 +- gdb-6.3-large-core-20051206.patch | 85 +- gdb-6.3-readnever-20050907.patch | 48 +- gdb-6.3-test-pie-20050107.patch | 56 +- ...337-resolve-tls-without-debuginfo-v2.patch | 44 +- gdb-6.6-buildid-locate-rpm.patch | 112 +- gdb-6.6-bz229517-gcore-without-terminal.patch | 184 - ...heduler_locking-step-sw-watchpoints2.patch | 46 +- gdb-6.6-step-thread-exit.patch | 14 +- ...7-bz426600-DW_TAG_interface_type-fix.patch | 41 - gdb-6.8-fortran-tag-constant.patch | 84 - gdb-archer-pie-addons-keep-disabled.patch | 28 +- gdb-archer-pie-addons.patch | 52 +- gdb-archer.patch | 7163 +---------------- gdb-bz555076-gcore-small-height.patch | 12 - gdb-bz562763-pretty-print-2d-vectors.patch | 65 +- gdb-bz575292-delayed-physname.patch | 630 -- gdb-bz592031-siginfo-lost-1of5.patch | 87 - gdb-bz592031-siginfo-lost-2of5.patch | 139 - gdb-bz592031-siginfo-lost-3of5.patch | 259 - gdb-bz592031-siginfo-lost-4of5.patch | 30 +- gdb-bz592031-siginfo-lost-5of5.patch | 26 +- gdb-bz594560-core-vs-process.patch | 164 - gdb-bz614659-prelink-dynbss.patch | 217 - gdb-bz627432-loop-static-self-class.patch | 280 - gdb-bz631158-cxx-this-lookup.patch | 14 - gdb-bz631575-gdb-index-nobits.patch | 61 - gdb-bz634660-gdbpy-load-on-attach.patch | 61 - gdb-bz637770-ifunc-watchpoint-delete.patch | 111 - gdb-bz645773-ifort-case-1of3.patch | 313 - gdb-bz645773-ifort-case-2of3.patch | 204 - gdb-bz645773-ifort-case-3of3.patch | 448 -- gdb-exec-pie-amd64.patch | 418 - gdb-fortran-common.patch | 68 +- gdb-gdb-add-index-script.patch | 34 +- gdb-gdbindex-ada-regression.patch | 50 - gdb-gdbindex-bigendian.patch | 96 - gdb-gdbindex-v1-to-v2.patch | 689 -- gdb-gdbindex-v2-to-v3.patch | 278 - gdb-next-over-throw.patch | 1283 +++ gdb-pr12028-double-free.patch | 99 - gdb-python-error-state.patch | 592 -- gdb-rhel5-gcc44.patch | 82 +- gdb-testsuite-lib-python.patch | 75 - gdb-upstream.patch | 467 -- gdb.spec | 139 +- sources | 2 +- 49 files changed, 2090 insertions(+), 13418 deletions(-) delete mode 100644 gdb-6.6-bz229517-gcore-without-terminal.patch delete mode 100644 gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch delete mode 100644 gdb-6.8-fortran-tag-constant.patch delete mode 100644 gdb-bz555076-gcore-small-height.patch delete mode 100644 gdb-bz575292-delayed-physname.patch delete mode 100644 gdb-bz592031-siginfo-lost-1of5.patch delete mode 100644 gdb-bz592031-siginfo-lost-2of5.patch delete mode 100644 gdb-bz592031-siginfo-lost-3of5.patch delete mode 100644 gdb-bz594560-core-vs-process.patch delete mode 100644 gdb-bz614659-prelink-dynbss.patch delete mode 100644 gdb-bz627432-loop-static-self-class.patch delete mode 100644 gdb-bz631158-cxx-this-lookup.patch delete mode 100644 gdb-bz631575-gdb-index-nobits.patch delete mode 100644 gdb-bz634660-gdbpy-load-on-attach.patch delete mode 100644 gdb-bz637770-ifunc-watchpoint-delete.patch delete mode 100644 gdb-bz645773-ifort-case-1of3.patch delete mode 100644 gdb-bz645773-ifort-case-2of3.patch delete mode 100644 gdb-bz645773-ifort-case-3of3.patch delete mode 100644 gdb-exec-pie-amd64.patch delete mode 100644 gdb-gdbindex-ada-regression.patch delete mode 100644 gdb-gdbindex-bigendian.patch delete mode 100644 gdb-gdbindex-v1-to-v2.patch delete mode 100644 gdb-gdbindex-v2-to-v3.patch create mode 100644 gdb-next-over-throw.patch delete mode 100644 gdb-pr12028-double-free.patch delete mode 100644 gdb-python-error-state.patch delete mode 100644 gdb-testsuite-lib-python.patch delete mode 100644 gdb-upstream.patch diff --git a/.gitignore b/.gitignore index 818b1e6..2bfa609 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -gdb-7.2.tar.bz2 +gdb-7.2.50.20101117.tar.bz2 diff --git a/gdb-6.3-bz231832-obstack-2gb.patch b/gdb-6.3-bz231832-obstack-2gb.patch index 47bd68b..38742cd 100644 --- a/gdb-6.3-bz231832-obstack-2gb.patch +++ b/gdb-6.3-bz231832-obstack-2gb.patch @@ -1,11 +1,11 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=231832 -Index: gdb-6.8/gdb/symmisc.c +Index: gdb-7.2.50.20101116/gdb/symmisc.c =================================================================== ---- gdb-6.8.orig/gdb/symmisc.c 2008-03-17 16:06:24.000000000 +0100 -+++ gdb-6.8/gdb/symmisc.c 2008-07-14 10:27:50.000000000 +0200 -@@ -230,8 +230,8 @@ print_objfile_statistics (void) +--- gdb-7.2.50.20101116.orig/gdb/symmisc.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/symmisc.c 2010-11-16 08:03:08.000000000 +0100 +@@ -186,8 +186,8 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, sz_strtab) > 0) printf_filtered (_(" Space used by a.out string tables: %d\n"), OBJSTAT (objfile, sz_strtab)); @@ -14,12 +14,12 @@ Index: gdb-6.8/gdb/symmisc.c + printf_filtered (_(" Total memory used for objfile obstack: %ld\n"), + (long) obstack_memory_used (&objfile->objfile_obstack)); printf_filtered (_(" Total memory used for psymbol cache: %d\n"), - bcache_memory_used (objfile->psymbol_cache)); - printf_filtered (_(" Total memory used for macro cache: %d\n"), -Index: gdb-6.8/include/obstack.h + bcache_memory_used (psymbol_bcache_get_bcache + (objfile->psymbol_cache))); +Index: gdb-7.2.50.20101116/include/obstack.h =================================================================== ---- gdb-6.8.orig/include/obstack.h 2005-05-10 12:21:08.000000000 +0200 -+++ gdb-6.8/include/obstack.h 2008-07-14 10:27:50.000000000 +0200 +--- gdb-7.2.50.20101116.orig/include/obstack.h 2008-10-21 01:03:31.000000000 +0200 ++++ gdb-7.2.50.20101116/include/obstack.h 2010-11-16 08:02:37.000000000 +0100 @@ -188,31 +188,31 @@ struct obstack /* control current objec /* Declare the external functions we use; they are in obstack.c. */ @@ -134,10 +134,10 @@ Index: gdb-6.8/include/obstack.h = (h)->temp + (char *) (h)->chunk) \ : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) -Index: gdb-6.8/libiberty/obstack.c +Index: gdb-7.2.50.20101116/libiberty/obstack.c =================================================================== ---- gdb-6.8.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200 -+++ gdb-6.8/libiberty/obstack.c 2008-07-14 10:27:50.000000000 +0200 +--- gdb-7.2.50.20101116.orig/libiberty/obstack.c 2005-05-10 17:33:33.000000000 +0200 ++++ gdb-7.2.50.20101116/libiberty/obstack.c 2010-11-16 08:02:37.000000000 +0100 @@ -44,9 +44,11 @@ #if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 #include diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 2d99428..98d5bb0 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-7.2/gdb/Makefile.in +Index: gdb-7.2.50.20101116/gdb/Makefile.in =================================================================== ---- gdb-7.2.orig/gdb/Makefile.in 2010-09-03 09:37:55.000000000 +0200 -+++ gdb-7.2/gdb/Makefile.in 2010-09-03 09:38:45.000000000 +0200 -@@ -1010,7 +1010,7 @@ install: all install-only +--- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-05 15:31:25.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 07:56:10.000000000 +0100 +@@ -972,7 +972,7 @@ gdb.z:gdb.1 + install: all + @$(MAKE) $(FLAGS_TO_PASS) 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 +-install-only: $(CONFIG_INSTALL) ++install-only: install-gstack $(CONFIG_INSTALL) transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1046,7 +1046,25 @@ install-tui: +@@ -1008,7 +1008,25 @@ install-tui: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -44,7 +44,7 @@ Index: gdb-7.2/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1068,6 +1086,17 @@ uninstall-tui: +@@ -1030,6 +1048,17 @@ uninstall-tui: fi ; \ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ $(DESTDIR)$(man1dir)/$$transformed_name.1 @@ -62,10 +62,10 @@ Index: gdb-7.2/gdb/Makefile.in # The C++ name parser can be built standalone for testing. test-cp-name-parser.o: cp-name-parser.c -Index: gdb-7.2/gdb/gstack.sh +Index: gdb-7.2.50.20101116/gdb/gstack.sh =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/gstack.sh 2010-09-03 09:38:12.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/gstack.sh 2010-11-16 07:55:47.000000000 +0100 @@ -0,0 +1,48 @@ +#!/bin/sh + @@ -115,10 +115,10 @@ Index: gdb-7.2/gdb/gstack.sh + -e 's/^\((gdb) \)*//' \ + -e '/^#/p' \ + -e '/^Thread/p' -Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.base/gstack.exp 2010-09-03 09:38:12.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.exp 2010-11-16 07:55:47.000000000 +0100 @@ -0,0 +1,71 @@ +# Copyright (C) 2010 Free Software Foundation, Inc. + @@ -191,10 +191,10 @@ Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.exp +gdb_exit + +remote_exec host "kill -9 $pid" -Index: gdb-7.2/gdb/testsuite/gdb.base/gstack.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.base/gstack.c 2010-09-03 09:38:12.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/gstack.c 2010-11-16 07:55:47.000000000 +0100 @@ -0,0 +1,43 @@ +/* This testcase is part of GDB, the GNU debugger. + diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch index 8789a6a..3be746a 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-7.1.90.20100711/gdb/symfile-mem.c +Index: gdb-7.2.50.20101116/gdb/symfile-mem.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100 -+++ gdb-7.1.90.20100711/gdb/symfile-mem.c 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/symfile-mem.c 2010-01-01 08:31:42.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/symfile-mem.c 2010-11-16 08:00:37.000000000 +0100 @@ -57,6 +57,14 @@ #include "elf/common.h" @@ -53,10 +53,10 @@ Index: gdb-7.1.90.20100711/gdb/symfile-mem.c if (nbfd == NULL) error (_("Failed to read a valid object file image from memory.")); -Index: gdb-7.1.90.20100711/gdb/target.c +Index: gdb-7.2.50.20101116/gdb/target.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/target.c 2010-07-12 10:00:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/target.c 2010-07-12 10:47:04.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/target.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/target.c 2010-11-16 08:00:37.000000000 +0100 @@ -58,7 +58,7 @@ static int nosymbol (char *, CORE_ADDR * static void tcomplain (void) ATTRIBUTE_NORETURN; @@ -84,7 +84,7 @@ Index: gdb-7.1.90.20100711/gdb/target.c nomemory); de_fault (to_files_info, (void (*) (struct target_ops *)) -@@ -1526,7 +1526,7 @@ target_xfer_partial (struct target_ops * +@@ -1550,7 +1550,7 @@ target_xfer_partial (struct target_ops * it makes no progress, and then return how much was transferred). */ int @@ -93,7 +93,7 @@ Index: gdb-7.1.90.20100711/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -1542,7 +1542,7 @@ target_read_memory (CORE_ADDR memaddr, g +@@ -1566,7 +1566,7 @@ target_read_memory (CORE_ADDR memaddr, g the target's stack. This may trigger different cache behavior. */ int @@ -102,7 +102,7 @@ Index: gdb-7.1.90.20100711/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -1561,7 +1561,7 @@ target_read_stack (CORE_ADDR memaddr, gd +@@ -1585,7 +1585,7 @@ target_read_stack (CORE_ADDR memaddr, gd Callers that can deal with partial writes should call target_write. */ int @@ -111,7 +111,7 @@ Index: gdb-7.1.90.20100711/gdb/target.c { /* Dispatch to the topmost target, not the flattened current_target. Memory accesses check target->to_has_(all_)memory, and the -@@ -3218,8 +3218,8 @@ debug_to_prepare_to_store (struct regcac +@@ -3348,8 +3348,8 @@ debug_to_prepare_to_store (struct regcac fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n"); } @@ -122,7 +122,7 @@ Index: gdb-7.1.90.20100711/gdb/target.c int write, struct mem_attrib *attrib, struct target_ops *target) { -@@ -3229,8 +3229,8 @@ deprecated_debug_xfer_memory (CORE_ADDR +@@ -3359,8 +3359,8 @@ deprecated_debug_xfer_memory (CORE_ADDR attrib, target); fprintf_unfiltered (gdb_stdlog, @@ -133,11 +133,11 @@ Index: gdb-7.1.90.20100711/gdb/target.c write ? "write" : "read", retval); if (retval > 0) -Index: gdb-7.1.90.20100711/gdb/target.h +Index: gdb-7.2.50.20101116/gdb/target.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/target.h 2010-07-12 10:00:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/target.h 2010-07-12 10:46:24.000000000 +0200 -@@ -417,10 +417,10 @@ struct target_ops +--- gdb-7.2.50.20101116.orig/gdb/target.h 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/target.h 2010-11-16 08:00:37.000000000 +0100 +@@ -429,10 +429,10 @@ struct target_ops NOTE: cagney/2004-10-01: This has been entirely superseeded by to_xfer_partial and inferior inheritance. */ @@ -152,7 +152,7 @@ Index: gdb-7.1.90.20100711/gdb/target.h void (*to_files_info) (struct target_ops *); int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *); -@@ -838,12 +838,12 @@ extern void target_dcache_invalidate (vo +@@ -846,12 +846,12 @@ extern void target_dcache_invalidate (vo extern int target_read_string (CORE_ADDR, char **, int, int *); @@ -168,10 +168,10 @@ Index: gdb-7.1.90.20100711/gdb/target.h /* Fetches the target's memory map. If one is found it is sorted and returned, after some consistency checking. Otherwise, NULL -Index: gdb-7.1.90.20100711/gdb/dcache.c +Index: gdb-7.2.50.20101116/gdb/dcache.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/dcache.c 2010-05-14 19:53:15.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/dcache.c 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/dcache.c 2010-05-14 19:53:15.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/dcache.c 2010-11-16 08:00:37.000000000 +0100 @@ -465,10 +465,10 @@ dcache_free (DCACHE *dcache) NOTE: This is different than the to_xfer_partial interface, in which positive values less than LEN mean further transfers may be possible. */ @@ -185,10 +185,10 @@ Index: gdb-7.1.90.20100711/gdb/dcache.c { int i; int res; -Index: gdb-7.1.90.20100711/gdb/dcache.h +Index: gdb-7.2.50.20101116/gdb/dcache.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100 -+++ gdb-7.1.90.20100711/gdb/dcache.h 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/dcache.h 2010-01-01 08:31:30.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/dcache.h 2010-11-16 08:00:37.000000000 +0100 @@ -35,8 +35,8 @@ void dcache_free (DCACHE *); /* Simple to call from _xfer_memory */ @@ -200,10 +200,10 @@ Index: gdb-7.1.90.20100711/gdb/dcache.h void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr, int len); -Index: gdb-7.1.90.20100711/gdb/exec.c +Index: gdb-7.2.50.20101116/gdb/exec.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/exec.c 2010-05-14 20:35:11.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/exec.c 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/exec.c 2010-08-31 20:08:43.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/exec.c 2010-11-16 08:00:37.000000000 +0100 @@ -571,7 +571,7 @@ map_vmap (bfd *abfd, bfd *arch) } @@ -213,11 +213,11 @@ Index: gdb-7.1.90.20100711/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-7.1.90.20100711/gdb/linux-nat.c +Index: gdb-7.2.50.20101116/gdb/linux-nat.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 10:44:36.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 10:46:24.000000000 +0200 -@@ -5197,7 +5197,7 @@ linux_xfer_partial (struct target_ops *o +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 08:00:26.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 08:00:37.000000000 +0100 +@@ -5251,7 +5251,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. */ @@ -226,10 +226,10 @@ Index: gdb-7.1.90.20100711/gdb/linux-nat.c /* Re-read register stack area. */ xxfer = super_xfer_partial (ops, object, annex, -Index: gdb-7.1.90.20100711/gdb/remote.c +Index: gdb-7.2.50.20101116/gdb/remote.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/remote.c 2010-07-07 18:15:16.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/remote.c 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/remote.c 2010-11-04 05:48:21.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/remote.c 2010-11-16 08:00:37.000000000 +0100 @@ -25,6 +25,7 @@ #include "gdb_string.h" #include @@ -269,11 +269,11 @@ Index: gdb-7.1.90.20100711/gdb/remote.c } /* Sends a packet with content determined by the printf format string -Index: gdb-7.1.90.20100711/gdb/remote-sim.c +Index: gdb-7.2.50.20101116/gdb/remote-sim.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/remote-sim.c 2010-05-16 23:11:14.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/remote-sim.c 2010-07-12 10:46:24.000000000 +0200 -@@ -759,11 +759,14 @@ gdbsim_prepare_to_store (struct regcache +--- gdb-7.2.50.20101116.orig/gdb/remote-sim.c 2010-08-10 06:39:26.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/remote-sim.c 2010-11-16 08:01:16.000000000 +0100 +@@ -1055,11 +1055,13 @@ gdbsim_prepare_to_store (struct regcache Returns the number of bytes transferred. */ @@ -286,14 +286,13 @@ Index: gdb-7.1.90.20100711/gdb/remote-sim.c { + /* Convert to len type that sim_read and sim_write can handle. */ + int xfer_len = (int)len; -+ - /* 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-7.1.90.20100711/gdb/exec.h + struct sim_inferior_data *sim_data + = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED); + +Index: gdb-7.2.50.20101116/gdb/exec.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100 -+++ gdb-7.1.90.20100711/gdb/exec.h 2010-07-12 10:46:24.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/exec.h 2010-01-01 08:31:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/exec.h 2010-11-16 08:00:37.000000000 +0100 @@ -60,7 +60,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-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index 7cdc0f7..519643d 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -11,11 +11,11 @@ * gdb.texinfo (File Options): Document --readnever. -Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo +Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.1.90.20100721.orig/gdb/doc/gdb.texinfo 2010-07-23 20:58:52.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/doc/gdb.texinfo 2010-07-23 20:59:15.000000000 +0200 -@@ -998,6 +998,12 @@ Read each symbol file's entire symbol ta +--- gdb-7.2.50.20101116.orig/gdb/doc/gdb.texinfo 2010-11-12 21:49:41.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/doc/gdb.texinfo 2010-11-16 07:59:31.000000000 +0100 +@@ -1001,6 +1001,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,11 +28,11 @@ Index: gdb-7.1.90.20100721/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-7.1.90.20100721/gdb/main.c +Index: gdb-7.2.50.20101116/gdb/main.c =================================================================== ---- gdb-7.1.90.20100721.orig/gdb/main.c 2010-07-23 20:58:55.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/main.c 2010-07-23 20:59:15.000000000 +0200 -@@ -391,6 +391,7 @@ captured_main (void *data) +--- gdb-7.2.50.20101116.orig/gdb/main.c 2010-11-16 07:59:20.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/main.c 2010-11-16 07:59:59.000000000 +0100 +@@ -390,6 +390,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, {"readnow", no_argument, &readnow_symbol_files, 1}, @@ -40,18 +40,18 @@ Index: gdb-7.1.90.20100721/gdb/main.c {"r", no_argument, &readnow_symbol_files, 1}, {"quiet", no_argument, &quiet, 1}, {"q", no_argument, &quiet, 1}, -@@ -1038,6 +1039,7 @@ Options:\n\n\ - fputs_unfiltered (_("\ +@@ -982,6 +983,7 @@ Options:\n\n\ + fputs_unfiltered (_(" file.\n\ --quiet Do not print version number on startup.\n\ --readnow Fully read symbol files on first access.\n\ + --readnever Do not read symbol files.\n\ "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-7.1.90.20100721/gdb/symfile.c +Index: gdb-7.2.50.20101116/gdb/symfile.c =================================================================== ---- gdb-7.1.90.20100721.orig/gdb/symfile.c 2010-07-23 20:58:52.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/symfile.c 2010-07-23 20:59:15.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/symfile.c 2010-10-17 20:49:46.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/symfile.c 2010-11-16 07:59:31.000000000 +0100 @@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file */ @@ -60,19 +60,19 @@ Index: gdb-7.1.90.20100721/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-7.1.90.20100721/gdb/dwarf2read.c +Index: gdb-7.2.50.20101116/gdb/dwarf2read.c =================================================================== ---- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c 2010-07-23 20:58:53.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/dwarf2read.c 2010-07-23 20:59:26.000000000 +0200 -@@ -54,6 +54,7 @@ - #include "exceptions.h" - #include "gdb_stat.h" - #include "completer.h" +--- gdb-7.2.50.20101116.orig/gdb/dwarf2read.c 2010-11-16 07:54:02.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/dwarf2read.c 2010-11-16 08:00:18.000000000 +0100 +@@ -57,6 +57,7 @@ + #include "vec.h" + #include "c-lang.h" + #include "valprint.h" +#include "top.h" #include #include "gdb_string.h" -@@ -1283,8 +1284,9 @@ dwarf2_has_info (struct objfile *objfile +@@ -1356,8 +1357,9 @@ dwarf2_has_info (struct objfile *objfile bfd_map_over_sections (objfile->obfd, dwarf2_locate_sections, NULL); dwarf2_per_objfile->objfile = objfile; } @@ -84,10 +84,10 @@ Index: gdb-7.1.90.20100721/gdb/dwarf2read.c } /* When loading sections, we can either look for ".", or for -Index: gdb-7.1.90.20100721/gdb/top.h +Index: gdb-7.2.50.20101116/gdb/top.h =================================================================== ---- gdb-7.1.90.20100721.orig/gdb/top.h 2010-04-07 18:54:39.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/top.h 2010-07-23 20:59:15.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/top.h 2010-04-07 18:54:39.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/top.h 2010-11-16 07:59:31.000000000 +0100 @@ -61,6 +61,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 440b283..824554e 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -1,25 +1,25 @@ -Index: gdb-7.0.90.20100306/gdb/testsuite/configure.ac +Index: gdb-7.2.50.20101116/gdb/testsuite/configure.ac =================================================================== ---- gdb-7.0.90.20100306.orig/gdb/testsuite/configure.ac 2010-02-19 20:16:36.000000000 +0100 -+++ gdb-7.0.90.20100306/gdb/testsuite/configure.ac 2010-03-06 23:19:56.000000000 +0100 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/configure.ac 2010-11-05 15:31:29.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/configure.ac 2010-11-16 07:56:53.000000000 +0100 @@ -144,6 +144,6 @@ AC_OUTPUT([Makefile \ gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \ gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \ gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \ -- gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ -+ gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ +- gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ ++ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \ gdb.python/Makefile gdb.reverse/Makefile \ gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) -Index: gdb-7.0.90.20100306/gdb/testsuite/configure +Index: gdb-7.2.50.20101116/gdb/testsuite/configure =================================================================== ---- gdb-7.0.90.20100306.orig/gdb/testsuite/configure 2010-02-19 20:16:36.000000000 +0100 -+++ gdb-7.0.90.20100306/gdb/testsuite/configure 2010-03-06 23:20:12.000000000 +0100 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/configure 2010-11-05 15:31:29.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/configure 2010-11-16 07:57:59.000000000 +0100 @@ -3515,7 +3515,7 @@ done --ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" -+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" +-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile gdb.opencl/Makefile" ++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile gdb.opencl/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -31,10 +31,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/configure "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;; "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;; "gdb.threads/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;; -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach.c 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,20 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -56,10 +56,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.c + } + return 0; +} -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach2.c 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,24 @@ +/* This program is intended to be started outside of gdb, and then + attached to by gdb. Thus, it simply spins in a loop. The loop @@ -85,10 +85,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach2.c + } + return (0); +} -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break.c 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,146 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -236,10 +236,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.c + } + return 0; +} -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break1.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break1.c 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,44 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -285,10 +285,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break1.c +void marker3 (a, b) char *a, *b; {} /* set breakpoint 18 here */ +void marker4 (d) long d; {} /* set breakpoint 13 here */ +#endif -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/coremaker.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/coremaker.c 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,142 @@ +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999 + Free Software Foundation, Inc. @@ -432,10 +432,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/coremaker.c + return 0; +} + -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/attach.exp 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,423 @@ +# Copyright 1997, 1999, 2002 Free Software Foundation, Inc. + @@ -860,10 +860,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/attach.exp +do_call_attach_tests + +return 0 -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/break.exp 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,966 @@ +# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2002, 2003, 2004 @@ -1831,10 +1831,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/break.exp + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} +} -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/corefile.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/corefile.exp 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,233 @@ +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. @@ -2069,10 +2069,10 @@ Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/corefile.exp +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" + +gdb_test "core" "No core file now." -Index: gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/Makefile.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.90.20100306/gdb/testsuite/gdb.pie/Makefile.in 2010-03-06 23:19:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.pie/Makefile.in 2010-11-16 07:56:34.000000000 +0100 @@ -0,0 +1,19 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 94c0072..300850e 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -30,11 +30,11 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location -Index: gdb-7.0.50.20100128/gdb/gdbtypes.c +Index: gdb-7.2.50.20101116/gdb/gdbtypes.c =================================================================== ---- gdb-7.0.50.20100128.orig/gdb/gdbtypes.c 2010-01-28 12:52:17.000000000 +0100 -+++ gdb-7.0.50.20100128/gdb/gdbtypes.c 2010-01-28 12:52:48.000000000 +0100 -@@ -3978,6 +3978,9 @@ gdbtypes_post_init (struct gdbarch *gdba +--- gdb-7.2.50.20101116.orig/gdb/gdbtypes.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/gdbtypes.c 2010-11-16 08:01:33.000000000 +0100 +@@ -4262,6 +4262,9 @@ gdbtypes_post_init (struct gdbarch *gdba = arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION, 0, ""); @@ -44,11 +44,11 @@ Index: gdb-7.0.50.20100128/gdb/gdbtypes.c return builtin_type; } -Index: gdb-7.0.50.20100128/gdb/gdbtypes.h +Index: gdb-7.2.50.20101116/gdb/gdbtypes.h =================================================================== ---- gdb-7.0.50.20100128.orig/gdb/gdbtypes.h 2010-01-28 12:52:17.000000000 +0100 -+++ gdb-7.0.50.20100128/gdb/gdbtypes.h 2010-01-28 12:52:48.000000000 +0100 -@@ -1245,6 +1245,8 @@ struct builtin_type +--- gdb-7.2.50.20101116.orig/gdb/gdbtypes.h 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/gdbtypes.h 2010-11-16 08:01:33.000000000 +0100 +@@ -1294,6 +1294,8 @@ struct builtin_type /* This type is used to represent a GDB internal function. */ struct type *internal_fn; @@ -57,11 +57,11 @@ Index: gdb-7.0.50.20100128/gdb/gdbtypes.h }; /* Return the type table for the specified architecture. */ -Index: gdb-7.0.50.20100128/gdb/parse.c +Index: gdb-7.2.50.20101116/gdb/parse.c =================================================================== ---- gdb-7.0.50.20100128.orig/gdb/parse.c 2010-01-28 12:52:19.000000000 +0100 -+++ gdb-7.0.50.20100128/gdb/parse.c 2010-01-28 12:53:20.000000000 +0100 -@@ -509,7 +509,11 @@ write_exp_msymbol (struct minimal_symbol +--- gdb-7.2.50.20101116.orig/gdb/parse.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/parse.c 2010-11-16 08:01:33.000000000 +0100 +@@ -530,7 +530,11 @@ write_exp_msymbol (struct minimal_symbol case mst_text: case mst_file_text: case mst_solib_trampoline: @@ -74,12 +74,12 @@ Index: gdb-7.0.50.20100128/gdb/parse.c break; case mst_text_gnu_ifunc: -Index: gdb-7.0.50.20100128/gdb/target.c +Index: gdb-7.2.50.20101116/gdb/target.c =================================================================== ---- gdb-7.0.50.20100128.orig/gdb/target.c 2010-01-28 12:52:29.000000000 +0100 -+++ gdb-7.0.50.20100128/gdb/target.c 2010-01-28 12:52:48.000000000 +0100 -@@ -1000,6 +1000,25 @@ pop_all_targets (int quitting) - pop_all_targets_above (dummy_stratum, quitting); +--- gdb-7.2.50.20101116.orig/gdb/target.c 2010-11-16 08:00:37.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/target.c 2010-11-16 08:01:52.000000000 +0100 +@@ -1067,6 +1067,25 @@ target_is_pushed (struct target_ops *t) + return 0; } +static int @@ -104,7 +104,7 @@ Index: gdb-7.0.50.20100128/gdb/target.c /* Using the objfile specified in OBJFILE, find the address for the current thread's thread-local storage with offset OFFSET. */ CORE_ADDR -@@ -1090,7 +1109,28 @@ target_translate_tls_address (struct obj +@@ -1157,7 +1176,28 @@ target_translate_tls_address (struct obj /* It wouldn't be wrong here to try a gdbarch method, too; finding TLS is an ABI-specific thing. But we don't do that yet. */ else @@ -134,10 +134,10 @@ Index: gdb-7.0.50.20100128/gdb/target.c return addr; } -Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.dwarf2/dw2-errno.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2010-01-28 12:52:48.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2010-11-16 08:01:33.000000000 +0100 @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -167,10 +167,10 @@ Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.c + + return 0; /* breakpoint */ +} -Index: gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.dwarf2/dw2-errno.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.0.50.20100128/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2010-01-28 12:52:48.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2010-11-16 08:01:33.000000000 +0100 @@ -0,0 +1,60 @@ +# Copyright 2007 Free Software Foundation, Inc. + diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 30832c6..4416e68 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -1,7 +1,7 @@ -Index: gdb-7.2/gdb/event-top.c +Index: gdb-7.2.50.20101116/gdb/event-top.c =================================================================== ---- gdb-7.2.orig/gdb/event-top.c 2010-06-26 08:44:47.000000000 +0200 -+++ gdb-7.2/gdb/event-top.c 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/event-top.c 2010-09-11 18:00:25.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/event-top.c 2010-11-16 08:14:26.000000000 +0100 @@ -33,6 +33,7 @@ #include "cli/cli-script.h" /* for reset_command_nest_depth */ #include "main.h" @@ -28,10 +28,10 @@ Index: gdb-7.2/gdb/event-top.c /* Each interpreter has its own rules on displaying the command prompt. */ if (!current_interp_display_prompt_p ()) -Index: gdb-7.2/gdb/elfread.c +Index: gdb-7.2.50.20101116/gdb/elfread.c =================================================================== ---- gdb-7.2.orig/gdb/elfread.c 2010-10-06 22:39:32.000000000 +0200 -+++ gdb-7.2/gdb/elfread.c 2010-10-06 22:39:52.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/elfread.c 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/elfread.c 2010-11-16 08:14:26.000000000 +0100 @@ -42,6 +42,7 @@ #include "gdbcore.h" #include "gdbcmd.h" @@ -464,11 +464,11 @@ Index: gdb-7.2/gdb/elfread.c } static char * -Index: gdb-7.2/gdb/symfile.h +Index: gdb-7.2.50.20101116/gdb/symfile.h =================================================================== ---- gdb-7.2.orig/gdb/symfile.h 2010-10-06 22:39:32.000000000 +0200 -+++ gdb-7.2/gdb/symfile.h 2010-10-06 22:39:52.000000000 +0200 -@@ -577,6 +577,8 @@ extern struct build_id *build_id_addr_ge +--- gdb-7.2.50.20101116.orig/gdb/symfile.h 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/symfile.h 2010-11-16 08:14:26.000000000 +0100 +@@ -552,6 +552,8 @@ 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); @@ -477,11 +477,11 @@ Index: gdb-7.2/gdb/symfile.h /* From dwarf2read.c */ -Index: gdb-7.2/gdb/testsuite/lib/gdb.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.2.orig/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200 -+++ gdb-7.2/gdb/testsuite/lib/gdb.exp 2010-10-06 22:39:32.000000000 +0200 -@@ -1359,7 +1359,7 @@ proc default_gdb_start { } { +--- gdb-7.2.50.20101116.orig/gdb/testsuite/lib/gdb.exp 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/lib/gdb.exp 2010-11-16 08:14:26.000000000 +0100 +@@ -1358,7 +1358,7 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } } @@ -490,10 +490,10 @@ Index: gdb-7.2/gdb/testsuite/lib/gdb.exp send_gdb "set build-id-verbose 0\n" gdb_expect 10 { -re "$gdb_prompt $" { -Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.2.orig/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200 -+++ gdb-7.2/gdb/testsuite/lib/mi-support.exp 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/lib/mi-support.exp 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/lib/mi-support.exp 2010-11-16 08:14:26.000000000 +0100 @@ -221,7 +221,7 @@ proc default_mi_gdb_start { args } { } } @@ -503,10 +503,10 @@ Index: gdb-7.2/gdb/testsuite/lib/mi-support.exp send_gdb "190-gdb-set build-id-verbose 0\n" gdb_expect 10 { -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { -Index: gdb-7.2/gdb/tui/tui-interp.c +Index: gdb-7.2.50.20101116/gdb/tui/tui-interp.c =================================================================== ---- gdb-7.2.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200 -+++ gdb-7.2/gdb/tui/tui-interp.c 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/tui/tui-interp.c 2010-05-18 00:21:43.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/tui/tui-interp.c 2010-11-16 08:14:26.000000000 +0100 @@ -30,6 +30,7 @@ #include "tui/tui.h" #include "tui/tui-io.h" @@ -524,10 +524,10 @@ Index: gdb-7.2/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-7.2/gdb/aclocal.m4 +Index: gdb-7.2.50.20101116/gdb/aclocal.m4 =================================================================== ---- gdb-7.2.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200 -+++ gdb-7.2/gdb/aclocal.m4 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/aclocal.m4 2010-05-23 02:56:59.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/aclocal.m4 2010-11-16 08:14:26.000000000 +0100 @@ -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'.])]) @@ -691,10 +691,10 @@ Index: gdb-7.2/gdb/aclocal.m4 # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation -Index: gdb-7.2/gdb/config.in +Index: gdb-7.2.50.20101116/gdb/config.in =================================================================== ---- gdb-7.2.orig/gdb/config.in 2010-10-06 22:39:31.000000000 +0200 -+++ gdb-7.2/gdb/config.in 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/config.in 2010-09-02 19:12:35.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/config.in 2010-11-16 08:14:26.000000000 +0100 @@ -46,6 +46,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -705,7 +705,7 @@ Index: gdb-7.2/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -231,6 +234,9 @@ +@@ -232,6 +235,9 @@ /* Define if Python 2.7 is being used. */ #undef HAVE_LIBPYTHON2_7 @@ -715,10 +715,10 @@ Index: gdb-7.2/gdb/config.in /* Define if libunwind library is being used. */ #undef HAVE_LIBUNWIND -Index: gdb-7.2/gdb/configure +Index: gdb-7.2.50.20101116/gdb/configure =================================================================== ---- gdb-7.2.orig/gdb/configure 2010-10-06 22:39:31.000000000 +0200 -+++ gdb-7.2/gdb/configure 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/configure 2010-11-05 02:50:17.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/configure 2010-11-16 08:15:33.000000000 +0100 @@ -679,6 +679,9 @@ REPORT_BUGS_TO PKGVERSION TARGET_OBS @@ -726,18 +726,18 @@ Index: gdb-7.2/gdb/configure +RPM_LIBS +RPM_CFLAGS +PKG_CONFIG - pythondir - GDB_DATADIR_PATH GDB_DATADIR -@@ -948,6 +951,7 @@ with_separate_debug_dir + DEBUGDIR + am__fastdepCC_FALSE +@@ -945,6 +948,7 @@ enable_dependency_tracking + with_separate_debug_dir with_gdb_datadir with_relocated_sources - with_pythondir +with_rpm enable_targets enable_64_bit_bfd enable_gdbcli -@@ -988,6 +992,9 @@ LDFLAGS +@@ -986,6 +990,9 @@ LDFLAGS LIBS CPPFLAGS CPP @@ -747,16 +747,16 @@ Index: gdb-7.2/gdb/configure YACC YFLAGS XMKMF' -@@ -1653,6 +1660,8 @@ Optional Packages: +@@ -1649,6 +1656,8 @@ Optional Packages: [DATADIR/gdb] - --with-pythondir install Python data files in this path - [DATADIR/gdb/python] + --with-relocated-sources=PATH + automatically relocate this path for source files + --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 -@@ -1688,6 +1697,9 @@ Some influential environment variables: +@@ -1684,6 +1693,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 @@ -766,7 +766,7 @@ Index: gdb-7.2/gdb/configure YACC The `Yet Another C Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. -@@ -7951,6 +7963,485 @@ _ACEOF +@@ -7881,6 +7893,486 @@ _ACEOF fi @@ -1249,16 +1249,17 @@ Index: gdb-7.2/gdb/configure + fi + fi +fi ++ - -Index: gdb-7.2/gdb/configure.ac + subdirs="$subdirs doc testsuite" +Index: gdb-7.2.50.20101116/gdb/configure.ac =================================================================== ---- gdb-7.2.orig/gdb/configure.ac 2010-10-06 22:39:31.000000000 +0200 -+++ gdb-7.2/gdb/configure.ac 2010-10-06 22:39:32.000000000 +0200 -@@ -152,6 +152,198 @@ else - fi - AC_SUBST(pythondir) +--- gdb-7.2.50.20101116.orig/gdb/configure.ac 2010-11-05 02:50:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/configure.ac 2010-11-16 08:15:10.000000000 +0100 +@@ -108,6 +108,199 @@ AS_HELP_STRING([--with-relocated-sources + [Relocated directory for source files. ]) + ]) +# Integration with rpm library to support missing debuginfo suggestions. +# --without-rpm: Disable any rpm support. @@ -1452,13 +1453,14 @@ Index: gdb-7.2/gdb/configure.ac + fi + fi +fi - ++ AC_CONFIG_SUBDIRS(doc testsuite) -Index: gdb-7.2/gdb/acinclude.m4 + # Check whether to support alternative target configurations +Index: gdb-7.2.50.20101116/gdb/acinclude.m4 =================================================================== ---- gdb-7.2.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200 -+++ gdb-7.2/gdb/acinclude.m4 2010-10-06 22:39:32.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/acinclude.m4 2010-05-27 05:40:45.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/acinclude.m4 2010-11-16 08:14:26.000000000 +0100 @@ -1,3 +1,5 @@ +# serial 1 + @@ -1474,11 +1476,11 @@ Index: gdb-7.2/gdb/acinclude.m4 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC -Index: gdb-7.2/gdb/corelow.c +Index: gdb-7.2.50.20101116/gdb/corelow.c =================================================================== ---- gdb-7.2.orig/gdb/corelow.c 2010-10-06 22:39:39.000000000 +0200 -+++ gdb-7.2/gdb/corelow.c 2010-10-06 22:39:52.000000000 +0200 -@@ -331,7 +331,7 @@ build_id_locate_exec (int from_tty) +--- gdb-7.2.50.20101116.orig/gdb/corelow.c 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/corelow.c 2010-11-16 08:14:26.000000000 +0100 +@@ -317,7 +317,7 @@ build_id_locate_exec (int from_tty) symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; } else diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch deleted file mode 100644 index 686bb9d..0000000 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ /dev/null @@ -1,184 +0,0 @@ -2007-04-22 Jan Kratochvil - - * gdb_gcore.sh: Redirect GDB from ` - - * gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files. - - ---- gdb-6.6-orig/gdb/gdb_gcore.sh 2005-12-17 17:33:59.000000000 -0500 -+++ gdb-6.6/gdb/gdb_gcore.sh 2007-04-22 05:42:50.000000000 -0400 -@@ -71,7 +71,9 @@ - quit - EOF - -- gdb -x $tmpfile -batch -+ # ` -+#include -+#include -+#include -+#include -+ -+int main (int argc, char **argv) -+{ -+ pid_t pid = 0; -+ pid_t ppid; -+ char buf[256]; -+ -+ if (argc != 4) -+ { -+ fprintf (stderr, "Syntax: %s {standard|detached} \n", -+ argv[0]); -+ exit (1); -+ } -+ -+ pid = fork (); -+ -+ switch (pid) -+ { -+ case 0: -+ if (strcmp (argv[1], "detached") == 0) -+ setpgrp (); -+ ppid = getppid (); -+ sprintf (buf, "sh %s -o %s %d", argv[2], argv[3], (int) ppid); -+ system (buf); -+ kill (ppid, SIGTERM); -+ break; -+ -+ case -1: -+ perror ("fork err\n"); -+ exit (1); -+ break; -+ -+ default: -+ sleep (60); -+ } -+ -+ return 0; -+} ---- /dev/null 1 Jan 1970 00:00:00 -0000 -+++ ./gdb/testsuite/gdb.base/gcorebg.exp 25 Feb 2007 12:21:20 -0000 -@@ -0,0 +1,113 @@ -+# Copyright 2007 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Please email any bugs, comments, and/or additions to this file to: -+# bug-gdb@prep.ai.mit.edu -+ -+# This file was written by Jan Kratochvil . -+# This is a test for `gdb_gcore.sh' functionality. -+# It also tests a regression with `gdb_gcore.sh' being run without its -+# accessible terminal. -+ -+if ![info exists GCORE] { -+ set GCORE "${srcdir}/../gdb_gcore.sh" -+} -+verbose "using GCORE = $GCORE" 2 -+ -+set testfile "gcorebg" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+set corefile ${objdir}/${subdir}/${testfile}.test -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested gcorebg.exp -+ return -1 -+} -+ -+# Cleanup. -+ -+proc core_clean {} { -+ global corefile -+ -+ foreach file [glob -nocomplain [join [list $corefile *] ""]] { -+ verbose "Delete file $file" 1 -+ remote_file target delete $file -+ } -+} -+core_clean -+remote_file target delete "./gdb" -+ -+# Generate the core file. -+ -+# Provide `./gdb' for `gdb_gcore.sh' running it as a bare `gdb' command. -+# Setup also `$PATH' appropriately. -+# If GDB was not found let `gdb_gcore.sh' to find the system GDB by `$PATH'. -+if {$GDB != "gdb"} { -+ file link ./gdb $GDB -+} -+global env -+set oldpath $env(PATH) -+set env(PATH) [join [list . $env(PATH)] ":"] -+verbose "PATH = $env(PATH)" 2 -+ -+# Test file body. -+# $detached == "standard" || $detached == "detached" -+ -+proc test_body { detached } { -+ global binfile -+ global GCORE -+ global corefile -+ -+ set res [remote_spawn target "$binfile $detached $GCORE $corefile"] -+ if { $res < 0 || $res == "" } { -+ fail "Spawning $detached gcore" -+ return 1 -+ } -+ pass "Spawning $detached gcore" -+ remote_expect target 20 { -+ timeout { -+ fail "Spawned $detached gcore finished" -+ remote_exec target "kill -9 -[exp_pid -i $res]" -+ return 1 -+ } -+ eof { -+ pass "Spawned $detached gcore finished" -+ remote_wait target 20 -+ } -+ } -+ -+ if {1 == [llength [glob -nocomplain [join [list $corefile *] ""]]]} { -+ pass "Core file generated by $detached gcore" -+ } else { -+ fail "Core file generated by $detached gcore" -+ } -+ core_clean -+} -+ -+# First a general `gdb_gcore.sh' spawn with its controlling terminal available. -+ -+test_body standard -+ -+# And now `gdb_gcore.sh' spawn without its controlling terminal available. -+# It is spawned through `gcorebg.c' using setpgrp (). -+ -+test_body detached -+ -+ -+# Cleanup. -+ -+set env(PATH) $oldpath -+remote_file target delete "./gdb" diff --git a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 0eb8a44..f19712e 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -21,10 +21,10 @@ Port to GDB-6.8pre. -Index: gdb-7.1.90.20100711/gdb/inferior.h +Index: gdb-7.2.50.20101116/gdb/inferior.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/inferior.h 2010-07-12 10:00:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/inferior.h 2010-07-12 10:04:25.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/inferior.h 2010-06-24 17:17:30.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/inferior.h 2010-11-16 07:54:36.000000000 +0100 @@ -198,7 +198,15 @@ extern void reopen_exec_file (void); /* The `resume' routine should only be called in special circumstances. Normally, use `proceed', which handles a lot of bookkeeping. */ @@ -42,11 +42,11 @@ Index: gdb-7.1.90.20100711/gdb/inferior.h /* From misc files */ -Index: gdb-7.1.90.20100711/gdb/infrun.c +Index: gdb-7.2.50.20101116/gdb/infrun.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/infrun.c 2010-07-12 10:00:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/infrun.c 2010-07-12 10:05:26.000000000 +0200 -@@ -76,7 +76,7 @@ static int follow_fork (void); +--- gdb-7.2.50.20101116.orig/gdb/infrun.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/infrun.c 2010-11-16 07:55:23.000000000 +0100 +@@ -74,7 +74,7 @@ static int follow_fork (void); static void set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c); @@ -55,7 +55,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c static int currently_stepping_or_nexting_callback (struct thread_info *tp, void *data); -@@ -1549,7 +1549,7 @@ maybe_software_singlestep (struct gdbarc +@@ -1557,7 +1557,7 @@ maybe_software_singlestep (struct gdbarc STEP nonzero if we should step (zero to continue instead). SIG is the signal to give the inferior (zero for none). */ void @@ -64,8 +64,8 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c { int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1562,10 +1562,12 @@ resume (int step, enum target_signal sig - QUIT; +@@ -1589,10 +1589,12 @@ resume (int step, enum target_signal sig + } if (debug_infrun) - fprintf_unfiltered (gdb_stdlog, @@ -81,7 +81,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c /* Normally, by the time we reach `resume', the breakpoints are either removed or inserted, as appropriate. The exception is if we're sitting -@@ -1678,9 +1680,10 @@ a command like `return' or `jump' to con +@@ -1710,9 +1712,10 @@ a command like `return' or `jump' to con individually. */ resume_ptid = inferior_ptid; } @@ -94,7 +94,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -1889,7 +1892,7 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -1921,7 +1924,7 @@ proceed (CORE_ADDR addr, enum target_sig struct thread_info *tp; CORE_ADDR pc; struct address_space *aspace; @@ -103,7 +103,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c /* If we're stopped at a fork/vfork, follow the branch set by the "set follow-fork-mode" command; otherwise, we'll just proceed -@@ -1924,13 +1927,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -1956,13 +1959,13 @@ proceed (CORE_ADDR addr, enum target_sig actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ @@ -119,7 +119,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c } else { -@@ -1971,13 +1974,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2003,13 +2006,13 @@ proceed (CORE_ADDR addr, enum target_sig is required it returns TRUE and sets the current thread to the old thread. */ if (prepare_to_proceed (step)) @@ -135,7 +135,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c { tp->trap_expected = 1; /* If displaced stepping is enabled, we can step over the -@@ -2064,8 +2067,13 @@ proceed (CORE_ADDR addr, enum target_sig +@@ -2096,8 +2099,13 @@ proceed (CORE_ADDR addr, enum target_sig /* Reset to normal state. */ init_infwait_state (); @@ -150,7 +150,7 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c /* Wait for it to stop (if not standalone) and in any case decode why it stopped, and act accordingly. */ -@@ -4903,13 +4911,18 @@ infrun: not switching back to stepped th +@@ -4859,13 +4867,18 @@ infrun: not switching back to stepped th /* Is thread TP in the middle of single-stepping? */ @@ -174,11 +174,11 @@ Index: gdb-7.1.90.20100711/gdb/infrun.c } /* Returns true if any thread *but* the one passed in "data" is in the -Index: gdb-7.1.90.20100711/gdb/linux-nat.c +Index: gdb-7.2.50.20101116/gdb/linux-nat.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/linux-nat.c 2010-07-12 10:00:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/linux-nat.c 2010-07-12 10:04:25.000000000 +0200 -@@ -2827,7 +2827,10 @@ count_events_callback (struct lwp_info * +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 07:54:36.000000000 +0100 +@@ -2883,7 +2883,10 @@ count_events_callback (struct lwp_info * static int select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { @@ -190,10 +190,10 @@ Index: gdb-7.1.90.20100711/gdb/linux-nat.c return 1; else return 0; -Index: gdb-7.1.90.20100711/gdb/linux-nat.h +Index: gdb-7.2.50.20101116/gdb/linux-nat.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/linux-nat.h 2010-06-11 14:10:12.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/linux-nat.h 2010-07-12 10:04:25.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.h 2010-07-27 22:51:37.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/linux-nat.h 2010-11-16 07:54:36.000000000 +0100 @@ -55,8 +55,8 @@ struct lwp_info /* If non-zero, a pending wait status. */ int status; diff --git a/gdb-6.6-step-thread-exit.patch b/gdb-6.6-step-thread-exit.patch index ce80232..22afbea 100644 --- a/gdb-6.6-step-thread-exit.patch +++ b/gdb-6.6-step-thread-exit.patch @@ -1,8 +1,8 @@ -Index: gdb-6.8.50.20090811/gdb/linux-nat.c +Index: gdb-7.2.50.20101116/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 +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 07:58:15.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 07:59:06.000000000 +0100 +@@ -1863,16 +1863,18 @@ resume_set_callback (struct lwp_info *lp static void linux_nat_resume (struct target_ops *ops, @@ -21,9 +21,9 @@ Index: gdb-6.8.50.20090811/gdb/linux-nat.c + (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 + (signo != TARGET_SIGNAL_0 + ? strsignal (target_signal_to_host (signo)) : "0"), +@@ -3171,10 +3173,34 @@ linux_nat_filter_event (int lwpid, int s if (num_lwps (GET_PID (lp->ptid)) > 1) { diff --git a/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch b/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch deleted file mode 100644 index f99486c..0000000 --- a/gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch +++ /dev/null @@ -1,41 +0,0 @@ -Original patch was: -http://sourceware.org/ml/gdb-patches/2007-12/msg00397.html -http://sourceware.org/ml/gdb-cvs/2007-12/msg00123.html - -extended for the RHEL safety: - -2007-12-28 Jan Kratochvil - - * dwarf2read.c (fixup_partial_die): Provide full - `DW_TAG_class_type'-type backing for `DW_TAG_interface_type', even for - namespaces which should not apply for Java `DW_TAG_interface_type'. - -2008-02-24 Jan Kratochvil - - Port to GDB-6.8pre. - -Index: ./gdb/dwarf2read.c -=================================================================== -RCS file: /cvs/src/src/gdb/dwarf2read.c,v -retrieving revision 1.245 -diff -u -p -r1.245 dwarf2read.c ---- ./gdb/dwarf2read.c 26 Dec 2007 12:36:18 -0000 1.245 -+++ ./gdb/dwarf2read.c 27 Dec 2007 23:25:49 -0000 -@@ -5887,7 +5887,8 @@ fixup_partial_die (struct partial_die_in - - /* Set default names for some unnamed DIEs. */ - if (part_die->name == NULL && (part_die->tag == DW_TAG_structure_type -- || part_die->tag == DW_TAG_class_type)) -+ || part_die->tag == DW_TAG_class_type -+ || part_die->tag == DW_TAG_interface_type)) - part_die->name = "(anonymous class)"; - - if (part_die->name == NULL && part_die->tag == DW_TAG_namespace) -@@ -5895,6 +5896,7 @@ fixup_partial_die (struct partial_die_in - - if (part_die->tag == DW_TAG_structure_type - || part_die->tag == DW_TAG_class_type -+ || part_die->tag == DW_TAG_interface_type - || part_die->tag == DW_TAG_union_type) - guess_structure_name (part_die, cu); - } diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch deleted file mode 100644 index 3283984..0000000 --- a/gdb-6.8-fortran-tag-constant.patch +++ /dev/null @@ -1,84 +0,0 @@ -Index: gdb-7.1.90.20100711/gdb/dwarf2read.c -=================================================================== ---- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-12 23:07:35.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:13:02.000000000 +0200 -@@ -2251,6 +2251,7 @@ scan_partial_symbols (struct partial_die - add_partial_subprogram (pdi, lowpc, highpc, need_pc, cu); - break; - case DW_TAG_variable: -+ case DW_TAG_constant: - case DW_TAG_typedef: - case DW_TAG_union_type: - if (!pdi->is_declaration) -@@ -2452,6 +2453,7 @@ add_partial_symbol (struct partial_die_i - } - break; - case DW_TAG_variable: -+ case DW_TAG_constant: - if (pdi->is_external) - { - /* Global Variable. -@@ -3289,6 +3291,7 @@ die_needs_namespace (struct die_info *di - return 1; - - case DW_TAG_variable: -+ case DW_TAG_constant: - /* We only need to prefix "globally" visible variables. These include - any variable marked with DW_AT_external or any variable that - lives in a namespace. [Variables in anonymous namespaces -@@ -4638,7 +4641,8 @@ dwarf2_add_field (struct field_info *fip - fip->non_public_fields = 1; - } - } -- else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable) -+ else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable -+ || die->tag == DW_TAG_constant) - { - /* C++ static member. */ - -@@ -5250,7 +5254,8 @@ read_structure_type (struct die_info *di - while (child_die && child_die->tag) - { - if (child_die->tag == DW_TAG_member -- || child_die->tag == DW_TAG_variable) -+ || child_die->tag == DW_TAG_variable -+ || child_die->tag == DW_TAG_constant) - { - /* NOTE: carlton/2002-11-05: A C++ static data member - should be a DW_TAG_member that is a declaration, but -@@ -5396,6 +5401,7 @@ process_structure_scope (struct die_info - { - if (child_die->tag == DW_TAG_member - || child_die->tag == DW_TAG_variable -+ || child_die->tag == DW_TAG_constant - || child_die->tag == DW_TAG_inheritance) - { - /* Do nothing. */ -@@ -7109,6 +7115,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) -@@ -7217,6 +7224,7 @@ load_partial_dies (bfd *abfd, gdb_byte * - if (load_all - || abbrev->tag == DW_TAG_subprogram - || abbrev->tag == DW_TAG_variable -+ || abbrev->tag == DW_TAG_constant - || abbrev->tag == DW_TAG_namespace - || part_die->is_declaration) - { -@@ -9059,6 +9067,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; -+ case DW_TAG_constant: -+ SYMBOL_TYPE (sym) = make_cv_type (1, -+ TYPE_VOLATILE (SYMBOL_TYPE (sym)), -+ SYMBOL_TYPE (sym), NULL); -+ /* PASSTHRU */ - case DW_TAG_variable: - case DW_TAG_member: - /* Compilation with minimal debug info may result in variables diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index e81a8dd..741f684 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,8 +1,8 @@ -Index: gdb-7.1.90.20100711/gdb/breakpoint.c +Index: gdb-7.2.50.20101116/gdb/breakpoint.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/breakpoint.c 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/breakpoint.c 2010-07-13 00:38:04.000000000 +0200 -@@ -10159,6 +10159,50 @@ update_breakpoint_locations (struct brea +--- gdb-7.2.50.20101116.orig/gdb/breakpoint.c 2010-11-16 07:53:58.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/breakpoint.c 2010-11-16 08:28:53.000000000 +0100 +@@ -10249,6 +10249,50 @@ update_breakpoint_locations (struct brea update_global_location_list (1); } @@ -53,23 +53,23 @@ Index: gdb-7.1.90.20100711/gdb/breakpoint.c /* Reset a breakpoint given it's struct breakpoint * BINT. The value we return ends up being the return value from catch_errors. Unused in this case. */ -Index: gdb-7.1.90.20100711/gdb/breakpoint.h +Index: gdb-7.2.50.20101116/gdb/breakpoint.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/breakpoint.h 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/breakpoint.h 2010-07-13 00:37:34.000000000 +0200 -@@ -1088,4 +1088,7 @@ extern void check_tracepoint_command (ch - extern void start_rbreak_breakpoints (void); - extern void end_rbreak_breakpoints (void); +--- gdb-7.2.50.20101116.orig/gdb/breakpoint.h 2010-11-16 07:53:58.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/breakpoint.h 2010-11-16 08:29:06.000000000 +0100 +@@ -1128,4 +1128,7 @@ extern void end_rbreak_breakpoints (void + extern struct breakpoint *iterate_over_breakpoints (int (*) (struct breakpoint *, + void *), void *); +extern void breakpoints_relocate (struct objfile *objfile, + struct section_offsets *delta); + #endif /* !defined (BREAKPOINT_H) */ -Index: gdb-7.1.90.20100711/gdb/objfiles.c +Index: gdb-7.2.50.20101116/gdb/objfiles.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/objfiles.c 2010-05-16 02:46:46.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/objfiles.c 2010-07-13 00:37:19.000000000 +0200 -@@ -834,6 +834,11 @@ objfile_relocate1 (struct objfile *objfi +--- gdb-7.2.50.20101116.orig/gdb/objfiles.c 2010-10-17 19:45:16.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/objfiles.c 2010-11-16 08:28:53.000000000 +0100 +@@ -844,6 +844,11 @@ objfile_relocate1 (struct objfile *objfi obj_section_addr (s)); } diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 4bcc4b4..67ca34a 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,8 +1,8 @@ -Index: gdb-7.1.90.20100711/gdb/dwarf2read.c +Index: gdb-7.2.50.20101116/gdb/dwarf2read.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:34:00.000000000 +0200 -@@ -5737,7 +5737,12 @@ read_common_block (struct die_info *die, +--- gdb-7.2.50.20101116.orig/gdb/dwarf2read.c 2010-11-16 08:25:21.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/dwarf2read.c 2010-11-16 08:26:35.000000000 +0100 +@@ -7325,7 +7325,12 @@ read_common_block (struct die_info *die, { struct attribute *attr; struct symbol *sym; @@ -16,7 +16,7 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) -@@ -5746,6 +5751,7 @@ read_common_block (struct die_info *die, +@@ -7334,6 +7339,7 @@ read_common_block (struct die_info *die, if (attr_form_is_block (attr)) { base = decode_locdesc (DW_BLOCK (attr), cu); @@ -24,7 +24,7 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c } else if (attr_form_is_section_offset (attr)) { -@@ -5807,12 +5813,15 @@ read_common_block (struct die_info *die, +@@ -7395,12 +7401,15 @@ read_common_block (struct die_info *die, else dwarf2_complex_location_expr_complaint (); @@ -42,7 +42,7 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c else SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym)); FIELD_TYPE (*field) = SYMBOL_TYPE (sym); -@@ -5826,7 +5835,7 @@ read_common_block (struct die_info *die, +@@ -7414,7 +7423,7 @@ read_common_block (struct die_info *die, sym = new_symbol (die, type, cu); /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */ @@ -51,10 +51,10 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c set_die_type (die, type, cu); } -Index: gdb-7.1.90.20100711/gdb/gdbtypes.h +Index: gdb-7.2.50.20101116/gdb/gdbtypes.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/gdbtypes.h 2010-07-12 23:07:34.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/gdbtypes.h 2010-07-13 00:34:00.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/gdbtypes.h 2010-11-16 08:01:33.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/gdbtypes.h 2010-11-16 08:26:35.000000000 +0100 @@ -395,6 +395,7 @@ enum type_instance_flag_value enum field_loc_kind { @@ -63,7 +63,7 @@ Index: gdb-7.1.90.20100711/gdb/gdbtypes.h FIELD_LOC_KIND_PHYSADDR, /* physaddr */ FIELD_LOC_KIND_PHYSNAME /* physname */ }; -@@ -577,6 +578,7 @@ struct main_type +@@ -576,6 +577,7 @@ struct main_type is the location (in the target) of the static field. Otherwise, physname is the mangled label of the static field. */ @@ -71,7 +71,7 @@ Index: gdb-7.1.90.20100711/gdb/gdbtypes.h CORE_ADDR physaddr; char *physname; } -@@ -1073,6 +1075,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1101,6 +1103,7 @@ extern void allocate_gnat_aux_type (stru #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind) #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) @@ -79,7 +79,7 @@ Index: gdb-7.1.90.20100711/gdb/gdbtypes.h #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define SET_FIELD_BITPOS(thisfld, bitpos) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_BITPOS, \ -@@ -1080,6 +1083,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1108,6 +1111,7 @@ extern void allocate_gnat_aux_type (stru #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -87,7 +87,7 @@ Index: gdb-7.1.90.20100711/gdb/gdbtypes.h #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1092,6 +1096,7 @@ extern void allocate_gnat_aux_type (stru +@@ -1120,6 +1124,7 @@ extern void allocate_gnat_aux_type (stru #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) @@ -95,10 +95,10 @@ Index: gdb-7.1.90.20100711/gdb/gdbtypes.h #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n)) #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n)) -Index: gdb-7.1.90.20100711/gdb/jv-lang.c +Index: gdb-7.2.50.20101116/gdb/jv-lang.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/jv-lang.c 2010-05-17 19:18:39.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/jv-lang.c 2010-07-13 00:34:00.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/jv-lang.c 2010-08-09 21:42:47.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/jv-lang.c 2010-11-16 08:26:35.000000000 +0100 @@ -409,7 +409,8 @@ java_link_class_type (struct gdbarch *gd fields = NULL; @@ -119,11 +119,11 @@ Index: gdb-7.1.90.20100711/gdb/jv-lang.c else TYPE_FIELD_BITPOS (type, i) = 8 * boffset; if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */ -Index: gdb-7.1.90.20100711/gdb/value.c +Index: gdb-7.2.50.20101116/gdb/value.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/value.c 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/value.c 2010-07-13 00:35:21.000000000 +0200 -@@ -1943,7 +1943,8 @@ value_static_field (struct type *type, i +--- gdb-7.2.50.20101116.orig/gdb/value.c 2010-11-16 07:54:00.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/value.c 2010-11-16 08:26:35.000000000 +0100 +@@ -1965,7 +1965,8 @@ value_static_field (struct type *type, i { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), @@ -133,13 +133,3 @@ Index: gdb-7.1.90.20100711/gdb/value.c break; case FIELD_LOC_KIND_PHYSNAME: { -@@ -1977,7 +1978,8 @@ value_static_field (struct type *type, i - } - if (retval && VALUE_LVAL (retval) == lval_memory) - SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), -- value_address (retval)); -+ value_address (retval) -+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); - break; - } - default: diff --git a/gdb-archer.patch b/gdb-archer.patch index 43fda9e..ef364d5 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,127 +2,23 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit 74fff58d0076fe97c6c99d65fa58126315266646 +commit 9dd061f10e7d3a8a8c2d9ffa2492a08efb91f293 branch `archer' - the merge of branches: archer-jankratochvil-vla archer-jankratochvil-watchpoint3 archer-jankratochvil-ifunc -archer-pmuldoon-next-over-throw2 -archer-tromey-python (not a merge) -archer-tromey-optional-psymtab (cherry-picked from post-7.2 master) +#archer-pmuldoon-next-over-throw2 +#archer-tromey-python (not a merge) +#archer-tromey-optional-psymtab (cherry-picked from post-7.2 master) #TODO:archer-tromey-threaded-dwarf -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index f07bc8b..3703dca 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -169,6 +169,12 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@ - TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ - - # 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@ -+ - GDB_DATADIR = @GDB_DATADIR@ - - # Helper code from gnulib. -@@ -295,13 +301,13 @@ SUBDIR_PYTHON_SRCS = \ - 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-lazy-string.c \ - python/py-objfile.c \ - python/py-param.c \ - python/py-prettyprint.c \ -- python/py-progspace.c \ - python/py-symbol.c \ - python/py-symtab.c \ - python/py-type.c \ -@@ -780,8 +786,8 @@ 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 jit.h xml-syscall.h ada-operator.inc microblaze-tdep.h \ --psymtab.h psympriv.h -+gdb_usleep.h jit.h python/python.h python/python-internal.h \ -+xml-syscall.h ada-operator.inc microblaze-tdep.h - - # Header files that already have srcdir in them, or which are in objdir. - -@@ -1301,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status - CONFIG_LINKS= \ - $(SHELL) config.status - -+.gdbinit: $(srcdir)/gdbinit.in config.status -+ CONFIG_FILES=".gdbinit:gdbinit.in" \ -+ CONFIG_COMMANDS= \ -+ CONFIG_HEADERS= \ -+ $(SHELL) config.status -+ - config.status: $(srcdir)/configure configure.tgt configure.host - $(SHELL) config.status --recheck - -@@ -2024,6 +2036,10 @@ py-function.o: $(srcdir)/python/py-function.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-function.c - $(POSTCOMPILE) - -+py-hooks.o: $(srcdir)/python/py-hooks.c -+ $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-hooks.c -+ $(POSTCOMPILE) -+ - py-inferior.o: $(srcdir)/python/py-inferior.c - $(COMPILE) $(PYTHON_CFLAGS) $(srcdir)/python/py-inferior.c - $(POSTCOMPILE) -@@ -2072,6 +2088,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. -+# Note that we should only install files in the "gdb" module. -+PY_FILES = gdb/FrameIterator.py gdb/FrameWrapper.py gdb/command/alias.py \ -+ gdb/command/backtrace.py gdb/command/require.py \ -+ gdb/command/pahole.py gdb/command/upto.py gdb/command/__init__.py \ -+ gdb/command/ignore_errors.py gdb/command/save_breakpoints.py \ -+ gdb/function/caller_is.py gdb/function/in_scope.py \ -+ gdb/function/__init__.py gdb/backtrace.py gdb/__init__.py -+ -+# Install the Python library. Python library files go under -+# $(pythondir). -+install-python: -+ files='$(PY_FILES)'; for file in $$files; do \ -+ dir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ -+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(pythondir)/$$dir; \ -+ $(INSTALL_DATA) $(srcdir)/python/lib/$$file $(DESTDIR)$(pythondir)/$$file; \ -+ done -+ -+# Other packages may have their files installed in $(pythondir). -+uninstall-python: -+ files='$(PY_FILES)'; for file in $$files; do \ -+ slashdir=`echo "/$$file" | sed 's,/[^/]*$$,,'`; \ -+ rm -f $(DESTDIR)$(pythondir)/$$file; \ -+ while test "x$$file" != "x$$slashdir"; do \ -+ rmdir 2>/dev/null "$(DESTDIR)$(pythondir)$$slashdir"; \ -+ file="$$slashdir"; \ -+ slashdir=`echo "$$file" | sed 's,/[^/]*$$,,'`; \ -+ done \ -+ done -+ - # - # Dependency tracking. Most of this is conditional on GNU Make being - # found by configure; if GNU Make is not found, we fall back to a diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index 1d4c38b..cafb88e 100644 +index ea71ea2..ccd7b29 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c -@@ -11114,6 +11114,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, +@@ -11250,6 +11250,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, static int ada_operator_check (struct expression *exp, int pos, @@ -130,7 +26,7 @@ index 1d4c38b..cafb88e 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -11128,12 +11129,15 @@ ada_operator_check (struct expression *exp, int pos, +@@ -11264,12 +11265,15 @@ ada_operator_check (struct expression *exp, int pos, break; default: @@ -149,7 +45,7 @@ index 1d4c38b..cafb88e 100644 return 1; diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c -index c0edc10..17d36b5 100644 +index 16e97a2..3a5d57e 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -375,6 +375,20 @@ amd64_linux_dr_unset_status (unsigned long mask) @@ -173,7 +69,7 @@ index c0edc10..17d36b5 100644 static void amd64_linux_new_thread (ptid_t ptid) -@@ -796,6 +810,7 @@ _initialize_amd64_linux_nat (void) +@@ -800,6 +814,7 @@ _initialize_amd64_linux_nat (void) 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; @@ -289,7 +185,7 @@ index 0348bf4..f01d0ee 100644 /* Return the innermost stack frame executing inside of BLOCK, diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index 6a6864c..5df336d 100644 +index 6b55313..b152eda 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -62,6 +62,7 @@ @@ -310,7 +206,7 @@ index 6a6864c..5df336d 100644 static int breakpoint_re_set_one (void *); static void clear_command (char *, int); -@@ -106,6 +110,9 @@ static void break_command_1 (char *, int, int); +@@ -104,6 +108,9 @@ static void break_command_1 (char *, int, int); static void mention (struct breakpoint *); @@ -320,7 +216,7 @@ index 6a6864c..5df336d 100644 /* This function is used in gdbtk sources and thus can not be made static. */ struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line, -@@ -230,6 +237,10 @@ static void disable_trace_command (char *, int); +@@ -219,6 +226,10 @@ static void disable_trace_command (char *, int); static void trace_pass_command (char *, int); @@ -331,16 +227,7 @@ index 6a6864c..5df336d 100644 /* Assuming we're creating a static tracepoint, does S look like a static tracepoint marker spec ("-m MARKER_ID")? */ #define is_marker_spec(s) \ -@@ -430,7 +441,7 @@ static int tracepoint_count; - - static struct cmd_list_element *breakpoint_set_cmdlist; - static struct cmd_list_element *breakpoint_show_cmdlist; --static struct cmd_list_element *save_cmdlist; -+struct cmd_list_element *save_cmdlist; - - /* Return whether a breakpoint is an active enabled breakpoint. */ - static int -@@ -1252,6 +1263,22 @@ watchpoint_in_thread_scope (struct breakpoint *b) +@@ -1241,6 +1252,22 @@ watchpoint_in_thread_scope (struct breakpoint *b) && !is_executing (inferior_ptid))); } @@ -363,7 +250,7 @@ index 6a6864c..5df336d 100644 /* Assuming that B is a watchpoint: - Reparse watchpoint expression, if REPARSE is non-zero - Evaluate expression and store the result in B->val -@@ -1307,6 +1334,8 @@ update_watchpoint (struct breakpoint *b, int reparse) +@@ -1296,6 +1323,8 @@ update_watchpoint (struct breakpoint *b, int reparse) struct frame_id saved_frame_id; int frame_saved; @@ -372,7 +259,7 @@ index 6a6864c..5df336d 100644 /* If this is a local watchpoint, we only want to check if the watchpoint frame is in scope if the current thread is the thread that was used to create the watchpoint. */ -@@ -1510,13 +1539,7 @@ update_watchpoint (struct breakpoint *b, int reparse) +@@ -1500,13 +1529,7 @@ update_watchpoint (struct breakpoint *b, int reparse) Watchpoint %d deleted because the program has left the block\n\ in which its expression is valid.\n"), b->number); @@ -387,69 +274,7 @@ index 6a6864c..5df336d 100644 } /* Restore the selected frame. */ -@@ -2201,6 +2224,33 @@ create_std_terminate_master_breakpoint (const char *func_name) - do_cleanups (old_chain); - } - -+/* 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) -+ { -+ struct breakpoint *b; -+ -+ b = create_internal_breakpoint (get_objfile_arch (objfile), -+ SYMBOL_VALUE_ADDRESS (debug_hook), -+ 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) - { -@@ -2242,7 +2292,8 @@ 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_std_terminate_master) -+ || b->type == bp_longjmp_master || b->type == bp_std_terminate_master -+ || b->type == bp_exception_master) - { - delete_breakpoint (b); - continue; -@@ -2257,7 +2308,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; -@@ -2319,6 +2371,7 @@ update_breakpoints_after_exec (void) - create_longjmp_master_breakpoint ("siglongjmp"); - create_longjmp_master_breakpoint ("_siglongjmp"); - create_std_terminate_master_breakpoint ("std::terminate()"); -+ create_exception_master_breakpoint (); - } - - int -@@ -2346,6 +2399,8 @@ detach_breakpoints (int pid) +@@ -2354,6 +2377,8 @@ detach_breakpoints (int pid) /* Detach single-step breakpoints as well. */ detach_single_step_breakpoints (); @@ -458,7 +283,7 @@ index 6a6864c..5df336d 100644 do_cleanups (old_chain); return val; } -@@ -2447,9 +2502,11 @@ remove_breakpoint_1 (struct bp_location *b, insertion_state_t is) +@@ -2455,9 +2480,11 @@ remove_breakpoint_1 (struct bp_location *b, insertion_state_t is) return val; b->inserted = (is == mark_inserted); } @@ -472,29 +297,7 @@ index 6a6864c..5df336d 100644 val = target_remove_watchpoint (b->address, b->length, b->watchpoint_type, b->owner->cond_exp); -@@ -3237,6 +3294,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); -@@ -3324,6 +3387,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: -@@ -3331,6 +3396,8 @@ print_it_typical (bpstat bs) +@@ -3342,6 +3369,8 @@ print_it_typical (bpstat bs) case bp_tracepoint: case bp_fast_tracepoint: case bp_jit_event: @@ -503,16 +306,16 @@ index 6a6864c..5df336d 100644 default: result = PRINT_UNKNOWN; break; -@@ -3549,6 +3616,8 @@ watchpoint_check (void *p) - gdb_assert (bs->breakpoint_at->owner != NULL); - b = bs->breakpoint_at->owner; +@@ -3562,6 +3591,8 @@ watchpoint_check (void *p) + gdb_assert (bs->breakpoint_at != NULL); + b = bs->breakpoint_at; + gdb_assert (is_watchpoint (b)); + /* If this is a local watchpoint, we only want to check if the watchpoint frame is in scope if the current thread is the thread that was used to create the watchpoint. */ -@@ -3655,13 +3724,7 @@ watchpoint_check (void *p) +@@ -3668,13 +3699,7 @@ watchpoint_check (void *p) ui_out_text (uiout, " deleted because the program has left the block in\n\ which its expression is valid.\n"); @@ -527,7 +330,7 @@ index 6a6864c..5df336d 100644 return WP_DELETED; } -@@ -3730,8 +3793,12 @@ bpstat_check_location (const struct bp_location *bl, +@@ -3743,8 +3768,12 @@ bpstat_check_location (const struct bp_location *bl, /* If BS refers to a watchpoint, determine if the watched values has actually changed, and we should stop. If not, set BS->stop @@ -542,7 +345,7 @@ index 6a6864c..5df336d 100644 bpstat_check_watchpoint (bpstat bs) { const struct bp_location *bl; -@@ -3865,9 +3932,7 @@ bpstat_check_watchpoint (bpstat bs) +@@ -3878,9 +3907,7 @@ bpstat_check_watchpoint (bpstat bs) case 0: /* Error from catch_errors. */ printf_filtered (_("Watchpoint %d deleted.\n"), b->number); @@ -553,7 +356,7 @@ index 6a6864c..5df336d 100644 /* We've already printed what needs to be printed. */ bs->print_it = print_it_done; break; -@@ -3881,8 +3946,10 @@ bpstat_check_watchpoint (bpstat bs) +@@ -3894,8 +3921,10 @@ bpstat_check_watchpoint (bpstat bs) anything for this watchpoint. */ bs->print_it = print_it_noop; bs->stop = 0; @@ -564,16 +367,16 @@ index 6a6864c..5df336d 100644 } -@@ -3914,7 +3981,7 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid) - watchpoint as triggered so that we will handle the - out-of-scope event. We'll get to the watchpoint next - iteration. */ -- if (b->type == bp_watchpoint_scope) -+ if (b->type == bp_watchpoint_scope && b->related_breakpoint != b) - b->related_breakpoint->watchpoint_triggered = watch_triggered_yes; - - if (is_watchpoint (b)) -@@ -4045,6 +4112,8 @@ bpstat_stop_status (struct address_space *aspace, +@@ -4035,7 +4064,7 @@ bpstat_stop_status (struct address_space *aspace, + struct bp_location *bl; + struct bp_location *loc; + /* First item of allocated bpstat's. */ +- bpstat bs_head = NULL, *bs_link = &bs_head; ++ bpstat bs_head = NULL, *bs_link = &bs_head, *bs_link_next; + /* Pointer to the last thing in the chain currently. */ + bpstat bs; + int ix; +@@ -4056,6 +4085,8 @@ bpstat_stop_status (struct address_space *aspace, for (bl = b->loc; bl != NULL; bl = bl->next) { @@ -582,43 +385,45 @@ index 6a6864c..5df336d 100644 /* For hardware watchpoints, we look only at the first location. The watchpoint_check function will work on the entire expression, not the individual locations. For read watchpoints, the -@@ -4062,6 +4131,7 @@ bpstat_stop_status (struct address_space *aspace, - /* Come here if it's a watchpoint, or if the break address matches */ +@@ -4084,7 +4115,7 @@ bpstat_stop_status (struct address_space *aspace, + watchpoint as triggered so that we will handle the + out-of-scope event. We'll get to the watchpoint next + iteration. */ +- if (b->type == bp_watchpoint_scope) ++ if (b->type == bp_watchpoint_scope && b->related_breakpoint != b) + b->related_breakpoint->watchpoint_triggered = watch_triggered_yes; + } + } +@@ -4108,14 +4139,26 @@ bpstat_stop_status (struct address_space *aspace, - bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */ -+ gdb_assert (bs_prev->next == bs); + removed_any = 0; - /* Assume we stop. Should we find watchpoint that is not actually - triggered, or if condition of breakpoint is false, we'll reset -@@ -4069,13 +4139,23 @@ bpstat_stop_status (struct address_space *aspace, - 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. */ +- for (bs = bs_head; bs != NULL; bs = bs->next) ++ for (bs_link = &bs_head; *bs_link != NULL; bs_link = bs_link_next) + { ++ bs = *bs_link; ++ bs_link_next = &bs->next; + -+ gdb_assert (bs->print_it == print_it_noop); -+ gdb_assert (!bs->stop); -+ xfree (bs); -+ bs = bs_prev; -+ bs->next = NULL; -+ continue; -+ } + if (!bs->stop) + continue; - if (b->type == bp_thread_event || b->type == bp_overlay_event - || b->type == bp_longjmp_master -- || b->type == bp_std_terminate_master) -+ || b->type == bp_std_terminate_master -+ || b->type == bp_exception_master) - /* We do not stop for these. */ - bs->stop = 0; - else -@@ -4176,7 +4256,7 @@ handle_jit_event (void) + bpstat_check_watchpoint (bs); + if (!bs->stop) +- continue; ++ { ++ /* 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); ++ bs_link_next = bs_link; ++ xfree (bs); ++ continue; ++ } + + b = bs->breakpoint_at; + +@@ -4205,7 +4248,7 @@ handle_jit_event (void) /* Decide what infrun needs to do with this bpstat. */ struct bpstat_what @@ -627,7 +432,7 @@ index 6a6864c..5df336d 100644 { struct bpstat_what retval; /* We need to defer calling `solib_add', as adding new symbols -@@ -4184,11 +4264,13 @@ bpstat_what (bpstat bs) +@@ -4213,11 +4256,12 @@ bpstat_what (bpstat bs) and hence may clear unprocessed entries in the BS chain. */ int shlib_event = 0; int jit_event = 0; @@ -635,38 +440,13 @@ index 6a6864c..5df336d 100644 retval.main_action = BPSTAT_WHAT_KEEP_CHECKING; retval.call_dummy = STOP_NONE; -+ retval.is_longjmp = 0; - for (; bs != NULL; bs = bs->next) + for (bs = bs_head; bs != NULL; bs = bs->next) { /* Extract this BS's action. After processing each BS, we check if its action overrides all we've seem so far. */ -@@ -4242,10 +4324,15 @@ bpstat_what (bpstat bs) - } - break; - case bp_longjmp: -+ case bp_exception: - this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME; -+ retval.is_longjmp = bs->breakpoint_at->owner->type == bp_longjmp; - break; - case bp_longjmp_resume: -+ case bp_exception_resume: - this_action = BPSTAT_WHAT_CLEAR_LONGJMP_RESUME; -+ retval.is_longjmp -+ = bs->breakpoint_at->owner->type == bp_longjmp_resume; - break; - case bp_step_resume: - if (bs->stop) -@@ -4261,6 +4348,7 @@ bpstat_what (bpstat bs) - case bp_overlay_event: - case bp_longjmp_master: - case bp_std_terminate_master: -+ case bp_exception_master: - this_action = BPSTAT_WHAT_SINGLE; - break; - case bp_catchpoint: -@@ -4313,6 +4401,20 @@ bpstat_what (bpstat bs) +@@ -4342,6 +4386,20 @@ bpstat_what (bpstat bs) out already. */ internal_error (__FILE__, __LINE__, _("bpstat_what: tracepoint encountered")); @@ -687,7 +467,7 @@ index 6a6864c..5df336d 100644 default: internal_error (__FILE__, __LINE__, _("bpstat_what: unhandled bptype %d"), (int) bptype); -@@ -4350,6 +4452,23 @@ bpstat_what (bpstat bs) +@@ -4379,6 +4437,21 @@ bpstat_what (bpstat bs) handle_jit_event (); } @@ -695,15 +475,13 @@ index 6a6864c..5df336d 100644 + { + if (bs->breakpoint_at == NULL) + continue; -+ if (bs->breakpoint_at->owner == NULL) -+ continue; -+ switch (bs->breakpoint_at->owner->type) ++ switch (bs->breakpoint_at->type) + { + case bp_gnu_ifunc_resolver: -+ gnu_ifunc_resolver_stop (bs->breakpoint_at->owner); ++ gnu_ifunc_resolver_stop (bs->breakpoint_at); + break; + case bp_gnu_ifunc_resolver_return: -+ gnu_ifunc_resolver_return_stop (bs->breakpoint_at->owner); ++ gnu_ifunc_resolver_return_stop (bs->breakpoint_at); + break; + } + } @@ -711,45 +489,16 @@ index 6a6864c..5df336d 100644 return retval; } -@@ -4461,6 +4580,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"}, -@@ -4470,11 +4591,14 @@ print_one_breakpoint_location (struct breakpoint *b, - {bp_overlay_event, "overlay events"}, - {bp_longjmp_master, "longjmp master"}, - {bp_std_terminate_master, "std::terminate master"}, -+ {bp_exception_master, "exception master"}, - {bp_catchpoint, "catchpoint"}, - {bp_tracepoint, "tracepoint"}, +@@ -4497,6 +4570,8 @@ bptype_string (enum bptype type) {bp_fast_tracepoint, "fast tracepoint"}, {bp_static_tracepoint, "static tracepoint"}, {bp_jit_event, "jit events"}, + {bp_gnu_ifunc_resolver, "gnu-ifunc resolver"}, + {bp_gnu_ifunc_resolver_return, "gnu-func resolver return"}, }; - - static char bpenables[] = "nynny"; -@@ -4595,6 +4719,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: -@@ -4604,10 +4730,13 @@ print_one_breakpoint_location (struct breakpoint *b, - case bp_overlay_event: - case bp_longjmp_master: - case bp_std_terminate_master: -+ case bp_exception_master: - case bp_tracepoint: + + if (((int) type >= (sizeof (bptypes) / sizeof (bptypes[0]))) +@@ -4643,6 +4718,8 @@ print_one_breakpoint_location (struct breakpoint *b, case bp_fast_tracepoint: case bp_static_tracepoint: case bp_jit_event: @@ -758,7 +507,7 @@ index 6a6864c..5df336d 100644 if (opts.addressprint) { annotate_field (4); -@@ -4888,7 +5017,8 @@ user_settable_breakpoint (const struct breakpoint *b) +@@ -4923,7 +5000,8 @@ user_settable_breakpoint (const struct breakpoint *b) || b->type == bp_catchpoint || b->type == bp_hardware_breakpoint || is_tracepoint (b) @@ -768,34 +517,24 @@ index 6a6864c..5df336d 100644 } /* Print information on user settable breakpoint (watchpoint, etc) -@@ -5334,6 +5464,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: -@@ -5344,6 +5476,9 @@ allocate_bp_location (struct breakpoint *bpt) +@@ -5389,6 +5467,8 @@ allocate_bp_location (struct breakpoint *bpt) case bp_jit_event: case bp_longjmp_master: case bp_std_terminate_master: + case bp_gnu_ifunc_resolver: + case bp_gnu_ifunc_resolver_return: -+ case bp_exception_master: loc->loc_type = bp_loc_software_breakpoint; break; case bp_hardware_breakpoint: -@@ -5420,6 +5555,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, - b->syscalls_to_be_caught = NULL; +@@ -5477,6 +5557,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, b->ops = NULL; b->condition_not_parsed = 0; + b->py_bp_object = NULL; + b->related_breakpoint = b; /* Add this breakpoint to the end of the chain so that a list of breakpoints will come out in order -@@ -5439,7 +5575,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, +@@ -5496,7 +5577,7 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch, /* Initialize loc->function_name. */ static void @@ -804,7 +543,7 @@ index 6a6864c..5df336d 100644 { gdb_assert (loc->owner != NULL); -@@ -5447,8 +5583,29 @@ set_breakpoint_location_function (struct bp_location *loc) +@@ -5504,8 +5585,29 @@ set_breakpoint_location_function (struct bp_location *loc) || loc->owner->type == bp_hardware_breakpoint || is_tracepoint (loc->owner)) { @@ -836,7 +575,7 @@ index 6a6864c..5df336d 100644 if (loc->function_name) loc->function_name = xstrdup (loc->function_name); } -@@ -5521,7 +5678,8 @@ set_raw_breakpoint (struct gdbarch *gdbarch, +@@ -5578,7 +5680,8 @@ set_raw_breakpoint (struct gdbarch *gdbarch, b->loc->section = sal.section; b->line_number = sal.line; @@ -846,41 +585,7 @@ index 6a6864c..5df336d 100644 breakpoints_changed (); -@@ -5548,8 +5706,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) -@@ -5562,11 +5719,12 @@ set_longjmp_breakpoint (int thread) - clones of those and enable them for the requested thread. */ - ALL_BREAKPOINTS_SAFE (b, temp) - if (b->pspace == current_program_space -- && b->type == bp_longjmp_master) -+ && (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; - } - } -@@ -5578,7 +5736,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); -@@ -6595,7 +6753,7 @@ clone_momentary_breakpoint (struct breakpoint *orig) +@@ -6652,7 +6755,7 @@ clone_momentary_breakpoint (struct breakpoint *orig) copy = set_raw_breakpoint_without_location (orig->gdbarch, orig->type); copy->loc = allocate_bp_location (copy); @@ -889,7 +594,7 @@ index 6a6864c..5df336d 100644 copy->loc->gdbarch = orig->loc->gdbarch; copy->loc->requested_address = orig->loc->requested_address; -@@ -6694,6 +6852,7 @@ mention (struct breakpoint *b) +@@ -6751,6 +6854,7 @@ mention (struct breakpoint *b) do_cleanups (ui_out_chain); break; case bp_breakpoint: @@ -897,7 +602,7 @@ index 6a6864c..5df336d 100644 if (ui_out_is_mi_like_p (uiout)) { say_where = 0; -@@ -6704,6 +6863,8 @@ mention (struct breakpoint *b) +@@ -6761,6 +6865,8 @@ mention (struct breakpoint *b) else printf_filtered (_("Breakpoint")); printf_filtered (_(" %d"), b->number); @@ -906,25 +611,15 @@ index 6a6864c..5df336d 100644 say_where = 1; break; case bp_hardware_breakpoint: -@@ -6750,6 +6911,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_std_terminate: -@@ -6760,6 +6923,8 @@ mention (struct breakpoint *b) +@@ -6817,6 +6923,7 @@ mention (struct breakpoint *b) case bp_jit_event: case bp_longjmp_master: case bp_std_terminate_master: + case bp_gnu_ifunc_resolver_return: -+ case bp_exception_master: break; } -@@ -6820,7 +6985,8 @@ add_location_to_breakpoint (struct breakpoint *b, +@@ -6877,7 +6984,8 @@ add_location_to_breakpoint (struct breakpoint *b, gdb_assert (loc->pspace != NULL); loc->section = sal->section; @@ -934,61 +629,7 @@ index 6a6864c..5df336d 100644 return loc; } -@@ -8346,6 +8512,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 -@@ -8360,6 +8527,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 -@@ -8371,6 +8539,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 (); - -@@ -8409,6 +8579,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. */ - -@@ -8421,6 +8594,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); -@@ -8437,6 +8614,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 (), -@@ -9564,12 +9742,22 @@ delete_breakpoint (struct breakpoint *bpt) +@@ -9712,12 +9820,22 @@ delete_breakpoint (struct breakpoint *bpt) /* At least avoid this stale reference until the reference counting of breakpoints gets resolved. */ @@ -1016,23 +657,7 @@ index 6a6864c..5df336d 100644 } observer_notify_breakpoint_deleted (bpt->number); -@@ -9658,6 +9846,7 @@ delete_command (char *arg, int from_tty) - && b->type != bp_overlay_event - && b->type != bp_longjmp_master - && b->type != bp_std_terminate_master -+ && b->type != bp_exception_master - && b->number >= 0) - { - breaks_to_delete = 1; -@@ -9679,6 +9868,7 @@ delete_command (char *arg, int from_tty) - && b->type != bp_overlay_event - && b->type != bp_longjmp_master - && b->type != bp_std_terminate_master -+ && b->type != bp_exception_master - && b->number >= 0) - delete_breakpoint (b); - } -@@ -9887,6 +10077,9 @@ update_breakpoint_locations (struct breakpoint *b, +@@ -10049,6 +10167,9 @@ update_breakpoint_locations (struct breakpoint *b, return; b->loc = NULL; @@ -1042,7 +667,7 @@ index 6a6864c..5df336d 100644 for (i = 0; i < sals.nelts; ++i) { -@@ -9913,11 +10106,7 @@ update_breakpoint_locations (struct breakpoint *b, +@@ -10075,11 +10196,7 @@ update_breakpoint_locations (struct breakpoint *b, } } @@ -1055,7 +680,7 @@ index 6a6864c..5df336d 100644 b->source_file = xstrdup (sals.sals[i].symtab->filename); if (b->line_number == 0) -@@ -9999,6 +10188,7 @@ breakpoint_re_set_one (void *bint) +@@ -10161,6 +10278,7 @@ breakpoint_re_set_one (void *bint) case bp_tracepoint: case bp_fast_tracepoint: case bp_static_tracepoint: @@ -1063,34 +688,15 @@ index 6a6864c..5df336d 100644 /* Do not attempt to re-set breakpoints disabled during startup. */ if (b->enable_state == bp_startup_disabled) return 0; -@@ -10139,6 +10329,7 @@ breakpoint_re_set_one (void *bint) - case bp_overlay_event: - case bp_longjmp_master: - case bp_std_terminate_master: -+ case bp_exception_master: - delete_breakpoint (b); - break; - -@@ -10162,7 +10353,10 @@ breakpoint_re_set_one (void *bint) - case bp_step_resume: +@@ -10325,6 +10443,7 @@ breakpoint_re_set_one (void *bint) case bp_longjmp: case bp_longjmp_resume: -+ case bp_exception: -+ case bp_exception_resume: case bp_jit_event: + case bp_gnu_ifunc_resolver_return: break; } -@@ -10205,6 +10399,7 @@ breakpoint_re_set (void) - create_longjmp_master_breakpoint ("siglongjmp"); - create_longjmp_master_breakpoint ("_siglongjmp"); - create_std_terminate_master_breakpoint ("std::terminate()"); -+ create_exception_master_breakpoint (); - } - - /* Reset the thread number of this breakpoint: -@@ -10334,11 +10529,20 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *, +@@ -10496,11 +10615,25 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *, ALL_BREAKPOINTS_SAFE (b, tmp) if (b->number == num) { @@ -1109,13 +715,18 @@ index 6a6864c..5df336d 100644 + /* FUNCTION can be also delete_breakpoint. */ + next_related_b = related_breakpoint->related_breakpoint; + function (related_breakpoint, data); ++ ++ /* For delete_breakpoint of the last entry of the ring we ++ were traversing we would never get back to B. */ ++ if (next_related_b == related_breakpoint) ++ break; + related_breakpoint = next_related_b; + } + while (related_breakpoint != b); break; } if (match == 0) -@@ -11428,6 +11632,22 @@ all_tracepoints () +@@ -11604,6 +11737,22 @@ all_tracepoints () return tp_vec; } @@ -1138,7 +749,7 @@ index 6a6864c..5df336d 100644 /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -11497,6 +11717,107 @@ save_command (char *arg, int from_tty) +@@ -11673,6 +11822,107 @@ save_command (char *arg, int from_tty) help_list (save_cmdlist, "save ", -1, gdb_stdout); } @@ -1243,44 +854,20 @@ index 6a6864c..5df336d 100644 + update_breakpoint_locations (b, sals); +} + - void - _initialize_breakpoint (void) - { -@@ -12022,4 +12343,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."), + struct breakpoint * + iterate_over_breakpoints (int (*callback) (struct breakpoint *, void *), + void *data) +@@ -12222,4 +12472,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 6f5d050..d0c3cc1 100644 +index e34c2d3..4aadd57 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h -@@ -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, -@@ -125,6 +132,9 @@ enum bptype - /* Master copies of std::terminate breakpoints. */ - bp_std_terminate_master, - -+ /* Like bp_longjmp_master, but for exceptions. */ -+ bp_exception_master, -+ - bp_catchpoint, - - bp_tracepoint, -@@ -133,6 +143,9 @@ enum bptype +@@ -138,6 +138,9 @@ enum bptype /* Event for JIT compiled code generation or deletion. */ bp_jit_event, @@ -1290,414 +877,30 @@ index 6f5d050..d0c3cc1 100644 }; /* States of enablement of breakpoint. */ -@@ -653,6 +666,10 @@ struct bpstat_what - continuing from a call dummy without popping the frame is not a - useful one). */ - enum stop_stack_kind 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, diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c -index 926ae2f..a59b965 100644 +index 04f8127..2e29eb2 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c -@@ -585,7 +585,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - fprintf_filtered (stream, ")"); +@@ -579,7 +579,13 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream, + fprintf_filtered (stream, ")"); - fprintf_filtered (stream, "["); -- if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 -+ if (TYPE_RANGE_DATA (TYPE_INDEX_TYPE (type))->high.kind -+ != RANGE_BOUND_KIND_CONSTANT) -+ { -+ /* No _() - printed sources should not be locale dependent. */ -+ fprintf_filtered (stream, "variable"); -+ } -+ else if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0 - && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) - fprintf_filtered (stream, "%d", - (TYPE_LENGTH (type) -diff --git a/gdb/config.in b/gdb/config.in -index 1fc457d..f4c846a 100644 ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -50,11 +50,10 @@ - language is requested. */ - #undef ENABLE_NLS + fprintf_filtered (stream, "["); +- if (get_array_bounds (type, &low_bound, &high_bound)) ++ if (TYPE_RANGE_DATA (TYPE_INDEX_TYPE (type))->high.kind ++ != RANGE_BOUND_KIND_CONSTANT) ++ { ++ /* No _() - printed sources should not be locale dependent. */ ++ fprintf_filtered (stream, "variable"); ++ } ++ else if (get_array_bounds (type, &low_bound, &high_bound)) + fprintf_filtered (stream, "%d", (int) (high_bound - low_bound + 1)); + fprintf_filtered (stream, "]"); --/* look for global separate data files in this path [DATADIR/gdb] */ -+/* Global directory for GDB data files. */ - #undef GDB_DATADIR - --/* Define if the gdb-datadir directory should be relocated when GDB is moved. -- */ -+/* Define if GDB datadir should be relocated when GDB is moved. */ - #undef GDB_DATADIR_RELOCATABLE - - /* Define to be a string naming the default host character set. */ -@@ -769,6 +768,9 @@ - 'ptrdiff_t'. */ - #undef PTRDIFF_T_SUFFIX - -+/* Define to install path for Python sources */ -+#undef PYTHONDIR -+ - /* Define if the python directory should be relocated when GDB is moved. */ - #undef PYTHON_PATH_RELOCATABLE - -diff --git a/gdb/configure b/gdb/configure -index 041ffc1..8243abb 100755 ---- a/gdb/configure -+++ b/gdb/configure -@@ -679,6 +679,8 @@ REPORT_BUGS_TO - PKGVERSION - TARGET_OBS - subdirs -+pythondir -+GDB_DATADIR_PATH - GDB_DATADIR - DEBUGDIR - am__fastdepCC_FALSE -@@ -945,6 +947,7 @@ enable_dependency_tracking - with_separate_debug_dir - with_gdb_datadir - with_relocated_sources -+with_pythondir - enable_targets - enable_64_bit_bfd - enable_gdbcli -@@ -1646,6 +1649,10 @@ Optional Packages: - [DATADIR/gdb] - --with-relocated-sources=PATH - automatically relocate this path for source files -+ --with-gdb-datadir look for global separate data files in this path -+ [DATADIR/gdb] -+ --with-pythondir install Python data files in this path -+ [DATADIR/gdb/python] - --with-libunwind use libunwind frame unwinding support - --with-curses use the curses library instead of the termcap - library -@@ -7878,6 +7885,73 @@ _ACEOF - fi - - -+# GDB's datadir relocation -+ -+gdbdatadir=${datadir}/gdb -+ -+ -+# 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" -+ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -+ ac_define_dir=`eval echo $gdbdatadir` -+ ac_define_dir=`eval echo $ac_define_dir` -+ -+cat >>confdefs.h <<_ACEOF -+#define GDB_DATADIR "$ac_define_dir" -+_ACEOF -+ -+ -+ -+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then -+ if test "x$prefix" = xNONE; then -+ test_prefix=/usr/local -+ else -+ test_prefix=$prefix -+ fi -+else -+ test_prefix=$exec_prefix -+fi -+ -+case ${gdbdatadir} in -+ "${test_prefix}"|"${test_prefix}/"*|\ -+ '${exec_prefix}'|'${exec_prefix}/'*) -+ -+$as_echo "#define GDB_DATADIR_RELOCATABLE 1" >>confdefs.h -+ -+ ;; -+esac -+GDB_DATADIR_PATH=${gdbdatadir} -+ -+ -+ -+# Check whether --with-pythondir was given. -+if test "${with_pythondir+set}" = set; then : -+ withval=$with_pythondir; pythondir="${withval}" -+else -+ pythondir=no -+fi -+ -+ -+# If the user passed in a path, define it. Otherwise, compute it at -+# runtime based on the possibly-relocatable datadir. -+if test "$pythondir" = "no"; then -+ pythondir='$(GDB_DATADIR_PATH)/python' -+else -+ -+cat >>confdefs.h <<_ACEOF -+#define PYTHONDIR "$pythondir" -+_ACEOF -+ -+fi -+ -+ -+ - - - subdirs="$subdirs doc testsuite" -@@ -10919,6 +10993,7 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h - CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" - CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" - CONFIG_INSTALL="$CONFIG_INSTALL install-python" -+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python" - ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" - - # Flags needed to compile Python code (taken from python-config --cflags). -diff --git a/gdb/configure.ac b/gdb/configure.ac -index b69c3b6..4e89558 100644 ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -108,6 +108,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat - [Relocated directory for source files. ]) - ]) - -+# GDB's datadir relocation -+ -+gdbdatadir=${datadir}/gdb -+ -+AC_ARG_WITH([gdb-datadir], -+ [AS_HELP_STRING([--with-gdb-datadir], -+ [look for global separate data files in this path [DATADIR/gdb]])], [gdbdatadir="${withval}"]) -+ -+AC_DEFINE_DIR(GDB_DATADIR, gdbdatadir, -+ [Global directory for GDB data files. ]) -+ -+if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then -+ if test "x$prefix" = xNONE; then -+ test_prefix=/usr/local -+ else -+ test_prefix=$prefix -+ fi -+else -+ test_prefix=$exec_prefix -+fi -+ -+case ${gdbdatadir} in -+ "${test_prefix}"|"${test_prefix}/"*|\ -+ '${exec_prefix}'|'${exec_prefix}/'*) -+ AC_DEFINE(GDB_DATADIR_RELOCATABLE, 1, [Define if GDB datadir should be relocated when GDB is moved.]) -+ ;; -+esac -+GDB_DATADIR_PATH=${gdbdatadir} -+AC_SUBST(GDB_DATADIR_PATH) -+ -+AC_ARG_WITH([pythondir], -+ [AS_HELP_STRING([--with-pythondir], -+ [install Python data files in this path [DATADIR/gdb/python]])], [pythondir="${withval}"], [pythondir=no]) -+ -+# If the user passed in a path, define it. Otherwise, compute it at -+# runtime based on the possibly-relocatable datadir. -+if test "$pythondir" = "no"; then -+ pythondir='$(GDB_DATADIR_PATH)/python' -+else -+ AC_DEFINE_UNQUOTED(PYTHONDIR, "$pythondir", -+ [Define to install path for Python sources]) -+fi -+AC_SUBST(pythondir) -+ -+ - AC_CONFIG_SUBDIRS(doc testsuite) - - # Check whether to support alternative target configurations -@@ -833,6 +878,7 @@ if test "${have_libpython}" != no; then - CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)" - CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)" - CONFIG_INSTALL="$CONFIG_INSTALL install-python" -+ CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-python" - ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)" - - # Flags needed to compile Python code (taken from python-config --cflags). -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 65d4899..96767b0 100644 ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -1162,6 +1162,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. - -+@item -P -+@cindex @code{-P} -+@itemx --python -+@cindex @code{--python} -+Change interpretation of command line so that the argument immediately -+following this switch is taken to be the name of a Python script file. -+This option stops option processing; subsequent options are passed to -+Python as @code{sys.argv}. This option is only available if Python -+scripting support was enabled when @value{GDBN} was configured. -+ - @c resolve the situation of these eventually - @item -tui - @cindex @code{--tui} -@@ -14308,6 +14318,7 @@ program. To debug a core dump of a previous run, you must also tell - @menu - * Files:: Commands to specify files - * Separate Debug Files:: Debugging information in separate files -+* Index Files:: Index files speed up GDB - * Symbol Errors:: Errors reading symbol files - * Data Files:: GDB data files - @end menu -@@ -15197,6 +15208,46 @@ gnu_debuglink_crc32 (unsigned long crc, - This computation does not apply to the ``build ID'' method. - - -+@node Index Files -+@section Index Files Speed Up @value{GDBN} -+@cindex index files -+@cindex @samp{.gdb_index} section -+ -+When @value{GDBN} finds a symbol file, it scans the symbols in the -+file in order to construct an internal symbol table. This lets most -+@value{GDBN} operations work quickly---at the cost of a delay early -+on. For large programs, this delay can be quite lengthy, so -+@value{GDBN} provides a way to build an index, which speeds up -+startup. -+ -+The index is stored as a section in the symbol file. @value{GDBN} can -+write the index to a file, then you can put it into the symbol file -+using @command{objcopy}. -+ -+To create an index file, use the @code{save gdb-index} command: -+ -+@table @code -+@item save gdb-index @var{directory} -+@kindex save gdb-index -+Create an index file for each symbol file currently known by -+@value{GDBN}. Each file is named after its corresponding symbol file, -+with @samp{.gdb-index} appended, and is written into the given -+@var{directory}. -+@end table -+ -+Once you have created an index file you can merge it into your symbol -+file, here named @file{symfile}, using @command{objcopy}: -+ -+@smallexample -+$ objcopy --add-section .gdb_index=symfile.gdb-index \ -+ --set-section-flags .gdb_index=readonly symfile symfile -+@end smallexample -+ -+There are currently some limitation on indices. They only work when -+for DWARF debugging information, not stabs. And, they do not -+currently work for programs using Ada. -+ -+ - @node Symbol Errors - @section Errors Reading Symbol Files - -@@ -20349,8 +20400,6 @@ containing @code{end}. For example: - - @smallexample - (@value{GDBP}) python --Type python script --End with a line saying just "end". - >print 23 - >end - 23 -@@ -20363,6 +20412,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. -+ -+@kindex maint set python auto-load -+@item maint set python auto-load -+By default, @value{GDBN} will attempt to automatically load Python -+code when an object file is opened. This can be controlled using -+@code{maint set python auto-load}: if @code{on}, the default, then -+Python auto-loading is enabled; if @code{off}, then Python -+auto-loading is disabled. - @end table - - It is also possible to execute a Python script from the @value{GDBN} -@@ -20384,6 +20441,14 @@ and thus is always available. - @cindex python api - @cindex programming in python - -+You can get quick online help for @value{GDBN}'s Python API by issuing -+the command @w{@kbd{python help (gdb)}}. -+ -+Functions and methods which have two or more optional arguments allow -+them to be specified using keyword syntax. This allows passing some -+optional arguments while skipping others. Example: -+@w{@code{gdb.some_function ('foo', bar = 1, baz = 2)}}. -+ - @cindex python stdout - @cindex python pagination - At startup, @value{GDBN} overrides Python's @code{sys.stdout} and -@@ -20395,7 +20460,7 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. - @menu - * Basic Python:: Basic Python Functions. - * Exception Handling:: --* Values From Inferior:: -+* Values From Inferior:: Python representation of values. - * Types In Python:: Python representation of types. - * Pretty Printing API:: Pretty-printing values. - * Selecting Pretty-Printers:: How GDB chooses a pretty-printer. -@@ -20456,6 +20521,12 @@ Return a sequence holding all of @value{GDBN}'s breakpoints. - @xref{Breakpoints In Python}, for more information. - @end defun - -+@findex gdb.breakpoints -+@defun breakpoints -+Return a sequence holding all of @value{GDBN}'s breakpoints. -+@xref{Breakpoints In Python}, for more information. -+@end defun -+ - @findex gdb.parameter - @defun parameter parameter - Return the value of a @value{GDBN} parameter. @var{parameter} is a -@@ -20472,6 +20543,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. -+ - 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 -@@ -20496,6 +20568,21 @@ compute values, for example, it is the only way to get the value of a - convenience variable (@pxref{Convenience Vars}) as a @code{gdb.Value}. - @end defun - -+@findex gdb.post_event -+@defun post_event event -+Put @var{event}, a callable object taking no arguments, into -+@value{GDBN}'s internal event queue. This callable will be invoked at -+some later point, during @value{GDBN}'s event processing. Events -+posted using @code{post_event} will be run in the order in which they -+were posted; however, there is no way to know when they will be -+processed relative to other events inside @value{GDBN}. -+ -+@value{GDBN} is not thread-safe. If your Python program uses multiple -+threads, you must be careful to only call @value{GDBN}-specific -+functions in the main @value{GDBN} thread. @code{post_event} ensures -+this. -+@end defun -+ - @findex gdb.write - @defun write string - Print a string to @value{GDBN}'s paginated standard output stream. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index 54187dd..320b501 100644 +index 4a112aa..7b6bed4 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo -@@ -2102,6 +2102,18 @@ time, and so we attempt to handle symbols incrementally. For instance, +@@ -2104,6 +2104,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. @@ -1716,7 +919,7 @@ index 54187dd..320b501 100644 @section Symbol Reading @cindex symbol reading -@@ -2194,6 +2206,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and +@@ -2196,6 +2208,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 @@ -1724,7 +927,7 @@ index 54187dd..320b501 100644 @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2295,6 +2308,7 @@ and partial symbol tables behind a set of function pointers known as +@@ -2297,6 +2310,7 @@ and partial symbol tables behind a set of function pointers known as the @dfn{quick symbol functions}. These are documented in @file{symfile.h}. @@ -1732,7 +935,7 @@ index 54187dd..320b501 100644 @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2317,6 +2331,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by +@@ -2319,6 +2333,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. @@ -1740,7 +943,7 @@ index 54187dd..320b501 100644 @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2331,6 +2346,7 @@ only one instance exists, while @file{c-lang.c} builds as many +@@ -2333,6 +2348,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. @@ -1748,7 +951,7 @@ index 54187dd..320b501 100644 @section Object File Formats @cindex object file formats -@@ -2416,6 +2432,7 @@ SOM, which is a cross-language ABI). +@@ -2418,6 +2434,7 @@ SOM, which is a cross-language ABI). The SOM reader is in @file{somread.c}. @@ -1756,7 +959,7 @@ index 54187dd..320b501 100644 @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2487,6 +2504,7 @@ DWARF 3 is an improved version of DWARF 2. +@@ -2489,6 +2506,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -1764,7 +967,7 @@ index 54187dd..320b501 100644 @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2509,6 +2527,7 @@ will only ever be implemented by one object file format may be called +@@ -2511,6 +2529,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}. @@ -1772,7 +975,7 @@ index 54187dd..320b501 100644 @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2520,10 +2539,45 @@ released when the objfile is unloaded or reloaded. Therefore one +@@ -2522,10 +2541,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. @@ -1878,23 +1081,10 @@ index 61b8f00..d94c03c 100644 /* The current depth of dwarf expression recursion, via DW_OP_call*, DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index f59bc40..7ff0ef9 100644 +index b2aecf2..afc7907 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -48,6 +48,12 @@ static void - dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, - const gdb_byte **start, size_t *length); - -+static struct value *dwarf2_evaluate_loc_desc (struct type *type, -+ struct frame_info *frame, -+ const gdb_byte *data, -+ unsigned short size, -+ struct dwarf2_per_cu_data *per_cu); -+ - /* A helper function for dealing with location lists. Given a - symbol baton (BATON) and a pc value (PC), find the appropriate - location expression, set *LOCEXPR_LENGTH, and return a pointer -@@ -127,6 +133,9 @@ struct dwarf_expr_baton +@@ -127,6 +127,9 @@ struct dwarf_expr_baton { struct frame_info *frame; struct dwarf2_per_cu_data *per_cu; @@ -1904,7 +1094,7 @@ index f59bc40..7ff0ef9 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -195,23 +204,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, +@@ -195,23 +198,33 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, symbaton = SYMBOL_LOCATION_BATON (framefunc); *start = find_location_expression (symbaton, length, pc); } @@ -1947,7 +1137,7 @@ index f59bc40..7ff0ef9 100644 } /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -263,6 +282,158 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) +@@ -263,6 +276,158 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) return per_cu_dwarf_call (ctx, die_offset, debaton->per_cu); } @@ -2106,7 +1296,7 @@ index f59bc40..7ff0ef9 100644 struct piece_closure { /* Reference count. */ -@@ -887,10 +1058,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +@@ -887,10 +1052,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, struct dwarf2_per_cu_data *per_cu) { struct value *retval; @@ -2118,7 +1308,7 @@ index f59bc40..7ff0ef9 100644 if (size == 0) { -@@ -900,24 +1069,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +@@ -900,24 +1063,8 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, return retval; } @@ -2144,7 +1334,7 @@ index f59bc40..7ff0ef9 100644 if (ctx->num_pieces > 0) { struct piece_closure *c; -@@ -951,6 +1104,11 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +@@ -951,6 +1098,11 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0); int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); @@ -2156,7 +1346,7 @@ index f59bc40..7ff0ef9 100644 retval = allocate_value (type); VALUE_LVAL (retval) = lval_memory; set_value_lazy (retval, 1); -@@ -2590,11 +2748,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, +@@ -2587,11 +2739,51 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, dlbaton->per_cu); } @@ -2211,10 +1401,10 @@ index f59bc40..7ff0ef9 100644 + missing_tracepoint_var_ref +}; diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index 826bc45..1e7d8dc 100644 +index a2cfe7f..f2d07ef 100644 --- a/gdb/dwarf2loc.h +++ b/gdb/dwarf2loc.h -@@ -86,5 +86,14 @@ struct dwarf2_loclist_baton +@@ -96,5 +96,14 @@ struct dwarf2_loclist_baton extern const struct symbol_computed_ops dwarf2_locexpr_funcs; extern const struct symbol_computed_ops dwarf2_loclist_funcs; @@ -2230,142 +1420,10 @@ index 826bc45..1e7d8dc 100644 #endif /* dwarf2loc.h */ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 1e75235..d54e266 100644 +index 404faf8..e372afb 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -51,6 +51,9 @@ - #include "typeprint.h" - #include "jv-lang.h" - #include "psympriv.h" -+#include "exceptions.h" -+#include "gdb_stat.h" -+#include "completer.h" - - #include - #include "gdb_string.h" -@@ -129,6 +132,33 @@ struct dwarf2_section_info - int readin; - }; - -+/* All offsets in the index are of this type. It must be -+ architecture-independent. */ -+typedef uint32_t offset_type; -+ -+DEF_VEC_I (offset_type); -+ -+/* A description of the mapped index. The file format is described in -+ a comment by the code that writes the index. */ -+struct mapped_index -+{ -+ /* The total length of the buffer. */ -+ off_t total_size; -+ /* A pointer to the address table data. */ -+ const gdb_byte *address_table; -+ /* Size of the address table data in bytes. */ -+ offset_type address_table_size; -+ /* The hash table. */ -+ const offset_type *index_table; -+ /* Size in slots, each slot is 2 offset_types. */ -+ offset_type index_table_slots; -+ /* A pointer to the constant pool. */ -+ const char *constant_pool; -+}; -+ -+typedef struct dwarf2_per_cu_data *dwarf2_per_cu_data_ptr; -+DEF_VEC_P (dwarf2_per_cu_data_ptr); -+ - struct dwarf2_per_objfile - { - struct dwarf2_section_info info; -@@ -141,6 +171,7 @@ struct dwarf2_per_objfile - struct dwarf2_section_info types; - struct dwarf2_section_info frame; - struct dwarf2_section_info eh_frame; -+ struct dwarf2_section_info gdb_index; - - /* Back link. */ - struct objfile *objfile; -@@ -163,6 +194,12 @@ struct dwarf2_per_objfile - /* A flag indicating wether this objfile has a section loaded at a - VMA of 0. */ - int has_section_at_zero; -+ -+ /* True if we are using the mapped index. */ -+ unsigned char using_index; -+ -+ /* The mapped index. */ -+ struct mapped_index *index_table; - }; - - static struct dwarf2_per_objfile *dwarf2_per_objfile; -@@ -182,6 +219,7 @@ static struct dwarf2_per_objfile *dwarf2_per_objfile; - #define TYPES_SECTION "debug_types" - #define FRAME_SECTION "debug_frame" - #define EH_FRAME_SECTION "eh_frame" -+#define GDB_INDEX_SECTION "gdb_index" - - /* local data types */ - -@@ -307,6 +345,32 @@ struct dwarf2_cu - unsigned int has_namespace_info : 1; - }; - -+/* When using the index (and thus not using psymtabs), each CU has an -+ object of this type. This is used to hold information needed by -+ the various "quick" methods. */ -+struct dwarf2_per_cu_quick_data -+{ -+ /* The line table. This can be NULL if there was no line table. */ -+ struct line_header *lines; -+ -+ /* The file names from the line table. */ -+ const char **file_names; -+ /* The file names from the line table after being run through -+ gdb_realpath. */ -+ const char **full_names; -+ -+ /* The corresponding symbol table. This is NULL if symbols for this -+ CU have not yet been read. */ -+ struct symtab *symtab; -+ -+ /* A temporary mark bit used when iterating over all CUs in -+ expand_symtabs_matching. */ -+ unsigned int mark : 1; -+ -+ /* True if we've tried to read the line table. */ -+ unsigned int read_lines : 1; -+}; -+ - /* Persistent data held for a compilation unit, even when not - processing it. We put a pointer to this structure in the - read_symtab_private field of the psymtab. If we encounter -@@ -347,10 +411,21 @@ struct dwarf2_per_cu_data - it. */ - htab_t type_hash; - -- /* The partial symbol table associated with this compilation unit, -- or NULL for partial units (which do not have an associated -- symtab). */ -- struct partial_symtab *psymtab; -+ /* The corresponding objfile. */ -+ struct objfile *objfile; -+ -+ /* When using partial symbol tables, the 'psymtab' field is active. -+ Otherwise the 'quick' field is active. */ -+ union -+ { -+ /* The partial symbol table associated with this compilation unit, -+ or NULL for partial units (which do not have an associated -+ symtab). */ -+ struct partial_symtab *psymtab; -+ -+ /* Data needed by the "quick" functions. */ -+ struct dwarf2_per_cu_quick_data *quick; -+ } v; - }; - - /* Entry in the signatured_types hash table. */ -@@ -1083,6 +1158,9 @@ static int attr_form_is_section_offset (struct attribute *); +@@ -1221,6 +1221,9 @@ static int attr_form_is_section_offset (struct attribute *); static int attr_form_is_constant (struct attribute *); @@ -2375,7 +1433,7 @@ index 1e75235..d54e266 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu); -@@ -1113,6 +1191,9 @@ static void age_cached_comp_units (void); +@@ -1251,6 +1254,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (void *); @@ -2385,1269 +1443,17 @@ index 1e75235..d54e266 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1132,6 +1213,56 @@ static void dwarf2_clear_marks (struct dwarf2_per_cu_data *); +@@ -1275,6 +1281,9 @@ static struct type *get_die_type_at_offset (unsigned int, static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); +static struct dwarf2_locexpr_baton *dwarf2_attr_to_locexpr_baton + (struct attribute *attr, struct dwarf2_cu *cu); + -+static void dwarf2_release_queue (void *dummy); -+ -+static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, -+ struct objfile *objfile); -+ -+static void process_queue (struct objfile *objfile); -+ -+static void find_file_and_directory (struct die_info *die, -+ struct dwarf2_cu *cu, -+ char **name, char **comp_dir); -+ -+static char *file_full_name (int file, struct line_header *lh, -+ const char *comp_dir); -+ -+static gdb_byte *partial_read_comp_unit_head (struct comp_unit_head *header, -+ gdb_byte *info_ptr, -+ gdb_byte *buffer, -+ unsigned int buffer_size, -+ bfd *abfd); -+ -+static void init_cu_die_reader (struct die_reader_specs *reader, -+ struct dwarf2_cu *cu); -+ -+#if WORDS_BIGENDIAN -+ -+/* Convert VALUE between big- and little-endian. */ -+static offset_type -+byte_swap (offset_type value) -+{ -+ offset_type result; -+ -+ result = (value & 0xff) << 24; -+ result |= (value & 0xff00) << 8; -+ result |= (value & 0xff0000) >> 8; -+ result |= (value & 0xff000000) >> 24; -+ return result; -+} -+ -+#define MAYBE_SWAP(V) byte_swap (V) -+ -+#else -+#define MAYBE_SWAP(V) (V) -+#endif /* WORDS_BIGENDIAN */ -+ -+/* The suffix for an index file. */ -+#define INDEX_SUFFIX ".gdb-index" -+ - /* Try to locate the sections we need for DWARF 2 debugging - information and return true if we have enough to do something. */ + static void dwarf2_release_queue (void *dummy); -@@ -1230,6 +1361,11 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr) - dwarf2_per_objfile->types.asection = sectp; - dwarf2_per_objfile->types.size = bfd_get_section_size (sectp); - } -+ else if (section_is_p (sectp->name, GDB_INDEX_SECTION)) -+ { -+ dwarf2_per_objfile->gdb_index.asection = sectp; -+ dwarf2_per_objfile->gdb_index.size = bfd_get_section_size (sectp); -+ } - - if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD) - && bfd_section_vma (abfd, sectp) == 0) -@@ -1353,87 +1489,940 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) - if (pagesize == 0) - pagesize = getpagesize (); - -- /* Only try to mmap sections which are large enough: we don't want to -- waste space due to fragmentation. Also, only try mmap for sections -- without relocations. */ -+ /* Only try to mmap sections which are large enough: we don't want to -+ waste space due to fragmentation. Also, only try mmap for sections -+ without relocations. */ -+ -+ if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0) -+ { -+ off_t pg_offset = sectp->filepos & ~(pagesize - 1); -+ size_t map_length = info->size + sectp->filepos - pg_offset; -+ caddr_t retbuf = bfd_mmap (abfd, 0, map_length, PROT_READ, -+ MAP_PRIVATE, pg_offset); -+ -+ if (retbuf != MAP_FAILED) -+ { -+ info->was_mmapped = 1; -+ info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ; -+#if HAVE_POSIX_MADVISE -+ posix_madvise (retbuf, map_length, POSIX_MADV_WILLNEED); -+#endif -+ return; -+ } -+ } -+#endif -+ -+ /* If we get here, we are a normal, not-compressed section. */ -+ info->buffer = buf -+ = obstack_alloc (&objfile->objfile_obstack, info->size); -+ -+ /* When debugging .o files, we may need to apply relocations; see -+ http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -+ We never compress sections in .o files, so we only need to -+ try this when the section is not compressed. */ -+ retbuf = symfile_relocate_debug_section (objfile, sectp, buf); -+ if (retbuf != NULL) -+ { -+ info->buffer = retbuf; -+ return; -+ } -+ -+ if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 -+ || bfd_bread (buf, info->size, abfd) != info->size) -+ error (_("Dwarf Error: Can't read DWARF data from '%s'"), -+ bfd_get_filename (abfd)); -+} -+ -+/* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and -+ SECTION_NAME. */ -+ -+void -+dwarf2_get_section_info (struct objfile *objfile, const char *section_name, -+ asection **sectp, gdb_byte **bufp, -+ bfd_size_type *sizep) -+{ -+ struct dwarf2_per_objfile *data -+ = objfile_data (objfile, dwarf2_objfile_data_key); -+ struct dwarf2_section_info *info; -+ -+ /* We may see an objfile without any DWARF, in which case we just -+ return nothing. */ -+ if (data == NULL) -+ { -+ *sectp = NULL; -+ *bufp = NULL; -+ *sizep = 0; -+ return; -+ } -+ if (section_is_p (section_name, EH_FRAME_SECTION)) -+ info = &data->eh_frame; -+ else if (section_is_p (section_name, FRAME_SECTION)) -+ info = &data->frame; -+ else -+ gdb_assert (0); -+ -+ if (info->asection != NULL && info->size != 0 && info->buffer == NULL) -+ /* We haven't read this section in yet. Do it now. */ -+ dwarf2_read_section (objfile, info); -+ -+ *sectp = info->asection; -+ *bufp = info->buffer; -+ *sizep = info->size; -+} -+ -+ -+ -+/* Read in the symbols for PER_CU. OBJFILE is the objfile from which -+ this CU came. */ -+static void -+dw2_do_instantiate_symtab (struct objfile *objfile, -+ struct dwarf2_per_cu_data *per_cu) -+{ -+ struct cleanup *back_to; -+ -+ back_to = make_cleanup (dwarf2_release_queue, NULL); -+ -+ queue_comp_unit (per_cu, objfile); -+ -+ if (per_cu->from_debug_types) -+ read_signatured_type_at_offset (objfile, per_cu->offset); -+ else -+ load_full_comp_unit (per_cu, objfile); -+ -+ process_queue (objfile); -+ -+ /* Age the cache, releasing compilation units that have not -+ been used recently. */ -+ age_cached_comp_units (); -+ -+ do_cleanups (back_to); -+} -+ -+/* Ensure that the symbols for PER_CU have been read in. OBJFILE is -+ the objfile from which this CU came. Returns the resulting symbol -+ table. */ -+static struct symtab * -+dw2_instantiate_symtab (struct objfile *objfile, -+ struct dwarf2_per_cu_data *per_cu) -+{ -+ if (!per_cu->v.quick->symtab) -+ { -+ struct cleanup *back_to = make_cleanup (free_cached_comp_units, NULL); -+ increment_reading_symtab (); -+ dw2_do_instantiate_symtab (objfile, per_cu); -+ do_cleanups (back_to); -+ } -+ return per_cu->v.quick->symtab; -+} -+ -+/* A helper function that knows how to read a 64-bit value in a way -+ that doesn't make gdb die. Returns 1 if the conversion went ok, 0 -+ otherwise. */ -+static int -+extract_cu_value (const char *bytes, ULONGEST *result) -+{ -+ if (sizeof (ULONGEST) < 8) -+ { -+ int i; -+ -+ /* Ignore the upper 4 bytes if they are all zero. */ -+ for (i = 0; i < 4; ++i) -+ if (bytes[i + 4] != 0) -+ return 0; -+ -+ *result = extract_unsigned_integer (bytes, 4, BFD_ENDIAN_LITTLE); -+ } -+ else -+ *result = extract_unsigned_integer (bytes, 8, BFD_ENDIAN_LITTLE); -+ return 1; -+} -+ -+/* Read the CU list from the mapped index, and use it to create all -+ the CU objects for this objfile. Return 0 if something went wrong, -+ 1 if everything went ok. */ -+static int -+create_cus_from_index (struct objfile *objfile, struct mapped_index *index, -+ const gdb_byte *cu_list, offset_type cu_list_elements) -+{ -+ offset_type i; -+ const char *entry; -+ -+ dwarf2_per_objfile->n_comp_units = cu_list_elements / 2; -+ dwarf2_per_objfile->all_comp_units -+ = obstack_alloc (&objfile->objfile_obstack, -+ dwarf2_per_objfile->n_comp_units -+ * sizeof (struct dwarf2_per_cu_data *)); -+ -+ for (i = 0; i < cu_list_elements; i += 2) -+ { -+ struct dwarf2_per_cu_data *the_cu; -+ ULONGEST offset, length; -+ -+ if (!extract_cu_value (cu_list, &offset) -+ || !extract_cu_value (cu_list + 8, &length)) -+ return 0; -+ cu_list += 2 * 8; -+ -+ the_cu = OBSTACK_ZALLOC (&objfile->objfile_obstack, -+ struct dwarf2_per_cu_data); -+ the_cu->offset = offset; -+ the_cu->length = length; -+ the_cu->objfile = objfile; -+ the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, -+ struct dwarf2_per_cu_quick_data); -+ dwarf2_per_objfile->all_comp_units[i / 2] = the_cu; -+ } -+ -+ return 1; -+} -+ -+/* Read the address map data from the mapped index, and use it to -+ populate the objfile's psymtabs_addrmap. */ -+static void -+create_addrmap_from_index (struct objfile *objfile, struct mapped_index *index) -+{ -+ const gdb_byte *iter, *end; -+ struct obstack temp_obstack; -+ struct addrmap *mutable_map; -+ struct cleanup *cleanup; -+ CORE_ADDR baseaddr; -+ -+ obstack_init (&temp_obstack); -+ cleanup = make_cleanup_obstack_free (&temp_obstack); -+ mutable_map = addrmap_create_mutable (&temp_obstack); -+ -+ iter = index->address_table; -+ end = iter + index->address_table_size; -+ -+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -+ -+ while (iter < end) -+ { -+ ULONGEST hi, lo, cu_index; -+ lo = extract_unsigned_integer (iter, 8, BFD_ENDIAN_LITTLE); -+ iter += 8; -+ hi = extract_unsigned_integer (iter, 8, BFD_ENDIAN_LITTLE); -+ iter += 8; -+ cu_index = extract_unsigned_integer (iter, 4, BFD_ENDIAN_LITTLE); -+ iter += 4; -+ -+ addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1, -+ dwarf2_per_objfile->all_comp_units[cu_index]); -+ } -+ -+ objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map, -+ &objfile->objfile_obstack); -+ do_cleanups (cleanup); -+} -+ -+/* The hash function for strings in the mapped index. This is the -+ same as the hashtab.c hash function, but we keep a separate copy to -+ maintain control over the implementation. This is necessary -+ because the hash function is tied to the format of the mapped index -+ file. */ -+static hashval_t -+mapped_index_string_hash (const void *p) -+{ -+ const unsigned char *str = (const unsigned char *) p; -+ hashval_t r = 0; -+ unsigned char c; -+ -+ while ((c = *str++) != 0) -+ r = r * 67 + c - 113; -+ -+ return r; -+} -+ -+/* Find a slot in the mapped index INDEX for the object named NAME. -+ If NAME is found, set *VEC_OUT to point to the CU vector in the -+ constant pool and return 1. If NAME cannot be found, return 0. */ -+static int -+find_slot_in_mapped_hash (struct mapped_index *index, const char *name, -+ offset_type **vec_out) -+{ -+ offset_type hash = mapped_index_string_hash (name); -+ offset_type slot, step; -+ -+ slot = hash & (index->index_table_slots - 1); -+ step = ((hash * 17) & (index->index_table_slots - 1)) | 1; -+ -+ for (;;) -+ { -+ /* Convert a slot number to an offset into the table. */ -+ offset_type i = 2 * slot; -+ const char *str; -+ if (index->index_table[i] == 0 && index->index_table[i + 1] == 0) -+ return 0; -+ -+ str = index->constant_pool + MAYBE_SWAP (index->index_table[i]); -+ if (!strcmp (name, str)) -+ { -+ *vec_out = (offset_type *) (index->constant_pool -+ + MAYBE_SWAP (index->index_table[i + 1])); -+ return 1; -+ } -+ -+ slot = (slot + step) & (index->index_table_slots - 1); -+ } -+} -+ -+/* Read the index file. If everything went ok, initialize the "quick" -+ elements of all the CUs and return 1. Otherwise, return 0. */ -+static int -+dwarf2_read_index (struct objfile *objfile) -+{ -+ char *addr; -+ struct mapped_index *map; -+ offset_type *metadata; -+ const gdb_byte *cu_list; -+ offset_type cu_list_elements; -+ -+ if (dwarf2_per_objfile->gdb_index.asection == NULL -+ || dwarf2_per_objfile->gdb_index.size == 0) -+ return 0; -+ dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index); -+ -+ addr = dwarf2_per_objfile->gdb_index.buffer; -+ /* Version check. */ -+ if (MAYBE_SWAP (*(offset_type *) addr) != 1) -+ return 0; -+ -+ map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); -+ map->total_size = dwarf2_per_objfile->gdb_index.size; -+ -+ metadata = (offset_type *) (addr + sizeof (offset_type)); -+ cu_list = addr + MAYBE_SWAP (metadata[0]); -+ cu_list_elements = ((MAYBE_SWAP (metadata[1]) - MAYBE_SWAP (metadata[0])) -+ / 8); -+ map->address_table = addr + MAYBE_SWAP (metadata[1]); -+ map->address_table_size = (MAYBE_SWAP (metadata[2]) -+ - MAYBE_SWAP (metadata[1])); -+ map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[2])); -+ map->index_table_slots = ((MAYBE_SWAP (metadata[3]) -+ - MAYBE_SWAP (metadata[2])) -+ / (2 * sizeof (offset_type))); -+ map->constant_pool = addr + MAYBE_SWAP (metadata[3]); -+ -+ if (!create_cus_from_index (objfile, map, cu_list, cu_list_elements)) -+ return 0; -+ -+ create_addrmap_from_index (objfile, map); -+ -+ dwarf2_per_objfile->index_table = map; -+ dwarf2_per_objfile->using_index = 1; -+ -+ return 1; -+} -+ -+/* A helper for the "quick" functions which sets the global -+ dwarf2_per_objfile according to OBJFILE. */ -+static void -+dw2_setup (struct objfile *objfile) -+{ -+ dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); -+ gdb_assert (dwarf2_per_objfile); -+} -+ -+/* A helper for the "quick" functions which attempts to read the line -+ table for THIS_CU. */ -+static void -+dw2_require_line_header (struct objfile *objfile, -+ struct dwarf2_per_cu_data *this_cu) -+{ -+ bfd *abfd = objfile->obfd; -+ struct line_header *lh = NULL; -+ struct attribute *attr; -+ struct cleanup *cleanups; -+ struct die_info *comp_unit_die; -+ gdb_byte *beg_of_comp_unit, *info_ptr, *buffer; -+ int has_children, i; -+ struct dwarf2_cu cu; -+ unsigned int bytes_read, buffer_size; -+ struct die_reader_specs reader_specs; -+ char *name, *comp_dir; -+ -+ if (this_cu->v.quick->read_lines) -+ return; -+ this_cu->v.quick->read_lines = 1; -+ -+ memset (&cu, 0, sizeof (cu)); -+ cu.objfile = objfile; -+ obstack_init (&cu.comp_unit_obstack); -+ -+ cleanups = make_cleanup (free_stack_comp_unit, &cu); -+ -+ dwarf2_read_section (objfile, &dwarf2_per_objfile->info); -+ buffer_size = dwarf2_per_objfile->info.size; -+ buffer = dwarf2_per_objfile->info.buffer; -+ info_ptr = buffer + this_cu->offset; -+ beg_of_comp_unit = info_ptr; -+ -+ info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr, -+ buffer, buffer_size, -+ abfd); -+ -+ /* Complete the cu_header. */ -+ cu.header.offset = beg_of_comp_unit - buffer; -+ cu.header.first_die_offset = info_ptr - beg_of_comp_unit; -+ -+ this_cu->cu = &cu; -+ cu.per_cu = this_cu; -+ -+ dwarf2_read_abbrevs (abfd, &cu); -+ make_cleanup (dwarf2_free_abbrev_table, &cu); -+ -+ if (this_cu->from_debug_types) -+ info_ptr += 8 /*signature*/ + cu.header.offset_size; -+ init_cu_die_reader (&reader_specs, &cu); -+ info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr, -+ &has_children); -+ -+ attr = dwarf2_attr (comp_unit_die, DW_AT_stmt_list, &cu); -+ if (attr) -+ { -+ unsigned int line_offset = DW_UNSND (attr); -+ lh = dwarf_decode_line_header (line_offset, abfd, &cu); -+ } -+ if (lh == NULL) -+ { -+ do_cleanups (cleanups); -+ return; -+ } -+ -+ find_file_and_directory (comp_unit_die, &cu, &name, &comp_dir); -+ -+ this_cu->v.quick->lines = lh; -+ -+ this_cu->v.quick->file_names -+ = obstack_alloc (&objfile->objfile_obstack, -+ lh->num_file_names * sizeof (char *)); -+ for (i = 0; i < lh->num_file_names; ++i) -+ this_cu->v.quick->file_names[i] = file_full_name (i + 1, lh, comp_dir); -+ -+ do_cleanups (cleanups); -+} -+ -+/* A helper for the "quick" functions which computes and caches the -+ real path for a given file name from the line table. -+ dw2_require_line_header must have been called before this is -+ invoked. */ -+static const char * -+dw2_require_full_path (struct objfile *objfile, -+ struct dwarf2_per_cu_data *cu, -+ int index) -+{ -+ if (!cu->v.quick->full_names) -+ cu->v.quick->full_names -+ = OBSTACK_CALLOC (&objfile->objfile_obstack, -+ cu->v.quick->lines->num_file_names, -+ sizeof (char *)); -+ -+ if (!cu->v.quick->full_names[index]) -+ cu->v.quick->full_names[index] -+ = gdb_realpath (cu->v.quick->file_names[index]); -+ -+ return cu->v.quick->full_names[index]; -+} -+ -+static struct symtab * -+dw2_find_last_source_symtab (struct objfile *objfile) -+{ -+ int index; -+ dw2_setup (objfile); -+ index = dwarf2_per_objfile->n_comp_units - 1; -+ return dw2_instantiate_symtab (objfile, -+ dwarf2_per_objfile->all_comp_units[index]); -+} -+ -+static void -+dw2_forget_cached_source_info (struct objfile *objfile) -+{ -+ int i; -+ -+ dw2_setup (objfile); -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (cu->v.quick->full_names) -+ { -+ int j; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ xfree ((void *) cu->v.quick->full_names[j]); -+ } -+ } -+} -+ -+static int -+dw2_lookup_symtab (struct objfile *objfile, const char *name, -+ const char *full_path, const char *real_path, -+ struct symtab **result) -+{ -+ int i; -+ int check_basename = lbasename (name) == name; -+ struct dwarf2_per_cu_data *base_cu = NULL; -+ -+ dw2_setup (objfile); -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ int j; -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (cu->v.quick->symtab) -+ continue; -+ -+ dw2_require_line_header (objfile, cu); -+ if (!cu->v.quick->lines) -+ continue; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ { -+ const char *this_name = cu->v.quick->file_names[j]; -+ -+ if (FILENAME_CMP (name, this_name) == 0) -+ { -+ *result = dw2_instantiate_symtab (objfile, cu); -+ return 1; -+ } -+ -+ if (check_basename && ! base_cu -+ && FILENAME_CMP (lbasename (this_name), name) == 0) -+ base_cu = cu; -+ -+ if (full_path != NULL) -+ { -+ const char *this_full_name = dw2_require_full_path (objfile, -+ cu, j); -+ -+ if (this_full_name -+ && FILENAME_CMP (full_path, this_full_name) == 0) -+ { -+ *result = dw2_instantiate_symtab (objfile, cu); -+ return 1; -+ } -+ } -+ -+ if (real_path != NULL) -+ { -+ const char *this_full_name = dw2_require_full_path (objfile, -+ cu, j); -+ -+ if (this_full_name != NULL) -+ { -+ char *rp = gdb_realpath (this_full_name); -+ if (rp != NULL && FILENAME_CMP (real_path, rp) == 0) -+ { -+ xfree (rp); -+ *result = dw2_instantiate_symtab (objfile, cu); -+ return 1; -+ } -+ xfree (rp); -+ } -+ } -+ } -+ } -+ -+ if (base_cu) -+ { -+ *result = dw2_instantiate_symtab (objfile, base_cu); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static struct symtab * -+dw2_lookup_symbol (struct objfile *objfile, int block_index, -+ const char *name, domain_enum domain) -+{ -+ /* We do all the work in the pre_expand_symtabs_matching hook -+ instead. */ -+ return NULL; -+} -+ -+/* A helper function that expands all symtabs that hold an object -+ named NAME. */ -+static void -+dw2_do_expand_symtabs_matching (struct objfile *objfile, const char *name) -+{ -+ dw2_setup (objfile); -+ -+ if (dwarf2_per_objfile->index_table) -+ { -+ offset_type *vec; -+ -+ if (find_slot_in_mapped_hash (dwarf2_per_objfile->index_table, -+ name, &vec)) -+ { -+ offset_type i, len = MAYBE_SWAP (*vec); -+ for (i = 0; i < len; ++i) -+ { -+ offset_type cu_index = MAYBE_SWAP (vec[i + 1]); -+ struct dwarf2_per_cu_data *cu; -+ cu = dwarf2_per_objfile->all_comp_units[cu_index]; -+ dw2_instantiate_symtab (objfile, cu); -+ } -+ } -+ } -+} -+ -+static void -+dw2_pre_expand_symtabs_matching (struct objfile *objfile, -+ int kind, const char *name, -+ domain_enum domain) -+{ -+ dw2_do_expand_symtabs_matching (objfile, name); -+} -+ -+static void -+dw2_print_stats (struct objfile *objfile) -+{ -+ int i, count; -+ -+ dw2_setup (objfile); -+ count = 0; -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (!cu->v.quick->symtab) -+ ++count; -+ } -+ printf_filtered (_(" Number of unread CUs: %d\n"), count); -+} -+ -+static void -+dw2_dump (struct objfile *objfile) -+{ -+ /* Nothing worth printing. */ -+} -+ -+static void -+dw2_relocate (struct objfile *objfile, struct section_offsets *new_offsets, -+ struct section_offsets *delta) -+{ -+ /* There's nothing to relocate here. */ -+} -+ -+static void -+dw2_expand_symtabs_for_function (struct objfile *objfile, -+ const char *func_name) -+{ -+ dw2_do_expand_symtabs_matching (objfile, func_name); -+} -+ -+static void -+dw2_expand_all_symtabs (struct objfile *objfile) -+{ -+ int i; -+ -+ dw2_setup (objfile); -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ dw2_instantiate_symtab (objfile, cu); -+ } -+} -+ -+static void -+dw2_expand_symtabs_with_filename (struct objfile *objfile, -+ const char *filename) -+{ -+ int i; -+ -+ dw2_setup (objfile); -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ int j; -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (cu->v.quick->symtab) -+ continue; -+ -+ dw2_require_line_header (objfile, cu); -+ if (!cu->v.quick->lines) -+ continue; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ { -+ const char *this_name = cu->v.quick->file_names[j]; -+ if (strcmp (this_name, filename) == 0) -+ { -+ dw2_instantiate_symtab (objfile, cu); -+ break; -+ } -+ } -+ } -+} -+ -+static const char * -+dw2_find_symbol_file (struct objfile *objfile, const char *name) -+{ -+ struct dwarf2_per_cu_data *cu; -+ offset_type *vec; -+ -+ dw2_setup (objfile); -+ -+ if (!dwarf2_per_objfile->index_table) -+ return NULL; -+ -+ if (!find_slot_in_mapped_hash (dwarf2_per_objfile->index_table, -+ name, &vec)) -+ return NULL; -+ -+ /* Note that this just looks at the very first one named NAME -- but -+ actually we are looking for a function. find_main_filename -+ should be rewritten so that it doesn't require a custom hook. It -+ could just use the ordinary symbol tables. */ -+ /* vec[0] is the length, which must always be >0. */ -+ cu = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[1])]; -+ -+ dw2_require_line_header (objfile, cu); -+ if (!cu->v.quick->lines) -+ return NULL; -+ -+ return cu->v.quick->file_names[cu->v.quick->lines->num_file_names - 1]; -+} -+ -+static void -+dw2_map_ada_symtabs (struct objfile *objfile, -+ int (*wild_match) (const char *, int, const char *), -+ int (*is_name_suffix) (const char *), -+ void (*callback) (struct objfile *, -+ struct symtab *, void *), -+ const char *name, int global, -+ domain_enum namespace, int wild, -+ void *data) -+{ -+ /* For now, we don't support Ada, so this function can't be -+ reached. */ -+ internal_error (__FILE__, __LINE__, -+ _("map_ada_symtabs called via index method")); -+} -+ -+static void -+dw2_expand_symtabs_matching (struct objfile *objfile, -+ int (*file_matcher) (const char *, void *), -+ int (*name_matcher) (const char *, void *), -+ domain_enum kind, -+ void *data) -+{ -+ int i; -+ offset_type iter; -+ -+ dw2_setup (objfile); -+ if (!dwarf2_per_objfile->index_table) -+ return; -+ -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ int j; -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ cu->v.quick->mark = 0; -+ if (cu->v.quick->symtab) -+ continue; -+ -+ dw2_require_line_header (objfile, cu); -+ if (!cu->v.quick->lines) -+ continue; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ { -+ if (file_matcher (cu->v.quick->file_names[j], data)) -+ { -+ cu->v.quick->mark = 1; -+ break; -+ } -+ } -+ } -+ -+ for (iter = 0; -+ iter < dwarf2_per_objfile->index_table->index_table_slots; -+ ++iter) -+ { -+ offset_type idx = 2 * iter; -+ const char *name; -+ offset_type *vec, vec_len, vec_idx; -+ -+ if (dwarf2_per_objfile->index_table->index_table[idx] == 0 -+ && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0) -+ continue; -+ -+ name = (dwarf2_per_objfile->index_table->constant_pool -+ + dwarf2_per_objfile->index_table->index_table[idx]); -+ -+ if (! (*name_matcher) (name, data)) -+ continue; -+ -+ /* The name was matched, now expand corresponding CUs that were -+ marked. */ -+ vec = (offset_type *) (dwarf2_per_objfile->index_table->constant_pool -+ + dwarf2_per_objfile->index_table->index_table[idx + 1]); -+ vec_len = MAYBE_SWAP (vec[0]); -+ for (vec_idx = 0; vec_idx < vec_len; ++vec_idx) -+ { -+ struct dwarf2_per_cu_data *cu -+ = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[vec_idx + 1])]; -+ if (cu->v.quick->mark) -+ dw2_instantiate_symtab (objfile, cu); -+ } -+ } -+} -+ -+static struct symtab * -+dw2_find_pc_sect_symtab (struct objfile *objfile, -+ struct minimal_symbol *msymbol, -+ CORE_ADDR pc, -+ struct obj_section *section, -+ int warn_if_readin) -+{ -+ struct dwarf2_per_cu_data *data; -+ -+ dw2_setup (objfile); -+ -+ if (!objfile->psymtabs_addrmap) -+ return NULL; -+ -+ data = addrmap_find (objfile->psymtabs_addrmap, pc); -+ if (!data) -+ return NULL; -+ -+ if (warn_if_readin && data->v.quick->symtab) -+ warning (_("(Internal error: pc %s in read in CU, but not in symtab.)\n"), -+ paddress (get_objfile_arch (objfile), pc)); -+ -+ return dw2_instantiate_symtab (objfile, data); -+} -+ -+static void -+dw2_map_symbol_names (struct objfile *objfile, -+ void (*fun) (const char *, void *), -+ void *data) -+{ -+ offset_type iter; -+ dw2_setup (objfile); - -- if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0) -+ if (!dwarf2_per_objfile->index_table) -+ return; -+ -+ for (iter = 0; -+ iter < dwarf2_per_objfile->index_table->index_table_slots; -+ ++iter) - { -- off_t pg_offset = sectp->filepos & ~(pagesize - 1); -- size_t map_length = info->size + sectp->filepos - pg_offset; -- caddr_t retbuf = bfd_mmap (abfd, 0, map_length, PROT_READ, -- MAP_PRIVATE, pg_offset); -+ offset_type idx = 2 * iter; -+ const char *name; -+ offset_type *vec, vec_len, vec_idx; - -- if (retbuf != MAP_FAILED) -- { -- info->was_mmapped = 1; -- info->buffer = retbuf + (sectp->filepos & (pagesize - 1)) ; --#if HAVE_POSIX_MADVISE -- posix_madvise (retbuf, map_length, POSIX_MADV_WILLNEED); --#endif -- return; -- } -+ if (dwarf2_per_objfile->index_table->index_table[idx] == 0 -+ && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0) -+ continue; -+ -+ name = (dwarf2_per_objfile->index_table->constant_pool -+ + dwarf2_per_objfile->index_table->index_table[idx]); -+ -+ (*fun) (name, data); - } --#endif -+} - -- /* If we get here, we are a normal, not-compressed section. */ -- info->buffer = buf -- = obstack_alloc (&objfile->objfile_obstack, info->size); -+static void -+dw2_map_symbol_filenames (struct objfile *objfile, -+ void (*fun) (const char *, const char *, void *), -+ void *data) -+{ -+ int i; - -- /* When debugging .o files, we may need to apply relocations; see -- http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . -- We never compress sections in .o files, so we only need to -- try this when the section is not compressed. */ -- retbuf = symfile_relocate_debug_section (objfile, sectp, buf); -- if (retbuf != NULL) -+ dw2_setup (objfile); -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) - { -- info->buffer = retbuf; -- return; -+ int j; -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (cu->v.quick->symtab) -+ continue; -+ -+ dw2_require_line_header (objfile, cu); -+ if (!cu->v.quick->lines) -+ continue; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ { -+ const char *this_full_name = dw2_require_full_path (objfile, cu, j); -+ (*fun) (cu->v.quick->file_names[j], this_full_name, data); -+ } - } -+} - -- if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 -- || bfd_bread (buf, info->size, abfd) != info->size) -- error (_("Dwarf Error: Can't read DWARF data from '%s'"), -- bfd_get_filename (abfd)); -+static int -+dw2_has_symbols (struct objfile *objfile) -+{ -+ return 1; - } - --/* Fill in SECTP, BUFP and SIZEP with section info, given OBJFILE and -- SECTION_NAME. */ -+const struct quick_symbol_functions dwarf2_gdb_index_functions = -+{ -+ dw2_has_symbols, -+ dw2_find_last_source_symtab, -+ dw2_forget_cached_source_info, -+ dw2_lookup_symtab, -+ dw2_lookup_symbol, -+ dw2_pre_expand_symtabs_matching, -+ dw2_print_stats, -+ dw2_dump, -+ dw2_relocate, -+ dw2_expand_symtabs_for_function, -+ dw2_expand_all_symtabs, -+ dw2_expand_symtabs_with_filename, -+ dw2_find_symbol_file, -+ dw2_map_ada_symtabs, -+ dw2_expand_symtabs_matching, -+ dw2_find_pc_sect_symtab, -+ dw2_map_symbol_names, -+ dw2_map_symbol_filenames -+}; - --void --dwarf2_get_section_info (struct objfile *objfile, const char *section_name, -- asection **sectp, gdb_byte **bufp, -- bfd_size_type *sizep) --{ -- struct dwarf2_per_objfile *data -- = objfile_data (objfile, dwarf2_objfile_data_key); -- struct dwarf2_section_info *info; -+/* Initialize for reading DWARF for this objfile. Return 0 if this -+ file will use psymtabs, or 1 if using the GNU index. */ - -- /* We may see an objfile without any DWARF, in which case we just -- return nothing. */ -- if (data == NULL) -+int -+dwarf2_initialize_objfile (struct objfile *objfile) -+{ -+ /* If we're about to read full symbols, don't bother with the -+ indices. In this case we also don't care if some other debug -+ format is making psymtabs, because they are all about to be -+ expanded anyway. */ -+ if ((objfile->flags & OBJF_READNOW)) - { -- *sectp = NULL; -- *bufp = NULL; -- *sizep = 0; -- return; -+ int i; -+ -+ dwarf2_per_objfile->using_index = 1; -+ create_all_comp_units (objfile); -+ -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, -+ struct dwarf2_per_cu_quick_data); -+ } -+ -+ /* Return 1 so that gdb sees the "quick" functions. However, -+ these functions will be no-ops because we will have expanded -+ all symtabs. */ -+ return 1; - } -- if (section_is_p (section_name, EH_FRAME_SECTION)) -- info = &data->eh_frame; -- else if (section_is_p (section_name, FRAME_SECTION)) -- info = &data->frame; -- else -- gdb_assert (0); - -- if (info->asection != NULL && info->size != 0 && info->buffer == NULL) -- /* We haven't read this section in yet. Do it now. */ -- dwarf2_read_section (objfile, info); -+ if (dwarf2_read_index (objfile)) -+ return 1; - -- *sectp = info->asection; -- *bufp = info->buffer; -- *sizep = info->size; -+ dwarf2_build_psymtabs (objfile); -+ return 0; - } - -+ -+ - /* Build a partial symbol table. */ - - void -@@ -1699,6 +2688,7 @@ create_debug_types_hash_table (struct objfile *objfile) - type_sig->signature = signature; - type_sig->offset = offset; - type_sig->type_offset = type_offset; -+ type_sig->per_cu.objfile = objfile; - - slot = htab_find_slot (types_htab, type_sig, INSERT); - gdb_assert (slot != NULL); -@@ -1897,7 +2887,7 @@ process_psymtab_comp_unit (struct objfile *objfile, - /* Store the function that reads in the rest of the symbol table */ - pst->read_symtab = dwarf2_psymtab_to_symtab; - -- this_cu->psymtab = pst; -+ this_cu->v.psymtab = pst; - - dwarf2_find_base_address (comp_unit_die, &cu); - -@@ -2182,6 +3172,7 @@ create_all_comp_units (struct objfile *objfile) - memset (this_cu, 0, sizeof (*this_cu)); - this_cu->offset = offset; - this_cu->length = length + initial_length_size; -+ this_cu->objfile = objfile; - - if (n_comp_units == n_allocated) - { -@@ -2613,7 +3604,7 @@ add_partial_subprogram (struct partial_die_info *pdi, - addrmap_set_empty (objfile->psymtabs_addrmap, - pdi->lowpc + baseaddr, - pdi->highpc - 1 + baseaddr, -- cu->per_cu->psymtab); -+ cu->per_cu->v.psymtab); - } - if (!pdi->is_declaration) - /* Ignore subprogram DIEs that do not have a name, they are -@@ -2885,7 +3876,6 @@ locate_pdi_sibling (struct partial_die_info *orig_pdi, - static void - dwarf2_psymtab_to_symtab (struct partial_symtab *pst) - { -- /* FIXME: This is barely more than a stub. */ - if (pst != NULL) - { - if (pst->readin) -@@ -2958,7 +3948,9 @@ process_queue (struct objfile *objfile) - may load a new CU, adding it to the end of the queue. */ - for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item) - { -- if (item->per_cu->psymtab && !item->per_cu->psymtab->readin) -+ if (dwarf2_per_objfile->using_index -+ ? !item->per_cu->v.quick->symtab -+ : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin)) - process_full_comp_unit (item->per_cu); - - item->per_cu->queued = 0; -@@ -3035,22 +4027,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst) - return; - } - -- back_to = make_cleanup (dwarf2_release_queue, NULL); -- -- queue_comp_unit (per_cu, pst->objfile); -- -- if (per_cu->from_debug_types) -- read_signatured_type_at_offset (pst->objfile, per_cu->offset); -- else -- load_full_comp_unit (per_cu, pst->objfile); -- -- process_queue (pst->objfile); -- -- /* Age the cache, releasing compilation units that have not -- been used recently. */ -- age_cached_comp_units (); -- -- do_cleanups (back_to); -+ dw2_do_instantiate_symtab (pst->objfile, per_cu); - } - - /* Load the DIEs associated with PER_CU into memory. */ -@@ -3130,9 +4107,8 @@ load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile) - static void - process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) - { -- struct partial_symtab *pst = per_cu->psymtab; - struct dwarf2_cu *cu = per_cu->cu; -- struct objfile *objfile = pst->objfile; -+ struct objfile *objfile = per_cu->objfile; - CORE_ADDR lowpc, highpc; - struct symtab *symtab; - struct cleanup *back_to; -@@ -3165,8 +4141,15 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu) - { - symtab->language = cu->language; - } -- pst->symtab = symtab; -- pst->readin = 1; -+ -+ if (dwarf2_per_objfile->using_index) -+ per_cu->v.quick->symtab = symtab; -+ else -+ { -+ struct partial_symtab *pst = per_cu->v.psymtab; -+ pst->symtab = symtab; -+ pst->readin = 1; -+ } - - do_cleanups (back_to); - } -@@ -3557,6 +4540,46 @@ free_cu_line_header (void *arg) - } - - static void -+find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu, -+ char **name, char **comp_dir) -+{ -+ struct attribute *attr; -+ -+ *name = NULL; -+ *comp_dir = NULL; -+ -+ /* Find the filename. Do not use dwarf2_name here, since the filename -+ is not a source language identifier. */ -+ attr = dwarf2_attr (die, DW_AT_name, cu); -+ if (attr) -+ { -+ *name = DW_STRING (attr); -+ } -+ -+ attr = dwarf2_attr (die, DW_AT_comp_dir, cu); -+ if (attr) -+ *comp_dir = DW_STRING (attr); -+ else if (*name != NULL && IS_ABSOLUTE_PATH (*name)) -+ { -+ *comp_dir = ldirname (*name); -+ if (*comp_dir != NULL) -+ make_cleanup (xfree, *comp_dir); -+ } -+ if (*comp_dir != NULL) -+ { -+ /* Irix 6.2 native cc prepends .: to the compilation -+ directory, get rid of it. */ -+ char *cp = strchr (*comp_dir, ':'); -+ -+ if (cp && cp != *comp_dir && cp[-1] == '.' && cp[1] == '/') -+ *comp_dir = cp + 1; -+ } -+ -+ if (*name == NULL) -+ *name = ""; -+} -+ -+static void - read_file_scope (struct die_info *die, struct dwarf2_cu *cu) - { - struct objfile *objfile = cu->objfile; -@@ -3582,35 +4605,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) - lowpc += baseaddr; - highpc += baseaddr; - -- /* Find the filename. Do not use dwarf2_name here, since the filename -- is not a source language identifier. */ -- attr = dwarf2_attr (die, DW_AT_name, cu); -- if (attr) -- { -- name = DW_STRING (attr); -- } -- -- attr = dwarf2_attr (die, DW_AT_comp_dir, cu); -- if (attr) -- comp_dir = DW_STRING (attr); -- else if (name != NULL && IS_ABSOLUTE_PATH (name)) -- { -- comp_dir = ldirname (name); -- if (comp_dir != NULL) -- make_cleanup (xfree, comp_dir); -- } -- if (comp_dir != NULL) -- { -- /* Irix 6.2 native cc prepends .: to the compilation -- directory, get rid of it. */ -- char *cp = strchr (comp_dir, ':'); -- -- if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/') -- comp_dir = cp + 1; -- } -- -- if (name == NULL) -- name = ""; -+ find_file_and_directory (die, cu, &name, &comp_dir); - - attr = dwarf2_attr (die, DW_AT_language, cu); - if (attr) -@@ -5529,6 +6524,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) + static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, +@@ -7112,6 +7121,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -3677,7 +1483,7 @@ index 1e75235..d54e266 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. */ -@@ -5542,7 +6560,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -7125,7 +7157,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; @@ -3686,7 +1492,7 @@ index 1e75235..d54e266 100644 struct cleanup *back_to; char *name; -@@ -5595,17 +6613,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -7178,17 +7210,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) @@ -3709,7 +1515,7 @@ index 1e75235..d54e266 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -6059,29 +7071,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -7681,29 +7707,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -3838,7 +1644,7 @@ index 1e75235..d54e266 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -6324,60 +7421,136 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -7985,8 +8096,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -3848,12 +1654,7 @@ index 1e75235..d54e266 100644 char *name; LONGEST negative_mask; - base_type = die_type (die, cu); -+ /* Preserve BASE_TYPE's original type, just set its LENGTH. */ -+ check_typedef (base_type); - - /* The die_type call above may have already set the type for this DIE. */ - range_type = get_die_type (die, cu); +@@ -7999,48 +8109,125 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) if (range_type) return range_type; @@ -4000,7 +1801,9 @@ index 1e75235..d54e266 100644 { - int count = dwarf2_get_attr_constant_value (attr, 1); - high = low + count - 1; -+ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; ++ /* Ada expects an empty array on no boundary attributes. */ ++ if (cu->language != language_ada) ++ TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + high = low - 1; } + if (!TYPE_UNSIGNED (base_type) && (high & negative_mask)) @@ -4009,7 +1812,7 @@ index 1e75235..d54e266 100644 } /* Dwarf-2 specifications explicitly allows to create subrange types -@@ -6419,20 +7592,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -8082,20 +8269,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) } } @@ -4063,7 +1866,7 @@ index 1e75235..d54e266 100644 name = dwarf2_name (die, cu); if (name) -@@ -8712,10 +9906,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, +@@ -10559,10 +10767,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 @@ -4078,16 +1881,16 @@ index 1e75235..d54e266 100644 } /* Given a pointer to a DWARF information entry, figure out if we need -@@ -8746,6 +9942,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - sizeof (struct symbol)); +@@ -10600,6 +10810,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, + else + sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); OBJSTAT (objfile, n_syms++); - memset (sym, 0, sizeof (struct symbol)); + /* Some methods are called w/o checking SYMBOL_COMPUTED_OPS validity. */ + SYMBOL_COMPUTED_OPS (sym) = &dwarf2_missing_funcs; /* Cache this symbol's name and the name's demangled form (if any). */ - SYMBOL_LANGUAGE (sym) = cu->language; -@@ -9375,6 +10573,9 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu) + SYMBOL_SET_LANGUAGE (sym, cu->language); +@@ -11367,6 +11579,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -4097,7 +1900,7 @@ index 1e75235..d54e266 100644 return this_type; } -@@ -11979,67 +13180,102 @@ attr_form_is_constant (struct attribute *attr) +@@ -14119,67 +14334,102 @@ attr_form_is_constant (struct attribute *attr) } } @@ -4160,7 +1963,7 @@ index 1e75235..d54e266 100644 + variable has been optimized out. */ + if (!attr) + return NULL; -+ + + dwarf2_read_section (dwarf2_per_objfile->objfile, + &dwarf2_per_objfile->loc); + @@ -4195,7 +1998,7 @@ index 1e75235..d54e266 100644 + struct dwarf2_cu *cu) +{ + struct dwarf2_loclist_baton *loclist_baton; - ++ + loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu); + if (loclist_baton) + { @@ -4249,74 +2052,7 @@ index 1e75235..d54e266 100644 } } -@@ -12050,7 +13286,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, - struct objfile * - dwarf2_per_cu_objfile (struct dwarf2_per_cu_data *per_cu) - { -- struct objfile *objfile = per_cu->psymtab->objfile; -+ struct objfile *objfile = per_cu->objfile; - - /* Return the master objfile, so that we can report and look up the - correct file containing this variable. */ -@@ -12070,7 +13306,7 @@ dwarf2_per_cu_addr_size (struct dwarf2_per_cu_data *per_cu) - else - { - /* If the CU is not currently read in, we re-read its header. */ -- struct objfile *objfile = per_cu->psymtab->objfile; -+ struct objfile *objfile = per_cu->objfile; - struct dwarf2_per_objfile *per_objfile - = objfile_data (objfile, dwarf2_objfile_data_key); - gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset; -@@ -12092,7 +13328,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu) - else - { - /* If the CU is not currently read in, we re-read its header. */ -- struct objfile *objfile = per_cu->psymtab->objfile; -+ struct objfile *objfile = per_cu->objfile; - struct dwarf2_per_objfile *per_objfile - = objfile_data (objfile, dwarf2_objfile_data_key); - gdb_byte *info_ptr = per_objfile->info.buffer + per_cu->offset; -@@ -12112,7 +13348,7 @@ dwarf2_per_cu_offset_size (struct dwarf2_per_cu_data *per_cu) - CORE_ADDR - dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu) - { -- struct objfile *objfile = per_cu->psymtab->objfile; -+ struct objfile *objfile = per_cu->objfile; - - return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - } -@@ -12334,6 +13570,30 @@ dwarf2_free_objfile (struct objfile *objfile) - /* Cached DIE trees use xmalloc and the comp_unit_obstack. */ - free_cached_comp_units (NULL); - -+ if (dwarf2_per_objfile->using_index) -+ { -+ int i; -+ -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ int j; -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ -+ if (!cu->v.quick->lines) -+ continue; -+ -+ for (j = 0; j < cu->v.quick->lines->num_file_names; ++j) -+ { -+ if (cu->v.quick->file_names) -+ xfree ((void *) cu->v.quick->file_names[j]); -+ if (cu->v.quick->full_names) -+ xfree ((void *) cu->v.quick->full_names[j]); -+ } -+ -+ free_line_header (cu->v.quick->lines); -+ } -+ } -+ - /* Everything else should be on the objfile obstack. */ - } - -@@ -12368,6 +13628,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -14533,6 +14783,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs) return ofs_lhs->offset == ofs_rhs->offset; } @@ -4348,607 +2084,20 @@ index 1e75235..d54e266 100644 /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. -@@ -12391,6 +13676,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - { - struct dwarf2_offset_and_type **slot, ofs; +@@ -14558,6 +14833,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) + struct objfile *objfile = cu->objfile; + htab_t *type_hash_ptr; + fetch_die_type_attrs (die, type, cu); + /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where we should not be doing so, because the type-specific area is -@@ -12591,8 +13878,567 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d) - munmap_section_buffer (&data->types); - munmap_section_buffer (&data->frame); - munmap_section_buffer (&data->eh_frame); -+ munmap_section_buffer (&data->gdb_index); -+} -+ -+ -+ -+/* The contents of the hash table we create when building the string -+ table. */ -+struct strtab_entry -+{ -+ offset_type offset; -+ const char *str; -+}; -+ -+/* Hash function for a strtab_entry. */ -+static hashval_t -+hash_strtab_entry (const void *e) -+{ -+ const struct strtab_entry *entry = e; -+ return mapped_index_string_hash (entry->str); -+} -+ -+/* Equality function for a strtab_entry. */ -+static int -+eq_strtab_entry (const void *a, const void *b) -+{ -+ const struct strtab_entry *ea = a; -+ const struct strtab_entry *eb = b; -+ return !strcmp (ea->str, eb->str); -+} -+ -+/* Create a strtab_entry hash table. */ -+static htab_t -+create_strtab (void) -+{ -+ return htab_create_alloc (100, hash_strtab_entry, eq_strtab_entry, -+ xfree, xcalloc, xfree); -+} -+ -+/* Add a string to the constant pool. Return the string's offset in -+ host order. */ -+static offset_type -+add_string (htab_t table, struct obstack *cpool, const char *str) -+{ -+ void **slot; -+ struct strtab_entry entry; -+ struct strtab_entry *result; -+ -+ entry.str = str; -+ slot = htab_find_slot (table, &entry, INSERT); -+ if (*slot) -+ result = *slot; -+ else -+ { -+ result = XNEW (struct strtab_entry); -+ result->offset = obstack_object_size (cpool); -+ result->str = str; -+ obstack_grow_str0 (cpool, str); -+ *slot = result; -+ } -+ return result->offset; -+} -+ -+/* An entry in the symbol table. */ -+struct symtab_index_entry -+{ -+ /* The name of the symbol. */ -+ const char *name; -+ /* The offset of the name in the constant pool. */ -+ offset_type index_offset; -+ /* A sorted vector of the indices of all the CUs that hold an object -+ of this name. */ -+ VEC (offset_type) *cu_indices; -+}; -+ -+/* The symbol table. This is a power-of-2-sized hash table. */ -+struct mapped_symtab -+{ -+ offset_type n_elements; -+ offset_type size; -+ struct symtab_index_entry **data; -+}; -+ -+/* Hash function for a symtab_index_entry. */ -+static hashval_t -+hash_symtab_entry (const void *e) -+{ -+ const struct symtab_index_entry *entry = e; -+ return iterative_hash (VEC_address (offset_type, entry->cu_indices), -+ sizeof (offset_type) * VEC_length (offset_type, -+ entry->cu_indices), -+ 0); -+} -+ -+/* Equality function for a symtab_index_entry. */ -+static int -+eq_symtab_entry (const void *a, const void *b) -+{ -+ const struct symtab_index_entry *ea = a; -+ const struct symtab_index_entry *eb = b; -+ int len = VEC_length (offset_type, ea->cu_indices); -+ if (len != VEC_length (offset_type, eb->cu_indices)) -+ return 0; -+ return !memcmp (VEC_address (offset_type, ea->cu_indices), -+ VEC_address (offset_type, eb->cu_indices), -+ sizeof (offset_type) * len); -+} -+ -+/* Destroy a symtab_index_entry. */ -+static void -+delete_symtab_entry (void *p) -+{ -+ struct symtab_index_entry *entry = p; -+ VEC_free (offset_type, entry->cu_indices); -+ xfree (entry); -+} -+ -+/* Create a hash table holding symtab_index_entry objects. */ -+static htab_t -+create_index_table (void) -+{ -+ return htab_create_alloc (100, hash_symtab_entry, eq_symtab_entry, -+ delete_symtab_entry, xcalloc, xfree); -+} -+ -+/* Create a new mapped symtab object. */ -+static struct mapped_symtab * -+create_mapped_symtab (void) -+{ -+ struct mapped_symtab *symtab = XNEW (struct mapped_symtab); -+ symtab->n_elements = 0; -+ symtab->size = 1024; -+ symtab->data = XCNEWVEC (struct symtab_index_entry *, symtab->size); -+ return symtab; -+} -+ -+/* Destroy a mapped_symtab. */ -+static void -+cleanup_mapped_symtab (void *p) -+{ -+ struct mapped_symtab *symtab = p; -+ /* The contents of the array are freed when the other hash table is -+ destroyed. */ -+ xfree (symtab->data); -+ xfree (symtab); -+} -+ -+/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to -+ the slot. */ -+static struct symtab_index_entry ** -+find_slot (struct mapped_symtab *symtab, const char *name) -+{ -+ offset_type index, step, hash = mapped_index_string_hash (name); -+ -+ index = hash & (symtab->size - 1); -+ step = ((hash * 17) & (symtab->size - 1)) | 1; -+ -+ for (;;) -+ { -+ if (!symtab->data[index] || !strcmp (name, symtab->data[index]->name)) -+ return &symtab->data[index]; -+ index = (index + step) & (symtab->size - 1); -+ } - } - -+/* Expand SYMTAB's hash table. */ -+static void -+hash_expand (struct mapped_symtab *symtab) -+{ -+ offset_type old_size = symtab->size; -+ offset_type i; -+ struct symtab_index_entry **old_entries = symtab->data; -+ -+ symtab->size *= 2; -+ symtab->data = XCNEWVEC (struct symtab_index_entry *, symtab->size); -+ -+ for (i = 0; i < old_size; ++i) -+ { -+ if (old_entries[i]) -+ { -+ struct symtab_index_entry **slot = find_slot (symtab, -+ old_entries[i]->name); -+ *slot = old_entries[i]; -+ } -+ } -+ -+ xfree (old_entries); -+} -+ -+/* Add an entry to SYMTAB. NAME is the name of the symbol. CU_INDEX -+ is the index of the CU in which the symbol appears. */ -+static void -+add_index_entry (struct mapped_symtab *symtab, const char *name, -+ offset_type cu_index) -+{ -+ struct symtab_index_entry **slot; -+ -+ ++symtab->n_elements; -+ if (4 * symtab->n_elements / 3 >= symtab->size) -+ hash_expand (symtab); -+ -+ slot = find_slot (symtab, name); -+ if (!*slot) -+ { -+ *slot = XNEW (struct symtab_index_entry); -+ (*slot)->name = name; -+ (*slot)->cu_indices = NULL; -+ } -+ /* Don't push an index twice. Due to how we add entries we only -+ have to check the last one. */ -+ if (VEC_empty (offset_type, (*slot)->cu_indices) -+ || VEC_length (offset_type, (*slot)->cu_indices) != cu_index) -+ VEC_safe_push (offset_type, (*slot)->cu_indices, cu_index); -+} -+ -+/* Add a vector of indices to the constant pool. */ -+static offset_type -+add_indices_to_cpool (htab_t index_table, struct obstack *cpool, -+ struct symtab_index_entry *entry) -+{ -+ void **slot; -+ -+ slot = htab_find_slot (index_table, entry, INSERT); -+ if (!*slot) -+ { -+ offset_type len = VEC_length (offset_type, entry->cu_indices); -+ offset_type val = MAYBE_SWAP (len); -+ offset_type iter; -+ int i; -+ -+ *slot = entry; -+ entry->index_offset = obstack_object_size (cpool); -+ -+ obstack_grow (cpool, &val, sizeof (val)); -+ for (i = 0; -+ VEC_iterate (offset_type, entry->cu_indices, i, iter); -+ ++i) -+ { -+ val = MAYBE_SWAP (iter); -+ obstack_grow (cpool, &val, sizeof (val)); -+ } -+ } -+ else -+ { -+ struct symtab_index_entry *old_entry = *slot; -+ entry->index_offset = old_entry->index_offset; -+ entry = old_entry; -+ } -+ return entry->index_offset; -+} -+ -+/* Write the mapped hash table SYMTAB to the obstack OUTPUT, with -+ constant pool entries going into the obstack CPOOL. */ -+static void -+write_hash_table (struct mapped_symtab *symtab, -+ struct obstack *output, struct obstack *cpool) -+{ -+ offset_type i; -+ htab_t index_table; -+ htab_t str_table; -+ -+ index_table = create_index_table (); -+ str_table = create_strtab (); -+ /* We add all the index vectors to the constant pool first, to -+ ensure alignment is ok. */ -+ for (i = 0; i < symtab->size; ++i) -+ { -+ if (symtab->data[i]) -+ add_indices_to_cpool (index_table, cpool, symtab->data[i]); -+ } -+ -+ /* Now write out the hash table. */ -+ for (i = 0; i < symtab->size; ++i) -+ { -+ offset_type str_off, vec_off; -+ -+ if (symtab->data[i]) -+ { -+ str_off = add_string (str_table, cpool, symtab->data[i]->name); -+ vec_off = symtab->data[i]->index_offset; -+ } -+ else -+ { -+ /* While 0 is a valid constant pool index, it is not valid -+ to have 0 for both offsets. */ -+ str_off = 0; -+ vec_off = 0; -+ } -+ -+ str_off = MAYBE_SWAP (str_off); -+ vec_off = MAYBE_SWAP (vec_off); -+ -+ obstack_grow (output, &str_off, sizeof (str_off)); -+ obstack_grow (output, &vec_off, sizeof (vec_off)); -+ } -+ -+ htab_delete (str_table); -+ htab_delete (index_table); -+} -+ -+/* Write an address entry to ADDR_OBSTACK. The addresses are taken -+ from PST; CU_INDEX is the index of the CU in the vector of all -+ CUs. */ -+static void -+add_address_entry (struct objfile *objfile, -+ struct obstack *addr_obstack, struct partial_symtab *pst, -+ unsigned int cu_index) -+{ -+ offset_type offset; -+ char addr[8]; -+ CORE_ADDR baseaddr; -+ -+ baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -+ -+ store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->textlow - baseaddr); -+ obstack_grow (addr_obstack, addr, 8); -+ store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->texthigh - baseaddr); -+ obstack_grow (addr_obstack, addr, 8); -+ offset = MAYBE_SWAP (cu_index); -+ obstack_grow (addr_obstack, &offset, sizeof (offset_type)); -+} -+ -+/* Add a list of partial symbols to SYMTAB. */ -+static void -+write_psymbols (struct mapped_symtab *symtab, -+ struct partial_symbol **psymp, -+ int count, -+ offset_type cu_index) -+{ -+ for (; count-- > 0; ++psymp) -+ { -+ if (SYMBOL_LANGUAGE (*psymp) == language_ada) -+ error (_("Ada is not currently supported by the index")); -+ add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index); -+ } -+} -+ -+/* Write the contents of an ("unfinished") obstack to FILE. Throw an -+ exception if there is an error. */ -+static void -+write_obstack (FILE *file, struct obstack *obstack) -+{ -+ if (fwrite (obstack_base (obstack), 1, obstack_object_size (obstack), -+ file) -+ != obstack_object_size (obstack)) -+ error (_("couldn't data write to file")); -+} -+ -+/* Unlink a file if the argument is not NULL. */ -+static void -+unlink_if_set (void *p) -+{ -+ char **filename = p; -+ if (*filename) -+ unlink (*filename); -+} -+ -+/* Create an index file for OBJFILE in the directory DIR. */ -+static void -+write_psymtabs_to_index (struct objfile *objfile, const char *dir) -+{ -+ struct cleanup *cleanup; -+ char *filename, *cleanup_filename; -+ struct obstack contents, addr_obstack, constant_pool, symtab_obstack, cu_list; -+ int i; -+ FILE *out_file; -+ struct mapped_symtab *symtab; -+ offset_type val, size_of_contents, total_len; -+ struct stat st; -+ char buf[8]; -+ -+ if (!objfile->psymtabs) -+ return; -+ if (dwarf2_per_objfile->using_index) -+ error (_("Cannot use an index to create the index")); -+ -+ if (stat (objfile->name, &st) < 0) -+ perror_with_name (_("Could not stat")); -+ -+ filename = concat (dir, SLASH_STRING, lbasename (objfile->name), -+ INDEX_SUFFIX, (char *) NULL); -+ cleanup = make_cleanup (xfree, filename); -+ -+ out_file = fopen (filename, "wb"); -+ if (!out_file) -+ error (_("Can't open `%s' for writing"), filename); -+ -+ cleanup_filename = filename; -+ make_cleanup (unlink_if_set, &cleanup_filename); -+ -+ symtab = create_mapped_symtab (); -+ make_cleanup (cleanup_mapped_symtab, symtab); -+ -+ obstack_init (&addr_obstack); -+ make_cleanup_obstack_free (&addr_obstack); -+ -+ obstack_init (&cu_list); -+ make_cleanup_obstack_free (&cu_list); -+ -+ for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ { -+ struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct partial_symtab *psymtab = cu->v.psymtab; -+ gdb_byte val[8]; -+ -+ write_psymbols (symtab, -+ objfile->global_psymbols.list + psymtab->globals_offset, -+ psymtab->n_global_syms, i); -+ write_psymbols (symtab, -+ objfile->static_psymbols.list + psymtab->statics_offset, -+ psymtab->n_static_syms, i); -+ -+ add_address_entry (objfile, &addr_obstack, psymtab, i); -+ -+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, cu->offset); -+ obstack_grow (&cu_list, val, 8); -+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, cu->length); -+ obstack_grow (&cu_list, val, 8); -+ } -+ -+ obstack_init (&constant_pool); -+ make_cleanup_obstack_free (&constant_pool); -+ obstack_init (&symtab_obstack); -+ make_cleanup_obstack_free (&symtab_obstack); -+ write_hash_table (symtab, &symtab_obstack, &constant_pool); -+ -+ obstack_init (&contents); -+ make_cleanup_obstack_free (&contents); -+ size_of_contents = 5 * sizeof (offset_type); -+ total_len = size_of_contents; -+ -+ /* The version number. */ -+ val = MAYBE_SWAP (1); -+ obstack_grow (&contents, &val, sizeof (val)); -+ -+ /* The offset of the CU list from the start of the file. */ -+ val = MAYBE_SWAP (total_len); -+ obstack_grow (&contents, &val, sizeof (val)); -+ total_len += obstack_object_size (&cu_list); -+ -+ /* The offset of the address table from the start of the file. */ -+ val = MAYBE_SWAP (total_len); -+ obstack_grow (&contents, &val, sizeof (val)); -+ total_len += obstack_object_size (&addr_obstack); -+ -+ /* The offset of the symbol table from the start of the file. */ -+ val = MAYBE_SWAP (total_len); -+ obstack_grow (&contents, &val, sizeof (val)); -+ total_len += obstack_object_size (&symtab_obstack); -+ -+ /* The offset of the constant pool from the start of the file. */ -+ val = MAYBE_SWAP (total_len); -+ obstack_grow (&contents, &val, sizeof (val)); -+ total_len += obstack_object_size (&constant_pool); -+ -+ gdb_assert (obstack_object_size (&contents) == size_of_contents); -+ -+ write_obstack (out_file, &contents); -+ write_obstack (out_file, &cu_list); -+ write_obstack (out_file, &addr_obstack); -+ write_obstack (out_file, &symtab_obstack); -+ write_obstack (out_file, &constant_pool); -+ -+ fclose (out_file); -+ -+ /* We want to keep the file, so we set cleanup_filename to NULL -+ here. See unlink_if_set. */ -+ cleanup_filename = NULL; -+ -+ do_cleanups (cleanup); -+} -+ -+/* The mapped index file format is designed to be directly mmap()able -+ on any architecture. In most cases, a datum is represented using a -+ little-endian 32-bit integer value, called an offset_type. Big -+ endian machines must byte-swap the values before using them. -+ Exceptions to this rule are noted. The data is laid out such that -+ alignment is always respected. -+ -+ A mapped index consists of several sections. -+ -+ 1. The file header. This is a sequence of values, of offset_type -+ unless otherwise noted: -+ [0] The version number. Currently 1. -+ [1] The offset, from the start of the file, of the CU list. -+ [2] The offset, from the start of the file, of the address section. -+ [3] The offset, from the start of the file, of the symbol table. -+ [4] The offset, from the start of the file, of the constant pool. -+ -+ 2. The CU list. This is a sequence of pairs of 64-bit -+ little-endian values. The first element in each pair is the offset -+ of a CU in the .debug_info section. The second element in each -+ pair is the length of that CU. References to a CU elsewhere in the -+ map are done using a CU index, which is just the 0-based index into -+ this table. -+ -+ 3. The address section. The address section consists of a sequence -+ of address entries. Each address entry has three elements. -+ [0] The low address. This is a 64-bit little-endian value. -+ [1] The high address. This is a 64-bit little-endian value. -+ [2] The CU index. This is an offset_type value. -+ -+ 4. The symbol table. This is a hash table. The size of the hash -+ table is always a power of 2. The initial hash and the step are -+ currently defined by the `find_slot' function. -+ -+ Each slot in the hash table consists of a pair of offset_type -+ values. The first value is the offset of the symbol's name in the -+ constant pool. The second value is the offset of the CU vector in -+ the constant pool. -+ -+ If both values are 0, then this slot in the hash table is empty. -+ This is ok because while 0 is a valid constant pool index, it -+ cannot be a valid index for both a string and a CU vector. -+ -+ A string in the constant pool is stored as a \0-terminated string, -+ as you'd expect. -+ -+ A CU vector in the constant pool is a sequence of offset_type -+ values. The first value is the number of CU indices in the vector. -+ Each subsequent value is the index of a CU in the CU list. This -+ element in the hash table is used to indicate which CUs define the -+ symbol. -+ -+ 5. The constant pool. This is simply a bunch of bytes. It is -+ organized so that alignment is correct: CU vectors are stored -+ first, followed by strings. */ -+static void -+save_gdb_index_command (char *arg, int from_tty) -+{ -+ struct objfile *objfile; -+ -+ if (!arg || !*arg) -+ error (_("usage: save gdb-index DIRECTORY")); -+ -+ ALL_OBJFILES (objfile) -+ { -+ struct stat st; -+ -+ /* If the objfile does not correspond to an actual file, skip it. */ -+ if (stat (objfile->name, &st) < 0) -+ continue; -+ -+ dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key); -+ if (dwarf2_per_objfile) -+ { -+ volatile struct gdb_exception except; -+ -+ TRY_CATCH (except, RETURN_MASK_ERROR) -+ { -+ write_psymtabs_to_index (objfile, arg); -+ } -+ if (except.reason < 0) -+ exception_fprintf (gdb_stderr, except, -+ _("Error while writing index for `%s': "), -+ objfile->name); -+ } -+ } -+} -+ -+ -+ - int dwarf2_always_disassemble; - - static void -@@ -12609,6 +14455,8 @@ void _initialize_dwarf2_read (void); - void - _initialize_dwarf2_read (void) - { -+ struct cmd_list_element *c; -+ - dwarf2_objfile_data_key - = register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free); - -@@ -12656,4 +14504,9 @@ The value is the maximum depth to print."), - NULL, - NULL, - &setdebuglist, &showdebuglist); -+ -+ c = add_cmd ("gdb-index", class_files, save_gdb_index_command, -+ _("Save a .gdb-index file"), -+ &save_cmdlist); -+ set_cmd_completer (c, filename_completer); - } diff --git a/gdb/elfread.c b/gdb/elfread.c -index 8c00938..a250c58 100644 +index 270f93f..a589c23 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -37,9 +37,13 @@ +@@ -37,6 +37,7 @@ #include "complaints.h" #include "demangle.h" #include "psympriv.h" @@ -4956,13 +2105,7 @@ index 8c00938..a250c58 100644 extern void _initialize_elfread (void); -+/* Forward declaration. */ -+static struct sym_fns elf_sym_fns_gdb_index; -+ - /* The struct elfinfo is available only during ELF symbol table and - psymtab reading. It is destroyed at the completion of psymtab-reading. - It's local to elf_symfile_read. */ -@@ -180,7 +184,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name, +@@ -183,7 +184,8 @@ record_minimal_symbol (const char *name, int name_len, int copy_name, { struct gdbarch *gdbarch = get_objfile_arch (objfile); @@ -4972,7 +2115,7 @@ index 8c00938..a250c58 100644 address = gdbarch_smash_text_address (gdbarch, address); return prim_record_minimal_symbol_full (name, name_len, copy_name, address, -@@ -388,7 +393,10 @@ elf_symtab_read (struct objfile *objfile, int type, +@@ -391,7 +393,10 @@ elf_symtab_read (struct objfile *objfile, int type, { if (sym->flags & (BSF_GLOBAL | BSF_WEAK)) { @@ -4984,7 +2127,7 @@ index 8c00938..a250c58 100644 } else if ((sym->name[0] == '.' && sym->name[1] == 'L') || ((sym->flags & BSF_LOCAL) -@@ -569,6 +577,250 @@ elf_symtab_read (struct objfile *objfile, int type, +@@ -572,6 +577,250 @@ elf_symtab_read (struct objfile *objfile, int type, } } @@ -5235,7 +2378,7 @@ index 8c00938..a250c58 100644 struct build_id { size_t size; -@@ -797,6 +1049,8 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) +@@ -800,6 +1049,8 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) bfd_errmsg (bfd_get_error ())); elf_symtab_read (objfile, ST_DYNAMIC, dynsymcount, dyn_symbol_table, 0); @@ -5244,48 +2387,8 @@ index 8c00938..a250c58 100644 } /* Add synthetic symbols - for instance, names for any PLT entries. */ -@@ -869,11 +1123,9 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) - str_sect->filepos, - bfd_section_size (abfd, str_sect)); - } -- if (dwarf2_has_info (objfile)) -- { -- /* DWARF 2 sections */ -- dwarf2_build_psymtabs (objfile); -- } -+ -+ if (dwarf2_has_info (objfile) && dwarf2_initialize_objfile (objfile)) -+ objfile->sf = &elf_sym_fns_gdb_index; - - /* 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. -@@ -1049,6 +1301,24 @@ static struct sym_fns elf_sym_fns = - NULL /* next: pointer to next struct sym_fns */ - }; - -+/* The same as elf_sym_fns, but not registered and uses the -+ DWARF-specific GNU index rather than psymtab. */ -+static struct sym_fns elf_sym_fns_gdb_index = -+{ -+ bfd_target_elf_flavour, -+ elf_new_init, /* sym_new_init: init anything gbl to entire symab */ -+ elf_symfile_init, /* sym_init: read initial info, setup for sym_red() */ -+ elf_symfile_read, /* sym_read: read a symbol file into symtab */ -+ elf_symfile_finish, /* sym_finish: finished with file, cleanup */ -+ default_symfile_offsets, /* sym_offsets: Translate ext. to int. relocatin */ -+ elf_symfile_segments, /* sym_segments: Get segment information from -+ a file. */ -+ NULL, /* sym_read_linetable */ -+ default_symfile_relocate, /* sym_relocate: Relocate a debug section. */ -+ &dwarf2_gdb_index_functions, -+ NULL /* next: pointer to next struct sym_fns */ -+}; -+ - void - _initialize_elfread (void) - { diff --git a/gdb/eval.c b/gdb/eval.c -index ff17c34..7b9e871 100644 +index 16e98ae..4fa4d5f 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -44,6 +44,7 @@ @@ -5296,7 +2399,7 @@ index ff17c34..7b9e871 100644 #include "gdb_assert.h" -@@ -788,6 +789,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -806,6 +807,7 @@ evaluate_subexp_standard (struct type *expect_type, int save_pos1; struct symbol *function = NULL; char *function_name = NULL; @@ -5304,7 +2407,7 @@ index ff17c34..7b9e871 100644 pc = (*pos)++; op = exp->elts[pc].opcode; -@@ -1772,6 +1774,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1822,6 +1824,8 @@ evaluate_subexp_standard (struct type *expect_type, return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); } @@ -5313,7 +2416,7 @@ index ff17c34..7b9e871 100644 else if (TYPE_TARGET_TYPE (ftype)) return allocate_value (TYPE_TARGET_TYPE (ftype)); else -@@ -1798,6 +1802,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1848,6 +1852,8 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -5322,7 +2425,7 @@ index ff17c34..7b9e871 100644 type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); -@@ -1818,6 +1824,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1868,6 +1874,7 @@ evaluate_subexp_standard (struct type *expect_type, code = TYPE_CODE (type); } } @@ -5330,7 +2433,7 @@ index ff17c34..7b9e871 100644 switch (code) { -@@ -2254,13 +2261,19 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2325,13 +2332,19 @@ evaluate_subexp_standard (struct type *expect_type, { int subscript_array[MAX_FORTRAN_DIMS]; int array_size_array[MAX_FORTRAN_DIMS]; @@ -5350,7 +2453,7 @@ index ff17c34..7b9e871 100644 tmp_type = check_typedef (value_type (arg1)); ndimensions = calc_f77_array_dims (type); -@@ -2290,6 +2303,9 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2361,6 +2374,9 @@ evaluate_subexp_standard (struct type *expect_type, upper = f77_get_upperbound (tmp_type); lower = f77_get_lowerbound (tmp_type); @@ -5360,7 +2463,7 @@ index ff17c34..7b9e871 100644 array_size_array[nargs - i - 1] = upper - lower + 1; /* Zero-normalize subscripts so that offsetting will work. */ -@@ -2308,13 +2324,25 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2379,13 +2395,25 @@ evaluate_subexp_standard (struct type *expect_type, tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type)); } @@ -5390,7 +2493,7 @@ index ff17c34..7b9e871 100644 /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level -@@ -2324,7 +2352,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2395,7 +2423,7 @@ evaluate_subexp_standard (struct type *expect_type, returns the correct type value */ deprecated_set_value_type (arg1, tmp_type); @@ -5399,7 +2502,7 @@ index ff17c34..7b9e871 100644 } case BINOP_LOGICAL_AND: -@@ -2558,14 +2586,22 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2629,14 +2657,22 @@ evaluate_subexp_standard (struct type *expect_type, if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); @@ -5424,7 +2527,7 @@ index ff17c34..7b9e871 100644 else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); -@@ -2574,12 +2610,18 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2645,12 +2681,18 @@ evaluate_subexp_standard (struct type *expect_type, /* In C you can dereference an array to get the 1st elt. */ || TYPE_CODE (type) == TYPE_CODE_ARRAY ) @@ -5448,7 +2551,7 @@ index ff17c34..7b9e871 100644 else error (_("Attempt to take contents of a non-pointer value.")); } -@@ -2589,9 +2631,14 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2660,9 +2702,14 @@ evaluate_subexp_standard (struct type *expect_type, do. "long long" variables are rare enough that BUILTIN_TYPE_LONGEST would seem to be a mistake. */ if (TYPE_CODE (type) == TYPE_CODE_INT) @@ -5466,7 +2569,7 @@ index ff17c34..7b9e871 100644 case UNOP_ADDR: /* C++: check for and handle pointer to members. */ -@@ -2933,7 +2980,7 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -3008,7 +3055,7 @@ evaluate_subexp_with_coercion (struct expression *exp, { enum exp_opcode op; int pc; @@ -5475,7 +2578,7 @@ index ff17c34..7b9e871 100644 struct symbol *var; struct type *type; -@@ -2944,12 +2991,17 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -3019,13 +3066,18 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -5485,6 +2588,7 @@ index ff17c34..7b9e871 100644 + val = address_of_variable (var, exp->elts[pc + 1].block); type = check_typedef (SYMBOL_TYPE (var)); if (TYPE_CODE (type) == TYPE_CODE_ARRAY + && !TYPE_VECTOR (type) && CAST_IS_CONVERSION (exp->language_defn)) { (*pos) += 4; @@ -5494,7 +2598,7 @@ index ff17c34..7b9e871 100644 return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -3001,9 +3053,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) +@@ -3077,9 +3129,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -5595,7 +2699,7 @@ index d35a255..dec81d5 100644 { case TYPE_CODE_ARRAY: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 85f698d..2f72b97 100644 +index e27f79e..93322a2 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -5732,171 +2836,6 @@ index 85f698d..2f72b97 100644 CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) { -diff --git a/gdb/findcmd.c b/gdb/findcmd.c -index ac63a9e..e9ba45c 100644 ---- a/gdb/findcmd.c -+++ b/gdb/findcmd.c -@@ -45,6 +45,41 @@ put_bits (bfd_uint64_t data, char *buf, int bits, bfd_boolean big_p) - } - } - -+/* Allocates a buffer in *PATTERN_BUF, with a hard-coded initial size which -+ will be returned in *PATTERN_BUF_SIZE. *PATTERN_BUF_END points to the same -+ place as *PATTERN_BUF, indicating that the buffer is initially empty. */ -+ -+void -+allocate_pattern_buffer (char **pattern_buf, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size) -+{ -+#define INITIAL_PATTERN_BUF_SIZE 100 -+ *pattern_buf_size = INITIAL_PATTERN_BUF_SIZE; -+ *pattern_buf = xmalloc (*pattern_buf_size); -+ *pattern_buf_end = *pattern_buf; -+} -+ -+/* Grows *PATTERN_BUF by a factor of two if it's not large enough to hold -+ VAL_BYTES more bytes or a 64-bit value, whichever is larger. -+ *PATTERN_BUF_END is updated as necessary. */ -+ -+void -+increase_pattern_buffer (char **pattern_buf, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size, int val_bytes) -+{ -+ /* Keep it simple and assume size == 'g' when watching for when we -+ need to grow the pattern buf. */ -+ if ((*pattern_buf_end - *pattern_buf + max (val_bytes, sizeof (int64_t))) -+ > *pattern_buf_size) -+ { -+ size_t current_offset = *pattern_buf_end - *pattern_buf; -+ -+ *pattern_buf_size *= 2; -+ *pattern_buf = xrealloc (*pattern_buf, *pattern_buf_size); -+ *pattern_buf_end = *pattern_buf + current_offset; -+ } -+} -+ - /* Subroutine of find_command to simplify it. - Parse the arguments of the "find" command. */ - -@@ -61,8 +96,7 @@ parse_find_args (char *args, ULONGEST *max_countp, - char *pattern_buf; - /* Current size of search pattern buffer. - We realloc space as needed. */ --#define INITIAL_PATTERN_BUF_SIZE 100 -- ULONGEST pattern_buf_size = INITIAL_PATTERN_BUF_SIZE; -+ ULONGEST pattern_buf_size; - /* Pointer to one past the last in-use part of pattern_buf. */ - char *pattern_buf_end; - ULONGEST pattern_len; -@@ -75,8 +109,7 @@ parse_find_args (char *args, ULONGEST *max_countp, - if (args == NULL) - error (_("Missing search parameters.")); - -- pattern_buf = xmalloc (pattern_buf_size); -- pattern_buf_end = pattern_buf; -+ allocate_pattern_buffer (&pattern_buf, &pattern_buf_end, &pattern_buf_size); - old_cleanups = make_cleanup (free_current_contents, &pattern_buf); - - /* Get search granularity and/or max count if specified. -@@ -175,17 +208,9 @@ parse_find_args (char *args, ULONGEST *max_countp, - v = parse_to_comma_and_eval (&s); - val_bytes = TYPE_LENGTH (value_type (v)); - -- /* Keep it simple and assume size == 'g' when watching for when we -- need to grow the pattern buf. */ -- if ((pattern_buf_end - pattern_buf + max (val_bytes, sizeof (int64_t))) -- > pattern_buf_size) -- { -- size_t current_offset = pattern_buf_end - pattern_buf; -+ increase_pattern_buffer (&pattern_buf, &pattern_buf_end, -+ &pattern_buf_size, val_bytes); - -- pattern_buf_size *= 2; -- pattern_buf = xrealloc (pattern_buf, pattern_buf_size); -- pattern_buf_end = pattern_buf + current_offset; -- } - - if (size != '\0') - { -@@ -240,6 +265,45 @@ parse_find_args (char *args, ULONGEST *max_countp, - discard_cleanups (old_cleanups); - } - -+/* Drives target_search_memory to sweep through the specified search space, -+ possibly in several iterations (with one call to this function for each -+ iteration). *START_ADDR is the address where the search starts, and is -+ updated to the next starting address to continue the search. -+ *SEARCH_SPACE_LEN is the amount of bytes which will be searched, and is -+ updated for the next iteration. PATTERN_BUF holds the pattern to be searched -+ for, PATTERN_LEN is the size of the pattern in bytes. If a match is found, -+ it's address is put in *FOUND_ADDR. -+ -+ Returns 1 if found, 0 if not found, and -1 if there was an error requiring -+ halting of the search (e.g. memory read error). */ -+ -+int -+search_memory (CORE_ADDR *start_addr, ULONGEST *search_space_len, -+ const char *pattern_buf, ULONGEST pattern_len, -+ CORE_ADDR *found_addr) -+{ -+ /* Offset from start of this iteration to the next iteration. */ -+ ULONGEST next_iter_incr; -+ int found; -+ -+ found = target_search_memory (*start_addr, *search_space_len, -+ pattern_buf, pattern_len, found_addr); -+ if (found <= 0) -+ return found; -+ -+ /* Begin next iteration at one byte past this match. */ -+ next_iter_incr = (*found_addr - *start_addr) + 1; -+ -+ /* For robustness, we don't let search_space_len go -ve here. */ -+ if (*search_space_len >= next_iter_incr) -+ *search_space_len -= next_iter_incr; -+ else -+ *search_space_len = 0; -+ *start_addr += next_iter_incr; -+ -+ return found; -+} -+ - static void - find_command (char *args, int from_tty) - { -@@ -270,12 +334,11 @@ find_command (char *args, int from_tty) - while (search_space_len >= pattern_len - && found_count < max_count) - { -- /* Offset from start of this iteration to the next iteration. */ -- ULONGEST next_iter_incr; - CORE_ADDR found_addr; -- int found = target_search_memory (start_addr, search_space_len, -- pattern_buf, pattern_len, &found_addr); -+ int found; - -+ found = search_memory (&start_addr, &search_space_len, pattern_buf, -+ pattern_len, &found_addr); - if (found <= 0) - break; - -@@ -283,16 +346,6 @@ find_command (char *args, int from_tty) - printf_filtered ("\n"); - ++found_count; - last_found_addr = found_addr; -- -- /* Begin next iteration at one byte past this match. */ -- next_iter_incr = (found_addr - start_addr) + 1; -- -- /* For robustness, we don't let search_space_len go -ve here. */ -- if (search_space_len >= next_iter_incr) -- search_space_len -= next_iter_incr; -- else -- search_space_len = 0; -- start_addr += next_iter_incr; - } - - /* Record and print the results. */ diff --git a/gdb/findvar.c b/gdb/findvar.c index e0ca12c..de6311a 100644 --- a/gdb/findvar.c @@ -6108,78 +3047,8 @@ index e0ca12c..de6311a 100644 } else { -diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h -index 78151dd..da11686 100644 ---- a/gdb/gdbcmd.h -+++ b/gdb/gdbcmd.h -@@ -124,6 +124,10 @@ extern struct cmd_list_element *setchecklist; - - extern struct cmd_list_element *showchecklist; - -+/* Chain containing all defined "save" subcommands. */ -+ -+extern struct cmd_list_element *save_cmdlist; -+ - extern void execute_command (char *, int); - extern char *execute_command_to_string (char *p, int from_tty); - -diff --git a/gdb/gdbinit.in b/gdb/gdbinit.in -index ffb7f53..a2e7e94 100644 ---- a/gdb/gdbinit.in -+++ b/gdb/gdbinit.in -@@ -1,5 +1,15 @@ - echo Setting up the environment for debugging gdb.\n - -+# Set up the Python library and "require" command. -+python -+from os.path import abspath -+gdb.datadir = abspath ('@srcdir@/python/lib') -+gdb.pythonlibdir = gdb.datadir -+gdb.__path__ = [gdb.datadir + '/gdb'] -+sys.path.insert(0, gdb.datadir) -+end -+source @srcdir@/python/lib/gdb/__init__.py -+ - set complaints 1 - - b internal_error -diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h -index cd24eaf..9638368 100644 ---- a/gdb/gdbthread.h -+++ b/gdb/gdbthread.h -@@ -66,6 +66,9 @@ struct thread_info - /* Step-resume or longjmp-resume breakpoint. */ - struct breakpoint *step_resume_breakpoint; - -+ /* Exception-resume breakpoint. */ -+ struct breakpoint *exception_resume_breakpoint; -+ - /* Range to single step within. - - If this is nonzero, respond to a single-step signal by continuing -@@ -185,6 +188,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; - -@@ -221,6 +228,9 @@ extern void delete_thread_silent (ptid_t); - /* Delete a step_resume_breakpoint from the thread database. */ - extern void delete_step_resume_breakpoint (struct thread_info *); - -+/* Delete an exception_resume_breakpoint from the thread database. */ -+extern void delete_exception_resume_breakpoint (struct thread_info *); -+ - /* Translate the integer thread id (GDB's homegrown id, not the system's) - into a "pid" (which may be overloaded with extra thread information). */ - extern ptid_t thread_id_to_pid (int); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index 443f6f7..d852a14 100644 +index d96d0f8..4bebcda 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -39,6 +39,9 @@ @@ -6191,8 +3060,8 @@ index 443f6f7..d852a14 100644 +#include "dwarf2loc.h" - /* Floatformat pairs. */ -@@ -123,6 +126,11 @@ static void print_arg_types (struct field *, int, int); + /* Initialize BADNESS constants. */ +@@ -145,6 +148,11 @@ static void print_arg_types (struct field *, int, int); static void dump_fn_fieldlists (struct type *, int); static void print_cplus_stuff (struct type *, int); @@ -6204,7 +3073,7 @@ index 443f6f7..d852a14 100644 /* Allocate a new OBJFILE-associated type structure and fill it with some defaults. Space for the type structure is allocated -@@ -153,6 +161,39 @@ alloc_type (struct objfile *objfile) +@@ -175,6 +183,39 @@ alloc_type (struct objfile *objfile) return type; } @@ -6244,7 +3113,7 @@ index 443f6f7..d852a14 100644 /* Allocate a new GDBARCH-associated type structure and fill it with some defaults. Space for the type structure is allocated on the heap. */ -@@ -278,7 +319,7 @@ make_pointer_type (struct type *type, struct type **typeptr) +@@ -300,7 +341,7 @@ make_pointer_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -6253,7 +3122,7 @@ index 443f6f7..d852a14 100644 if (typeptr) *typeptr = ntype; } -@@ -355,7 +396,7 @@ make_reference_type (struct type *type, struct type **typeptr) +@@ -377,7 +418,7 @@ make_reference_type (struct type *type, struct type **typeptr) if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { @@ -6262,7 +3131,7 @@ index 443f6f7..d852a14 100644 if (typeptr) *typeptr = ntype; } -@@ -726,6 +767,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -748,6 +789,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_LOW_BOUND (result_type) = low_bound; TYPE_HIGH_BOUND (result_type) = high_bound; @@ -6270,7 +3139,7 @@ index 443f6f7..d852a14 100644 if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -825,26 +867,45 @@ create_array_type (struct type *result_type, +@@ -891,26 +933,45 @@ create_array_type (struct type *result_type, TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -6329,7 +3198,7 @@ index 443f6f7..d852a14 100644 return result_type; } -@@ -1353,6 +1414,105 @@ stub_noname_complaint (void) +@@ -1413,6 +1474,105 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -6432,10 +3301,10 @@ index 443f6f7..d852a14 100644 + TYPE_DYNAMIC (type) = 1; +} + - /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. - - If this is a stubbed struct (i.e. declared as struct foo *), see if -@@ -1486,52 +1646,36 @@ check_typedef (struct type *type) + /* Find the real type of TYPE. This function returns the real type, + after removing all layers of typedefs, and completing opaque or stub + types. Completion changes the TYPE argument, but stripping of +@@ -1575,52 +1735,36 @@ check_typedef (struct type *type) } } @@ -6508,21 +3377,16 @@ index 443f6f7..d852a14 100644 TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1539,9 +1683,12 @@ check_typedef (struct type *type) +@@ -1628,6 +1772,7 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } + TYPE_DYNAMIC (type) = 0; } -+ - /* Cache TYPE_LENGTH for future use. */ - TYPE_LENGTH (orig_type) = TYPE_LENGTH (type); -+ - return type; - } -@@ -1811,6 +1958,8 @@ init_type (enum type_code code, int length, int flags, - TYPE_NOTTEXT (type) = 1; + type = make_qualified_type (type, instance_flags, NULL); +@@ -1902,6 +2047,8 @@ init_type (enum type_code code, int length, int flags, + TYPE_STUB_SUPPORTED (type) = 1; if (flags & TYPE_FLAG_FIXED_INSTANCE) TYPE_FIXED_INSTANCE (type) = 1; + if (flags & TYPE_FLAG_GNU_IFUNC) @@ -6530,7 +3394,7 @@ index 443f6f7..d852a14 100644 if (name) TYPE_NAME (type) = obsavestring (name, strlen (name), -@@ -3006,33 +3155,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) +@@ -3194,33 +3341,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -6588,7 +3452,7 @@ index 443f6f7..d852a14 100644 return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -3047,8 +3205,10 @@ copy_type_recursive (struct objfile *objfile, +@@ -3235,8 +3391,10 @@ copy_type_recursive (struct objfile *objfile, new_type = alloc_type_arch (get_type_arch (type)); /* We must add the new type to the hash table immediately, in case @@ -6601,7 +3465,7 @@ index 443f6f7..d852a14 100644 stored->old = type; stored->new = new_type; *slot = stored; -@@ -3059,6 +3219,19 @@ copy_type_recursive (struct objfile *objfile, +@@ -3247,6 +3405,19 @@ copy_type_recursive (struct objfile *objfile, TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OWNER (new_type).gdbarch = get_type_arch (type); @@ -6621,7 +3485,7 @@ index 443f6f7..d852a14 100644 if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -3067,12 +3240,48 @@ copy_type_recursive (struct objfile *objfile, +@@ -3255,12 +3426,48 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -6670,7 +3534,7 @@ index 443f6f7..d852a14 100644 TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -3081,8 +3290,8 @@ copy_type_recursive (struct objfile *objfile, +@@ -3269,8 +3476,8 @@ copy_type_recursive (struct objfile *objfile, TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); if (TYPE_FIELD_TYPE (type, i)) TYPE_FIELD_TYPE (new_type, i) @@ -6681,7 +3545,7 @@ index 443f6f7..d852a14 100644 if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3109,24 +3318,166 @@ copy_type_recursive (struct objfile *objfile, +@@ -3297,24 +3504,166 @@ copy_type_recursive (struct objfile *objfile, } } @@ -6855,7 +3719,7 @@ index 443f6f7..d852a14 100644 /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3143,6 +3494,17 @@ copy_type_recursive (struct objfile *objfile, +@@ -3331,6 +3680,17 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -6873,7 +3737,7 @@ index 443f6f7..d852a14 100644 /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -3165,6 +3527,199 @@ copy_type (const struct type *type) +@@ -3353,6 +3713,199 @@ copy_type (const struct type *type) return new_type; } @@ -7073,7 +3937,7 @@ index 443f6f7..d852a14 100644 /* Helper functions to initialize architecture-specific types. */ -@@ -3511,6 +4066,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch) +@@ -3701,6 +4254,8 @@ gdbtypes_post_init (struct gdbarch *gdbarch) = lookup_pointer_type (builtin_type->builtin_void); builtin_type->builtin_func_ptr = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void)); @@ -7082,7 +3946,7 @@ index 443f6f7..d852a14 100644 /* This type represents a GDB internal function. */ builtin_type->internal_fn -@@ -3624,6 +4181,18 @@ objfile_type (struct objfile *objfile) +@@ -3814,6 +4369,18 @@ objfile_type (struct objfile *objfile) "", objfile); TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol) = objfile_type->builtin_int; @@ -7101,7 +3965,7 @@ index 443f6f7..d852a14 100644 objfile_type->nodebug_data_symbol = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0, -@@ -3678,6 +4247,11 @@ void +@@ -3868,6 +4435,11 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -7114,13 +3978,13 @@ index 443f6f7..d852a14 100644 add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, _("\ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 085270e..cb2b88e 100644 +index 51eb445..627e5af 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -171,6 +171,7 @@ enum type_flag_value - TYPE_FLAG_FIXED_INSTANCE = (1 << 15), - TYPE_FLAG_STUB_SUPPORTED = (1 << 16), - TYPE_FLAG_NOTTEXT = (1 << 17), +@@ -170,6 +170,7 @@ enum type_flag_value + TYPE_FLAG_VECTOR = (1 << 15), + TYPE_FLAG_FIXED_INSTANCE = (1 << 16), + TYPE_FLAG_STUB_SUPPORTED = (1 << 17), + TYPE_FLAG_GNU_IFUNC = (1 << 18), /* Used for error-checking. */ @@ -7139,7 +4003,7 @@ index 085270e..cb2b88e 100644 * Note: This may be unnecessary, since static data members @@ -271,6 +277,12 @@ enum type_instance_flag_value - #define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext) + #define TYPE_NOTTEXT(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_NOTTEXT) +/* Used only for TYPE_CODE_FUNC where it specifies the real function + address is returned by this function call. TYPE_TARGET_TYPE determines the @@ -7199,10 +4063,10 @@ index 085270e..cb2b88e 100644 /* Constant type. If this is set, the corresponding type has a * const modifier. */ -@@ -389,11 +443,19 @@ struct main_type +@@ -388,11 +442,19 @@ struct main_type + unsigned int flag_varargs : 1; unsigned int flag_vector : 1; unsigned int flag_stub_supported : 1; - unsigned int flag_nottext : 1; + unsigned int flag_gnu_ifunc : 1; unsigned int flag_fixed_instance : 1; unsigned int flag_objfile_owned : 1; @@ -7219,7 +4083,7 @@ index 085270e..cb2b88e 100644 /* A discriminant telling us which field of the type_specific union is being used for this type, if any. */ -@@ -467,6 +529,20 @@ struct main_type +@@ -466,6 +528,20 @@ struct main_type struct type *target_type; @@ -7240,7 +4104,7 @@ index 085270e..cb2b88e 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. -@@ -540,13 +616,34 @@ struct main_type +@@ -539,13 +615,34 @@ struct main_type struct range_bounds { @@ -7280,7 +4144,7 @@ index 085270e..cb2b88e 100644 /* Flags indicating whether the values of low and high are valid. When true, the respective range value is -@@ -889,9 +986,9 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -917,9 +1014,9 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_CHAIN(thistype) (thistype)->chain @@ -7293,7 +4157,7 @@ index 085270e..cb2b88e 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 -@@ -899,11 +996,16 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -927,11 +1024,16 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields @@ -7312,7 +4176,7 @@ index 085270e..cb2b88e 100644 #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ TYPE_RANGE_DATA(range_type)->low_undefined #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -920,7 +1022,14 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -948,7 +1050,14 @@ extern void allocate_gnat_aux_type (struct type *); (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ @@ -7328,7 +4192,7 @@ index 085270e..cb2b88e 100644 /* C++ */ -@@ -1141,6 +1250,10 @@ struct builtin_type +@@ -1176,6 +1285,10 @@ struct builtin_type (*) () can server as a generic function pointer. */ struct type *builtin_func_ptr; @@ -7339,7 +4203,7 @@ index 085270e..cb2b88e 100644 /* Special-purpose types. */ -@@ -1181,6 +1294,8 @@ struct objfile_type +@@ -1216,6 +1329,8 @@ struct objfile_type /* Types used for symbols with no debug information. */ struct type *nodebug_text_symbol; @@ -7348,7 +4212,7 @@ index 085270e..cb2b88e 100644 struct type *nodebug_data_symbol; struct type *nodebug_unknown_symbol; struct type *nodebug_tls_symbol; -@@ -1328,6 +1443,18 @@ extern struct type *create_array_type (struct type *, struct type *, +@@ -1363,6 +1478,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -7367,7 +4231,7 @@ index 085270e..cb2b88e 100644 extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1370,6 +1497,8 @@ extern int is_public_ancestor (struct type *, struct type *); +@@ -1408,6 +1535,8 @@ extern int is_public_ancestor (struct type *, struct type *); extern int is_unique_ancestor (struct type *, struct value *); @@ -7376,7 +4240,7 @@ index 085270e..cb2b88e 100644 /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1432,10 +1561,11 @@ extern void maintenance_print_type (char *, int); +@@ -1478,10 +1607,11 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -7478,7 +4342,7 @@ index 7317e7d..ea914a5 100644 }; diff --git a/gdb/infcall.c b/gdb/infcall.c -index 0c9a3af..957ec1d 100644 +index 7f60e56..b7acfc6 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -225,6 +225,56 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg, @@ -7591,209 +4455,11 @@ index 0c9a3af..957ec1d 100644 { /* Handle the case of functions lacking debugging info. Their values are characters since their addresses are char */ -diff --git a/gdb/infcmd.c b/gdb/infcmd.c -index c4cdb06..d213f6a 100644 ---- a/gdb/infcmd.c -+++ b/gdb/infcmd.c -@@ -822,7 +822,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; -@@ -862,10 +862,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); - } -@@ -1219,6 +1222,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. - -@@ -1235,6 +1247,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 (); -@@ -1270,7 +1284,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 -@@ -1463,6 +1489,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 -@@ -1546,6 +1573,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); -@@ -1556,6 +1584,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... */ - cargs = xmalloc (sizeof (*cargs)); - -diff --git a/gdb/inferior.h b/gdb/inferior.h -index 5abec68..e309277 100644 ---- a/gdb/inferior.h -+++ b/gdb/inferior.h -@@ -291,6 +291,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 54b1d9f..58d045a 100644 +index f6b00da..56e558b 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" -@@ -367,6 +369,7 @@ follow_fork (void) - parent thread structure's run control related fields, not just these. - Initialized to avoid "may be used uninitialized" warnings from gcc. */ - struct breakpoint *step_resume_breakpoint = NULL; -+ struct breakpoint *exception_resume_breakpoint = NULL; - CORE_ADDR step_range_start = 0; - CORE_ADDR step_range_end = 0; - struct frame_id step_frame_id = { 0 }; -@@ -419,6 +422,8 @@ follow_fork (void) - step_range_start = tp->step_range_start; - step_range_end = tp->step_range_end; - step_frame_id = tp->step_frame_id; -+ exception_resume_breakpoint -+ = clone_momentary_breakpoint (tp->exception_resume_breakpoint); - - /* For now, delete the parent's sr breakpoint, otherwise, - parent/child sr breakpoints are considered duplicates, -@@ -429,6 +434,7 @@ follow_fork (void) - tp->step_range_start = 0; - tp->step_range_end = 0; - tp->step_frame_id = null_frame_id; -+ delete_exception_resume_breakpoint (tp); - } - - parent = inferior_ptid; -@@ -470,6 +476,8 @@ follow_fork (void) - tp->step_range_start = step_range_start; - tp->step_range_end = step_range_end; - tp->step_frame_id = step_frame_id; -+ tp->exception_resume_breakpoint -+ = exception_resume_breakpoint; - } - else - { -@@ -523,6 +531,9 @@ follow_inferior_reset_breakpoints (void) - if (tp->step_resume_breakpoint) - breakpoint_re_set_thread (tp->step_resume_breakpoint); - -+ if (tp->exception_resume_breakpoint) -+ breakpoint_re_set_thread (tp->exception_resume_breakpoint); -+ - /* Reinsert all breakpoints in the child. The user may have set - breakpoints after catching the fork, in which case those - were never set in the child, but only in the parent. This makes -@@ -760,6 +771,7 @@ follow_exec (ptid_t pid, char *execd_pathname) - /* If there was one, it's gone now. We cannot truly step-to-next - statement through an exec(). */ - th->step_resume_breakpoint = NULL; -+ th->exception_resume_breakpoint = NULL; - th->step_range_start = 0; - th->step_range_end = 0; - -@@ -2190,6 +2202,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); -@@ -2313,6 +2327,7 @@ delete_step_resume_breakpoint_callback (struct thread_info *info, void *data) - return 0; - - delete_step_resume_breakpoint (info); -+ delete_exception_resume_breakpoint (info); - return 0; - } - -@@ -2337,6 +2352,7 @@ delete_step_thread_step_resume_breakpoint (void) - struct thread_info *tp = inferior_thread (); - - delete_step_resume_breakpoint (tp); -+ delete_exception_resume_breakpoint (tp); - } - else - /* In all-stop mode, delete all step-resume and longjmp-resume -@@ -3241,6 +3257,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -3267,6 +3267,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -7804,7 +4470,7 @@ index 54b1d9f..58d045a 100644 ecs->event_thread->stop_bpstat = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()), stop_pc, ecs->ptid); -@@ -3328,6 +3348,10 @@ handle_inferior_event (struct execution_control_state *ecs) +@@ -3354,6 +3358,10 @@ handle_inferior_event (struct execution_control_state *ecs) stop_pc = regcache_read_pc (get_thread_regcache (ecs->ptid)); @@ -7815,210 +4481,11 @@ index 54b1d9f..58d045a 100644 /* Do whatever is necessary to the parent branch of the vfork. */ handle_vfork_child_exec_or_exit (1); -@@ -4076,23 +4100,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; - -@@ -4101,8 +4135,52 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); - fprintf_unfiltered (gdb_stdlog, - "infrun: BPSTAT_WHAT_CLEAR_LONGJMP_RESUME\n"); - -- gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); -- delete_step_resume_breakpoint (ecs->event_thread); -+ if (what.is_longjmp) -+ { -+ gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); -+ delete_step_resume_breakpoint (ecs->event_thread); -+ } -+ else -+ { -+ /* 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. We stop, because the exception has been -+ caught. -+ -+ 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); -+ -+ gdb_assert (ecs->event_thread->exception_resume_breakpoint != NULL); -+ delete_exception_resume_breakpoint (ecs->event_thread); -+ -+ 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)) -+ { -+ /* Case 2. Fall through. */ -+ } -+ else -+ { -+ /* Case 3. */ -+ keep_going (ecs); -+ return; -+ } -+ } -+ -+ /* For Cases 1 and 2, remove the step-resume breakpoint, -+ if it exists. */ -+ delete_step_resume_breakpoint (ecs->event_thread); -+ } - - ecs->event_thread->stop_step = 1; - print_stop_reason (END_STEPPING_RANGE, 0); -@@ -5070,6 +5148,97 @@ 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); -+ /* If the value was optimized out, revert to the old behavior. */ -+ if (! value_optimized_out (value)) -+ { -+ handler = value_as_address (value); -+ -+ 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); -+ bp->thread = tp->num; -+ inferior_thread ()->exception_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) - { diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c -index 93adfcd..34412a6 100644 +index 0e18034..96895db 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -2587,6 +2587,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) +@@ -2607,6 +2607,39 @@ linux_nat_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p) return lp->stopped_data_address_p; } @@ -8055,10 +4522,10 @@ index 93adfcd..34412a6 100644 + return retval; +} + - /* Wait until LP is stopped. */ + /* Commonly any breakpoint / watchpoint generate only SIGTRAP. */ static int -@@ -5606,6 +5639,8 @@ linux_nat_add_target (struct target_ops *t) +@@ -5660,6 +5693,8 @@ linux_nat_add_target (struct target_ops *t) t->to_thread_address_space = linux_nat_thread_address_space; t->to_stopped_by_watchpoint = linux_nat_stopped_by_watchpoint; t->to_stopped_data_address = linux_nat_stopped_data_address; @@ -8068,186 +4535,18 @@ index 93adfcd..34412a6 100644 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-tdep.c b/gdb/linux-tdep.c -index 07fd67c..2524250 100644 +index c51ede9..ef8cbda 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c -@@ -23,6 +23,8 @@ - #include "auxv.h" +@@ -24,6 +24,8 @@ #include "target.h" #include "elf/common.h" + #include "inferior.h" +#include "value.h" +#include "infcall.h" - /* This function is suitable for architectures that don't - extend/override the standard siginfo structure. */ -diff --git a/gdb/main.c b/gdb/main.c -index bfd1213..72faabd 100644 ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -39,6 +39,7 @@ + static struct gdbarch_data *linux_gdbarch_data_handle; - #include "interps.h" - #include "main.h" -+#include "python/python.h" - #include "source.h" - #include "cli/cli-cmds.h" - #include "python/python.h" -@@ -259,6 +260,8 @@ captured_main (void *data) - char *cdarg = NULL; - char *ttyarg = NULL; - -+ int python_script = 0; -+ - /* These are static so that we can take their address in an initializer. */ - static int print_help; - static int print_version; -@@ -443,10 +446,14 @@ captured_main (void *data) - {"args", no_argument, &set_args, 1}, - {"l", required_argument, 0, 'l'}, - {"return-child-result", no_argument, &return_child_result, 1}, -+#if HAVE_PYTHON -+ {"python", no_argument, 0, 'P'}, -+ {"P", no_argument, 0, 'P'}, -+#endif - {0, no_argument, 0, 0} - }; - -- while (1) -+ while (!python_script) - { - int option_index; - -@@ -464,6 +471,9 @@ captured_main (void *data) - case 0: - /* Long option that just sets a flag. */ - break; -+ case 'P': -+ python_script = 1; -+ break; - case OPT_SE: - symarg = optarg; - execarg = optarg; -@@ -650,7 +660,31 @@ extern int gdbtk_test (char *); - - /* Now that gdb_init has created the initial inferior, we're in position - to set args for that inferior. */ -- if (set_args) -+ if (python_script) -+ { -+ /* The first argument is a python script to evaluate, and -+ subsequent arguments are passed to the script for -+ processing there. */ -+ if (optind >= argc) -+ { -+ fprintf_unfiltered (gdb_stderr, -+ _("%s: Python script file name required\n"), -+ argv[0]); -+ exit (1); -+ } -+ -+ /* FIXME: should handle inferior I/O intelligently here. -+ E.g., should be possible to run gdb in pipeline and have -+ Python (and gdb) output go to stderr or file; and if a -+ prompt is needed, open the tty. */ -+ quiet = 1; -+ /* FIXME: should read .gdbinit if, and only if, a prompt is -+ requested by the script. Though... maybe this is not -+ ideal? */ -+ /* FIXME: likewise, reading in history. */ -+ inhibit_gdbinit = 1; -+ } -+ else if (set_args) - { - /* The remaining options are the command-line options for the - inferior. The first one is the sym/exec file, and the rest -@@ -890,7 +924,8 @@ Can't attach to process and specify a core file at the same time.")); - xfree (cmdarg); - - /* Read in the old history after all the command files have been read. */ -- init_history (); -+ if (!python_script) -+ init_history (); - - if (batch_flag) - { -@@ -901,13 +936,25 @@ Can't attach to process and specify a core file at the same time.")); - /* Show time and/or space usage. */ - do_cleanups (pre_stat_chain); - -- /* NOTE: cagney/1999-11-07: There is probably no reason for not -- moving this loop and the code found in captured_command_loop() -- into the command_loop() proper. The main thing holding back that -- change - SET_TOP_LEVEL() - has been eliminated. */ -- while (1) -+#if HAVE_PYTHON -+ if (python_script) - { -- catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ extern int pagination_enabled; -+ pagination_enabled = 0; -+ run_python_script (argc - optind, &argv[optind]); -+ return 1; -+ } -+ else -+#endif -+ { -+ /* NOTE: cagney/1999-11-07: There is probably no reason for not -+ moving this loop and the code found in captured_command_loop() -+ into the command_loop() proper. The main thing holding back that -+ change - SET_TOP_LEVEL() - has been eliminated. */ -+ while (1) -+ { -+ catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL); -+ } - } - /* No exit -- exit is through quit_command. */ - } -@@ -939,7 +986,12 @@ print_gdb_help (struct ui_file *stream) - fputs_unfiltered (_("\ - This is the GNU debugger. Usage:\n\n\ - gdb [options] [executable-file [core-file or process-id]]\n\ -- gdb [options] --args executable-file [inferior-arguments ...]\n\n\ -+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream); -+#endif -+ fputs_unfiltered (_("\n\ - Options:\n\n\ - "), stream); - fputs_unfiltered (_("\ -@@ -977,7 +1029,13 @@ Options:\n\n\ - --nw Do not use a window interface.\n\ - --nx Do not read "), stream); - fputs_unfiltered (gdbinit, stream); -- fputs_unfiltered (_(" file.\n\ -+ fputs_unfiltered (_(" file.\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ --python, -P Following argument is Python script file; remaining\n\ -+ arguments are passed to script.\n"), stream); -+#endif -+ fputs_unfiltered (_("\ - --quiet Do not print version number on startup.\n\ - --readnow Fully read symbol files on first access.\n\ - "), stream); -diff --git a/gdb/maint.c b/gdb/maint.c -index 28fd610..4e21476 100644 ---- a/gdb/maint.c -+++ b/gdb/maint.c -@@ -909,4 +909,12 @@ When enabled GDB is profiled."), - show_maintenance_profile_p, - &maintenance_set_cmdlist, - &maintenance_show_cmdlist); -+ add_setshow_filename_cmd ("gdb_datadir", class_maintenance, -+ &gdb_datadir, _("Set GDB's datadir path."), -+ _("Show GDB's datadir path."), -+ _("\ -+When set, GDB uses the specified path to search for data files."), -+ NULL, NULL, -+ &maintenance_set_cmdlist, -+ &maintenance_show_cmdlist); - } diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 310ade9..d8710a1 100644 --- a/gdb/mi/mi-cmd-var.c @@ -8261,7 +4560,7 @@ index 310ade9..d8710a1 100644 varobj_update_one (var, print_values, 1 /* explicit */); diff --git a/gdb/minsyms.c b/gdb/minsyms.c -index cb4545c..92d4027 100644 +index 0a57e77..6be74df 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -337,8 +337,9 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf) @@ -8301,7 +4600,7 @@ index cb4545c..92d4027 100644 case mst_file_text: case mst_solib_trampoline: section = SECT_OFF_TEXT (objfile); -@@ -1235,7 +1247,8 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) +@@ -1234,7 +1246,8 @@ find_solib_trampoline_target (struct frame_info *frame, CORE_ADDR pc) { ALL_MSYMBOLS (objfile, msymbol) { @@ -8311,25 +4610,8 @@ index cb4545c..92d4027 100644 && strcmp (SYMBOL_LINKAGE_NAME (msymbol), SYMBOL_LINKAGE_NAME (tsymbol)) == 0) return SYMBOL_VALUE_ADDRESS (msymbol); -diff --git a/gdb/p-lang.c b/gdb/p-lang.c -index 08738ac..64d2e9f 100644 ---- a/gdb/p-lang.c -+++ b/gdb/p-lang.c -@@ -222,7 +222,11 @@ pascal_printstr (struct ui_file *stream, struct type *type, - unsigned int things_printed = 0; - int in_quotes = 0; - int need_comma = 0; -- int width = TYPE_LENGTH (type); -+ int width; -+ -+ /* Preserve TYPE's original type, just set its LENGTH. */ -+ check_typedef (type); -+ width = TYPE_LENGTH (type); - - /* If the string was not truncated due to `set print elements', and - the last byte of it is a null, we don't print that, in traditional C diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c -index 4d39bed..d0ddebc 100644 +index 44a2d72..e3aead4 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -38,6 +38,7 @@ @@ -8389,7 +4671,7 @@ index 4d39bed..d0ddebc 100644 return (0); } -@@ -252,6 +274,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, +@@ -254,6 +276,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, /* Return number of characters printed, including the terminating '\0' if we reached the end. val_print_string takes care including the terminating '\0' if necessary. */ @@ -8397,7 +4679,7 @@ index 4d39bed..d0ddebc 100644 return i; break; -@@ -554,6 +577,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, +@@ -556,6 +579,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, error (_("Invalid pascal type code %d in symbol table."), TYPE_CODE (type)); } gdb_flush (stream); @@ -8406,7 +4688,7 @@ index 4d39bed..d0ddebc 100644 } diff --git a/gdb/parse.c b/gdb/parse.c -index c885c6a..cbf9c65 100644 +index 18038ed..1438ae0 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -487,9 +487,21 @@ write_exp_msymbol (struct minimal_symbol *msymbol) @@ -8455,7 +4737,7 @@ index c885c6a..cbf9c65 100644 default: write_exp_elt_type (objfile_type (objfile)->nodebug_unknown_symbol); break; -@@ -1412,6 +1433,7 @@ parser_fprintf (FILE *x, const char *y, ...) +@@ -1481,6 +1502,7 @@ parser_fprintf (FILE *x, const char *y, ...) int operator_check_standard (struct expression *exp, int pos, @@ -8463,7 +4745,7 @@ index c885c6a..cbf9c65 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) -@@ -1453,7 +1475,7 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1522,7 +1544,7 @@ operator_check_standard (struct expression *exp, int pos, struct type *type = elts[pos + 2 + arg].type; struct objfile *objfile = TYPE_OBJFILE (type); @@ -8472,7 +4754,7 @@ index c885c6a..cbf9c65 100644 return 1; } } -@@ -1471,7 +1493,8 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1540,7 +1562,8 @@ operator_check_standard (struct expression *exp, int pos, /* Check objfile where the variable itself is placed. SYMBOL_OBJ_SECTION (symbol) may be NULL. */ @@ -8482,7 +4764,7 @@ index c885c6a..cbf9c65 100644 return 1; /* Check objfile where is placed the code touching the variable. */ -@@ -1484,24 +1507,27 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1553,24 +1576,27 @@ operator_check_standard (struct expression *exp, int pos, /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ @@ -8518,7 +4800,7 @@ index c885c6a..cbf9c65 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -1516,7 +1542,9 @@ exp_iterate (struct expression *exp, +@@ -1585,7 +1611,9 @@ exp_iterate (struct expression *exp, pos = endpos - oplen; if (exp->language_defn->la_exp_desc->operator_check (exp, pos, @@ -8529,7 +4811,7 @@ index c885c6a..cbf9c65 100644 return 1; endpos = pos; -@@ -1547,7 +1575,26 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) +@@ -1616,7 +1644,26 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) { gdb_assert (objfile->separate_debug_objfile_backlink == NULL); @@ -8558,7 +4840,7 @@ index c885c6a..cbf9c65 100644 void diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index bb79ae1..fbbd600 100644 +index 1625575..d072f86 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -194,6 +194,8 @@ extern void operator_length_standard (const struct expression *, int, int *, @@ -8570,7 +4852,7 @@ index bb79ae1..fbbd600 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -285,6 +287,7 @@ struct exp_descriptor +@@ -291,6 +293,7 @@ struct exp_descriptor value should be immediately returned to the caller. Otherwise zero should be returned. */ int (*operator_check) (struct expression *exp, int pos, @@ -8578,7 +4860,7 @@ index bb79ae1..fbbd600 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -323,4 +326,8 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); +@@ -329,4 +332,8 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); @@ -8625,7 +4907,7 @@ index 18ddee7..652b02a 100644 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 5ffa099..58d9c79 100644 +index 5586767..144e851 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -971,6 +971,11 @@ print_command_1 (char *exp, int inspect, int voidprint) @@ -8670,1384 +4952,20 @@ index 5ffa099..58d9c79 100644 + + observer_attach_mark_used (print_types_mark_used); } -diff --git a/gdb/psymtab.c b/gdb/psymtab.c -index 97a4eec..fce19c9 100644 ---- a/gdb/psymtab.c -+++ b/gdb/psymtab.c -@@ -421,6 +421,14 @@ lookup_symbol_aux_psymtabs (struct objfile *objfile, - return NULL; - } - -+static void -+pre_expand_symtabs_matching_psymtabs (struct objfile *objfile, -+ int kind, const char *name, -+ domain_enum domain) -+{ -+ /* Nothing. */ -+} -+ - /* Look, in partial_symtab PST, for symbol whose natural name is NAME. - Check the global symbols if GLOBAL, the static symbols if not. */ - -@@ -941,7 +949,7 @@ psymtab_to_fullname (struct partial_symtab *ps) - return NULL; - } - --static char * -+static const char * - find_symbol_file_from_partial (struct objfile *objfile, const char *name) - { - struct partial_symtab *pst; -@@ -1199,6 +1207,7 @@ const struct quick_symbol_functions psym_functions = - forget_cached_source_info_partial, - lookup_symtab_via_partial_symtab, - lookup_symbol_aux_psymtabs, -+ pre_expand_symtabs_matching_psymtabs, - print_psymtab_stats_for_objfile, - dump_psymtabs_for_objfile, - relocate_psymtabs, -diff --git a/gdb/psymtab.h b/gdb/psymtab.h -index 9b8c8df..de8b67e 100644 ---- a/gdb/psymtab.h -+++ b/gdb/psymtab.h -@@ -1,6 +1,6 @@ - /* Public partial symbol table definitions. - -- Copyright (C) 2009 Free Software Foundation, Inc. -+ Copyright (C) 2009, 2010 Free Software Foundation, Inc. - - This file is part of GDB. - -@@ -28,4 +28,6 @@ void map_partial_symbol_filenames (void (*) (const char *, const char *, - - extern const struct quick_symbol_functions psym_functions; - -+extern const struct quick_symbol_functions dwarf2_gdb_index_functions; -+ - #endif /* PSYMTAB_H */ -diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py -new file mode 100644 -index 0000000..5654546 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameIterator.py -@@ -0,0 +1,33 @@ -+# Iterator over frames. -+ -+# Copyright (C) 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 . -+ -+class FrameIterator: -+ """An iterator that iterates over frames.""" -+ -+ def __init__ (self, frame): -+ "Initialize a FrameIterator. FRAME is the starting frame." -+ self.frame = frame -+ -+ def __iter__ (self): -+ return self -+ -+ def next (self): -+ result = self.frame -+ if result is None: -+ raise StopIteration -+ self.frame = result.older () -+ return result -diff --git a/gdb/python/lib/gdb/FrameWrapper.py b/gdb/python/lib/gdb/FrameWrapper.py -new file mode 100644 -index 0000000..b790a54 ---- /dev/null -+++ b/gdb/python/lib/gdb/FrameWrapper.py -@@ -0,0 +1,112 @@ -+# Wrapper API for frames. -+ -+# Copyright (C) 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 . -+ -+import gdb -+ -+# FIXME: arguably all this should be on Frame somehow. -+class FrameWrapper: -+ def __init__ (self, frame): -+ self.frame = frame; -+ -+ def write_symbol (self, stream, sym, block): -+ if len (sym.linkage_name): -+ nsym, is_field_of_this = gdb.lookup_symbol (sym.linkage_name, block) -+ if nsym.addr_class != gdb.SYMBOL_LOC_REGISTER: -+ sym = nsym -+ -+ stream.write (sym.print_name + "=") -+ try: -+ val = self.read_var (sym) -+ if val != None: -+ val = str (val) -+ # FIXME: would be nice to have a more precise exception here. -+ except RuntimeError, text: -+ val = text -+ if val == None: -+ stream.write ("???") -+ else: -+ stream.write (str (val)) -+ -+ def print_frame_locals (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if sym.is_argument: -+ continue; -+ -+ self.write_symbol (stream, sym, block) -+ stream.write ('\n') -+ -+ def print_frame_args (self, stream, func): -+ if not func: -+ return -+ -+ first = True -+ block = func.value -+ -+ for sym in block: -+ if not sym.is_argument: -+ continue; -+ -+ if not first: -+ stream.write (", ") -+ -+ self.write_symbol (stream, sym, block) -+ first = False -+ -+ # FIXME: this should probably just be a method on gdb.Frame. -+ # But then we need stream wrappers. -+ def describe (self, stream, full): -+ if self.type () == gdb.DUMMY_FRAME: -+ stream.write (" \n") -+ elif self.type () == gdb.SIGTRAMP_FRAME: -+ stream.write (" \n") -+ else: -+ sal = self.find_sal () -+ pc = self.pc () -+ name = self.name () -+ if not name: -+ name = "??" -+ if pc != sal.pc or not sal.symtab: -+ stream.write (" 0x%08x in" % pc) -+ stream.write (" " + name + " (") -+ -+ func = self.function () -+ self.print_frame_args (stream, func) -+ -+ stream.write (")") -+ -+ if sal.symtab and sal.symtab.filename: -+ stream.write (" at " + sal.symtab.filename) -+ stream.write (":" + str (sal.line)) -+ -+ if not self.name () or (not sal.symtab or not sal.symtab.filename): -+ lib = gdb.solib_address (pc) -+ if lib: -+ stream.write (" from " + lib) -+ -+ stream.write ("\n") -+ -+ if full: -+ self.print_frame_locals (stream, func) -+ -+ def __getattr__ (self, name): -+ return getattr (self.frame, name) -diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py -new file mode 100644 -index 0000000..b375c68 ---- /dev/null -+++ b/gdb/python/lib/gdb/__init__.py -@@ -0,0 +1,19 @@ -+# Startup code. -+ -+# Copyright (C) 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 . -+ -+# Load the require command by default. -+import gdb.command.require -diff --git a/gdb/python/lib/gdb/backtrace.py b/gdb/python/lib/gdb/backtrace.py -new file mode 100644 -index 0000000..2baab5f ---- /dev/null -+++ b/gdb/python/lib/gdb/backtrace.py -@@ -0,0 +1,42 @@ -+# Filtering backtrace. -+ -+# Copyright (C) 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 . -+ -+import gdb -+import itertools -+ -+# Our only exports. -+__all__ = ['push_frame_filter', 'create_frame_filter'] -+ -+frame_filter = None -+ -+def push_frame_filter (constructor): -+ """Register a new backtrace filter class with the 'backtrace' command. -+The filter will be passed an iterator as an argument. The iterator -+will return gdb.Frame-like objects. The filter should in turn act as -+an iterator returning such objects.""" -+ global frame_filter -+ if frame_filter == None: -+ frame_filter = constructor -+ else: -+ frame_filter = lambda iterator: constructor (frame_filter (iterator)) -+ -+def create_frame_filter (iter): -+ global frame_filter -+ if frame_filter is None: -+ return iter -+ return frame_filter (iter) -+ -diff --git a/gdb/python/lib/gdb/command/__init__.py b/gdb/python/lib/gdb/command/__init__.py -new file mode 100644 -index 0000000..8b13789 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/__init__.py -@@ -0,0 +1 @@ -+ -diff --git a/gdb/python/lib/gdb/command/alias.py b/gdb/python/lib/gdb/command/alias.py -new file mode 100644 -index 0000000..96b6618 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/alias.py -@@ -0,0 +1,59 @@ -+# Alias command. -+ -+# Copyright (C) 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 . -+ -+import gdb -+ -+class AliasImplementation (gdb.Command): -+ def __init__ (self, name, real, doc): -+ # Have to set __doc__ before the super init call. -+ # It would be nice if gdb's help looked up __doc__ dynamically. -+ self.__doc__ = doc -+ # Note: no good way to complete :( -+ super (AliasImplementation, self).__init__ (name, gdb.COMMAND_NONE) -+ self.real = real -+ -+ def invoke(self, arg, from_tty): -+ gdb.execute (self.real + ' ' + arg, from_tty) -+ -+class AliasCommand (gdb.Command): -+ """Alias one command to another. -+In the simplest form, the first word is the name of the alias, and -+the remaining words are the the expansion. -+An '=' by itself can be used to define a multi-word alias; words -+before the '=' are the name of the new command.""" -+ -+ def __init__ (self): -+ # Completion is not quite right here. -+ super (AliasCommand, self).__init__ ("alias", gdb.COMMAND_NONE, -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ self.dont_repeat () -+ # Without some form of quoting we can't alias a multi-word -+ # command to another command. -+ args = arg.split() -+ try: -+ start = args.index ('=') -+ end = start + 1 -+ except ValueError: -+ start = 1 -+ end = 1 -+ target = " ".join(args[end:]) -+ AliasImplementation (" ".join (args[0:start]), target, -+ "This command is an alias for '%s'." % target) -+ -+AliasCommand() -diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py -new file mode 100644 -index 0000000..ec9a527 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/backtrace.py -@@ -0,0 +1,106 @@ -+# New backtrace command. -+ -+# Copyright (C) 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 . -+ -+import gdb -+import gdb.backtrace -+import itertools -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+import sys -+ -+class ReverseBacktraceParameter (gdb.Parameter): -+ """The new-backtrace command can show backtraces in 'reverse' order. -+This means that the innermost frame will be printed last. -+Note that reverse backtraces are more expensive to compute.""" -+ -+ set_doc = "Enable or disable reverse backtraces." -+ show_doc = "Show whether backtraces will be printed in reverse order." -+ -+ def __init__(self): -+ gdb.Parameter.__init__ (self, "reverse-backtrace", -+ gdb.COMMAND_STACK, gdb.PARAM_BOOLEAN) -+ # Default to compatibility with gdb. -+ self.value = False -+ -+class FilteringBacktrace (gdb.Command): -+ """Print backtrace of all stack frames, or innermost COUNT frames. -+With a negative argument, print outermost -COUNT frames. -+Use of the 'full' qualifier also prints the values of the local variables. -+Use of the 'raw' qualifier avoids any filtering by loadable modules. -+""" -+ -+ def __init__ (self): -+ # FIXME: this is not working quite well enough to replace -+ # "backtrace" yet. -+ gdb.Command.__init__ (self, "new-backtrace", gdb.COMMAND_STACK) -+ self.reverse = ReverseBacktraceParameter() -+ -+ def reverse_iter (self, iter): -+ result = [] -+ for item in iter: -+ result.append (item) -+ result.reverse() -+ return result -+ -+ def final_n (self, iter, x): -+ result = [] -+ for item in iter: -+ result.append (item) -+ return result[x:] -+ -+ def invoke (self, arg, from_tty): -+ i = 0 -+ count = 0 -+ filter = True -+ full = False -+ -+ for word in arg.split (" "): -+ if word == '': -+ continue -+ elif word == 'raw': -+ filter = False -+ elif word == 'full': -+ full = True -+ else: -+ count = int (word) -+ -+ # FIXME: provide option to start at selected frame -+ # However, should still number as if starting from newest -+ newest_frame = gdb.selected_thread ().newest_frame () -+ iter = itertools.imap (FrameWrapper, -+ FrameIterator (newest_frame)) -+ if filter: -+ iter = gdb.backtrace.create_frame_filter (iter) -+ -+ # Now wrap in an iterator that numbers the frames. -+ iter = itertools.izip (itertools.count (0), iter) -+ -+ # Reverse if the user wanted that. -+ if self.reverse.value: -+ iter = self.reverse_iter (iter) -+ -+ # Extract sub-range user wants. -+ if count < 0: -+ iter = self.final_n (iter, count) -+ elif count > 0: -+ iter = itertools.islice (iter, 0, count) -+ -+ for pair in iter: -+ sys.stdout.write ("#%-2d" % pair[0]) -+ pair[1].describe (sys.stdout, full) -+ -+FilteringBacktrace() -diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py -new file mode 100644 -index 0000000..6fa48ff ---- /dev/null -+++ b/gdb/python/lib/gdb/command/ignore_errors.py -@@ -0,0 +1,37 @@ -+# Ignore errors in user commands. -+ -+# Copyright (C) 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 . -+ -+import gdb -+ -+class IgnoreErrorsCommand (gdb.Command): -+ """Execute a single command, ignoring all errors. -+Only one-line commands are supported. -+This is primarily useful in scripts.""" -+ -+ def __init__ (self): -+ super (IgnoreErrorsCommand, self).__init__ ("ignore-errors", -+ gdb.COMMAND_OBSCURE, -+ # FIXME... -+ gdb.COMPLETE_COMMAND) -+ -+ def invoke (self, arg, from_tty): -+ try: -+ gdb.execute (arg, from_tty) -+ except: -+ pass -+ -+IgnoreErrorsCommand () -diff --git a/gdb/python/lib/gdb/command/pahole.py b/gdb/python/lib/gdb/command/pahole.py -new file mode 100644 -index 0000000..21a0bf0 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/pahole.py -@@ -0,0 +1,75 @@ -+# pahole command for gdb -+ -+# Copyright (C) 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 . -+ -+import gdb -+ -+class Pahole (gdb.Command): -+ """Show the holes in a structure. -+This command takes a single argument, a type name. -+It prints the type and displays comments showing where holes are.""" -+ -+ def __init__ (self): -+ super (Pahole, self).__init__ ("pahole", gdb.COMMAND_NONE, -+ gdb.COMPLETE_SYMBOL) -+ -+ def pahole (self, type, level, name): -+ if name is None: -+ name = '' -+ tag = type.tag -+ if tag is None: -+ tag = '' -+ print '%sstruct %s {' % (' ' * (2 * level), tag) -+ bitpos = 0 -+ for field in type.fields (): -+ # Skip static fields. -+ if not hasattr (field, ('bitpos')): -+ continue -+ -+ ftype = field.type.strip_typedefs() -+ -+ if bitpos != field.bitpos: -+ hole = field.bitpos - bitpos -+ print ' /* XXX %d bit hole, try to pack */' % hole -+ bitpos = field.bitpos -+ if field.bitsize > 0: -+ fieldsize = field.bitsize -+ else: -+ # TARGET_CHAR_BIT here... -+ fieldsize = 8 * ftype.sizeof -+ -+ # TARGET_CHAR_BIT -+ print ' /* %3d %3d */' % (int (bitpos / 8), int (fieldsize / 8)), -+ bitpos = bitpos + fieldsize -+ -+ if ftype.code == gdb.TYPE_CODE_STRUCT: -+ self.pahole (ftype, level + 1, field.name) -+ else: -+ print ' ' * (2 + 2 * level), -+ print '%s %s' % (str (ftype), field.name) -+ -+ print ' ' * (14 + 2 * level), -+ print '} %s' % name -+ -+ def invoke (self, arg, from_tty): -+ type = gdb.lookup_type (arg) -+ type = type.strip_typedefs () -+ if type.code != gdb.TYPE_CODE_STRUCT: -+ raise TypeError, '%s is not a struct type' % arg -+ print ' ' * 14, -+ self.pahole (type, 0, '') -+ -+Pahole() -diff --git a/gdb/python/lib/gdb/command/require.py b/gdb/python/lib/gdb/command/require.py -new file mode 100644 -index 0000000..1fbc1e8 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/require.py -@@ -0,0 +1,57 @@ -+# Demand-loading commands. -+ -+# Copyright (C) 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 . -+ -+import gdb -+import os -+ -+class RequireCommand (gdb.Command): -+ """Prefix command for requiring features.""" -+ -+ def __init__ (self): -+ super (RequireCommand, self).__init__ ("require", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_NONE, -+ True) -+ -+class RequireSubcommand (gdb.Command): -+ """Demand-load a command by name.""" -+ -+ def __init__ (self, name): -+ self.__doc__ = "Demand-load a %s by name." % name -+ super (RequireSubcommand, self).__init__ ("require %s" % name, -+ gdb.COMMAND_SUPPORT) -+ self.name = name -+ -+ def invoke (self, arg, from_tty): -+ for cmd in arg.split(): -+ exec ('import gdb.' + self.name + '.' + cmd, globals ()) -+ -+ def complete (self, text, word): -+ dir = gdb.pythondir + '/gdb/' + self.name -+ result = [] -+ for file in os.listdir(dir): -+ if not file.startswith (word) or not file.endswith ('.py'): -+ continue -+ feature = file[0:-3] -+ if feature == 'require' or feature == '__init__': -+ continue -+ result.append (feature) -+ return result -+ -+RequireCommand() -+RequireSubcommand("command") -+RequireSubcommand("function") -diff --git a/gdb/python/lib/gdb/command/save_breakpoints.py b/gdb/python/lib/gdb/command/save_breakpoints.py -new file mode 100644 -index 0000000..6143187 ---- /dev/null -+++ b/gdb/python/lib/gdb/command/save_breakpoints.py -@@ -0,0 +1,65 @@ -+# Save breakpoints. -+ -+# Copyright (C) 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 . -+ -+from __future__ import with_statement -+import gdb -+ -+class SavePrefixCommand (gdb.Command): -+ "Prefix command for saving things." -+ -+ def __init__ (self): -+ super (SavePrefixCommand, self).__init__ ("save", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_NONE, True) -+ -+class SaveBreakpointsCommand (gdb.Command): -+ """Save the current breakpoints to a file. -+This command takes a single argument, a file name. -+The breakpoints can be restored using the 'source' command.""" -+ -+ def __init__ (self): -+ super (SaveBreakpointsCommand, self).__init__ ("save breakpoints", -+ gdb.COMMAND_SUPPORT, -+ gdb.COMPLETE_FILENAME) -+ -+ def invoke (self, arg, from_tty): -+ self.dont_repeat () -+ bps = gdb.breakpoints () -+ if bps is None: -+ raise RuntimeError, 'No breakpoints to save' -+ with open (arg.strip (), 'w') as f: -+ for bp in bps: -+ print >> f, "break", bp.location, -+ if bp.thread is not None: -+ print >> f, " thread", bp.thread, -+ if bp.condition is not None: -+ print >> f, " if", bp.condition, -+ print >> f -+ if not bp.enabled: -+ print >> f, "disable $bpnum" -+ # Note: we don't save the ignore count; there doesn't -+ # seem to be much point. -+ commands = bp.commands -+ if commands is not None: -+ print >> f, "commands" -+ # Note that COMMANDS has a trailing newline. -+ print >> f, commands, -+ print >> f, "end" -+ print >> f -+ -+SavePrefixCommand () -+SaveBreakpointsCommand () -diff --git a/gdb/python/lib/gdb/command/upto.py b/gdb/python/lib/gdb/command/upto.py -new file mode 100644 -index 0000000..faf54ed ---- /dev/null -+++ b/gdb/python/lib/gdb/command/upto.py -@@ -0,0 +1,129 @@ -+# upto command. -+ -+# Copyright (C) 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 . -+ -+import gdb -+import re -+from gdb.FrameIterator import FrameIterator -+from gdb.FrameWrapper import FrameWrapper -+ -+class UptoPrefix (gdb.Command): -+ def __init__ (self): -+ super (UptoPrefix, self).__init__ ("upto", gdb.COMMAND_STACK, -+ prefix = True) -+ -+class UptoImplementation (gdb.Command): -+ def __init__ (self, subcommand): -+ super (UptoImplementation, self).__init__ ("upto " + subcommand, -+ gdb.COMMAND_STACK) -+ -+ def search (self): -+ saved = gdb.selected_frame () -+ iter = FrameIterator (saved) -+ found = False -+ try: -+ for frame in iter: -+ frame.select () -+ try: -+ if self.filter (frame): -+ wrapper = FrameWrapper (frame) -+ wrapper.describe (sys.stdout, False) -+ return -+ except: -+ pass -+ except: -+ pass -+ saved.select () -+ raise RuntimeError, 'Could not find a matching frame' -+ -+ def invoke (self, arg, from_tty): -+ self.rx = re.compile (arg) -+ self.search () -+ -+class UptoSymbolCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on symbol. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose symbol matches the regular -+expression.""" -+ -+ def __init__ (self): -+ super (UptoSymbolCommand, self).__init__ ("symbol") -+ -+ def filter (self, frame): -+ name = frame.name () -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoSourceCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on source file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose source file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoSourceCommand, self).__init__ ("source") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoObjectCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on object file. -+The argument is a regular expression. This command moves up the -+stack, stopping at the first frame whose object file name matches the -+regular expression.""" -+ -+ def __init__ (self): -+ super (UptoObjectCommand, self).__init__ ("object") -+ -+ def filter (self, frame): -+ name = frame.find_sal ().symtab.objfile.filename -+ if name is not None: -+ if self.rx.search (name) is not None: -+ return True -+ return False -+ -+class UptoWhereCommand (UptoImplementation): -+ """Select and print some calling stack frame, based on expression. -+The argument is an expression. This command moves up the stack, -+parsing and evaluating the expression in each frame. This stops when -+the expression evaluates to a non-zero (true) value.""" -+ -+ def __init__ (self): -+ super (UptoWhereCommand, self).__init__ ("where") -+ -+ def filter (self, frame): -+ try: -+ if gdb.parse_and_eval (self.expression): -+ return True -+ except: -+ pass -+ return False -+ -+ def invoke (self, arg, from_tty): -+ self.expression = arg -+ self.search () -+ -+UptoPrefix () -+UptoSymbolCommand () -+UptoSourceCommand () -+UptoObjectCommand () -+UptoWhereCommand () -diff --git a/gdb/python/lib/gdb/function/__init__.py b/gdb/python/lib/gdb/function/__init__.py -new file mode 100644 -index 0000000..8b13789 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/__init__.py -@@ -0,0 +1 @@ -+ -diff --git a/gdb/python/lib/gdb/function/caller_is.py b/gdb/python/lib/gdb/function/caller_is.py -new file mode 100644 -index 0000000..2b9c5c7 ---- /dev/null -+++ b/gdb/python/lib/gdb/function/caller_is.py -@@ -0,0 +1,58 @@ -+# Caller-is functions. -+ -+# Copyright (C) 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 . -+ -+import gdb -+import re -+ -+class CallerIs (gdb.Function): -+ """Return True if the calling function's name is equal to a string. -+This function takes one or two arguments. -+The first argument is the name of a function; if the calling function's -+name is equal to this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerIs, self).__init__ ("caller_is") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return frame.name () == name.string () -+ -+class CallerMatches (gdb.Function): -+ """Return True if the calling function's name matches a string. -+This function takes one or two arguments. -+The first argument is a regular expression; if the calling function's -+name is matched by this argument, this function returns True. -+The optional second argument tells this function how many stack frames -+to traverse to find the calling function. The default is 1.""" -+ -+ def __init__ (self): -+ super (CallerMatches, self).__init__ ("caller_matches") -+ -+ def invoke (self, name, nframes = 1): -+ frame = gdb.selected_frame () -+ while nframes > 0: -+ frame = frame.older () -+ nframes = nframes - 1 -+ return re.match (name.string (), frame.name ()) is not None -+ -+CallerIs() -+CallerMatches() -diff --git a/gdb/python/lib/gdb/function/in_scope.py b/gdb/python/lib/gdb/function/in_scope.py -new file mode 100644 -index 0000000..debb3bb ---- /dev/null -+++ b/gdb/python/lib/gdb/function/in_scope.py -@@ -0,0 +1,47 @@ -+# In-scope function. -+ -+# Copyright (C) 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 . -+ -+import gdb -+ -+class InScope (gdb.Function): -+ """Return True if all the given variables or macros are in scope. -+Takes one argument for each variable name to be checked.""" -+ -+ def __init__ (self): -+ super (InScope, self).__init__ ("in_scope") -+ -+ def invoke (self, *vars): -+ if len (vars) == 0: -+ raise TypeError, "in_scope takes at least one argument" -+ -+ # gdb.Value isn't hashable so it can't be put in a map. -+ # Convert to string first. -+ wanted = set (map (lambda x: x.string (), vars)) -+ found = set () -+ block = gdb.selected_frame ().block () -+ while block: -+ for sym in block: -+ if (sym.is_argument or sym.is_constant -+ or sym.is_function or sym.is_variable): -+ if sym.name in wanted: -+ found.add (sym.name) -+ -+ block = block.superblock -+ -+ return wanted == found -+ -+InScope () -diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c -index 2cff4ba..9255336 100644 ---- 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])) - --/* A gdb command. For the time being only ordinary commands (not -- set/show commands) are allowed. */ -+/* A gdb command. */ - struct cmdpy_object - { - PyObject_HEAD -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/py-hooks.c -@@ -0,0 +1,50 @@ -+/* Notifications from gdb to Python -+ -+ Copyright (C) 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 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "cli/cli-decode.h" -+#include "charset.h" -+#include "python.h" -+#include "python-internal.h" -+#include "observer.h" -+ -+PyObject * -+gdbpy_get_hook_function (const char *name) -+{ -+ PyObject *hooks; -+ PyObject *result; -+ -+ if (! PyObject_HasAttrString (gdb_module, "hooks")) -+ return NULL; -+ hooks = PyObject_GetAttrString (gdb_module, "hooks"); -+ if (! hooks) -+ return NULL; -+ /* The cast is because the Python function doesn't declare const argument. -+ This is a problem in Python version 2.4, but not in 2.5. */ -+ if (! PyObject_HasAttrString (hooks, (char *) name)) -+ { -+ Py_DECREF (hooks); -+ return NULL; -+ } -+ /* The cast is because the Python function doesn't declare const argument. -+ This is a problem in Python version 2.4, but not in 2.5. */ -+ result = PyObject_GetAttrString (hooks, (char *) name); -+ Py_DECREF (hooks); -+ return result; -+} -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/py-membuf.c -@@ -0,0 +1,268 @@ -+/* Python interface to the inferior memory. -+ -+ Copyright (C) 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 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "exceptions.h" -+#include "gdbcore.h" -+#include "python-internal.h" -+ -+typedef struct { -+ PyObject_HEAD -+ void *buffer; -+ -+ /* These are kept just for mbpy_str. */ -+ CORE_ADDR addr; -+ CORE_ADDR length; -+} membuf_object; -+ -+static PyTypeObject membuf_object_type; -+ -+/* Implementation of gdb.read_memory (address, length). -+ Returns a Python buffer object with LENGTH bytes of the inferior's memory -+ at ADDRESS. Both arguments are integers. */ -+ -+PyObject * -+gdbpy_read_memory (PyObject *self, PyObject *args) -+{ -+ int error = 0; -+ CORE_ADDR addr, length; -+ void *buffer = NULL; -+ membuf_object *membuf_obj; -+ PyObject *addr_obj, *length_obj; -+ struct cleanup *cleanups = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "OO", &addr_obj, &length_obj)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr) -+ || !get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ buffer = xmalloc (length); -+ cleanups = make_cleanup (xfree, buffer); -+ -+ read_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ return NULL; -+ -+ discard_cleanups (cleanups); -+ -+ membuf_obj = PyObject_New (membuf_object, &membuf_object_type); -+ if (membuf_obj == NULL) -+ { -+ xfree (buffer); -+ PyErr_SetString (PyExc_MemoryError, -+ "Could not allocate memory buffer object."); -+ return NULL; -+ } -+ -+ membuf_obj->buffer = buffer; -+ membuf_obj->addr = addr; -+ membuf_obj->length = length; -+ -+ return PyBuffer_FromReadWriteObject ((PyObject *) membuf_obj, 0, -+ Py_END_OF_BUFFER); -+} -+ -+/* Implementation of gdb.write_memory (address, buffer [, length]). -+ Writes the contents of BUFFER (a Python object supporting the read buffer -+ protocol) at ADDRESS in the inferior's memory. Write LENGTH bytes from -+ BUFFER, or its entire contents if the argument is not provided. The -+ function returns nothing. */ -+ -+PyObject * -+gdbpy_write_memory (PyObject *self, PyObject *args) -+{ -+ int buf_len, error = 0; -+ const char *buffer; -+ CORE_ADDR addr, length; -+ PyObject *addr_obj, *length_obj = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "Os#|O", &addr_obj, &buffer, &buf_len, -+ &length_obj)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (!get_addr_from_python (addr_obj, &addr)) -+ { -+ error = 1; -+ break; -+ } -+ -+ if (!length_obj) -+ length = buf_len; -+ else if (!get_addr_from_python (length_obj, &length)) -+ { -+ error = 1; -+ break; -+ } -+ -+ write_memory (addr, buffer, length); -+ } -+ GDB_PY_HANDLE_EXCEPTION (except); -+ -+ if (error) -+ return NULL; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Destructor of Membuf objects. */ -+ -+static void -+mbpy_dealloc (PyObject *self) -+{ -+ xfree (((membuf_object *) self)->buffer); -+ self->ob_type->tp_free (self); -+} -+ -+/* Return a description of the Membuf object. */ -+ -+static PyObject * -+mbpy_str (PyObject *self) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ return PyString_FromFormat ("memory buffer for address %s, %s bytes long", -+ paddress (membuf_obj->addr), -+ pulongest (membuf_obj->length)); -+} -+ -+static Py_ssize_t -+get_read_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ membuf_object *membuf_obj = (membuf_object *) self; -+ -+ if (segment) -+ { -+ PyErr_SetString (PyExc_SystemError, -+ "The memory buffer supports only one segment."); -+ return -1; -+ } -+ -+ *ptrptr = membuf_obj->buffer; -+ -+ return membuf_obj->length; -+} -+ -+static Py_ssize_t -+get_write_buffer (PyObject *self, Py_ssize_t segment, void **ptrptr) -+{ -+ return get_read_buffer (self, segment, ptrptr); -+} -+ -+static Py_ssize_t -+get_seg_count (PyObject *self, Py_ssize_t *lenp) -+{ -+ if (lenp) -+ *lenp = ((membuf_object *) self)->length; -+ -+ return 1; -+} -+ -+static Py_ssize_t -+get_char_buffer (PyObject *self, Py_ssize_t segment, char **ptrptr) -+{ -+ void *ptr = NULL; -+ Py_ssize_t ret; -+ -+ ret = get_read_buffer (self, segment, &ptr); -+ *ptrptr = (char *) ptr; -+ -+ return ret; -+} -+ -+/* Python doesn't provide a decent way to get compatibility here. */ -+#if HAVE_LIBPYTHON2_4 -+#define CHARBUFFERPROC_NAME getcharbufferproc -+#else -+#define CHARBUFFERPROC_NAME charbufferproc -+#endif -+ -+static PyBufferProcs buffer_procs = { -+ get_read_buffer, -+ get_write_buffer, -+ get_seg_count, -+ /* The cast here works around a difference between Python 2.4 and -+ Python 2.5. */ -+ (CHARBUFFERPROC_NAME) get_char_buffer -+}; -+ -+static PyTypeObject membuf_object_type = { -+ PyObject_HEAD_INIT (NULL) -+ 0, /*ob_size*/ -+ "gdb.Membuf", /*tp_name*/ -+ sizeof (membuf_object), /*tp_basicsize*/ -+ 0, /*tp_itemsize*/ -+ mbpy_dealloc, /*tp_dealloc*/ -+ 0, /*tp_print*/ -+ 0, /*tp_getattr*/ -+ 0, /*tp_setattr*/ -+ 0, /*tp_compare*/ -+ 0, /*tp_repr*/ -+ 0, /*tp_as_number*/ -+ 0, /*tp_as_sequence*/ -+ 0, /*tp_as_mapping*/ -+ 0, /*tp_hash */ -+ 0, /*tp_call*/ -+ mbpy_str, /*tp_str*/ -+ 0, /*tp_getattro*/ -+ 0, /*tp_setattro*/ -+ &buffer_procs, /*tp_as_buffer*/ -+ Py_TPFLAGS_DEFAULT, /*tp_flags*/ -+ "GDB memory buffer object", /*tp_doc*/ -+ 0, /* tp_traverse */ -+ 0, /* tp_clear */ -+ 0, /* tp_richcompare */ -+ 0, /* tp_weaklistoffset */ -+ 0, /* tp_iter */ -+ 0, /* tp_iternext */ -+ 0, /* tp_methods */ -+ 0, /* tp_members */ -+ 0, /* tp_getset */ -+ 0, /* tp_base */ -+ 0, /* tp_dict */ -+ 0, /* tp_descr_get */ -+ 0, /* tp_descr_set */ -+ 0, /* tp_dictoffset */ -+ 0, /* tp_init */ -+ 0, /* tp_alloc */ -+ PyType_GenericNew /* tp_new */ -+}; -+ -+void -+gdbpy_initialize_membuf (void) -+{ -+ if (PyType_Ready (&membuf_object_type) < 0) -+ return; -+ -+ Py_INCREF (&membuf_object_type); -+ PyModule_AddObject (gdb_module, "Membuf", (PyObject *) &membuf_object_type); -+} -diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c -index 434c8a5..b22c557 100644 ---- a/gdb/python/py-prettyprint.c -+++ b/gdb/python/py-prettyprint.c -@@ -204,10 +204,10 @@ pretty_print_one_value (PyObject *printer, struct value **out_value) - && result != Py_None) - { - *out_value = convert_value_from_python (result); -- if (PyErr_Occurred ()) -- *out_value = NULL; -- Py_DECREF (result); -- result = NULL; -+ if (PyErr_Occurred ()) -+ *out_value = NULL; -+ Py_DECREF (result); -+ result = NULL; - } - } - } -@@ -700,14 +700,7 @@ gdbpy_get_varobj_pretty_printer (struct value *value) - { - PyObject *val_obj; - PyObject *pretty_printer = NULL; -- 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; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c -index b901255..4ff18e5 100644 +index 8232436..e9fc8aa 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c -@@ -27,6 +27,8 @@ - #include "demangle.h" - #include "objfiles.h" +@@ -29,6 +29,8 @@ #include "language.h" + #include "vec.h" + #include "bcache.h" +#include "observer.h" +#include "gdb_assert.h" typedef struct pyty_type_object { -@@ -35,11 +37,17 @@ typedef struct pyty_type_object +@@ -37,11 +39,17 @@ typedef struct pyty_type_object /* If a Type object is associated with an objfile, it is kept on a doubly-linked list, rooted in the objfile. This lets us copy the @@ -10066,7 +4984,7 @@ index b901255..4ff18e5 100644 static PyTypeObject type_object_type; /* A Field object. */ -@@ -618,8 +626,59 @@ typy_str (PyObject *self) +@@ -919,8 +927,59 @@ typy_richcompare (PyObject *self, PyObject *other, int op) @@ -10126,7 +5044,7 @@ index b901255..4ff18e5 100644 static void save_objfile_types (struct objfile *objfile, void *datum) { -@@ -637,12 +696,13 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -938,12 +997,13 @@ save_objfile_types (struct objfile *objfile, void *datum) { type_object *next = obj->next; @@ -10144,7 +5062,7 @@ index b901255..4ff18e5 100644 obj = next; } -@@ -653,42 +713,25 @@ save_objfile_types (struct objfile *objfile, void *datum) +@@ -954,42 +1014,25 @@ save_objfile_types (struct objfile *objfile, void *datum) } static void @@ -10199,7 +5117,7 @@ index b901255..4ff18e5 100644 } /* Create a new Type referring to TYPE. */ -@@ -699,7 +742,10 @@ type_to_type_object (struct type *type) +@@ -1000,7 +1043,10 @@ type_to_type_object (struct type *type) type_obj = PyObject_New (type_object, &type_object_type); if (type_obj) @@ -10211,7 +5129,7 @@ index b901255..4ff18e5 100644 return (PyObject *) type_obj; } -@@ -773,6 +819,8 @@ gdbpy_initialize_types (void) +@@ -1074,6 +1120,8 @@ gdbpy_initialize_types (void) Py_INCREF (&field_object_type); PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type); @@ -10221,18 +5139,18 @@ index b901255..4ff18e5 100644 diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c -index 2024021..e8be12d 100644 +index 4445655..8b06fd8 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" +@@ -28,6 +28,7 @@ + #include "infcall.h" + #include "expression.h" + #include "cp-abi.h" +#include "observer.h" #ifdef HAVE_PYTHON -@@ -1067,6 +1068,17 @@ gdbpy_is_value_object (PyObject *obj) +@@ -1220,6 +1221,17 @@ gdbpy_is_value_object (PyObject *obj) return PyObject_TypeCheck (obj, &value_object_type); } @@ -10250,7 +5168,7 @@ index 2024021..e8be12d 100644 void gdbpy_initialize_values (void) { -@@ -1077,6 +1089,8 @@ gdbpy_initialize_values (void) +@@ -1230,6 +1242,8 @@ gdbpy_initialize_values (void) PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type); values_in_python = NULL; @@ -10259,445 +5177,11 @@ index 2024021..e8be12d 100644 } -diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h -index 2b8d301..0af99c8 100644 ---- a/gdb/python/python-internal.h -+++ b/gdb/python/python-internal.h -@@ -82,10 +82,11 @@ struct language_defn; - struct program_space; - - extern PyObject *gdb_module; --extern PyTypeObject value_object_type; - extern PyTypeObject block_object_type; -+extern PyTypeObject value_object_type; - extern PyTypeObject symbol_object_type; - -+/* Used in python-inferior.c. */ - typedef struct - { - PyObject_HEAD -@@ -126,6 +127,10 @@ PyObject *block_to_block_object (struct block *block, struct objfile *objfile); - PyObject *value_to_value_object (struct value *v); - PyObject *type_to_type_object (struct type *); - PyObject *frame_info_to_frame_object (struct frame_info *frame); -+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 *pspace_to_pspace_object (struct program_space *); - PyObject *pspy_get_printers (PyObject *, void *); -@@ -145,8 +150,11 @@ struct type *type_object_to_type (PyObject *obj); - struct symtab *symtab_object_to_symtab (PyObject *obj); - struct symtab_and_line *sal_object_to_symtab_and_line (PyObject *obj); - -+PyObject *gdbpy_get_hook_function (const char *); - void gdbpy_initialize_auto_load (void); -+ - 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); -@@ -154,6 +162,7 @@ void gdbpy_initialize_symbols (void); - void gdbpy_initialize_symtabs (void); - void gdbpy_initialize_blocks (void); - void gdbpy_initialize_types (void); -+void gdbpy_initialize_blocks (void); - void gdbpy_initialize_functions (void); - void gdbpy_initialize_pspace (void); - void gdbpy_initialize_objfile (void); -@@ -171,6 +180,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) \ -@@ -221,13 +236,14 @@ int gdbpy_is_value_object (PyObject *obj); - 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; - extern PyObject *gdbpy_enabled_cst; - - extern PyObject *gdbpy_gdberror_exc; -diff --git a/gdb/python/python.c b/gdb/python/python.c -index 7346fba..34708c4 100644 ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -28,6 +28,7 @@ - #include "value.h" - #include "language.h" - #include "exceptions.h" -+#include "event-loop.h" - - #include - -@@ -42,10 +43,17 @@ static int gdbpy_should_print_stack = 1; - #include "cli/cli-decode.h" - #include "charset.h" - #include "top.h" -+#include "solib.h" - #include "python-internal.h" -+#include "linespec.h" -+#include "symtab.h" -+#include "source.h" - #include "version.h" -+#include "inferior.h" -+#include "gdbthread.h" - #include "target.h" - #include "gdbthread.h" -+#include "event-top.h" - - static PyMethodDef GdbMethods[]; - -@@ -374,6 +382,105 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - Py_RETURN_NONE; - } - -+/* Implementation of gdb.solib_address (Long) -> String. -+ Returns the name of the shared library holding a given address, or None. */ -+ -+static PyObject * -+gdbpy_solib_address (PyObject *self, PyObject *args) -+{ -+ unsigned long long pc; -+ char *soname; -+ PyObject *str_obj; -+ -+ if (!PyArg_ParseTuple (args, "K", &pc)) -+ return NULL; -+ -+ soname = solib_name_from_address (current_program_space, pc); -+ if (soname) -+ str_obj = PyString_Decode (soname, strlen (soname), host_charset (), NULL); -+ else -+ { -+ str_obj = Py_None; -+ Py_INCREF (Py_None); -+ } -+ -+ return str_obj; -+} -+ -+/* A Python function which is a wrapper for decode_line_1. */ -+ -+static PyObject * -+gdbpy_decode_line (PyObject *self, PyObject *args) -+{ -+ struct symtabs_and_lines sals = { NULL, 0 }; /* Initialize to appease gcc. */ -+ struct symtab_and_line sal; -+ char *arg = NULL; -+ int free_sals = 0, i; -+ PyObject *result = NULL; -+ volatile struct gdb_exception except; -+ -+ if (! PyArg_ParseTuple (args, "|s", &arg)) -+ return NULL; -+ -+ TRY_CATCH (except, RETURN_MASK_ALL) -+ { -+ if (arg) -+ { -+ char *copy; -+ -+ arg = strdup (arg); -+ copy = arg; -+ -+ sals = decode_line_1 (©, 0, 0, 0, 0, 0); -+ free_sals = 1; -+ } -+ else -+ { -+ set_default_source_symtab_and_line (); -+ sal = get_current_source_symtab_and_line (); -+ sals.sals = &sal; -+ sals.nelts = 1; -+ } -+ } -+ if (arg) -+ xfree (arg); -+ -+ if (except.reason < 0) -+ { -+ if (free_sals) -+ xfree (sals.sals); -+ /* We know this will always throw. */ -+ GDB_PY_HANDLE_EXCEPTION (except); -+ } -+ -+ if (sals.nelts) -+ { -+ result = PyTuple_New (sals.nelts); -+ for (i = 0; i < sals.nelts; ++i) -+ { -+ PyObject *obj; -+ char *str; -+ -+ obj = symtab_and_line_to_sal_object (sals.sals[i]); -+ if (! obj) -+ { -+ Py_DECREF (result); -+ result = NULL; -+ break; -+ } -+ -+ PyTuple_SetItem (result, i, obj); -+ } -+ } -+ -+ if (free_sals) -+ xfree (sals.sals); -+ -+ if (result) -+ return result; -+ Py_RETURN_NONE; -+} -+ - /* Parse a string and evaluate it as an expression. */ - static PyObject * - gdbpy_parse_and_eval (PyObject *self, PyObject *args) -@@ -414,6 +521,114 @@ source_python_script (FILE *stream, const char *file) - - - -+/* Posting and handling events. */ -+ -+/* A single event. */ -+struct gdbpy_event -+{ -+ /* The Python event. This is just a callable object. */ -+ PyObject *event; -+ /* The next event. */ -+ struct gdbpy_event *next; -+}; -+ -+/* All pending events. */ -+static struct gdbpy_event *gdbpy_event_list; -+/* The final link of the event list. */ -+static struct gdbpy_event **gdbpy_event_list_end; -+ -+/* We use a file handler, and not an async handler, so that we can -+ wake up the main thread even when it is blocked in poll(). */ -+static int gdbpy_event_fds[2]; -+ -+/* The file handler callback. This reads from the internal pipe, and -+ then processes the Python event queue. This will always be run in -+ the main gdb thread. */ -+static void -+gdbpy_run_events (int err, gdb_client_data ignore) -+{ -+ struct cleanup *cleanup; -+ char buffer[100]; -+ int r; -+ -+ cleanup = ensure_python_env (get_current_arch (), current_language); -+ -+ /* Just read whatever is available on the fd. It is relatively -+ harmless if there are any bytes left over. */ -+ r = read (gdbpy_event_fds[0], buffer, sizeof (buffer)); -+ -+ while (gdbpy_event_list) -+ { -+ /* Dispatching the event might push a new element onto the event -+ loop, so we update here "atomically enough". */ -+ struct gdbpy_event *item = gdbpy_event_list; -+ gdbpy_event_list = gdbpy_event_list->next; -+ if (gdbpy_event_list == NULL) -+ gdbpy_event_list_end = &gdbpy_event_list; -+ -+ /* Ignore errors. */ -+ PyObject_CallObject (item->event, NULL); -+ -+ Py_DECREF (item->event); -+ xfree (item); -+ } -+ -+ do_cleanups (cleanup); -+} -+ -+/* Submit an event to the gdb thread. */ -+static PyObject * -+gdbpy_post_event (PyObject *self, PyObject *args) -+{ -+ struct gdbpy_event *event; -+ PyObject *func; -+ int wakeup; -+ -+ if (!PyArg_ParseTuple (args, "O", &func)) -+ return NULL; -+ -+ if (!PyCallable_Check (func)) -+ { -+ PyErr_SetString (PyExc_RuntimeError, "Posted event is not callable"); -+ return NULL; -+ } -+ -+ Py_INCREF (func); -+ -+ /* From here until the end of the function, we have the GIL, so we -+ can operate on our global data structures without worrying. */ -+ wakeup = gdbpy_event_list == NULL; -+ -+ event = XNEW (struct gdbpy_event); -+ event->event = func; -+ event->next = NULL; -+ *gdbpy_event_list_end = event; -+ gdbpy_event_list_end = &event->next; -+ -+ /* Wake up gdb when needed. */ -+ if (wakeup) -+ { -+ char c = 'q'; /* Anything. */ -+ if (write (gdbpy_event_fds[1], &c, 1) != 1) -+ return PyErr_SetFromErrno (PyExc_IOError); -+ } -+ -+ Py_RETURN_NONE; -+} -+ -+/* Initialize the Python event handler. */ -+static void -+gdbpy_initialize_events (void) -+{ -+ if (!pipe (gdbpy_event_fds)) -+ { -+ gdbpy_event_list_end = &gdbpy_event_list; -+ add_file_handler (gdbpy_event_fds[0], gdbpy_run_events, NULL); -+ } -+} -+ -+ -+ - /* Printing. */ - - /* A python function to write a single string using gdb's filtered -@@ -459,6 +674,53 @@ gdbpy_print_stack (void) - - /* Return the current Progspace. - There always is one. */ -+/* True if 'gdb -P' was used, false otherwise. */ -+static int running_python_script; -+ -+/* True if we are currently in a call to 'gdb.cli', false otherwise. */ -+static int in_cli; -+ -+/* Enter the command loop. */ -+ -+static PyObject * -+gdbpy_cli (PyObject *unused1, PyObject *unused2) -+{ -+ if (! running_python_script || in_cli) -+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively"); -+ -+ in_cli = 1; -+ cli_command_loop (); -+ in_cli = 0; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Set up the Python argument vector and evaluate a script. This is -+ used to implement 'gdb -P'. */ -+ -+void -+run_python_script (int argc, char **argv) -+{ -+ FILE *input; -+ -+ /* We never free this, since we plan to exit at the end. */ -+ ensure_python_env (get_current_arch (), current_language); -+ -+ running_python_script = 1; -+ PySys_SetArgv (argc - 1, argv + 1); -+ input = fopen (argv[0], "r"); -+ if (! input) -+ { -+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno)); -+ exit (1); -+ } -+ PyRun_SimpleFile (input, argv[0]); -+ fclose (input); -+ exit (0); -+} -+ -+ -+ - - static PyObject * - gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -720,6 +982,7 @@ Enables or disables printing of Python stack traces."), - gdbpy_initialize_lazy_string (); - gdbpy_initialize_thread (); - gdbpy_initialize_inferior (); -+ gdbpy_initialize_events (); - - PyRun_SimpleString ("import gdb"); - PyRun_SimpleString ("gdb.pretty_printers = []"); -@@ -787,6 +1050,8 @@ static PyMethodDef GdbMethods[] = - "Get a value from history" }, - { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS, - "Execute a gdb command" }, -+ { "cli", gdbpy_cli, METH_NOARGS, -+ "Enter the gdb CLI" }, - { "parameter", gdbpy_parameter, METH_VARARGS, - "Return a gdb parameter's value" }, - -@@ -825,11 +1090,21 @@ a boolean indicating if name is a field of the current implied argument\n\ - `this' (when the current language is object-oriented)." }, - { "block_for_pc", gdbpy_block_for_pc, METH_VARARGS, - "Return the block containing the given pc value, or None." }, -+ { "solib_address", gdbpy_solib_address, METH_VARARGS, -+ "solib_address (Long) -> String.\n\ -+Return the name of the shared library holding a given address, or None." }, -+ { "decode_line", gdbpy_decode_line, METH_VARARGS, -+ "Decode a string argument the way that 'break' or 'edit' does.\n\ -+Return a tuple holding the file name (or None) and line number (or None).\n\ -+Note: may later change to return an object." }, - { "parse_and_eval", gdbpy_parse_and_eval, METH_VARARGS, - "parse_and_eval (String) -> Value.\n\ - Parse String as an expression, evaluate it, and return the result as a Value." - }, - -+ { "post_event", gdbpy_post_event, METH_VARARGS, -+ "Post an event into gdb's event loop." }, -+ - { "target_charset", gdbpy_target_charset, METH_NOARGS, - "target_charset () -> string.\n\ - Return the name of the current target charset." }, -diff --git a/gdb/python/python.h b/gdb/python/python.h -index affd4a4..5407878 100644 ---- a/gdb/python/python.h -+++ b/gdb/python/python.h -@@ -28,6 +28,8 @@ void eval_python_from_control_command (struct command_line *); - - void source_python_script (FILE *stream, const char *file); - -+void run_python_script (int argc, char **argv); -+ - int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c -index 1f135d4..489838d 100644 +index db21360..1897d10 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1278,7 +1278,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) +@@ -1276,7 +1276,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc) && pc < info->interp_text_sect_high) || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high) @@ -10707,89 +5191,11 @@ index 1f135d4..489838d 100644 } /* Given an executable's ABFD and target, compute the entry-point -diff --git a/gdb/symfile.c b/gdb/symfile.c -index 42f7ae3..371db0d 100644 ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -1059,6 +1059,9 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - const char *name = bfd_get_filename (abfd); - const int from_tty = add_flags & SYMFILE_VERBOSE; - -+ if (readnow_symbol_files) -+ flags |= OBJF_READNOW; -+ - my_cleanups = make_cleanup_bfd_close (abfd); - - /* Give user a chance to burp if we'd be -@@ -1095,7 +1098,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, - the gdb startup command line or on a per symbol file basis. Expand - all partial symbol tables for this objfile if so. */ - -- if ((flags & OBJF_READNOW) || readnow_symbol_files) -+ if ((flags & OBJF_READNOW)) - { - if (from_tty || info_verbose) - { -@@ -1533,7 +1536,7 @@ symbol_file_command (char *args, int from_tty) - void - set_initial_language (void) - { -- char *filename; -+ const char *filename; - enum language lang = language_unknown; - - filename = find_main_filename (); -@@ -2660,7 +2663,7 @@ init_filename_language_table (void) - } - - enum language --deduce_language_from_filename (char *filename) -+deduce_language_from_filename (const char *filename) - { - int i; - char *cp; -diff --git a/gdb/symfile.h b/gdb/symfile.h -index d53c465..5815354 100644 ---- a/gdb/symfile.h -+++ b/gdb/symfile.h -@@ -171,6 +171,15 @@ struct quick_symbol_functions - int kind, const char *name, - domain_enum domain); - -+ /* This is called to expand symbol tables before looking up a -+ symbol. A backend can choose to implement this and then have its -+ `lookup_symbol' hook always return NULL, or the reverse. (It -+ doesn't make sense to implement both.) The arguments are as for -+ `lookup_symbol'. */ -+ void (*pre_expand_symtabs_matching) (struct objfile *objfile, -+ int kind, const char *name, -+ domain_enum domain); -+ - /* Print statistics about any indices loaded for OBJFILE. The - statistics should be printed to gdb_stdout. This is used for - "maint print statistics". */ -@@ -201,7 +210,7 @@ struct quick_symbol_functions - - /* Return the file name of the file holding the symbol in OBJFILE - named NAME. If no such symbol exists in OBJFILE, return NULL. */ -- char *(*find_symbol_file) (struct objfile *objfile, const char *name); -+ const char *(*find_symbol_file) (struct objfile *objfile, const char *name); - - /* This method is specific to Ada. It walks the partial symbol - tables of OBJFILE looking for a name match. WILD_MATCH and -@@ -566,6 +575,7 @@ extern struct cleanup *increment_reading_symtab (void); - - extern int dwarf2_has_info (struct objfile *); - -+extern int dwarf2_initialize_objfile (struct objfile *); - extern void dwarf2_build_psymtabs (struct objfile *); - extern void dwarf2_build_frame_info (struct objfile *); - diff --git a/gdb/symmisc.c b/gdb/symmisc.c -index 62e6b97..00dc613 100644 +index ef63216..1cc9082 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c -@@ -262,6 +262,9 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) +@@ -264,6 +264,9 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) case mst_text: ms_type = 'T'; break; @@ -10800,110 +5206,23 @@ index 62e6b97..00dc613 100644 ms_type = 'S'; break; diff --git a/gdb/symtab.c b/gdb/symtab.c -index 2c4c9e4..28f0450 100644 +index a6023b9..9d577b0 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c -@@ -1295,16 +1295,25 @@ lookup_symbol_aux_symtabs (int block_index, const char *name, - const struct block *block; - struct symtab *s; - -- ALL_PRIMARY_SYMTABS (objfile, s) -+ ALL_OBJFILES (objfile) - { -- bv = BLOCKVECTOR (s); -- block = BLOCKVECTOR_BLOCK (bv, block_index); -- sym = lookup_block_symbol (block, name, domain); -- if (sym) -- { -- block_found = block; -- return fixup_symbol_section (sym, objfile); -- } -+ if (objfile->sf) -+ objfile->sf->qf->pre_expand_symtabs_matching (objfile, -+ block_index, -+ name, domain); -+ -+ ALL_OBJFILE_SYMTABS (objfile, s) -+ if (s->primary) -+ { -+ bv = BLOCKVECTOR (s); -+ block = BLOCKVECTOR_BLOCK (bv, block_index); -+ sym = lookup_block_symbol (block, name, domain); -+ if (sym) -+ { -+ block_found = block; -+ return fixup_symbol_section (sym, objfile); -+ } -+ } - } - - return NULL; -@@ -1547,15 +1556,24 @@ basic_lookup_transparent_type (const char *name) - of the desired name as a global, then do psymtab-to-symtab - conversion on the fly and return the found symbol. */ - -- ALL_PRIMARY_SYMTABS (objfile, s) -+ ALL_OBJFILES (objfile) - { -- bv = BLOCKVECTOR (s); -- block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -- sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); -- if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) -- { -- return SYMBOL_TYPE (sym); -- } -+ if (objfile->sf) -+ objfile->sf->qf->pre_expand_symtabs_matching (objfile, -+ GLOBAL_BLOCK, -+ name, STRUCT_DOMAIN); -+ -+ ALL_OBJFILE_SYMTABS (objfile, s) -+ if (s->primary) -+ { -+ bv = BLOCKVECTOR (s); -+ block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); -+ sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); -+ if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) -+ { -+ return SYMBOL_TYPE (sym); -+ } -+ } - } - - ALL_OBJFILES (objfile) -@@ -1599,14 +1617,16 @@ basic_lookup_transparent_type (const char *name) - /* FIXME: What about languages without main() or specially linked - executables that have no main() ? */ - --char * -+const char * - find_main_filename (void) - { - struct objfile *objfile; -- char *result, *name = main_name (); -+ char *name = main_name (); - - ALL_OBJFILES (objfile) - { -+ const char *result; -+ - if (!objfile->sf) - continue; - result = objfile->sf->qf->find_symbol_file (objfile, name); -@@ -2914,7 +2934,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], - static enum minimal_symbol_type types3[] +@@ -2988,7 +2988,7 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], + static const enum minimal_symbol_type types3[] = {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown}; - static enum minimal_symbol_type types4[] + static const enum minimal_symbol_type types4[] - = {mst_file_bss, mst_text, mst_abs, mst_unknown}; + = {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown}; enum minimal_symbol_type ourtype; enum minimal_symbol_type ourtype2; enum minimal_symbol_type ourtype3; diff --git a/gdb/symtab.h b/gdb/symtab.h -index bedc10a..dc284e4 100644 +index a4032f8..944dd33 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h -@@ -277,6 +277,9 @@ enum minimal_symbol_type +@@ -290,6 +290,9 @@ enum minimal_symbol_type { mst_unknown = 0, /* Unknown type, the default */ mst_text, /* Generally executable instructions */ @@ -10913,7 +5232,7 @@ index bedc10a..dc284e4 100644 mst_data, /* Generally initialized data */ mst_bss, /* Generally uninitialized data */ mst_abs, /* Generally absolute (nonrelocatable) */ -@@ -917,11 +920,25 @@ extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *); +@@ -955,11 +958,25 @@ extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *); /* lookup function from address, return name, start addr and end addr */ @@ -10941,7 +5260,7 @@ index bedc10a..dc284e4 100644 /* lookup partial symbol table by address and section */ extern struct symtab *find_pc_sect_symtab_via_partial (CORE_ADDR, -@@ -996,6 +1013,8 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_name +@@ -1034,6 +1051,8 @@ extern struct minimal_symbol *lookup_minimal_symbol_by_pc_name extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR); @@ -10950,26 +5269,8 @@ index bedc10a..dc284e4 100644 extern struct minimal_symbol * lookup_minimal_symbol_and_objfile (const char *, struct objfile **); -@@ -1137,7 +1156,7 @@ extern char **make_source_files_completion_list (char *, char *); - - int matching_obj_sections (struct obj_section *, struct obj_section *); - --extern char *find_main_filename (void); -+extern const char *find_main_filename (void); - - extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *); - -@@ -1150,7 +1169,7 @@ extern void skip_prologue_sal (struct symtab_and_line *); - - extern void clear_symtab_users (void); - --extern enum language deduce_language_from_filename (char *); -+extern enum language deduce_language_from_filename (const char *); - - /* symtab.c */ - diff --git a/gdb/target.c b/gdb/target.c -index 4cabcbd..34b3b60 100644 +index 5984125..06589d4 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -123,6 +123,8 @@ static int debug_to_insert_watchpoint (CORE_ADDR, int, int, @@ -10999,7 +5300,7 @@ index 4cabcbd..34b3b60 100644 de_fault (to_stopped_by_watchpoint, (int (*) (void)) return_zero); -@@ -3440,6 +3446,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, +@@ -3570,6 +3576,19 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, return retval; } @@ -11019,7 +5320,7 @@ index 4cabcbd..34b3b60 100644 static void debug_to_terminal_init (void) { -@@ -3687,6 +3706,7 @@ setup_target_debug (void) +@@ -3817,6 +3836,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; @@ -11028,10 +5329,10 @@ index 4cabcbd..34b3b60 100644 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 3c8c017..608a742 100644 +index 7290d90..c026d76 100644 --- a/gdb/target.h +++ b/gdb/target.h -@@ -433,6 +433,7 @@ struct target_ops +@@ -445,6 +445,7 @@ struct target_ops provided with the corresponding target_* macros. */ int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); @@ -11039,7 +5340,7 @@ index 3c8c017..608a742 100644 int (*to_stopped_by_watchpoint) (void); int to_have_steppable_watchpoint; -@@ -1316,6 +1317,15 @@ extern char *normal_pid_to_str (ptid_t ptid); +@@ -1324,6 +1325,15 @@ extern char *normal_pid_to_str (ptid_t ptid); #define target_remove_watchpoint(addr, len, type, cond) \ (*current_target.to_remove_watchpoint) (addr, len, type, cond) @@ -11055,25 +5356,6 @@ index 3c8c017..608a742 100644 #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) -@@ -1369,6 +1379,18 @@ extern int target_search_memory (CORE_ADDR start_addr, - ULONGEST pattern_len, - CORE_ADDR *found_addrp); - -+/* Utility functions which can be used by search_memory implementations. */ -+ -+void allocate_pattern_buffer (char **pattern_bufp, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size); -+ -+void increase_pattern_buffer (char **pattern_bufp, char **pattern_buf_end, -+ ULONGEST *pattern_buf_size, int val_bytes); -+ -+int search_memory (CORE_ADDR *start_addr, ULONGEST *search_space_len, -+ const char *pattern_buf, ULONGEST pattern_len, -+ CORE_ADDR *found_addr); -+ - /* Tracepoint-related operations. */ - - #define target_trace_init() \ diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S new file mode 100644 index 0000000..83faaf6 @@ -12834,15 +7116,15 @@ 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.cp/gdb9593.cc b/gdb/testsuite/gdb.cp/gdb9593.cc +diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.c b/gdb/testsuite/gdb.base/watchpoint-delete.c new file mode 100644 -index 0000000..783c962 +index 0000000..031ef92 --- /dev/null -+++ b/gdb/testsuite/gdb.cp/gdb9593.cc -@@ -0,0 +1,180 @@ ++++ b/gdb/testsuite/gdb.base/watchpoint-delete.c +@@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + -+ Copyright 2008, 2009 Free Software Foundation, Inc. ++ Copyright 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by @@ -12855,178 +7137,31 @@ index 0000000..783c962 + 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 ++ along with this program. If not, see . */ + -+using namespace std; -+ -+class NextOverThrowDerivates ++void ++func (void) +{ ++ volatile int x = 0; + -+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 (...) -+ { -+ } ++ x++; /* break-here */ ++ x++; +} + -diff --git a/gdb/testsuite/gdb.cp/gdb9593.exp b/gdb/testsuite/gdb.cp/gdb9593.exp ++int ++main (void) ++{ ++ func (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp new file mode 100644 -index 0000000..3dad7ca +index 0000000..45bc650 --- /dev/null -+++ b/gdb/testsuite/gdb.cp/gdb9593.exp -@@ -0,0 +1,182 @@ -+# Copyright 2008, 2009 Free Software Foundation, Inc. ++++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp +@@ -0,0 +1,38 @@ ++# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by @@ -13041,173 +7176,29 @@ index 0000000..3dad7ca +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + ++set testfile "watchpoint-delete" ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} + -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+if { [skip_cplus_tests] } { continue } -+ -+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 ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { ++ untested ${testfile}.exp + return -1 +} + -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { -+ untested gdb9593.exp ++# It is more compatible this way. ++gdb_test_no_output "set can-use-hw-watchpoints 0" ++ ++if ![runto_main] { + 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 -+} ++# Ensure there is a parent frame to create related bp_watchpoint_scope. ++gdb_breakpoint [gdb_get_line_number "break-here"] ++gdb_continue_to_breakpoint "break-here" ".* break-here .*" + -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} ++gdb_test "watch x" {Watchpoint [0-9]+: x} + -+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" \ -+ ".*function1 ().*" \ -+ "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" ++gdb_test_no_output {delete $bpnum} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S new file mode 100644 index 0000000..7fb00ea @@ -14205,145 +8196,6 @@ index 0000000..226dc5d + h = 'h' + call foo (g, h) +end -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp -index fc8bccc..e053813 100644 ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -92,6 +92,10 @@ proc do_steps_and_nexts {} { - set description "step over ttyarg initialization" - set command "step" - } -+ -re ".*python_script = 0.*$gdb_prompt $" { -+ set description "step over python_script initialization" -+ set command "step" -+ } - -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" { - set description "next over make_command_stats_cleanup and everything it calls" - set command "next" -diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp -new file mode 100644 -index 0000000..55aa80d ---- /dev/null -+++ b/gdb/testsuite/gdb.java/jnpe.exp -@@ -0,0 +1,74 @@ -+# 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 ${testfile}.java -+set binfile ${objdir}/${subdir}/${testfile} -+if { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } { -+ untested "Couldn't compile ${srcdir}/$subdir/${srcfile}" -+ return -1 -+} -+ -+# 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" \ -+ "// break here.*" \ -+ "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. -+ setup_xfail *-*-* -+ fail "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" -+ -+# The line where we stop differ according to gcj; check just we did not already -+# execute the catch point. -+ -+gdb_test "next" \ -+ "" \ -+ "next over NPE" -+ -+gdb_breakpoint [gdb_get_line_number "catch point"] -+gdb_continue_to_breakpoint "catch point" ".*// catch point.*" -diff --git a/gdb/testsuite/gdb.java/jnpe.java b/gdb/testsuite/gdb.java/jnpe.java -new file mode 100644 -index 0000000..3524830 ---- /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"); // catch point -+ } -+ } -+} 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 @@ -14447,10 +8299,10 @@ index 0000000..f2de718 +gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42" 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 +index 0000000..c108ea5 --- /dev/null +++ b/gdb/testsuite/gdb.opt/fortran-string.exp -@@ -0,0 +1,41 @@ +@@ -0,0 +1,39 @@ +# Copyright 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -14482,13 +8334,11 @@ index 0000000..f997eec + return -1 +} + -+if ![runto MAIN__] then { ++if ![runto $srcfile:[gdb_get_line_number "s = s"]] 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'" @@ -14724,154 +8574,6 @@ index 0000000..295602d + s := 'test'#0'string'; + writeln(s); { set breakpoint 2 here } +end. -diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp -index 0f250d2..84e5038 100644 ---- a/gdb/testsuite/gdb.python/py-cmd.exp -+++ b/gdb/testsuite/gdb.python/py-cmd.exp -@@ -20,24 +20,6 @@ if $tracelevel then { - strace $tracelevel - } - --# 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 --} -- - # Start with a fresh gdb. - - gdb_exit -diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp -index e1212d3..77f44f5 100644 ---- a/gdb/testsuite/gdb.python/py-frame.exp -+++ b/gdb/testsuite/gdb.python/py-frame.exp -@@ -89,8 +89,6 @@ gdb_py_test_silent_cmd "python f0 = f1.newer ()" "get first frame" 0 - - gdb_test "python print 'result =', f0 == f1" " = False" "test equality comparison (false)" - gdb_test "python print 'result =', f0 == f0" " = True" "test equality comparison (true)" --gdb_test "python print 'result =', f0 != f1" " = True" "test inequality comparison (true)" --gdb_test "python print 'result =', f0 != f0" " = False" "test inequality comparison (false)" - gdb_test "python print 'result =', f0.is_valid ()" " = True" "test Frame.is_valid" - gdb_test "python print 'result =', f0.name ()" " = f2" "test Frame.name" - gdb_test "python print 'result =', f0.type () == gdb.NORMAL_FRAME" " = True" "test Frame.type" -@@ -105,3 +103,5 @@ gdb_test "python print 'result =', f0.read_var ('variable_which_surely_doesnt_ex - gdb_test "python print 'result =', f0.read_var ('a')" " = 1" "test Frame.read_var - success" - - 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/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp -index 38c5693..e7f0037 100644 ---- a/gdb/testsuite/gdb.python/py-function.exp -+++ b/gdb/testsuite/gdb.python/py-function.exp -@@ -20,24 +20,6 @@ if $tracelevel then { - strace $tracelevel - } - --# 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 --} -- - # Start with a fresh gdb. - - gdb_exit -diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp -index 3b2aadd..03bbf3e 100644 ---- a/gdb/testsuite/gdb.python/py-prettyprint.exp -+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp -@@ -102,6 +102,8 @@ proc run_lang_tests {lang} { - gdb_test "print estring" "\"embedded x\\\\201\\\\202\\\\203\\\\204\"" - gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" - -+ gdb_test "print nullstr" "RuntimeError: Error reading string from inferior.*" -+ - gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}" - gdb_test "continue" "Program exited normally\." - -diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp -index a24bc11..e3043bc 100644 ---- a/gdb/testsuite/gdb.python/py-value.exp -+++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -313,6 +313,15 @@ proc test_value_after_death {} { - "print value's type" - } - -+# Regression test for a cast failure. The bug was that if we cast a -+# value to its own type, gdb could crash. This happened because we -+# could end up double-freeing a struct value. -+proc test_cast_regression {} { -+ gdb_test "python v = gdb.Value(5)" "" "create value for cast test" -+ gdb_test "python v = v.cast(v.type)" "" "cast value for cast test" -+ gdb_test "python print v" "5" "print value for cast test" -+} -+ - # Regression test for invalid subscript operations. The bug was that - # the type of the value was not being checked before allowing a - # subscript operation to proceed. -@@ -437,6 +446,7 @@ if ![runto_main] then { - test_value_in_inferior - test_lazy_strings - 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/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp -new file mode 100644 -index 0000000..70319ff ---- /dev/null -+++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp -@@ -0,0 +1,24 @@ -+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# https://bugzilla.redhat.com/show_bug.cgi?id=634108 -+ -+gdb_exit -+gdb_start -+ -+# Skip all tests if Python scripting is not enabled. -+if { [skip_python_tests] } { continue } -+ -+gdb_test "python print gdb.solib_address(-1)" "None" "gdb.solib_address exists" 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 @@ -15415,20 +9117,8 @@ index 0000000..1dc93ab +if {[istarget "*-*-linux*"]} { + test child FOLLOW_CHILD +} -diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 20e2fb7..b27d25c 100644 ---- a/gdb/testsuite/lib/gdb.exp -+++ b/gdb/testsuite/lib/gdb.exp -@@ -27,6 +27,7 @@ if {$tool == ""} { - } - - load_lib libgloss.exp -+load_lib python-support.exp - - global GDB - diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp -index 9691bc1..13ea8b5 100644 +index af0b00d..e1a8dc4 100644 --- a/gdb/testsuite/lib/pascal.exp +++ b/gdb/testsuite/lib/pascal.exp @@ -37,6 +37,9 @@ proc pascal_init {} { @@ -15462,104 +9152,11 @@ index 9691bc1..13ea8b5 100644 } set pascal_init_done 1 } -diff --git a/gdb/testsuite/lib/python-support.exp b/gdb/testsuite/lib/python-support.exp -new file mode 100644 -index 0000000..b8e9836 ---- /dev/null -+++ b/gdb/testsuite/lib/python-support.exp -@@ -0,0 +1,53 @@ -+global python_supported_saved -+ -+# Return 1 if Python scripting is supported in GDB, 0 if not. -+proc python_supported { } { -+ global gdb_prompt -+ global python_supported_saved -+ -+ if [info exists python_supported_saved] { -+ verbose "python_supported: returning saved $python_supported_saved" 2 -+ return $python_supported_saved -+ } -+ -+ gdb_test_multiple "python print 'hello, world!'" "verify python support" { -+ -re "not supported.*$gdb_prompt $" { -+ return [set python_supported_saved 0] -+ } -+ -re "$gdb_prompt $" { -+ return [set python_supported_saved 1] -+ } -+ } -+ -+ return [set python_supported_saved 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 } } -+ } -+} -+ -+# 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 -+} -diff --git a/gdb/thread.c b/gdb/thread.c -index 0b291ba..ae3e4ff 100644 ---- a/gdb/thread.c -+++ b/gdb/thread.c -@@ -90,6 +90,16 @@ delete_step_resume_breakpoint (struct thread_info *tp) - } - } - -+void -+delete_exception_resume_breakpoint (struct thread_info *tp) -+{ -+ if (tp && tp->exception_resume_breakpoint) -+ { -+ delete_breakpoint (tp->exception_resume_breakpoint); -+ tp->exception_resume_breakpoint = NULL; -+ } -+} -+ - static void - clear_thread_inferior_resources (struct thread_info *tp) - { -@@ -103,6 +113,12 @@ clear_thread_inferior_resources (struct thread_info *tp) - tp->step_resume_breakpoint = NULL; - } - -+ if (tp->exception_resume_breakpoint) -+ { -+ tp->exception_resume_breakpoint->disposition = disp_del_at_next_stop; -+ tp->exception_resume_breakpoint = NULL; -+ } -+ - bpstat_clear (&tp->stop_bpstat); - - discard_all_intermediate_continuations_thread (tp); diff --git a/gdb/top.c b/gdb/top.c -index b29e68d..8edac70 100644 +index 6680c38..38d1cc2 100644 --- a/gdb/top.c +++ b/gdb/top.c -@@ -337,6 +337,7 @@ void +@@ -338,6 +338,7 @@ void prepare_execute_command (void) { free_all_values (); @@ -15625,7 +9222,7 @@ index ce9f551..5f9d739 100644 static void diff --git a/gdb/valarith.c b/gdb/valarith.c -index 0c40905..a781636 100644 +index 7c553d1..80be82f 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -161,12 +161,26 @@ value_subscript (struct value *array, LONGEST index) @@ -15719,7 +9316,7 @@ index 0c40905..a781636 100644 } diff --git a/gdb/valops.c b/gdb/valops.c -index 7fbad10..8e32405 100644 +index 932e311..5ce565f 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -38,6 +38,7 @@ @@ -15730,7 +9327,7 @@ index 7fbad10..8e32405 100644 #include #include "gdb_string.h" -@@ -858,6 +859,65 @@ value_one (struct type *type, enum lval_type lv) +@@ -897,6 +898,65 @@ value_one (struct type *type, enum lval_type lv) return val; } @@ -15796,7 +9393,7 @@ index 7fbad10..8e32405 100644 /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack. */ static struct value * -@@ -956,15 +1016,21 @@ value_fetch_lazy (struct value *val) +@@ -995,15 +1055,21 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { @@ -15825,7 +9422,7 @@ index 7fbad10..8e32405 100644 } } else if (VALUE_LVAL (val) == lval_register) -@@ -1374,7 +1440,18 @@ address_of_variable (struct symbol *var, struct block *b) +@@ -1407,7 +1473,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) { @@ -15845,7 +9442,7 @@ index 7fbad10..8e32405 100644 return value_from_pointer (lookup_pointer_type (type), addr); } -@@ -1481,6 +1558,7 @@ struct value * +@@ -1515,6 +1592,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -15853,7 +9450,7 @@ index 7fbad10..8e32405 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 -@@ -1490,8 +1568,12 @@ value_coerce_array (struct value *arg1) +@@ -1524,8 +1602,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -15868,7 +9465,7 @@ index 7fbad10..8e32405 100644 /* Given a value which is a function, return a value which is a pointer diff --git a/gdb/valprint.c b/gdb/valprint.c -index ad6268e..fb0ef7a 100644 +index ddb16e4..c4c2969 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -36,6 +36,7 @@ @@ -15887,7 +9484,7 @@ index ad6268e..fb0ef7a 100644 case TYPE_CODE_BITSTRING: return 0; default: -@@ -1142,6 +1142,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1104,6 +1104,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, { unsigned int things_printed = 0; unsigned len; @@ -15895,10 +9492,10 @@ index ad6268e..fb0ef7a 100644 struct type *elttype, *index_type; unsigned eltlen; /* Position of the array element we are examining to see -@@ -1150,9 +1151,33 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, +@@ -1112,9 +1113,33 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, /* Number of repetitions we have detected so far. */ unsigned int reps; - LONGEST low_bound_index = 0; + LONGEST low_bound, high_bound; + struct cleanup *back_to; + CORE_ADDR saved_address = address; + @@ -15930,18 +9527,8 @@ index ad6268e..fb0ef7a 100644 + eltlen = TYPE_ARRAY_BYTE_STRIDE_VALUE (type); index_type = TYPE_INDEX_TYPE (type); - /* Compute the number of elements in the array. On most arrays, -@@ -1160,9 +1185,6 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, - is simply the size of the array divided by the size of the elements. - But for arrays of elements whose size is zero, we need to look at - the bounds. */ -- if (eltlen != 0) -- len = TYPE_LENGTH (type) / eltlen; -- else - { - LONGEST low, hi; - -@@ -1236,6 +1258,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, + if (get_array_bounds (type, &low_bound, &high_bound)) +@@ -1189,6 +1214,8 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, { fprintf_filtered (stream, "..."); } @@ -15951,7 +9538,7 @@ index ad6268e..fb0ef7a 100644 /* Read LEN bytes of target memory at address MEMADDR, placing the diff --git a/gdb/value.c b/gdb/value.c -index d552402..b10269c 100644 +index 85cb62a..013a9fc 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -39,6 +39,7 @@ @@ -15962,7 +9549,7 @@ index d552402..b10269c 100644 #include "python/python.h" -@@ -828,12 +829,15 @@ void +@@ -850,12 +851,15 @@ void set_value_component_location (struct value *component, const struct value *whole) { @@ -15978,7 +9565,7 @@ index d552402..b10269c 100644 if (whole->lval == lval_computed) { struct lval_funcs *funcs = whole->location.computed.funcs; -@@ -841,6 +845,12 @@ set_value_component_location (struct value *component, +@@ -863,6 +867,12 @@ set_value_component_location (struct value *component, if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -15991,7 +9578,7 @@ index d552402..b10269c 100644 } -@@ -973,6 +983,29 @@ show_values (char *num_exp, int from_tty) +@@ -995,6 +1005,29 @@ show_values (char *num_exp, int from_tty) num_exp[1] = '\0'; } } @@ -16021,7 +9608,7 @@ index d552402..b10269c 100644 /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -1451,6 +1484,40 @@ call_internal_function (struct gdbarch *gdbarch, +@@ -1473,6 +1506,40 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -16062,7 +9649,7 @@ index d552402..b10269c 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 -@@ -1498,11 +1565,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, +@@ -1520,11 +1587,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -16076,7 +9663,7 @@ index d552402..b10269c 100644 copied_types); } -@@ -1517,13 +1583,13 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, +@@ -1539,13 +1605,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 @@ -16092,7 +9679,7 @@ index d552402..b10269c 100644 break; case INTERNALVAR_VALUE: -@@ -2387,7 +2453,24 @@ value_from_decfloat (struct type *type, const gdb_byte *dec) +@@ -2399,7 +2465,24 @@ value_from_decfloat (struct type *type, const gdb_byte *dec) struct value * coerce_ref (struct value *arg) { @@ -16118,7 +9705,7 @@ index d552402..b10269c 100644 if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF) arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp), -@@ -2485,4 +2568,8 @@ VARIABLE is already initialized.")); +@@ -2497,4 +2580,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); @@ -16128,10 +9715,10 @@ index d552402..b10269c 100644 + observer_attach_mark_used (value_types_mark_used); } diff --git a/gdb/value.h b/gdb/value.h -index 12cbc0a..a508bf6 100644 +index ef2cb4f..ac99a4b 100644 --- a/gdb/value.h +++ b/gdb/value.h -@@ -372,6 +372,10 @@ extern struct value *value_from_double (struct type *type, DOUBLEST num); +@@ -373,6 +373,10 @@ extern struct value *value_from_double (struct type *type, DOUBLEST num); extern struct value *value_from_decfloat (struct type *type, const gdb_byte *decbytes); @@ -16142,7 +9729,7 @@ index 12cbc0a..a508bf6 100644 extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); -@@ -729,7 +733,7 @@ extern struct value *value_allocate_space_in_inferior (int); +@@ -733,7 +737,7 @@ extern struct value *value_allocate_space_in_inferior (int); extern struct value *value_of_local (const char *name, int complain); extern struct value *value_subscripted_rvalue (struct value *array, @@ -16152,7 +9739,7 @@ index 12cbc0a..a508bf6 100644 /* User function handler. */ diff --git a/gdb/varobj.c b/gdb/varobj.c -index b9b8e91..a81d25c 100644 +index 25518d4..cb5d8a2 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -26,6 +26,8 @@ diff --git a/gdb-bz555076-gcore-small-height.patch b/gdb-bz555076-gcore-small-height.patch deleted file mode 100644 index acad66b..0000000 --- a/gdb-bz555076-gcore-small-height.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/gdb/gdb_gcore.sh -+++ b/gdb/gdb_gcore.sh -@@ -64,6 +64,9 @@ for pid in $* - do - # Write gdb script for pid $pid. - cat >>$tmpfile <frame when -@@ -397,6 +398,9 @@ print_children (PyObject *printer, const +@@ -511,6 +512,9 @@ print_children (PyObject *printer, const goto done; } make_cleanup_py_decref (frame); @@ -50,7 +50,7 @@ Index: gdb-7.1/gdb/python/py-prettyprint.c done_flag = 0; for (i = 0; i < options->print_max; ++i) -@@ -431,12 +435,23 @@ print_children (PyObject *printer, const +@@ -545,12 +549,23 @@ print_children (PyObject *printer, const 3. Other. Always print a ",". */ if (i == 0) { @@ -79,7 +79,7 @@ Index: gdb-7.1/gdb/python/py-prettyprint.c else if (! is_map || i % 2 == 0) fputs_filtered (pretty ? "," : ", ", stream); -@@ -465,6 +480,10 @@ print_children (PyObject *printer, const +@@ -579,6 +594,10 @@ print_children (PyObject *printer, const if (is_map && i % 2 == 0) fputs_filtered ("[", stream); @@ -90,7 +90,7 @@ Index: gdb-7.1/gdb/python/py-prettyprint.c else if (is_array) { /* We print the index, not whatever the child method -@@ -539,7 +558,12 @@ print_children (PyObject *printer, const +@@ -655,7 +674,12 @@ print_children (PyObject *printer, const fputs_filtered ("\n", stream); print_spaces_filtered (2 * recurse, stream); } @@ -104,15 +104,15 @@ Index: gdb-7.1/gdb/python/py-prettyprint.c } done: -@@ -561,6 +585,7 @@ apply_val_pretty_printer (struct type *t +@@ -678,6 +702,7 @@ apply_val_pretty_printer (struct type *t struct cleanup *cleanups; int result = 0; - int is_py_none = 0; + enum string_repr_result print_result; + struct value_print_options *options_copy; cleanups = ensure_python_env (gdbarch, language); /* Instantiate the printer. */ -@@ -582,12 +607,23 @@ apply_val_pretty_printer (struct type *t +@@ -709,9 +734,21 @@ apply_val_pretty_printer (struct type *t /* If we are printing a map, we want some special formatting. */ hint = gdbpy_get_display_hint (printer); @@ -128,21 +128,16 @@ Index: gdb-7.1/gdb/python/py-prettyprint.c make_cleanup (free_current_contents, &hint); /* Print the section */ -- is_py_none = print_string_repr (printer, hint, stream, recurse, -- options, language, gdbarch); -- print_children (printer, hint, stream, recurse, options, language, -+ is_py_none = options_copy->prettyprint_matrix ? -+ 1 : print_string_repr (printer, hint, stream, -+ recurse, options_copy, -+ language, gdbarch); -+ print_children (printer, hint, stream, recurse, options_copy, language, - is_py_none); - - result = 1; -Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc ++ if (options_copy->prettyprint_matrix) ++ print_result = string_repr_none; ++else /* Red Hat 2D matrix patch */ + print_result = print_string_repr (printer, hint, stream, recurse, + options, language, gdbarch); + if (print_result != string_repr_error) +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.cc =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc 2010-06-30 14:34:49.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.cc 2010-11-16 08:31:56.000000000 +0100 @@ -0,0 +1,43 @@ +#include +#include // /usr/include/c++/4.4.1/bits/vector.tcc @@ -187,10 +182,10 @@ Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.cc + + return 0; // break +} -Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp 2010-06-30 14:34:49.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.exp 2010-11-16 08:31:56.000000000 +0100 @@ -0,0 +1,82 @@ +#Copyright 2010 Free Software Foundation, Inc. + @@ -274,10 +269,10 @@ Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.exp +# + + -Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.py +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1/gdb/testsuite/gdb.python/pr10659.py 2010-06-30 14:34:49.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.python/pr10659.py 2010-11-16 08:31:56.000000000 +0100 @@ -0,0 +1,109 @@ +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. + @@ -388,11 +383,11 @@ Index: gdb-7.1/gdb/testsuite/gdb.python/pr10659.py +fake_pretty_printers_dict = {} + +build_libfakecxx_dictionary () -Index: gdb-7.1/gdb/valprint.c +Index: gdb-7.2.50.20101116/gdb/valprint.c =================================================================== ---- gdb-7.1.orig/gdb/valprint.c 2010-06-30 13:51:26.000000000 +0200 -+++ gdb-7.1/gdb/valprint.c 2010-06-30 14:35:41.000000000 +0200 -@@ -83,7 +83,8 @@ struct value_print_options user_print_op +--- gdb-7.2.50.20101116.orig/gdb/valprint.c 2010-11-16 07:54:00.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/valprint.c 2010-11-16 08:31:56.000000000 +0100 +@@ -85,7 +85,8 @@ struct value_print_options user_print_op 1, /* static_field_print */ 1, /* pascal_static_field_print */ 0, /* raw */ diff --git a/gdb-bz575292-delayed-physname.patch b/gdb-bz575292-delayed-physname.patch deleted file mode 100644 index e15391d..0000000 --- a/gdb-bz575292-delayed-physname.patch +++ /dev/null @@ -1,630 +0,0 @@ -Made more safe (but less effective) by using a linked list. - -Based on: - Re: [RFA] Delayed physname computation - http://sourceware.org/ml/gdb-patches/2010-05/msg00248.html - -Neither its obstack-leak.patch nor - [patch] Fix duplicate types for single DIE - http://sourceware.org/ml/gdb-patches/2010-05/msg00271.html -is needed as the linked list is used instead. - -Index: gdb-7.1.90.20100721/gdb/dwarf2read.c -=================================================================== ---- gdb-7.1.90.20100721.orig/gdb/dwarf2read.c 2010-07-22 11:59:19.000000000 +0200 -+++ gdb-7.1.90.20100721/gdb/dwarf2read.c 2010-07-22 12:00:08.000000000 +0200 -@@ -253,6 +253,28 @@ struct comp_unit_head - unsigned int first_die_offset; - }; - -+/* Type used for delaying computation of method physnames. -+ See comments for compute_delayed_physnames. */ -+struct delayed_method_info -+{ -+ struct delayed_method_info *next; -+ -+ /* The type to which the method is attached, i.e., its parent class. */ -+ struct type *type; -+ -+ /* The index of the method in the type's function fieldlists. */ -+ int fnfield_index; -+ -+ /* The index of the method in the fieldlist. */ -+ int index; -+ -+ /* The name of the DIE. */ -+ const char *name; -+ -+ /* The DIE associated with this method. */ -+ struct die_info *die; -+}; -+ - /* Internal state when decoding a particular compilation unit. */ - struct dwarf2_cu - { -@@ -331,6 +353,10 @@ struct dwarf2_cu - /* Header data from the line table, during full symbol processing. */ - struct line_header *line_header; - -+ /* A list of methods which need to have physnames computed -+ after all type information has been read. */ -+ struct delayed_method_info *method_list; -+ - /* Mark used when releasing cached dies. */ - unsigned int mark : 1; - -@@ -1239,6 +1265,9 @@ static gdb_byte *partial_read_comp_unit_ - static void init_cu_die_reader (struct die_reader_specs *reader, - struct dwarf2_cu *cu); - -+static const char *dwarf2_physname (char *name, struct die_info *die, -+ struct dwarf2_cu *cu); -+ - #if WORDS_BIGENDIAN - - /* Convert VALUE between big- and little-endian. */ -@@ -4103,6 +4132,58 @@ load_full_comp_unit (struct dwarf2_per_c - discard_cleanups (free_cu_cleanup); - } - -+/* Add a DIE to the delayed physname list. */ -+static void -+add_to_method_list (struct type *type, int fnfield_index, int index, -+ const char *name, struct die_info *die, -+ struct dwarf2_cu *cu) -+{ -+ struct delayed_method_info *mi; -+ -+ mi = xmalloc (sizeof (*mi)); -+ mi->next = cu->method_list; -+ cu->method_list = mi; -+ mi->type = type; -+ mi->fnfield_index = fnfield_index; -+ mi->index = index; -+ mi->name = name; -+ mi->die = die; -+} -+ -+/* Compute the physnames of any methods on the CU's method list. -+ -+ The computation of method physnames is delayed in order to avoid the -+ (bad) condition that one of the method's formal parameters is of an as yet -+ incomplete type. */ -+static void -+compute_delayed_physnames (struct dwarf2_cu *cu) -+{ -+ struct delayed_method_info *mi; -+ -+ for (mi = cu->method_list; mi; mi = mi->next) -+ { -+ char *physname; -+ struct fn_fieldlist *fn_flp -+ = &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index); -+ physname = (char *) dwarf2_physname ((char *) mi->name, mi->die, cu); -+ fn_flp->fn_fields[mi->index].physname = physname ? physname : ""; -+ } -+} -+ -+static void -+method_list_cleanup (void *arg) -+{ -+ struct delayed_method_info **method_list_pointer = arg; -+ -+ while (*method_list_pointer) -+ { -+ struct delayed_method_info *mi = *method_list_pointer; -+ -+ *method_list_pointer = mi->next; -+ xfree (mi); -+ } -+} -+ - /* Generate full symbol information for PST and CU, whose DIEs have - already been loaded into memory. */ - -@@ -4113,7 +4194,7 @@ process_full_comp_unit (struct dwarf2_pe - struct objfile *objfile = per_cu->objfile; - CORE_ADDR lowpc, highpc; - struct symtab *symtab; -- struct cleanup *back_to; -+ struct cleanup *back_to, *delayed_list_cleanup; - CORE_ADDR baseaddr; - - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -@@ -4123,11 +4204,22 @@ process_full_comp_unit (struct dwarf2_pe - - cu->list_in_scope = &file_symbols; - -+ /* If methods were found in the partial symbol table, we allocate one -+ big buffer to hold the entire delayed list for the CU. */ -+ delayed_list_cleanup = make_cleanup (method_list_cleanup, -+ &cu->method_list); -+ - dwarf2_find_base_address (cu->dies, cu); - - /* Do line number decoding in read_file_scope () */ - process_die (cu->dies, cu); - -+ /* Now that we have processed all the DIEs in the CU, all the types -+ should be complete, and it should now be safe to compute all of the -+ physnames. */ -+ compute_delayed_physnames (cu); -+ do_cleanups (delayed_list_cleanup); -+ - /* Some compilers don't define a DW_AT_high_pc attribute for the - compilation unit. If the DW_AT_high_pc is missing, synthesize - it, by scanning the DIE's below the compilation unit. */ -@@ -5838,7 +5930,6 @@ dwarf2_add_member_fn (struct field_info - int i; - struct fn_field *fnp; - char *fieldname; -- char *physname; - struct nextfnfield *new_fnfield; - struct type *this_type; - -@@ -5850,9 +5941,6 @@ dwarf2_add_member_fn (struct field_info - if (fieldname == NULL) - return; - -- /* Get the mangled name. */ -- physname = (char *) dwarf2_physname (fieldname, die, cu); -- - /* Look up member function name in fieldlist. */ - for (i = 0; i < fip->nfnfields; i++) - { -@@ -5878,7 +5966,7 @@ dwarf2_add_member_fn (struct field_info - flp->name = fieldname; - flp->length = 0; - flp->head = NULL; -- fip->nfnfields++; -+ i = fip->nfnfields++; - } - - /* Create a new member function field and chain it to the field list -@@ -5892,9 +5980,19 @@ dwarf2_add_member_fn (struct field_info - - /* Fill in the member function field info. */ - fnp = &new_fnfield->fnfield; -- /* The name is already allocated along with this objfile, so we don't -- need to duplicate it for the type. */ -- fnp->physname = physname ? physname : ""; -+ -+ /* Delay processing of the physname until later. */ -+ if (cu->language == language_cplus || cu->language == language_java) -+ { -+ add_to_method_list (type, i, flp->length - 1, fieldname, -+ die, cu); -+ } -+ else -+ { -+ char *physname = (char *) dwarf2_physname (fieldname, die, cu); -+ fnp->physname = physname ? physname : ""; -+ } -+ - fnp->type = alloc_type (objfile); - this_type = read_type_die (die, cu); - if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC) -@@ -5920,7 +6018,7 @@ dwarf2_add_member_fn (struct field_info - } - else - complaint (&symfile_complaints, _("member function type missing for '%s'"), -- physname); -+ dwarf2_full_name (fieldname, die, cu)); - - /* Get fcontext from DW_AT_containing_type if present. */ - if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL) -@@ -8299,7 +8397,9 @@ load_partial_dies (bfd *abfd, gdb_byte * - || last_die->tag == DW_TAG_interface_type - || last_die->tag == DW_TAG_structure_type - || last_die->tag == DW_TAG_union_type)) -- || (cu->language == language_ada -+ || ((cu->language == language_ada -+ || cu->language == language_cplus -+ || cu->language == language_java) - && (last_die->tag == DW_TAG_subprogram - || last_die->tag == DW_TAG_lexical_block)))) - { -Index: gdb-7.1.90.20100721/gdb/testsuite/gdb.dwarf2/pr11465.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1.90.20100721/gdb/testsuite/gdb.dwarf2/pr11465.S 2010-07-22 11:59:29.000000000 +0200 -@@ -0,0 +1,355 @@ -+/* Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Compiled from: -+ -+ namespace N -+ { -+ class C -+ { -+ public: -+ typedef void (*t) (C); -+ C (t) {} -+ }; -+ typedef C::t u; -+ u f; -+ C c (f); -+ }; -+ -+ int -+ main () -+ { -+ return 0; -+ } -+*/ -+ -+ .text -+_ZN1N1cE: -+ .section .debug_info -+d: -+ .long .Ldebug_info_end - 1f /* Length of CU info */ -+1: -+ .2byte 0x2 /* DWARF version number */ -+ .long .Ldebug_abbrev0 /* Abbrev offset */ -+ .byte 0x4 /* Pointer size */ -+dieb: .uleb128 0x1 /* DW_TAG_compile_unit */ -+ .long .LASF4 /* DW_AT_producer */ -+ .byte 0x4 /* DW_AT_language */ -+ .long .LASF5 /* DW_AT_name */ -+ .long .LASF6 /* DW_AT_comp_dir */ -+ .long 0x0 /* DW_AT_low_pc */ -+ .long 0x0 /* DW_AT_high_pc */ -+ .long 0x0 /* DW_AT_entry_pc */ -+die29: .uleb128 0x2 /* DW_TAG_namespace */ -+ .string "N" /* DW_AT_name */ -+die32: .uleb128 0x3 /* DW_TAG_class_type */ -+ .string "C" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_declaration */ -+die36: .uleb128 0x4 /* DW_TAG_typedef */ -+ .string "u" /* DW_AT_name */ -+ .long die7e-d /* DW_AT_type */ -+die3f: .uleb128 0x5 /* DW_TAG_variable */ -+ .string "f" /* DW_AT_name */ -+ .long .LASF0 /* DW_AT_MIPS_linkage_name */ -+ .long die36-d /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_external */ -+ .byte 0x1 /* DW_AT_declaration */ -+die4e: .uleb128 0x5 /* DW_TAG_variable */ -+ .string "c" /* DW_AT_name */ -+ .long .LASF1 /* DW_AT_MIPS_linkage_name */ -+ .long die5e-d /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_external */ -+ .byte 0x1 /* DW_AT_declaration */ -+ .byte 0x0 -+die5e: .uleb128 0x6 /* DW_TAG_class_type */ -+ .long die32-d /* DW_AT_specification */ -+ .byte 0x1 /* DW_AT_byte_size */ -+die6a: .uleb128 0x7 /* DW_TAG_subprogram */ -+ .byte 0x1 /* DW_AT_external */ -+ .string "C" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_declaration */ -+die71: .uleb128 0x8 /* DW_TAG_formal_parameter */ -+ .long die8f-d /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_artificial */ -+die77: .uleb128 0x9 /* DW_TAG_formal_parameter */ -+ .long die7e-d /* DW_AT_type */ -+ .byte 0x0 -+ .byte 0x0 -+die7e: .uleb128 0xa /* DW_TAG_pointer_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .long die84-d /* DW_AT_type */ -+die84: .uleb128 0xb /* DW_TAG_subroutine_type */ -+die89: .uleb128 0x9 /* DW_TAG_formal_parameter */ -+ .long die5e-d /* DW_AT_type */ -+ .byte 0x0 -+die8f: .uleb128 0xa /* DW_TAG_pointer_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .long die5e-d /* DW_AT_type */ -+die95: .uleb128 0xc /* DW_TAG_subprogram */ -+ .long die6a-d /* DW_AT_specification */ -+ .byte 0x2 /* DW_AT_inline */ -+die9f: .uleb128 0xd /* DW_TAG_formal_parameter */ -+ .long .LASF7 /* DW_AT_name */ -+ .long dieaf-d /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_artificial */ -+diea9: .uleb128 0x9 /* DW_TAG_formal_parameter */ -+ .long die7e-d /* DW_AT_type */ -+ .byte 0x0 -+dieaf: .uleb128 0xe /* DW_TAG_const_type */ -+ .long die8f-d /* DW_AT_type */ -+dieb4: .uleb128 0xf /* DW_TAG_subprogram */ -+ .long die95-d /* DW_AT_abstract_origin */ -+ .long _ZN1N1cE /* DW_AT_low_pc */ -+ .long _ZN1N1cE /* DW_AT_high_pc */ -+diec9: .uleb128 0x10 /* DW_TAG_subprogram */ -+ .long die9f-d /* DW_AT_abstract_origin */ -+ .byte 2f-1f /* DW_AT_location */ -+1: -+ .byte 0x50 /* DW_OP_reg0 */ -+2: -+died1: .uleb128 0x10 /* DW_TAG_formal_parameter */ -+ .long diea9-d /* DW_AT_abstract_origin */ -+ .byte 2f-1f /* DW_AT_location */ -+1: -+ .byte 0x51 /* DW_OP_reg1 */ -+2: -+ .byte 0x0 -+dieda: .uleb128 0x11 /* DW_TAG_subprogram */ -+ .byte 0x1 /* DW_AT_external */ -+ .long .LASF8 /* DW_AT_name */ -+ .long dief2-d /* DW_AT_type */ -+ .long _ZN1N1cE /* DW_AT_low_pc */ -+ .long _ZN1N1cE /* DW_AT_high_pc */ -+dief2: .uleb128 0x12 /* DW_TAG_base_type */ -+ .byte 0x4 /* DW_AT_byte_size */ -+ .byte 0x5 /* DW_AT_encoding */ -+ .string "int" /* DW_AT_name */ -+die149: .uleb128 0x16 /* DW_TAG_variable */ -+ .long die4e-d /* DW_AT_specification */ -+ .byte 0x5 /* DW_AT_location */ -+ .byte 0x3 -+ .long _ZN1N1cE -+ .byte 0x0 -+.Ldebug_info_end: -+ .section .debug_abbrev -+.Ldebug_abbrev0: -+ .uleb128 0x1 /* abbrev code*/ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x25 /* DW_AT_producer*/ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x1b /* DW_AT_comp_dir */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x52 /* DW_AT_entry_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x2 /* abbrev code */ -+ .uleb128 0x39 /* DW_TAG_namespace */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x3 /* abbrev code */ -+ .uleb128 0x2 /* DW_TAG_class_type */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x3c /* DW_AT_declaration */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x4 /* abbrev code */ -+ .uleb128 0x16 /* DW_TAG_typedef */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x5 /* abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x2007 /* DW_AT_MIPS_linkage_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x49 /* DW_AT_TYPE */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3c /* DW_AT_declaration */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x6 /* abbrev code */ -+ .uleb128 0x2 /* DW_TAG_class_type */ -+ .byte 0x1 /* DW_has_children_yes */ -+ .uleb128 0x47 /* DW_AT_specification */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x7 /* abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogra */ -+ .byte 0x1 /* DW_has_children_yes */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x3c /* DW_AT_declaration */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x8 /* abbrev code */ -+ .uleb128 0x5 /* DW_TAG_formal_parameter */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x9 /* abbrev code */ -+ .uleb128 0x5 /* DW_TAG_formal_parameter */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xa /* abbrev code */ -+ .uleb128 0xf /* DW_TAG_pointer_type */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xb /* abbrev code */ -+ .uleb128 0x15 /* DW_TAG_subroutine_type */ -+ .byte 0x1 /* DW_has_children_yes */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xc /* abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0x1 /* DW_has_children_yes */ -+ .uleb128 0x47 /* DW_AT_specification */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x20 /* DW_AT_inline */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xd /* abbrev code */ -+ .uleb128 0x5 /* DW_TAG_formal_parameter */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x34 /* DW_AT_artificial */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xe /* abbrev code */ -+ .uleb128 0x26 /* DW_TAG_const_type */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0xf /* abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0x1 /* DW_has_children_yes */ -+ .uleb128 0x31 /* DW_AT_abstract_origin */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x10 /* abbrev code */ -+ .uleb128 0x5 /* DW_TAG_formal_parameter */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x31 /* DW_AT_abstract_origin */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x11 /* abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0xe /* DW_FORM_strp */ -+ .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 */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x12 /* abbrev code */ -+ .uleb128 0x24 /* DW_TAG_base_type */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0xb /* DW_AT_byte_size */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3e /* DW_AT_encoding */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 -+ .byte 0x0 -+ .uleb128 0x16 /* abbrev code */ -+ .uleb128 0x34 /* DW_TAG_variable */ -+ .byte 0x0 /* DW_has_children_no */ -+ .uleb128 0x47 /* DW_AT_specification */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 -+ .byte 0x0 -+ .byte 0x0 -+ .section .debug_str -+.LASF0: -+ .string "_ZN1N1fE" -+.LASF7: -+ .string "this" -+.LASF6: -+ .string "" -+.LASF8: -+ .string "main" -+.LASF1: -+ .string "_ZN1N1cE" -+.LASF5: -+ .string "pr11465.cc" -+.LASF4: -+ .string "GNU C++ 4.4.2" -+ .ident "GCC: (GNU) 4.4.2" -Index: gdb-7.1.90.20100721/gdb/testsuite/gdb.dwarf2/pr11465.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1.90.20100721/gdb/testsuite/gdb.dwarf2/pr11465.exp 2010-07-22 11:59:29.000000000 +0200 -@@ -0,0 +1,39 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "pr11465" -+set srcfile ${testfile}.S -+set executable ${testfile}.x -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } { -+ return -1 -+} -+ -+clean_restart $executable -+ -+# Test delayed physname computations -+gdb_test "p N::c.C" { = {void \(N::C \*, void \(\*\)\(N::C\)\)}.*} diff --git a/gdb-bz592031-siginfo-lost-1of5.patch b/gdb-bz592031-siginfo-lost-1of5.patch deleted file mode 100644 index 16c789f..0000000 --- a/gdb-bz592031-siginfo-lost-1of5.patch +++ /dev/null @@ -1,87 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-08/msg00559.html -http://sourceware.org/ml/gdb-cvs/2010-08/msg00199.html - -### src/gdb/ChangeLog 2010/08/31 18:08:42 1.12129 -### src/gdb/ChangeLog 2010/08/31 18:11:48 1.12130 -## -1,5 +1,14 @@ - 2010-08-31 Jan Kratochvil - -+ Make linux_get_siginfo_type `type *' unique. -+ * linux-tdep.c (linux_gdbarch_data_handle, struct linux_gdbarch_data) -+ (init_linux_gdbarch_data, get_linux_gdbarch_data): New. -+ (linux_get_siginfo_type): New variable linux_gdbarch_data. Initialize -+ it. Use linux_gdbarch_data->siginfo_type as a persistent storage. -+ (_initialize_linux_tdep): New. -+ -+2010-08-31 Jan Kratochvil -+ - Code cleanup. - * defs.h (find_memory_region_ftype): New typedef. - (exec_set_find_memory_regions): Use it. -Index: gdb-7.2/gdb/linux-tdep.c -=================================================================== ---- gdb-7.2.orig/gdb/linux-tdep.c 2010-09-25 15:30:50.000000000 +0200 -+++ gdb-7.2/gdb/linux-tdep.c 2010-09-25 15:31:54.000000000 +0200 -@@ -26,18 +26,42 @@ - #include "value.h" - #include "infcall.h" - -+static struct gdbarch_data *linux_gdbarch_data_handle; -+ -+struct linux_gdbarch_data -+ { -+ struct type *siginfo_type; -+ }; -+ -+static void * -+init_linux_gdbarch_data (struct gdbarch *gdbarch) -+{ -+ return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct linux_gdbarch_data); -+} -+ -+static struct linux_gdbarch_data * -+get_linux_gdbarch_data (struct gdbarch *gdbarch) -+{ -+ return gdbarch_data (gdbarch, linux_gdbarch_data_handle); -+} -+ - /* This function is suitable for architectures that don't - extend/override the standard siginfo structure. */ - - struct type * - linux_get_siginfo_type (struct gdbarch *gdbarch) - { -+ struct linux_gdbarch_data *linux_gdbarch_data; - struct type *int_type, *uint_type, *long_type, *void_ptr_type; - struct type *uid_type, *pid_type; - struct type *sigval_type, *clock_type; - struct type *siginfo_type, *sifields_type; - struct type *type; - -+ linux_gdbarch_data = get_linux_gdbarch_data (gdbarch); -+ if (linux_gdbarch_data->siginfo_type != NULL) -+ return linux_gdbarch_data->siginfo_type; -+ - int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), - 0, "int"); - uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), -@@ -137,6 +161,8 @@ linux_get_siginfo_type (struct gdbarch * - "_sifields", sifields_type, - TYPE_LENGTH (long_type)); - -+ linux_gdbarch_data->siginfo_type = siginfo_type; -+ - return siginfo_type; - } - -@@ -154,3 +180,10 @@ linux_has_shared_address_space (void) - - return target_is_uclinux; - } -+ -+void -+_initialize_linux_tdep (void) -+{ -+ linux_gdbarch_data_handle = -+ gdbarch_data_register_post_init (init_linux_gdbarch_data); -+} diff --git a/gdb-bz592031-siginfo-lost-2of5.patch b/gdb-bz592031-siginfo-lost-2of5.patch deleted file mode 100644 index c5184e0..0000000 --- a/gdb-bz592031-siginfo-lost-2of5.patch +++ /dev/null @@ -1,139 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00430.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00152.html - -### src/gdb/ChangeLog 2010/09/24 11:15:51 1.12199 -### src/gdb/ChangeLog 2010/09/24 13:41:42 1.12200 -## -1,5 +1,12 @@ - 2010-09-24 Pedro Alves - -+ * amd64-linux-nat.c (compat_siginfo_from_siginfo) -+ (siginfo_from_compat_siginfo): Also copy si_pid and si_uid when -+ si_code is < 0. Check for si_code == SI_TIMER before checking for -+ si_code < 0. -+ -+2010-09-24 Pedro Alves -+ - * objfiles.h (ALL_OBJSECTIONS): Handle breaks in the inner loop. - - 2010-09-22 Joel Brobecker ---- src/gdb/amd64-linux-nat.c 2010/04/22 20:02:55 1.32 -+++ src/gdb/amd64-linux-nat.c 2010/09/24 13:41:43 1.33 -@@ -574,8 +574,10 @@ - to->si_errno = from->si_errno; - to->si_code = from->si_code; - -- if (to->si_code < 0) -+ if (to->si_code == SI_TIMER) - { -+ to->cpt_si_timerid = from->si_timerid; -+ to->cpt_si_overrun = from->si_overrun; - to->cpt_si_ptr = (intptr_t) from->si_ptr; - } - else if (to->si_code == SI_USER) -@@ -583,10 +585,10 @@ - to->cpt_si_pid = from->si_pid; - to->cpt_si_uid = from->si_uid; - } -- else if (to->si_code == SI_TIMER) -+ else if (to->si_code < 0) - { -- to->cpt_si_timerid = from->si_timerid; -- to->cpt_si_overrun = from->si_overrun; -+ to->cpt_si_pid = from->si_pid; -+ to->cpt_si_uid = from->si_uid; - to->cpt_si_ptr = (intptr_t) from->si_ptr; - } - else -@@ -628,8 +630,10 @@ - to->si_errno = from->si_errno; - to->si_code = from->si_code; - -- if (to->si_code < 0) -+ if (to->si_code == SI_TIMER) - { -+ to->si_timerid = from->cpt_si_timerid; -+ to->si_overrun = from->cpt_si_overrun; - to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr; - } - else if (to->si_code == SI_USER) -@@ -637,10 +641,10 @@ - to->si_pid = from->cpt_si_pid; - to->si_uid = from->cpt_si_uid; - } -- else if (to->si_code == SI_TIMER) -+ if (to->si_code < 0) - { -- to->si_timerid = from->cpt_si_timerid; -- to->si_overrun = from->cpt_si_overrun; -+ to->si_pid = from->cpt_si_pid; -+ to->si_uid = from->cpt_si_uid; - to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr; - } - else -### src/gdb/gdbserver/ChangeLog 2010/09/13 19:11:03 1.431 -### src/gdb/gdbserver/ChangeLog 2010/09/24 13:41:43 1.432 -## -1,3 +1,10 @@ -+2010-09-24 Pedro Alves -+ -+ * linux-x86-low.c (compat_siginfo_from_siginfo) -+ (siginfo_from_compat_siginfo): Also copy si_pid and si_uid when -+ si_code is < 0. Check for si_code == SI_TIMER before checking for -+ si_code < 0. -+ - 2010-09-13 Joel Brobecker - - * lynx-i386-low.c: New file. ---- src/gdb/gdbserver/linux-x86-low.c 2010/08/27 00:16:48 1.23 -+++ src/gdb/gdbserver/linux-x86-low.c 2010/09/24 13:41:43 1.24 -@@ -792,8 +792,10 @@ - to->si_errno = from->si_errno; - to->si_code = from->si_code; - -- if (to->si_code < 0) -+ if (to->si_code == SI_TIMER) - { -+ to->cpt_si_timerid = from->si_timerid; -+ to->cpt_si_overrun = from->si_overrun; - to->cpt_si_ptr = (intptr_t) from->si_ptr; - } - else if (to->si_code == SI_USER) -@@ -801,10 +803,10 @@ - to->cpt_si_pid = from->si_pid; - to->cpt_si_uid = from->si_uid; - } -- else if (to->si_code == SI_TIMER) -+ else if (to->si_code < 0) - { -- to->cpt_si_timerid = from->si_timerid; -- to->cpt_si_overrun = from->si_overrun; -+ to->cpt_si_pid = from->si_pid; -+ to->cpt_si_uid = from->si_uid; - to->cpt_si_ptr = (intptr_t) from->si_ptr; - } - else -@@ -846,8 +848,10 @@ - to->si_errno = from->si_errno; - to->si_code = from->si_code; - -- if (to->si_code < 0) -+ if (to->si_code == SI_TIMER) - { -+ to->si_timerid = from->cpt_si_timerid; -+ to->si_overrun = from->cpt_si_overrun; - to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr; - } - else if (to->si_code == SI_USER) -@@ -855,10 +859,10 @@ - to->si_pid = from->cpt_si_pid; - to->si_uid = from->cpt_si_uid; - } -- else if (to->si_code == SI_TIMER) -+ else if (to->si_code < 0) - { -- to->si_timerid = from->cpt_si_timerid; -- to->si_overrun = from->cpt_si_overrun; -+ to->si_pid = from->cpt_si_pid; -+ to->si_uid = from->cpt_si_uid; - to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr; - } - else diff --git a/gdb-bz592031-siginfo-lost-3of5.patch b/gdb-bz592031-siginfo-lost-3of5.patch deleted file mode 100644 index e45c83d..0000000 --- a/gdb-bz592031-siginfo-lost-3of5.patch +++ /dev/null @@ -1,259 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00438.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00156.html - -### src/gdb/ChangeLog 2010/09/24 16:11:44 1.12203 -### src/gdb/ChangeLog 2010/09/24 18:35:20 1.12204 -## -1,3 +1,16 @@ -+2010-09-24 Jan Kratochvil -+ -+ Fix lost siginfo_t for inferior calls. -+ * infrun.c -+ (struct inferior_thread_state) : New. -+ (save_inferior_thread_state): New variables regcache, gdbarch and -+ siginfo_data. Initialize SIGINFO_DATA if gdbarch_get_siginfo_type_p. -+ Move INF_STATE allocation later, pre-clear it. Initialize REGISTERS -+ using REGCACHE. -+ (restore_inferior_thread_state): New variables regcache and gdbarch. -+ Restore SIGINFO_DATA for matching GDBARCH. Restore REGISTERS using -+ REGCACHE. Free also SIGINFO_DATA. -+ - 2010-09-24 Tom Tromey - - * dwarf2read.c (dw2_expand_symtabs_matching): Add missing ---- src/gdb/infrun.c 2010/09/06 14:22:07 1.450 -+++ src/gdb/infrun.c 2010/09/24 18:35:27 1.451 -@@ -6037,18 +6037,57 @@ - enum target_signal stop_signal; - CORE_ADDR stop_pc; - struct regcache *registers; -+ -+ /* Format of SIGINFO or NULL if it is not present. */ -+ struct gdbarch *siginfo_gdbarch; -+ -+ /* The inferior format depends on SIGINFO_GDBARCH and it has a length of -+ TYPE_LENGTH (gdbarch_get_siginfo_type ()). For different gdbarch the -+ content would be invalid. */ -+ gdb_byte *siginfo_data; - }; - - struct inferior_thread_state * - save_inferior_thread_state (void) - { -- struct inferior_thread_state *inf_state = XMALLOC (struct inferior_thread_state); -+ struct inferior_thread_state *inf_state; - struct thread_info *tp = inferior_thread (); -+ struct regcache *regcache = get_current_regcache (); -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ gdb_byte *siginfo_data = NULL; -+ -+ if (gdbarch_get_siginfo_type_p (gdbarch)) -+ { -+ struct type *type = gdbarch_get_siginfo_type (gdbarch); -+ size_t len = TYPE_LENGTH (type); -+ struct cleanup *back_to; -+ -+ siginfo_data = xmalloc (len); -+ back_to = make_cleanup (xfree, siginfo_data); -+ -+ if (target_read (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, -+ siginfo_data, 0, len) == len) -+ discard_cleanups (back_to); -+ else -+ { -+ /* Errors ignored. */ -+ do_cleanups (back_to); -+ siginfo_data = NULL; -+ } -+ } -+ -+ inf_state = XZALLOC (struct inferior_thread_state); -+ -+ if (siginfo_data) -+ { -+ inf_state->siginfo_gdbarch = gdbarch; -+ inf_state->siginfo_data = siginfo_data; -+ } - - inf_state->stop_signal = tp->stop_signal; - inf_state->stop_pc = stop_pc; - -- inf_state->registers = regcache_dup (get_current_regcache ()); -+ inf_state->registers = regcache_dup (regcache); - - return inf_state; - } -@@ -6059,16 +6098,29 @@ - restore_inferior_thread_state (struct inferior_thread_state *inf_state) - { - struct thread_info *tp = inferior_thread (); -+ struct regcache *regcache = get_current_regcache (); -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); - - tp->stop_signal = inf_state->stop_signal; - stop_pc = inf_state->stop_pc; - -+ if (inf_state->siginfo_gdbarch == gdbarch) -+ { -+ struct type *type = gdbarch_get_siginfo_type (gdbarch); -+ size_t len = TYPE_LENGTH (type); -+ -+ /* Errors ignored. */ -+ target_write (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, -+ inf_state->siginfo_data, 0, len); -+ } -+ - /* The inferior can be gone if the user types "print exit(0)" - (and perhaps other times). */ - if (target_has_execution) - /* NB: The register write goes through to the target. */ -- regcache_cpy (get_current_regcache (), inf_state->registers); -+ regcache_cpy (regcache, inf_state->registers); - regcache_xfree (inf_state->registers); -+ xfree (inf_state->siginfo_data); - xfree (inf_state); - } - -### src/gdb/testsuite/ChangeLog 2010/09/22 20:08:04 1.2456 -### src/gdb/testsuite/ChangeLog 2010/09/24 18:35:28 1.2457 -## -1,3 +1,9 @@ -+2010-09-24 Jan Kratochvil -+ -+ Fix lost siginfo_t for inferior calls. -+ * gdb.base/siginfo-infcall.exp: New file. -+ * gdb.base/siginfo-infcall.c: New file. -+ - 2010-09-22 Joel Brobecker - - * gdb.dwarf2/dw2-const.S: Minor (space) reformatting. ---- src/gdb/testsuite/gdb.base/siginfo-infcall.c -+++ src/gdb/testsuite/gdb.base/siginfo-infcall.c 2010-09-25 13:25:25.007169000 +0000 -@@ -0,0 +1,79 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+#include -+#include -+#include -+ -+#ifndef SA_SIGINFO -+# error "SA_SIGINFO is required for this test" -+#endif -+ -+static int -+callme (void) -+{ -+ return 42; -+} -+ -+static int -+pass (void) -+{ -+ return 1; -+} -+ -+static int -+fail (void) -+{ -+ return 1; -+} -+ -+static void -+handler (int sig, siginfo_t *siginfo, void *context) -+{ -+ assert (sig == SIGUSR1); -+ assert (siginfo->si_signo == SIGUSR1); -+ if (siginfo->si_pid == getpid ()) -+ pass (); -+ else -+ fail (); -+} -+ -+int -+main (void) -+{ -+ struct sigaction sa; -+ int i; -+ -+ callme (); -+ -+ memset (&sa, 0, sizeof (sa)); -+ sa.sa_sigaction = handler; -+ sa.sa_flags = SA_SIGINFO; -+ -+ i = sigemptyset (&sa.sa_mask); -+ assert (i == 0); -+ -+ i = sigaction (SIGUSR1, &sa, NULL); -+ assert (i == 0); -+ -+ i = raise (SIGUSR1); -+ assert (i == 0); -+ -+ sleep (600); -+ return 0; -+} ---- src/gdb/testsuite/gdb.base/siginfo-infcall.exp -+++ src/gdb/testsuite/gdb.base/siginfo-infcall.exp 2010-09-25 13:25:25.357724000 +0000 -@@ -0,0 +1,47 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if [target_info exists gdb,nosignals] { -+ verbose "Skipping siginfo-infcall.exp because of nosignals." -+ continue -+} -+ -+set testfile siginfo-infcall -+set srcfile ${testfile}.c -+set executable ${testfile} -+if { [prepare_for_testing ${testfile}.exp $executable] } { -+ return -1 -+} -+ -+if ![runto_main] { -+ return -1 -+} -+ -+gdb_breakpoint "pass" -+gdb_breakpoint "fail" -+ -+gdb_test "continue" "Program received signal SIGUSR1, .*" "continue to SIGUSR1" -+ -+gdb_test "p callme ()" " = 42" -+ -+set test "continue to the handler" -+gdb_test_multiple "continue" $test { -+ -re "Breakpoint \[0-9\]+,\[^\r\n\]* pass .*\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "Breakpoint \[0-9\]+,\[^\r\n\]* fail .*\r\n$gdb_prompt $" { -+ fail $test -+ } -+} diff --git a/gdb-bz592031-siginfo-lost-4of5.patch b/gdb-bz592031-siginfo-lost-4of5.patch index a73ab33..290644c 100644 --- a/gdb-bz592031-siginfo-lost-4of5.patch +++ b/gdb-bz592031-siginfo-lost-4of5.patch @@ -78,11 +78,11 @@ gdb/testsuite/ * gdb.threads/sigstep-threads.exp: New file. * gdb.threads/sigstep-threads.c: New file. -Index: gdb-7.2/gdb/linux-nat.c +Index: gdb-7.2.50.20101116/gdb/linux-nat.c =================================================================== ---- gdb-7.2.orig/gdb/linux-nat.c 2010-09-25 15:30:54.000000000 +0200 -+++ gdb-7.2/gdb/linux-nat.c 2010-09-25 15:37:23.000000000 +0200 -@@ -2702,6 +2702,8 @@ stop_wait_callback (struct lwp_info *lp, +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 08:21:46.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 09:12:26.000000000 +0100 +@@ -2759,6 +2759,8 @@ stop_wait_callback (struct lwp_info *lp, { int status; @@ -91,11 +91,11 @@ Index: gdb-7.2/gdb/linux-nat.c status = wait_lwp (lp); if (status == 0) return 0; -@@ -2726,110 +2728,61 @@ stop_wait_callback (struct lwp_info *lp, +@@ -2783,110 +2785,61 @@ stop_wait_callback (struct lwp_info *lp, if (WSTOPSIG (status) != SIGSTOP) { -- if (WSTOPSIG (status) == SIGTRAP) +- if (linux_nat_status_is_event (status)) - { - /* If a LWP other than the LWP that we're reporting an - event for has hit a GDB breakpoint (as opposed to @@ -248,7 +248,7 @@ Index: gdb-7.2/gdb/linux-nat.c lp->signalled = 0; } } -@@ -3416,52 +3369,6 @@ retry: +@@ -3469,52 +3422,6 @@ retry: lp = NULL; } @@ -301,10 +301,10 @@ Index: gdb-7.2/gdb/linux-nat.c if (!target_can_async_p ()) { /* Causes SIGINT to be passed on to the attached process. */ -Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/siginfo-threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c 2010-09-25 15:32:32.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/siginfo-threads.c 2010-11-16 09:08:44.000000000 +0100 @@ -0,0 +1,447 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -753,10 +753,10 @@ Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.c + + return EXIT_SUCCESS; +} -Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/siginfo-threads.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp 2010-09-25 15:32:32.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/siginfo-threads.exp 2010-11-16 09:08:44.000000000 +0100 @@ -0,0 +1,94 @@ +# Copyright 2010 Free Software Foundation, Inc. + @@ -852,10 +852,10 @@ Index: gdb-7.2/gdb/testsuite/gdb.threads/siginfo-threads.exp +} + +gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*" -Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/sigstep-threads.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c 2010-09-25 15:32:32.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/sigstep-threads.c 2010-11-16 09:08:44.000000000 +0100 @@ -0,0 +1,54 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -911,10 +911,10 @@ Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.c + start (NULL); /* main-start */ + return 0; +} -Index: gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/sigstep-threads.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.threads/sigstep-threads.exp 2010-09-25 15:32:32.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/sigstep-threads.exp 2010-11-16 09:08:44.000000000 +0100 @@ -0,0 +1,74 @@ +# Copyright 2010 Free Software Foundation, Inc. + diff --git a/gdb-bz592031-siginfo-lost-5of5.patch b/gdb-bz592031-siginfo-lost-5of5.patch index 6bf93ef..b8212bb 100644 --- a/gdb-bz592031-siginfo-lost-5of5.patch +++ b/gdb-bz592031-siginfo-lost-5of5.patch @@ -26,11 +26,11 @@ gdb/ (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO. * linux-nat.h (struct lwp_info) : Remove. -Index: gdb-7.2/gdb/linux-nat.c +Index: gdb-7.2.50.20101116/gdb/linux-nat.c =================================================================== ---- gdb-7.2.orig/gdb/linux-nat.c 2010-09-25 15:37:23.000000000 +0200 -+++ gdb-7.2/gdb/linux-nat.c 2010-09-25 15:38:18.000000000 +0200 -@@ -1851,7 +1851,6 @@ resume_callback (struct lwp_info *lp, vo +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 09:12:26.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 09:13:21.000000000 +0100 +@@ -1850,7 +1850,6 @@ resume_callback (struct lwp_info *lp, vo target_pid_to_str (lp->ptid)); lp->stopped = 0; lp->step = 0; @@ -46,7 +46,7 @@ Index: gdb-7.2/gdb/linux-nat.c lp->stopped_by_watchpoint = 0; if (debug_linux_nat) -@@ -2483,22 +2481,6 @@ wait_lwp (struct lwp_info *lp) +@@ -2503,22 +2501,6 @@ wait_lwp (struct lwp_info *lp) return status; } @@ -69,7 +69,7 @@ Index: gdb-7.2/gdb/linux-nat.c /* Send a SIGSTOP to LP. */ static int -@@ -2730,9 +2712,6 @@ stop_wait_callback (struct lwp_info *lp, +@@ -2787,9 +2769,6 @@ stop_wait_callback (struct lwp_info *lp, { /* The thread was stopped with a signal other than SIGSTOP. */ @@ -79,10 +79,10 @@ Index: gdb-7.2/gdb/linux-nat.c save_sigtrap (lp); if (debug_linux_nat) -@@ -3102,12 +3081,7 @@ linux_nat_filter_event (int lwpid, int s +@@ -3155,12 +3134,7 @@ linux_nat_filter_event (int lwpid, int s } - if (WIFSTOPPED (status) && WSTOPSIG (status) == SIGTRAP) + if (linux_nat_status_is_event (status)) - { - /* Save the trap's siginfo in case we need it later. */ - save_siginfo (lp); @@ -93,7 +93,7 @@ Index: gdb-7.2/gdb/linux-nat.c /* Check if the thread has exited. */ if ((WIFEXITED (status) || WIFSIGNALED (status)) -@@ -3706,7 +3680,6 @@ resume_stopped_resumed_lwps (struct lwp_ +@@ -3763,7 +3737,6 @@ resume_stopped_resumed_lwps (struct lwp_ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), lp->step, TARGET_SIGNAL_0); lp->stopped = 0; @@ -101,7 +101,7 @@ Index: gdb-7.2/gdb/linux-nat.c lp->stopped_by_watchpoint = 0; } -@@ -5878,11 +5851,19 @@ linux_nat_set_siginfo_fixup (struct targ +@@ -5932,11 +5905,19 @@ linux_nat_set_siginfo_fixup (struct targ struct siginfo * linux_nat_get_siginfo (ptid_t ptid) { @@ -124,10 +124,10 @@ Index: gdb-7.2/gdb/linux-nat.c } /* Provide a prototype to silence -Wmissing-prototypes. */ -Index: gdb-7.2/gdb/linux-nat.h +Index: gdb-7.2.50.20101116/gdb/linux-nat.h =================================================================== ---- gdb-7.2.orig/gdb/linux-nat.h 2010-09-25 15:30:50.000000000 +0200 -+++ gdb-7.2/gdb/linux-nat.h 2010-09-25 15:37:57.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/linux-nat.h 2010-11-16 07:54:36.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/linux-nat.h 2010-11-16 09:12:44.000000000 +0100 @@ -58,10 +58,6 @@ struct lwp_info /* The kind of stepping of this LWP. */ enum resume_step step; diff --git a/gdb-bz594560-core-vs-process.patch b/gdb-bz594560-core-vs-process.patch deleted file mode 100644 index 5f7b9d4..0000000 --- a/gdb-bz594560-core-vs-process.patch +++ /dev/null @@ -1,164 +0,0 @@ ---- ./gdb/doc/gdb.texinfo 2010-05-24 19:37:01.000000000 +0200 -+++ ./gdb/doc/gdb.texinfo 2010-05-24 19:38:56.000000000 +0200 -@@ -14768,33 +14768,21 @@ and @code{show architecture}. - @cindex active targets - @cindex multiple targets - --There are three classes of targets: processes, core files, and --executable files. @value{GDBN} can work concurrently on up to three --active targets, one in each class. This allows you to (for example) --start a process and inspect its activity without abandoning your work on --a core file. -- --For example, if you execute @samp{gdb a.out}, then the executable file --@code{a.out} is the only active target. If you designate a core file as --well---presumably from a prior run that crashed and coredumped---then --@value{GDBN} has two active targets and uses them in tandem, looking --first in the corefile target, then in the executable file, to satisfy --requests for memory addresses. (Typically, these two classes of target --are complementary, since core files contain only a program's --read-write memory---variables and so on---plus machine status, while --executable files contain only the program text and initialized data.) -- --When you type @code{run}, your executable file becomes an active process --target as well. When a process target is active, all @value{GDBN} --commands requesting memory addresses refer to that target; addresses in --an active core file or executable file target are obscured while the --process target is active. -- --Use the @code{core-file} and @code{exec-file} commands to select a new --core file or executable target (@pxref{Files, ,Commands to Specify --Files}). To specify as a target a process that is already running, use --the @code{attach} command (@pxref{Attach, ,Debugging an Already-running --Process}). -+There are multiple classes of targets such as: processes, executable files or -+recording sessions. Core files belong to the process class, there can be -+active only one of a core or a running process. Otherwise @value{GDBN} can -+work concurrently on multiple active targets, one in each class. This allows -+you to (for example) start a process and inspect its activity while still -+having access to the executable file after the process finishes. Or if you -+start process recording (@pxref{Reverse Execution}) and @code{reverse-step} -+there you are presented a virtual layer of the recording target while the -+process target remains stopped at the chronologically last point of the process -+execution. -+ -+Use the @code{core-file} and @code{exec-file} commands to select a new core -+file or executable target (@pxref{Files, ,Commands to Specify Files}). To -+specify as a target a process that is already running, use the @code{attach} -+command (@pxref{Attach, ,Debugging an Already-running Process}). - - @node Target Commands - @section Commands for Managing Targets ---- ./gdb/infcmd.c 2010-05-24 19:37:01.000000000 +0200 -+++ ./gdb/infcmd.c 2010-05-24 19:41:21.000000000 +0200 -@@ -483,6 +483,13 @@ run_command_1 (char *args, int from_tty, - - dont_repeat (); - -+ if (core_bfd) -+ { -+ core_file_command (NULL, from_tty); -+ if (core_bfd) -+ warning (_("Core file not unloaded.")); -+ } -+ - kill_if_already_running (from_tty); - - init_wait_for_inferior (); -@@ -2373,6 +2380,13 @@ attach_command (char *args, int from_tty - error (_("Not killed.")); - } - -+ if (core_bfd) -+ { -+ core_file_command (NULL, from_tty); -+ if (core_bfd) -+ warning (_("Core file not unloaded.")); -+ } -+ - /* Clean up any leftovers from other runs. Some other things from - this function should probably be moved into target_pre_inferior. */ - target_pre_inferior (from_tty); ---- ./gdb/testsuite/gdb.base/corefile.exp 2010-01-09 01:14:11.000000000 +0100 -+++ ./gdb/testsuite/gdb.base/corefile.exp 2010-05-24 19:38:56.000000000 +0200 -@@ -182,3 +182,62 @@ gdb_load ${binfile} - gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(.*\\).*" "up in corefile.exp (reinit)" - - gdb_test "core" "No core file now." -+ -+ -+# Test a run (start) command will clear any loaded core file. -+ -+gdb_test "core-file $corefile" "Core was generated by .*" "run: load core again" -+gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "run: sanity check we see the core file" -+ -+set test "run: with core" -+if [runto_main] { -+ pass $test -+} else { -+ fail $test -+} -+ -+set test "run: core file is cleared" -+gdb_test_multiple "info files" $test { -+ "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_exit -+ -+ -+# Test an attach command will clear any loaded core file. -+ -+if ![is_remote target] { -+ set test "attach: spawn sleep" -+ set res [remote_spawn host "$binfile sleep"]; -+ if { $res < 0 || $res == "" } { -+ perror "$test failed." -+ fail $test -+ return -+ } -+ set pid [exp_pid -i $res] -+ # We do not care of the startup phase where it will be caught. -+ -+ gdb_start -+ -+ gdb_test "core-file $corefile" "Core was generated by .*" "attach: load core again" -+ gdb_test "info files" "\r\nLocal core dump file:\r\n.*" "attach: sanity check we see the core file" -+ -+ gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach: with core" -+ -+ set test "attach: core file is cleared" -+ gdb_test_multiple "info files" $test { -+ "\r\nLocal core dump file:\r\n.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ "\r\n$gdb_prompt $" { -+ pass $test -+ } -+ } -+ -+ gdb_exit -+} ---- ./gdb/testsuite/gdb.base/coremaker.c 2010-01-01 08:32:00.000000000 +0100 -+++ ./gdb/testsuite/gdb.base/coremaker.c 2010-05-24 19:38:56.000000000 +0200 -@@ -133,8 +133,14 @@ func1 () - func2 (); - } - --int main () -+int -+main (int argc, char **argv) - { -+ if (argc == 2 && strcmp (argv[1], "sleep") == 0) -+ { -+ sleep (60); -+ return 0; -+ } - mmapdata (); - func1 (); - return 0; diff --git a/gdb-bz614659-prelink-dynbss.patch b/gdb-bz614659-prelink-dynbss.patch deleted file mode 100644 index 75514ec..0000000 --- a/gdb-bz614659-prelink-dynbss.patch +++ /dev/null @@ -1,217 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-07/msg00237.html -Subject: [patch] Fix regression on prelinked executables - -Hi, - -there is a regression since gdb-7.0 for a combination of: - * prelinked - * main executable - * using separate debug info - * using copy relocations - -It is since a patch for both PIE and (AFAIK) OSX support: - [commit] syms_from_objfile: Relativize also MAINLINE - http://sourceware.org/ml/gdb-patches/2010-01/msg00080.html - -which started to use problematic addr_info_make_relative even for main -executables. prelink<->gdb discussion at: - https://bugzilla.redhat.com/show_bug.cgi?id=614659 - -Currently in the unfortunately executables GDB has invalid displcement for -symbols in .bss: - int bssvar, *bssvarp = &bssvar; - (gdb) p &bssvar - $1 = (int *) 0x600b54 - (gdb) p bssvarp - $2 = (int *) 0x600b50 - - -addr_info_make_relative could just simply subtract entry point address and -provide single CORE_ADDR objfile->offset (instead of the current -section_offsets array with offsets specific for each section). Linux systems -use always single offset for the whole objfile. AFAIK these per-section -offsets are there for some embedded targets. Curiously GDB already uses at -many places - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -instead of using offset for the appropriate section at that place and nobody -complains. - - -No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. - -Proposing for the gdb-7.2 branch. I had problems fixing up my crashing X. - - -Thanks, -Jan - - -gdb/ -2010-07-15 Jan Kratochvil - - * symfile.c (addr_section_name): New function. - (addrs_section_compar): Use it. - (addr_info_make_relative): Use it. Move variable sect_name into a more - inner block. Make ".dynbss" and ".sdynbss" checks more strict. - -gdb/testsuite/ -2010-07-15 Jan Kratochvil - - * gdb.base/prelink-lib.c (copyreloc): New initialized variable. - * gdb.base/prelink.c (copyreloc, bssvar, bssvarp): New variables. - (main): Use copyreloc. - * gdb.base/prelink.exp (split debug of executable) - (.dynbss vs. .bss address shift): New tests. - ---- a/gdb/symfile.c -+++ b/gdb/symfile.c -@@ -547,6 +547,23 @@ relative_addr_info_to_section_offsets (struct section_offsets *section_offsets, - } - } - -+/* Transform section name S for a name comparison. prelink can split section -+ `.bss' into two sections `.dynbss' and `.bss' (in this order). Similarly -+ prelink can split `.sbss' into `.sdynbss' and `.sbss'. Use virtual address -+ of the new `.dynbss' (`.sdynbss') section as the adjacent new `.bss' -+ (`.sbss') section has invalid (increased) virtual address. */ -+ -+static const char * -+addr_section_name (const char *s) -+{ -+ if (strcmp (s, ".dynbss") == 0) -+ return ".bss"; -+ if (strcmp (s, ".sdynbss") == 0) -+ return ".sbss"; -+ -+ return s; -+} -+ - /* qsort comparator for addrs_section_sort. Sort entries in ascending order by - their (name, sectindex) pair. sectindex makes the sort by name stable. */ - -@@ -557,7 +574,7 @@ addrs_section_compar (const void *ap, const void *bp) - const struct other_sections *b = *((struct other_sections **) bp); - int retval, a_idx, b_idx; - -- retval = strcmp (a->name, b->name); -+ retval = strcmp (addr_section_name (a->name), addr_section_name (b->name)); - if (retval) - return retval; - -@@ -641,14 +658,16 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - - while (*addrs_sorted) - { -- const char *sect_name = (*addrs_sorted)->name; -+ const char *sect_name = addr_section_name ((*addrs_sorted)->name); - - while (*abfd_addrs_sorted -- && strcmp ((*abfd_addrs_sorted)->name, sect_name) < 0) -+ && strcmp (addr_section_name ((*abfd_addrs_sorted)->name), -+ sect_name) < 0) - abfd_addrs_sorted++; - - if (*abfd_addrs_sorted -- && strcmp ((*abfd_addrs_sorted)->name, sect_name) == 0) -+ && strcmp (addr_section_name ((*abfd_addrs_sorted)->name), -+ sect_name) == 0) - { - int index_in_addrs; - -@@ -676,7 +695,6 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - - for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) - { -- const char *sect_name = addrs->other[i].name; - struct other_sections *sect = addrs_to_abfd_addrs[i]; - - if (sect) -@@ -694,6 +712,9 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - } - else - { -+ /* addr_section_name transformation is not used for SECT_NAME. */ -+ const char *sect_name = addrs->other[i].name; -+ - /* This section does not exist in ABFD, which is normally - unexpected and we want to issue a warning. - -@@ -704,12 +725,20 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) - a warning. Shared libraries contain just the section - ".gnu.liblist" but it is not marked as loadable there. There is - no other way to identify them than by their name as the sections -- created by prelink have no special flags. */ -+ created by prelink have no special flags. -+ -+ For the sections `.bss' and `.sbss' see addr_section_name. */ - - if (!(strcmp (sect_name, ".gnu.liblist") == 0 - || strcmp (sect_name, ".gnu.conflict") == 0 -- || strcmp (sect_name, ".dynbss") == 0 -- || strcmp (sect_name, ".sdynbss") == 0)) -+ || (strcmp (sect_name, ".bss") == 0 -+ && i > 0 -+ && strcmp (addrs->other[i - 1].name, ".dynbss") == 0 -+ && addrs_to_abfd_addrs[i - 1] != NULL) -+ || (strcmp (sect_name, ".sbss") == 0 -+ && i > 0 -+ && strcmp (addrs->other[i - 1].name, ".sdynbss") == 0 -+ && addrs_to_abfd_addrs[i - 1] != NULL))) - warning (_("section %s not found in %s"), sect_name, - bfd_get_filename (abfd)); - ---- a/gdb/testsuite/gdb.base/prelink-lib.c -+++ b/gdb/testsuite/gdb.base/prelink-lib.c -@@ -16,6 +16,8 @@ - along with this program. If not, see . - */ - -+int copyreloc = 1; -+ - int - g (void (*p)(void)) - { ---- a/gdb/testsuite/gdb.base/prelink.c -+++ b/gdb/testsuite/gdb.base/prelink.c -@@ -18,6 +18,11 @@ - - #include - -+extern int copyreloc; -+ -+/* Test GDB itself finds `&bssvar' right. */ -+static int bssvar, *bssvarp = &bssvar; -+ - extern void (*h (void)) (void (*)(void)); - - int -@@ -25,5 +30,6 @@ main (void) - { - void (*f) (void (*)(void)) = h (); - printf ("%p\n", f); -+ printf ("%d\n", copyreloc); - f (0); - } ---- a/gdb/testsuite/gdb.base/prelink.exp -+++ b/gdb/testsuite/gdb.base/prelink.exp -@@ -57,6 +57,13 @@ if {$prelink_args == ""} { - return -1 - } - -+set test "split debug of executable" -+if [gdb_gnu_strip_debug $binfile] { -+ fail $test -+} else { -+ pass $test -+} -+ - if ![prelink_yes $prelink_args] { - # Maybe we don't have prelink. - return -1 -@@ -105,3 +112,5 @@ clean_restart $executable - gdb_test_no_output "set verbose on" - - gdb_test "core-file $objdir/$subdir/prelink.core" "Using PIC \\(Position Independent Code\\) prelink displacement 0x\[^0\]\[0-9a-f\]* for \[^\r\n\]*[file tail ${libfile}].*" "seen displacement message" -+ -+gdb_test "p &bssvar == bssvarp" " = 1" ".dynbss vs. .bss address shift" - diff --git a/gdb-bz627432-loop-static-self-class.patch b/gdb-bz627432-loop-static-self-class.patch deleted file mode 100644 index 7a03f17..0000000 --- a/gdb-bz627432-loop-static-self-class.patch +++ /dev/null @@ -1,280 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00440.html -Subject: [patch] Fix infinite loop crash on self-referencing class - -Hi, - -class C { static C s; }; is a problem for GDB as it references itself and it -can crash. Downstream Bug: - https://bugzilla.redhat.com/show_bug.cgi?id=627432 - -#3 0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840 -#4 0x00000000005b2cc5 in gnuv3_pass_by_reference (type=0x1044d3c8) at ../../gdb/gnu-v3-abi.c:840 -[...] - -No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. - -FYI the .cc file is not reproducible on - and only on - Fedora 14 GCC, filed: - https://bugzilla.redhat.com/show_bug.cgi?id=637315 - -I would even check it in in some time. - - -Thanks, -Jan - - -gdb/ -2010-09-24 Jan Kratochvil - - Fix GDB crash on inferior calls with self-referencing classes. - * gnu-v3-abi.c (gnuv3_pass_by_reference): Do not call itself on static - member fields. - -gdb/testsuite/ -2010-09-24 Jan Kratochvil - - Fix GDB crash on inferior calls with self-referencing classes. - * gdb.dwarf2/dw2-cp-infcall-ref-static.exp: New file. - * gdb.dwarf2/dw2-cp-infcall-ref-static-main.c: New file. - * gdb.dwarf2/dw2-cp-infcall-ref-static.S: New file. - ---- a/gdb/gnu-v3-abi.c -+++ b/gdb/gnu-v3-abi.c -@@ -835,9 +835,10 @@ gnuv3_pass_by_reference (struct type *type) - by reference, so does this class. Similarly for members, which - are constructed whenever this class is. We do not need to worry - about recursive loops here, since we are only looking at members -- of complete class type. */ -+ of complete class type. Also ignore any static members. */ - for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++) -- if (gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum))) -+ if (TYPE_FIELD_LOC_KIND (type, fieldnum) == FIELD_LOC_KIND_BITPOS -+ && gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum))) - return 1; - - return 0; ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static-main.c -@@ -0,0 +1,51 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* class C -+ { -+ public: -+ static C s; -+ }; -+ C C::s; -+ C f() -+ { -+ return C::s; -+ } */ -+ -+asm (".globl cu_text_start"); -+asm ("cu_text_start:"); -+ -+asm (".globl f_start"); -+asm ("f_start:"); -+ -+void -+f (void) -+{ -+} -+ -+asm (".globl f_end"); -+asm ("f_end:"); -+ -+int -+main (void) -+{ -+ f (); -+ return 0; -+} -+ -+asm (".globl cu_text_end"); -+asm ("cu_text_end:"); ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.S -@@ -0,0 +1,115 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* Debug information */ -+ -+ .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 cu_text_start /* DW_AT_low_pc */ -+ .4byte cu_text_end /* DW_AT_high_pc */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 4 /* DW_AT_language (DW_LANG_C_plus_plus) */ -+ -+.Ltype_class: -+ .uleb128 3 /* Abbrev: DW_TAG_class_type */ -+ .ascii "C\0" /* DW_AT_name */ -+ -+ .uleb128 4 /* Abbrev: DW_TAG_member */ -+ .ascii "s\0" /* DW_AT_name */ -+ .4byte .Ltype_class-.Lcu1_begin /* DW_AT_type */ -+ .byte 1 /* DW_AT_declaration */ -+ .byte 1 /* DW_AT_external */ -+ -+ .byte 0 /* End of children of DW_TAG_class_type */ -+ -+ .uleb128 5 /* Abbrev: DW_TAG_subprogram */ -+ .ascii "f\0" /* DW_AT_name */ -+ .4byte .Ltype_class-.Lcu1_begin /* DW_AT_type */ -+ .4byte f_start /* DW_AT_low_pc */ -+ .4byte f_end /* DW_AT_high_pc */ -+ -+ .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 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_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 3 /* Abbrev code */ -+ .uleb128 0x2 /* DW_TAG_class_type */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* Abbrev code */ -+ .uleb128 0xd /* DW_TAG_member */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x3c /* DW_AT_declaration */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 5 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0 /* has_children */ -+ .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 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ ---- /dev/null -+++ b/gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp -@@ -0,0 +1,49 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Check that GDB can call C++ functions whose parameters or return values have -+# type containing a static member of the same type. -+ -+# Still no C++ compiler is used. -+if { [skip_cplus_tests] } { continue } -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-cp-infcall-ref-static" -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}-main.c ${testfile}.S] {}] } { -+ return -1 -+} -+ -+if ![runto_main] then { -+ return -1 -+} -+ -+# main is not provided by DWARF. -+gdb_test_no_output "set language c++" -+ -+# There are no mangled names in DWARF to suggest the v3 ABI. -+gdb_test_no_output "set cp-abi gnu-v3" -+ -+# GDB could crash. There is no DW_AT_location so it is . -+gdb_test "p f()" { = {static s = }} - diff --git a/gdb-bz631158-cxx-this-lookup.patch b/gdb-bz631158-cxx-this-lookup.patch deleted file mode 100644 index 0d7ae05..0000000 --- a/gdb-bz631158-cxx-this-lookup.patch +++ /dev/null @@ -1,14 +0,0 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=631158 -http://sourceware.org/ml/gdb-patches/2010-09/msg00229.html -Subject: [patch] PR 11992 "Regression: C++ this scope sometimes does not work" - ---- gdb-7.2/gdb/c-exp.y.orig 2010-08-19 17:50:00.000000000 +0200 -+++ gdb-7.2/gdb/c-exp.y 2010-09-11 20:30:15.000000000 +0200 -@@ -2422,6 +2422,7 @@ classify_name (struct block *block) - - if (sym == NULL - && parse_language->la_language == language_cplus -+ && !is_a_field_of_this - && !lookup_minimal_symbol (copy, NULL, NULL)) - return UNKNOWN_CPP_NAME; - diff --git a/gdb-bz631575-gdb-index-nobits.patch b/gdb-bz631575-gdb-index-nobits.patch deleted file mode 100644 index 707a613..0000000 --- a/gdb-bz631575-gdb-index-nobits.patch +++ /dev/null @@ -1,61 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00183.html -Subject: [patch] .gdb_index: Do not crash on NOBITS - -Hi, - -elfutils-0.148 still do not contain patch of its GIT -804e9ca4d644e64a6125307cbf0a0b89477d7611 where the .gdb_index section has been -also split into the separate debug info file. - -Due to it binaries split using elfutils-0.148 contain - [38] .gdb_index NOBITS 0000000000000000 0000338c -instead of expected - [28] .gdb_index PROGBITS 0000000000000000 0000211c - -and due to it GDB while reading the file can error() by: -Reading symbols from x.debug...Dwarf Error: Can't read DWARF data from 'x.debug' - -which should not be fatal but due to some other bugs therein it can crash GDB. - -The wrong separate debug info file is for example: -http://kojipkgs.fedoraproject.org/packages/glibc/2.12.90/10/x86_64/glibc-debuginfo-2.12.90-10.x86_64.rpm -/usr/lib/debug/lib64/libutil-2.12.90.so.debug - -OK to check-in? - -It does not attempt to use .gdb_index from the main binary, it will just -disable .gdb_index usage on these binaries. - - -Thanks, -Jan - - -http://sourceware.org/ml/gdb-cvs/2010-09/msg00062.html - -### src/gdb/ChangeLog 2010/09/08 19:09:42 1.12162 -### src/gdb/ChangeLog 2010/09/08 19:49:28 1.12163 -## -1,3 +1,7 @@ -+2010-09-08 Jan Kratochvil -+ -+ * dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS. -+ - 2010-09-08 Daniel Jacobowitz - - * dwarf2read.c (read_structure_type): Move processing of ---- src/gdb/dwarf2read.c 2010/09/08 19:09:42 1.452 -+++ src/gdb/dwarf2read.c 2010/09/08 19:49:28 1.453 -@@ -1904,6 +1904,13 @@ - if (dwarf2_per_objfile->gdb_index.asection == NULL - || dwarf2_per_objfile->gdb_index.size == 0) - return 0; -+ -+ /* Older elfutils strip versions could keep the section in the main -+ executable while splitting it for the separate debug info file. */ -+ if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection) -+ & SEC_HAS_CONTENTS) == 0) -+ return 0; -+ - dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index); - - addr = dwarf2_per_objfile->gdb_index.buffer; diff --git a/gdb-bz634660-gdbpy-load-on-attach.patch b/gdb-bz634660-gdbpy-load-on-attach.patch deleted file mode 100644 index 2223776..0000000 --- a/gdb-bz634660-gdbpy-load-on-attach.patch +++ /dev/null @@ -1,61 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00365.html -Subject: [patch] python: load *-gdb.py for shlibs during attach - -Hi, - -currently if you attach to or load a core file for executable, its -gdb.py -script is loaded. But none -gdb.py for the shared libraries. - -Spawned or with the fix (libstdc++-gdb.py): -#1 0x00000000004007b5 in f (s="a") at 1.C:4 - ^ is std::string - -Attached/core without the fix: -#1 0x00000000004007b5 in f (s=...) at 1.C:4 - -No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. - -Mostly obvious, I will check it in later. - - -Thanks, -Jan - - -gdb/ -2010-09-22 Jan Kratochvil - - * main.c: Include objfiles.h. - (captured_main): New variable objfile. Call - load_auto_scripts_for_objfile for ALL_OBJFILES. - ---- ./gdb/main.c 2010-09-22 10:51:32.000000000 +0200 -+++ ./gdb/main.c 2010-09-22 10:50:44.000000000 +0200 -@@ -43,6 +43,7 @@ - #include "source.h" - #include "cli/cli-cmds.h" - #include "python/python.h" -+#include "objfiles.h" - - /* The selected interpreter. This will be used as a set command - variable, so it should always be malloc'ed - since -@@ -323,6 +324,7 @@ captured_main (void *data) - - int i; - int save_auto_load; -+ struct objfile *objfile; - - struct cleanup *pre_stat_chain = make_command_stats_cleanup (0); - -@@ -957,8 +959,8 @@ Can't attach to process and specify a co - We wait until now because it is common to add to the source search - path in local_gdbinit. */ - gdbpy_global_auto_load = save_auto_load; -- if (symfile_objfile != NULL) -- load_auto_scripts_for_objfile (symfile_objfile); -+ ALL_OBJFILES (objfile) -+ load_auto_scripts_for_objfile (objfile); - - for (i = 0; i < ncmd; i++) - { - diff --git a/gdb-bz637770-ifunc-watchpoint-delete.patch b/gdb-bz637770-ifunc-watchpoint-delete.patch deleted file mode 100644 index 17015dd..0000000 --- a/gdb-bz637770-ifunc-watchpoint-delete.patch +++ /dev/null @@ -1,111 +0,0 @@ -commit 30fedadf224a8c119575fcc8a6ced51f0d4aee9f -Author: Jan Kratochvil -Date: Wed Sep 29 01:25:39 2010 +0200 - - Fix the crash. - -commit d101ce597f2d6143e9f023a4444352bceffb2679 -Author: Jan Kratochvil -Date: Wed Sep 29 00:42:37 2010 +0200 - - New testcase for: https://bugzilla.redhat.com/show_bug.cgi?id=637770 - -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index de51231..18b7868 100644 ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -10560,6 +10560,11 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *, - /* FUNCTION can be also delete_breakpoint. */ - next_related_b = related_breakpoint->related_breakpoint; - function (related_breakpoint, data); -+ -+ /* For delete_breakpoint of the last entry of the ring we -+ were traversing we would never get back to B. */ -+ if (next_related_b == related_breakpoint) -+ break; - related_breakpoint = next_related_b; - } - while (related_breakpoint != b); -diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.c b/gdb/testsuite/gdb.base/watchpoint-delete.c -new file mode 100644 -index 0000000..031ef92 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-delete.c -@@ -0,0 +1,33 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+void -+func (void) -+{ -+ volatile int x = 0; -+ -+ x++; /* break-here */ -+ x++; -+} -+ -+int -+main (void) -+{ -+ func (); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/watchpoint-delete.exp b/gdb/testsuite/gdb.base/watchpoint-delete.exp -new file mode 100644 -index 0000000..45bc650 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-delete.exp -@@ -0,0 +1,38 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile "watchpoint-delete" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { -+ untested ${testfile}.exp -+ return -1 -+} -+ -+# It is more compatible this way. -+gdb_test_no_output "set can-use-hw-watchpoints 0" -+ -+if ![runto_main] { -+ return -1 -+} -+ -+# Ensure there is a parent frame to create related bp_watchpoint_scope. -+gdb_breakpoint [gdb_get_line_number "break-here"] -+gdb_continue_to_breakpoint "break-here" ".* break-here .*" -+ -+gdb_test "watch x" {Watchpoint [0-9]+: x} -+ -+gdb_test_no_output {delete $bpnum} diff --git a/gdb-bz645773-ifort-case-1of3.patch b/gdb-bz645773-ifort-case-1of3.patch deleted file mode 100644 index ec9f88d..0000000 --- a/gdb-bz645773-ifort-case-1of3.patch +++ /dev/null @@ -1,313 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html -Subject: [new testcase] Regression 7.1->7.2 for iFort [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute] - -On Fri, 21 May 2010 22:45:35 +0200, Pierre Muller wrote: -> Thanks, I committed the patch. - -commit 570d5d01de35effada277a69552c0903a4928241 -Author: Pierre Muller -Date: Fri May 21 20:45:18 2010 +0000 - - * dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter - attribute. - - -Please revert this patch. - ->From the DWARF-4 description of DW_AT_variable_parameter I do not think it -changes the data structures meaning in any way. It just states which data can -be modified by whom. I do not think this is useful for GDB in any way. - - -> > I think it would be improved by a test case, but that is up to you. -> -> This test would be pascal specific anyhow, - -I believe the Pascal compiler should generate different debug info. For the -`var' keyword you can either (a) use DW_TAG_reference_type and point -DW_AT_location at the pointer or (b) use DW_OP_deref (as iFort does) on the -passed pointer and point DW_AT_location at the value itself. -DW_AT_variable_parameter would be true only for the (a) choice. - -1 subroutine f (i) -2 integer i -3 i = 2 -4 end -5 program varparam -6 integer m -7 m = 1 -8 call f (m) -9 write(*,*) m -10 end - -for iFort 11.1 20100806 it regressed this code, GDB-7.1 displayed: - -Breakpoint 1, f (i=1) at varparam.f90:3 -3 i = 2 -(gdb) p i -$1 = 1 - -while GDB-7.2 displays: - -Breakpoint 2, f (i=@0x1) at varparam.f90:3 -3 i = 2 -(gdb) p i -$1 = (REF TO -> ( INTEGER(4) )) @0x1: - -(note that `0x1' GDB considers as an address here) - - - -A new testcase for the iFort usage case is attached. - -No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. - -I will then check-in the testcase or you can or so. - - -Regards, -Jan - - -gdb/ -2010-11-04 Jan Kratochvil - - Revert: - 2010-05-21 Pierre Muller - * dwarf2read.c (new_symbol): Handle DW_AT_variable_parameter - attribute. - -gdb/testsuite/ -2010-11-04 Jan Kratochvil - - * dw2-ifort-parameter-debug.S: New file. - * dw2-ifort-parameter.c: New file. - * dw2-ifort-parameter.exp: New file. - -Index: gdb-7.2/gdb/dwarf2read.c -=================================================================== ---- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:24:01.000000000 +0100 -+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:36:34.000000000 +0100 -@@ -10474,14 +10474,6 @@ new_symbol (struct die_info *die, struct - { - dwarf2_const_value (attr, sym, cu); - } -- attr = dwarf2_attr (die, DW_AT_variable_parameter, cu); -- if (attr && DW_UNSND (attr)) -- { -- struct type *ref_type; -- -- ref_type = lookup_reference_type (SYMBOL_TYPE (sym)); -- SYMBOL_TYPE (sym) = ref_type; -- } - - add_symbol_to_list (sym, cu->list_in_scope); - break; -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S 2010-11-07 05:36:18.000000000 +0100 -@@ -0,0 +1,122 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+ .section .debug_info -+.Lcu1_begin: -+ /* CU header */ -+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ -+.Lcu1_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 1 /* DW_AT_language (C) */ -+ .4byte func /* DW_AT_low_pc */ -+ .4byte main /* DW_AT_high_pc */ -+ -+ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ -+ .byte 1 /* DW_AT_external */ -+ .ascii "func\0" /* DW_AT_name */ -+ .4byte func /* DW_AT_low_pc */ -+ .4byte main /* DW_AT_high_pc */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_formal_parameter */ -+ .ascii "param\0" /* DW_AT_name */ -+ .byte 1 /* DW_AT_variable_parameter */ -+ .4byte .Ltype_int - .Lcu1_begin /* DW_AT_type */ -+ .byte 2f - 1f /* DW_AT_location */ -+1: .byte 3 /* DW_OP_addr */ -+ .4byte ptr /* */ -+ .byte 0x6 /* DW_OP_deref */ -+2: -+ -+ .byte 0 /* End of children of func */ -+ -+.Ltype_int: -+ .uleb128 4 /* 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 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 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x05 /* DW_TAG_formal_parameter */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x4b /* DW_AT_variable_parameter */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x49 /* DW_AT_type */ -+ .uleb128 0x13 /* DW_FORM_ref4 */ -+ .uleb128 0x2 /* DW_AT_location */ -+ .uleb128 0xa /* DW_FORM_block1 */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 4 /* 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 */ -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c 2010-11-07 05:36:18.000000000 +0100 -@@ -0,0 +1,31 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+int value = 0xdeadf00d; -+int *ptr = &value; -+ -+void -+func (void) -+{ -+} -+ -+int -+main (void) -+{ -+ func (); -+ return 0; -+} -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp 2010-11-07 05:36:18.000000000 +0100 -@@ -0,0 +1,40 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Verify DW_AT_variable_parameter does not modify the data structures meaning -+# for GDB, as being used by iFort. -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-ifort-parameter" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } { -+ return -1 -+} -+ -+if ![runto func] { -+ return -1 -+} -+ -+gdb_test "p/x param" " = 0xdeadf00d" diff --git a/gdb-bz645773-ifort-case-2of3.patch b/gdb-bz645773-ifort-case-2of3.patch deleted file mode 100644 index b871a70..0000000 --- a/gdb-bz645773-ifort-case-2of3.patch +++ /dev/null @@ -1,204 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-11/msg00107.html -Subject: [patch 1/2] Code cleanup: New init_one_comp_unit - -Hi, - -unify some code into a function, to be extended in the next patch. - - -Thanks, -Jan - - -gdb/ -2010-11-06 Jan Kratochvil - - Code cleanup. - * dwarf2read.c (alloc_one_comp_unit): Rename prototype to ... - (init_one_comp_unit): ... this one. - (prepare_one_comp_unit): New prototype. - (dw2_require_line_header, process_psymtab_comp_unit): Use - init_one_comp_unit. - (process_psymtab_comp_unit): Use prepare_one_comp_unit. - (load_partial_comp_unit): Remove variable attr. Use - init_one_comp_unit with xmalloc. Use prepare_one_comp_unit. - (load_full_comp_unit): Use init_one_comp_unit with xmalloc. Use - prepare_one_comp_unit. - (read_signatured_type): Remove variable attr. Use init_one_comp_unit. - Use prepare_one_comp_unit. - (alloc_one_comp_unit): Rename to ... - (init_one_comp_unit): ... here and remove there calloc, new parameter - cu. - (prepare_one_comp_unit): New function. - -Index: gdb-7.2/gdb/dwarf2read.c -=================================================================== ---- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:36:34.000000000 +0100 -+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:38:21.000000000 +0100 -@@ -1214,7 +1214,11 @@ static struct dwarf2_per_cu_data *dwarf2 - static struct dwarf2_per_cu_data *dwarf2_find_comp_unit - (unsigned int offset, struct objfile *objfile); - --static struct dwarf2_cu *alloc_one_comp_unit (struct objfile *objfile); -+static void init_one_comp_unit (struct dwarf2_cu *cu, -+ struct objfile *objfile); -+ -+static void prepare_one_comp_unit (struct dwarf2_cu *cu, -+ struct die_info *comp_unit_die); - - static void free_one_comp_unit (void *); - -@@ -1980,10 +1984,7 @@ dw2_require_line_header (struct objfile - return; - this_cu->v.quick->read_lines = 1; - -- memset (&cu, 0, sizeof (cu)); -- cu.objfile = objfile; -- obstack_init (&cu.comp_unit_obstack); -- -+ init_one_comp_unit (&cu, objfile); - cleanups = make_cleanup (free_stack_comp_unit, &cu); - - dwarf2_read_section (objfile, &dwarf2_per_objfile->info); -@@ -2978,10 +2979,7 @@ process_psymtab_comp_unit (struct objfil - CORE_ADDR best_lowpc = 0, best_highpc = 0; - struct die_reader_specs reader_specs; - -- memset (&cu, 0, sizeof (cu)); -- cu.objfile = objfile; -- obstack_init (&cu.comp_unit_obstack); -- -+ init_one_comp_unit (&cu, objfile); - back_to_inner = make_cleanup (free_stack_comp_unit, &cu); - - info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr, -@@ -3035,12 +3033,7 @@ process_psymtab_comp_unit (struct objfil - return info_ptr; - } - -- /* Set the language we're debugging. */ -- attr = dwarf2_attr (comp_unit_die, DW_AT_language, &cu); -- if (attr) -- set_cu_language (DW_UNSND (attr), &cu); -- else -- set_cu_language (language_minimal, &cu); -+ prepare_one_comp_unit (&cu, comp_unit_die); - - /* Allocate a new partial symbol table structure. */ - attr = dwarf2_attr (comp_unit_die, DW_AT_name, &cu); -@@ -3263,7 +3256,8 @@ load_partial_comp_unit (struct dwarf2_pe - info_ptr = dwarf2_per_objfile->info.buffer + this_cu->offset; - beg_of_comp_unit = info_ptr; - -- cu = alloc_one_comp_unit (objfile); -+ cu = xmalloc (sizeof (*cu)); -+ init_one_comp_unit (cu, objfile); - - /* ??? Missing cleanup for CU? */ - -@@ -3290,12 +3284,7 @@ load_partial_comp_unit (struct dwarf2_pe - info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr, - &has_children); - -- /* Set the language we're debugging. */ -- attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu); -- if (attr) -- set_cu_language (DW_UNSND (attr), cu); -- else -- set_cu_language (language_minimal, cu); -+ prepare_one_comp_unit (cu, comp_unit_die); - - /* Check if comp unit has_children. - If so, read the rest of the partial symbols from this comp unit. -@@ -4227,7 +4216,8 @@ load_full_comp_unit (struct dwarf2_per_c - info_ptr = dwarf2_per_objfile->info.buffer + offset; - beg_of_comp_unit = info_ptr; - -- cu = alloc_one_comp_unit (objfile); -+ cu = xmalloc (sizeof (*cu)); -+ init_one_comp_unit (cu, objfile); - - /* If an error occurs while loading, release our storage. */ - free_cu_cleanup = make_cleanup (free_one_comp_unit, cu); -@@ -4254,11 +4244,7 @@ load_full_comp_unit (struct dwarf2_per_c - all objfiles needed for references have been loaded yet, and symbol - table processing isn't initialized. But we have to set the CU language, - or we won't be able to build types correctly. */ -- attr = dwarf2_attr (cu->dies, DW_AT_language, cu); -- if (attr) -- set_cu_language (DW_UNSND (attr), cu); -- else -- set_cu_language (language_minimal, cu); -+ prepare_one_comp_unit (cu, cu->dies); - - /* Similarly, if we do not read the producer, we can not apply - producer-specific interpretation. */ -@@ -12617,17 +12603,15 @@ read_signatured_type (struct objfile *ob - struct dwarf2_cu *cu; - ULONGEST signature; - struct cleanup *back_to, *free_cu_cleanup; -- struct attribute *attr; - - dwarf2_read_section (objfile, &dwarf2_per_objfile->types); - types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset; - - gdb_assert (type_sig->per_cu.cu == NULL); - -- cu = xmalloc (sizeof (struct dwarf2_cu)); -- memset (cu, 0, sizeof (struct dwarf2_cu)); -- obstack_init (&cu->comp_unit_obstack); -- cu->objfile = objfile; -+ cu = xmalloc (sizeof (*cu)); -+ init_one_comp_unit (cu, objfile); -+ - type_sig->per_cu.cu = cu; - cu->per_cu = &type_sig->per_cu; - -@@ -12659,11 +12643,7 @@ read_signatured_type (struct objfile *ob - all objfiles needed for references have been loaded yet, and symbol - table processing isn't initialized. But we have to set the CU language, - or we won't be able to build types correctly. */ -- attr = dwarf2_attr (cu->dies, DW_AT_language, cu); -- if (attr) -- set_cu_language (DW_UNSND (attr), cu); -- else -- set_cu_language (language_minimal, cu); -+ prepare_one_comp_unit (cu, cu->dies); - - do_cleanups (back_to); - -@@ -13755,15 +13735,29 @@ dwarf2_find_comp_unit (unsigned int offs - return this_cu; - } - --/* Malloc space for a dwarf2_cu for OBJFILE and initialize it. */ -+/* Initialize dwarf2_cu CU for OBJFILE in a pre-allocated space. */ - --static struct dwarf2_cu * --alloc_one_comp_unit (struct objfile *objfile) -+static void -+init_one_comp_unit (struct dwarf2_cu *cu, struct objfile *objfile) - { -- struct dwarf2_cu *cu = xcalloc (1, sizeof (struct dwarf2_cu)); -+ memset (cu, 0, sizeof (*cu)); - cu->objfile = objfile; - obstack_init (&cu->comp_unit_obstack); -- return cu; -+} -+ -+/* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE. */ -+ -+static void -+prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die) -+{ -+ struct attribute *attr; -+ -+ /* Set the language we're debugging. */ -+ attr = dwarf2_attr (comp_unit_die, DW_AT_language, cu); -+ if (attr) -+ set_cu_language (DW_UNSND (attr), cu); -+ else -+ set_cu_language (language_minimal, cu); - } - - /* Release one cached compilation unit, CU. We unlink it from the tree diff --git a/gdb-bz645773-ifort-case-3of3.patch b/gdb-bz645773-ifort-case-3of3.patch deleted file mode 100644 index 084f9d2..0000000 --- a/gdb-bz645773-ifort-case-3of3.patch +++ /dev/null @@ -1,448 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-11/msg00108.html -Subject: [patch 2/2] iFort compat.: case insensitive symbols (PR 11313) - -Hi, - -iFort (Intel Fortran compiler) produces DIEs like: - - <1><1dc>: Abbrev Number: 6 (DW_TAG_module) - <1e0> DW_AT_name : MOD1 - -But Fortran is case insensitive, therefore GDB lowercases any user input -first. Symbols cannot match. gfortran always produces lowercased DIE names. - -I was told by Jakub Jelinek GCC frontend will never be properly case -preserving - to output "Mod1" if user stated it in such case in the sources. - -Therefore GDB will now lowercase any case insensitive symbol names on their -read-in from DWARF. - -ELF symbol tables are currently not touched - their matching to their CU (and -thus to their DW_AT_identifier_case / DW_AT_language) is expensive and it does -not seem to me to be needed for iFort as only the module names are uppercased -there. - -For the iFort compatibility there is also needed: - [new testcase] Regression 7.1->7.2 for iFort [Re: [RFA-v2] dwarf debug format: Support DW_AT_variable_parameter attribute] - http://sourceware.org/ml/gdb-patches/2010-11/msg00084.html - -No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2010-11-07 Jan Kratochvil - - PR 11313 - case insensitive identifiers in DWARF not in lowercase. - * dwarf2read.c: Include ctype.h. - (struct dwarf2_cu) : New. - (struct attribute) : Update the comment. - (canonical_case): New declaration. - (read_partial_die): Call canonical_case. - (canonical_case): New function. - (dwarf2_canonicalize_name): Update the function comment. Call - canonical_case, adjust the obstack allocation. - (dwarf2_name): Call canonical_case, set DW_STRING_IS_CANONICAL. - (init_one_comp_unit, prepare_one_comp_unit): Set cu->case_sensitivity. - -gdb/testsuite/ -2010-11-07 Jan Kratochvil - - PR 11313 - case insensitive identifiers in DWARF not in lowercase. - * gdb.dwarf2/dw2-case-insensitive-debug.S: New. - * gdb.dwarf2/dw2-case-insensitive.c: New. - * gdb.dwarf2/dw2-case-insensitive.exp: New. - * gdb.mi/mi-var-child-f.exp (mi_runto): Use lowercase main__. - -Index: gdb-7.2/gdb/dwarf2read.c -=================================================================== ---- gdb-7.2.orig/gdb/dwarf2read.c 2010-11-07 05:38:21.000000000 +0100 -+++ gdb-7.2/gdb/dwarf2read.c 2010-11-07 05:38:47.000000000 +0100 -@@ -55,6 +55,7 @@ - #include "gdb_stat.h" - #include "completer.h" - #include "top.h" -+#include - - #include - #include "gdb_string.h" -@@ -376,6 +377,10 @@ struct dwarf2_cu - DIEs for namespaces, we don't need to try to infer them - from mangled names. */ - unsigned int has_namespace_info : 1; -+ -+ /* Are identifiers in this CU case sensitive or should they be lowercased -+ before storing them into GDB symbol tables? */ -+ enum case_sensitivity case_sensitivity; - }; - - /* When using the index (and thus not using psymtabs), each CU has an -@@ -621,9 +626,10 @@ struct attribute - ENUM_BITFIELD(dwarf_attribute) name : 16; - ENUM_BITFIELD(dwarf_form) form : 15; - -- /* Has DW_STRING already been updated by dwarf2_canonicalize_name? This -- field should be in u.str (existing only for DW_STRING) but it is kept -- here for better struct attribute alignment. */ -+ /* Has DW_STRING already been updated by dwarf2_canonicalize_name or -+ canonical_case? This field should be in u.str (existing only for -+ DW_STRING) but it is kept here for better struct attribute alignment. -+ */ - unsigned int string_is_canonical : 1; - - union -@@ -1109,6 +1115,9 @@ static gdb_byte *read_full_die (const st - - static void process_die (struct die_info *, struct dwarf2_cu *); - -+static char *canonical_case (char *name, struct dwarf2_cu *cu, -+ struct obstack *obstack); -+ - static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *, - struct obstack *); - -@@ -8589,7 +8598,8 @@ read_partial_die (struct partial_die_inf - case DW_TAG_enumerator: - /* These tags always have simple identifiers already; no need - to canonicalize them. */ -- part_die->name = DW_STRING (&attr); -+ part_die->name = canonical_case (DW_STRING (&attr), cu, -+ &cu->objfile->objfile_obstack); - break; - default: - part_die->name -@@ -11043,7 +11053,36 @@ sibling_die (struct die_info *die) - return die->sibling; - } - --/* Get name of a die, return NULL if not found. */ -+/* Convert NAME to the lower case if CU is case_sensitive_off. Allocate -+ memory on OBSTACK if needed, otherwise return the NAME pointer. */ -+ -+static char * -+canonical_case (char *name, struct dwarf2_cu *cu, -+ struct obstack *obstack) -+{ -+ char *retval; -+ int i; -+ -+ if (cu->case_sensitivity == case_sensitive_on) -+ return name; -+ -+ for (i = 0; name[i] != 0; i++) -+ if (tolower (name[i]) != name[i]) -+ break; -+ if (name[i] == 0) -+ return name; -+ -+ retval = obstack_alloc (obstack, strlen (name) + 1); -+ -+ for (i = 0; name[i] != 0; i++) -+ retval[i] = tolower (name[i]); -+ retval[i] = 0; -+ -+ return retval; -+} -+ -+/* Get name of a die, return NULL if not found. canonical_case is always -+ already called for the returned string. */ - - static char * - dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu, -@@ -11055,14 +11094,26 @@ dwarf2_canonicalize_name (char *name, st - - if (canon_name != NULL) - { -- if (strcmp (canon_name, name) != 0) -- name = obsavestring (canon_name, strlen (canon_name), -+ char *cased_name; -+ -+ cased_name = canonical_case (canon_name, cu, obstack); -+ -+ /* Push CASED_NAME on OBSTACK only if it isn't already pushed there -+ by canonical_case and if it was allocated using xmalloc by -+ cp_canonicalize_string. */ -+ if (strcmp (canon_name, cased_name) == 0 -+ && strcmp (canon_name, name) != 0) -+ name = obsavestring (cased_name, strlen (cased_name), - obstack); -+ else -+ name = cased_name; - xfree (canon_name); -+ -+ return name; - } - } - -- return name; -+ return canonical_case (name, cu, obstack); - } - - /* Get name of a die, return NULL if not found. */ -@@ -11088,7 +11139,13 @@ dwarf2_name (struct die_info *die, struc - case DW_TAG_enumeration_type: - case DW_TAG_enumerator: - /* These tags always have simple identifiers already; no need -- to canonicalize them. */ -+ to call dwarf2_canonicalize_name for them. */ -+ if (!DW_STRING_IS_CANONICAL (attr)) -+ { -+ DW_STRING (attr) = canonical_case (DW_STRING (attr), cu, -+ &cu->objfile->objfile_obstack); -+ DW_STRING_IS_CANONICAL (attr) = 1; -+ } - return DW_STRING (attr); - - case DW_TAG_subprogram: -@@ -13743,6 +13800,7 @@ init_one_comp_unit (struct dwarf2_cu *cu - memset (cu, 0, sizeof (*cu)); - cu->objfile = objfile; - obstack_init (&cu->comp_unit_obstack); -+ cu->case_sensitivity = case_sensitive_on; - } - - /* Initiailize basic fields of dwarf_cu CU according to DIE COMP_UNIT_DIE. */ -@@ -13758,6 +13816,13 @@ prepare_one_comp_unit (struct dwarf2_cu - set_cu_language (DW_UNSND (attr), cu); - else - set_cu_language (language_minimal, cu); -+ -+ attr = dwarf2_attr (comp_unit_die, DW_AT_identifier_case, cu); -+ if (attr) -+ cu->case_sensitivity = (DW_UNSND (attr) == DW_ID_case_sensitive -+ ? case_sensitive_on : case_sensitive_off); -+ else -+ cu->case_sensitivity = cu->language_defn->la_case_sensitivity; - } - - /* Release one cached compilation unit, CU. We unlink it from the tree -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive-debug.S 2010-11-07 05:38:35.000000000 +0100 -@@ -0,0 +1,122 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+ .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 2 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 2 /* DW_AT_language (DW_LANG_C) */ -+ .byte 3 /* DW_AT_identifier_case (DW_ID_case_insensitive) */ -+ .4byte FUNC_attr /* DW_AT_low_pc */ -+ .4byte FUNC_lang /* DW_AT_high_pc */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */ -+ .byte 1 /* DW_AT_external */ -+ .ascii "FUNC_attr\0" /* DW_AT_name */ -+ .4byte FUNC_attr /* DW_AT_low_pc */ -+ .4byte FUNC_lang /* DW_AT_high_pc */ -+ -+ .byte 0 /* End of children of CU */ -+.Lcu1_end: -+ -+.Lcu2_begin: -+ /* CU header */ -+ .4byte .Lcu2_end - .Lcu2_start /* Length of Compilation Unit */ -+.Lcu2_start: -+ .2byte 2 /* DWARF Version */ -+ .4byte .Labbrev1_begin /* Offset into abbrev section */ -+ .byte 4 /* Pointer size */ -+ -+ /* CU die */ -+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ -+ .ascii "file1.txt\0" /* DW_AT_name */ -+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ -+ .byte 8 /* DW_AT_language (DW_LANG_Fortran90) */ -+ .4byte FUNC_lang /* DW_AT_low_pc */ -+ .4byte main /* DW_AT_high_pc */ -+ -+ .uleb128 3 /* Abbrev: DW_TAG_subprogram */ -+ .byte 1 /* DW_AT_external */ -+ .ascii "FUNC_lang\0" /* DW_AT_name */ -+ .4byte FUNC_lang /* DW_AT_low_pc */ -+ .4byte main /* DW_AT_high_pc */ -+ -+ .byte 0 /* End of children of CU */ -+.Lcu2_end: -+ -+/* Abbrev table */ -+ .section .debug_abbrev -+.Labbrev1_begin: -+ .uleb128 1 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 2 /* Abbrev code */ -+ .uleb128 0x11 /* DW_TAG_compile_unit */ -+ .byte 1 /* has_children */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x25 /* DW_AT_producer */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x13 /* DW_AT_language */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x42 /* DW_AT_identifier_case */ -+ .uleb128 0xb /* DW_FORM_data1 */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .uleb128 3 /* Abbrev code */ -+ .uleb128 0x2e /* DW_TAG_subprogram */ -+ .byte 0 /* has_children */ -+ .uleb128 0x3f /* DW_AT_external */ -+ .uleb128 0xc /* DW_FORM_flag */ -+ .uleb128 0x3 /* DW_AT_name */ -+ .uleb128 0x8 /* DW_FORM_string */ -+ .uleb128 0x11 /* DW_AT_low_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .uleb128 0x12 /* DW_AT_high_pc */ -+ .uleb128 0x1 /* DW_FORM_addr */ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -+ -+ .byte 0x0 /* Terminator */ -+ .byte 0x0 /* Terminator */ -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.c 2010-11-07 05:38:35.000000000 +0100 -@@ -0,0 +1,36 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+/* This one is DW_LANG_C but it uses DW_ID_case_insensitive. */ -+ -+void -+FUNC_attr (void) -+{ -+} -+ -+/* This one has no DW_AT_identifier_case but it is DW_LANG_Fortran90. */ -+ -+void -+FUNC_lang (void) -+{ -+} -+ -+int -+main() -+{ -+ return 0; -+} -Index: gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp 2010-11-07 05:38:35.000000000 +0100 -@@ -0,0 +1,41 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# This test can only be run on targets which support DWARF-2 and use gas. -+# For now pick a sampling of likely targets. -+if {![istarget *-*-linux*] -+ && ![istarget *-*-gnu*] -+ && ![istarget *-*-elf*] -+ && ![istarget *-*-openbsd*] -+ && ![istarget arm-*-eabi*] -+ && ![istarget powerpc-*-eabi*]} { -+ return 0 -+} -+ -+set testfile "dw2-case-insensitive" -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } { -+ return -1 -+} -+ -+gdb_test_no_output "set language fortran" -+ -+if {[gdb_breakpoint "fuNC_attr"] == 1} { -+ pass "setting breakpoint at fuNC_attr" -+} -+ -+if {[gdb_breakpoint "fuNC_lang"] == 1} { -+ pass "setting breakpoint at fuNC_lang" -+} -Index: gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp -=================================================================== ---- gdb-7.2.orig/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2010-01-01 08:32:03.000000000 +0100 -+++ gdb-7.2/gdb/testsuite/gdb.mi/mi-var-child-f.exp 2010-11-07 05:38:35.000000000 +0100 -@@ -36,7 +36,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${ - mi_gdb_reinitialize_dir $srcdir/$subdir - mi_gdb_load ${binfile} - --mi_runto MAIN__ -+mi_runto main__ - - mi_gdb_test "-var-create array * array" \ - "\\^done,name=\"array\",numchild=\"3\",value=\".*\",type=\"integer \\(2,-1:1\\)\"" \ diff --git a/gdb-exec-pie-amd64.patch b/gdb-exec-pie-amd64.patch deleted file mode 100644 index e8403ad..0000000 --- a/gdb-exec-pie-amd64.patch +++ /dev/null @@ -1,418 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00519.html -Subject: [patch] Fix inferior execl of new PIE x86_64 - -Hi, - -gcc -o 1 1.c -Wall -g -fPIE -pie; gdb -nx ./1 -ex 'b main' -ex r -ex c - -Starting program: .../gdb/1 -Breakpoint 1, main (argc=1, argv=0x7fffffffdff8) at 1.c:7 -7 setbuf (stdout, NULL); -Continuing. -re-exec -process 28056 is executing new program: .../gdb/1 -Error in re-setting breakpoint 1: Cannot access memory at address 0x80c -exit -Program exited normally. -(gdb) _ - -while it should be: - -re-exec -process 28095 is executing new program: .../gdb/1 -Breakpoint 1, main (argc=2, argv=0x7fffffffe008) at 1.c:7 -7 setbuf (stdout, NULL); -(gdb) _ - -The error comes from: - -throw_error <- memory_error <- read_memory <- read_memory_unsigned_integer <- -amd64_analyze_prologue <- amd64_skip_prologue <- gdbarch_skip_prologue <- -skip_prologue_sal <- find_function_start_sal <- symbol_found <- decode_variable -<- decode_line_1 <- breakpoint_re_set_one <- catch_errors <- breakpoint_re_set -<- clear_symtab_users <- new_symfile_objfile <- -symbol_file_add_with_addrs_or_offsets <- symbol_file_add_from_bfd <- -symbol_file_add <- symbol_file_add_main_1 <- symbol_file_add_main <- -follow_exec - - -I understand this hack is not nice, the correct way would be to unify more -follow_exec with post_create_inferior. But I could break it for non-GNU/Linux -targets a lot. - -No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. - - -Thanks, -Jan - - -for the demo above: ------------------------------------------------------------------------------- -#include -#include -#include -int -main (int argc, char **argv) -{ - setbuf (stdout, NULL); - if (argc == 1) - { - puts ("re-exec"); - execl ("/proc/self/exe", argv[0], "foo", NULL); - assert (0); - } - puts ("exit"); - return 0; -} ------------------------------------------------------------------------------- - - -gdb/ -2010-09-30 Jan Kratochvil - - * infrun.c (follow_exec): Replace symbol_file_add_main by - symbol_file_add with SYMFILE_DEFER_BP_RESET, set_initial_language and - breakpoint_re_set. - * m32r-rom.c (m32r_load, m32r_upload_command): Use parameter 0 for - clear_symtab_users. - * objfiles.c (free_all_objfiles): Likewise. - * remote-m32r-sdi.c (m32r_load): Likewise. - * solib-som.c (som_solib_create_inferior_hook): Likewise. - * symfile.c (new_symfile_objfile): New comment for add_flags. Call - clear_symtab_users with ADD_FLAGS. - (reread_symbols): Use parameter 0 for clear_symtab_users. - (clear_symtab_users): New parameter add_flags. Do not call - breakpoint_re_set if SYMFILE_DEFER_BP_RESET. - (clear_symtab_users_cleanup): Use parameter 0 for clear_symtab_users. - * symtab.h (clear_symtab_users): New parameter add_flags. - -gdb/testsuite/ -2010-09-30 Jan Kratochvil - - * gdb.base/pie-execl.exp: New file. - * gdb.base/pie-execl.c: New file. - -Index: gdb-7.2/gdb/infrun.c -=================================================================== ---- gdb-7.2.orig/gdb/infrun.c 2010-10-12 18:27:58.000000000 +0200 -+++ gdb-7.2/gdb/infrun.c 2010-10-12 18:29:24.000000000 +0200 -@@ -840,8 +840,15 @@ follow_exec (ptid_t pid, char *execd_pat - /* That a.out is now the one to use. */ - exec_file_attach (execd_pathname, 0); - -- /* Load the main file's symbols. */ -- symbol_file_add_main (execd_pathname, 0); -+ /* SYMFILE_DEFER_BP_RESET is used as the proper displacement for PIE -+ (Position Independent Executable) main symbol file will get applied by -+ solib_create_inferior_hook below. breakpoint_re_set would fail to insert -+ the breakpoints with the zero displacement. */ -+ -+ symbol_file_add (execd_pathname, SYMFILE_MAINLINE | SYMFILE_DEFER_BP_RESET, -+ NULL, 0); -+ -+ set_initial_language (); - - #ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); -@@ -851,6 +858,8 @@ follow_exec (ptid_t pid, char *execd_pat - - jit_inferior_created_hook (); - -+ breakpoint_re_set (); -+ - /* Reinsert all breakpoints. (Those which were symbolic have - been reset to the proper address in the new a.out, thanks - to symbol_file_command...) */ -Index: gdb-7.2/gdb/m32r-rom.c -=================================================================== ---- gdb-7.2.orig/gdb/m32r-rom.c 2010-01-01 08:31:37.000000000 +0100 -+++ gdb-7.2/gdb/m32r-rom.c 2010-10-12 18:29:24.000000000 +0200 -@@ -188,7 +188,7 @@ m32r_load (char *filename, int from_tty) - the stack may not be valid, and things would get horribly - confused... */ - -- clear_symtab_users (); -+ clear_symtab_users (0); - } - - static void -@@ -551,7 +551,7 @@ m32r_upload_command (char *args, int fro - the stack may not be valid, and things would get horribly - confused... */ - -- clear_symtab_users (); -+ clear_symtab_users (0); - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -Index: gdb-7.2/gdb/objfiles.c -=================================================================== ---- gdb-7.2.orig/gdb/objfiles.c 2010-10-12 18:27:56.000000000 +0200 -+++ gdb-7.2/gdb/objfiles.c 2010-10-12 18:29:39.000000000 +0200 -@@ -699,7 +699,7 @@ free_all_objfiles (void) - { - free_objfile (objfile); - } -- clear_symtab_users (); -+ clear_symtab_users (0); - } - - /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS -Index: gdb-7.2/gdb/remote-m32r-sdi.c -=================================================================== ---- gdb-7.2.orig/gdb/remote-m32r-sdi.c 2010-07-07 18:15:16.000000000 +0200 -+++ gdb-7.2/gdb/remote-m32r-sdi.c 2010-10-12 18:29:24.000000000 +0200 -@@ -1377,7 +1377,7 @@ m32r_load (char *args, int from_tty) - might be to call normal_stop, except that the stack may not be valid, - and things would get horribly confused... */ - -- clear_symtab_users (); -+ clear_symtab_users (0); - - if (!nostart) - { -Index: gdb-7.2/gdb/solib-som.c -=================================================================== ---- gdb-7.2.orig/gdb/solib-som.c 2010-05-17 01:49:58.000000000 +0200 -+++ gdb-7.2/gdb/solib-som.c 2010-10-12 18:29:24.000000000 +0200 -@@ -354,7 +354,7 @@ keep_going: - /* Make the breakpoint at "_start" a shared library event breakpoint. */ - create_solib_event_breakpoint (target_gdbarch, anaddr); - -- clear_symtab_users (); -+ clear_symtab_users (0); - } - - static void -Index: gdb-7.2/gdb/symfile.c -=================================================================== ---- gdb-7.2.orig/gdb/symfile.c 2010-10-12 18:27:57.000000000 +0200 -+++ gdb-7.2/gdb/symfile.c 2010-10-12 18:29:24.000000000 +0200 -@@ -1036,7 +1036,7 @@ syms_from_objfile (struct objfile *objfi - - /* Perform required actions after either reading in the initial - symbols for a new objfile, or mapping in the symbols from a reusable -- objfile. */ -+ objfile. ADD_FLAGS is a bitmask of enum symfile_add_flags. */ - - void - new_symfile_objfile (struct objfile *objfile, int add_flags) -@@ -1049,7 +1049,7 @@ new_symfile_objfile (struct objfile *obj - /* OK, make it the "real" symbol file. */ - symfile_objfile = objfile; - -- clear_symtab_users (); -+ clear_symtab_users (add_flags); - } - else if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0) - { -@@ -2527,7 +2527,7 @@ reread_symbols (void) - /* Notify objfiles that we've modified objfile sections. */ - objfiles_changed (); - -- clear_symtab_users (); -+ clear_symtab_users (0); - /* At least one objfile has changed, so we can consider that - the executable we're debugging has changed too. */ - observer_notify_executable_changed (); -@@ -2745,10 +2745,10 @@ allocate_symtab (char *filename, struct - - - /* Reset all data structures in gdb which may contain references to symbol -- table data. */ -+ table data. ADD_FLAGS is a bitmask of enum symfile_add_flags. */ - - void --clear_symtab_users (void) -+clear_symtab_users (int add_flags) - { - /* Someday, we should do better than this, by only blowing away - the things that really need to be blown. */ -@@ -2758,7 +2758,8 @@ clear_symtab_users (void) - clear_current_source_symtab_and_line (); - - clear_displays (); -- breakpoint_re_set (); -+ if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0) -+ breakpoint_re_set (); - set_default_breakpoint (0, NULL, 0, 0, 0); - clear_pc_function_cache (); - observer_notify_new_objfile (NULL); -@@ -2777,7 +2778,7 @@ clear_symtab_users (void) - static void - clear_symtab_users_cleanup (void *ignore) - { -- clear_symtab_users (); -+ clear_symtab_users (0); - } - - /* OVERLAYS: -Index: gdb-7.2/gdb/symtab.h -=================================================================== ---- gdb-7.2.orig/gdb/symtab.h 2010-10-12 18:27:56.000000000 +0200 -+++ gdb-7.2/gdb/symtab.h 2010-10-12 18:29:24.000000000 +0200 -@@ -1170,7 +1170,7 @@ extern void skip_prologue_sal (struct sy - - /* symfile.c */ - --extern void clear_symtab_users (void); -+extern void clear_symtab_users (int add_flags); - - extern enum language deduce_language_from_filename (const char *); - -Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.c 2010-10-12 18:29:24.000000000 +0200 -@@ -0,0 +1,51 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2010 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include -+#include -+#include -+ -+static void pie_execl_marker (void); -+ -+int -+main (int argc, char **argv) -+{ -+ setbuf (stdout, NULL); -+ -+#if BIN == 1 -+ if (argc == 2) -+ { -+ printf ("pie-execl: re-exec: %s\n", argv[1]); -+ execl (argv[1], argv[1], NULL); -+ assert (0); -+ } -+#endif -+ -+ pie_execl_marker (); -+ -+ return 0; -+} -+ -+/* pie_execl_marker must be on a different address than in `pie-execl2.c'. */ -+ -+volatile int v; -+ -+static void -+pie_execl_marker (void) -+{ -+ v = 1; -+} -Index: gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.base/pie-execl.exp 2010-10-12 18:29:24.000000000 +0200 -@@ -0,0 +1,94 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# The problem was due to amd64_skip_prologue attempting to access inferior -+# memory before the PIE (Position Independent Executable) gets relocated. -+ -+if { ![istarget *-linux*]} { -+ continue -+} -+ -+set testfile "pie-execl" -+set srcfile ${testfile}.c -+set executable1 ${testfile}1 -+set executable2 ${testfile}2 -+set binfile1 ${objdir}/${subdir}/${executable1} -+set binfile2 ${objdir}/${subdir}/${executable2} -+ -+# Use conditional compilation according to `BIN' as GDB remembers the source -+# file name of the breakpoint. -+ -+set opts [list debug {additional_flags=-fPIE -pie}] -+if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == "" -+ || [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == ""} { -+ return -1 -+} -+ -+clean_restart ${executable1} -+ -+gdb_test_no_output "set args ${binfile2}" -+ -+if ![runto_main] { -+ return -1 -+} -+ -+# Do not stop on `main' after re-exec. -+delete_breakpoints -+ -+gdb_breakpoint "pie_execl_marker" -+gdb_test "info breakpoints" ".*" "" -+ -+set addr1 "" -+set test "pie_execl_marker address first" -+gdb_test_multiple "p/x &pie_execl_marker" $test { -+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { -+ set addr1 $expect_out(1,string) -+ pass $test -+ } -+} -+verbose -log "addr1 is $addr1" -+ -+set test "continue" -+gdb_test_multiple $test $test { -+ -re "Error in re-setting breakpoint" { -+ fail $test -+ } -+ -re "Cannot access memory" { -+ fail $test -+ } -+ -re "pie-execl: re-exec.*executing new program.*\r\nBreakpoint \[0-9\]+,\[^\r\n\]* pie_execl_marker .*\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ -+gdb_test "info breakpoints" ".*" "" -+ -+set addr2 "" -+set test "pie_execl_marker address second" -+gdb_test_multiple "p/x &pie_execl_marker" $test { -+ -re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { -+ set addr2 $expect_out(1,string) -+ pass $test -+ } -+} -+verbose -log "addr2 is $addr2" -+ -+# Ensure we cannot get a false PASS and the inferior has really changed. -+set test "pie_execl_marker address has changed" -+if [string equal $addr1 $addr2] { -+ fail $test -+} else { -+ pass $test -+} diff --git a/gdb-fortran-common.patch b/gdb-fortran-common.patch index 63fa81c..a70b780 100644 --- a/gdb-fortran-common.patch +++ b/gdb-fortran-common.patch @@ -1,8 +1,8 @@ -Index: gdb-7.1.90.20100711/gdb/dwarf2read.c +Index: gdb-7.2.50.20101116/gdb/dwarf2read.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c 2010-07-13 00:13:02.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/dwarf2read.c 2010-07-13 00:26:25.000000000 +0200 -@@ -5727,12 +5727,14 @@ read_set_type (struct die_info *die, str +--- gdb-7.2.50.20101116.orig/gdb/dwarf2read.c 2010-11-16 08:19:54.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/dwarf2read.c 2010-11-16 08:25:21.000000000 +0100 +@@ -7315,12 +7315,14 @@ read_set_type (struct die_info *die, str return set_die_type (die, set_type, cu); } @@ -19,7 +19,7 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c struct attribute *attr; struct symbol *sym; CORE_ADDR base = (CORE_ADDR) 0; -@@ -5757,10 +5759,40 @@ read_common_block (struct die_info *die, +@@ -7345,10 +7347,40 @@ read_common_block (struct die_info *die, } if (die->child != NULL) { @@ -58,9 +58,9 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c + + /* Undocumented in DWARF3, when it can be present? */ attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu); - if (attr) + if (sym != NULL && attr != NULL) { -@@ -5778,8 +5810,25 @@ read_common_block (struct die_info *die, +@@ -7366,8 +7398,25 @@ read_common_block (struct die_info *die, SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset; add_symbol_to_list (sym, &global_symbols); } @@ -86,7 +86,7 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c } } -@@ -9106,6 +9155,13 @@ new_symbol (struct die_info *die, struct +@@ -10954,6 +11003,13 @@ new_symbol_full (struct die_info *die, s { var_decode_location (attr, sym, cu); attr2 = dwarf2_attr (die, DW_AT_external, cu); @@ -97,12 +97,12 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c + && die->parent->tag == DW_TAG_common_block) + attr2 = NULL; + - if (attr2 && (DW_UNSND (attr2) != 0)) - { - struct pending **list_to_add; -@@ -9277,6 +9333,11 @@ new_symbol (struct die_info *die, struct + if (SYMBOL_CLASS (sym) == LOC_STATIC + && SYMBOL_VALUE_ADDRESS (sym) == 0 + && !dwarf2_per_objfile->has_section_at_zero) +@@ -11126,6 +11182,11 @@ new_symbol_full (struct die_info *die, s SYMBOL_CLASS (sym) = LOC_TYPEDEF; - add_symbol_to_list (sym, &global_symbols); + list_to_add = &global_symbols; break; + case DW_TAG_common_block: + SYMBOL_CLASS (sym) = LOC_STATIC; @@ -112,10 +112,10 @@ Index: gdb-7.1.90.20100711/gdb/dwarf2read.c default: /* Not a tag we recognize. Hopefully we aren't processing trash data, but since we must specifically ignore things -Index: gdb-7.1.90.20100711/gdb/f-lang.c +Index: gdb-7.2.50.20101116/gdb/f-lang.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/f-lang.c 2010-07-13 00:24:04.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/f-lang.c 2010-07-13 00:25:56.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/f-lang.c 2010-11-16 08:21:46.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/f-lang.c 2010-11-16 08:22:05.000000000 +0100 @@ -443,27 +443,3 @@ _initialize_f_language (void) add_language (&f_language_defn); @@ -144,10 +144,10 @@ Index: gdb-7.1.90.20100711/gdb/f-lang.c - } - return (NULL); -} -Index: gdb-7.1.90.20100711/gdb/f-lang.h +Index: gdb-7.2.50.20101116/gdb/f-lang.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/f-lang.h 2010-07-13 00:24:04.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/f-lang.h 2010-07-13 00:25:56.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/f-lang.h 2010-11-16 08:21:46.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/f-lang.h 2010-11-16 08:22:05.000000000 +0100 @@ -52,36 +52,8 @@ enum f90_range_type NONE_BOUND_DEFAULT /* "(low:high)" */ }; @@ -185,10 +185,10 @@ Index: gdb-7.1.90.20100711/gdb/f-lang.h /* When reasonable array bounds cannot be fetched, such as when you ask to 'mt print symbols' and there is no stack frame and -Index: gdb-7.1.90.20100711/gdb/f-valprint.c +Index: gdb-7.2.50.20101116/gdb/f-valprint.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/f-valprint.c 2010-07-13 00:24:25.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/f-valprint.c 2010-07-13 00:32:05.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/f-valprint.c 2010-11-16 08:21:46.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/f-valprint.c 2010-11-16 08:22:05.000000000 +0100 @@ -34,6 +34,8 @@ #include "gdbcore.h" #include "command.h" @@ -371,11 +371,11 @@ Index: gdb-7.1.90.20100711/gdb/f-valprint.c } void -Index: gdb-7.1.90.20100711/gdb/stack.c +Index: gdb-7.2.50.20101116/gdb/stack.c =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/stack.c 2010-07-01 17:36:17.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/stack.c 2010-07-13 00:29:49.000000000 +0200 -@@ -1484,6 +1484,8 @@ iterate_over_block_locals (struct block +--- gdb-7.2.50.20101116.orig/gdb/stack.c 2010-09-30 12:29:00.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/stack.c 2010-11-16 08:22:05.000000000 +0100 +@@ -1490,6 +1490,8 @@ iterate_over_block_locals (struct block case LOC_COMPUTED: if (SYMBOL_IS_ARGUMENT (sym)) break; @@ -384,11 +384,11 @@ Index: gdb-7.1.90.20100711/gdb/stack.c (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data); break; -Index: gdb-7.1.90.20100711/gdb/symtab.h +Index: gdb-7.2.50.20101116/gdb/symtab.h =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/symtab.h 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/symtab.h 2010-07-13 00:27:02.000000000 +0200 -@@ -396,7 +396,10 @@ typedef enum domain_enum_tag +--- gdb-7.2.50.20101116.orig/gdb/symtab.h 2010-11-16 07:53:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/symtab.h 2010-11-16 08:22:05.000000000 +0100 +@@ -408,7 +408,10 @@ typedef enum domain_enum_tag FUNCTIONS_DOMAIN, /* All defined types */ @@ -400,10 +400,10 @@ Index: gdb-7.1.90.20100711/gdb/symtab.h } domain_enum; -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 00:25:56.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp 2010-11-16 08:22:05.000000000 +0100 @@ -0,0 +1,101 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -506,10 +506,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp +gdb_test "p ix_x" " = 1 *" "p ix_x in" +gdb_test "p iy_y" " = 2 *" "p iy_y in" +gdb_test "p iz_z2" " = 3 *" "p iz_z2 in" -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.f90 +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.f90 2010-07-13 00:25:56.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.f90 2010-11-16 08:22:05.000000000 +0100 @@ -0,0 +1,67 @@ +! Copyright 2008 Free Software Foundation, Inc. +! diff --git a/gdb-gdb-add-index-script.patch b/gdb-gdb-add-index-script.patch index c770a77..1c145ac 100644 --- a/gdb-gdb-add-index-script.patch +++ b/gdb-gdb-add-index-script.patch @@ -40,11 +40,11 @@ Subject: [PATCH 4/4] add gdb-add-index 5 files changed, 57 insertions(+), 1 deletions(-) create mode 100755 gdb/gdb-add-index -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 6dbb284..8210a2c 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -1018,7 +1018,16 @@ install-only: $(CONFIG_INSTALL) xml-syscall-install +Index: gdb-7.2.50.20101116/gdb/Makefile.in +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/Makefile.in 2010-11-16 08:03:17.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/Makefile.in 2010-11-16 08:47:45.000000000 +0100 +@@ -986,7 +986,16 @@ install-only: install-gstack $(CONFIG_IN $(SHELL) $(srcdir)/../mkinstalldirs \ $(DESTDIR)$(man1dir) ; \ $(INSTALL_DATA) $(srcdir)/gdb.1 \ @@ -62,11 +62,11 @@ index 6dbb284..8210a2c 100644 @$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do .PHONY: install-tui install-tui: -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 69141e3..457e6b4 100644 ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -15045,6 +15045,14 @@ There are currently some limitation on indices. They only work when +Index: gdb-7.2.50.20101116/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/doc/gdb.texinfo 2010-11-16 08:04:18.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/doc/gdb.texinfo 2010-11-16 08:56:30.000000000 +0100 +@@ -15500,6 +15500,14 @@ There are currently some limitation on i for DWARF debugging information, not stabs. And, they do not currently work for programs using Ada. @@ -78,14 +78,13 @@ index 69141e3..457e6b4 100644 +$ gdb-add-index symfile +@end smallexample + - @node Symbol Errors @section Errors Reading Symbol Files -diff --git a/gdb/gdb-add-index b/gdb/gdb-add-index -new file mode 100755 -index 0000000..c9a03b0 ---- /dev/null -+++ b/gdb/gdb-add-index + +Index: gdb-7.2.50.20101116/gdb/gdb-add-index +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.2.50.20101116/gdb/gdb-add-index 2010-11-16 08:47:45.000000000 +0100 @@ -0,0 +1,30 @@ +#! /bin/sh + @@ -117,6 +116,3 @@ index 0000000..c9a03b0 +fi + +exit 0 --- -1.6.2.5 - diff --git a/gdb-gdbindex-ada-regression.patch b/gdb-gdbindex-ada-regression.patch deleted file mode 100644 index 9d67d58..0000000 --- a/gdb-gdbindex-ada-regression.patch +++ /dev/null @@ -1,50 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00273.html -Subject: [patch] .gdb_index: Fix Ada regression - -Hi, - -on a system with libraries using .gdb_index all the Ada testcases FAIL: - -Running ./gdb.ada/print_pc.exp ... -FAIL: gdb.ada/print_pc.exp: start inferior (GDB internal error) -FAIL: gdb.ada/print_pc.exp: p /x $pc - -dwarf2read.c:2374: internal-error: map_ada_symtabs called via index method - -FAIl is on Fedora 14 snapshot using gcc-debuginfo-4.5.1-3.fc14.x86_64 file: - /usr/lib/debug/lib64/libgcc_s-4.5.1-20100907.so.1.debug - -The regressions get fixed on x86_64-fedora14snapshot-linux-gnu by the attached -patch. No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. - -During my tests with `set language ada' I could not lookup non-Ada symbols -anyway so I believe the patch is OK but sure it needs an Ada-wise review. - - -Thanks, -Jan - - -gdb/ -2010-09-14 Jan Kratochvil - - * dwarf2read.c (dw2_map_ada_symtabs): Remove the internal_error. - Update the comment. - ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -2369,10 +2369,9 @@ dw2_map_ada_symtabs (struct objfile *objfile, - domain_enum namespace, int wild, - void *data) - { -- /* For now, we don't support Ada, so this function can't be -- reached. */ -- internal_error (__FILE__, __LINE__, -- _("map_ada_symtabs called via index method")); -+ /* For now, we don't support Ada. Still the function can be called if the -+ current language is Ada for a non-Ada objfile using GNU index. As Ada -+ does not look for non-Ada symbols this function should just return. */ - } - - static void - diff --git a/gdb-gdbindex-bigendian.patch b/gdb-gdbindex-bigendian.patch deleted file mode 100644 index edd4f4f..0000000 --- a/gdb-gdbindex-bigendian.patch +++ /dev/null @@ -1,96 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00434.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00155.html - -### src/gdb/ChangeLog 2010/09/24 14:47:52 1.12202 -### src/gdb/ChangeLog 2010/09/24 16:11:44 1.12203 -## -1,3 +1,9 @@ -+2010-09-24 Tom Tromey -+ -+ * dwarf2read.c (dw2_expand_symtabs_matching): Add missing -+ MAYBE_SWAPs. -+ (dw2_map_symbol_names): Likewise. -+ - 2010-09-24 Sami Wagiaalla - - * valops.c (find_oload_champ_namespace_loop): replace incorrect ---- src/gdb/dwarf2read.c 2010/09/22 19:22:44 1.460 -+++ src/gdb/dwarf2read.c 2010/09/24 16:11:46 1.461 -@@ -2382,10 +2382,12 @@ - { - int i; - offset_type iter; -+ struct mapped_index *index; - - dw2_setup (objfile); - if (!dwarf2_per_objfile->index_table) - return; -+ index = dwarf2_per_objfile->index_table; - - for (i = 0; i < (dwarf2_per_objfile->n_comp_units - + dwarf2_per_objfile->n_type_comp_units); ++i) -@@ -2411,28 +2413,24 @@ - } - } - -- for (iter = 0; -- iter < dwarf2_per_objfile->index_table->index_table_slots; -- ++iter) -+ for (iter = 0; iter < index->index_table_slots; ++iter) - { - offset_type idx = 2 * iter; - const char *name; - offset_type *vec, vec_len, vec_idx; - -- if (dwarf2_per_objfile->index_table->index_table[idx] == 0 -- && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0) -+ if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0) - continue; - -- name = (dwarf2_per_objfile->index_table->constant_pool -- + dwarf2_per_objfile->index_table->index_table[idx]); -+ name = index->constant_pool + MAYBE_SWAP (index->index_table[idx]); - - if (! (*name_matcher) (name, data)) - continue; - - /* The name was matched, now expand corresponding CUs that were - marked. */ -- vec = (offset_type *) (dwarf2_per_objfile->index_table->constant_pool -- + dwarf2_per_objfile->index_table->index_table[idx + 1]); -+ vec = (offset_type *) (index->constant_pool -+ + MAYBE_SWAP (index->index_table[idx + 1])); - vec_len = MAYBE_SWAP (vec[0]); - for (vec_idx = 0; vec_idx < vec_len; ++vec_idx) - { -@@ -2476,25 +2474,24 @@ - void *data) - { - offset_type iter; -+ struct mapped_index *index; -+ - dw2_setup (objfile); - - if (!dwarf2_per_objfile->index_table) - return; -+ index = dwarf2_per_objfile->index_table; - -- for (iter = 0; -- iter < dwarf2_per_objfile->index_table->index_table_slots; -- ++iter) -+ for (iter = 0; iter < index->index_table_slots; ++iter) - { - offset_type idx = 2 * iter; - const char *name; - offset_type *vec, vec_len, vec_idx; - -- if (dwarf2_per_objfile->index_table->index_table[idx] == 0 -- && dwarf2_per_objfile->index_table->index_table[idx + 1] == 0) -+ if (index->index_table[idx] == 0 && index->index_table[idx + 1] == 0) - continue; - -- name = (dwarf2_per_objfile->index_table->constant_pool -- + dwarf2_per_objfile->index_table->index_table[idx]); -+ name = (index->constant_pool + MAYBE_SWAP (index->index_table[idx])); - - (*fun) (name, data); - } diff --git a/gdb-gdbindex-v1-to-v2.patch b/gdb-gdbindex-v1-to-v2.patch deleted file mode 100644 index 2a7b9b7..0000000 --- a/gdb-gdbindex-v1-to-v2.patch +++ /dev/null @@ -1,689 +0,0 @@ -http://sourceware.org/ml/gdb-cvs/2010-07/msg00139.html - -### src/gdb/ChangeLog 2010/07/23 21:10:54 1.12013 -### src/gdb/ChangeLog 2010/07/23 22:15:13 1.12014 -## -1,3 +1,31 @@ -+2010-07-23 Tom Tromey -+ -+ * dwarf2read.c (struct dwarf2_per_objfile) : New fields. -+ (dw2_get_cu): New function. -+ (create_cus_from_index): Remove unused argument. -+ (create_signatured_type_hash_from_index): New function. -+ (create_addrmap_from_index): Update. -+ (dwarf2_read_index): Handle version 2. -+ (dw2_find_last_source_symtab, dw2_forget_cached_source_info) -+ (dw2_lookup_symtab, dw2_do_expand_symtabs_matching) -+ (dw2_print_stats, dw2_expand_all_symtabs) -+ (dw2_expand_symtabs_with_filename, dw2_find_symbol_file) -+ (dw2_expand_symtabs_matching, dw2_map_symbol_filenames): Update. -+ (dwarf2_initialize_objfile): Call create_debug_types_hash_table. -+ (allocate_signatured_type_hash_table): New function. -+ (add_signatured_type_cu_to_list): Likewise. -+ (create_debug_types_hash_table): Use them. Set type_comp_units. -+ (read_signatured_type): Ensure section data is available. -+ (add_address_entry): Don't record empty ranges. -+ (struct signatured_type_index_data): New. -+ (write_one_signatured_type): New function. -+ (write_psymtabs_to_index): Write type CUs. -+ (save_gdb_index_command): Update comment. -+ (process_type_comp_unit): Move inititalization of -+ from_debug_types... -+ (create_debug_types_hash_table): ... here. -+ - 2010-07-23 Jan Kratochvil - - * gdb_gcore.sh (tmpfile): Remove the variable, its initialization, -Index: gdb-7.2/gdb/dwarf2read.c -=================================================================== ---- gdb-7.2.orig/gdb/dwarf2read.c 2010-10-12 18:10:47.000000000 +0200 -+++ gdb-7.2/gdb/dwarf2read.c 2010-10-12 18:11:16.000000000 +0200 -@@ -184,6 +184,12 @@ struct dwarf2_per_objfile - /* The number of compilation units in ALL_COMP_UNITS. */ - int n_comp_units; - -+ /* The number of .debug_types-related CUs. */ -+ int n_type_comp_units; -+ -+ /* The .debug_types-related CUs. */ -+ struct dwarf2_per_cu_data **type_comp_units; -+ - /* A chain of compilation units that are currently read in, so that - they can be freed later. */ - struct dwarf2_per_cu_data *read_in_chain; -@@ -1226,6 +1232,8 @@ static struct type *set_die_type (struct - - static void create_all_comp_units (struct objfile *); - -+static int create_debug_types_hash_table (struct objfile *objfile); -+ - static void load_full_comp_unit (struct dwarf2_per_cu_data *, - struct objfile *); - -@@ -1269,6 +1277,8 @@ static void init_cu_die_reader (struct d - static const char *dwarf2_physname (char *name, struct die_info *die, - struct dwarf2_cu *cu); - -+static htab_t allocate_signatured_type_hash_table (struct objfile *objfile); -+ - #if WORDS_BIGENDIAN - - /* Convert VALUE between big- and little-endian. */ -@@ -1646,6 +1656,18 @@ dw2_instantiate_symtab (struct objfile * - return per_cu->v.quick->symtab; - } - -+/* Return the CU given its index. */ -+static struct dwarf2_per_cu_data * -+dw2_get_cu (int index) -+{ -+ if (index >= dwarf2_per_objfile->n_comp_units) -+ { -+ index -= dwarf2_per_objfile->n_comp_units; -+ return dwarf2_per_objfile->type_comp_units[index]; -+ } -+ return dwarf2_per_objfile->all_comp_units[index]; -+} -+ - /* A helper function that knows how to read a 64-bit value in a way - that doesn't make gdb die. Returns 1 if the conversion went ok, 0 - otherwise. */ -@@ -1672,11 +1694,10 @@ extract_cu_value (const char *bytes, ULO - the CU objects for this objfile. Return 0 if something went wrong, - 1 if everything went ok. */ - static int --create_cus_from_index (struct objfile *objfile, struct mapped_index *index, -- const gdb_byte *cu_list, offset_type cu_list_elements) -+create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list, -+ offset_type cu_list_elements) - { - offset_type i; -- const char *entry; - - dwarf2_per_objfile->n_comp_units = cu_list_elements / 2; - dwarf2_per_objfile->all_comp_units -@@ -1707,6 +1728,58 @@ create_cus_from_index (struct objfile *o - return 1; - } - -+/* Create the signatured type hash table from the index. */ -+static int -+create_signatured_type_hash_from_index (struct objfile *objfile, -+ const gdb_byte *bytes, -+ offset_type elements) -+{ -+ offset_type i; -+ htab_t type_hash; -+ -+ dwarf2_per_objfile->n_type_comp_units = elements / 3; -+ dwarf2_per_objfile->type_comp_units -+ = obstack_alloc (&objfile->objfile_obstack, -+ dwarf2_per_objfile->n_type_comp_units -+ * sizeof (struct dwarf2_per_cu_data *)); -+ -+ type_hash = allocate_signatured_type_hash_table (objfile); -+ -+ for (i = 0; i < elements; i += 3) -+ { -+ struct signatured_type *type_sig; -+ ULONGEST offset, type_offset, signature; -+ void **slot; -+ -+ if (!extract_cu_value (bytes, &offset) -+ || !extract_cu_value (bytes + 8, &type_offset)) -+ return 0; -+ signature = extract_unsigned_integer (bytes + 16, 8, BFD_ENDIAN_LITTLE); -+ bytes += 3 * 8; -+ -+ type_sig = OBSTACK_ZALLOC (&objfile->objfile_obstack, -+ struct signatured_type); -+ type_sig->signature = signature; -+ type_sig->offset = offset; -+ type_sig->type_offset = type_offset; -+ type_sig->per_cu.from_debug_types = 1; -+ type_sig->per_cu.offset = offset; -+ type_sig->per_cu.objfile = objfile; -+ type_sig->per_cu.v.quick -+ = OBSTACK_ZALLOC (&objfile->objfile_obstack, -+ struct dwarf2_per_cu_quick_data); -+ -+ slot = htab_find_slot (type_hash, type_sig, INSERT); -+ *slot = type_sig; -+ -+ dwarf2_per_objfile->type_comp_units[i / 3] = &type_sig->per_cu; -+ } -+ -+ dwarf2_per_objfile->signatured_types = type_hash; -+ -+ return 1; -+} -+ - /* Read the address map data from the mapped index, and use it to - populate the objfile's psymtabs_addrmap. */ - static void -@@ -1738,7 +1811,7 @@ create_addrmap_from_index (struct objfil - iter += 4; - - addrmap_set_empty (mutable_map, lo + baseaddr, hi + baseaddr - 1, -- dwarf2_per_objfile->all_comp_units[cu_index]); -+ dw2_get_cu (cu_index)); - } - - objfile->psymtabs_addrmap = addrmap_create_fixed (mutable_map, -@@ -1805,8 +1878,9 @@ dwarf2_read_index (struct objfile *objfi - char *addr; - struct mapped_index *map; - offset_type *metadata; -- const gdb_byte *cu_list; -- offset_type cu_list_elements; -+ const gdb_byte *cu_list, *types_list; -+ offset_type version, cu_list_elements, types_list_elements; -+ int i; - - if (dwarf2_per_objfile->gdb_index.asection == NULL - || dwarf2_per_objfile->gdb_index.size == 0) -@@ -1822,26 +1896,58 @@ dwarf2_read_index (struct objfile *objfi - - addr = dwarf2_per_objfile->gdb_index.buffer; - /* Version check. */ -- if (MAYBE_SWAP (*(offset_type *) addr) != 1) -+ version = MAYBE_SWAP (*(offset_type *) addr); -+ if (version == 1) -+ { -+ /* Index version 1 neglected to account for .debug_types. So, -+ if we see .debug_types, we cannot use this index. */ -+ if (dwarf2_per_objfile->types.asection != NULL -+ && dwarf2_per_objfile->types.size != 0) -+ return 0; -+ } -+ else if (version != 2) - return 0; - - map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); - map->total_size = dwarf2_per_objfile->gdb_index.size; - - metadata = (offset_type *) (addr + sizeof (offset_type)); -- cu_list = addr + MAYBE_SWAP (metadata[0]); -- cu_list_elements = ((MAYBE_SWAP (metadata[1]) - MAYBE_SWAP (metadata[0])) -+ -+ i = 0; -+ cu_list = addr + MAYBE_SWAP (metadata[i]); -+ cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i])) - / 8); -- map->address_table = addr + MAYBE_SWAP (metadata[1]); -- map->address_table_size = (MAYBE_SWAP (metadata[2]) -- - MAYBE_SWAP (metadata[1])); -- map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[2])); -- map->index_table_slots = ((MAYBE_SWAP (metadata[3]) -- - MAYBE_SWAP (metadata[2])) -+ ++i; -+ -+ if (version == 2) -+ { -+ types_list = addr + MAYBE_SWAP (metadata[i]); -+ types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) -+ - MAYBE_SWAP (metadata[i])) -+ / 8); -+ ++i; -+ } -+ -+ map->address_table = addr + MAYBE_SWAP (metadata[i]); -+ map->address_table_size = (MAYBE_SWAP (metadata[i + 1]) -+ - MAYBE_SWAP (metadata[i])); -+ ++i; -+ -+ map->index_table = (offset_type *) (addr + MAYBE_SWAP (metadata[i])); -+ map->index_table_slots = ((MAYBE_SWAP (metadata[i + 1]) -+ - MAYBE_SWAP (metadata[i])) - / (2 * sizeof (offset_type))); -- map->constant_pool = addr + MAYBE_SWAP (metadata[3]); -+ ++i; - -- if (!create_cus_from_index (objfile, map, cu_list, cu_list_elements)) -+ map->constant_pool = addr + MAYBE_SWAP (metadata[i]); -+ -+ if (!create_cus_from_index (objfile, cu_list, cu_list_elements)) -+ return 0; -+ -+ if (version == 2 -+ && types_list_elements -+ && !create_signatured_type_hash_from_index (objfile, types_list, -+ types_list_elements)) - return 0; - - create_addrmap_from_index (objfile, map); -@@ -1968,8 +2074,7 @@ dw2_find_last_source_symtab (struct objf - int index; - dw2_setup (objfile); - index = dwarf2_per_objfile->n_comp_units - 1; -- return dw2_instantiate_symtab (objfile, -- dwarf2_per_objfile->all_comp_units[index]); -+ return dw2_instantiate_symtab (objfile, dw2_get_cu (index)); - } - - static void -@@ -1978,9 +2083,10 @@ dw2_forget_cached_source_info (struct ob - int i; - - dw2_setup (objfile); -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - if (cu->v.quick->full_names) - { -@@ -2002,10 +2108,11 @@ dw2_lookup_symtab (struct objfile *objfi - struct dwarf2_per_cu_data *base_cu = NULL; - - dw2_setup (objfile); -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { - int j; -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - if (cu->v.quick->symtab) - continue; -@@ -2097,8 +2204,8 @@ dw2_do_expand_symtabs_matching (struct o - for (i = 0; i < len; ++i) - { - offset_type cu_index = MAYBE_SWAP (vec[i + 1]); -- struct dwarf2_per_cu_data *cu; -- cu = dwarf2_per_objfile->all_comp_units[cu_index]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (cu_index); -+ - dw2_instantiate_symtab (objfile, cu); - } - } -@@ -2120,9 +2227,10 @@ dw2_print_stats (struct objfile *objfile - - dw2_setup (objfile); - count = 0; -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - if (!cu->v.quick->symtab) - ++count; -@@ -2156,9 +2264,11 @@ dw2_expand_all_symtabs (struct objfile * - int i; - - dw2_setup (objfile); -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - dw2_instantiate_symtab (objfile, cu); - } -@@ -2171,10 +2281,11 @@ dw2_expand_symtabs_with_filename (struct - int i; - - dw2_setup (objfile); -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { - int j; -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - if (cu->v.quick->symtab) - continue; -@@ -2215,7 +2326,7 @@ dw2_find_symbol_file (struct objfile *ob - should be rewritten so that it doesn't require a custom hook. It - could just use the ordinary symbol tables. */ - /* vec[0] is the length, which must always be >0. */ -- cu = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[1])]; -+ cu = dw2_get_cu (MAYBE_SWAP (vec[1])); - - dw2_require_line_header (objfile, cu); - if (!cu->v.quick->lines) -@@ -2253,10 +2364,11 @@ dw2_expand_symtabs_matching (struct objf - if (!dwarf2_per_objfile->index_table) - return; - -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { - int j; -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - cu->v.quick->mark = 0; - if (cu->v.quick->symtab) -@@ -2301,8 +2413,9 @@ dw2_expand_symtabs_matching (struct objf - vec_len = MAYBE_SWAP (vec[0]); - for (vec_idx = 0; vec_idx < vec_len; ++vec_idx) - { -- struct dwarf2_per_cu_data *cu -- = dwarf2_per_objfile->all_comp_units[MAYBE_SWAP (vec[vec_idx + 1])]; -+ struct dwarf2_per_cu_data *cu; -+ -+ cu = dw2_get_cu (MAYBE_SWAP (vec[vec_idx + 1])); - if (cu->v.quick->mark) - dw2_instantiate_symtab (objfile, cu); - } -@@ -2372,10 +2485,11 @@ dw2_map_symbol_filenames (struct objfile - int i; - - dw2_setup (objfile); -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { - int j; -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - if (cu->v.quick->symtab) - continue; -@@ -2436,10 +2550,12 @@ dwarf2_initialize_objfile (struct objfil - - dwarf2_per_objfile->using_index = 1; - create_all_comp_units (objfile); -+ create_debug_types_hash_table (objfile); - -- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) -+ for (i = 0; i < (dwarf2_per_objfile->n_comp_units -+ + dwarf2_per_objfile->n_type_comp_units); ++i) - { -- struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -+ struct dwarf2_per_cu_data *cu = dw2_get_cu (i); - - cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, - struct dwarf2_per_cu_quick_data); -@@ -2653,6 +2769,34 @@ eq_type_signature (const void *item_lhs, - return lhs->signature == rhs->signature; - } - -+/* Allocate a hash table for signatured types. */ -+ -+static htab_t -+allocate_signatured_type_hash_table (struct objfile *objfile) -+{ -+ return htab_create_alloc_ex (41, -+ hash_type_signature, -+ eq_type_signature, -+ NULL, -+ &objfile->objfile_obstack, -+ hashtab_obstack_allocate, -+ dummy_obstack_deallocate); -+} -+ -+/* A helper function to add a signatured type CU to a list. */ -+ -+static int -+add_signatured_type_cu_to_list (void **slot, void *datum) -+{ -+ struct signatured_type *sigt = *slot; -+ struct dwarf2_per_cu_data ***datap = datum; -+ -+ **datap = &sigt->per_cu; -+ ++*datap; -+ -+ return 1; -+} -+ - /* Create the hash table of all entries in the .debug_types section. - The result is zero if there is an error (e.g. missing .debug_types section), - otherwise non-zero. */ -@@ -2662,6 +2806,7 @@ create_debug_types_hash_table (struct ob - { - gdb_byte *info_ptr; - htab_t types_htab; -+ struct dwarf2_per_cu_data **iter; - - dwarf2_read_section (objfile, &dwarf2_per_objfile->types); - info_ptr = dwarf2_per_objfile->types.buffer; -@@ -2672,13 +2817,7 @@ create_debug_types_hash_table (struct ob - return 0; - } - -- types_htab = htab_create_alloc_ex (41, -- hash_type_signature, -- eq_type_signature, -- NULL, -- &objfile->objfile_obstack, -- hashtab_obstack_allocate, -- dummy_obstack_deallocate); -+ types_htab = allocate_signatured_type_hash_table (objfile); - - if (dwarf2_die_debug) - fprintf_unfiltered (gdb_stdlog, "Signatured types:\n"); -@@ -2726,6 +2865,7 @@ create_debug_types_hash_table (struct ob - type_sig->offset = offset; - type_sig->type_offset = type_offset; - type_sig->per_cu.objfile = objfile; -+ type_sig->per_cu.from_debug_types = 1; - - slot = htab_find_slot (types_htab, type_sig, INSERT); - gdb_assert (slot != NULL); -@@ -2740,6 +2880,16 @@ create_debug_types_hash_table (struct ob - - dwarf2_per_objfile->signatured_types = types_htab; - -+ dwarf2_per_objfile->n_type_comp_units = htab_elements (types_htab); -+ dwarf2_per_objfile->type_comp_units -+ = obstack_alloc (&objfile->objfile_obstack, -+ dwarf2_per_objfile->n_type_comp_units -+ * sizeof (struct dwarf2_per_cu_data *)); -+ iter = &dwarf2_per_objfile->type_comp_units[0]; -+ htab_traverse_noresize (types_htab, add_signatured_type_cu_to_list, &iter); -+ gdb_assert (iter - &dwarf2_per_objfile->type_comp_units[0] -+ == dwarf2_per_objfile->n_type_comp_units); -+ - return 1; - } - -@@ -3008,7 +3158,6 @@ process_type_comp_unit (void **slot, voi - struct dwarf2_per_cu_data *this_cu; - - this_cu = &entry->per_cu; -- this_cu->from_debug_types = 1; - - gdb_assert (dwarf2_per_objfile->types.readin); - process_psymtab_comp_unit (objfile, this_cu, -@@ -12483,13 +12632,16 @@ static void - read_signatured_type (struct objfile *objfile, - struct signatured_type *type_sig) - { -- gdb_byte *types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset; -+ gdb_byte *types_ptr; - struct die_reader_specs reader_specs; - struct dwarf2_cu *cu; - ULONGEST signature; - struct cleanup *back_to, *free_cu_cleanup; - struct attribute *attr; - -+ dwarf2_read_section (objfile, &dwarf2_per_objfile->types); -+ types_ptr = dwarf2_per_objfile->types.buffer + type_sig->offset; -+ - gdb_assert (type_sig->per_cu.cu == NULL); - - cu = xmalloc (sizeof (struct dwarf2_cu)); -@@ -14402,6 +14554,10 @@ add_address_entry (struct objfile *objfi - char addr[8]; - CORE_ADDR baseaddr; - -+ /* Don't bother recording empty ranges. */ -+ if (pst->textlow == pst->texthigh) -+ return; -+ - baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - - store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, pst->textlow - baseaddr); -@@ -14447,13 +14603,53 @@ unlink_if_set (void *p) - unlink (*filename); - } - -+/* A helper struct used when iterating over debug_types. */ -+struct signatured_type_index_data -+{ -+ struct objfile *objfile; -+ struct mapped_symtab *symtab; -+ struct obstack *types_list; -+ int cu_index; -+}; -+ -+/* A helper function that writes a single signatured_type to an -+ obstack. */ -+static int -+write_one_signatured_type (void **slot, void *d) -+{ -+ struct signatured_type_index_data *info = d; -+ struct signatured_type *entry = (struct signatured_type *) *slot; -+ struct dwarf2_per_cu_data *cu = &entry->per_cu; -+ struct partial_symtab *psymtab = cu->v.psymtab; -+ gdb_byte val[8]; -+ -+ write_psymbols (info->symtab, -+ info->objfile->global_psymbols.list + psymtab->globals_offset, -+ psymtab->n_global_syms, info->cu_index); -+ write_psymbols (info->symtab, -+ info->objfile->static_psymbols.list + psymtab->statics_offset, -+ psymtab->n_static_syms, info->cu_index); -+ -+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset); -+ obstack_grow (info->types_list, val, 8); -+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->type_offset); -+ obstack_grow (info->types_list, val, 8); -+ store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->signature); -+ obstack_grow (info->types_list, val, 8); -+ -+ ++info->cu_index; -+ -+ return 1; -+} -+ - /* Create an index file for OBJFILE in the directory DIR. */ - static void - write_psymtabs_to_index (struct objfile *objfile, const char *dir) - { - struct cleanup *cleanup; - char *filename, *cleanup_filename; -- struct obstack contents, addr_obstack, constant_pool, symtab_obstack, cu_list; -+ struct obstack contents, addr_obstack, constant_pool, symtab_obstack; -+ struct obstack cu_list, types_cu_list; - int i; - FILE *out_file; - struct mapped_symtab *symtab; -@@ -14489,6 +14685,12 @@ write_psymtabs_to_index (struct objfile - obstack_init (&cu_list); - make_cleanup_obstack_free (&cu_list); - -+ obstack_init (&types_cu_list); -+ make_cleanup_obstack_free (&types_cu_list); -+ -+ /* The list is already sorted, so we don't need to do additional -+ work here. Also, the debug_types entries do not appear in -+ all_comp_units, but only in their own hash table. */ - for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i) - { - struct dwarf2_per_cu_data *cu = dwarf2_per_objfile->all_comp_units[i]; -@@ -14510,6 +14712,19 @@ write_psymtabs_to_index (struct objfile - obstack_grow (&cu_list, val, 8); - } - -+ /* Write out the .debug_type entries, if any. */ -+ if (dwarf2_per_objfile->signatured_types) -+ { -+ struct signatured_type_index_data sig_data; -+ -+ sig_data.objfile = objfile; -+ sig_data.symtab = symtab; -+ sig_data.types_list = &types_cu_list; -+ sig_data.cu_index = dwarf2_per_objfile->n_comp_units; -+ htab_traverse_noresize (dwarf2_per_objfile->signatured_types, -+ write_one_signatured_type, &sig_data); -+ } -+ - obstack_init (&constant_pool); - make_cleanup_obstack_free (&constant_pool); - obstack_init (&symtab_obstack); -@@ -14518,11 +14733,11 @@ write_psymtabs_to_index (struct objfile - - obstack_init (&contents); - make_cleanup_obstack_free (&contents); -- size_of_contents = 5 * sizeof (offset_type); -+ size_of_contents = 6 * sizeof (offset_type); - total_len = size_of_contents; - - /* The version number. */ -- val = MAYBE_SWAP (1); -+ val = MAYBE_SWAP (2); - obstack_grow (&contents, &val, sizeof (val)); - - /* The offset of the CU list from the start of the file. */ -@@ -14530,6 +14745,11 @@ write_psymtabs_to_index (struct objfile - obstack_grow (&contents, &val, sizeof (val)); - total_len += obstack_object_size (&cu_list); - -+ /* The offset of the types CU list from the start of the file. */ -+ val = MAYBE_SWAP (total_len); -+ obstack_grow (&contents, &val, sizeof (val)); -+ total_len += obstack_object_size (&types_cu_list); -+ - /* The offset of the address table from the start of the file. */ - val = MAYBE_SWAP (total_len); - obstack_grow (&contents, &val, sizeof (val)); -@@ -14549,6 +14769,7 @@ write_psymtabs_to_index (struct objfile - - write_obstack (out_file, &contents); - write_obstack (out_file, &cu_list); -+ write_obstack (out_file, &types_cu_list); - write_obstack (out_file, &addr_obstack); - write_obstack (out_file, &symtab_obstack); - write_obstack (out_file, &constant_pool); -@@ -14573,18 +14794,33 @@ write_psymtabs_to_index (struct objfile - - 1. The file header. This is a sequence of values, of offset_type - unless otherwise noted: -- [0] The version number. Currently 1. -+ [0] The version number. Currently 1 or 2. The differences are -+ noted below. Version 1 did not account for .debug_types sections; -+ the presence of a .debug_types section invalidates any version 1 -+ index that may exist. - [1] The offset, from the start of the file, of the CU list. -+ [1.5] In version 2, the offset, from the start of the file, of the -+ types CU list. This offset does not appear in version 1. Note -+ that this can be empty, in which case this offset will be equal to -+ the next offset. - [2] The offset, from the start of the file, of the address section. - [3] The offset, from the start of the file, of the symbol table. - [4] The offset, from the start of the file, of the constant pool. - - 2. The CU list. This is a sequence of pairs of 64-bit -- little-endian values. The first element in each pair is the offset -- of a CU in the .debug_info section. The second element in each -- pair is the length of that CU. References to a CU elsewhere in the -- map are done using a CU index, which is just the 0-based index into -- this table. -+ little-endian values, sorted by the CU offset. The first element -+ in each pair is the offset of a CU in the .debug_info section. The -+ second element in each pair is the length of that CU. References -+ to a CU elsewhere in the map are done using a CU index, which is -+ just the 0-based index into this table. Note that if there are -+ type CUs, then conceptually CUs and type CUs form a single list for -+ the purposes of CU indices. -+ -+ 2.5 The types CU list. This does not appear in a version 1 index. -+ This is a sequence of triplets of 64-bit little-endian values. In -+ a triplet, the first value is the CU offset, the second value is -+ the type offset in the CU, and the third value is the type -+ signature. The types CU list is not sorted. - - 3. The address section. The address section consists of a sequence - of address entries. Each address entry has three elements. diff --git a/gdb-gdbindex-v2-to-v3.patch b/gdb-gdbindex-v2-to-v3.patch deleted file mode 100644 index bbd7045..0000000 --- a/gdb-gdbindex-v2-to-v3.patch +++ /dev/null @@ -1,278 +0,0 @@ -FYI: index pre-expansion fix -http://sourceware.org/ml/gdb-patches/2010-09/msg00452.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00165.html - -### src/gdb/ChangeLog 2010/09/27 17:41:35 1.12206 -### src/gdb/ChangeLog 2010/09/27 18:42:35 1.12207 -## -1,5 +1,17 @@ - 2010-09-27 Tom Tromey - -+ * dwarf2read.c (dwarf2_read_index): Only allow version 3. -+ (write_psymbols): Add 'psyms_seen' and 'is_static' arguments. -+ Only emit a given psymbol once. -+ (struct signatured_type_index_data) : New field. -+ (write_one_signatured_type): Update. -+ (cleanup_htab): New function. -+ (write_psymtabs_to_index): Update. Create psyms_seen hash. Bump -+ version to 3. -+ (save_gdb_index_command): Update index documentation. -+ -+2010-09-27 Tom Tromey -+ - * bcache.c (expand_hash_table): Use hash_function, not hash. - - 2010-09-27 Tom Tromey -Index: gdb-7.2/gdb/dwarf2read.c -=================================================================== ---- gdb-7.2.orig/gdb/dwarf2read.c 2010-10-12 18:11:27.000000000 +0200 -+++ gdb-7.2/gdb/dwarf2read.c 2010-10-12 18:12:03.000000000 +0200 -@@ -1897,15 +1897,10 @@ dwarf2_read_index (struct objfile *objfi - addr = dwarf2_per_objfile->gdb_index.buffer; - /* Version check. */ - version = MAYBE_SWAP (*(offset_type *) addr); -- if (version == 1) -- { -- /* Index version 1 neglected to account for .debug_types. So, -- if we see .debug_types, we cannot use this index. */ -- if (dwarf2_per_objfile->types.asection != NULL -- && dwarf2_per_objfile->types.size != 0) -- return 0; -- } -- else if (version != 2) -+ /* Versions earlier than 3 emitted every copy of a psymbol. This -+ causes the index to behave very poorly for certain requests. So, -+ it seems better to just ignore such indices. */ -+ if (version < 3) - return 0; - - map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); -@@ -1919,14 +1914,11 @@ dwarf2_read_index (struct objfile *objfi - / 8); - ++i; - -- if (version == 2) -- { -- types_list = addr + MAYBE_SWAP (metadata[i]); -- types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) -- - MAYBE_SWAP (metadata[i])) -- / 8); -- ++i; -- } -+ types_list = addr + MAYBE_SWAP (metadata[i]); -+ types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) -+ - MAYBE_SWAP (metadata[i])) -+ / 8); -+ ++i; - - map->address_table = addr + MAYBE_SWAP (metadata[i]); - map->address_table_size = (MAYBE_SWAP (metadata[i + 1]) -@@ -1944,8 +1936,7 @@ dwarf2_read_index (struct objfile *objfi - if (!create_cus_from_index (objfile, cu_list, cu_list_elements)) - return 0; - -- if (version == 2 -- && types_list_elements -+ if (types_list_elements - && !create_signatured_type_hash_from_index (objfile, types_list, - types_list_elements)) - return 0; -@@ -14568,15 +14559,38 @@ add_address_entry (struct objfile *objfi - /* Add a list of partial symbols to SYMTAB. */ - static void - write_psymbols (struct mapped_symtab *symtab, -+ htab_t psyms_seen, - struct partial_symbol **psymp, - int count, -- offset_type cu_index) -+ offset_type cu_index, -+ int is_static) - { - for (; count-- > 0; ++psymp) - { -+ void **slot, *lookup; -+ - if (SYMBOL_LANGUAGE (*psymp) == language_ada) - error (_("Ada is not currently supported by the index")); -- add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index); -+ -+ /* We only want to add a given psymbol once. However, we also -+ want to account for whether it is global or static. So, we -+ may add it twice, using slightly different values. */ -+ if (is_static) -+ { -+ uintptr_t val = 1 | (uintptr_t) *psymp; -+ -+ lookup = (void *) val; -+ } -+ else -+ lookup = *psymp; -+ -+ /* Only add a given psymbol once. */ -+ slot = htab_find_slot (psyms_seen, lookup, INSERT); -+ if (!*slot) -+ { -+ *slot = lookup; -+ add_index_entry (symtab, SYMBOL_NATURAL_NAME (*psymp), cu_index); -+ } - } - } - -@@ -14606,6 +14620,7 @@ struct signatured_type_index_data - struct objfile *objfile; - struct mapped_symtab *symtab; - struct obstack *types_list; -+ htab_t psyms_seen; - int cu_index; - }; - -@@ -14621,11 +14636,15 @@ write_one_signatured_type (void **slot, - gdb_byte val[8]; - - write_psymbols (info->symtab, -+ info->psyms_seen, - info->objfile->global_psymbols.list + psymtab->globals_offset, -- psymtab->n_global_syms, info->cu_index); -+ psymtab->n_global_syms, info->cu_index, -+ 0); - write_psymbols (info->symtab, -+ info->psyms_seen, - info->objfile->static_psymbols.list + psymtab->statics_offset, -- psymtab->n_static_syms, info->cu_index); -+ psymtab->n_static_syms, info->cu_index, -+ 1); - - store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->offset); - obstack_grow (info->types_list, val, 8); -@@ -14639,6 +14658,14 @@ write_one_signatured_type (void **slot, - return 1; - } - -+/* A cleanup function for an htab_t. */ -+ -+static void -+cleanup_htab (void *arg) -+{ -+ htab_delete (arg); -+} -+ - /* Create an index file for OBJFILE in the directory DIR. */ - static void - write_psymtabs_to_index (struct objfile *objfile, const char *dir) -@@ -14653,6 +14680,7 @@ write_psymtabs_to_index (struct objfile - offset_type val, size_of_contents, total_len; - struct stat st; - char buf[8]; -+ htab_t psyms_seen; - - if (!objfile->psymtabs) - return; -@@ -14685,6 +14713,10 @@ write_psymtabs_to_index (struct objfile - obstack_init (&types_cu_list); - make_cleanup_obstack_free (&types_cu_list); - -+ psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer, -+ NULL, xcalloc, xfree); -+ make_cleanup (cleanup_htab, psyms_seen); -+ - /* The list is already sorted, so we don't need to do additional - work here. Also, the debug_types entries do not appear in - all_comp_units, but only in their own hash table. */ -@@ -14695,11 +14727,15 @@ write_psymtabs_to_index (struct objfile - gdb_byte val[8]; - - write_psymbols (symtab, -+ psyms_seen, - objfile->global_psymbols.list + psymtab->globals_offset, -- psymtab->n_global_syms, i); -+ psymtab->n_global_syms, i, -+ 0); - write_psymbols (symtab, -+ psyms_seen, - objfile->static_psymbols.list + psymtab->statics_offset, -- psymtab->n_static_syms, i); -+ psymtab->n_static_syms, i, -+ 1); - - add_address_entry (objfile, &addr_obstack, psymtab, i); - -@@ -14717,6 +14753,7 @@ write_psymtabs_to_index (struct objfile - sig_data.objfile = objfile; - sig_data.symtab = symtab; - sig_data.types_list = &types_cu_list; -+ sig_data.psyms_seen = psyms_seen; - sig_data.cu_index = dwarf2_per_objfile->n_comp_units; - htab_traverse_noresize (dwarf2_per_objfile->signatured_types, - write_one_signatured_type, &sig_data); -@@ -14734,7 +14771,7 @@ write_psymtabs_to_index (struct objfile - total_len = size_of_contents; - - /* The version number. */ -- val = MAYBE_SWAP (2); -+ val = MAYBE_SWAP (3); - obstack_grow (&contents, &val, sizeof (val)); - - /* The offset of the CU list from the start of the file. */ -@@ -14791,18 +14828,16 @@ write_psymtabs_to_index (struct objfile - - 1. The file header. This is a sequence of values, of offset_type - unless otherwise noted: -- [0] The version number. Currently 1 or 2. The differences are -- noted below. Version 1 did not account for .debug_types sections; -- the presence of a .debug_types section invalidates any version 1 -- index that may exist. -+ -+ [0] The version number, currently 3. Versions 1 and 2 are -+ obsolete. - [1] The offset, from the start of the file, of the CU list. -- [1.5] In version 2, the offset, from the start of the file, of the -- types CU list. This offset does not appear in version 1. Note -- that this can be empty, in which case this offset will be equal to -- the next offset. -- [2] The offset, from the start of the file, of the address section. -- [3] The offset, from the start of the file, of the symbol table. -- [4] The offset, from the start of the file, of the constant pool. -+ [2] The offset, from the start of the file, of the types CU list. -+ Note that this section can be empty, in which case this offset will -+ be equal to the next offset. -+ [3] The offset, from the start of the file, of the address section. -+ [4] The offset, from the start of the file, of the symbol table. -+ [5] The offset, from the start of the file, of the constant pool. - - 2. The CU list. This is a sequence of pairs of 64-bit - little-endian values, sorted by the CU offset. The first element -@@ -14813,19 +14848,19 @@ write_psymtabs_to_index (struct objfile - type CUs, then conceptually CUs and type CUs form a single list for - the purposes of CU indices. - -- 2.5 The types CU list. This does not appear in a version 1 index. -- This is a sequence of triplets of 64-bit little-endian values. In -- a triplet, the first value is the CU offset, the second value is -- the type offset in the CU, and the third value is the type -- signature. The types CU list is not sorted. -+ 3. The types CU list. This is a sequence of triplets of 64-bit -+ little-endian values. In a triplet, the first value is the CU -+ offset, the second value is the type offset in the CU, and the -+ third value is the type signature. The types CU list is not -+ sorted. - -- 3. The address section. The address section consists of a sequence -+ 4. The address section. The address section consists of a sequence - of address entries. Each address entry has three elements. - [0] The low address. This is a 64-bit little-endian value. - [1] The high address. This is a 64-bit little-endian value. - [2] The CU index. This is an offset_type value. - -- 4. The symbol table. This is a hash table. The size of the hash -+ 5. The symbol table. This is a hash table. The size of the hash - table is always a power of 2. The initial hash and the step are - currently defined by the `find_slot' function. - -@@ -14847,7 +14882,7 @@ write_psymtabs_to_index (struct objfile - element in the hash table is used to indicate which CUs define the - symbol. - -- 5. The constant pool. This is simply a bunch of bytes. It is -+ 6. The constant pool. This is simply a bunch of bytes. It is - organized so that alignment is correct: CU vectors are stored - first, followed by strings. */ - static void diff --git a/gdb-next-over-throw.patch b/gdb-next-over-throw.patch new file mode 100644 index 0000000..acfeef2 --- /dev/null +++ b/gdb-next-over-throw.patch @@ -0,0 +1,1283 @@ +http://sourceware.org/ml/gdb-patches/2010-10/msg00109.html +Subject: RFC: next/finish/etc -vs- exceptions + +This is a refresh of: + + http://www.sourceware.org/ml/gdb-patches/2009-05/msg00635.html + +(The thread continues in the following month.) + +I rebased the patch and addressed Pedro's comments. + +I did not add the user notification that Doug asked for. + +This version does work if an exception is thrown from a signal handler. +The included Java test case checks that (on most platforms). + +Built and regtested on x86-64 (compile farm). +Tests for the new functionality are included. + +I'd appreciate comments. I don't want to commit this without a review, +as my experience is that I usually err when touching breakpoints or +infrun. + +If you want to try this yourself, you will need a new-enough libgcc, one +that includes the necessary debugging hook. + +Tom + +2010-10-06 Tom Tromey + + * infrun.c (handle_inferior_event): Handle exception breakpoints. + (handle_inferior_event): Likewise. + (insert_exception_resume_breakpoint): New function. + (check_exception_resume): Likewise. + * inferior.h (delete_longjmp_breakpoint_cleanup): Declare. + * infcmd.c (delete_longjmp_breakpoint_cleanup): No longer static. + (step_1): Set thread's initiating frame. + (until_next_continuation): New function. + (until_next_command): Support exception breakpoints. + (finish_command_continuation): Delete longjmp breakpoint. + (finish_forward): Support exception breakpoints. + * gdbthread.h (struct thread_info) : New field. + * breakpoint.h (enum bptype) : New constants. + (struct bpstat_what) : New field. + * breakpoint.c (create_exception_master_breakpoint): New function. + (update_breakpoints_after_exec): Handle bp_exception_master. Call + create_exception_master_breakpoint. + (print_it_typical): Handle bp_exception_master, bp_exception. + (bpstat_stop_status): Handle bp_exception_master. + (bpstat_what): Handle bp_exception_master, bp_exception, + bp_exception_resume. + (bptype_string): Likewise. + (print_one_breakpoint_location): Likewise. + (allocate_bp_location): Likewise. + (set_longjmp_breakpoint): Handle exception breakpoints. + (delete_longjmp_breakpoint): Likewise. + (mention): Likewise. + (struct until_break_command_continuation_args) : New + field. + (until_break_command_continuation): Call + delete_longjmp_breakpoint. + (until_break_command): Support exception breakpoints. + (delete_command): Likewise. + (breakpoint_re_set_one): Likewise. + (breakpoint_re_set): Likewise. + +2010-10-06 Tom Tromey + + * gdb.java/jnpe.java: New file. + * gdb.java/jnpe.exp: New file. + * gdb.cp/gdb9593.exp: New file. + * gdb.cp/gdb9593.cc: New file. + +Index: gdb-7.2.50.20101116/gdb/breakpoint.c +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/breakpoint.c 2010-11-17 02:38:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/breakpoint.c 2010-11-17 02:41:53.000000000 +0100 +@@ -2232,6 +2232,33 @@ create_std_terminate_master_breakpoint ( + do_cleanups (old_chain); + } + ++/* 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) ++ { ++ struct breakpoint *b; ++ ++ b = create_internal_breakpoint (get_objfile_arch (objfile), ++ SYMBOL_VALUE_ADDRESS (debug_hook), ++ 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) + { +@@ -2273,7 +2300,8 @@ 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_std_terminate_master) ++ || b->type == bp_longjmp_master || b->type == bp_std_terminate_master ++ || b->type == bp_exception_master) + { + delete_breakpoint (b); + continue; +@@ -2288,7 +2316,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; +@@ -2350,6 +2379,7 @@ update_breakpoints_after_exec (void) + create_longjmp_master_breakpoint ("siglongjmp"); + create_longjmp_master_breakpoint ("_siglongjmp"); + create_std_terminate_master_breakpoint ("std::terminate()"); ++ create_exception_master_breakpoint (); + } + + int +@@ -3275,6 +3305,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); +@@ -3362,6 +3398,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: +@@ -4164,7 +4202,8 @@ bpstat_stop_status (struct address_space + + if (b->type == bp_thread_event || b->type == bp_overlay_event + || b->type == bp_longjmp_master +- || b->type == bp_std_terminate_master) ++ || b->type == bp_std_terminate_master ++ || b->type == bp_exception_master) + /* We do not stop for these. */ + bs->stop = 0; + else +@@ -4260,6 +4299,7 @@ bpstat_what (bpstat bs_head) + + retval.main_action = BPSTAT_WHAT_KEEP_CHECKING; + retval.call_dummy = STOP_NONE; ++ retval.is_longjmp = 0; + + for (bs = bs_head; bs != NULL; bs = bs->next) + { +@@ -4315,10 +4355,14 @@ bpstat_what (bpstat bs_head) + } + break; + case bp_longjmp: ++ case bp_exception: + this_action = BPSTAT_WHAT_SET_LONGJMP_RESUME; ++ retval.is_longjmp = bptype == bp_longjmp; + break; + case bp_longjmp_resume: ++ case bp_exception_resume: + this_action = BPSTAT_WHAT_CLEAR_LONGJMP_RESUME; ++ retval.is_longjmp = bptype == bp_longjmp_resume; + break; + case bp_step_resume: + if (bs->stop) +@@ -4334,6 +4378,7 @@ bpstat_what (bpstat bs_head) + case bp_overlay_event: + case bp_longjmp_master: + case bp_std_terminate_master: ++ case bp_exception_master: + this_action = BPSTAT_WHAT_SINGLE; + break; + case bp_catchpoint: +@@ -4556,6 +4601,8 @@ bptype_string (enum bptype type) + {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"}, +@@ -4565,6 +4612,7 @@ bptype_string (enum bptype type) + {bp_overlay_event, "overlay events"}, + {bp_longjmp_master, "longjmp master"}, + {bp_std_terminate_master, "std::terminate master"}, ++ {bp_exception_master, "exception master"}, + {bp_catchpoint, "catchpoint"}, + {bp_tracepoint, "tracepoint"}, + {bp_fast_tracepoint, "fast tracepoint"}, +@@ -4705,6 +4753,8 @@ print_one_breakpoint_location (struct br + 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: +@@ -4714,6 +4764,7 @@ print_one_breakpoint_location (struct br + case bp_overlay_event: + case bp_longjmp_master: + case bp_std_terminate_master: ++ case bp_exception_master: + case bp_tracepoint: + case bp_fast_tracepoint: + case bp_static_tracepoint: +@@ -5457,6 +5508,8 @@ allocate_bp_location (struct breakpoint + 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: +@@ -5469,6 +5522,7 @@ allocate_bp_location (struct breakpoint + case bp_std_terminate_master: + case bp_gnu_ifunc_resolver: + case bp_gnu_ifunc_resolver_return: ++ case bp_exception_master: + loc->loc_type = bp_loc_software_breakpoint; + break; + case bp_hardware_breakpoint: +@@ -5708,8 +5762,7 @@ make_breakpoint_permanent (struct breakp + } + + /* 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) +@@ -5722,11 +5775,12 @@ set_longjmp_breakpoint (int thread) + clones of those and enable them for the requested thread. */ + ALL_BREAKPOINTS_SAFE (b, temp) + if (b->pspace == current_program_space +- && b->type == bp_longjmp_master) ++ && (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; + } + } +@@ -5738,7 +5792,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); +@@ -6913,6 +6967,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_std_terminate: +@@ -6924,6 +6980,7 @@ mention (struct breakpoint *b) + case bp_longjmp_master: + case bp_std_terminate_master: + case bp_gnu_ifunc_resolver_return: ++ case bp_exception_master: + break; + } + +@@ -8598,6 +8655,7 @@ struct until_break_command_continuation_ + { + struct breakpoint *breakpoint; + struct breakpoint *breakpoint2; ++ int thread_num; + }; + + /* This function is called by fetch_inferior_event via the +@@ -8612,6 +8670,7 @@ until_break_command_continuation (void * + delete_breakpoint (a->breakpoint); + if (a->breakpoint2) + delete_breakpoint (a->breakpoint2); ++ delete_longjmp_breakpoint (a->thread_num); + } + + void +@@ -8623,6 +8682,8 @@ until_break_command (char *arg, int from + struct breakpoint *breakpoint; + struct breakpoint *breakpoint2 = NULL; + struct cleanup *old_chain; ++ int thread; ++ struct thread_info *tp; + + clear_proceed_status (); + +@@ -8661,6 +8722,9 @@ until_break_command (char *arg, int from + + 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. */ + +@@ -8673,6 +8737,10 @@ until_break_command (char *arg, int from + 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); +@@ -8689,6 +8757,7 @@ until_break_command (char *arg, int from + + args->breakpoint = breakpoint; + args->breakpoint2 = breakpoint2; ++ args->thread_num = thread; + + discard_cleanups (old_chain); + add_continuation (inferior_thread (), +@@ -9940,6 +10009,7 @@ delete_command (char *arg, int from_tty) + && b->type != bp_overlay_event + && b->type != bp_longjmp_master + && b->type != bp_std_terminate_master ++ && b->type != bp_exception_master + && b->number >= 0) + { + breaks_to_delete = 1; +@@ -9961,6 +10031,7 @@ delete_command (char *arg, int from_tty) + && b->type != bp_overlay_event + && b->type != bp_longjmp_master + && b->type != bp_std_terminate_master ++ && b->type != bp_exception_master + && b->number >= 0) + delete_breakpoint (b); + } +@@ -10470,6 +10541,7 @@ breakpoint_re_set_one (void *bint) + case bp_overlay_event: + case bp_longjmp_master: + case bp_std_terminate_master: ++ case bp_exception_master: + delete_breakpoint (b); + break; + +@@ -10493,6 +10565,8 @@ breakpoint_re_set_one (void *bint) + case bp_step_resume: + case bp_longjmp: + case bp_longjmp_resume: ++ case bp_exception: ++ case bp_exception_resume: + case bp_jit_event: + case bp_gnu_ifunc_resolver_return: + break; +@@ -10537,6 +10611,7 @@ breakpoint_re_set (void) + create_longjmp_master_breakpoint ("siglongjmp"); + create_longjmp_master_breakpoint ("_siglongjmp"); + create_std_terminate_master_breakpoint ("std::terminate()"); ++ create_exception_master_breakpoint (); + } + + /* Reset the thread number of this breakpoint: +Index: gdb-7.2.50.20101116/gdb/breakpoint.h +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/breakpoint.h 2010-11-17 02:38:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/breakpoint.h 2010-11-17 02:39:19.000000000 +0100 +@@ -61,6 +61,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, +@@ -130,6 +137,9 @@ enum bptype + /* Master copies of std::terminate breakpoints. */ + bp_std_terminate_master, + ++ /* Like bp_longjmp_master, but for exceptions. */ ++ bp_exception_master, ++ + bp_catchpoint, + + bp_tracepoint, +@@ -672,6 +682,10 @@ struct bpstat_what + continuing from a call dummy without popping the frame is not a + useful one). */ + enum stop_stack_kind 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, +Index: gdb-7.2.50.20101116/gdb/gdbthread.h +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/gdbthread.h 2010-11-02 02:37:31.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/gdbthread.h 2010-11-17 02:39:19.000000000 +0100 +@@ -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; + +Index: gdb-7.2.50.20101116/gdb/infcmd.c +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/infcmd.c 2010-07-01 17:36:15.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/infcmd.c 2010-11-17 02:39:19.000000000 +0100 +@@ -822,7 +822,7 @@ nexti_command (char *count_string, int f + step_1 (1, 1, count_string); + } + +-static void ++void + delete_longjmp_breakpoint_cleanup (void *arg) + { + int thread = * (int *) arg; +@@ -862,10 +862,13 @@ step_1 (int skip_subroutines, int single + + 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); + } +@@ -1219,6 +1222,15 @@ signal_command (char *signum_exp, int fr + 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. + +@@ -1235,6 +1247,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 (); +@@ -1270,7 +1284,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 +@@ -1463,6 +1489,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 +@@ -1546,6 +1573,7 @@ finish_forward (struct symbol *function, + 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); +@@ -1556,6 +1584,10 @@ finish_forward (struct symbol *function, + + 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... */ + cargs = xmalloc (sizeof (*cargs)); + +Index: gdb-7.2.50.20101116/gdb/inferior.h +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/inferior.h 2010-11-17 02:38:55.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/inferior.h 2010-11-17 02:39:19.000000000 +0100 +@@ -299,6 +299,8 @@ extern void interrupt_target_command (ch + + 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); +Index: gdb-7.2.50.20101116/gdb/infrun.c +=================================================================== +--- gdb-7.2.50.20101116.orig/gdb/infrun.c 2010-11-17 02:38:59.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/infrun.c 2010-11-17 02:39:19.000000000 +0100 +@@ -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" +@@ -2229,6 +2231,8 @@ static void insert_step_resume_breakpoin + 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); +@@ -4121,23 +4125,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; + +@@ -4149,6 +4163,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME ( + 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_end_stepping_range_reason (); + stop_stepping (ecs); +@@ -5127,6 +5188,100 @@ insert_longjmp_resume_breakpoint (struct + 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); ++ /* If the value was optimized out, revert to the old behavior. */ ++ if (! value_optimized_out (value)) ++ { ++ 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) + { +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.cp/gdb9593.cc +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.cp/gdb9593.cc 2010-11-17 02:39:19.000000000 +0100 +@@ -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 (...) ++ { ++ } ++} ++ +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.cp/gdb9593.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.cp/gdb9593.exp 2010-11-17 02:39:19.000000000 +0100 +@@ -0,0 +1,182 @@ ++# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++if { [skip_cplus_tests] } { continue } ++ ++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" +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.java/jnpe.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.java/jnpe.exp 2010-11-17 02:39:19.000000000 +0100 +@@ -0,0 +1,74 @@ ++# Copyright 2009, 2010 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++load_lib "java.exp" ++ ++set testfile "jnpe" ++set srcfile ${testfile}.java ++set binfile ${objdir}/${subdir}/${testfile} ++if { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } { ++ untested "Couldn't compile ${srcdir}/$subdir/${srcfile}" ++ return -1 ++} ++ ++# 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" \ ++ "// break here.*" \ ++ "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. ++ setup_xfail *-*-* ++ fail "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" ++ ++# The line where we stop differ according to gcj; check just we did not already ++# execute the catch point. ++ ++gdb_test "next" \ ++ "" \ ++ "next over NPE" ++ ++gdb_breakpoint [gdb_get_line_number "catch point"] ++gdb_continue_to_breakpoint "catch point" ".*// catch point.*" +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.java/jnpe.java +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.java/jnpe.java 2010-11-17 02:39:19.000000000 +0100 +@@ -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"); // catch point ++ } ++ } ++} diff --git a/gdb-pr12028-double-free.patch b/gdb-pr12028-double-free.patch deleted file mode 100644 index deb2115..0000000 --- a/gdb-pr12028-double-free.patch +++ /dev/null @@ -1,99 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00321.html -Subject: [patch] PR 12028 "GDB crashes on a double free during overload resolution" - -old_cleanups was being set twice making the later call to -discard_cleanups ignore the first 'make_cleanup' request. - -The patch is proposed for both head and the 7.2 branch. - -This has been regression tested on x8664 with gcc-4.4.4-10.fc13 - - -Fix PR 12028: "GDB crashes on a double free during overload resolution " - -2010-09-16 Sami Wagiaalla - - PR C++/12028 - * valops.c (find_oload_champ_namespace_loop): removed incorrect - 'old_cleanups' reassignment. - -2010-09-16 Sami Wagiaalla - - * gdb.cp/pr12028.cc: New. - * gdb.cp/pr12028.exp: New. - -diff --git a/gdb/testsuite/gdb.cp/pr12028.cc b/gdb/testsuite/gdb.cp/pr12028.cc -new file mode 100644 -index 0000000..0fcab6b ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/pr12028.cc -@@ -0,0 +1,21 @@ -+class A{}; -+class B{}; -+class C: public B {}; -+ -+namespace D{ -+ int foo (A) { return 11; } -+ int foo (C) { return 12; } -+} -+ -+int main() -+{ -+ A a; -+ B b; -+ C c; -+ -+ D::foo (a); -+ // D::foo (b); -+ D::foo (c); -+ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.cp/pr12028.exp b/gdb/testsuite/gdb.cp/pr12028.exp -new file mode 100644 -index 0000000..746c6b5 ---- /dev/null -+++ b/gdb/testsuite/gdb.cp/pr12028.exp -@@ -0,0 +1,29 @@ -+# Copyright 2008 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+set testfile pr12028 -+set srcfile ${testfile}.cc -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug c++}] } { -+ return -1 -+} -+ -+############################################ -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint main" -+ continue -+} -+ -+gdb_test "p D::foo(b)" "Cannot resolve function foo to any overloaded instance" -diff --git a/gdb/valops.c b/gdb/valops.c -index 7fbad10..4e83a04 100644 ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -2715,7 +2715,7 @@ find_oload_champ_namespace_loop (struct type **arg_types, int nargs, - function symbol to start off with.) */ - - old_cleanups = make_cleanup (xfree, *oload_syms); -- old_cleanups = make_cleanup (xfree, *oload_champ_bv); -+ make_cleanup (xfree, *oload_champ_bv); - new_namespace = alloca (namespace_len + 1); - strncpy (new_namespace, qualified_name, namespace_len); - new_namespace[namespace_len] = '\0'; diff --git a/gdb-python-error-state.patch b/gdb-python-error-state.patch deleted file mode 100644 index d3df518..0000000 --- a/gdb-python-error-state.patch +++ /dev/null @@ -1,592 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-10/msg00175.html -Subject: Re: [patch] python: save/restore/fix error state - -On Fri, 08 Oct 2010 22:08:27 +0200, Doug Evans wrote: -> The comment above this code says: -> -> /* Note: If an exception occurs python will print the traceback and -> clear the error indicator. */ -> -> ISTM that either this comment is wrong or the above patch is wrong, or -> some combination thereof. - -This comment is right, Python has no bug there, other gdb/python/ code has -bugs. That is some gdb/python/ code returned success value while still -leaving the python exception set. Such case is undefined and unchecked by -Python. Python error state does not follow the errno POSIX semantics - The setting of errno after a successful call to a function is - unspecified [...]. -as Python requires instead: - The Python error state after a successful call to a function must be - cleared. - -I have checked callers of these functions, as a closure on the callers of the -top py-utils.c functions. That does not mean this Python error state handling -verification is complete: - python_string_to_unicode unicode_to_encoded_string - unicode_to_encoded_python_string unicode_to_target_string - unicode_to_target_python_string python_string_to_target_string - python_string_to_target_python_string python_string_to_host_string - target_string_to_unicode gdbpy_obj_to_string gdbpy_exception_to_string - get_addr_from_python convert_value_from_python frapy_read_var - gdbpy_get_display_hint valpy_getitem FIXME set_parameter_value - compute_enum_values infpy_read_memory infpy_write_memory - infpy_search_memory valpy_new valpy_call valpy_binop valpy_richcompare - pretty_print_one_value set_attr parmpy_init - -Therefore I have removed the check after PyRun_SimpleFile. - -No regressions on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2010-10-09 Jan Kratochvil - - * python/py-breakpoint.c (bppy_set_condition): New comment. - * python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for - failed PyUnicode_Decode. - (cmdpy_completer): Skip element for failed - python_string_to_host_string. - (cmdpy_init): Return -1 on failed python_string_to_host_string. - * python/py-frame.c (frapy_read_var): Extend the function comment. - * python/py-function.c (fnpy_init): Return -1 on failed - python_string_to_host_string. - * python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend - the function comment. - (infpy_search_memory): Extend the function comment. Remove the - PyErr_SetString call on already set error state. - * python/py-param.c (set_parameter_value): Extend the function - comment. Return -1 on failed python_string_to_host_string, twice. - (set_attr): Extend the function comment. - (compute_enum_values): Extend the function comment. New variable - back_to. Protect self->enumeration by BACK_TO cleanups. Return 0 on - failed python_string_to_host_string. - (get_doc_string): Call gdbpy_print_stack on failed - python_string_to_host_string. - (parmpy_init): Extend the function comment. - * python/py-prettyprint.c (pretty_print_one_value): Likewise. - (gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on - failed python_string_to_host_string. - * python/py-value.c (valpy_new, valpy_getitem, valpy_call) - (valpy_binop, valpy_richcompare): Extend the function comment. - * python/python.c - (struct python_env) : New - fields. - (restore_python_env): Handle PyErr_Occurred. Call PyErr_Restore. - (ensure_python_env): Call PyErr_Fetch. - * varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on - failed convert_value_from_python. - (value_get_print_value): Call gdbpy_print_stack on failed - python_string_to_target_python_string. - -gdb/testsuite/ -2010-10-09 Jan Kratochvil - - * gdb.python/py-error.exp: New file. - * gdb.python/py-error.py: New file. - -Index: gdb-7.2/gdb/python/py-breakpoint.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-breakpoint.c 2010-10-12 18:27:54.000000000 +0200 -+++ gdb-7.2/gdb/python/py-breakpoint.c 2010-10-12 18:28:58.000000000 +0200 -@@ -420,6 +420,9 @@ bppy_get_condition (PyObject *self, void - return PyString_Decode (str, strlen (str), host_charset (), NULL); - } - -+/* Returns 0 on success. Returns -1 on error, with a python exception set. -+ */ -+ - static int - bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure) - { -Index: gdb-7.2/gdb/python/py-cmd.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-cmd.c 2010-10-12 18:27:54.000000000 +0200 -+++ gdb-7.2/gdb/python/py-cmd.c 2010-10-12 18:28:58.000000000 +0200 -@@ -138,7 +138,10 @@ cmdpy_function (struct cmd_list_element - args = ""; - argobj = PyUnicode_Decode (args, strlen (args), host_charset (), NULL); - if (! argobj) -- error (_("Could not convert arguments to Python string.")); -+ { -+ gdbpy_print_stack (); -+ error (_("Could not convert arguments to Python string.")); -+ } - - ttyobj = from_tty ? Py_True : Py_False; - Py_INCREF (ttyobj); -@@ -255,6 +258,12 @@ cmdpy_completer (struct cmd_list_element - continue; - } - result[out] = python_string_to_host_string (elt); -+ if (result[out] == NULL) -+ { -+ /* Skip problem elements. */ -+ PyErr_Clear (); -+ continue; -+ } - ++out; - } - result[out] = NULL; -@@ -465,7 +474,15 @@ cmdpy_init (PyObject *self, PyObject *ar - PyObject *ds_obj = PyObject_GetAttr (self, gdbpy_doc_cst); - - if (ds_obj && gdbpy_is_string (ds_obj)) -- docstring = python_string_to_host_string (ds_obj); -+ { -+ docstring = python_string_to_host_string (ds_obj); -+ if (docstring == NULL) -+ { -+ xfree (cmd_name); -+ xfree (pfx_name); -+ return -1; -+ } -+ } - } - if (! docstring) - docstring = xstrdup (_("This command is not documented.")); -Index: gdb-7.2/gdb/python/py-frame.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-frame.c 2010-06-28 23:16:03.000000000 +0200 -+++ gdb-7.2/gdb/python/py-frame.c 2010-10-12 18:28:58.000000000 +0200 -@@ -385,7 +385,8 @@ frapy_find_sal (PyObject *self, PyObject - start the search from that block, otherwise search from the frame's - current block (determined by examining the resume address of the - frame). The variable argument must be a string or an instance of a -- gdb.Symbol. The block argument must be an instance of gdb.Block. */ -+ gdb.Symbol. The block argument must be an instance of gdb.Block. Returns -+ NULL on error, with a python exception set. */ - static PyObject * - frapy_read_var (PyObject *self, PyObject *args) - { -Index: gdb-7.2/gdb/python/py-function.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-function.c 2010-05-17 23:23:25.000000000 +0200 -+++ gdb-7.2/gdb/python/py-function.c 2010-10-12 18:28:58.000000000 +0200 -@@ -113,7 +113,14 @@ fnpy_init (PyObject *self, PyObject *arg - { - PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__"); - if (ds_obj && gdbpy_is_string (ds_obj)) -- docstring = python_string_to_host_string (ds_obj); -+ { -+ docstring = python_string_to_host_string (ds_obj); -+ if (docstring == NULL) -+ { -+ Py_DECREF (self); -+ return -1; -+ } -+ } - } - if (! docstring) - docstring = xstrdup (_("This function is not documented.")); -Index: gdb-7.2/gdb/python/py-inferior.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-inferior.c 2010-06-28 23:16:03.000000000 +0200 -+++ gdb-7.2/gdb/python/py-inferior.c 2010-10-12 18:28:58.000000000 +0200 -@@ -293,7 +293,8 @@ gdbpy_inferiors (PyObject *unused, PyObj - - /* Implementation of gdb.read_memory (address, length). - Returns a Python buffer object with LENGTH bytes of the inferior's -- memory at ADDRESS. Both arguments are integers. */ -+ memory at ADDRESS. Both arguments are integers. Returns NULL on error, -+ with a python exception set. */ - static PyObject * - infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw) - { -@@ -361,7 +362,8 @@ infpy_read_memory (PyObject *self, PyObj - Writes the contents of BUFFER (a Python object supporting the read - buffer protocol) at ADDRESS in the inferior's memory. Write LENGTH - bytes from BUFFER, or its entire contents if the argument is not -- provided. The function returns nothing. */ -+ provided. The function returns nothing. Returns NULL on error, with -+ a python exception set. */ - static PyObject * - infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) - { -@@ -473,7 +475,8 @@ get_char_buffer (PyObject *self, Py_ssiz - search from ADDRESS. PATTERN is the pattern to search for (and - must be a Python object supporting the buffer protocol). - Returns a Python Long object holding the address where the pattern -- was located, or if the pattern was not found, returns None. */ -+ was located, or if the pattern was not found, returns None. Returns NULL -+ on error, with a python exception set. */ - static PyObject * - infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) - { -@@ -511,12 +514,7 @@ infpy_search_memory (PyObject *self, PyO - } - } - else -- { -- PyErr_SetString (PyExc_RuntimeError, -- _("Cannot get search address/range from Python.")); -- -- return NULL; -- } -+ return NULL; - - if (!PyObject_CheckReadBuffer (pattern)) - { -Index: gdb-7.2/gdb/python/py-param.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-param.c 2010-05-17 23:23:25.000000000 +0200 -+++ gdb-7.2/gdb/python/py-param.c 2010-10-12 18:28:58.000000000 +0200 -@@ -110,8 +110,8 @@ get_attr (PyObject *obj, PyObject *attr_ - return PyObject_GenericGetAttr (obj, attr_name); - } - --/* Set a parameter value from a Python value. Return 0 on success, -1 -- on failure. */ -+/* Set a parameter value from a Python value. Return 0 on success. Returns -+ -1 on error, with a python exception set. */ - static int - set_parameter_value (parmpy_object *self, PyObject *value) - { -@@ -142,7 +142,11 @@ set_parameter_value (parmpy_object *self - self->value.stringval = NULL; - } - else -- self->value.stringval = python_string_to_host_string (value); -+ { -+ self->value.stringval = python_string_to_host_string (value); -+ if (self->value.stringval == NULL) -+ return -1; -+ } - break; - - case var_enum: -@@ -158,6 +162,8 @@ set_parameter_value (parmpy_object *self - } - - str = python_string_to_host_string (value); -+ if (str == NULL) -+ return -1; - for (i = 0; self->enumeration[i]; ++i) - if (! strcmp (self->enumeration[i], str)) - break; -@@ -258,7 +264,7 @@ set_parameter_value (parmpy_object *self - return 0; - } - --/* Set an attribute. */ -+/* Set an attribute. Returns -1 on error, with a python exception set. */ - static int - set_attr (PyObject *obj, PyObject *attr_name, PyObject *val) - { -@@ -358,12 +364,13 @@ add_setshow_generic (int parmclass, enum - } - } - --/* A helper which computes enum values. Returns 1 on success, 0 on -- error. */ -+/* A helper which computes enum values. Returns 1 on success. Returns 0 on -+ error, with a python exception set. */ - static int - compute_enum_values (parmpy_object *self, PyObject *enum_values) - { - Py_ssize_t size, i; -+ struct cleanup *back_to; - - if (! enum_values) - { -@@ -390,6 +397,7 @@ compute_enum_values (parmpy_object *self - } - - self->enumeration = xmalloc ((size + 1) * sizeof (char *)); -+ back_to = make_cleanup (free_current_contents, &self->enumeration); - memset (self->enumeration, 0, (size + 1) * sizeof (char *)); - - for (i = 0; i < size; ++i) -@@ -397,16 +405,27 @@ compute_enum_values (parmpy_object *self - PyObject *item = PySequence_GetItem (enum_values, i); - - if (! item) -- return 0; -+ { -+ do_cleanups (back_to); -+ return 0; -+ } - if (! gdbpy_is_string (item)) - { -+ do_cleanups (back_to); - PyErr_SetString (PyExc_RuntimeError, - _("The enumeration item not a string.")); - return 0; - } - self->enumeration[i] = python_string_to_host_string (item); -+ if (self->enumeration[i] == NULL) -+ { -+ do_cleanups (back_to); -+ return 0; -+ } -+ make_cleanup (xfree, (char *) self->enumeration[i]); - } - -+ discard_cleanups (back_to); - return 1; - } - -@@ -422,7 +441,11 @@ get_doc_string (PyObject *object, PyObje - PyObject *ds_obj = PyObject_GetAttr (object, attr); - - if (ds_obj && gdbpy_is_string (ds_obj)) -- result = python_string_to_host_string (ds_obj); -+ { -+ result = python_string_to_host_string (ds_obj); -+ if (result == NULL) -+ gdbpy_print_stack (); -+ } - } - if (! result) - result = xstrdup (_("This command is not documented.")); -@@ -449,8 +472,9 @@ get_doc_string (PyObject *object, PyObje - - The documentation for the parameter is taken from the doc string - for the python class. -- --*/ -+ -+ Returns -1 on error, with a python exception set. */ -+ - static int - parmpy_init (PyObject *self, PyObject *args, PyObject *kwds) - { -Index: gdb-7.2/gdb/python/py-prettyprint.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-prettyprint.c 2010-10-12 18:27:57.000000000 +0200 -+++ gdb-7.2/gdb/python/py-prettyprint.c 2010-10-12 18:28:58.000000000 +0200 -@@ -185,8 +185,8 @@ find_pretty_printer (PyObject *value) - is returned. If the function returns Py_NONE that means the pretty - printer returned the Python None as a value. Otherwise, if the - function returns a value, *OUT_VALUE is set to the value, and NULL -- is returned. On error, *OUT_VALUE is set to NULL, and NULL is -- returned. */ -+ is returned. On error, *OUT_VALUE is set to NULL, NULL is -+ returned, with a python exception set. */ - - static PyObject * - pretty_print_one_value (PyObject *printer, struct value **out_value) -@@ -232,7 +232,11 @@ gdbpy_get_display_hint (PyObject *printe - if (hint) - { - if (gdbpy_is_string (hint)) -- result = python_string_to_host_string (hint); -+ { -+ result = python_string_to_host_string (hint); -+ if (result == NULL) -+ gdbpy_print_stack (); -+ } - Py_DECREF (hint); - } - else -@@ -574,7 +578,10 @@ print_children (PyObject *printer, const - else - { - output = python_string_to_host_string (py_v); -- fputs_filtered (output, stream); -+ if (!output) -+ gdbpy_print_stack (); -+ else -+ fputs_filtered (output, stream); - xfree (output); - } - } -Index: gdb-7.2/gdb/python/py-value.c -=================================================================== ---- gdb-7.2.orig/gdb/python/py-value.c 2010-10-12 18:27:54.000000000 +0200 -+++ gdb-7.2/gdb/python/py-value.c 2010-10-12 18:28:58.000000000 +0200 -@@ -114,7 +114,8 @@ note_value (value_object *value_obj) - values_in_python = value_obj; - } - --/* Called when a new gdb.Value object needs to be allocated. */ -+/* Called when a new gdb.Value object needs to be allocated. Returns NULL on -+ error, with a python exception set. */ - static PyObject * - valpy_new (PyTypeObject *subtype, PyObject *args, PyObject *keywords) - { -@@ -334,7 +335,7 @@ valpy_length (PyObject *self) - } - - /* Given string name of an element inside structure, return its value -- object. */ -+ object. Returns NULL on error, with a python exception set. */ - static PyObject * - valpy_getitem (PyObject *self, PyObject *key) - { -@@ -468,7 +469,8 @@ enum valpy_opcode - ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE)) - - /* Returns a value object which is the result of applying the operation -- specified by OPCODE to the given arguments. */ -+ specified by OPCODE to the given arguments. Returns NULL on error, with -+ a python exception set. */ - static PyObject * - valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other) - { -@@ -723,7 +725,8 @@ valpy_xor (PyObject *self, PyObject *oth - return valpy_binop (VALPY_BITXOR, self, other); - } - --/* Implements comparison operations for value objects. */ -+/* Implements comparison operations for value objects. Returns NULL on error, -+ with a python exception set. */ - static PyObject * - valpy_richcompare (PyObject *self, PyObject *other, int op) - { -Index: gdb-7.2/gdb/python/python.c -=================================================================== ---- gdb-7.2.orig/gdb/python/python.c 2010-10-12 18:27:54.000000000 +0200 -+++ gdb-7.2/gdb/python/python.c 2010-10-12 18:28:58.000000000 +0200 -@@ -82,6 +82,7 @@ struct python_env - PyGILState_STATE state; - struct gdbarch *gdbarch; - const struct language_defn *language; -+ PyObject *error_type, *error_value, *error_traceback; - }; - - static void -@@ -89,6 +90,16 @@ restore_python_env (void *p) - { - struct python_env *env = (struct python_env *)p; - -+ /* Leftover Python error is forbidden by Python Exception Handling. */ -+ if (PyErr_Occurred ()) -+ { -+ /* This order is similar to the one calling error afterwards. */ -+ gdbpy_print_stack (); -+ warning (_("internal error: Unhandled Python exception")); -+ } -+ -+ PyErr_Restore (env->error_type, env->error_value, env->error_traceback); -+ - PyGILState_Release (env->state); - python_gdbarch = env->gdbarch; - python_language = env->language; -@@ -111,6 +122,9 @@ ensure_python_env (struct gdbarch *gdbar - python_gdbarch = gdbarch; - python_language = language; - -+ /* Save it and ensure ! PyErr_Occurred () afterwards. */ -+ PyErr_Fetch (&env->error_type, &env->error_value, &env->error_traceback); -+ - return make_cleanup (restore_python_env, env); - } - -Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.python/py-error.exp 2010-10-12 18:28:58.000000000 +0200 -@@ -0,0 +1,56 @@ -+# Copyright (C) 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Test error while loading *-gdb.py. IBM1047 is chosen as possibly supported -+# by glibc but unsupported by Python -+ -+set testfile "py-error" -+ -+load_lib gdb-python.exp -+ -+# Start with a fresh gdb. -+gdb_exit -+gdb_start -+ -+# Skip all tests if Python scripting is not enabled. -+if { [skip_python_tests] } { continue } -+ -+set charset "IBM1047" -+ -+set test2 "main reached" -+ -+set test "set host-charset $charset" -+set test_regex [string_to_regexp $test] -+gdb_test_multiple $test $test { -+ -re "^$test_regex\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "^$test_regex\r\nUndefined item: \"$charset\"\\.\r\n$gdb_prompt $" { -+ xfail $test -+ untested $test2 -+ set test2 "" -+ } -+} -+ -+if {$test2 == ""} { -+ return 0 -+} -+ -+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] -+ -+# argc=LookupError: unknown encoding: IBM1047 -+gdb_test "source $remote_python_file" "Traceback.*ClassName.*\r\nLookupError: unknown encoding: $charset" $test2 -+ -+gdb_test "p 1" " = 1" "no delayed error" -Index: gdb-7.2/gdb/testsuite/gdb.python/py-error.py -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.2/gdb/testsuite/gdb.python/py-error.py 2010-10-12 18:28:58.000000000 +0200 -@@ -0,0 +1,25 @@ -+# Copyright (C) 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+import gdb -+ -+class ClassName(gdb.Command): -+ 'a' -+ def __init__(self): -+ gdb.Command.__init__ (self, "ClassName", gdb.COMMAND_DATA, prefix=True) -+ def invoke(self, args, from_tty): -+ print -+ -+ClassName() -Index: gdb-7.2/gdb/varobj.c -=================================================================== ---- gdb-7.2.orig/gdb/varobj.c 2010-10-12 18:27:54.000000000 +0200 -+++ gdb-7.2/gdb/varobj.c 2010-10-12 18:28:58.000000000 +0200 -@@ -1054,6 +1054,8 @@ update_dynamic_varobj_children (struct v - error (_("Invalid item from the child list")); - - v = convert_value_from_python (py_v); -+ if (v == NULL) -+ gdbpy_print_stack (); - install_dynamic_child (var, can_mention ? changed : NULL, - can_mention ? new : NULL, - can_mention ? unchanged : NULL, -@@ -2542,6 +2544,8 @@ value_get_print_value (struct value *val - type = builtin_type (gdbarch)->builtin_char; - Py_DECREF (py_str); - } -+ else -+ gdbpy_print_stack (); - } - Py_DECREF (output); - } diff --git a/gdb-rhel5-gcc44.patch b/gdb-rhel5-gcc44.patch index e198d5d..be1586e 100644 --- a/gdb-rhel5-gcc44.patch +++ b/gdb-rhel5-gcc44.patch @@ -1,10 +1,10 @@ Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as the default gcc and gfortran binaries are from gcc-4.1. -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/vla.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/vla.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/vla.exp 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/vla.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.base/vla.exp 2010-11-16 09:26:50.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/vla.exp 2010-11-16 09:27:20.000000000 +0100 @@ -16,7 +16,25 @@ set testfile vla set srcfile ${testfile}.c @@ -32,10 +32,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/vla.exp untested "Couldn't compile test program" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.base/break-interp.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-07-05 20:04:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp 2010-07-13 23:11:22.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.base/break-interp.exp 2010-10-12 20:41:06.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.base/break-interp.exp 2010-11-16 09:28:40.000000000 +0100 @@ -33,9 +33,29 @@ if [get_compiler_info ${binfile_lib}] { return -1 } @@ -55,8 +55,8 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp + # Use -soname so that the new library gets copied by build_executable_own_libs. --if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} { -+set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] +-if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] != ""} { ++set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug ldflags=-Wl,-soname,${test}.so]] + +unset_board_info compiler +if [info exists old_compiler] { @@ -67,10 +67,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/break-interp.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 00:25:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/common-block.exp 2010-11-16 09:26:54.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/common-block.exp 2010-11-16 09:27:20.000000000 +0100 @@ -20,7 +20,25 @@ set testfile "common-block" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -98,10 +98,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/common-block.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dwarf-stride.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dwarf-stride.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-11-16 09:26:50.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dwarf-stride.exp 2010-11-16 09:27:20.000000000 +0100 @@ -27,7 +27,25 @@ set testfile dwarf-stride set srcfile ${testfile}.f90 @@ -129,10 +129,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dwarf-stride.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dynamic.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dynamic.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dynamic.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/dynamic.exp 2010-11-16 09:26:50.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/dynamic.exp 2010-11-16 09:27:20.000000000 +0100 @@ -25,7 +25,25 @@ set testfile "dynamic" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -160,10 +160,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/dynamic.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/library-module.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-06-03 00:41:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/library-module.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/library-module.exp 2010-06-03 00:41:56.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/library-module.exp 2010-11-16 09:27:20.000000000 +0100 @@ -25,16 +25,34 @@ if [get_compiler_info not-used] { return -1 } @@ -203,10 +203,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/library-module.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/module.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/module.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/module.exp 2010-06-03 01:01:01.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/module.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/module.exp 2010-09-22 21:22:44.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/module.exp 2010-11-16 09:27:20.000000000 +0100 @@ -16,7 +16,25 @@ set testfile "module" set srcfile ${testfile}.f90 @@ -234,10 +234,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/module.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/string.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/string.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/string.exp 2010-07-12 23:07:33.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/string.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/string.exp 2010-11-16 09:26:50.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/string.exp 2010-11-16 09:27:20.000000000 +0100 @@ -23,7 +23,25 @@ set testfile "string" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -265,10 +265,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/string.exp untested "Couldn't compile ${srcfile}" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/omp-step.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/omp-step.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-07-13 00:21:30.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/omp-step.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/omp-step.exp 2010-11-16 09:26:54.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/omp-step.exp 2010-11-16 09:27:20.000000000 +0100 @@ -15,7 +15,26 @@ set testfile "omp-step" @@ -297,10 +297,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/omp-step.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/derived-type.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/derived-type.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/derived-type.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/derived-type.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/derived-type.exp 2010-11-16 09:27:20.000000000 +0100 @@ -28,8 +28,26 @@ set testfile "derived-type" set srcfile ${testfile}.f90 set binfile ${objdir}/${subdir}/${testfile} @@ -330,10 +330,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/derived-type.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/subarray.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/subarray.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/subarray.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.fortran/subarray.exp 2010-01-01 08:32:02.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.fortran/subarray.exp 2010-11-16 09:27:20.000000000 +0100 @@ -28,8 +28,26 @@ set testfile "subarray" set srcfile ${testfile}.f set binfile ${objdir}/${subdir}/${testfile} @@ -363,10 +363,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.fortran/subarray.exp return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/tls-sepdebug.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/tls-sepdebug.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-07-12 23:07:34.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-07-13 23:05:14.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-11-16 09:26:51.000000000 +0100 ++++ gdb-7.2.50.20101116/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2010-11-16 09:27:20.000000000 +0100 @@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi # FIXME: gcc dependency (-Wl,-soname). @@ -394,10 +394,10 @@ Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.threads/tls-sepdebug.exp untested "Couldn't compile test library" return -1 } -Index: gdb-7.1.90.20100711/gdb/testsuite/lib/prelink-support.exp +Index: gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp =================================================================== ---- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/prelink-support.exp 2010-07-05 20:02:56.000000000 +0200 -+++ gdb-7.1.90.20100711/gdb/testsuite/lib/prelink-support.exp 2010-07-13 23:09:34.000000000 +0200 +--- gdb-7.2.50.20101116.orig/gdb/testsuite/lib/prelink-support.exp 2010-10-12 20:12:49.000000000 +0200 ++++ gdb-7.2.50.20101116/gdb/testsuite/lib/prelink-support.exp 2010-11-16 09:27:20.000000000 +0100 @@ -118,9 +118,31 @@ proc file_copy {src dest} { proc build_executable_own_libs {testname executable sources options {interp ""} {dir ""}} { global objdir subdir diff --git a/gdb-testsuite-lib-python.patch b/gdb-testsuite-lib-python.patch deleted file mode 100644 index 5a4a560..0000000 --- a/gdb-testsuite-lib-python.patch +++ /dev/null @@ -1,75 +0,0 @@ -ad20e5eb15d037a31e3b484e9f57542dc927c0a9 -http://sourceware.org/ml/gdb-cvs/2010-10/msg00005.html - -### src/gdb/testsuite/ChangeLog 2010/09/30 18:58:07 1.2462 -### src/gdb/testsuite/ChangeLog 2010/10/01 17:03:49 1.2463 -## -1,3 +1,19 @@ -+2010-10-01 Doug Evans -+ -+ * lib/gdb-python.exp: New file. -+ * gdb.python/py-block.exp: Use it. -+ * gdb.python/py-breakpoint.exp: Ditto. -+ * gdb.python/py-frame.exp: Ditto. -+ * gdb.python/py-inferior.exp: Ditto. -+ * gdb.python/py-param.exp: Ditto. -+ * gdb.python/py-prettyprint.exp: Ditto. -+ * gdb.python/py-shared.exp: Ditto. -+ * gdb.python/py-symbol.exp: Ditto. -+ * gdb.python/py-symtab.exp: Ditto. -+ * gdb.python/py-type.exp: Ditto. -+ * gdb.python/py-value.exp: Ditto. -+ * gdb.python/python.exp: Ditto. -+ - 2010-09-30 Tom Tromey - - * gdb.base/anon.exp: New file. ---- src/gdb/testsuite/lib/gdb-python.exp -+++ src/gdb/testsuite/lib/gdb-python.exp 2010-10-12 17:58:35.904468000 +0000 -@@ -0,0 +1,47 @@ -+# Copyright 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+# Utilities for python-scripting related tests. -+ -+# 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 } } -+ } -+} -+ -+# 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 -+} diff --git a/gdb-upstream.patch b/gdb-upstream.patch deleted file mode 100644 index ad3d10c..0000000 --- a/gdb-upstream.patch +++ /dev/null @@ -1,467 +0,0 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=610986 -http://sourceware.org/ml/gdb-cvs/2010-08/msg00112.html - -### src/gdb/ChangeLog 2010/08/18 22:57:45 1.12097 -### src/gdb/ChangeLog 2010/08/19 07:34:26 1.12098 -## -1,3 +1,9 @@ -+2010-08-19 Jan Kratochvil -+ -+ * varobj.c (varobj_create): Replace variable old_fi with old_id, -+ initialize it by null_frame_id, wrap its usage by get_frame_id, -+ frame_id_p and frame_find_by_id. -+ - 2010-08-18 Tom Tromey - - PR python/11900: ---- src/gdb/varobj.c 2010/08/06 14:17:56 1.159 -+++ src/gdb/varobj.c 2010/08/19 07:34:27 1.160 -@@ -524,7 +524,7 @@ varobj_create (char *objname, - { - struct varobj *var; - struct frame_info *fi; -- struct frame_info *old_fi = NULL; -+ struct frame_id old_id = null_frame_id; - struct block *block; - struct cleanup *old_chain; - -@@ -611,7 +611,7 @@ - - var->root->frame = get_frame_id (fi); - var->root->thread_id = pid_to_thread_id (inferior_ptid); -- old_fi = get_selected_frame (NULL); -+ old_id = get_frame_id (get_selected_frame (NULL)); - select_frame (fi); - } - -@@ -639,8 +639,8 @@ - var->root->rootvar = var; - - /* Reset the selected frame */ -- if (old_fi != NULL) -- select_frame (old_fi); -+ if (frame_id_p (old_id)) -+ select_frame (frame_find_by_id (old_id)); - } - - /* If the variable object name is null, that means this - - - -https://bugzilla.redhat.com/show_bug.cgi?id=627506 -Re: [patch] Fix nesting of ui_out_redirect -http://sourceware.org/ml/gdb-patches/2010-09/msg00122.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00031.html - -### src/gdb/ChangeLog 2010/09/03 01:29:09 1.12149 -### src/gdb/ChangeLog 2010/09/03 15:41:59 1.12150 -## -1,3 +1,27 @@ -+2010-09-03 Jan Kratochvil -+ -+ * breakpoint.c (save_breakpoints): Use RETURN_MASK_ALL. -+ * cli-out.c: Include vec.h. -+ (cli_field_fmt, cli_spaces, cli_text, cli_message, cli_flush): New -+ variable stream, initialize it, use it. -+ (cli_redirect): New function comment. Replace the stream and -+ original_stream fields by the new streams field. Remove the -+ original_stream != NULL conditional, assert error on NULL instead. -+ (out_field_fmt, field_separator): New variable stream, initialize it, use it. -+ (cli_out_data_ctor): Assert non-NULL stream. Replace the stream and -+ original_stream fields by the new streams field. -+ (cli_out_set_stream): Replace the stream field by the new streams -+ field. -+ * cli-out.h: Include vec.h. -+ (ui_filep): New typedef, call DEF_VEC_P for it. -+ (struct cli_ui_out_data): Replace the stream and original_stream -+ fields by the new streams field. -+ * cli/cli-logging.c (set_logging_redirect): Call ui_out_redirect with -+ NULL first. Extend the comment. -+ (handle_redirections): Call ui_out_redirect with output. -+ * python/py-breakpoint.c (bppy_get_commands): Move ui_out_redirect -+ calls outside of the TRY_CATCH block. -+ - -[ cli/cli-logging.c removed. ] - ---- src/gdb/breakpoint.c 2010/08/30 09:49:12 1.511 -+++ src/gdb/breakpoint.c 2010/09/03 15:42:02 1.512 -@@ -11487,7 +11487,7 @@ - fprintf_unfiltered (fp, " commands\n"); - - ui_out_redirect (uiout, fp); -- TRY_CATCH (ex, RETURN_MASK_ERROR) -+ TRY_CATCH (ex, RETURN_MASK_ALL) - { - print_command_lines (uiout, tp->commands->commands, 2); - } ---- src/gdb/cli-out.c 2010/05/13 23:53:32 1.30 -+++ src/gdb/cli-out.c 2010/09/03 15:42:02 1.31 -@@ -26,6 +26,7 @@ - #include "cli-out.h" - #include "gdb_string.h" - #include "gdb_assert.h" -+#include "vec.h" - - typedef struct cli_ui_out_data cli_out_data; - -@@ -224,11 +225,13 @@ - va_list args) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream; - - if (data->suppress_output) - return; - -- vfprintf_filtered (data->stream, format, args); -+ stream = VEC_last (ui_filep, data->streams); -+ vfprintf_filtered (stream, format, args); - - if (align != ui_noalign) - field_separator (); -@@ -238,20 +241,26 @@ - cli_spaces (struct ui_out *uiout, int numspaces) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream; - - if (data->suppress_output) - return; -- print_spaces_filtered (numspaces, data->stream); -+ -+ stream = VEC_last (ui_filep, data->streams); -+ print_spaces_filtered (numspaces, stream); - } - - static void - cli_text (struct ui_out *uiout, const char *string) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream; - - if (data->suppress_output) - return; -- fputs_filtered (string, data->stream); -+ -+ stream = VEC_last (ui_filep, data->streams); -+ fputs_filtered (string, stream); - } - - static void ATTRIBUTE_PRINTF (3, 0) -@@ -262,8 +271,13 @@ - - if (data->suppress_output) - return; -+ - if (ui_out_get_verblvl (uiout) >= verbosity) -- vfprintf_unfiltered (data->stream, format, args); -+ { -+ struct ui_file *stream = VEC_last (ui_filep, data->streams); -+ -+ vfprintf_unfiltered (stream, format, args); -+ } - } - - static void -@@ -280,25 +294,24 @@ - cli_flush (struct ui_out *uiout) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream = VEC_last (ui_filep, data->streams); - -- gdb_flush (data->stream); -+ gdb_flush (stream); - } - -+/* OUTSTREAM as non-NULL will push OUTSTREAM on the stack of output streams -+ and make it therefore active. OUTSTREAM as NULL will pop the last pushed -+ output stream; it is an internal error if it does not exist. */ -+ - static int - cli_redirect (struct ui_out *uiout, struct ui_file *outstream) - { - cli_out_data *data = ui_out_data (uiout); - - if (outstream != NULL) -- { -- data->original_stream = data->stream; -- data->stream = outstream; -- } -- else if (data->original_stream != NULL) -- { -- data->stream = data->original_stream; -- data->original_stream = NULL; -- } -+ VEC_safe_push (ui_filep, data->streams, outstream); -+ else -+ VEC_pop (ui_filep, data->streams); - - return 0; - } -@@ -315,10 +328,11 @@ - const char *format,...) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream = VEC_last (ui_filep, data->streams); - va_list args; - - va_start (args, format); -- vfprintf_filtered (data->stream, format, args); -+ vfprintf_filtered (stream, format, args); - - va_end (args); - } -@@ -329,8 +343,9 @@ - field_separator (void) - { - cli_out_data *data = ui_out_data (uiout); -+ struct ui_file *stream = VEC_last (ui_filep, data->streams); - -- fputc_filtered (' ', data->stream); -+ fputc_filtered (' ', stream); - } - - /* This is the CLI ui-out implementation functions vector */ -@@ -364,8 +379,11 @@ - void - cli_out_data_ctor (cli_out_data *self, struct ui_file *stream) - { -- self->stream = stream; -- self->original_stream = NULL; -+ gdb_assert (stream != NULL); -+ -+ self->streams = NULL; -+ VEC_safe_push (ui_filep, self->streams, stream); -+ - self->suppress_output = 0; - } - -@@ -385,8 +403,10 @@ - cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream) - { - cli_out_data *data = ui_out_data (uiout); -- struct ui_file *old = data->stream; -+ struct ui_file *old; -+ -+ old = VEC_pop (ui_filep, data->streams); -+ VEC_quick_push (ui_filep, data->streams, stream); - -- data->stream = stream; - return old; - } ---- src/gdb/cli-out.h 2010/04/18 00:11:55 1.11 -+++ src/gdb/cli-out.h 2010/09/03 15:42:02 1.12 -@@ -22,14 +22,19 @@ - #define CLI_OUT_H - - #include "ui-out.h" -+#include "vec.h" -+ -+/* Used for cli_ui_out_data->streams. */ -+ -+typedef struct ui_file *ui_filep; -+DEF_VEC_P (ui_filep); - - /* These are exported so that they can be extended by other `ui_out' - implementations, like TUI's. */ - - struct cli_ui_out_data - { -- struct ui_file *stream; -- struct ui_file *original_stream; -+ VEC (ui_filep) *streams; - int suppress_output; - }; - ---- src/gdb/python/py-breakpoint.c 2010/07/01 10:36:12 1.4 -+++ src/gdb/python/py-breakpoint.c 2010/09/03 15:42:03 1.5 -@@ -474,12 +474,12 @@ - string_file = mem_fileopen (); - chain = make_cleanup_ui_file_delete (string_file); - -+ ui_out_redirect (uiout, string_file); - TRY_CATCH (except, RETURN_MASK_ALL) - { -- ui_out_redirect (uiout, string_file); - print_command_lines (uiout, breakpoint_commands (bp), 0); -- ui_out_redirect (uiout, NULL); - } -+ ui_out_redirect (uiout, NULL); - cmdstr = ui_file_xstrdup (string_file, &length); - GDB_PY_HANDLE_EXCEPTION (except); - -### src/gdb/testsuite/ChangeLog 2010/09/02 15:19:56 1.2435 -### src/gdb/testsuite/ChangeLog 2010/09/03 15:42:04 1.2436 -## -1,3 +1,7 @@ -+2010-09-03 Jan Kratochvil -+ -+ * gdb.base/ui-redirect.exp: New file. -+ - 2010-09-02 Jan Kratochvil - Joel Brobecker - ---- src/gdb/testsuite/gdb.base/ui-redirect.exp -+++ src/gdb/testsuite/gdb.base/ui-redirect.exp 2010-09-11 18:42:40.040910000 +0000 -@@ -0,0 +1,41 @@ -+# Copyright (C) 2010 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+if { [prepare_for_testing ui-redirect.exp ui-redirect start.c] } { -+ return -1 -+} -+ -+gdb_breakpoint main -+ -+set test "commands" -+gdb_test_multiple $test $test { -+ -re "End with a line saying just \"end\"\\.\r\n>$" { -+ pass $test -+ } -+} -+ -+set test "print 1" -+gdb_test_multiple $test $test { -+ -re "\r\n>$" { -+ pass $test -+ } -+} -+gdb_test_no_output "end" -+ -+gdb_test_no_output "set logging file /dev/null" -+gdb_test "set logging on" "Copying output to /dev/null\\." -+gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." -+gdb_test "set logging off" "Done logging to /dev/null\\." -+gdb_test "help" "List of classes of commands:.*" - - - -https://bugzilla.redhat.com/show_bug.cgi?id=627506 -Re: [patch] Fix uiout for execute_command_to_string -http://sourceware.org/ml/gdb-patches/2010-09/msg00235.html -http://sourceware.org/ml/gdb-cvs/2010-09/msg00080.html - -### src/gdb/ChangeLog 2010/09/10 16:17:11 1.12170 -### src/gdb/ChangeLog 2010/09/11 16:00:20 1.12171 -## -1,3 +1,21 @@ -+2010-09-11 Jan Kratochvil -+ Paul Bolle -+ -+ Redirect also uiout and stdtarg{,err} in execute_command_to_string. -+ * cli-logging.c (struct saved_output_files) : New. -+ (set_logging_redirect, pop_output_files, handle_redirections): -+ Redirect also gdb_stdtargerr. -+ * defs.h (struct ui_out, make_cleanup_ui_out_redirect_pop): New -+ declarations. -+ * event-top.c (gdb_setup_readline, gdb_disable_readline): Redirect -+ also gdb_stdtargerr. -+ * top.c (execute_command_to_string): Move make_cleanup_ui_file_delete -+ to the top. Redirect also gdb_stdlog, gdb_stdtarg and gdb_stdtargerr. -+ Use ui_out_redirect, register make_cleanup_ui_out_redirect_pop. -+ * tui/tui-io.c (tui_setup_io): Redirect also gdb_stdtargerr. -+ * utils.c (do_ui_out_redirect_pop, make_cleanup_ui_out_redirect_pop): -+ New functions. -+ - -### src/gdb/testsuite/ChangeLog 2010/09/10 20:29:25 1.2444 -### src/gdb/testsuite/ChangeLog 2010/09/11 16:00:26 1.2445 -## -1,3 +1,8 @@ -+2010-09-11 Jan Kratochvil -+ -+ * gdb.python/python.exp (set height 0, collect help from uiout) -+ (verify help to uiout): New tests. -+ - -[ gdb_stdtargerr handling dropped. ] - ---- src/gdb/defs.h 2010/08/31 18:08:43 1.278 -+++ src/gdb/defs.h 2010/09/11 16:00:25 1.279 -@@ -337,6 +337,10 @@ - struct ui_file; - extern struct cleanup *make_cleanup_ui_file_delete (struct ui_file *); - -+struct ui_out; -+extern struct cleanup * -+ make_cleanup_ui_out_redirect_pop (struct ui_out *uiout); -+ - struct section_addr_info; - extern struct cleanup *(make_cleanup_free_section_addr_info - (struct section_addr_info *)); ---- src/gdb/top.c 2010/08/07 15:00:37 1.183 -+++ src/gdb/top.c 2010/09/11 16:00:25 1.184 -@@ -475,12 +475,23 @@ - - str_file = mem_fileopen (); - -+ make_cleanup_ui_file_delete (str_file); - make_cleanup_restore_ui_file (&gdb_stdout); - make_cleanup_restore_ui_file (&gdb_stderr); -- make_cleanup_ui_file_delete (str_file); -+ make_cleanup_restore_ui_file (&gdb_stdlog); -+ make_cleanup_restore_ui_file (&gdb_stdtarg); -+ make_cleanup_restore_ui_file (&gdb_stdtargerr); -+ -+ if (ui_out_redirect (uiout, str_file) < 0) -+ warning (_("Current output protocol does not support redirection")); -+ else -+ make_cleanup_ui_out_redirect_pop (uiout); - - gdb_stdout = str_file; - gdb_stderr = str_file; -+ gdb_stdlog = str_file; -+ gdb_stdtarg = str_file; -+ gdb_stdtargerr = str_file; - - execute_command (p, from_tty); - ---- src/gdb/utils.c 2010/08/07 15:00:37 1.239 -+++ src/gdb/utils.c 2010/09/11 16:00:25 1.240 -@@ -311,6 +311,26 @@ - return make_my_cleanup (&cleanup_chain, do_ui_file_delete, arg); - } - -+/* Helper function for make_cleanup_ui_out_redirect_pop. */ -+ -+static void -+do_ui_out_redirect_pop (void *arg) -+{ -+ struct ui_out *uiout = arg; -+ -+ if (ui_out_redirect (uiout, NULL) < 0) -+ warning (_("Cannot restore redirection of the current output protocol")); -+} -+ -+/* Return a new cleanup that pops the last redirection by ui_out_redirect -+ with NULL parameter. */ -+ -+struct cleanup * -+make_cleanup_ui_out_redirect_pop (struct ui_out *uiout) -+{ -+ return make_my_cleanup (&cleanup_chain, do_ui_out_redirect_pop, uiout); -+} -+ - static void - do_free_section_addr_info (void *arg) - { ---- gdb-7.2/gdb/testsuite/gdb.python/python.exp-orig 2010-08-09 21:23:00.000000000 +0200 -+++ gdb-7.2/gdb/testsuite/gdb.python/python.exp 2010-09-11 20:49:22.000000000 +0200 -@@ -110,3 +110,9 @@ gdb_test_multiple "python print \"\\n\" - } - } - gdb_test "q" "Quit" "verify pagination afterwards: q" -+ -+gdb_test_no_output "set height 0" -+ -+gdb_test_no_output "python a = gdb.execute('help', to_string=True)" "collect help from uiout" -+ -+gdb_test "python print a" ".*aliases -- Aliases of other commands.*" "verify help to uiout" diff --git a/gdb.spec b/gdb.spec index a709120..c82e752 100644 --- a/gdb.spec +++ b/gdb.spec @@ -23,18 +23,19 @@ Name: gdb%{?_with_debug:-debug} # Set version to contents of gdb/version.in. # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). -Version: 7.2 +Version: 7.2.50.20101117 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 25%{?_with_upstream:.upstream}%{dist} +Release: 1%{?_with_upstream:.upstream}%{dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain Group: Development/Debuggers # Do not provide URL for snapshots as the file lasts there only for 2 days. +# ftp://sourceware.org/pub/gdb/snapshots/current/gdb-%{version}.tar.bz2 # ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 # ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 -Source: ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 +Source: ftp://sourceware.org/pub/gdb/snapshots/current/gdb-%{version}.tar.bz2 Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) URL: http://gnu.org/software/gdb/ @@ -276,8 +277,8 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. -#=drop: Just backports. -Patch232: gdb-upstream.patch +#Xdrop: Just backports. +#Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest+ppc @@ -291,10 +292,6 @@ Patch235: gdb-6.3-bz231832-obstack-2gb.patch #=push Patch241: gdb-6.6-bz225783-gdb-debuginfo-paths.patch -# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). -#=fedoratest: Drop the obsoleted gdb_gcore.sh change. -Patch245: gdb-6.6-bz229517-gcore-without-terminal.patch - # Notify user of a child forked process being detached (BZ 235197). #=push: This is more about discussion if/what should be printed. Patch247: gdb-6.6-bz235197-fork-detach-info.patch @@ -357,8 +354,6 @@ Patch289: gdb-6.5-ia64-libunwind-leak-test.patch Patch290: gdb-6.5-missed-trap-on-step-test.patch # Support DW_TAG_interface_type the same way as DW_TAG_class_type (BZ 426600). -#=maybepush -Patch293: gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch #=fedoratest Patch294: gdb-6.7-bz426600-DW_TAG_interface_type-test.patch @@ -419,10 +414,6 @@ Patch330: gdb-6.8-bz436037-reg-no-longer-active.patch #=push: Useful only after gdb-6.8-attach-signalled-detach-stopped.patch . Patch331: gdb-6.8-quit-never-aborts.patch -# Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs. -#=push -Patch332: gdb-6.8-fortran-tag-constant.patch - # Fix attaching to stopped processes and/or pending signals. #=push+work Patch337: gdb-6.8-attach-signalled-detach-stopped.patch @@ -435,19 +426,14 @@ Patch343: gdb-6.8-watchpoint-conditionals-test.patch #=fedoratest Patch348: gdb-6.8-bz466901-backtrace-full-prelinked.patch -# The merged branch `archer' of: http://sourceware.org/gdb/wiki/ProjectArcher +# The merged branch `archer-jankratochvil-fedora15' of: +# http://sourceware.org/gdb/wiki/ProjectArcher #=push #archer-jankratochvil-vla #=push #archer-jankratochvil-watchpoint3 #=push #archer-jankratochvil-ifunc -#=push -#archer-pmuldoon-next-over-throw2 -#=maybepush -#archer-tromey-python -#=maybepush -#archer-tromey-optional-psymtab Patch349: gdb-archer.patch #=maybepush Patch420: gdb-archer-ada.patch @@ -512,12 +498,6 @@ Patch412: gdb-unused-revert.patch #=push+work: It should be fixed properly instead. Patch417: gdb-bz541866-rwatch-before-run.patch -# Fix crash on C++ types in some debug info files (BZ 575292, Keith Seitz). -# Temporarily workaround the crash of BZ 575292 as there was now BZ 585445. -# Re-enable the BZ 575292 and BZ 585445 C++ fix using an updated patch. -#=maybepush: Not sure if all the parts are upstream. -Patch451: gdb-bz575292-delayed-physname.patch - # Fix crash when using GNU IFUNC call from breakpoint condition. #=drop: After archer-jankratochvil-ifunc gets in this one gets obsoleted. Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch @@ -526,10 +506,6 @@ Patch454: gdb-bz539590-gnu-ifunc-fix-cond.patch #=push+work: Currently it is still not fully safe. Patch459: gdb-moribund-utrace-workaround.patch -# Remove core file when starting a process (BZ 594560). -#=maybepush -Patch461: gdb-bz594560-core-vs-process.patch - # Fix follow-exec for C++ programs (bugreported by Martin Stransky). #=fedoratest Patch470: gdb-archer-next-over-throw-cxx-exec.patch @@ -544,18 +520,10 @@ Patch486: gdb-bz562763-pretty-print-2d-vectors.patch #=push+work: There are some outstanding issues, check the mails. Patch487: gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch -# Fix prelinked executables with sepdebug and copy relocations (BZ 614659). -#=drop: Upstreamed. -Patch489: gdb-bz614659-prelink-dynbss.patch - # Provide /usr/bin/gdb-add-index for rpm-build (Tom Tromey). #=drop: Re-check against the upstream version. Patch491: gdb-gdb-add-index-script.patch -# Fix gcore from very small terminal windows (BZ 555076). -#=drop: Upstreamed. -Patch493: gdb-bz555076-gcore-small-height.patch - # Out of memory is just an error, not fatal (uninitialized VLS vars, BZ 568248). #=drop+work: Inferior objects should be read in parts, then this patch gets obsoleted. Patch496: gdb-bz568248-oom-is-error.patch @@ -564,76 +532,23 @@ Patch496: gdb-bz568248-oom-is-error.patch #=push Patch497: gdb-false-gcc-warning.patch -# Do not crash on broken separate debuginfo due to old elfutils (BZ 631575). -#=drop: Upstreamed. -Patch499: gdb-bz631575-gdb-index-nobits.patch - -# Fix symbol lookup misses methods of current class (BZ 631158, Sami Wagiaalla). -#=maybepush -Patch500: gdb-bz631158-cxx-this-lookup.patch - -# Fix Ada regression when any .gdb_index library is present. -#=drop: Upstreamed. -Patch501: gdb-gdbindex-ada-regression.patch - -# python: load *-gdb.py for shlibs during attach (BZ 634660). -#=drop: Upstreamed. -Patch502: gdb-bz634660-gdbpy-load-on-attach.patch - -# Fix double free crash during overload resolution (PR 12028, Sami Wagiaalla). -#=drop: Upstreamed. -Patch503: gdb-pr12028-double-free.patch - # Fix gcore writer for -Wl,-z,relro (PR corefiles/11804). #=push: There is different patch on gdb-patches, waiting now for resolution in kernel. Patch504: gdb-bz623749-gcore-relro.patch -# Fix infinite loop crash on self-referencing class (BZ 627432). -#=drop: Upstreamed. -Patch506: gdb-bz627432-loop-static-self-class.patch - # Fix lost siginfo_t in linux-nat (BZ 592031). -#=drop: Upstreamed. -Patch507: gdb-bz592031-siginfo-lost-1of5.patch -#=drop: Upstreamed. -Patch508: gdb-bz592031-siginfo-lost-2of5.patch -#=drop: Upstreamed. -Patch509: gdb-bz592031-siginfo-lost-3of5.patch #=push Patch510: gdb-bz592031-siginfo-lost-4of5.patch #=push Patch511: gdb-bz592031-siginfo-lost-5of5.patch -# Fix .gdb_index for big-endian hosts (Tom Tromey). -#=drop: Upstreamed. -Patch514: gdb-gdbindex-v1-to-v2.patch -#=drop: Upstreamed. -Patch512: gdb-gdbindex-bigendian.patch -#=drop: Upstreamed. -Patch515: gdb-gdbindex-v2-to-v3.patch - -# [ifunc] Fix crash on deleting watchpoint of an autovariable (BZ 637770). -#=drop: A part of archer-jankratochvil-ifunc work. -Patch513: gdb-bz637770-ifunc-watchpoint-delete.patch - -# Fix python stale error state, also fix its save/restore (BZ 639089). -#=drop: Just a backport. -Patch518: gdb-testsuite-lib-python.patch -#=drop: Upstreamed. -Patch516: gdb-python-error-state.patch - -# Fix inferior exec of new PIE x86_64 (BZ 638979). -#=drop: Upstreamed. -Patch517: gdb-exec-pie-amd64.patch - # Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879). #=push Patch520: gdb-bz642879-elfread-sigint-stale.patch -# iFort compat. - case insensitive DWARF not in lowercase (BZ 645773). -Patch522: gdb-bz645773-ifort-case-1of3.patch -Patch523: gdb-bz645773-ifort-case-2of3.patch -Patch524: gdb-bz645773-ifort-case-3of3.patch +# Fix next/finish/etc -vs- exceptions (Tom Tromey). +#=push +Patch525: gdb-next-over-throw.patch BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa} Requires: readline%{?_isa} @@ -769,7 +684,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %if 0%{!?_with_upstream:1} -%patch232 -p1 +#patch232 -p1 %patch349 -p1 %patch420 -p1 %patch1 -p1 @@ -820,7 +735,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch234 -p1 %patch235 -p1 %patch241 -p1 -%patch245 -p1 %patch247 -p1 %patch254 -p1 %patch258 -p1 @@ -837,7 +751,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch287 -p1 %patch289 -p1 %patch290 -p1 -%patch293 -p1 %patch294 -p1 %patch296 -p1 %patch298 -p1 @@ -853,7 +766,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch329 -p1 %patch330 -p1 %patch331 -p1 -%patch332 -p1 %patch337 -p1 %patch343 -p1 %patch348 -p1 @@ -872,10 +784,8 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch408 -p1 %patch412 -p1 %patch417 -p1 -%patch451 -p1 %patch454 -p1 %patch459 -p1 -%patch461 -p1 %patch470 -p1 %patch475 -p1 %patch486 -p1 @@ -883,34 +793,14 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c #patch487 -p1 %patch415 -p1 %patch519 -p1 -%patch489 -p1 %patch491 -p1 -%patch493 -p1 %patch496 -p1 %patch497 -p1 -%patch499 -p1 -%patch500 -p1 -%patch501 -p1 -%patch502 -p1 -%patch503 -p1 %patch504 -p1 -%patch506 -p1 -%patch507 -p1 -%patch508 -p1 -%patch509 -p1 %patch510 -p1 %patch511 -p1 -%patch514 -p1 -%patch512 -p1 -%patch515 -p1 -%patch513 -p1 -%patch516 -p1 -%patch517 -p1 -%patch518 -p1 %patch520 -p1 -%patch522 -p1 -%patch523 -p1 -%patch524 -p1 +%patch525 -p1 %patch393 -p1 %patch335 -p1 @@ -1281,6 +1171,9 @@ fi %endif %changelog +* Wed Nov 17 2010 Jan Kratochvil - 7.2.50.20101117-1.fc15 +- Rebase to FSF GDB 7.2.50.20101117 (which is a 7.3 pre-release). + * Sun Nov 7 2010 Jan Kratochvil - 7.2-25.fc14 - iFort compat. - case insensitive DWARF not in lowercase (BZ 645773). diff --git a/sources b/sources index 6c2d734..c5eb9de 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -64260e6c56979ee750a01055f16091a5 gdb-7.2.tar.bz2 +b13143c7c7e70f929c86c3f363247909 gdb-7.2.50.20101117.tar.bz2