]> git.pld-linux.org Git - packages/gdb.git/commitdiff
redhat patchset merged, pld patchset updated.
authorPaweł Sikora <pawel.sikora@agmk.net>
Sun, 18 Nov 2012 20:27:35 +0000 (21:27 +0100)
committerPaweł Sikora <pawel.sikora@agmk.net>
Sun, 18 Nov 2012 20:27:35 +0000 (21:27 +0100)
97 files changed:
buildid-locate-rpm-pld.patch
gdb-6.3-bt-past-zero-20051201.patch [deleted file]
gdb-6.3-framepczero-20040927.patch [deleted file]
gdb-6.3-inheritance-20050324.patch [deleted file]
gdb-6.3-large-core-20051206.patch [deleted file]
gdb-6.3-readnever-20050907.patch
gdb-6.3-security-errata-20050610.patch [deleted file]
gdb-6.3-terminal-fix-20050214.patch [deleted file]
gdb-6.3-test-pie-20050107.patch
gdb-6.5-bz203661-emit-relocs.patch
gdb-6.5-bz216711-clone-is-outermost.patch
gdb-6.5-dwarf-stack-overflow.patch [deleted file]
gdb-6.5-readline-long-line-crash.patch [deleted file]
gdb-6.6-buildid-locate-core-as-arg.patch
gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
gdb-6.6-buildid-locate-rpm.patch
gdb-6.6-buildid-locate-solib-missing-ids.patch [new file with mode: 0644]
gdb-6.6-buildid-locate.patch
gdb-6.6-bz225783-gdb-debuginfo-paths.patch [deleted file]
gdb-6.6-readline-system.patch [deleted file]
gdb-6.6-scheduler_locking-step-is-default.patch
gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch
gdb-6.6-testsuite-timeouts.patch
gdb-6.7-bz426600-DW_TAG_interface_type-fix.patch [deleted file]
gdb-6.7-kernel-headers-compat.patch [deleted file]
gdb-6.8-attach-signalled-detach-stopped.patch [new file with mode: 0644]
gdb-6.8-bz254229-gcore-prpsinfo.patch
gdb-6.8-fortran-tag-constant.patch [deleted file]
gdb-6.8-gcc35998-ada-memory-trash.patch [deleted file]
gdb-6.8-glibc-headers-compat.patch [deleted file]
gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
gdb-archer-ada.patch [deleted file]
gdb-archer-pie-addons-keep-disabled.patch
gdb-archer-pie-addons.patch
gdb-archer-vla-rhel5gcc.patch [deleted file]
gdb-archer.patch
gdb-attach-fail-reasons-1of5.patch [deleted file]
gdb-attach-fail-reasons-2of5.patch [deleted file]
gdb-attach-fail-reasons-3of5.patch [deleted file]
gdb-attach-fail-reasons-4of5.patch [deleted file]
gdb-attach-fail-reasons-5of5.patch
gdb-attach-fail-reasons-5of5configure.patch
gdb-bz539590-gnu-ifunc-fix-cond.patch [deleted file]
gdb-bz541866-rwatch-before-run.patch
gdb-bz555076-gcore-small-height.patch [deleted file]
gdb-bz575292-delayed-physname.patch [deleted file]
gdb-bz592031-siginfo-lost-1of5.patch [deleted file]
gdb-bz592031-siginfo-lost-2of5.patch [deleted file]
gdb-bz592031-siginfo-lost-3of5.patch [deleted file]
gdb-bz592031-siginfo-lost-4of5.patch [deleted file]
gdb-bz592031-siginfo-lost-5of5.patch [deleted file]
gdb-bz594560-core-vs-process.patch [deleted file]
gdb-bz614659-prelink-dynbss.patch [deleted file]
gdb-bz627432-loop-static-self-class.patch [deleted file]
gdb-bz631158-cxx-this-lookup.patch [deleted file]
gdb-bz631575-gdb-index-nobits.patch [deleted file]
gdb-bz634660-gdbpy-load-on-attach.patch [deleted file]
gdb-bz637770-ifunc-watchpoint-delete.patch [deleted file]
gdb-check-type.patch [new file with mode: 0644]
gdb-core-open-vdso-warning.patch
gdb-die-cu-offset-1of2.patch [deleted file]
gdb-die-cu-offset-2of2.patch [deleted file]
gdb-dlopen-stap-probe-1of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-2of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-3of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-4of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-5of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-6of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-7of7.patch [new file with mode: 0644]
gdb-dlopen-stap-probe-test.patch
gdb-dlopen-stap-probe-test2.patch [new file with mode: 0644]
gdb-dlopen-stap-probe.patch [deleted file]
gdb-entryval-inlined.patch [new file with mode: 0644]
gdb-exit-warning.patch [deleted file]
gdb-expand-cxx-accel.patch [deleted file]
gdb-false-gcc-warning.patch [deleted file]
gdb-fortran-common-reduce.patch
gdb-fortran-common.patch
gdb-gdbindex-ada-regression.patch [deleted file]
gdb-gdbindex-bigendian.patch [deleted file]
gdb-glibc-strstr-workaround.patch [new file with mode: 0644]
gdb-minidebuginfo.patch [new file with mode: 0644]
gdb-print-class.patch [new file with mode: 0644]
gdb-prologue-not-skipped.patch [deleted file]
gdb-readline62-ask-more-rh.patch [new file with mode: 0644]
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch [new file with mode: 0644]
gdb-rhel5-compat.patch [new file with mode: 0644]
gdb-rhel5-gcc44.patch
gdb-rhel5.9-testcase-xlf-var-inside-mod.patch [new file with mode: 0644]
gdb-stale-frame_info.patch [new file with mode: 0644]
gdb-stap-double-free.patch [deleted file]
gdb-step-symless.patch [new file with mode: 0644]
gdb-unused-revert.patch [deleted file]
gdb-upstream.patch [deleted file]
gdb-x86-onstack-1of2.patch [deleted file]
gdb-x86-onstack-2of2.patch [deleted file]
gdb.spec

index 1910f54e45948246ce87dcd0c77cb8fc215184a8..2a420393eafa3d97dcb532191e0e1a2fbd3e393e 100644 (file)
@@ -1,11 +1,11 @@
---- gdb-7.2/gdb/elfread.c.orig 2010-10-16 10:25:51.886687929 +0200
-+++ gdb-7.2/gdb/elfread.c      2010-10-16 10:26:30.752319402 +0200
+--- gdb-7.5.0.20120926/gdb/elfread.c.orig      2012-11-18 20:50:42.844619396 +0100
++++ gdb-7.5.0.20120926/gdb/elfread.c   2012-11-18 20:52:37.756554669 +0100
 @@ -2177,9 +2177,8 @@
        fprintf_unfiltered (gdb_stdlog,
                            _("Missing separate debuginfo for %s\n"), binary);
          if (debug != NULL)
 -        fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
--                            "yum --disablerepo='*' --enablerepo='*-debug*'"
+-                            "yum --disablerepo='*' --enablerepo='*debug*'"
 -                            " install", debug);
 +        fprintf_unfiltered (gdb_stdlog, _("Try to install package that provides `%s' file\n"),
 +                            debug);
diff --git a/gdb-6.3-bt-past-zero-20051201.patch b/gdb-6.3-bt-past-zero-20051201.patch
deleted file mode 100644 (file)
index 11b946d..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-2005-12-01  Jeff Johnston  <jjohnstn@redhat.com>
-
-       * frame.c (backtrace_past_zero_pc): New static variable.
-       (get_prev_frame): Don't return NULL for zero pc value if
-       backtrace past-zero-frame option is turned on.
-       (_initialize_frame): Initialize new command to allow backtracing
-       past a zero pc value (set backtrace past-zero-pc).
-
-testsuite/gdb.base:
-2005-12-01  Jeff Johnston  <jjohnstn@redhat.com>
-
-       * setshow.exp: Add testing of "set backtrace past-zero-pc" option.
-
-2007-10-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Port to GDB-6.7.
-
-Index: gdb-7.1.90.20100711/gdb/testsuite/gdb.base/setshow.exp
-===================================================================
---- gdb-7.1.90.20100711.orig/gdb/testsuite/gdb.base/setshow.exp        2010-06-11 22:56:06.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/testsuite/gdb.base/setshow.exp     2010-07-12 10:46:06.000000000 +0200
-@@ -96,6 +96,16 @@ if { ![target_info exists use_gdb_stub] 
-     delete_breakpoints
-     gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args"
- }
-+#test show backtrace past-zero-pc
-+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "default show backtrace past-zero-pc (off)"
-+#test set backtrace past-zero-pc on
-+gdb_test "set backtrace past-zero-pc on" "" "set backtrace past-zero-pc on"
-+#test show backtrace past-zero-pc
-+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is on." "show backtrace past-zero-pc (on)"
-+#test set backtrace past-zero-pc off
-+gdb_test "set backtrace past-zero-pc off" "" "set backtrace past-zero-pc off"
-+#test show backtrace past-zero-pc
-+gdb_test "show backtrace past-zero-pc" "Whether backtraces should continue past a zero pc value is off." "show backtrace past-zero-pc (off)"
- #test set check range on
- gdb_test "set check range on" ".*" "set check range on" 
- #test show check range on
-Index: gdb-7.1.90.20100711/gdb/frame.c
-===================================================================
---- gdb-7.1.90.20100711.orig/gdb/frame.c       2010-07-12 10:00:56.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/frame.c    2010-07-12 10:45:18.000000000 +0200
-@@ -185,6 +185,16 @@ Whether backtraces should continue past 
-                   value);
- }
-+static int backtrace_past_zero_pc;
-+static void
-+show_backtrace_past_zero_pc (struct ui_file *file, int from_tty,
-+                           struct cmd_list_element *c, const char *value)
-+{
-+  fprintf_filtered (file, _("\
-+Whether backtraces should continue past a zero pc value is %s.\n"),
-+                  value);
-+}
-+
- static int backtrace_past_entry;
- static void
- show_backtrace_past_entry (struct ui_file *file, int from_tty,
-@@ -1784,9 +1794,7 @@ get_prev_frame (struct frame_info *this_
-     }
-   if (this_frame->level > 0
--#if 0
--      && backtrace_past_zero_pc
--#endif
-+      && !backtrace_past_zero_pc
-       && get_frame_type (this_frame) == NORMAL_FRAME
-       && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
-       && get_frame_pc (this_frame) == 0)
-@@ -2271,6 +2279,17 @@ the rest of the stack trace."),
-                          &set_backtrace_cmdlist,
-                          &show_backtrace_cmdlist);
-+  add_setshow_boolean_cmd ("past-zero-pc", class_obscure,
-+                         &backtrace_past_zero_pc, _("\
-+Set whether backtraces should continue past a zero pc value."), _("\
-+Show whether backtraces should continue past a zero pc value."), _("\
-+Normally GDB stops backtracing when it finds a zero pc.\n\
-+Set this variable if you need to see the rest of the stack trace."), 
-+                         NULL,
-+                         show_backtrace_past_zero_pc,
-+                         &set_backtrace_cmdlist,
-+                         &show_backtrace_cmdlist);
-+
-   add_setshow_integer_cmd ("limit", class_obscure,
-                          &backtrace_limit, _("\
- Set an upper bound on the number of backtrace levels."), _("\
diff --git a/gdb-6.3-framepczero-20040927.patch b/gdb-6.3-framepczero-20040927.patch
deleted file mode 100644 (file)
index a8dae6b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-2004-09-27  Andrew Cagney  <cagney@gnu.org>
-
-       * frame.c (get_prev_frame): Stop backtrace when a zero PC and
-       successive normal frames.
-
-Index: gdb-6.8.50.20081128/gdb/frame.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/frame.c       2008-12-04 01:34:37.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/frame.c    2008-12-04 01:35:47.000000000 +0100
-@@ -1566,6 +1566,18 @@ get_prev_frame (struct frame_info *this_
-       return NULL;
-     }
-+  if (this_frame->level > 0
-+#if 0
-+      && backtrace_past_zero_pc
-+#endif
-+      && get_frame_type (this_frame) == NORMAL_FRAME
-+      && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
-+      && get_frame_pc (this_frame) == 0)
-+    {
-+      frame_debug_got_null_frame (this_frame, "zero PC");
-+      return NULL;
-+    }
-+
-   return get_prev_frame_1 (this_frame);
- }
diff --git a/gdb-6.3-inheritance-20050324.patch b/gdb-6.3-inheritance-20050324.patch
deleted file mode 100644 (file)
index 433b6f7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-2005-03-24  Jeff Johnston  <jjohnstn@redhat.com>
-
-       * valops.c (check_field_in): Use check_typedef for base classes
-       to avoid problems with opaque type references.
-
-Index: gdb-6.8.50.20081128/gdb/valops.c
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/valops.c      2008-12-08 10:56:11.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/valops.c   2008-12-08 10:59:14.000000000 +0100
-@@ -2484,8 +2484,14 @@ check_field (struct type *type, const ch
-     }
-   for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
--    if (check_field (TYPE_BASECLASS (type, i), name))
--      return 1;
-+    {
-+      /* Check the base classes.  Make sure we have the real type for
-+         each base class as opposed to an opaque declaration.  */
-+      struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
-+
-+      if (check_field (baseclass, name))
-+      return 1;
-+    }
-   return 0;
- }
diff --git a/gdb-6.3-large-core-20051206.patch b/gdb-6.3-large-core-20051206.patch
deleted file mode 100644 (file)
index 8789a6a..0000000
+++ /dev/null
@@ -1,305 +0,0 @@
-2005-12-14  Jeff Johnston  <jjohnstn@redhat.com>
-
-       * symfile-mem.c (read_memory): New static read callback function.
-       (symfile_add_from_memory): Pass read_memory to bfd instead of
-       target_read_memory.
-       * target.c (target_xfer_memory): Add support for LONGEST len and
-       change all callers.
-       (deprecated_debug_xfer_memory, target_read_memory): Ditto.
-       (target_write_memory, do_xfer_memory): Ditto.
-       (target_xfer_memory_partial, target_read_memory_partial): Ditto.
-       (target_write_memory_partial): Ditto.
-       * infptrace.c (child_xfer_memory): Ditto.
-       * linux-nat.c (linux_nat_xfer_memory): Ditto.
-       (linux_nat_proc_xfer_memory): Ditto.
-       * dcache.c (dcache_xfer_memory): Ditto.
-       * exec.c (xfer_memory): Ditto.
-       * remote.c (remote_xfer_memory): Ditto.
-       * remote-sim.c (gdbsim_xfer_interior_memory): Ditto.
-       * target.h: Change prototypes for functions changed above.
-       * linux-nat.h: Ditto.
-       * remote.h: Ditto.
-       * dcache.h: Ditto.
-
-2007-10-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Port to GDB-6.7.
-
-Index: gdb-7.1.90.20100711/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
-@@ -57,6 +57,14 @@
- #include "elf/common.h"
-+/* Local callback routine to pass to bfd to read from target memory,
-+   using a len constrained to INT_MAX.  */
-+static int
-+read_target_memory (bfd_vma addr, bfd_byte *buf, int len)
-+{
-+  return target_read_memory (addr, buf, (LONGEST)len);
-+}
-+
- /* Read inferior memory at ADDR to find the header of a loaded object file
-    and read its in-core symbols out of inferior memory.  TEMPL is a bfd
-    representing the target's format.  NAME is the name to use for this
-@@ -77,7 +85,7 @@ symbol_file_add_from_memory (struct bfd 
-     error (_("add-symbol-file-from-memory not supported for this target"));
-   nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, &loadbase,
--                                       target_read_memory);
-+                                       read_target_memory);
-   if (nbfd == NULL)
-     error (_("Failed to read a valid object file image from memory."));
-Index: gdb-7.1.90.20100711/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
-@@ -58,7 +58,7 @@ static int nosymbol (char *, CORE_ADDR *
- static void tcomplain (void) ATTRIBUTE_NORETURN;
--static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
-+static LONGEST nomemory (CORE_ADDR, char *, int, int, struct target_ops *);
- static int return_zero (void);
-@@ -513,7 +513,7 @@ target_terminal_inferior (void)
-   (*current_target.to_terminal_inferior) ();
- }
--static int
-+static LONGEST
- nomemory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-         struct target_ops *t)
- {
-@@ -718,7 +718,7 @@ update_current_target (void)
-           (void (*) (struct regcache *))
-           noprocess);
-   de_fault (deprecated_xfer_memory,
--          (int (*) (CORE_ADDR, gdb_byte *, int, int, struct mem_attrib *, struct target_ops *))
-+          (LONGEST (*) (CORE_ADDR, gdb_byte *, LONGEST, int, struct mem_attrib *, struct target_ops *))
-           nomemory);
-   de_fault (to_files_info,
-           (void (*) (struct target_ops *))
-@@ -1526,7 +1526,7 @@ target_xfer_partial (struct target_ops *
-    it makes no progress, and then return how much was transferred). */
- int
--target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
-+target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
- {
-   /* Dispatch to the topmost target, not the flattened current_target.
-      Memory accesses check target->to_has_(all_)memory, and the
-@@ -1542,7 +1542,7 @@ target_read_memory (CORE_ADDR memaddr, g
-    the target's stack.  This may trigger different cache behavior.  */
- int
--target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len)
-+target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len)
- {
-   /* Dispatch to the topmost target, not the flattened current_target.
-      Memory accesses check target->to_has_(all_)memory, and the
-@@ -1561,7 +1561,7 @@ target_read_stack (CORE_ADDR memaddr, gd
-    Callers that can deal with partial writes should call target_write.  */
- int
--target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len)
-+target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, LONGEST len)
- {
-   /* Dispatch to the topmost target, not the flattened current_target.
-      Memory accesses check target->to_has_(all_)memory, and the
-@@ -3218,8 +3218,8 @@ debug_to_prepare_to_store (struct regcac
-   fprintf_unfiltered (gdb_stdlog, "target_prepare_to_store ()\n");
- }
--static int
--deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len,
-+static LONGEST
-+deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, LONGEST len,
-                             int write, struct mem_attrib *attrib,
-                             struct target_ops *target)
- {
-@@ -3229,8 +3229,8 @@ deprecated_debug_xfer_memory (CORE_ADDR 
-                                               attrib, target);
-   fprintf_unfiltered (gdb_stdlog,
--                    "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d",
--                    paddress (target_gdbarch, memaddr), len,
-+                    "target_xfer_memory (%s, xxx, %ld, %s, xxx) = %d",
-+                    paddress (target_gdbarch, memaddr), (long) len,
-                     write ? "write" : "read", retval);
-   if (retval > 0)
-Index: gdb-7.1.90.20100711/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
-        NOTE: cagney/2004-10-01: This has been entirely superseeded by
-        to_xfer_partial and inferior inheritance.  */
--    int (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
--                                 int len, int write,
--                                 struct mem_attrib *attrib,
--                                 struct target_ops *target);
-+    LONGEST (*deprecated_xfer_memory) (CORE_ADDR memaddr, gdb_byte *myaddr,
-+                                     LONGEST len, int write,
-+                                     struct mem_attrib *attrib,
-+                                     struct target_ops *target);
-     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
- extern int target_read_string (CORE_ADDR, char **, int, int *);
--extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
-+extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len);
--extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
-+extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len);
- extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
--                              int len);
-+                              LONGEST len);
- /* Fetches the target's memory map.  If one is found it is sorted
-    and returned, after some consistency checking.  Otherwise, NULL
-Index: gdb-7.1.90.20100711/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
-@@ -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.  */
--int
-+LONGEST
- dcache_xfer_memory (struct target_ops *ops, DCACHE *dcache,
-                   CORE_ADDR memaddr, gdb_byte *myaddr,
--                  int len, int should_write)
-+                  LONGEST len, int should_write)
- {
-   int i;
-   int res;
-Index: gdb-7.1.90.20100711/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
-@@ -35,8 +35,8 @@ void dcache_free (DCACHE *);
- /* Simple to call from <remote>_xfer_memory */
--int dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem,
--                      gdb_byte *my, int len, int should_write);
-+LONGEST dcache_xfer_memory (struct target_ops *ops, DCACHE *cache, CORE_ADDR mem,
-+                      gdb_byte *my, LONGEST len, int should_write);
- void dcache_update (DCACHE *dcache, CORE_ADDR memaddr, gdb_byte *myaddr,
-                   int len);
-Index: gdb-7.1.90.20100711/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
-@@ -571,7 +571,7 @@ map_vmap (bfd *abfd, bfd *arch)
- }
\f
--int
-+LONGEST
- 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
-===================================================================
---- 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
- #endif
-       if (iterate_over_lwps (ia64_linux_check_stack_region, &range) != NULL)
-       { /* This region contains ia64 rse registers, we have to re-read.  */
--        int xxfer;
-+        LONGEST xxfer;
-         /* Re-read register stack area.  */
-         xxfer = super_xfer_partial (ops, object, annex,
-Index: gdb-7.1.90.20100711/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
-@@ -25,6 +25,7 @@
- #include "gdb_string.h"
- #include <ctype.h>
- #include <fcntl.h>
-+#include <limits.h>
- #include "inferior.h"
- #include "bfd.h"
- #include "symfile.h"
-@@ -6515,12 +6516,19 @@ handle_notification (char *buf, size_t l
-    if SHOULD_WRITE is nonzero.  Returns length of data written or
-    read; 0 for error.  TARGET is unused.  */
--static int
--remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, int mem_len,
-+static LONGEST
-+remote_xfer_memory (CORE_ADDR mem_addr, gdb_byte *buffer, LONGEST mem_len,
-                   int should_write, struct mem_attrib *attrib,
-                   struct target_ops *target)
- {
-   int res;
-+  int len;
-+
-+  /* This routine is not set up to handle > INT_MAX bytes.  */
-+  if (mem_len >= (LONGEST)INT_MAX)
-+    return 0;
-+
-+  len = (int)mem_len;
-   set_general_thread (inferior_ptid);
-@@ -6529,7 +6537,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, 
-   else
-     res = remote_read_bytes (mem_addr, buffer, mem_len);
--  return res;
-+  return (LONGEST)res;
- }
- /* Sends a packet with content determined by the printf format string
-Index: gdb-7.1.90.20100711/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
-    Returns the number of bytes transferred. */
--static int
--gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
-+static LONGEST
-+gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, LONGEST len,
-                            int write, struct mem_attrib *attrib,
-                            struct target_ops *target)
- {
-+  /* 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
-===================================================================
---- 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
-@@ -60,7 +60,7 @@ extern int resize_section_table (struct 
-    One, and only one, of readbuf or writebuf must be non-NULL.  */
--extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
-+extern LONGEST section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
-                                             ULONGEST, LONGEST,
-                                             struct target_section *,
-                                             struct target_section *,
index 9f712a79eeea4fa39a9719fa211490efd300ec57..77280701c2bbc842bf35603ccbe017fe45918da9 100644 (file)
 
         * gdb.texinfo (File Options): Document --readnever.
 
-Index: gdb-7.4.50.20111218/gdb/doc/gdb.texinfo
+Index: gdb-7.4.50.20120703/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/doc/gdb.texinfo       2011-12-19 02:52:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/doc/gdb.texinfo    2011-12-19 02:52:25.765407434 +0100
-@@ -1005,6 +1005,12 @@ Read each symbol file's entire symbol ta
+--- gdb-7.4.50.20120703.orig/gdb/doc/gdb.texinfo       2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/doc/gdb.texinfo    2012-07-03 17:31:40.695642449 +0200
+@@ -1023,6 +1023,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.4.50.20111218/gdb/doc/gdb.texinfo
  @end table
  
  @node Mode Options
-Index: gdb-7.4.50.20111218/gdb/main.c
+Index: gdb-7.4.50.20120703/gdb/main.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/main.c        2011-12-19 02:52:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/main.c     2011-12-19 02:52:36.925364438 +0100
-@@ -406,6 +406,7 @@ captured_main (void *data)
+--- gdb-7.4.50.20120703.orig/gdb/main.c        2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/main.c     2012-07-03 17:31:40.696642448 +0200
+@@ -414,6 +414,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,7 +40,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
        {"r", no_argument, &readnow_symbol_files, 1},
        {"quiet", no_argument, &quiet, 1},
        {"q", no_argument, &quiet, 1},
-@@ -1072,6 +1073,7 @@ Options:\n\n\
+@@ -1131,6 +1132,7 @@ Options:\n\n\
    fputs_unfiltered (_("\
    --quiet            Do not print version number on startup.\n\
    --readnow          Fully read symbol files on first access.\n\
@@ -48,11 +48,11 @@ Index: gdb-7.4.50.20111218/gdb/main.c
  "), stream);
    fputs_unfiltered (_("\
    --se=FILE          Use FILE as symbol file and executable file.\n\
-Index: gdb-7.4.50.20111218/gdb/symfile.c
+Index: gdb-7.4.50.20120703/gdb/symfile.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/symfile.c     2011-12-15 16:36:55.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/symfile.c  2011-12-19 02:52:25.767407426 +0100
-@@ -82,6 +82,7 @@ static void clear_symtab_users_cleanup (
+--- gdb-7.4.50.20120703.orig/gdb/symfile.c     2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/symfile.c  2012-07-03 17:31:40.697642447 +0200
+@@ -81,6 +81,7 @@ static void clear_symtab_users_cleanup (
  
  /* Global variables owned by this file.  */
  int readnow_symbol_files;     /* Read full symbols immediately.  */
@@ -60,19 +60,19 @@ Index: gdb-7.4.50.20111218/gdb/symfile.c
  
  /* External variables and functions referenced.  */
  
-Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
+Index: gdb-7.4.50.20120703/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c  2011-12-19 02:52:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/dwarf2read.c       2011-12-19 02:52:25.769407418 +0100
-@@ -59,6 +59,7 @@
- #include "c-lang.h"
- #include "valprint.h"
+--- gdb-7.4.50.20120703.orig/gdb/dwarf2read.c  2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/dwarf2read.c       2012-07-03 17:31:53.421627153 +0200
+@@ -65,6 +65,7 @@
+ #include "gdb/gdb-index.h"
  #include <ctype.h>
+ #include "gdb_bfd.h"
 +#include "top.h"
  
  #include <fcntl.h>
  #include "gdb_string.h"
-@@ -1405,8 +1406,9 @@ dwarf2_has_info (struct objfile *objfile
+@@ -1587,8 +1588,9 @@ dwarf2_has_info (struct objfile *objfile
                               (void *) names);
        dwarf2_per_objfile->objfile = objfile;
      }
@@ -84,11 +84,11 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
  }
  
  /* When loading sections, we look either for uncompressed section or for
-Index: gdb-7.4.50.20111218/gdb/top.h
+Index: gdb-7.4.50.20120703/gdb/top.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/top.h 2011-12-16 21:29:28.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/top.h      2011-12-19 02:52:25.769407418 +0100
-@@ -61,6 +61,7 @@ extern void set_prompt (const char *s);
+--- gdb-7.4.50.20120703.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100
++++ gdb-7.4.50.20120703/gdb/top.h      2012-07-03 17:31:40.700642444 +0200
+@@ -60,6 +60,7 @@ extern void set_prompt (const char *s);
  
  /* From random places.  */
  extern int readnow_symbol_files;
diff --git a/gdb-6.3-security-errata-20050610.patch b/gdb-6.3-security-errata-20050610.patch
deleted file mode 100644 (file)
index 8e048d8..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2005-05/threads.html#00637
-Proposed upstream but never committed upstream.
-
-2005-06-09  Jeff Johnston  <jjohnstn@redhat.com>
-
-        * gdb.base/gdbinit.exp: New testcase.
-        * gdb.base/gdbinit.sample: Sample .gdbinit for gdbinit.exp.
-
-2005-06-08  Daniel Jacobowitz  <dan@codesourcery.com>
-            Jeff Johnston  <jjohnstn@redhat.com>
-
-        * Makefile.in (cli-cmds.o): Update.
-        * configure.in: Add check for getuid.
-        * configure: Regenerated.
-        * config.in: Ditto.
-        * main.c (captured_main): Pass -1 to source_command when loading
-        gdbinit files.
-        * cli/cli-cmds.c: Include "gdb_stat.h" and <fcntl.h>.
-        (source_command): Update documentation.  Check permissions if
-        FROM_TTY is -1.
-
-Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.c        2011-12-16 22:17:42.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.c     2011-12-19 00:27:16.572468926 +0100
-@@ -40,6 +40,7 @@
- #include "source.h"
- #include "disasm.h"
- #include "tracepoint.h"
-+#include "gdb_stat.h"
- #include "ui-out.h"
-@@ -485,7 +486,7 @@ show_script_ext_mode (struct ui_file *fi
- int
- find_and_open_script (const char *script_file, int search_path,
--                    FILE **streamp, char **full_pathp)
-+                    FILE **streamp, char **full_pathp, int from_tty)
- {
-   char *file;
-   int fd;
-@@ -511,6 +512,32 @@ find_and_open_script (const char *script
-       return 0;
-     }
-+#ifdef HAVE_GETUID
-+  if (from_tty == -1)
-+    {
-+      struct stat statbuf;
-+
-+      if (fstat (fd, &statbuf) < 0)
-+      {
-+        int save_errno = errno;
-+
-+        close (fd);
-+        do_cleanups (old_cleanups);
-+        errno = save_errno;
-+        return 0;
-+      }
-+      if (statbuf.st_uid != getuid () || (statbuf.st_mode & S_IWOTH))
-+      {
-+        /* FILE gets freed by do_cleanups (old_cleanups).  */
-+        warning (_("not using untrusted file \"%s\""), file);
-+        close (fd);
-+        do_cleanups (old_cleanups);
-+        errno = EPERM;
-+        return 0;
-+      }
-+    }
-+#endif
-+
-   do_cleanups (old_cleanups);
-   *streamp = fdopen (fd, FOPEN_RT);
-@@ -572,13 +599,14 @@ source_script_with_search (const char *f
-   if (file == NULL || *file == 0)
-     error (_("source command requires file name of file to source."));
--  if (!find_and_open_script (file, search_path, &stream, &full_path))
-+  if (!find_and_open_script (file, search_path, &stream, &full_path,
-+                           from_tty))
-     {
-       /* The script wasn't found, or was otherwise inaccessible.
-          If the source command was invoked interactively, throw an
-        error.  Otherwise (e.g. if it was invoked by a script),
-        silently ignore the error.  */
--      if (from_tty)
-+      if (from_tty > 0)
-       perror_with_name (file);
-       else
-       return;
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.exp     2011-12-19 00:25:26.079891954 +0100
-@@ -0,0 +1,91 @@
-+#   Copyright 2005
-+#   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 Jeff Johnston <jjohnstn@redhat.com>.
-+
-+# are we on a target board
-+if [is_remote target] {
-+    return
-+}
-+
-+
-+global verbose
-+global GDB
-+global GDBFLAGS
-+global gdb_prompt
-+global timeout
-+global gdb_spawn_id;
-+
-+gdb_stop_suppressing_tests;
-+
-+verbose "Spawning $GDB -nw"
-+
-+if [info exists gdb_spawn_id] {
-+    return 0;
-+}
-+
-+if ![is_remote host] {
-+   if { [which $GDB] == 0 } then {
-+        perror "$GDB does not exist."
-+        exit 1
-+    }
-+}
-+
-+set env(HOME) [pwd]
-+remote_exec build "rm .gdbinit"
-+remote_exec build "cp ${srcdir}/${subdir}/gdbinit.sample .gdbinit"
-+remote_exec build "chmod 646 .gdbinit"
-+
-+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
-+if { $res < 0 || $res == "" } {
-+    perror "Spawning $GDB failed."
-+    return 1;
-+}
-+gdb_expect 360 {
-+    -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
-+        pass "untrusted .gdbinit caught."
-+    }
-+    -re "$gdb_prompt $"     {
-+        fail "untrusted .gdbinit caught."
-+    }
-+    timeout {
-+        fail "(timeout) untrusted .gdbinit caught."
-+    }
-+}
-+
-+remote_exec build "chmod 644 .gdbinit"
-+set res [remote_spawn host "$GDB -nw [host_info gdb_opts]"];
-+if { $res < 0 || $res == "" } {
-+    perror "Spawning $GDB failed."
-+    return 1;
-+}
-+gdb_expect 360 {
-+    -re "warning: not using untrusted file.*\.gdbinit.*\[\r\n\]$gdb_prompt $" {
-+        fail "trusted .gdbinit allowed."
-+    }
-+    -re "in gdbinit.*$gdb_prompt $"     {
-+        pass "trusted .gdbinit allowed."
-+    }
-+    timeout {
-+        fail "(timeout) trusted .gdbinit allowed."
-+    }
-+}
-+
-+remote_exec build "rm .gdbinit"
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/gdbinit.sample  2011-12-19 00:25:26.079891954 +0100
-@@ -0,0 +1 @@
-+echo "\nin gdbinit"
-Index: gdb-7.4.50.20111218/gdb/main.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/main.c        2011-11-05 18:08:30.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/main.c     2011-12-19 00:25:26.080891950 +0100
-@@ -822,7 +822,7 @@ captured_main (void *data)
-      debugging or what directory you are in.  */
-   if (home_gdbinit && !inhibit_gdbinit)
--    catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL);
-+    catch_command_errors (source_script, home_gdbinit, -1, RETURN_MASK_ALL);
-   /* Now perform all the actions indicated by the arguments.  */
-   if (cdarg != NULL)
-@@ -901,7 +901,7 @@ captured_main (void *data)
-   /* Read the .gdbinit file in the current directory, *if* it isn't
-      the same as the $HOME/.gdbinit file (it should exist, also).  */
-   if (local_gdbinit && !inhibit_gdbinit)
--    catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
-+    catch_command_errors (source_script, local_gdbinit, -1, RETURN_MASK_ALL);
-   /* Now that all .gdbinit's have been read and all -d options have been
-      processed, we can read any scripts mentioned in SYMARG.
-Index: gdb-7.4.50.20111218/gdb/python/py-auto-load.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/python/py-auto-load.c 2011-12-10 23:51:47.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/python/py-auto-load.c      2011-12-19 00:25:26.080891950 +0100
-@@ -284,7 +284,7 @@ source_section_scripts (struct objfile *
-       }
-       opened = find_and_open_script (file, 1 /*search_path*/,
--                                   &stream, &full_path);
-+                                   &stream, &full_path, 1 /* from_tty */);
-       /* If one script isn't found it's not uncommon for more to not be
-        found either.  We don't want to print an error message for each
-Index: gdb-7.4.50.20111218/gdb/cli/cli-cmds.h
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/cli/cli-cmds.h        2011-11-01 15:51:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/cli/cli-cmds.h     2011-12-19 00:25:26.080891950 +0100
-@@ -129,7 +129,8 @@ extern void source_script (char *, int);
- /* Exported to objfiles.c.  */
- extern int find_and_open_script (const char *file, int search_path,
--                               FILE **streamp, char **full_path);
-+                               FILE **streamp, char **full_path,
-+                               int from_tty);
- /* Command tracing state.  */
diff --git a/gdb-6.3-terminal-fix-20050214.patch b/gdb-6.3-terminal-fix-20050214.patch
deleted file mode 100644 (file)
index d97d6a2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-2005-02-14  Jeff Johnston <jjohnstn@redhat.com>
-
-       * top.c (gdb_readline_wrapper): Ensure terminal is gdb's before calling
-       readline.
-
-2007-10-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Port to GDB-6.7.
-
-Index: gdb-6.7/gdb/top.c
-===================================================================
---- gdb-6.7.orig/gdb/top.c     2007-09-02 23:13:56.000000000 +0200
-+++ gdb-6.7/gdb/top.c  2007-10-14 23:38:27.000000000 +0200
-@@ -795,6 +795,14 @@ gdb_readline_wrapper (char *prompt)
-   back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
-+  /* Before calling readline, ensure we have the terminal.  If we don't
-+     have the terminal and call readline, we risk the possibility of
-+     gdb being thrown into the background.  This problem occurs when
-+     we attach to a background process on the same terminal the background
-+     process was started from and then perform some action which requires
-+     a page break prompt.  */
-+  terminal_ours ();
-+
-   /* Display our prompt and prevent double prompt display.  */
-   display_gdb_prompt (prompt);
-   rl_already_prompted = 1;
index 61115418b0c214a1828b4a353439b11f7b5a3046..f877225e74d0f9b9aef0ff2239fa0ec85cb67a6a 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.4.50.20111219/gdb/testsuite/configure.ac
+Index: gdb-7.4.50.20120602/gdb/testsuite/configure.ac
 ===================================================================
---- gdb-7.4.50.20111219.orig/gdb/testsuite/configure.ac        2011-12-19 21:07:02.178472157 +0100
-+++ gdb-7.4.50.20111219/gdb/testsuite/configure.ac     2011-12-19 22:05:02.704432213 +0100
-@@ -97,6 +97,6 @@ AC_OUTPUT([Makefile \
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure.ac        2012-04-25 16:07:22.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/testsuite/configure.ac     2012-06-02 18:24:38.456266545 +0200
+@@ -96,6 +96,6 @@ AC_OUTPUT([Makefile \
    gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
    gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \
    gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
@@ -10,20 +10,20 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/configure.ac
 +  gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile \
    gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
    gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile])
-Index: gdb-7.4.50.20111219/gdb/testsuite/configure
+Index: gdb-7.4.50.20120602/gdb/testsuite/configure
 ===================================================================
---- gdb-7.4.50.20111219.orig/gdb/testsuite/configure   2011-12-19 21:07:02.179472153 +0100
-+++ gdb-7.4.50.20111219/gdb/testsuite/configure        2011-12-19 22:05:02.735432090 +0100
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/configure   2012-04-25 16:07:21.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/testsuite/configure        2012-06-02 18:25:06.200258240 +0200
 @@ -3448,7 +3448,7 @@ done
  
  
  
--ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
-+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
++ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.go/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.pie/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
  
  cat >confcache <<\_ACEOF
  # This file is a shell script that caches the results of configure
-@@ -4174,6 +4174,7 @@ do
+@@ -4175,6 +4175,7 @@ do
      "gdb.opencl/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opencl/Makefile" ;;
      "gdb.opt/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;;
      "gdb.pascal/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.pascal/Makefile" ;;
@@ -31,10 +31,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/configure
      "gdb.python/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.python/Makefile" ;;
      "gdb.reverse/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.reverse/Makefile" ;;
      "gdb.stabs/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.stabs/Makefile" ;;
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c 2011-12-19 22:05:02.782431905 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.c 2012-06-02 18:24:38.497266532 +0200
 @@ -0,0 +1,20 @@
 +/* This program is intended to be started outside of gdb, and then
 +   attached to by gdb.  Thus, it simply spins in a loop.  The loop
@@ -56,10 +56,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.c
 +    }
 +  return 0;
 +}
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c        2011-12-19 22:05:02.786431889 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach2.c        2012-06-02 18:24:38.504266529 +0200
 @@ -0,0 +1,24 @@
 +/* This program is intended to be started outside of gdb, and then
 +   attached to by gdb.  Thus, it simply spins in a loop.  The loop
@@ -85,10 +85,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach2.c
 +    }
 +  return (0);
 +}
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c  2011-12-19 22:05:02.787431885 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.c  2012-06-02 18:24:38.505266529 +0200
 @@ -0,0 +1,146 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -236,10 +236,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.c
 +    }
 +  return 0;
 +}
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break1.c 2011-12-19 22:05:02.787431885 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break1.c 2012-06-02 18:24:38.506266530 +0200
 @@ -0,0 +1,44 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -285,10 +285,10 @@ Index: gdb-7.4.50.20111219/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.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c      2011-12-19 22:05:02.787431885 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/coremaker.c      2012-06-02 18:24:38.506266530 +0200
 @@ -0,0 +1,142 @@
 +/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
 +   Free Software Foundation, Inc.
@@ -432,10 +432,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/coremaker.c
 +  return 0;
 +}
 +
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp       2011-12-19 22:05:02.787431885 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/attach.exp       2012-06-02 18:24:38.508266531 +0200
 @@ -0,0 +1,417 @@
 +#   Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
 +
@@ -854,10 +854,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/attach.exp
 +do_call_attach_tests
 +
 +return 0
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp        2011-12-19 23:11:51.092333080 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/break.exp        2012-06-02 18:24:38.510266529 +0200
 @@ -0,0 +1,962 @@
 +#   Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
 +#   2000, 2002, 2003, 2004
@@ -1374,7 +1374,7 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
 +#
 +send_gdb "break $bp_location12 foo\n"
 +gdb_expect {
-+  -re "Junk at end of arguments..*$gdb_prompt $"\
++  -re "malformed linespec error: unexpected string, \"foo\"\r\n$gdb_prompt $"\
 +          {pass "breakpoint with trailing garbage disallowed"}
 +  -re "$gdb_prompt $"\
 +          {fail "breakpoint with trailing garbage disallowed"}
@@ -1821,10 +1821,10 @@ Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/break.exp
 +    send_gdb "set args main\n"
 +    gdb_expect -re ".*$gdb_prompt $" {}
 +}
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/corefile.exp     2011-12-19 22:05:02.788431881 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/corefile.exp     2012-06-02 18:24:38.511266528 +0200
 @@ -0,0 +1,233 @@
 +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
 +# Free Software Foundation, Inc.
@@ -2059,10 +2059,10 @@ Index: gdb-7.4.50.20111219/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.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.pie/Makefile.in      2011-12-19 22:05:02.788431881 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.pie/Makefile.in      2012-06-02 18:24:38.512266527 +0200
 @@ -0,0 +1,19 @@
 +VPATH = @srcdir@
 +srcdir = @srcdir@
index 61e0d56b61a230521772a69d65f4e786a427b0e6..cc8e515e3fc28e86c33ecdfce25010d9a259654f 100644 (file)
@@ -1,14 +1,14 @@
-Index: gdb-7.0.90.20100306/gdb/symfile.c
+Index: gdb-7.4.50.20120602/gdb/symfile.c
 ===================================================================
---- gdb-7.0.90.20100306.orig/gdb/symfile.c     2010-03-06 23:20:35.000000000 +0100
-+++ gdb-7.0.90.20100306/gdb/symfile.c  2010-03-06 23:26:25.000000000 +0100
-@@ -3642,6 +3642,12 @@ default_symfile_relocate (struct objfile
- {
-   bfd *abfd = objfile->obfd;
+--- gdb-7.4.50.20120602.orig/gdb/symfile.c     2012-06-02 18:25:20.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/symfile.c  2012-06-02 18:26:36.145232057 +0200
+@@ -3630,6 +3630,12 @@ default_symfile_relocate (struct objfile
+      DWO file.  */
+   bfd *abfd = sectp->owner;
  
 +  /* Executable files have all the relocations already resolved.
-+   * Handle files linked with --emit-relocs.
-+   * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html  */
++     Handle files linked with --emit-relocs.
++     http://sources.redhat.com/ml/gdb/2006-08/msg00137.html  */
 +  if ((abfd->flags & EXEC_P) != 0)
 +    return NULL;
 +
index debac4eacfcabba6a9e905a9f4396d8477a62873..41a887aec532c18a3bd233893381c2bfbe41f252 100644 (file)
@@ -23,11 +23,11 @@ instead.
 
        Port to GDB-6.7.
 
-Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
+Index: gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/amd64-linux-tdep.c    2012-03-02 22:15:48.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c 2012-03-02 22:16:13.526569163 +0100
-@@ -268,6 +268,80 @@ amd64_linux_register_reggroup_p (struct
+--- gdb-7.4.50.20120703.orig/gdb/amd64-linux-tdep.c    2012-06-13 22:36:48.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c 2012-07-03 17:32:46.547563363 +0200
+@@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct
  
  /* Set the program counter for process PTID to PC.  */
  
@@ -87,7 +87,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
 +amd64_linux_outermost_frame (struct frame_info *this_frame)
 +{
 +  CORE_ADDR pc = get_frame_pc (this_frame);
-+  char *name;
++  const char *name;
 +
 +  find_pc_partial_function (pc, &name, NULL, NULL);
 +
@@ -108,20 +108,20 @@ Index: gdb-7.4.50.20120120/gdb/amd64-linux-tdep.c
  static void
  amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
  {
-@@ -1321,6 +1395,8 @@ amd64_linux_init_abi (struct gdbarch_inf
+@@ -1547,6 +1621,8 @@ amd64_linux_init_abi (struct gdbarch_inf
  
-   tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
+   amd64_linux_init_abi_common (info, gdbarch);
  
 +  tdep->outermost_frame_p = amd64_linux_outermost_frame;
 +
    /* GNU/Linux uses SVR4-style shared libraries.  */
    set_solib_svr4_fetch_link_map_offsets
      (gdbarch, svr4_lp64_fetch_link_map_offsets);
-Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
+Index: gdb-7.4.50.20120703/gdb/amd64-tdep.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/amd64-tdep.c  2012-01-04 09:16:56.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/amd64-tdep.c       2012-03-02 22:17:39.133287571 +0100
-@@ -2108,6 +2108,7 @@ amd64_frame_unwind_stop_reason (struct f
+--- gdb-7.4.50.20120703.orig/gdb/amd64-tdep.c  2012-06-16 17:20:22.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/amd64-tdep.c       2012-07-03 17:32:12.335604415 +0200
+@@ -2324,6 +2324,7 @@ amd64_frame_unwind_stop_reason (struct f
  {
    struct amd64_frame_cache *cache =
      amd64_frame_cache (this_frame, this_cache);
@@ -129,7 +129,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
  
    if (!cache->base_p)
      return UNWIND_UNAVAILABLE;
-@@ -2116,6 +2117,10 @@ amd64_frame_unwind_stop_reason (struct f
+@@ -2332,6 +2333,10 @@ amd64_frame_unwind_stop_reason (struct f
    if (cache->base == 0)
      return UNWIND_OUTERMOST;
  
@@ -140,7 +140,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
    return UNWIND_NO_REASON;
  }
  
-@@ -2125,6 +2130,7 @@ amd64_frame_this_id (struct frame_info *
+@@ -2341,6 +2346,7 @@ amd64_frame_this_id (struct frame_info *
  {
    struct amd64_frame_cache *cache =
      amd64_frame_cache (this_frame, this_cache);
@@ -148,7 +148,7 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
  
    if (!cache->base_p)
      return;
-@@ -2133,6 +2139,10 @@ amd64_frame_this_id (struct frame_info *
+@@ -2349,6 +2355,10 @@ amd64_frame_this_id (struct frame_info *
    if (cache->base == 0)
      return;
  
@@ -159,11 +159,11 @@ Index: gdb-7.4.50.20120120/gdb/amd64-tdep.c
    (*this_id) = frame_id_build (cache->base + 16, cache->pc);
  }
  
-Index: gdb-7.4.50.20120120/gdb/i386-tdep.c
+Index: gdb-7.4.50.20120703/gdb/i386-tdep.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/i386-tdep.c   2012-03-02 22:15:48.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/i386-tdep.c        2012-03-02 22:16:13.528569157 +0100
-@@ -7613,6 +7613,9 @@ i386_gdbarch_init (struct gdbarch_info i
+--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.c   2012-06-18 19:31:34.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/i386-tdep.c        2012-07-03 17:32:12.339604409 +0200
+@@ -7655,6 +7655,9 @@ i386_gdbarch_init (struct gdbarch_info i
  
    tdep->xsave_xcr0_offset = -1;
  
@@ -173,10 +173,10 @@ Index: gdb-7.4.50.20120120/gdb/i386-tdep.c
    tdep->record_regmap = i386_record_regmap;
  
    set_gdbarch_long_long_align_bit (gdbarch, 32);
-Index: gdb-7.4.50.20120120/gdb/i386-tdep.h
+Index: gdb-7.4.50.20120703/gdb/i386-tdep.h
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/i386-tdep.h   2012-03-02 22:15:48.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/i386-tdep.h        2012-03-02 22:16:13.529569154 +0100
+--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.h   2012-06-13 22:29:15.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/i386-tdep.h        2012-07-03 17:32:12.340604408 +0200
 @@ -219,6 +219,9 @@ struct gdbarch_tdep
    int (*i386_sysenter_record) (struct regcache *regcache);
    /* Parse syscall args.  */
@@ -187,11 +187,11 @@ Index: gdb-7.4.50.20120120/gdb/i386-tdep.h
  };
  
  /* Floating-point registers.  */
-Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
+Index: gdb-7.4.50.20120703/gdb/ia64-tdep.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/ia64-tdep.c   2012-03-02 22:15:48.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/ia64-tdep.c        2012-03-02 22:16:13.529569154 +0100
-@@ -2181,6 +2181,138 @@ static const struct frame_unwind ia64_fr
+--- gdb-7.4.50.20120703.orig/gdb/ia64-tdep.c   2012-07-03 17:30:09.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/ia64-tdep.c        2012-07-03 17:32:12.343604405 +0200
+@@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr
    default_frame_sniffer
  };
  
@@ -330,7 +330,7 @@ Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
  /* Signal trampolines.  */
  
  static void
-@@ -4153,6 +4285,7 @@ ia64_gdbarch_init (struct gdbarch_info i
+@@ -4146,6 +4278,7 @@ ia64_gdbarch_init (struct gdbarch_info i
    set_gdbarch_dummy_id (gdbarch, ia64_dummy_id);
  
    set_gdbarch_unwind_pc (gdbarch, ia64_unwind_pc);
@@ -338,10 +338,10 @@ Index: gdb-7.4.50.20120120/gdb/ia64-tdep.c
  #ifdef HAVE_LIBUNWIND_IA64_H
    frame_unwind_append_unwinder (gdbarch,
                                  &ia64_libunwind_sigtramp_frame_unwind);
-Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c      2012-03-02 22:16:13.530569151 +0100
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c      2012-07-03 17:32:12.344604404 +0200
 @@ -0,0 +1,39 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -382,10 +382,10 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.c
 +      for (;;)
 +              pause();
 +}
-Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.threads/bt-clone-stop.exp    2012-03-02 22:16:13.530569151 +0100
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp    2012-07-03 17:32:12.344604404 +0200
 @@ -0,0 +1,61 @@
 +# Copyright 2006 Free Software Foundation, Inc.
 +
diff --git a/gdb-6.5-dwarf-stack-overflow.patch b/gdb-6.5-dwarf-stack-overflow.patch
deleted file mode 100644 (file)
index 0d107b3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-for gdb/ChangeLog:
-2006-08-22  Will Drewry <wad@google.com>
-           Tavis Ormandy <taviso@google.com>
-
-       * dwarf2read.c (decode_locdesc): Enforce location description stack
-       boundaries.
-       * dwarfread.c (locval): Likewise.
-
-2007-10-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Port to GDB-6.7.
-
-Index: gdb-7.1.90.20100711/gdb/dwarf2read.c
-===================================================================
---- gdb-7.1.90.20100711.orig/gdb/dwarf2read.c  2010-07-12 10:43:53.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/dwarf2read.c       2010-07-12 10:49:32.000000000 +0200
-@@ -11382,8 +11382,7 @@ read_signatured_type (struct objfile *ob
-    callers will only want a very basic result and this can become a
-    complaint.
--   Note that stack[0] is unused except as a default error return.
--   Note that stack overflow is not yet handled.  */
-+   Note that stack[0] is unused except as a default error return. */
- static CORE_ADDR
- decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
-@@ -11399,7 +11398,7 @@ decode_locdesc (struct dwarf_block *blk,
-   i = 0;
-   stacki = 0;
--  stack[stacki] = 0;
-+  stack[++stacki] = 0;
-   while (i < size)
-     {
-@@ -11581,6 +11580,16 @@ decode_locdesc (struct dwarf_block *blk,
-                    dwarf_stack_op_name (op, 1));
-         return (stack[stacki]);
-       }
-+      /* Enforce maximum stack depth of size-1 to avoid ++stacki writing
-+         outside of the allocated space. Also enforce minimum > 0.
-+         -- wad@google.com 14 Aug 2006 */
-+      if (stacki >= sizeof (stack) / sizeof (*stack) - 1)
-+      internal_error (__FILE__, __LINE__,
-+                      _("location description stack too deep: %d"),
-+                      stacki);
-+      if (stacki <= 0)
-+      internal_error (__FILE__, __LINE__,
-+                      _("location description stack too shallow"));
-     }
-   return (stack[stacki]);
- }
diff --git a/gdb-6.5-readline-long-line-crash.patch b/gdb-6.5-readline-long-line-crash.patch
deleted file mode 100644 (file)
index cc76179..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-Fix Valgrind paste of >= 256 * (screen width) characters (as 130001).
-
-Invalid write of size 4
-   at 0x8203BD9: rl_redisplay (display.c:812)
-   by 0x81F5130: _rl_internal_char_cleanup (readline.c:427)
-   by 0x81F52B3: readline_internal_char (readline.c:508)
-   by 0x8209817: rl_callback_read_char (callback.c:184)
-   by 0x8135312: rl_callback_read_char_wrapper (event-top.c:179)
-   by 0x8135B7B: stdin_event_handler (event-top.c:432)
-   by 0x81349F2: handle_file_event (event-loop.c:730)
-   by 0x81342AB: process_event (event-loop.c:343)
-   by 0x81342F4: gdb_do_one_event (event-loop.c:380)
-   by 0x81313AC: catch_errors (exceptions.c:515)
-   by 0x80CE8CA: tui_command_loop (tui-interp.c:151)
-   by 0x81318B9: current_interp_command_loop (interps.c:278)
- Address 0x43DCEB8 is 0 bytes after a block of size 1,024 alloc'd
-   at 0x4005400: malloc (vg_replace_malloc.c:149)
-   by 0x8087084: xmalloc (utils.c:959)
-   by 0x8202CA7: init_line_structures (display.c:440)
-   by 0x8202D14: rl_redisplay (display.c:471)
-   by 0x81F4F53: readline_internal_setup (readline.c:363)
-   by 0x820958C: _rl_callback_newline (callback.c:89)
-   by 0x82095BB: rl_callback_handler_install (callback.c:101)
-   by 0x80CE896: tui_command_loop (tui-interp.c:138)
-   by 0x81318B9: current_interp_command_loop (interps.c:278)
-   by 0x807E69A: captured_command_loop (main.c:101)
-   by 0x81313AC: catch_errors (exceptions.c:515)
-   by 0x807F55A: captured_main (main.c:826)
-
-
-2006-11-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * readline/display.c (line_state, line_state_array, line_state_visible,
-       line_state_invisible): Encapsulate _rl_wrapped_line, inv_lbreaks,
-       inv_lbsize, vis_lbreaks, vis_lbsize, visible_line, invisible_line.
-       (init_line_structures): Initialize both _rl_wrapped_line ones now.
-       (rl_redisplay): Fix _rl_wrapped_line handling by using its own size.
-       Swap whole `line_state_visible' / `line_state_invisible' structures.
-       (update_line): Update for new `_rl_wrapped_line'.
-
-
-Index: ./readline/display.c
-===================================================================
---- ./readline/display.c       5 May 2006 18:26:12 -0000       1.11
-+++ ./readline/display.c       8 Nov 2006 18:23:33 -0000
-@@ -73,15 +73,31 @@ static void delete_chars PARAMS((int));
- static void insert_some_chars PARAMS((char *, int, int));
- static void cr PARAMS((void));
-+struct line_state
-+  {
-+    char *line;
-+    int *lbreaks;
-+    int lbreaks_size;
-+#if defined (HANDLE_MULTIBYTE)
-+    int *wrapped_line;
-+    int wrapped_line_size;
-+#endif
-+  };
-+static struct line_state line_state_array[2];
-+static struct line_state *line_state_visible = &line_state_array[0];
-+static struct line_state *line_state_invisible = &line_state_array[1];
-+
- #if defined (HANDLE_MULTIBYTE)
- static int _rl_col_width PARAMS((const char *, int, int));
--static int *_rl_wrapped_line;
- #else
- #  define _rl_col_width(l, s, e)      (((e) <= (s)) ? 0 : (e) - (s))
- #endif
--static int *inv_lbreaks, *vis_lbreaks;
--static int inv_lbsize, vis_lbsize;
-+/* FIXME: Backward compatible naming. */
-+#define inv_lbreaks (line_state_invisible->lbreaks)
-+#define inv_lbsize (line_state_invisible->lbreaks_size)
-+#define vis_lbreaks (line_state_visible->lbreaks)
-+#define vis_lbsize (line_state_visible->lbreaks_size)
- /* Heuristic used to decide whether it is faster to move from CUR to NEW
-    by backing up or outputting a carriage return and moving forward. */
-@@ -150,8 +166,9 @@ static int last_lmargin;
- /* The line display buffers.  One is the line currently displayed on
-    the screen.  The other is the line about to be displayed. */
--static char *visible_line = (char *)NULL;
--static char *invisible_line = (char *)NULL;
-+/* FIXME: Backward compatible naming. */
-+#define visible_line (line_state_visible->line)
-+#define invisible_line (line_state_invisible->line)
- /* A buffer for `modeline' messages. */
- static char msg_buf[128];
-@@ -437,7 +454,10 @@ init_line_structures (minsize)
-       inv_lbreaks = (int *)xmalloc (inv_lbsize * sizeof (int));
-       vis_lbreaks = (int *)xmalloc (vis_lbsize * sizeof (int));
- #if defined (HANDLE_MULTIBYTE)
--      _rl_wrapped_line = (int *)xmalloc (vis_lbsize * sizeof (int));
-+      line_state_visible->wrapped_line_size = vis_lbsize;
-+      line_state_visible->wrapped_line = (int *)xmalloc (line_state_visible->wrapped_line_size * sizeof (int));
-+      line_state_invisible->wrapped_line_size = inv_lbsize;
-+      line_state_invisible->wrapped_line = (int *)xmalloc (line_state_invisible->wrapped_line_size * sizeof (int));
- #endif
-       inv_lbreaks[0] = vis_lbreaks[0] = 0;
-     }
-@@ -572,10 +592,15 @@ rl_redisplay ()
-             { \
-               inv_lbsize *= 2; \
-               inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
--              _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
-             } \
-           inv_lbreaks[++newlines] = out; \
--          _rl_wrapped_line[newlines] = _rl_wrapped_multicolumn; \
-+          if (newlines >= (line_state_invisible->wrapped_line_size - 1)) \
-+            { \
-+              line_state_invisible->wrapped_line_size *= 2; \
-+              line_state_invisible->wrapped_line = (int *)xrealloc (line_state_invisible->wrapped_line, \
-+                line_state_invisible->wrapped_line_size * sizeof (int)); \
-+            } \
-+          line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn; \
-           lpos = 0; \
-         } \
-       } while (0)
-@@ -605,7 +630,7 @@ rl_redisplay ()
- #endif
- #if defined (HANDLE_MULTIBYTE)
--  memset (_rl_wrapped_line, 0, vis_lbsize);
-+  memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wrapped_line_size * sizeof (int));
-   num = 0;
- #endif
-@@ -1118,17 +1143,10 @@ rl_redisplay ()
-   /* Swap visible and non-visible lines. */
-   {
--    char *vtemp = visible_line;
--    int *itemp = vis_lbreaks, ntemp = vis_lbsize;
--
--    visible_line = invisible_line;
--    invisible_line = vtemp;
--
--    vis_lbreaks = inv_lbreaks;
--    inv_lbreaks = itemp;
--
--    vis_lbsize = inv_lbsize;
--    inv_lbsize = ntemp;
-+    struct line_state *line_state_temp = line_state_visible;
-+    
-+    line_state_visible = line_state_invisible;
-+    line_state_invisible = line_state_temp;
-     rl_display_fixed = 0;
-     /* If we are displaying on a single line, and last_lmargin is > 0, we
-@@ -1194,8 +1212,9 @@ update_line (old, new, current_line, oma
-         /* This fixes only double-column characters, but if the wrapped
-            character comsumes more than three columns, spaces will be
-            inserted in the string buffer. */
--        if (_rl_wrapped_line[current_line] > 0)
--          _rl_clear_to_eol (_rl_wrapped_line[current_line]);
-+        if (current_line < line_state_visible->wrapped_line_size
-+            && line_state_visible->wrapped_line[current_line] > 0)
-+          _rl_clear_to_eol (line_state_visible->wrapped_line[current_line]);
-         memset (&ps, 0, sizeof (mbstate_t));
-         ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);
index de1ccad4675a4fdc7e16dbab14206dfff75e2c7a..2faa3064d61cf83c8246948da8642a2552871502 100644 (file)
@@ -58,11 +58,11 @@ Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html
        * exec.c (exec_file_attach): Print a more useful error message if the
        user did "gdb core".
 
-Index: gdb-7.4.50.20111218/gdb/exceptions.h
+Index: gdb-7.4.91.20120801/gdb/exceptions.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/exceptions.h  2011-10-09 21:21:38.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/exceptions.h       2011-12-19 01:41:20.900509347 +0100
-@@ -88,6 +88,9 @@ enum errors {
+--- gdb-7.4.91.20120801.orig/gdb/exceptions.h  2012-01-04 09:17:01.000000000 +0100
++++ gdb-7.4.91.20120801/gdb/exceptions.h       2012-08-01 18:43:39.806959992 +0200
+@@ -86,6 +86,9 @@ enum errors {
    /* DW_OP_GNU_entry_value resolving failed.  */
    NO_ENTRY_VALUE_ERROR,
  
@@ -72,19 +72,19 @@ Index: gdb-7.4.50.20111218/gdb/exceptions.h
    /* Add more errors here.  */
    NR_ERRORS
  };
-Index: gdb-7.4.50.20111218/gdb/exec.c
+Index: gdb-7.4.91.20120801/gdb/exec.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/exec.c        2011-03-23 19:23:54.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/exec.c     2011-12-19 01:41:04.863568846 +0100
-@@ -35,6 +35,7 @@
- #include "arch-utils.h"
+--- gdb-7.4.91.20120801.orig/gdb/exec.c        2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/exec.c     2012-08-01 18:44:39.928627287 +0200
+@@ -34,6 +34,7 @@
  #include "gdbthread.h"
  #include "progspace.h"
+ #include "gdb_bfd.h"
 +#include "exceptions.h"
  
  #include <fcntl.h>
  #include "readline/readline.h"
-@@ -254,12 +255,27 @@ exec_file_attach (char *filename, int fr
+@@ -242,12 +243,27 @@ exec_file_attach (char *filename, int fr
  
        if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
        {
@@ -115,13 +115,13 @@ Index: gdb-7.4.50.20111218/gdb/exec.c
        }
  
        /* FIXME - This should only be run for RS6000, but the ifdef is a poor
-Index: gdb-7.4.50.20111218/gdb/main.c
+Index: gdb-7.4.91.20120801/gdb/main.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/main.c        2011-12-19 00:28:01.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/main.c     2011-12-19 01:41:04.863568846 +0100
-@@ -248,6 +248,36 @@ captured_command_loop (void *data)
-   return 1;
- }
+--- gdb-7.4.91.20120801.orig/gdb/main.c        2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/main.c     2012-08-01 18:43:39.810959970 +0200
+@@ -266,6 +266,36 @@ typedef struct cmdarg {
+ /* Define type VEC (cmdarg_s).  */
+ DEF_VEC_O (cmdarg_s);
  
 +/* Call exec_file_attach.  If it detected FILENAME is a core file call
 +   core_file_command.  Print the original exec_file_attach error only if
@@ -156,7 +156,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
  static int
  captured_main (void *data)
  {
-@@ -704,6 +734,8 @@ captured_main (void *data)
+@@ -762,6 +792,8 @@ captured_main (void *data)
        {
          symarg = argv[optind];
          execarg = argv[optind];
@@ -165,7 +165,7 @@ Index: gdb-7.4.50.20111218/gdb/main.c
          optind++;
        }
  
-@@ -845,11 +877,25 @@ captured_main (void *data)
+@@ -917,11 +949,25 @@ captured_main (void *data)
        && symarg != NULL
        && strcmp (execarg, symarg) == 0)
      {
index 5807ace5ca1dd00111cf880bf929fb3ae450e6ff..617bef97853a645a1431d8f5ae342ad879328548 100644 (file)
@@ -1,6 +1,8 @@
---- ./gdb/elfread.c    2010-10-14 17:07:45.000000000 +0200
-+++ ./gdb/elfread.c    2010-10-14 17:06:30.000000000 +0200
-@@ -1382,6 +1382,18 @@ build_id_to_filename (struct build_id *b
+Index: gdb-7.4.50.20120602/gdb/elfread.c
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/elfread.c     2012-06-02 21:35:09.669510757 +0200
++++ gdb-7.4.50.20120602/gdb/elfread.c  2012-06-02 21:35:31.106502660 +0200
+@@ -1658,6 +1658,19 @@ build_id_to_filename (struct build_id *b
  #include <dlfcn.h>
  #endif
  
@@ -10,6 +12,7 @@
 +   Enable or disable a signal handler.  SIGNUM: signal to enable (or disable
 +   if negative).  HANDLER: sa_sigaction handler (or NULL to use
 +   rpmsqHandler()).  Returns: no. of refs, -1 on error.  */
++extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler);
 +int
 +rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler)
 +{
  /* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files
     and avoid their duplicities during a single inferior run.  */
  
---- ./gdb/proc-service.list    2010-05-28 20:50:30.000000000 +0200
-+++ ./gdb/proc-service.list    2010-10-14 17:06:30.000000000 +0200
+Index: gdb-7.4.50.20120602/gdb/proc-service.list
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/proc-service.list     2012-06-02 21:35:09.669510757 +0200
++++ gdb-7.4.50.20120602/gdb/proc-service.list  2012-06-02 21:35:14.296508989 +0200
 @@ -37,4 +37,7 @@
    ps_pstop;
    ps_ptread;
index 5602e7c1d959f89f793ea7b6d9dfa46f2b63003c..f5553f1960b0dd01375e13304c596aca3874ebca 100644 (file)
@@ -1,7 +1,7 @@
-Index: gdb-7.4.50.20111218/gdb/event-top.c
+Index: gdb-7.4.50.20120602/gdb/event-top.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/event-top.c   2011-09-21 17:21:28.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/event-top.c        2011-12-19 01:18:56.087539251 +0100
+--- gdb-7.4.50.20120602.orig/gdb/event-top.c   2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/event-top.c        2012-06-02 21:08:23.479221885 +0200
 @@ -36,6 +36,7 @@
  #include "observer.h"
  #include "continuations.h"
@@ -28,11 +28,11 @@ Index: gdb-7.4.50.20111218/gdb/event-top.c
    /* Each interpreter has its own rules on displaying the command
       prompt.  */
    if (!current_interp_display_prompt_p ())
-Index: gdb-7.4.50.20111218/gdb/elfread.c
+Index: gdb-7.4.50.20120602/gdb/elfread.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/elfread.c     2011-12-19 00:54:09.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/elfread.c  2011-12-19 01:16:15.248455897 +0100
-@@ -47,6 +47,7 @@
+--- gdb-7.4.50.20120602.orig/gdb/elfread.c     2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/elfread.c  2012-06-02 21:08:23.482221882 +0200
+@@ -48,6 +48,7 @@
  #include "gdbcore.h"
  #include "gdbcmd.h"
  #include "observer.h"
@@ -40,7 +40,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
  #include <sys/stat.h>
  
  extern void _initialize_elfread (void);
-@@ -1622,8 +1623,361 @@ build_id_to_filename (struct build_id *b
+@@ -1647,8 +1648,361 @@ build_id_to_filename (struct build_id *b
    return retval;
  }
  
@@ -258,7 +258,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
 +
 +        /* Base package name for `debuginfo-install'.  We do not use the
 +           `yum' command directly as the line
-+               yum --disablerepo='*' --enablerepo='*-debug*' \
++               yum --disablerepo='*' --enablerepo='*debug*' \
 +                   install NAME-debuginfo.ARCH
 +           would be more complicated than just:
 +               debuginfo-install NAME-VERSION-RELEASE.ARCH
@@ -399,11 +399,11 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
 +
  /* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
 -     Try to install the hash file ...
-+     yum --disablerepo='*' --enablerepo='*-debug*' install ...
++     yum --disablerepo='*' --enablerepo='*debug*' install ...
     avoidance.  */
  
  struct missing_filepair
-@@ -1677,11 +2031,17 @@ missing_filepair_change (void)
+@@ -1702,11 +2056,17 @@ missing_filepair_change (void)
        /* All their memory came just from missing_filepair_OBSTACK.  */
        missing_filepair_hash = NULL;
      }
@@ -421,7 +421,7 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
    missing_filepair_change ();
  }
  
-@@ -1748,14 +2108,35 @@ debug_print_missing (const char *binary,
+@@ -1773,14 +2133,35 @@ debug_print_missing (const char *binary,
  
    *slot = missing_filepair;
  
@@ -458,17 +458,17 @@ Index: gdb-7.4.50.20111218/gdb/elfread.c
 +                          _("Missing separate debuginfo for %s\n"), binary);
 +        if (debug != NULL)
 +        fprintf_unfiltered (gdb_stdlog, _("Try: %s %s\n"),
-+                            "yum --disablerepo='*' --enablerepo='*-debug*'"
++                            "yum --disablerepo='*' --enablerepo='*debug*'"
 +                            " install", debug);
 +      }
  }
  
  static char *
-Index: gdb-7.4.50.20111218/gdb/symfile.h
+Index: gdb-7.4.50.20120602/gdb/symfile.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/symfile.h     2011-12-19 00:54:09.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/symfile.h  2011-12-19 01:16:15.249455893 +0100
-@@ -568,6 +568,8 @@ extern struct build_id *build_id_addr_ge
+--- gdb-7.4.50.20120602.orig/gdb/symfile.h     2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/symfile.h  2012-06-02 21:08:23.499221877 +0200
+@@ -621,6 +621,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.4.50.20111218/gdb/symfile.h
  
  /* From dwarf2read.c */
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/gdb.exp 2011-12-19 00:54:09.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp      2011-12-19 01:16:15.250455889 +0100
-@@ -1387,7 +1387,7 @@ proc default_gdb_start { } {
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp      2012-06-02 21:08:23.510221873 +0200
+@@ -1388,7 +1388,7 @@ proc default_gdb_start { } {
            warning "Couldn't set the width to 0."
        }
      }
@@ -490,11 +490,11 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/lib/gdb.exp
      send_gdb "set build-id-verbose 0\n"
      gdb_expect 10 {
        -re "$gdb_prompt $" {
-Index: gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/mi-support.exp  2011-12-19 00:54:49.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/lib/mi-support.exp       2011-12-19 01:20:34.921163977 +0100
-@@ -212,7 +212,7 @@ proc default_mi_gdb_start { args } {
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp  2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp       2012-06-02 21:08:23.523221869 +0200
+@@ -213,7 +213,7 @@ proc default_mi_gdb_start { args } {
            warning "Couldn't set the width to 0."
        }
      }
@@ -503,11 +503,11 @@ Index: gdb-7.4.50.20111218/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.4.50.20111218/gdb/tui/tui-interp.c
+Index: gdb-7.4.50.20120602/gdb/tui/tui-interp.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/tui/tui-interp.c      2011-09-12 23:24:51.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/tui/tui-interp.c   2011-12-19 01:16:15.252455883 +0100
-@@ -31,6 +31,7 @@
+--- gdb-7.4.50.20120602.orig/gdb/tui/tui-interp.c      2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/tui/tui-interp.c   2012-06-02 21:08:23.524221869 +0200
+@@ -30,6 +30,7 @@
  #include "tui/tui.h"
  #include "tui/tui-io.h"
  #include "exceptions.h"
@@ -515,15 +515,16 @@ Index: gdb-7.4.50.20111218/gdb/tui/tui-interp.c
  
  /* Set to 1 when the TUI mode must be activated when we first start
     gdb.  */
-Index: gdb-7.4.50.20111218/gdb/aclocal.m4
+Index: gdb-7.4.50.20120602/gdb/aclocal.m4
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/aclocal.m4    2011-02-15 22:05:53.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/aclocal.m4 2011-12-19 01:16:15.252455883 +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'.])])
+--- gdb-7.4.50.20120602.orig/gdb/aclocal.m4    2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/aclocal.m4 2012-06-02 21:08:23.545221858 +0200
+@@ -11,6 +11,164 @@
+ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ # PARTICULAR PURPOSE.
  
 +# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
++# serial 1 (pkg-config-0.24)
 +# 
 +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
 +#
@@ -551,7 +552,10 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +AC_DEFUN([PKG_PROG_PKG_CONFIG],
 +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
 +m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
++AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
++AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
++AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
++
 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 +      AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
 +fi
@@ -564,7 +568,6 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +              AC_MSG_RESULT([no])
 +              PKG_CONFIG=""
 +      fi
-+              
 +fi[]dnl
 +])# PKG_PROG_PKG_CONFIG
 +
@@ -573,21 +576,20 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +# Check to see whether a particular set of modules exists.  Similar
 +# to PKG_CHECK_MODULES(), but does not set variables or print errors.
 +#
-+#
-+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-+# this or PKG_CHECK_MODULES is called, or make sure to call
-+# PKG_CHECK_EXISTS manually
++# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
++# only at the first occurence in configure.ac, so if the first place
++# it's called might be skipped (such as if it is within an "if", you
++# have to call PKG_CHECK_EXISTS manually
 +# --------------------------------------------------------------
 +AC_DEFUN([PKG_CHECK_EXISTS],
 +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
 +if test -n "$PKG_CONFIG" && \
 +    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
-+  m4_ifval([$2], [$2], [:])
++  m4_default([$2], [:])
 +m4_ifvaln([$3], [else
 +  $3])dnl
 +fi])
 +
-+
 +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 +# ---------------------------------------------
 +m4_define([_PKG_CONFIG],
@@ -640,6 +642,7 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +See the pkg-config man page for more details.])
 +
 +if test $pkg_failed = yes; then
++      AC_MSG_RESULT([no])
 +        _PKG_SHORT_ERRORS_SUPPORTED
 +        if test $_pkg_short_errors_supported = yes; then
 +              $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
@@ -649,7 +652,7 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +      # Put the nasty error message in config.log where it belongs
 +      echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
 +
-+      ifelse([$4], , [AC_MSG_ERROR(dnl
++      m4_default([$4], [AC_MSG_ERROR(
 +[Package requirements ($2) were not met:
 +
 +$$1_PKG_ERRORS
@@ -657,36 +660,35 @@ Index: gdb-7.4.50.20111218/gdb/aclocal.m4
 +Consider adjusting the PKG_CONFIG_PATH environment variable if you
 +installed software in a non-standard prefix.
 +
-+_PKG_TEXT
-+])],
-+              [AC_MSG_RESULT([no])
-+                $4])
++_PKG_TEXT])
++        ])
 +elif test $pkg_failed = untried; then
-+      ifelse([$4], , [AC_MSG_FAILURE(dnl
++      AC_MSG_RESULT([no])
++      m4_default([$4], [AC_MSG_FAILURE(
 +[The pkg-config script could not be found or is too old.  Make sure it
 +is in your PATH or set the PKG_CONFIG environment variable to the full
 +path to pkg-config.
 +
 +_PKG_TEXT
 +
-+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
-+              [$4])
++To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
++        ])
 +else
 +      $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
 +      $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
 +        AC_MSG_RESULT([yes])
-+      ifelse([$3], , :, [$3])
++      $3
 +fi[]dnl
 +])# PKG_CHECK_MODULES
 +
- # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
- #
- # This file is free software; the Free Software Foundation
-Index: gdb-7.4.50.20111218/gdb/config.in
+ # AM_CONDITIONAL                                            -*- Autoconf -*-
+ # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+Index: gdb-7.4.50.20120602/gdb/config.in
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/config.in     2011-11-20 09:59:56.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/config.in  2011-12-19 01:16:15.253455879 +0100
-@@ -46,6 +46,9 @@
+--- gdb-7.4.50.20120602.orig/gdb/config.in     2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/config.in  2012-06-02 21:08:23.546221859 +0200
+@@ -36,6 +36,9 @@
  /* Define to BFD's default target vector. */
  #undef DEFAULT_BFD_VEC
  
@@ -696,70 +698,78 @@ Index: gdb-7.4.50.20111218/gdb/config.in
  /* Define to 1 if translation of program messages to the user's native
     language is requested. */
  #undef ENABLE_NLS
-@@ -233,6 +236,9 @@
+@@ -216,6 +219,9 @@
  /* Define if Python 2.7 is being used. */
  #undef HAVE_LIBPYTHON2_7
  
 +/* Define if librpm library is being used. */
 +#undef HAVE_LIBRPM
 +
- /* Define if libunwind library is being used. */
- #undef HAVE_LIBUNWIND
+ /* Define to 1 if you have the <libunwind-ia64.h> header file. */
+ #undef HAVE_LIBUNWIND_IA64_H
  
-Index: gdb-7.4.50.20111218/gdb/configure
+Index: gdb-7.4.50.20120602/gdb/configure
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/configure     2011-11-20 09:59:56.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/configure  2011-12-19 01:16:15.256455867 +0100
-@@ -684,6 +684,9 @@ REPORT_BUGS_TO
+--- gdb-7.4.50.20120602.orig/gdb/configure     2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/configure  2012-06-02 21:20:53.245838121 +0200
+@@ -680,6 +680,11 @@ REPORT_BUGS_TO
  PKGVERSION
  TARGET_OBS
  subdirs
 +RPM_LIBS
 +RPM_CFLAGS
++PKG_CONFIG_LIBDIR
++PKG_CONFIG_PATH
 +PKG_CONFIG
  GDB_DATADIR
  DEBUGDIR
- am__fastdepCC_FALSE
-@@ -952,6 +955,7 @@ enable_dependency_tracking
- with_separate_debug_dir
- with_gdb_datadir
+ MAKEINFO_EXTRA_FLAGS
+@@ -780,6 +785,7 @@ with_gdb_datadir
  with_relocated_sources
+ with_auto_load_dir
+ with_auto_load_safe_path
 +with_rpm
  enable_targets
  enable_64_bit_bfd
  enable_gdbcli
-@@ -995,6 +999,9 @@ LDFLAGS
- LIBS
- CPPFLAGS
+@@ -825,6 +831,11 @@ CPPFLAGS
  CPP
+ MAKEINFO
+ MAKEINFOFLAGS
 +PKG_CONFIG
++PKG_CONFIG_PATH
++PKG_CONFIG_LIBDIR
 +RPM_CFLAGS
 +RPM_LIBS
  YACC
  YFLAGS
  XMKMF'
-@@ -1658,6 +1665,8 @@ Optional Packages:
-                           [DATADIR/gdb]
-   --with-relocated-sources=PATH
-                           automatically relocate this path for source files
+@@ -1494,6 +1505,8 @@ Optional Packages:
+                           [--with-auto-load-dir]
+   --without-auto-load-safe-path
+                           do not restrict auto-loaded files locations
 +  --with-rpm              query rpm database for missing debuginfos (yes/no,
 +                          def. auto=librpm.so)
-   --with-libunwind        use libunwind frame unwinding support
+   --with-libunwind-ia64   use libunwind frame unwinding for ia64 targets
    --with-curses           use the curses library instead of the termcap
                            library
-@@ -1696,6 +1705,9 @@ Some influential environment variables:
-   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
-               you have headers in a nonstandard directory <include dir>
-   CPP         C preprocessor
+@@ -1535,6 +1548,13 @@ Some influential environment variables:
+   MAKEINFO    Parent configure detects if it is of sufficient version.
+   MAKEINFOFLAGS
+               Parameters for MAKEINFO.
 +  PKG_CONFIG  path to pkg-config utility
++  PKG_CONFIG_PATH
++              directories to add to pkg-config's search path
++  PKG_CONFIG_LIBDIR
++              path overriding pkg-config's built-in search path
 +  RPM_CFLAGS  C compiler flags for RPM, overriding pkg-config
 +  RPM_LIBS    linker flags for RPM, overriding pkg-config
    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.
-@@ -7968,6 +7980,486 @@ _ACEOF
- fi
+@@ -5015,6 +5035,491 @@ _ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5
+ $as_echo "$with_auto_load_safe_path" >&6; }
  
 +# Integration with rpm library to support missing debuginfo suggestions.
 +# --without-rpm: Disable any rpm support.
@@ -988,6 +998,10 @@ Index: gdb-7.4.50.20111218/gdb/configure
 +    fi
 +
 +
++
++
++
++
 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
 +      if test -n "$ac_tool_prefix"; then
 +  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
@@ -1100,7 +1114,6 @@ Index: gdb-7.4.50.20111218/gdb/configure
 +$as_echo "no" >&6; }
 +              PKG_CONFIG=""
 +      fi
-+
 +fi
 +
 +pkg_failed=no
@@ -1143,6 +1156,8 @@ Index: gdb-7.4.50.20111218/gdb/configure
 +
 +
 +if test $pkg_failed = yes; then
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
 +
 +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
 +        _pkg_short_errors_supported=yes
@@ -1157,10 +1172,10 @@ Index: gdb-7.4.50.20111218/gdb/configure
 +      # Put the nasty error message in config.log where it belongs
 +      echo "$RPM_PKG_ERRORS" >&5
 +
-+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-+$as_echo "no" >&6; }
-+                HAVE_LIBRPM=false
++      HAVE_LIBRPM=false
 +elif test $pkg_failed = untried; then
++      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
++$as_echo "no" >&6; }
 +      HAVE_LIBRPM=false
 +else
 +      RPM_CFLAGS=$pkg_cv_RPM_CFLAGS
@@ -1244,13 +1259,13 @@ Index: gdb-7.4.50.20111218/gdb/configure
  
  
  subdirs="$subdirs testsuite"
-Index: gdb-7.4.50.20111218/gdb/configure.ac
+Index: gdb-7.4.50.20120602/gdb/configure.ac
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/configure.ac  2011-11-20 09:59:56.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/configure.ac       2011-12-19 01:16:15.257455863 +0100
-@@ -140,6 +140,199 @@ AS_HELP_STRING([--with-relocated-sources
-               [Relocated directory for source files. ])
- ])
+--- gdb-7.4.50.20120602.orig/gdb/configure.ac  2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/configure.ac       2012-06-02 21:08:23.560221855 +0200
+@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escap
+             [Directories safe to hold auto-loaded files.])
AC_MSG_RESULT([$with_auto_load_safe_path])
  
 +# Integration with rpm library to support missing debuginfo suggestions.
 +# --without-rpm: Disable any rpm support.
@@ -1448,30 +1463,11 @@ Index: gdb-7.4.50.20111218/gdb/configure.ac
  AC_CONFIG_SUBDIRS(testsuite)
  
  # Check whether to support alternative target configurations
-Index: gdb-7.4.50.20111218/gdb/acinclude.m4
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/acinclude.m4  2010-05-27 05:40:45.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/acinclude.m4       2011-12-19 01:16:15.257455863 +0100
-@@ -1,3 +1,5 @@
-+# serial 1
-+
- dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
- dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
-@@ -81,8 +83,6 @@ AC_MSG_RESULT(yes)
- # Foundation, Inc., 51 Franklin Street, Fifth Floor,
- # Boston, MA 02110-1301, USA.
--# serial 1
--
- # @defmac AC_PROG_CC_STDC
- # @maindex PROG_CC_STDC
- # @ovindex CC
-Index: gdb-7.4.50.20111218/gdb/corelow.c
+Index: gdb-7.4.50.20120602/gdb/corelow.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/corelow.c     2011-12-19 00:54:09.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/corelow.c  2011-12-19 01:16:15.258455859 +0100
-@@ -321,7 +321,7 @@ build_id_locate_exec (int from_tty)
+--- gdb-7.4.50.20120602.orig/gdb/corelow.c     2012-06-02 21:08:08.651227347 +0200
++++ gdb-7.4.50.20120602/gdb/corelow.c  2012-06-02 21:08:23.561221855 +0200
+@@ -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-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch
new file mode 100644 (file)
index 0000000..9a6a15e
--- /dev/null
@@ -0,0 +1,57 @@
+--- gdb-7.4.50.20120120/gdb/solib-svr4.c.orig  2012-03-17 10:23:11.000000000 +0100
++++ gdb-7.4.50.20120120/gdb/solib-svr4.c       2012-03-17 10:36:22.265628529 +0100
+@@ -1228,14 +1228,27 @@ svr4_read_so_list (CORE_ADDR lm, struct
+       }
+       {
+-      struct build_id *build_id;
++      struct build_id *build_id = NULL;
+       strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
+       new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
+       /* May get overwritten below.  */
+       strcpy (new->so_name, new->so_original_name);
+-      build_id = build_id_addr_get (new->lm_info->l_ld);
++      /* In the case the main executable was found according to its build-id
++         (from a core file) prevent loading a different build of a library
++         with accidentally the same SO_NAME.
++
++         It suppresses bogus backtraces (and prints "??" there instead) if
++         the on-disk files no longer match the running program version.
++
++         If the main executable was not loaded according to its build-id do
++         not do any build-id checking of the libraries.  There may be missing
++         build-ids dumped in the core file and we would map all the libraries
++         to the only existing file loaded that time - the executable.  */
++      if (symfile_objfile != NULL
++          && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
++        build_id = build_id_addr_get (new->lm_info->l_ld);
+       if (build_id != NULL)
+         {
+           char *name, *build_id_filename;
+@@ -1250,23 +1263,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
+               xfree (name);
+             }
+           else
+-            {
+-              debug_print_missing (new->so_name, build_id_filename);
+-
+-              /* In the case the main executable was found according to
+-                 its build-id (from a core file) prevent loading
+-                 a different build of a library with accidentally the
+-                 same SO_NAME.
+-
+-                 It suppresses bogus backtraces (and prints "??" there
+-                 instead) if the on-disk files no longer match the
+-                 running program version.  */
+-
+-              if (symfile_objfile != NULL
+-                  && (symfile_objfile->flags
+-                      & OBJF_BUILD_ID_CORE_LOADED) != 0)
+-                new->so_name[0] = 0;
+-            }
++            debug_print_missing (new->so_name, build_id_filename);
+           xfree (build_id_filename);
+           xfree (build_id);
index 7368d8abc567016fed23e7b78019f2c593b25f53..d6f5735be5713bde3c4761f7205f578c8f34fb53 100644 (file)
@@ -1,18 +1,18 @@
-Index: gdb-7.4.50.20120120/gdb/corelow.c
+Index: gdb-7.4.91.20120801/gdb/corelow.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/corelow.c     2012-01-10 17:30:44.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/corelow.c  2012-01-21 00:02:58.720401792 +0100
-@@ -46,6 +46,9 @@
- #include "filenames.h"
+--- gdb-7.4.91.20120801.orig/gdb/corelow.c     2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/corelow.c  2012-08-01 18:37:44.584925750 +0200
+@@ -47,6 +47,9 @@
  #include "progspace.h"
  #include "objfiles.h"
+ #include "gdb_bfd.h"
 +#include "auxv.h"
 +#include "elf/common.h"
 +#include "gdbcmd.h"
  
  #ifndef O_LARGEFILE
  #define O_LARGEFILE 0
-@@ -273,6 +276,52 @@ add_to_thread_list (bfd *abfd, asection
+@@ -274,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection
      inferior_ptid = ptid;                     /* Yes, make it current.  */
  }
  
@@ -65,20 +65,22 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
  /* This routine opens and sets up the core file bfd.  */
  
  static void
-@@ -375,6 +424,12 @@ core_open (char *filename, int from_tty)
-   push_target (&core_ops);
-   discard_cleanups (old_chain);
+@@ -418,6 +467,14 @@ core_open (char *filename, int from_tty)
+       switch_to_thread (thread->ptid);
+     }
  
 +  /* Find the build_id identifiers.  If it gets executed after
 +     POST_CREATE_INFERIOR we would clash with asking to discard the already
-+     loaded VDSO symbols.  */
++     loaded VDSO symbols.  If it gets executed before bfd_map_over_sections
++     INFERIOR_PTID is still not set and libthread_db initialization crashes on
++     PID == 0 in ps_pglobal_lookup.  */
 +  if (build_id_core_loads != 0)
 +    build_id_locate_exec (from_tty);
 +
-   /* Do this before acknowledging the inferior, so if
-      post_create_inferior throws (can happen easilly if you're loading
-      a core file with the wrong exec), we aren't left with threads
-@@ -934,4 +989,11 @@ _initialize_corelow (void)
+   post_create_inferior (&core_ops, from_tty);
+   /* Now go through the target stack looking for threads since there
+@@ -939,4 +996,11 @@ _initialize_corelow (void)
    init_core_ops ();
  
    add_target (&core_ops);
@@ -86,15 +88,15 @@ Index: gdb-7.4.50.20120120/gdb/corelow.c
 +  add_setshow_boolean_cmd ("build-id-core-loads", class_files,
 +                         &build_id_core_loads, _("\
 +Set whether CORE-FILE loads the build-id associated files automatically."), _("\
-+Show whether CORE-FILE loads the build-id associated files automatically.."),
++Show whether CORE-FILE loads the build-id associated files automatically."),
 +                         NULL, NULL, NULL,
 +                         &setlist, &showlist);
  }
-Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
+Index: gdb-7.4.91.20120801/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/doc/gdb.texinfo       2012-01-21 00:02:36.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/doc/gdb.texinfo    2012-01-21 00:02:41.619463607 +0100
-@@ -16015,6 +16015,27 @@ information files.
+--- gdb-7.4.91.20120801.orig/gdb/doc/gdb.texinfo       2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/doc/gdb.texinfo    2012-08-01 18:37:44.598925672 +0200
+@@ -16530,6 +16530,27 @@ information files.
  
  @end table
  
@@ -122,11 +124,11 @@ Index: gdb-7.4.50.20120120/gdb/doc/gdb.texinfo
  @cindex @code{.gnu_debuglink} sections
  @cindex debug link sections
  A debug link is a special section of the executable file named
-Index: gdb-7.4.50.20120120/gdb/solib-svr4.c
+Index: gdb-7.4.91.20120801/gdb/solib-svr4.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/solib-svr4.c  2012-01-04 09:17:11.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/solib-svr4.c       2012-01-21 00:02:41.620463603 +0100
-@@ -1227,9 +1227,52 @@ svr4_read_so_list (CORE_ADDR lm, struct
+--- gdb-7.4.91.20120801.orig/gdb/solib-svr4.c  2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/solib-svr4.c       2012-08-01 18:37:44.599925667 +0200
+@@ -1228,9 +1228,52 @@ svr4_read_so_list (CORE_ADDR lm, struct
          continue;
        }
  
@@ -182,14 +184,14 @@ Index: gdb-7.4.50.20120120/gdb/solib-svr4.c
        xfree (buffer);
  
        /* If this entry has no name, or its name matches the name
-Index: gdb-7.4.50.20120120/gdb/elfread.c
+Index: gdb-7.4.91.20120801/gdb/elfread.c
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/elfread.c     2012-01-21 00:02:33.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/elfread.c  2012-01-21 00:02:41.621463599 +0100
-@@ -44,6 +44,11 @@
- #include "gdbthread.h"
+--- gdb-7.4.91.20120801.orig/gdb/elfread.c     2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/elfread.c  2012-08-01 18:38:08.956790879 +0200
+@@ -45,6 +45,11 @@
  #include "regcache.h"
  #include "bcache.h"
+ #include "gdb_bfd.h"
 +#include "libbfd.h"
 +#include "gdbcore.h"
 +#include "gdbcmd.h"
@@ -198,7 +200,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  
  extern void _initialize_elfread (void);
  
-@@ -1076,16 +1081,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
+@@ -1074,16 +1079,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
    update_breakpoint_locations (b, sals, sals_end);
  }
  
@@ -223,8 +225,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 -/* Locate NT_GNU_BUILD_ID from ABFD and return its content.  */
 +/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
 +   FIXME: NOTE decoding should be unified with the BFD core notes decoding.  */
-+
-+struct build_id *
+ static struct build_id *
+-build_id_bfd_get (bfd *abfd)
 +build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size)
 +{
 +  bfd_byte *p;
@@ -259,14 +262,13 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +/* Separate debuginfo files have corrupted PHDR but SHDR is correct there.
 +   Locate NT_GNU_BUILD_ID from ABFD and return its content.  */
- static struct build_id *
--build_id_bfd_get (bfd *abfd)
++
++static struct build_id *
 +build_id_bfd_shdr_get (bfd *abfd)
  {
    struct build_id *retval;
  
-@@ -1101,6 +1155,348 @@ build_id_bfd_get (bfd *abfd)
+@@ -1099,6 +1153,348 @@ build_id_bfd_get (bfd *abfd)
    return retval;
  }
  
@@ -362,7 +364,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +/* Translate an ELF program header table entry in external format into an
 +   ELF program header table entry in internal format.  */
 +
-+void
++static void
 +elf_swap_phdr_in (bfd *abfd,
 +                const Elf64_External_Phdr *src64,
 +                Elf_Internal_Phdr *dst)
@@ -615,7 +617,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value.  */
  
  static int
-@@ -1115,7 +1511,7 @@ build_id_verify (const char *filename, s
+@@ -1113,7 +1509,7 @@ build_id_verify (const char *filename, s
    if (abfd == NULL)
      return 0;
  
@@ -624,7 +626,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  
    if (found == NULL)
      warning (_("File \"%s\" has no build-id, file skipped"), filename);
-@@ -1133,14 +1529,15 @@ build_id_verify (const char *filename, s
+@@ -1131,17 +1527,18 @@ build_id_verify (const char *filename, s
    return retval;
  }
  
@@ -636,6 +638,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  {
    char *link, *debugdir, *retval = NULL;
 +  char *link_all = NULL;
+   VEC (char_ptr) *debugdir_vec;
+   struct cleanup *back_to;
+   int ix;
  
    /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
 -  link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
@@ -644,30 +649,26 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  
    /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
       cause "/.build-id/..." lookups.  */
-@@ -1151,6 +1548,8 @@ build_id_to_debug_filename (struct build
-       char *s, *debugdir_end;
+@@ -1154,6 +1551,8 @@ build_id_to_debug_filename (struct build
+       size_t debugdir_len = strlen (debugdir);
        gdb_byte *data = build_id->data;
        size_t size = build_id->size;
 +      unsigned seqno;
 +      struct stat statbuf_trash;
+       char *s;
  
-       while (*debugdir == DIRNAME_SEPARATOR)
-       debugdir++;
-@@ -1171,39 +1570,242 @@ build_id_to_debug_filename (struct build
+       memcpy (link, debugdir, debugdir_len);
+@@ -1168,37 +1567,240 @@ build_id_to_debug_filename (struct build
        *s++ = '/';
        while (size-- > 0)
        s += sprintf (s, "%02x", (unsigned) *data++);
 -      strcpy (s, ".debug");
--
 -      /* lrealpath() is expensive even for the usually non-existent files.  */
 -      if (access (link, F_OK) == 0)
 -      retval = lrealpath (link);
--      if (retval != NULL && !build_id_verify (retval, build_id))
 +      for (seqno = 0;; seqno++)
-       {
--        xfree (retval);
--        retval = NULL;
++      {
 +        char *s2;
 +
 +        if (seqno)
@@ -685,7 +686,8 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +          strcpy (s2, ".debug");
 +        else
 +          *s2 = 0;
-+
+-      if (retval != NULL && !build_id_verify (retval, build_id))
 +        /* `access' automatically dereferences LINK.  */
 +        if (lstat (link, &statbuf_trash) != 0)
 +          {
@@ -703,15 +705,16 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +        if (retval)
 +          break;
-       }
-       if (retval != NULL)
--      break;
-+      {
-+        /* LINK_ALL is not used below in this non-NULL RETVAL case.  */
-+        break;
 +      }
 +
++      if (retval != NULL)
+       {
+-        xfree (retval);
+-        retval = NULL;
++        /* LINK_ALL is not used below in this non-NULL RETVAL case.  */
++        break;
+       }
 +      if (link_all == NULL)
 +        link_all = xstrdup (link);
 +      else
@@ -726,14 +729,12 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +          strcpy (&link_all[len_orig + 1], link);
 +        }
-       debugdir = debugdir_end;
-     }
-   while (*debugdir != 0);
++    }
++
 +  if (link_return != NULL)
 +    {
-+      if (retval != NULL)
+       if (retval != NULL)
+-      break;
 +       {
 +         *link_return = link;
 +         link = NULL;
@@ -743,13 +744,14 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +         *link_return = link_all;
 +         link_all = NULL;
 +       }
-+    }
+     }
 +  xfree (link);
 +  xfree (link_all);
-+
-+  return retval;
-+}
-+
+   do_cleanups (back_to);
+   return retval;
+ }
 +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
 +     Try to install the hash file ...
 +   avoidance.  */
@@ -772,9 +774,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +  retval = obstack_alloc (&missing_filepair_obstack, size);
 +  memset (retval, 0, size);
-   return retval;
- }
++  return retval;
++}
++
 +static hashval_t
 +missing_filepair_hash_func (const struct missing_filepair *elem)
 +{
@@ -908,7 +910,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
        xfree (build_id);
        /* Prevent looping on a stripped .debug file.  */
        if (build_id_name != NULL
-@@ -1214,7 +1816,7 @@ find_separate_debug_file_by_buildid (str
+@@ -1209,7 +1811,7 @@ find_separate_debug_file_by_buildid (str
          xfree (build_id_name);
        }
        else if (build_id_name != NULL)
@@ -917,7 +919,7 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
      }
    return NULL;
  }
-@@ -1434,9 +2036,10 @@ elf_symfile_read (struct objfile *objfil
+@@ -1436,9 +2038,10 @@ elf_symfile_read (struct objfile *objfil
       `.note.gnu.build-id'.  */
    else if (!objfile_has_partial_symbols (objfile))
      {
@@ -930,9 +932,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
  
        if (debugfile == NULL)
        debugfile = find_separate_debug_file_by_debuglink (objfile);
-@@ -1448,6 +2051,12 @@ elf_symfile_read (struct objfile *objfil
+@@ -1452,6 +2055,12 @@ elf_symfile_read (struct objfile *objfil
          symbol_file_add_separate (abfd, symfile_flags, objfile);
-         xfree (debugfile);
+         do_cleanups (cleanup);
        }
 +      /* Check if any separate debug info has been extracted out.  */
 +      else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
@@ -941,9 +943,9 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +      xfree (build_id_filename);
      }
- }
  
-@@ -1931,4 +2540,16 @@ _initialize_elfread (void)
+   if (symtab_create_debug)
+@@ -1784,4 +2393,16 @@ _initialize_elfread (void)
  
    elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
    gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
@@ -960,11 +962,11 @@ Index: gdb-7.4.50.20120120/gdb/elfread.c
 +
 +  observer_attach_executable_changed (debug_print_executable_changed);
  }
-Index: gdb-7.4.50.20120120/gdb/symfile.h
+Index: gdb-7.4.91.20120801/gdb/symfile.h
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/symfile.h     2012-01-21 00:02:33.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/symfile.h  2012-01-21 00:02:41.621463599 +0100
-@@ -614,6 +614,13 @@ void free_symfile_segment_data (struct s
+--- gdb-7.4.91.20120801.orig/gdb/symfile.h     2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/symfile.h  2012-08-01 18:37:44.600925662 +0200
+@@ -615,6 +615,13 @@ void free_symfile_segment_data (struct s
  
  extern struct cleanup *increment_reading_symtab (void);
  
@@ -978,11 +980,11 @@ Index: gdb-7.4.50.20120120/gdb/symfile.h
  /* From dwarf2read.c */
  
  /* Names for a dwarf2 debugging section.  The field NORMAL is the normal
-Index: gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.4.91.20120801/gdb/testsuite/lib/gdb.exp
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/testsuite/lib/gdb.exp 2012-01-21 00:02:36.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp      2012-01-21 00:02:41.622463596 +0100
-@@ -1385,6 +1385,16 @@ proc default_gdb_start { } {
+--- gdb-7.4.91.20120801.orig/gdb/testsuite/lib/gdb.exp 2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/lib/gdb.exp      2012-08-01 18:37:44.601925656 +0200
+@@ -1388,6 +1388,16 @@ proc default_gdb_start { } {
            warning "Couldn't set the width to 0."
        }
      }
@@ -999,11 +1001,11 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/lib/gdb.exp
      return 0;
  }
  
-Index: gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp
+Index: gdb-7.4.91.20120801/gdb/testsuite/lib/mi-support.exp
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/testsuite/lib/mi-support.exp  2012-01-12 23:28:34.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp       2012-01-21 00:02:41.622463596 +0100
-@@ -212,6 +212,16 @@ proc default_mi_gdb_start { args } {
+--- gdb-7.4.91.20120801.orig/gdb/testsuite/lib/mi-support.exp  2012-07-25 22:35:30.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/lib/mi-support.exp       2012-08-01 18:37:44.601925656 +0200
+@@ -213,6 +213,16 @@ proc default_mi_gdb_start { args } {
            warning "Couldn't set the width to 0."
        }
      }
@@ -1020,11 +1022,11 @@ Index: gdb-7.4.50.20120120/gdb/testsuite/lib/mi-support.exp
      # If allowing the inferior to have its own PTY then assign the inferior
      # its own terminal device here.
      if { $separate_inferior_pty } {
-Index: gdb-7.4.50.20120120/gdb/objfiles.h
+Index: gdb-7.4.91.20120801/gdb/objfiles.h
 ===================================================================
---- gdb-7.4.50.20120120.orig/gdb/objfiles.h    2012-01-04 09:17:09.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/objfiles.h 2012-01-21 00:02:41.623463593 +0100
-@@ -433,6 +433,10 @@ struct objfile
+--- gdb-7.4.91.20120801.orig/gdb/objfiles.h    2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/objfiles.h 2012-08-01 18:37:44.601925656 +0200
+@@ -432,6 +432,10 @@ struct objfile
  
  #define OBJF_MAINLINE (1 << 5)
  
@@ -1035,3 +1037,41 @@ Index: gdb-7.4.50.20120120/gdb/objfiles.h
  /* The object file that contains the runtime common minimal symbols
     for SunOS4.  Note that this objfile has no associated BFD.  */
  
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.base/corefile.exp
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/testsuite/gdb.base/corefile.exp       2012-06-21 22:46:21.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.base/corefile.exp    2012-08-01 18:37:44.602925650 +0200
+@@ -256,3 +256,33 @@ if ![is_remote target] {
+     gdb_exit
+ }
++
++
++# Test auto-loading of binary files through build-id from the core file.
++set buildid [build_id_debug_filename_get $binfile]
++set wholetest "binfile found by build-id"
++if {$buildid == ""} {
++    untested "$wholetest (binary has no build-id)"
++} else {
++    gdb_exit
++    gdb_start
++
++    regsub {\.debug$} $buildid {} buildid
++    set debugdir ${objdir}/${subdir}/${testfile}-debugdir
++    file delete -force -- $debugdir
++    file mkdir $debugdir/[file dirname $buildid]
++    file copy $binfile $debugdir/$buildid
++
++    set test "show debug-file-directory"
++    gdb_test_multiple $test $test {
++      -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" {
++          set debugdir_orig $expect_out(1,string)
++          pass $test
++      }
++    }
++    gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory"
++    gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.}
++    gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable"
++    gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
++    pass $wholetest
++}
diff --git a/gdb-6.6-bz225783-gdb-debuginfo-paths.patch b/gdb-6.6-bz225783-gdb-debuginfo-paths.patch
deleted file mode 100644 (file)
index 639bbcd..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225783
-
-
-Index: gdb-6.8.50.20081128/gdb/Makefile.in
-===================================================================
---- gdb-6.8.50.20081128.orig/gdb/Makefile.in   2008-12-02 23:06:16.000000000 +0100
-+++ gdb-6.8.50.20081128/gdb/Makefile.in        2008-12-02 23:28:02.000000000 +0100
-@@ -1490,8 +1490,10 @@ po/$(PACKAGE).pot: force
- .SUFFIXES: .y .l
- .y.c:
--      $(SHELL) $(YLWRAP) $< y.tab.c $@.tmp -- $(YACC) $(YFLAGS)
--      -sed -e '/extern.*malloc/d' \
-+      rm -f $@ $@.tmp
-+      $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
-+              || (rm -f $@; false)
-+      sed -e '/extern.*malloc/d' \
-            -e '/extern.*realloc/d' \
-            -e '/extern.*free/d' \
-            -e '/include.*malloc.h/d' \
-@@ -1500,9 +1502,9 @@ po/$(PACKAGE).pot: force
-            -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
-            -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
-            -e '/^#line.*y.tab.c/d' \
--        < $@.tmp > $@.new
--      -rm $@.tmp
--      mv $@.new ./$*.c
-+           -e "s/^\(#line.*\)`basename $<`/\1`echo $<|sed 's/\//\\\\\//g'`/" \
-+        < $@.tmp > $@
-+      rm -f $@.tmp
- .l.c:
-       if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
-           $(FLEX) -o$@ $< && \
diff --git a/gdb-6.6-readline-system.patch b/gdb-6.6-readline-system.patch
deleted file mode 100644 (file)
index 02901e7..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-2007-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Port to GDB-6.7.
-
-Index: gdb-6.7/gdb/doc/Makefile.in
-===================================================================
---- gdb-6.7.orig/gdb/doc/Makefile.in   2007-07-26 12:34:00.000000000 +0200
-+++ gdb-6.7/gdb/doc/Makefile.in        2007-10-16 16:31:08.000000000 +0200
-@@ -109,9 +109,7 @@ DVIPS = dvips
- GDB_DOC_SOURCE_INCLUDES = \
-       $(srcdir)/fdl.texi \
-       $(srcdir)/gpl.texi \
--      $(srcdir)/agentexpr.texi \
--      $(READLINE_DIR)/rluser.texi \
--      $(READLINE_DIR)/inc-hist.texinfo
-+      $(srcdir)/agentexpr.texi
- GDB_DOC_BUILD_INCLUDES = \
-       gdb-cfg.texi \
-       GDBvn.texi
-Index: gdb-6.7/gdb/doc/gdb.texinfo
-===================================================================
---- gdb-6.7.orig/gdb/doc/gdb.texinfo   2007-10-16 16:19:19.000000000 +0200
-+++ gdb-6.7/gdb/doc/gdb.texinfo        2007-10-16 16:32:10.000000000 +0200
-@@ -158,8 +158,8 @@ software in general.  We will miss him.
- * GDB Bugs::                    Reporting bugs in @value{GDBN}
--* Command Line Editing::        Command Line Editing
--* Using History Interactively:: Using History Interactively
-+* Command Line Editing: (rluserman).       Command Line Editing
-+* Using History Interactively: (history).  Using History Interactively
- * Formatting Documentation::    How to format and print @value{GDBN} documentation
- * Installing GDB::              Installing GDB
- * Maintenance Commands::        Maintenance Commands
-@@ -15533,7 +15533,7 @@ Disable command line editing.
- Show whether command line editing is enabled.
- @end table
--@xref{Command Line Editing}, for more details about the Readline
-+@xref{Command Line Editing, , , rluserman, GNU Readline Library}, for more details about the Readline
- interface.  Users unfamiliar with @sc{gnu} Emacs or @code{vi} are
- encouraged to read that chapter.
-@@ -15548,7 +15548,8 @@ history facility.
- @value{GDBN} uses the @sc{gnu} History library, a part of the Readline
- package, to provide the history facility.  @xref{Using History
--Interactively}, for the detailed description of the History library.
-+Interactively, , , history, GNU History Library}, for the detailed description
-+of the History library.
- To issue a command to @value{GDBN} without affecting certain aspects of
- the state which is seen by users, prefix it with @samp{server }
-@@ -15600,7 +15601,7 @@ This defaults to the value of the enviro
- @end table
- History expansion assigns special meaning to the character @kbd{!}.
--@xref{Event Designators}, for more details.
-+@xref{Event Designators, , , history, GNU History Library}, for more details.
- @cindex history expansion, turn on/off
- Since @kbd{!} is also the logical not operator in C, history expansion
-@@ -16660,7 +16661,8 @@ Indicates the current program counter ad
- @cindex TUI key bindings
- The TUI installs several key bindings in the readline keymaps
--(@pxref{Command Line Editing}).  The following key bindings
-+(@pxref{Command Line Editing, , , rluserman, GNU Readline Library}).
-+The following key bindings
- are installed for both TUI mode and the @value{GDBN} standard mode.
- @table @kbd
-@@ -21937,15 +21939,6 @@ Such guesses are usually wrong.  Even we
- things without first using the debugger to find the facts.
- @end itemize
--@c The readline documentation is distributed with the readline code
--@c and consists of the two following files:
--@c     rluser.texinfo
--@c     inc-hist.texinfo
--@c Use -I with makeinfo to point to the appropriate directory,
--@c environment var TEXINPUTS with TeX.
--@include rluser.texi
--@include inc-hist.texinfo
--
- @node Formatting Documentation
- @appendix Formatting Documentation
-@@ -22115,9 +22108,6 @@ source for the @samp{-liberty} free soft
- @item gdb-@value{GDBVN}/opcodes
- source for the library of opcode tables and disassemblers
--@item gdb-@value{GDBVN}/readline
--source for the @sc{gnu} command-line interface
--
- @item gdb-@value{GDBVN}/glob
- source for the @sc{gnu} filename pattern-matching subroutine
-@@ -22149,7 +22139,7 @@ where @var{host} is an identifier such a
- correct value by examining your system.)
- Running @samp{configure @var{host}} and then running @code{make} builds the
--@file{bfd}, @file{readline}, @file{mmalloc}, and @file{libiberty}
-+@file{bfd}, @file{mmalloc}, and @file{libiberty}
- libraries, then @code{gdb} itself.  The configured source files, and the
- binaries, are left in the corresponding source directories.
-@@ -22175,7 +22165,7 @@ source tree, the @file{gdb-@var{version-
- that subdirectory.  That is usually not what you want.  In particular,
- if you run the first @file{configure} from the @file{gdb} subdirectory
- of the @file{gdb-@var{version-number}} directory, you will omit the
--configuration of @file{bfd}, @file{readline}, and other sibling
-+configuration of @file{bfd}, and other sibling
- directories of the @file{gdb} subdirectory.  This leads to build errors
- about missing include files such as @file{bfd/bfd.h}.
index 50af796f1a12b47101e97cbb2a32dad773f221fc..bfc8e96f5910a8b87e55f8ec82107bf7a7cd5593 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.3.50.20110722/gdb/infrun.c
+Index: gdb-7.4.50.20120703/gdb/infrun.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/infrun.c      2011-07-22 19:12:56.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/infrun.c   2011-07-22 19:17:06.000000000 +0200
-@@ -1549,7 +1549,7 @@ static const char *scheduler_enums[] = {
+--- gdb-7.4.50.20120703.orig/gdb/infrun.c      2012-07-03 20:26:25.060940765 +0200
++++ gdb-7.4.50.20120703/gdb/infrun.c   2012-07-03 20:26:32.808929860 +0200
+@@ -1591,7 +1591,7 @@ static const char *const scheduler_enums
    schedlock_step,
    NULL
  };
@@ -11,11 +11,11 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c
  static void
  show_scheduler_mode (struct ui_file *file, int from_tty,
                     struct cmd_list_element *c, const char *value)
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-console.exp       2011-01-01 16:33:47.000000000 +0100
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp    2011-07-22 19:17:06.000000000 +0200
-@@ -47,6 +47,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-console.exp       2012-07-03 20:26:25.060940765 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp    2012-07-03 20:26:32.809929858 +0200
+@@ -46,6 +46,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
  
  mi_run_to_main
  
@@ -25,11 +25,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp
  # Next over the hello() call which will produce lots of output
  mi_gdb_test "220-exec-next" \
            "220\\^running(\r\n\\*running,thread-id=\"all\")?" \
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi2-console.exp      2011-06-23 11:40:50.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp   2011-07-22 19:17:27.000000000 +0200
-@@ -47,6 +47,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi2-console.exp      2012-07-03 20:26:25.060940765 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp   2012-07-03 20:26:32.809929858 +0200
+@@ -46,6 +46,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/
  
  mi_run_to_main
  
@@ -39,11 +39,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp
  # Next over the hello() call which will produce lots of output
  mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \
        "Started step over hello"
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-cli.exp   2011-04-27 12:17:38.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp        2011-07-22 19:17:06.000000000 +0200
-@@ -176,7 +176,7 @@ mi_execute_to "exec-continue" "breakpoin
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-cli.exp   2012-07-03 20:26:25.060940765 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp        2012-07-03 20:26:32.810929856 +0200
+@@ -175,7 +175,7 @@ mi_execute_to "exec-continue" "breakpoin
  # Test that the token is output even for CLI commands
  # Also test that *stopped includes frame information.
  mi_gdb_test "34 next" \
@@ -52,3 +52,25 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp
      "34 next: run"
  
  if {!$async} {
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp
+===================================================================
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-logging.exp       2012-06-29 00:11:23.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp    2012-07-03 20:29:03.573717651 +0200
+@@ -56,7 +56,7 @@ close $chan
+ set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+"
+-if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
++if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+     pass "Log file contents"
+ } else {
+     fail "Log file contents"
+@@ -79,7 +79,7 @@ set chan [open $milogfile]
+ set logcontent [read $chan]
+ close $chan
+-if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
++if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] {
+     pass "Redirect log file contents"
+ } else {
+     fail "Redirect log file contents"
index c7f0d3343cdc7e1777855149876c06c7cf46e561..36b10a5f505dc96e6296d9c5c9b6723ba980264e 100644 (file)
 
        Port to GDB-6.8pre.
 
-Index: gdb-7.4.50.20111218/gdb/inferior.h
+Index: gdb-7.4.50.20120714/gdb/inferior.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/inferior.h    2011-10-07 14:06:46.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/inferior.h 2011-12-18 23:40:59.257300451 +0100
-@@ -162,7 +162,15 @@ extern void reopen_exec_file (void);
+--- gdb-7.4.50.20120714.orig/gdb/inferior.h    2012-06-13 20:15:05.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/inferior.h 2012-07-14 23:21:01.795161794 +0200
+@@ -159,7 +159,15 @@ extern void reopen_exec_file (void);
  /* The `resume' routine should only be called in special circumstances.
     Normally, use `proceed', which handles a lot of bookkeeping.  */
  
--extern void resume (int, enum target_signal);
+-extern void resume (int, enum gdb_signal);
 +enum resume_step
 +  {
 +    /* currently_stepping () should return non-zero for non-continue.  */
@@ -38,14 +38,14 @@ Index: gdb-7.4.50.20111218/gdb/inferior.h
 +    RESUME_STEP_NEEDED                /* Stepping only for software watchpoints.  */
 +  };
 +
-+extern void resume (enum resume_step, enum target_signal);
++extern void resume (enum resume_step, enum gdb_signal);
  
  extern ptid_t user_visible_resume_ptid (int step);
  
-Index: gdb-7.4.50.20111218/gdb/infrun.c
+Index: gdb-7.4.50.20120714/gdb/infrun.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/infrun.c      2011-11-22 22:25:17.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/infrun.c   2011-12-19 00:12:34.470854218 +0100
+--- gdb-7.4.50.20120714.orig/gdb/infrun.c      2012-07-01 12:37:04.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/infrun.c   2012-07-14 23:21:01.800161767 +0200
 @@ -79,7 +79,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.4.50.20111218/gdb/infrun.c
  
  static int currently_stepping_or_nexting_callback (struct thread_info *tp,
                                                   void *data);
-@@ -1668,7 +1668,8 @@ user_visible_resume_ptid (int step)
+@@ -1672,7 +1672,8 @@ user_visible_resume_ptid (int step)
      }
    else if ((scheduler_mode == schedlock_on)
           || (scheduler_mode == schedlock_step
@@ -65,16 +65,16 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
      {
        /* User-settable 'scheduler' mode requires solo thread resume.  */
        resume_ptid = inferior_ptid;
-@@ -1686,7 +1687,7 @@ user_visible_resume_ptid (int step)
+@@ -1690,7 +1691,7 @@ user_visible_resume_ptid (int step)
     STEP nonzero if we should step (zero to continue instead).
     SIG is the signal to give the inferior (zero for none).  */
  void
--resume (int step, enum target_signal sig)
-+resume (enum resume_step step, enum target_signal sig)
+-resume (int step, enum gdb_signal sig)
++resume (enum resume_step step, enum gdb_signal sig)
  {
    int should_resume = 1;
    struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
-@@ -1719,9 +1720,13 @@ resume (int step, enum target_signal sig
+@@ -1723,9 +1724,13 @@ resume (int step, enum gdb_signal sig)
  
    if (debug_infrun)
      fprintf_unfiltered (gdb_stdlog,
@@ -90,7 +90,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
                        target_pid_to_str (inferior_ptid),
                        paddress (gdbarch, pc));
  
-@@ -2094,7 +2099,7 @@ proceed (CORE_ADDR addr, enum target_sig
+@@ -2102,7 +2107,7 @@ proceed (CORE_ADDR addr, enum gdb_signal
    struct thread_info *tp;
    CORE_ADDR pc;
    struct address_space *aspace;
@@ -99,7 +99,7 @@ Index: gdb-7.4.50.20111218/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
-@@ -2134,13 +2139,13 @@ proceed (CORE_ADDR addr, enum target_sig
+@@ -2142,13 +2147,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
           actually be executing the breakpoint insn anyway.
           We'll be (un-)executing the previous instruction.  */
  
@@ -115,7 +115,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
      }
    else
      {
-@@ -2171,13 +2176,13 @@ proceed (CORE_ADDR addr, enum target_sig
+@@ -2179,13 +2184,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
         is required it returns TRUE and sets the current thread to
         the old thread.  */
        if (prepare_to_proceed (step))
@@ -131,7 +131,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
      {
        tp->control.trap_expected = 1;
        /* If displaced stepping is enabled, we can step over the
-@@ -2264,8 +2269,13 @@ proceed (CORE_ADDR addr, enum target_sig
+@@ -2272,8 +2277,13 @@ proceed (CORE_ADDR addr, enum gdb_signal
    /* Reset to normal state.  */
    init_infwait_state ();
  
@@ -146,7 +146,7 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
  
    /* Wait for it to stop (if not standalone)
       and in any case decode why it stopped, and act accordingly.  */
-@@ -5223,13 +5233,18 @@ process_event_stop_test:
+@@ -5205,13 +5215,18 @@ process_event_stop_test:
  
  /* Is thread TP in the middle of single-stepping?  */
  
@@ -170,11 +170,11 @@ Index: gdb-7.4.50.20111218/gdb/infrun.c
  }
  
  /* Returns true if any thread *but* the one passed in "data" is in the
-Index: gdb-7.4.50.20111218/gdb/linux-nat.c
+Index: gdb-7.4.50.20120714/gdb/linux-nat.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/linux-nat.c   2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/linux-nat.c        2011-12-19 00:08:41.824855353 +0100
-@@ -3036,7 +3036,11 @@ static int
+--- gdb-7.4.50.20120714.orig/gdb/linux-nat.c   2012-07-07 14:13:56.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/linux-nat.c        2012-07-14 23:21:01.803161750 +0200
+@@ -2982,7 +2982,11 @@ static int
  select_singlestep_lwp_callback (struct lwp_info *lp, void *data)
  {
    if (lp->last_resume_kind == resume_step
@@ -187,11 +187,11 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.c
      return 1;
    else
      return 0;
-Index: gdb-7.4.50.20111218/gdb/linux-nat.h
+Index: gdb-7.4.50.20120714/gdb/linux-nat.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/linux-nat.h   2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/linux-nat.h        2011-12-18 23:40:59.262300431 +0100
-@@ -74,8 +74,8 @@ struct lwp_info
+--- gdb-7.4.50.20120714.orig/gdb/linux-nat.h   2012-07-06 18:52:20.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/linux-nat.h        2012-07-14 23:21:17.414075355 +0200
+@@ -73,8 +73,8 @@ struct lwp_info
    /* If non-zero, a pending wait status.  */
    int status;
  
@@ -200,5 +200,5 @@ Index: gdb-7.4.50.20111218/gdb/linux-nat.h
 +  /* The kind of stepping of this LWP.  */
 +  enum resume_step step;
  
-   /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
-      be the address of a hardware watchpoint.  */
+   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+      watchpoint trap.  */
index 7e697405bffbc6401b4143966f7c3acef80e2cf4..00f5d8554fbbc7a727b67c9a950ddb28ea69498a 100644 (file)
@@ -1,26 +1,26 @@
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp
 ===================================================================
---- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota1.exp        2011-12-13 18:22:08.000000000 +0100
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota1.exp     2011-12-20 00:01:36.518847033 +0100
-@@ -50,6 +50,8 @@ gdb_start
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota1.exp        2012-03-16 17:47:33.000000000 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota1.exp     2012-06-02 18:27:46.623210711 +0200
+@@ -45,6 +45,8 @@ gdb_start
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
 +gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
 +
- #
- # the line at which break main will put the breakpoint
- #
-Index: gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp
+ # The commands we test here produce many lines of output; disable "press 
+ # <return> to continue" prompts.
+ gdb_test_no_output "set height 0"
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp
 ===================================================================
---- gdb-7.4.50.20111219.orig/gdb/testsuite/gdb.base/annota3.exp        2011-12-13 18:22:08.000000000 +0100
-+++ gdb-7.4.50.20111219/gdb/testsuite/gdb.base/annota3.exp     2011-12-20 00:01:36.518847033 +0100
-@@ -50,6 +50,8 @@ gdb_start
+--- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/annota3.exp        2012-02-28 23:40:48.000000000 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/annota3.exp     2012-06-02 18:28:00.375206457 +0200
+@@ -45,6 +45,8 @@ gdb_start
  gdb_reinitialize_dir $srcdir/$subdir
  gdb_load ${binfile}
  
 +gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions"
 +
- #
- # the line at which break main will put the breakpoint
- #
+ # The commands we test here produce many lines of output; disable "press 
+ # <return> to continue" prompts.
+ gdb_test_no_output "set height 0"
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 (file)
index f99486c..0000000
+++ /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  <jan.kratochvil@redhat.com>
-
-       * 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  <jan.kratochvil@redhat.com>
-
-       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.7-kernel-headers-compat.patch b/gdb-6.7-kernel-headers-compat.patch
deleted file mode 100644 (file)
index f169b78..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-kernel-headers-2.6.25-0.40.rc1.git2.fc9.x86_64
-
-In file included from /usr/include/asm/ptrace.h:4,
-                 from ../../gdb/amd64-linux-nat.c:44:
-/usr/include/asm/ptrace-abi.h:92: error: expected specifier-qualifier-list before ‘u32’
-
---- gdb-6.7.1-13.fc9.x86_64/gdb/amd64-linux-nat.c-orig 2008-02-15 15:37:28.000000000 -0500
-+++ gdb-6.7.1-13.fc9.x86_64/gdb/amd64-linux-nat.c      2008-02-15 15:40:13.000000000 -0500
-@@ -35,13 +35,13 @@
- #include <sys/procfs.h>
- #include <asm/prctl.h>
- /* FIXME ezannoni-2003-07-09: we need <sys/reg.h> to be included after
--   <asm/ptrace.h> because the latter redefines FS and GS for no apparent
-+   <sys/ptrace.h> because the latter redefines FS and GS for no apparent
-    reason, and those definitions don't match the ones that libpthread_db
-    uses, which come from <sys/reg.h>.  */
- /* ezannoni-2003-07-09: I think this is fixed. The extraneous defs have
-    been removed from ptrace.h in the kernel.  However, better safe than
-    sorry.  */
--#include <asm/ptrace.h>
-+#include <sys/ptrace.h>
- #include <sys/reg.h>
- #include "gdb_proc_service.h"
diff --git a/gdb-6.8-attach-signalled-detach-stopped.patch b/gdb-6.8-attach-signalled-detach-stopped.patch
new file mode 100644 (file)
index 0000000..13966f2
--- /dev/null
@@ -0,0 +1,152 @@
+Index: gdb-7.4.50.20120703/gdb/linux-nat.c
+===================================================================
+--- gdb-7.4.50.20120703.orig/gdb/linux-nat.c   2012-07-03 17:46:55.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/linux-nat.c        2012-07-03 17:57:29.608734933 +0200
+@@ -180,6 +180,9 @@ blocked.  */
+ static struct target_ops *linux_ops;
+ static struct target_ops linux_ops_saved;
++/* PID of the inferior stopped by SIGSTOP before attaching (or zero).  */
++static pid_t pid_was_stopped;
++
+ /* The method to call, if any, when a new thread is attached.  */
+ static void (*linux_nat_new_thread) (struct lwp_info *);
+@@ -909,7 +912,14 @@ holding the child stopped.  Try \"set de
+         parent_inf->waiting_for_vfork_done = 0;
+       }
+       else if (detach_fork)
+-      target_detach (NULL, 0);
++      {
++        /* We should check PID_WAS_STOPPED and detach it stopped accordingly.
++           In this point of code it cannot be 1 as we would not get FORK
++           executed without CONTINUE first which resets PID_WAS_STOPPED.
++           We would have to first TARGET_STOP and WAITPID it as with running
++           inferior PTRACE_DETACH, SIGSTOP will ignore the signal.  */
++        target_detach (NULL, 0);
++      }
+       /* Note that the detach above makes PARENT_INF dangling.  */
+@@ -1377,6 +1387,7 @@ linux_nat_post_attach_wait (ptid_t ptid,
+       if (debug_linux_nat)
+       fprintf_unfiltered (gdb_stdlog,
+                           "LNPAW: Attaching to a stopped process\n");
++      pid_was_stopped = GET_PID (ptid);
+       /* The process is definitely stopped.  It is in a job control
+        stop, unless the kernel predates the TASK_STOPPED /
+@@ -1805,6 +1816,9 @@ get_pending_status (struct lwp_info *lp,
+                           gdb_signal_to_string (signo));
+     }
++  if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
++    *status = W_STOPCODE (SIGSTOP);
++
+   return 0;
+ }
+@@ -1918,6 +1932,8 @@ linux_nat_detach (struct target_ops *ops
+     }
+   else
+     linux_ops->to_detach (ops, args, from_tty);
++
++  pid_was_stopped = 0;
+ }
+ /* Resume LP.  */
+@@ -2104,6 +2120,14 @@ linux_nat_resume (struct target_ops *ops
+      linux_nat_resume_callback.  */
+   lp->stopped = 0;
++  /* At this point, we are going to resume the inferior and if we
++     have attached to a stopped process, we no longer should leave
++     it as stopped if the user detaches.  PTID variable has PID set to LWP
++     while we need to check the real PID here.  */
++
++  if (!step && lp && pid_was_stopped == GET_PID (lp->ptid))
++    pid_was_stopped = 0;
++
+   if (resume_many)
+     iterate_over_lwps (ptid, linux_nat_resume_callback, NULL);
+@@ -4129,6 +4153,8 @@ linux_nat_mourn_inferior (struct target_
+        there are other viable forks to debug.  Delete the exiting
+        one and context-switch to the first available.  */
+     linux_fork_mourn_inferior ();
++
++  pid_was_stopped = 0;
+ }
+ /* Convert a native/host siginfo object, into/from the siginfo in the
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/attach-stopped.exp
+===================================================================
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.threads/attach-stopped.exp      2012-06-26 21:23:20.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/attach-stopped.exp   2012-07-03 17:56:43.797790120 +0200
+@@ -61,7 +61,65 @@ proc corefunc { threadtype } {
+     gdb_reinitialize_dir $srcdir/$subdir
+     gdb_load ${binfile}
+-    # Verify that we can attach to the stopped process.
++    # Verify that we can attach to the process by first giving its
++    # executable name via the file command, and using attach with the
++    # process ID.
++
++    set test "$threadtype: set file, before attach1 to stopped process"
++    gdb_test_multiple "file $binfile" "$test" {
++       -re "Load new symbol table from.*y or n. $" {
++          gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
++                  "$test (re-read)"
++      }
++      -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
++          pass "$test"
++      }
++    }
++
++    set test "$threadtype: attach1 to stopped, after setting file"
++    gdb_test_multiple "attach $testpid" "$test" {
++      -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*$gdb_prompt $" {
++          pass "$test"
++      }
++    }
++
++    # ".*sleep.*clone.*" would fail on s390x as bt stops at START_THREAD there.
++    if {[string equal $threadtype threaded]} {
++      gdb_test "thread apply all bt" ".*sleep.*start_thread.*" "$threadtype: attach1 to stopped bt"
++    } else {
++      gdb_test "bt" ".*sleep.*main.*" "$threadtype: attach1 to stopped bt"
++    }
++
++    # Exit and detach the process.
++       
++    gdb_exit
++
++    # Avoid some race:
++    sleep 2
++
++    if [catch {open /proc/${testpid}/status r} fileid] {
++      set line2 "NOTFOUND"
++    } else {
++      gets $fileid line1;
++      gets $fileid line2;
++      close $fileid;
++    }
++
++    set test "$threadtype: attach1, exit leaves process stopped"
++    if {[string match "*(stopped)*" $line2]} {
++      pass $test
++    } else {
++      fail $test
++    }
++
++    # At this point, the process should still be stopped
++
++    gdb_start
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load ${binfile}
++
++    # Verify that we can attach to the process just by giving the
++    # process ID.
+        
+     set test "$threadtype: attach2 to stopped, after setting file"
+     gdb_test_multiple "attach $testpid" "$test" {
index b5eb514003fc33d8bf9434ef034c54f89c5b678c..51071f480476f262b6c9675b9177dbfc9e549db9 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
+Index: gdb-7.4.50.20120602/bfd/elf-bfd.h
 ===================================================================
---- gdb-7.2.50.20110320.orig/bfd/elf-bfd.h     2011-03-20 15:17:42.000000000 +0100
-+++ gdb-7.2.50.20110320/bfd/elf-bfd.h  2011-03-20 15:24:02.000000000 +0100
-@@ -2193,8 +2193,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
+--- gdb-7.4.50.20120602.orig/bfd/elf-bfd.h     2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/bfd/elf-bfd.h  2012-06-02 21:27:21.727689625 +0200
+@@ -2221,8 +2221,10 @@ extern Elf_Internal_Phdr * _bfd_elf_find
  /* Exported interface for writing elf corefile notes. */
  extern char *elfcore_write_note
    (bfd *, char *, int *, const char *, int, const void *, int);
@@ -14,17 +14,11 @@ Index: gdb-7.2.50.20110320/bfd/elf-bfd.h
  extern char *elfcore_write_prstatus
    (bfd *, char *, int *, long, int, const void *);
  extern char * elfcore_write_pstatus
-Index: gdb-7.2.50.20110320/bfd/elf.c
+Index: gdb-7.4.50.20120602/bfd/elf.c
 ===================================================================
---- gdb-7.2.50.20110320.orig/bfd/elf.c 2011-03-20 15:17:42.000000000 +0100
-+++ gdb-7.2.50.20110320/bfd/elf.c      2011-03-20 15:24:02.000000000 +0100
-@@ -8814,13 +8814,12 @@ elfcore_write_note (bfd *abfd,
-   return buf;
- }
--#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
-+#if defined (HAVE_PRPSINFO_T)
- char *
+--- gdb-7.4.50.20120602.orig/bfd/elf.c 2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/bfd/elf.c      2012-06-02 21:27:21.732689623 +0200
+@@ -8917,56 +8917,61 @@ char *
  elfcore_write_prpsinfo (bfd  *abfd,
                        char *buf,
                        int  *bufsiz,
@@ -32,9 +26,8 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 -                      const char *psargs)
 +                      const prpsinfo_t *input)
  {
-   const char *note_name = "CORE";
    const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-@@ -8828,48 +8827,55 @@ elfcore_write_prpsinfo (bfd  *abfd,
    if (bed->elf_backend_write_core_note != NULL)
      {
        char *ret;
@@ -52,7 +45,9 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
        return ret;
      }
  
+-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
 -#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
++#if defined (HAVE_PRPSINFO_T)
 +#if defined (HAVE_PRPSINFO32_T)
    if (bed->s->elfclass == ELFCLASS32)
      {
@@ -64,7 +59,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
        int note_type = NT_PRPSINFO;
 -#endif
  
-       memset (&data, 0, sizeof (data));
+-      memset (&data, 0, sizeof (data));
 -      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
 -      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
 +      data.pr_state = input->pr_state;
@@ -83,7 +78,7 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 +      BFD_ASSERT (sizeof (data.pr_psargs) == sizeof (input->pr_psargs));
 +      memcpy (data.pr_psargs, input->pr_psargs, sizeof (data.pr_psargs));
        return elfcore_write_note (abfd, buf, bufsiz,
-                                note_name, note_type, &data, sizeof (data));
+                                "CORE", note_type, &data, sizeof (data));
      }
    else
  #endif
@@ -100,21 +95,40 @@ Index: gdb-7.2.50.20110320/bfd/elf.c
 -      strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
 -      strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
        return elfcore_write_note (abfd, buf, bufsiz,
--                               note_name, note_type, &data, sizeof (data));
-+                               note_name, note_type, input, sizeof (*input));
+-                               "CORE", note_type, &data, sizeof (data));
++                               "CORE", note_type, input, sizeof (*input));
      }
- }
 -#endif        /* PSINFO_T or PRPSINFO_T */
 +#endif        /* PRPSINFO_T */
  
- #if defined (HAVE_PRSTATUS_T)
- char *
-Index: gdb-7.2.50.20110320/gdb/linux-nat.c
+   free (buf);
+   return NULL;
+Index: gdb-7.4.50.20120602/gdb/procfs.c
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/procfs.c      2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/gdb/procfs.c   2012-06-02 21:27:21.745689618 +0200
+@@ -5541,6 +5541,7 @@ procfs_make_note_section (bfd *obfd, int
+   note_data = (char *) elfcore_write_prpsinfo (obfd,
+                                              note_data,
+                                              note_size,
++                                             NULL,
+                                              fname,
+                                              psargs);
+Index: gdb-7.4.50.20120602/gdb/linux-tdep.c
 ===================================================================
---- gdb-7.2.50.20110320.orig/gdb/linux-nat.c   2011-03-20 15:17:46.000000000 +0100
-+++ gdb-7.2.50.20110320/gdb/linux-nat.c        2011-03-20 15:25:36.000000000 +0100
-@@ -4603,6 +4603,131 @@ linux_spu_make_corefile_notes (bfd *obfd
-   return args.note_data;
+--- gdb-7.4.50.20120602.orig/gdb/linux-tdep.c  2012-06-02 21:26:09.928717069 +0200
++++ gdb-7.4.50.20120602/gdb/linux-tdep.c       2012-06-02 21:31:12.051601510 +0200
+@@ -30,6 +30,7 @@
+ #include "elf-bfd.h"            /* for elfcore_write_* */
+ #include "inferior.h"
+ #include "cli/cli-utils.h"
++#include <sys/procfs.h>
+ #include <ctype.h>
+@@ -769,6 +770,131 @@ linux_corefile_thread_callback (struct t
+   return !args->note_data;
  }
  
 +/* Should be always true for Linux */
@@ -245,45 +259,22 @@ Index: gdb-7.2.50.20110320/gdb/linux-nat.c
  /* Fills the "to_make_corefile_note" target vector.  Builds the note
     section for a corefile, and returns it in a malloc buffer.  */
  
-@@ -4621,26 +4746,11 @@ linux_nat_make_corefile_notes (bfd *obfd
+@@ -784,16 +910,9 @@ linux_make_corefile_notes (struct gdbarc
+   /* Process information.  */
    if (get_exec_file (0))
      {
--      strncpy (fname, lbasename (get_exec_file (0)), sizeof (fname));
--      strncpy (psargs, get_exec_file (0), sizeof (psargs));
--      if (get_inferior_args ())
--      {
--        char *string_end;
--        char *psargs_end = psargs + sizeof (psargs);
--
--        /* linux_elfcore_write_prpsinfo () handles zero unterminated
--           strings fine.  */
--        string_end = memchr (psargs, 0, sizeof (psargs));
--        if (string_end != NULL)
--          {
--            *string_end++ = ' ';
--            strncpy (string_end, get_inferior_args (),
--                     psargs_end - string_end);
--          }
--      }
+-      const char *fname = lbasename (get_exec_file (0));
+-      char *psargs = xstrdup (fname);
 +      const prpsinfo_t *data = fill_prpsinfo ();
-+
-       note_data = (char *) elfcore_write_prpsinfo (obfd,
-                                                  note_data,
--                                                 note_size, fname, psargs);
-+                                                 note_size, data);
-     }
  
-   /* Dump information for threads.  */
-Index: gdb-7.2.50.20110320/gdb/procfs.c
-===================================================================
---- gdb-7.2.50.20110320.orig/gdb/procfs.c      2011-03-09 13:48:55.000000000 +0100
-+++ gdb-7.2.50.20110320/gdb/procfs.c   2011-03-20 15:24:02.000000000 +0100
-@@ -5752,6 +5752,7 @@ procfs_make_note_section (bfd *obfd, int
-   note_data = (char *) elfcore_write_prpsinfo (obfd,
-                                              note_data,
-                                              note_size,
-+                                             NULL,
-                                              fname,
-                                              psargs);
+-      if (get_inferior_args ())
+-        psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
+-                         (char *) NULL);
+-
+-      note_data = elfcore_write_prpsinfo (obfd, note_data, note_size,
+-                                          fname, psargs);
+-      xfree (psargs);
++      note_data = elfcore_write_prpsinfo (obfd, note_data, note_size, data);
  
+       if (!note_data)
+       return NULL;
diff --git a/gdb-6.8-fortran-tag-constant.patch b/gdb-6.8-fortran-tag-constant.patch
deleted file mode 100644 (file)
index 3283984..0000000
+++ /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-6.8-gcc35998-ada-memory-trash.patch b/gdb-6.8-gcc35998-ada-memory-trash.patch
deleted file mode 100644 (file)
index 1142cc9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- ./gdb/dwarf2read.c 4 May 2008 17:27:01 -0000       1.260
-+++ ./gdb/dwarf2read.c 4 May 2008 18:26:20 -0000
-@@ -6754,7 +6754,14 @@ dwarf2_attr (struct die_info *die, unsig
-   for (i = 0; i < die->num_attrs; ++i)
-     {
-       if (die->attrs[i].name == name)
--      return &die->attrs[i];
-+        {
-+        /* GCC PR ada/35998 workaround.  */
-+        if (name == DW_AT_byte_size
-+            && DW_UNSND (&die->attrs[i]) == 0xffffffff)
-+          return NULL;
-+
-+        return &die->attrs[i];
-+      }
-       if (die->attrs[i].name == DW_AT_specification
-         || die->attrs[i].name == DW_AT_abstract_origin)
-       spec = &die->attrs[i];
diff --git a/gdb-6.8-glibc-headers-compat.patch b/gdb-6.8-glibc-headers-compat.patch
deleted file mode 100644 (file)
index 39b3b31..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-../../libiberty/strsignal.c:552: error: conflicting types for 'psignal'
-/usr/include/signal.h:141: error: previous declaration of 'psignal' was here
-
---- gdb-6.8/libiberty/strsignal.c-orig 2007-01-31 00:13:04.000000000 +0100
-+++ gdb-6.8/libiberty/strsignal.c      2008-06-17 16:30:13.000000000 +0200
-@@ -549,7 +549,7 @@ followed by a newline.
- #ifndef HAVE_PSIGNAL
- void
--psignal (int signo, char *message)
-+psignal (int signo, const char *message)
- {
-   if (signal_names == NULL)
-     {
index b011658294bcd5a7b067b9a2c0223d75f7cf42a7..becf80e4c070d068ea84ecf906a01a297c981728 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
+Index: gdb-7.4.50.20120703/gdb/gdb_bfd.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c  2011-07-22 19:37:15.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/dwarf2read.c       2011-07-22 19:44:42.000000000 +0200
-@@ -67,12 +67,14 @@
+--- gdb-7.4.50.20120703.orig/gdb/gdb_bfd.c     2012-07-03 17:30:07.356754655 +0200
++++ gdb-7.4.50.20120703/gdb/gdb_bfd.c  2012-07-03 17:43:52.565762454 +0200
+@@ -26,12 +26,14 @@
  #ifdef HAVE_ZLIB_H
  #include <zlib.h>
  #endif
@@ -15,37 +15,37 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
  #endif
 +#endif
  
- typedef struct symbol *symbolp;
- DEF_VEC_P (symbolp);
-@@ -1618,6 +1620,7 @@ dwarf2_read_section (struct objfile *obj
-         }
-     }
+ /* An object of this type is stored in the section's user data when
+    mapping a section.  */
+@@ -181,6 +183,7 @@ free_one_bfd_section (bfd *abfd, asectio
  
+   if (sect != NULL && sect->data != NULL)
+     {
 +#ifndef __sparc__
  #ifdef HAVE_MMAP
-   if (pagesize == 0)
-     pagesize = getpagesize ();
-@@ -1641,6 +1644,7 @@ dwarf2_read_section (struct objfile *obj
+       if (sect->map_addr != NULL)
+       {
+@@ -191,6 +194,7 @@ free_one_bfd_section (bfd *abfd, asectio
        }
-     }
+       else
  #endif
 +#endif
+       xfree (sect->data);
+     }
+ }
+@@ -425,6 +429,7 @@ gdb_bfd_map_section (asection *sectp, bf
+         }
+     }
  
-   /* If we get here, we are a normal, not-compressed section.  */
-   info->buffer = buf
-@@ -15983,6 +15987,7 @@ munmap_section_buffer (struct dwarf2_sec
- {
-   if (info->map_addr != NULL)
-     {
 +#ifndef __sparc__
  #ifdef HAVE_MMAP
-       int res;
-@@ -15992,6 +15997,7 @@ munmap_section_buffer (struct dwarf2_sec
-       /* Without HAVE_MMAP, we should never be here to begin with.  */
-       gdb_assert_not_reached ("no mmap support");
- #endif
+   {
+     /* The page size, used when mmapping.  */
+@@ -458,6 +463,7 @@ gdb_bfd_map_section (asection *sectp, bf
+       }
+   }
+ #endif /* HAVE_MMAP */
 +#endif
-     }
- }
+   /* If we get here, we are a normal, not-compressed section.  */
  
diff --git a/gdb-archer-ada.patch b/gdb-archer-ada.patch
deleted file mode 100644 (file)
index 128112b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Keith Seitz <keiths@redhat.com>
-Message-ID: <4B7F207A.7020102@redhat.com>
-
-[ read_partial_die part dropped in the port to Rawhide ]
-
---- gdb-7.0.1-orig/gdb/dwarf2read.c    2010-02-20 01:06:44.000000000 +0100
-+++ gdb-7.0.1/gdb/dwarf2read.c 2010-02-20 01:08:28.000000000 +0100
-@@ -9924,9 +9928,13 @@ dwarf2_canonicalize_name (char *name, st
- static char *
- dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
- {
--  struct attribute *attr;
-+  struct attribute *attr = NULL;
-+
-+  if (cu->language == language_ada)
-+    attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
--  attr = dwarf2_attr (die, DW_AT_name, cu);
-+  if (!attr)
-+    attr = dwarf2_attr (die, DW_AT_name, cu);
-   if (!attr || !DW_STRING (attr))
-     return NULL;
index 83aa8daf0376aaff6d6f7fe39fb56f564a9b65f5..41b9b46b1ea97e895cab071108d6561dc7f4355a 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.4.50.20120103/gdb/breakpoint.c
+Index: gdb-7.4.50.20120602/gdb/breakpoint.c
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/breakpoint.c  2012-01-03 05:52:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/breakpoint.c       2012-01-03 15:22:56.105405559 +0100
-@@ -13724,6 +13724,50 @@ initialize_breakpoint_ops (void)
+--- gdb-7.4.50.20120602.orig/gdb/breakpoint.c  2012-06-02 19:11:54.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/breakpoint.c       2012-06-02 19:52:58.161226506 +0200
+@@ -15495,6 +15495,50 @@ initialize_breakpoint_ops (void)
  }
  
  void
@@ -53,23 +53,23 @@ Index: gdb-7.4.50.20120103/gdb/breakpoint.c
  _initialize_breakpoint (void)
  {
    struct cmd_list_element *c;
-Index: gdb-7.4.50.20120103/gdb/breakpoint.h
+Index: gdb-7.4.50.20120602/gdb/breakpoint.h
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/breakpoint.h  2012-01-03 05:52:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/breakpoint.h       2012-01-03 15:23:09.444356484 +0100
-@@ -1393,4 +1393,7 @@ extern struct gdbarch *get_sal_arch (str
+--- gdb-7.4.50.20120602.orig/gdb/breakpoint.h  2012-05-16 16:35:03.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/breakpoint.h       2012-06-02 19:53:09.268223263 +0200
+@@ -1503,4 +1503,7 @@ extern struct gdbarch *get_sal_arch (str
  
- extern void modify_semaphore (struct bp_location *location, int set);
+ extern void handle_solib_event (void);
  
 +extern void breakpoints_relocate (struct objfile *objfile,
 +                                struct section_offsets *delta);
 +
  #endif /* !defined (BREAKPOINT_H) */
-Index: gdb-7.4.50.20120103/gdb/objfiles.c
+Index: gdb-7.4.50.20120602/gdb/objfiles.c
 ===================================================================
---- gdb-7.4.50.20120103.orig/gdb/objfiles.c    2012-01-03 05:52:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/objfiles.c 2012-01-03 15:23:28.141287697 +0100
-@@ -818,6 +818,11 @@ objfile_relocate1 (struct objfile *objfi
+--- gdb-7.4.50.20120602.orig/gdb/objfiles.c    2012-05-10 21:50:08.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/objfiles.c 2012-06-02 19:52:58.202226502 +0200
+@@ -802,6 +802,11 @@ objfile_relocate1 (struct objfile *objfi
      objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
                                                    new_offsets, delta);
  
index b18a06023b5076edeabbc07531afbaf5d06e9c2e..f8119643ba732419d261d2806f307eddf1bb4a2c 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
+Index: gdb-7.4.50.20120602/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/dwarf2read.c  2011-12-19 01:31:24.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/dwarf2read.c       2011-12-19 01:33:25.263238972 +0100
-@@ -8347,7 +8347,12 @@ read_common_block (struct die_info *die,
+--- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c  2012-06-02 19:14:38.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/dwarf2read.c       2012-06-02 19:51:29.977252338 +0200
+@@ -9746,7 +9746,12 @@ read_common_block (struct die_info *die,
  {
    struct attribute *attr;
    struct symbol *sym;
@@ -16,7 +16,7 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
  
    attr = dwarf2_attr (die, DW_AT_location, cu);
    if (attr)
-@@ -8356,6 +8361,7 @@ read_common_block (struct die_info *die,
+@@ -9755,6 +9760,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.4.50.20111218/gdb/dwarf2read.c
          }
        else if (attr_form_is_section_offset (attr))
          {
-@@ -8408,12 +8414,15 @@ read_common_block (struct die_info *die,
+@@ -9807,12 +9813,15 @@ read_common_block (struct die_info *die,
          if (sym != NULL
              && handle_data_member_location (child_die, cu, &offset))
            {
@@ -42,7 +42,7 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
          else
            SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
          FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
-@@ -8427,7 +8436,7 @@ read_common_block (struct die_info *die,
+@@ -9826,7 +9835,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,19 +51,19 @@ Index: gdb-7.4.50.20111218/gdb/dwarf2read.c
  
        set_die_type (die, type, cu);
      }
-Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
+Index: gdb-7.4.50.20120602/gdb/gdbtypes.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/gdbtypes.h    2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/gdbtypes.h 2011-12-19 01:34:21.448025620 +0100
-@@ -396,6 +396,7 @@ enum type_instance_flag_value
- enum field_loc_kind
+--- gdb-7.4.50.20120602.orig/gdb/gdbtypes.h    2012-06-02 19:11:54.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/gdbtypes.h 2012-06-02 19:52:44.990230200 +0200
+@@ -401,6 +401,7 @@ enum field_loc_kind
    {
      FIELD_LOC_KIND_BITPOS,    /* bitpos */
+     FIELD_LOC_KIND_ENUMVAL,   /* enumval */
 +    /* This address is unrelocated by the objfile's ANOFFSET.  */
      FIELD_LOC_KIND_PHYSADDR,  /* physaddr */
      FIELD_LOC_KIND_PHYSNAME,  /* physname */
      FIELD_LOC_KIND_DWARF_BLOCK        /* dwarf_block */
-@@ -581,6 +582,7 @@ struct main_type
+@@ -595,6 +596,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,15 +71,15 @@ Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
        CORE_ADDR physaddr;
        const char *physname;
  
-@@ -1194,6 +1196,7 @@ extern void allocate_gnat_aux_type (stru
- #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
- #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+@@ -1200,6 +1202,7 @@ extern void allocate_gnat_aux_type (stru
+ #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval)
+ #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0)
  #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
 +/* This address is unrelocated by the objfile's ANOFFSET.  */
  #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
  #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
  #define SET_FIELD_BITPOS(thisfld, bitpos)                     \
-@@ -1202,6 +1205,7 @@ extern void allocate_gnat_aux_type (stru
+@@ -1211,6 +1214,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,19 +87,19 @@ Index: gdb-7.4.50.20111218/gdb/gdbtypes.h
  #define SET_FIELD_PHYSADDR(thisfld, addr)                     \
    (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,                \
     FIELD_STATIC_PHYSADDR (thisfld) = (addr))
-@@ -1217,6 +1221,7 @@ extern void allocate_gnat_aux_type (stru
- #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
+@@ -1227,6 +1231,7 @@ extern void allocate_gnat_aux_type (stru
  #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
 +/* This address is unrelocated by the objfile's ANOFFSET.  */
  #define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
  #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
-Index: gdb-7.4.50.20111218/gdb/jv-lang.c
+Index: gdb-7.4.50.20120602/gdb/jv-lang.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/jv-lang.c     2011-12-06 19:54:39.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/jv-lang.c  2011-12-19 01:33:25.280238908 +0100
-@@ -430,7 +430,8 @@ java_link_class_type (struct gdbarch *gd
+--- gdb-7.4.50.20120602.orig/gdb/jv-lang.c     2012-05-10 21:59:12.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/jv-lang.c  2012-06-02 19:51:53.286245280 +0200
+@@ -431,7 +431,8 @@ java_link_class_type (struct gdbarch *gd
  
    fields = NULL;
    nfields--;                  /* First set up dummy "class" field.  */
@@ -109,7 +109,7 @@ Index: gdb-7.4.50.20111218/gdb/jv-lang.c
    TYPE_FIELD_NAME (type, nfields) = "class";
    TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
    SET_TYPE_FIELD_PRIVATE (type, nfields);
-@@ -478,7 +479,8 @@ java_link_class_type (struct gdbarch *gd
+@@ -479,7 +480,8 @@ java_link_class_type (struct gdbarch *gd
          SET_TYPE_FIELD_PROTECTED (type, i);
        }
        if (accflags & 0x0008)  /* ACC_STATIC */
@@ -117,13 +117,13 @@ Index: gdb-7.4.50.20111218/gdb/jv-lang.c
 +      SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
 +        - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
        else
-       TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
+       SET_FIELD_BITPOS (TYPE_FIELD (type, i), 8 * boffset);
        if (accflags & 0x8000)  /* FIELD_UNRESOLVED_FLAG */
-Index: gdb-7.4.50.20111218/gdb/value.c
+Index: gdb-7.4.50.20120602/gdb/value.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/value.c       2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/value.c    2011-12-19 01:33:25.283238896 +0100
-@@ -2481,7 +2481,8 @@ value_static_field (struct type *type, i
+--- gdb-7.4.50.20120602.orig/gdb/value.c       2012-06-02 19:11:55.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/value.c    2012-06-02 19:51:30.031252317 +0200
+@@ -2592,7 +2592,8 @@ value_static_field (struct type *type, i
      {
      case FIELD_LOC_KIND_PHYSADDR:
        retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
diff --git a/gdb-archer-vla-rhel5gcc.patch b/gdb-archer-vla-rhel5gcc.patch
deleted file mode 100644 (file)
index f64957b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-commit a999ae2c722b366b94987941f0ce899f95e8d679
-Author: Jan Kratochvil <jan.kratochvil@redhat.com>
-Date:   Fri Mar 2 22:08:49 2012 +0100
-
-    Fix crash for gdb.fortran/dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64.
-
---- a/gdb/valops.c
-+++ b/gdb/valops.c
-@@ -1037,7 +1037,8 @@ int
- value_fetch_lazy (struct value *val)
- {
-   gdb_assert (value_lazy (val));
--  allocate_value_contents (val);
-+  if (VALUE_LVAL (val) != lval_memory)
-+    allocate_value_contents (val);
-   if (value_bitsize (val))
-     {
-       /* To read a lazy bitfield, read the entire enclosing value.  This
-@@ -1080,11 +1081,15 @@ value_fetch_lazy (struct value *val)
-         if (length)
-           {
-+            /* Delay it after object_address_get_data above.  */
-+            allocate_value_contents (val);
-             addr += value_offset (val);
-             read_value_memory (val, 0, value_stack (val),
-                                addr, value_contents_all_raw (val), length);
-           }
-       }
-+      /* Just to be sure it has been called.  */
-+      allocate_value_contents (val);
-     }
-   else if (VALUE_LVAL (val) == lval_register)
-     {
index 5e9b168770ccee379ea36157df04b7b3e4b56326..80e3cf283bfeb63ec7444d6ddf79da36bba5273f 100644 (file)
@@ -2,49 +2,46 @@ http://sourceware.org/gdb/wiki/ProjectArcher
 http://sourceware.org/gdb/wiki/ArcherBranchManagement
 
 GIT snapshot:
-commit 9f8d47f059091333d178bd249507fd25676860e7
+commit 897686c0aedb7a6da59b823f22b1d24ec5a1d2ba
 
 branch `archer' - the merge of branches:
 archer-jankratochvil-vla
-archer-jankratochvil-watchpoint3
 archer-tromey-python
-archer-sergiodj-stap
+archer-tromey-dwz-multifile-rebase (but from post-7.5 FSF GDB commits)
 
 
 diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index 38c93c9..3acacdb 100644
+index a41cff9..d7786a6 100644
 --- a/gdb/Makefile.in
 +++ b/gdb/Makefile.in
-@@ -720,8 +720,8 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
-       sentinel-frame.c \
-       serial.c ser-base.c ser-unix.c skip.c \
-       solib.c solib-target.c source.c \
--      stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \
--      symtab.c \
-+      stabsread.c stack.c stap-probe.c std-regs.c \
-+      symfile.c symfile-mem.c symmisc.c symtab.c \
-       target.c target-descriptions.c target-memory.c \
-       thread.c top.c tracepoint.c \
-       trad-frame.c \
-@@ -817,7 +817,7 @@ osdata.h procfs.h python/py-event.h python/py-events.h python/py-stopevent.h \
- python/python-internal.h python/python.h ravenscar-thread.h record.h \
- solib-darwin.h solib-ia64-hpux.h solib-spu.h windows-nat.h xcoffread.h \
- gnulib/extra/arg-nonnull.h gnulib/extra/c++defs.h gnulib/extra/warn-on-use.h \
--gnulib/stddef.in.h inline-frame.h skip.h \
-+gnulib/stddef.in.h inline-frame.h skip.h stap-probe.h \
+@@ -704,7 +704,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \
+       exceptions.c expprint.c \
+       f-exp.y f-lang.c f-typeprint.c f-valprint.c filesystem.c \
+       findcmd.c findvar.c frame.c frame-base.c frame-unwind.c \
+-      gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
++      gdbarch.c arch-utils.c gdb_bfd.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
+       go-exp.y go-lang.c go-typeprint.c go-valprint.c \
+       inf-loop.c \
+       infcall.c \
+@@ -829,7 +829,7 @@ gnulib/import/extra/snippet/warn-on-use.h \
+ gnulib/import/stddef.in.h gnulib/import/inttypes.in.h inline-frame.h skip.h \
  common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \
- common/linux-osdata.h gdb-dlfcn.h
-@@ -905,7 +905,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
-       xml-support.o xml-syscall.o xml-utils.o \
-       target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o \
-       inferior.o osdata.o gdb_usleep.o record.o gcore.o \
--      jit.o progspace.o skip.o \
-+      jit.o progspace.o skip.o stap-probe.o \
-       common-utils.o buffer.o ptid.o gdb-dlfcn.o
- TSOBS = inflow.o
-@@ -1293,6 +1293,12 @@ stamp-h: $(srcdir)/config.in config.status
+ common/format.h \
+-common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h
++common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h gdb_bfd.h
+ # Header files that already have srcdir in them, or which are in objdir.
+@@ -879,7 +879,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
+       macrotab.o macrocmd.o macroexp.o macroscope.o \
+       mi-common.o \
+       event-loop.o event-top.o inf-loop.o completer.o \
+-      gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o \
++      gdbarch.o arch-utils.o gdbtypes.o gdb_bfd.o osabi.o copying.o \
+       memattr.o mem-break.o target.o parse.o language.o buildsym.o \
+       findcmd.o \
+       std-regs.o \
+@@ -1307,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status
          CONFIG_LINKS= \
          $(SHELL) config.status
  
@@ -58,25 +55,28 @@ index 38c93c9..3acacdb 100644
        $(SHELL) config.status --recheck
  
 diff --git a/gdb/NEWS b/gdb/NEWS
-index 128825e..13dd88c 100644
+index b281824..4da886c 100644
 --- a/gdb/NEWS
 +++ b/gdb/NEWS
-@@ -328,6 +328,10 @@ Renesas RL78                              rl78-*-elf
-   Initial support for the OpenCL C language (http://www.khronos.org/opencl)
-   has been integrated into GDB.
+@@ -1,6 +1,13 @@
+               What has changed in GDB?
+            (Organized release by release)
  
-+* GDB now has support for SystemTap <sys/sdt.h> probes.  You can set a
-+  breakpoint using the new "probe:" linespec and inspect the probe
-+  arguments using the new $_probe_arg family of convenience variables.
++*** Changes since GDB 7.5
 +
- * Python scripting
++* New commands (for set/show, see "New options" below)
++
++maint info bfds
++  List the BFDs known to GDB.
++
+ *** Changes in GDB 7.5
  
-   ** The function gdb.Write now accepts an optional keyword 'stream'.
+ * GDB now supports x32 ABI.  Visit <http://sites.google.com/site/x32abi/>
 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
-index 29956d7..dc1fadd 100644
+index aa090af..e672731 100644
 --- a/gdb/ada-lang.c
 +++ b/gdb/ada-lang.c
-@@ -11896,6 +11896,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp,
+@@ -12037,6 +12037,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp,
  
  static int
  ada_operator_check (struct expression *exp, int pos,
@@ -84,7 +84,7 @@ index 29956d7..dc1fadd 100644
                    int (*objfile_func) (struct objfile *objfile, void *data),
                    void *data)
  {
-@@ -11910,12 +11911,15 @@ ada_operator_check (struct expression *exp, int pos,
+@@ -12051,12 +12052,15 @@ ada_operator_check (struct expression *exp, int pos,
        break;
  
        default:
@@ -102,313 +102,59 @@ index 29956d7..dc1fadd 100644
        && (*objfile_func) (TYPE_OBJFILE (type), data))
      return 1;
  
-diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
-index a0bdbd7..98760bf 100644
---- a/gdb/amd64-linux-nat.c
-+++ b/gdb/amd64-linux-nat.c
-@@ -336,8 +336,8 @@ amd64_linux_dr_get_status (void)
-   return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
- }
--/* Callback for iterate_over_lwps.  Update the debug registers of
--   LWP.  */
-+/* Callback for linux_nat_iterate_watchpoint_lwps.  Update the debug registers
-+   of LWP.  */
- static int
- update_debug_registers_callback (struct lwp_info *lwp, void *arg)
-@@ -363,9 +363,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg)
- static void
- amd64_linux_dr_set_control (unsigned long control)
- {
--  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
--
--  iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
-+  linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL);
- }
- /* Set address REGNUM (zero based) to ADDR in all LWPs of the current
-@@ -378,7 +376,7 @@ amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
-   gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
--  iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
-+  linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL);
- }
- /* Called when resuming a thread.
-@@ -400,6 +398,13 @@ amd64_linux_prepare_to_resume (struct lwp_info *lwp)
-       struct i386_debug_reg_state *state = i386_debug_reg_state ();
-       int i;
-+      /* On Linux kernel before 2.6.33 commit
-+       72f674d203cd230426437cdcf7dd6f681dad8b0d
-+       if you enable a breakpoint by the DR_CONTROL bits you need to have
-+       already written the corresponding DR_FIRSTADDR...DR_LASTADDR registers.
-+
-+       Ensure DR_CONTROL gets written as the very last register here.  */
-+
-       for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
-       if (state->dr_ref_count[i] > 0)
-         {
-diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
-index ca9ade6..c30185d 100644
---- a/gdb/amd64-linux-tdep.c
-+++ b/gdb/amd64-linux-tdep.c
-@@ -1362,6 +1362,15 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-   set_gdbarch_process_record (gdbarch, i386_process_record);
-   set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal);
-+  /* SystemTap variables and functions.  */
-+  set_gdbarch_stap_integer_prefix (gdbarch, "$");
-+  set_gdbarch_stap_register_prefix (gdbarch, "%");
-+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
-+  set_gdbarch_stap_register_indirection_sufix (gdbarch, ")");
-+  set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand);
-+  set_gdbarch_stap_parse_special_token (gdbarch,
-+                                      i386_stap_parse_special_token);
-+
-   /* Initialize the amd64_linux_record_tdep.  */
-   /* These values are the size of the type that will be used in a system
-      call.  They are obtained from Linux Kernel source.  */
-diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
-index ac4860c..d710682 100644
---- a/gdb/arm-linux-tdep.c
-+++ b/gdb/arm-linux-tdep.c
-@@ -43,6 +43,12 @@
- #include "gdbthread.h"
- #include "symfile.h"
-+#include "cli/cli-utils.h"
-+#include "stap-probe.h"
-+#include "parser-defs.h"
-+#include "user-regs.h"
-+#include <ctype.h>
-+
- #include "gdb_string.h"
- /* This is defined in <elf.h> on ARM GNU/Linux systems.  */
-@@ -1053,6 +1059,122 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
-   return dsc;
- }
-+static int
-+arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
-+{
-+  return (*s == '#' /* Literal number.  */
-+        || *s == '[' /* Register indirection or
-+                        displacement.  */
-+        || isalpha (*s)); /* Register value.  */
-+}
-+
-+/* This routine is used to parse a special token in ARM's assembly.
-+
-+   The special tokens parsed by it are:
-+
-+      - Register displacement (e.g, [fp, #-8])
-+
-+   It returns one if the special token has been parsed successfully,
-+   or zero if the current token is not considered special.  */
-+
-+static int
-+arm_stap_parse_special_token (struct gdbarch *gdbarch,
-+                            struct stap_parse_info *p)
-+{
-+  if (*p->arg == '[')
-+    {
-+      /* Temporary holder for lookahead.  */
-+      const char *tmp = p->arg;
-+      /* Used to save the register name.  */
-+      const char *start;
-+      char *regname;
-+      int len, offset;
-+      int got_minus = 0;
-+      long displacement;
-+      struct stoken str;
-+
-+      ++tmp;
-+      start = tmp;
-+
-+      /* Register name.  */
-+      while (isalnum (*tmp))
-+      ++tmp;
-+
-+      if (*tmp != ',')
-+      return 0;
-+
-+      len = tmp - start;
-+      regname = alloca (len + 2);
-+
-+      offset = 0;
-+      if (isdigit (*start))
-+      {
-+        /* If we are dealing with a register whose name begins with a
-+           digit, it means we should prefix the name with the letter
-+           `r', because GDB expects this name pattern.  Otherwise (e.g.,
-+           we are dealing with the register `fp'), we don't need to
-+           add such a prefix.  */
-+        regname[0] = 'r';
-+        offset = 1;
-+      }
-+
-+      strncpy (regname + offset, start, len);
-+      len += offset;
-+      regname[len] = '\0';
-+
-+      if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
-+      error (_("Invalid register name `%s' on expression `%s'."),
-+             regname, p->saved_arg);
-+
-+      ++tmp;
-+      tmp = skip_spaces_const (tmp);
-+      if (*tmp++ != '#')
-+      return 0;
-+
-+      if (*tmp == '-')
-+      {
-+        ++tmp;
-+        got_minus = 1;
-+      }
-+
-+      displacement = strtol (tmp, (char **) &tmp, 10);
-+
-+      /* Skipping last `]'.  */
-+      if (*tmp++ != ']')
-+      return 0;
-+
-+      /* The displacement.  */
-+      write_exp_elt_opcode (OP_LONG);
-+      write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
-+      write_exp_elt_longcst (displacement);
-+      write_exp_elt_opcode (OP_LONG);
-+      if (got_minus)
-+      write_exp_elt_opcode (UNOP_NEG);
-+
-+      /* The register name.  */
-+      write_exp_elt_opcode (OP_REGISTER);
-+      str.ptr = regname;
-+      str.length = len;
-+      write_exp_string (str);
-+      write_exp_elt_opcode (OP_REGISTER);
-+
-+      write_exp_elt_opcode (BINOP_ADD);
-+
-+      /* Casting to the expected type.  */
-+      write_exp_elt_opcode (UNOP_CAST);
-+      write_exp_elt_type (lookup_pointer_type (p->arg_type));
-+      write_exp_elt_opcode (UNOP_CAST);
-+
-+      write_exp_elt_opcode (UNOP_IND);
-+
-+      p->arg = tmp;
-+    }
-+  else
-+    return 0;
-+
-+  return 1;
-+}
-+
- static void
- arm_linux_init_abi (struct gdbarch_info info,
-                   struct gdbarch *gdbarch)
-@@ -1152,6 +1274,15 @@ arm_linux_init_abi (struct gdbarch_info info,
-                                          simple_displaced_step_free_closure);
-   set_gdbarch_displaced_step_location (gdbarch, displaced_step_at_entry_point);
-+  /* SystemTap functions.  */
-+  set_gdbarch_stap_integer_prefix (gdbarch, "#");
-+  set_gdbarch_stap_register_prefix (gdbarch, "r");
-+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "[");
-+  set_gdbarch_stap_register_indirection_sufix (gdbarch, "]");
-+  set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
-+  set_gdbarch_stap_is_single_operand (gdbarch, arm_stap_is_single_operand);
-+  set_gdbarch_stap_parse_special_token (gdbarch,
-+                                      arm_stap_parse_special_token);
-   tdep->syscall_next_pc = arm_linux_syscall_next_pc;
- }
-diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
-index 31e91b9..4518f6b 100644
---- a/gdb/ax-gdb.c
-+++ b/gdb/ax-gdb.c
-@@ -95,8 +95,6 @@ static void gen_int_literal (struct agent_expr *ax,
-                            struct axs_value *value,
-                            LONGEST k, struct type *type);
+diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
+index 6728800..455d3e6 100644
+--- a/gdb/bfd-target.c
++++ b/gdb/bfd-target.c
+@@ -21,6 +21,7 @@
+ #include "target.h"
+ #include "bfd-target.h"
+ #include "exec.h"
++#include "gdb_bfd.h"
  
--
--static void require_rvalue (struct agent_expr *ax, struct axs_value *value);
- static void gen_usual_unary (struct expression *exp, struct agent_expr *ax,
-                            struct axs_value *value);
- static int type_wider_than (struct type *type1, struct type *type2);
-@@ -157,8 +155,6 @@ static void gen_repeat (struct expression *exp, union exp_element **pc,
- static void gen_sizeof (struct expression *exp, union exp_element **pc,
-                       struct agent_expr *ax, struct axs_value *value,
-                       struct type *size_type);
--static void gen_expr (struct expression *exp, union exp_element **pc,
--                    struct agent_expr *ax, struct axs_value *value);
- static void gen_expr_binop_rest (struct expression *exp,
-                                enum exp_opcode op, union exp_element **pc,
-                                struct agent_expr *ax,
-@@ -789,7 +785,7 @@ gen_int_literal (struct agent_expr *ax, struct axs_value *value, LONGEST k,
- /* Take what's on the top of the stack (as described by VALUE), and
-    try to make an rvalue out of it.  Signal an error if we can't do
-    that.  */
--static void
-+void
- require_rvalue (struct agent_expr *ax, struct axs_value *value)
- {
-   /* Only deal with scalars, structs and such may be too large
-@@ -1807,7 +1803,7 @@ gen_sizeof (struct expression *exp, union exp_element **pc,
- /* XXX: i18n */
- /* A gen_expr function written by a Gen-X'er guy.
-    Append code for the subexpression of EXPR starting at *POS_P to AX.  */
--static void
-+void
- gen_expr (struct expression *exp, union exp_element **pc,
-         struct agent_expr *ax, struct axs_value *value)
+ /* The object that is stored in the target_ops->to_data field has this
+    type.  */
+@@ -70,7 +71,7 @@ target_bfd_xclose (struct target_ops *t, int quitting)
  {
-@@ -2042,7 +2038,8 @@ gen_expr (struct expression *exp, union exp_element **pc,
-     case OP_INTERNALVAR:
-       {
--      const char *name = internalvar_name ((*pc)[1].internalvar);
-+      struct internalvar *var = (*pc)[1].internalvar;
-+      const char *name = internalvar_name (var);
-       struct trace_state_variable *tsv;
-       (*pc) += 3;
-@@ -2056,7 +2053,7 @@ gen_expr (struct expression *exp, union exp_element **pc,
-           value->kind = axs_rvalue;
-           value->type = builtin_type (exp->gdbarch)->builtin_long_long;
-         }
--      else
-+      else if (! compile_internalvar_to_ax (var, ax, value))
-         error (_("$%s is not a trace state variable; GDB agent "
-                  "expressions cannot use convenience variables."), name);
-       }
-diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h
-index 48c35a4..09f6889 100644
---- a/gdb/ax-gdb.h
-+++ b/gdb/ax-gdb.h
-@@ -110,6 +110,11 @@ extern struct agent_expr *gen_trace_for_return_address (CORE_ADDR,
- extern struct agent_expr *gen_eval_for_expr (CORE_ADDR, struct expression *);
-+extern void gen_expr (struct expression *exp, union exp_element **pc,
-+                    struct agent_expr *ax, struct axs_value *value);
-+
-+extern void require_rvalue (struct agent_expr *ax, struct axs_value *value);
-+
- extern int trace_kludge;
- extern int trace_string_kludge;
+   struct target_bfd_data *data = t->to_data;
+-  bfd_close (data->bfd);
++  gdb_bfd_unref (data->bfd);
+   xfree (data->table.sections);
+   xfree (data);
+   xfree (t);
+@@ -84,6 +85,7 @@ target_bfd_reopen (struct bfd *abfd)
+   data = XZALLOC (struct target_bfd_data);
+   data->bfd = abfd;
++  gdb_bfd_ref (abfd);
+   build_section_table (abfd, &data->table.sections, &data->table.sections_end);
+   t = XZALLOC (struct target_ops);
+diff --git a/gdb/bfd-target.h b/gdb/bfd-target.h
+index 71001c5..7f4e628 100644
+--- a/gdb/bfd-target.h
++++ b/gdb/bfd-target.h
+@@ -23,9 +23,9 @@
+ struct bfd;
+ struct target_ops;
+-/* Given an existing BFD, re-open it as a "struct target_ops".  On
+-   close, it will also close the corresponding BFD (which is like
+-   freopen and fdopen).  */
++/* Given an existing BFD, re-open it as a "struct target_ops".  This
++   acquires a new reference to the BFD.  This reference will be
++   released when the target is closed.  */
+ struct target_ops *target_bfd_reopen (struct bfd *bfd);
+ #endif
 diff --git a/gdb/block.c b/gdb/block.c
-index 57ab4c2..573630e 100644
+index a0f82ec..097dbf6 100644
 --- a/gdb/block.c
 +++ b/gdb/block.c
-@@ -369,3 +369,21 @@ allocate_block (struct obstack *obstack)
+@@ -692,3 +692,21 @@ block_iter_match_next (const char *name,
  
-   return bl;
+   return block_iter_match_step (iterator, name, compare, 0);
  }
 +
 +/* Return OBJFILE in which BLOCK is located or NULL if we cannot find it for
@@ -429,238 +175,21 @@ index 57ab4c2..573630e 100644
 +  return SYMBOL_SYMTAB (func)->objfile;
 +}
 diff --git a/gdb/block.h b/gdb/block.h
-index 2cbcc1b..104c146 100644
+index 99c4788..6ceb704 100644
 --- a/gdb/block.h
 +++ b/gdb/block.h
-@@ -167,4 +167,6 @@ extern const struct block *block_global_block (const struct block *block);
- extern struct block *allocate_block (struct obstack *obstack);
+@@ -279,4 +279,6 @@ extern struct symbol *block_iter_match_next (const char *name,
+        (sym);                                         \
+        (sym) = block_iterator_next (&(iter)))
  
 +extern struct objfile *block_objfile (const struct block *block);
 +
  #endif /* BLOCK_H */
 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index f6a0276..e406156 100644
+index 78fffd3..224ba49 100644
 --- a/gdb/breakpoint.c
 +++ b/gdb/breakpoint.c
-@@ -60,6 +60,8 @@
- #include "jit.h"
- #include "xml-syscall.h"
- #include "parser-defs.h"
-+#include "gdb_regex.h"
-+#include "stap-probe.h"
- #include "cli/cli-utils.h"
- #include "continuations.h"
- #include "stack.h"
-@@ -1239,9 +1241,10 @@ is_watchpoint (const struct breakpoint *bpt)
- static int
- watchpoint_in_thread_scope (struct watchpoint *b)
- {
--  return (ptid_equal (b->watchpoint_thread, null_ptid)
--        || (ptid_equal (inferior_ptid, b->watchpoint_thread)
--            && !is_executing (inferior_ptid)));
-+  return (b->base.pspace == current_program_space
-+        && (ptid_equal (b->watchpoint_thread, null_ptid)
-+            || (ptid_equal (inferior_ptid, b->watchpoint_thread)
-+                && !is_executing (inferior_ptid))));
- }
- /* Set watchpoint B to disp_del_at_next_stop, even including its possible
-@@ -1648,6 +1651,40 @@ unduplicated_should_be_inserted (struct bp_location *bl)
-   return result;
- }
-+/* See the comment in breakpoint.h.  */
-+
-+void
-+modify_semaphore (struct bp_location *loc, int set)
-+{
-+  struct gdbarch *arch = loc->gdbarch;
-+  gdb_byte bytes[sizeof (LONGEST)];
-+  /* The ABI specifies "unsigned short".  */
-+  struct type *type = builtin_type (arch)->builtin_unsigned_short;
-+  CORE_ADDR address = loc->semaphore;
-+  ULONGEST value;
-+
-+  if (address == 0)
-+    return;
-+
-+  /* Swallow errors.  */
-+  if (target_read_memory (address, bytes, TYPE_LENGTH (type)) != 0)
-+    return;
-+
-+  value = extract_unsigned_integer (bytes, TYPE_LENGTH (type),
-+                                  gdbarch_byte_order (arch));
-+  /* Note that we explicitly don't worry about overflow or
-+     underflow.  */
-+  if (set)
-+    ++value;
-+  else
-+    --value;
-+
-+  store_unsigned_integer (bytes, TYPE_LENGTH (type),
-+                        gdbarch_byte_order (arch), value);
-+
-+  target_write_memory (address, bytes, TYPE_LENGTH (type));
-+}
-+
- /* Insert a low-level "breakpoint" of some type.  BL is the breakpoint
-    location.  Any error messages are printed to TMP_ERROR_STREAM; and
-    DISABLED_BREAKS, and HW_BREAKPOINT_ERROR are used to report problems.
-@@ -1741,6 +1778,8 @@ insert_bp_location (struct bp_location *bl,
-         /* No overlay handling: just set the breakpoint.  */
-         val = bl->owner->ops->insert_location (bl);
-+
-+        modify_semaphore (bl, 1);
-       }
-       else
-       {
-@@ -2224,11 +2263,23 @@ struct breakpoint_objfile_data
-   /* Minimal symbol(s) for "longjmp", "siglongjmp", etc. (if any).  */
-   struct minimal_symbol *longjmp_msym[NUM_LONGJMP_NAMES];
-+  /* True if we have looked for longjmp probes.  */
-+  int longjmp_searched;
-+
-+  /* SystemTap probe points for longjmp (if any).  */
-+  VEC (stap_probe_p) *longjmp_probes;
-+
-   /* Minimal symbol for "std::terminate()" (if any).  */
-   struct minimal_symbol *terminate_msym;
-   /* Minimal symbol for "_Unwind_DebugHook" (if any).  */
-   struct minimal_symbol *exception_msym;
-+
-+  /* True if we have looked for exception probes.  */
-+  int exception_searched;
-+
-+  /* SystemTap probe points for unwinding (if any).  */
-+  VEC (stap_probe_p) *exception_probes;
- };
- static const struct objfile_data *breakpoint_objfile_key;
-@@ -2265,6 +2316,15 @@ get_breakpoint_objfile_data (struct objfile *objfile)
- }
- static void
-+free_breakpoint_probes (struct objfile *obj, void *data)
-+{
-+  struct breakpoint_objfile_data *bp_objfile_data = data;
-+
-+  VEC_free (stap_probe_p, bp_objfile_data->longjmp_probes);
-+  VEC_free (stap_probe_p, bp_objfile_data->exception_probes);
-+}
-+
-+static void
- create_overlay_event_breakpoint (void)
- {
-   struct objfile *objfile;
-@@ -2341,6 +2401,37 @@ create_longjmp_master_breakpoint (void)
-       bp_objfile_data = get_breakpoint_objfile_data (objfile);
-+      if (!bp_objfile_data->longjmp_searched)
-+      {
-+        bp_objfile_data->longjmp_probes
-+          = find_probes_in_objfile (objfile, "libc", "longjmp");
-+        bp_objfile_data->longjmp_searched = 1;
-+      }
-+
-+      if (bp_objfile_data->longjmp_probes != NULL)
-+      {
-+        int i;
-+        struct stap_probe *probe;
-+        struct gdbarch *gdbarch = get_objfile_arch (objfile);
-+
-+        for (i = 0;
-+             VEC_iterate (stap_probe_p,
-+                          bp_objfile_data->longjmp_probes,
-+                          i, probe);
-+             ++i)
-+          {
-+            struct breakpoint *b;
-+             
-+            b = create_internal_breakpoint (gdbarch, probe->address,
-+                                            bp_longjmp_master,
-+                                            &internal_breakpoint_ops);
-+            b->addr_string = xstrdup ("-p libc:longjmp");
-+            b->enable_state = bp_disabled;
-+          }
-+
-+        continue;
-+      }
-+
-       for (i = 0; i < NUM_LONGJMP_NAMES; i++)
-       {
-         struct breakpoint *b;
-@@ -2451,6 +2542,40 @@ create_exception_master_breakpoint (void)
-       bp_objfile_data = get_breakpoint_objfile_data (objfile);
-+      /* We prefer the SystemTap probe point if it exists.  */
-+      if (!bp_objfile_data->exception_searched)
-+      {
-+        bp_objfile_data->exception_probes
-+          = find_probes_in_objfile (objfile, "libgcc", "unwind");
-+        bp_objfile_data->exception_searched = 1;
-+      }
-+
-+      if (bp_objfile_data->exception_probes != NULL)
-+      {
-+        struct gdbarch *gdbarch = get_objfile_arch (objfile);
-+        int i;
-+        struct stap_probe *probe;
-+
-+        for (i = 0;
-+             VEC_iterate (stap_probe_p,
-+                          bp_objfile_data->exception_probes,
-+                          i, probe);
-+             ++i)
-+          {
-+            struct breakpoint *b;
-+
-+            b = create_internal_breakpoint (gdbarch, probe->address,
-+                                            bp_exception_master,
-+                                            &internal_breakpoint_ops);
-+            b->addr_string = xstrdup ("-p libgcc:unwind");
-+            b->enable_state = bp_disabled;
-+          }
-+
-+        continue;
-+      }
-+
-+      /* Otherwise, try the hook function.  */
-+
-       if (msym_not_found_p (bp_objfile_data->exception_msym))
-       continue;
-@@ -2666,6 +2791,8 @@ remove_breakpoint_1 (struct bp_location *bl, insertion_state_t is)
-       {
-         /* No overlay handling: just remove the breakpoint.  */
-         val = bl->owner->ops->remove_location (bl);
-+
-+        modify_semaphore (bl, 0);
-       }
-       else
-       {
-@@ -7111,6 +7238,7 @@ momentary_breakpoint_from_master (struct breakpoint *orig,
-   copy->loc->address = orig->loc->address;
-   copy->loc->section = orig->loc->section;
-   copy->loc->pspace = orig->loc->pspace;
-+  copy->loc->semaphore = orig->loc->semaphore;
-   if (orig->loc->source_file != NULL)
-     copy->loc->source_file = xstrdup (orig->loc->source_file);
-@@ -7196,6 +7324,7 @@ add_location_to_breakpoint (struct breakpoint *b,
-   loc->requested_address = sal->pc;
-   loc->address = adjusted_address;
-   loc->pspace = sal->pspace;
-+  loc->semaphore = sal->semaphore;
-   gdb_assert (loc->pspace != NULL);
-   loc->section = sal->section;
-   loc->gdbarch = loc_gdbarch;
-@@ -13521,6 +13650,24 @@ all_tracepoints (void)
+@@ -15519,6 +15519,24 @@ all_tracepoints (void)
    return tp_vec;
  }
  
@@ -685,17 +214,7 @@ index f6a0276..e406156 100644
  \f
  /* This help string is used for the break, hbreak, tbreak and thbreak
     commands.  It is defined as a macro to prevent duplication.
-@@ -13815,7 +13962,8 @@ _initialize_breakpoint (void)
-   observer_attach_inferior_exit (clear_syscall_counts);
-   observer_attach_memory_changed (invalidate_bp_value_on_memory_change);
--  breakpoint_objfile_key = register_objfile_data ();
-+  breakpoint_objfile_key
-+    = register_objfile_data_with_cleanup (NULL, free_breakpoint_probes);
-   breakpoint_chain = 0;
-   /* Don't bother to call set_breakpoint_count.  $bpnum isn't useful
-@@ -14340,4 +14488,7 @@ range (including START-LOCATION and END-LOCATION)."));
+@@ -16484,4 +16502,7 @@ agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
    automatic_hardware_breakpoints = 1;
  
    observer_attach_about_to_proceed (breakpoint_about_to_proceed);
@@ -703,36 +222,71 @@ index f6a0276..e406156 100644
 +  observer_attach_mark_used (breakpoint_types_mark_used);
 +#endif
  }
-diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
-index 8a8d5f2..1e18562 100644
---- a/gdb/breakpoint.h
-+++ b/gdb/breakpoint.h
-@@ -379,6 +379,11 @@ struct bp_location
-      processor's architectual constraints.  */
-   CORE_ADDR requested_address;
-+  /* If the location comes from a SystemTap probe point, and the probe
-+     has an associated semaphore variable, then this is the address of
-+     the semaphore.  Otherwise, this is zero.  */
-+  CORE_ADDR semaphore;
-+
-   char *function_name;
-   /* Details of the placed breakpoint, when inserted.  */
-@@ -1412,4 +1417,11 @@ extern int user_breakpoint_p (struct breakpoint *);
- /* Attempt to determine architecture of location identified by SAL.  */
- extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
-+/* Set or clear a SystemTap semaphore.  LOC is the location which may
-+   hold a semaphore.  SET is non-zero if the semaphore should be set,
-+   or zero if the semaphore should be cleared.  Semaphores act as
-+   reference counters, so calls to this function must be paired.  */
-+
-+extern void modify_semaphore (struct bp_location *location, int set);
-+
- #endif /* !defined (BREAKPOINT_H) */
+diff --git a/gdb/buildsym.c b/gdb/buildsym.c
+index d547012..e4882fb 100644
+--- a/gdb/buildsym.c
++++ b/gdb/buildsym.c
+@@ -966,11 +966,14 @@ reset_symtab_globals (void)
+    file's text.
+    If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made
+-   expandable.  */
++   expandable.
++
++   If REQUIRED is non-zero, then a symtab is created even if it does
++   not contain any symbols.  */
+ struct block *
+ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
+-                           int expandable)
++                           int expandable, int required)
+ {
+   /* Finish the lexical context of the last function in the file; pop
+      the context stack.  */
+@@ -1038,7 +1041,8 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
+   cleanup_undefined_stabs_types (objfile);
+   finish_global_stabs (objfile);
+-  if (pending_blocks == NULL
++  if (!required
++      && pending_blocks == NULL
+       && file_symbols == NULL
+       && global_symbols == NULL
+       && have_line_numbers == 0
+@@ -1296,7 +1300,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
+ {
+   struct block *static_block;
+-  static_block = end_symtab_get_static_block (end_addr, objfile, 0);
++  static_block = end_symtab_get_static_block (end_addr, objfile, 0, 0);
+   return end_symtab_from_static_block (static_block, objfile, section, 0);
+ }
+@@ -1308,7 +1312,7 @@ end_expandable_symtab (CORE_ADDR end_addr, struct objfile *objfile,
+ {
+   struct block *static_block;
+-  static_block = end_symtab_get_static_block (end_addr, objfile, 1);
++  static_block = end_symtab_get_static_block (end_addr, objfile, 1, 0);
+   return end_symtab_from_static_block (static_block, objfile, section, 1);
+ }
+diff --git a/gdb/buildsym.h b/gdb/buildsym.h
+index 162ee8c..33b34c8 100644
+--- a/gdb/buildsym.h
++++ b/gdb/buildsym.h
+@@ -260,7 +260,8 @@ extern char *pop_subfile (void);
+ extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
+                                                 struct objfile *objfile,
+-                                                int expandable);
++                                                int expandable,
++                                                int required);
+ extern struct symtab *end_symtab_from_static_block (struct block *static_block,
+                                                   struct objfile *objfile,
 diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
-index db254dc..181de05 100644
+index a5892b5..2944c2d 100644
 --- a/gdb/c-typeprint.c
 +++ b/gdb/c-typeprint.c
 @@ -624,9 +624,14 @@ c_type_print_varspec_suffix (struct type *type,
@@ -753,151 +307,555 @@ index db254dc..181de05 100644
        fprintf_filtered (stream, "]");
  
        c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
-diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
-index a7b2718..a1e5161 100644
---- a/gdb/cli/cli-utils.c
-+++ b/gdb/cli/cli-utils.c
-@@ -223,6 +223,18 @@ skip_spaces (char *chp)
-   return chp;
- }
-+/* A const-correct version of the above.  */
-+
-+const char *
-+skip_spaces_const (const char *chp)
-+{
-+  if (chp == NULL)
-+    return NULL;
-+  while (*chp && isspace (*chp))
-+    chp++;
-+  return chp;
-+}
-+
- /* See documentation in cli-utils.h.  */
+diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh
+deleted file mode 100755
+index f66deb1..0000000
+--- a/gdb/cc-with-dwz.sh
++++ /dev/null
+@@ -1,80 +0,0 @@
+-#! /bin/sh
+-# Wrapper around gcc to run 'dwz' when running the testsuite.
+-
+-# Copyright (C) 2010-2012 Free Software Foundation, Inc.
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 3 of the License, or
+-# (at your option) any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-
+-# This program requires dwz in addition to gcc.
+-#
+-# Example usage:
+-#
+-# bash$ cd $objdir/gdb/testsuite
+-# bash$ runtest \
+-#   CC_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh gcc" \
+-#   CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh g++"
+-#
+-
+-myname=cc-with-dwz.sh
+-
+-DWZ=${DWZ:-dwz}
+-
+-have_link=unknown
+-next_is_output_file=no
+-output_file=a.out
+-
+-for arg in "$@"
+-do
+-    if [ "$next_is_output_file" = "yes" ]
+-    then
+-      output_file="$arg"
+-      next_is_output_file=no
+-      continue
+-    fi
+-
+-    # Poor man's gcc argument parser.
+-    # We don't need to handle all arguments, we just need to know if we're
+-    # doing a link and what the output file is.
+-    # It's not perfect, but it seems to work well enough for the task at hand.
+-    case "$arg" in
+-    "-c") have_link=no ;;
+-    "-E") have_link=no ;;
+-    "-S") have_link=no ;;
+-    "-o") next_is_output_file=yes ;;
+-    esac
+-done
+-
+-if [ "$next_is_output_file" = "yes" ]
+-then
+-    echo "$myname: Unable to find output file" >&2
+-    exit 1
+-fi
+-
+-if [ "$have_link" = "no" ]
+-then
+-    "$@"
+-    exit $?
+-fi
+-
+-"$@"
+-rc=$?
+-[ $rc != 0 ] && exit $rc
+-if [ ! -f "$output_file" ]
+-then
+-    echo "$myname: Internal error: $output_file missing." >&2
+-    exit 1
+-fi
+-
+-$DWZ "$output_file" > /dev/null 2>&1
+-
+-exit 0
+diff --git a/gdb/cc-with-index.sh b/gdb/cc-with-index.sh
+deleted file mode 100644
+index 644ba34..0000000
+--- a/gdb/cc-with-index.sh
++++ /dev/null
+@@ -1,126 +0,0 @@
+-#! /bin/sh
+-# Wrapper around gcc to add the .gdb_index section when running the testsuite.
+-
+-# Copyright (C) 2010-2012 Free Software Foundation, Inc.
+-# This program is free software; you can redistribute it and/or modify
+-# it under the terms of the GNU General Public License as published by
+-# the Free Software Foundation; either version 3 of the License, or
+-# (at your option) any later version.
+-#
+-# This program is distributed in the hope that it will be useful,
+-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-# GNU General Public License for more details.
+-#
+-# You should have received a copy of the GNU General Public License
+-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+-
+-# This program requires gdb and objcopy in addition to gcc.
+-# The default values are gdb from the build tree and objcopy from $PATH.
+-# They may be overridden by setting environment variables GDB and OBJCOPY
+-# respectively.
+-# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite.
+-#
+-# Example usage:
+-#
+-# bash$ cd $objdir/gdb/testsuite
+-# bash$ runtest \
+-#   CC_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh gcc" \
+-#   CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh g++"
+-#
+-# For documentation on index files: info -f gdb.info -n "Index Files"
+-
+-myname=cc-with-index.sh
+-
+-if [ -z "$GDB" ]
+-then
+-    if [ -f ./gdb ]
+-    then
+-      GDB="./gdb"
+-    elif [ -f ../gdb ]
+-    then
+-      GDB="../gdb"
+-    elif [ -f ../../gdb ]
+-    then
+-      GDB="../../gdb"
+-    else
+-      echo "$myname: unable to find usable gdb" >&2
+-      exit 1
+-    fi
+-fi
+-
+-OBJCOPY=${OBJCOPY:-objcopy}
+-
+-have_link=unknown
+-next_is_output_file=no
+-output_file=a.out
+-
+-for arg in "$@"
+-do
+-    if [ "$next_is_output_file" = "yes" ]
+-    then
+-      output_file="$arg"
+-      next_is_output_file=no
+-      continue
+-    fi
+-
+-    # Poor man's gcc argument parser.
+-    # We don't need to handle all arguments, we just need to know if we're
+-    # doing a link and what the output file is.
+-    # It's not perfect, but it seems to work well enough for the task at hand.
+-    case "$arg" in
+-    "-c") have_link=no ;;
+-    "-E") have_link=no ;;
+-    "-S") have_link=no ;;
+-    "-o") next_is_output_file=yes ;;
+-    esac
+-done
+-
+-if [ "$next_is_output_file" = "yes" ]
+-then
+-    echo "$myname: Unable to find output file" >&2
+-    exit 1
+-fi
+-
+-if [ "$have_link" = "no" ]
+-then
+-    "$@"
+-    exit $?
+-fi
+-
+-index_file="${output_file}.gdb-index"
+-if [ -f "$index_file" ]
+-then
+-    echo "$myname: Index file $index_file exists, won't clobber." >&2
+-    exit 1
+-fi
+-
+-output_dir="${output_file%/*}"
+-[ "$output_dir" = "$output_file" ] && output_dir="."
+-
+-"$@"
+-rc=$?
+-[ $rc != 0 ] && exit $rc
+-if [ ! -f "$output_file" ]
+-then
+-    echo "$myname: Internal error: $output_file missing." >&2
+-    exit 1
+-fi
+-
+-$GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir"
+-rc=$?
+-[ $rc != 0 ] && exit $rc
+-
+-# GDB might not always create an index.  Cope.
+-if [ -f "$index_file" ]
+-then
+-    $OBJCOPY --add-section .gdb_index="$index_file" \
+-      --set-section-flags .gdb_index=readonly \
+-      "$output_file" "$output_file"
+-    rc=$?
+-else
+-    rc=0
+-fi
+-
+-rm -f "$index_file"
+-exit $rc
+diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
+index 4a8b5d1..7341f00 100644
+--- a/gdb/cli/cli-dump.c
++++ b/gdb/cli/cli-dump.c
+@@ -32,6 +32,7 @@
+ #include "readline/readline.h"
+ #include "gdbcore.h"
+ #include "cli/cli-utils.h"
++#include "gdb_bfd.h"
  
- char *
-@@ -245,3 +257,32 @@ remove_trailing_whitespace (const char *start, char *s)
+ #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
  
-   return s;
- }
-+
-+/* See documentation in cli-utils.h.  */
-+
-+char *
-+extract_arg (char **arg)
-+{
-+  char *result, *copy;
-+
-+  if (!*arg)
-+    return NULL;
-+
-+  /* Find the start of the argument.  */
-+  *arg = skip_spaces (*arg);
-+  if (! **arg)
-+    return NULL;
-+  result = *arg;
-+
-+  /* Find the end of the argument.  */
-+  *arg = skip_to_space (*arg + 1);
-+
-+  if (result == *arg)
-+    return NULL;
-+
-+  copy = xmalloc (*arg - result + 1);
-+  memcpy (copy, result, *arg - result);
-+  copy[*arg - result] = '\0';
-+
-+  return copy;
-+}
-diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h
-index e23c7d8..5f8a91d 100644
---- a/gdb/cli/cli-utils.h
-+++ b/gdb/cli/cli-utils.h
-@@ -94,6 +94,10 @@ extern int number_is_in_list (char *list, int number);
+@@ -111,12 +112,12 @@ bfd_openr_with_cleanup (const char *filename, const char *target)
+ {
+   bfd *ibfd;
  
- extern char *skip_spaces (char *inp);
+-  ibfd = bfd_openr (filename, target);
++  ibfd = gdb_bfd_openr (filename, target);
+   if (ibfd == NULL)
+     error (_("Failed to open %s: %s."), filename, 
+          bfd_errmsg (bfd_get_error ()));
  
-+/* A const-correct version of the above.  */
-+
-+extern const char *skip_spaces_const (const char *inp);
-+
- /* Skip leading non-whitespace characters in INP, returning an updated
-    pointer.  If INP is NULL, return NULL.  */
+-  make_cleanup_bfd_close (ibfd);
++  make_cleanup_bfd_unref (ibfd);
+   if (!bfd_check_format (ibfd, bfd_object))
+     error (_("'%s' is not a recognized file format."), filename);
  
-@@ -103,4 +107,11 @@ extern char *skip_to_space (char *inp);
-    START.  */
+@@ -131,11 +132,11 @@ bfd_openw_with_cleanup (const char *filename, const char *target,
  
- extern char *remove_trailing_whitespace (const char *start, char *s);
-+
-+/* A helper function to extract an argument from *ARG.  An argument is
-+   delimited by whitespace.  The return value is either NULL if no
-+   argument was found, or an xmalloc'd string.  */
-+
-+extern char *extract_arg (char **arg);
-+
- #endif /* CLI_UTILS_H */
+   if (*mode == 'w')   /* Write: create new file */
+     {
+-      obfd = bfd_openw (filename, target);
++      obfd = gdb_bfd_openw (filename, target);
+       if (obfd == NULL)
+       error (_("Failed to open %s: %s."), filename, 
+              bfd_errmsg (bfd_get_error ()));
+-      make_cleanup_bfd_close (obfd);
++      make_cleanup_bfd_unref (obfd);
+       if (!bfd_set_format (obfd, bfd_object))
+       error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ()));
+     }
 diff --git a/gdb/coffread.c b/gdb/coffread.c
-index c727228..e1fab6d 100644
+index b0a8b82..0c7e6d9 100644
 --- a/gdb/coffread.c
 +++ b/gdb/coffread.c
-@@ -2195,6 +2195,7 @@ static const struct sym_fns coff_sym_fns =
+@@ -653,13 +653,14 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags)
+       char *debugfile;
  
-   default_symfile_relocate,   /* sym_relocate: Relocate a debug
-                                  section.  */
-+  NULL,                               /* sym_probe_fns */
-   &psym_functions
- };
+       debugfile = find_separate_debug_file_by_debuglink (objfile);
++      make_cleanup (xfree, debugfile);
  
-diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
-index 4296e5a..b04d12f 100644
---- a/gdb/data-directory/Makefile.in
-+++ b/gdb/data-directory/Makefile.in
-@@ -52,13 +52,24 @@ SYSCALLS_FILES = \
- PYTHON_DIR = python
- PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
- PYTHON_FILES = \
-+      gdb/FrameIterator.py \
-+      gdb/FrameWrapper.py \
-       gdb/__init__.py \
--      gdb/types.py \
--      gdb/printing.py \
--      gdb/prompt.py \
-+      gdb/backtrace.py \
-       gdb/command/__init__.py \
-+      gdb/command/backtrace.py \
-+      gdb/command/ignore_errors.py \
-+      gdb/command/pahole.py \
-       gdb/command/pretty_printers.py \
--      gdb/command/prompt.py
-+      gdb/command/prompt.py \
-+      gdb/command/require.py \
-+      gdb/command/upto.py \
-+      gdb/function/__init__.py \
-+      gdb/function/caller_is.py \
-+      gdb/function/in_scope.py \
-+      gdb/printing.py \
-+      gdb/prompt.py \
-+      gdb/types.py
+       if (debugfile)
+       {
+         bfd *abfd = symfile_bfd_open (debugfile);
  
- FLAGS_TO_PASS = \
-       "prefix=$(prefix)" \
-diff --git a/gdb/dbxread.c b/gdb/dbxread.c
-index adf8315..c11e4d4 100644
---- a/gdb/dbxread.c
-+++ b/gdb/dbxread.c
-@@ -3588,6 +3588,7 @@ static const struct sym_fns aout_sym_fns =
-   default_symfile_segments,   /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  NULL,                               /* sym_probe_fns */
-   &psym_functions
- };
++        make_cleanup_bfd_unref (abfd);
+         symbol_file_add_separate (abfd, symfile_flags, objfile);
+-        xfree (debugfile);
+       }
+     }
+diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
+new file mode 100755
+index 0000000..7d7932c
+--- /dev/null
++++ b/gdb/contrib/cc-with-tweaks.sh
+@@ -0,0 +1,162 @@
++#! /bin/sh
++# Wrapper around gcc to tweak the output in various ways when running
++# the testsuite.
++
++# Copyright (C) 2010-2012 Free Software Foundation, Inc.
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# This program requires gdb and objcopy in addition to gcc.
++# The default values are gdb from the build tree and objcopy from $PATH.
++# They may be overridden by setting environment variables GDB and OBJCOPY
++# respectively.
++# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite.
++#
++# Example usage:
++#
++# bash$ cd $objdir/gdb/testsuite
++# bash$ runtest \
++#   CC_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS gcc" \
++#   CXX_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS g++"
++#
++# For documentation on index files: info -f gdb.info -n "Index Files"
++# For information about 'dwz', see the announcement:
++#     http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html
++# (More documentation is to come.)
++
++# ARGS determine what is done.  They can be:
++# -z compress using dwz
++# -m compress using dwz -m
++# -i make an index
++# If nothing is given, no changes are made
++
++myname=cc-with-tweaks.sh
++
++if [ -z "$GDB" ]
++then
++    if [ -f ./gdb ]
++    then
++      GDB="./gdb"
++    elif [ -f ../gdb ]
++    then
++      GDB="../gdb"
++    elif [ -f ../../gdb ]
++    then
++      GDB="../../gdb"
++    else
++      echo "$myname: unable to find usable gdb" >&2
++      exit 1
++    fi
++fi
++
++OBJCOPY=${OBJCOPY:-objcopy}
++
++DWZ=${DWZ:-dwz}
++
++have_link=unknown
++next_is_output_file=no
++output_file=a.out
++
++want_index=false
++want_dwz=false
++want_multi=false
++
++while [ $# -gt 0 ]; do
++    case "$1" in
++      -z) want_dwz=true ;;
++      -i) want_index=true ;;
++      -m) want_multi=true ;;
++      *) break ;;
++    esac
++    shift
++done
++
++for arg in "$@"
++do
++    if [ "$next_is_output_file" = "yes" ]
++    then
++      output_file="$arg"
++      next_is_output_file=no
++      continue
++    fi
++
++    # Poor man's gcc argument parser.
++    # We don't need to handle all arguments, we just need to know if we're
++    # doing a link and what the output file is.
++    # It's not perfect, but it seems to work well enough for the task at hand.
++    case "$arg" in
++    "-c") have_link=no ;;
++    "-E") have_link=no ;;
++    "-S") have_link=no ;;
++    "-o") next_is_output_file=yes ;;
++    esac
++done
++
++if [ "$next_is_output_file" = "yes" ]
++then
++    echo "$myname: Unable to find output file" >&2
++    exit 1
++fi
++
++if [ "$have_link" = "no" ]
++then
++    "$@"
++    exit $?
++fi
++
++index_file="${output_file}.gdb-index"
++if [ "$want_index" = true ] && [ -f "$index_file" ]
++then
++    echo "$myname: Index file $index_file exists, won't clobber." >&2
++    exit 1
++fi
++
++output_dir="${output_file%/*}"
++[ "$output_dir" = "$output_file" ] && output_dir="."
++
++"$@"
++rc=$?
++[ $rc != 0 ] && exit $rc
++if [ ! -f "$output_file" ]
++then
++    echo "$myname: Internal error: $output_file missing." >&2
++    exit 1
++fi
++
++if [ "$want_index" = true ]; then
++    $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir"
++    rc=$?
++    [ $rc != 0 ] && exit $rc
++
++    # GDB might not always create an index.  Cope.
++    if [ -f "$index_file" ]
++    then
++      $OBJCOPY --add-section .gdb_index="$index_file" \
++          --set-section-flags .gdb_index=readonly \
++          "$output_file" "$output_file"
++      rc=$?
++    else
++      rc=0
++    fi
++    [ $rc != 0 ] && exit $rc
++fi
++
++if [ "$want_dwz" = true ]; then
++    $DWZ "$output_file" > /dev/null 2>&1
++elif [ "$want_multi" = true ]; then
++    cp $output_file ${output_file}.alt
++    $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null 2>&1
++fi
++
++rm -f "$index_file"
++exit $rc
+diff --git a/gdb/corelow.c b/gdb/corelow.c
+index dd62560..340b149 100644
+--- a/gdb/corelow.c
++++ b/gdb/corelow.c
+@@ -46,6 +46,7 @@
+ #include "filenames.h"
+ #include "progspace.h"
+ #include "objfiles.h"
++#include "gdb_bfd.h"
+ #ifndef O_LARGEFILE
+ #define O_LARGEFILE 0
+@@ -215,9 +216,7 @@ core_close (int quitting)
+         core_data = NULL;
+       }
+-      name = bfd_get_filename (core_bfd);
+-      gdb_bfd_close_or_warn (core_bfd);
+-      xfree (name);
++      gdb_bfd_unref (core_bfd);
+       core_bfd = NULL;
+     }
+   core_vec = NULL;
+@@ -319,9 +318,9 @@ core_open (char *filename, int from_tty)
+   if (scratch_chan < 0)
+     perror_with_name (filename);
+-  temp_bfd = bfd_fopen (filename, gnutarget, 
+-                      write_files ? FOPEN_RUB : FOPEN_RB,
+-                      scratch_chan);
++  temp_bfd = gdb_bfd_fopen (filename, gnutarget, 
++                          write_files ? FOPEN_RUB : FOPEN_RB,
++                          scratch_chan);
+   if (temp_bfd == NULL)
+     perror_with_name (filename);
+@@ -332,7 +331,7 @@ core_open (char *filename, int from_tty)
+       /* FIXME: should be checking for errors from bfd_close (for one
+          thing, on error it does not free all the storage associated
+          with the bfd).  */
+-      make_cleanup_bfd_close (temp_bfd);
++      make_cleanup_bfd_unref (temp_bfd);
+       error (_("\"%s\" is not a core dump: %s"),
+            filename, bfd_errmsg (bfd_get_error ()));
+     }
+@@ -340,7 +339,7 @@ core_open (char *filename, int from_tty)
+   /* Looks semi-reasonable.  Toss the old core file and work on the
+      new.  */
+-  discard_cleanups (old_chain);       /* Don't free filename any more */
++  do_cleanups (old_chain);
+   unpush_target (&core_ops);
+   core_bfd = temp_bfd;
+   old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);
+diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
+index 87c6dd4..1c26652 100644
+--- a/gdb/data-directory/Makefile.in
++++ b/gdb/data-directory/Makefile.in
+@@ -52,14 +52,25 @@ SYSCALLS_FILES = \
+ PYTHON_DIR = python
+ PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
+ PYTHON_FILES = \
++      gdb/FrameIterator.py \
++      gdb/FrameWrapper.py \
+       gdb/__init__.py \
+-      gdb/types.py \
+-      gdb/printing.py \
+-      gdb/prompt.py \
++      gdb/backtrace.py \
+       gdb/command/__init__.py \
++      gdb/command/backtrace.py \
++      gdb/command/ignore_errors.py \
++      gdb/command/pahole.py \
+       gdb/command/pretty_printers.py \
+       gdb/command/prompt.py \
+-      gdb/command/explore.py
++      gdb/command/explore.py \
++      gdb/command/require.py \
++      gdb/command/upto.py \
++      gdb/function/__init__.py \
++      gdb/function/caller_is.py \
++      gdb/function/in_scope.py \
++      gdb/printing.py \
++      gdb/prompt.py \
++      gdb/types.py
  
+ FLAGS_TO_PASS = \
+       "prefix=$(prefix)" \
 diff --git a/gdb/defs.h b/gdb/defs.h
-index 83a716a..7f8752e 100644
+index 1c6fa79..ec08348 100644
 --- a/gdb/defs.h
 +++ b/gdb/defs.h
-@@ -411,6 +411,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void);
+@@ -315,7 +315,7 @@ extern struct cleanup *make_cleanup_close (int fd);
+ extern struct cleanup *make_cleanup_fclose (FILE *file);
+-extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
++extern struct cleanup *make_cleanup_bfd_unref (bfd *abfd);
+ struct obstack;
+ extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack);
+@@ -353,6 +353,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void);
  extern struct cleanup *
    set_batch_flag_and_make_cleanup_restore_page_info (void);
  
@@ -907,10 +865,10 @@ index 83a716a..7f8752e 100644
  extern char *xfullpath (const char *);
  
 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
-index 20b0b67..57068c3 100644
+index 68ea817..5945bac 100644
 --- a/gdb/doc/gdb.texinfo
 +++ b/gdb/doc/gdb.texinfo
-@@ -1173,6 +1173,16 @@ for remote debugging.
+@@ -1200,6 +1200,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.
  
@@ -927,124 +885,7 @@ index 20b0b67..57068c3 100644
  @c resolve the situation of these eventually
  @item -tui
  @cindex @code{--tui}
-@@ -3301,6 +3311,7 @@ all breakpoints in that range are operated on.
- * Conditions::                  Break conditions
- * Break Commands::              Breakpoint command lists
- * Save Breakpoints::            How to save breakpoints in a file
-+* Static Probe Points::         Listing static probe points
- * Error in Breakpoints::        ``Cannot insert breakpoints''
- * Breakpoint-related Warnings:: ``Breakpoint address adjusted...''
- @end menu
-@@ -4530,6 +4541,50 @@ and remove the breakpoint definitions you're not interested in, or
- that can no longer be recreated.
- @end table
-+@node Static Probe Points
-+@subsection Static Probe Points
-+
-+@cindex SystemTap static probe point
-+@cindex sdt-probe
-+The @sc{gnu}/Linux tool @code{SystemTap} provides a way for
-+applications to embed static probes, using @file{sys/sdt.h}.  @value{GDBN}
-+can list the available probes, and you can put breakpoints at the
-+probe points (@pxref{Specify Location}).
-+
-+You can examine the available @code{SystemTap} static probes using
-+@code{info probes}:
-+
-+@table @code
-+@kindex info probes
-+@item info probes [@var{provider} [@var{name} [@var{objfile}]]]
-+List the available @code{SystemTap} static probes.
-+
-+If given, @var{provider} is a regular expression used to select which
-+providers to list.  If omitted, all providers are listed.
-+
-+If given, @var{name} is a regular expression used to select which
-+probes to list.  If omitted, all probes are listed.
-+
-+If given, @var{objfile} is a regular expression used to select which
-+object files (executable or shared libraries) to examine.  If not
-+given, all object files are considered.
-+@end table
-+
-+@vindex $_probe_arg@r{, convenience variable}
-+A probe may specify up to ten arguments.  These are available at the
-+point at which the probe is defined---that is, when the current PC is
-+at the probe's location.  The arguments are available using the
-+convenience variables (@pxref{Convenience Vars})
-+@code{$_probe_arg0}@dots{}@code{$_probe_arg11}.  Each probe argument is
-+an integer of the appropriate size; types are not preserved.  The
-+convenience variable @code{$_probe_argc} holds the number of arguments
-+at the current probe point.
-+
-+These variables are always available, but attempts to access them at
-+any location other than a probe point will cause @value{GDBN} to give
-+an error.
-+
-+
- @c  @ifclear BARETARGET
- @node Error in Breakpoints
- @subsection ``Cannot insert breakpoints''
-@@ -6555,6 +6610,29 @@ specify the function unambiguously, e.g., if there are several
- functions with identical names in different source files.
- @end table
-+@cindex SystemTap static probe point
-+@item -p @r{[}@var{objfile}:@r{]}@r{[}@var{provider}:@r{]}@var{name}
-+The @sc{gnu}/Linux tool @code{SystemTap} provides a way for
-+applications to embed static probes.  This form of linespec specifies
-+the location of such a static probe.  See
-+@uref{http://sourceware.org/systemtap/wiki/AddingUserSpaceProbingToApps}
-+for more information on static probes.
-+
-+If @var{objfile} is given, only probes coming from that shared library
-+or executable are considered.  If @var{provider} is given, then only
-+probes from that provider are considered.
-+
-+@xref{Static Probe Points}, for more information on finding and using
-+static probes.
-+
-+Some probes have an associated semaphore variable; for instance, this
-+happens automatically if you defined your probe using a DTrace-style
-+@file{.d} file.  If your probe has a semaphore, @value{GDBN} will
-+automatically enable it when you specify a breakpoint using the
-+@samp{-p} notation.  But, if you put a breakpoint at a probe's
-+location by some other method (e.g., @code{break file:line}), then
-+@value{GDBN} will not automatically set the semaphore.
-+
- @end table
-@@ -8811,6 +8889,10 @@ to match the format in which the data was printed.
- The variable @code{$_exitcode} is automatically set to the exit code when
- the program being debugged terminates.
-+@item $_probe_argc
-+@itemx $_probe_arg0@dots{}$_probe_arg11
-+Arguments to a SystemTap static probe.  @xref{Static Probe Points}.
-+
- @item $_sdata
- @vindex $_sdata@r{, inspect, convenience variable}
- The variable @code{$_sdata} contains extra collected static tracepoint
-@@ -10763,6 +10845,16 @@ Collect all local variables.
- Collect the return address.  This is helpful if you want to see more
- of a backtrace.
-+@item $_probe_argc
-+Collects the number of arguments from the @code{SystemTap} probe at
-+which the tracepoint is located.
-+@xref{Static Probe Points,,Static Probe Points}.
-+
-+@item $_probe_arg@var{N}
-+Where @var{N} varies from 0 to 11.  Collects the @var{N}th argument
-+from the @code{SystemTap} probe at which the tracepoint is located.
-+@xref{Static Probe Points,,Static Probe Points}.
-+
- @item $_sdata
- @vindex $_sdata@r{, collect}
- Collect static tracepoint marker specific data.  Only available for
-@@ -21506,8 +21598,6 @@ containing @code{end}.  For example:
+@@ -22563,8 +22573,6 @@ containing @code{end}.  For example:
  
  @smallexample
  (@value{GDBP}) python
@@ -1053,7 +894,7 @@ index 20b0b67..57068c3 100644
  >print 23
  >end
  23
-@@ -21521,6 +21611,14 @@ controlled using @code{set python print-stack}: if @code{full}, then
+@@ -22578,6 +22586,14 @@ controlled using @code{set python print-stack}: if @code{full}, then
  full Python stack printing is enabled; if @code{none}, then Python stack
  and message printing is disabled; if @code{message}, the default, only
  the message component of the error is printed.
@@ -1068,7 +909,7 @@ index 20b0b67..57068c3 100644
  @end table
  
  It is also possible to execute a Python script from the @value{GDBN}
-@@ -21542,6 +21640,14 @@ and thus is always available.
+@@ -22599,6 +22615,14 @@ and thus is always available.
  @cindex python api
  @cindex programming in python
  
@@ -1083,11 +924,23 @@ index 20b0b67..57068c3 100644
  @cindex python stdout
  @cindex python pagination
  At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
+@@ -34536,6 +34560,11 @@ Shared library events.
+ @end table
++@kindex maint info bfds
++@item maint info bfds
++This prints information about each @code{bfd} object that is known to
++@value{GDBN}.  @xref{Top, , BFD, bfd, The Binary File Descriptor Library}.
++
+ @kindex set displaced-stepping
+ @kindex show displaced-stepping
+ @cindex displaced stepping support
 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
-index 026dc59..f0f6ee3 100644
+index 5e00f1f..c5c432b 100644
 --- a/gdb/doc/gdbint.texinfo
 +++ b/gdb/doc/gdbint.texinfo
-@@ -2103,6 +2103,18 @@ time, and so we attempt to handle symbols incrementally.  For instance,
+@@ -2102,6 +2102,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.
  
@@ -1106,7 +959,7 @@ index 026dc59..f0f6ee3 100644
  @section Symbol Reading
  
  @cindex symbol reading
-@@ -2195,6 +2207,7 @@ symtab.  Upon return, @code{pst->readin} should have been set to 1, and
+@@ -2194,6 +2206,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
  
@@ -1114,7 +967,7 @@ index 026dc59..f0f6ee3 100644
  @section Partial Symbol Tables
  
  @value{GDBN} has three types of symbol tables:
-@@ -2296,6 +2309,7 @@ and partial symbol tables behind a set of function pointers known as
+@@ -2295,6 +2308,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}.
  
@@ -1122,7 +975,7 @@ index 026dc59..f0f6ee3 100644
  @section Types
  
  @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}).
-@@ -2318,6 +2332,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by
+@@ -2317,6 +2331,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.
  
@@ -1130,7 +983,7 @@ index 026dc59..f0f6ee3 100644
  @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}).
  
  These are instances of type structs that roughly correspond to
-@@ -2332,6 +2347,7 @@ only one instance exists, while @file{c-lang.c} builds as many
+@@ -2331,6 +2346,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.
  
@@ -1138,7 +991,7 @@ index 026dc59..f0f6ee3 100644
  @section Object File Formats
  @cindex object file formats
  
-@@ -2417,6 +2433,7 @@ SOM, which is a cross-language ABI).
+@@ -2416,6 +2432,7 @@ SOM, which is a cross-language ABI).
  
  The SOM reader is in @file{somread.c}.
  
@@ -1146,7 +999,7 @@ index 026dc59..f0f6ee3 100644
  @section Debugging File Formats
  
  This section describes characteristics of debugging information that
-@@ -2488,6 +2505,7 @@ DWARF 3 is an improved version of DWARF 2.
+@@ -2487,6 +2504,7 @@ DWARF 3 is an improved version of DWARF 2.
  @cindex SOM debugging info
  Like COFF, the SOM definition includes debugging information.
  
@@ -1154,7 +1007,7 @@ index 026dc59..f0f6ee3 100644
  @section Adding a New Symbol Reader to @value{GDBN}
  
  @cindex adding debugging info reader
-@@ -2510,6 +2528,7 @@ will only ever be implemented by one object file format may be called
+@@ -2509,6 +2527,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}.
  
@@ -1162,7 +1015,7 @@ index 026dc59..f0f6ee3 100644
  @section Memory Management for Symbol Files
  
  Most memory associated with a loaded symbol file is stored on
-@@ -2521,10 +2540,45 @@ released when the objfile is unloaded or reloaded.  Therefore one
+@@ -2520,10 +2539,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.
  
@@ -1213,11 +1066,11 @@ index 026dc59..f0f6ee3 100644
  
  @node Language Support
 diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
-index 24233cb..efb2013 100644
+index 6827ed8..c63b901 100644
 --- a/gdb/doc/observer.texi
 +++ b/gdb/doc/observer.texi
-@@ -226,6 +226,11 @@ Called before a top-level prompt is displayed.  @var{current_prompt} is
the current top-level prompt.
+@@ -230,6 +230,11 @@ the current top-level prompt.
Variable gdb_datadir has been set.  The value may not necessarily change.
  @end deftypefun
  
 +@c @deftypefun void mark_used (void)
@@ -1228,11 +1081,55 @@ index 24233cb..efb2013 100644
  @deftypefun void test_notification (int @var{somearg})
  This observer is used for internal testing.  Do not use.  
  See testsuite/gdb.gdb/observer.exp.
+diff --git a/gdb/dsrec.c b/gdb/dsrec.c
+index d2c99b2..f39d0ed 100644
+--- a/gdb/dsrec.c
++++ b/gdb/dsrec.c
+@@ -23,6 +23,7 @@
+ #include <time.h>
+ #include "gdb_assert.h"
+ #include "gdb_string.h"
++#include "gdb_bfd.h"
+ extern void report_transfer_performance (unsigned long, time_t, time_t);
+@@ -56,19 +57,22 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
+   int reclen;
+   time_t start_time, end_time;
+   unsigned long data_count = 0;
++  struct cleanup *cleanup;
+   srec = (char *) alloca (maxrecsize + 1);
+-  abfd = bfd_openr (file, 0);
++  abfd = gdb_bfd_openr (file, 0);
+   if (!abfd)
+     {
+       printf_filtered (_("Unable to open file %s\n"), file);
+       return;
+     }
++  cleanup = make_cleanup_bfd_unref (abfd);
+   if (bfd_check_format (abfd, bfd_object) == 0)
+     {
+       printf_filtered (_("File is not an object file\n"));
++      do_cleanups (cleanup);
+       return;
+     }
+@@ -170,6 +174,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
+   serial_flush_input (desc);
+   report_transfer_performance (data_count, start_time, end_time);
++  do_cleanups (cleanup);
+ }
+ /*
 diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
-index 222fcc3..93389e0 100644
+index 214b371..d9b3751 100644
 --- a/gdb/dwarf2expr.c
 +++ b/gdb/dwarf2expr.c
-@@ -1449,6 +1449,14 @@ execute_stack_op (struct dwarf_expr_context *ctx,
+@@ -1480,6 +1480,14 @@ execute_stack_op (struct dwarf_expr_context *ctx,
          }
          break;
  
@@ -1248,16 +1145,16 @@ index 222fcc3..93389e0 100644
          error (_("Unhandled dwarf expression opcode 0x%x"), op);
        }
 diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h
-index fd70bf9..5129c4e 100644
+index 19efbfd..0e0e498 100644
 --- a/gdb/dwarf2expr.h
 +++ b/gdb/dwarf2expr.h
-@@ -73,12 +73,10 @@ struct dwarf_expr_context_funcs
-                                     int dwarf_reg, CORE_ADDR fb_offset,
-                                     int deref_size);
+@@ -78,12 +78,8 @@ struct dwarf_expr_context_funcs
+      This can throw an exception if the index is out of range.  */
+   CORE_ADDR (*get_addr_index) (void *baton, unsigned int index);
  
 -#if 0
-   /* Not yet implemented.  */
+-  /* Not yet implemented.  */
+-
    /* Return the `object address' for DW_OP_push_object_address.  */
    CORE_ADDR (*get_object_address) (void *baton);
 -#endif
@@ -1265,10 +1162,10 @@ index fd70bf9..5129c4e 100644
  
  /* The location of a value.  */
 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
-index 313df7b..35e0766 100644
+index 38e4814..46a033d 100644
 --- a/gdb/dwarf2loc.c
 +++ b/gdb/dwarf2loc.c
-@@ -157,6 +157,9 @@ struct dwarf_expr_baton
+@@ -293,6 +293,9 @@ struct dwarf_expr_baton
  {
    struct frame_info *frame;
    struct dwarf2_per_cu_data *per_cu;
@@ -1278,7 +1175,7 @@ index 313df7b..35e0766 100644
  };
  
  /* Helper functions for dwarf2_evaluate_loc_desc.  */
-@@ -216,16 +219,14 @@ static void
+@@ -352,16 +355,14 @@ static void
  dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
                         const gdb_byte **start, size_t *length)
  {
@@ -1297,7 +1194,7 @@ index 313df7b..35e0766 100644
      {
        struct dwarf2_locexpr_baton *symbaton;
  
-@@ -238,10 +239,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
+@@ -374,10 +375,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
        else
        *length = 0;
      }
@@ -1322,7 +1219,7 @@ index 313df7b..35e0766 100644
  }
  
  /* Helper function for dwarf2_evaluate_loc_desc.  Computes the CFA for
-@@ -309,6 +323,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset)
+@@ -445,6 +459,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset)
                     ctx->funcs->get_frame_pc, ctx->baton);
  }
  
@@ -1408,7 +1305,7 @@ index 313df7b..35e0766 100644
  /* Callback function for dwarf2_evaluate_loc_desc.  */
  
  static struct type *
-@@ -990,10 +1083,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx,
+@@ -1139,10 +1232,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx,
  
    saved_ctx.gdbarch = ctx->gdbarch;
    saved_ctx.addr_size = ctx->addr_size;
@@ -1421,7 +1318,7 @@ index 313df7b..35e0766 100644
    ctx->offset = dwarf2_per_cu_text_offset (baton_local.per_cu);
    ctx->baton = &baton_local;
  
-@@ -1001,10 +1096,92 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx,
+@@ -1150,10 +1245,95 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx,
  
    ctx->gdbarch = saved_ctx.gdbarch;
    ctx->addr_size = saved_ctx.addr_size;
@@ -1430,6 +1327,8 @@ index 313df7b..35e0766 100644
    ctx->baton = saved_ctx.baton;
  }
  
++static CORE_ADDR dwarf_expr_get_addr_index (void *baton, unsigned int index);
++
 +/* Virtual method table for dwarf2_evaluate_loc_desc_full below.  */
 +
 +static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs =
@@ -1443,6 +1342,7 @@ index 313df7b..35e0766 100644
 +  dwarf_expr_dwarf_call,
 +  dwarf_expr_get_base_type,
 +  dwarf_expr_push_dwarf_reg_entry_value,
++  dwarf_expr_get_addr_index,
 +  dwarf_expr_object_address
 +};
 +
@@ -1511,10 +1411,10 @@ index 313df7b..35e0766 100644
 +  return retval;
 +}
 +
- /* VALUE must be of type lval_computed with entry_data_value_funcs.  Perform
-    the indirect method on it, that is use its stored target value, the sole
-    purpose of entry_data_value_funcs..  */
-@@ -1927,21 +2104,6 @@ invalid_synthetic_pointer (void)
+ /* Callback function for dwarf2_evaluate_loc_desc.
+    Fetch the address indexed by DW_OP_GNU_addr_index.  */
+@@ -2088,22 +2268,6 @@ invalid_synthetic_pointer (void)
           "referenced via synthetic pointer"));
  }
  
@@ -1530,13 +1430,14 @@ index 313df7b..35e0766 100644
 -  dwarf_expr_tls_address,
 -  dwarf_expr_dwarf_call,
 -  dwarf_expr_get_base_type,
--  dwarf_expr_push_dwarf_reg_entry_value
+-  dwarf_expr_push_dwarf_reg_entry_value,
+-  dwarf_expr_get_addr_index
 -};
 -
  /* Evaluate a location description, starting at DATA and with length
     SIZE, to find the current location of variable of TYPE in the
     context of FRAME.  BYTE_OFFSET is applied after the contents are
-@@ -1954,7 +2116,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
+@@ -2116,7 +2280,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
                               LONGEST byte_offset)
  {
    struct value *retval;
@@ -1544,7 +1445,7 @@ index 313df7b..35e0766 100644
    struct dwarf_expr_context *ctx;
    struct cleanup *old_chain, *value_chain;
    struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
-@@ -1966,29 +2127,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
+@@ -2128,29 +2291,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
    if (size == 0)
      return allocate_optimized_out_value (type);
  
@@ -1575,7 +1476,7 @@ index 313df7b..35e0766 100644
          retval = allocate_value (type);
          mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type));
          return retval;
-@@ -2052,6 +2202,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
+@@ -2214,6 +2366,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
            int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
  
            do_cleanups (value_chain);
@@ -1592,7 +1493,7 @@ index 313df7b..35e0766 100644
            retval = allocate_value_lazy (type);
            VALUE_LVAL (retval) = lval_memory;
            if (in_stack_memory)
-@@ -3896,8 +4056,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
+@@ -4130,8 +4292,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch,
                               dlbaton->per_cu);
  }
  
@@ -1602,7 +1503,7 @@ index 313df7b..35e0766 100644
  const struct symbol_computed_ops dwarf2_loclist_funcs = {
    loclist_read_variable,
    loclist_read_variable_at_entry,
-@@ -3906,6 +4065,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = {
+@@ -4140,6 +4301,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = {
    loclist_tracepoint_var_ref
  };
  
@@ -1648,14 +1549,14 @@ index 313df7b..35e0766 100644
 +  missing_tracepoint_var_ref
 +};
 +
- void
- _initialize_dwarf2loc (void)
- {
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+ extern initialize_file_ftype _initialize_dwarf2loc;
 diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
-index a7f835f..52a44f1 100644
+index e9d06a3..bfa6776 100644
 --- a/gdb/dwarf2loc.h
 +++ b/gdb/dwarf2loc.h
-@@ -118,6 +118,15 @@ struct dwarf2_loclist_baton
+@@ -127,6 +127,15 @@ struct dwarf2_loclist_baton
  
  extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
  extern const struct symbol_computed_ops dwarf2_loclist_funcs;
@@ -1672,10 +1573,145 @@ index a7f835f..52a44f1 100644
  /* Compile a DWARF location expression to an agent expression.
     
 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 0ef0a5b..80e5fe4 100644
+index deee5a2..b2f052b 100644
 --- a/gdb/dwarf2read.c
 +++ b/gdb/dwarf2read.c
-@@ -1209,6 +1209,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu,
+@@ -64,20 +64,12 @@
+ #include "gdbcore.h" /* for gnutarget */
+ #include "gdb/gdb-index.h"
+ #include <ctype.h>
++#include "gdb_bfd.h"
+ #include <fcntl.h>
+ #include "gdb_string.h"
+ #include "gdb_assert.h"
+ #include <sys/types.h>
+-#ifdef HAVE_ZLIB_H
+-#include <zlib.h>
+-#endif
+-#ifdef HAVE_MMAP
+-#include <sys/mman.h>
+-#ifndef MAP_FAILED
+-#define MAP_FAILED ((void *) -1)
+-#endif
+-#endif
+ typedef struct symbol *symbolp;
+ DEF_VEC_P (symbolp);
+@@ -95,8 +87,6 @@ static int check_physname = 0;
+ /* When non-zero, do not reject deprecated .gdb_index sections.  */
+ static int use_deprecated_index_sections = 0;
+-static int pagesize;
+-
+ /* When set, the file that we're processing is known to have debugging
+    info for C++ namespaces.  GCC 3.3.x did not produce this information,
+    but later versions do.  */
+@@ -110,10 +100,6 @@ struct dwarf2_section_info
+   asection *asection;
+   gdb_byte *buffer;
+   bfd_size_type size;
+-  /* Not NULL if the section was actually mmapped.  */
+-  void *map_addr;
+-  /* Page aligned size of mmapped area.  */
+-  bfd_size_type map_len;
+   /* True if we have tried to read this section.  */
+   int readin;
+ };
+@@ -247,6 +233,10 @@ struct dwarf2_per_objfile
+      This is NULL if the table hasn't been allocated yet.  */
+   htab_t dwo_files;
++  /* The shared '.dwz' file, if one exists.  This is used when the
++     original data was compressed using 'dwz -m'.  */
++  struct dwz_file *dwz_file;
++
+   /* A flag indicating wether this objfile has a section loaded at a
+      VMA of 0.  */
+   int has_section_at_zero;
+@@ -505,15 +495,13 @@ struct dwarf2_cu
+ struct dwarf2_per_cu_data
+ {
+-  /* The start offset and length of this compilation unit.  2**29-1
+-     bytes should suffice to store the length of any compilation unit
+-     - if it doesn't, GDB will fall over anyway.
++  /* The start offset and length of this compilation unit.
+      NOTE: Unlike comp_unit_head.length, this length includes
+      initial_length_size.
+      If the DIE refers to a DWO file, this is always of the original die,
+      not the DWO file.  */
+   sect_offset offset;
+-  unsigned int length : 29;
++  unsigned int length;
+   /* Flag indicating this compilation unit will be read in before
+      any of the current compilation units are processed.  */
+@@ -528,6 +516,9 @@ struct dwarf2_per_cu_data
+   /* Non-zero if this CU is from .debug_types.  */
+   unsigned int is_debug_types : 1;
++  /* Non-zero if this CU is from the .dwz file.  */
++  unsigned int is_dwz : 1;
++
+   /* The section this CU/TU lives in.
+      If the DIE refers to a DWO file, this is always the original die,
+      not the DWO file.  */
+@@ -715,6 +706,22 @@ struct dwo_file
+   htab_t tus;
+ };
++/* This represents a '.dwz' file.  */
++
++struct dwz_file
++{
++  /* A dwz file can only contain a few sections.  */
++  struct dwarf2_section_info abbrev;
++  struct dwarf2_section_info info;
++  struct dwarf2_section_info str;
++  struct dwarf2_section_info line;
++  struct dwarf2_section_info macro;
++  struct dwarf2_section_info gdb_index;
++
++  /* The dwz's BFD.  */
++  bfd *dwz_bfd;
++};
++
+ /* Struct used to pass misc. parameters to read_die_and_children, et
+    al.  which are used for both .debug_info and .debug_types dies.
+    All parameters here are unchanging for the life of the call.  This
+@@ -828,6 +835,12 @@ struct partial_die_info
+     /* Flag set if fixup_partial_die has been called on this die.  */
+     unsigned int fixup_called : 1;
++    /* Flag set if DW_TAG_imported_unit uses DW_FORM_GNU_ref_alt.  */
++    unsigned int is_dwz : 1;
++
++    /* Flag set if spec_offset uses DW_FORM_GNU_ref_alt.  */
++    unsigned int spec_is_dwz : 1;
++
+     /* The name of this DIE.  Normally the value of DW_AT_name, but
+        sometimes a default name for unnamed DIEs.  */
+     char *name;
+@@ -1213,7 +1226,7 @@ static gdb_byte *read_partial_die (const struct die_reader_specs *,
+                                  unsigned int,
+                                  gdb_byte *);
+-static struct partial_die_info *find_partial_die (sect_offset,
++static struct partial_die_info *find_partial_die (sect_offset, int,
+                                                 struct dwarf2_cu *);
+ static void fixup_partial_die (struct partial_die_info *,
+@@ -1258,6 +1271,8 @@ static char *read_indirect_string (bfd *, gdb_byte *,
+                                    const struct comp_unit_head *,
+                                    unsigned int *);
++static char *read_indirect_string_from_dwz (struct dwz_file *, LONGEST);
++
+ static ULONGEST read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *);
+ static LONGEST read_signed_leb128 (bfd *, gdb_byte *, unsigned int *);
+@@ -1509,6 +1524,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu,
                                   struct dwarf2_loclist_baton *baton,
                                   struct attribute *attr);
  
@@ -1685,9 +1721,18 @@ index 0ef0a5b..80e5fe4 100644
  static void dwarf2_symbol_mark_computed (struct attribute *attr,
                                         struct symbol *sym,
                                         struct dwarf2_cu *cu);
-@@ -1240,6 +1243,9 @@ static void age_cached_comp_units (void);
+@@ -1524,7 +1542,7 @@ static hashval_t partial_die_hash (const void *item);
+ static int partial_die_eq (const void *item_lhs, const void *item_rhs);
+ static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit
+-  (sect_offset offset, struct objfile *objfile);
++  (sect_offset offset, unsigned int offset_in_dwz, struct objfile *objfile);
  
- static void free_one_cached_comp_unit (void *);
+ static void init_one_comp_unit (struct dwarf2_cu *cu,
+                               struct dwarf2_per_cu_data *per_cu);
+@@ -1541,6 +1559,9 @@ static void age_cached_comp_units (void);
+ static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *);
  
 +static void fetch_die_type_attrs (struct die_info *die, struct type *type,
 +                                struct dwarf2_cu *cu);
@@ -1695,7 +1740,7 @@ index 0ef0a5b..80e5fe4 100644
  static struct type *set_die_type (struct die_info *, struct type *,
                                  struct dwarf2_cu *);
  
-@@ -1263,6 +1269,9 @@ static struct type *get_die_type_at_offset (unsigned int,
+@@ -1569,6 +1590,9 @@ static struct type *get_die_type_at_offset (sect_offset,
  
  static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
  
@@ -1704,66 +1749,920 @@ index 0ef0a5b..80e5fe4 100644
 +
  static void dwarf2_release_queue (void *dummy);
  
- static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu);
-@@ -8001,6 +8010,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
-   new_symbol (die, this_type, cu);
+ static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu,
+@@ -1587,6 +1611,12 @@ static void find_file_and_directory (struct die_info *die,
+ static char *file_full_name (int file, struct line_header *lh,
+                            const char *comp_dir);
++static gdb_byte *read_and_check_comp_unit_head
++  (struct comp_unit_head *header,
++   struct dwarf2_section_info *section,
++   struct dwarf2_section_info *abbrev_section, gdb_byte *info_ptr,
++   int is_debug_types_section);
++
+ static void init_cutu_and_read_dies
+   (struct dwarf2_per_cu_data *this_cu, struct abbrev_table *abbrev_table,
+    int use_existing_cu, int keep,
+@@ -1608,8 +1638,6 @@ static struct dwo_unit *lookup_dwo_type_unit
+ static void free_dwo_file_cleanup (void *);
+-static void munmap_section_buffer (struct dwarf2_section_info *);
+-
+ static void process_cu_includes (void);
+ #if WORDS_BIGENDIAN
+@@ -1779,85 +1807,6 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames)
+     dwarf2_per_objfile->has_section_at_zero = 1;
  }
  
-+/* Create a new array dimension referencing its target type TYPE.
+-/* Decompress a section that was compressed using zlib.  Store the
+-   decompressed buffer, and its size, in OUTBUF and OUTSIZE.  */
+-
+-static void
+-zlib_decompress_section (struct objfile *objfile, asection *sectp,
+-                         gdb_byte **outbuf, bfd_size_type *outsize)
+-{
+-  bfd *abfd = sectp->owner;
+-#ifndef HAVE_ZLIB_H
+-  error (_("Support for zlib-compressed DWARF data (from '%s') "
+-           "is disabled in this copy of GDB"),
+-         bfd_get_filename (abfd));
+-#else
+-  bfd_size_type compressed_size = bfd_get_section_size (sectp);
+-  gdb_byte *compressed_buffer = xmalloc (compressed_size);
+-  struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer);
+-  bfd_size_type uncompressed_size;
+-  gdb_byte *uncompressed_buffer;
+-  z_stream strm;
+-  int rc;
+-  int header_size = 12;
+-
+-  if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
+-      || bfd_bread (compressed_buffer,
+-                  compressed_size, abfd) != compressed_size)
+-    error (_("Dwarf Error: Can't read DWARF data from '%s'"),
+-           bfd_get_filename (abfd));
+-
+-  /* Read the zlib header.  In this case, it should be "ZLIB" followed
+-     by the uncompressed section size, 8 bytes in big-endian order.  */
+-  if (compressed_size < header_size
+-      || strncmp (compressed_buffer, "ZLIB", 4) != 0)
+-    error (_("Dwarf Error: Corrupt DWARF ZLIB header from '%s'"),
+-           bfd_get_filename (abfd));
+-  uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
+-  uncompressed_size += compressed_buffer[11];
+-
+-  /* It is possible the section consists of several compressed
+-     buffers concatenated together, so we uncompress in a loop.  */
+-  strm.zalloc = NULL;
+-  strm.zfree = NULL;
+-  strm.opaque = NULL;
+-  strm.avail_in = compressed_size - header_size;
+-  strm.next_in = (Bytef*) compressed_buffer + header_size;
+-  strm.avail_out = uncompressed_size;
+-  uncompressed_buffer = obstack_alloc (&objfile->objfile_obstack,
+-                                       uncompressed_size);
+-  rc = inflateInit (&strm);
+-  while (strm.avail_in > 0)
+-    {
+-      if (rc != Z_OK)
+-        error (_("Dwarf Error: setting up DWARF uncompression in '%s': %d"),
+-               bfd_get_filename (abfd), rc);
+-      strm.next_out = ((Bytef*) uncompressed_buffer
+-                       + (uncompressed_size - strm.avail_out));
+-      rc = inflate (&strm, Z_FINISH);
+-      if (rc != Z_STREAM_END)
+-        error (_("Dwarf Error: zlib error uncompressing from '%s': %d"),
+-               bfd_get_filename (abfd), rc);
+-      rc = inflateReset (&strm);
+-    }
+-  rc = inflateEnd (&strm);
+-  if (rc != Z_OK
+-      || strm.avail_out != 0)
+-    error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"),
+-           bfd_get_filename (abfd), rc);
+-
+-  do_cleanups (cleanup);
+-  *outbuf = uncompressed_buffer;
+-  *outsize = uncompressed_size;
+-#endif
+-}
+-
+ /* A helper function that decides whether a section is empty,
+    or not present.  */
+@@ -1884,56 +1833,27 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info)
+   if (info->readin)
+     return;
+   info->buffer = NULL;
+-  info->map_addr = NULL;
+   info->readin = 1;
+   if (dwarf2_section_empty_p (info))
+     return;
+-  /* Note that ABFD may not be from OBJFILE, e.g. a DWO section.  */
+   abfd = sectp->owner;
+-  /* Check if the file has a 4-byte header indicating compression.  */
+-  if (info->size > sizeof (header)
+-      && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0
+-      && bfd_bread (header, sizeof (header), abfd) == sizeof (header))
+-    {
+-      /* Upon decompression, update the buffer and its size.  */
+-      if (strncmp (header, "ZLIB", sizeof (header)) == 0)
+-        {
+-          zlib_decompress_section (objfile, sectp, &info->buffer,
+-                                 &info->size);
+-          return;
+-        }
+-    }
+-
+-#ifdef HAVE_MMAP
+-  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.  */
+-
+-  if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0)
++  /* If the section has relocations, we must read it ourselves.
++     Otherwise we attach it to the BFD.  */
++  if ((sectp->flags & SEC_RELOC) == 0)
+     {
+-      info->buffer = bfd_mmap (abfd, 0, info->size, PROT_READ,
+-                         MAP_PRIVATE, sectp->filepos,
+-                         &info->map_addr, &info->map_len);
++      const gdb_byte *bytes = gdb_bfd_map_section (sectp, &info->size);
+-      if ((caddr_t)info->buffer != MAP_FAILED)
+-      {
+-#if HAVE_POSIX_MADVISE
+-        posix_madvise (info->map_addr, info->map_len, POSIX_MADV_WILLNEED);
+-#endif
+-        return;
+-      }
++      /* We have to cast away const here for historical reasons.
++       Fixing dwarf2read to be const-correct would be quite nice.  */
++      info->buffer = (gdb_byte *) bytes;
++      return;
+     }
+-#endif
+-  /* If we get here, we are a normal, not-compressed section.  */
+-  info->buffer = buf
+-    = obstack_alloc (&objfile->objfile_obstack, info->size);
++  buf = obstack_alloc (&objfile->objfile_obstack, info->size);
++  info->buffer = buf;
+   /* When debugging .o files, we may need to apply relocations; see
+      http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html .
+@@ -2009,6 +1929,111 @@ dwarf2_get_section_info (struct objfile *objfile,
+   *sizep = info->size;
+ }
++/* A helper function to find the sections for a .dwz file.  */
 +
-+   Multidimensional arrays are internally represented as a stack of
-+   singledimensional arrays being referenced by their TYPE_TARGET_TYPE.  */
++static void
++locate_dwz_sections (bfd *abfd, asection *sectp, void *arg)
++{
++  struct dwz_file *dwz_file = arg;
 +
-+static struct type *
-+create_single_array_dimension (struct type *type, struct type *range_type,
-+                             struct die_info *die, struct dwarf2_cu *cu)
++  /* Note that we only support the standard ELF names, because .dwz
++     is ELF-only (at the time of writing).  */
++  if (section_is_p (sectp->name, &dwarf2_elf_names.abbrev))
++    {
++      dwz_file->abbrev.asection = sectp;
++      dwz_file->abbrev.size = bfd_get_section_size (sectp);
++    }
++  else if (section_is_p (sectp->name, &dwarf2_elf_names.info))
++    {
++      dwz_file->info.asection = sectp;
++      dwz_file->info.size = bfd_get_section_size (sectp);
++    }
++  else if (section_is_p (sectp->name, &dwarf2_elf_names.str))
++    {
++      dwz_file->str.asection = sectp;
++      dwz_file->str.size = bfd_get_section_size (sectp);
++    }
++  else if (section_is_p (sectp->name, &dwarf2_elf_names.line))
++    {
++      dwz_file->line.asection = sectp;
++      dwz_file->line.size = bfd_get_section_size (sectp);
++    }
++  else if (section_is_p (sectp->name, &dwarf2_elf_names.macro))
++    {
++      dwz_file->macro.asection = sectp;
++      dwz_file->macro.size = bfd_get_section_size (sectp);
++    }
++  else if (section_is_p (sectp->name, &dwarf2_elf_names.gdb_index))
++    {
++      dwz_file->gdb_index.asection = sectp;
++      dwz_file->gdb_index.size = bfd_get_section_size (sectp);
++    }
++}
++
++/* Open the separate '.dwz' debug file, if needed.  Error if the file
++   cannot be found.  */
++
++static struct dwz_file *
++dwarf2_get_dwz_file (void)
 +{
-+  type = create_array_type (NULL, type, range_type);
++  bfd *abfd, *dwz_bfd;
++  asection *section;
++  gdb_byte *data;
++  struct cleanup *cleanup;
++  const char *filename;
++  struct dwz_file *result;
++
++  if (dwarf2_per_objfile->dwz_file != NULL)
++    return dwarf2_per_objfile->dwz_file;
++
++  abfd = dwarf2_per_objfile->objfile->obfd;
++  section = bfd_get_section_by_name (abfd, ".gnu_debugaltlink");
++  if (section == NULL)
++    error (_("could not find '.gnu_debugaltlink' section"));
++  if (!bfd_malloc_and_get_section (abfd, section, &data))
++    error (_("could not read '.gnu_debugaltlink' section: %s"),
++         bfd_errmsg (bfd_get_error ()));
++  cleanup = make_cleanup (xfree, data);
++
++  filename = data;
++  if (!IS_ABSOLUTE_PATH (filename))
++    {
++      char *abs = gdb_realpath (dwarf2_per_objfile->objfile->name);
++      char *rel;
 +
-+  /* These generic type attributes need to be fetched by
-+     evaluate_subexp_standard <multi_f77_subscript>'s call of
-+     value_subscripted_rvalue only for the innermost array type.  */
-+  fetch_die_type_attrs (die, type, cu);
++      make_cleanup (xfree, abs);
++      abs = ldirname (abs);
++      make_cleanup (xfree, abs);
 +
-+  /* These generic type attributes are checked for allocated/associated
-+     validity while accessing FIELD_LOC_KIND_DWARF_BLOCK.  */
-+  fetch_die_type_attrs (die, range_type, cu);
++      rel = concat (abs, SLASH_STRING, filename, (char *) NULL);
++      make_cleanup (xfree, rel);
++      filename = rel;
++    }
 +
-+  return type;
-+}
++  /* The format is just a NUL-terminated file name, followed by the
++     build-id.  For now, though, we ignore the build-id.  */
++  dwz_bfd = gdb_bfd_open (filename, gnutarget, -1);
++  if (dwz_bfd == NULL)
++    error (_("could not read '%s': %s"), filename,
++         bfd_errmsg (bfd_get_error ()));
 +
- /* 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.  */
-@@ -8014,7 +8046,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
-   struct type *element_type, *range_type, *index_type;
-   struct type **range_types = NULL;
-   struct attribute *attr;
--  int ndim = 0;
-+  int ndim = 0, i;
-   struct cleanup *back_to;
-   char *name;
++  if (!bfd_check_format (dwz_bfd, bfd_object))
++    {
++      gdb_bfd_unref (dwz_bfd);
++      error (_("file '%s' was not usable: %s"), filename,
++           bfd_errmsg (bfd_get_error ()));
++    }
++
++  result = OBSTACK_ZALLOC (&dwarf2_per_objfile->objfile->objfile_obstack,
++                         struct dwz_file);
++  result->dwz_bfd = dwz_bfd;
++
++  bfd_map_over_sections (dwz_bfd, locate_dwz_sections, result);
++
++  do_cleanups (cleanup);
++
++  return result;
++}
\f
+ /* DWARF quick_symbols_functions support.  */
  
-@@ -8067,17 +8099,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
-   type = element_type;
+@@ -2279,23 +2304,19 @@ extract_cu_value (const char *bytes, ULONGEST *result)
+   return 1;
+ }
  
-   if (read_array_order (die, cu) == DW_ORD_col_major)
--    {
--      int i = 0;
+-/* 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.  */
++/* A helper for create_cus_from_index that handles a given list of
++   CUs.  */
+ static int
+-create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list,
+-                     offset_type cu_list_elements)
++create_cus_from_index_list (struct objfile *objfile,
++                          const gdb_byte *cu_list, offset_type n_elements,
++                          struct dwarf2_section_info *section,
++                          int is_dwz,
++                          int base_offset)
+ {
+   offset_type i;
+-  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 *));
 -
--      while (i < ndim)
--      type = create_array_type (NULL, type, range_types[i++]);
--    }
--  else
--    {
--      while (ndim-- > 0)
--      type = create_array_type (NULL, type, range_types[ndim]);
--    }
-+    for (i = 0; i < ndim; i++)
-+      type = create_single_array_dimension (type, range_types[i], die, cu);
-+  else /* (read_array_order (die, cu) == DW_ORD_row_major) */
-+    for (i = ndim - 1; i >= 0; i--)
-+      type = create_single_array_dimension (type, range_types[i], die, cu);
+-  for (i = 0; i < cu_list_elements; i += 2)
++  for (i = 0; i < n_elements; i += 2)
+     {
+       struct dwarf2_per_cu_data *the_cu;
+       ULONGEST offset, length;
+@@ -2310,15 +2331,45 @@ create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list,
+       the_cu->offset.sect_off = offset;
+       the_cu->length = length;
+       the_cu->objfile = objfile;
+-      the_cu->info_or_types_section = &dwarf2_per_objfile->info;
++      the_cu->info_or_types_section = section;
+       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;
++      the_cu->is_dwz = is_dwz;
++      dwarf2_per_objfile->all_comp_units[base_offset + i / 2] = the_cu;
+     }
+   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,
++                     const gdb_byte *cu_list, offset_type cu_list_elements,
++                     const gdb_byte *dwz_list, offset_type dwz_elements)
++{
++  struct dwz_file *dwz;
++
++  dwarf2_per_objfile->n_comp_units = (cu_list_elements + dwz_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 *));
++
++  if (!create_cus_from_index_list (objfile, cu_list, cu_list_elements,
++                                 &dwarf2_per_objfile->info, 0, 0))
++    return 0;
++
++  if (dwz_elements == 0)
++    return 1;
++
++  dwz = dwarf2_get_dwz_file ();
++  return create_cus_from_index_list (objfile, dwz_list, dwz_elements,
++                                   &dwz->info, 1, cu_list_elements / 2);
++}
++
+ /* Create the signatured type hash table from the index.  */
+ static int
+@@ -2508,33 +2559,44 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
+     }
+ }
+-/* Read the index file.  If everything went ok, initialize the "quick"
+-   elements of all the CUs and return 1.  Otherwise, return 0.  */
++/* A helper function that reads the .gdb_index from SECTION and fills
++   in MAP.  FILENAME is the name of the file containing the section;
++   it is used for error reporting.  DEPRECATED_OK is nonzero if it is
++   ok to use deprecated sections.
++
++   CU_LIST, CU_LIST_ELEMENTS, TYPES_LIST, and TYPES_LIST_ELEMENTS are
++   out parameters that are filled in with information about the CU and
++   TU lists in the section.
++
++   Returns 1 if all went well, 0 otherwise.  */
+ static int
+-dwarf2_read_index (struct objfile *objfile)
++read_index_from_section (struct objfile *objfile,
++                       const char *filename,
++                       int deprecated_ok,
++                       struct dwarf2_section_info *section,
++                       struct mapped_index *map,
++                       const gdb_byte **cu_list,
++                       offset_type *cu_list_elements,
++                       const gdb_byte **types_list,
++                       offset_type *types_list_elements)
+ {
+   char *addr;
+-  struct mapped_index *map;
++  offset_type version;
+   offset_type *metadata;
+-  const gdb_byte *cu_list;
+-  const gdb_byte *types_list = NULL;
+-  offset_type version, cu_list_elements;
+-  offset_type types_list_elements = 0;
+   int i;
+-  if (dwarf2_section_empty_p (&dwarf2_per_objfile->gdb_index))
++  if (dwarf2_section_empty_p (section))
+     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)
++  if ((bfd_get_file_flags (section->asection) & SEC_HAS_CONTENTS) == 0)
+     return 0;
+-  dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index);
++  dwarf2_read_section (objfile, section);
+-  addr = dwarf2_per_objfile->gdb_index.buffer;
++  addr = section->buffer;
+   /* Version check.  */
+   version = MAYBE_SWAP (*(offset_type *) addr);
+   /* Versions earlier than 3 emitted every copy of a psymbol.  This
+@@ -2547,7 +2609,7 @@ dwarf2_read_index (struct objfile *objfile)
+       if (!warning_printed)
+       {
+         warning (_("Skipping obsolete .gdb_index section in %s."),
+-                 objfile->name);
++                 filename);
+         warning_printed = 1;
+       }
+       return 0;
+@@ -2560,7 +2622,7 @@ dwarf2_read_index (struct objfile *objfile)
+      set breakpoints on inlined functions by name, so we ignore these
+      indices unless the user has done
+      "set use-deprecated-index-sections on".  */
+-  if (version < 6 && !use_deprecated_index_sections)
++  if (version < 6 && !deprecated_ok)
+     {
+       static int warning_printed = 0;
+       if (!warning_printed)
+@@ -2569,7 +2631,7 @@ dwarf2_read_index (struct objfile *objfile)
+ Skipping deprecated .gdb_index section in %s.\n\
+ Do \"set use-deprecated-index-sections on\" before the file is read\n\
+ to use the section anyway."),
+-                 objfile->name);
++                 filename);
+         warning_printed = 1;
+       }
+       return 0;
+@@ -2579,22 +2641,21 @@ to use the section anyway."),
+   if (version > 7)
+     return 0;
+-  map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index);
+   map->version = version;
+-  map->total_size = dwarf2_per_objfile->gdb_index.size;
++  map->total_size = section->size;
+   metadata = (offset_type *) (addr + sizeof (offset_type));
+   i = 0;
+-  cu_list = addr + MAYBE_SWAP (metadata[i]);
+-  cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i]))
+-                    / 8);
++  *cu_list = addr + MAYBE_SWAP (metadata[i]);
++  *cu_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);
++  *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]);
+@@ -2610,11 +2671,55 @@ to use the section anyway."),
+   map->constant_pool = addr + MAYBE_SWAP (metadata[i]);
++  return 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)
++{
++  struct mapped_index local_map, *map;
++  const gdb_byte *cu_list, *types_list, *dwz_list = NULL;
++  offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0;
++
++  if (!read_index_from_section (objfile, objfile->name,
++                              use_deprecated_index_sections,
++                              &dwarf2_per_objfile->gdb_index, &local_map,
++                              &cu_list, &cu_list_elements,
++                              &types_list, &types_list_elements))
++    return 0;
++
+   /* Don't use the index if it's empty.  */
+-  if (map->symbol_table_slots == 0)
++  if (local_map.symbol_table_slots == 0)
+     return 0;
+-  if (!create_cus_from_index (objfile, cu_list, cu_list_elements))
++  /* If there is a .dwz file, read it so we can get its CU list as
++     well.  */
++  if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL)
++    {
++      struct dwz_file *dwz = dwarf2_get_dwz_file ();
++      struct mapped_index dwz_map;
++      const gdb_byte *dwz_types_ignore;
++      offset_type dwz_types_elements_ignore;
++
++      if (!read_index_from_section (objfile, bfd_get_filename (dwz->dwz_bfd),
++                                  1,
++                                  &dwz->gdb_index, &dwz_map,
++                                  &dwz_list, &dwz_list_elements,
++                                  &dwz_types_ignore,
++                                  &dwz_types_elements_ignore))
++      {
++        warning (_("could not read '.gdb_index' section from %s; skipping"),
++                 bfd_get_filename (dwz->dwz_bfd));
++        return 0;
++      }
++    }
++
++  if (!create_cus_from_index (objfile, cu_list, cu_list_elements,
++                            dwz_list, dwz_list_elements))
+     return 0;
+   if (types_list_elements)
+@@ -2635,7 +2740,10 @@ to use the section anyway."),
+       return 0;
+     }
+-  create_addrmap_from_index (objfile, map);
++  create_addrmap_from_index (objfile, &local_map);
++
++  map = obstack_alloc (&objfile->objfile_obstack, sizeof (struct mapped_index));
++  *map = local_map;
+   dwarf2_per_objfile->index_table = map;
+   dwarf2_per_objfile->using_index = 1;
+@@ -3686,6 +3794,22 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
+   return info_ptr;
+ }
++/* Helper function that returns the proper abbrev section for
++   THIS_CU.  */
++
++static struct dwarf2_section_info *
++get_abbrev_section_for_cu (struct dwarf2_per_cu_data *this_cu)
++{
++  struct dwarf2_section_info *abbrev;
++
++  if (this_cu->is_dwz)
++    abbrev = &dwarf2_get_dwz_file ()->abbrev;
++  else
++    abbrev = &dwarf2_per_objfile->abbrev;
++
++  return abbrev;
++}
++
+ /* Subroutine of read_and_check_comp_unit_head and
+    read_and_check_type_unit_head to simplify them.
+    Perform various error checking on the header.  */
+@@ -3704,8 +3828,7 @@ error_check_comp_unit_head (struct comp_unit_head *header,
+          filename);
+   if (header->abbrev_offset.sect_off
+-      >= dwarf2_section_size (dwarf2_per_objfile->objfile,
+-                            &dwarf2_per_objfile->abbrev))
++      >= dwarf2_section_size (dwarf2_per_objfile->objfile, abbrev_section))
+     error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header "
+          "(offset 0x%lx + 6) [in module %s]"),
+          (long) header->abbrev_offset.sect_off, (long) header->offset.sect_off,
+@@ -3942,6 +4065,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
+     {
+       bfd *abfd;
+       gdb_byte *info_ptr, *end_ptr;
++      struct dwarf2_section_info *abbrev_section;
+       dwarf2_read_section (objfile, section);
+       info_ptr = section->buffer;
+@@ -3953,6 +4077,11 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
+        not present, in which case section->asection will be NULL.  */
+       abfd = section->asection->owner;
++      if (dwo_file)
++      abbrev_section = &dwo_file->sections.abbrev;
++      else
++      abbrev_section = &dwarf2_per_objfile->abbrev;
++
+       if (types_htab == NULL)
+       {
+         if (dwo_file)
+@@ -4192,7 +4321,8 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu,
+   dwarf2_read_section (objfile, section);
+   begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off;
+-  abbrev_section = &dwarf2_per_objfile->abbrev;
++
++  abbrev_section = get_abbrev_section_for_cu (this_cu);
+   if (use_existing_cu && this_cu->cu != NULL)
+     {
+@@ -4574,7 +4704,7 @@ init_cutu_and_read_dies_simple (struct dwarf2_per_cu_data *this_cu,
+                               void *data)
+ {
+   init_cutu_and_read_dies_no_follow (this_cu,
+-                                   &dwarf2_per_objfile->abbrev,
++                                   get_abbrev_section_for_cu (this_cu),
+                                    NULL,
+                                    die_reader_func, data);
+ }
+@@ -5202,6 +5332,9 @@ set_partial_user (struct objfile *objfile)
+       struct partial_symtab *pst = per_cu->v.psymtab;
+       int j;
++      if (pst == NULL)
++      continue;
++
+       for (j = 0; j < pst->number_of_dependencies; ++j)
+       {
+         /* Set the 'user' field only if it is not already set.  */
+@@ -5296,38 +5429,32 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu)
+                          load_partial_comp_unit_reader, NULL);
+ }
+-/* Create a list of all compilation units in OBJFILE.
+-   This is only done for -readnow and building partial symtabs.  */
+-
+ static void
+-create_all_comp_units (struct objfile *objfile)
++read_comp_units_from_section (struct objfile *objfile,
++                            struct dwarf2_section_info *section,
++                            unsigned int is_dwz,
++                            int *n_allocated,
++                            int *n_comp_units,
++                            struct dwarf2_per_cu_data ***all_comp_units)
+ {
+-  int n_allocated;
+-  int n_comp_units;
+-  struct dwarf2_per_cu_data **all_comp_units;
+   gdb_byte *info_ptr;
++  bfd *abfd = section->asection->owner;
+-  dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
+-  info_ptr = dwarf2_per_objfile->info.buffer;
++  dwarf2_read_section (objfile, section);
+-  n_comp_units = 0;
+-  n_allocated = 10;
+-  all_comp_units = xmalloc (n_allocated
+-                          * sizeof (struct dwarf2_per_cu_data *));
++  info_ptr = section->buffer;
+-  while (info_ptr < dwarf2_per_objfile->info.buffer
+-       + dwarf2_per_objfile->info.size)
++  while (info_ptr < section->buffer + section->size)
+     {
+       unsigned int length, initial_length_size;
+       struct dwarf2_per_cu_data *this_cu;
+       sect_offset offset;
+-      offset.sect_off = info_ptr - dwarf2_per_objfile->info.buffer;
++      offset.sect_off = info_ptr - section->buffer;
+       /* Read just enough information to find out where the next
+        compilation unit is.  */
+-      length = read_initial_length (objfile->obfd, info_ptr,
+-                                  &initial_length_size);
++      length = read_initial_length (abfd, info_ptr, &initial_length_size);
+       /* Save the compilation unit for later lookup.  */
+       this_cu = obstack_alloc (&objfile->objfile_obstack,
+@@ -5335,20 +5462,50 @@ 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->is_dwz = is_dwz;
+       this_cu->objfile = objfile;
+-      this_cu->info_or_types_section = &dwarf2_per_objfile->info;
++      this_cu->info_or_types_section = section;
+-      if (n_comp_units == n_allocated)
++      if (*n_comp_units == *n_allocated)
+       {
+-        n_allocated *= 2;
+-        all_comp_units = xrealloc (all_comp_units,
+-                                   n_allocated
+-                                   * sizeof (struct dwarf2_per_cu_data *));
++        *n_allocated *= 2;
++        *all_comp_units = xrealloc (*all_comp_units,
++                                    *n_allocated
++                                    * sizeof (struct dwarf2_per_cu_data *));
+       }
+-      all_comp_units[n_comp_units++] = this_cu;
++      (*all_comp_units)[*n_comp_units] = this_cu;
++      ++*n_comp_units;
+       info_ptr = info_ptr + this_cu->length;
+     }
++}
++
++/* Create a list of all compilation units in OBJFILE.
++   This is only done for -readnow and building partial symtabs.  */
++
++static void
++create_all_comp_units (struct objfile *objfile)
++{
++  int n_allocated;
++  int n_comp_units;
++  struct dwarf2_per_cu_data **all_comp_units;
++
++  n_comp_units = 0;
++  n_allocated = 10;
++  all_comp_units = xmalloc (n_allocated
++                          * sizeof (struct dwarf2_per_cu_data *));
++
++  read_comp_units_from_section (objfile, &dwarf2_per_objfile->info, 0,
++                              &n_allocated, &n_comp_units, &all_comp_units);
++
++  if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL)
++    {
++      struct dwz_file *dwz = dwarf2_get_dwz_file ();
++
++      read_comp_units_from_section (objfile, &dwz->info, 1,
++                                  &n_allocated, &n_comp_units,
++                                  &all_comp_units);
++    }
+   dwarf2_per_objfile->all_comp_units
+     = obstack_alloc (&objfile->objfile_obstack,
+@@ -5441,6 +5598,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
+                 }
+               per_cu = dwarf2_find_containing_comp_unit (pdi->d.offset,
++                                                         pdi->is_dwz,
+                                                          cu->objfile);
+               /* Go read the partial unit, if needed.  */
+@@ -5498,7 +5656,8 @@ partial_die_parent_scope (struct partial_die_info *pdi,
+   real_pdi = pdi;
+   while (real_pdi->has_specification)
+-    real_pdi = find_partial_die (real_pdi->spec_offset, cu);
++    real_pdi = find_partial_die (real_pdi->spec_offset,
++                               real_pdi->spec_is_dwz, cu);
+   parent = real_pdi->die_parent;
+   if (parent == NULL)
+@@ -5998,6 +6157,9 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr,
+         else
+           info_ptr += cu->header.offset_size;
+         break;
++      case DW_FORM_GNU_ref_alt:
++        info_ptr += cu->header.offset_size;
++        break;
+       case DW_FORM_addr:
+         info_ptr += cu->header.addr_size;
+         break;
+@@ -6027,6 +6189,7 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr,
+         break;
+       case DW_FORM_sec_offset:
+       case DW_FORM_strp:
++      case DW_FORM_GNU_strp_alt:
+         info_ptr += cu->header.offset_size;
+         break;
+       case DW_FORM_exprloc:
+@@ -6694,7 +6857,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
+      it, by scanning the DIE's below the compilation unit.  */
+   get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
+-  static_block = end_symtab_get_static_block (highpc + baseaddr, objfile, 0);
++  static_block
++    = end_symtab_get_static_block (highpc + baseaddr, objfile, 0,
++                                 per_cu->s.imported_symtabs != NULL);
+   /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges.
+      Also, DW_AT_ranges may record ranges not belonging to any child DIEs
+@@ -6845,9 +7010,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
+       struct dwarf2_per_cu_data *per_cu;
+       struct symtab *imported_symtab;
+       sect_offset offset;
++      int is_dwz;
+       offset = dwarf2_get_ref_die_offset (attr);
+-      per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
++      is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz);
++      per_cu = dwarf2_find_containing_comp_unit (offset, is_dwz, cu->objfile);
+       /* Queue the unit, if needed.  */
+       if (maybe_queue_comp_unit (cu, per_cu, cu->language))
+@@ -8116,24 +8283,21 @@ try_open_dwo_file (const char *file_name)
+   if (desc < 0)
+     return NULL;
+-  sym_bfd = bfd_fopen (absolute_name, gnutarget, FOPEN_RB, desc);
++  sym_bfd = gdb_bfd_open (absolute_name, gnutarget, desc);
+   if (!sym_bfd)
+     {
+       xfree (absolute_name);
+       return NULL;
+     }
++  xfree (absolute_name);
+   bfd_set_cacheable (sym_bfd, 1);
+   if (!bfd_check_format (sym_bfd, bfd_object))
+     {
+-      bfd_close (sym_bfd); /* This also closes desc.  */
+-      xfree (absolute_name);
++      gdb_bfd_unref (sym_bfd); /* This also closes desc.  */
+       return NULL;
+     }
+-  /* bfd_usrdata exists for applications and libbfd must not touch it.  */
+-  gdb_assert (bfd_usrdata (sym_bfd) == NULL);
+-
+   return sym_bfd;
+ }
+@@ -8325,20 +8489,7 @@ free_dwo_file (struct dwo_file *dwo_file, struct objfile *objfile)
+   struct dwarf2_section_info *section;
+   gdb_assert (dwo_file->dwo_bfd != objfile->obfd);
+-  bfd_close (dwo_file->dwo_bfd);
+-
+-  munmap_section_buffer (&dwo_file->sections.abbrev);
+-  munmap_section_buffer (&dwo_file->sections.info);
+-  munmap_section_buffer (&dwo_file->sections.line);
+-  munmap_section_buffer (&dwo_file->sections.loc);
+-  munmap_section_buffer (&dwo_file->sections.str);
+-  munmap_section_buffer (&dwo_file->sections.str_offsets);
+-
+-  for (ix = 0;
+-       VEC_iterate (dwarf2_section_info_def, dwo_file->sections.types,
+-                  ix, section);
+-       ++ix)
+-    munmap_section_buffer (section);
++  gdb_bfd_unref (dwo_file->dwo_bfd);
+   VEC_free (dwarf2_section_info_def, dwo_file->sections.types);
+ }
+@@ -10721,6 +10872,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+   new_symbol (die, this_type, cu);
+ }
++/* Create a new array dimension referencing its target type TYPE.
++
++   Multidimensional arrays are internally represented as a stack of
++   singledimensional arrays being referenced by their TYPE_TARGET_TYPE.  */
++
++static struct type *
++create_single_array_dimension (struct type *type, struct type *range_type,
++                             struct die_info *die, struct dwarf2_cu *cu)
++{
++  type = create_array_type (NULL, type, range_type);
++
++  /* These generic type attributes need to be fetched by
++     evaluate_subexp_standard <multi_f77_subscript>'s call of
++     value_subscripted_rvalue only for the innermost array type.  */
++  fetch_die_type_attrs (die, type, cu);
++
++  /* These generic type attributes are checked for allocated/associated
++     validity while accessing FIELD_LOC_KIND_DWARF_BLOCK.  */
++  fetch_die_type_attrs (die, range_type, cu);
++
++  return type;
++}
++
+ /* Extract all information from a DW_TAG_array_type DIE and put it in
+    the DIE's type field.  For now, this only handles one dimensional
+    arrays.  */
+@@ -10734,7 +10908,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+   struct type *element_type, *range_type, *index_type;
+   struct type **range_types = NULL;
+   struct attribute *attr;
+-  int ndim = 0;
++  int ndim = 0, i;
+   struct cleanup *back_to;
+   char *name;
+@@ -10787,17 +10961,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+   type = element_type;
+   if (read_array_order (die, cu) == DW_ORD_col_major)
+-    {
+-      int i = 0;
+-
+-      while (i < ndim)
+-      type = create_array_type (NULL, type, range_types[i++]);
+-    }
+-  else
+-    {
+-      while (ndim-- > 0)
+-      type = create_array_type (NULL, type, range_types[ndim]);
+-    }
++    for (i = 0; i < ndim; i++)
++      type = create_single_array_dimension (type, range_types[i], die, cu);
++  else /* (read_array_order (die, cu) == DW_ORD_row_major) */
++    for (i = ndim - 1; i >= 0; i--)
++      type = create_single_array_dimension (type, range_types[i], die, cu);
 +
 +  /* Data locations should be set only for the outermost dimension as they
 +     would be confusing for the dereferenced offset on the inner ones.  */
@@ -1775,7 +2674,7 @@ index 0ef0a5b..80e5fe4 100644
  
    /* Understand Dwarf2 support for vector types (like they occur on
       the PowerPC w/ AltiVec).  Gcc just adds another attribute to the
-@@ -8561,29 +8595,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -11281,29 +11457,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;
@@ -1819,8 +2718,8 @@ index 0ef0a5b..80e5fe4 100644
 +            ULONGEST ulongest;
 +            const gdb_byte *end;
 +
-+            end = read_uleb128 (&blk->data[1], &blk->data[blk->size],
-+                                &ulongest);
++            end = safe_read_uleb128 (&blk->data[1], &blk->data[blk->size],
++                                     &ulongest);
 +            if (end == &blk->data[blk->size])
 +              length_baton = dwarf2_attr_to_locexpr_baton (attr, cu);
 +          }
@@ -1903,43 +2802,86 @@ index 0ef0a5b..80e5fe4 100644
    char_type = language_string_char_type (cu->language_defn, gdbarch);
    type = create_string_type (NULL, char_type, range_type);
  
-@@ -8887,8 +9006,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -11607,7 +11868,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *base_type;
    struct type *range_type;
    struct attribute *attr;
--  LONGEST low = 0;
--  LONGEST high = -1;
+-  LONGEST low, high;
 +  LONGEST low;
+   int low_default_is_valid;
    char *name;
    LONGEST negative_mask;
+@@ -11663,42 +11924,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+                                     "- DIE at 0x%x [in module %s]"),
+              die->offset.sect_off, cu->objfile->name);
  
-@@ -8901,53 +9019,126 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
-   if (range_type)
-     return range_type;
--  if (cu->language == language_fortran)
+-  attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
+-  if (attr)
+-    {
+-      if (attr_form_is_block (attr) || is_ref_attr (attr))
+-        {
+-          /* GCC encodes arrays with unspecified or dynamic length
+-             with a DW_FORM_block1 attribute or a reference attribute.
+-             FIXME: GDB does not yet know how to handle dynamic
+-             arrays properly, treat them as arrays with unspecified
+-             length for now.
+-
+-             FIXME: jimb/2003-09-22: GDB does not really know
+-             how to handle arrays of unspecified length
+-             either; we just represent them as zero-length
+-             arrays.  Choose an appropriate upper bound given
+-             the lower bound we've computed above.  */
+-          high = low - 1;
+-        }
+-      else
+-        high = dwarf2_get_attr_constant_value (attr, 1);
+-    }
+-  else
 -    {
--      /* FORTRAN implies a lower bound of 1, if not given.  */
--      low = 1;
+-      attr = dwarf2_attr (die, DW_AT_count, cu);
+-      if (attr)
+-      {
+-        int count = dwarf2_get_attr_constant_value (attr, 1);
+-        high = low + count - 1;
+-      }
+-      else
+-      {
+-        /* Unspecified array length.  */
+-        high = low - 1;
+-      }
 -    }
+-
+   /* Dwarf-2 specifications explicitly allows to create subrange types
+      without specifying a base type.
+      In that case, the base type must be set to the type of
+@@ -11737,24 +11962,163 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+       }
+     }
+-  negative_mask =
 +  /* LOW_BOUND and HIGH_BOUND are set for real below.  */
 +  range_type = create_range_type (NULL, base_type, 0, -1);
 +  TYPE_UNSIGNED (range_type) = 0;
 +
 +  negative_mask = 
-+    (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
-+
+     (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
+-  if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))
+-    low |= negative_mask;
+-  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
+-    high |= negative_mask;
+-  range_type = create_range_type (NULL, base_type, low, high);
 +  /* Exclude language_ada from any TYPE_DYNAMIC constructs below.  GDB Ada
 +     supports implements the dynamic bounds in a non-DWARF way and the
 +     existing DWARF dynamic bounds are invalid, leading to memory access
 +     errors.  */
  
--  /* FIXME: For variable sized arrays either of these could be
--     a variable rather than a constant value.  We'll allow it,
--     but we don't know how to handle it.  */
-   attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
--  if (attr)
--    low = dwarf2_get_attr_constant_value (attr, 0);
+-  /* Mark arrays with dynamic length at least as an array of unspecified
+-     length.  GDB could check the boundary but before it gets implemented at
+-     least allow accessing the array elements.  */
+-  if (attr && attr_form_is_block (attr))
+-    TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
++  attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
 +  if (attr && attr_form_is_block (attr) && cu->language != language_ada)
 +    {
 +      TYPE_RANGE_DATA (range_type)->low.kind = RANGE_BOUND_KIND_DWARF_BLOCK;
@@ -1955,8 +2897,9 @@ index 0ef0a5b..80e5fe4 100644
 +      struct dwarf2_cu *target_cu = cu;
 +      struct attribute *target_loc_attr;
  
--  attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
--  if (attr)
+-  /* Ada expects an empty array on no boundary attributes.  */
+-  if (attr == NULL && cu->language != language_ada)
+-    TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
 +      target_die = follow_die_ref_or_sig (die, attr, &target_cu);
 +      gdb_assert (target_cu->objfile == cu->objfile);
 +      target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
@@ -1971,26 +2914,10 @@ index 0ef0a5b..80e5fe4 100644
 +      low = 0;
 +    }
 +  else
-     {
--      if (attr_form_is_block (attr) || is_ref_attr (attr))
--        {
--          /* GCC encodes arrays with unspecified or dynamic length
--             with a DW_FORM_block1 attribute or a reference attribute.
--             FIXME: GDB does not yet know how to handle dynamic
--             arrays properly, treat them as arrays with unspecified
--             length for now.
--
--             FIXME: jimb/2003-09-22: GDB does not really know
--             how to handle arrays of unspecified length
--             either; we just represent them as zero-length
--             arrays.  Choose an appropriate upper bound given
--             the lower bound we've computed above.  */
--          high = low - 1;
--        }
++    {
 +      if (attr && attr_form_is_constant (attr))
 +      low = dwarf2_get_attr_constant_value (attr, 0);
-       else
--        high = dwarf2_get_attr_constant_value (attr, 1);
++      else
 +      {
 +        if (cu->language == language_fortran)
 +          {
@@ -2009,24 +2936,19 @@ index 0ef0a5b..80e5fe4 100644
 +      TYPE_LOW_BOUND (range_type) = low;
 +      if (low >= 0)
 +      TYPE_UNSIGNED (range_type) = 1;
-     }
--  else
++    }
 +
 +  attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
 +  if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr)
 +              && !is_ref_attr (attr)))
-     {
-       attr = dwarf2_attr (die, DW_AT_count, cu);
--      if (attr)
--      {
--        int count = dwarf2_get_attr_constant_value (attr, 1);
--        high = low + count - 1;
++    {
++      attr = dwarf2_attr (die, DW_AT_count, cu);
 +      /* It does not hurt but it is needlessly ineffective in check_typedef.  */
 +      if (attr && (attr_form_is_block (attr) || attr_form_is_constant (attr)))
 +              {
 +        TYPE_RANGE_HIGH_BOUND_IS_COUNT (range_type) = 1;
 +        TYPE_DYNAMIC (range_type) = 1;
-       }
++      }
 +      /* Pass it now as the regular DW_AT_upper_bound.  */
 +    }
 +
@@ -2060,32 +2982,18 @@ index 0ef0a5b..80e5fe4 100644
 +
 +      if (attr && attr_form_is_constant (attr))
 +      high = dwarf2_get_attr_constant_value (attr, 0);
-       else
-       {
--        /* Unspecified array length.  */
++      else
++      {
 +        /* Ada expects an empty array on no boundary attributes.  */
 +        if (cu->language != language_ada)
 +          TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
-         high = low - 1;
-       }
++        high = low - 1;
++      }
 +      if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
 +      high |= negative_mask;
 +      TYPE_HIGH_BOUND (range_type) = high;
-     }
-   /* Dwarf-2 specifications explicitly allows to create subrange types
-@@ -8988,24 +9179,41 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
-       }
-     }
--  negative_mask =
--    (LONGEST) -1 << (TYPE_LENGTH (base_type) * TARGET_CHAR_BIT - 1);
--  if (!TYPE_UNSIGNED (base_type) && (low & negative_mask))
--    low |= negative_mask;
--  if (!TYPE_UNSIGNED (base_type) && (high & negative_mask))
--    high |= negative_mask;
--
--  range_type = create_range_type (NULL, base_type, low, high);
++    }
++
 +  /* DW_AT_bit_stride is currently unsupported as we count in bytes.  */
 +  attr = dwarf2_attr (die, DW_AT_byte_stride, cu);
 +  if (attr && attr_form_is_block (attr) && cu->language != language_ada)
@@ -2101,19 +3009,11 @@ index 0ef0a5b..80e5fe4 100644
 +      struct die_info *target_die;
 +      struct dwarf2_cu *target_cu = cu;
 +      struct attribute *target_loc_attr;
--  /* Mark arrays with dynamic length at least as an array of unspecified
--     length.  GDB could check the boundary but before it gets implemented at
--     least allow accessing the array elements.  */
--  if (attr && attr_form_is_block (attr))
--    TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
++
 +      target_die = follow_die_ref_or_sig (die, attr, &target_cu);
 +      gdb_assert (target_cu->objfile == cu->objfile);
 +      target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
--  /* Ada expects an empty array on no boundary attributes.  */
--  if (attr == NULL && cu->language != language_ada)
--    TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1;
++
 +      TYPE_RANGE_DATA (range_type)->byte_stride.kind
 +        = RANGE_BOUND_KIND_DWARF_LOCLIST;
 +      TYPE_RANGE_DATA (range_type)->byte_stride.u.dwarf_loclist.loclist
@@ -2132,7 +3032,214 @@ index 0ef0a5b..80e5fe4 100644
  
    name = dwarf2_name (die, cu);
    if (name)
-@@ -11545,10 +11753,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -12544,6 +12908,8 @@ read_partial_die (const struct die_reader_specs *reader,
+       case DW_AT_extension:
+         part_die->has_specification = 1;
+         part_die->spec_offset = dwarf2_get_ref_die_offset (&attr);
++        part_die->spec_is_dwz = (attr.form == DW_FORM_GNU_ref_alt
++                                 || cu->per_cu->is_dwz);
+         break;
+       case DW_AT_sibling:
+         /* Ignore absolute siblings, they might point outside of
+@@ -12590,7 +12956,11 @@ read_partial_die (const struct die_reader_specs *reader,
+       case DW_AT_import:
+         if (part_die->tag == DW_TAG_imported_unit)
+-          part_die->d.offset = dwarf2_get_ref_die_offset (&attr);
++          {
++            part_die->d.offset = dwarf2_get_ref_die_offset (&attr);
++            part_die->is_dwz = (attr.form == DW_FORM_GNU_ref_alt
++                                || cu->per_cu->is_dwz);
++          }
+         break;
+       default:
+@@ -12661,13 +13031,14 @@ find_partial_die_in_comp_unit (sect_offset offset, struct dwarf2_cu *cu)
+    DW_FORM_ref_sig8).  */
+ static struct partial_die_info *
+-find_partial_die (sect_offset offset, struct dwarf2_cu *cu)
++find_partial_die (sect_offset offset, int offset_in_dwz, struct dwarf2_cu *cu)
+ {
+   struct objfile *objfile = cu->objfile;
+   struct dwarf2_per_cu_data *per_cu = NULL;
+   struct partial_die_info *pd = NULL;
+-  if (offset_in_cu_p (&cu->header, offset))
++  if (offset_in_dwz == cu->per_cu->is_dwz
++      && offset_in_cu_p (&cu->header, offset))
+     {
+       pd = find_partial_die_in_comp_unit (offset, cu);
+       if (pd != NULL)
+@@ -12686,7 +13057,8 @@ find_partial_die (sect_offset offset, struct dwarf2_cu *cu)
+                (long) cu->header.offset.sect_off, (long) offset.sect_off,
+                bfd_get_filename (objfile->obfd));
+       }
+-      per_cu = dwarf2_find_containing_comp_unit (offset, objfile);
++      per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz,
++                                               objfile);
+       if (per_cu->cu == NULL || per_cu->cu->partial_dies == NULL)
+       load_partial_comp_unit (per_cu);
+@@ -12744,7 +13116,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi,
+   real_pdi = struct_pdi;
+   while (real_pdi->has_specification)
+-    real_pdi = find_partial_die (real_pdi->spec_offset, cu);
++    real_pdi = find_partial_die (real_pdi->spec_offset,
++                               real_pdi->spec_is_dwz, cu);
+   if (real_pdi->die_parent != NULL)
+     return;
+@@ -12792,7 +13165,8 @@ fixup_partial_die (struct partial_die_info *part_die,
+     {
+       struct partial_die_info *spec_die;
+-      spec_die = find_partial_die (part_die->spec_offset, cu);
++      spec_die = find_partial_die (part_die->spec_offset,
++                                 part_die->spec_is_dwz, cu);
+       fixup_partial_die (spec_die, cu);
+@@ -12880,6 +13254,10 @@ read_attribute_value (const struct die_reader_specs *reader,
+                                      &cu->header, &bytes_read);
+       info_ptr += bytes_read;
+       break;
++    case DW_FORM_GNU_ref_alt:
++      DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read);
++      info_ptr += bytes_read;
++      break;
+     case DW_FORM_addr:
+       DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+       info_ptr += bytes_read;
+@@ -12922,10 +13300,25 @@ read_attribute_value (const struct die_reader_specs *reader,
+       info_ptr += bytes_read;
+       break;
+     case DW_FORM_strp:
+-      DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header,
+-                                             &bytes_read);
+-      DW_STRING_IS_CANONICAL (attr) = 0;
+-      info_ptr += bytes_read;
++      if (!cu->per_cu->is_dwz)
++      {
++        DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header,
++                                                 &bytes_read);
++        DW_STRING_IS_CANONICAL (attr) = 0;
++        info_ptr += bytes_read;
++        break;
++      }
++      /* FALLTHROUGH */
++    case DW_FORM_GNU_strp_alt:
++      {
++      struct dwz_file *dwz = dwarf2_get_dwz_file ();
++      LONGEST str_offset = read_offset (abfd, info_ptr, cu_header,
++                                        &bytes_read);
++
++      DW_STRING (attr) = read_indirect_string_from_dwz (dwz, str_offset);
++      DW_STRING_IS_CANONICAL (attr) = 0;
++      info_ptr += bytes_read;
++      }
+       break;
+     case DW_FORM_exprloc:
+     case DW_FORM_block:
+@@ -13037,6 +13430,10 @@ read_attribute_value (const struct die_reader_specs *reader,
+            bfd_get_filename (abfd));
+     }
++  /* Super hack.  */
++  if (cu->per_cu->is_dwz && is_ref_attr (attr))
++    attr->form = DW_FORM_GNU_ref_alt;
++
+   /* We have seen instances where the compiler tried to emit a byte
+      size attribute of -1 which ended up being encoded as an unsigned
+      0xffffffff.  Although 0xffffffff is technically a valid size value,
+@@ -13333,6 +13730,30 @@ read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset)
+   return (char *) (dwarf2_per_objfile->str.buffer + str_offset);
+ }
++/* Read a string at offset STR_OFFSET in the .debug_str section from
++   the .dwz file DWZ.  Throw an error if the offset is too large.  If
++   the string consists of a single NUL byte, return NULL; otherwise
++   return a pointer to the string.  */
++
++static char *
++read_indirect_string_from_dwz (struct dwz_file *dwz, LONGEST str_offset)
++{
++  dwarf2_read_section (dwarf2_per_objfile->objfile, &dwz->str);
++
++  if (dwz->str.buffer == NULL)
++    error (_("DW_FORM_GNU_strp_alt used without .debug_str "
++           "section [in module %s]"),
++         bfd_get_filename (dwz->dwz_bfd));
++  if (str_offset >= dwz->str.size)
++    error (_("DW_FORM_GNU_strp_alt pointing outside of "
++           ".debug_str section [in module %s]"),
++         bfd_get_filename (dwz->dwz_bfd));
++  gdb_assert (HOST_CHAR_BIT == 8);
++  if (dwz->str.buffer[str_offset] == '\0')
++    return NULL;
++  return (char *) (dwz->str.buffer + str_offset);
++}
++
+ static char *
+ read_indirect_string (bfd *abfd, gdb_byte *buf,
+                     const struct comp_unit_head *cu_header,
+@@ -13804,6 +14225,30 @@ add_file_name (struct line_header *lh,
+   fe->symtab = NULL;
+ }
++/* A convenience function to find the proper .debug_line section for a
++   CU.  */
++
++static struct dwarf2_section_info *
++get_debug_line_section (struct dwarf2_cu *cu)
++{
++  struct dwarf2_section_info *section;
++
++  /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
++     DWO file.  */
++  if (cu->dwo_unit && cu->per_cu->is_debug_types)
++    section = &cu->dwo_unit->dwo_file->sections.line;
++  else if (cu->per_cu->is_dwz)
++    {
++      struct dwz_file *dwz = dwarf2_get_dwz_file ();
++
++      section = &dwz->line;
++    }
++  else
++    section = &dwarf2_per_objfile->line;
++
++  return section;
++}
++
+ /* Read the statement program header starting at OFFSET in
+    .debug_line, or .debug_line.dwo.  Return a pointer
+    to a struct line_header, allocated using xmalloc.
+@@ -13824,13 +14269,7 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu)
+   struct dwarf2_section_info *section;
+   bfd *abfd;
+-  /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
+-     DWO file.  */
+-  if (cu->dwo_unit && cu->per_cu->is_debug_types)
+-    section = &cu->dwo_unit->dwo_file->sections.line;
+-  else
+-    section = &dwarf2_per_objfile->line;
+-
++  section = get_debug_line_section (cu);
+   dwarf2_read_section (dwarf2_per_objfile->objfile, section);
+   if (section->buffer == NULL)
+     {
+@@ -14155,7 +14594,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
+                        GCd by the linker.  Ignore it.  PR gdb/12528 */
+                     long line_offset
+-                      = line_ptr - dwarf2_per_objfile->line.buffer;
++                      = line_ptr - get_debug_line_section (cu)->buffer;
+                     complaint (&symfile_complaints,
+                                _(".debug_line address at offset 0x%lx is 0 "
+@@ -14534,10 +14973,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
@@ -2147,7 +3254,7 @@ index 0ef0a5b..80e5fe4 100644
  
    if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs)
      cu->has_loclist = 1;
-@@ -11589,6 +11799,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
+@@ -14578,6 +15019,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++);
@@ -2156,7 +3263,32 @@ index 0ef0a5b..80e5fe4 100644
  
        /* Cache this symbol's name and the name's demangled form (if any).  */
        SYMBOL_SET_LANGUAGE (sym, cu->language);
-@@ -12354,6 +12566,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
+@@ -15001,6 +15444,7 @@ dwarf2_const_value_attr (struct attribute *attr, struct type *type,
+     case DW_FORM_string:
+     case DW_FORM_strp:
+     case DW_FORM_GNU_str_index:
++    case DW_FORM_GNU_strp_alt:
+       /* DW_STRING is already allocated on the objfile obstack, point
+        directly to it.  */
+       *bytes = (gdb_byte *) DW_STRING (attr);
+@@ -15187,7 +15631,15 @@ lookup_die_type (struct die_info *die, struct attribute *attr,
+   /* First see if we have it cached.  */
+-  if (is_ref_attr (attr))
++  if (attr->form == DW_FORM_GNU_ref_alt)
++    {
++      struct dwarf2_per_cu_data *per_cu;
++      sect_offset offset = dwarf2_get_ref_die_offset (attr);
++
++      per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile);
++      this_type = get_die_type_at_offset (offset, per_cu);
++    }
++  else if (is_ref_attr (attr))
+     {
+       sect_offset offset = dwarf2_get_ref_die_offset (attr);
+@@ -15352,6 +15804,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
        break;
      }
  
@@ -2166,8 +3298,214 @@ index 0ef0a5b..80e5fe4 100644
    return this_type;
  }
  
-@@ -15590,62 +15805,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
-   baton->base_address = cu->base_address;
+@@ -15960,6 +16415,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
+         fprintf_unfiltered (f, "ref address: ");
+         fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f);
+         break;
++      case DW_FORM_GNU_ref_alt:
++        fprintf_unfiltered (f, "alt ref address: ");
++        fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f);
++        break;
+       case DW_FORM_ref1:
+       case DW_FORM_ref2:
+       case DW_FORM_ref4:
+@@ -15991,6 +16450,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
+       case DW_FORM_string:
+       case DW_FORM_strp:
+       case DW_FORM_GNU_str_index:
++      case DW_FORM_GNU_strp_alt:
+         fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)",
+                  DW_STRING (&die->attrs[i])
+                  ? DW_STRING (&die->attrs[i]) : "",
+@@ -16094,6 +16554,7 @@ is_ref_attr (struct attribute *attr)
+     case DW_FORM_ref4:
+     case DW_FORM_ref8:
+     case DW_FORM_ref_udata:
++    case DW_FORM_GNU_ref_alt:
+       return 1;
+     default:
+       return 0;
+@@ -16171,7 +16632,8 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr,
+    Returns NULL if OFFSET is invalid.  */
+ static struct die_info *
+-follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu)
++follow_die_offset (sect_offset offset, int offset_in_dwz,
++                 struct dwarf2_cu **ref_cu)
+ {
+   struct die_info temp_die;
+   struct dwarf2_cu *target_cu, *cu = *ref_cu;
+@@ -16188,11 +16650,13 @@ follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu)
+       if (! offset_in_cu_p (&cu->header, offset))
+       return NULL;
+     }
+-  else if (! offset_in_cu_p (&cu->header, offset))
++  else if (offset_in_dwz != cu->per_cu->is_dwz
++         || ! offset_in_cu_p (&cu->header, offset))
+     {
+       struct dwarf2_per_cu_data *per_cu;
+-      per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
++      per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz,
++                                               cu->objfile);
+       /* If necessary, add it to the queue and load its DIEs.  */
+       if (maybe_queue_comp_unit (cu, per_cu, cu->language))
+@@ -16224,7 +16688,10 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr,
+   struct dwarf2_cu *cu = *ref_cu;
+   struct die_info *die;
+-  die = follow_die_offset (offset, ref_cu);
++  die = follow_die_offset (offset,
++                         (attr->form == DW_FORM_GNU_ref_alt
++                          || cu->per_cu->is_dwz),
++                         ref_cu);
+   if (!die)
+     error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE "
+          "at 0x%x [in module %s]"),
+@@ -16255,7 +16722,7 @@ dwarf2_fetch_die_location_block (cu_offset offset_in_cu,
+     load_cu (per_cu);
+   cu = per_cu->cu;
+-  die = follow_die_offset (offset, &cu);
++  die = follow_die_offset (offset, per_cu->is_dwz, &cu);
+   if (!die)
+     error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"),
+          offset.sect_off, per_cu->objfile->name);
+@@ -17049,6 +17516,7 @@ skip_form_bytes (bfd *abfd, gdb_byte *bytes, gdb_byte *buffer_end,
+     case DW_FORM_sec_offset:
+     case DW_FORM_strp:
++    case DW_FORM_GNU_strp_alt:
+       bytes += offset_size;
+       break;
+@@ -17204,7 +17672,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+                         struct macro_source_file *current_file,
+                         struct line_header *lh, char *comp_dir,
+                         struct dwarf2_section_info *section,
+-                        int section_is_gnu,
++                        int section_is_gnu, int section_is_dwz,
+                         unsigned int offset_size,
+                         struct objfile *objfile,
+                         htab_t include_hash)
+@@ -17255,6 +17723,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+         case DW_MACRO_GNU_undef:
+       case DW_MACRO_GNU_define_indirect:
+       case DW_MACRO_GNU_undef_indirect:
++      case DW_MACRO_GNU_define_indirect_alt:
++      case DW_MACRO_GNU_undef_indirect_alt:
+           {
+             unsigned int bytes_read;
+             int line;
+@@ -17277,11 +17747,21 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+               str_offset = read_offset_1 (abfd, mac_ptr, offset_size);
+               mac_ptr += offset_size;
+-              body = read_indirect_string_at_offset (abfd, str_offset);
++              if (macinfo_type == DW_MACRO_GNU_define_indirect_alt
++                  || macinfo_type == DW_MACRO_GNU_undef_indirect_alt
++                  || section_is_dwz)
++                {
++                  struct dwz_file *dwz = dwarf2_get_dwz_file ();
++
++                  body = read_indirect_string_from_dwz (dwz, str_offset);
++                }
++              else
++                body = read_indirect_string_at_offset (abfd, str_offset);
+             }
+           is_define = (macinfo_type == DW_MACRO_GNU_define
+-                       || macinfo_type == DW_MACRO_GNU_define_indirect);
++                       || macinfo_type == DW_MACRO_GNU_define_indirect
++                       || macinfo_type == DW_MACRO_GNU_define_indirect_alt);
+             if (! current_file)
+             {
+               /* DWARF violation as no main source is present.  */
+@@ -17305,7 +17785,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+           else
+             {
+               gdb_assert (macinfo_type == DW_MACRO_GNU_undef
+-                          || macinfo_type == DW_MACRO_GNU_undef_indirect);
++                          || macinfo_type == DW_MACRO_GNU_undef_indirect
++                          || macinfo_type == DW_MACRO_GNU_undef_indirect_alt);
+               macro_undef (current_file, line, body);
+             }
+           }
+@@ -17380,6 +17861,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+           break;
+       case DW_MACRO_GNU_transparent_include:
++      case DW_MACRO_GNU_transparent_include_alt:
+         {
+           LONGEST offset;
+           void **slot;
+@@ -17398,13 +17880,32 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
+             }
+           else
+             {
++              bfd *include_bfd = abfd;
++              struct dwarf2_section_info *include_section = section;
++              struct dwarf2_section_info alt_section;
++              gdb_byte *include_mac_end = mac_end;
++              int is_dwz = section_is_dwz;
++
+               *slot = mac_ptr;
+-              dwarf_decode_macro_bytes (abfd,
+-                                        section->buffer + offset,
+-                                        mac_end, current_file,
++              if (macinfo_type == DW_MACRO_GNU_transparent_include_alt)
++                {
++                  struct dwz_file *dwz = dwarf2_get_dwz_file ();
++
++                  dwarf2_read_section (dwarf2_per_objfile->objfile,
++                                       &dwz->macro);
++
++                  include_bfd = dwz->macro.asection->owner;
++                  include_section = &dwz->macro;
++                  include_mac_end = dwz->macro.buffer + dwz->macro.size;
++                  is_dwz = 1;
++                }
++
++              dwarf_decode_macro_bytes (include_bfd,
++                                        include_section->buffer + offset,
++                                        include_mac_end, current_file,
+                                         lh, comp_dir,
+-                                        section, section_is_gnu,
++                                        section, section_is_gnu, is_dwz,
+                                         offset_size, objfile, include_hash);
+               htab_remove_elt (include_hash, mac_ptr);
+@@ -17571,6 +18072,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
+       case DW_MACRO_GNU_define_indirect:
+       case DW_MACRO_GNU_undef_indirect:
++      case DW_MACRO_GNU_define_indirect_alt:
++      case DW_MACRO_GNU_undef_indirect_alt:
+         {
+           unsigned int bytes_read;
+@@ -17581,6 +18084,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
+         break;
+       case DW_MACRO_GNU_transparent_include:
++      case DW_MACRO_GNU_transparent_include_alt:
+         /* Note that, according to the spec, a transparent include
+            chain cannot call DW_MACRO_GNU_start_file.  So, we can just
+            skip this opcode.  */
+@@ -17623,7 +18127,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
+   slot = htab_find_slot (include_hash, mac_ptr, INSERT);
+   *slot = mac_ptr;
+   dwarf_decode_macro_bytes (abfd, mac_ptr, mac_end,
+-                          current_file, lh, comp_dir, section, section_is_gnu,
++                          current_file, lh, comp_dir, section,
++                          section_is_gnu, 0,
+                           offset_size, objfile, include_hash);
+   do_cleanups (cleanup);
+ }
+@@ -17721,62 +18226,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
+   baton->from_dwo = cu->dwo_unit != NULL;
  }
  
 -static void
@@ -2178,26 +3516,16 @@ index 0ef0a5b..80e5fe4 100644
 +
 +static struct dwarf2_locexpr_baton *
 +dwarf2_attr_to_locexpr_baton (struct attribute *attr, struct dwarf2_cu *cu)
- {
-   struct objfile *objfile = dwarf2_per_objfile->objfile;
++{
++  struct objfile *objfile = dwarf2_per_objfile->objfile;
 +  struct dwarf2_locexpr_baton *baton;
--  if (attr_form_is_section_offset (attr)
--      /* ".debug_loc" may not exist at all, or the offset may be outside
--       the section.  If so, fall through to the complaint in the
--       other branch.  */
--      && DW_UNSND (attr) < dwarf2_section_size (objfile,
--                                              &dwarf2_per_objfile->loc))
--    {
--      struct dwarf2_loclist_baton *baton;
++
 +  gdb_assert (attr_form_is_block (attr));
 +
 +  baton = obstack_alloc (&objfile->objfile_obstack, sizeof (*baton));
 +  baton->per_cu = cu->per_cu;
 +  gdb_assert (baton->per_cu);
--      baton = obstack_alloc (&objfile->objfile_obstack,
--                           sizeof (struct dwarf2_loclist_baton));
++
 +  /* Note that we're just copying the block's data pointer
 +     here, not the actual data.  We're still pointing into the
 +     info_buffer for SYM's objfile; right now we never release
@@ -2206,18 +3534,15 @@ index 0ef0a5b..80e5fe4 100644
 +  baton->size = DW_BLOCK (attr)->size;
 +  baton->data = DW_BLOCK (attr)->data;
 +  gdb_assert (baton->size == 0 || baton->data != NULL);
--      fill_in_loclist_baton (cu, baton, attr);
++
 +  return baton;
 +}
--      if (cu->base_known == 0)
--      complaint (&symfile_complaints,
--                 _("Location list used without "
--                   "specifying the CU base address."));
++
 +static struct dwarf2_loclist_baton *
 +dwarf2_attr_to_loclist_baton (struct attribute *attr, struct dwarf2_cu *cu)
-+{
+ {
+   struct objfile *objfile = dwarf2_per_objfile->objfile;
+   struct dwarf2_section_info *section = cu_debug_loc_section (cu);
 +  struct dwarf2_loclist_baton *baton;
 +
 +  /* DW_AT_location of the referenced DIE may be missing if the referenced
@@ -2225,27 +3550,36 @@ index 0ef0a5b..80e5fe4 100644
 +  if (!attr)
 +    return NULL;
 +
-+  dwarf2_read_section (dwarf2_per_objfile->objfile,
-+                     &dwarf2_per_objfile->loc);
-+
++  dwarf2_read_section (dwarf2_per_objfile->objfile, section);
+-  if (attr_form_is_section_offset (attr)
 +  if (!(attr_form_is_section_offset (attr)
-+      /* ".debug_loc" may not exist at all, or the offset may be outside
-+         the section.  If so, fall through to the complaint in the
-+         other branch.  */
-+      && DW_UNSND (attr) < dwarf2_section_size (dwarf2_per_objfile->objfile,
-+                                                &dwarf2_per_objfile->loc)))
+       /* .debug_loc{,.dwo} may not exist at all, or the offset may be outside
+        the section.  If so, fall through to the complaint in the
+        other branch.  */
+-      && DW_UNSND (attr) < dwarf2_section_size (objfile, section))
+-    {
+-      struct dwarf2_loclist_baton *baton;
++      && DW_UNSND (attr) < dwarf2_section_size (objfile, section)))
 +    return NULL;
-+
-+  baton = obstack_alloc (&cu->objfile->objfile_obstack,
+-      baton = obstack_alloc (&objfile->objfile_obstack,
+-                           sizeof (struct dwarf2_loclist_baton));
++  baton = obstack_alloc (&objfile->objfile_obstack,
 +                       sizeof (struct dwarf2_loclist_baton));
-+
+-      fill_in_loclist_baton (cu, baton, attr);
 +  fill_in_loclist_baton (cu, baton, attr);
-+
+-      if (cu->base_known == 0)
+-      complaint (&symfile_complaints,
+-                 _("Location list used without "
+-                   "specifying the CU base address."));
 +  if (cu->base_known == 0)
 +    complaint (&symfile_complaints,
 +             _("Location list used without "
 +               "specifying the CU base address."));
++
 +  return baton;
 +}
 +
@@ -2256,7 +3590,7 @@ index 0ef0a5b..80e5fe4 100644
 +                           struct dwarf2_cu *cu)
 +{
 +  struct dwarf2_loclist_baton *loclist_baton;
-+
 +  loclist_baton = dwarf2_attr_to_loclist_baton (attr, cu);
 +  if (loclist_baton)
 +    {
@@ -2309,8 +3643,49 @@ index 0ef0a5b..80e5fe4 100644
      }
  }
  
-@@ -16003,6 +16256,25 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
-   return ofs_lhs->offset == ofs_rhs->offset;
+@@ -17878,28 +18421,35 @@ dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
+ static struct dwarf2_per_cu_data *
+ dwarf2_find_containing_comp_unit (sect_offset offset,
++                                unsigned int offset_in_dwz,
+                                 struct objfile *objfile)
+ {
+   struct dwarf2_per_cu_data *this_cu;
+   int low, high;
++  const sect_offset *cu_off;
+   low = 0;
+   high = dwarf2_per_objfile->n_comp_units - 1;
+   while (high > low)
+     {
++      struct dwarf2_per_cu_data *mid_cu;
+       int mid = low + (high - low) / 2;
+-      if (dwarf2_per_objfile->all_comp_units[mid]->offset.sect_off
+-        >= offset.sect_off)
++      mid_cu = dwarf2_per_objfile->all_comp_units[mid];
++      cu_off = &mid_cu->offset;
++      if (mid_cu->is_dwz > offset_in_dwz
++        || (mid_cu->is_dwz == offset_in_dwz
++            && cu_off->sect_off >= offset.sect_off))
+       high = mid;
+       else
+       low = mid + 1;
+     }
+   gdb_assert (low == high);
+-  if (dwarf2_per_objfile->all_comp_units[low]->offset.sect_off
+-      > offset.sect_off)
++  this_cu = dwarf2_per_objfile->all_comp_units[low];
++  cu_off = &this_cu->offset;
++  if (this_cu->is_dwz != offset_in_dwz || cu_off->sect_off > offset.sect_off)
+     {
+-      if (low == 0)
++      if (low == 0 || this_cu->is_dwz != offset_in_dwz)
+       error (_("Dwarf Error: could not find partial DIE containing "
+              "offset 0x%lx [in module %s]"),
+              (long) offset.sect_off, bfd_get_filename (objfile->obfd));
+@@ -18140,6 +18690,25 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+         && ofs_lhs->offset.sect_off == ofs_rhs->offset.sect_off);
  }
  
 +/* Fill in generic attributes applicable for type DIEs.  */
@@ -2335,367 +3710,137 @@ index 0ef0a5b..80e5fe4 100644
  /* Set the type associated with DIE to TYPE.  Save it in CU's hash
     table if necessary.  For convenience, return TYPE.
  
-@@ -16028,6 +16300,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -18164,6 +18733,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+   struct dwarf2_per_cu_offset_and_type **slot, ofs;
    struct objfile *objfile = cu->objfile;
-   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
+@@ -18341,53 +18912,13 @@ show_dwarf2_cmd (char *args, int from_tty)
+   cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
+ }
+-/* If section described by INFO was mmapped, munmap it now.  */
+-
+-static void
+-munmap_section_buffer (struct dwarf2_section_info *info)
+-{
+-  if (info->map_addr != NULL)
+-    {
+-#ifdef HAVE_MMAP
+-      int res;
+-
+-      res = munmap (info->map_addr, info->map_len);
+-      gdb_assert (res == 0);
+-#else
+-      /* Without HAVE_MMAP, we should never be here to begin with.  */
+-      gdb_assert_not_reached ("no mmap support");
+-#endif
+-    }
+-}
+-
+-/* munmap debug sections for OBJFILE, if necessary.  */
++/* Free data associated with OBJFILE, if necessary.  */
+ static void
+ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
+ {
+   struct dwarf2_per_objfile *data = d;
+   int ix;
+-  struct dwarf2_section_info *section;
+-
+-  /* This is sorted according to the order they're defined in to make it easier
+-     to keep in sync.  */
+-  munmap_section_buffer (&data->info);
+-  munmap_section_buffer (&data->abbrev);
+-  munmap_section_buffer (&data->line);
+-  munmap_section_buffer (&data->loc);
+-  munmap_section_buffer (&data->macinfo);
+-  munmap_section_buffer (&data->macro);
+-  munmap_section_buffer (&data->str);
+-  munmap_section_buffer (&data->ranges);
+-  munmap_section_buffer (&data->addr);
+-  munmap_section_buffer (&data->frame);
+-  munmap_section_buffer (&data->eh_frame);
+-  munmap_section_buffer (&data->gdb_index);
+-
+-  for (ix = 0;
+-       VEC_iterate (dwarf2_section_info_def, data->types, ix, section);
+-       ++ix)
+-    munmap_section_buffer (section);
+   for (ix = 0; ix < dwarf2_per_objfile->n_comp_units; ++ix)
+     VEC_free (dwarf2_per_cu_ptr,
+@@ -18397,6 +18928,9 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
+   if (data->dwo_files)
+     free_dwo_files (data->dwo_files, objfile);
++
++  if (data->dwz_file && data->dwz_file->dwz_bfd)
++    gdb_bfd_unref (data->dwz_file->dwz_bfd);
+ }
\f
 diff --git a/gdb/elfread.c b/gdb/elfread.c
-index ddae099..aea443f 100644
+index 1edfb27..0b54b8a 100644
 --- a/gdb/elfread.c
 +++ b/gdb/elfread.c
-@@ -36,6 +36,8 @@
- #include "demangle.h"
- #include "psympriv.h"
- #include "filenames.h"
-+#include "stap-probe.h"
-+#include "arch-utils.h"
- #include "gdbtypes.h"
- #include "value.h"
- #include "infcall.h"
-@@ -60,6 +62,21 @@ struct elfinfo
-     asection *mdebugsect;     /* Section pointer for .mdebug section */
-   };
+@@ -44,6 +44,7 @@
+ #include "gdbthread.h"
+ #include "regcache.h"
+ #include "bcache.h"
++#include "gdb_bfd.h"
  
-+/* Per-objfile data for SystemTap probe info.  */
-+
-+static const struct objfile_data *stap_probe_key = NULL;
-+
-+/* Per-objfile data about SystemTap probes.  */
-+
-+struct stap_probe_per_objfile
-+  {
-+    /* The number of probes in this objfile.  */
-+    int stap_num_probes;
-+
-+    /* The probes themselves.  */
-+    struct stap_probe *probes;
-+  };
-+
- static void free_elfinfo (void *);
+ extern void _initialize_elfread (void);
+@@ -1108,7 +1109,7 @@ build_id_verify (const char *filename, struct build_id *check)
+   int retval = 0;
+   /* We expect to be silent on the non-existing files.  */
+-  abfd = bfd_open_maybe_remote (filename);
++  abfd = gdb_bfd_open_maybe_remote (filename);
+   if (abfd == NULL)
+     return 0;
+@@ -1123,7 +1124,7 @@ build_id_verify (const char *filename, struct build_id *check)
+   else
+     retval = 1;
+-  gdb_bfd_close_or_warn (abfd);
++  gdb_bfd_unref (abfd);
  
- /* Minimal symbols located at the GOT entries for .plt - that is the real
-@@ -1576,7 +1593,270 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
-     complaint (&symfile_complaints,
-              _("elf/stab section information missing for %s"), filename);
- }
-+
-+/* Helper function that parses the information contained in a
-+   SystemTap's probe.  Basically, the information consists in:
-+
-+   - Probe's PC address;
-+   - Link-time section address of `.stapsdt.base' section;
-+   - Link-time address of the semaphore variable, or ZERO if the
-+     probe doesn't have an associated semaphore;
-+   - Probe's provider name;
-+   - Probe's name;
-+   - Probe's argument format.  */
-+
-+static void
-+handle_probe (struct objfile *objfile, struct sdt_note *el,
-+            struct stap_probe *ret, CORE_ADDR base)
-+{
-+  bfd *abfd = objfile->obfd;
-+  int size = bfd_get_arch_size (abfd) / 8;
-+  struct gdbarch *gdbarch = get_objfile_arch (objfile);
-+  struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
-+  CORE_ADDR base_ref;
-+
-+  ret->gdbarch = gdbarch;
-+
-+  /* Provider and the name of the probe.  */
-+  ret->provider = (const char *) &el->data[3 * size];
-+  ret->name = memchr (ret->provider, '\0',
-+                    (unsigned long *) el->data
-+                    + el->size - (unsigned long *) ret->provider);
-+  /* Making sure there is a name.  */
-+  if (!ret->name)
-+    complaint (&symfile_complaints, _("corrupt probe when reading `%s'"),
-+             objfile->name);
-+  else
-+    ++ret->name;
-+
-+  /* Retrieving the probe's address.  */
-+  ret->address = extract_typed_address ((const gdb_byte *) &el->data[0],
-+                                      ptr_type);
-+  /* Link-time sh_addr of `.stapsdt.base' section.  */
-+  base_ref = extract_typed_address ((const gdb_byte *) &el->data[size],
-+                                  ptr_type);
-+  /* Semaphore address.  */
-+  ret->sem_addr = extract_typed_address ((const gdb_byte *) &el->data[2 * size],
-+                                       ptr_type);
-+
-+  ret->address += (ANOFFSET (objfile->section_offsets,
-+                           SECT_OFF_TEXT (objfile))
-+                 + base - base_ref);
-+  if (ret->sem_addr)
-+    ret->sem_addr += (ANOFFSET (objfile->section_offsets,
-+                              SECT_OFF_DATA (objfile))
-+                    + base - base_ref);
-+
-+  /* Arguments.  We can only extract the argument format if there is a valid
-+     name for this probe.  */
-+  if (ret->name)
-+    {
-+      ret->args = memchr (ret->name, '\0',
-+                        (unsigned long *) el->data
-+                        + el->size - (unsigned long *) ret->name);
-+
-+      if (ret->args != NULL)
-+      ++ret->args;
-+      if (ret->args == NULL
-+        || (memchr (ret->args, '\0', (unsigned long *) el->data
-+                    + el->size - (unsigned long *) ret->name)
-+            != el->data + el->size - 1))
-+      complaint (&symfile_complaints, _("corrupt probe when reading `%s'"),
-+                 objfile->name);
-+    }
-+  else
-+    ret->args = NULL;
-+}
-+
-+/* The name of the SystemTap section where we will find information about
-+   the probes.  */
-+
-+#define STAP_BASE_SECTION_NAME ".stapsdt.base"
-+
-+/* Helper function which tries to find the base address of the SystemTap
-+   base section named STAP_BASE_SECTION_NAME.  */
-+
-+static void
-+get_base_address_1 (bfd *abfd, asection *sect, void *obj)
-+{
-+  bfd_vma *base = (bfd_vma *) obj;
-+
-+  if (*base == (bfd_vma) -1
-+      && (sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS))
-+      && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
-+    *base = sect->vma;
-+}
-+
-+/* Helper function which iterates over every section in the BFD file,
-+   trying to find the base address of the SystemTap base section.
-+   Returns the section address if found, or -1 otherwise.  */
-+
-+static bfd_vma
-+get_base_address (bfd *obfd)
-+{
-+  bfd_vma base = (bfd_vma) -1;
-+
-+  bfd_map_over_sections (obfd, get_base_address_1, (void *) &base);
-+
-+  return base;
-+}
-+
-+/* Implementation of `sym_get_probes', as documented in symfile.h.  */
-+
-+static struct stap_probe *
-+elf_get_probes (struct objfile *objfile, int *num_probes)
-+{
-+  struct stap_probe *ret = NULL;
-+  struct stap_probe_per_objfile *probes_per_objfile;
-+
-+  /* Initially, no probes.  */
-+  *num_probes = 0;
-+
-+  /* Have we parsed this objfile's probes already?  */
-+  probes_per_objfile
-+    = (struct stap_probe_per_objfile *) objfile_data (objfile,
-+                                                    stap_probe_key);
-+
-+  if (!probes_per_objfile)
-+    {
-+      /* If we are here, then this is the first time we are parsing the
-+       probe's information.  We basically have to count how many probes
-+       the objfile has, and then fill in the necessary information
-+       for each one.  */
-+
-+      bfd *obfd = objfile->obfd;
-+      bfd_vma base = get_base_address (obfd);
-+      struct sdt_note *iter;
-+      int i;
-+      int n = 0;
-+
-+      if (! elf_tdata (obfd)->sdt_note_head)
-+      /* There isn't any probe here.  */
-+      return NULL;
-+
-+      /* Allocating space for probe info.  */
-+      for (iter = elf_tdata (obfd)->sdt_note_head;
-+         iter;
-+         iter = iter->next, ++n);
-+
-+      ret = xcalloc (n, sizeof (struct stap_probe));
-+
-+      /* Parsing each probe's information.  */
-+      for (iter = elf_tdata (obfd)->sdt_note_head, i = 0;
-+         iter;
-+         iter = iter->next, i++)
-+      /* We first have to handle all the information about the
-+         probe which is present in the section.  */
-+      handle_probe (objfile, iter, &ret[i], base);
-+
-+      /* Creating a cache for these probes in the objfile's registry.  */
-+      probes_per_objfile = xmalloc (sizeof (struct stap_probe_per_objfile));
-+
-+      probes_per_objfile->stap_num_probes = n;
-+      probes_per_objfile->probes = ret;
-+
-+      set_objfile_data (objfile, stap_probe_key, probes_per_objfile);
-+    }
-+  else
-+    ret = probes_per_objfile->probes;
-+
-+  *num_probes = probes_per_objfile->stap_num_probes;
-+
-+  return ret;
-+}
-+
-+/* Implementation of `sym_get_probe_argument_count', as documented in
-+   symfile.h.  */
-+
-+static int
-+elf_get_probe_argument_count (struct objfile *objfile,
-+                            struct stap_probe *probe)
-+{
-+  const char *pargs = probe->args;
-+
-+  if (!pargs || !*pargs || *pargs == ':')
-+    /* No arguments.  */
-+    return 0;
-+
-+  return stap_get_probe_argument_count (probe);
-+}
-+
-+/* Implementation of `sym_evaluate_probe_argument', as documented in
-+   symfile.h.  */
-+
-+static struct value *
-+elf_evaluate_probe_argument (struct objfile *objfile,
-+                           struct stap_probe *probe,
-+                           struct frame_info *frame,
-+                           int n)
-+{
-+  return stap_evaluate_probe_argument (objfile, probe, frame, n);
-+}
-+
-+/* Implementation of `sym_compile_to_ax', as documented in symfile.h.  */
-+
-+static void
-+elf_compile_to_ax (struct objfile *objfile,
-+                 struct stap_probe *probe,
-+                 struct agent_expr *expr,
-+                 struct axs_value *value,
-+                 int n)
-+{
-+  stap_compile_to_ax (objfile, probe, expr, value, n);
-+}
-+
-+/* Implementation of `sym_relocate_probe', as documented in symfile.h.  */
-+
-+static void
-+elf_symfile_relocate_probe (struct objfile *objfile,
-+                          struct section_offsets *new_offsets,
-+                          struct section_offsets *delta)
-+{
-+  int i;
-+  struct stap_probe_per_objfile *p
-+    = (struct stap_probe_per_objfile *) objfile_data (objfile,
-+                                                    stap_probe_key);
-+
-+  if (!p)
-+    /* No probe to relocate.  */
-+    return;
-+
-+  for (i = 0; i < p->stap_num_probes; i++)
-+    {
-+      p->probes[i].address += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
-+      if (p->probes[i].sem_addr)
-+      p->probes[i].sem_addr += ANOFFSET (delta, SECT_OFF_DATA (objfile));
-+    }
-+}
-+
-+/* Helper function used to free the space allocated for storing SystemTap
-+   probe information.  */
-+
-+static void
-+stap_probe_key_free (struct objfile *objfile, void *d)
-+{
-+  int i;
-+  struct stap_probe_per_objfile *data = (struct stap_probe_per_objfile *) d;
-+
-+  for (i = 0; i < data->stap_num_probes; i++)
-+    stap_free_parsed_args (data->probes[i].parsed_args);
-+  xfree (data->probes);
-+  xfree (data);
-+}
-+
\f
-+
-+/* Implementation `sym_probe_fns', as documented in symfile.h.  */
-+
-+static const struct sym_probe_fns elf_probe_fns =
-+{
-+  elf_get_probes,             /* sym_get_probes */
-+  elf_get_probe_argument_count,       /* sym_get_probe_argument_count */
-+  elf_evaluate_probe_argument,        /* sym_evaluate_probe_argument */
-+  elf_compile_to_ax,          /* sym_compile_to_ax */
-+  elf_symfile_relocate_probe, /* sym_relocate_probe */
-+};
-+
- /* Register that we are able to handle ELF object file formats.  */
- static const struct sym_fns elf_sym_fns =
-@@ -1591,6 +1871,7 @@ static const struct sym_fns elf_sym_fns =
-   elf_symfile_segments,               /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  &elf_probe_fns,             /* sym_probe_fns */
-   &psym_functions
- };
-@@ -1609,6 +1890,7 @@ static const struct sym_fns elf_sym_fns_lazy_psyms =
-   elf_symfile_segments,               /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  &elf_probe_fns,             /* sym_probe_fns */
-   &psym_functions
- };
-@@ -1626,6 +1908,7 @@ static const struct sym_fns elf_sym_fns_gdb_index =
-   elf_symfile_segments,               /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  &elf_probe_fns,             /* sym_probe_fns */
-   &dwarf2_gdb_index_functions
- };
-@@ -1642,6 +1925,8 @@ static const struct gnu_ifunc_fns elf_gnu_ifunc_fns =
- void
- _initialize_elfread (void)
- {
-+  stap_probe_key
-+    = register_objfile_data_with_cleanup (NULL, stap_probe_key_free);
-   add_symtab_fns (&elf_sym_fns);
-   elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
-diff --git a/gdb/eval.c b/gdb/eval.c
-index 0244f7a..b33d367 100644
---- a/gdb/eval.c
-+++ b/gdb/eval.c
-@@ -41,6 +41,7 @@
- #include "gdb_obstack.h"
- #include "objfiles.h"
- #include "python/python.h"
-+#include "dwarf2loc.h"
- #include "gdb_assert.h"
-@@ -498,27 +499,217 @@ init_array_element (struct value *array, struct value *element,
+   xfree (found);
+@@ -1444,10 +1445,12 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags)
+       if (debugfile)
+       {
++        struct cleanup *cleanup = make_cleanup (xfree, debugfile);
+         bfd *abfd = symfile_bfd_open (debugfile);
++        make_cleanup_bfd_unref (abfd);
+         symbol_file_add_separate (abfd, symfile_flags, objfile);
+-        xfree (debugfile);
++        do_cleanups (cleanup);
+       }
+     }
+diff --git a/gdb/eval.c b/gdb/eval.c
+index 7d3a8b9..f69dff0 100644
+--- a/gdb/eval.c
++++ b/gdb/eval.c
+@@ -41,6 +41,7 @@
+ #include "gdb_obstack.h"
+ #include "objfiles.h"
+ #include "python/python.h"
++#include "dwarf2loc.h"
+ #include "gdb_assert.h"
+@@ -500,27 +501,217 @@ init_array_element (struct value *array, struct value *element,
  }
  
  static struct value *
@@ -2929,7 +4074,7 @@ index 0244f7a..b33d367 100644
  }
  
  
-@@ -799,6 +990,7 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -818,6 +1009,7 @@ evaluate_subexp_standard (struct type *expect_type,
    int save_pos1;
    struct symbol *function = NULL;
    char *function_name = NULL;
@@ -2937,7 +4082,7 @@ index 0244f7a..b33d367 100644
  
    pc = (*pos)++;
    op = exp->elts[pc].opcode;
-@@ -1874,6 +2066,8 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1892,6 +2084,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);
@@ -2946,7 +4091,7 @@ index 0244f7a..b33d367 100644
        type = check_typedef (value_type (arg1));
        code = TYPE_CODE (type);
  
-@@ -1894,23 +2088,13 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -1912,23 +2106,13 @@ evaluate_subexp_standard (struct type *expect_type,
              code = TYPE_CODE (type);
            }
        } 
@@ -2972,7 +4117,7 @@ index 0244f7a..b33d367 100644
  
        case TYPE_CODE_PTR:
        case TYPE_CODE_FUNC:
-@@ -2349,49 +2533,6 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2361,49 +2545,6 @@ evaluate_subexp_standard (struct type *expect_type,
        }
        return (arg1);
  
@@ -3022,7 +4167,7 @@ index 0244f7a..b33d367 100644
      case BINOP_LOGICAL_AND:
        arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
        if (noside == EVAL_SKIP)
-@@ -2623,15 +2764,23 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2635,15 +2776,23 @@ evaluate_subexp_standard (struct type *expect_type,
        if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
        expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
        arg1 = evaluate_subexp (expect_type, exp, pos, noside);
@@ -3048,7 +4193,7 @@ index 0244f7a..b33d367 100644
        else if (noside == EVAL_AVOID_SIDE_EFFECTS)
        {
          type = check_typedef (value_type (arg1));
-@@ -2640,12 +2789,18 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2652,12 +2801,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
            )
@@ -3072,7 +4217,7 @@ index 0244f7a..b33d367 100644
          else
            error (_("Attempt to take contents of a non-pointer value."));
        }
-@@ -2655,9 +2810,14 @@ evaluate_subexp_standard (struct type *expect_type,
+@@ -2667,9 +2822,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)
@@ -3090,7 +4235,7 @@ index 0244f7a..b33d367 100644
  
      case UNOP_ADDR:
        /* C++: check for and handle pointer to members.  */
-@@ -2999,7 +3159,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -3011,7 +3171,7 @@ evaluate_subexp_with_coercion (struct expression *exp,
  {
    enum exp_opcode op;
    int pc;
@@ -3099,7 +4244,7 @@ index 0244f7a..b33d367 100644
    struct symbol *var;
    struct type *type;
  
-@@ -3010,13 +3170,18 @@ evaluate_subexp_with_coercion (struct expression *exp,
+@@ -3022,13 +3182,18 @@ evaluate_subexp_with_coercion (struct expression *exp,
      {
      case OP_VAR_VALUE:
        var = exp->elts[pc + 2].symbol;
@@ -3119,7 +4264,7 @@ index 0244f7a..b33d367 100644
          return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
                             val);
        }
-@@ -3068,9 +3233,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
+@@ -3080,9 +3245,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
  
      case OP_VAR_VALUE:
        (*pos) += 4;
@@ -3136,7 +4281,7 @@ index 0244f7a..b33d367 100644
  
      default:
        val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
-@@ -3101,18 +3270,25 @@ parse_and_eval_type (char *p, int length)
+@@ -3113,18 +3282,25 @@ parse_and_eval_type (char *p, int length)
  int
  calc_f77_array_dims (struct type *array_type)
  {
@@ -3172,11 +4317,95 @@ index 0244f7a..b33d367 100644
 -  return ndimen;
 +
  }
+diff --git a/gdb/exec.c b/gdb/exec.c
+index 6ba1986..e076609 100644
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -33,6 +33,7 @@
+ #include "arch-utils.h"
+ #include "gdbthread.h"
+ #include "progspace.h"
++#include "gdb_bfd.h"
+ #include <fcntl.h>
+ #include "readline/readline.h"
+@@ -98,10 +99,8 @@ exec_close (void)
+   if (exec_bfd)
+     {
+       bfd *abfd = exec_bfd;
+-      char *name = bfd_get_filename (abfd);
+-      gdb_bfd_close_or_warn (abfd);
+-      xfree (name);
++      gdb_bfd_unref (abfd);
+       /* Removing target sections may close the exec_ops target.
+        Clear exec_bfd before doing so to prevent recursion.  */
+@@ -128,17 +127,13 @@ exec_close_1 (int quitting)
+       vp = nxt;
+       nxt = vp->nxt;
+-      /* if there is an objfile associated with this bfd,
+-         free_objfile() will do proper cleanup of objfile *and* bfd.  */
+-
+       if (vp->objfile)
+       {
+         free_objfile (vp->objfile);
+         need_symtab_cleanup = 1;
+       }
+-      else if (vp->bfd != exec_bfd)
+-      /* FIXME-leak: We should be freeing vp->name too, I think.  */
+-      gdb_bfd_close_or_warn (vp->bfd);
++
++      gdb_bfd_unref (vp->bfd);
+       xfree (vp);
+     }
+@@ -230,11 +225,14 @@ exec_file_attach (char *filename, int from_tty)
+            &scratch_pathname);
+       }
+ #endif
++
++      cleanups = make_cleanup (xfree, scratch_pathname);
++
+       if (scratch_chan < 0)
+       perror_with_name (filename);
+-      exec_bfd = bfd_fopen (scratch_pathname, gnutarget,
+-                          write_files ? FOPEN_RUB : FOPEN_RB,
+-                          scratch_chan);
++      exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
++                              write_files ? FOPEN_RUB : FOPEN_RB,
++                              scratch_chan);
+       if (!exec_bfd)
+       {
+@@ -242,13 +240,6 @@ exec_file_attach (char *filename, int from_tty)
+                scratch_pathname, bfd_errmsg (bfd_get_error ()));
+       }
+-      /* At this point, scratch_pathname and exec_bfd->name both point to the
+-         same malloc'd string.  However exec_close() will attempt to free it
+-         via the exec_bfd->name pointer, so we need to make another copy and
+-         leave exec_bfd as the new owner of the original copy.  */
+-      scratch_pathname = xstrdup (scratch_pathname);
+-      cleanups = make_cleanup (xfree, scratch_pathname);
+-
+       if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching))
+       {
+         /* Make sure to close exec_bfd, or else "run" might try to use
+@@ -554,6 +545,7 @@ map_vmap (bfd *abfd, bfd *arch)
+   memset ((char *) vp, '\0', sizeof (*vp));
+   vp->nxt = 0;
+   vp->bfd = abfd;
++  gdb_bfd_ref (abfd);
+   vp->name = bfd_get_filename (arch ? arch : abfd);
+   vp->member = arch ? bfd_get_filename (abfd) : "";
 diff --git a/gdb/f-exp.y b/gdb/f-exp.y
-index b258c0a..1752973 100644
+index 33c7418..4db1bfa 100644
 --- a/gdb/f-exp.y
 +++ b/gdb/f-exp.y
-@@ -292,7 +292,9 @@ arglist :  subrange
+@@ -298,7 +298,9 @@ arglist :  subrange
                        { arglist_len = 1; }
        ;
     
@@ -3188,7 +4417,7 @@ index b258c0a..1752973 100644
        ;
  
 diff --git a/gdb/f-lang.h b/gdb/f-lang.h
-index 3a46ebf..2b73e1f 100644
+index 4aae3c5..51a4e1e 100644
 --- a/gdb/f-lang.h
 +++ b/gdb/f-lang.h
 @@ -28,6 +28,10 @@ extern void f_error (char *);       /* Defined in f-exp.y */
@@ -3199,9 +4428,9 @@ index 3a46ebf..2b73e1f 100644
 +  (struct type *type, struct ui_file *stream);
 +extern void f_object_address_data_valid_or_error (struct type *type);
 +
- extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-                       struct ui_file *, int,
-                       const struct value *,
+ extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
+                        struct ui_file *, int,
+                        const struct value *,
 diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
 index a95ef84..830917d 100644
 --- a/gdb/f-typeprint.c
@@ -3271,7 +4500,7 @@ index a95ef84..830917d 100644
      {
      case TYPE_CODE_ARRAY:
 diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
-index 87b2ed1..5d263f2 100644
+index 4359f6f..8ff834b 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];
@@ -3399,43 +4628,41 @@ index 87b2ed1..5d263f2 100644
            fprintf_filtered (stream, "...");
        }
      }
-@@ -260,6 +268,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+@@ -270,6 +278,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
    CORE_ADDR addr;
    int index;
  
 +  if (f_object_address_data_valid_print_to_stream (type, stream) != NULL)
-+    return 0;
++    return;
 +
    CHECK_TYPEDEF (type);
    switch (TYPE_CODE (type))
      {
 diff --git a/gdb/findvar.c b/gdb/findvar.c
-index 79c4221..1bb7c22 100644
+index 66bcebe..e59e5f2 100644
 --- a/gdb/findvar.c
 +++ b/gdb/findvar.c
-@@ -34,6 +34,7 @@
- #include "user-regs.h"
+@@ -35,6 +35,7 @@
  #include "block.h"
  #include "objfiles.h"
+ #include "language.h"
 +#include "dwarf2loc.h"
  
  /* Basic byte-swapping routines.  All 'extract' functions return a
     host-format integer from a target-format integer at ADDR which is
-@@ -407,8 +408,11 @@ symbol_read_needs_frame (struct symbol *sym)
- /* Given a struct symbol for a variable,
-    and a stack frame id, read the value of the variable
--   and return a (pointer to a) struct value containing the value.
--   If the variable cannot be found, throw error.  */
-+   and return a (pointer to a) struct value containing the value. 
-+   If the variable cannot be found, throw error.
+@@ -438,7 +439,10 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data)
+ }
+ /* A default implementation for the "la_read_var_value" hook in
+-   the language vector which should work in most situations.  */
++   the language vector which should work in most situations.
 +   We have to first find the address of the variable before allocating struct
 +   value to return as its size may depend on DW_OP_PUSH_OBJECT_ADDRESS possibly 
 +   used by its type.  */
  
  struct value *
- read_var_value (struct symbol *var, struct frame_info *frame)
-@@ -416,16 +420,6 @@ read_var_value (struct symbol *var, struct frame_info *frame)
default_read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -446,16 +450,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
    struct value *v;
    struct type *type = SYMBOL_TYPE (var);
    CORE_ADDR addr;
@@ -3452,7 +4679,7 @@ index 79c4221..1bb7c22 100644
  
    if (symbol_read_needs_frame (var))
      gdb_assert (frame);
-@@ -435,7 +429,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -465,7 +459,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
      case LOC_CONST:
        /* Put the constant back in target format.  */
        v = allocate_value (type);
@@ -3461,7 +4688,7 @@ index 79c4221..1bb7c22 100644
                            gdbarch_byte_order (get_type_arch (type)),
                            (LONGEST) SYMBOL_VALUE (var));
        VALUE_LVAL (v) = not_lval;
-@@ -460,12 +454,12 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -490,12 +484,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
  
      case LOC_CONST_BYTES:
        v = allocate_value (type);
@@ -3476,7 +4703,7 @@ index 79c4221..1bb7c22 100644
        if (overlay_debugging)
        addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
                                         SYMBOL_OBJ_SECTION (var));
-@@ -479,7 +473,6 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -509,7 +503,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
        error (_("Unknown argument list address for `%s'."),
               SYMBOL_PRINT_NAME (var));
        addr += SYMBOL_VALUE (var);
@@ -3484,7 +4711,7 @@ index 79c4221..1bb7c22 100644
        break;
  
      case LOC_REF_ARG:
-@@ -494,14 +487,12 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -524,14 +517,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
        argref += SYMBOL_VALUE (var);
        ref = value_at (lookup_pointer_type (type), argref);
        addr = value_as_address (ref);
@@ -3499,7 +4726,7 @@ index 79c4221..1bb7c22 100644
        break;
  
      case LOC_TYPEDEF:
-@@ -510,7 +501,6 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -540,7 +531,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
        break;
  
      case LOC_BLOCK:
@@ -3507,7 +4734,7 @@ index 79c4221..1bb7c22 100644
        if (overlay_debugging)
        addr = symbol_overlayed_address
          (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var));
-@@ -536,7 +526,6 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -566,7 +556,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
                     SYMBOL_PRINT_NAME (var));
  
            addr = value_as_address (regval);
@@ -3515,7 +4742,7 @@ index 79c4221..1bb7c22 100644
          }
        else
          {
-@@ -576,7 +565,6 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -615,7 +604,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
        if (obj_section
            && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
          addr = target_translate_tls_address (obj_section->objfile, addr);
@@ -3523,7 +4750,7 @@ index 79c4221..1bb7c22 100644
        }
        break;
  
-@@ -589,6 +577,10 @@ read_var_value (struct symbol *var, struct frame_info *frame)
+@@ -628,6 +616,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
        break;
      }
  
@@ -3534,7 +4761,7 @@ index 79c4221..1bb7c22 100644
    VALUE_LVAL (v) = lval_memory;
    set_value_address (v, addr);
    return v;
-@@ -671,10 +663,11 @@ struct value *
+@@ -723,10 +715,11 @@ struct value *
  value_from_register (struct type *type, int regnum, struct frame_info *frame)
  {
    struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -3548,7 +4775,7 @@ index 79c4221..1bb7c22 100644
      {
        int optim, unavail, ok;
  
-@@ -689,7 +682,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
+@@ -741,7 +734,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
        VALUE_LVAL (v) = lval_register;
        VALUE_FRAME_ID (v) = get_frame_id (frame);
        VALUE_REGNUM (v) = regnum;
@@ -3557,3818 +4784,2937 @@ index 79c4221..1bb7c22 100644
                                      value_contents_raw (v), &optim,
                                      &unavail);
  
-diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
-index 1bd2341..431ddcc 100644
---- a/gdb/gdbarch.c
-+++ b/gdb/gdbarch.c
-@@ -265,6 +265,16 @@ struct gdbarch
-   gdbarch_get_siginfo_type_ftype *get_siginfo_type;
-   gdbarch_record_special_symbol_ftype *record_special_symbol;
-   gdbarch_get_syscall_number_ftype *get_syscall_number;
-+  const char * stap_integer_prefix;
-+  const char * stap_integer_sufix;
-+  const char * stap_register_prefix;
-+  const char * stap_register_sufix;
-+  const char * stap_register_indirection_prefix;
-+  const char * stap_register_indirection_sufix;
-+  const char * stap_gdb_register_prefix;
-+  const char * stap_gdb_register_sufix;
-+  gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
-+  gdbarch_stap_parse_special_token_ftype *stap_parse_special_token;
-   int has_global_solist;
-   int has_global_breakpoints;
-   gdbarch_has_shared_address_space_ftype *has_shared_address_space;
-@@ -423,6 +433,16 @@ struct gdbarch startup_gdbarch =
-   0,  /* get_siginfo_type */
-   0,  /* record_special_symbol */
-   0,  /* get_syscall_number */
-+  0,  /* stap_integer_prefix */
-+  0,  /* stap_integer_sufix */
-+  0,  /* stap_register_prefix */
-+  0,  /* stap_register_sufix */
-+  0,  /* stap_register_indirection_prefix */
-+  0,  /* stap_register_indirection_sufix */
-+  0,  /* stap_gdb_register_prefix */
-+  0,  /* stap_gdb_register_sufix */
-+  0,  /* stap_is_single_operand */
-+  0,  /* stap_parse_special_token */
-   0,  /* has_global_solist */
-   0,  /* has_global_breakpoints */
-   default_has_shared_address_space,  /* has_shared_address_space */
-@@ -715,6 +735,16 @@ verify_gdbarch (struct gdbarch *gdbarch)
-   /* Skip verify of get_siginfo_type, has predicate.  */
-   /* Skip verify of record_special_symbol, has predicate.  */
-   /* Skip verify of get_syscall_number, has predicate.  */
-+  /* Skip verify of stap_integer_prefix, invalid_p == 0 */
-+  /* Skip verify of stap_integer_sufix, invalid_p == 0 */
-+  /* Skip verify of stap_register_prefix, invalid_p == 0 */
-+  /* Skip verify of stap_register_sufix, invalid_p == 0 */
-+  /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
-+  /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */
-+  /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
-+  /* Skip verify of stap_gdb_register_sufix, invalid_p == 0 */
-+  /* Skip verify of stap_is_single_operand, has predicate.  */
-+  /* Skip verify of stap_parse_special_token, has predicate.  */
-   /* Skip verify of has_global_solist, invalid_p == 0 */
-   /* Skip verify of has_global_breakpoints, invalid_p == 0 */
-   /* Skip verify of has_shared_address_space, invalid_p == 0 */
-@@ -1267,6 +1297,42 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
-                       "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
-                       host_address_to_string (gdbarch->stabs_argument_has_addr));
-   fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_gdb_register_prefix = %s\n",
-+                      gdbarch->stap_gdb_register_prefix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_gdb_register_sufix = %s\n",
-+                      gdbarch->stap_gdb_register_sufix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_integer_prefix = %s\n",
-+                      gdbarch->stap_integer_prefix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_integer_sufix = %s\n",
-+                      gdbarch->stap_integer_sufix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
-+                      gdbarch_stap_is_single_operand_p (gdbarch));
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_is_single_operand = <%s>\n",
-+                      host_address_to_string (gdbarch->stap_is_single_operand));
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
-+                      gdbarch_stap_parse_special_token_p (gdbarch));
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_parse_special_token = <%s>\n",
-+                      host_address_to_string (gdbarch->stap_parse_special_token));
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_register_indirection_prefix = %s\n",
-+                      gdbarch->stap_register_indirection_prefix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_register_indirection_sufix = %s\n",
-+                      gdbarch->stap_register_indirection_sufix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_register_prefix = %s\n",
-+                      gdbarch->stap_register_prefix);
-+  fprintf_unfiltered (file,
-+                      "gdbarch_dump: stap_register_sufix = %s\n",
-+                      gdbarch->stap_register_sufix);
-+  fprintf_unfiltered (file,
-                       "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n",
-                       gdbarch_static_transform_name_p (gdbarch));
-   fprintf_unfiltered (file,
-@@ -3834,6 +3900,190 @@ set_gdbarch_get_syscall_number (struct gdbarch *gdbarch,
-   gdbarch->get_syscall_number = get_syscall_number;
+diff --git a/gdb/gcore.c b/gdb/gcore.c
+index aedda41..a45e787 100644
+--- a/gdb/gcore.c
++++ b/gdb/gcore.c
+@@ -33,6 +33,7 @@
+ #include <fcntl.h>
+ #include "regcache.h"
+ #include "regset.h"
++#include "gdb_bfd.h"
+ /* The largest amount of memory to read from the target at once.  We
+    must throttle it to limit the amount of memory used by GDB during
+@@ -50,7 +51,7 @@ static int gcore_memory_sections (bfd *);
+ bfd *
+ create_gcore_bfd (char *filename)
+ {
+-  bfd *obfd = bfd_openw (filename, default_gcore_target ());
++  bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
+   if (!obfd)
+     error (_("Failed to open '%s' for output."), filename);
+@@ -110,7 +111,7 @@ do_bfd_delete_cleanup (void *arg)
+   bfd *obfd = arg;
+   const char *filename = obfd->filename;
+-  bfd_close (arg);
++  gdb_bfd_unref (arg);
+   unlink (filename);
  }
  
-+const char *
-+gdbarch_stap_integer_prefix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_integer_prefix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_prefix called\n");
-+  return gdbarch->stap_integer_prefix;
-+}
+@@ -154,7 +155,7 @@ gcore_command (char *args, int from_tty)
+   fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename);
+   discard_cleanups (old_chain);
+-  bfd_close (obfd);
++  gdb_bfd_unref (obfd);
+ }
+ static unsigned long
+diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
+index ffb7f53..a2e7e94 100644
+--- a/gdb/gdb-gdb.gdb.in
++++ b/gdb/gdb-gdb.gdb.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
 +
-+void
-+set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch,
-+                                 const char * stap_integer_prefix)
-+{
-+  gdbarch->stap_integer_prefix = stap_integer_prefix;
-+}
+ set complaints 1
+ b internal_error
+diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
+new file mode 100644
+index 0000000..fac8776
+--- /dev/null
++++ b/gdb/gdb_bfd.c
+@@ -0,0 +1,670 @@
++/* Definitions for BFD wrappers used by GDB.
 +
-+const char *
-+gdbarch_stap_integer_sufix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_integer_sufix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_integer_sufix called\n");
-+  return gdbarch->stap_integer_sufix;
-+}
++   Copyright (C) 2011, 2012
++   Free Software Foundation, Inc.
 +
-+void
-+set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch,
-+                                const char * stap_integer_sufix)
-+{
-+  gdbarch->stap_integer_sufix = stap_integer_sufix;
-+}
++   This file is part of GDB.
 +
-+const char *
-+gdbarch_stap_register_prefix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_register_prefix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_prefix called\n");
-+  return gdbarch->stap_register_prefix;
-+}
++   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.
 +
-+void
-+set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch,
-+                                  const char * stap_register_prefix)
-+{
-+  gdbarch->stap_register_prefix = stap_register_prefix;
-+}
++   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.
 +
-+const char *
-+gdbarch_stap_register_sufix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_register_sufix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_sufix called\n");
-+  return gdbarch->stap_register_sufix;
-+}
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+void
-+set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch,
-+                                 const char * stap_register_sufix)
-+{
-+  gdbarch->stap_register_sufix = stap_register_sufix;
-+}
++#include "defs.h"
++#include "gdb_bfd.h"
++#include "gdb_assert.h"
++#include "gdb_string.h"
++#include "ui-out.h"
++#include "gdbcmd.h"
++#include "hashtab.h"
++#ifdef HAVE_ZLIB_H
++#include <zlib.h>
++#endif
++#ifdef HAVE_MMAP
++#include <sys/mman.h>
++#ifndef MAP_FAILED
++#define MAP_FAILED ((void *) -1)
++#endif
++#endif
 +
-+const char *
-+gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_register_indirection_prefix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_prefix called\n");
-+  return gdbarch->stap_register_indirection_prefix;
-+}
++/* An object of this type is stored in the section's user data when
++   mapping a section.  */
 +
-+void
-+set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch,
-+                                              const char * stap_register_indirection_prefix)
++struct gdb_bfd_section_data
 +{
-+  gdbarch->stap_register_indirection_prefix = stap_register_indirection_prefix;
-+}
++  /* Size of the data.  */
++  bfd_size_type size;
++  /* If the data was mmapped, this is the length of the map.  */
++  bfd_size_type map_len;
++  /* The data.  If NULL, the section data has not been read.  */
++  void *data;
++  /* If the data was mmapped, this is the map address.  */
++  void *map_addr;
++};
 +
-+const char *
-+gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_register_indirection_sufix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_register_indirection_sufix called\n");
-+  return gdbarch->stap_register_indirection_sufix;
-+}
++/* A hash table holding every BFD that gdb knows about.  This is not
++   to be confused with 'gdb_bfd_cache', which is used for sharing
++   BFDs; in contrast, this hash is used just to implement
++   "maint info bfd".  */
 +
-+void
-+set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch,
-+                                             const char * stap_register_indirection_sufix)
-+{
-+  gdbarch->stap_register_indirection_sufix = stap_register_indirection_sufix;
-+}
++static htab_t all_bfds;
 +
-+const char *
-+gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_gdb_register_prefix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_prefix called\n");
-+  return gdbarch->stap_gdb_register_prefix;
-+}
++/* See gdb_bfd.h.  */
 +
 +void
-+set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch,
-+                                      const char * stap_gdb_register_prefix)
++gdb_bfd_stash_filename (struct bfd *abfd)
 +{
-+  gdbarch->stap_gdb_register_prefix = stap_gdb_register_prefix;
-+}
++  char *name = bfd_get_filename (abfd);
++  char *data;
 +
-+const char *
-+gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  /* Skip verify of stap_gdb_register_sufix, invalid_p == 0 */
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_gdb_register_sufix called\n");
-+  return gdbarch->stap_gdb_register_sufix;
-+}
++  data = bfd_alloc (abfd, strlen (name) + 1);
++  strcpy (data, name);
 +
-+void
-+set_gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch,
-+                                     const char * stap_gdb_register_sufix)
-+{
-+  gdbarch->stap_gdb_register_sufix = stap_gdb_register_sufix;
++  /* Unwarranted chumminess with BFD.  */
++  abfd->filename = data;
 +}
 +
-+int
-+gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch)
-+{
-+  gdb_assert (gdbarch != NULL);
-+  return gdbarch->stap_is_single_operand != NULL;
-+}
++/* An object of this type is stored in each BFD's user data.  */
 +
-+int
-+gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
++struct gdb_bfd_data
 +{
-+  gdb_assert (gdbarch != NULL);
-+  gdb_assert (gdbarch->stap_is_single_operand != NULL);
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_is_single_operand called\n");
-+  return gdbarch->stap_is_single_operand (gdbarch, s);
-+}
++  /* The reference count.  */
++  int refc;
 +
-+void
-+set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
-+                                    gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
++  /* The mtime of the BFD at the point the cache entry was made.  */
++  time_t mtime;
++};
++
++/* A hash table storing all the BFDs maintained in the cache.  */
++
++static htab_t gdb_bfd_cache;
++
++/* The type of an object being looked up in gdb_bfd_cache.  We use
++   htab's capability of storing one kind of object (BFD in this case)
++   and using a different sort of object for searching.  */
++
++struct gdb_bfd_cache_search
 +{
-+  gdbarch->stap_is_single_operand = stap_is_single_operand;
-+}
++  /* The filename.  */
++  const char *filename;
++  /* The mtime.  */
++  time_t mtime;
++};
 +
-+int
-+gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
++/* A hash function for BFDs.  */
++
++static hashval_t
++hash_bfd (const void *b)
 +{
-+  gdb_assert (gdbarch != NULL);
-+  return gdbarch->stap_parse_special_token != NULL;
++  const bfd *abfd = b;
++
++  /* It is simplest to just hash the filename.  */
++  return htab_hash_string (bfd_get_filename (abfd));
 +}
 +
-+int
-+gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p)
++/* An equality function for BFDs.  Note that this expects the caller
++   to search using struct gdb_bfd_cache_search only, not BFDs.  */
++
++static int
++eq_bfd (const void *a, const void *b)
 +{
-+  gdb_assert (gdbarch != NULL);
-+  gdb_assert (gdbarch->stap_parse_special_token != NULL);
-+  if (gdbarch_debug >= 2)
-+    fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_parse_special_token called\n");
-+  return gdbarch->stap_parse_special_token (gdbarch, p);
++  const bfd *abfd = a;
++  const struct gdb_bfd_cache_search *s = b;
++  struct gdb_bfd_data *gdata = bfd_usrdata (abfd);
++
++  return (gdata->mtime == s->mtime
++        && strcmp (bfd_get_filename (abfd), s->filename) == 0);
 +}
 +
-+void
-+set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
-+                                      gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
++/* See gdb_bfd.h.  */
++
++struct bfd *
++gdb_bfd_open (const char *name, const char *target, int fd)
 +{
-+  gdbarch->stap_parse_special_token = stap_parse_special_token;
-+}
++  hashval_t hash;
++  void **slot;
++  bfd *abfd;
++  struct gdb_bfd_cache_search search;
++  struct stat st;
 +
- int
- gdbarch_has_global_solist (struct gdbarch *gdbarch)
- {
-diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
-index 044281c..294a63f 100644
---- a/gdb/gdbarch.h
-+++ b/gdb/gdbarch.h
-@@ -55,6 +55,7 @@ struct core_regset_section;
- struct syscall;
- struct agent_expr;
- struct axs_value;
-+struct stap_parse_info;
- /* The architecture associated with the connection to the target.
-  
-@@ -979,6 +980,125 @@ typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, pti
- extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, ptid_t ptid);
- extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number);
-+/* SystemTap related fields and functions.
-+   Prefix used to mark an integer constant on the architecture's assembly
-+   For example, on x86 integer constants are written as:
-+  
-+    $10 ;; integer constant 10
-+  
-+   in this case, this prefix would be the character `$'. */
++  if (gdb_bfd_cache == NULL)
++    gdb_bfd_cache = htab_create_alloc (1, hash_bfd, eq_bfd, NULL,
++                                     xcalloc, xfree);
 +
-+extern const char * gdbarch_stap_integer_prefix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_integer_prefix (struct gdbarch *gdbarch, const char * stap_integer_prefix);
++  if (fd == -1)
++    {
++      fd = open (name, O_RDONLY | O_BINARY);
++      if (fd == -1)
++      {
++        bfd_set_error (bfd_error_system_call);
++        return NULL;
++      }
++    }
 +
-+/* Sufix used to mark an integer constant on the architecture's assembly. */
++  search.filename = name;
++  if (fstat (fd, &st) < 0)
++    {
++      /* Weird situation here.  */
++      search.mtime = 0;
++    }
++  else
++    search.mtime = st.st_mtime;
++
++  /* Note that this must compute the same result as hash_bfd.  */
++  hash = htab_hash_string (name);
++  /* Note that we cannot use htab_find_slot_with_hash here, because
++     opening the BFD may fail; and this would violate hashtab
++     invariants.  */
++  abfd = htab_find_with_hash (gdb_bfd_cache, &search, hash);
++  if (abfd != NULL)
++    {
++      close (fd);
++      gdb_bfd_ref (abfd);
++      return abfd;
++    }
 +
-+extern const char * gdbarch_stap_integer_sufix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_integer_sufix (struct gdbarch *gdbarch, const char * stap_integer_sufix);
++  abfd = bfd_fopen (name, target, FOPEN_RB, fd);
++  if (abfd == NULL)
++    return NULL;
 +
-+/* Prefix used to mark a register name on the architecture's assembly.
-+   For example, on x86 the register name is written as:
-+  
-+    %eax ;; register eax
-+  
-+   in this case, this prefix would be the character `%'. */
++  slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, INSERT);
++  gdb_assert (!*slot);
++  *slot = abfd;
 +
-+extern const char * gdbarch_stap_register_prefix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_register_prefix (struct gdbarch *gdbarch, const char * stap_register_prefix);
++  gdb_bfd_stash_filename (abfd);
++  gdb_bfd_ref (abfd);
++  return abfd;
++}
 +
-+/* Sufix used to mark a register name on the architecture's assembly */
++/* A helper function that releases any section data attached to the
++   BFD.  */
 +
-+extern const char * gdbarch_stap_register_sufix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_register_sufix (struct gdbarch *gdbarch, const char * stap_register_sufix);
++static void
++free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
++{
++  struct gdb_bfd_section_data *sect = bfd_get_section_userdata (abfd, sectp);
 +
-+/* Prefix used to mark a register indirection on the architecture's assembly.
-+   For example, on x86 the register indirection is written as:
-+  
-+    (%eax) ;; indirecting eax
-+  
-+   in this case, this prefix would be the charater `('.
-+  
-+   Please note that we use the indirection prefix also for register
-+   displacement, e.g., `4(%eax)' on x86. */
++  if (sect != NULL && sect->data != NULL)
++    {
++#ifdef HAVE_MMAP
++      if (sect->map_addr != NULL)
++      {
++        int res;
 +
-+extern const char * gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_register_indirection_prefix (struct gdbarch *gdbarch, const char * stap_register_indirection_prefix);
++        res = munmap (sect->map_addr, sect->map_len);
++        gdb_assert (res == 0);
++      }
++      else
++#endif
++      xfree (sect->data);
++    }
++}
 +
-+/* Sufix used to mark a register indirection on the architecture's assembly.
-+   For example, on x86 the register indirection is written as:
-+  
-+    (%eax) ;; indirecting eax
-+  
-+   in this case, this prefix would be the charater `)'.
-+  
-+   Please note that we use the indirection sufix also for register
-+   displacement, e.g., `4(%eax)' on x86. */
++/* Close ABFD, and warn if that fails.  */
 +
-+extern const char * gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_register_indirection_sufix (struct gdbarch *gdbarch, const char * stap_register_indirection_sufix);
++static int
++gdb_bfd_close_or_warn (struct bfd *abfd)
++{
++  int ret;
++  char *name = bfd_get_filename (abfd);
 +
-+/* Prefix used to name a register using GDB's nomenclature.
-+  
-+   For example, on PPC a register is represented by a number in the assembly
-+   language (e.g., `10' is the 10th general-purpose register).  However,
-+   inside GDB this same register has an `r' appended to its name, so the 10th
-+   register would be represented as `r10' internally. */
++  bfd_map_over_sections (abfd, free_one_bfd_section, NULL);
 +
-+extern const char * gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, const char * stap_gdb_register_prefix);
++  ret = bfd_close (abfd);
 +
-+/* Sufix used to name a register using GDB's nomenclature. */
++  if (!ret)
++    warning (_("cannot close \"%s\": %s"),
++           name, bfd_errmsg (bfd_get_error ()));
 +
-+extern const char * gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch);
-+extern void set_gdbarch_stap_gdb_register_sufix (struct gdbarch *gdbarch, const char * stap_gdb_register_sufix);
++  return ret;
++}
 +
-+/* Check if S is a single operand.
-+  
-+   Single operands can be:
-+    - Literal integers, e.g. `$10' on x86
-+    - Register access, e.g. `%eax' on x86
-+    - Register indirection, e.g. `(%eax)' on x86
-+    - Register displacement, e.g. `4(%eax)' on x86
-+  
-+   This function should check for these patterns on the string
-+   and return 1 if some were found, or zero otherwise.  Please try to match
-+   as much info as you can from the string, i.e., if you have to match
-+   something like `(%', do not match just the `('. */
++/* See gdb_bfd.h.  */
 +
-+extern int gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch);
++void
++gdb_bfd_ref (struct bfd *abfd)
++{
++  struct gdb_bfd_data *gdata;
++  void **slot;
 +
-+typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s);
-+extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s);
-+extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand);
++  if (abfd == NULL)
++    return;
 +
-+/* Function used to handle a "special case" in the parser.
-+  
-+   A "special case" is considered to be an unknown token, i.e., a token
-+   that the parser does not know how to parse.  A good example of special
-+   case would be ARM's register displacement syntax:
-+  
-+    [R0, #4]  ;; displacing R0 by 4
-+  
-+   Since the parser assumes that a register displacement is of the form:
-+  
-+    <number> <indirection_prefix> <register_name> <indirection_sufix>
-+  
-+   it means that it will not be able to recognize and parse this odd syntax.
-+   Therefore, we should add a special case function that will handle this token.
-+  
-+   This function should generate the proper expression form of the expression
-+   using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode'
-+   and so on).  It should also return 1 if the parsing was successful, or zero
-+   if the token was not recognized as a special token (in this case, returning
-+   zero means that the special parser is deferring the parsing to the generic
-+   parser), and should advance the buffer pointer (p->arg). */
-+
-+extern int gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch);
-+
-+typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p);
-+extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
-+extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
-+
- /* True if the list of shared libraries is one and only for all
-    processes, as opposed to a list of shared libraries per inferior.
-    This usually means that all processes, although may or may not share
-diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
-index 37281ba..879fab7 100755
---- a/gdb/gdbarch.sh
-+++ b/gdb/gdbarch.sh
-@@ -792,6 +792,101 @@ M:void:record_special_symbol:struct objfile *objfile, asymbol *sym:objfile, sym
- # Get architecture-specific system calls information from registers.
- M:LONGEST:get_syscall_number:ptid_t ptid:ptid
-+# SystemTap related fields and functions.
-+
-+# Prefix used to mark an integer constant on the architecture's assembly
-+# For example, on x86 integer constants are written as:
-+#
-+#  \$10 ;; integer constant 10
-+#
-+# in this case, this prefix would be the character \`\$\'.
-+v:const char *:stap_integer_prefix:::0:0::0:gdbarch->stap_integer_prefix
++  gdata = bfd_usrdata (abfd);
 +
-+# Sufix used to mark an integer constant on the architecture's assembly.
-+v:const char *:stap_integer_sufix:::0:0::0:gdbarch->stap_integer_sufix
++  if (gdata != NULL)
++    {
++      gdata->refc += 1;
++      return;
++    }
 +
-+# Prefix used to mark a register name on the architecture's assembly.
-+# For example, on x86 the register name is written as:
-+#
-+#  \%eax ;; register eax
-+#
-+# in this case, this prefix would be the character \`\%\'.
-+v:const char *:stap_register_prefix:::0:0::0:gdbarch->stap_register_prefix
++  gdata = bfd_zalloc (abfd, sizeof (struct gdb_bfd_data));
++  gdata->refc = 1;
++  gdata->mtime = bfd_get_mtime (abfd);
++  bfd_usrdata (abfd) = gdata;
 +
-+# Sufix used to mark a register name on the architecture's assembly
-+v:const char *:stap_register_sufix:::0:0::0:gdbarch->stap_register_sufix
++  /* This is the first we've seen it, so add it to the hash table.  */
++  slot = htab_find_slot (all_bfds, abfd, INSERT);
++  gdb_assert (slot && !*slot);
++  *slot = abfd;
++}
 +
-+# Prefix used to mark a register indirection on the architecture's assembly.
-+# For example, on x86 the register indirection is written as:
-+#
-+#  \(\%eax\) ;; indirecting eax
-+#
-+# in this case, this prefix would be the charater \`\(\'.
-+#
-+# Please note that we use the indirection prefix also for register
-+# displacement, e.g., \`4\(\%eax\)\' on x86.
-+v:const char *:stap_register_indirection_prefix:::0:0::0:gdbarch->stap_register_indirection_prefix
++/* See gdb_bfd.h.  */
 +
-+# Sufix used to mark a register indirection on the architecture's assembly.
-+# For example, on x86 the register indirection is written as:
-+#
-+#  \(\%eax\) ;; indirecting eax
-+#
-+# in this case, this prefix would be the charater \`\)\'.
-+#
-+# Please note that we use the indirection sufix also for register
-+# displacement, e.g., \`4\(\%eax\)\' on x86.
-+v:const char *:stap_register_indirection_sufix:::0:0::0:gdbarch->stap_register_indirection_sufix
++void
++gdb_bfd_unref (struct bfd *abfd)
++{
++  struct gdb_bfd_data *gdata;
++  struct gdb_bfd_cache_search search;
++  void **slot;
 +
-+# Prefix used to name a register using GDB's nomenclature.
-+#
-+# For example, on PPC a register is represented by a number in the assembly
-+# language (e.g., \`10\' is the 10th general-purpose register).  However,
-+# inside GDB this same register has an \`r\' appended to its name, so the 10th
-+# register would be represented as \`r10\' internally.
-+v:const char *:stap_gdb_register_prefix:::0:0::0:gdbarch->stap_gdb_register_prefix
++  if (abfd == NULL)
++    return;
 +
-+# Sufix used to name a register using GDB's nomenclature.
-+v:const char *:stap_gdb_register_sufix:::0:0::0:gdbarch->stap_gdb_register_sufix
++  gdata = bfd_usrdata (abfd);
++  gdb_assert (gdata->refc >= 1);
 +
-+# Check if S is a single operand.
-+#
-+# Single operands can be:
-+#  \- Literal integers, e.g. \`\$10\' on x86
-+#  \- Register access, e.g. \`\%eax\' on x86
-+#  \- Register indirection, e.g. \`\(\%eax\)\' on x86
-+#  \- Register displacement, e.g. \`4\(\%eax\)\' on x86
-+#
-+# This function should check for these patterns on the string
-+# and return 1 if some were found, or zero otherwise.  Please try to match
-+# as much info as you can from the string, i.e., if you have to match
-+# something like \`\(\%\', do not match just the \`\(\'.
-+M:int:stap_is_single_operand:const char *s:s
++  gdata->refc -= 1;
++  if (gdata->refc > 0)
++    return;
 +
-+# Function used to handle a "special case" in the parser.
-+#
-+# A "special case" is considered to be an unknown token, i.e., a token
-+# that the parser does not know how to parse.  A good example of special
-+# case would be ARM's register displacement syntax:
-+#
-+#  [R0, #4]  ;; displacing R0 by 4
-+#
-+# Since the parser assumes that a register displacement is of the form:
-+#
-+#  <number> <indirection_prefix> <register_name> <indirection_sufix>
-+#
-+# it means that it will not be able to recognize and parse this odd syntax.
-+# Therefore, we should add a special case function that will handle this token.
-+#
-+# This function should generate the proper expression form of the expression
-+# using GDB\'s internal expression mechanism (e.g., \`write_exp_elt_opcode\'
-+# and so on).  It should also return 1 if the parsing was successful, or zero
-+# if the token was not recognized as a special token (in this case, returning
-+# zero means that the special parser is deferring the parsing to the generic
-+# parser), and should advance the buffer pointer (p->arg).
-+M:int:stap_parse_special_token:struct stap_parse_info *p:p
-+
-+
- # True if the list of shared libraries is one and only for all
- # processes, as opposed to a list of shared libraries per inferior.
- # This usually means that all processes, although may or may not share
-@@ -954,6 +1049,7 @@ struct core_regset_section;
- struct syscall;
- struct agent_expr;
- struct axs_value;
-+struct stap_parse_info;
- /* The architecture associated with the connection to the target.
-  
-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
++  search.filename = bfd_get_filename (abfd);
 +
- set complaints 1
- b internal_error
-diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
-index b09c1ec..8e0256c 100644
---- a/gdb/gdbtypes.c
-+++ b/gdb/gdbtypes.c
-@@ -37,6 +37,9 @@
- #include "gdb_assert.h"
- #include "hashtab.h"
- #include "exceptions.h"
-+#include "observer.h"
-+#include "dwarf2expr.h"
-+#include "dwarf2loc.h"
- /* Initialize BADNESS constants.  */
-@@ -141,7 +144,16 @@ static void print_bit_vector (B_TYPE *, int);
- 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);
-+static LONGEST type_length_get (struct type *type, struct type *target_type,
-+                              int full_span);
-+#if 0
-+/* The hash table holding all discardable `struct type *' references.  */
-+static htab_t type_discardable_table;
++  if (gdb_bfd_cache && search.filename)
++    {
++      hashval_t hash = htab_hash_string (search.filename);
++      void **slot;
 +
-+/* Current type_discardable_check pass used for TYPE_DISCARDABLE_AGE.  */
-+static int type_discardable_age_current;
-+#endif
- /* Allocate a new OBJFILE-associated type structure and fill it
-    with some defaults.  Space for the type structure is allocated
-@@ -172,6 +184,43 @@ alloc_type (struct objfile *objfile)
-   return type;
- }
-+#if 0
-+/* Declare TYPE as discardable on next garbage collection by free_all_types.
-+   You must call type_mark_used during each free_all_types to protect TYPE from
-+   being deallocated.  */
++      search.mtime = gdata->mtime;
++      slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash,
++                                     NO_INSERT);
 +
-+static void
-+set_type_as_discardable (struct type *type)
++      if (slot && *slot)
++      htab_clear_slot (gdb_bfd_cache, slot);
++    }
++
++  bfd_usrdata (abfd) = NULL;  /* Paranoia.  */
++
++  htab_remove_elt (all_bfds, abfd);
++
++  gdb_bfd_close_or_warn (abfd);
++}
++
++/* A helper function that returns the section data descriptor
++   associated with SECTION.  If no such descriptor exists, a new one
++   is allocated and cleared.  */
++
++static struct gdb_bfd_section_data *
++get_section_descriptor (asection *section)
 +{
-+  void **slot;
++  struct gdb_bfd_section_data *result;
 +
-+  gdb_assert (!TYPE_DISCARDABLE (type));
++  result = bfd_get_section_userdata (section->owner, section);
 +
-+  TYPE_DISCARDABLE (type) = 1;
-+  TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current;
++  if (result == NULL)
++    {
++      result = bfd_zalloc (section->owner, sizeof (*result));
++      bfd_set_section_userdata (section->owner, section, result);
++    }
 +
-+  slot = htab_find_slot (type_discardable_table, type, INSERT);
-+  gdb_assert (!*slot);
-+  *slot = type;
++  return result;
 +}
++
++/* Decompress a section that was compressed using zlib.  Store the
++   decompressed buffer, and its size, in DESCRIPTOR.  */
++
++static void
++zlib_decompress_section (asection *sectp,
++                       struct gdb_bfd_section_data *descriptor)
++{
++  bfd *abfd = sectp->owner;
++#ifndef HAVE_ZLIB_H
++  error (_("Support for zlib-compressed data (from '%s', section '%s') "
++           "is disabled in this copy of GDB"),
++         bfd_get_filename (abfd),
++       bfd_get_section_name (sectp));
++#else
++  bfd_size_type compressed_size = bfd_get_section_size (sectp);
++  gdb_byte *compressed_buffer = xmalloc (compressed_size);
++  struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer);
++  struct cleanup *inner_cleanup;
++  bfd_size_type uncompressed_size;
++  gdb_byte *uncompressed_buffer;
++  z_stream strm;
++  int rc;
++  int header_size = 12;
++  struct dwarf2_per_bfd_section *section_data;
++
++  if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
++      || bfd_bread (compressed_buffer,
++                  compressed_size, abfd) != compressed_size)
++    error (_("can't read data from '%s', section '%s'"),
++           bfd_get_filename (abfd),
++         bfd_get_section_name (abfd, sectp));
++
++  /* Read the zlib header.  In this case, it should be "ZLIB" followed
++     by the uncompressed section size, 8 bytes in big-endian order.  */
++  if (compressed_size < header_size
++      || strncmp (compressed_buffer, "ZLIB", 4) != 0)
++    error (_("corrupt ZLIB header from '%s', section '%s'"),
++           bfd_get_filename (abfd),
++         bfd_get_section_name (abfd, sectp));
++  uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8;
++  uncompressed_size += compressed_buffer[11];
++
++  /* It is possible the section consists of several compressed
++     buffers concatenated together, so we uncompress in a loop.  */
++  strm.zalloc = NULL;
++  strm.zfree = NULL;
++  strm.opaque = NULL;
++  strm.avail_in = compressed_size - header_size;
++  strm.next_in = (Bytef*) compressed_buffer + header_size;
++  strm.avail_out = uncompressed_size;
++  uncompressed_buffer = xmalloc (uncompressed_size);
++  inner_cleanup = make_cleanup (xfree, uncompressed_buffer);
++  rc = inflateInit (&strm);
++  while (strm.avail_in > 0)
++    {
++      if (rc != Z_OK)
++        error (_("setting up uncompression in '%s', section '%s': %d"),
++               bfd_get_filename (abfd),
++             bfd_get_section_name (abfd, sectp),
++             rc);
++      strm.next_out = ((Bytef*) uncompressed_buffer
++                       + (uncompressed_size - strm.avail_out));
++      rc = inflate (&strm, Z_FINISH);
++      if (rc != Z_STREAM_END)
++        error (_("zlib error uncompressing from '%s', section '%s': %d"),
++               bfd_get_filename (abfd),
++             bfd_get_section_name (abfd, sectp),
++             rc);
++      rc = inflateReset (&strm);
++    }
++  rc = inflateEnd (&strm);
++  if (rc != Z_OK
++      || strm.avail_out != 0)
++    error (_("concluding uncompression in '%s', section '%s': %d"),
++           bfd_get_filename (abfd),
++         bfd_get_section_name (abfd, sectp),
++         rc);
++
++  discard_cleanups (inner_cleanup);
++  do_cleanups (cleanup);
++
++  /* Attach the data to the BFD section.  */
++  descriptor->data = uncompressed_buffer;
++  descriptor->size = uncompressed_size;
 +#endif
++}
 +
-+/* Allocate a new type like alloc_type but preserve for it the discardability
-+   state of PARENT_TYPE.  */
++/* See gdb_bfd.h.  */
 +
-+static struct type *
-+alloc_type_as_parent (struct type *parent_type)
++const gdb_byte *
++gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
 +{
-+  struct type *new_type = alloc_type_copy (parent_type);
++  bfd *abfd;
++  gdb_byte *buf, *retbuf;
++  unsigned char header[4];
++  struct gdb_bfd_section_data *descriptor;
 +
-+#if 0
-+  if (TYPE_DISCARDABLE (parent_type))
-+    set_type_as_discardable (new_type);
-+#endif
++  gdb_assert ((sectp->flags & SEC_RELOC) == 0);
++  gdb_assert (size != NULL);
 +
-+  return new_type;
-+}
++  abfd = sectp->owner;
 +
- /* Allocate a new GDBARCH-associated type structure and fill it
-    with some defaults.  Space for the type structure is allocated
-    on the heap.  */
-@@ -297,7 +346,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
-   if (typeptr == 0 || *typeptr == 0)  /* We'll need to allocate one.  */
-     {
--      ntype = alloc_type_copy (type);
-+      ntype = alloc_type_as_parent (type);
-       if (typeptr)
-       *typeptr = ntype;
-     }
-@@ -374,7 +423,7 @@ make_reference_type (struct type *type, struct type **typeptr)
-   if (typeptr == 0 || *typeptr == 0)  /* We'll need to allocate one.  */
-     {
--      ntype = alloc_type_copy (type);
-+      ntype = alloc_type_as_parent (type);
-       if (typeptr)
-       *typeptr = ntype;
-     }
-@@ -747,6 +796,7 @@ create_range_type (struct type *result_type, struct type *index_type,
-     TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
-   TYPE_LOW_BOUND (result_type) = low_bound;
-   TYPE_HIGH_BOUND (result_type) = high_bound;
-+  TYPE_BYTE_STRIDE (result_type) = 0;
-   if (low_bound >= 0)
-     TYPE_UNSIGNED (result_type) = 1;
-@@ -890,26 +940,31 @@ create_array_type (struct type *result_type,
-   TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
-   TYPE_TARGET_TYPE (result_type) = element_type;
--  if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
--    low_bound = high_bound = 0;
--  CHECK_TYPEDEF (element_type);
--  /* Be careful when setting the array length.  Ada arrays can be
--     empty arrays with the high_bound being smaller than the low_bound.
--     In such cases, the array length should be zero.  */
--  if (high_bound < low_bound)
--    TYPE_LENGTH (result_type) = 0;
--  else
--    TYPE_LENGTH (result_type) =
--      TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);
-   TYPE_NFIELDS (result_type) = 1;
-   TYPE_FIELDS (result_type) =
-     (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
-   TYPE_INDEX_TYPE (result_type) = range_type;
-   TYPE_VPTR_FIELDNO (result_type) = -1;
--  /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays.  */
-+  /* DWARF blocks may depend on runtime information like
-+     DW_OP_PUSH_OBJECT_ADDRESS not being available during the
-+     CREATE_ARRAY_TYPE time.  */
-+  if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT
-+      || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT
-+      || TYPE_DYNAMIC (element_type))
-+    TYPE_LENGTH (result_type) = 0;
-+  else
++  descriptor = get_section_descriptor (sectp);
++
++  /* If the data was already read for this BFD, just reuse it.  */
++  if (descriptor->data != NULL)
++    goto done;
++
++  /* Check if the file has a 4-byte header indicating compression.  */
++  if (bfd_get_section_size (sectp) > sizeof (header)
++      && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0
++      && bfd_bread (header, sizeof (header), abfd) == sizeof (header))
 +    {
-+      CHECK_TYPEDEF (element_type);
-+      TYPE_LENGTH (result_type) = type_length_get (result_type, element_type,
-+                                                 0);
++      /* Upon decompression, update the buffer and its size.  */
++      if (strncmp (header, "ZLIB", sizeof (header)) == 0)
++        {
++          zlib_decompress_section (sectp, descriptor);
++        goto done;
++        }
 +    }
-   if (TYPE_LENGTH (result_type) == 0)
--    TYPE_TARGET_STUB (result_type) = 1;
++
++#ifdef HAVE_MMAP
++  {
++    /* The page size, used when mmapping.  */
++    static int pagesize;
++
++    if (pagesize == 0)
++      pagesize = getpagesize ();
++
++    /* Only try to mmap sections which are large enough: we don't want
++       to waste space due to fragmentation.  */
++
++    if (bfd_get_section_size (sectp) > 4 * pagesize)
++      {
++      descriptor->size = bfd_get_section_size (sectp);
++      descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ,
++                                   MAP_PRIVATE, sectp->filepos,
++                                   &descriptor->map_addr,
++                                   &descriptor->map_len);
++
++      if ((caddr_t)descriptor->data != MAP_FAILED)
++        {
++#if HAVE_POSIX_MADVISE
++          posix_madvise (descriptor->map_addr, descriptor->map_len,
++                         POSIX_MADV_WILLNEED);
++#endif
++          goto done;
++        }
++
++      /* On failure, clear out the section data and try again.  */
++      memset (descriptor, 0, sizeof (*descriptor));
++      }
++  }
++#endif /* HAVE_MMAP */
++
++  /* If we get here, we are a normal, not-compressed section.  */
++
++  descriptor->size = bfd_get_section_size (sectp);
++  descriptor->data = xmalloc (descriptor->size);
++
++  if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
++      || bfd_bread (descriptor->data, bfd_get_section_size (sectp),
++                  abfd) != bfd_get_section_size (sectp))
 +    {
-+      /* The real size will be computed for specific instances by
-+       CHECK_TYPEDEF.  */
-+      TYPE_TARGET_STUB (result_type) = 1;
++      xfree (descriptor->data);
++      descriptor->data = NULL;
++      error (_("Can't read data for section '%s'"),
++           bfd_get_filename (abfd));
 +    }
-   return result_type;
- }
-@@ -1438,6 +1493,105 @@ stub_noname_complaint (void)
-   complaint (&symfile_complaints, _("stub type has NULL name"));
- }
-+/* Calculate the memory length of array TYPE.
 +
-+   TARGET_TYPE should be set to `check_typedef (TYPE_TARGET_TYPE (type))' as
-+   a performance hint.  Feel free to pass NULL.  Set FULL_SPAN to return the
-+   size incl. the possible padding of the last element - it may differ from the
-+   cleared FULL_SPAN return value (the expected SIZEOF) for non-zero
-+   TYPE_BYTE_STRIDE values.  */
++ done:
++  gdb_assert (descriptor->data != NULL);
++  *size = descriptor->size;
++  return descriptor->data;
++}
 +
-+static LONGEST
-+type_length_get (struct type *type, struct type *target_type, int full_span)
++\f
++
++/* See gdb_bfd.h.  */
++
++bfd *
++gdb_bfd_fopen (const char *filename, const char *target, const char *mode,
++             int fd)
 +{
-+  struct type *range_type;
-+  LONGEST byte_stride = 0;    /* `= 0' for a false GCC warning.  */
-+  LONGEST count, element_size, retval;
++  bfd *result = bfd_fopen (filename, target, mode, fd);
 +
-+  if (TYPE_CODE (type) != TYPE_CODE_ARRAY
-+      && TYPE_CODE (type) != TYPE_CODE_STRING)
-+    return TYPE_LENGTH (type);
-+
-+  /* Avoid executing TYPE_HIGH_BOUND for invalid (unallocated/unassociated)
-+     Fortran arrays.  The allocated data will never be used so they can be
-+     zero-length.  */
-+  if (object_address_data_not_valid (type))
-+    return 0;
-+
-+  range_type = TYPE_INDEX_TYPE (type);
-+  if (TYPE_LOW_BOUND_UNDEFINED (range_type)
-+      || TYPE_HIGH_BOUND_UNDEFINED (range_type))
-+    return 0;
-+  count = TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1;
-+  /* It may happen for wrong DWARF annotations returning garbage data.  */
-+  if (count < 0)
-+    warning (_("Range for type %s has invalid bounds %s..%s"),
-+           TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
-+           plongest (TYPE_HIGH_BOUND (range_type)));
-+  /* The code below does not handle count == 0 right.  */
-+  if (count <= 0)
-+    return 0;
-+  if (full_span || count > 1)
++  if (result)
 +    {
-+      /* We do not use TYPE_ARRAY_BYTE_STRIDE_VALUE (type) here as we want to
-+         force FULL_SPAN to 1.  */
-+      byte_stride = TYPE_BYTE_STRIDE (range_type);
-+      if (byte_stride == 0)
-+        {
-+        if (target_type == NULL)
-+          target_type = check_typedef (TYPE_TARGET_TYPE (type));
-+        byte_stride = type_length_get (target_type, NULL, 1);
-+      }
++      gdb_bfd_stash_filename (result);
++      gdb_bfd_ref (result);
 +    }
 +
-+  /* For now, we conservatively take the array length to be 0 if its length
-+     exceeds UINT_MAX.  The code below assumes that for x < 0,
-+     (ULONGEST) x == -x + ULONGEST_MAX + 1, which is technically not guaranteed
-+     by C, but is usually true (because it would be true if x were unsigned
-+     with its high-order bit on). It uses the fact that high_bound-low_bound is
-+     always representable in ULONGEST and that if high_bound-low_bound+1
-+     overflows, it overflows to 0.  We must change these tests if we decide to
-+     increase the representation of TYPE_LENGTH from unsigned int to ULONGEST.
-+     */
++  return result;
++}
 +
-+  if (full_span)
++/* See gdb_bfd.h.  */
++
++bfd *
++gdb_bfd_openr (const char *filename, const char *target)
++{
++  bfd *result = bfd_openr (filename, target);
++
++  if (result)
 +    {
-+      retval = count * byte_stride;
-+      if (count == 0 || retval / count != byte_stride || retval > UINT_MAX)
-+      retval = 0;
-+      return retval;
++      gdb_bfd_stash_filename (result);
++      gdb_bfd_ref (result);
 +    }
-+  if (target_type == NULL)
-+    target_type = check_typedef (TYPE_TARGET_TYPE (type));
-+  element_size = type_length_get (target_type, NULL, 1);
-+  retval = (count - 1) * byte_stride + element_size;
-+  if (retval < element_size
-+      || (byte_stride != 0
-+          && (retval - element_size) / byte_stride != count - 1)
-+      || retval > UINT_MAX)
-+    retval = 0;
-+  return retval;
++
++  return result;
 +}
 +
-+/* Prepare TYPE after being read in by the backend.  Currently this function
-+   only propagates the TYPE_DYNAMIC flag.  */
++/* See gdb_bfd.h.  */
 +
-+void
-+finalize_type (struct type *type)
++bfd *
++gdb_bfd_openw (const char *filename, const char *target)
 +{
-+  int i;
++  bfd *result = bfd_openw (filename, target);
 +
-+  for (i = 0; i < TYPE_NFIELDS (type); ++i)
-+    if (TYPE_FIELD_TYPE (type, i) && TYPE_DYNAMIC (TYPE_FIELD_TYPE (type, i)))
-+      break;
++  if (result)
++    {
++      gdb_bfd_stash_filename (result);
++      gdb_bfd_ref (result);
++    }
 +
-+  /* FIXME: cplus_stuff is ignored here.  */
-+  if (i < TYPE_NFIELDS (type)
-+      || (TYPE_VPTR_BASETYPE (type) && TYPE_DYNAMIC (TYPE_VPTR_BASETYPE (type)))
-+      || (TYPE_TARGET_TYPE (type) && TYPE_DYNAMIC (TYPE_TARGET_TYPE (type))))
-+    TYPE_DYNAMIC (type) = 1;
++  return result;
 +}
 +
- /* 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
-@@ -1604,52 +1758,37 @@ check_typedef (struct type *type)
-         }
-     }
--  if (TYPE_TARGET_STUB (type))
-+  /* copy_type_recursive automatically makes the resulting type containing only
-+     constant values expected by the callers of this function.  */
-+  if (TYPE_DYNAMIC (type))
++/* See gdb_bfd.h.  */
++
++bfd *
++gdb_bfd_openr_iovec (const char *filename, const char *target,
++                   void *(*open_func) (struct bfd *nbfd,
++                                       void *open_closure),
++                   void *open_closure,
++                   file_ptr (*pread_func) (struct bfd *nbfd,
++                                           void *stream,
++                                           void *buf,
++                                           file_ptr nbytes,
++                                           file_ptr offset),
++                   int (*close_func) (struct bfd *nbfd,
++                                      void *stream),
++                   int (*stat_func) (struct bfd *abfd,
++                                     void *stream,
++                                     struct stat *sb))
++{
++  bfd *result = bfd_openr_iovec (filename, target,
++                               open_func, open_closure,
++                               pread_func, close_func, stat_func);
++
++  if (result)
 +    {
-+      htab_t copied_types;
++      gdb_bfd_ref (result);
++      gdb_bfd_stash_filename (result);
++    }
 +
-+      copied_types = create_copied_types_hash (NULL);
-+      type = copy_type_recursive (type, copied_types);
-+      htab_delete (copied_types);
++  return result;
++}
 +
-+      gdb_assert (TYPE_DYNAMIC (type) == 0);
-+      /* Force TYPE_LENGTH (type) recalculation.  */
-+      TYPE_DYNAMIC (type) = 1;
-+    }
++/* See gdb_bfd.h.  */
 +
-+  if (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type))
-     {
--      struct type *range_type;
-       struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
-+      if (TYPE_DYNAMIC (type))
-+      TYPE_TARGET_TYPE (type) = target_type;
-       if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
-       {
-         /* Nothing we can do.  */
-       }
-       else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
--             && TYPE_NFIELDS (type) == 1
--             && (TYPE_CODE (range_type = TYPE_INDEX_TYPE (type))
--                 == TYPE_CODE_RANGE))
-+             || TYPE_CODE (type) == TYPE_CODE_STRING)
-       {
-         /* Now recompute the length of the array type, based on its
--           number of elements and the target type's length.
--           Watch out for Ada null Ada arrays where the high bound
--           is smaller than the low bound.  */
--        const LONGEST low_bound = TYPE_LOW_BOUND (range_type);
--        const LONGEST high_bound = TYPE_HIGH_BOUND (range_type);
--        ULONGEST len;
--
--        if (high_bound < low_bound)
--          len = 0;
--        else
--          {
--            /* For now, we conservatively take the array length to be 0
--               if its length exceeds UINT_MAX.  The code below assumes
--               that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1,
--               which is technically not guaranteed by C, but is usually true
--               (because it would be true if x were unsigned with its
--               high-order bit on).  It uses the fact that
--               high_bound-low_bound is always representable in
--               ULONGEST and that if high_bound-low_bound+1 overflows,
--               it overflows to 0.  We must change these tests if we 
--               decide to increase the representation of TYPE_LENGTH
--               from unsigned int to ULONGEST.  */
--            ULONGEST ulow = low_bound, uhigh = high_bound;
--            ULONGEST tlen = TYPE_LENGTH (target_type);
--
--            len = tlen * (uhigh - ulow + 1);
--            if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh 
--                || len > UINT_MAX)
--              len = 0;
--          }
--        TYPE_LENGTH (type) = len;
-+           number of elements and the target type's length.  */
-+        TYPE_LENGTH (type) = type_length_get (type, target_type, 0);
-         TYPE_TARGET_STUB (type) = 0;
-       }
-       else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
-@@ -1657,6 +1796,7 @@ check_typedef (struct type *type)
-         TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
-         TYPE_TARGET_STUB (type) = 0;
-       }
-+      TYPE_DYNAMIC (type) = 0;
-     }
-   type = make_qualified_type (type, instance_flags, NULL);
-@@ -3310,33 +3450,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs)
- }
- /* Allocate the hash table used by copy_type_recursive to walk
--   types without duplicates.  We use OBJFILE's obstack, because
--   OBJFILE is about to be deleted.  */
-+   types without duplicates.   */
- htab_t
- create_copied_types_hash (struct objfile *objfile)
- {
--  return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
--                             NULL, &objfile->objfile_obstack,
--                             hashtab_obstack_allocate,
--                             dummy_obstack_deallocate);
-+  if (objfile == NULL)
++bfd *
++gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous)
++{
++  bfd *result = bfd_openr_next_archived_file (archive, previous);
++
++  if (result)
 +    {
-+      /* NULL OBJFILE is for TYPE_DYNAMIC types already contained in
-+       OBJFILE_MALLOC memory, such as those from VALUE_HISTORY_CHAIN.  Table
-+       element entries get allocated by xmalloc - so use xfree.  */
-+      return htab_create (1, type_pair_hash, type_pair_eq, xfree);
++      gdb_bfd_ref (result);
++      /* No need to stash the filename here.  */
 +    }
-+  else
++
++  return result;
++}
++
++/* See gdb_bfd.h.  */
++
++bfd *
++gdb_bfd_fdopenr (const char *filename, const char *target, int fd)
++{
++  bfd *result = bfd_fdopenr (filename, target, fd);
++
++  if (result)
 +    {
-+      /* Use OBJFILE's obstack, because OBJFILE is about to be deleted.  Table
-+       element entries get allocated by xmalloc - so use xfree.  */
-+      return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
-+                                 xfree, &objfile->objfile_obstack,
-+                                 hashtab_obstack_allocate,
-+                                 dummy_obstack_deallocate);
++      gdb_bfd_ref (result);
++      gdb_bfd_stash_filename (result);
 +    }
- }
--/* Recursively copy (deep copy) TYPE, if it is associated with
--   OBJFILE.  Return a new type allocated using malloc, a saved type if
--   we have already visited TYPE (using COPIED_TYPES), or TYPE if it is
--   not associated with OBJFILE.  */
-+/* A helper for copy_type_recursive.  This does all the work.  OBJFILE is used
-+   only for an assertion checking.  */
--struct type *
--copy_type_recursive (struct objfile *objfile, 
--                   struct type *type,
--                   htab_t copied_types)
-+static struct type *
-+copy_type_recursive_1 (struct objfile *objfile, 
-+                     struct type *type,
-+                     htab_t copied_types)
- {
-   struct type_pair *stored, pair;
-   void **slot;
-   struct type *new_type;
--  if (! TYPE_OBJFILE_OWNED (type))
-+  if (! TYPE_OBJFILE_OWNED (type) && !TYPE_DYNAMIC (type))
-     return type;
-   /* This type shouldn't be pointing to any types in other objfiles;
-@@ -3351,9 +3500,10 @@ copy_type_recursive (struct objfile *objfile,
-   new_type = alloc_type_arch (get_type_arch (type));
-   /* We must add the new type to the hash table immediately, in case
--     we encounter this type again during a recursive call below.  */
--  stored
--    = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair));
-+     we encounter this type again during a recursive call below.  Memory could
-+     be allocated from OBJFILE in the case we will be removing OBJFILE, this
-+     optimization is missed and xfree is called for it from COPIED_TYPES.  */
-+  stored = xmalloc (sizeof (*stored));
-   stored->old = type;
-   stored->new = new_type;
-   *slot = stored;
-@@ -3364,6 +3514,21 @@ copy_type_recursive (struct objfile *objfile,
-   TYPE_OBJFILE_OWNED (new_type) = 0;
-   TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
-+#if 0
-+  /* TYPE_MAIN_TYPE memory copy above rewrote the TYPE_DISCARDABLE flag so we
-+     need to initialize it again.  And even if TYPE was already discardable
-+     NEW_TYPE so far is not registered in TYPE_DISCARDABLE_TABLE.  */
-+  TYPE_DISCARDABLE (new_type) = 0;
-+  set_type_as_discardable (new_type);
-+#endif
 +
-+  /* Pre-clear the fields processed by delete_main_type.  If DWARF block
-+     evaluations below call error we would leave an unfreeable TYPE.  */
-+  TYPE_TARGET_TYPE (new_type) = NULL;
-+  TYPE_VPTR_BASETYPE (new_type) = NULL;
-+  TYPE_NFIELDS (new_type) = 0;
-+  TYPE_FIELDS (new_type) = NULL;
++  return result;
++}
 +
-   if (TYPE_NAME (type))
-     TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
-   if (TYPE_TAG_NAME (type))
-@@ -3372,12 +3537,48 @@ copy_type_recursive (struct objfile *objfile,
-   TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
-   TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
-+  if (TYPE_ALLOCATED (new_type))
-+    {
-+      gdb_assert (!TYPE_NOT_ALLOCATED (new_type));
++\f
 +
-+      if (!dwarf_locexpr_baton_eval (TYPE_ALLOCATED (new_type)))
-+        TYPE_NOT_ALLOCATED (new_type) = 1;
-+      TYPE_ALLOCATED (new_type) = NULL;
-+    }
++/* A callback for htab_traverse that prints a single BFD.  */
 +
-+  if (TYPE_ASSOCIATED (new_type))
-+    {
-+      gdb_assert (!TYPE_NOT_ASSOCIATED (new_type));
++static int
++print_one_bfd (void **slot, void *data)
++{
++  bfd *abfd = *slot;
++  struct gdb_bfd_data *gdata = bfd_usrdata (abfd);
++  struct ui_out *uiout = data;
++  struct cleanup *inner;
 +
-+      if (!dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (new_type)))
-+        TYPE_NOT_ASSOCIATED (new_type) = 1;
-+      TYPE_ASSOCIATED (new_type) = NULL;
-+    }
++  inner = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
++  ui_out_field_int (uiout, "refcount", gdata->refc);
++  ui_out_field_string (uiout, "addr", host_address_to_string (abfd));
++  ui_out_field_string (uiout, "filename", bfd_get_filename (abfd));
++  ui_out_text (uiout, "\n");
++  do_cleanups (inner);
 +
-+  if (!TYPE_DATA_LOCATION_IS_ADDR (new_type)
-+      && TYPE_DATA_LOCATION_DWARF_BLOCK (new_type))
-+    {
-+      if (TYPE_NOT_ALLOCATED (new_type)
-+          || TYPE_NOT_ASSOCIATED (new_type))
-+      TYPE_DATA_LOCATION_DWARF_BLOCK (new_type) = NULL;
-+      else
-+      {
-+        TYPE_DATA_LOCATION_IS_ADDR (new_type) = 1;
-+        TYPE_DATA_LOCATION_ADDR (new_type) = dwarf_locexpr_baton_eval
-+                                  (TYPE_DATA_LOCATION_DWARF_BLOCK (new_type));
-+      }
-+    }
++  return 1;
++}
 +
-   /* Copy the fields.  */
-   if (TYPE_NFIELDS (type))
-     {
-       int i, nfields;
-+      /* TYPE_CODE_RANGE uses TYPE_RANGE_DATA of the union with TYPE_FIELDS.  */
-+      gdb_assert (TYPE_CODE (type) != TYPE_CODE_RANGE);
++/* Implement the 'maint info bfd' command.  */
 +
-       nfields = TYPE_NFIELDS (type);
-+      TYPE_NFIELDS (new_type) = nfields;
-       TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field);
-       for (i = 0; i < nfields; i++)
-       {
-@@ -3386,8 +3587,8 @@ copy_type_recursive (struct objfile *objfile,
-         TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
-         if (TYPE_FIELD_TYPE (type, i))
-           TYPE_FIELD_TYPE (new_type, i)
--            = copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
--                                   copied_types);
-+            = copy_type_recursive_1 (objfile, TYPE_FIELD_TYPE (type, i),
-+                                     copied_types);
-         if (TYPE_FIELD_NAME (type, i))
-           TYPE_FIELD_NAME (new_type, i) = 
-             xstrdup (TYPE_FIELD_NAME (type, i));
-@@ -3414,24 +3615,184 @@ copy_type_recursive (struct objfile *objfile,
-       }
-     }
-+  /* Both FIELD_LOC_KIND_DWARF_BLOCK and TYPE_RANGE_HIGH_BOUND_IS_COUNT were
-+     possibly converted.  */
-+  TYPE_DYNAMIC (new_type) = 0;
++static void
++maintenance_info_bfds (char *arg, int from_tty)
++{
++  struct cleanup *cleanup;
++  struct ui_out *uiout = current_uiout;
 +
-   /* For range types, copy the bounds information.  */
--  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
-+  if (TYPE_CODE (new_type) == TYPE_CODE_RANGE)
-     {
-       TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds));
-       *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
++  cleanup = make_cleanup_ui_out_table_begin_end (uiout, 3, -1, "bfds");
++  ui_out_table_header (uiout, 10, ui_left, "refcount", "Refcount");
++  ui_out_table_header (uiout, 18, ui_left, "addr", "Address");
++  ui_out_table_header (uiout, 40, ui_left, "filename", "Filename");
 +
-+      switch (TYPE_RANGE_DATA (new_type)->low.kind)
-+      {
-+      case RANGE_BOUND_KIND_CONSTANT:
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_BLOCK:
-+        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+           it is expected to be made constant by CHECK_TYPEDEF.
-+           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+           */
-+        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
-+            || ! has_stack_frames ())
-+          {
-+            /* We should set 1 for Fortran but how to find the language?  */
-+            TYPE_LOW_BOUND (new_type) = 0;
-+            TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
-+          }
-+        else
-+          {
-+            TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval
-+                              (TYPE_RANGE_DATA (new_type)->low.u.dwarf_block);
-+            if (TYPE_LOW_BOUND (new_type) >= 0)
-+              TYPE_UNSIGNED (new_type) = 1;
-+          }
-+        TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_LOCLIST:
-+        {
-+          CORE_ADDR addr;
++  ui_out_table_body (uiout);
++  htab_traverse (all_bfds, print_one_bfd, uiout);
 +
-+          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
-+             it is expected to be made constant by CHECK_TYPEDEF.
-+             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+             */
-+          if (! TYPE_NOT_ALLOCATED (new_type)
-+              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
-+              && dwarf_loclist_baton_eval
-+                (TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.loclist,
-+                 TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.type, &addr))
-+            {
-+              TYPE_LOW_BOUND (new_type) = addr;
-+              if (TYPE_LOW_BOUND (new_type) >= 0)
-+                TYPE_UNSIGNED (new_type) = 1;
-+            }
-+          else
-+            {
-+              /* We should set 1 for Fortran but how to find the language?  */
-+              TYPE_LOW_BOUND (new_type) = 0;
-+              TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
-+            }
-+          TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
-+        }
-+        break;
-+      }
++  do_cleanups (cleanup);
++}
 +
-+      switch (TYPE_RANGE_DATA (new_type)->high.kind)
-+      {
-+      case RANGE_BOUND_KIND_CONSTANT:
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_BLOCK:
-+        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+           it is expected to be made constant by CHECK_TYPEDEF.
-+           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+           */
-+        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
-+            || ! has_stack_frames ())
-+          {
-+            TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
-+            TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
-+          }
-+        else
-+          TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval
-+                             (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block);
-+        TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_LOCLIST:
-+        {
-+          CORE_ADDR addr;
++/* -Wmissing-prototypes */
++extern initialize_file_ftype _initialize_gdb_bfd;
 +
-+          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
-+             it is expected to be made constant by CHECK_TYPEDEF.
-+             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+             */
-+          if (! TYPE_NOT_ALLOCATED (new_type)
-+              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
-+              && dwarf_loclist_baton_eval
-+                    (TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.loclist,
-+                     TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.type,
-+                     &addr))
-+            TYPE_HIGH_BOUND (new_type) = addr;
-+          else
-+            {
-+              TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
-+              TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
-+            }
-+          TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
-+        }
-+        break;
-+      }
++void
++_initialize_gdb_bfd (void)
++{
++  all_bfds = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer,
++                              NULL, xcalloc, xfree);
 +
-+      switch (TYPE_RANGE_DATA (new_type)->byte_stride.kind)
-+      {
-+      case RANGE_BOUND_KIND_CONSTANT:
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_BLOCK:
-+        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
-+           it is expected to be made constant by CHECK_TYPEDEF.
-+           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+           */
-+        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
-+            || ! has_stack_frames ())
-+          TYPE_BYTE_STRIDE (new_type) = 0;
-+        else
-+          TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval
-+                      (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block);
-+        TYPE_RANGE_DATA (new_type)->byte_stride.kind
-+          = RANGE_BOUND_KIND_CONSTANT;
-+        break;
-+      case RANGE_BOUND_KIND_DWARF_LOCLIST:
-+        {
-+          CORE_ADDR addr = 0;
++  add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\
++List the BFDs that are currently open."),
++         &maintenanceinfolist);
++}
+diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h
+new file mode 100644
+index 0000000..f131ba7
+--- /dev/null
++++ b/gdb/gdb_bfd.h
+@@ -0,0 +1,106 @@
++/* Definitions for BFD wrappers used by GDB.
 +
-+          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
-+             it is expected to be made constant by CHECK_TYPEDEF.
-+             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
-+             */
-+          if (! TYPE_NOT_ALLOCATED (new_type)
-+              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ())
-+            dwarf_loclist_baton_eval
-+             (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.loclist,
-+              TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.type,
-+              &addr);
-+          TYPE_BYTE_STRIDE (new_type) = addr;
-+          TYPE_RANGE_DATA (new_type)->byte_stride.kind
-+            = RANGE_BOUND_KIND_CONSTANT;
-+        }
-+        break;
-+      }
++   Copyright (C) 2011, 2012
++   Free Software Foundation, Inc.
 +
-+      /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound.  */
-+      if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type))
-+      {
-+        TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type)
-+                                     + TYPE_HIGH_BOUND (new_type) - 1;
-+        TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0;
-+      }
-     }
-   /* Copy pointers to other types.  */
-   if (TYPE_TARGET_TYPE (type))
-     TYPE_TARGET_TYPE (new_type) = 
--      copy_type_recursive (objfile, 
--                         TYPE_TARGET_TYPE (type),
--                         copied_types);
-+      copy_type_recursive_1 (objfile, 
-+                           TYPE_TARGET_TYPE (type),
-+                           copied_types);
-   if (TYPE_VPTR_BASETYPE (type))
-     TYPE_VPTR_BASETYPE (new_type) = 
--      copy_type_recursive (objfile,
--                         TYPE_VPTR_BASETYPE (type),
--                         copied_types);
-+      copy_type_recursive_1 (objfile,
-+                           TYPE_VPTR_BASETYPE (type),
-+                           copied_types);
++   This file is part of GDB.
 +
-+  if (TYPE_CODE (new_type) == TYPE_CODE_ARRAY)
-+    {
-+      struct type *new_index_type = TYPE_INDEX_TYPE (new_type);
++   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.
 +
-+      if (TYPE_BYTE_STRIDE (new_index_type) == 0)
-+      TYPE_BYTE_STRIDE (new_index_type)
-+        = TYPE_LENGTH (TYPE_TARGET_TYPE (new_type));
-+    }
++   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.
 +
-   /* Maybe copy the type_specific bits.
-      NOTE drow/2005-12-09: We do not copy the C++-specific bits like
-@@ -3448,6 +3809,17 @@ copy_type_recursive (struct objfile *objfile,
-   return new_type;
- }
-+/* Recursively copy (deep copy) TYPE.  Return a new type allocated using
-+   malloc, a saved type if we have already visited TYPE (using COPIED_TYPES),
-+   or TYPE if it is not associated with OBJFILE.  */
-+
-+struct type *
-+copy_type_recursive (struct type *type,
-+                   htab_t copied_types)
-+{
-+  return copy_type_recursive_1 (TYPE_OBJFILE (type), type, copied_types);
-+}
-+
- /* Make a copy of the given TYPE, except that the pointer & reference
-    types are not preserved.
-    
-@@ -3470,6 +3842,201 @@ copy_type (const struct type *type)
-   return new_type;
- }
-+#if 0
-+/* Callback type for main_type_crawl.  */
-+typedef int (*main_type_crawl_iter) (struct type *type, void *data);
-+
-+/* Iterate all main_type structures reachable through any `struct type *' from
-+   TYPE.  ITER will be called only for one type of each main_type, use
-+   TYPE_CHAIN traversal to find all the type instances.  ITER is being called
-+   for each main_type found.  ITER returns non-zero if main_type_crawl should
-+   depth-first enter the specific type.  ITER must provide some detection for
-+   reentering the same main_type as this function would otherwise endlessly
-+   loop.  */
-+
-+static void
-+main_type_crawl (struct type *type, main_type_crawl_iter iter, void *data)
-+{
-+  struct type *type_iter;
-+  int i;
-+
-+  if (!type)
-+    return;
-+
-+  gdb_assert (TYPE_OBJFILE (type) == NULL);
-+
-+  /* `struct cplus_struct_type' handling is unsupported by this function.  */
-+  gdb_assert ((TYPE_CODE (type) != TYPE_CODE_STRUCT
-+             && TYPE_CODE (type) != TYPE_CODE_UNION)
-+            || !HAVE_CPLUS_STRUCT (type));
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+  if (!(*iter) (type, data))
-+    return;
++#ifndef GDB_BFD_H
++#define GDB_BFD_H
 +
-+  /* Iterate all the type instances of this main_type.  */
-+  type_iter = type;
-+  do
-+    {
-+      gdb_assert (TYPE_MAIN_TYPE (type_iter) == TYPE_MAIN_TYPE (type));
++/* Make a copy ABFD's filename using bfd_alloc, and reassign it to the
++   BFD.  This ensures that the BFD's filename has the same lifetime as
++   the BFD itself.  */
 +
-+      main_type_crawl (TYPE_POINTER_TYPE (type), iter, data);
-+      main_type_crawl (TYPE_REFERENCE_TYPE (type), iter, data);
++void gdb_bfd_stash_filename (struct bfd *abfd);
 +
-+      type_iter = TYPE_CHAIN (type_iter);
-+    }
-+  while (type_iter != type);
++/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen.
++   Returns NULL on error.  On success, returns a new reference to the
++   BFD, which must be freed with gdb_bfd_unref.  BFDs returned by this
++   call are shared among all callers opening the same file.  If FD is
++   not -1, then after this call it is owned by BFD.  */
 +
-+  for (i = 0; i < TYPE_NFIELDS (type); i++)
-+    main_type_crawl (TYPE_FIELD_TYPE (type, i), iter, data);
++struct bfd *gdb_bfd_open (const char *name, const char *target, int fd);
 +
-+  main_type_crawl (TYPE_TARGET_TYPE (type), iter, data);
-+  main_type_crawl (TYPE_VPTR_BASETYPE (type), iter, data);
-+}
++/* Increment the reference count of ABFD.  It is fine for ABFD to be
++   NULL; in this case the function does nothing.  */
 +
-+/* A helper for delete_type which deletes a main_type and the things to which
-+   it refers.  TYPE is a type whose main_type we wish to destroy.  */
++void gdb_bfd_ref (struct bfd *abfd);
 +
-+static void
-+delete_main_type (struct type *type)
-+{
-+  int i;
++/* Decrement the reference count of ABFD.  If this is the last
++   reference, ABFD will be freed.  If ABFD is NULL, this function does
++   nothing.  */
 +
-+  gdb_assert (TYPE_DISCARDABLE (type));
-+  gdb_assert (TYPE_OBJFILE (type) == NULL);
++void gdb_bfd_unref (struct bfd *abfd);
 +
-+  xfree (TYPE_NAME (type));
-+  xfree (TYPE_TAG_NAME (type));
++/* Try to read or map the contents of the section SECT.  If
++   successful, the section data is returned and *SIZE is set to the
++   size of the section data; this may not be the same as the size
++   according to bfd_get_section_size if the section was compressed.
++   The returned section data is associated with the BFD and will be
++   destroyed when the BFD is destroyed.  There is no other way to free
++   it; for temporary uses of section data, see
++   bfd_malloc_and_get_section.  SECT may not have relocations.  This
++   function will throw on error.  */
 +
-+  for (i = 0; i < TYPE_NFIELDS (type); ++i)
-+    {
-+      xfree (TYPE_FIELD_NAME (type, i));
++const gdb_byte *gdb_bfd_map_section (asection *section, bfd_size_type *size);
 +
-+      if (TYPE_FIELD_LOC_KIND (type, i) == FIELD_LOC_KIND_PHYSNAME)
-+      xfree (TYPE_FIELD_STATIC_PHYSNAME (type, i));
-+    }
-+  xfree (TYPE_FIELDS (type));
++\f
 +
-+  gdb_assert (!HAVE_CPLUS_STRUCT (type));
++/* A wrapper for bfd_fopen that initializes the gdb-specific reference
++   count and calls gdb_bfd_stash_filename.  */
 +
-+  xfree (TYPE_MAIN_TYPE (type));
-+}
++bfd *gdb_bfd_fopen (const char *, const char *, const char *, int);
 +
-+/* Delete all the instances on TYPE_CHAIN of TYPE, including their referenced
-+   main_type.  TYPE must be a reclaimable type - neither permanent nor objfile
-+   associated.  */
++/* A wrapper for bfd_openr that initializes the gdb-specific reference
++   count and calls gdb_bfd_stash_filename.  */
 +
-+static void
-+delete_type_chain (struct type *type)
-+{
-+  struct type *type_iter, *type_iter_to_free;
++bfd *gdb_bfd_openr (const char *, const char *);
 +
-+  gdb_assert (TYPE_DISCARDABLE (type));
-+  gdb_assert (TYPE_OBJFILE (type) == NULL);
++/* A wrapper for bfd_openw that initializes the gdb-specific reference
++   count and calls gdb_bfd_stash_filename.  */
 +
-+  delete_main_type (type);
++bfd *gdb_bfd_openw (const char *, const char *);
 +
-+  type_iter = type;
-+  do
-+    {
-+      type_iter_to_free = type_iter;
-+      type_iter = TYPE_CHAIN (type_iter);
-+      xfree (type_iter_to_free);
-+    }
-+  while (type_iter != type);
-+}
++/* A wrapper for bfd_openr_iovec that initializes the gdb-specific
++   reference count and calls gdb_bfd_stash_filename.  */
 +
-+/* Hash function for type_discardable_table.  */
++bfd *gdb_bfd_openr_iovec (const char *filename, const char *target,
++                        void *(*open_func) (struct bfd *nbfd,
++                                            void *open_closure),
++                        void *open_closure,
++                        file_ptr (*pread_func) (struct bfd *nbfd,
++                                                void *stream,
++                                                void *buf,
++                                                file_ptr nbytes,
++                                                file_ptr offset),
++                        int (*close_func) (struct bfd *nbfd,
++                                           void *stream),
++                        int (*stat_func) (struct bfd *abfd,
++                                          void *stream,
++                                          struct stat *sb));
 +
-+static hashval_t
-+type_discardable_hash (const void *p)
-+{
-+  const struct type *type = p;
++/* A wrapper for bfd_openr_next_archived_file that initializes the
++   gdb-specific reference count and calls gdb_bfd_stash_filename.  */
 +
-+  return htab_hash_pointer (TYPE_MAIN_TYPE (type));
-+}
++bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous);
 +
-+/* Equality function for type_discardable_table.  */
++/* A wrapper for bfd_fdopenr that initializes the gdb-specific
++   reference count and calls gdb_bfd_stash_filename.  */
 +
-+static int
-+type_discardable_equal (const void *a, const void *b)
-+{
-+  const struct type *left = a;
-+  const struct type *right = b;
++bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd);
 +
-+  return TYPE_MAIN_TYPE (left) == TYPE_MAIN_TYPE (right);
-+}
++#endif /* GDB_BFD_H */
+diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
+index 8142ab9..a2953cc 100644
+--- a/gdb/gdbtypes.c
++++ b/gdb/gdbtypes.c
+@@ -37,6 +37,9 @@
+ #include "gdb_assert.h"
+ #include "hashtab.h"
+ #include "exceptions.h"
++#include "observer.h"
++#include "dwarf2expr.h"
++#include "dwarf2loc.h"
+ /* Initialize BADNESS constants.  */
+@@ -141,7 +144,16 @@ static void print_bit_vector (B_TYPE *, int);
+ 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);
++static LONGEST type_length_get (struct type *type, struct type *target_type,
++                              int full_span);
++#if 0
++/* The hash table holding all discardable `struct type *' references.  */
++static htab_t type_discardable_table;
 +
-+/* A helper for type_mark_used.  */
++/* Current type_discardable_check pass used for TYPE_DISCARDABLE_AGE.  */
++static int type_discardable_age_current;
++#endif
+ /* Allocate a new OBJFILE-associated type structure and fill it
+    with some defaults.  Space for the type structure is allocated
+@@ -172,6 +184,43 @@ alloc_type (struct objfile *objfile)
+   return type;
+ }
++#if 0
++/* Declare TYPE as discardable on next garbage collection by free_all_types.
++   You must call type_mark_used during each free_all_types to protect TYPE from
++   being deallocated.  */
 +
-+static int
-+type_mark_used_crawl (struct type *type, void *unused)
++static void
++set_type_as_discardable (struct type *type)
 +{
-+  if (!TYPE_DISCARDABLE (type))
-+    return 0;
++  void **slot;
 +
-+  if (TYPE_DISCARDABLE_AGE (type) == type_discardable_age_current)
-+    return 0;
++  gdb_assert (!TYPE_DISCARDABLE (type));
 +
++  TYPE_DISCARDABLE (type) = 1;
 +  TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current;
 +
-+  /* Continue the traversal.  */
-+  return 1;
-+}
-+
-+/* Mark TYPE and its connected types as used in this free_all_types pass.  */
-+
-+void
-+type_mark_used (struct type *type)
-+{
-+  if (type == NULL)
-+    return;
-+
-+  if (!TYPE_DISCARDABLE (type))
-+    return;
-+
-+  main_type_crawl (type, type_mark_used_crawl, NULL);
++  slot = htab_find_slot (type_discardable_table, type, INSERT);
++  gdb_assert (!*slot);
++  *slot = type;
 +}
++#endif
 +
-+/* A traverse callback for type_discardable_table which removes any
-+   type_discardable whose reference count is now zero (unused link).  */
++/* Allocate a new type like alloc_type but preserve for it the discardability
++   state of PARENT_TYPE.  */
 +
-+static int
-+type_discardable_remove (void **slot, void *unused)
++static struct type *
++alloc_type_as_parent (struct type *parent_type)
 +{
-+  struct type *type = *slot;
-+
-+  gdb_assert (TYPE_DISCARDABLE (type));
-+
-+  if (TYPE_DISCARDABLE_AGE (type) != type_discardable_age_current)
-+    {
-+      delete_type_chain (type);
++  struct type *new_type = alloc_type_copy (parent_type);
 +
-+      htab_clear_slot (type_discardable_table, slot);
-+    }
++#if 0
++  if (TYPE_DISCARDABLE (parent_type))
++    set_type_as_discardable (new_type);
++#endif
 +
-+  return 1;
++  return new_type;
 +}
 +
-+/* Free all the reclaimable types that have been allocated and that have
-+   currently zero reference counter.
-+
-+   This function is called after each command, successful or not.  Use this
-+   cleanup only in the GDB idle state as GDB only marks those types used by
-+   globally tracked objects (with no autovariable references tracking).  */
-+
-+void
-+free_all_types (void)
-+{
-+  /* Mark a new pass.  As GDB checks all the entries were visited after each
-+     pass there cannot be any stale entries already containing the changed
-+     value.  */
-+  type_discardable_age_current ^= 1;
-+
-+  observer_notify_mark_used ();
-+
-+  htab_traverse (type_discardable_table, type_discardable_remove, NULL);
-+}
-+#endif
+ /* Allocate a new GDBARCH-associated type structure and fill it
+    with some defaults.  Space for the type structure is allocated
+    on the heap.  */
+@@ -297,7 +346,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
  
- /* Helper functions to initialize architecture-specific types.  */
+   if (typeptr == 0 || *typeptr == 0)  /* We'll need to allocate one.  */
+     {
+-      ntype = alloc_type_copy (type);
++      ntype = alloc_type_as_parent (type);
+       if (typeptr)
+       *typeptr = ntype;
+     }
+@@ -374,7 +423,7 @@ make_reference_type (struct type *type, struct type **typeptr)
  
-@@ -4002,6 +4569,13 @@ void
- _initialize_gdbtypes (void)
- {
-   gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
-+
-+#if 0
-+  type_discardable_table = htab_create_alloc (20, type_discardable_hash,
-+                                           type_discardable_equal, NULL,
-+                                           xcalloc, xfree);
-+#endif
-+
-   objfile_type_data = register_objfile_data ();
+   if (typeptr == 0 || *typeptr == 0)  /* We'll need to allocate one.  */
+     {
+-      ntype = alloc_type_copy (type);
++      ntype = alloc_type_as_parent (type);
+       if (typeptr)
+       *typeptr = ntype;
+     }
+@@ -784,6 +833,7 @@ create_range_type (struct type *result_type, struct type *index_type,
+     TYPE_ZALLOC (result_type, sizeof (struct range_bounds));
+   TYPE_LOW_BOUND (result_type) = low_bound;
+   TYPE_HIGH_BOUND (result_type) = high_bound;
++  TYPE_BYTE_STRIDE (result_type) = 0;
  
-   add_setshow_zinteger_cmd ("overload", no_class, &overload_debug,
-diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
-index 2070f00..40db606 100644
---- a/gdb/gdbtypes.h
-+++ b/gdb/gdbtypes.h
-@@ -213,6 +213,11 @@ enum type_instance_flag_value
+   if (low_bound >= 0)
+     TYPE_UNSIGNED (result_type) = 1;
+@@ -927,26 +977,31 @@ create_array_type (struct type *result_type,
  
- #define TYPE_TARGET_STUB(t)   (TYPE_MAIN_TYPE (t)->flag_target_stub)
+   TYPE_CODE (result_type) = TYPE_CODE_ARRAY;
+   TYPE_TARGET_TYPE (result_type) = element_type;
+-  if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
+-    low_bound = high_bound = 0;
+-  CHECK_TYPEDEF (element_type);
+-  /* Be careful when setting the array length.  Ada arrays can be
+-     empty arrays with the high_bound being smaller than the low_bound.
+-     In such cases, the array length should be zero.  */
+-  if (high_bound < low_bound)
+-    TYPE_LENGTH (result_type) = 0;
+-  else
+-    TYPE_LENGTH (result_type) =
+-      TYPE_LENGTH (element_type) * (high_bound - low_bound + 1);
+   TYPE_NFIELDS (result_type) = 1;
+   TYPE_FIELDS (result_type) =
+     (struct field *) TYPE_ZALLOC (result_type, sizeof (struct field));
+   TYPE_INDEX_TYPE (result_type) = range_type;
+   TYPE_VPTR_FIELDNO (result_type) = -1;
  
-+/* Type needs to be evaluated on each CHECK_TYPEDEF and its results must not be
-+   sticky.  */
-+
-+#define TYPE_DYNAMIC(t)               (TYPE_MAIN_TYPE (t)->flag_dynamic)
-+
- /* Static type.  If this is set, the corresponding type had 
-    a static modifier.
-    Note: This may be unnecessary, since static data members
-@@ -296,6 +301,50 @@ enum type_instance_flag_value
+-  /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays.  */
++  /* DWARF blocks may depend on runtime information like
++     DW_OP_PUSH_OBJECT_ADDRESS not being available during the
++     CREATE_ARRAY_TYPE time.  */
++  if (TYPE_RANGE_DATA (range_type)->low.kind != RANGE_BOUND_KIND_CONSTANT
++      || TYPE_RANGE_DATA (range_type)->high.kind != RANGE_BOUND_KIND_CONSTANT
++      || TYPE_DYNAMIC (element_type))
++    TYPE_LENGTH (result_type) = 0;
++  else
++    {
++      CHECK_TYPEDEF (element_type);
++      TYPE_LENGTH (result_type) = type_length_get (result_type, element_type,
++                                                 0);
++    }
+   if (TYPE_LENGTH (result_type) == 0)
+-    TYPE_TARGET_STUB (result_type) = 1;
++    {
++      /* The real size will be computed for specific instances by
++       CHECK_TYPEDEF.  */
++      TYPE_TARGET_STUB (result_type) = 1;
++    }
  
- #define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum)
+   return result_type;
+ }
+@@ -1468,6 +1523,105 @@ stub_noname_complaint (void)
+   complaint (&symfile_complaints, _("stub type has NULL name"));
+ }
  
-+#if 0
-+/* Define this type as being reclaimable during free_all_types.  Type is
-+   required to be have TYPE_OBJFILE set to NULL.  Setting this flag requires
-+   initializing TYPE_DISCARDABLE_AGE, see alloc_type_discardable.  */
++/* Calculate the memory length of array TYPE.
 +
-+#define TYPE_DISCARDABLE(t)   (TYPE_MAIN_TYPE (t)->flag_discardable)
++   TARGET_TYPE should be set to `check_typedef (TYPE_TARGET_TYPE (type))' as
++   a performance hint.  Feel free to pass NULL.  Set FULL_SPAN to return the
++   size incl. the possible padding of the last element - it may differ from the
++   cleared FULL_SPAN return value (the expected SIZEOF) for non-zero
++   TYPE_BYTE_STRIDE values.  */
 +
-+/* Marker this type has been visited by the type_mark_used by this
-+   mark-and-sweep types garbage collecting pass.  Current pass is represented
-+   by TYPE_DISCARDABLE_AGE_CURRENT.  */
++static LONGEST
++type_length_get (struct type *type, struct type *target_type, int full_span)
++{
++  struct type *range_type;
++  LONGEST byte_stride = 0;    /* `= 0' for a false GCC warning.  */
++  LONGEST count, element_size, retval;
 +
-+#define TYPE_DISCARDABLE_AGE(t)       (TYPE_MAIN_TYPE (t)->flag_discardable_age)
-+#endif
++  if (TYPE_CODE (type) != TYPE_CODE_ARRAY
++      && TYPE_CODE (type) != TYPE_CODE_STRING)
++    return TYPE_LENGTH (type);
 +
-+/* Is HIGH_BOUND a low-bound relative count (1) or the high bound itself (0)?  */
++  /* Avoid executing TYPE_HIGH_BOUND for invalid (unallocated/unassociated)
++     Fortran arrays.  The allocated data will never be used so they can be
++     zero-length.  */
++  if (object_address_data_not_valid (type))
++    return 0;
 +
-+#define TYPE_RANGE_HIGH_BOUND_IS_COUNT(range_type) \
-+  (TYPE_MAIN_TYPE (range_type)->flag_range_high_bound_is_count)
++  range_type = TYPE_INDEX_TYPE (type);
++  if (TYPE_LOW_BOUND_UNDEFINED (range_type)
++      || TYPE_HIGH_BOUND_UNDEFINED (range_type))
++    return 0;
++  count = TYPE_HIGH_BOUND (range_type) - TYPE_LOW_BOUND (range_type) + 1;
++  /* It may happen for wrong DWARF annotations returning garbage data.  */
++  if (count < 0)
++    warning (_("Range for type %s has invalid bounds %s..%s"),
++           TYPE_ERROR_NAME (type), plongest (TYPE_LOW_BOUND (range_type)),
++           plongest (TYPE_HIGH_BOUND (range_type)));
++  /* The code below does not handle count == 0 right.  */
++  if (count <= 0)
++    return 0;
++  if (full_span || count > 1)
++    {
++      /* We do not use TYPE_ARRAY_BYTE_STRIDE_VALUE (type) here as we want to
++         force FULL_SPAN to 1.  */
++      byte_stride = TYPE_BYTE_STRIDE (range_type);
++      if (byte_stride == 0)
++        {
++        if (target_type == NULL)
++          target_type = check_typedef (TYPE_TARGET_TYPE (type));
++        byte_stride = type_length_get (target_type, NULL, 1);
++      }
++    }
 +
-+/* Not allocated.  TYPE_ALLOCATED(t) must be NULL in such case.  If this flag
-+   is unset and TYPE_ALLOCATED(t) is NULL then the type is allocated.  If this
-+   flag is unset and TYPE_ALLOCATED(t) is not NULL then its DWARF block
-+   determines the actual allocation state.  */
++  /* For now, we conservatively take the array length to be 0 if its length
++     exceeds UINT_MAX.  The code below assumes that for x < 0,
++     (ULONGEST) x == -x + ULONGEST_MAX + 1, which is technically not guaranteed
++     by C, but is usually true (because it would be true if x were unsigned
++     with its high-order bit on). It uses the fact that high_bound-low_bound is
++     always representable in ULONGEST and that if high_bound-low_bound+1
++     overflows, it overflows to 0.  We must change these tests if we decide to
++     increase the representation of TYPE_LENGTH from unsigned int to ULONGEST.
++     */
 +
-+#define TYPE_NOT_ALLOCATED(t) (TYPE_MAIN_TYPE (t)->flag_not_allocated)
++  if (full_span)
++    {
++      retval = count * byte_stride;
++      if (count == 0 || retval / count != byte_stride || retval > UINT_MAX)
++      retval = 0;
++      return retval;
++    }
++  if (target_type == NULL)
++    target_type = check_typedef (TYPE_TARGET_TYPE (type));
++  element_size = type_length_get (target_type, NULL, 1);
++  retval = (count - 1) * byte_stride + element_size;
++  if (retval < element_size
++      || (byte_stride != 0
++          && (retval - element_size) / byte_stride != count - 1)
++      || retval > UINT_MAX)
++    retval = 0;
++  return retval;
++}
 +
-+/* Not associated.  TYPE_ASSOCIATED(t) must be NULL in such case.  If this flag
-+   is unset and TYPE_ASSOCIATED(t) is NULL then the type is associated.  If
-+   this flag is unset and TYPE_ASSOCIATED(t) is not NULL then its DWARF block
-+   determines the actual association state.  */
++/* Prepare TYPE after being read in by the backend.  Currently this function
++   only propagates the TYPE_DYNAMIC flag.  */
 +
-+#define TYPE_NOT_ASSOCIATED(t)        (TYPE_MAIN_TYPE (t)->flag_not_associated)
++void
++finalize_type (struct type *type)
++{
++  int i;
 +
-+/* Address of the actual data as for DW_AT_data_location.  Its dwarf block must
-+   not be evaluated unless both TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are
-+   false.  If TYPE_DATA_LOCATION_IS_ADDR set then TYPE_DATA_LOCATION_ADDR value
-+   is the actual data address value.  If unset and
-+   TYPE_DATA_LOCATION_DWARF_BLOCK is NULL then the value is the normal
-+   value_raw_address.  If unset and TYPE_DATA_LOCATION_DWARF_BLOCK is not NULL
-+   then its DWARF block determines the actual data address.  */
++  for (i = 0; i < TYPE_NFIELDS (type); ++i)
++    if (TYPE_FIELD_TYPE (type, i) && TYPE_DYNAMIC (TYPE_FIELD_TYPE (type, i)))
++      break;
 +
-+#define TYPE_DATA_LOCATION_IS_ADDR(t) \
-+  (TYPE_MAIN_TYPE (t)->flag_data_location_is_addr)
++  /* FIXME: cplus_stuff is ignored here.  */
++  if (i < TYPE_NFIELDS (type)
++      || (TYPE_VPTR_BASETYPE (type) && TYPE_DYNAMIC (TYPE_VPTR_BASETYPE (type)))
++      || (TYPE_TARGET_TYPE (type) && TYPE_DYNAMIC (TYPE_TARGET_TYPE (type))))
++    TYPE_DYNAMIC (type) = 1;
++}
 +
- /* Constant type.  If this is set, the corresponding type has a
-    const modifier.  */
-@@ -405,6 +454,15 @@ struct main_type
-   /* True if this type was declared with "class" rather than
-      "struct".  */
-   unsigned int flag_declared_class : 1;
-+#if 0
-+  unsigned int flag_discardable : 1;
-+  unsigned int flag_discardable_age : 1;
-+#endif
-+  unsigned int flag_dynamic : 1;
-+  unsigned int flag_range_high_bound_is_count : 1;
-+  unsigned int flag_not_allocated : 1;
-+  unsigned int flag_not_associated : 1;
-+  unsigned int flag_data_location_is_addr : 1;
-   /* True if this is an enum type with disjoint values.  This affects
-      how the enum is printed.  */
-@@ -483,6 +541,20 @@ struct main_type
-   struct type *target_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
+@@ -1634,52 +1788,37 @@ check_typedef (struct type *type)
+         }
+     }
  
-+  /* For DW_AT_data_location.  */
-+  union
+-  if (TYPE_TARGET_STUB (type))
++  /* copy_type_recursive automatically makes the resulting type containing only
++     constant values expected by the callers of this function.  */
++  if (TYPE_DYNAMIC (type))
 +    {
-+      struct dwarf2_locexpr_baton *dwarf_block;
-+      CORE_ADDR addr;
-+    }
-+  data_location;
++      htab_t copied_types;
 +
-+  /* For DW_AT_allocated.  */
-+  struct dwarf2_locexpr_baton *allocated;
++      copied_types = create_copied_types_hash (NULL);
++      type = copy_type_recursive (type, copied_types);
++      htab_delete (copied_types);
 +
-+  /* For DW_AT_associated.  */
-+  struct dwarf2_locexpr_baton *associated;
++      gdb_assert (TYPE_DYNAMIC (type) == 0);
++      /* Force TYPE_LENGTH (type) recalculation.  */
++      TYPE_DYNAMIC (type) = 1;
++    }
 +
-   /* 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.
-@@ -563,13 +635,34 @@ struct main_type
-     struct range_bounds
++  if (TYPE_TARGET_STUB (type) || TYPE_DYNAMIC (type))
      {
-+      struct
-+      {
-+        union
-+          {
-+            LONGEST constant;
-+            struct dwarf2_locexpr_baton *dwarf_block;
-+            struct
-+              {
-+                struct dwarf2_loclist_baton *loclist;
-+                struct type *type;
-+              }
-+            dwarf_loclist;
-+          }
-+        u;
-+        enum range_bound_kind
-+          {
-+            RANGE_BOUND_KIND_CONSTANT,
-+            RANGE_BOUND_KIND_DWARF_BLOCK,
-+            RANGE_BOUND_KIND_DWARF_LOCLIST
-+          }
-+        kind;
-+      }
-       /* Low bound of range.  */
--
--      LONGEST low;
+-      struct type *range_type;
+       struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
++      if (TYPE_DYNAMIC (type))
++      TYPE_TARGET_TYPE (type) = target_type;
+       if (TYPE_STUB (target_type) || TYPE_TARGET_STUB (target_type))
+       {
+         /* Nothing we can do.  */
+       }
+       else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+-             && TYPE_NFIELDS (type) == 1
+-             && (TYPE_CODE (range_type = TYPE_INDEX_TYPE (type))
+-                 == TYPE_CODE_RANGE))
++             || TYPE_CODE (type) == TYPE_CODE_STRING)
+       {
+         /* Now recompute the length of the array type, based on its
+-           number of elements and the target type's length.
+-           Watch out for Ada null Ada arrays where the high bound
+-           is smaller than the low bound.  */
+-        const LONGEST low_bound = TYPE_LOW_BOUND (range_type);
+-        const LONGEST high_bound = TYPE_HIGH_BOUND (range_type);
+-        ULONGEST len;
 -
-+      low,
-       /* High bound of range.  */
+-        if (high_bound < low_bound)
+-          len = 0;
+-        else
+-          {
+-            /* For now, we conservatively take the array length to be 0
+-               if its length exceeds UINT_MAX.  The code below assumes
+-               that for x < 0, (ULONGEST) x == -x + ULONGEST_MAX + 1,
+-               which is technically not guaranteed by C, but is usually true
+-               (because it would be true if x were unsigned with its
+-               high-order bit on).  It uses the fact that
+-               high_bound-low_bound is always representable in
+-               ULONGEST and that if high_bound-low_bound+1 overflows,
+-               it overflows to 0.  We must change these tests if we 
+-               decide to increase the representation of TYPE_LENGTH
+-               from unsigned int to ULONGEST.  */
+-            ULONGEST ulow = low_bound, uhigh = high_bound;
+-            ULONGEST tlen = TYPE_LENGTH (target_type);
 -
--      LONGEST high;
-+      high,
-+      /* Byte stride of range.  */
-+      byte_stride;
-       /* Flags indicating whether the values of low and high are
-          valid.  When true, the respective range value is
-@@ -1016,9 +1109,9 @@ extern void allocate_gnat_aux_type (struct type *);
- #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
- #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
- #define TYPE_CHAIN(thistype) (thistype)->chain
--/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
--   But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
--   so you only have to call check_typedef once.  Since allocate_value
-+/* Note that if thistype is a TYPEDEF, ARRAY or STRING type, you have to call
-+   check_typedef.  But check_typedef does set the TYPE_LENGTH of the TYPEDEF
-+   type, so you only have to call check_typedef once.  Since allocate_value
-    calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe.  */
- #define TYPE_LENGTH(thistype) (thistype)->length
- /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
-@@ -1026,11 +1119,16 @@ extern void allocate_gnat_aux_type (struct type *);
- #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
- #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
- #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
-+#define TYPE_DATA_LOCATION_DWARF_BLOCK(thistype) TYPE_MAIN_TYPE (thistype)->data_location.dwarf_block
-+#define TYPE_DATA_LOCATION_ADDR(thistype) TYPE_MAIN_TYPE (thistype)->data_location.addr
-+#define TYPE_ALLOCATED(thistype) TYPE_MAIN_TYPE (thistype)->allocated
-+#define TYPE_ASSOCIATED(thistype) TYPE_MAIN_TYPE (thistype)->associated
- #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
- #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds
--#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low
--#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high
-+#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low.u.constant
-+#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high.u.constant
-+#define TYPE_BYTE_STRIDE(range_type) TYPE_RANGE_DATA(range_type)->byte_stride.u.constant
- #define TYPE_LOW_BOUND_UNDEFINED(range_type) \
-    TYPE_RANGE_DATA(range_type)->low_undefined
- #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
-@@ -1047,7 +1145,14 @@ extern void allocate_gnat_aux_type (struct type *);
-    (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
- #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
--   (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype))))
-+  TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arraytype))
-+
-+/* TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) with a fallback to the
-+   element size if no specific stride value is known.  */
-+#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype)               \
-+  (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) == 0        \
-+   ? TYPE_LENGTH (TYPE_TARGET_TYPE (arraytype))               \
-+   : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)))
- /* C++ */
+-            len = tlen * (uhigh - ulow + 1);
+-            if (tlen == 0 || (len / tlen - 1 + ulow) != uhigh 
+-                || len > UINT_MAX)
+-              len = 0;
+-          }
+-        TYPE_LENGTH (type) = len;
++           number of elements and the target type's length.  */
++        TYPE_LENGTH (type) = type_length_get (type, target_type, 0);
+         TYPE_TARGET_STUB (type) = 0;
+       }
+       else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+@@ -1687,6 +1826,7 @@ check_typedef (struct type *type)
+         TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
+         TYPE_TARGET_STUB (type) = 0;
+       }
++      TYPE_DYNAMIC (type) = 0;
+     }
  
-@@ -1482,6 +1587,18 @@ extern struct type *create_array_type (struct type *, struct type *,
-                                      struct type *);
- extern struct type *lookup_array_range_type (struct type *, int, int);
+   type = make_qualified_type (type, instance_flags, NULL);
+@@ -3345,33 +3485,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs)
+ }
  
-+extern CORE_ADDR type_range_any_field_internal (struct type *range_type,
-+                                              int fieldno);
-+
-+extern int type_range_high_bound_internal (struct type *range_type);
-+
-+extern int type_range_count_bound_internal (struct type *range_type);
-+
-+extern CORE_ADDR type_range_byte_stride_internal (struct type *range_type,
-+                                                struct type *element_type);
-+
-+extern void finalize_type (struct type *type);
-+
- extern struct type *create_string_type (struct type *, struct type *,
-                                       struct type *);
- extern struct type *lookup_string_range_type (struct type *, int, int);
-@@ -1527,6 +1644,10 @@ extern int is_public_ancestor (struct type *, struct type *);
+ /* Allocate the hash table used by copy_type_recursive to walk
+-   types without duplicates.  We use OBJFILE's obstack, because
+-   OBJFILE is about to be deleted.  */
++   types without duplicates.   */
  
- extern int is_unique_ancestor (struct type *, struct value *);
+ htab_t
+ create_copied_types_hash (struct objfile *objfile)
+ {
+-  return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
+-                             NULL, &objfile->objfile_obstack,
+-                             hashtab_obstack_allocate,
+-                             dummy_obstack_deallocate);
++  if (objfile == NULL)
++    {
++      /* NULL OBJFILE is for TYPE_DYNAMIC types already contained in
++       OBJFILE_MALLOC memory, such as those from VALUE_HISTORY_CHAIN.  Table
++       element entries get allocated by xmalloc - so use xfree.  */
++      return htab_create (1, type_pair_hash, type_pair_eq, xfree);
++    }
++  else
++    {
++      /* Use OBJFILE's obstack, because OBJFILE is about to be deleted.  Table
++       element entries get allocated by xmalloc - so use xfree.  */
++      return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
++                                 xfree, &objfile->objfile_obstack,
++                                 hashtab_obstack_allocate,
++                                 dummy_obstack_deallocate);
++    }
+ }
  
-+#if 0
-+extern void type_mark_used (struct type *type);
-+#endif
-+
- /* Overload resolution */
+-/* Recursively copy (deep copy) TYPE, if it is associated with
+-   OBJFILE.  Return a new type allocated using malloc, a saved type if
+-   we have already visited TYPE (using COPIED_TYPES), or TYPE if it is
+-   not associated with OBJFILE.  */
++/* A helper for copy_type_recursive.  This does all the work.  OBJFILE is used
++   only for an assertion checking.  */
  
- #define LENGTH_MATCH(bv) ((bv)->rank[0])
-@@ -1602,10 +1723,13 @@ extern void maintenance_print_type (char *, int);
+-struct type *
+-copy_type_recursive (struct objfile *objfile, 
+-                   struct type *type,
+-                   htab_t copied_types)
++static struct type *
++copy_type_recursive_1 (struct objfile *objfile, 
++                     struct type *type,
++                     htab_t copied_types)
+ {
+   struct type_pair *stored, pair;
+   void **slot;
+   struct type *new_type;
  
- extern htab_t create_copied_types_hash (struct objfile *objfile);
+-  if (! TYPE_OBJFILE_OWNED (type))
++  if (! TYPE_OBJFILE_OWNED (type) && !TYPE_DYNAMIC (type))
+     return type;
  
--extern struct type *copy_type_recursive (struct objfile *objfile,
--                                       struct type *type,
-+extern struct type *copy_type_recursive (struct type *type,
-                                        htab_t copied_types);
+   /* This type shouldn't be pointing to any types in other objfiles;
+@@ -3386,9 +3535,10 @@ copy_type_recursive (struct objfile *objfile,
+   new_type = alloc_type_arch (get_type_arch (type));
  
- extern struct type *copy_type (const struct type *type);
+   /* We must add the new type to the hash table immediately, in case
+-     we encounter this type again during a recursive call below.  */
+-  stored
+-    = obstack_alloc (&objfile->objfile_obstack, sizeof (struct type_pair));
++     we encounter this type again during a recursive call below.  Memory could
++     be allocated from OBJFILE in the case we will be removing OBJFILE, this
++     optimization is missed and xfree is called for it from COPIED_TYPES.  */
++  stored = xmalloc (sizeof (*stored));
+   stored->old = type;
+   stored->new = new_type;
+   *slot = stored;
+@@ -3399,6 +3549,21 @@ copy_type_recursive (struct objfile *objfile,
+   TYPE_OBJFILE_OWNED (new_type) = 0;
+   TYPE_OWNER (new_type).gdbarch = get_type_arch (type);
  
 +#if 0
-+extern void free_all_types (void);
++  /* TYPE_MAIN_TYPE memory copy above rewrote the TYPE_DISCARDABLE flag so we
++     need to initialize it again.  And even if TYPE was already discardable
++     NEW_TYPE so far is not registered in TYPE_DISCARDABLE_TABLE.  */
++  TYPE_DISCARDABLE (new_type) = 0;
++  set_type_as_discardable (new_type);
 +#endif
 +
- #endif /* GDBTYPES_H */
-diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
-index 4b1b20f..38e7027 100644
---- a/gdb/i386-linux-nat.c
-+++ b/gdb/i386-linux-nat.c
-@@ -708,8 +708,8 @@ i386_linux_dr_get_status (void)
-   return i386_linux_dr_get (inferior_ptid, DR_STATUS);
- }
--/* Callback for iterate_over_lwps.  Update the debug registers of
--   LWP.  */
-+/* Callback for linux_nat_iterate_watchpoint_lwps.  Update the debug registers
-+   of LWP.  */
- static int
- update_debug_registers_callback (struct lwp_info *lwp, void *arg)
-@@ -735,9 +735,7 @@ update_debug_registers_callback (struct lwp_info *lwp, void *arg)
- static void
- i386_linux_dr_set_control (unsigned long control)
- {
--  ptid_t pid_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
--
--  iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
-+  linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL);
- }
- /* Set address REGNUM (zero based) to ADDR in all LWPs of the current
-@@ -750,7 +748,7 @@ i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
-   gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
--  iterate_over_lwps (pid_ptid, update_debug_registers_callback, NULL);
-+  linux_nat_iterate_watchpoint_lwps (update_debug_registers_callback, NULL);
- }
- /* Called when resuming a thread.
-@@ -772,6 +770,9 @@ i386_linux_prepare_to_resume (struct lwp_info *lwp)
-       struct i386_debug_reg_state *state = i386_debug_reg_state ();
-       int i;
-+      /* See amd64_linux_prepare_to_resume for Linux kernel note on
-+       i386_linux_dr_set calls ordering.  */
++  /* Pre-clear the fields processed by delete_main_type.  If DWARF block
++     evaluations below call error we would leave an unfreeable TYPE.  */
++  TYPE_TARGET_TYPE (new_type) = NULL;
++  TYPE_VPTR_BASETYPE (new_type) = NULL;
++  TYPE_NFIELDS (new_type) = 0;
++  TYPE_FIELDS (new_type) = NULL;
 +
-       for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++)
-       if (state->dr_ref_count[i] > 0)
-         {
-diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
-index eb114ef..f80e05a 100644
---- a/gdb/i386-linux-tdep.c
-+++ b/gdb/i386-linux-tdep.c
-@@ -903,6 +903,15 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-                                   i386_linux_get_syscall_number);
-   set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
-+
-+  /* SystemTap variables and functions.  */
-+  set_gdbarch_stap_integer_prefix (gdbarch, "$");
-+  set_gdbarch_stap_register_prefix (gdbarch, "%");
-+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
-+  set_gdbarch_stap_register_indirection_sufix (gdbarch, ")");
-+  set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand);
-+  set_gdbarch_stap_parse_special_token (gdbarch,
-+                                      i386_stap_parse_special_token);
- }
+   if (TYPE_NAME (type))
+     TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
+   if (TYPE_TAG_NAME (type))
+@@ -3407,12 +3572,48 @@ copy_type_recursive (struct objfile *objfile,
+   TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type);
+   TYPE_LENGTH (new_type) = TYPE_LENGTH (type);
  
- /* Provide a prototype to silence -Wmissing-prototypes.  */
-diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
-index fa17823..846b2b8 100644
---- a/gdb/i386-nat.c
-+++ b/gdb/i386-nat.c
-@@ -25,6 +25,7 @@
- #include "gdbcmd.h"
- #include "target.h"
- #include "gdb_assert.h"
-+#include "inferior.h"
- /* Support for hardware watchpoints and breakpoints using the i386
-    debug registers.
-@@ -170,14 +171,88 @@ i386_init_dregs (struct i386_debug_reg_state *state)
-   state->dr_status_mirror  = 0;
- }
--/* The local mirror of the inferior's debug registers.  Currently this
--   is a global, but it should really be per-inferior.  */
--static struct i386_debug_reg_state dr_mirror;
-+/* Per-inferior data key.  */
-+static const struct inferior_data *i386_inferior_data;
-+
-+/* Per-inferior data.  */
-+struct i386_inferior_data
-+  {
-+    /* Copy of i386 hardware debug registers for performance reasons.  */
-+    struct i386_debug_reg_state state;
-+  };
-+
-+/* Per-inferior hook for register_inferior_data_with_cleanup.  */
-+
-+static void
-+i386_inferior_data_cleanup (struct inferior *inf, void *arg)
-+{
-+  struct i386_inferior_data *inf_data = arg;
-+
-+  xfree (inf_data);
-+}
-+
-+/* Get data specific for INFERIOR_PTID LWP.  Return special data area
-+   for processes being detached.  */
-+
-+static struct i386_inferior_data *
-+i386_inferior_data_get (void)
-+{
-+  struct inferior *inf = current_inferior ();
-+  struct i386_inferior_data *inf_data;
-+
-+  inf_data = inferior_data (inf, i386_inferior_data);
-+  if (inf_data == NULL)
++  if (TYPE_ALLOCATED (new_type))
 +    {
-+      inf_data = xzalloc (sizeof (*inf_data));
-+      set_inferior_data (current_inferior (), i386_inferior_data, inf_data);
++      gdb_assert (!TYPE_NOT_ALLOCATED (new_type));
++
++      if (!dwarf_locexpr_baton_eval (TYPE_ALLOCATED (new_type)))
++        TYPE_NOT_ALLOCATED (new_type) = 1;
++      TYPE_ALLOCATED (new_type) = NULL;
 +    }
 +
-+  if (inf->pid != ptid_get_pid (inferior_ptid))
++  if (TYPE_ASSOCIATED (new_type))
 +    {
-+      /* INFERIOR_PTID is being detached from the inferior INF.
-+       Provide local cache specific for the detached LWP.  */
++      gdb_assert (!TYPE_NOT_ASSOCIATED (new_type));
 +
-+      static struct i386_inferior_data detached_inf_data_local;
-+      static int detached_inf_pid = -1;
++      if (!dwarf_locexpr_baton_eval (TYPE_ASSOCIATED (new_type)))
++        TYPE_NOT_ASSOCIATED (new_type) = 1;
++      TYPE_ASSOCIATED (new_type) = NULL;
++    }
 +
-+      if (detached_inf_pid != ptid_get_pid (inferior_ptid))
++  if (!TYPE_DATA_LOCATION_IS_ADDR (new_type)
++      && TYPE_DATA_LOCATION_DWARF_BLOCK (new_type))
++    {
++      if (TYPE_NOT_ALLOCATED (new_type)
++          || TYPE_NOT_ASSOCIATED (new_type))
++      TYPE_DATA_LOCATION_DWARF_BLOCK (new_type) = NULL;
++      else
 +      {
-+        /* Reinitialize the local cache if INFERIOR_PTID is
-+           different from the LWP last detached.
-+ 
-+           Linux kernel before 2.6.33 commit
-+           72f674d203cd230426437cdcf7dd6f681dad8b0d
-+           will inherit hardware debug registers from parent
-+           on fork/vfork/clone.  Newer Linux kernels create such tasks with
-+           zeroed debug registers.
-+
-+           GDB will remove all breakpoints (and watchpoints) from the forked
-+           off process.  We also need to reset the debug registers in that
-+           process to be compatible with the older Linux kernels.
-+
-+           Copy the debug registers mirrors into the new process so that all
-+           breakpoints and watchpoints can be removed together.  The debug
-+           registers mirror will become zeroed in the end before detaching
-+           the forked off process.  */
-+
-+        detached_inf_pid = ptid_get_pid (inferior_ptid);
-+        memcpy (&detached_inf_data_local, inf_data,
-+                sizeof (detached_inf_data_local));
++        TYPE_DATA_LOCATION_IS_ADDR (new_type) = 1;
++        TYPE_DATA_LOCATION_ADDR (new_type) = dwarf_locexpr_baton_eval
++                                  (TYPE_DATA_LOCATION_DWARF_BLOCK (new_type));
 +      }
-+
-+      return &detached_inf_data_local;
 +    }
 +
-+  return inf_data;
-+}
-+
-+/* Get debug registers state for INFERIOR_PTID, see
-+   i386_inferior_data_get.  */
- struct i386_debug_reg_state *
- i386_debug_reg_state (void)
- {
--  return &dr_mirror;
-+  return &i386_inferior_data_get ()->state;
- }
- /* Whether or not to print the mirrored debug registers.  */
-@@ -230,7 +305,9 @@ static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state
- void
- i386_cleanup_dregs (void)
- {
--  i386_init_dregs (&dr_mirror);
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-+
-+  i386_init_dregs (state);
- }
- /* Print the values of the mirrored debug registers.  This is called
-@@ -494,20 +571,21 @@ Invalid value %d of operation in i386_handle_nonaligned_watchpoint.\n"),
- static void
- i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   int i;
-   ALL_DEBUG_REGISTERS (i)
+   /* Copy the fields.  */
+   if (TYPE_NFIELDS (type))
      {
--      if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (&dr_mirror, i))
-+      if (I386_DR_VACANT (new_state, i) != I386_DR_VACANT (state, i))
-       i386_dr_low.set_addr (i, new_state->dr_mirror[i]);
-       else
--      gdb_assert (new_state->dr_mirror[i] == dr_mirror.dr_mirror[i]);
-+      gdb_assert (new_state->dr_mirror[i] == state->dr_mirror[i]);
-     }
--  if (new_state->dr_control_mirror != dr_mirror.dr_control_mirror)
-+  if (new_state->dr_control_mirror != state->dr_control_mirror)
-     i386_dr_low.set_control (new_state->dr_control_mirror);
--  dr_mirror = *new_state;
-+  *state = *new_state;
- }
- /* Insert a watchpoint to watch a memory region which starts at
-@@ -518,10 +596,11 @@ static int
- i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
-                       struct expression *cond)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   int retval;
-   /* Work on a local copy of the debug registers, and on success,
-      commit the change back to the inferior.  */
--  struct i386_debug_reg_state local_state = dr_mirror;
-+  struct i386_debug_reg_state local_state = *state;
-   if (type == hw_read)
-     return 1; /* unsupported */
-@@ -542,7 +621,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type,
-     i386_update_inferior_debug_regs (&local_state);
-   if (maint_show_dr)
--    i386_show_dr (&dr_mirror, "insert_watchpoint", addr, len, type);
-+    i386_show_dr (state, "insert_watchpoint", addr, len, type);
-   return retval;
- }
-@@ -554,10 +633,11 @@ static int
- i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
-                       struct expression *cond)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   int retval;
-   /* Work on a local copy of the debug registers, and on success,
-      commit the change back to the inferior.  */
--  struct i386_debug_reg_state local_state = dr_mirror;
-+  struct i386_debug_reg_state local_state = *state;
-   if (((len != 1 && len !=2 && len !=4) && !(TARGET_HAS_DR_LEN_8 && len == 8))
-       || addr % len != 0)
-@@ -575,7 +655,7 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
-     i386_update_inferior_debug_regs (&local_state);
-   if (maint_show_dr)
--    i386_show_dr (&dr_mirror, "remove_watchpoint", addr, len, type);
-+    i386_show_dr (state, "remove_watchpoint", addr, len, type);
-   return retval;
- }
-@@ -586,11 +666,12 @@ i386_remove_watchpoint (CORE_ADDR addr, int len, int type,
- static int
- i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   int nregs;
+       int i, nfields;
  
-   /* Compute how many aligned watchpoints we would need to cover this
-      region.  */
--  nregs = i386_handle_nonaligned_watchpoint (&dr_mirror,
-+  nregs = i386_handle_nonaligned_watchpoint (state,
-                                            WP_COUNT, addr, len, hw_write);
-   return nregs <= DR_NADDR ? 1 : 0;
- }
-@@ -602,6 +683,7 @@ i386_region_ok_for_watchpoint (CORE_ADDR addr, int len)
- static int
- i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   CORE_ADDR addr = 0;
-   int i;
-   int rc = 0;
-@@ -615,25 +697,24 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
-   unsigned control = 0;
-   /* In non-stop/async, threads can be running while we change the
--     global dr_mirror (and friends).  Say, we set a watchpoint, and
--     let threads resume.  Now, say you delete the watchpoint, or
--     add/remove watchpoints such that dr_mirror changes while threads
--     are running.  On targets that support non-stop,
--     inserting/deleting watchpoints updates the global dr_mirror only.
--     It does not update the real thread's debug registers; that's only
--     done prior to resume.  Instead, if threads are running when the
--     mirror changes, a temporary and transparent stop on all threads
--     is forced so they can get their copy of the debug registers
--     updated on re-resume.  Now, say, a thread hit a watchpoint before
--     having been updated with the new dr_mirror contents, and we
--     haven't yet handled the corresponding SIGTRAP.  If we trusted
--     dr_mirror below, we'd mistake the real trapped address (from the
--     last time we had updated debug registers in the thread) with
--     whatever was currently in dr_mirror.  So to fix this, dr_mirror
--     always represents intention, what we _want_ threads to have in
--     debug registers.  To get at the address and cause of the trap, we
--     need to read the state the thread still has in its debug
--     registers.
-+     STATE (and friends).  Say, we set a watchpoint, and let threads
-+     resume.  Now, say you delete the watchpoint, or add/remove
-+     watchpoints such that STATE changes while threads are running.
-+     On targets that support non-stop, inserting/deleting watchpoints
-+     updates the STATE only.  It does not update the real thread's
-+     debug registers; that's only done prior to resume.  Instead, if
-+     threads are running when the mirror changes, a temporary and
-+     transparent stop on all threads is forced so they can get their
-+     copy of the debug registers updated on re-resume.  Now, say,
-+     a thread hit a watchpoint before having been updated with the new
-+     STATE contents, and we haven't yet handled the corresponding
-+     SIGTRAP.  If we trusted STATE below, we'd mistake the real
-+     trapped address (from the last time we had updated debug
-+     registers in the thread) with whatever was currently in STATE.
-+     So to fix this, STATE always represents intention, what we _want_
-+     threads to have in debug registers.  To get at the address and
-+     cause of the trap, we need to read the state the thread still has
-+     in its debug registers.
-      In sum, always get the current debug register values the current
-      thread has, instead of trusting the global mirror.  If the thread
-@@ -663,11 +744,11 @@ i386_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
-         addr = i386_dr_low.get_addr (i);
-         rc = 1;
-         if (maint_show_dr)
--          i386_show_dr (&dr_mirror, "watchpoint_hit", addr, -1, hw_write);
-+          i386_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
++      /* TYPE_CODE_RANGE uses TYPE_RANGE_DATA of the union with TYPE_FIELDS.  */
++      gdb_assert (TYPE_CODE (type) != TYPE_CODE_RANGE);
++
+       nfields = TYPE_NFIELDS (type);
++      TYPE_NFIELDS (new_type) = nfields;
+       TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field);
+       for (i = 0; i < nfields; i++)
+       {
+@@ -3421,8 +3622,8 @@ copy_type_recursive (struct objfile *objfile,
+         TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
+         if (TYPE_FIELD_TYPE (type, i))
+           TYPE_FIELD_TYPE (new_type, i)
+-            = copy_type_recursive (objfile, TYPE_FIELD_TYPE (type, i),
+-                                   copied_types);
++            = copy_type_recursive_1 (objfile, TYPE_FIELD_TYPE (type, i),
++                                     copied_types);
+         if (TYPE_FIELD_NAME (type, i))
+           TYPE_FIELD_NAME (new_type, i) = 
+             xstrdup (TYPE_FIELD_NAME (type, i));
+@@ -3453,24 +3654,184 @@ copy_type_recursive (struct objfile *objfile,
        }
      }
-   if (maint_show_dr && addr == 0)
--    i386_show_dr (&dr_mirror, "stopped_data_addr", 0, 0, hw_write);
-+    i386_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
-   if (rc)
-     *addr_p = addr;
-@@ -687,11 +768,12 @@ static int
- i386_insert_hw_breakpoint (struct gdbarch *gdbarch,
-                          struct bp_target_info *bp_tgt)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
-   CORE_ADDR addr = bp_tgt->placed_address;
-   /* Work on a local copy of the debug registers, and on success,
-      commit the change back to the inferior.  */
--  struct i386_debug_reg_state local_state = dr_mirror;
-+  struct i386_debug_reg_state local_state = *state;
-   int retval = i386_insert_aligned_watchpoint (&local_state,
-                                              addr, len_rw) ? EBUSY : 0;
-@@ -699,7 +781,7 @@ i386_insert_hw_breakpoint (struct gdbarch *gdbarch,
-     i386_update_inferior_debug_regs (&local_state);
-   if (maint_show_dr)
--    i386_show_dr (&dr_mirror, "insert_hwbp", addr, 1, hw_execute);
-+    i386_show_dr (state, "insert_hwbp", addr, 1, hw_execute);
-   return retval;
- }
-@@ -711,11 +793,12 @@ static int
- i386_remove_hw_breakpoint (struct gdbarch *gdbarch,
-                          struct bp_target_info *bp_tgt)
- {
-+  struct i386_debug_reg_state *state = i386_debug_reg_state ();
-   unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
-   CORE_ADDR addr = bp_tgt->placed_address;
-   /* Work on a local copy of the debug registers, and on success,
-      commit the change back to the inferior.  */
--  struct i386_debug_reg_state local_state = dr_mirror;
-+  struct i386_debug_reg_state local_state = *state;
-   int retval = i386_remove_aligned_watchpoint (&local_state,
-                                              addr, len_rw);
-@@ -723,7 +806,7 @@ i386_remove_hw_breakpoint (struct gdbarch *gdbarch,
-     i386_update_inferior_debug_regs (&local_state);
-   if (maint_show_dr)
--    i386_show_dr (&dr_mirror, "remove_hwbp", addr, 1, hw_execute);
-+    i386_show_dr (state, "remove_hwbp", addr, 1, hw_execute);
-   return retval;
- }
-@@ -788,6 +871,10 @@ i386_use_watchpoints (struct target_ops *t)
-   t->to_remove_watchpoint = i386_remove_watchpoint;
-   t->to_insert_hw_breakpoint = i386_insert_hw_breakpoint;
-   t->to_remove_hw_breakpoint = i386_remove_hw_breakpoint;
-+
-+  if (i386_inferior_data == NULL)
-+    i386_inferior_data
-+      = register_inferior_data_with_cleanup (i386_inferior_data_cleanup);
- }
- void
-diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
-index 549297e..5783c4c 100644
---- a/gdb/i386-tdep.c
-+++ b/gdb/i386-tdep.c
-@@ -58,8 +58,14 @@
- #include "features/i386/i386-avx.c"
- #include "features/i386/i386-mmx.c"
-+#include "stap-probe.h"
- #include "ax.h"
- #include "ax-gdb.h"
-+#include "user-regs.h"
-+#include "cli/cli-utils.h"
-+#include "expression.h"
-+#include "parser-defs.h"
-+#include <ctype.h>
- /* Register names.  */
-@@ -7246,6 +7252,312 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
-   return valid_p;
- }
  
-+int
-+i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
-+{
-+  return (*s == '$' /* Literal number.  */
-+        || (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement.  */
-+        || (*s == '(' && s[1] == '%') /* Register indirection.  */
-+        || (*s == '%' && isalpha (s[1]))); /* Register access.  */
-+}
-+
-+int
-+i386_stap_parse_special_token (struct gdbarch *gdbarch,
-+                             struct stap_parse_info *p)
-+{
-+  const char *s = p->arg;
-+
-+  /* In order to parse special tokens, we use a state-machine that go
-+     through every known token and try to get a match.  */
-+  enum
-+    {
-+      TRIPLET,
-+      THREE_ARG_DISPLACEMENT,
-+      DONE
-+    } current_state;
-+
-+  current_state = TRIPLET;
-+
-+  /* The special tokens to be parsed here are:
-+
-+     - `register base + (register index * size) + offset', as represented
-+     in `(%rcx,%rax,8)', or `[OFFSET](BASE_REG,INDEX_REG[,SIZE])'.
-+
-+     - Operands of the form `-8+3+1(%rbp)', which must be interpreted as
-+     `*(-8 + 3 - 1 + (void *) $eax)'.  */
++  /* Both FIELD_LOC_KIND_DWARF_BLOCK and TYPE_RANGE_HIGH_BOUND_IS_COUNT were
++     possibly converted.  */
++  TYPE_DYNAMIC (new_type) = 0;
 +
-+  while (current_state != DONE)
-+    {
-+      const char *s = p->arg;
+   /* For range types, copy the bounds information.  */
+-  if (TYPE_CODE (type) == TYPE_CODE_RANGE)
++  if (TYPE_CODE (new_type) == TYPE_CODE_RANGE)
+     {
+       TYPE_RANGE_DATA (new_type) = xmalloc (sizeof (struct range_bounds));
+       *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
 +
-+      switch (current_state)
++      switch (TYPE_RANGE_DATA (new_type)->low.kind)
 +      {
-+      case TRIPLET:
++      case RANGE_BOUND_KIND_CONSTANT:
++        break;
++      case RANGE_BOUND_KIND_DWARF_BLOCK:
++        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
++           it is expected to be made constant by CHECK_TYPEDEF.
++           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++           */
++        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++            || ! has_stack_frames ())
 +          {
-+            if (isdigit (*s) || *s == '-' || *s == '+')
-+              {
-+                int got_minus[3];
-+                int i;
-+                long displacements[3];
-+                const char *start;
-+                char *regname;
-+                int len;
-+                struct stoken str;
-+
-+                got_minus[0] = 0;
-+                if (*s == '+')
-+                  ++s;
-+                else if (*s == '-')
-+                  {
-+                    ++s;
-+                    got_minus[0] = 1;
-+                  }
-+
-+                displacements[0] = strtol (s, (char **) &s, 10);
-+
-+                if (*s != '+' && *s != '-')
-+                  /* We are not dealing with a triplet.  */
-+                  break;
-+
-+                got_minus[1] = 0;
-+                if (*s == '+')
-+                  ++s;
-+                else
-+                  {
-+                    ++s;
-+                    got_minus[1] = 1;
-+                  }
-+
-+                displacements[1] = strtol (s, (char **) &s, 10);
-+
-+                if (*s != '+' && *s != '-')
-+                  /* We are not dealing with a triplet.  */
-+                  break;
-+
-+                got_minus[2] = 0;
-+                if (*s == '+')
-+                  ++s;
-+                else
-+                  {
-+                    ++s;
-+                    got_minus[2] = 1;
-+                  }
-+
-+                displacements[2] = strtol (s, (char **) &s, 10);
-+
-+                if (*s != '(' || s[1] != '%')
-+                  break;
-+
-+                s += 2;
-+                start = s;
-+
-+                while (isalnum (*s))
-+                  ++s;
-+
-+                if (*s++ != ')')
-+                  break;
-+
-+                len = s - start;
-+                regname = alloca (len + 1);
-+
-+                strncpy (regname, start, len);
-+                regname[len] = '\0';
-+
-+                if (user_reg_map_name_to_regnum (gdbarch,
-+                                                 regname, len) == -1)
-+                  error (_("Invalid register name `%s' "
-+                           "on expression `%s'."),
-+                         regname, p->saved_arg);
-+
-+                for (i = 0; i < 3; i++)
-+                  {
-+                    write_exp_elt_opcode (OP_LONG);
-+                    write_exp_elt_type
-+                      (builtin_type (gdbarch)->builtin_long);
-+                    write_exp_elt_longcst (displacements[i]);
-+                    write_exp_elt_opcode (OP_LONG);
-+                    if (got_minus[i])
-+                      write_exp_elt_opcode (UNOP_NEG);
-+                  }
-+
-+                write_exp_elt_opcode (OP_REGISTER);
-+                str.ptr = regname;
-+                str.length = len;
-+                write_exp_string (str);
-+                write_exp_elt_opcode (OP_REGISTER);
-+                
-+                write_exp_elt_opcode (UNOP_CAST);
-+                write_exp_elt_type (builtin_type (gdbarch)->builtin_data_ptr);
-+                write_exp_elt_opcode (UNOP_CAST);
-+
-+                write_exp_elt_opcode (BINOP_ADD);
-+                write_exp_elt_opcode (BINOP_ADD);
-+                write_exp_elt_opcode (BINOP_ADD);
-+
-+                write_exp_elt_opcode (UNOP_CAST);
-+                write_exp_elt_type (lookup_pointer_type (p->arg_type));
-+                write_exp_elt_opcode (UNOP_CAST);
-+
-+                write_exp_elt_opcode (UNOP_IND);
-+
-+                p->arg = s;
-+
-+                return 1;
-+              }
-+            break;
++            /* We should set 1 for Fortran but how to find the language?  */
++            TYPE_LOW_BOUND (new_type) = 0;
++            TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
 +          }
-+      case THREE_ARG_DISPLACEMENT:
++        else
 +          {
-+            if (isdigit (*s) || *s == '(' || *s == '-' || *s == '+')
-+              {
-+                int offset_minus = 0;
-+                long offset = 0;
-+                int size_minus = 0;
-+                long size = 0;
-+                const char *start;
-+                char *base;
-+                int len_base;
-+                char *index;
-+                int len_index;
-+                struct stoken base_token, index_token;
-+
-+                if (*s == '+')
-+                  ++s;
-+                else if (*s == '-')
-+                  {
-+                    ++s;
-+                    offset_minus = 1;
-+                  }
-+
-+                if (offset_minus && !isdigit (*s))
-+                  break;
-+
-+                if (isdigit (*s))
-+                  offset = strtol (s, (char **) &s, 10);
-+
-+                if (*s != '(' || s[1] != '%')
-+                  break;
-+
-+                s += 2;
-+                start = s;
-+
-+                while (isalnum (*s))
-+                  ++s;
-+
-+                if (*s != ',' || s[1] != '%')
-+                  break;
-+
-+                len_base = s - start;
-+                base = alloca (len_base + 1);
-+                strncpy (base, start, len_base);
-+                base[len_base] = '\0';
-+
-+                if (user_reg_map_name_to_regnum (gdbarch,
-+                                                 base, len_base) == -1)
-+                  error (_("Invalid register name `%s' "
-+                           "on expression `%s'."),
-+                         base, p->saved_arg);
-+
-+                s += 2;
-+                start = s;
-+
-+                while (isalnum (*s))
-+                  ++s;
-+
-+                len_index = s - start;
-+                index = alloca (len_index + 1);
-+                strncpy (index, start, len_index);
-+                index[len_index] = '\0';
-+
-+                if (user_reg_map_name_to_regnum (gdbarch,
-+                                                 index, len_index) == -1)
-+                  error (_("Invalid register name `%s' "
-+                           "on expression `%s'."),
-+                         index, p->saved_arg);
-+
-+                if (*s != ',' && *s != ')')
-+                  break;
-+
-+                if (*s == ',')
-+                  {
-+                    ++s;
-+                    if (*s == '+')
-+                      ++s;
-+                    else if (*s == '-')
-+                      {
-+                        ++s;
-+                        size_minus = 1;
-+                      }
-+
-+                    size = strtol (s, (char **) &s, 10);
-+
-+                    if (*s != ')')
-+                      break;
-+                  }
-+
-+                ++s;
-+
-+                if (offset)
-+                  {
-+                    write_exp_elt_opcode (OP_LONG);
-+                    write_exp_elt_type
-+                      (builtin_type (gdbarch)->builtin_long);
-+                    write_exp_elt_longcst (offset);
-+                    write_exp_elt_opcode (OP_LONG);
-+                    if (offset_minus)
-+                      write_exp_elt_opcode (UNOP_NEG);
-+                  }
-+
-+                write_exp_elt_opcode (OP_REGISTER);
-+                base_token.ptr = base;
-+                base_token.length = len_base;
-+                write_exp_string (base_token);
-+                write_exp_elt_opcode (OP_REGISTER);
-+                
-+                if (offset)
-+                  write_exp_elt_opcode (BINOP_ADD);
-+
-+                write_exp_elt_opcode (OP_REGISTER);
-+                index_token.ptr = index;
-+                index_token.length = len_index;
-+                write_exp_string (index_token);
-+                write_exp_elt_opcode (OP_REGISTER);
-+
-+                if (size)
-+                  {
-+                    write_exp_elt_opcode (OP_LONG);
-+                    write_exp_elt_type
-+                      (builtin_type (gdbarch)->builtin_long);
-+                    write_exp_elt_longcst (size);
-+                    write_exp_elt_opcode (OP_LONG);
-+                    if (size_minus)
-+                      write_exp_elt_opcode (UNOP_NEG);
-+                    write_exp_elt_opcode (BINOP_MUL);
-+                  }
-+
-+                write_exp_elt_opcode (BINOP_ADD);
-+
-+                write_exp_elt_opcode (UNOP_CAST);
-+                write_exp_elt_type (lookup_pointer_type (p->arg_type));
-+                write_exp_elt_opcode (UNOP_CAST);
-+
-+                write_exp_elt_opcode (UNOP_IND);
-+
-+                p->arg = s;
-+
-+                return 1;
-+              }
-+            break;
++            TYPE_LOW_BOUND (new_type) = dwarf_locexpr_baton_eval
++                              (TYPE_RANGE_DATA (new_type)->low.u.dwarf_block);
++            if (TYPE_LOW_BOUND (new_type) >= 0)
++              TYPE_UNSIGNED (new_type) = 1;
 +          }
-+      }
-+
-+      /* Advancing to the next state.  */
-+      ++current_state;
-+    }
-+
-+  return 0;
-+}
++        TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
++        break;
++      case RANGE_BOUND_KIND_DWARF_LOCLIST:
++        {
++          CORE_ADDR addr;
 +
\f
- static struct gdbarch *
- i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
-diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
-index 870054f..9ffbe44 100644
---- a/gdb/i386-tdep.h
-+++ b/gdb/i386-tdep.h
-@@ -379,6 +379,15 @@ extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
- extern int i386_process_record (struct gdbarch *gdbarch,
-                                 struct regcache *regcache, CORE_ADDR addr);
++          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++             it is expected to be made constant by CHECK_TYPEDEF.
++             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++             */
++          if (! TYPE_NOT_ALLOCATED (new_type)
++              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
++              && dwarf_loclist_baton_eval
++                (TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.loclist,
++                 TYPE_RANGE_DATA (new_type)->low.u.dwarf_loclist.type, &addr))
++            {
++              TYPE_LOW_BOUND (new_type) = addr;
++              if (TYPE_LOW_BOUND (new_type) >= 0)
++                TYPE_UNSIGNED (new_type) = 1;
++            }
++          else
++            {
++              /* We should set 1 for Fortran but how to find the language?  */
++              TYPE_LOW_BOUND (new_type) = 0;
++              TYPE_LOW_BOUND_UNDEFINED (new_type) = 1;
++            }
++          TYPE_RANGE_DATA (new_type)->low.kind = RANGE_BOUND_KIND_CONSTANT;
++        }
++        break;
++      }
 +
-+/* SystemTap related functions.  */
++      switch (TYPE_RANGE_DATA (new_type)->high.kind)
++      {
++      case RANGE_BOUND_KIND_CONSTANT:
++        break;
++      case RANGE_BOUND_KIND_DWARF_BLOCK:
++        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
++           it is expected to be made constant by CHECK_TYPEDEF.
++           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++           */
++        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++            || ! has_stack_frames ())
++          {
++            TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
++            TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
++          }
++        else
++          TYPE_HIGH_BOUND (new_type) = dwarf_locexpr_baton_eval
++                             (TYPE_RANGE_DATA (new_type)->high.u.dwarf_block);
++        TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
++        break;
++      case RANGE_BOUND_KIND_DWARF_LOCLIST:
++        {
++          CORE_ADDR addr;
 +
-+extern int i386_stap_is_single_operand (struct gdbarch *gdbarch,
-+                                      const char *s);
++          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++             it is expected to be made constant by CHECK_TYPEDEF.
++             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++             */
++          if (! TYPE_NOT_ALLOCATED (new_type)
++              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ()
++              && dwarf_loclist_baton_eval
++                    (TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.loclist,
++                     TYPE_RANGE_DATA (new_type)->high.u.dwarf_loclist.type,
++                     &addr))
++            TYPE_HIGH_BOUND (new_type) = addr;
++          else
++            {
++              TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type) - 1;
++              TYPE_HIGH_BOUND_UNDEFINED (new_type) = 1;
++            }
++          TYPE_RANGE_DATA (new_type)->high.kind = RANGE_BOUND_KIND_CONSTANT;
++        }
++        break;
++      }
 +
-+extern int i386_stap_parse_special_token (struct gdbarch *gdbarch,
-+                                        struct stap_parse_info *p);
++      switch (TYPE_RANGE_DATA (new_type)->byte_stride.kind)
++      {
++      case RANGE_BOUND_KIND_CONSTANT:
++        break;
++      case RANGE_BOUND_KIND_DWARF_BLOCK:
++        /* `struct dwarf2_locexpr_baton' is too bound to its objfile so
++           it is expected to be made constant by CHECK_TYPEDEF.
++           TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++           */
++        if (TYPE_NOT_ALLOCATED (new_type) || TYPE_NOT_ASSOCIATED (new_type)
++            || ! has_stack_frames ())
++          TYPE_BYTE_STRIDE (new_type) = 0;
++        else
++          TYPE_BYTE_STRIDE (new_type) = dwarf_locexpr_baton_eval
++                      (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_block);
++        TYPE_RANGE_DATA (new_type)->byte_stride.kind
++          = RANGE_BOUND_KIND_CONSTANT;
++        break;
++      case RANGE_BOUND_KIND_DWARF_LOCLIST:
++        {
++          CORE_ADDR addr = 0;
 +
\f
- /* Functions and variables exported from i386bsd-tdep.c.  */
-diff --git a/gdb/infrun.c b/gdb/infrun.c
-index 24d2720..c516b8b 100644
---- a/gdb/infrun.c
-+++ b/gdb/infrun.c
-@@ -55,6 +55,8 @@
- #include "continuations.h"
- #include "interps.h"
- #include "skip.h"
-+#include "stap-probe.h"
-+#include "objfiles.h"
- /* Prototypes for local functions */
-@@ -2379,7 +2381,7 @@ static void handle_step_into_function (struct gdbarch *gdbarch,
- static void handle_step_into_function_backward (struct gdbarch *gdbarch,
-                                               struct execution_control_state *ecs);
- static void check_exception_resume (struct execution_control_state *,
--                                  struct frame_info *, struct symbol *);
-+                                  struct frame_info *);
- static void stop_stepping (struct execution_control_state *ecs);
- static void prepare_to_wait (struct execution_control_state *ecs);
-@@ -4417,9 +4419,17 @@ process_event_stop_test:
++          /* `struct dwarf2_loclist_baton' is too bound to its objfile so
++             it is expected to be made constant by CHECK_TYPEDEF.
++             TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are not valid for TYPE.
++             */
++          if (! TYPE_NOT_ALLOCATED (new_type)
++              && ! TYPE_NOT_ASSOCIATED (new_type) && has_stack_frames ())
++            dwarf_loclist_baton_eval
++             (TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.loclist,
++              TYPE_RANGE_DATA (new_type)->byte_stride.u.dwarf_loclist.type,
++              &addr);
++          TYPE_BYTE_STRIDE (new_type) = addr;
++          TYPE_RANGE_DATA (new_type)->byte_stride.kind
++            = RANGE_BOUND_KIND_CONSTANT;
++        }
++        break;
++      }
++
++      /* Convert TYPE_RANGE_HIGH_BOUND_IS_COUNT into a regular bound.  */
++      if (TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type))
++      {
++        TYPE_HIGH_BOUND (new_type) = TYPE_LOW_BOUND (new_type)
++                                     + TYPE_HIGH_BOUND (new_type) - 1;
++        TYPE_RANGE_HIGH_BOUND_IS_COUNT (new_type) = 0;
++      }
+     }
  
-       if (what.is_longjmp)
-         {
--          if (!gdbarch_get_longjmp_target_p (gdbarch)
--              || !gdbarch_get_longjmp_target (gdbarch,
--                                              frame, &jmp_buf_pc))
-+          struct value *arg_value;
-+
-+          /* If we set the longjmp breakpoint via a SystemTap probe,
-+             then use it to extract the arguments.  The destination
-+             PC is the third argument to the probe.  */
-+          arg_value = stap_safe_evaluate_at_pc (frame, 2);
-+          if (arg_value)
-+            jmp_buf_pc = value_as_address (arg_value);
-+          else if (!gdbarch_get_longjmp_target_p (gdbarch)
-+                   || !gdbarch_get_longjmp_target (gdbarch,
-+                                                   frame, &jmp_buf_pc))
-             {
-               if (debug_infrun)
-                 fprintf_unfiltered (gdb_stdlog,
-@@ -4437,12 +4447,7 @@ process_event_stop_test:
-           insert_longjmp_resume_breakpoint (gdbarch, jmp_buf_pc);
-         }
-       else
--        {
--          struct symbol *func = get_frame_function (frame);
--
--          if (func)
--            check_exception_resume (ecs, frame, func);
--        }
-+        check_exception_resume (ecs, frame);
-       keep_going (ecs);
-       return;
+   /* Copy pointers to other types.  */
+   if (TYPE_TARGET_TYPE (type))
+     TYPE_TARGET_TYPE (new_type) = 
+-      copy_type_recursive (objfile, 
+-                         TYPE_TARGET_TYPE (type),
+-                         copied_types);
++      copy_type_recursive_1 (objfile, 
++                           TYPE_TARGET_TYPE (type),
++                           copied_types);
+   if (TYPE_VPTR_BASETYPE (type))
+     TYPE_VPTR_BASETYPE (new_type) = 
+-      copy_type_recursive (objfile,
+-                         TYPE_VPTR_BASETYPE (type),
+-                         copied_types);
++      copy_type_recursive_1 (objfile,
++                           TYPE_VPTR_BASETYPE (type),
++                           copied_types);
++
++  if (TYPE_CODE (new_type) == TYPE_CODE_ARRAY)
++    {
++      struct type *new_index_type = TYPE_INDEX_TYPE (new_type);
++
++      if (TYPE_BYTE_STRIDE (new_index_type) == 0)
++      TYPE_BYTE_STRIDE (new_index_type)
++        = TYPE_LENGTH (TYPE_TARGET_TYPE (new_type));
++    }
++
+   /* Maybe copy the type_specific bits.
  
-@@ -5524,15 +5529,65 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
-     }
+      NOTE drow/2005-12-09: We do not copy the C++-specific bits like
+@@ -3487,6 +3848,17 @@ copy_type_recursive (struct objfile *objfile,
+   return new_type;
  }
  
-+/* A helper for check_exception_resume that sets an
-+   exception-breakpoint based on a SystemTap probe.  */
++/* Recursively copy (deep copy) TYPE.  Return a new type allocated using
++   malloc, a saved type if we have already visited TYPE (using COPIED_TYPES),
++   or TYPE if it is not associated with OBJFILE.  */
++
++struct type *
++copy_type_recursive (struct type *type,
++                   htab_t copied_types)
++{
++  return copy_type_recursive_1 (TYPE_OBJFILE (type), type, copied_types);
++}
++
+ /* Make a copy of the given TYPE, except that the pointer & reference
+    types are not preserved.
+    
+@@ -3509,6 +3881,201 @@ copy_type (const struct type *type)
+   return new_type;
+ }
++#if 0
++/* Callback type for main_type_crawl.  */
++typedef int (*main_type_crawl_iter) (struct type *type, void *data);
++
++/* Iterate all main_type structures reachable through any `struct type *' from
++   TYPE.  ITER will be called only for one type of each main_type, use
++   TYPE_CHAIN traversal to find all the type instances.  ITER is being called
++   for each main_type found.  ITER returns non-zero if main_type_crawl should
++   depth-first enter the specific type.  ITER must provide some detection for
++   reentering the same main_type as this function would otherwise endlessly
++   loop.  */
 +
 +static void
-+insert_exception_resume_from_probe (struct thread_info *tp,
-+                                  const struct stap_probe *probe,
-+                                  struct objfile *objfile,
-+                                  struct frame_info *frame)
++main_type_crawl (struct type *type, main_type_crawl_iter iter, void *data)
 +{
-+  struct value *arg_value;
-+  CORE_ADDR handler;
-+  struct breakpoint *bp;
++  struct type *type_iter;
++  int i;
 +
-+  arg_value = stap_safe_evaluate_at_pc (frame, 1);
-+  if (!arg_value)
++  if (!type)
 +    return;
 +
-+  handler = value_as_address (arg_value);
-+
-+  if (debug_infrun)
-+    fprintf_unfiltered (gdb_stdlog,
-+                      "infrun: exception resume at %s\n",
-+                      paddress (get_objfile_arch (objfile),
-+                                handler));
++  gdb_assert (TYPE_OBJFILE (type) == NULL);
 +
-+  bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
-+                                     handler, bp_exception_resume);
-+  bp->thread = tp->num;
-+  inferior_thread ()->control.exception_resume_breakpoint = bp;
-+}
++  /* `struct cplus_struct_type' handling is unsupported by this function.  */
++  gdb_assert ((TYPE_CODE (type) != TYPE_CODE_STRUCT
++             && TYPE_CODE (type) != TYPE_CODE_UNION)
++            || !HAVE_CPLUS_STRUCT (type));
 +
- /* 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 frame_info *frame)
- {
-   volatile struct gdb_exception e;
-+  struct objfile *objfile;
-+  const struct stap_probe *probe;
-+  struct symbol *func;
++  if (!(*iter) (type, data))
++    return;
 +
-+  /* First see if this exception unwinding breakpoint was set via a
-+     SystemTap probe point.  If so, the probe has two arguments: the
-+     CFA and the HANDLER.  We ignore the CFA, extract the handler, and
-+     set a breakpoint there.  */
-+  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
-+  if (probe)
++  /* Iterate all the type instances of this main_type.  */
++  type_iter = type;
++  do
 +    {
-+      insert_exception_resume_from_probe (ecs->event_thread, probe,
-+                                        objfile, frame);
-+      return;
++      gdb_assert (TYPE_MAIN_TYPE (type_iter) == TYPE_MAIN_TYPE (type));
++
++      main_type_crawl (TYPE_POINTER_TYPE (type), iter, data);
++      main_type_crawl (TYPE_REFERENCE_TYPE (type), iter, data);
++
++      type_iter = TYPE_CHAIN (type_iter);
 +    }
++  while (type_iter != type);
 +
-+  func = get_frame_function (frame);
-+  if (!func)
-+    return;
-   TRY_CATCH (e, RETURN_MASK_ERROR)
-     {
-@@ -6564,7 +6619,8 @@ static const struct lval_funcs siginfo_value_funcs =
-    if there's no object available.  */
- static struct value *
--siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var)
-+siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
-+                  void *ignore)
- {
-   if (target_has_stack
-       && !ptid_equal (inferior_ptid, null_ptid)
-@@ -7059,6 +7115,15 @@ show_schedule_multiple (struct ui_file *file, int from_tty,
-                           "of all processes is %s.\n"), value);
- }
-+/* Implementation of `siginfo' variable.  */
++  for (i = 0; i < TYPE_NFIELDS (type); i++)
++    main_type_crawl (TYPE_FIELD_TYPE (type, i), iter, data);
++
++  main_type_crawl (TYPE_TARGET_TYPE (type), iter, data);
++  main_type_crawl (TYPE_VPTR_BASETYPE (type), iter, data);
++}
++
++/* A helper for delete_type which deletes a main_type and the things to which
++   it refers.  TYPE is a type whose main_type we wish to destroy.  */
 +
-+static const struct internalvar_funcs siginfo_funcs =
++static void
++delete_main_type (struct type *type)
 +{
-+  siginfo_make_value,
-+  NULL,
-+  NULL
-+};
++  int i;
 +
- void
- _initialize_infrun (void)
- {
-@@ -7347,7 +7412,7 @@ enabled by default on some platforms."),
-      value with a void typed value, and when we get here, gdbarch
-      isn't initialized yet.  At this point, we're quite sure there
-      isn't another convenience variable of the same name.  */
--  create_internalvar_type_lazy ("_siginfo", siginfo_make_value);
-+  create_internalvar_type_lazy ("_siginfo", &siginfo_funcs, NULL);
-   add_setshow_boolean_cmd ("observer", no_class,
-                          &observer_mode_1, _("\
-diff --git a/gdb/linespec.c b/gdb/linespec.c
-index 0782c54..31bb36c 100644
---- a/gdb/linespec.c
-+++ b/gdb/linespec.c
-@@ -43,6 +43,7 @@
- #include "cli/cli-utils.h"
- #include "filenames.h"
- #include "ada-lang.h"
-+#include "stap-probe.h"
- typedef struct symtab *symtab_p;
- DEF_VEC_P (symtab_p);
-@@ -802,6 +803,7 @@ keep_name_info (char *p, int on_boundary)
-    PC returned is 0.
-    FILE:FUNCTION -- likewise, but prefer functions in that file.
-    *EXPR -- line in which address EXPR appears.
-+   -p [OBJFILE:][PROVIDER:]NAME -- a systemtap static probe
-    This may all be followed by an "if EXPR", which we ignore.
-@@ -872,6 +874,9 @@ decode_line_internal (struct linespec_state *self, char **argptr)
-       return decode_indirect (self, argptr);
-     }
-+  if (strncmp (*argptr, "-p", 2) == 0 && isspace ((*argptr)[2]))
-+    return parse_stap_probe (argptr, self->canonical);
++  gdb_assert (TYPE_DISCARDABLE (type));
++  gdb_assert (TYPE_OBJFILE (type) == NULL);
 +
-   is_quoted = (strchr (get_gdb_completer_quote_characters (),
-                      **argptr) != NULL);
-diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
-index 50d4efd..893b7c4 100644
---- a/gdb/linux-nat.c
-+++ b/gdb/linux-nat.c
-@@ -288,6 +288,7 @@ static void restore_child_signals_mask (sigset_t *prev_mask);
- struct lwp_info;
- static struct lwp_info *add_lwp (ptid_t ptid);
- static void purge_lwp_list (int pid);
-+static void delete_lwp (ptid_t ptid);
- static struct lwp_info *find_lwp_pid (ptid_t ptid);
\f
-@@ -584,6 +585,31 @@ linux_child_post_startup_inferior (ptid_t ptid)
-   linux_enable_tracesysgood (ptid);
- }
-+/* Return the number of known LWPs in the tgid given by PID.  */
++  xfree (TYPE_NAME (type));
++  xfree (TYPE_TAG_NAME (type));
 +
-+static int
-+num_lwps (int pid)
-+{
-+  int count = 0;
-+  struct lwp_info *lp;
++  for (i = 0; i < TYPE_NFIELDS (type); ++i)
++    {
++      xfree (TYPE_FIELD_NAME (type, i));
++
++      if (TYPE_FIELD_LOC_KIND (type, i) == FIELD_LOC_KIND_PHYSNAME)
++      xfree (TYPE_FIELD_STATIC_PHYSNAME (type, i));
++    }
++  xfree (TYPE_FIELDS (type));
 +
-+  for (lp = lwp_list; lp; lp = lp->next)
-+    if (ptid_get_pid (lp->ptid) == pid)
-+      count++;
++  gdb_assert (!HAVE_CPLUS_STRUCT (type));
 +
-+  return count;
++  xfree (TYPE_MAIN_TYPE (type));
 +}
 +
-+/* Call delete_lwp with prototype compatible for make_cleanup.  */
++/* Delete all the instances on TYPE_CHAIN of TYPE, including their referenced
++   main_type.  TYPE must be a reclaimable type - neither permanent nor objfile
++   associated.  */
 +
 +static void
-+delete_lwp_cleanup (void *lp_voidp)
++delete_type_chain (struct type *type)
 +{
-+  struct lwp_info *lp = lp_voidp;
++  struct type *type_iter, *type_iter_to_free;
 +
-+  delete_lwp (lp->ptid);
-+}
++  gdb_assert (TYPE_DISCARDABLE (type));
++  gdb_assert (TYPE_OBJFILE (type) == NULL);
 +
- static int
- linux_child_follow_fork (struct target_ops *ops, int follow_child)
- {
-@@ -630,6 +656,8 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
-       /* Detach new forked process?  */
-       if (detach_fork)
-       {
-+        struct cleanup *old_chain;
++  delete_main_type (type);
 +
-         /* Before detaching from the child, remove all breakpoints
-            from it.  If we forked, then this has already been taken
-            care of by infrun.c.  If we vforked however, any
-@@ -652,7 +680,28 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
-                               child_pid);
-           }
-+        old_chain = save_inferior_ptid ();
-+        inferior_ptid = ptid_build (child_pid, child_pid, 0);
++  type_iter = type;
++  do
++    {
++      type_iter_to_free = type_iter;
++      type_iter = TYPE_CHAIN (type_iter);
++      xfree (type_iter_to_free);
++    }
++  while (type_iter != type);
++}
 +
-+        child_lp = add_lwp (inferior_ptid);
-+        child_lp->stopped = 1;
-+        child_lp->last_resume_kind = resume_stop;
-+        make_cleanup (delete_lwp_cleanup, child_lp);
++/* Hash function for type_discardable_table.  */
 +
-+        /* CHILD_LP has new PID, therefore linux_nat_new_thread is not called for it.
-+           See i386_inferior_data_get for the Linux kernel specifics.
-+           Ensure linux_nat_prepare_to_resume will reset the hardware debug
-+           registers.  It is done by the linux_nat_new_thread call, which is
-+           being skipped in add_lwp above for the first lwp of a pid.  */
-+        gdb_assert (num_lwps (GET_PID (child_lp->ptid)) == 1);
-+        if (linux_nat_new_thread != NULL)
-+          linux_nat_new_thread (child_lp);
++static hashval_t
++type_discardable_hash (const void *p)
++{
++  const struct type *type = p;
 +
-+        if (linux_nat_prepare_to_resume != NULL)
-+          linux_nat_prepare_to_resume (child_lp);
-         ptrace (PTRACE_DETACH, child_pid, 0, 0);
++  return htab_hash_pointer (TYPE_MAIN_TYPE (type));
++}
 +
-+        do_cleanups (old_chain);
-       }
-       else
-       {
-@@ -670,6 +719,9 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
-         save_current_program_space ();
-         inferior_ptid = ptid_build (child_pid, child_pid, 0);
-+        reinit_frame_cache ();
-+        registers_changed ();
-+
-         add_thread (inferior_ptid);
-         child_lp = add_lwp (inferior_ptid);
-         child_lp->stopped = 1;
-@@ -861,6 +913,9 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
-        informing the solib layer about this new process.  */
-       inferior_ptid = ptid_build (child_pid, child_pid, 0);
-+      reinit_frame_cache ();
-+      registers_changed ();
-+
-       add_thread (inferior_ptid);
-       child_lp = add_lwp (inferior_ptid);
-       child_lp->stopped = 1;
-@@ -1111,21 +1166,6 @@ purge_lwp_list (int pid)
-     }
- }
--/* Return the number of known LWPs in the tgid given by PID.  */
--
--static int
--num_lwps (int pid)
--{
--  int count = 0;
--  struct lwp_info *lp;
--
--  for (lp = lwp_list; lp; lp = lp->next)
--    if (ptid_get_pid (lp->ptid) == pid)
--      count++;
--
--  return count;
--}
--
- /* Add the LWP specified by PID to the list.  Return a pointer to the
-    structure describing the new LWP.  The LWP should already be stopped
-    (with an exception for the very first LWP).  */
-@@ -1235,6 +1275,46 @@ iterate_over_lwps (ptid_t filter,
-   return NULL;
- }
-+/* Iterate like iterate_over_lwps does except when forking-off a child call
-+   CALLBACK with CALLBACK_DATA specifically only for that new child PID.  */
++/* Equality function for type_discardable_table.  */
 +
-+void
-+linux_nat_iterate_watchpoint_lwps
-+  (linux_nat_iterate_watchpoint_lwps_ftype callback, void *callback_data)
++static int
++type_discardable_equal (const void *a, const void *b)
 +{
-+  int inferior_pid = ptid_get_pid (inferior_ptid);
-+  struct inferior *inf = current_inferior ();
++  const struct type *left = a;
++  const struct type *right = b;
 +
-+  if (inf->pid == inferior_pid)
-+    {
-+      /* Iterate all the threads of the current inferior.  Without specifying
-+       INFERIOR_PID it would iterate all threads of all inferiors, which is
-+       inappropriate for watchpoints.  */
++  return TYPE_MAIN_TYPE (left) == TYPE_MAIN_TYPE (right);
++}
 +
-+      iterate_over_lwps (pid_to_ptid (inferior_pid), callback, callback_data);
-+    }
-+  else
-+    {
-+      /* Detaching a new child PID temporarily present in INFERIOR_PID.  */
++/* A helper for type_mark_used.  */
 +
-+      struct lwp_info *child_lp;
-+      struct cleanup *old_chain;
-+      pid_t child_pid = GET_PID (inferior_ptid);
-+      ptid_t child_ptid = ptid_build (child_pid, child_pid, 0);
++static int
++type_mark_used_crawl (struct type *type, void *unused)
++{
++  if (!TYPE_DISCARDABLE (type))
++    return 0;
 +
-+      gdb_assert (!is_lwp (inferior_ptid));
-+      gdb_assert (find_lwp_pid (child_ptid) == NULL);
-+      child_lp = add_lwp (child_ptid);
-+      child_lp->stopped = 1;
-+      child_lp->last_resume_kind = resume_stop;
-+      old_chain = make_cleanup (delete_lwp_cleanup, child_lp);
++  if (TYPE_DISCARDABLE_AGE (type) == type_discardable_age_current)
++    return 0;
 +
-+      callback (child_lp, callback_data);
++  TYPE_DISCARDABLE_AGE (type) = type_discardable_age_current;
 +
-+      do_cleanups (old_chain);
-+    }
++  /* Continue the traversal.  */
++  return 1;
 +}
 +
- /* Update our internal state when changing from one checkpoint to
-    another indicated by NEW_PTID.  We can only switch single-threaded
-    applications, so we only create one new LWP, and the previous list
-diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
-index d9dc71b..6217370 100644
---- a/gdb/linux-nat.h
-+++ b/gdb/linux-nat.h
-@@ -158,6 +158,12 @@ struct lwp_info *iterate_over_lwps (ptid_t filter,
-                                                    void *), 
-                                   void *data);
-+typedef int (*linux_nat_iterate_watchpoint_lwps_ftype) (struct lwp_info *lwp,
-+                                                      void *arg);
++/* Mark TYPE and its connected types as used in this free_all_types pass.  */
 +
-+extern void linux_nat_iterate_watchpoint_lwps
-+  (linux_nat_iterate_watchpoint_lwps_ftype callback, void *callback_data);
++void
++type_mark_used (struct type *type)
++{
++  if (type == NULL)
++    return;
 +
- /* Create a prototype generic GNU/Linux target.  The client can
-    override it with local methods.  */
- struct target_ops * linux_target (void);
-diff --git a/gdb/machoread.c b/gdb/machoread.c
-index 9fa97e1..d6f0f38 100644
---- a/gdb/machoread.c
-+++ b/gdb/machoread.c
-@@ -1032,6 +1032,7 @@ static const struct sym_fns macho_sym_fns = {
-   default_symfile_segments,   /* Get segment information from a file.  */
-   NULL,
-   macho_symfile_relocate,     /* Relocate a debug section.  */
-+  NULL,                               /* sym_get_probes */
-   &psym_functions
- };
-diff --git a/gdb/main.c b/gdb/main.c
-index 8b45c25..c7ea0df 100644
---- a/gdb/main.c
-+++ b/gdb/main.c
-@@ -37,6 +37,7 @@
++  if (!TYPE_DISCARDABLE (type))
++    return;
++
++  main_type_crawl (type, type_mark_used_crawl, NULL);
++}
++
++/* A traverse callback for type_discardable_table which removes any
++   type_discardable whose reference count is now zero (unused link).  */
++
++static int
++type_discardable_remove (void **slot, void *unused)
++{
++  struct type *type = *slot;
++
++  gdb_assert (TYPE_DISCARDABLE (type));
++
++  if (TYPE_DISCARDABLE_AGE (type) != type_discardable_age_current)
++    {
++      delete_type_chain (type);
++
++      htab_clear_slot (type_discardable_table, slot);
++    }
++
++  return 1;
++}
++
++/* Free all the reclaimable types that have been allocated and that have
++   currently zero reference counter.
++
++   This function is called after each command, successful or not.  Use this
++   cleanup only in the GDB idle state as GDB only marks those types used by
++   globally tracked objects (with no autovariable references tracking).  */
++
++void
++free_all_types (void)
++{
++  /* Mark a new pass.  As GDB checks all the entries were visited after each
++     pass there cannot be any stale entries already containing the changed
++     value.  */
++  type_discardable_age_current ^= 1;
++
++  observer_notify_mark_used ();
++
++  htab_traverse (type_discardable_table, type_discardable_remove, NULL);
++}
++#endif
  
- #include "interps.h"
- #include "main.h"
-+#include "python/python.h"
- #include "source.h"
- #include "cli/cli-cmds.h"
- #include "python/python.h"
-@@ -264,6 +265,8 @@ captured_main (void *data)
-   char *cdarg = NULL;
-   char *ttyarg = NULL;
+ /* Helper functions to initialize architecture-specific types.  */
  
-+  int python_script = 0;
+@@ -4042,6 +4609,13 @@ void
+ _initialize_gdbtypes (void)
+ {
+   gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init);
 +
-   /* These are static so that we can take their address in an
-      initializer.  */
-   static int print_help;
-@@ -457,10 +460,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'},
++#if 0
++  type_discardable_table = htab_create_alloc (20, type_discardable_hash,
++                                           type_discardable_equal, NULL,
++                                           xcalloc, xfree);
 +#endif
-       {0, no_argument, 0, 0}
-     };
++
+   objfile_type_data = register_objfile_data ();
  
--    while (1)
-+    while (!python_script)
-       {
-       int option_index;
+   add_setshow_zinteger_cmd ("overload", no_class, &overload_debug,
+diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
+index 17bfbc5..72e9cc5 100644
+--- a/gdb/gdbtypes.h
++++ b/gdb/gdbtypes.h
+@@ -228,6 +228,11 @@ enum type_instance_flag_value
  
-@@ -478,6 +485,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;
-@@ -673,7 +683,31 @@ captured_main (void *data)
+ #define TYPE_TARGET_STUB(t)   (TYPE_MAIN_TYPE (t)->flag_target_stub)
  
-   /* 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);
-+      }
++/* Type needs to be evaluated on each CHECK_TYPEDEF and its results must not be
++   sticky.  */
 +
-+      /* 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
-@@ -922,7 +956,8 @@ captured_main (void *data)
++#define TYPE_DYNAMIC(t)               (TYPE_MAIN_TYPE (t)->flag_dynamic)
++
+ /* Static type.  If this is set, the corresponding type had 
+    a static modifier.
+    Note: This may be unnecessary, since static data members
+@@ -311,6 +316,50 @@ enum type_instance_flag_value
  
-   /* Read in the old history after all the command files have been
-      read.  */
--  init_history ();
-+  if (!python_script)
-+    init_history ();
+ #define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum)
  
-   if (batch_flag)
-     {
-@@ -933,13 +968,25 @@ captured_main (void *data)
-   /* Show time and/or space usage.  */
-   do_cleanups (pre_stat_chain);
++#if 0
++/* Define this type as being reclaimable during free_all_types.  Type is
++   required to be have TYPE_OBJFILE set to NULL.  Setting this flag requires
++   initializing TYPE_DISCARDABLE_AGE, see alloc_type_discardable.  */
++
++#define TYPE_DISCARDABLE(t)   (TYPE_MAIN_TYPE (t)->flag_discardable)
++
++/* Marker this type has been visited by the type_mark_used by this
++   mark-and-sweep types garbage collecting pass.  Current pass is represented
++   by TYPE_DISCARDABLE_AGE_CURRENT.  */
++
++#define TYPE_DISCARDABLE_AGE(t)       (TYPE_MAIN_TYPE (t)->flag_discardable_age)
++#endif
++
++/* Is HIGH_BOUND a low-bound relative count (1) or the high bound itself (0)?  */
++
++#define TYPE_RANGE_HIGH_BOUND_IS_COUNT(range_type) \
++  (TYPE_MAIN_TYPE (range_type)->flag_range_high_bound_is_count)
++
++/* Not allocated.  TYPE_ALLOCATED(t) must be NULL in such case.  If this flag
++   is unset and TYPE_ALLOCATED(t) is NULL then the type is allocated.  If this
++   flag is unset and TYPE_ALLOCATED(t) is not NULL then its DWARF block
++   determines the actual allocation state.  */
++
++#define TYPE_NOT_ALLOCATED(t) (TYPE_MAIN_TYPE (t)->flag_not_allocated)
++
++/* Not associated.  TYPE_ASSOCIATED(t) must be NULL in such case.  If this flag
++   is unset and TYPE_ASSOCIATED(t) is NULL then the type is associated.  If
++   this flag is unset and TYPE_ASSOCIATED(t) is not NULL then its DWARF block
++   determines the actual association state.  */
++
++#define TYPE_NOT_ASSOCIATED(t)        (TYPE_MAIN_TYPE (t)->flag_not_associated)
++
++/* Address of the actual data as for DW_AT_data_location.  Its dwarf block must
++   not be evaluated unless both TYPE_NOT_ALLOCATED and TYPE_NOT_ASSOCIATED are
++   false.  If TYPE_DATA_LOCATION_IS_ADDR set then TYPE_DATA_LOCATION_ADDR value
++   is the actual data address value.  If unset and
++   TYPE_DATA_LOCATION_DWARF_BLOCK is NULL then the value is the normal
++   value_raw_address.  If unset and TYPE_DATA_LOCATION_DWARF_BLOCK is not NULL
++   then its DWARF block determines the actual data address.  */
++
++#define TYPE_DATA_LOCATION_IS_ADDR(t) \
++  (TYPE_MAIN_TYPE (t)->flag_data_location_is_addr)
++
+ /* Constant type.  If this is set, the corresponding type has a
+    const modifier.  */
  
--  /* 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
+@@ -421,6 +470,15 @@ struct main_type
+   /* True if this type was declared with "class" rather than
+      "struct".  */
+   unsigned int flag_declared_class : 1;
++#if 0
++  unsigned int flag_discardable : 1;
++  unsigned int flag_discardable_age : 1;
 +#endif
++  unsigned int flag_dynamic : 1;
++  unsigned int flag_range_high_bound_is_count : 1;
++  unsigned int flag_not_allocated : 1;
++  unsigned int flag_not_associated : 1;
++  unsigned int flag_data_location_is_addr : 1;
+   /* True if this is an enum type with disjoint values.  This affects
+      how the enum is printed.  */
+@@ -501,6 +559,20 @@ struct main_type
+   struct type *target_type;
++  /* For DW_AT_data_location.  */
++  union
 +    {
-+      /* 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)
++      struct dwarf2_locexpr_baton *dwarf_block;
++      CORE_ADDR addr;
++    }
++  data_location;
++
++  /* For DW_AT_allocated.  */
++  struct dwarf2_locexpr_baton *allocated;
++
++  /* For DW_AT_associated.  */
++  struct dwarf2_locexpr_baton *associated;
++
+   /* For structure and union types, a description of each field.
+      For set and pascal array types, there is one "field",
+      whose type is the domain type of the set or array.
+@@ -583,13 +655,34 @@ struct main_type
+     struct range_bounds
+     {
++      struct
 +      {
-+        catch_errors (captured_command_loop, 0, "", RETURN_MASK_ALL);
-+      }
-     }
-   /* No exit -- exit is through quit_command.  */
- }
-@@ -971,7 +1018,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 (_("\
-@@ -1009,7 +1061,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/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
-index 4de7392..fb0b550 100644
---- a/gdb/mi/mi-cmd-var.c
-+++ b/gdb/mi/mi-cmd-var.c
-@@ -721,7 +721,6 @@ mi_cmd_var_update (char *command, char **argv, int argc)
-     }
-   else
-     {
--      /* Get varobj handle, if a valid var obj name was specified */
-       struct varobj *var = varobj_get_handle (name);
-       varobj_update_one (var, print_values, 1 /* explicit */);
-diff --git a/gdb/mipsread.c b/gdb/mipsread.c
-index 5790730..23ceece 100644
---- a/gdb/mipsread.c
-+++ b/gdb/mipsread.c
-@@ -401,6 +401,7 @@ static const struct sym_fns ecoff_sym_fns =
-   default_symfile_segments,   /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  NULL,                               /* sym_probe_fns */
-   &psym_functions
- };
++        union
++          {
++            LONGEST constant;
++            struct dwarf2_locexpr_baton *dwarf_block;
++            struct
++              {
++                struct dwarf2_loclist_baton *loclist;
++                struct type *type;
++              }
++            dwarf_loclist;
++          }
++        u;
++        enum range_bound_kind
++          {
++            RANGE_BOUND_KIND_CONSTANT,
++            RANGE_BOUND_KIND_DWARF_BLOCK,
++            RANGE_BOUND_KIND_DWARF_LOCLIST
++          }
++        kind;
++      }
+       /* Low bound of range.  */
+-
+-      LONGEST low;
+-
++      low,
+       /* High bound of range.  */
+-
+-      LONGEST high;
++      high,
++      /* Byte stride of range.  */
++      byte_stride;
  
-diff --git a/gdb/objfiles.c b/gdb/objfiles.c
-index 1cf5aee..d1640ef 100644
---- a/gdb/objfiles.c
-+++ b/gdb/objfiles.c
-@@ -811,6 +811,11 @@ objfile_relocate1 (struct objfile *objfile,
-                               obj_section_addr (s));
-     }
+       /* Flags indicating whether the values of low and high are
+          valid.  When true, the respective range value is
+@@ -1054,9 +1147,9 @@ extern void allocate_gnat_aux_type (struct type *);
+ #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
+ #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
+ #define TYPE_CHAIN(thistype) (thistype)->chain
+-/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
+-   But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
+-   so you only have to call check_typedef once.  Since allocate_value
++/* Note that if thistype is a TYPEDEF, ARRAY or STRING type, you have to call
++   check_typedef.  But check_typedef does set the TYPE_LENGTH of the TYPEDEF
++   type, so you only have to call check_typedef once.  Since allocate_value
+    calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe.  */
+ #define TYPE_LENGTH(thistype) (thistype)->length
+ /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real
+@@ -1064,11 +1157,16 @@ extern void allocate_gnat_aux_type (struct type *);
+ #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
+ #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
+ #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
++#define TYPE_DATA_LOCATION_DWARF_BLOCK(thistype) TYPE_MAIN_TYPE (thistype)->data_location.dwarf_block
++#define TYPE_DATA_LOCATION_ADDR(thistype) TYPE_MAIN_TYPE (thistype)->data_location.addr
++#define TYPE_ALLOCATED(thistype) TYPE_MAIN_TYPE (thistype)->allocated
++#define TYPE_ASSOCIATED(thistype) TYPE_MAIN_TYPE (thistype)->associated
+ #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
+ #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds
+-#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low
+-#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high
++#define TYPE_LOW_BOUND(range_type) TYPE_RANGE_DATA(range_type)->low.u.constant
++#define TYPE_HIGH_BOUND(range_type) TYPE_RANGE_DATA(range_type)->high.u.constant
++#define TYPE_BYTE_STRIDE(range_type) TYPE_RANGE_DATA(range_type)->byte_stride.u.constant
+ #define TYPE_LOW_BOUND_UNDEFINED(range_type) \
+    TYPE_RANGE_DATA(range_type)->low_undefined
+ #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \
+@@ -1085,7 +1183,14 @@ extern void allocate_gnat_aux_type (struct type *);
+    (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
  
-+  /* Relocating SystemTap probes.  */
-+  if (objfile->sf && objfile->sf->sym_probe_fns)
-+    objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
-+                                                  new_offsets, delta);
+ #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \
+-   (TYPE_LOW_BOUND(TYPE_INDEX_TYPE((arraytype))))
++  TYPE_LOW_BOUND (TYPE_INDEX_TYPE (arraytype))
 +
-   /* Data changed.  */
-   return 1;
- }
-diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
-index c5bef8a..fc3beb3 100644
---- a/gdb/p-valprint.c
-+++ b/gdb/p-valprint.c
-@@ -39,6 +39,7 @@
- #include "cp-abi.h"
- #include "cp-support.h"
- #include "exceptions.h"
-+#include "dwarf2loc.h"
\f
++/* TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) with a fallback to the
++   element size if no specific stride value is known.  */
++#define TYPE_ARRAY_BYTE_STRIDE_VALUE(arraytype)               \
++  (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)) == 0        \
++   ? TYPE_LENGTH (TYPE_TARGET_TYPE (arraytype))               \
++   : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (arraytype)))
  
- /* See val_print for a description of the various parameters of this
-@@ -63,8 +64,31 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
-   struct type *char_type;
-   LONGEST val;
-   CORE_ADDR addr;
-+  struct cleanup *back_to;
-+  struct type *saved_type = type;
-+  CORE_ADDR saved_address = address;
-+  
-+  back_to = make_cleanup (null_cleanup, 0);
-+  address += embedded_offset;
-+  type = object_address_get_data (type, &address);
-+  if (type == NULL)
-+    {
-+      fputs_filtered (object_address_data_not_valid (saved_type), stream);
-+      gdb_flush (stream);
-+      do_cleanups (back_to);
-+      return 0;
-+    }
-+  if (address != saved_address + embedded_offset)
-+    {
-+      size_t length = TYPE_LENGTH (type);
+ /* C++ */
  
--  CHECK_TYPEDEF (type);
-+      valaddr = xmalloc (length);
-+      make_cleanup (xfree, (gdb_byte *) valaddr);
-+      read_memory (address, (gdb_byte *) valaddr, length);
-+      embedded_offset = 0;
-+    }
-+  else
-+    address -= embedded_offset;
-   switch (TYPE_CODE (type))
-     {
-     case TYPE_CODE_ARRAY:
-@@ -120,8 +144,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
-               {
-                 i = 0;
-               }
--            val_print_array_elements (type, valaddr, embedded_offset,
--                                      address, stream, recurse,
-+            val_print_array_elements (saved_type, valaddr, embedded_offset,
-+                                      saved_address, stream, recurse,
-                                       original_value, options, i);
-             fprintf_filtered (stream, "}");
-           }
-@@ -160,6 +184,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
-         /* Try to print what function it points to.  */
-         print_address_demangle (gdbarch, addr, stream, demangle);
-         /* Return value is irrelevant except for string pointers.  */
-+        do_cleanups (back_to);
-         return (0);
-       }
+@@ -1531,6 +1636,18 @@ extern struct type *create_array_type (struct type *, struct type *,
+                                      struct type *);
+ extern struct type *lookup_array_range_type (struct type *, int, int);
  
-@@ -251,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.  */
-+      do_cleanups (back_to);
-       return i;
++extern CORE_ADDR type_range_any_field_internal (struct type *range_type,
++                                              int fieldno);
++
++extern int type_range_high_bound_internal (struct type *range_type);
++
++extern int type_range_count_bound_internal (struct type *range_type);
++
++extern CORE_ADDR type_range_byte_stride_internal (struct type *range_type,
++                                                struct type *element_type);
++
++extern void finalize_type (struct type *type);
++
+ extern struct type *create_string_type (struct type *, struct type *,
+                                       struct type *);
+ extern struct type *lookup_string_range_type (struct type *, int, int);
+@@ -1576,6 +1693,10 @@ extern int is_public_ancestor (struct type *, struct type *);
  
-       break;
-@@ -576,6 +602,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
-            TYPE_CODE (type));
-     }
-   gdb_flush (stream);
-+  do_cleanups (back_to);
-   return (0);
- }
\f
-diff --git a/gdb/parse.c b/gdb/parse.c
-index 32a3bd6..9eaf2de 100644
---- a/gdb/parse.c
-+++ b/gdb/parse.c
-@@ -113,8 +113,6 @@ show_parserdebug (struct ui_file *file, int from_tty,
+ extern int is_unique_ancestor (struct type *, struct value *);
  
- static void free_funcalls (void *ignore);
++#if 0
++extern void type_mark_used (struct type *type);
++#endif
++
+ /* Overload resolution */
  
--static int prefixify_expression (struct expression *);
--
- static int prefixify_subexp (struct expression *, struct expression *, int,
-                            int);
+ #define LENGTH_MATCH(bv) ((bv)->rank[0])
+@@ -1651,10 +1772,13 @@ extern void maintenance_print_type (char *, int);
  
-@@ -188,7 +186,7 @@ free_funcalls (void *ignore)
-    the expout array.  LANG is the language used to parse the expression.
-    And GDBARCH is the gdbarch to use during parsing.  */
+ extern htab_t create_copied_types_hash (struct objfile *objfile);
  
--static void
-+void
- initialize_expout (int initial_size, const struct language_defn *lang,
-                  struct gdbarch *gdbarch)
- {
-@@ -204,7 +202,7 @@ initialize_expout (int initial_size, const struct language_defn *lang,
-    It is generally used when the parser has just been parsed and
-    created.  */
+-extern struct type *copy_type_recursive (struct objfile *objfile,
+-                                       struct type *type,
++extern struct type *copy_type_recursive (struct type *type,
+                                        htab_t copied_types);
  
--static void
-+void
- reallocate_expout (void)
- {
-   /* Record the actual number of expression elements, and then
-@@ -811,7 +809,7 @@ copy_name (struct stoken token)
-    return the index of the subexpression which is the left-hand-side
-    of the struct operation at EXPOUT_LAST_STRUCT.  */
+ extern struct type *copy_type (const struct type *type);
  
--static int
-+int
- prefixify_expression (struct expression *expr)
++#if 0
++extern void free_all_types (void);
++#endif
++
+ #endif /* GDBTYPES_H */
+diff --git a/gdb/jit.c b/gdb/jit.c
+index 568d17b..cdd9f49 100644
+--- a/gdb/jit.c
++++ b/gdb/jit.c
+@@ -38,6 +38,7 @@
+ #include "gdb-dlfcn.h"
+ #include "gdb_stat.h"
+ #include "exceptions.h"
++#include "gdb_bfd.h"
+ static const char *jit_reader_dir = NULL;
+@@ -132,17 +133,16 @@ mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
+ static struct bfd *
+ bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target)
  {
-   int len = sizeof (struct expression) + EXP_ELEM_TO_BYTES (expr->nelts);
-@@ -1529,6 +1527,7 @@ parser_fprintf (FILE *x, const char *y, ...)
+-  const char *filename = xstrdup ("<in-memory>");
+   struct target_buffer *buffer = xmalloc (sizeof (struct target_buffer));
+   buffer->base = addr;
+   buffer->size = size;
+-  return bfd_openr_iovec (filename, target,
+-                          mem_bfd_iovec_open,
+-                          buffer,
+-                          mem_bfd_iovec_pread,
+-                          mem_bfd_iovec_close,
+-                          mem_bfd_iovec_stat);
++  return gdb_bfd_openr_iovec ("<in-memory>", target,
++                            mem_bfd_iovec_open,
++                            buffer,
++                            mem_bfd_iovec_pread,
++                            mem_bfd_iovec_close,
++                            mem_bfd_iovec_stat);
+ }
  
- int
- operator_check_standard (struct expression *exp, int pos,
-+                       int (*type_func) (struct type *type, void *data),
-                        int (*objfile_func) (struct objfile *objfile,
-                                             void *data),
-                        void *data)
-@@ -1570,7 +1569,7 @@ operator_check_standard (struct expression *exp, int pos,
-           struct type *type = elts[pos + 2 + arg].type;
-           struct objfile *objfile = TYPE_OBJFILE (type);
+ /* One reader that has been loaded successfully, and can potentially be used to
+@@ -868,7 +868,7 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
+     {
+       printf_unfiltered (_("\
+ JITed symbol file is not an object file, ignoring it.\n"));
+-      bfd_close (nbfd);
++      gdb_bfd_unref (nbfd);
+       return;
+     }
  
--          if (objfile && (*objfile_func) (objfile, data))
-+          if (objfile && objfile_func && (*objfile_func) (objfile, data))
-             return 1;
-         }
+@@ -896,7 +896,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
+         ++i;
        }
-@@ -1588,7 +1587,8 @@ operator_check_standard (struct expression *exp, int pos,
-       /* Check objfile where the variable itself is placed.
-          SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
--      if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
-+      if (objfile_func
-+          && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
-         return 1;
  
-       /* Check objfile where is placed the code touching the variable.  */
-@@ -1601,24 +1601,27 @@ operator_check_standard (struct expression *exp, int pos,
+-  /* This call takes ownership of NBFD.  It does not take ownership of SAI.  */
++  /* This call does not take ownership of SAI.  */
++  make_cleanup_bfd_unref (nbfd);
+   objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL);
+   do_cleanups (old_cleanups);
+diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
+index 76e4bf1..9a2f5aa 100644
+--- a/gdb/m32r-rom.c
++++ b/gdb/m32r-rom.c
+@@ -40,6 +40,7 @@
+ #include "inferior.h"
+ #include <ctype.h>
+ #include "regcache.h"
++#include "gdb_bfd.h"
+ /*
+  * All this stuff just to get my host computer's IP address!
+@@ -124,13 +125,15 @@ m32r_load (char *filename, int from_tty)
+   bfd *abfd;
+   unsigned int data_count = 0;
+   struct timeval start_time, end_time;
++  struct cleanup *cleanup;
  
-   /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL.  */
+   if (filename == NULL || filename[0] == 0)
+     filename = get_exec_file (1);
+-  abfd = bfd_openr (filename, 0);
++  abfd = gdb_bfd_openr (filename, 0);
+   if (!abfd)
+     error (_("Unable to open file %s."), filename);
++  cleanup = make_cleanup_bfd_unref (abfd);
+   if (bfd_check_format (abfd, bfd_object) == 0)
+     error (_("File is not an object file."));
+   gettimeofday (&start_time, NULL);
+@@ -188,6 +191,7 @@ m32r_load (char *filename, int from_tty)
+      confused...  */
+   clear_symtab_users (0);
++  do_cleanups (cleanup);
+ }
  
--  if (type && TYPE_OBJFILE (type)
-+  if (type && type_func && (*type_func) (type, data))
-+    return 1;
-+  if (type && TYPE_OBJFILE (type) && objfile_func
-       && (*objfile_func) (TYPE_OBJFILE (type), data))
-     return 1;
--  if (objfile && (*objfile_func) (objfile, data))
-+  if (objfile && objfile_func && (*objfile_func) (objfile, data))
-     return 1;
+ static void
+@@ -434,6 +438,7 @@ m32r_upload_command (char *args, int from_tty)
+   char buf[1024];
+   struct hostent *hostent;
+   struct in_addr inet_addr;
++  struct cleanup *cleanup;
  
-   return 0;
+   /* First check to see if there's an ethernet port!  */
+   monitor_printf ("ust\r");
+@@ -524,7 +529,8 @@ m32r_upload_command (char *args, int from_tty)
+     printf_filtered (" -- Ethernet load complete.\n");
+   gettimeofday (&end_time, NULL);
+-  abfd = bfd_openr (args, 0);
++  abfd = gdb_bfd_openr (args, 0);
++  cleanup = make_cleanup_bfd_unref (abfd);
+   if (abfd != NULL)
+     {         /* Download is done -- print section statistics.  */
+       if (bfd_check_format (abfd, bfd_object) == 0)
+@@ -565,6 +571,7 @@ m32r_upload_command (char *args, int from_tty)
+      confused...  */
+   clear_symtab_users (0);
++  do_cleanups (cleanup);
  }
  
--/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP.
--   The functions are never called with NULL OBJFILE.  Functions get passed an
--   arbitrary caller supplied DATA pointer.  If any of the functions returns
--   non-zero value then (any other) non-zero value is immediately returned to
--   the caller.  Otherwise zero is returned after iterating through whole EXP.
--   */
-+/* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being
-+   referenced by EXP.  The functions are never called with NULL TYPE or NULL
-+   OBJFILE.  Functions get passed an arbitrary caller supplied DATA pointer.
-+   If any of the functions returns non-zero value then (any other) non-zero
-+   value is immediately returned to the caller.  Otherwise zero is returned
-+   after iterating through whole EXP.  */
- static int
- exp_iterate (struct expression *exp,
-+           int (*type_func) (struct type *type, void *data),
-            int (*objfile_func) (struct objfile *objfile, void *data),
-            void *data)
- {
-@@ -1633,7 +1636,9 @@ exp_iterate (struct expression *exp,
-       pos = endpos - oplen;
-       if (exp->language_defn->la_exp_desc->operator_check (exp, pos,
--                                                         objfile_func, data))
-+                                                         type_func,
-+                                                         objfile_func,
-+                                                         data))
-       return 1;
-       endpos = pos;
-@@ -1664,8 +1669,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile)
- {
-   gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
--  return exp_iterate (exp, exp_uses_objfile_iter, objfile);
-+  return exp_iterate (exp, NULL, exp_uses_objfile_iter, objfile);
-+}
-+
-+/* Helper for exp_types_mark_used.  */
-+
-+#if 0
-+static int
-+exp_types_mark_used_iter (struct type *type, void *unused)
-+{
-+  type_mark_used (type);
-+
-+  /* Continue the traversal.  */
-+  return 0;
-+}
-+
-+/* Call type_mark_used for any type contained in EXP.  */
-+
-+void
-+exp_types_mark_used (struct expression *exp)
-+{
-+  exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL);
- }
-+#endif
- void
- _initialize_parse (void)
-diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
-index 16b40ac..c3813ff 100644
---- a/gdb/parser-defs.h
-+++ b/gdb/parser-defs.h
-@@ -130,6 +130,24 @@ union type_stack_elt
- extern union type_stack_elt *type_stack;
- extern int type_stack_depth, type_stack_size;
-+/* Allocate and initialize `expout' and its related variables `expout_size'
-+   and `expout_ptr'.
-+
-+   The first argument is the initial size to be used for xmalloc.  The second
-+   argument is the language related to the expression.  The third argument is
-+   corresponding gdbarch.  */
-+
-+extern void initialize_expout (int, const struct language_defn *,
-+                             struct gdbarch *);
-+
-+/* Reallocate `expout' in order to free excessive elements that might have
-+   been created during the parsing.  Set the number of elements
-+   accordingly.  */
-+
-+extern void reallocate_expout (void);
-+
-+extern int prefixify_expression (struct expression *expr);
-+
- extern void write_exp_elt_opcode (enum exp_opcode);
- extern void write_exp_elt_sym (struct symbol *);
-@@ -191,6 +209,8 @@ extern void operator_length_standard (const struct expression *, int, int *,
-                                     int *);
- extern int operator_check_standard (struct expression *exp, int pos,
-+                                  int (*type_func) (struct type *type,
-+                                                    void *data),
-                                   int (*objfile_func)
-                                     (struct objfile *objfile, void *data),
-                                   void *data);
-@@ -277,6 +297,7 @@ struct exp_descriptor
-        value should be immediately returned to the caller.  Otherwise zero
-        should be returned.  */
-     int (*operator_check) (struct expression *exp, int pos,
-+                         int (*type_func) (struct type *type, void *data),
-                          int (*objfile_func) (struct objfile *objfile,
-                                               void *data),
-                          void *data);
-@@ -315,4 +336,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3);
- extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
+ /* Provide a prototype to silence -Wmissing-prototypes.  */
+diff --git a/gdb/machoread.c b/gdb/machoread.c
+index 22530ab..0d7578a 100644
+--- a/gdb/machoread.c
++++ b/gdb/machoread.c
+@@ -454,6 +454,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
+   asymbol **symp;
+   struct bfd_hash_table table;
+   int nbr_sections;
++  struct cleanup *cleanup;
  
-+extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
-+
-+#if 0
-+extern void exp_types_mark_used (struct expression *exp);
-+#endif
-+
- #endif /* PARSER_DEFS_H */
-diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
-index af80919..3077c4b 100644
---- a/gdb/ppc-linux-nat.c
-+++ b/gdb/ppc-linux-nat.c
-@@ -1468,14 +1468,13 @@ ppc_linux_can_use_hw_breakpoint (int type, int cnt, int ot)
-   if (!have_ptrace_booke_interface ())
+   /* Per section flag to mark which section have been rebased.  */
+   unsigned char *sections_rebased;
+@@ -466,14 +467,14 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
      {
-       int tid;
--      ptid_t ptid = inferior_ptid;
-       /* We need to know whether ptrace supports PTRACE_SET_DEBUGREG
-        and whether the target has DABR.  If either answer is no, the
-        ptrace call will return -1.  Fail in that case.  */
--      tid = TIDGET (ptid);
-+      tid = TIDGET (inferior_ptid);
-       if (tid == 0)
--      tid = PIDGET (ptid);
-+      tid = PIDGET (inferior_ptid);
-       if (ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0) == -1)
-       return 0;
-@@ -1566,8 +1565,9 @@ booke_find_thread_points_by_tid (int tid, int alloc_new)
- /* This function is a generic wrapper that is responsible for inserting a
-    *point (i.e., calling `ptrace' in order to issue the request to the
-    kernel) and registering it internally in GDB.  */
-+
- static void
--booke_insert_point (struct ppc_hw_breakpoint *b, int tid)
-+booke_insert_point (struct lwp_info *lp, struct ppc_hw_breakpoint *b)
- {
-   int i;
-   long slot;
-@@ -1580,12 +1580,12 @@ booke_insert_point (struct ppc_hw_breakpoint *b, int tid)
-   memcpy (p, b, sizeof (struct ppc_hw_breakpoint));
-   errno = 0;
--  slot = ptrace (PPC_PTRACE_SETHWDEBUG, tid, 0, p);
-+  slot = ptrace (PPC_PTRACE_SETHWDEBUG, TIDGET (lp->ptid), 0, p);
-   if (slot < 0)
-     perror_with_name (_("Unexpected error setting breakpoint or watchpoint"));
-   /* Everything went fine, so we have to register this *point.  */
--  t = booke_find_thread_points_by_tid (tid, 1);
-+  t = booke_find_thread_points_by_tid (TIDGET (lp->ptid), 1);
-   gdb_assert (t != NULL);
-   hw_breaks = t->hw_breaks;
-@@ -1603,17 +1603,33 @@ booke_insert_point (struct ppc_hw_breakpoint *b, int tid)
-   discard_cleanups (c);
- }
--/* This function is a generic wrapper that is responsible for removing a
--   *point (i.e., calling `ptrace' in order to issue the request to the
--   kernel), and unregistering it internally at GDB.  */
--static void
--booke_remove_point (struct ppc_hw_breakpoint *b, int tid)
-+/* Callback for linux_nat_iterate_watchpoint_lwps
-+   calling booke_insert_point.  */
-+
-+static int
-+booke_insert_point_callback (struct lwp_info *lp, void *b_voidp)
- {
-+  struct ppc_hw_breakpoint *b = b_voidp;
-+
-+  booke_insert_point (lp, b);
-+
-+  /* Continue the traversal.  */
-+  return 0;
-+}
-+
-+/* This function is a callback for linux_nat_iterate_watchpoint_lwps that is
-+   responsible for removing a *point (i.e., calling `ptrace' in order to issue
-+   the request to the kernel), and unregistering it internally at GDB.  */
-+
-+static int
-+booke_remove_point_callback (struct lwp_info *lp, void *b_voidp)
-+{
-+  struct ppc_hw_breakpoint *b = b_voidp;
-   int i;
-   struct hw_break_tuple *hw_breaks;
-   struct thread_points *t;
--  t = booke_find_thread_points_by_tid (tid, 0);
-+  t = booke_find_thread_points_by_tid (TIDGET (lp->ptid), 0);
-   gdb_assert (t != NULL);
-   hw_breaks = t->hw_breaks;
-@@ -1627,13 +1643,17 @@ booke_remove_point (struct ppc_hw_breakpoint *b, int tid)
-      breakpoints/watchpoints as "one-shot", that is, they are automatically
-      deleted when hit.  */
-   errno = 0;
--  if (ptrace (PPC_PTRACE_DELHWDEBUG, tid, 0, hw_breaks[i].slot) < 0)
-+  if (ptrace (PPC_PTRACE_DELHWDEBUG, TIDGET (lp->ptid), 0, hw_breaks[i].slot)
-+      < 0)
-     if (errno != ENOENT)
-       perror_with_name (_("Unexpected error deleting "
-                         "breakpoint or watchpoint"));
-   xfree (hw_breaks[i].hw_break);
-   hw_breaks[i].hw_break = NULL;
-+
-+  /* Continue the traversal.  */
-+  return 0;
- }
- /* Return the number of registers needed for a ranged breakpoint.  */
-@@ -1653,7 +1673,6 @@ static int
- ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
-                                 struct bp_target_info *bp_tgt)
- {
--  struct lwp_info *lp;
-   struct ppc_hw_breakpoint p;
-   if (!have_ptrace_booke_interface ())
-@@ -1679,8 +1698,7 @@ ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
-       p.addr2 = 0;
+       warning (_("`%s': can't read symbols: %s."), oso->name,
+                bfd_errmsg (bfd_get_error ()));
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
+       return;
      }
  
--  ALL_LWPS (lp)
--    booke_insert_point (&p, TIDGET (lp->ptid));
-+  linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p);
-   return 0;
- }
-@@ -1689,7 +1707,6 @@ static int
- ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
-                                 struct bp_target_info *bp_tgt)
- {
--  struct lwp_info *lp;
-   struct ppc_hw_breakpoint p;
-   if (!have_ptrace_booke_interface ())
-@@ -1715,8 +1732,7 @@ ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
-       p.addr2 = 0;
+   if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd))
+     {
+       warning (_("`%s': file time stamp mismatch."), oso->name);
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
+       return;
      }
  
--  ALL_LWPS (lp)
--    booke_remove_point (&p, TIDGET (lp->ptid));
-+  linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p);
-   return 0;
- }
-@@ -1745,7 +1761,6 @@ static int
- ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
-                                 CORE_ADDR mask, int rw)
- {
--  struct lwp_info *lp;
-   struct ppc_hw_breakpoint p;
+@@ -482,7 +483,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
+                               oso->nbr_syms))
+     {
+       warning (_("`%s': can't create hash table"), oso->name);
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
+       return;
+     }
  
-   gdb_assert (have_ptrace_booke_interface ());
-@@ -1758,8 +1773,7 @@ ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
-   p.addr2 = mask;
-   p.condition_value = 0;
+@@ -629,18 +630,15 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
  
--  ALL_LWPS (lp)
--    booke_insert_point (&p, TIDGET (lp->ptid));
-+  linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p);
+   bfd_hash_table_free (&table);
  
-   return 0;
+-  /* Make sure that the filename was malloc'ed.  The current filename comes
+-     either from an OSO symbol name or from an archive name.  Memory for both
+-     is not managed by gdb.  */
+-  abfd->filename = xstrdup (abfd->filename);
+-
+   /* We need to clear SYMFILE_MAINLINE to avoid interractive question
+      from symfile.c:symbol_file_add_with_addrs_or_offsets.  */
++  cleanup = make_cleanup_bfd_unref (abfd);
+   symbol_file_add_from_bfd
+     (abfd, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), NULL,
+      main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED
+                           | OBJF_READNOW | OBJF_USERLOADED),
+      main_objfile);
++  do_cleanups (cleanup);
  }
-@@ -1773,7 +1787,6 @@ static int
- ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
-                                 CORE_ADDR mask, int rw)
- {
--  struct lwp_info *lp;
-   struct ppc_hw_breakpoint p;
-   gdb_assert (have_ptrace_booke_interface ());
-@@ -1786,8 +1799,7 @@ ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
-   p.addr2 = mask;
-   p.condition_value = 0;
--  ALL_LWPS (lp)
--    booke_remove_point (&p, TIDGET (lp->ptid));
-+  linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p);
  
-   return 0;
- }
-@@ -1797,10 +1809,16 @@ static int
- can_use_watchpoint_cond_accel (void)
- {
-   struct thread_points *p;
--  int tid = TIDGET (inferior_ptid);
-   int cnt = booke_debug_info.num_condition_regs, i;
-   CORE_ADDR tmp_value;
+ /* Read symbols from the vector of oso files.  */
+@@ -651,6 +649,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+   int ix;
+   VEC (oso_el) *vec;
+   oso_el *oso;
++  struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
  
-+  /* Overload thread id onto process id.  */
-+  int tid = TIDGET (inferior_ptid);
-+
-+  /* No thread id, just use process id.  */
-+  if (tid == 0)
-+    tid = PIDGET (inferior_ptid);
-+
-   if (!have_ptrace_booke_interface () || cnt == 0)
-     return 0;
+   vec = oso_vector;
+   oso_vector = NULL;
+@@ -677,6 +676,8 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+         memcpy (archive_name, oso->name, pfx_len);
+         archive_name[pfx_len] = '\0';
++        make_cleanup (xfree, archive_name);
++
+           /* Compute number of oso for this archive.  */
+           for (last_ix = ix;
+                VEC_iterate (oso_el, vec, last_ix, oso2); last_ix++)
+@@ -686,7 +687,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+             }
+         /* Open the archive and check the format.  */
+-        archive_bfd = bfd_openr (archive_name, gnutarget);
++        archive_bfd = gdb_bfd_openr (archive_name, gnutarget);
+         if (archive_bfd == NULL)
+           {
+             warning (_("Could not open OSO archive file \"%s\""),
+@@ -698,17 +699,18 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+           {
+             warning (_("OSO archive file \"%s\" not an archive."),
+                      archive_name);
+-            bfd_close (archive_bfd);
++            gdb_bfd_unref (archive_bfd);
+               ix = last_ix;
+             continue;
+           }
+-        member_bfd = bfd_openr_next_archived_file (archive_bfd, NULL);
++
++        member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd, NULL);
+         if (member_bfd == NULL)
+           {
+             warning (_("Could not read archive members out of "
+                        "OSO archive \"%s\""), archive_name);
+-            bfd_close (archive_bfd);
++            gdb_bfd_unref (archive_bfd);
+               ix = last_ix;
+             continue;
+           }
+@@ -738,12 +740,12 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+                 }
+               prev = member_bfd;
+-            member_bfd = bfd_openr_next_archived_file
+-              (archive_bfd, member_bfd);
++            member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd,
++                                                           member_bfd);
+               /* Free previous member if not referenced by an oso.  */
+               if (ix2 >= last_ix)
+-                bfd_close (prev);
++                gdb_bfd_unref (prev);
+           }
+           for (ix2 = ix; ix2 < last_ix; ix2++)
+             {
+@@ -759,7 +761,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+       {
+           bfd *abfd;
+-        abfd = bfd_openr (oso->name, gnutarget);
++        abfd = gdb_bfd_openr (oso->name, gnutarget);
+         if (!abfd)
+             warning (_("`%s': can't open to read symbols: %s."), oso->name,
+                      bfd_errmsg (bfd_get_error ()));
+@@ -771,6 +773,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
+     }
  
-@@ -1999,6 +2017,22 @@ ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw,
-         && check_condition (addr, cond, &data_value, &len));
+   VEC_free (oso_el, vec);
++  do_cleanups (cleanup);
  }
  
-+/* Callback for linux_nat_iterate_watchpoint_lwps setting RETP_VOIDP by
-+   PTRACE_SET_DEBUGREG for LP.  */
-+
-+static int
-+set_saved_dabr_value_callback (struct lwp_info *lp, void *retp_voidp)
-+{
-+  int *retp = retp_voidp;
-+
-+  if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0, saved_dabr_value)
-+      < 0)
-+    *retp = -1;
-+
-+  /* Continue the traversal.  */
-+  return 0;
-+}
-+
- /* Set up P with the parameters necessary to request a watchpoint covering
-    LEN bytes starting at ADDR and if possible with condition expression COND
-    evaluated by hardware.  INSERT tells if we are creating a request for
-@@ -2054,7 +2088,6 @@ static int
- ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
-                            struct expression *cond)
- {
--  struct lwp_info *lp;
-   int ret = -1;
-   if (have_ptrace_booke_interface ())
-@@ -2063,8 +2096,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
-       create_watchpoint_request (&p, addr, len, rw, cond, 1);
--      ALL_LWPS (lp)
--      booke_insert_point (&p, TIDGET (lp->ptid));
-+      linux_nat_iterate_watchpoint_lwps (booke_insert_point_callback, &p);
-       ret = 0;
+ /* DSYM (debug symbols) files contain the debug info of an executable.
+@@ -808,20 +811,17 @@ macho_check_dsym (struct objfile *objfile)
+       warning (_("can't find UUID in %s"), objfile->name);
+       return NULL;
      }
-@@ -2107,12 +2139,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
-       saved_dabr_value = dabr_value;
--      ALL_LWPS (lp)
--      if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0,
--                  saved_dabr_value) < 0)
--        return -1;
--
-       ret = 0;
-+      linux_nat_iterate_watchpoint_lwps (set_saved_dabr_value_callback, &ret);
+-  dsym_filename = xstrdup (dsym_filename);
+-  dsym_bfd = bfd_openr (dsym_filename, gnutarget);
++  dsym_bfd = gdb_bfd_openr (dsym_filename, gnutarget);
+   if (dsym_bfd == NULL)
+     {
+       warning (_("can't open dsym file %s"), dsym_filename);
+-      xfree (dsym_filename);
+       return NULL;
      }
  
-   return ret;
-@@ -2122,7 +2150,6 @@ static int
- ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
-                            struct expression *cond)
- {
--  struct lwp_info *lp;
-   int ret = -1;
-   if (have_ptrace_booke_interface ())
-@@ -2131,20 +2158,16 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
-       create_watchpoint_request (&p, addr, len, rw, cond, 0);
--      ALL_LWPS (lp)
--      booke_remove_point (&p, TIDGET (lp->ptid));
-+      linux_nat_iterate_watchpoint_lwps (booke_remove_point_callback, &p);
-       ret = 0;
-     }
-   else
+   if (!bfd_check_format (dsym_bfd, bfd_object))
      {
-       saved_dabr_value = 0;
--      ALL_LWPS (lp)
--      if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0,
--                  saved_dabr_value) < 0)
--        return -1;
-       ret = 0;
-+      linux_nat_iterate_watchpoint_lwps (set_saved_dabr_value_callback, &ret);
+-      bfd_close (dsym_bfd);
++      gdb_bfd_unref (dsym_bfd);
+       warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ()));
+-      xfree (dsym_filename);
+       return NULL;
      }
  
-   return ret;
-@@ -2171,7 +2194,7 @@ ppc_linux_new_thread (struct lwp_info *lp)
-       /* Copy that thread's breakpoints and watchpoints to the new thread.  */
-       for (i = 0; i < max_slots_number; i++)
-       if (hw_breaks[i].hw_break)
--        booke_insert_point (hw_breaks[i].hw_break, tid);
-+        booke_insert_point (lp, hw_breaks[i].hw_break);
+@@ -829,16 +829,14 @@ macho_check_dsym (struct objfile *objfile)
+                                  BFD_MACH_O_LC_UUID, &dsym_uuid) == 0)
+     {
+       warning (_("can't find UUID in %s"), dsym_filename);
+-      bfd_close (dsym_bfd);
+-      xfree (dsym_filename);
++      gdb_bfd_unref (dsym_bfd);
+       return NULL;
      }
-   else
-     ptrace (PTRACE_SET_DEBUGREG, tid, 0, saved_dabr_value);
-@@ -2229,7 +2252,14 @@ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
-       /* The index (or slot) of the *point is passed in the si_errno field.  */
-       int slot = siginfo_p->si_errno;
--      t = booke_find_thread_points_by_tid (TIDGET (inferior_ptid), 0);
-+      /* Overload thread id onto process id.  */
-+      int tid = TIDGET (inferior_ptid);
-+
-+      /* No thread id, just use process id.  */
-+      if (tid == 0)
-+      tid = PIDGET (inferior_ptid);
-+
-+      t = booke_find_thread_points_by_tid (tid, 0);
-       /* Find out if this *point is a hardware breakpoint.
-        If so, we should return 0.  */
-diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
-index b6470fe..f871309 100644
---- a/gdb/ppc-linux-tdep.c
-+++ b/gdb/ppc-linux-tdep.c
-@@ -65,6 +65,14 @@
- #include "features/rs6000/powerpc-isa205-vsx64l.c"
- #include "features/rs6000/powerpc-e500l.c"
-+#include "stap-probe.h"
-+#include "ax.h"
-+#include "ax-gdb.h"
-+#include "cli/cli-utils.h"
-+#include "parser-defs.h"
-+#include "user-regs.h"
-+#include <ctype.h>
-+
- /* The syscall's XML filename for PPC and PPC64.  */
- #define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
- #define XML_SYSCALL_FILENAME_PPC64 "syscalls/ppc64-linux.xml"
-@@ -1192,6 +1200,65 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
+   if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid,
+               sizeof (main_uuid->command.uuid.uuid)))
+     {
+       warning (_("dsym file UUID doesn't match the one in %s"), objfile->name);
+-      bfd_close (dsym_bfd);
+-      xfree (dsym_filename);
++      gdb_bfd_unref (dsym_bfd);
+       return NULL;
      }
- }
+   return dsym_bfd;
+@@ -902,6 +900,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
+         int ix;
+         oso_el *oso;
+           struct bfd_section *asect, *dsect;
++        struct cleanup *cleanup;
+         if (mach_o_debug_level > 0)
+           printf_unfiltered (_("dsym file found\n"));
+@@ -922,7 +921,9 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
+             }
+         /* Add the dsym file as a separate file.  */
++        cleanup = make_cleanup_bfd_unref (dsym_bfd);
+           symbol_file_add_separate (dsym_bfd, symfile_flags, objfile);
++        do_cleanups (cleanup);
+         /* Don't try to read dwarf2 from main file or shared libraries.  */
+           return;
+diff --git a/gdb/main.c b/gdb/main.c
+index d075694..e4da3f1 100644
+--- a/gdb/main.c
++++ b/gdb/main.c
+@@ -37,6 +37,7 @@
  
-+static int
-+ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
-+{
-+  return (*s == 'i' /* Literal number.  */
-+        || (isdigit (*s) && s[1] == '('
-+            && isdigit (s[2])) /* Displacement.  */
-+        || (*s == '(' && isdigit (s[1])) /* Register indirection.  */
-+        || isdigit (*s)); /* Register value.  */
-+}
-+
-+static int
-+ppc_stap_parse_special_token (struct gdbarch *gdbarch,
-+                            struct stap_parse_info *p)
-+{
-+  if (isdigit (*p->arg))
-+    {
-+      /* This temporary pointer is needed because we have to do a lookahead.
-+        We could be dealing with a register displacement, and in such case
-+        we would not need to do anything.  */
-+      const char *s = p->arg;
-+      char *regname;
-+      int len;
-+      struct stoken str;
-+
-+      while (isdigit (*s))
-+      ++s;
-+
-+      if (*s == '(')
-+      /* It is a register displacement indeed.  Returning 0 means we are
-+         deferring the treatment of this case to the generic parser.  */
-+      return 0;
-+
-+      len = s - p->arg;
-+      regname = alloca (len + 2);
-+      regname[0] = 'r';
-+
-+      strncpy (regname + 1, p->arg, len);
-+      ++len;
-+      regname[len] = '\0';
-+
-+      if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
-+      error (_("Invalid register name `%s' on expression `%s'."),
-+             regname, p->saved_arg);
-+
-+      write_exp_elt_opcode (OP_REGISTER);
-+      str.ptr = regname;
-+      str.length = len;
-+      write_exp_string (str);
-+      write_exp_elt_opcode (OP_REGISTER);
-+
-+      p->arg = s;
-+    }
-+  else
-+    /* All the other tokens should be handled correctly by the generic
-+       parser.  */
-+    return 0;
+ #include "interps.h"
+ #include "main.h"
++#include "python/python.h"
+ #include "source.h"
+ #include "cli/cli-cmds.h"
+ #include "python/python.h"
+@@ -283,6 +284,8 @@ captured_main (void *data)
+   char *cdarg = NULL;
+   char *ttyarg = NULL;
++  int python_script = 0;
 +
-+  return 1;
-+}
+   /* These are static so that we can take their address in an
+      initializer.  */
+   static int print_help;
+@@ -471,10 +474,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}
+     };
  
- /* Cell/B.E. active SPE context tracking support.  */
+-    while (1)
++    while (!python_script)
+       {
+       int option_index;
  
-@@ -1509,6 +1576,15 @@ ppc_linux_init_abi (struct gdbarch_info info,
-   /* Get the syscall number from the arch's register.  */
-   set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
+@@ -492,6 +499,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;
+@@ -699,7 +709,31 @@ captured_main (void *data)
  
-+  /* SystemTap functions.  */
-+  set_gdbarch_stap_integer_prefix (gdbarch, "i");
-+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
-+  set_gdbarch_stap_register_indirection_sufix (gdbarch, ")");
-+  set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
-+  set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand);
-+  set_gdbarch_stap_parse_special_token (gdbarch,
-+                                      ppc_stap_parse_special_token);
+   /* 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);
++      }
 +
-   if (tdep->wordsize == 4)
-     {
-       /* Until November 2001, gcc did not comply with the 32 bit SysV
-diff --git a/gdb/printcmd.c b/gdb/printcmd.c
-index bee8a85..00f332d 100644
---- a/gdb/printcmd.c
-+++ b/gdb/printcmd.c
-@@ -49,6 +49,7 @@
- #include "charset.h"
- #include "arch-utils.h"
- #include "cli/cli-utils.h"
++      /* 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
+@@ -979,7 +1013,8 @@ captured_main (void *data)
+   /* Read in the old history after all the command files have been
+      read.  */
+-  init_history ();
++  if (!python_script)
++    init_history ();
+   if (batch_flag)
+     {
+@@ -990,13 +1025,25 @@ captured_main (void *data)
+   /* 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.  */
+ }
+@@ -1028,7 +1075,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 (_("\
+@@ -1068,7 +1120,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/objfiles.c b/gdb/objfiles.c
+index f5e5c75..411618f 100644
+--- a/gdb/objfiles.c
++++ b/gdb/objfiles.c
+@@ -53,6 +53,7 @@
+ #include "complaints.h"
+ #include "psymtab.h"
+ #include "solist.h"
++#include "gdb_bfd.h"
+ /* Prototypes for local functions */
+@@ -195,7 +196,8 @@ allocate_objfile (bfd *abfd, int flags)
+      that any data that is reference is saved in the per-objfile data
+      region.  */
+-  objfile->obfd = gdb_bfd_ref (abfd);
++  objfile->obfd = abfd;
++  gdb_bfd_ref (abfd);
+   if (abfd != NULL)
+     {
+       /* Look up the gdbarch associated with the BFD.  */
+@@ -1456,75 +1458,6 @@ objfiles_changed (void)
+   get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1;
+ }
+-/* Close ABFD, and warn if that fails.  */
+-
+-int
+-gdb_bfd_close_or_warn (struct bfd *abfd)
+-{
+-  int ret;
+-  char *name = bfd_get_filename (abfd);
+-
+-  ret = bfd_close (abfd);
+-
+-  if (!ret)
+-    warning (_("cannot close \"%s\": %s"),
+-           name, bfd_errmsg (bfd_get_error ()));
+-
+-  return ret;
+-}
+-
+-/* Add reference to ABFD.  Returns ABFD.  */
+-struct bfd *
+-gdb_bfd_ref (struct bfd *abfd)
+-{
+-  int *p_refcount;
+-
+-  if (abfd == NULL)
+-    return NULL;
+-
+-  p_refcount = bfd_usrdata (abfd);
+-
+-  if (p_refcount != NULL)
+-    {
+-      *p_refcount += 1;
+-      return abfd;
+-    }
+-
+-  p_refcount = xmalloc (sizeof (*p_refcount));
+-  *p_refcount = 1;
+-  bfd_usrdata (abfd) = p_refcount;
+-
+-  return abfd;
+-}
+-
+-/* Unreference and possibly close ABFD.  */
+-void
+-gdb_bfd_unref (struct bfd *abfd)
+-{
+-  int *p_refcount;
+-  char *name;
+-
+-  if (abfd == NULL)
+-    return;
+-
+-  p_refcount = bfd_usrdata (abfd);
+-
+-  /* Valid range for p_refcount: a pointer to int counter, which has a
+-     value of 1 (single owner) or 2 (shared).  */
+-  gdb_assert (*p_refcount == 1 || *p_refcount == 2);
+-
+-  *p_refcount -= 1;
+-  if (*p_refcount > 0)
+-    return;
+-
+-  xfree (p_refcount);
+-  bfd_usrdata (abfd) = NULL;  /* Paranoia.  */
+-
+-  name = bfd_get_filename (abfd);
+-  gdb_bfd_close_or_warn (abfd);
+-  xfree (name);
+-}
+-
+ /* The default implementation for the "iterate_over_objfiles_in_search_order"
+    gdbarch method.  It is equivalent to use the ALL_OBJFILES macro,
+    searching the objfiles in the order they are stored internally,
+diff --git a/gdb/objfiles.h b/gdb/objfiles.h
+index 01c3aea..0df5798 100644
+--- a/gdb/objfiles.h
++++ b/gdb/objfiles.h
+@@ -522,10 +522,6 @@ extern void set_objfile_data (struct objfile *objfile,
+ extern void *objfile_data (struct objfile *objfile,
+                          const struct objfile_data *data);
+-extern struct bfd *gdb_bfd_ref (struct bfd *abfd);
+-extern void gdb_bfd_unref (struct bfd *abfd);
+-extern int gdb_bfd_close_or_warn (struct bfd *abfd);
+-
+ extern void default_iterate_over_objfiles_in_search_order
+   (struct gdbarch *gdbarch,
+    iterate_over_objfiles_in_search_order_cb_ftype *cb,
+diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
+index b8434ed..98a076d 100644
+--- a/gdb/p-valprint.c
++++ b/gdb/p-valprint.c
+@@ -39,6 +39,7 @@
+ #include "cp-abi.h"
+ #include "cp-support.h"
+ #include "exceptions.h"
 +#include "dwarf2loc.h"
\f
  
- #ifdef TUI
- #include "tui/tui.h"          /* For tui_active et al.   */
-@@ -971,6 +972,11 @@ print_command_1 (char *exp, int inspect, int voidprint)
-   else
-     val = access_value_history (0);
+ /* Decorations for Pascal.  */
+@@ -74,8 +75,31 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
+   struct type *char_type;
+   CORE_ADDR addr;
+   int want_space = 0;
++  struct cleanup *back_to;
++  struct type *saved_type = type;
++  CORE_ADDR saved_address = address;
++  
++  back_to = make_cleanup (null_cleanup, 0);
++  address += embedded_offset;
++  type = object_address_get_data (type, &address);
++  if (type == NULL)
++    {
++      fputs_filtered (object_address_data_not_valid (saved_type), stream);
++      gdb_flush (stream);
++      do_cleanups (back_to);
++      return;
++    }
++  if (address != saved_address + embedded_offset)
++    {
++      size_t length = TYPE_LENGTH (type);
  
-+  /* Do not try to OBJECT_ADDRESS_SET here anything.  We are interested in the
-+     source variable base addresses as found by READ_VAR_VALUE.  The value here
-+     can be already a calculated expression address inappropriate for
-+     DW_OP_push_object_address.  */
-+
-   if (voidprint || (val && value_type (val) &&
-                   TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
+-  CHECK_TYPEDEF (type);
++      valaddr = xmalloc (length);
++      make_cleanup (xfree, (gdb_byte *) valaddr);
++      read_memory (address, (gdb_byte *) valaddr, length);
++      embedded_offset = 0;
++    }
++  else
++    address -= embedded_offset;
+   switch (TYPE_CODE (type))
      {
-@@ -1059,6 +1065,9 @@ output_command (char *exp, int from_tty)
+     case TYPE_CODE_ARRAY:
+@@ -131,8 +155,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
+               {
+                 i = 0;
+               }
+-            val_print_array_elements (type, valaddr, embedded_offset,
+-                                      address, stream, recurse,
++            val_print_array_elements (saved_type, valaddr, embedded_offset,
++                                      saved_address, stream, recurse,
+                                       original_value, options, i);
+             fprintf_filtered (stream, "}");
+           }
+@@ -170,6 +194,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
+       {
+         /* Try to print what function it points to.  */
+         print_address_demangle (options, gdbarch, addr, stream, demangle);
++        do_cleanups (back_to);
+         return;
+       }
  
-   val = evaluate_expression (expr);
+@@ -271,6 +296,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
+           }
+       }
  
-+  if (VALUE_LVAL (val) == lval_memory)
-+    object_address_set (value_raw_address (val));
-+
-   annotate_value_begin (value_type (val));
++      do_cleanups (back_to);
+       return;
  
-   get_formatted_print_options (&opts, format);
-@@ -1472,6 +1481,24 @@ x_command (char *exp, int from_tty)
-       set_internalvar (lookup_internalvar ("__"), last_examine_value);
+     case TYPE_CODE_REF:
+@@ -421,6 +447,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
+            TYPE_CODE (type));
      }
+   gdb_flush (stream);
++  do_cleanups (back_to);
  }
-+
-+#if 0
-+/* Call type_mark_used for any TYPEs referenced from this GDB source file.  */
-+
-+static void
-+print_types_mark_used (void)
-+{
-+  struct display *d;
-+
-+  if (last_examine_value)
-+    type_mark_used (value_type (last_examine_value));
-+
-+  for (d = display_chain; d; d = d->next)
-+    if (d->exp)
-+      exp_types_mark_used (d->exp);
-+}
-+#endif
-+
  \f
+ void
+diff --git a/gdb/parse.c b/gdb/parse.c
+index 529c517..6326a01 100644
+--- a/gdb/parse.c
++++ b/gdb/parse.c
+@@ -1708,6 +1708,7 @@ parser_fprintf (FILE *x, const char *y, ...)
  
- /* Add an expression to the auto-display chain.
-@@ -1971,6 +1998,10 @@ print_variable_and_value (const char *name, struct symbol *var,
-       struct value_print_options opts;
+ int
+ operator_check_standard (struct expression *exp, int pos,
++                       int (*type_func) (struct type *type, void *data),
+                        int (*objfile_func) (struct objfile *objfile,
+                                             void *data),
+                        void *data)
+@@ -1749,7 +1750,7 @@ operator_check_standard (struct expression *exp, int pos,
+           struct type *type = elts[pos + 2 + arg].type;
+           struct objfile *objfile = TYPE_OBJFILE (type);
  
-       val = read_var_value (var, frame);
-+
-+      make_cleanup_restore_selected_frame ();
-+      select_frame (frame);
-+
-       get_user_print_options (&opts);
-       opts.deref_ref = 1;
-       common_val_print (val, stream, indent, &opts, current_language);
-@@ -2884,4 +2915,8 @@ Show printing of source filename and line number with <symbol>."), NULL,
-   add_com ("eval", no_class, eval_command, _("\
- Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\
- a command line, and call it."));
-+
-+#if 0
-+  observer_attach_mark_used (print_types_mark_used);
-+#endif
- }
-diff --git a/gdb/python/lib/gdb/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.
-+
+-          if (objfile && (*objfile_func) (objfile, data))
++          if (objfile && objfile_func && (*objfile_func) (objfile, data))
+             return 1;
+         }
+       }
+@@ -1767,7 +1768,8 @@ operator_check_standard (struct expression *exp, int pos,
+       /* Check objfile where the variable itself is placed.
+          SYMBOL_OBJ_SECTION (symbol) may be NULL.  */
+-      if ((*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
++      if (objfile_func
++          && (*objfile_func) (SYMBOL_SYMTAB (symbol)->objfile, data))
+         return 1;
+       /* Check objfile where is placed the code touching the variable.  */
+@@ -1780,24 +1782,27 @@ operator_check_standard (struct expression *exp, int pos,
+   /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL.  */
+-  if (type && TYPE_OBJFILE (type)
++  if (type && type_func && (*type_func) (type, data))
++    return 1;
++  if (type && TYPE_OBJFILE (type) && objfile_func
+       && (*objfile_func) (TYPE_OBJFILE (type), data))
+     return 1;
+-  if (objfile && (*objfile_func) (objfile, data))
++  if (objfile && objfile_func && (*objfile_func) (objfile, data))
+     return 1;
+   return 0;
+ }
+-/* Call OBJFILE_FUNC for any TYPE and OBJFILE found being referenced by EXP.
+-   The functions are never called with NULL OBJFILE.  Functions get passed an
+-   arbitrary caller supplied DATA pointer.  If any of the functions returns
+-   non-zero value then (any other) non-zero value is immediately returned to
+-   the caller.  Otherwise zero is returned after iterating through whole EXP.
+-   */
++/* Call TYPE_FUNC and OBJFILE_FUNC for any TYPE and OBJFILE found being
++   referenced by EXP.  The functions are never called with NULL TYPE or NULL
++   OBJFILE.  Functions get passed an arbitrary caller supplied DATA pointer.
++   If any of the functions returns non-zero value then (any other) non-zero
++   value is immediately returned to the caller.  Otherwise zero is returned
++   after iterating through whole EXP.  */
+ static int
+ exp_iterate (struct expression *exp,
++           int (*type_func) (struct type *type, void *data),
+            int (*objfile_func) (struct objfile *objfile, void *data),
+            void *data)
+ {
+@@ -1812,7 +1817,9 @@ exp_iterate (struct expression *exp,
+       pos = endpos - oplen;
+       if (exp->language_defn->la_exp_desc->operator_check (exp, pos,
+-                                                         objfile_func, data))
++                                                         type_func,
++                                                         objfile_func,
++                                                         data))
+       return 1;
+       endpos = pos;
+@@ -1843,8 +1850,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile)
+ {
+   gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
+-  return exp_iterate (exp, exp_uses_objfile_iter, objfile);
++  return exp_iterate (exp, NULL, exp_uses_objfile_iter, objfile);
++}
++
++/* Helper for exp_types_mark_used.  */
++
++#if 0
++static int
++exp_types_mark_used_iter (struct type *type, void *unused)
++{
++  type_mark_used (type);
++
++  /* Continue the traversal.  */
++  return 0;
++}
++
++/* Call type_mark_used for any type contained in EXP.  */
++
++void
++exp_types_mark_used (struct expression *exp)
++{
++  exp_iterate (exp, exp_types_mark_used_iter, NULL, NULL);
+ }
++#endif
+ void
+ _initialize_parse (void)
+diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
+index 86f3bdf..f908a61 100644
+--- a/gdb/parser-defs.h
++++ b/gdb/parser-defs.h
+@@ -245,6 +245,8 @@ extern void operator_length_standard (const struct expression *, int, int *,
+                                     int *);
+ extern int operator_check_standard (struct expression *exp, int pos,
++                                  int (*type_func) (struct type *type,
++                                                    void *data),
+                                   int (*objfile_func)
+                                     (struct objfile *objfile, void *data),
+                                   void *data);
+@@ -331,6 +333,7 @@ struct exp_descriptor
+        value should be immediately returned to the caller.  Otherwise zero
+        should be returned.  */
+     int (*operator_check) (struct expression *exp, int pos,
++                         int (*type_func) (struct type *type, void *data),
+                          int (*objfile_func) (struct objfile *objfile,
+                                               void *data),
+                          void *data);
+@@ -369,4 +372,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3);
+ extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
++extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile);
++
++#if 0
++extern void exp_types_mark_used (struct expression *exp);
++#endif
++
+ #endif /* PARSER_DEFS_H */
+diff --git a/gdb/printcmd.c b/gdb/printcmd.c
+index d5b5b63..4bc2b5b 100644
+--- a/gdb/printcmd.c
++++ b/gdb/printcmd.c
+@@ -50,6 +50,7 @@
+ #include "arch-utils.h"
+ #include "cli/cli-utils.h"
+ #include "format.h"
++#include "dwarf2loc.h"
+ #ifdef TUI
+ #include "tui/tui.h"          /* For tui_active et al.   */
+@@ -968,6 +969,11 @@ print_command_1 (char *exp, int inspect, int voidprint)
+   else
+     val = access_value_history (0);
++  /* Do not try to OBJECT_ADDRESS_SET here anything.  We are interested in the
++     source variable base addresses as found by READ_VAR_VALUE.  The value here
++     can be already a calculated expression address inappropriate for
++     DW_OP_push_object_address.  */
++
+   if (voidprint || (val && value_type (val) &&
+                   TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
+     {
+@@ -1056,6 +1062,9 @@ output_command (char *exp, int from_tty)
+   val = evaluate_expression (expr);
++  if (VALUE_LVAL (val) == lval_memory)
++    object_address_set (value_raw_address (val));
++
+   annotate_value_begin (value_type (val));
+   get_formatted_print_options (&opts, format);
+@@ -1485,6 +1494,24 @@ x_command (char *exp, int from_tty)
+       set_internalvar (lookup_internalvar ("__"), last_examine_value);
+     }
+ }
++
++#if 0
++/* Call type_mark_used for any TYPEs referenced from this GDB source file.  */
++
++static void
++print_types_mark_used (void)
++{
++  struct display *d;
++
++  if (last_examine_value)
++    type_mark_used (value_type (last_examine_value));
++
++  for (d = display_chain; d; d = d->next)
++    if (d->exp)
++      exp_types_mark_used (d->exp);
++}
++#endif
++
\f
+ /* Add an expression to the auto-display chain.
+@@ -1982,6 +2009,10 @@ print_variable_and_value (const char *name, struct symbol *var,
+       struct value_print_options opts;
+       val = read_var_value (var, frame);
++
++      make_cleanup_restore_selected_frame ();
++      select_frame (frame);
++
+       get_user_print_options (&opts);
+       opts.deref_ref = 1;
+       common_val_print (val, stream, indent, &opts, current_language);
+@@ -2626,4 +2657,8 @@ Show printing of source filename and line number with <symbol>."), NULL,
+   add_com ("eval", no_class, eval_command, _("\
+ Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\
+ a command line, and call it."));
++
++#if 0
++  observer_attach_mark_used (print_types_mark_used);
++#endif
+ }
+diff --git a/gdb/procfs.c b/gdb/procfs.c
+index 774df2e..4409e5b 100644
+--- a/gdb/procfs.c
++++ b/gdb/procfs.c
+@@ -3486,7 +3486,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
+   long storage_needed;
+   CORE_ADDR sym_addr;
+-  abfd = bfd_fdopenr ("unamed", 0, fd);
++  abfd = gdb_bfd_fdopenr ("unamed", 0, fd);
+   if (abfd == NULL)
+     {
+       warning (_("Failed to create a bfd: %s."), bfd_errmsg (bfd_get_error ()));
+@@ -3497,7 +3497,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
+     {
+       /* Not the correct format, so we can not possibly find the dbx_link
+        symbol in it.  */
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
+       return 0;
+     }
+@@ -3511,14 +3511,14 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
+       if (dbx_link_bpt == NULL)
+       {
+         warning (_("Failed to insert dbx_link breakpoint."));
+-        bfd_close (abfd);
++        gdb_bfd_unref (abfd);
+         return 0;
+       }
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
+       return 1;
+     }
+-  bfd_close (abfd);
++  gdb_bfd_unref (abfd);
+   return 0;
+ }
+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
@@ -8123,7 +8469,7 @@ index 0000000..debb3bb
 +
 +InScope ()
 diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
-index dadb037..864da99 100644
+index 98030a6..9870eec 100644
 --- a/gdb/python/py-type.c
 +++ b/gdb/python/py-type.c
 @@ -30,6 +30,8 @@
@@ -8156,7 +8502,7 @@ index dadb037..864da99 100644
  static PyTypeObject type_object_type;
  
  /* A Field object.  */
-@@ -1150,8 +1160,63 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
+@@ -1166,8 +1176,63 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
  
  \f
  
@@ -8220,7 +8566,7 @@ index dadb037..864da99 100644
  static void
  save_objfile_types (struct objfile *objfile, void *datum)
  {
-@@ -1169,12 +1234,13 @@ save_objfile_types (struct objfile *objfile, void *datum)
+@@ -1185,12 +1250,13 @@ save_objfile_types (struct objfile *objfile, void *datum)
      {
        type_object *next = obj->next;
  
@@ -8238,7 +8584,7 @@ index dadb037..864da99 100644
  
        obj = next;
      }
-@@ -1185,43 +1251,28 @@ save_objfile_types (struct objfile *objfile, void *datum)
+@@ -1201,43 +1267,28 @@ save_objfile_types (struct objfile *objfile, void *datum)
  }
  
  static void
@@ -8296,7 +8642,7 @@ index dadb037..864da99 100644
  
  /* Return number of fields ("length" of the field dictionary).  */
  
-@@ -1444,7 +1495,10 @@ type_to_type_object (struct type *type)
+@@ -1457,7 +1508,10 @@ type_to_type_object (struct type *type)
  
    type_obj = PyObject_New (type_object, &type_object_type);
    if (type_obj)
@@ -8308,7 +8654,7 @@ index dadb037..864da99 100644
  
    return (PyObject *) type_obj;
  }
-@@ -1524,6 +1578,10 @@ gdbpy_initialize_types (void)
+@@ -1537,6 +1591,10 @@ gdbpy_initialize_types (void)
  
    Py_INCREF (&field_object_type);
    PyModule_AddObject (gdb_module, "Field", (PyObject *) &field_object_type);
@@ -8320,18 +8666,18 @@ index dadb037..864da99 100644
  
  \f
 diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
-index 760360e..d935f54 100644
+index 6f67bdb..5ddd6bc 100644
 --- a/gdb/python/py-value.c
 +++ b/gdb/python/py-value.c
-@@ -28,6 +28,7 @@
- #include "infcall.h"
+@@ -29,6 +29,7 @@
  #include "expression.h"
  #include "cp-abi.h"
+ #include "python.h"
 +#include "observer.h"
  
  #ifdef HAVE_PYTHON
  
-@@ -1335,6 +1336,19 @@ gdbpy_is_value_object (PyObject *obj)
+@@ -1378,6 +1379,19 @@ gdbpy_is_value_object (PyObject *obj)
    return PyObject_TypeCheck (obj, &value_object_type);
  }
  
@@ -8351,7 +8697,7 @@ index 760360e..d935f54 100644
  void
  gdbpy_initialize_values (void)
  {
-@@ -1345,6 +1359,10 @@ gdbpy_initialize_values (void)
+@@ -1388,6 +1402,10 @@ gdbpy_initialize_values (void)
    PyModule_AddObject (gdb_module, "Value", (PyObject *) &value_object_type);
  
    values_in_python = NULL;
@@ -8363,7 +8709,7 @@ index 760360e..d935f54 100644
  
  \f
 diff --git a/gdb/python/python.c b/gdb/python/python.c
-index 5a0d776..af01dfd 100644
+index c66efe4..0211fcb 100644
 --- a/gdb/python/python.c
 +++ b/gdb/python/python.c
 @@ -66,10 +66,13 @@ static const char *gdbpy_should_print_stack = python_excp_message;
@@ -8380,7 +8726,7 @@ index 5a0d776..af01dfd 100644
  
  static PyMethodDef GdbMethods[];
  
-@@ -946,6 +949,53 @@ gdbpy_print_stack (void)
+@@ -979,6 +982,53 @@ gdbpy_print_stack (void)
  
  /* Return the current Progspace.
     There always is one.  */
@@ -8434,7 +8780,7 @@ index 5a0d776..af01dfd 100644
  
  static PyObject *
  gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2)
-@@ -1386,6 +1436,8 @@ static PyMethodDef GdbMethods[] =
+@@ -1420,6 +1470,8 @@ static PyMethodDef GdbMethods[] =
      "Get a value from history" },
    { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS,
      "Execute a gdb command" },
@@ -8444,3929 +8790,1487 @@ index 5a0d776..af01dfd 100644
      "Return a gdb parameter's value" },
  
 diff --git a/gdb/python/python.h b/gdb/python/python.h
-index 9e461f7..57b21da 100644
+index dd7066f..f0f6e90 100644
 --- a/gdb/python/python.h
 +++ b/gdb/python/python.h
-@@ -32,6 +32,8 @@ void eval_python_from_control_command (struct command_line *);
+@@ -30,6 +30,8 @@ void eval_python_from_control_command (struct command_line *);
  
- void source_python_script (const char *file);
+ void source_python_script (FILE *file, const char *filename);
  
 +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/remote.c b/gdb/remote.c
-index f348536..e20f6bf 100644
---- a/gdb/remote.c
-+++ b/gdb/remote.c
-@@ -9948,7 +9948,7 @@ remote_download_tracepoint (struct bp_location *loc)
-   char **stepping_actions;
-   int ndx;
-   struct cleanup *old_chain = NULL;
--  struct agent_expr *aexpr;
-+  struct agent_expr *aexpr = NULL;
-   struct cleanup *aexpr_chain = NULL;
-   char *pkt;
-   struct breakpoint *b = loc->owner;
-diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
-index 2755e58..8df3fd1 100644
---- a/gdb/s390-nat.c
-+++ b/gdb/s390-nat.c
-@@ -515,6 +515,17 @@ s390_fix_watch_points (struct lwp_info *lp)
-     perror_with_name (_("Couldn't modify watchpoint status"));
+diff --git a/gdb/record.c b/gdb/record.c
+index bb0fe52..ec42aac 100644
+--- a/gdb/record.c
++++ b/gdb/record.c
+@@ -32,6 +32,7 @@
+ #include "gcore.h"
+ #include "event-loop.h"
+ #include "inf-loop.h"
++#include "gdb_bfd.h"
+ #include <signal.h>
+@@ -2638,7 +2639,7 @@ record_save_cleanups (void *data)
+   bfd *obfd = data;
+   char *pathname = xstrdup (bfd_get_filename (obfd));
+-  bfd_close (obfd);
++  gdb_bfd_unref (obfd);
+   unlink (pathname);
+   xfree (pathname);
  }
+@@ -2854,7 +2855,7 @@ cmd_record_save (char *args, int from_tty)
+     }
  
-+/* Callback for iterate_over_lwps, to call s390_fix_watch_points.  */
-+
-+static int
-+s390_fix_watch_points_iterate (struct lwp_info *lp, void *arg)
-+{
-+  s390_fix_watch_points (lp);
-+
-+  /* Continue the traversal.  */
-+  return 0;
-+}
-+
- static int
- s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
-                       struct expression *cond)
-@@ -531,8 +542,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
-   area->next = watch_base;
-   watch_base = area;
--  ALL_LWPS (lp)
--    s390_fix_watch_points (lp);
-+  iterate_over_lwps (minus_one_ptid, s390_fix_watch_points_iterate, NULL);
-+
-   return 0;
- }
+   do_cleanups (set_cleanups);
+-  bfd_close (obfd);
++  gdb_bfd_unref (obfd);
+   discard_cleanups (old_cleanups);
  
-@@ -559,8 +570,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
-   *parea = area->next;
-   xfree (area);
+   /* Succeeded.  */
+diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
+index 47f4405..85268b6 100644
+--- a/gdb/remote-m32r-sdi.c
++++ b/gdb/remote-m32r-sdi.c
+@@ -39,6 +39,7 @@
+ #include <sys/time.h>
+ #include <signal.h>
+ #include <time.h>
++#include "gdb_bfd.h"
  
--  ALL_LWPS (lp)
--    s390_fix_watch_points (lp);
-+  iterate_over_lwps (minus_one_ptid, s390_fix_watch_points_iterate, NULL);
-+
-   return 0;
- }
  
-diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
-index ac0c526..dd0e477 100644
---- a/gdb/s390-tdep.c
-+++ b/gdb/s390-tdep.c
-@@ -55,6 +55,12 @@
- #include "features/s390x-linux64v1.c"
- #include "features/s390x-linux64v2.c"
+ #include "serial.h"
+@@ -1257,13 +1258,13 @@ m32r_load (char *args, int from_tty)
+   if (!filename)
+     filename = get_exec_file (1);
  
-+#include "stap-probe.h"
-+#include "ax.h"
-+#include "ax-gdb.h"
-+#include "user-regs.h"
-+#include "cli/cli-utils.h"
-+#include <ctype.h>
+-  pbfd = bfd_openr (filename, gnutarget);
++  pbfd = gdb_bfd_openr (filename, gnutarget);
+   if (pbfd == NULL)
+     {
+       perror_with_name (filename);
+       return;
+     }
+-  old_chain = make_cleanup_bfd_close (pbfd);
++  old_chain = make_cleanup_bfd_unref (pbfd);
+   if (!bfd_check_format (pbfd, bfd_object))
+     error (_("\"%s\" is not an object file: %s"), filename,
+diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
+index babbf19..db4381b 100644
+--- a/gdb/remote-mips.c
++++ b/gdb/remote-mips.c
+@@ -36,6 +36,7 @@
+ #include <ctype.h>
+ #include "mips-tdep.h"
+ #include "gdbthread.h"
++#include "gdb_bfd.h"
\f
  
- /* The tdep structure.  */
+ /* Breakpoint types.  Values 0, 1, and 2 must agree with the watch
+@@ -2783,20 +2784,23 @@ mips_load_srec (char *args)
+   unsigned int i;
+   unsigned int srec_frame = 200;
+   int reclen;
++  struct cleanup *cleanup;
+   static int hashmark = 1;
  
-@@ -2953,6 +2959,15 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch,
-     return 0;
- }
+   buffer = alloca (srec_frame * 2 + 256);
  
-+static int
-+s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
-+{
-+  return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
-+                                                        or indirection.  */
-+        || *s == '%' /* Register access.  */
-+        || isdigit (*s)); /* Literal number.  */
-+}
-+
- /* Set up gdbarch struct.  */
+-  abfd = bfd_openr (args, 0);
++  abfd = gdb_bfd_openr (args, 0);
+   if (!abfd)
+     {
+       printf_filtered ("Unable to open file %s\n", args);
+       return;
+     }
  
- static struct gdbarch *
-@@ -3283,6 +3298,12 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
++  cleanup = make_cleanup_bfd_unref (abfd);
+   if (bfd_check_format (abfd, bfd_object) == 0)
+     {
+       printf_filtered ("File is not an object file\n");
++      do_cleanups (cleanup);
+       return;
+     }
  
-   set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
+@@ -2850,6 +2854,7 @@ mips_load_srec (char *args)
+   send_srec (srec, reclen, abfd->start_address);
  
-+  /* SystemTap functions.  */
-+  set_gdbarch_stap_register_prefix (gdbarch, "%");
-+  set_gdbarch_stap_register_indirection_prefix (gdbarch, "(");
-+  set_gdbarch_stap_register_indirection_sufix (gdbarch, ")");
-+  set_gdbarch_stap_is_single_operand (gdbarch, s390_stap_is_single_operand);
-+
-   return gdbarch;
+   serial_flush_input (mips_desc);
++  do_cleanups (cleanup);
  }
  
-diff --git a/gdb/somread.c b/gdb/somread.c
-index e621cba..19a15e2 100644
---- a/gdb/somread.c
-+++ b/gdb/somread.c
-@@ -427,6 +427,7 @@ static const struct sym_fns som_sym_fns =
-   default_symfile_segments,   /* Get segment information from a file.  */
-   NULL,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  NULL,                               /* sym_get_probes */
-   &psym_functions
- };
+ /*
+@@ -3366,20 +3371,23 @@ pmon_load_fast (char *file)
+   int bintotal = 0;
+   int final = 0;
+   int finished = 0;
++  struct cleanup *cleanup;
  
-diff --git a/gdb/stack.c b/gdb/stack.c
-index b15b5fc..b2dad29 100644
---- a/gdb/stack.c
-+++ b/gdb/stack.c
-@@ -509,6 +509,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
-   stb = ui_out_stream_new (uiout);
-   old_chain = make_cleanup_ui_out_stream_delete (stb);
+   buffer = (char *) xmalloc (MAXRECSIZE + 1);
+   binbuf = (unsigned char *) xmalloc (BINCHUNK);
  
-+  /* Frame may be needed for check_typedef of TYPE_DYNAMIC.  */
-+  make_cleanup_restore_selected_frame ();
-+  select_frame (frame);
-+
-   if (func)
+-  abfd = bfd_openr (file, 0);
++  abfd = gdb_bfd_openr (file, 0);
+   if (!abfd)
      {
-       struct block *b = SYMBOL_BLOCK_VALUE (func);
-diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
-new file mode 100644
-index 0000000..123530f
---- /dev/null
-+++ b/gdb/stap-probe.c
-@@ -0,0 +1,1672 @@
-+/* SystemTap probe support for GDB.
-+
-+   Copyright (C) 2011 Free Software Foundation, Inc.
-+
-+   This file is part of GDB.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#include "defs.h"
-+#include "stap-probe.h"
-+#include "vec.h"
-+#include "ui-out.h"
-+#include "gdb_regex.h"
-+#include "objfiles.h"
-+#include "arch-utils.h"
-+#include "command.h"
-+#include "gdbcmd.h"
-+#include "filenames.h"
-+#include "value.h"
-+#include "exceptions.h"
-+#include "ax.h"
-+#include "ax-gdb.h"
-+#include "complaints.h"
-+#include "cli/cli-utils.h"
-+#include "linespec.h"
-+#include "user-regs.h"
-+#include "parser-defs.h"
-+#include "language.h"
-+
-+#include <ctype.h>
-+
-+/* The maximum number of arguments that a probe can have,
-+   as defined in <sys/sdt.h>.  */
-+
-+#define STAP_MAX_ARGS 12
-+
-+/* Should we display debug information for the probe's argument expression
-+   parsing?  */
-+
-+static int stap_expression_debug = 0;
-+
-+/* The various possibilities of bitness defined for a probe's argument.
-+
-+   The relationship is:
-+
-+   - STAP_ARG_BITNESS_UNDEFINED:  The user hasn't specified the bitness.
-+   - STAP_ARG_BITNESS_32BIT_UNSIGNED:  argument string starts with `4@'.
-+   - STAP_ARG_BITNESS_32BIT_SIGNED:  argument string starts with `-4@'.
-+   - STAP_ARG_BITNESS_64BIT_UNSIGNED:  argument string starts with `8@'.
-+   - STAP_ARG_BITNESS_64BIT_SIGNED:  argument string starts with `-8@'.  */
-+
-+enum stap_arg_bitness
-+{
-+  STAP_ARG_BITNESS_UNDEFINED,
-+  STAP_ARG_BITNESS_32BIT_UNSIGNED,
-+  STAP_ARG_BITNESS_32BIT_SIGNED,
-+  STAP_ARG_BITNESS_64BIT_UNSIGNED,
-+  STAP_ARG_BITNESS_64BIT_SIGNED,
-+};
-+
-+/* The following structure represents a single argument for the probe.  */
-+
-+struct stap_probe_arg
-+{
-+  /* The bitness of this argument.  */
-+  enum stap_arg_bitness bitness;
-+
-+  /* The corresponding `struct type *' to the bitness.  */
-+  struct type *atype;
-+
-+  /* The argument converted to an internal GDB expression.  */
-+  struct expression *aexpr;
-+};
-+
-+/* Structure that holds information about all arguments of a probe.  */
-+
-+struct stap_args_info
-+{
-+  /* The number of valid parsed arguments.  */
-+  int n_args;
-+
-+  /* The probe to which these arguments belong.  */
-+  struct stap_probe *probe;
-+
-+  /* Information about each argument.  This is an array of `stap_probe_arg',
-+     with each entry representing one argument.  */
-+  struct stap_probe_arg *args;
-+};
-+
-+/* When parsing the arguments, we have to establish different precedences
-+   for the various kinds of asm operators.  This enumeration represents those
-+   precedences.
-+
-+   This logic behind this is available at
-+   <http://sourceware.org/binutils/docs/as/Infix-Ops.html#Infix-Ops>, or using
-+   the command "info '(as)Infix Ops'".  */
-+
-+enum stap_operand_prec
-+{
-+  /* Lowest precedence, used for non-recognized operands or for the beginning
-+     of the parsing process.  */
-+  STAP_OPERAND_PREC_NONE = 0,
-+
-+  /* Precedence of logical OR.  */
-+  STAP_OPERAND_PREC_LOGICAL_OR,
-+
-+  /* Precedence of logical AND.  */
-+  STAP_OPERAND_PREC_LOGICAL_AND,
-+
-+  /* Precedence of additive (plus, minus) and comparative (equal, less,
-+     greater-than, etc) operands.  */
-+  STAP_OPERAND_PREC_ADD_CMP,
-+
-+  /* Precedence of bitwise operands (bitwise OR, XOR, bitwise AND,
-+     logical NOT).  */
-+  STAP_OPERAND_PREC_BITWISE,
-+
-+  /* Precedence of multiplicative operands (multiplication, division,
-+     remainder, left shift and right shift).  */
-+  STAP_OPERAND_PREC_MUL
-+};
-+
-+/* This dummy variable is used when parsing a probe's argument fails.
-+   In this case, the number of arguments for this probe is zero, so that's
-+   why this variable is useful.  */
-+
-+static struct stap_args_info dummy_stap_args_info =
-+  { 0, NULL, NULL };
-+
-+static void stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
-+                                 enum stap_operand_prec prec);
+       printf_filtered ("Unable to open file %s\n", file);
+       return;
+     }
++  cleanup = make_cleanup_bfd_unref (abfd);
+   if (bfd_check_format (abfd, bfd_object) == 0)
+     {
+       printf_filtered ("File is not an object file\n");
++      do_cleanups (cleanup);
+       return;
+     }
+@@ -3503,6 +3511,7 @@ pmon_load_fast (char *file)
+       pmon_end_download (final, bintotal);
+     }
++  do_cleanups (cleanup);
+   return;
+ }
+diff --git a/gdb/remote.c b/gdb/remote.c
+index 1c9367d..f2b5e7b 100644
+--- a/gdb/remote.c
++++ b/gdb/remote.c
+@@ -42,6 +42,7 @@
+ #include "cli/cli-decode.h"
+ #include "cli/cli-setshow.h"
+ #include "target-descriptions.h"
++#include "gdb_bfd.h"
+ #include <ctype.h>
+ #include <sys/time.h>
+@@ -9823,11 +9824,13 @@ remote_filename_p (const char *filename)
+ bfd *
+ remote_bfd_open (const char *remote_file, const char *target)
+ {
+-  return bfd_openr_iovec (remote_file, target,
+-                        remote_bfd_iovec_open, NULL,
+-                        remote_bfd_iovec_pread,
+-                        remote_bfd_iovec_close,
+-                        remote_bfd_iovec_stat);
++  bfd *abfd = gdb_bfd_openr_iovec (remote_file, target,
++                                 remote_bfd_iovec_open, NULL,
++                                 remote_bfd_iovec_pread,
++                                 remote_bfd_iovec_close,
++                                 remote_bfd_iovec_stat);
++
++  return abfd;
+ }
+ void
+diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
+index 0a2000a..9b8efd3 100644
+--- a/gdb/rs6000-nat.c
++++ b/gdb/rs6000-nat.c
+@@ -730,7 +730,7 @@ static struct vmap *
+ add_vmap (LdInfo *ldi)
+ {
+   bfd *abfd, *last;
+-  char *mem, *objname, *filename;
++  char *mem, *filename;
+   struct objfile *obj;
+   struct vmap *vp;
+   int fd;
+@@ -743,19 +743,18 @@ add_vmap (LdInfo *ldi)
+   filename = LDI_FILENAME (ldi, arch64);
+   mem = filename + strlen (filename) + 1;
+   mem = xstrdup (mem);
+-  objname = xstrdup (filename);
+   fd = LDI_FD (ldi, arch64);
+   if (fd < 0)
+     /* Note that this opens it once for every member; a possible
+        enhancement would be to only open it once for every object.  */
+-    abfd = bfd_openr (objname, gnutarget);
++    abfd = gdb_bfd_openr (filename, gnutarget);
+   else
+-    abfd = bfd_fdopenr (objname, gnutarget, fd);
++    abfd = gdb_bfd_fdopenr (filename, gnutarget, fd);
+   if (!abfd)
+     {
+       warning (_("Could not open `%s' as an executable file: %s"),
+-             objname, bfd_errmsg (bfd_get_error ()));
++             filename, bfd_errmsg (bfd_get_error ()));
+       return NULL;
+     }
+@@ -766,35 +765,44 @@ add_vmap (LdInfo *ldi)
+   else if (bfd_check_format (abfd, bfd_archive))
+     {
+-      last = 0;
+-      /* FIXME??? am I tossing BFDs?  bfd?  */
+-      while ((last = bfd_openr_next_archived_file (abfd, last)))
+-      if (strcmp (mem, last->filename) == 0)
+-        break;
++      last = gdb_bfd_openr_next_archived_file (abfd, NULL);
++      while (last != NULL)
++      {
++        bfd *next;
 +
-+static void stap_parse_argument_conditionally (struct stap_parse_info *p);
++        if (strcmp (mem, last->filename) == 0)
++          break;
 +
-+/* Returns 1 if *S is an operator, zero otherwise.  */
++        next = gdb_bfd_openr_next_archived_file (abfd, last);
++        gdb_bfd_unref (last);
++      }
+       if (!last)
+       {
+-        warning (_("\"%s\": member \"%s\" missing."), objname, mem);
+-        bfd_close (abfd);
++        warning (_("\"%s\": member \"%s\" missing."), filename, mem);
++        gdb_bfd_unref (abfd);
+         return NULL;
+       }
+       if (!bfd_check_format (last, bfd_object))
+       {
+         warning (_("\"%s\": member \"%s\" not in executable format: %s."),
+-                 objname, mem, bfd_errmsg (bfd_get_error ()));
+-        bfd_close (last);
+-        bfd_close (abfd);
++                 filename, mem, bfd_errmsg (bfd_get_error ()));
++        gdb_bfd_unref (last);
++        gdb_bfd_unref (abfd);
+         return NULL;
+       }
+       vp = map_vmap (last, abfd);
++      /* map_vmap acquired a reference to LAST, so we can release
++       ours.  */
++      gdb_bfd_unref (last);
+     }
+   else
+     {
+       warning (_("\"%s\": not in executable format: %s."),
+-             objname, bfd_errmsg (bfd_get_error ()));
+-      bfd_close (abfd);
++             filename, bfd_errmsg (bfd_get_error ()));
++      gdb_bfd_unref (abfd);
+       return NULL;
+     }
+   obj = allocate_objfile (vp->bfd, 0);
+@@ -803,6 +811,11 @@ add_vmap (LdInfo *ldi)
+   /* Always add symbols for the main objfile.  */
+   if (vp == vmap || auto_solib_add)
+     vmap_add_symbols (vp);
 +
-+static int stap_is_operator (char op);
++  /* Anything needing a reference to ABFD has already acquired it, so
++     release our local reference.  */
++  gdb_bfd_unref (abfd);
 +
-+static void
-+show_stapexpressiondebug (struct ui_file *file, int from_tty,
-+                        struct cmd_list_element *c, const char *value)
-+{
-+  fprintf_filtered (file, _("SystemTap Probe expression debugging is %s.\n"),
-+                  value);
-+}
+   return vp;
+ }
\f
+diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
+index d52fb46..db8f187 100644
+--- a/gdb/solib-darwin.c
++++ b/gdb/solib-darwin.c
+@@ -28,6 +28,7 @@
+ #include "inferior.h"
+ #include "regcache.h"
+ #include "gdbthread.h"
++#include "gdb_bfd.h"
+ #include "gdb_assert.h"
+@@ -356,6 +357,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
+   gdb_byte *interp_name;
+   CORE_ADDR load_addr = 0;
+   bfd *dyld_bfd = NULL;
++  struct cleanup *cleanup;
+   /* This method doesn't work with an attached process.  */
+   if (current_inferior ()->attach_flag)
+@@ -366,24 +368,31 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
+   if (!interp_name)
+     return;
++  cleanup = make_cleanup (null_cleanup, NULL);
 +
-+/* Returns the operator precedence level of OP, or STAP_OPERAND_PREC_NONE
-+   if the operator code was not recognized.  */
+   /* Create a bfd for the interpreter.  */
+-  dyld_bfd = bfd_openr (interp_name, gnutarget);
++  dyld_bfd = gdb_bfd_openr (interp_name, gnutarget);
+   if (dyld_bfd)
+     {
+       bfd *sub;
++      make_cleanup_bfd_unref (dyld_bfd);
+       sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object,
+                                   gdbarch_bfd_arch_info (target_gdbarch));
+       if (sub)
+-      dyld_bfd = sub;
+-      else
+       {
+-        bfd_close (dyld_bfd);
+-        dyld_bfd = NULL;
++        dyld_bfd = sub;
++        gdb_bfd_ref (sub);
++        make_cleanup_bfd_unref (sub);
+       }
++      else
++      dyld_bfd = NULL;
+     }
+   if (!dyld_bfd)
+-    return;
++    {
++      do_cleanups (cleanup);
++      return;
++    }
+   /* We find the dynamic linker's base address by examining
+      the current pc (which should point at the entry point for the
+@@ -395,7 +404,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
+   info->all_image_addr =
+     lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos");
+-  bfd_close (dyld_bfd);
++  do_cleanups (cleanup);
+   if (info->all_image_addr == 0)
+     return;
+@@ -509,17 +518,10 @@ darwin_bfd_open (char *pathname)
+                               gdbarch_bfd_arch_info (target_gdbarch));
+   if (!res)
+     {
+-      bfd_close (abfd);
+-      make_cleanup (xfree, found_pathname);
++      make_cleanup_bfd_unref (abfd);
+       error (_("`%s': not a shared-library: %s"),
+-           found_pathname, bfd_errmsg (bfd_get_error ()));
++           bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
+     }
+-
+-  /* Make sure that the filename is malloc'ed.  The current filename
+-     for fat-binaries BFDs is a name that was generated by BFD, usually
+-     a static string containing the name of the architecture.  */
+-  res->filename = xstrdup (pathname);
+-
+   return res;
+ }
+diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
+index 2500c1f..fcc01a8 100644
+--- a/gdb/solib-dsbt.c
++++ b/gdb/solib-dsbt.c
+@@ -30,6 +30,7 @@
+ #include "gdbcmd.h"
+ #include "elf-bfd.h"
+ #include "exceptions.h"
++#include "gdb_bfd.h"
+ #define GOT_MODULE_OFFSET 4
+@@ -899,7 +900,7 @@ enable_break2 (void)
+       {
+         warning (_("Could not find symbol _dl_debug_addr in dynamic linker"));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+@@ -948,13 +949,13 @@ enable_break2 (void)
+                    "(at address %s) from dynamic linker"),
+                  hex_string_custom (addr + 8, 8));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
+       /* We're done with the temporary bfd.  */
+-      bfd_close (tmp_bfd);
++      gdb_bfd_unref (tmp_bfd);
+       /* We're also done with the loadmap.  */
+       xfree (ldm);
+diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
+index 2f2c8b0..0f59535 100644
+--- a/gdb/solib-frv.c
++++ b/gdb/solib-frv.c
+@@ -31,6 +31,7 @@
+ #include "gdbcmd.h"
+ #include "elf/frv.h"
+ #include "exceptions.h"
++#include "gdb_bfd.h"
+ /* Flag which indicates whether internal debug messages should be printed.  */
+ static int solib_frv_debug;
+@@ -574,7 +575,7 @@ enable_break2 (void)
+       {
+         warning (_("Unable to determine dynamic linker loadmap address."));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+@@ -589,7 +590,7 @@ enable_break2 (void)
+         warning (_("Unable to load dynamic linker loadmap at address %s."),
+                  hex_string_custom (interp_loadmap_addr, 8));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+@@ -623,7 +624,7 @@ enable_break2 (void)
+         warning (_("Could not find symbol _dl_debug_addr "
+                    "in dynamic linker"));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+@@ -674,7 +675,7 @@ enable_break2 (void)
+                    "(at address %s) from dynamic linker"),
+                  hex_string_custom (addr + 8, 8));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
+@@ -686,13 +687,13 @@ enable_break2 (void)
+                    "(at address %s) from dynamic linker"),
+                  hex_string_custom (addr, 8));
+         enable_break_failure_warning ();
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return 0;
+       }
+       addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
+       /* We're done with the temporary bfd.  */
+-      bfd_close (tmp_bfd);
++      gdb_bfd_unref (tmp_bfd);
+       /* We're also done with the loadmap.  */
+       xfree (ldm);
+diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
+index 2b8d061..00ed8a5 100644
+--- a/gdb/solib-pa64.c
++++ b/gdb/solib-pa64.c
+@@ -362,7 +362,7 @@ manpage for methods to privately map shared library text."));
+        to find any magic formula to find it for Solaris (appears to
+        be trivial on GNU/Linux).  Therefore, we have to try an alternate
+        mechanism to find the dynamic linker's base address.  */
+-      tmp_bfd = bfd_openr (buf, gnutarget);
++      tmp_bfd = gdb_bfd_openr (buf, gnutarget);
+       if (tmp_bfd == NULL)
+       return;
+@@ -371,7 +371,7 @@ manpage for methods to privately map shared library text."));
+       {
+         warning (_("Unable to grok dynamic linker %s as an object file"),
+                  buf);
+-        bfd_close (tmp_bfd);
++        gdb_bfd_unref (tmp_bfd);
+         return;
+       }
+@@ -401,7 +401,7 @@ manpage for methods to privately map shared library text."));
+       }
+       /* We're done with the temporary bfd.  */
+-      bfd_close (tmp_bfd);
++      gdb_bfd_unref (tmp_bfd);
+     }
+ }
+diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
+index b5454e7..f62d96c 100644
+--- a/gdb/solib-spu.c
++++ b/gdb/solib-spu.c
+@@ -36,6 +36,7 @@
+ #include "breakpoint.h"
+ #include "gdbthread.h"
+ #include "exceptions.h"
++#include "gdb_bfd.h"
+ #include "spu-tdep.h"
+@@ -325,16 +326,16 @@ spu_bfd_fopen (char *name, CORE_ADDR addr)
+   CORE_ADDR *open_closure = xmalloc (sizeof (CORE_ADDR));
+   *open_closure = addr;
+-  nbfd = bfd_openr_iovec (xstrdup (name), "elf32-spu",
+-                          spu_bfd_iovec_open, open_closure,
+-                          spu_bfd_iovec_pread, spu_bfd_iovec_close,
+-                        spu_bfd_iovec_stat);
++  nbfd = gdb_bfd_openr_iovec (name, "elf32-spu",
++                            spu_bfd_iovec_open, open_closure,
++                            spu_bfd_iovec_pread, spu_bfd_iovec_close,
++                            spu_bfd_iovec_stat);
+   if (!nbfd)
+     return NULL;
+   if (!bfd_check_format (nbfd, bfd_object))
+     {
+-      bfd_close (nbfd);
++      gdb_bfd_unref (nbfd);
+       return NULL;
+     }
+diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+index 307e483..76bd872 100644
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -46,6 +46,7 @@
+ #include "exec.h"
+ #include "auxv.h"
+ #include "exceptions.h"
++#include "gdb_bfd.h"
+ static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
+ static int svr4_have_link_map_offsets (void);
+@@ -1558,9 +1559,11 @@ enable_break (struct svr4_info *info, int from_tty)
+       goto bkpt_at_symbol;
+       /* Now convert the TMP_BFD into a target.  That way target, as
+-         well as BFD operations can be used.  Note that closing the
+-         target will also close the underlying bfd.  */
++         well as BFD operations can be used.  */
+       tmp_bfd_target = target_bfd_reopen (tmp_bfd);
++      /* target_bfd_reopen acquired its own reference, so we can
++         release ours now.  */
++      gdb_bfd_unref (tmp_bfd);
+       /* On a running target, we can get the dynamic linker's base
+          address from the shared library table.  */
+@@ -1670,8 +1673,9 @@ enable_break (struct svr4_info *info, int from_tty)
+                                                      sym_addr,
+                                                      tmp_bfd_target);
+-      /* We're done with both the temporary bfd and target.  Remember,
+-         closing the target closes the underlying bfd.  */
++      /* We're done with both the temporary bfd and target.  Closing
++         the target closes the underlying bfd, because it holds the
++         only remaining reference.  */
+       target_close (tmp_bfd_target, 0);
+       if (sym_addr != 0)
+diff --git a/gdb/solib.c b/gdb/solib.c
+index 90439ba..73773f1 100644
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -46,6 +46,7 @@
+ #include "solib.h"
+ #include "interps.h"
+ #include "filesystem.h"
++#include "gdb_bfd.h"
+ /* Architecture-specific operations.  */
+@@ -360,9 +361,9 @@ solib_find (char *in_pathname, int *fd)
+    it is used as file handle to open the file.  Throws an error if the file
+    could not be opened.  Handles both local and remote file access.
+-   PATHNAME must be malloc'ed by the caller.  If successful, the new BFD's
+-   name will point to it.  If unsuccessful, PATHNAME will be freed and the
+-   FD will be closed (unless FD was -1).  */
++   PATHNAME must be malloc'ed by the caller.  It will be freed by this
++   function.  If unsuccessful, the FD will be closed (unless FD was
++   -1).  */
+ bfd *
+ solib_bfd_fopen (char *pathname, int fd)
+@@ -376,7 +377,7 @@ solib_bfd_fopen (char *pathname, int fd)
+     }
+   else
+     {
+-      abfd = bfd_fopen (pathname, gnutarget, FOPEN_RB, fd);
++      abfd = gdb_bfd_fopen (pathname, gnutarget, FOPEN_RB, fd);
+       if (abfd)
+       bfd_set_cacheable (abfd, 1);
+@@ -389,6 +390,8 @@ solib_bfd_fopen (char *pathname, int fd)
+            pathname, bfd_errmsg (bfd_get_error ()));
+     }
++  xfree (pathname);
 +
-+static enum stap_operand_prec
-+stap_get_operator_prec (enum exp_opcode op)
-+{
-+  switch (op)
+   return abfd;
+ }
+@@ -420,17 +423,16 @@ solib_bfd_open (char *pathname)
+   /* Check bfd format.  */
+   if (!bfd_check_format (abfd, bfd_object))
+     {
+-      bfd_close (abfd);
+-      make_cleanup (xfree, found_pathname);
++      make_cleanup_bfd_unref (abfd);
+       error (_("`%s': not in executable format: %s"),
+-           found_pathname, bfd_errmsg (bfd_get_error ()));
++           bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
+     }
+   /* Check bfd arch.  */
+   b = gdbarch_bfd_arch_info (target_gdbarch);
+   if (!b->compatible (b, bfd_get_arch_info (abfd)))
+     warning (_("`%s': Shared library architecture %s is not compatible "
+-               "with target architecture %s."), found_pathname,
++               "with target architecture %s."), bfd_get_filename (abfd),
+              bfd_get_arch_info (abfd)->printable_name, b->printable_name);
+   return abfd;
+@@ -466,7 +468,7 @@ solib_map_sections (struct so_list *so)
+     return 0;
+   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
+-  so->abfd = gdb_bfd_ref (abfd);
++  so->abfd = abfd;
+   /* copy full path name into so_name, so that later symbol_file_add
+      can find it.  */
+@@ -1233,7 +1235,7 @@ reload_shared_libraries_1 (int from_tty)
+       {
+         found_pathname = xstrdup (bfd_get_filename (abfd));
+         make_cleanup (xfree, found_pathname);
+-        gdb_bfd_close_or_warn (abfd);
++        gdb_bfd_unref (abfd);
+       }
+       /* If this shared library is no longer associated with its previous
+diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
+index 2dfec8c..999f1ab 100644
+--- a/gdb/spu-linux-nat.c
++++ b/gdb/spu-linux-nat.c
+@@ -315,16 +315,16 @@ spu_bfd_open (ULONGEST addr)
+   ULONGEST *open_closure = xmalloc (sizeof (ULONGEST));
+   *open_closure = addr;
+-  nbfd = bfd_openr_iovec (xstrdup ("<in-memory>"), "elf32-spu",
+-                        spu_bfd_iovec_open, open_closure,
+-                        spu_bfd_iovec_pread, spu_bfd_iovec_close,
+-                        spu_bfd_iovec_stat);
++  nbfd = gdb_bfd_openr_iovec ("<in-memory>", "elf32-spu",
++                            spu_bfd_iovec_open, open_closure,
++                            spu_bfd_iovec_pread, spu_bfd_iovec_close,
++                            spu_bfd_iovec_stat);
+   if (!nbfd)
+     return NULL;
+   if (!bfd_check_format (nbfd, bfd_object))
+     {
+-      bfd_close (nbfd);
++      gdb_bfd_unref (nbfd);
+       return NULL;
+     }
+@@ -374,8 +374,13 @@ spu_symbol_file_add_from_memory (int inferior_fd)
+   /* Open BFD representing SPE executable and read its symbols.  */
+   nbfd = spu_bfd_open (addr);
+   if (nbfd)
+-    symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
+-                              NULL, 0, NULL);
 +    {
-+    case BINOP_LOGICAL_OR:
-+      return STAP_OPERAND_PREC_LOGICAL_OR;
-+
-+    case BINOP_LOGICAL_AND:
-+      return STAP_OPERAND_PREC_LOGICAL_AND;
-+
-+    case BINOP_ADD:
-+    case BINOP_SUB:
-+    case BINOP_EQUAL:
-+    case BINOP_NOTEQUAL:
-+    case BINOP_LESS:
-+    case BINOP_LEQ:
-+    case BINOP_GTR:
-+    case BINOP_GEQ:
-+      return STAP_OPERAND_PREC_ADD_CMP;
-+
-+    case BINOP_BITWISE_IOR:
-+    case BINOP_BITWISE_AND:
-+    case BINOP_BITWISE_XOR:
-+    case UNOP_LOGICAL_NOT:
-+      return STAP_OPERAND_PREC_BITWISE;
-+
-+    case BINOP_MUL:
-+    case BINOP_DIV:
-+    case BINOP_REM:
-+    case BINOP_LSH:
-+    case BINOP_RSH:
-+      return STAP_OPERAND_PREC_MUL;
++      struct cleanup *cleanup = make_cleanup_bfd_unref (nbfd);
 +
-+    default:
-+      return STAP_OPERAND_PREC_NONE;
++      symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE,
++                              NULL, 0, NULL);
++      do_cleanups (cleanup);
 +    }
-+}
+ }
+diff --git a/gdb/stack.c b/gdb/stack.c
+index 35d379d..04aab5e 100644
+--- a/gdb/stack.c
++++ b/gdb/stack.c
+@@ -509,6 +509,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
+   stb = mem_fileopen ();
+   old_chain = make_cleanup_ui_file_delete (stb);
++  /* Frame may be needed for check_typedef of TYPE_DYNAMIC.  */
++  make_cleanup_restore_selected_frame ();
++  select_frame (frame);
 +
-+/* Given S, read the operator in it and fills the OP pointer with its code.
-+   Return 1 on success, zero if the operator was not recognized.  */
+   if (func)
+     {
+       struct block *b = SYMBOL_BLOCK_VALUE (func);
+diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
+index e80fd25..2e53be0 100644
+--- a/gdb/symfile-mem.c
++++ b/gdb/symfile-mem.c
+@@ -54,6 +54,7 @@
+ #include "observer.h"
+ #include "auxv.h"
+ #include "elf/common.h"
++#include "gdb_bfd.h"
+ /* Verify parameters of target_read_memory_bfd and target_read_memory are
+    compatible.  */
+@@ -100,23 +101,24 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
+   if (nbfd == NULL)
+     error (_("Failed to read a valid object file image from memory."));
++  gdb_bfd_ref (nbfd);
+   if (name == NULL)
+-    nbfd->filename = xstrdup ("shared object read from target memory");
++    nbfd->filename = "shared object read from target memory";
+   else
+-    nbfd->filename = name;
+-
+-  if (!bfd_check_format (nbfd, bfd_object))
+     {
+-      /* FIXME: should be checking for errors from bfd_close (for one thing,
+-         on error it does not free all the storage associated with the
+-         bfd).  */
+-      bfd_close (nbfd);
+-      error (_("Got object file from memory but can't read symbols: %s."),
+-           bfd_errmsg (bfd_get_error ()));
++      nbfd->filename = name;
++      gdb_bfd_stash_filename (nbfd);
++      xfree (name);
+     }
++  cleanup = make_cleanup_bfd_unref (nbfd);
++
++  if (!bfd_check_format (nbfd, bfd_object))
++    error (_("Got object file from memory but can't read symbols: %s."),
++         bfd_errmsg (bfd_get_error ()));
++
+   sai = alloc_section_addr_info (bfd_count_sections (nbfd));
+-  cleanup = make_cleanup (xfree, sai);
++  make_cleanup (xfree, sai);
+   i = 0;
+   for (sec = nbfd->sections; sec != NULL; sec = sec->next)
+     if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+diff --git a/gdb/symfile.c b/gdb/symfile.c
+index 01252e2..95ed480 100644
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -55,6 +55,7 @@
+ #include "solib.h"
+ #include "remote.h"
+ #include "stack.h"
++#include "gdb_bfd.h"
+ #include <sys/types.h>
+ #include <fcntl.h>
+@@ -1036,7 +1037,7 @@ new_symfile_objfile (struct objfile *objfile, int add_flags)
+    loaded file.
+    ABFD is a BFD already open on the file, as from symfile_bfd_open.
+-   This BFD will be closed on error, and is always consumed by this function.
++   A new reference is acquired by this function.
+    ADD_FLAGS encodes verbosity, whether this is main symbol file or
+    extra, such as dynamically loaded code, and what to do with breakpoins.
+@@ -1060,7 +1061,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+                                        int flags, struct objfile *parent)
+ {
+   struct objfile *objfile;
+-  struct cleanup *my_cleanups;
+   const char *name = bfd_get_filename (abfd);
+   const int from_tty = add_flags & SYMFILE_VERBOSE;
+   const int mainline = add_flags & SYMFILE_MAINLINE;
+@@ -1074,8 +1074,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+       add_flags &= ~SYMFILE_NO_READ;
+     }
+-  my_cleanups = make_cleanup_bfd_close (abfd);
+-
+   /* Give user a chance to burp if we'd be
+      interactively wiping out any existing symbols.  */
+@@ -1086,7 +1084,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+     error (_("Not confirmed."));
+   objfile = allocate_objfile (abfd, flags | (mainline ? OBJF_MAINLINE : 0));
+-  discard_cleanups (my_cleanups);
+   if (parent)
+     add_separate_debug_objfile (objfile, parent);
+@@ -1207,8 +1204,13 @@ struct objfile *
+ symbol_file_add (char *name, int add_flags, struct section_addr_info *addrs,
+                int flags)
+ {
+-  return symbol_file_add_from_bfd (symfile_bfd_open (name), add_flags, addrs,
+-                                   flags, NULL);
++  bfd *bfd = symfile_bfd_open (name);
++  struct cleanup *cleanup = make_cleanup_bfd_unref (bfd);
++  struct objfile *objf;
 +
-+static int
-+stap_get_opcode (const char **s, enum exp_opcode *op)
-+{
-+  const char c = **s;
-+  int ret = 1;
++  objf = symbol_file_add_from_bfd (bfd, add_flags, addrs, flags, NULL);
++  do_cleanups (cleanup);
++  return objf;
+ }
+@@ -1350,7 +1352,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
+   if (filename_cmp (name, parent_objfile->name) == 0)
+     return 0;
+-  abfd = bfd_open_maybe_remote (name);
++  abfd = gdb_bfd_open_maybe_remote (name);
+   if (!abfd)
+     return 0;
+@@ -1372,7 +1374,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
+       if (abfd_stat.st_dev == parent_stat.st_dev
+         && abfd_stat.st_ino == parent_stat.st_ino)
+       {
+-        bfd_close (abfd);
++        gdb_bfd_unref (abfd);
+         return 0;
+       }
+       verified_as_different = 1;
+@@ -1382,7 +1384,7 @@ separate_debug_file_exists (const char *name, unsigned long crc,
+   file_crc_p = get_file_crc (abfd, &file_crc);
+-  bfd_close (abfd);
++  gdb_bfd_unref (abfd);
+   if (!file_crc_p)
+     return 0;
+@@ -1690,15 +1692,20 @@ set_initial_language (void)
+ }
+ /* If NAME is a remote name open the file using remote protocol, otherwise
+-   open it normally.  */
++   open it normally.  Returns a new reference to the BFD.  On error,
++   returns NULL with the BFD error set.  */
+ bfd *
+-bfd_open_maybe_remote (const char *name)
++gdb_bfd_open_maybe_remote (const char *name)
+ {
++  bfd *result;
 +
-+  *s += 1;
+   if (remote_filename_p (name))
+-    return remote_bfd_open (name, gnutarget);
++    result = remote_bfd_open (name, gnutarget);
+   else
+-    return bfd_openr (name, gnutarget);
++    result = gdb_bfd_openr (name, gnutarget);
 +
-+  switch (c)
-+    {
-+    case '*':
-+      *op = BINOP_MUL;
-+      break;
-+
-+    case '/':
-+      *op = BINOP_DIV;
-+      break;
-+
-+    case '%':
-+      *op = BINOP_REM;
-+    break;
-+
-+    case '<':
-+      *op = BINOP_LESS;
-+      if (**s == '<')
-+      {
-+        *s += 1;
-+        *op = BINOP_LSH;
-+      }
-+      else if (**s == '=')
-+      {
-+        *s += 1;
-+        *op = BINOP_LEQ;
-+      }
-+      else if (**s == '>')
-+      {
-+        *s += 1;
-+        *op = BINOP_NOTEQUAL;
-+      }
-+    break;
-+
-+    case '>':
-+      *op = BINOP_GTR;
-+      if (**s == '>')
-+      {
-+        *s += 1;
-+        *op = BINOP_RSH;
-+      }
-+      else if (**s == '=')
-+      {
-+        *s += 1;
-+        *op = BINOP_GEQ;
-+      }
-+    break;
-+
-+    case '|':
-+      *op = BINOP_BITWISE_IOR;
-+      if (**s == '|')
-+      {
-+        *s += 1;
-+        *op = BINOP_LOGICAL_OR;
-+      }
-+    break;
-+
-+    case '&':
-+      *op = BINOP_BITWISE_AND;
-+      if (**s == '&')
-+      {
-+        *s += 1;
-+        *op = BINOP_LOGICAL_AND;
-+      }
-+    break;
-+
-+    case '^':
-+      *op = BINOP_BITWISE_XOR;
-+      break;
-+
-+    case '!':
-+      *op = UNOP_LOGICAL_NOT;
-+      break;
-+
-+    case '+':
-+      *op = BINOP_ADD;
-+      break;
-+
-+    case '-':
-+      *op = BINOP_SUB;
-+      break;
-+
-+    case '=':
-+      if (**s != '=')
-+      {
-+        ret = 0;
-+        break;
-+      }
-+      *op = BINOP_EQUAL;
-+      break;
-+
-+    default:
-+      /* We didn't find any operator.  */
-+      *s -= 1;
-+      return 0;
-+    }
-+
-+  return ret;
-+}
-+
-+/* Given the bitness of the argument, represented by B, return the
-+   corresponding `struct type *'.  */
-+
-+static struct type *
-+stap_get_expected_argument_type (struct gdbarch *gdbarch,
-+                               enum stap_arg_bitness b)
-+{
-+  switch (b)
-+    {
-+    case STAP_ARG_BITNESS_UNDEFINED:
-+      if (gdbarch_addr_bit (gdbarch) == 32)
-+      return builtin_type (gdbarch)->builtin_uint32;
-+      else
-+      return builtin_type (gdbarch)->builtin_uint64;
-+
-+    case STAP_ARG_BITNESS_32BIT_SIGNED:
-+      return builtin_type (gdbarch)->builtin_int32;
-+
-+    case STAP_ARG_BITNESS_32BIT_UNSIGNED:
-+      return builtin_type (gdbarch)->builtin_uint32;
-+
-+    case STAP_ARG_BITNESS_64BIT_SIGNED:
-+      return builtin_type (gdbarch)->builtin_int64;
-+
-+    case STAP_ARG_BITNESS_64BIT_UNSIGNED:
-+      return builtin_type (gdbarch)->builtin_uint64;
-+
-+    default:
-+      internal_error (__FILE__, __LINE__,
-+                    _("Undefined bitness for probe."));
-+      break;
-+    }
-+}
-+
-+static void
-+stap_parse_register_operand (struct stap_parse_info *p)
-+{
-+  /* Simple flag to indicate whether we have seen a minus signal before
-+     certain number.  */
-+  int got_minus = 0;
-+  /* Flags to indicate whether this register access is being displaced and/or
-+     indirected.  */
-+  int disp_p = 0, indirect_p = 0;
-+  struct gdbarch *gdbarch = p->gdbarch;
-+  /* Needed to generate the register name as a part of an expression.  */
-+  struct stoken str;
-+  /* Variables used to extract the register name from the probe's
-+     argument.  */
-+  const char *start;
-+  char *regname;
-+  int len;
-+
-+  /* Prefixes for the parser.  */
-+  const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch);
-+  const char *reg_ind_prefix
-+    = gdbarch_stap_register_indirection_prefix (gdbarch);
-+  const char *gdb_reg_prefix = gdbarch_stap_gdb_register_prefix (gdbarch);
-+  int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0;
-+  int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0;
-+  int gdb_reg_prefix_len = gdb_reg_prefix ? strlen (gdb_reg_prefix) : 0;
-+
-+  /* Sufixes for the parser.  */
-+  const char *reg_sufix = gdbarch_stap_register_sufix (gdbarch);
-+  const char *reg_ind_sufix
-+    = gdbarch_stap_register_indirection_sufix (gdbarch);
-+  const char *gdb_reg_sufix = gdbarch_stap_gdb_register_sufix (gdbarch);
-+  int reg_sufix_len = reg_sufix ? strlen (reg_sufix) : 0;
-+  int reg_ind_sufix_len = reg_ind_sufix ? strlen (reg_ind_sufix) : 0;
-+  int gdb_reg_sufix_len = gdb_reg_sufix ? strlen (gdb_reg_sufix) : 0;
-+
-+  /* Checking for a displacement argument.  */
-+  if (*p->arg == '+')
-+    /* If it's a plus sign, we don't need to do anything, just advance the
-+       pointer.  */
-+    ++p->arg;
-+
-+  if (*p->arg == '-')
-+    {
-+      got_minus = 1;
-+      ++p->arg;
-+    }
-+
-+  if (isdigit (*p->arg))
-+    {
-+      /* The value of the displacement.  */
-+      long displacement;
-+
-+      disp_p = 1;
-+      displacement = strtol (p->arg, (char **) &p->arg, 10);
-+
-+      /* Generating the expression for the displacement.  */
-+      write_exp_elt_opcode (OP_LONG);
-+      write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
-+      write_exp_elt_longcst (displacement);
-+      write_exp_elt_opcode (OP_LONG);
-+      if (got_minus)
-+      write_exp_elt_opcode (UNOP_NEG);
-+    }
-+
-+  /* Getting rid of register indirection prefix.  */
-+  if (reg_ind_prefix
-+      && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0)
-+    {
-+      indirect_p = 1;
-+      p->arg += reg_ind_prefix_len;
-+    }
-+
-+  if (disp_p && !indirect_p)
-+    error (_("Invalid register displacement syntax on expression `%s'."),
-+         p->saved_arg);
-+
-+  /* Getting rid of register prefix.  */
-+  if (reg_prefix && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0)
-+    p->arg += reg_prefix_len;
-+
-+  /* Now we should have only the register name.  Let's extract it and get
-+     the associated number.  */
-+  start = p->arg;
-+
-+  /* We assume the register name is composed by letters and numbers.  */
-+  while (isalnum (*p->arg))
-+    ++p->arg;
-+
-+  len = p->arg - start;
-+
-+  regname = alloca (len + gdb_reg_prefix_len + gdb_reg_sufix_len + 1);
-+  regname[0] = '\0';
-+
-+  /* We only add the GDB's register prefix/sufix if we are dealing with
-+     a numeric register.  */
-+  if (gdb_reg_prefix && isdigit (*start))
-+    {
-+      strncpy (regname, gdb_reg_prefix, gdb_reg_prefix_len);
-+      strncpy (regname + gdb_reg_prefix_len, start, len);
-+
-+      if (gdb_reg_sufix)
-+      strncpy (regname + gdb_reg_prefix_len + len,
-+               gdb_reg_sufix, gdb_reg_sufix_len);
-+
-+      len += gdb_reg_prefix_len + gdb_reg_sufix_len;
-+    }
-+  else
-+    strncpy (regname, start, len);
-+
-+  regname[len] = '\0';
-+  /* Is this a valid register name?  */
-+  if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
-+    error (_("Invalid register name `%s' on expression `%s'."),
-+         regname, p->saved_arg);
-+
-+  write_exp_elt_opcode (OP_REGISTER);
-+  str.ptr = regname;
-+  str.length = len;
-+  write_exp_string (str);
-+  write_exp_elt_opcode (OP_REGISTER);
-+
-+  if (indirect_p)
-+    {
-+      if (disp_p)
-+      write_exp_elt_opcode (BINOP_ADD);
-+
-+      /* Casting to the expected type.  */
-+      write_exp_elt_opcode (UNOP_CAST);
-+      write_exp_elt_type (lookup_pointer_type (p->arg_type));
-+      write_exp_elt_opcode (UNOP_CAST);
-+
-+      write_exp_elt_opcode (UNOP_IND);
-+    }
-+
-+  /* Getting rid of the register name sufix.  */
-+  if (reg_sufix)
-+    {
-+      if (strncmp (p->arg, reg_sufix, reg_sufix_len) != 0)
-+      error (_("Missing register name sufix `%s' on expression `%s'."),
-+             reg_sufix, p->saved_arg);
-+
-+      p->arg += reg_sufix_len;
-+    }
-+
-+  /* Getting rid of the register indirection sufix.  */
-+  if (indirect_p && reg_ind_sufix)
-+    {
-+      if (strncmp (p->arg, reg_ind_sufix, reg_ind_sufix_len) != 0)
-+      error (_("Missing indirection sufix `%s' on expression `%s'."),
-+             reg_ind_sufix, p->saved_arg);
-+
-+      p->arg += reg_ind_sufix_len;
-+    }
-+}
-+
-+static void
-+stap_parse_single_operand (struct stap_parse_info *p)
-+{
-+  struct gdbarch *gdbarch = p->gdbarch;
-+  /* Prefixes for the parser.  */
-+  const char *const_prefix = gdbarch_stap_integer_prefix (gdbarch);
-+  const char *reg_prefix = gdbarch_stap_register_prefix (gdbarch);
-+  const char *reg_ind_prefix
-+    = gdbarch_stap_register_indirection_prefix (gdbarch);
-+  int const_prefix_len = const_prefix ? strlen (const_prefix) : 0;
-+  int reg_prefix_len = reg_prefix ? strlen (reg_prefix) : 0;
-+  int reg_ind_prefix_len = reg_ind_prefix ? strlen (reg_ind_prefix) : 0;
-+
-+  /* Sufixes for the parser.  */
-+  const char *const_sufix = gdbarch_stap_integer_sufix (gdbarch);
-+  const char *reg_sufix = gdbarch_stap_register_sufix (gdbarch);
-+  const char *reg_ind_sufix
-+    = gdbarch_stap_register_indirection_sufix (gdbarch);
-+  int const_sufix_len = const_sufix ? strlen (const_sufix) : 0;
-+  int reg_sufix_len = reg_sufix ? strlen (reg_sufix) : 0;
-+  int reg_ind_sufix_len = reg_ind_sufix ? strlen (reg_ind_sufix) : 0;
-+
-+  /* We first try to parse this token as a "special token".  */
-+  if (gdbarch_stap_parse_special_token_p (gdbarch))
-+    {
-+      int ret = gdbarch_stap_parse_special_token (gdbarch, p);
-+
-+      if (ret)
-+      /* If the return value of the above function is not zero,
-+         it means it successfully parsed the special token.
-+
-+         If it is NULL, we try to parse it using our method.  */
-+      return;
-+    }
-+
-+  if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+')
-+    {
-+      char c = *p->arg;
-+      /* We use this variable to do a lookahead.  */
-+      const char *tmp = p->arg;
-+
-+      ++tmp;
-+
-+      /* This is an unary operation.  Here is a list of allowed tokens
-+       here:
-+
-+       - numeric literal;
-+       - number (from register displacement)
-+       - subexpression (beginning with `(')
-+
-+       We handle the register displacement here, and the other cases
-+       recursively.  */
-+      if (isdigit (*tmp))
-+      {
-+        int number = strtol (tmp, (char **) &tmp, 10);
-+
-+        if (p->inside_paren_p)
-+          tmp = skip_spaces_const (tmp);
-+        if (!reg_ind_prefix
-+            || strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0)
-+          goto not_displacement;
-+
-+        /* If we are here, it means it is a displacement.  The only
-+           operations allowed here are `-' and `+'.  */
-+        if (c == '~')
-+          error (_("Invalid operator `%c' for register displacement "
-+                   "on expression `%s'."), c, p->saved_arg);
-+
-+        stap_parse_register_operand (p);
-+      }
-+      else
-+not_displacement:
-+      {
-+        p->arg = tmp;
-+        stap_parse_argument_conditionally (p);
-+        if (c == '-')
-+          write_exp_elt_opcode (UNOP_NEG);
-+        else if (c == '~')
-+          write_exp_elt_opcode (UNOP_COMPLEMENT);
-+      }
-+    }
-+  else if (isdigit (*p->arg))
-+    {
-+      /* A temporary variable, needed for lookahead.  */
-+      const char *tmp = p->arg;
-+      long number;
-+
-+      /* We can be dealing with a numeric constant (if `const_prefix' is
-+       NULL), or with a register displacement.  */
-+      number = strtol (tmp, (char **) &tmp, 10);
-+
-+      if (p->inside_paren_p)
-+      tmp = skip_spaces_const (tmp);
-+      if (!const_prefix && reg_ind_prefix
-+        && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) != 0)
-+      {
-+        /* We are dealing with a numeric constant.  */
-+        write_exp_elt_opcode (OP_LONG);
-+        write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
-+        write_exp_elt_longcst (number);
-+        write_exp_elt_opcode (OP_LONG);
-+
-+        p->arg = tmp;
-+
-+        if (const_sufix)
-+          {
-+            if (strncmp (p->arg, const_sufix, const_sufix_len) == 0)
-+              p->arg += const_sufix_len;
-+            else
-+              error (_("Invalid constant sufix on expression `%s'."),
-+                     p->saved_arg);
-+          }
-+      }
-+      else if (reg_ind_prefix
-+             && strncmp (tmp, reg_ind_prefix, reg_ind_prefix_len) == 0)
-+      stap_parse_register_operand (p);
-+      else
-+      error (_("Unknown numeric token on expression `%s'."),
-+             p->saved_arg);
-+    }
-+  else if (const_prefix
-+         && strncmp (p->arg, const_prefix, const_prefix_len) == 0)
-+    {
-+      /* We are dealing with a numeric constant.  */
-+      long number;
-+
-+      p->arg += const_prefix_len;
-+      number = strtol (p->arg, (char **) &p->arg, 10);
-+
-+      write_exp_elt_opcode (OP_LONG);
-+      write_exp_elt_type (builtin_type (gdbarch)->builtin_long);
-+      write_exp_elt_longcst (number);
-+      write_exp_elt_opcode (OP_LONG);
-+
-+      if (const_sufix)
-+      {
-+        if (strncmp (p->arg, const_sufix, const_sufix_len) == 0)
-+          p->arg += const_sufix_len;
-+        else
-+          error (_("Invalid constant sufix on expression `%s'."),
-+                 p->saved_arg);
-+      }
-+    }
-+  else if ((reg_prefix
-+          && strncmp (p->arg, reg_prefix, reg_prefix_len) == 0)
-+         || (reg_ind_prefix
-+             && strncmp (p->arg, reg_ind_prefix, reg_ind_prefix_len) == 0))
-+    stap_parse_register_operand (p);
-+  else
-+    error (_("Operator `%c' not recognized on expression `%s'."),
-+         *p->arg, p->saved_arg);
-+}
-+
-+static void
-+stap_parse_argument_conditionally (struct stap_parse_info *p)
-+{
-+  if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' /* Unary.  */
-+      || isdigit (*p->arg)
-+      || gdbarch_stap_is_single_operand (p->gdbarch, p->arg))
-+    stap_parse_single_operand (p);
-+  else if (*p->arg == '(')
-+    {
-+      /* We are dealing with a parenthesized operand.  It means we
-+       have to parse it as it was a separate expression, without
-+       left-side or precedence.  */
-+      ++p->arg;
-+      p->arg = skip_spaces_const (p->arg);
-+      ++p->inside_paren_p;
-+
-+      stap_parse_argument_1 (p, 0, STAP_OPERAND_PREC_NONE);
-+
-+      --p->inside_paren_p;
-+      if (*p->arg != ')')
-+      error (_("Missign close-paren on expression `%s'."),
-+             p->saved_arg);
-+
-+      ++p->arg;
-+      if (p->inside_paren_p)
-+      p->arg = skip_spaces_const (p->arg);
-+    }
-+  else
-+    error (_("Cannot parse expression `%s'."), p->saved_arg);
-+}
-+
-+static void
-+stap_parse_argument_1 (struct stap_parse_info *p, int has_lhs,
-+                     enum stap_operand_prec prec)
-+{
-+  /* This is an operator-precedence parser.
-+
-+     We work with left- and right-sides of expressions, and
-+     parse them depending on the precedence of the operators
-+     we find.  */
-+
-+  if (p->inside_paren_p)
-+    p->arg = skip_spaces_const (p->arg);
-+
-+  if (!has_lhs)
-+    /* We were called without a left-side, either because this is the
-+       first call, or because we were called to parse a parenthesized
-+       expression.  It doesn't really matter; we have to parse the
-+       left-side in order to continue the process.  */
-+    stap_parse_argument_conditionally (p);
-+
-+  /* Start to parse the right-side, and to "join" left and right sides
-+     depending on the operation specified.
-+
-+     This loop shall continue until we run out of characters in the input,
-+     or until we find a close-parenthesis, which means that we've reached
-+     the end of a sub-expression.  */
-+  while (p->arg && *p->arg && *p->arg != ')' && !isspace (*p->arg))
-+    {
-+      const char *tmp_exp_buf;
-+      enum exp_opcode opcode;
-+      enum stap_operand_prec cur_prec;
-+
-+      if (!stap_is_operator (*p->arg))
-+      error (_("Invalid operator `%c' on expression `%s'."), *p->arg,
-+             p->saved_arg);
-+
-+      /* We have to save the current value of the expression buffer because
-+       the `stap_get_opcode' modifies it in order to get the current
-+       operator.  If this operator's precedence is lower than PREC, we
-+       should return and not advance the expression buffer pointer.  */
-+      tmp_exp_buf = p->arg;
-+      stap_get_opcode (&tmp_exp_buf, &opcode);
-+
-+      cur_prec = stap_get_operator_prec (opcode);
-+      if (cur_prec < prec)
-+      /* If the precedence of the operator that we are seeing now is
-+         lower than the precedence of the first operator seen before
-+         this parsing process began, it means we should stop parsing
-+         and return.  */
-+      break;
-+
-+      p->arg = tmp_exp_buf;
-+      if (p->inside_paren_p)
-+      p->arg = skip_spaces_const (p->arg);
-+
-+      /* Parse the right-side of the expression.  */
-+      stap_parse_argument_conditionally (p);
-+
-+      /* While we still have operators, try to parse another
-+       right-side, but using the current right-side as a left-side.  */
-+      while (*p->arg && stap_is_operator (*p->arg))
-+      {
-+        enum exp_opcode lookahead_opcode;
-+        enum stap_operand_prec lookahead_prec;
-+
-+        /* Saving the current expression buffer position.  The explanation
-+           is the same as above.  */
-+        tmp_exp_buf = p->arg;
-+        stap_get_opcode (&tmp_exp_buf, &lookahead_opcode);
-+        lookahead_prec = stap_get_operator_prec (lookahead_opcode);
-+
-+        if (lookahead_prec <= prec)
-+          /* If we are dealing with an operator whose precedence is lower
-+             than the first one, just abandon the attempt.  */
-+          break;
-+
-+        /* Parse the right-side of the expression, but since we already
-+           have a left-side at this point, set `has_lhs' to 1.  */
-+        stap_parse_argument_1 (p, 1, lookahead_prec);
-+      }
-+
-+      write_exp_elt_opcode (opcode);
-+    }
-+}
-+
-+/* Parse a probe's argument.
-+
-+   Assuming that:
-+
-+   LP = literal integer prefix
-+   LS = literal integer sufix
-+
-+   RP = register prefix
-+   RS = register sufix
-+
-+   RIP = register indirection prefix
-+   RIS = register indirection sufix
-+
-+   This routine assumes that arguments' tokens are of the form:
-+
-+   - [LP] NUMBER [LS]
-+   - [RP] REGISTER [RS]
-+   - [RIP] [RP] REGISTER [RS] [RIS]
-+   - If we find a number without LP, we try to parse it as a literal integer
-+   constant (if LP == NULL), or as a register displacement.
-+   - We count parenthesis, and only skip whitespaces if we are inside them.
-+   - If we find an operator, we skip it.
-+
-+   This function can also call a special function that will try to match
-+   unknown tokens.  It will return 1 if the argument has been parsed
-+   successfully, or zero otherwise.  */
-+
-+static int
-+stap_parse_argument (const char **arg, struct type *atype,
-+                   struct gdbarch *gdbarch)
-+{
-+  struct stap_parse_info p;
-+  volatile struct gdb_exception e;
-+
-+  /* We need to initialize the expression buffer, in order to begin
-+     our parsing efforts.  The language here does not matter, since we
-+     are using our own parser.  */
-+  initialize_expout (10, current_language, gdbarch);
++  return result;
+ }
+@@ -1716,19 +1723,14 @@ symfile_bfd_open (char *name)
+   if (remote_filename_p (name))
+     {
+-      name = xstrdup (name);
+       sym_bfd = remote_bfd_open (name, gnutarget);
+       if (!sym_bfd)
+-      {
+-        make_cleanup (xfree, name);
+-        error (_("`%s': can't open to read symbols: %s."), name,
+-               bfd_errmsg (bfd_get_error ()));
+-      }
++      error (_("`%s': can't open to read symbols: %s."), name,
++             bfd_errmsg (bfd_get_error ()));
+       if (!bfd_check_format (sym_bfd, bfd_object))
+       {
+-        bfd_close (sym_bfd);
+-        make_cleanup (xfree, name);
++        make_cleanup_bfd_unref (sym_bfd);
+         error (_("`%s': can't read symbols: %s."), name,
+                bfd_errmsg (bfd_get_error ()));
+       }
+@@ -1757,12 +1759,11 @@ symfile_bfd_open (char *name)
+       perror_with_name (name);
+     }
+-  /* Free 1st new malloc'd copy, but keep the 2nd malloc'd copy in
+-     bfd.  It'll be freed in free_objfile().  */
+   xfree (name);
+   name = absolute_name;
++  make_cleanup (xfree, name);
+-  sym_bfd = bfd_fopen (name, gnutarget, FOPEN_RB, desc);
++  sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc);
+   if (!sym_bfd)
+     {
+       make_cleanup (xfree, name);
+@@ -1773,18 +1774,11 @@ symfile_bfd_open (char *name)
+   if (!bfd_check_format (sym_bfd, bfd_object))
+     {
+-      /* FIXME: should be checking for errors from bfd_close (for one
+-         thing, on error it does not free all the storage associated
+-         with the bfd).  */
+-      bfd_close (sym_bfd);    /* This also closes desc.  */
+-      make_cleanup (xfree, name);
++      make_cleanup_bfd_unref (sym_bfd);
+       error (_("`%s': can't read symbols: %s."), name,
+            bfd_errmsg (bfd_get_error ()));
+     }
+-  /* bfd_usrdata exists for applications and libbfd must not touch it.  */
+-  gdb_assert (bfd_usrdata (sym_bfd) == NULL);
+-
+   return sym_bfd;
+ }
+@@ -2109,17 +2103,14 @@ generic_load (char *args, int from_tty)
+     }
+   /* Open the file for loading.  */
+-  loadfile_bfd = bfd_openr (filename, gnutarget);
++  loadfile_bfd = gdb_bfd_openr (filename, gnutarget);
+   if (loadfile_bfd == NULL)
+     {
+       perror_with_name (filename);
+       return;
+     }
+-  /* FIXME: should be checking for errors from bfd_close (for one thing,
+-     on error it does not free all the storage associated with the
+-     bfd).  */
+-  make_cleanup_bfd_close (loadfile_bfd);
++  make_cleanup_bfd_unref (loadfile_bfd);
+   if (!bfd_check_format (loadfile_bfd, bfd_object))
+     {
+@@ -2518,15 +2509,18 @@ reread_symbols (void)
+         /* Clean up any state BFD has sitting around.  We don't need
+            to close the descriptor but BFD lacks a way of closing the
+            BFD without closing the descriptor.  */
+-        obfd_filename = bfd_get_filename (objfile->obfd);
+-        if (!bfd_close (objfile->obfd))
+-          error (_("Can't close BFD for %s: %s"), objfile->name,
+-                 bfd_errmsg (bfd_get_error ()));
+-        objfile->obfd = bfd_open_maybe_remote (obfd_filename);
++        {
++          struct bfd *obfd = objfile->obfd;
 +
-+  p.saved_arg = *arg;
-+  p.arg = *arg;
-+  p.arg_type = atype;
-+  p.gdbarch = gdbarch;
-+  p.inside_paren_p = 0;
++          obfd_filename = bfd_get_filename (objfile->obfd);
++          /* Open the new BFD before freeing the old one, so that
++             the filename remains live.  */
++          objfile->obfd = gdb_bfd_open_maybe_remote (obfd_filename);
++          gdb_bfd_unref (obfd);
++        }
 +
-+  TRY_CATCH (e, RETURN_MASK_ERROR)
-+    {
-+      stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE);
-+    }
-+  if (e.reason < 0)
-+    {
-+      xfree (expout);
-+      return 0;
+         if (objfile->obfd == NULL)
+           error (_("Can't open %s to read symbols."), objfile->name);
+-        else
+-          objfile->obfd = gdb_bfd_ref (objfile->obfd);
+         /* bfd_openr sets cacheable to true, which is what we want.  */
+         if (!bfd_check_format (objfile->obfd, bfd_object))
+           error (_("Can't read symbols from %s: %s."), objfile->name,
+diff --git a/gdb/symfile.h b/gdb/symfile.h
+index aca7359..184a83e 100644
+--- a/gdb/symfile.h
++++ b/gdb/symfile.h
+@@ -553,7 +553,7 @@ extern void find_lowest_section (bfd *, asection *, void *);
+ extern bfd *symfile_bfd_open (char *);
+-extern bfd *bfd_open_maybe_remote (const char *);
++extern bfd *gdb_bfd_open_maybe_remote (const char *);
+ extern int get_section_index (struct objfile *, char *);
+diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
+index 678639c..47a2202 100644
+--- a/gdb/testsuite/gdb.ada/packed_array.exp
++++ b/gdb/testsuite/gdb.ada/packed_array.exp
+@@ -60,5 +60,11 @@ gdb_test_multiple "$test" "$test" {
+         # are.  Observed with (FSF GNU Ada 4.5.3 20110124).
+         xfail $test
+     }
++    -re "= \\(\\)\[\r\n\]+$gdb_prompt $" {
++      # archer-jankratochvil-vla resolves it as a dynamic type resolved as an
++      # empty array [0..-1].
++      # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref)
++        xfail $test
 +    }
-+
-+  gdb_assert (p.inside_paren_p == 0);
-+
-+  /* Casting the final expression to the appropriate type.  */
-+  write_exp_elt_opcode (UNOP_CAST);
-+  write_exp_elt_type (atype);
-+  write_exp_elt_opcode (UNOP_CAST);
-+
-+  reallocate_expout ();
-+
-+  p.arg = skip_spaces_const (p.arg);
-+  *arg = p.arg;
-+
-+  return 1;
-+}
-+
-+/* Helper function which is responsible for freeing the space allocated to
-+   hold information about a probe's arguments.  */
-+
-+static void
-+stap_free_args_info (void *args_info_ptr)
-+{
-+  struct stap_args_info *a = (struct stap_args_info *) args_info_ptr;
-+  int i;
-+
-+  for (i = 0; i < a->n_args; i++)
-+    xfree (a->args[i].aexpr);
-+
-+  xfree (a->args);
-+  xfree (a);
-+}
-+
-+/* Function which parses an argument string from PROBE, correctly splitting
-+   the arguments and storing their information in properly ways.
-+
-+   Consider the following argument string (x86 syntax):
-+
-+   `4@%eax 4@$10'
-+
-+   We have two arguments, `%eax' and `$10', both with 32-bit unsigned bitness.
-+   This function basically handles them, properly filling some structures with
-+   this information.  */
-+
-+static void
-+stap_parse_probe_arguments (struct stap_probe *probe)
-+{
-+  struct stap_args_info *args_info;
-+  struct cleanup *back_to;
-+  const char *cur = probe->args;
-+  int current_arg = -1;
-+  /* This is a state-machine parser, which means we will always be
-+     in a known state when parsing an argument.  The state could be
-+     either `NEW_ARG' if we are parsing a new argument, `BITNESS' if
-+     we are parsing the bitness-definition part (i.e., `4@'), or
-+     `PARSE_ARG' if we are actually parsing the argument part.  */
-+  enum
-+    {
-+      NEW_ARG,
-+      BITNESS,
-+      PARSE_ARG,
-+    } current_state;
-+
-+  /* For now, we assume everything is not going to work.  */
-+  probe->parsed_args = &dummy_stap_args_info;
-+
-+  if (!cur || !*cur || *cur == ':')
-+    return;
-+
-+  args_info = xmalloc (sizeof (struct stap_args_info));
-+  args_info->n_args = 0;
-+  back_to = make_cleanup (stap_free_args_info, args_info);
-+  args_info->args = xcalloc (STAP_MAX_ARGS, sizeof (struct stap_probe_arg));
-+
-+  /* Ok, let's start.  */
-+  current_state = NEW_ARG;
-+
-+  while (*cur)
-+    {
-+      switch (current_state)
-+      {
-+      case NEW_ARG:
-+        ++current_arg;
-+
-+        if (current_arg >= STAP_MAX_ARGS)
-+          {
-+            complaint (&symfile_complaints,
-+                       _("probe `%s' has more arguments than the maximum "
-+                         "allowed"), probe->name);
-+            do_cleanups (back_to);
-+            return;
-+          }
-+
-+        current_state = BITNESS;
-+        break;
-+
-+      case BITNESS:
-+          {
-+            enum stap_arg_bitness b;
-+            int got_minus = 0;
-+
-+            /* We expect to find something like:
-+
-+               N@OP
-+
-+               Where `N' can be [+,-][4,8].  This is not mandatory, so
-+               we check it here.  If we don't find it, go to the next
-+               state.  */
-+            if ((*cur == '-' && cur[1] && cur[2] != '@')
-+                && cur[1] != '@')
-+              {
-+                current_state = PARSE_ARG;
-+                args_info->args[current_arg].bitness
-+                  = STAP_ARG_BITNESS_UNDEFINED;
-+                break;
-+              }
-+
-+            if (*cur == '-')
-+              {
-+                /* Discard the `-'.  */
-+                ++cur;
-+                got_minus = 1;
-+              }
-+
-+            if (*cur == '4')
-+              b = got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED
-+                : STAP_ARG_BITNESS_32BIT_UNSIGNED;
-+            else if (*cur == '8')
-+              b = got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED
-+                : STAP_ARG_BITNESS_64BIT_UNSIGNED;
-+            else
-+              {
-+                /* We have an error, because we don't expect anything
-+                   except 4 and 8.  */
-+                complaint (&symfile_complaints,
-+                           _("unrecognized bitness `%c' for probe `%s'"),
-+                           *cur, probe->name);
-+                do_cleanups (back_to);
-+                return;
-+              }
-+
-+            args_info->args[current_arg].bitness = b;
-+            args_info->args[current_arg].atype
-+              = stap_get_expected_argument_type (probe->gdbarch, b);
-+            /* Discard the number and the `@' sign.  */
-+            cur += 2;
-+            /* Move on.  */
-+            current_state = PARSE_ARG;
-+          }
-+        break;
-+
-+      case PARSE_ARG:
-+          {
-+            if (!stap_parse_argument (&cur,
-+                                      args_info->args[current_arg].atype,
-+                                      probe->gdbarch))
-+              {
-+                /* We have tried to parse this argument, but it's
-+                   malformed.  This is an error.  */
-+                complaint (&symfile_complaints,
-+                           _("malformed argument for probe `%s'"),
-+                           probe->name);
-+                do_cleanups (back_to);
-+                return;
-+              }
-+
-+            if (stap_expression_debug)
-+              dump_raw_expression (expout, gdb_stdlog,
-+                                   "before conversion to prefix form");
-+
-+            prefixify_expression (expout);
-+
-+            if (stap_expression_debug)
-+              dump_prefix_expression (expout, gdb_stdlog);
-+
-+            args_info->args[current_arg].aexpr = expout;
-+            expout = NULL;
-+
-+            ++args_info->n_args;
-+            /* Start it over again.  */
-+            cur = skip_spaces_const (cur);
-+            current_state = NEW_ARG;
-+          }
-+        break;
-+      }
-+
-+      if (!*cur && current_state != NEW_ARG)
-+      {
-+        /* We reached the end of the argument string, but we're
-+           still in the middle of the process of parsing an argument.
-+           It means the argument string is malformed.  */
-+        complaint (&symfile_complaints,
-+                   _("malformed argument for probe `%s'"),
-+                   probe->name);
-+        do_cleanups (back_to);
-+        return;
-+      }
-+    }
-+
-+  args_info->args = xrealloc (args_info->args,
-+                            args_info->n_args
-+                            * sizeof (struct stap_probe_arg));
-+  args_info->probe = probe;
-+
-+  probe->parsed_args = args_info;
-+
-+  discard_cleanups (back_to);
-+}
-+
-+/* See definition in stap-probe.h.  */
-+
-+int
-+stap_get_probe_argument_count (struct stap_probe *probe)
-+{
-+  if (!probe->parsed_args)
-+    stap_parse_probe_arguments (probe);
-+
-+  return probe->parsed_args->n_args;
-+}
-+
-+/* Return 1 if OP is a valid operator inside a probe argument, or zero
-+   otherwise.  */
-+
-+static int
-+stap_is_operator (char op)
-+{
-+  return (op == '+' || op == '-' || op == '*' || op == '/'
-+        || op == '>' || op == '<' || op == '!' || op == '^'
-+        || op == '|' || op == '&' || op == '%' || op == '=');
-+}
-+
-+/* See definition in stap-probe.h.  */
-+
-+struct value *
-+stap_evaluate_probe_argument (struct objfile *objfile,
-+                            struct stap_probe *probe,
-+                            struct frame_info *frame,
-+                            int n)
-+{
-+  int pos = 0;
-+
-+  if (!probe->parsed_args)
-+    stap_parse_probe_arguments (probe);
-+
-+  if (!probe->parsed_args->args
-+      || n >= probe->parsed_args->n_args)
-+    return NULL;
-+
-+  /* This is needed because on some architectures (e.g., ARM) we need
-+     the frame's gdbarch in order to compute the value of the frame
-+     pointer.  */
-+  probe->parsed_args->args[n].aexpr->gdbarch = get_frame_arch (frame);
-+
-+  return evaluate_subexp_standard (probe->parsed_args->args[n].atype,
-+                                 probe->parsed_args->args[n].aexpr,
-+                                 &pos, EVAL_NORMAL);
-+}
-+
-+/* See definition in stap-probe.h.  */
-+
-+void
-+stap_compile_to_ax (struct objfile *objfile,
-+                  struct stap_probe *probe,
-+                  struct agent_expr *expr,
-+                  struct axs_value *value,
-+                  int n)
-+{
-+  union exp_element *pc;
-+
-+  if (!probe->parsed_args)
-+    stap_parse_probe_arguments (probe);
-+
-+  if (!probe->parsed_args->args
-+      || n >= probe->parsed_args->n_args)
-+    return;
-+
-+  pc = probe->parsed_args->args[n].aexpr->elts;
-+  gen_expr (probe->parsed_args->args[n].aexpr, &pc, expr, value);
-+
-+  require_rvalue (expr, value);
-+  value->type = probe->parsed_args->args[n].atype;
-+}
-+
-+struct value *
-+stap_safe_evaluate_at_pc (struct frame_info *frame, int n)
-+{
-+  struct stap_probe *probe;
-+  struct objfile *objfile;
-+  int n_probes;
-+
-+  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
-+  if (!probe)
-+    return NULL;
-+  gdb_assert (objfile->sf && objfile->sf->sym_probe_fns);
-+
-+  n_probes
-+    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
-+                                                              probe);
-+  if (n >= n_probes)
-+    return NULL;
-+
-+  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
-+                                                                probe,
-+                                                                frame,
-+                                                                n);
-+}
-+
-+/* This function frees the space allocated to hold information about
-+   the probe's parsed arguments.  */
-+
-+void
-+stap_free_parsed_args (struct stap_args_info *parsed_args)
-+{
-+  int i;
-+
-+  if (!parsed_args
-+      || parsed_args == &dummy_stap_args_info
-+      || parsed_args->n_args == 0)
-+    return;
-+
-+  for (i = 0; i < parsed_args->n_args; i++)
-+    xfree (parsed_args->args[i].aexpr);
-+
-+  xfree (parsed_args->args);
-+  xfree (parsed_args);
-+}
-+
-+/* A utility structure.  A VEC of these is built when handling "info
-+   probes".  */
-+
-+struct stap_probe_and_objfile
-+{
-+  /* The probe.  */
-+  struct stap_probe *probe;
-+  /* The probe's objfile.  */
-+  struct objfile *objfile;
-+};
-+
-+typedef struct stap_probe_and_objfile stap_entry;
-+DEF_VEC_O (stap_entry);
-+
-+/* A helper function for collect_probes that compiles a regexp and
-+   throws an exception on error.  This installs a cleanup to free the
-+   resulting pattern on success.  If RX is NULL, this does nothing.  */
-+
-+static void
-+compile_rx_or_error (regex_t *pattern, const char *rx, const char *message)
-+{
-+  int code;
-+
-+  if (!rx)
-+    return;
-+
-+  code = regcomp (pattern, rx, REG_NOSUB);
-+  if (code == 0)
-+    make_regfree_cleanup (pattern);
-+  else
-+    {
-+      char *err = get_regcomp_error (code, pattern);
-+
-+      make_cleanup (xfree, err);
-+      error (_("%s: %s"), message, err);
-+    }
-+}
-+
-+/* Make a vector of probes matching OBJNAME, PROVIDER, and PROBE.
-+   Each argument is a regexp, or NULL, which matches anything.  */
-+
-+static VEC (stap_entry) *
-+collect_probes (char *objname, char *provider, char *probe)
-+{
-+  struct objfile *objfile;
-+  VEC (stap_entry) *result = NULL;
-+  struct cleanup *cleanup;
-+  regex_t obj_pat, prov_pat, probe_pat;
-+
-+  cleanup = make_cleanup (VEC_cleanup (stap_entry), &result);
-+
-+  compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
-+  compile_rx_or_error (&probe_pat, probe, _("Invalid probe regexp"));
-+  compile_rx_or_error (&obj_pat, objname, _("Invalid object file regexp"));
-+
-+  ALL_OBJFILES (objfile)
-+  {
-+    struct stap_probe *probes;
-+    int i, num_probes;
-+
-+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
-+      continue;
-+
-+    if (objname)
-+      {
-+      if (regexec (&obj_pat, objfile->name, 0, NULL, 0) != 0)
-+        continue;
-+      }
-+
-+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
-+    for (i = 0; i < num_probes; ++i)
-+      {
-+      stap_entry entry;
-+
-+      if (provider)
-+        {
-+          if (regexec (&prov_pat, probes[i].provider, 0, NULL, 0) != 0)
-+            continue;
-+        }
-+
-+      if (probe)
-+        {
-+          if (regexec (&probe_pat, probes[i].name, 0, NULL, 0) != 0)
-+            continue;
-+        }
-+
-+      entry.probe = &probes[i];
-+      entry.objfile = objfile;
-+      VEC_safe_push (stap_entry, result, &entry);
-+      }
-+  }
-+
-+  discard_cleanups (cleanup);
-+  return result;
-+}
-+
-+/* A qsort comparison function for stap_entry objects.  */
-+
-+static int
-+compare_entries (const void *a, const void *b)
-+{
-+  const stap_entry *ea = a;
-+  const stap_entry *eb = b;
-+  int v;
-+
-+  v = strcmp (ea->probe->provider, eb->probe->provider);
-+  if (v)
-+    return v;
-+
-+  v = strcmp (ea->probe->name, eb->probe->name);
-+  if (v)
-+    return v;
-+
-+  if (ea->probe->address < eb->probe->address)
-+    return -1;
-+  if (ea->probe->address > eb->probe->address)
-+    return 1;
-+
-+  return strcmp (ea->objfile->name, eb->objfile->name);
-+}
-+
-+/* Implementation of the "info probes" command.  */
-+
-+static void
-+info_probes_command (char *arg, int from_tty)
-+{
-+  char *provider, *probe = NULL, *objname = NULL;
-+  struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
-+  VEC (stap_entry) *items;
-+  int i, addr_width, any_found;
-+  stap_entry *entry;
-+
-+  provider = extract_arg (&arg);
-+  if (provider)
-+    {
-+      make_cleanup (xfree, provider);
-+
-+      probe = extract_arg (&arg);
-+      if (probe)
-+      {
-+        make_cleanup (xfree, probe);
-+
-+        objname = extract_arg (&arg);
-+        if (objname)
-+          make_cleanup (xfree, objname);
-+      }
-+    }
-+
-+  items = collect_probes (objname, provider, probe);
-+  make_cleanup (VEC_cleanup (stap_entry), &items);
-+  make_cleanup_ui_out_table_begin_end (current_uiout, 5,
-+                                     VEC_length (stap_entry, items),
-+                                     "SystemTapProbes");
-+
-+  if (! VEC_empty (stap_entry, items))
-+    qsort (VEC_address (stap_entry, items),
-+         VEC_length (stap_entry, items),
-+         sizeof (stap_entry),
-+         compare_entries);
-+
-+  addr_width = 4 + (gdbarch_ptr_bit (get_current_arch ()) / 4);
-+
-+  ui_out_table_header (current_uiout, 10, ui_left, "provider", _("Provider"));
-+  ui_out_table_header (current_uiout, 10, ui_left, "name", _("Name"));
-+  ui_out_table_header (current_uiout, addr_width - 1, ui_left, "addr", _("Where"));
-+  ui_out_table_header (current_uiout, addr_width - 1, ui_left, "semaphore",
-+                     _("Semaphore"));
-+  ui_out_table_header (current_uiout, 30, ui_left, "object", _("Object"));
-+  ui_out_table_body (current_uiout);
-+
-+  for (i = 0; VEC_iterate (stap_entry, items, i, entry); ++i)
-+    {
-+      struct cleanup *inner;
-+
-+      inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe");
-+
-+      ui_out_field_string (current_uiout, "provider", entry->probe->provider);
-+      ui_out_field_string (current_uiout, "name", entry->probe->name);
-+      ui_out_field_core_addr (current_uiout, "addr", get_current_arch (),
-+                            entry->probe->address);
-+      if (entry->probe->sem_addr == 0)
-+      ui_out_field_skip (current_uiout, "semaphore");
-+      else
-+      ui_out_field_core_addr (current_uiout, "semaphore", get_current_arch (),
-+                            entry->probe->sem_addr);
-+      ui_out_field_string (current_uiout, "object", entry->objfile->name);
-+      ui_out_text (current_uiout, "\n");
-+
-+      do_cleanups (inner);
-+    }
-+
-+  any_found = ! VEC_empty (stap_entry, items);
-+  do_cleanups (cleanup);
-+
-+  if (! any_found)
-+    ui_out_message (current_uiout, 0, _("No probes matched.\n"));
-+}
-+
-+\f
-+
-+/* See definition in stap-probe.h.  */
-+
-+VEC (stap_probe_p) *
-+find_probes_in_objfile (struct objfile *objfile,
-+                      const char *provider,
-+                      const char *name)
-+{
-+  struct stap_probe *probes;
-+  int i, num_probes;
-+  VEC (stap_probe_p) *result = NULL;
-+
-+  if (! objfile->sf || ! objfile->sf->sym_probe_fns)
-+    return NULL;
-+
-+  probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
-+  for (i = 0; i < num_probes; ++i)
-+    {
-+      if (strcmp (probes[i].provider, provider) != 0)
-+      continue;
-+
-+      if (strcmp (probes[i].name, name) != 0)
-+      continue;
-+
-+      VEC_safe_push (stap_probe_p, result, &probes[i]);
-+    }
-+
-+  return result;
-+}
-+
-+/* See definition in stap-probe.h.  */
-+
-+struct symtabs_and_lines
-+parse_stap_probe (char **argptr, struct linespec_result *canonical)
-+{
-+  char *arg_start, *arg_end, *arg;
-+  char *objfile_name = NULL, *provider = NULL, *name, *p;
-+  struct cleanup *cleanup;
-+  struct symtabs_and_lines result;
-+  struct objfile *objfile;
-+
-+  result.sals = NULL;
-+  result.nelts = 0;
-+
-+  arg_start = *argptr;
-+  /* The caller ensured that this starts with '-p'.  */
-+  gdb_assert (arg_start && strncmp (arg_start, "-p", 2) == 0);
-+  arg_end = arg_start + 2;
-+  arg_end = skip_spaces (arg_end);
-+
-+  if (!*arg_end)
-+    error (_("argument to `-p' missing"));
-+
-+  arg = arg_end;
-+  arg_end = skip_to_space (arg_end);
-+
-+  /* We make a copy here so we can write over parts with impunity.  */
-+  arg = savestring (arg, arg_end - arg);
-+  cleanup = make_cleanup (xfree, arg);
-+
-+  /* Extract each word from the argument, separated by ":"s.  */
-+  p = strchr (arg, ':');
-+  if (p == NULL)
-+    {
-+      /* This is `-p name'.  */
-+      name = arg;
-+    }
-+  else
-+    {
-+      char *hold = p + 1;
-+
-+      *p = '\0';
-+      p = strchr (hold, ':');
-+      if (p == NULL)
-+      {
-+        /* This is `-p provider:name'.  */
-+        provider = arg;
-+        name = hold;
-+      }
-+      else
-+      {
-+        /* This is `-p objfile:provider:name'.  */
-+        *p = '\0';
-+        objfile_name = arg;
-+        provider = hold;
-+        name = p + 1;
-+      }
-+    }
-+
-+  if (*name == '\0')
-+    error (_("no probe name specified"));
-+  if (provider && *provider == '\0')
-+    error (_("invalid provider name"));
-+  if (objfile_name && *objfile_name == '\0')
-+    error (_("invalid objfile name"));
-+
-+  ALL_OBJFILES (objfile)
-+  {
-+    struct stap_probe *probes;
-+    int i, num_probes;
-+
-+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
-+      continue;
-+
-+    if (objfile_name
-+      && FILENAME_CMP (objfile->name, objfile_name) != 0
-+      && FILENAME_CMP (lbasename (objfile->name), objfile_name) != 0)
-+      continue;
-+
-+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
-+    for (i = 0; i < num_probes; ++i)
-+      {
-+      struct symtab_and_line *sal;
-+
-+      if (provider && strcmp (probes[i].provider, provider) != 0)
-+        continue;
-+
-+      if (strcmp (probes[i].name, name) != 0)
-+        continue;
-+
-+      ++result.nelts;
-+      result.sals = xrealloc (result.sals,
-+                              result.nelts * sizeof (struct symtab_and_line));
-+      sal = &result.sals[result.nelts - 1];
-+
-+      init_sal (sal);
-+
-+      sal->pc = probes[i].address;
-+      sal->explicit_pc = 1;
-+      sal->section = find_pc_overlay (sal->pc);
-+      sal->pspace = current_program_space;
-+      sal->semaphore = probes[i].sem_addr;
-+      }
-+  }
-+
-+  if (result.nelts == 0)
-+    {
-+      throw_error (NOT_FOUND_ERROR,
-+                 _("No probe matching objfile=`%s', provider=`%s', name=`%s'"),
-+                 objfile_name ? objfile_name : _("<any>"),
-+                 provider ? provider : _("<any>"),
-+                 name);
-+    }
-+
-+  if (canonical)
-+    {
-+      canonical->special_display = 1;
-+      canonical->pre_expanded = 1;
-+      canonical->addr_string = savestring (*argptr, arg_end - *argptr);
-+    }
-+
-+  *argptr = arg_end;
-+  do_cleanups (cleanup);
-+
-+  return result;
-+}
-+
-+\f
-+
-+/* See definition in stap-probe.h.  */
-+
-+struct stap_probe *
-+find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out)
-+{
-+  struct objfile *objfile;
-+
-+  ALL_OBJFILES (objfile)
-+  {
-+    struct stap_probe *probes;
-+    int i, num_probes;
-+    stap_entry entry;
-+
-+    if (! objfile->sf || ! objfile->sf->sym_probe_fns)
-+      continue;
-+
-+    /* If this proves too inefficient, we can replace with a hash.  */
-+    probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile, &num_probes);
-+    for (i = 0; i < num_probes; ++i)
-+      {
-+      if (probes[i].address == pc)
-+        {
-+          *objfile_out = objfile;
-+          return &probes[i];
-+        }
-+      }
-+  }
-+
-+  return NULL;
-+}
-+
-+/* This is called to compute the value of one of the $_probe_arg*
-+   convenience variables.  */
-+
-+static struct value *
-+compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar,
-+                 void *data)
-+{
-+  struct frame_info *frame = get_selected_frame (_("No frame selected"));
-+  CORE_ADDR pc = get_frame_pc (frame);
-+  int sel = (int) (uintptr_t) data;
-+  struct objfile *objfile;
-+  struct stap_probe *pc_probe;
-+  int n_probes;
-+
-+  /* SEL==-1 means "_probe_argc".  */
-+  gdb_assert (sel >= -1 && sel <= STAP_MAX_ARGS);
-+
-+  pc_probe = find_probe_by_pc (pc, &objfile);
-+  if (pc_probe == NULL)
-+    error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
-+
-+  n_probes
-+    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
-+                                                              pc_probe);
-+  if (sel == -1)
-+    return value_from_longest (builtin_type (arch)->builtin_int, n_probes);
-+
-+  if (sel >= n_probes)
-+    error (_("Invalid probe argument %d -- probe has %d arguments available"),
-+         sel, n_probes);
-+
-+  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
-+                                                                pc_probe,
-+                                                                frame, sel);
-+}
-+
-+/* This is called to compile one of the $_probe_arg* convenience
-+   variables into an agent expression.  */
-+
-+static void
-+compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
-+                 struct axs_value *value, void *data)
-+{
-+  CORE_ADDR pc = expr->scope;
-+  int sel = (int) (uintptr_t) data;
-+  struct objfile *objfile;
-+  struct stap_probe *pc_probe;
-+  int n_probes;
-+
-+  /* SEL==-1 means "_probe_argc".  */
-+  gdb_assert (sel >= -1 && sel <= STAP_MAX_ARGS);
-+
-+  pc_probe = find_probe_by_pc (pc, &objfile);
-+  if (pc_probe == NULL)
-+    error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
-+
-+  n_probes
-+    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
-+                                                              pc_probe);
-+  if (sel == -1)
-+    {
-+      value->kind = axs_rvalue;
-+      value->type = builtin_type (expr->gdbarch)->builtin_int;
-+      ax_const_l (expr, n_probes);
-+      return;
-+    }
-+
-+  gdb_assert (sel >= 0);
-+  if (sel >= n_probes)
-+    error (_("Invalid probe argument %d -- probe has %d arguments available"),
-+         sel, n_probes);
-+
-+  objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe,
-+                                               expr, value, sel);
-+}
-+
-+\f
-+
-+/* Implementation of `$_probe_arg*' set of variables.  */
-+
-+static const struct internalvar_funcs probe_funcs =
-+{
-+  compute_probe_arg,
-+  compile_probe_arg,
-+  NULL
-+};
-+
-+void
-+_initialize_stap_probe (void)
-+{
-+  add_info ("probes", info_probes_command, _("\
-+Show available static probes.\n\
-+Usage: info probes [PROVIDER [NAME [OBJECT]]]\n\
-+Each argument is a regular expression, used to select probes.\n\
-+PROVIDER matches probe provider names.\n\
-+NAME matches the probe names.\n\
-+OBJECT match the executable or shared library name."));
-+
-+  add_setshow_zinteger_cmd ("stap-expression", class_maintenance,
-+                          &stap_expression_debug,
-+                          _("Set SystemTap expression debugging."),
-+                          _("Show SystemTap expression debugging."),
-+                          _("When non-zero, the internal representation "
-+                            "of SystemTap expressions will be printed."),
-+                          NULL,
-+                          show_stapexpressiondebug,
-+                          &setdebuglist, &showdebuglist);
-+
-+  create_internalvar_type_lazy ("_probe_argc", &probe_funcs,
-+                              (void *) (uintptr_t) -1);
-+  create_internalvar_type_lazy ("_probe_arg0", &probe_funcs,
-+                              (void *) (uintptr_t) 0);
-+  create_internalvar_type_lazy ("_probe_arg1", &probe_funcs,
-+                              (void *) (uintptr_t) 1);
-+  create_internalvar_type_lazy ("_probe_arg2", &probe_funcs,
-+                              (void *) (uintptr_t) 2);
-+  create_internalvar_type_lazy ("_probe_arg3", &probe_funcs,
-+                              (void *) (uintptr_t) 3);
-+  create_internalvar_type_lazy ("_probe_arg4", &probe_funcs,
-+                              (void *) (uintptr_t) 4);
-+  create_internalvar_type_lazy ("_probe_arg5", &probe_funcs,
-+                              (void *) (uintptr_t) 5);
-+  create_internalvar_type_lazy ("_probe_arg6", &probe_funcs,
-+                              (void *) (uintptr_t) 6);
-+  create_internalvar_type_lazy ("_probe_arg7", &probe_funcs,
-+                              (void *) (uintptr_t) 7);
-+  create_internalvar_type_lazy ("_probe_arg8", &probe_funcs,
-+                              (void *) (uintptr_t) 8);
-+  create_internalvar_type_lazy ("_probe_arg9", &probe_funcs,
-+                              (void *) (uintptr_t) 9);
-+  create_internalvar_type_lazy ("_probe_arg10", &probe_funcs,
-+                              (void *) (uintptr_t) 10);
-+  create_internalvar_type_lazy ("_probe_arg11", &probe_funcs,
-+                              (void *) (uintptr_t) 11);
-+}
-diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
-new file mode 100644
-index 0000000..9b6dc7a
---- /dev/null
-+++ b/gdb/stap-probe.h
-@@ -0,0 +1,144 @@
-+/* SystemTap probe support for GDB.
-+
-+   Copyright (C) 2011 Free Software Foundation, Inc.
-+
-+   This file is part of GDB.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#if !defined (STAP_PROBE_H)
-+#define STAP_PROBE_H 1
-+
-+#include "vec.h"
-+
-+struct stap_args_info;
-+struct axs_value;
-+struct linespec_result;
-+
-+/* Main structure which holds information about a SystemTap probe.  */
-+
-+struct stap_probe
-+{
-+  /* The provider of this probe.  */
-+  const char *provider;
-+
-+  /* The name of the probe.  */
-+  const char *name;
-+
-+  /* The address where the probe is inserted.  */
-+  CORE_ADDR address;
-+
-+  /* The address of the probe's semaphore, or 0 if this probe does not
-+     have an associated semaphore.  */
-+  CORE_ADDR sem_addr;
-+
-+  /* Probe's arguments.  Users should generally not examine this, but
-+     should instead extract information about the arguments using the
-+     methods provided in sym_probe_fns.  */
-+  const char *args;
-+
-+  /* Probe's arguments after parsing.  This is an opaque structure that
-+     will hold information about the arguments pointed by ARGS.  */
-+  struct stap_args_info *parsed_args;
-+
-+  /* gdbarch structure associated with this probe.  */
-+  struct gdbarch *gdbarch;
-+};
-+
-+/* Structure which holds information about the parsing process of one probe's
-+   argument.  */
-+
-+struct stap_parse_info
-+{
-+  /* The probe's argument in a string format.  */
-+  const char *arg;
-+
-+  /* A pointer to the full chain of arguments.  This is useful for printing
-+     error messages.  The parser functions should not modify this argument
-+     directly; instead, they should use the ARG pointer above.  */
-+  const char *saved_arg;
-+
-+  /* The expected argument type (bitness), as defined in the probe's
-+     argument.  For instance, if the argument begins with `-8@', it means
-+     the bitness is 64-bit signed.  In this case, ARG_TYPE would represent
-+     the type `int64_t'.  */
-+  struct type *arg_type;
-+
-+  /* A pointer to the current gdbarch.  */
-+  struct gdbarch *gdbarch;
-+
-+  /* Greater than zero if we are inside a parenthesized expression.  Useful
-+     for knowing when to skip spaces or not.  */
-+  int inside_paren_p;
-+};
-+
-+typedef struct stap_probe *stap_probe_p;
-+DEF_VEC_P (stap_probe_p);
-+
-+/* A helper for linespec that decodes a stap probe specification.  It
-+   returns a symtabs_and_lines object and updates *ARGPTR or throws an
-+   error.  */
-+
-+extern struct symtabs_and_lines parse_stap_probe (char **argptr,
-+                                                struct linespec_result *canon);
-+
-+/* Search OBJFILE for a probe with the given PROVIDER and NAME.
-+   Return a VEC of all probes that were found.  If no matching probe
-+   is found, return NULL.  The caller must free the VEC.  */
-+
-+extern VEC (stap_probe_p) *find_probes_in_objfile (struct objfile *objfile,
-+                                                 const char *provider,
-+                                                 const char *name);
-+
-+/* Given a PC, find an associated SystemTap probe.  If a probe is
-+   found, set *OBJFILE_OUT to the probe's objfile, and return the
-+   probe.  If no probe is found, return NULL.  */
-+
-+extern struct stap_probe *find_probe_by_pc (CORE_ADDR pc,
-+                                          struct objfile **objfile_out);
-+
-+/* Given PROBE, returns the number of arguments present in that probe's
-+   argument string.  */
-+
-+extern int stap_get_probe_argument_count (struct stap_probe *probe);
-+
-+/* Given PARSED_ARGS, frees the space allocated to hold information about
-+   the probe's parsed arguments.  */
-+
-+extern void stap_free_parsed_args (struct stap_args_info *parsed_args);
-+
-+/* Evaluate the probe's argument N, returning a value corresponding
-+   to it.  */
-+
-+extern struct value *stap_evaluate_probe_argument (struct objfile *objfile,
-+                                                 struct stap_probe *probe,
-+                                                 struct frame_info *frame,
-+                                                 int n);
-+
-+/* Compile the probe's argument N to agent expression.  */
-+
-+extern void stap_compile_to_ax (struct objfile *objfile,
-+                              struct stap_probe *probe,
-+                              struct agent_expr *expr,
-+                              struct axs_value *value,
-+                              int n);
-+
-+/* A convenience function that finds a probe at the PC in FRAME and
-+   evaluates argument N.  If there is no probe at that location, or if
-+   the probe does not have enough arguments, this returns NULL.  */
-+
-+extern struct value *stap_safe_evaluate_at_pc (struct frame_info *frame,
-+                                             int n);
-+
-+#endif /* !defined (STAP_PROBE_H) */
-diff --git a/gdb/symfile.h b/gdb/symfile.h
-index 6b664cd..6ca797d 100644
---- a/gdb/symfile.h
-+++ b/gdb/symfile.h
-@@ -29,6 +29,11 @@ struct objfile;
- struct obj_section;
- struct obstack;
- struct block;
-+struct stap_probe;
-+struct value;
-+struct frame_info;
-+struct agent_expr;
-+struct axs_value;
- /* Comparison function for symbol look ups.  */
-@@ -299,6 +304,52 @@ struct quick_symbol_functions
-                               int need_fullname);
- };
-+/* Structure of functions used for SystemTap probe support.  If one of
-+   these functions is provided, all must be.  */
-+
-+struct sym_probe_fns
-+{
-+  /* If non-NULL, return an array of SystemTap probe objects.  The
-+     number of objects is returned in *NUM_PROBES.  */
-+  struct stap_probe *(*sym_get_probes) (struct objfile *,
-+                                            int *num_probes);
-+
-+  /* Return the number of arguments available to PROBE.  PROBE will
-+     have come from a call to this objfile's sym_get_probes method.
-+     If you provide an implementation of sym_get_probes, you must
-+     implement this method as well.  */
-+  int (*sym_get_probe_argument_count) (struct objfile *objfile,
-+                                     struct stap_probe *probe);
-+
-+  /* Evaluate the Nth argument available to PROBE.  PROBE will have
-+     come from a call to this objfile's sym_get_probes method.  N will
-+     be between 0 and the number of arguments available to this probe.
-+     FRAME is the frame in which the evaluation is done; the frame's
-+     PC will match the address of the probe.  If you provide an
-+     implementation of sym_get_probes, you must implement this method
-+     as well.  */
-+  struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
-+                                              struct stap_probe *probe,
-+                                              struct frame_info *frame,
-+                                              int n);
-+
-+  /* Compile the Nth probe argument to an agent expression.  PROBE
-+     will have come from a call to this objfile's sym_get_probes
-+     method.  N will be between 0 and the number of arguments
-+     available to this probe.  EXPR and VALUE are the agent expression
-+     that is being updated.  */
-+  void (*sym_compile_to_ax) (struct objfile *objfile,
-+                           struct stap_probe *probe,
-+                           struct agent_expr *expr,
-+                           struct axs_value *value,
-+                           int n);
-+
-+  /* Relocate the probe section of OBJFILE.  */
-+  void (*sym_relocate_probe) (struct objfile *objfile,
-+                            struct section_offsets *new_offsets,
-+                            struct section_offsets *delta);
-+};
-+
- /* Structure to keep track of symbol reading functions for various
-    object file types.  */
-@@ -369,6 +420,10 @@ struct sym_fns
-   bfd_byte *(*sym_relocate) (struct objfile *, asection *sectp, bfd_byte *buf);
-+  /* If non-NULL, this objfile has probe support, and all the probe
-+     functions referred to here will be non-NULL.  */
-+  const struct sym_probe_fns *sym_probe_fns;
-+
-   /* The "quick" (aka partial) symbol functions for this symbol
-      reader.  */
-   const struct quick_symbol_functions *qf;
-diff --git a/gdb/symtab.c b/gdb/symtab.c
-index 1746d69..2abc17f 100644
---- a/gdb/symtab.c
-+++ b/gdb/symtab.c
-@@ -869,6 +869,7 @@ init_sal (struct symtab_and_line *sal)
-   sal->end = 0;
-   sal->explicit_pc = 0;
-   sal->explicit_line = 0;
-+  sal->semaphore = 0;
- }
\f
-diff --git a/gdb/symtab.h b/gdb/symtab.h
-index 4836dd6..668a22b 100644
---- a/gdb/symtab.h
-+++ b/gdb/symtab.h
-@@ -1056,6 +1056,10 @@ struct symtab_and_line
-   CORE_ADDR end;
-   int explicit_pc;
-   int explicit_line;
-+
-+  /* If non-zero, the semaphore location associated with a SystemTap
-+     probe.  */
-+  CORE_ADDR semaphore;
- };
- extern void init_sal (struct symtab_and_line *sal);
-diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
-index 678639c..47a2202 100644
---- a/gdb/testsuite/gdb.ada/packed_array.exp
-+++ b/gdb/testsuite/gdb.ada/packed_array.exp
-@@ -60,5 +60,11 @@ gdb_test_multiple "$test" "$test" {
-         # are.  Observed with (FSF GNU Ada 4.5.3 20110124).
-         xfail $test
-     }
-+    -re "= \\(\\)\[\r\n\]+$gdb_prompt $" {
-+      # archer-jankratochvil-vla resolves it as a dynamic type resolved as an
-+      # empty array [0..-1].
-+      # DW_AT_upper_bound : (DW_OP_fbreg: -48; DW_OP_deref)
-+        xfail $test
-+    }
- }
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
-new file mode 100644
-index 0000000..83faaf6
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
-@@ -0,0 +1,457 @@
-+      .file   "x86_64-vla-pointer.c"
-+      .section        .debug_abbrev,"",@progbits
-+.Ldebug_abbrev0:
-+      .section        .debug_info,"",@progbits
-+.Ldebug_info0:
-+      .section        .debug_line,"",@progbits
-+.Ldebug_line0:
-+      .text
-+.Ltext0:
-+.globl foo
-+      .type   foo, @function
-+foo:
-+.LFB2:
-+      .file 1 "x86_64-vla-pointer.c"
-+      .loc 1 22 0
-+      pushq   %rbp
-+.LCFI0:
-+      movq    %rsp, %rbp
-+.LCFI1:
-+      subq    $64, %rsp
-+.LCFI2:
-+      movl    %edi, -36(%rbp)
-+      .loc 1 22 0
-+      movq    %rsp, %rax
-+      movq    %rax, -48(%rbp)
-+      .loc 1 23 0
-+      movl    -36(%rbp), %edx
-+      movslq  %edx,%rax
-+      subq    $1, %rax
-+      movq    %rax, -24(%rbp)
-+      .loc 1 24 0
-+      movslq  %edx,%rax
-+      addq    $15, %rax
-+      addq    $15, %rax
-+      shrq    $4, %rax
-+      salq    $4, %rax
-+      subq    %rax, %rsp
-+      movq    %rsp, -56(%rbp)
-+      movq    -56(%rbp), %rax
-+      addq    $15, %rax
-+      shrq    $4, %rax
-+      salq    $4, %rax
-+      movq    %rax, -56(%rbp)
-+      movq    -56(%rbp), %rax
-+      movq    %rax, -16(%rbp)
-+      .loc 1 27 0
-+      movl    $0, -4(%rbp)
-+      jmp     .L2
-+.L3:
-+      .loc 1 28 0
-+      movl    -4(%rbp), %esi
-+      movl    -4(%rbp), %eax
-+      movl    %eax, %ecx
-+      movq    -16(%rbp), %rdx
-+      movslq  %esi,%rax
-+      movb    %cl, (%rdx,%rax)
-+      .loc 1 27 0
-+      addl    $1, -4(%rbp)
-+.L2:
-+      movl    -4(%rbp), %eax
-+      cmpl    -36(%rbp), %eax
-+      jl      .L3
-+      .loc 1 30 0
-+      .globl  break_here
-+break_here:
-+      movq    -16(%rbp), %rax
-+      movb    $0, (%rax)
-+      movq    -48(%rbp), %rsp
-+      .loc 1 31 0
-+      leave
-+      ret
-+.LFE2:
-+      .size   foo, .-foo
-+      .section        .debug_frame,"",@progbits
-+.Lframe0:
-+      .long   .LECIE0-.LSCIE0
-+.LSCIE0:
-+      .long   0xffffffff
-+      .byte   0x1
-+      .string ""
-+      .uleb128 0x1
-+      .sleb128 -8
-+      .byte   0x10
-+      .byte   0xc
-+      .uleb128 0x7
-+      .uleb128 0x8
-+      .byte   0x90
-+      .uleb128 0x1
-+      .align 8
-+.LECIE0:
-+.LSFDE0:
-+      .long   .LEFDE0-.LASFDE0
-+.LASFDE0:
-+      .long   .Lframe0
-+      .quad   .LFB2
-+      .quad   .LFE2-.LFB2
-+      .byte   0x4
-+      .long   .LCFI0-.LFB2
-+      .byte   0xe
-+      .uleb128 0x10
-+      .byte   0x86
-+      .uleb128 0x2
-+      .byte   0x4
-+      .long   .LCFI1-.LCFI0
-+      .byte   0xd
-+      .uleb128 0x6
-+      .align 8
-+.LEFDE0:
-+      .section        .eh_frame,"a",@progbits
-+.Lframe1:
-+      .long   .LECIE1-.LSCIE1
-+.LSCIE1:
-+      .long   0x0
-+      .byte   0x1
-+      .string "zR"
-+      .uleb128 0x1
-+      .sleb128 -8
-+      .byte   0x10
-+      .uleb128 0x1
-+      .byte   0x3
-+      .byte   0xc
-+      .uleb128 0x7
-+      .uleb128 0x8
-+      .byte   0x90
-+      .uleb128 0x1
-+      .align 8
-+.LECIE1:
-+.LSFDE1:
-+      .long   .LEFDE1-.LASFDE1
-+.LASFDE1:
-+      .long   .LASFDE1-.Lframe1
-+      .long   .LFB2
-+      .long   .LFE2-.LFB2
-+      .uleb128 0x0
-+      .byte   0x4
-+      .long   .LCFI0-.LFB2
-+      .byte   0xe
-+      .uleb128 0x10
-+      .byte   0x86
-+      .uleb128 0x2
-+      .byte   0x4
-+      .long   .LCFI1-.LCFI0
-+      .byte   0xd
-+      .uleb128 0x6
-+      .align 8
-+.LEFDE1:
-+      .text
-+.Letext0:
-+      .section        .debug_loc,"",@progbits
-+.Ldebug_loc0:
-+.LLST0:
-+      .quad   .LFB2-.Ltext0
-+      .quad   .LCFI0-.Ltext0
-+      .value  0x2
-+      .byte   0x77
-+      .sleb128 8
-+      .quad   .LCFI0-.Ltext0
-+      .quad   .LCFI1-.Ltext0
-+      .value  0x2
-+      .byte   0x77
-+      .sleb128 16
-+      .quad   .LCFI1-.Ltext0
-+      .quad   .LFE2-.Ltext0
-+      .value  0x2
-+      .byte   0x76
-+      .sleb128 16
-+      .quad   0x0
-+      .quad   0x0
-+      .section        .debug_info
-+.Ldebug_relative:
-+      .long   .Ldebug_end - .Ldebug_start
-+.Ldebug_start:
-+      .value  0x2
-+      .long   .Ldebug_abbrev0
-+      .byte   0x8
-+      .uleb128 0x1
-+      .long   .LASF2
-+      .byte   0x1
-+      .long   .LASF3
-+      .long   .LASF4
-+      .quad   .Ltext0
-+      .quad   .Letext0
-+      .long   .Ldebug_line0
-+      .uleb128 0x2
-+      .byte   0x1
-+      .string "foo"
-+      .byte   0x1
-+      .byte   0x16
-+      .byte   0x1
-+      .quad   .LFB2
-+      .quad   .LFE2
-+      .long   .LLST0
-+      .long   .Ltype_int - .Ldebug_relative
-+      .uleb128 0x3
-+      .long   .LASF5
-+      .byte   0x1
-+      .byte   0x15
-+      .long   .Ltype_int - .Ldebug_relative
-+      .byte   0x2
-+      .byte   0x91
-+      .sleb128 -52
-+.Ltag_pointer:
-+      .uleb128 0x4
-+      .byte   0x8     /* DW_AT_byte_size */
-+      .long   .Ltag_array_type - .debug_info  /* DW_AT_type */
-+      .uleb128 0x5    /* Abbrev Number: 5 (DW_TAG_variable) */
-+      .long   .LASF0
-+      .byte   0x1
-+      .byte   0x18
-+#if 1
-+      .long   .Ltag_pointer - .debug_info
-+#else
-+      /* Debugging only: Skip the typedef indirection.  */
-+      .long   .Ltag_array_type - .debug_info
-+#endif
-+      /* DW_AT_location: DW_FORM_block1: start */
-+      .byte   0x3
-+      .byte   0x91
-+      .sleb128 -32
-+#if 0
-+      .byte   0x6     /* DW_OP_deref */
-+#else
-+      .byte   0x96    /* DW_OP_nop */
-+#endif
-+      /* DW_AT_location: DW_FORM_block1: end */
-+      .uleb128 0x6
-+      .string "i"
-+      .byte   0x1
-+      .byte   0x19
-+      .long   .Ltype_int - .Ldebug_relative
-+      .byte   0x2
-+      .byte   0x91
-+      .sleb128 -20
-+      .byte   0x0
-+.Ltype_int:
-+      .uleb128 0x7
-+      .byte   0x4
-+      .byte   0x5
-+      .string "int"
-+.Ltag_array_type:
-+      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
-+      .long   .Ltype_char - .Ldebug_relative
-+      .long   .Ltype_ulong - .Ldebug_relative /* DW_AT_sibling: DW_FORM_ref4 */
-+1:    /* DW_AT_data_location: DW_FORM_block1: start */
-+      .byte   2f - 3f /* length */
-+3:
-+      .byte   0x97    /* DW_OP_push_object_address */
-+#if 1
-+      .byte   0x6     /* DW_OP_deref */
-+#else
-+      .byte   0x96    /* DW_OP_nop */
-+#endif
-+2:    /* DW_AT_data_location: DW_FORM_block1: end */
-+      .uleb128 0x9
-+      .long   .Ltype_char - .Ldebug_relative  /* DW_AT_type: DW_FORM_ref4 */
-+      .byte   0x3
-+      .byte   0x91
-+      .sleb128 -40
-+      .byte   0x6
-+      .byte   0x0
-+.Ltype_ulong:
-+      .uleb128 0xa
-+      .byte   0x8
-+      .byte   0x7
-+.Ltype_char:
-+      .uleb128 0xb
-+      .byte   0x1
-+      .byte   0x6
-+      .long   .LASF1
-+      .byte   0x0
-+.Ldebug_end:
-+      .section        .debug_abbrev
-+      .uleb128 0x1
-+      .uleb128 0x11
-+      .byte   0x1
-+      .uleb128 0x25
-+      .uleb128 0xe
-+      .uleb128 0x13
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x1b
-+      .uleb128 0xe
-+      .uleb128 0x11
-+      .uleb128 0x1
-+      .uleb128 0x12
-+      .uleb128 0x1
-+      .uleb128 0x10
-+      .uleb128 0x6
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x2
-+      .uleb128 0x2e
-+      .byte   0x1
-+      .uleb128 0x3f
-+      .uleb128 0xc
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x27
-+      .uleb128 0xc
-+      .uleb128 0x11
-+      .uleb128 0x1
-+      .uleb128 0x12
-+      .uleb128 0x1
-+      .uleb128 0x40
-+      .uleb128 0x6
-+      .uleb128 0x1
-+      .uleb128 0x13
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0x5
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x4    /* .Ltag_pointer abbrev */
-+      .uleb128 0x0f   /* DW_TAG_pointer_type */
-+      .byte   0x0
-+      .uleb128 0x0b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x5
-+      .uleb128 0x34
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x6
-+      .uleb128 0x34
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x7
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
-+      .uleb128 0x1
-+      .byte   0x1
-+      .uleb128 0x49   /* DW_AT_type */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x1    /* DW_AT_sibling */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x50   /* DW_AT_data_location */
-+      .uleb128 0xa    /* DW_FORM_block1 */
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x9
-+      .uleb128 0x21
-+      .byte   0x0
-+      .uleb128 0x49   /* DW_AT_type */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x2f
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0xa
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .byte   0x0
-+      .byte   0x0
-+      .byte   0x0
-+      .section        .debug_pubnames,"",@progbits
-+      .long   0x16
-+      .value  0x2
-+      .long   .Ldebug_info0
-+      .long   0xa8
-+      .long   0x2d
-+      .string "foo"
-+      .long   0x0
-+      .section        .debug_aranges,"",@progbits
-+      .long   0x2c
-+      .value  0x2
-+      .long   .Ldebug_info0
-+      .byte   0x8
-+      .byte   0x0
-+      .value  0x0
-+      .value  0x0
-+      .quad   .Ltext0
-+      .quad   .Letext0-.Ltext0
-+      .quad   0x0
-+      .quad   0x0
-+      .section        .debug_str,"MS",@progbits,1
-+.LASF0:
-+      .string "array"
-+.LASF5:
-+      .string "size"
-+.LASF3:
-+      .string "x86_64-vla-pointer.c"
-+.LASF6:
-+      .string "array_t"
-+.LASF1:
-+      .string "char"
-+.LASF4:
-+      .string "gdb.arch"
-+.LASF2:
-+      .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
-+      .ident  "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
-+      .section        .note.GNU-stack,"",@progbits
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
-new file mode 100644
-index 0000000..fe2c8f7
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
-@@ -0,0 +1,43 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2009 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#if 0
-+
-+void
-+foo (int size)
-+{
-+  typedef char array_t[size];
-+  array_t array;
-+  int i;
-+
-+  for (i = 0; i < size; i++)
-+    array[i] = i;
-+
-+  array[0] = 0;       /* break-here */
-+}
-+
-+#else
-+
-+int
-+main (void)
-+{
-+  foo (26);
-+  foo (78);
-+  return 0;
-+}
-+
-+#endif
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
-new file mode 100644
-index 0000000..d243cf1
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
-@@ -0,0 +1,66 @@
-+# Copyright 2009 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+if ![istarget "x86_64-*-*"] then {
-+    verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64."
-+    return
-+}
-+
-+set testfile x86_64-vla-pointer
-+set srcasmfile ${testfile}-foo.S
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+if ![runto_main] {
-+    untested x86_64-vla-pointer
-+    return -1
-+}
-+
-+gdb_breakpoint "break_here"
-+
-+gdb_continue_to_breakpoint "break_here"
-+
-+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "first: whatis array"
-+gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array"
-+
-+gdb_test "whatis *array" "type = char \\\[26\\\]" "first: whatis *array"
-+gdb_test "ptype *array" "type = char \\\[26\\\]" "first: ptype *array"
-+
-+gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
-+gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
-+gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
-+gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
-+
-+gdb_continue_to_breakpoint "break_here"
-+
-+gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "second: whatis array"
-+gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array"
-+
-+gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array"
-+gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array"
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
-new file mode 100644
-index 0000000..66f7a39
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
-@@ -0,0 +1,455 @@
-+      .file   "x86_64-vla-typedef.c"
-+      .section        .debug_abbrev,"",@progbits
-+.Ldebug_abbrev0:
-+      .section        .debug_info,"",@progbits
-+.Ldebug_info0:
-+      .section        .debug_line,"",@progbits
-+.Ldebug_line0:
-+      .text
-+.Ltext0:
-+.globl foo
-+      .type   foo, @function
-+foo:
-+.LFB2:
-+      .file 1 "x86_64-vla-typedef.c"
-+      .loc 1 22 0
-+      pushq   %rbp
-+.LCFI0:
-+      movq    %rsp, %rbp
-+.LCFI1:
-+      subq    $64, %rsp
-+.LCFI2:
-+      movl    %edi, -36(%rbp)
-+      .loc 1 22 0
-+      movq    %rsp, %rax
-+      movq    %rax, -48(%rbp)
-+      .loc 1 23 0
-+      movl    -36(%rbp), %edx
-+      movslq  %edx,%rax
-+      subq    $1, %rax
-+      movq    %rax, -24(%rbp)
-+      .loc 1 24 0
-+      movslq  %edx,%rax
-+      addq    $15, %rax
-+      addq    $15, %rax
-+      shrq    $4, %rax
-+      salq    $4, %rax
-+      subq    %rax, %rsp
-+      movq    %rsp, -56(%rbp)
-+      movq    -56(%rbp), %rax
-+      addq    $15, %rax
-+      shrq    $4, %rax
-+      salq    $4, %rax
-+      movq    %rax, -56(%rbp)
-+      movq    -56(%rbp), %rax
-+      movq    %rax, -16(%rbp)
-+      .loc 1 27 0
-+      movl    $0, -4(%rbp)
-+      jmp     .L2
-+.L3:
-+      .loc 1 28 0
-+      movl    -4(%rbp), %esi
-+      movl    -4(%rbp), %eax
-+      movl    %eax, %ecx
-+      movq    -16(%rbp), %rdx
-+      movslq  %esi,%rax
-+      movb    %cl, (%rdx,%rax)
-+      .loc 1 27 0
-+      addl    $1, -4(%rbp)
-+.L2:
-+      movl    -4(%rbp), %eax
-+      cmpl    -36(%rbp), %eax
-+      jl      .L3
-+      .loc 1 30 0
-+      .globl  break_here
-+break_here:
-+      movq    -16(%rbp), %rax
-+      movb    $0, (%rax)
-+      movq    -48(%rbp), %rsp
-+      .loc 1 31 0
-+      leave
-+      ret
-+.LFE2:
-+      .size   foo, .-foo
-+      .section        .debug_frame,"",@progbits
-+.Lframe0:
-+      .long   .LECIE0-.LSCIE0
-+.LSCIE0:
-+      .long   0xffffffff
-+      .byte   0x1
-+      .string ""
-+      .uleb128 0x1
-+      .sleb128 -8
-+      .byte   0x10
-+      .byte   0xc
-+      .uleb128 0x7
-+      .uleb128 0x8
-+      .byte   0x90
-+      .uleb128 0x1
-+      .align 8
-+.LECIE0:
-+.LSFDE0:
-+      .long   .LEFDE0-.LASFDE0
-+.LASFDE0:
-+      .long   .Lframe0
-+      .quad   .LFB2
-+      .quad   .LFE2-.LFB2
-+      .byte   0x4
-+      .long   .LCFI0-.LFB2
-+      .byte   0xe
-+      .uleb128 0x10
-+      .byte   0x86
-+      .uleb128 0x2
-+      .byte   0x4
-+      .long   .LCFI1-.LCFI0
-+      .byte   0xd
-+      .uleb128 0x6
-+      .align 8
-+.LEFDE0:
-+      .section        .eh_frame,"a",@progbits
-+.Lframe1:
-+      .long   .LECIE1-.LSCIE1
-+.LSCIE1:
-+      .long   0x0
-+      .byte   0x1
-+      .string "zR"
-+      .uleb128 0x1
-+      .sleb128 -8
-+      .byte   0x10
-+      .uleb128 0x1
-+      .byte   0x3
-+      .byte   0xc
-+      .uleb128 0x7
-+      .uleb128 0x8
-+      .byte   0x90
-+      .uleb128 0x1
-+      .align 8
-+.LECIE1:
-+.LSFDE1:
-+      .long   .LEFDE1-.LASFDE1
-+.LASFDE1:
-+      .long   .LASFDE1-.Lframe1
-+      .long   .LFB2
-+      .long   .LFE2-.LFB2
-+      .uleb128 0x0
-+      .byte   0x4
-+      .long   .LCFI0-.LFB2
-+      .byte   0xe
-+      .uleb128 0x10
-+      .byte   0x86
-+      .uleb128 0x2
-+      .byte   0x4
-+      .long   .LCFI1-.LCFI0
-+      .byte   0xd
-+      .uleb128 0x6
-+      .align 8
-+.LEFDE1:
-+      .text
-+.Letext0:
-+      .section        .debug_loc,"",@progbits
-+.Ldebug_loc0:
-+.LLST0:
-+      .quad   .LFB2-.Ltext0
-+      .quad   .LCFI0-.Ltext0
-+      .value  0x2
-+      .byte   0x77
-+      .sleb128 8
-+      .quad   .LCFI0-.Ltext0
-+      .quad   .LCFI1-.Ltext0
-+      .value  0x2
-+      .byte   0x77
-+      .sleb128 16
-+      .quad   .LCFI1-.Ltext0
-+      .quad   .LFE2-.Ltext0
-+      .value  0x2
-+      .byte   0x76
-+      .sleb128 16
-+      .quad   0x0
-+      .quad   0x0
-+      .section        .debug_info
-+      .long   .Ldebug_end - .Ldebug_start
-+.Ldebug_start:
-+      .value  0x2
-+      .long   .Ldebug_abbrev0
-+      .byte   0x8
-+      .uleb128 0x1
-+      .long   .LASF2
-+      .byte   0x1
-+      .long   .LASF3
-+      .long   .LASF4
-+      .quad   .Ltext0
-+      .quad   .Letext0
-+      .long   .Ldebug_line0
-+      .uleb128 0x2
-+      .byte   0x1
-+      .string "foo"
-+      .byte   0x1
-+      .byte   0x16
-+      .byte   0x1
-+      .quad   .LFB2
-+      .quad   .LFE2
-+      .long   .LLST0
-+      .long   0x83
-+      .uleb128 0x3
-+      .long   .LASF5
-+      .byte   0x1
-+      .byte   0x15
-+      .long   0x83
-+      .byte   0x2
-+      .byte   0x91
-+      .sleb128 -52
-+.Ltag_typedef:
-+      .uleb128 0x4
-+      .long   .LASF6
-+      .byte   0x1
-+      .byte   0x17
-+      .long   .Ltag_array_type - .debug_info
-+      .uleb128 0x5    /* Abbrev Number: 5 (DW_TAG_variable) */
-+      .long   .LASF0
-+      .byte   0x1
-+      .byte   0x18
-+#if 1
-+      .long   .Ltag_typedef - .debug_info
-+#else
-+      /* Debugging only: Skip the typedef indirection.  */
-+      .long   .Ltag_array_type - .debug_info
-+#endif
-+      /* DW_AT_location: DW_FORM_block1: start */
-+      .byte   0x3
-+      .byte   0x91
-+      .sleb128 -32
-+#if 0
-+      .byte   0x6     /* DW_OP_deref */
-+#else
-+      .byte   0x96    /* DW_OP_nop */
-+#endif
-+      /* DW_AT_location: DW_FORM_block1: end */
-+      .uleb128 0x6
-+      .string "i"
-+      .byte   0x1
-+      .byte   0x19
-+      .long   0x83
-+      .byte   0x2
-+      .byte   0x91
-+      .sleb128 -20
-+      .byte   0x0
-+      .uleb128 0x7
-+      .byte   0x4
-+      .byte   0x5
-+      .string "int"
-+.Ltag_array_type:
-+      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
-+      .long   0xa0 + (2f - 1f)        /* DW_AT_type: DW_FORM_ref4 */
-+      .long   0x9d + (2f - 1f)        /* DW_AT_sibling: DW_FORM_ref4 */
-+1:    /* DW_AT_data_location: DW_FORM_block1: start */
-+      .byte   2f - 3f /* length */
-+3:
-+      .byte   0x97    /* DW_OP_push_object_address */
-+      .byte   0x6     /* DW_OP_deref */
-+2:    /* DW_AT_data_location: DW_FORM_block1: end */
-+      .uleb128 0x9
-+      .long   0x9d + (2b - 1b)        /* DW_AT_type: DW_FORM_ref4 */
-+      .byte   0x3
-+      .byte   0x91
-+      .sleb128 -40
-+      .byte   0x6
-+      .byte   0x0
-+      .uleb128 0xa
-+      .byte   0x8
-+      .byte   0x7
-+      .uleb128 0xb
-+      .byte   0x1
-+      .byte   0x6
-+      .long   .LASF1
-+      .byte   0x0
-+.Ldebug_end:
-+      .section        .debug_abbrev
-+      .uleb128 0x1
-+      .uleb128 0x11
-+      .byte   0x1
-+      .uleb128 0x25
-+      .uleb128 0xe
-+      .uleb128 0x13
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x1b
-+      .uleb128 0xe
-+      .uleb128 0x11
-+      .uleb128 0x1
-+      .uleb128 0x12
-+      .uleb128 0x1
-+      .uleb128 0x10
-+      .uleb128 0x6
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x2
-+      .uleb128 0x2e
-+      .byte   0x1
-+      .uleb128 0x3f
-+      .uleb128 0xc
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x27
-+      .uleb128 0xc
-+      .uleb128 0x11
-+      .uleb128 0x1
-+      .uleb128 0x12
-+      .uleb128 0x1
-+      .uleb128 0x40
-+      .uleb128 0x6
-+      .uleb128 0x1
-+      .uleb128 0x13
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0x5
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x4
-+      .uleb128 0x16
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x5
-+      .uleb128 0x34
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x6
-+      .uleb128 0x34
-+      .byte   0x0
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .uleb128 0x3a
-+      .uleb128 0xb
-+      .uleb128 0x3b
-+      .uleb128 0xb
-+      .uleb128 0x49
-+      .uleb128 0x13
-+      .uleb128 0x2
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x7
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0x8
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
-+      .uleb128 0x1
-+      .byte   0x1
-+      .uleb128 0x49   /* DW_AT_type */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x1    /* DW_AT_sibling */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x50   /* DW_AT_data_location */
-+      .uleb128 0xa    /* DW_FORM_block1 */
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0x9
-+      .uleb128 0x21
-+      .byte   0x0
-+      .uleb128 0x49   /* DW_AT_type */
-+      .uleb128 0x13   /* DW_FORM_ref4 */
-+      .uleb128 0x2f
-+      .uleb128 0xa
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0xa
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .byte   0x0
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0x24
-+      .byte   0x0
-+      .uleb128 0xb
-+      .uleb128 0xb
-+      .uleb128 0x3e
-+      .uleb128 0xb
-+      .uleb128 0x3
-+      .uleb128 0xe
-+      .byte   0x0
-+      .byte   0x0
-+      .byte   0x0
-+      .section        .debug_pubnames,"",@progbits
-+      .long   0x16
-+      .value  0x2
-+      .long   .Ldebug_info0
-+      .long   0xa8
-+      .long   0x2d
-+      .string "foo"
-+      .long   0x0
-+      .section        .debug_aranges,"",@progbits
-+      .long   0x2c
-+      .value  0x2
-+      .long   .Ldebug_info0
-+      .byte   0x8
-+      .byte   0x0
-+      .value  0x0
-+      .value  0x0
-+      .quad   .Ltext0
-+      .quad   .Letext0-.Ltext0
-+      .quad   0x0
-+      .quad   0x0
-+      .section        .debug_str,"MS",@progbits,1
-+.LASF0:
-+      .string "array"
-+.LASF5:
-+      .string "size"
-+.LASF3:
-+      .string "x86_64-vla-typedef.c"
-+.LASF6:
-+      .string "array_t"
-+.LASF1:
-+      .string "char"
-+.LASF4:
-+      .string "gdb.arch"
-+.LASF2:
-+      .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
-+      .ident  "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
-+      .section        .note.GNU-stack,"",@progbits
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
-new file mode 100644
-index 0000000..b809c4e
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
-@@ -0,0 +1,43 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2008 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#if 0
-+
-+void
-+foo (int size)
-+{
-+  typedef char array_t[size];
-+  array_t array;
-+  int i;
-+
-+  for (i = 0; i < size; i++)
-+    array[i] = i;
-+
-+  array[0] = 0;       /* break-here */
-+}
-+
-+#else
-+
-+int
-+main (void)
-+{
-+  foo (26);
-+  foo (78);
-+  return 0;
-+}
-+
-+#endif
-diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
-new file mode 100644
-index 0000000..b05411e
---- /dev/null
-+++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
-@@ -0,0 +1,64 @@
-+# Copyright 2009 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
-+
-+if ![istarget "x86_64-*-*"] then {
-+    verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
-+    return
-+}
-+
-+set testfile x86_64-vla-typedef
-+set srcasmfile ${testfile}-foo.S
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+if ![runto_main] {
-+    untested x86_64-vla-typedef
-+    return -1
-+}
-+
-+gdb_breakpoint "break_here"
-+
-+gdb_continue_to_breakpoint "break_here"
-+
-+gdb_test "whatis array" "type = array_t" "first: whatis array"
-+
-+gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
-+
-+gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
-+gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
-+gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
-+gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
-+
-+gdb_continue_to_breakpoint "break_here"
-+
-+gdb_test "whatis array" "type = array_t" "second: whatis array"
-+
-+gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
-diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
-index a99137e..c3dc2d9 100644
---- a/gdb/testsuite/gdb.base/arrayidx.c
-+++ b/gdb/testsuite/gdb.base/arrayidx.c
-@@ -17,6 +17,13 @@
- int array[] = {1, 2, 3, 4};
-+#ifdef __GNUC__
-+struct
-+  {
-+    int a[0];
-+  } unbound;
-+#endif
-+
- int
- main (void)
- {
-diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
-index cba0024..0dc0e46 100644
---- a/gdb/testsuite/gdb.base/arrayidx.exp
-+++ b/gdb/testsuite/gdb.base/arrayidx.exp
-@@ -53,4 +53,12 @@ gdb_test "print array" \
-          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
-          "Print array with array-indexes on"
--
-+set test "p unbound.a == &unbound.a\[0\]"
-+gdb_test_multiple $test $test {
-+    -re " = 1\r\n$gdb_prompt $" {
-+      pass $test
-+    }
-+    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
-+      unsupported "$test (no GCC)"
-+    }
-+}
-diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
-index 9677396..55d03a9 100644
---- a/gdb/testsuite/gdb.base/default.exp
-+++ b/gdb/testsuite/gdb.base/default.exp
-@@ -610,6 +610,19 @@ gdb_test_list_exact "show convenience" "show convenience" \
-       {$_sdata = void} \
-       {$_siginfo = void} \
-       {$_thread = 0} \
-+      {$_probe_argc = <error: No frame selected>} \
-+      {$_probe_arg0 = <error: No frame selected>} \
-+      {$_probe_arg1 = <error: No frame selected>} \
-+      {$_probe_arg2 = <error: No frame selected>} \
-+      {$_probe_arg3 = <error: No frame selected>} \
-+      {$_probe_arg4 = <error: No frame selected>} \
-+      {$_probe_arg5 = <error: No frame selected>} \
-+      {$_probe_arg6 = <error: No frame selected>} \
-+      {$_probe_arg7 = <error: No frame selected>} \
-+      {$_probe_arg8 = <error: No frame selected>} \
-+      {$_probe_arg9 = <error: No frame selected>} \
-+      {$_probe_arg10 = <error: No frame selected>} \
-+      {$_probe_arg11 = <error: No frame selected>} \
-     }
- #test show directories
-diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c
-new file mode 100644
-index 0000000..eeb7b85
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/internal-var-field-address.c
-@@ -0,0 +1,20 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2009 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+struct {
-+  int field;
-+} staticstruct = { 1 };
-diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp
-new file mode 100644
-index 0000000..6d82e73
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp
-@@ -0,0 +1,26 @@
-+# Copyright 2009 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+set test internal-var-field-address
-+set binfile ${test}.x
-+if  { [gdb_compile "${srcdir}/${subdir}/${test}.c" "${objdir}/${subdir}/${binfile}" object {debug}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+
-+clean_restart $binfile
-+
-+gdb_test {set $varstruct = staticstruct}
-+gdb_test {p $varstruct.field} " = 1"
-diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c
-new file mode 100644
-index 0000000..236da96
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/stap-probe.c
-@@ -0,0 +1,108 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2011 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#if USE_PROBES
-+
-+#define _SDT_HAS_SEMAPHORES
-+__extension__ unsigned short teste_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+#define TEST teste_user_semaphore
-+
-+__extension__ unsigned short teste_two_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+#define TEST2 teste_two_semaphore
-+
-+__extension__ unsigned short teste_m4_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+
-+__extension__ unsigned short teste_pstr_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+
-+__extension__ unsigned short teste_ps_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+#else
-+
-+#define TEST 1
-+#define TEST2 1
-+
-+#endif
-+
-+#include <sys/sdt.h>
-+
-+/* We only support SystemTap and only the v3 form.  */
-+#if _SDT_NOTE_TYPE != 3
-+#error "not using SystemTap v3 probes"
-+#endif
-+
-+struct funcs
-+{
-+  int val;
-+
-+  const char *(*ps) (int);
-+};
-+
-+static void
-+m1 (void)
-+{
-+  if (TEST2)
-+    STAP_PROBE (teste, two);
-+}
-+
-+static void
-+m2 (void)
-+{
-+  if (TEST2)
-+    STAP_PROBE (teste, two);
-+}
-+
-+static int
-+f (int x)
-+{
-+  if (TEST)
-+    STAP_PROBE1 (teste, user, x);
-+  return x+5;
-+}
-+
-+static const char *
-+pstr (int val)
-+{
-+  const char *a = "This is a test message.";
-+  const char *b = "This is another test message.";
-+
-+  STAP_PROBE3 (teste, ps, a, b, val);
-+
-+  return val == 0 ? a : b;
-+}
-+
-+static void
-+m4 (const struct funcs *fs, int v)
-+{
-+  STAP_PROBE3 (teste, m4, fs->val, fs->ps (v), v);
-+}
-+
-+int
-+main()
-+{
-+  struct funcs fs;
-+
-+  fs.val = 42;
-+  fs.ps = pstr;
-+
-+  f (f (23));
-+  m1 ();
-+  m2 ();
-+
-+  m4 (&fs, 0);
-+  m4 (&fs, 1);
-+
-+  return 0; /* last break here */
-+}
-diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
-new file mode 100644
-index 0000000..468efb9
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/stap-probe.exp
-@@ -0,0 +1,187 @@
-+# Copyright (C) 2011 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+set testfile stap-probe
-+
-+# Run the tests.  We run the tests two different ways: once with a
-+# plain probe, and once with a probe that has an associated semaphore.
-+# This returns -1 on failure to compile or start, 0 otherwise.
-+proc stap_test {{arg ""}} {
-+    global testfile hex
-+
-+    if {$arg != ""} {
-+      set arg "additional_flags=$arg"
-+      set addendum ", with semaphore, not optimized"
-+    } else {
-+      set addendum ", no semaphore, not optimized"
-+    }
-+
-+    if {[prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c \
-+         [concat $arg debug]]} {
-+      return -1
-+    }
-+
-+    if ![runto_main] {
-+      return -1
-+    }
-+
-+    gdb_test "print \$_probe_argc" "No SystemTap probe at PC $hex" \
-+      "check argument not at probe point$addendum"
-+
-+    gdb_test "info probes" \
-+      "teste *user *$hex .*" \
-+      "info probes$addendum"
-+    
-+    if {[runto "-p teste:user"]} {
-+      pass "run to -p teste:user$addendum"
-+    } else {
-+      fail "run to -p teste:user$addendum"
-+    }
-+
-+    # Test probe arguments.
-+    gdb_test "print \$_probe_argc" " = 1" \
-+    "print \$_probe_argc for probe user$addendum"
-+    gdb_test "print \$_probe_arg0 == x" " = 1" \
-+    "check \$_probe_arg0 for probe user$addendum"
-+    gdb_test "print \$_probe_arg1" \
-+      "Invalid probe argument 1 -- probe has 1 arguments available" \
-+      "check \$_probe_arg1 for probe user$addendum"
-+
-+    # Set a breakpoint with multiple probe locations.
-+    gdb_test "break -p teste:two" \
-+      "Breakpoint \[0-9\]+ at $hex.*2 locations.*" \
-+      "set multi-location probe breakpoint (probe two)$addendum"
-+
-+    # Reinit GDB, set a breakpoint on probe m4.
-+    delete_breakpoints
-+    rerun_to_main
-+    if {[runto "-p teste:m4"]} {
-+      pass "run to -p teste:m4$addendum"
-+    } else {
-+      fail "run to -p teste:m4$addendum"
-+    }
-+
-+    # Testing probe arguments.
-+    gdb_test "print \$_probe_argc" " = 3" \
-+    "print \$_probe_argc for probe m4$addendum"
-+    gdb_test "print \$_probe_arg0" " = 42" \
-+    "check \$_probe_arg0 for probe m4$addendum"
-+    gdb_test "print (const char *) \$_probe_arg1" \
-+    " = $hex .This is a test message.*" \
-+    "check \$_probe_arg1 for probe m4$addendum"
-+    gdb_test "print \$_probe_arg2 == v" " = 1" \
-+    "check \$_probe_arg2 for probe m4$addendum"
-+
-+    # Reinit GDB, set a breakpoint on probe ps.
-+    delete_breakpoints
-+    rerun_to_main
-+    if {[runto "-p teste:ps"]} {
-+      pass "run to -p teste:m4$addendum"
-+    } else {
-+      fail "run to -p teste:m4$addendum"
-+    }
-+
-+    gdb_test "print \$_probe_argc" " = 3" \
-+    "print \$_probe_argc for probe ps$addendum"
-+    gdb_test "print (const char *) \$_probe_arg1" \
-+    " = $hex .This is another test message.*" \
-+    "print \$_probe_arg1 for probe ps$addendum"
-+
-+    return 0
-+}
-+
-+proc stap_test_no_debuginfo {{ arg "" }} {
-+    global testfile hex
-+
-+    if {$arg != ""} {
-+      set arg "additional_flags=$arg"
-+      set addendum ", with semaphore, optimized"
-+    } else {
-+      set addendum ", no semaphore, optimized"
-+    }
-+
-+    if {[prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c \
-+         {$arg nodebug optimize=-O2}]} {
-+      return -1
-+    }
-+
-+    if {[runto "-p teste:user"]} {
-+      pass "run to -p teste:user$addendum"
-+    } else {
-+      fail "run to -p teste:user$addendum"
-+    }
-+
-+    # Test probe arguments.
-+    gdb_test "print \$_probe_argc" " = 1" \
-+    "print \$_probe_argc for probe user$addendum"
-+    gdb_test "print \$_probe_arg0 == 23" " = 1" \
-+    "check \$_probe_arg0 for probe user$addendum"
-+    gdb_test "print \$_probe_arg1" \
-+      "Invalid probe argument 1 -- probe has 1 arguments available" \
-+      "check \$_probe_arg1 for probe user$addendum"
-+
-+    # Set a breakpoint with multiple probe locations.
-+    # In this scenario, we may expect more than 2 locations because of
-+    # the optimizations (inlining, loop unrolling, etc).
-+    gdb_test "break -p teste:two" \
-+      "Breakpoint .* at $hex.*\[0-9\]+ locations.*" \
-+      "set multi-location probe breakpoint (probe two)$addendum"
-+
-+    # Reinit GDB, set a breakpoint on probe m4.
-+    delete_breakpoints
-+    rerun_to_main
-+    if {[runto "-p teste:m4"]} {
-+      pass "run to -p teste:m4$addendum"
-+    } else {
-+      fail "run to -p teste:m4$addendum"
-+    }
-+
-+    # Testing probe arguments.
-+    gdb_test "print \$_probe_argc" " = 3" \
-+    "print \$_probe_argc for probe m4$addendum"
-+    gdb_test "print \$_probe_arg0" " = 42" \
-+    "check \$_probe_arg0 for probe m4$addendum"
-+    gdb_test "print (const char *) \$_probe_arg1" \
-+    " = $hex .This is a test message.*" \
-+    "check \$_probe_arg1 for probe m4$addendum"
-+    gdb_test "print \$_probe_arg2 == 0" " = 1" \
-+    "check \$_probe_arg2 for probe m4$addendum"
-+
-+    # Reinit GDB, set a breakpoint on probe ps.
-+    delete_breakpoints
-+    rerun_to_main
-+    if {[runto "-p teste:ps"]} {
-+      pass "run to -p teste:m4$addendum"
-+    } else {
-+      fail "run to -p teste:m4$addendum"
-+    }
-+
-+    gdb_test "print \$_probe_argc" " = 3" \
-+    "print \$_probe_argc for probe ps$addendum"
-+    gdb_test "print (const char *) \$_probe_arg1" \
-+    " = $hex .This is another test message.*" \
-+    "print \$_probe_arg1 for probe ps$addendum"
-+
-+    return 0
-+}
-+
-+if {[stap_test] == -1} {
-+    untested stap-probe.exp
-+    return -1
-+}
-+
-+stap_test "-DUSE_PROBES"
-+stap_test_no_debuginfo
-+stap_test_no_debuginfo "-DUSE_PROBES"
-diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c
-new file mode 100644
-index 0000000..5750f68
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla-frame.c
-@@ -0,0 +1,31 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2011 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#include <string.h>
-+
-+int
-+main (int argc, char **argv)
-+{
-+  char s[2 + argc];
-+  void (*f) (char *) = 0;
-+
-+  memset (s, 0, sizeof (s));
-+  s[0] = 'X';
-+
-+  f (s);
-+  return 0;
-+}
-diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp
-new file mode 100644
-index 0000000..47736c7
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla-frame.exp
-@@ -0,0 +1,38 @@
-+# Copyright 2011 Free Software Foundation, Inc.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+set testfile vla-frame
-+set executable ${testfile}
-+
-+if { [prepare_for_testing ${testfile}.exp ${executable}] } {
-+    return -1
-+}
-+
-+if ![runto_main] {
-+    return -1
-+}
-+
-+set test "continue"
-+gdb_test_multiple $test $test {
-+    -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
-+      pass $test
-+    }
-+    -re "\r\n$gdb_prompt $" {
-+      untested ${testfile}.exp
-+      return
-+    }
-+}
-+
-+gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
-diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c
-new file mode 100644
-index 0000000..c5d5ee0
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla-overflow.c
-@@ -0,0 +1,30 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2008 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#include <stdlib.h>
-+
-+int
-+main (int argc, char **argv)
-+{
-+  int array[argc];
-+
-+  array[0] = array[0];
-+
-+  abort ();
-+
-+  return 0;
-+}
-diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
+ }
+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..24a608f
---- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla-overflow.exp
-@@ -0,0 +1,109 @@
-+# Copyright 2008 Free Software Foundation, Inc.
-+
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+# We could crash in:
-+# #0  block_linkage_function (bl=0x0) at ../../gdb/block.c:69
-+# #1  in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
-+#   97          framefunc = block_linkage_function (get_frame_block (frame, NULL));
-+# #2  in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
-+# #3  in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
-+# #4  dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
-+# #5  in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
-+# #6  in create_array_type (...) at ../../gdb/gdbtypes.c:840
-+# ...
-+# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
-+# ...
-+# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
-+
-+set testfile vla-overflow
-+set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-+    untested "Couldn't compile test program"
-+    return -1
-+}
-+
-+set f [open "|getconf PAGESIZE" "r"]
-+gets $f pagesize
-+close $f
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+set pid_of_gdb [exp_pid -i [board_info host fileid]]
-+
-+if { [runto_main] < 0 } {
-+    untested vla-overflow
-+    return -1
-+}
-+
-+# Get the GDB memory size when we stay at main.
-+
-+proc memory_v_pages_get {} {
-+    global pid_of_gdb pagesize
-+    set fd [open "/proc/$pid_of_gdb/statm"]
-+    gets $fd line
-+    close $fd
-+    # number of pages of virtual memory
-+    scan $line "%d" drs
-+    return $drs
-+}
-+
-+set pages_found [memory_v_pages_get]
-+
-+# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
-+set mb_reserve 40
-+verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
-+set kb_found [expr $pages_found * $pagesize / 1024]
-+set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
-+verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
-+
-+# Create the ulimit wrapper.
-+set f [open $shfile "w"]
-+puts $f "#! /bin/sh"
-+puts $f "ulimit -v $kb_permit"
-+puts $f "exec $GDB \"\$@\""
-+close $f
-+remote_exec host "chmod +x $shfile"
-+
-+gdb_exit
-+set GDBold $GDB
-+set GDB "$shfile"
-+gdb_start
-+set GDB $GDBold
-+
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+set pid_of_gdb [exp_pid -i [board_info host fileid]]
-+
-+# Check the size again after the second run.
-+# We must not stop in main as it would cache `array' and never crash later.
-+
-+gdb_run_cmd
-+
-+verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
-+
-+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
-+
-+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
-+
-+# `abort' can get expressed as `*__GI_abort'.
-+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
-+
-+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
-diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c
+index 0000000..83faaf6
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer-foo.S
+@@ -0,0 +1,457 @@
++      .file   "x86_64-vla-pointer.c"
++      .section        .debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++      .section        .debug_info,"",@progbits
++.Ldebug_info0:
++      .section        .debug_line,"",@progbits
++.Ldebug_line0:
++      .text
++.Ltext0:
++.globl foo
++      .type   foo, @function
++foo:
++.LFB2:
++      .file 1 "x86_64-vla-pointer.c"
++      .loc 1 22 0
++      pushq   %rbp
++.LCFI0:
++      movq    %rsp, %rbp
++.LCFI1:
++      subq    $64, %rsp
++.LCFI2:
++      movl    %edi, -36(%rbp)
++      .loc 1 22 0
++      movq    %rsp, %rax
++      movq    %rax, -48(%rbp)
++      .loc 1 23 0
++      movl    -36(%rbp), %edx
++      movslq  %edx,%rax
++      subq    $1, %rax
++      movq    %rax, -24(%rbp)
++      .loc 1 24 0
++      movslq  %edx,%rax
++      addq    $15, %rax
++      addq    $15, %rax
++      shrq    $4, %rax
++      salq    $4, %rax
++      subq    %rax, %rsp
++      movq    %rsp, -56(%rbp)
++      movq    -56(%rbp), %rax
++      addq    $15, %rax
++      shrq    $4, %rax
++      salq    $4, %rax
++      movq    %rax, -56(%rbp)
++      movq    -56(%rbp), %rax
++      movq    %rax, -16(%rbp)
++      .loc 1 27 0
++      movl    $0, -4(%rbp)
++      jmp     .L2
++.L3:
++      .loc 1 28 0
++      movl    -4(%rbp), %esi
++      movl    -4(%rbp), %eax
++      movl    %eax, %ecx
++      movq    -16(%rbp), %rdx
++      movslq  %esi,%rax
++      movb    %cl, (%rdx,%rax)
++      .loc 1 27 0
++      addl    $1, -4(%rbp)
++.L2:
++      movl    -4(%rbp), %eax
++      cmpl    -36(%rbp), %eax
++      jl      .L3
++      .loc 1 30 0
++      .globl  break_here
++break_here:
++      movq    -16(%rbp), %rax
++      movb    $0, (%rax)
++      movq    -48(%rbp), %rsp
++      .loc 1 31 0
++      leave
++      ret
++.LFE2:
++      .size   foo, .-foo
++      .section        .debug_frame,"",@progbits
++.Lframe0:
++      .long   .LECIE0-.LSCIE0
++.LSCIE0:
++      .long   0xffffffff
++      .byte   0x1
++      .string ""
++      .uleb128 0x1
++      .sleb128 -8
++      .byte   0x10
++      .byte   0xc
++      .uleb128 0x7
++      .uleb128 0x8
++      .byte   0x90
++      .uleb128 0x1
++      .align 8
++.LECIE0:
++.LSFDE0:
++      .long   .LEFDE0-.LASFDE0
++.LASFDE0:
++      .long   .Lframe0
++      .quad   .LFB2
++      .quad   .LFE2-.LFB2
++      .byte   0x4
++      .long   .LCFI0-.LFB2
++      .byte   0xe
++      .uleb128 0x10
++      .byte   0x86
++      .uleb128 0x2
++      .byte   0x4
++      .long   .LCFI1-.LCFI0
++      .byte   0xd
++      .uleb128 0x6
++      .align 8
++.LEFDE0:
++      .section        .eh_frame,"a",@progbits
++.Lframe1:
++      .long   .LECIE1-.LSCIE1
++.LSCIE1:
++      .long   0x0
++      .byte   0x1
++      .string "zR"
++      .uleb128 0x1
++      .sleb128 -8
++      .byte   0x10
++      .uleb128 0x1
++      .byte   0x3
++      .byte   0xc
++      .uleb128 0x7
++      .uleb128 0x8
++      .byte   0x90
++      .uleb128 0x1
++      .align 8
++.LECIE1:
++.LSFDE1:
++      .long   .LEFDE1-.LASFDE1
++.LASFDE1:
++      .long   .LASFDE1-.Lframe1
++      .long   .LFB2
++      .long   .LFE2-.LFB2
++      .uleb128 0x0
++      .byte   0x4
++      .long   .LCFI0-.LFB2
++      .byte   0xe
++      .uleb128 0x10
++      .byte   0x86
++      .uleb128 0x2
++      .byte   0x4
++      .long   .LCFI1-.LCFI0
++      .byte   0xd
++      .uleb128 0x6
++      .align 8
++.LEFDE1:
++      .text
++.Letext0:
++      .section        .debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++      .quad   .LFB2-.Ltext0
++      .quad   .LCFI0-.Ltext0
++      .value  0x2
++      .byte   0x77
++      .sleb128 8
++      .quad   .LCFI0-.Ltext0
++      .quad   .LCFI1-.Ltext0
++      .value  0x2
++      .byte   0x77
++      .sleb128 16
++      .quad   .LCFI1-.Ltext0
++      .quad   .LFE2-.Ltext0
++      .value  0x2
++      .byte   0x76
++      .sleb128 16
++      .quad   0x0
++      .quad   0x0
++      .section        .debug_info
++.Ldebug_relative:
++      .long   .Ldebug_end - .Ldebug_start
++.Ldebug_start:
++      .value  0x2
++      .long   .Ldebug_abbrev0
++      .byte   0x8
++      .uleb128 0x1
++      .long   .LASF2
++      .byte   0x1
++      .long   .LASF3
++      .long   .LASF4
++      .quad   .Ltext0
++      .quad   .Letext0
++      .long   .Ldebug_line0
++      .uleb128 0x2
++      .byte   0x1
++      .string "foo"
++      .byte   0x1
++      .byte   0x16
++      .byte   0x1
++      .quad   .LFB2
++      .quad   .LFE2
++      .long   .LLST0
++      .long   .Ltype_int - .Ldebug_relative
++      .uleb128 0x3
++      .long   .LASF5
++      .byte   0x1
++      .byte   0x15
++      .long   .Ltype_int - .Ldebug_relative
++      .byte   0x2
++      .byte   0x91
++      .sleb128 -52
++.Ltag_pointer:
++      .uleb128 0x4
++      .byte   0x8     /* DW_AT_byte_size */
++      .long   .Ltag_array_type - .debug_info  /* DW_AT_type */
++      .uleb128 0x5    /* Abbrev Number: 5 (DW_TAG_variable) */
++      .long   .LASF0
++      .byte   0x1
++      .byte   0x18
++#if 1
++      .long   .Ltag_pointer - .debug_info
++#else
++      /* Debugging only: Skip the typedef indirection.  */
++      .long   .Ltag_array_type - .debug_info
++#endif
++      /* DW_AT_location: DW_FORM_block1: start */
++      .byte   0x3
++      .byte   0x91
++      .sleb128 -32
++#if 0
++      .byte   0x6     /* DW_OP_deref */
++#else
++      .byte   0x96    /* DW_OP_nop */
++#endif
++      /* DW_AT_location: DW_FORM_block1: end */
++      .uleb128 0x6
++      .string "i"
++      .byte   0x1
++      .byte   0x19
++      .long   .Ltype_int - .Ldebug_relative
++      .byte   0x2
++      .byte   0x91
++      .sleb128 -20
++      .byte   0x0
++.Ltype_int:
++      .uleb128 0x7
++      .byte   0x4
++      .byte   0x5
++      .string "int"
++.Ltag_array_type:
++      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
++      .long   .Ltype_char - .Ldebug_relative
++      .long   .Ltype_ulong - .Ldebug_relative /* DW_AT_sibling: DW_FORM_ref4 */
++1:    /* DW_AT_data_location: DW_FORM_block1: start */
++      .byte   2f - 3f /* length */
++3:
++      .byte   0x97    /* DW_OP_push_object_address */
++#if 1
++      .byte   0x6     /* DW_OP_deref */
++#else
++      .byte   0x96    /* DW_OP_nop */
++#endif
++2:    /* DW_AT_data_location: DW_FORM_block1: end */
++      .uleb128 0x9
++      .long   .Ltype_char - .Ldebug_relative  /* DW_AT_type: DW_FORM_ref4 */
++      .byte   0x3
++      .byte   0x91
++      .sleb128 -40
++      .byte   0x6
++      .byte   0x0
++.Ltype_ulong:
++      .uleb128 0xa
++      .byte   0x8
++      .byte   0x7
++.Ltype_char:
++      .uleb128 0xb
++      .byte   0x1
++      .byte   0x6
++      .long   .LASF1
++      .byte   0x0
++.Ldebug_end:
++      .section        .debug_abbrev
++      .uleb128 0x1
++      .uleb128 0x11
++      .byte   0x1
++      .uleb128 0x25
++      .uleb128 0xe
++      .uleb128 0x13
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x1b
++      .uleb128 0xe
++      .uleb128 0x11
++      .uleb128 0x1
++      .uleb128 0x12
++      .uleb128 0x1
++      .uleb128 0x10
++      .uleb128 0x6
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x2
++      .uleb128 0x2e
++      .byte   0x1
++      .uleb128 0x3f
++      .uleb128 0xc
++      .uleb128 0x3
++      .uleb128 0x8
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x27
++      .uleb128 0xc
++      .uleb128 0x11
++      .uleb128 0x1
++      .uleb128 0x12
++      .uleb128 0x1
++      .uleb128 0x40
++      .uleb128 0x6
++      .uleb128 0x1
++      .uleb128 0x13
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0x5
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x4    /* .Ltag_pointer abbrev */
++      .uleb128 0x0f   /* DW_TAG_pointer_type */
++      .byte   0x0
++      .uleb128 0x0b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x5
++      .uleb128 0x34
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x6
++      .uleb128 0x34
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0x8
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x7
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0x8
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
++      .uleb128 0x1
++      .byte   0x1
++      .uleb128 0x49   /* DW_AT_type */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x1    /* DW_AT_sibling */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x50   /* DW_AT_data_location */
++      .uleb128 0xa    /* DW_FORM_block1 */
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x9
++      .uleb128 0x21
++      .byte   0x0
++      .uleb128 0x49   /* DW_AT_type */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x2f
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0xa
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0xe
++      .byte   0x0
++      .byte   0x0
++      .byte   0x0
++      .section        .debug_pubnames,"",@progbits
++      .long   0x16
++      .value  0x2
++      .long   .Ldebug_info0
++      .long   0xa8
++      .long   0x2d
++      .string "foo"
++      .long   0x0
++      .section        .debug_aranges,"",@progbits
++      .long   0x2c
++      .value  0x2
++      .long   .Ldebug_info0
++      .byte   0x8
++      .byte   0x0
++      .value  0x0
++      .value  0x0
++      .quad   .Ltext0
++      .quad   .Letext0-.Ltext0
++      .quad   0x0
++      .quad   0x0
++      .section        .debug_str,"MS",@progbits,1
++.LASF0:
++      .string "array"
++.LASF5:
++      .string "size"
++.LASF3:
++      .string "x86_64-vla-pointer.c"
++.LASF6:
++      .string "array_t"
++.LASF1:
++      .string "char"
++.LASF4:
++      .string "gdb.arch"
++.LASF2:
++      .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
++      .ident  "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
++      .section        .note.GNU-stack,"",@progbits
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
 new file mode 100644
-index 0000000..e1f3ed1
+index 0000000..fe2c8f7
 --- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla.c
-@@ -0,0 +1,55 @@
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.c
+@@ -0,0 +1,43 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2008 Free Software Foundation, Inc.
++   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
@@ -12381,37 +10285,23 @@ index 0000000..e1f3ed1
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+#include <string.h>
-+
-+void
-+marker (void)
-+{
-+}
-+
-+void
-+bar (char *a, char *b, char *c, int size)
-+{
-+  memset (a, '1', size);
-+  memset (b, '2', size);
-+  memset (c, '3', 48);
-+}
++#if 0
 +
 +void
 +foo (int size)
 +{
-+  char temp1[size];
-+  char temp3[48];
-+
-+  temp1[size - 1] = '\0';
-+  {
-+    char temp2[size];
++  typedef char array_t[size];
++  array_t array;
++  int i;
 +
-+    bar (temp1, temp2, temp3, size);
++  for (i = 0; i < size; i++)
++    array[i] = i;
 +
-+    marker ();        /* break-here */
-+  }
++  array[0] = 0;       /* break-here */
 +}
 +
++#else
++
 +int
 +main (void)
 +{
@@ -12419,13 +10309,15 @@ index 0000000..e1f3ed1
 +  foo (78);
 +  return 0;
 +}
-diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp
++
++#endif
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
 new file mode 100644
-index 0000000..5da7378
+index 0000000..d243cf1
 --- /dev/null
-+++ b/gdb/testsuite/gdb.base/vla.exp
-@@ -0,0 +1,62 @@
-+# Copyright 2008 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-pointer.exp
+@@ -0,0 +1,66 @@
++# Copyright 2009 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -12440,10 +10332,21 @@ index 0000000..5da7378
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+set testfile vla
++if ![istarget "x86_64-*-*"] then {
++    verbose "Skipping over gdb.arch/x86_64-vla-pointer.exp test made only for x86_64."
++    return
++}
++
++set testfile x86_64-vla-pointer
++set srcasmfile ${testfile}-foo.S
 +set srcfile ${testfile}.c
 +set binfile ${objdir}/${subdir}/${testfile}
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
++if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
 +    untested "Couldn't compile test program"
 +    return -1
 +}
@@ -12454,70 +10357,502 @@ index 0000000..5da7378
 +gdb_load ${binfile}
 +
 +if ![runto_main] {
-+    untested vla
++    untested x86_64-vla-pointer
 +    return -1
 +}
 +
-+gdb_breakpoint [gdb_get_line_number "break-here"]
-+
-+gdb_continue_to_breakpoint "break-here"
-+
-+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "first: whatis temp1"
-+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "first: whatis temp2"
-+gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
++gdb_breakpoint "break_here"
 +
-+gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
-+gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
-+gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
++gdb_continue_to_breakpoint "break_here"
 +
-+gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
-+gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
-+gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
++gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "first: whatis array"
++gdb_test "ptype array" "type = char \\(\\*\\)\\\[26\\\]" "first: ptype array"
 +
-+gdb_continue_to_breakpoint "break-here"
++gdb_test "whatis *array" "type = char \\\[26\\\]" "first: whatis *array"
++gdb_test "ptype *array" "type = char \\\[26\\\]" "first: ptype *array"
 +
-+gdb_test "whatis temp1" "type = char \\\[variable\\\]" "second: whatis temp1"
-+gdb_test "whatis temp2" "type = char \\\[variable\\\]" "second: whatis temp2"
-+gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
++gdb_test "p (*array)\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
++gdb_test "p (*array)\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
++gdb_test "p (*array)\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
++gdb_test "p (*array)\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
 +
-+gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
-+gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
-+gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
++gdb_continue_to_breakpoint "break_here"
 +
-+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
-+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
-+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
-diff --git a/gdb/testsuite/gdb.cp/nextoverthrow.exp b/gdb/testsuite/gdb.cp/nextoverthrow.exp
-index 7d4a0c5..2dafcab 100644
---- a/gdb/testsuite/gdb.cp/nextoverthrow.exp
-+++ b/gdb/testsuite/gdb.cp/nextoverthrow.exp
-@@ -54,6 +54,17 @@ gdb_test_multiple "print _Unwind_DebugHook" "check for unwinder hook" {
-     }
- }
- if {!$ok} {
-+    gdb_test_multiple "info probe" "check for stap probe in unwinder" {
-+      -re ".*libgcc.*unwind.*\r\n$gdb_prompt $" {
-+          pass "check for stap probe in unwinder"
-+          set ok 1
-+      }
-+      -re "\r\n$gdb_prompt $" {
-+      }
-+    }
-+}
++gdb_test "whatis array" "type = char \\(\\*\\)\\\[variable\\\]" "second: whatis array"
++gdb_test "ptype array" "type = char \\(\\*\\)\\\[78\\\]" "second: ptype array"
 +
-+if {!$ok} {
-     unsupported "nextoverthrow.exp could not find _Unwind_DebugHook"
-     return -1
- }
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
++gdb_test "whatis *array" "type = char \\\[78\\\]" "second: whatis *array"
++gdb_test "ptype *array" "type = char \\\[78\\\]" "second: ptype *array"
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
+new file mode 100644
+index 0000000..66f7a39
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef-foo.S
+@@ -0,0 +1,455 @@
++      .file   "x86_64-vla-typedef.c"
++      .section        .debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++      .section        .debug_info,"",@progbits
++.Ldebug_info0:
++      .section        .debug_line,"",@progbits
++.Ldebug_line0:
++      .text
++.Ltext0:
++.globl foo
++      .type   foo, @function
++foo:
++.LFB2:
++      .file 1 "x86_64-vla-typedef.c"
++      .loc 1 22 0
++      pushq   %rbp
++.LCFI0:
++      movq    %rsp, %rbp
++.LCFI1:
++      subq    $64, %rsp
++.LCFI2:
++      movl    %edi, -36(%rbp)
++      .loc 1 22 0
++      movq    %rsp, %rax
++      movq    %rax, -48(%rbp)
++      .loc 1 23 0
++      movl    -36(%rbp), %edx
++      movslq  %edx,%rax
++      subq    $1, %rax
++      movq    %rax, -24(%rbp)
++      .loc 1 24 0
++      movslq  %edx,%rax
++      addq    $15, %rax
++      addq    $15, %rax
++      shrq    $4, %rax
++      salq    $4, %rax
++      subq    %rax, %rsp
++      movq    %rsp, -56(%rbp)
++      movq    -56(%rbp), %rax
++      addq    $15, %rax
++      shrq    $4, %rax
++      salq    $4, %rax
++      movq    %rax, -56(%rbp)
++      movq    -56(%rbp), %rax
++      movq    %rax, -16(%rbp)
++      .loc 1 27 0
++      movl    $0, -4(%rbp)
++      jmp     .L2
++.L3:
++      .loc 1 28 0
++      movl    -4(%rbp), %esi
++      movl    -4(%rbp), %eax
++      movl    %eax, %ecx
++      movq    -16(%rbp), %rdx
++      movslq  %esi,%rax
++      movb    %cl, (%rdx,%rax)
++      .loc 1 27 0
++      addl    $1, -4(%rbp)
++.L2:
++      movl    -4(%rbp), %eax
++      cmpl    -36(%rbp), %eax
++      jl      .L3
++      .loc 1 30 0
++      .globl  break_here
++break_here:
++      movq    -16(%rbp), %rax
++      movb    $0, (%rax)
++      movq    -48(%rbp), %rsp
++      .loc 1 31 0
++      leave
++      ret
++.LFE2:
++      .size   foo, .-foo
++      .section        .debug_frame,"",@progbits
++.Lframe0:
++      .long   .LECIE0-.LSCIE0
++.LSCIE0:
++      .long   0xffffffff
++      .byte   0x1
++      .string ""
++      .uleb128 0x1
++      .sleb128 -8
++      .byte   0x10
++      .byte   0xc
++      .uleb128 0x7
++      .uleb128 0x8
++      .byte   0x90
++      .uleb128 0x1
++      .align 8
++.LECIE0:
++.LSFDE0:
++      .long   .LEFDE0-.LASFDE0
++.LASFDE0:
++      .long   .Lframe0
++      .quad   .LFB2
++      .quad   .LFE2-.LFB2
++      .byte   0x4
++      .long   .LCFI0-.LFB2
++      .byte   0xe
++      .uleb128 0x10
++      .byte   0x86
++      .uleb128 0x2
++      .byte   0x4
++      .long   .LCFI1-.LCFI0
++      .byte   0xd
++      .uleb128 0x6
++      .align 8
++.LEFDE0:
++      .section        .eh_frame,"a",@progbits
++.Lframe1:
++      .long   .LECIE1-.LSCIE1
++.LSCIE1:
++      .long   0x0
++      .byte   0x1
++      .string "zR"
++      .uleb128 0x1
++      .sleb128 -8
++      .byte   0x10
++      .uleb128 0x1
++      .byte   0x3
++      .byte   0xc
++      .uleb128 0x7
++      .uleb128 0x8
++      .byte   0x90
++      .uleb128 0x1
++      .align 8
++.LECIE1:
++.LSFDE1:
++      .long   .LEFDE1-.LASFDE1
++.LASFDE1:
++      .long   .LASFDE1-.Lframe1
++      .long   .LFB2
++      .long   .LFE2-.LFB2
++      .uleb128 0x0
++      .byte   0x4
++      .long   .LCFI0-.LFB2
++      .byte   0xe
++      .uleb128 0x10
++      .byte   0x86
++      .uleb128 0x2
++      .byte   0x4
++      .long   .LCFI1-.LCFI0
++      .byte   0xd
++      .uleb128 0x6
++      .align 8
++.LEFDE1:
++      .text
++.Letext0:
++      .section        .debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++      .quad   .LFB2-.Ltext0
++      .quad   .LCFI0-.Ltext0
++      .value  0x2
++      .byte   0x77
++      .sleb128 8
++      .quad   .LCFI0-.Ltext0
++      .quad   .LCFI1-.Ltext0
++      .value  0x2
++      .byte   0x77
++      .sleb128 16
++      .quad   .LCFI1-.Ltext0
++      .quad   .LFE2-.Ltext0
++      .value  0x2
++      .byte   0x76
++      .sleb128 16
++      .quad   0x0
++      .quad   0x0
++      .section        .debug_info
++      .long   .Ldebug_end - .Ldebug_start
++.Ldebug_start:
++      .value  0x2
++      .long   .Ldebug_abbrev0
++      .byte   0x8
++      .uleb128 0x1
++      .long   .LASF2
++      .byte   0x1
++      .long   .LASF3
++      .long   .LASF4
++      .quad   .Ltext0
++      .quad   .Letext0
++      .long   .Ldebug_line0
++      .uleb128 0x2
++      .byte   0x1
++      .string "foo"
++      .byte   0x1
++      .byte   0x16
++      .byte   0x1
++      .quad   .LFB2
++      .quad   .LFE2
++      .long   .LLST0
++      .long   0x83
++      .uleb128 0x3
++      .long   .LASF5
++      .byte   0x1
++      .byte   0x15
++      .long   0x83
++      .byte   0x2
++      .byte   0x91
++      .sleb128 -52
++.Ltag_typedef:
++      .uleb128 0x4
++      .long   .LASF6
++      .byte   0x1
++      .byte   0x17
++      .long   .Ltag_array_type - .debug_info
++      .uleb128 0x5    /* Abbrev Number: 5 (DW_TAG_variable) */
++      .long   .LASF0
++      .byte   0x1
++      .byte   0x18
++#if 1
++      .long   .Ltag_typedef - .debug_info
++#else
++      /* Debugging only: Skip the typedef indirection.  */
++      .long   .Ltag_array_type - .debug_info
++#endif
++      /* DW_AT_location: DW_FORM_block1: start */
++      .byte   0x3
++      .byte   0x91
++      .sleb128 -32
++#if 0
++      .byte   0x6     /* DW_OP_deref */
++#else
++      .byte   0x96    /* DW_OP_nop */
++#endif
++      /* DW_AT_location: DW_FORM_block1: end */
++      .uleb128 0x6
++      .string "i"
++      .byte   0x1
++      .byte   0x19
++      .long   0x83
++      .byte   0x2
++      .byte   0x91
++      .sleb128 -20
++      .byte   0x0
++      .uleb128 0x7
++      .byte   0x4
++      .byte   0x5
++      .string "int"
++.Ltag_array_type:
++      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
++      .long   0xa0 + (2f - 1f)        /* DW_AT_type: DW_FORM_ref4 */
++      .long   0x9d + (2f - 1f)        /* DW_AT_sibling: DW_FORM_ref4 */
++1:    /* DW_AT_data_location: DW_FORM_block1: start */
++      .byte   2f - 3f /* length */
++3:
++      .byte   0x97    /* DW_OP_push_object_address */
++      .byte   0x6     /* DW_OP_deref */
++2:    /* DW_AT_data_location: DW_FORM_block1: end */
++      .uleb128 0x9
++      .long   0x9d + (2b - 1b)        /* DW_AT_type: DW_FORM_ref4 */
++      .byte   0x3
++      .byte   0x91
++      .sleb128 -40
++      .byte   0x6
++      .byte   0x0
++      .uleb128 0xa
++      .byte   0x8
++      .byte   0x7
++      .uleb128 0xb
++      .byte   0x1
++      .byte   0x6
++      .long   .LASF1
++      .byte   0x0
++.Ldebug_end:
++      .section        .debug_abbrev
++      .uleb128 0x1
++      .uleb128 0x11
++      .byte   0x1
++      .uleb128 0x25
++      .uleb128 0xe
++      .uleb128 0x13
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x1b
++      .uleb128 0xe
++      .uleb128 0x11
++      .uleb128 0x1
++      .uleb128 0x12
++      .uleb128 0x1
++      .uleb128 0x10
++      .uleb128 0x6
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x2
++      .uleb128 0x2e
++      .byte   0x1
++      .uleb128 0x3f
++      .uleb128 0xc
++      .uleb128 0x3
++      .uleb128 0x8
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x27
++      .uleb128 0xc
++      .uleb128 0x11
++      .uleb128 0x1
++      .uleb128 0x12
++      .uleb128 0x1
++      .uleb128 0x40
++      .uleb128 0x6
++      .uleb128 0x1
++      .uleb128 0x13
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0x5
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x4
++      .uleb128 0x16
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x5
++      .uleb128 0x34
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0xe
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x6
++      .uleb128 0x34
++      .byte   0x0
++      .uleb128 0x3
++      .uleb128 0x8
++      .uleb128 0x3a
++      .uleb128 0xb
++      .uleb128 0x3b
++      .uleb128 0xb
++      .uleb128 0x49
++      .uleb128 0x13
++      .uleb128 0x2
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x7
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0x8
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x8    /* Abbrev Number: 8 (DW_TAG_array_type) */
++      .uleb128 0x1
++      .byte   0x1
++      .uleb128 0x49   /* DW_AT_type */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x1    /* DW_AT_sibling */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x50   /* DW_AT_data_location */
++      .uleb128 0xa    /* DW_FORM_block1 */
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0x9
++      .uleb128 0x21
++      .byte   0x0
++      .uleb128 0x49   /* DW_AT_type */
++      .uleb128 0x13   /* DW_FORM_ref4 */
++      .uleb128 0x2f
++      .uleb128 0xa
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0xa
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .byte   0x0
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0x24
++      .byte   0x0
++      .uleb128 0xb
++      .uleb128 0xb
++      .uleb128 0x3e
++      .uleb128 0xb
++      .uleb128 0x3
++      .uleb128 0xe
++      .byte   0x0
++      .byte   0x0
++      .byte   0x0
++      .section        .debug_pubnames,"",@progbits
++      .long   0x16
++      .value  0x2
++      .long   .Ldebug_info0
++      .long   0xa8
++      .long   0x2d
++      .string "foo"
++      .long   0x0
++      .section        .debug_aranges,"",@progbits
++      .long   0x2c
++      .value  0x2
++      .long   .Ldebug_info0
++      .byte   0x8
++      .byte   0x0
++      .value  0x0
++      .value  0x0
++      .quad   .Ltext0
++      .quad   .Letext0-.Ltext0
++      .quad   0x0
++      .quad   0x0
++      .section        .debug_str,"MS",@progbits,1
++.LASF0:
++      .string "array"
++.LASF5:
++      .string "size"
++.LASF3:
++      .string "x86_64-vla-typedef.c"
++.LASF6:
++      .string "array_t"
++.LASF1:
++      .string "char"
++.LASF4:
++      .string "gdb.arch"
++.LASF2:
++      .string "GNU C 4.3.2 20081105 (Red Hat 4.3.2-7)"
++      .ident  "GCC: (GNU) 4.3.2 20081105 (Red Hat 4.3.2-7)"
++      .section        .note.GNU-stack,"",@progbits
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
 new file mode 100644
-index 0000000..aac3baa
+index 0000000..b809c4e
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
-@@ -0,0 +1,246 @@
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.c
+@@ -0,0 +1,43 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2010 Free Software Foundation, Inc.
++   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
@@ -12532,242 +10867,39 @@ index 0000000..aac3baa
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+/* Debug information */
-+
-+/* We will `break *main' at the very first instruction.  */
-+#define main_length 1
-+
-+      .section        .data
-+vardata:
-+      /* See DW_OP_lit3 + 1 (0-based).  */
-+      .string         "seennotseen"
-+
-+      .section        .debug_info
-+.Lcu1_begin:
-+      .4byte          .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
-+.Lcu1_start:
-+      .2byte          2                       /* DWARF version number */
-+      .4byte          .Ldebug_abbrev0         /* Offset Into Abbrev. Section */
-+      .byte           4                       /* Pointer Size (in bytes) */
-+
-+      /* CU die */
-+      .uleb128        1                       /* Abbrev: DW_TAG_compile_unit */
-+      .4byte          .Lproducer              /* DW_AT_producer */
-+      /* Use C++ to exploit a bug in parsing DW_AT_name "".  */
-+      .byte           4                       /* DW_AT_language (C++) -  */
-+      .4byte          main                    /* DW_AT_low_pc */
-+      .byte           main_length             /* DW_AT_high_pc */
-+
-+.Larray_type:
-+      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
-+      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
-+
-+      .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
-+      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           0                       /* DW_AT_lower_bound */
-+      .4byte          .Llen_var-.Lcu1_begin   /* DW_AT_upper_bound */
-+      .byte           0                       /* End of children of die */
-+
-+      /* DW_AT_upper_bound is referencing an optimized-out variable.  */
-+.Larrayb_type:
-+      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
-+      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
-+
-+      .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
-+      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           0                       /* DW_AT_lower_bound */
-+      .4byte          .Llenb_var-.Lcu1_begin  /* DW_AT_upper_bound */
-+      .byte           0                       /* End of children of die */
-+
-+      /* DW_AT_upper_bound is referencing register.  */
-+.Larrayreg_type:
-+      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
-+      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
-+
-+      .uleb128        8                       /* Abbrev: DW_TAG_subrange_type with block */
-+      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           0                       /* DW_AT_lower_bound */
-+      .byte           2f - 1f                 /* DW_AT_upper_bound */
-+1:    .byte           0x50                    /* DW_OP_reg0 */
-+2:
-+      .byte           0                       /* End of children of die */
-+
-+.Luint_type:
-+      .uleb128        4                       /* Abbrev: DW_TAG_base_type */
-+      .4byte          .Luint_str              /* DW_AT_name */
-+      .byte           4                       /* DW_AT_byte_size */
-+      .byte           7                       /* DW_AT_encoding */
-+
-+.Lchar_type:
-+      .uleb128        4                       /* Abbrev: DW_TAG_base_type */
-+      .4byte          .Lchar_str              /* DW_AT_name */
-+      .byte           1                       /* DW_AT_byte_size */
-+      .byte           6                       /* DW_AT_encoding */
-+
-+.Llen_var:
-+      .uleb128        5                       /* Abbrev: DW_TAG_variable artificial */
-+      .byte           1                       /* DW_AT_artificial */
-+      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
-+      .4byte          .Llen_loclist-.Lloclist /* DW_AT_location */
-+
-+      /* optimized-out variable for b_string.  */
-+.Llenb_var:
-+      .uleb128        7                       /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
-+      .byte           1                       /* DW_AT_artificial */
-+      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
-+
-+      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
-+      .string         "a_string"              /* DW_AT_name */
-+      .4byte          .Larray_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           2f - 1f                 /* DW_AT_location */
-+1:    .byte           3                       /*   DW_OP_addr */
-+      .4byte          vardata                 /*   <addr> */
-+2:
-+
-+      /* DW_AT_upper_bound is referencing an optimized-out variable.  */
-+      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
-+      .string         "b_string"              /* DW_AT_name */
-+      .4byte          .Larrayb_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           2f - 1f                 /* DW_AT_location */
-+1:    .byte           3                       /*   DW_OP_addr */
-+      .4byte          vardata                 /*   <addr> */
-+2:
-+
-+      /* DW_AT_upper_bound is referencing register.  */
-+      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
-+      .string         "reg_string"            /* DW_AT_name */
-+      .4byte          .Larrayreg_type-.Lcu1_begin /* DW_AT_type */
-+      .byte           2f - 1f                 /* DW_AT_location */
-+1:    .byte           3                       /*   DW_OP_addr */
-+      .4byte          vardata                 /*   <addr> */
-+2:
-+
-+      .byte           0                       /* End of children of CU */
-+.Lcu1_end:
-+
-+      .section        .debug_loc
-+.Lloclist:
-+.Llen_loclist:
-+      .4byte  0                       # Location list begin address
-+      .4byte  main_length             # Location list end address
-+      .value  2f-1f   # Location expression size
-+1:    .byte   0x33    # DW_OP_lit3
-+      .byte   0x9f    # DW_OP_stack_value
-+2:
-+      .quad   0x0     # Location list terminator begin (*.LLST2)
-+      .quad   0x0     # Location list terminator end (*.LLST2)
-+
-+      .section .debug_abbrev
-+.Ldebug_abbrev0:
-+      .uleb128        1                       /* Abbrev code */
-+      .uleb128        0x11                    /* DW_TAG_compile_unit */
-+      .byte           0x1                     /* has_children */
-+      .uleb128        0x25                    /* DW_AT_producer */
-+      .uleb128        0xe                     /* DW_FORM_strp */
-+      .uleb128        0x13                    /* DW_AT_language */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .uleb128        0x11                    /* DW_AT_low_pc */
-+      .uleb128        0x1                     /* DW_FORM_addr */
-+      .uleb128        0x12                    /* DW_AT_high_pc */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
-+
-+      .uleb128        2                       /* Abbrev code */
-+      .uleb128        0x1                     /* TAG: DW_TAG_array_type */
-+      .byte           0x1                     /* DW_children_yes */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
-+
-+      .uleb128        3                       /* Abbrev code */
-+      .uleb128        0x21                    /* DW_TAG_subrange_type */
-+      .byte           0x0                     /* no children */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .uleb128        0x22                    /* DW_AT_lower_bound */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .uleb128        0x2f                    /* DW_AT_upper_bound */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
-+
-+      .uleb128        4                       /* Abbrev code */
-+      .uleb128        0x24                    /* DW_TAG_base_type */
-+      .byte           0x0                     /* no_children */
-+      .uleb128        0x3                     /* DW_AT_name */
-+      .uleb128        0xe                     /* DW_FORM_strp */
-+      .uleb128        0xb                     /* DW_AT_byte_size */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .uleb128        0x3e                    /* DW_AT_encoding */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++#if 0
 +
-+      .uleb128        5                       /* Abbrev code */
-+      .uleb128        0x34                    /* DW_TAG_variable */
-+      .byte           0x0                     /* no_children */
-+      .uleb128        0x34                    /* DW_AT_artificial */
-+      .uleb128        0x0c                    /* DW_FORM_flag */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .uleb128        0x02                    /* DW_AT_location */
-+      .uleb128        0x06                    /* DW_FORM_data4 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++void
++foo (int size)
++{
++  typedef char array_t[size];
++  array_t array;
++  int i;
 +
-+      .uleb128        6                       /* Abbrev code */
-+      .uleb128        0x34                    /* DW_TAG_variable */
-+      .byte           0x0                     /* no_children */
-+      .uleb128        0x3                     /* DW_AT_name */
-+      .uleb128        0x8                     /* DW_FORM_string */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .uleb128        0x2                     /* DW_AT_location */
-+      .uleb128        0xa                     /* DW_FORM_block1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++  for (i = 0; i < size; i++)
++    array[i] = i;
 +
-+      .uleb128        7                       /* Abbrev code */
-+      .uleb128        0x34                    /* DW_TAG_variable */
-+      .byte           0x0                     /* no_children */
-+      .uleb128        0x34                    /* DW_AT_artificial */
-+      .uleb128        0x0c                    /* DW_FORM_flag */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++  array[0] = 0;       /* break-here */
++}
 +
-+      .uleb128        8                       /* Abbrev code */
-+      .uleb128        0x21                    /* DW_TAG_subrange_type with block */
-+      .byte           0x0                     /* no children */
-+      .uleb128        0x49                    /* DW_AT_type */
-+      .uleb128        0x13                    /* DW_FORM_ref4 */
-+      .uleb128        0x22                    /* DW_AT_lower_bound */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .uleb128        0x2f                    /* DW_AT_upper_bound */
-+      .uleb128        0xa                     /* DW_FORM_block1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++#else
 +
-+      .byte           0x0                     /* Terminator */
++int
++main (void)
++{
++  foo (26);
++  foo (78);
++  return 0;
++}
 +
-+/* String table */
-+      .section .debug_str
-+.Lproducer:
-+      .string         "GNU C 3.3.3"
-+.Lchar_str:
-+      .string         "char"
-+.Luint_str:
-+      .string         "unsigned int"
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
++#endif
+diff --git a/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
 new file mode 100644
-index 0000000..815ed93
+index 0000000..b05411e
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
-@@ -0,0 +1,54 @@
-+# Copyright 2010 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.arch/x86_64-vla-typedef.exp
+@@ -0,0 +1,64 @@
++# Copyright 2009 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -12782,187 +10914,239 @@ index 0000000..815ed93
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+# Test printing variable with dynamic bounds which reference a different
-+# (artificial in the GCC case) variable containing loclist as its location.
-+# This testcase uses value (not address) of the referenced variable:
-+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
++# Test DW_AT_data_location accessed through DW_TAG_typedef intermediate.
 +
-+# 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
++if ![istarget "x86_64-*-*"] then {
++    verbose "Skipping over gdb.arch/x86_64-vla-typedef.exp test made only for x86_64."
++    return
 +}
 +
-+set testfile dw2-bound-loclist
-+if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
++set testfile x86_64-vla-typedef
++set srcasmfile ${testfile}-foo.S
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++set binobjfile ${objdir}/${subdir}/${testfile}-foo.o
++if  { [gdb_compile "${srcdir}/${subdir}/${srcasmfile}" "${binobjfile}" object {}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${binobjfile}" "${binfile}" executable {debug}] != "" } {
++    untested "Couldn't compile test program"
 +    return -1
 +}
 +
-+# Verify it behaves at least as an unbound array without inferior.
-+
-+gdb_test "p a_string" { = 0x[0-9a-f]+ "seennotseen"}
-+gdb_test "ptype a_string" {type = char \[\]}
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
 +
-+# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
-+if ![runto "*main"] {
++if ![runto_main] {
++    untested x86_64-vla-typedef
 +    return -1
 +}
 +
-+gdb_test "p a_string" { = "seen"}
-+gdb_test "ptype a_string" {type = char \[4\]}
++gdb_breakpoint "break_here"
 +
-+gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
-+gdb_test "ptype b_string" {type = char \[\]}
++gdb_continue_to_breakpoint "break_here"
 +
-+# The register contains unpredictable value - the array size.
-+gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
++gdb_test "whatis array" "type = array_t" "first: whatis array"
++
++gdb_test "ptype array" "type = char \\\[26\\\]" "first: ptype array"
++
++gdb_test "p array\[1\]" "\\$\[0-9\] = 1 '\\\\001'"
++gdb_test "p array\[2\]" "\\$\[0-9\] = 2 '\\\\002'"
++gdb_test "p array\[3\]" "\\$\[0-9\] = 3 '\\\\003'"
++gdb_test "p array\[4\]" "\\$\[0-9\] = 4 '\\\\004'"
++
++gdb_continue_to_breakpoint "break_here"
++
++gdb_test "whatis array" "type = array_t" "second: whatis array"
++
++gdb_test "ptype array" "type = char \\\[78\\\]" "second: ptype array"
+diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
+index a99137e..c3dc2d9 100644
+--- a/gdb/testsuite/gdb.base/arrayidx.c
++++ b/gdb/testsuite/gdb.base/arrayidx.c
+@@ -17,6 +17,13 @@
+ int array[] = {1, 2, 3, 4};
++#ifdef __GNUC__
++struct
++  {
++    int a[0];
++  } unbound;
++#endif
++
+ int
+ main (void)
+ {
+diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
+index cba0024..0dc0e46 100644
+--- a/gdb/testsuite/gdb.base/arrayidx.exp
++++ b/gdb/testsuite/gdb.base/arrayidx.exp
+@@ -53,4 +53,12 @@ gdb_test "print array" \
+          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
+          "Print array with array-indexes on"
+-
++set test "p unbound.a == &unbound.a\[0\]"
++gdb_test_multiple $test $test {
++    -re " = 1\r\n$gdb_prompt $" {
++      pass $test
++    }
++    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
++      unsupported "$test (no GCC)"
++    }
++}
+diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.c b/gdb/testsuite/gdb.base/internal-var-field-address.c
 new file mode 100644
-index 0000000..1f02d90
+index 0000000..eeb7b85
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
-@@ -0,0 +1,42 @@
++++ b/gdb/testsuite/gdb.base/internal-var-field-address.c
+@@ -0,0 +1,20 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2004 Free Software Foundation, Inc.
++   Copyright 2009 Free Software Foundation, Inc.
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2 of the License, or
++   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, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+   USA.  */
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
++struct {
++  int field;
++} staticstruct = { 1 };
+diff --git a/gdb/testsuite/gdb.base/internal-var-field-address.exp b/gdb/testsuite/gdb.base/internal-var-field-address.exp
+new file mode 100644
+index 0000000..6d82e73
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/internal-var-field-address.exp
+@@ -0,0 +1,26 @@
++# Copyright 2009 Free Software Foundation, Inc.
 +
-+/* The function `func1' traced into must have debug info on offset > 0;
-+   (DW_UNSND (attr)).  This is the reason of `func0' existence.  */
++# 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 <http://www.gnu.org/licenses/>.
 +
-+void
-+func0(int a, int b)
-+{
++set test internal-var-field-address
++set binfile ${test}.x
++if  { [gdb_compile "${srcdir}/${subdir}/${test}.c" "${objdir}/${subdir}/${binfile}" object {debug}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
 +}
 +
-+/* `func1' being traced into must have some arguments to dump.  */
++clean_restart $binfile
 +
-+void
-+func1(int a, int b)
-+{
-+  func0 (a,b);
-+}
++gdb_test {set $varstruct = staticstruct}
++gdb_test {p $varstruct.field} " = 1"
+diff --git a/gdb/testsuite/gdb.base/vla-frame.c b/gdb/testsuite/gdb.base/vla-frame.c
+new file mode 100644
+index 0000000..5750f68
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/vla-frame.c
+@@ -0,0 +1,31 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2011 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <string.h>
 +
 +int
-+main(void)
++main (int argc, char **argv)
 +{
-+  func1 (1, 2);
++  char s[2 + argc];
++  void (*f) (char *) = 0;
++
++  memset (s, 0, sizeof (s));
++  s[0] = 'X';
++
++  f (s);
 +  return 0;
 +}
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
+diff --git a/gdb/testsuite/gdb.base/vla-frame.exp b/gdb/testsuite/gdb.base/vla-frame.exp
 new file mode 100644
-index 0000000..1c6e84a
+index 0000000..47736c7
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
-@@ -0,0 +1,79 @@
-+# Copyright 2006 Free Software Foundation, Inc.
-+
++++ b/gdb/testsuite/gdb.base/vla-frame.exp
+@@ -0,0 +1,38 @@
++# Copyright 2011 Free Software Foundation, Inc.
++#
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
++# 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, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+
-+# Minimal DWARF-2 unit test
-+
-+# This test can only be run on targets which support DWARF-2.
-+# For now pick a sampling of likely targets.
-+if {![istarget *-*-linux*]
-+    && ![istarget *-*-gnu*]
-+    && ![istarget *-*-elf*]
-+    && ![istarget *-*-openbsd*]
-+    && ![istarget arm-*-eabi*]
-+    && ![istarget powerpc-*-eabi*]} {
-+    return 0  
-+}
-+
-+set testfile "dw2-stripped"
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}.x
-+
-+remote_exec build "rm -f ${binfile}"
-+
-+# get the value of gcc_compiled
-+if [get_compiler_info ${binfile}] {
-+    return -1
-+}
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+# This test can only be run on gcc as we use additional_flags=FIXME
-+if {$gcc_compiled == 0} {
-+    return 0
-+}
++set testfile vla-frame
++set executable ${testfile}
 +
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
++if { [prepare_for_testing ${testfile}.exp ${executable}] } {
 +    return -1
 +}
 +
-+remote_exec build "objcopy -R .debug_loc ${binfile}"
-+set strip_output [remote_exec build "objdump -h ${binfile}"]
-+
-+set test "stripping test file preservation"
-+if [ regexp ".debug_info " $strip_output]  {
-+    pass "$test (.debug_info preserved)"
-+} else {
-+    fail "$test (.debug_info got also stripped)"
++if ![runto_main] {
++    return -1
 +}
 +
-+set test "stripping test file functionality"
-+if [ regexp ".debug_loc " $strip_output]  {
-+    fail "$test (.debug_loc still present)"
-+} else {
-+    pass "$test (.debug_loc stripped)"
++set test "continue"
++gdb_test_multiple $test $test {
++    -re "Continuing\\.\r\n\r\nProgram received signal SIGSEGV, Segmentation fault\\.\r\n0x0+ in \\?\\? \\(\\)\r\n$gdb_prompt $" {
++      pass $test
++    }
++    -re "\r\n$gdb_prompt $" {
++      untested ${testfile}.exp
++      return
++    }
 +}
 +
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+
-+# For C programs, "start" should stop in main().
-+
-+gdb_test "start" \
-+         ".*main \\(\\) at .*" \
-+         "start"
-+gdb_test "step" \
-+         "func.* \\(.*\\) at .*" \
-+         "step"
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
++gdb_test "bt full" "\r\n +s = \"X\\\\000\"\r\n.*"
+diff --git a/gdb/testsuite/gdb.base/vla-overflow.c b/gdb/testsuite/gdb.base/vla-overflow.c
 new file mode 100644
-index 0000000..5fcdd84
+index 0000000..c5d5ee0
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
-@@ -0,0 +1,83 @@
++++ b/gdb/testsuite/gdb.base/vla-overflow.c
+@@ -0,0 +1,30 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2009 Free Software Foundation, Inc.
++   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
@@ -12977,79 +11161,26 @@ index 0000000..5fcdd84
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+/* Debug information */
-+
-+      .section .debug_info
-+.Lcu1_begin:
-+      /* CU header */
-+      .4byte  .Lcu1_end - .Lcu1_start         /* Length of Compilation Unit */
-+.Lcu1_start:
-+      .2byte  2                               /* DWARF Version */
-+      .4byte  .Labbrev1_begin                 /* Offset into abbrev section */
-+      .byte   4                               /* Pointer size */
-+
-+      /* CU die */
-+      .uleb128 1                              /* Abbrev: DW_TAG_compile_unit */
-+      .ascii  "dw2-struct-member-data-location.c\0"   /* DW_AT_name */
-+      .ascii  "GNU C 4.3.2\0"                 /* DW_AT_producer */
-+      .byte   1                               /* DW_AT_language (C) */
-+
-+.Ltype_uchar:
-+      .uleb128        2                       /* Abbrev: DW_TAG_structure_type */
-+      .ascii          "some_struct\0"         /* DW_AT_name */
-+
-+      .uleb128        3                       /* Abbrev: DW_TAG_member */
-+      .ascii          "field\0"               /* DW_AT_name */
-+      .byte           0                       /* DW_AT_data_member_location */
-+
-+      .byte           0                       /* End of children of some_struct */
-+
-+      .byte           0                       /* End of children of CU */
-+
-+.Lcu1_end:
++#include <stdlib.h>
 +
-+/* Abbrev table */
-+      .section .debug_abbrev
-+.Labbrev1_begin:
-+      .uleb128        1                       /* Abbrev code */
-+      .uleb128        0x11                    /* DW_TAG_compile_unit */
-+      .byte           1                       /* has_children */
-+      .uleb128        0x3                     /* DW_AT_name */
-+      .uleb128        0x8                     /* DW_FORM_string */
-+      .uleb128        0x25                    /* DW_AT_producer */
-+      .uleb128        0x8                     /* DW_FORM_string */
-+      .uleb128        0x13                    /* DW_AT_language */
-+      .uleb128        0xb                     /* DW_FORM_data1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++int
++main (int argc, char **argv)
++{
++  int array[argc];
 +
-+      .uleb128        2                       /* Abbrev code */
-+      .uleb128        0x13                    /* DW_TAG_structure_type */
-+      .byte           1                       /* has_children */
-+      .uleb128        0x3                     /* DW_AT_name */
-+      .uleb128        0x8                     /* DW_FORM_string */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++  array[0] = array[0];
 +
-+      .uleb128        3                       /* Abbrev code */
-+      .uleb128        0x0d                    /* DW_TAG_member */
-+      .byte           0                       /* has_children */
-+      .uleb128        0x3                     /* DW_AT_name */
-+      .uleb128        0x8                     /* DW_FORM_string */
-+      .uleb128        0x38                    /* DW_AT_data_member_location */
-+      .uleb128        0x0b                    /* DW_FORM_data1 */
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
++  abort ();
 +
-+      .byte           0x0                     /* Terminator */
-+      .byte           0x0                     /* Terminator */
-diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/vla-overflow.exp b/gdb/testsuite/gdb.base/vla-overflow.exp
 new file mode 100644
-index 0000000..c41151c
+index 0000000..24a608f
 --- /dev/null
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
-@@ -0,0 +1,37 @@
-+# Copyright 2009 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.base/vla-overflow.exp
+@@ -0,0 +1,109 @@
++# Copyright 2008 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -13064,614 +11195,488 @@ index 0000000..c41151c
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+# 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  
++# We could crash in:
++# #0  block_linkage_function (bl=0x0) at ../../gdb/block.c:69
++# #1  in dwarf_block_get_frame_base (...) at ../../gdb/dwarf2block.c:97
++#   97          framefunc = block_linkage_function (get_frame_block (frame, NULL));
++# #2  in execute_stack_op (...) at ../../gdb/dwarf2expr.c:496
++# #3  in dwarf_block_exec_core () at ../../gdb/dwarf2block.c:156
++# #4  dwarf_block_exec (...) at ../../gdb/dwarf2block.c:206
++# #5  in range_type_count_bound_internal (...) at ../../gdb/gdbtypes.c:1430
++# #6  in create_array_type (...) at ../../gdb/gdbtypes.c:840
++# ...
++# #21 in psymtab_to_symtab (...) at ../../gdb/symfile.c:292
++# ...
++# #29 in backtrace_command_1 () at ../../gdb/stack.c:1273
++
++set testfile vla-overflow
++set shfile ${objdir}/${subdir}/${testfile}-gdb.sh
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
 +}
 +
-+set testfile "dw2-struct-member-data-location"
-+set srcfile ${testfile}.S
-+set binfile ${testfile}.x
++set f [open "|getconf PAGESIZE" "r"]
++gets $f pagesize
++close $f
 +
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${binfile}" object {nodebug}] != "" } {
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++set pid_of_gdb [exp_pid -i [board_info host fileid]]
++
++if { [runto_main] < 0 } {
++    untested vla-overflow
 +    return -1
 +}
 +
-+clean_restart $binfile
++# Get the GDB memory size when we stay at main.
 +
-+gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
-diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
-new file mode 100644
-index 0000000..d7b8bea
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
-@@ -0,0 +1,42 @@
-+# Copyright 2009 Free Software Foundation, Inc.
++proc memory_v_pages_get {} {
++    global pid_of_gdb pagesize
++    set fd [open "/proc/$pid_of_gdb/statm"]
++    gets $fd line
++    close $fd
++    # number of pages of virtual memory
++    scan $line "%d" drs
++    return $drs
++}
 +
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
-+# (at your option) any later version.
-+# 
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+# 
-+# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
++set pages_found [memory_v_pages_get]
 +
-+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
++# s390x with glibc-debuginfo.s390x installed used approx. 16MB.
++set mb_reserve 40
++verbose -log "pages_found = $pages_found, mb_reserve = $mb_reserve"
++set kb_found [expr $pages_found * $pagesize / 1024]
++set kb_permit [expr $kb_found + 1 * 1024 + $mb_reserve * 1024]
++verbose -log "kb_found = $kb_found, kb_permit = $kb_permit"
 +
-+# This file is part of the gdb testsuite.  Array element stride must not be
-+# specified in the number of elements but in a number of bytes instead.
-+# Original problem:
-+# (gdb) p c40pt(1)
-+# $1 = '0-hello', ' ' <repeats 33 times>
-+# (gdb) p c40pt(2)
-+# warning: Fortran array stride not divisible by the element size
++# Create the ulimit wrapper.
++set f [open $shfile "w"]
++puts $f "#! /bin/sh"
++puts $f "ulimit -v $kb_permit"
++puts $f "exec $GDB \"\$@\""
++close $f
++remote_exec host "chmod +x $shfile"
++
++gdb_exit
++set GDBold $GDB
++set GDB "$shfile"
++gdb_start
++set GDB $GDBold
++
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++set pid_of_gdb [exp_pid -i [board_info host fileid]]
++
++# Check the size again after the second run.
++# We must not stop in main as it would cache `array' and never crash later.
++
++gdb_run_cmd
++
++verbose -log "kb_found before abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
 +
-+set testfile dwarf-stride
-+set srcfile ${testfile}.f90
++gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
 +
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
-+    return -1
-+}
++verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
 +
-+if ![runto MAIN__] then {
-+    perror "couldn't run to breakpoint MAIN__"
-+    continue
-+}
++# `abort' can get expressed as `*__GI_abort'.
++gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
 +
-+gdb_breakpoint [gdb_get_line_number "break-here"]
-+gdb_continue_to_breakpoint "break-here" ".*break-here.*"
-+gdb_test "p c40pt(1)" " = '0-hello.*"
-+gdb_test "p c40pt(2)" " = '1-hello.*"
-diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
++verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
+diff --git a/gdb/testsuite/gdb.base/vla.c b/gdb/testsuite/gdb.base/vla.c
 new file mode 100644
-index 0000000..e492b3a
+index 0000000..e1f3ed1
 --- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
-@@ -0,0 +1,40 @@
-+! Copyright 2009 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 2 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program; if not, write to the Free Software
-+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+!
-+! File written by Alan Matsuoka.
++++ b/gdb/testsuite/gdb.base/vla.c
+@@ -0,0 +1,55 @@
++/* This testcase is part of GDB, the GNU debugger.
 +
-+program repro
++   Copyright 2008 Free Software Foundation, Inc.
 +
-+  type small_stride
-+     character*40 long_string
-+     integer      small_pad
-+  end type small_stride
++   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.
 +
-+  type(small_stride), dimension (20), target :: unpleasant
-+  character*40, pointer, dimension(:):: c40pt
++   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.
 +
-+  integer i
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+  do i = 0,19
-+     unpleasant(i+1)%small_pad = i+1
-+     unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
-+  end do
++#include <string.h>
 +
-+  c40pt => unpleasant%long_string
++void
++marker (void)
++{
++}
 +
-+  print *, c40pt  ! break-here
++void
++bar (char *a, char *b, char *c, int size)
++{
++  memset (a, '1', size);
++  memset (b, '2', size);
++  memset (c, '3', 48);
++}
 +
-+end program repro
-diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
-new file mode 100644
-index 0000000..261ce17
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
-@@ -0,0 +1,24 @@
-+! Copyright 2010 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 2 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program; if not, write to the Free Software
-+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+!
-+! Ihis file is the Fortran source file for dynamic.exp.
-+! Original file written by Jakub Jelinek <jakub@redhat.com>.
-+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++void
++foo (int size)
++{
++  char temp1[size];
++  char temp3[48];
 +
-+subroutine bar
-+  real :: dummy
-+  dummy = 1
-+end subroutine bar
-diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
++  temp1[size - 1] = '\0';
++  {
++    char temp2[size];
++
++    bar (temp1, temp2, temp3, size);
++
++    marker ();        /* break-here */
++  }
++}
++
++int
++main (void)
++{
++  foo (26);
++  foo (78);
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/vla.exp b/gdb/testsuite/gdb.base/vla.exp
 new file mode 100644
-index 0000000..fa41b80
+index 0000000..5da7378
 --- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
-@@ -0,0 +1,37 @@
-+# Copyright 2010 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.base/vla.exp
+@@ -0,0 +1,62 @@
++# Copyright 2008 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
++# 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, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
-+
-+set testfile "dynamic-other-frame"
-+set srcfile1 ${testfile}.f90
-+set srcfile2 ${testfile}-stub.f90
-+set objfile2 ${objdir}/${subdir}/${testfile}-stub.o
-+set executable ${testfile}
-+set binfile ${objdir}/${subdir}/${executable}
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
-+     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
-+    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
++set testfile vla
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
++    untested "Couldn't compile test program"
 +    return -1
 +}
 +
-+clean_restart ${executable}
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
 +
-+if ![runto bar_] then {
-+    perror "couldn't run to bar_"
-+    continue
++if ![runto_main] {
++    untested vla
++    return -1
 +}
 +
-+gdb_test "bt" {foo \(string='hello'.*}
-diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
-new file mode 100644
-index 0000000..2bc637d
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
-@@ -0,0 +1,36 @@
-+! Copyright 2010 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 2 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program; if not, write to the Free Software
-+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+!
-+! Ihis file is the Fortran source file for dynamic.exp.
-+! Original file written by Jakub Jelinek <jakub@redhat.com>.
-+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++gdb_breakpoint [gdb_get_line_number "break-here"]
 +
-+subroutine foo (string)
-+  interface
-+    subroutine bar
-+    end subroutine
-+  end interface
-+  character string*(*)
-+  call bar                                ! stop-here
-+end subroutine foo
-+program test
-+  interface
-+    subroutine foo (string)
-+    character string*(*)
-+    end subroutine
-+  end interface
-+  call foo ('hello')
-+end
-diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp
++gdb_continue_to_breakpoint "break-here"
++
++gdb_test "whatis temp1" "type = char \\\[variable\\\]" "first: whatis temp1"
++gdb_test "whatis temp2" "type = char \\\[variable\\\]" "first: whatis temp2"
++gdb_test "whatis temp3" "type = char \\\[48\\\]" "first: whatis temp3"
++
++gdb_test "ptype temp1" "type = char \\\[26\\\]" "first: ptype temp1"
++gdb_test "ptype temp2" "type = char \\\[26\\\]" "first: ptype temp2"
++gdb_test "ptype temp3" "type = char \\\[48\\\]" "first: ptype temp3"
++
++gdb_test "p temp1" " = '1' <repeats 26 times>" "first: print temp1"
++gdb_test "p temp2" " = '2' <repeats 26 times>" "first: print temp2"
++gdb_test "p temp3" " = '3' <repeats 48 times>" "first: print temp3"
++
++gdb_continue_to_breakpoint "break-here"
++
++gdb_test "whatis temp1" "type = char \\\[variable\\\]" "second: whatis temp1"
++gdb_test "whatis temp2" "type = char \\\[variable\\\]" "second: whatis temp2"
++gdb_test "whatis temp3" "type = char \\\[48\\\]" "second: whatis temp3"
++
++gdb_test "ptype temp1" "type = char \\\[78\\\]" "second: ptype temp1"
++gdb_test "ptype temp2" "type = char \\\[78\\\]" "second: ptype temp2"
++gdb_test "ptype temp3" "type = char \\\[48\\\]" "second: ptype temp3"
++
++gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
++gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
++gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
 new file mode 100644
-index 0000000..e79e94a
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dynamic.exp
-@@ -0,0 +1,152 @@
-+# Copyright 2007 Free Software Foundation, Inc.
+index 0000000..aac3baa
+--- /dev/null
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.S
+@@ -0,0 +1,246 @@
++/* This testcase is part of GDB, the GNU debugger.
 +
-+# 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.  
++   Copyright 2010 Free Software Foundation, Inc.
 +
-+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
++   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 file is part of the gdb testsuite.  It contains tests for dynamically
-+# allocated Fortran arrays.
-+# It depends on the GCC dynamic Fortran arrays DWARF support:
-+#     http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
++   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.
 +
-+set testfile "dynamic"
-+set srcfile ${testfile}.f90
-+set binfile ${objdir}/${subdir}/${testfile}
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
-+    untested "Couldn't compile ${srcfile}"
-+    return -1
-+}
++/* Debug information */
 +
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
++/* We will `break *main' at the very first instruction.  */
++#define main_length 1
 +
-+if ![runto MAIN__] then {
-+    perror "couldn't run to breakpoint MAIN__"
-+    continue
-+}
++      .section        .data
++vardata:
++      /* See DW_OP_lit3 + 1 (0-based).  */
++      .string         "seennotseen"
 +
-+gdb_breakpoint [gdb_get_line_number "varx-init"]
-+gdb_continue_to_breakpoint "varx-init"
-+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx unallocated"
-+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx unallocated"
-+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) unallocated"
-+gdb_test "p varx(1,5,17)=1" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17)=1 unallocated"
-+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) unallocated"
++      .section        .debug_info
++.Lcu1_begin:
++      .4byte          .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
++.Lcu1_start:
++      .2byte          2                       /* DWARF version number */
++      .4byte          .Ldebug_abbrev0         /* Offset Into Abbrev. Section */
++      .byte           4                       /* Pointer Size (in bytes) */
 +
-+gdb_breakpoint [gdb_get_line_number "varx-allocated"]
-+gdb_continue_to_breakpoint "varx-allocated"
-+# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
-+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
-+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
-+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
++      /* CU die */
++      .uleb128        1                       /* Abbrev: DW_TAG_compile_unit */
++      .4byte          .Lproducer              /* DW_AT_producer */
++      /* Use C++ to exploit a bug in parsing DW_AT_name "".  */
++      .byte           4                       /* DW_AT_language (C++) -  */
++      .4byte          main                    /* DW_AT_low_pc */
++      .byte           main_length             /* DW_AT_high_pc */
 +
-+gdb_breakpoint [gdb_get_line_number "varx-filled"]
-+gdb_continue_to_breakpoint "varx-filled"
-+gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
-+gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
-+gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
-+gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
-+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
-+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv unassociated"
-+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv unassociated"
++.Larray_type:
++      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
++      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
 +
-+set test "output varx"
-+gdb_test_multiple $test $test {
-+    -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
-+      pass $test
-+    }
-+}
++      .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
++      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
++      .byte           0                       /* DW_AT_lower_bound */
++      .4byte          .Llen_var-.Lcu1_begin   /* DW_AT_upper_bound */
++      .byte           0                       /* End of children of die */
 +
-+gdb_breakpoint [gdb_get_line_number "varv-associated"]
-+gdb_continue_to_breakpoint "varv-associated"
-+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
-+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
-+# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
-+gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
-+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
-+# Intel Fortran Compiler 10.1.008 uses the pointer type.
-+gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
++      /* DW_AT_upper_bound is referencing an optimized-out variable.  */
++.Larrayb_type:
++      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
++      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
 +
-+gdb_breakpoint [gdb_get_line_number "varv-filled"]
-+gdb_continue_to_breakpoint "varv-filled"
-+gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
-+gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
++      .uleb128        3                       /* Abbrev: DW_TAG_subrange_type */
++      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
++      .byte           0                       /* DW_AT_lower_bound */
++      .4byte          .Llenb_var-.Lcu1_begin  /* DW_AT_upper_bound */
++      .byte           0                       /* End of children of die */
 +
-+gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
-+gdb_continue_to_breakpoint "varv-deassociated"
-+# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
-+gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated"
-+gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated"
-+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
-+gdb_test "p varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\."
-+gdb_test "ptype varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\."
++      /* DW_AT_upper_bound is referencing register.  */
++.Larrayreg_type:
++      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
++      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
 +
-+gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
-+gdb_continue_to_breakpoint "varx-deallocated"
-+gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx deallocated"
-+gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx deallocated"
-+gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
-+gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) deallocated"
-+gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) deallocated"
++      .uleb128        8                       /* Abbrev: DW_TAG_subrange_type with block */
++      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
++      .byte           0                       /* DW_AT_lower_bound */
++      .byte           2f - 1f                 /* DW_AT_upper_bound */
++1:    .byte           0x50                    /* DW_OP_reg0 */
++2:
++      .byte           0                       /* End of children of die */
 +
-+gdb_breakpoint [gdb_get_line_number "vary-passed"]
-+gdb_continue_to_breakpoint "vary-passed"
-+# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
-+gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
++.Luint_type:
++      .uleb128        4                       /* Abbrev: DW_TAG_base_type */
++      .4byte          .Luint_str              /* DW_AT_name */
++      .byte           4                       /* DW_AT_byte_size */
++      .byte           7                       /* DW_AT_encoding */
 +
-+gdb_breakpoint [gdb_get_line_number "vary-filled"]
-+gdb_continue_to_breakpoint "vary-filled"
-+gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
-+gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
-+gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
-+gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
-+# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
-+gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
++.Lchar_type:
++      .uleb128        4                       /* Abbrev: DW_TAG_base_type */
++      .4byte          .Lchar_str              /* DW_AT_name */
++      .byte           1                       /* DW_AT_byte_size */
++      .byte           6                       /* DW_AT_encoding */
 +
-+gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
-+gdb_continue_to_breakpoint "varw-almostfilled"
-+gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
-+gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
-+# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
-+gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
-+# "up" works with GCC but other Fortran compilers may copy the values into the
-+# outer function only on the exit of the inner function.
-+# We need both variants as depending on the arch we optionally may still be
-+# executing the caller line or not after `finish'.
-+gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
-+gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
-+gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
-+gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
-+gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
++.Llen_var:
++      .uleb128        5                       /* Abbrev: DW_TAG_variable artificial */
++      .byte           1                       /* DW_AT_artificial */
++      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
++      .4byte          .Llen_loclist-.Lloclist /* DW_AT_location */
 +
-+gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
-+gdb_continue_to_breakpoint "varz-almostfilled"
-+# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
-+gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
-+# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
-+# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
-+gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
-+gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
-+gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
-+gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
-+# maps to foo::vary(1,1)
-+gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
-+# maps to foo::vary(2,2)
-+gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
-+# maps to foo::vary(1,3)
-+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
-diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90
-new file mode 100644
-index 0000000..0f43564
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/dynamic.f90
-@@ -0,0 +1,98 @@
-+! Copyright 2007 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 2 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program; if not, write to the Free Software
-+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+!
-+! Ihis file is the Fortran source file for dynamic.exp.
-+! Original file written by Jakub Jelinek <jakub@redhat.com>.
-+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++      /* optimized-out variable for b_string.  */
++.Llenb_var:
++      .uleb128        7                       /* Abbrev: DW_TAG_variable artificial no DW_AT_location */
++      .byte           1                       /* DW_AT_artificial */
++      .4byte          .Luint_type-.Lcu1_begin /* DW_AT_type */
++
++      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
++      .string         "a_string"              /* DW_AT_name */
++      .4byte          .Larray_type-.Lcu1_begin /* DW_AT_type */
++      .byte           2f - 1f                 /* DW_AT_location */
++1:    .byte           3                       /*   DW_OP_addr */
++      .4byte          vardata                 /*   <addr> */
++2:
++
++      /* DW_AT_upper_bound is referencing an optimized-out variable.  */
++      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
++      .string         "b_string"              /* DW_AT_name */
++      .4byte          .Larrayb_type-.Lcu1_begin /* DW_AT_type */
++      .byte           2f - 1f                 /* DW_AT_location */
++1:    .byte           3                       /*   DW_OP_addr */
++      .4byte          vardata                 /*   <addr> */
++2:
 +
-+subroutine baz
-+  real, target, allocatable :: varx (:, :, :)
-+  real, pointer :: varv (:, :, :)
-+  real, target :: varu (1, 2, 3)
-+  logical :: l
-+  allocate (varx (1:6, 5:15, 17:28))            ! varx-init
-+  l = allocated (varx)
-+  varx(:, :, :) = 6                             ! varx-allocated
-+  varx(1, 5, 17) = 7
-+  varx(2, 6, 18) = 8
-+  varx(6, 15, 28) = 9
-+  varv => varx                                  ! varx-filled
-+  l = associated (varv)
-+  varv(3, 7, 19) = 10                           ! varv-associated
-+  varv => null ()                               ! varv-filled
-+  l = associated (varv)
-+  deallocate (varx)                             ! varv-deassociated
-+  l = allocated (varx)
-+  varu(:, :, :) = 10                            ! varx-deallocated
-+  allocate (varv (1:6, 5:15, 17:28))
-+  l = associated (varv)
-+  varv(:, :, :) = 6
-+  varv(1, 5, 17) = 7
-+  varv(2, 6, 18) = 8
-+  varv(6, 15, 28) = 9
-+  deallocate (varv)
-+  l = associated (varv)
-+  varv => varu
-+  varv(1, 1, 1) = 6
-+  varv(1, 2, 3) = 7
-+  l = associated (varv)
-+end subroutine baz
-+subroutine foo (vary, varw)
-+  real :: vary (:, :)
-+  real :: varw (:, :, :)
-+  vary(:, :) = 4                                ! vary-passed
-+  vary(1, 1) = 8
-+  vary(2, 2) = 9
-+  vary(1, 3) = 10
-+  varw(:, :, :) = 5                             ! vary-filled
-+  varw(1, 1, 1) = 6
-+  varw(2, 2, 2) = 7                             ! varw-almostfilled
-+end subroutine foo
-+subroutine bar (varz, vart)
-+  real :: varz (*)
-+  real :: vart (2:11, 7:*)
-+  varz(1:3) = 4
-+  varz(2) = 5                                   ! varz-almostfilled
-+  vart(2,7) = vart(2,7)
-+end subroutine bar
-+program test
-+  interface
-+    subroutine foo (vary, varw)
-+    real :: vary (:, :)
-+    real :: varw (:, :, :)
-+    end subroutine
-+  end interface
-+  interface
-+    subroutine bar (varz, vart)
-+    real :: varz (*)
-+    real :: vart (2:11, 7:*)
-+    end subroutine
-+  end interface
-+  real :: x (10, 10), y (5), z(8, 8, 8)
-+  x(:,:) = 1
-+  y(:) = 2
-+  z(:,:,:) = 3
-+  call baz
-+  call foo (x, z(2:6, 4:7, 6:8))
-+  call bar (y, x)
-+  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
-+  if (x (1, 3) .ne. 10) call abort
-+  if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
-+  if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
-+  call foo (transpose (x), z)
-+  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
-+  if (x (3, 1) .ne. 10) call abort
-+end
-diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp
-new file mode 100644
-index 0000000..39de2c4
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/string.exp
-@@ -0,0 +1,59 @@
-+# Copyright 2008 Free Software Foundation, Inc.
++      /* DW_AT_upper_bound is referencing register.  */
++      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
++      .string         "reg_string"            /* DW_AT_name */
++      .4byte          .Larrayreg_type-.Lcu1_begin /* DW_AT_type */
++      .byte           2f - 1f                 /* DW_AT_location */
++1:    .byte           3                       /*   DW_OP_addr */
++      .4byte          vardata                 /*   <addr> */
++2:
 +
-+# 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.  
++      .byte           0                       /* End of children of CU */
++.Lcu1_end:
 +
-+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
++      .section        .debug_loc
++.Lloclist:
++.Llen_loclist:
++      .4byte  0                       # Location list begin address
++      .4byte  main_length             # Location list end address
++      .value  2f-1f   # Location expression size
++1:    .byte   0x33    # DW_OP_lit3
++      .byte   0x9f    # DW_OP_stack_value
++2:
++      .quad   0x0     # Location list terminator begin (*.LLST2)
++      .quad   0x0     # Location list terminator end (*.LLST2)
 +
-+# This file is part of the gdb testsuite.  It contains tests for Fortran
-+# strings with dynamic length.
++      .section .debug_abbrev
++.Ldebug_abbrev0:
++      .uleb128        1                       /* Abbrev code */
++      .uleb128        0x11                    /* DW_TAG_compile_unit */
++      .byte           0x1                     /* has_children */
++      .uleb128        0x25                    /* DW_AT_producer */
++      .uleb128        0xe                     /* DW_FORM_strp */
++      .uleb128        0x13                    /* DW_AT_language */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x11                    /* DW_AT_low_pc */
++      .uleb128        0x1                     /* DW_FORM_addr */
++      .uleb128        0x12                    /* DW_AT_high_pc */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+set testfile "string"
-+set srcfile ${testfile}.f90
-+set binfile ${objdir}/${subdir}/${testfile}
++      .uleb128        2                       /* Abbrev code */
++      .uleb128        0x1                     /* TAG: DW_TAG_array_type */
++      .byte           0x1                     /* DW_children_yes */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
-+    untested "Couldn't compile ${srcfile}"
-+    return -1
-+}
++      .uleb128        3                       /* Abbrev code */
++      .uleb128        0x21                    /* DW_TAG_subrange_type */
++      .byte           0x0                     /* no children */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .uleb128        0x22                    /* DW_AT_lower_bound */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x2f                    /* DW_AT_upper_bound */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
++      .uleb128        4                       /* Abbrev code */
++      .uleb128        0x24                    /* DW_TAG_base_type */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0xe                     /* DW_FORM_strp */
++      .uleb128        0xb                     /* DW_AT_byte_size */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x3e                    /* DW_AT_encoding */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+if ![runto MAIN__] then {
-+    perror "couldn't run to breakpoint MAIN__"
-+    continue
-+}
++      .uleb128        5                       /* Abbrev code */
++      .uleb128        0x34                    /* DW_TAG_variable */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x34                    /* DW_AT_artificial */
++      .uleb128        0x0c                    /* DW_FORM_flag */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .uleb128        0x02                    /* DW_AT_location */
++      .uleb128        0x06                    /* DW_FORM_data4 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+gdb_breakpoint [gdb_get_line_number "var-init"]
-+gdb_continue_to_breakpoint "var-init"
-+gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
-+gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
-+gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
-+gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
-+gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
-+gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
-+gdb_test "p c" "\\$\[0-9\]* = 'c'"
-+gdb_test "p d" "\\$\[0-9\]* = 'd       '"
-+gdb_test "p e" "\\$\[0-9\]* = 'g   '"
-+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\)"
-+gdb_test "p *e" "Attempt to take contents of a non-pointer value."
-+gdb_test "p *f" "Attempt to take contents of a non-pointer value."
++      .uleb128        6                       /* Abbrev code */
++      .uleb128        0x34                    /* DW_TAG_variable */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .uleb128        0x2                     /* DW_AT_location */
++      .uleb128        0xa                     /* DW_FORM_block1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+gdb_breakpoint [gdb_get_line_number "var-finish"]
-+gdb_continue_to_breakpoint "var-finish"
-+gdb_test "p e" "\\$\[0-9\]* = 'e   '" "p e re-set"
-+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f2  ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\)" "p *f re-set"
-diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90
-new file mode 100644
-index 0000000..226dc5d
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/string.f90
-@@ -0,0 +1,37 @@
-+! Copyright 2008 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 2 of the License, or
-+! (at your option) any later version.
-+!
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+!
-+! You should have received a copy of the GNU General Public License
-+! along with this program; if not, write to the Free Software
-+! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+!
-+! Ihis file is the Fortran source file for dynamic.exp.
-+! Original file written by Jakub Jelinek <jakub@redhat.com>.
-+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++      .uleb128        7                       /* Abbrev code */
++      .uleb128        0x34                    /* DW_TAG_variable */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x34                    /* DW_AT_artificial */
++      .uleb128        0x0c                    /* DW_FORM_flag */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+subroutine foo (e, f)
-+  character (len=1) :: c
-+  character (len=8) :: d
-+  character (len=*) :: e
-+  character (len=*) :: f (1:7, 8:10)
-+  c = 'c'
-+  d = 'd'
-+  e = 'e'                                       ! var-init
-+  f = 'f'
-+  f(1,9) = 'f2'
-+  c = 'c'                                       ! var-finish
-+end subroutine foo
-+  character (len=4) :: g, h (1:7, 8:10)
-+  g = 'g'
-+  h = 'h'
-+  call foo (g, h)
-+end
-diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp
++      .uleb128        8                       /* Abbrev code */
++      .uleb128        0x21                    /* DW_TAG_subrange_type with block */
++      .byte           0x0                     /* no children */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .uleb128        0x22                    /* DW_AT_lower_bound */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x2f                    /* DW_AT_upper_bound */
++      .uleb128        0xa                     /* DW_FORM_block1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
++
++      .byte           0x0                     /* Terminator */
++
++/* String table */
++      .section .debug_str
++.Lproducer:
++      .string         "GNU C 3.3.3"
++.Lchar_str:
++      .string         "char"
++.Luint_str:
++      .string         "unsigned int"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
 new file mode 100644
-index 0000000..c819e23
+index 0000000..815ed93
 --- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/subrange.exp
-@@ -0,0 +1,60 @@
-+# Copyright 2011 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.dwarf2/dw2-bound-loclist.exp
+@@ -0,0 +1,54 @@
++# Copyright 2010 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -13686,204 +11691,187 @@ index 0000000..c819e23
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+if { [skip_fortran_tests] } { return -1 }
++# Test printing variable with dynamic bounds which reference a different
++# (artificial in the GCC case) variable containing loclist as its location.
++# This testcase uses value (not address) of the referenced variable:
++# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43762
 +
-+set testfile "subrange"
-+set srcfile ${testfile}.f90
-+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
-+    return -1
++# 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
 +}
 +
-+if ![runto MAIN__] {
-+    perror "Couldn't run to MAIN__"
-+    continue
++set testfile dw2-bound-loclist
++if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {}] } {
++    return -1
 +}
 +
-+# Depending on the compiler version being used, the name of the 4-byte integer
-+# and real types can be printed differently.  For instance, gfortran-4.1 uses
-+# "int4" whereas gfortran-4.3 uses "int(kind=4)".
-+set int4 "(int4|integer\\(kind=4\\))"
-+
-+gdb_breakpoint [gdb_get_line_number "break-static"]
-+gdb_continue_to_breakpoint "break-static" ".*break-static.*"
-+
-+foreach var {a alloc ptr} {
-+    global pf_prefix
-+    set old_prefix $pf_prefix
-+    lappend pf_prefix "$var:"
++# Verify it behaves at least as an unbound array without inferior.
 +
-+    gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
-+    gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
-+    gdb_test "p $var (1, 2:)" { = \(21, 31\)}
-+    gdb_test "p $var (2, :2)" { = \(12, 22\)}
-+    gdb_test "p $var (3, 2:2)" { = \(23\)}
-+    gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
-+    gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
-+    gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
-+    gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
-+    gdb_test "p $var (:)" "Wrong number of subscripts"
-+    gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
++gdb_test "p a_string" { = 0x[0-9a-f]+ "seennotseen"}
++gdb_test "ptype a_string" {type = char \[\]}
 +
-+    set pf_prefix $old_prefix
++# Not runto_main as dw2-bound-loclist.S handles only the first byte of main.
++if ![runto "*main"] {
++    return -1
 +}
 +
-+gdb_test_no_output {set $a=a}
-+delete_breakpoints
-+gdb_unload
-+gdb_test {p $a (3, 2:2)} { = \(23\)}
-diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90
-new file mode 100644
-index 0000000..4747ea9
---- /dev/null
-+++ b/gdb/testsuite/gdb.fortran/subrange.f90
-@@ -0,0 +1,28 @@
-+! Copyright 2011 Free Software Foundation, Inc.
-+!
-+! This program is free software; you can redistribute it and/or modify
-+! it under the terms of the GNU General Public License as published by
-+! the Free Software Foundation; either version 3 of the License, or
-+! (at your option) any later version.
-+! 
-+! This program is distributed in the hope that it will be useful,
-+! but WITHOUT ANY WARRANTY; without even the implied warranty of
-+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+! GNU General Public License for more details.
-+! 
-+! You should have received a copy of the GNU General Public License
-+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
++gdb_test "p a_string" { = "seen"}
++gdb_test "ptype a_string" {type = char \[4\]}
 +
-+program test
-+  integer, target :: a (4, 3)
-+  integer, allocatable :: alloc (:, :)
-+  integer, pointer :: ptr (:, :)
-+  do 1 i = 1, 4
-+  do 1 j = 1, 3
-+    a (i, j) = j * 10 + i
-+1 continue
-+  allocate (alloc (4, 3))
-+  alloc = a
-+  ptr => a
-+  write (*,*) a                 ! break-static
-+end
-diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
-index 21798bc..111f692 100644
---- a/gdb/testsuite/gdb.gdb/selftest.exp
-+++ b/gdb/testsuite/gdb.gdb/selftest.exp
-@@ -88,6 +88,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.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
++gdb_test "p b_string" { = (0x[0-9a-f]+ )?"seennotseen"}
++gdb_test "ptype b_string" {type = char \[\]}
++
++# The register contains unpredictable value - the array size.
++gdb_test "ptype reg_string" {type = char \[-?[0-9]+\]}
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.c b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
 new file mode 100644
-index 0000000..ebced3c
+index 0000000..1f02d90
 --- /dev/null
-+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
-@@ -0,0 +1,26 @@
-+/* Copyright 2011 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.c
+@@ -0,0 +1,42 @@
++/* This testcase is part of GDB, the GNU debugger.
 +
-+   This file is part of GDB.
++   Copyright 2004 Free Software Foundation, Inc.
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
++   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, see <http://www.gnu.org/licenses/>.  */
++   along with this program; if not, write to the Free Software
++   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++   USA.  */
 +
-+int
-+main (int argc, char **argv)
++
++/* The function `func1' traced into must have debug info on offset > 0;
++   (DW_UNSND (attr)).  This is the reason of `func0' existence.  */
++
++void
++func0(int a, int b)
 +{
-+  char vla[argc];
++}
 +
-+  vla[0] = 0; /* break-here */
++/* `func1' being traced into must have some arguments to dump.  */
 +
++void
++func1(int a, int b)
++{
++  func0 (a,b);
++}
++
++int
++main(void)
++{
++  func1 (1, 2);
 +  return 0;
 +}
-diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
 new file mode 100644
-index 0000000..74a104e
+index 0000000..1c6e84a
 --- /dev/null
-+++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
-@@ -0,0 +1,57 @@
-+# Copyright 2011 Free Software Foundation, Inc.
-+#
++++ b/gdb/testsuite/gdb.dwarf2/dw2-stripped.exp
+@@ -0,0 +1,79 @@
++# Copyright 2006 Free Software Foundation, Inc.
++
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
++# 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, see <http://www.gnu.org/licenses/>.
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 +
-+load_lib mi-support.exp
-+set MIFLAGS "-i=mi2"
++# Minimal DWARF-2 unit test
 +
-+gdb_exit
-+if [mi_gdb_start] {
-+    continue
++# This test can only be run on targets which support DWARF-2.
++# For now pick a sampling of likely targets.
++if {![istarget *-*-linux*]
++    && ![istarget *-*-gnu*]
++    && ![istarget *-*-elf*]
++    && ![istarget *-*-openbsd*]
++    && ![istarget arm-*-eabi*]
++    && ![istarget powerpc-*-eabi*]} {
++    return 0  
 +}
 +
-+set testfile "mi2-var-stale-type"
++set testfile "dw2-stripped"
 +set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
-+    return -1
-+}
++set binfile ${objdir}/${subdir}/${testfile}.x
 +
-+mi_delete_breakpoints
-+mi_gdb_reinitialize_dir $srcdir/$subdir
-+mi_gdb_load ${binfile}
++remote_exec build "rm -f ${binfile}"
 +
-+mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
-+  {\^done} \
-+  "maintenance set internal-error quit yes"
++# get the value of gcc_compiled
++if [get_compiler_info ${binfile}] {
++    return -1
++}
 +
-+mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
-+  {\^done} \
-+  "maintenance set internal-error corefile yes"
++# This test can only be run on gcc as we use additional_flags=FIXME
++if {$gcc_compiled == 0} {
++    return 0
++}
 +
-+set line [gdb_get_line_number "break-here"]
-+set func "main"
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
++    return -1
++}
 +
-+mi_gdb_test "-break-insert -t $srcfile:$line" \
-+  "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}" \
-+  "breakpoint at $func"
++remote_exec build "objcopy -R .debug_loc ${binfile}"
++set strip_output [remote_exec build "objdump -h ${binfile}"]
 +
-+if { [mi_run_cmd] < 0 } {
-+    return -1
++set test "stripping test file preservation"
++if [ regexp ".debug_info " $strip_output]  {
++    pass "$test (.debug_info preserved)"
++} else {
++    fail "$test (.debug_info got also stripped)"
 +}
-+mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
 +
-+mi_create_varobj "vla" "vla" "create local variable vla"
++set test "stripping test file functionality"
++if [ regexp ".debug_loc " $strip_output]  {
++    fail "$test (.debug_loc still present)"
++} else {
++    pass "$test (.debug_loc stripped)"
++}
 +
-+mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
-diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.c b/gdb/testsuite/gdb.multi/watchpoint-multi.c
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# For C programs, "start" should stop in main().
++
++gdb_test "start" \
++         ".*main \\(\\) at .*" \
++         "start"
++gdb_test "step" \
++         "func.* \\(.*\\) at .*" \
++         "step"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
 new file mode 100644
-index 0000000..51697b0
+index 0000000..5fcdd84
 --- /dev/null
-+++ b/gdb/testsuite/gdb.multi/watchpoint-multi.c
-@@ -0,0 +1,51 @@
++++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.S
+@@ -0,0 +1,83 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2012 Free Software Foundation, Inc.
++   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
@@ -13898,48 +11886,80 @@ index 0000000..51697b0
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+#include <pthread.h>
-+#include <assert.h>
++/* Debug information */
 +
-+static volatile int a, b, c;
++      .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 */
 +
-+static void
-+marker_exit (void)
-+{
-+  a = 1;
-+}
++      /* CU die */
++      .uleb128 1                              /* Abbrev: DW_TAG_compile_unit */
++      .ascii  "dw2-struct-member-data-location.c\0"   /* DW_AT_name */
++      .ascii  "GNU C 4.3.2\0"                 /* DW_AT_producer */
++      .byte   1                               /* DW_AT_language (C) */
 +
-+static void *
-+start (void *arg)
-+{
-+  b = 2;
-+  c = 3;
++.Ltype_uchar:
++      .uleb128        2                       /* Abbrev: DW_TAG_structure_type */
++      .ascii          "some_struct\0"         /* DW_AT_name */
 +
-+  return NULL;
-+}
++      .uleb128        3                       /* Abbrev: DW_TAG_member */
++      .ascii          "field\0"               /* DW_AT_name */
++      .byte           0                       /* DW_AT_data_member_location */
 +
-+int
-+main (void)
-+{
-+  pthread_t thread;
-+  int i;
++      .byte           0                       /* End of children of some_struct */
++
++      .byte           0                       /* End of children of CU */
 +
-+  i = pthread_create (&thread, NULL, start, NULL);
-+  assert (i == 0);
-+  i = pthread_join (thread, NULL);
-+  assert (i == 0);
++.Lcu1_end:
 +
-+  marker_exit ();
-+  return 0;
-+}
-diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
++/* Abbrev table */
++      .section .debug_abbrev
++.Labbrev1_begin:
++      .uleb128        1                       /* Abbrev code */
++      .uleb128        0x11                    /* DW_TAG_compile_unit */
++      .byte           1                       /* has_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x25                    /* DW_AT_producer */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x13                    /* DW_AT_language */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
++
++      .uleb128        2                       /* Abbrev code */
++      .uleb128        0x13                    /* DW_TAG_structure_type */
++      .byte           1                       /* has_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
++
++      .uleb128        3                       /* Abbrev code */
++      .uleb128        0x0d                    /* DW_TAG_member */
++      .byte           0                       /* has_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x38                    /* DW_AT_data_member_location */
++      .uleb128        0x0b                    /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
++
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
 new file mode 100644
-index 0000000..d7daeec
+index 0000000..c41151c
 --- /dev/null
-+++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp
-@@ -0,0 +1,92 @@
-+# Copyright 2012 Free Software Foundation, Inc.
-+#
++++ b/gdb/testsuite/gdb.dwarf2/dw2-struct-member-data-location.exp
+@@ -0,0 +1,37 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
 +# the Free Software Foundation; either version 3 of the License, or
@@ -13953,92 +11973,37 @@ index 0000000..d7daeec
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+if [is_remote target] {
-+    # It is KFAIL.
-+    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 "watchpoint-multi"
-+
-+set executable ${testfile}
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${executable}
++set testfile "dw2-struct-member-data-location"
++set srcfile ${testfile}.S
++set binfile ${testfile}.x
 +
-+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-+    untested ${testfile}.exp
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${binfile}" object {nodebug}] != "" } {
 +    return -1
 +}
 +
-+clean_restart $executable
-+
-+if ![runto_main] {
-+    return
-+}
-+# Never keep/use any non-hw breakpoints to workaround a multi-inferior bug.
-+delete_breakpoints
-+
-+gdb_test "add-inferior" "Added inferior 2"
-+gdb_test "inferior 2" "witching to inferior 2 .*"
-+gdb_load $binfile
-+
-+if ![runto_main] {
-+    return
-+}
-+delete_breakpoints
-+
-+# Simulate non-stop+target-async which also uses breakpoint always-inserted.
-+gdb_test_no_output "set breakpoint always-inserted on"
-+# displaced-stepping is also needed as other GDB sometimes still removes the
-+# breakpoints, even with always-inserted on.
-+gdb_test_no_output "set displaced-stepping on"
-+
-+# Debugging of this testcase:
-+#gdb_test_no_output "maintenance set show-debug-regs on"
-+#gdb_test_no_output "set debug infrun 1"
-+
-+# Do not use simple hardware watchpoint ("watch") as its false hit may be
-+# unnoticed by GDB if it reads it still has the same value.
-+gdb_test "awatch c" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c"
-+
-+gdb_breakpoint "marker_exit"
-+
-+gdb_test "inferior 1" "witching to inferior 1 .*"
-+
-+set have_awatch_b 0
-+set test "awatch b"
-+gdb_test_multiple $test $test {
-+    -re "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n$gdb_prompt $" {
-+      pass $test
-+      set have_awatch_b 1
-+    }
-+    -re "There are not enough available hardware resources for this watchpoint\\.\r\n$gdb_prompt $" {
-+      untested $test
-+      return
-+    }
-+}
-+
-+gdb_test "inferior 2" "witching to inferior 2 .*"
-+
-+# FAIL would be a hit on watchpoint for `b' - that one is for the other
-+# inferior.
-+gdb_test "continue" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c\r\n\r\nOld value = 0\r\nNew value = 3\r\n.*" "catch c"
-+
-+gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 2"
-+
-+gdb_test "inferior 1" "witching to inferior 1 .*"
-+
-+gdb_test "continue" "Hardware access \\(read/write\\) watchpoint \[0-9\]+: b\r\n\r\nOld value = 0\r\nNew value = 2\r\n.*" "catch b"
++clean_restart $binfile
 +
-+gdb_test "continue" "Breakpoint \[0-9\]+, marker_exit .*" "catch marker_exit in inferior 1"
-diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c
++gdb_test "ptype struct some_struct" "type = struct some_struct {\[\r\n \t\]*void field;\[\r\n \t\]*}"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
 new file mode 100644
-index 0000000..729f457
+index 0000000..9dbbf3c
 --- /dev/null
-+++ b/gdb/testsuite/gdb.opt/array-from-register-func.c
-@@ -0,0 +1,22 @@
-+/* This file is part of GDB, the GNU debugger.
++++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.S
+@@ -0,0 +1,121 @@
++/* This testcase is part of GDB, the GNU debugger.
 +
-+   Copyright 2009 Free Software Foundation, Inc.
++   Copyright 2012 Free Software Foundation, Inc.
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
@@ -14053,56 +12018,121 @@ index 0000000..729f457
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+int
-+func (int *arr)
-+{
-+  return arr[0];
-+}
-diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c
-new file mode 100644
-index 0000000..3090e7e
---- /dev/null
-+++ b/gdb/testsuite/gdb.opt/array-from-register.c
-@@ -0,0 +1,28 @@
-+/* This file is part of GDB, the GNU debugger.
++/* Debug information */
 +
-+   Copyright 2009 Free Software Foundation, Inc.
++      .section        .data
++vardata:
++      .rept           129
++      .ascii          "x"
++      .endr
++      .ascii          "UNSEEN\0"
 +
-+   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.
++      .section        .debug_info
++.Lcu1_begin:
++      .4byte          .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
++.Lcu1_start:
++      .2byte          2                       /* DWARF version number */
++      .4byte          .Ldebug_abbrev0         /* Offset Into Abbrev. Section */
++      .byte           4                       /* Pointer Size (in bytes) */
 +
-+   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.
++      /* CU die */
++      .uleb128        1                       /* Abbrev: DW_TAG_compile_unit */
++      .ascii          "GNU C 3.3.3\0"         /* DW_AT_producer */
++      .byte           2                       /* DW_AT_language (C) -  */
++
++.Larray_type:
++      .uleb128        2                       /* Abbrev: DW_TAG_array_type */
++      .4byte          .Lchar_type-.Lcu1_begin /* DW_AT_type */
++
++      .uleb128        8                       /* Abbrev: DW_TAG_subrange_type without DW_AT_type */
++      .byte           0                       /* DW_AT_lower_bound */
++      .byte           128                     /* DW_AT_upper_bound */
++
++      .byte           0                       /* End of children of die */
++
++.Lchar_type:
++      .uleb128        4                       /* Abbrev: DW_TAG_base_type */
++      .ascii          "char\0"                /* DW_AT_name */
++      .byte           1                       /* DW_AT_byte_size */
++      .byte           6                       /* DW_AT_encoding */
++
++      .uleb128        6                       /* Abbrev: DW_TAG_variable DW_FORM_string */
++      .ascii          "notype_string\0"       /* DW_AT_name */
++      .4byte          .Larray_type-.Lcu1_begin /* DW_AT_type */
++      .byte           2f - 1f                 /* DW_AT_location */
++1:    .byte           3                       /*   DW_OP_addr */
++      .4byte          vardata                 /*   <addr> */
++2:
++
++      .byte           0                       /* End of children of CU */
++.Lcu1_end:
++
++      .section .debug_abbrev
++.Ldebug_abbrev0:
++      .uleb128        1                       /* Abbrev code */
++      .uleb128        0x11                    /* DW_TAG_compile_unit */
++      .byte           0x1                     /* has_children */
++      .uleb128        0x25                    /* DW_AT_producer */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x13                    /* DW_AT_language */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++      .uleb128        2                       /* Abbrev code */
++      .uleb128        0x1                     /* TAG: DW_TAG_array_type */
++      .byte           0x1                     /* DW_children_yes */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+extern int func (int *arr);
++      .uleb128        4                       /* Abbrev code */
++      .uleb128        0x24                    /* DW_TAG_base_type */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0xb                     /* DW_AT_byte_size */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x3e                    /* DW_AT_encoding */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+int
-+main (void)
-+{
-+  int arr[] = { 42 };
++      .uleb128        6                       /* Abbrev code */
++      .uleb128        0x34                    /* DW_TAG_variable */
++      .byte           0x0                     /* no_children */
++      .uleb128        0x3                     /* DW_AT_name */
++      .uleb128        0x8                     /* DW_FORM_string */
++      .uleb128        0x49                    /* DW_AT_type */
++      .uleb128        0x13                    /* DW_FORM_ref4 */
++      .uleb128        0x2                     /* DW_AT_location */
++      .uleb128        0xa                     /* DW_FORM_block1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+  func (arr);
++      .uleb128        8                       /* Abbrev code */
++      .uleb128        0x21                    /* DW_TAG_subrange_type without DW_AT_type */
++      .byte           0x0                     /* no children */
++      .uleb128        0x22                    /* DW_AT_lower_bound */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .uleb128        0x2f                    /* DW_AT_upper_bound */
++      .uleb128        0xb                     /* DW_FORM_data1 */
++      .byte           0x0                     /* Terminator */
++      .byte           0x0                     /* Terminator */
 +
-+  return 0;
-+}
-diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp
++      .byte           0x0                     /* Terminator */
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
 new file mode 100644
-index 0000000..f2de718
+index 0000000..a13e346
 --- /dev/null
-+++ b/gdb/testsuite/gdb.opt/array-from-register.exp
-@@ -0,0 +1,33 @@
-+# Copyright 2009 Free Software Foundation, Inc.
-+#
++++ b/gdb/testsuite/gdb.dwarf2/dw2-subrange-no-type.exp
+@@ -0,0 +1,39 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 2 of the License, or
++# 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,
@@ -14111,681 +12141,739 @@ index 0000000..f2de718
 +# GNU General Public License for more details.
 +#
 +# You should have received a copy of the GNU General Public License
-+# along with this program; if not, write to the Free Software
-+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+#
-+# This file is part of the gdb testsuite.
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++load_lib dwarf.exp
 +
-+if { [prepare_for_testing array-from-register.exp "array-from-register"      \
-+                        {array-from-register.c array-from-register-func.c} \
-+                        {debug optimize=-O2}] } {
-+    return -1
++# https://bugzilla.redhat.com/show_bug.cgi?id=806920
++# read_subrange_type <TYPE_CODE (base_type) == TYPE_CODE_VOID> reinitialization
++# of BASE_TYPE was done too late, it affects DW_TAG_subrange_type without
++# specified DW_AT_type, present only in XLF produced code.
++
++# This test can only be run on targets which support DWARF-2 and use gas.
++if {![dwarf2_support]} {
++    return 0  
 +}
 +
-+if ![runto func] then {
++set testfile dw2-subrange-no-type
++set srcfile ${testfile}.S
++set executable ${testfile}.x
++set binfile ${objdir}/${subdir}/${executable}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
 +    return -1
 +}
 +
-+gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
++clean_restart $executable
 +
-+# Seen regression:
-+# Address requested for identifier "arr" which is in register $rdi
-+gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
-diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp
++gdb_test "ptype notype_string" {type = char \[129\]}
++gdb_test "p notype_string" " = 'x' <repeats 129 times>"
+diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.exp b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
 new file mode 100644
-index 0000000..ccc6e1e
+index 0000000..d7b8bea
 --- /dev/null
-+++ b/gdb/testsuite/gdb.pascal/arrays.exp
-@@ -0,0 +1,104 @@
-+# Copyright 2008, 2009 Free Software Foundation, Inc.
-+#
++++ b/gdb/testsuite/gdb.fortran/dwarf-stride.exp
+@@ -0,0 +1,42 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
++# 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, see <http://www.gnu.org/licenses/>.
-+
-+if $tracelevel then {
-+    strace $tracelevel
-+}
-+
-+load_lib "pascal.exp"
-+
-+set testfile "arrays"
-+set srcfile ${testfile}.pas
-+set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
-+
-+# These tests only work with fpc, using the -gw3 compile-option
-+pascal_init
-+if { $pascal_compiler_is_fpc != 1 } {
-+  return -1
-+}
-+
-+# Detect if the fpc version is below 2.3.0
-+set fpc_generates_dwarf_for_dynamic_arrays 1
-+if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))}  {
-+  set fpc_generates_dwarf_for_dynamic_arrays 0
-+}
-+
-+
-+if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
-+  return -1
-+}
-+
-+gdb_exit
-+gdb_start
-+gdb_reinitialize_dir $srcdir/$subdir
-+gdb_load ${binfile}
-+set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
-+set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
-+
-+
-+if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
-+    pass "setting breakpoint 1"
-+}
-+if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
-+    pass "setting breakpoint 2"
-+}
-+
-+# Verify that "start" lands inside the right procedure.
-+if { [gdb_start_cmd] < 0 } {
-+    untested start
-+    return -1
-+}
-+
-+gdb_test "" ".* at .*${srcfile}.*" "start"
-+
-+gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
-+
-+gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
-+gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
-+
-+gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
-+
-+gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
-+gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer"
-+
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
-+
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
-+
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
-+
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
-+
-+if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
-+  setup_xfail "*-*-*"
-+}
-+gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
-+
-diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas
-new file mode 100644
-index 0000000..295602d
---- /dev/null
-+++ b/gdb/testsuite/gdb.pascal/arrays.pas
-@@ -0,0 +1,82 @@
-+{
-+ Copyright 2008, 2009 Free Software Foundation, Inc.
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 3 of the License, or
-+ (at your option) any later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+}
-+
-+program arrays;
-+
-+{$mode objfpc}{$h+}
-+
-+uses sysutils;
-+
-+type TStatArrInt= array[0..11] of integer;
-+     TDynArrInt= array of integer;
-+     TStatArrStr= array[0..12] of string;
-+     TDynArrStr= array of string;
-+     TDynArrChar = array of char;
-+     TStatArrChar = array [0..11] of char;
-+
-+     TStat2dArrInt = array[0..11,0..4] of integer;
-+
-+var StatArrInt: TStatArrInt;
-+    StatArrInt_: Array[0..11] of integer;
-+    DynArrInt:  TDynArrInt;
-+    DynArrInt_: Array of integer;
-+    StatArrStr: TStatArrStr;
-+    DynArrStr: TDynArrStr;
-+    StatArrChar: TStatArrChar;
-+    DynArrChar: TDynArrChar;
-+
-+    Stat2dArrInt: TStat2dArrInt;
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 +
-+    s: string;
-+      
-+    i,j : integer;
++# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
 +
-+begin
-+  for i := 0 to 11 do
-+    begin
-+    StatArrInt[i]:= i+50;
-+    StatArrInt_[i]:= i+50;
-+    StatArrChar[i]:= chr(ord('a')+i);
-+    for j := 0 to 4 do
-+      Stat2dArrInt[i,j]:=i+j;
-+    end;
-+  writeln(StatArrInt_[0]);
-+  writeln(StatArrInt[0]); { set breakpoint 1 here }
-+  writeln(StatArrChar[0]);
-+  writeln(Stat2dArrInt[0,0]);
++# This file is part of the gdb testsuite.  Array element stride must not be
++# specified in the number of elements but in a number of bytes instead.
++# Original problem:
++# (gdb) p c40pt(1)
++# $1 = '0-hello', ' ' <repeats 33 times>
++# (gdb) p c40pt(2)
++# warning: Fortran array stride not divisible by the element size
 +
-+  setlength(DynArrInt,13);
-+  setlength(DynArrInt_,13);
-+  setlength(DynArrStr,13);
-+  setlength(DynArrChar,13);
-+  for i := 0 to 12 do
-+    begin
-+    DynArrInt[i]:= i+50;
-+    DynArrInt_[i]:= i+50;
-+    DynArrChar[i]:= chr(ord('a')+i);
-+    StatArrStr[i]:='str'+inttostr(i);
-+    DynArrStr[i]:='dstr'+inttostr(i);
-+    end;
-+  writeln(DynArrInt_[1]);
-+  writeln(DynArrInt[1]); 
-+  writeln(DynArrStr[1]); 
-+  writeln(StatArrStr[1]);
-+  writeln(DynArrChar[1]);
++set testfile dwarf-stride
++set srcfile ${testfile}.f90
 +
-+  s := 'test'#0'string';
-+  writeln(s); { set breakpoint 2 here }
-+end.
-diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
-index 83ff8fe..bddbf9f 100644
---- a/gdb/testsuite/gdb.python/py-frame.exp
-+++ b/gdb/testsuite/gdb.python/py-frame.exp
-@@ -74,8 +74,6 @@ gdb_test "python print bframe == gdb.newest_frame()" True \
- 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"
-@@ -90,3 +88,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"
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
++    return -1
++}
 +
-+gdb_test "python print 'result =', f0.block ()" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
-diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
-index c9d8c97..4324db0 100644
---- a/gdb/testsuite/gdb.python/py-value.exp
-+++ b/gdb/testsuite/gdb.python/py-value.exp
-@@ -360,6 +360,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"
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
 +}
 +
- # 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.
-@@ -496,6 +505,7 @@ test_value_in_inferior
- test_inferior_function_call
- test_lazy_strings
- test_value_after_death
-+test_cast_regression
- # Test either C or C++ values. 
- test_subscript_regression "${binfile}" "c"
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-child.c b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
++gdb_breakpoint [gdb_get_line_number "break-here"]
++gdb_continue_to_breakpoint "break-here" ".*break-here.*"
++gdb_test "p c40pt(1)" " = '0-hello.*"
++gdb_test "p c40pt(2)" " = '1-hello.*"
+diff --git a/gdb/testsuite/gdb.fortran/dwarf-stride.f90 b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
 new file mode 100644
-index 0000000..7a7e07f
+index 0000000..e492b3a
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-child.c
-@@ -0,0 +1,129 @@
-+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
++++ b/gdb/testsuite/gdb.fortran/dwarf-stride.f90
+@@ -0,0 +1,40 @@
++! Copyright 2009 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! File written by Alan Matsuoka.
 +
-+   Copyright 2012 Free Software Foundation, Inc.
++program repro
 +
-+   This file is part of GDB.
++  type small_stride
++     character*40 long_string
++     integer      small_pad
++  end type small_stride
 +
-+   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.
++  type(small_stride), dimension (20), target :: unpleasant
++  character*40, pointer, dimension(:):: c40pt
 +
-+   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.
++  integer i
 +
-+   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.  */
++  do i = 0,19
++     unpleasant(i+1)%small_pad = i+1
++     unpleasant(i+1)%long_string = char (ichar('0') + i) // '-hello'
++  end do
 +
-+#include <string.h>
-+#include <errno.h>
-+#include <unistd.h>
-+#include <assert.h>
-+#include <signal.h>
-+#include <stdio.h>
++  c40pt => unpleasant%long_string
++
++  print *, c40pt  ! break-here
 +
-+#include "watchpoint-fork.h"
++end program repro
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+new file mode 100644
+index 0000000..261ce17
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90
+@@ -0,0 +1,24 @@
++! Copyright 2010 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub@redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++
++subroutine bar
++  real :: dummy
++  dummy = 1
++end subroutine bar
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
+new file mode 100644
+index 0000000..fa41b80
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp
+@@ -0,0 +1,37 @@
++# Copyright 2010 Free Software Foundation, Inc.
 +
-+/* `pid_t' may not be available.  */
++# 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.  
 +
-+static volatile int usr1_got;
++set testfile "dynamic-other-frame"
++set srcfile1 ${testfile}.f90
++set srcfile2 ${testfile}-stub.f90
++set objfile2 ${objdir}/${subdir}/${testfile}-stub.o
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/${executable}
 +
-+static void
-+handler_usr1 (int signo)
-+{
-+  usr1_got++;
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != ""
++     || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } {
++    untested "Couldn't compile ${srcfile1} or ${srcfile2}"
++    return -1
 +}
 +
-+void
-+forkoff (int nr)
-+{
-+  int child, save_parent = getpid ();
-+  int i;
-+  struct sigaction act, oldact;
-+#ifdef THREAD
-+  void *thread_result;
-+#endif
++clean_restart ${executable}
++
++if ![runto bar_] then {
++    perror "couldn't run to bar_"
++    continue
++}
++
++gdb_test "bt" {foo \(string='hello'.*}
+diff --git a/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+new file mode 100644
+index 0000000..2bc637d
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90
+@@ -0,0 +1,36 @@
++! Copyright 2010 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub@redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
++
++subroutine foo (string)
++  interface
++    subroutine bar
++    end subroutine
++  end interface
++  character string*(*)
++  call bar                                ! stop-here
++end subroutine foo
++program test
++  interface
++    subroutine foo (string)
++    character string*(*)
++    end subroutine
++  end interface
++  call foo ('hello')
++end
+diff --git a/gdb/testsuite/gdb.fortran/dynamic.exp b/gdb/testsuite/gdb.fortran/dynamic.exp
+new file mode 100644
+index 0000000..e79e94a
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/dynamic.exp
+@@ -0,0 +1,152 @@
++# Copyright 2007 Free Software Foundation, Inc.
 +
-+  memset (&act, 0, sizeof act);
-+  act.sa_flags = SA_RESTART;
-+  act.sa_handler = handler_usr1;
-+  sigemptyset (&act.sa_mask);
-+  i = sigaction (SIGUSR1, &act, &oldact);
-+  assert (i == 0);
++# 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.  
 +
-+  child = fork ();
-+  switch (child)
-+    {
-+    case -1:
-+      assert (0);
-+    default:
-+      printf ("parent%d: %d\n", nr, (int) child);
++# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
 +
-+      /* Sleep for a while to possibly get incorrectly ATTACH_THREADed by GDB
-+       tracing the child fork with no longer valid thread/lwp entries of the
-+       parent.  */
++# This file is part of the gdb testsuite.  It contains tests for dynamically
++# allocated Fortran arrays.
++# It depends on the GCC dynamic Fortran arrays DWARF support:
++#     http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22244
 +
-+      i = sleep (2);
-+      assert (i == 0);
++set testfile "dynamic"
++set srcfile ${testfile}.f90
++set binfile ${objdir}/${subdir}/${testfile}
 +
-+      /* We must not get caught here (against a forgotten breakpoint).  */
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
++    untested "Couldn't compile ${srcfile}"
++    return -1
++}
 +
-+      var++;
-+      marker ();
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
 +
-+#ifdef THREAD
-+      /* And neither got caught our thread.  */
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
++}
 +
-+      step = 99;
-+      i = pthread_join (thread, &thread_result);
-+      assert (i == 0);
-+      assert (thread_result == (void *) 99UL);
-+#endif
++gdb_breakpoint [gdb_get_line_number "varx-init"]
++gdb_continue_to_breakpoint "varx-init"
++gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx unallocated"
++gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx unallocated"
++gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) unallocated"
++gdb_test "p varx(1,5,17)=1" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17)=1 unallocated"
++gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) unallocated"
 +
-+      /* Be sure our child knows we did not get caught above.  */
++gdb_breakpoint [gdb_get_line_number "varx-allocated"]
++gdb_continue_to_breakpoint "varx-allocated"
++# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...)
++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated"
++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated"
 +
-+      i = kill (child, SIGUSR1);
-+      assert (i == 0);
++gdb_breakpoint [gdb_get_line_number "varx-filled"]
++gdb_continue_to_breakpoint "varx-filled"
++gdb_test "p varx(2, 5, 17)" "\\$\[0-9\]* = 6"
++gdb_test "p varx(1, 5, 17)" "\\$\[0-9\]* = 7"
++gdb_test "p varx(2, 6, 18)" "\\$\[0-9\]* = 8"
++gdb_test "p varx(6, 15, 28)" "\\$\[0-9\]* = 9"
++# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
++gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv unassociated"
++gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv unassociated"
 +
-+      /* Sleep for a while to check GDB's `info threads' no longer tracks us in
-+       the child fork.  */
++set test "output varx"
++gdb_test_multiple $test $test {
++    -re "^output varx\r\n\[() ,6789.\]*$gdb_prompt $" {
++      pass $test
++    }
++}
 +
-+      i = sleep (2);
-+      assert (i == 0);
++gdb_breakpoint [gdb_get_line_number "varv-associated"]
++gdb_continue_to_breakpoint "varv-associated"
++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 6" "p varx(3, 7, 19) with varv associated"
++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated"
++# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1.
++gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated"
++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated"
++# Intel Fortran Compiler 10.1.008 uses the pointer type.
++gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated"
 +
-+      _exit (0);
-+    case 0:
-+      printf ("child%d: %d\n", nr, (int) getpid ());
++gdb_breakpoint [gdb_get_line_number "varv-filled"]
++gdb_continue_to_breakpoint "varv-filled"
++gdb_test "p varx(3, 7, 19)" "\\$\[0-9\]* = 10" "p varx(3, 7, 19) with varv filled"
++gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 10" "p varv(3, 7, 19) filled"
 +
-+      /* Let the parent signal us about its success.  Be careful of races.  */
++gdb_breakpoint [gdb_get_line_number "varv-deassociated"]
++gdb_continue_to_breakpoint "varv-deassociated"
++# The latter one is for the Intel Fortran Compiler 10.1.008 pointer type.
++gdb_test "p varv" "\\$\[0-9\]* = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "p varv deassociated"
++gdb_test "ptype varv" "type = (<(object|the array) is not associated>|.*(Cannot access it|Unable to access the object) because the object is not associated.)" "ptype varv deassociated"
++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varv deassociated"
++gdb_test "p varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\."
++gdb_test "ptype varv(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not associated\\."
 +
-+      for (;;)
-+      {
-+        /* Parent either died (and USR1_GOT is zero) or it succeeded.  */
-+        if (getppid () != save_parent)
-+          break;
-+        if (kill (getppid (), 0) != 0)
-+          break;
-+        /* Parent succeeded?  */
-+        if (usr1_got)
-+          break;
++gdb_breakpoint [gdb_get_line_number "varx-deallocated"]
++gdb_continue_to_breakpoint "varx-deallocated"
++gdb_test "p varx" "\\$\[0-9\]* = <(object|the array) is not allocated>" "p varx deallocated"
++gdb_test "ptype varx" "type = <(object|the array) is not allocated>" "ptype varx deallocated"
++gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated"
++gdb_test "p varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "p varx(1,5,17) deallocated"
++gdb_test "ptype varx(1,5,17)" "(Cannot access it|Unable to access the object) because the (object|array) is not allocated\\." "ptype varx(1,5,17) deallocated"
 +
-+#ifdef THREAD
-+        i = pthread_yield ();
-+        assert (i == 0);
-+#endif
-+      }
-+      assert (usr1_got);
++gdb_breakpoint [gdb_get_line_number "vary-passed"]
++gdb_continue_to_breakpoint "vary-passed"
++# $1 = (( ( 1, 1, 1, 1, 1, 1) ( 1, 1, 1, 1, 1, 1) --- , 1) ) ( ( 1, 1, ...) ...) ...)
++gdb_test "p vary" "\\$\[0-9\]* = \\(\[()1, .\]*\\)"
 +
-+      /* We must get caught here (against a false watchpoint removal).  */
++gdb_breakpoint [gdb_get_line_number "vary-filled"]
++gdb_continue_to_breakpoint "vary-filled"
++gdb_test "ptype vary" "type = real(\\(kind=4\\)|\\*4) \\(10,10\\)"
++gdb_test "p vary(1, 1)" "\\$\[0-9\]* = 8"
++gdb_test "p vary(2, 2)" "\\$\[0-9\]* = 9"
++gdb_test "p vary(1, 3)" "\\$\[0-9\]* = 10"
++# $1 = (( ( 3, 3, 3, 3, 3, 3) ( 3, 3, 3, 3, 3, 3) --- , 3) ) ( ( 3, 3, ...) ...) ...)
++gdb_test "p varw" "\\$\[0-9\]* = \\(\[()3, .\]*\\)"
 +
-+      marker ();
-+    }
++gdb_breakpoint [gdb_get_line_number "varw-almostfilled"]
++gdb_continue_to_breakpoint "varw-almostfilled"
++gdb_test "ptype varw" "type = real(\\(kind=4\\)|\\*4) \\(5,4,3\\)"
++gdb_test "p varw(3,1,1)=1" "\\$\[0-9\]* = 1"
++# $1 = (( ( 6, 5, 1, 5, 5, 5) ( 5, 5, 5, 5, 5, 5) --- , 5) ) ( ( 5, 5, ...) ...) ...)
++gdb_test "p varw" "\\$\[0-9\]* = \\( *\\( *\\( *6, *5, *1,\[()5, .\]*\\)" "p varw filled"
++# "up" works with GCC but other Fortran compilers may copy the values into the
++# outer function only on the exit of the inner function.
++# We need both variants as depending on the arch we optionally may still be
++# executing the caller line or not after `finish'.
++gdb_test "finish" ".*(call bar \\(y, x\\)|call foo \\(x, z\\(2:6, 4:7, 6:8\\)\\))"
++gdb_test "p z(2,4,5)" "\\$\[0-9\]* = 3"
++gdb_test "p z(2,4,6)" "\\$\[0-9\]* = 6"
++gdb_test "p z(2,4,7)" "\\$\[0-9\]* = 5"
++gdb_test "p z(4,4,6)" "\\$\[0-9\]* = 1"
 +
-+  i = sigaction (SIGUSR1, &oldact, NULL);
-+  assert (i == 0);
-+}
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
++gdb_breakpoint [gdb_get_line_number "varz-almostfilled"]
++gdb_continue_to_breakpoint "varz-almostfilled"
++# GCC uses the pointer type here, Intel Fortran Compiler 10.1.008 does not.
++gdb_test "ptype varz" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?"
++# Intel Fortran Compiler 10.1.008 has a bug here - (2:11,7:7)
++# as it produces DW_AT_lower_bound == DW_AT_upper_bound == 7.
++gdb_test "ptype vart" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(2:11,7:\\*\\)\\)?"
++gdb_test "p varz" "\\$\[0-9\]* = \\(\\)"
++gdb_test "p vart" "\\$\[0-9\]* = \\(\\)"
++gdb_test "p varz(3)" "\\$\[0-9\]* = 4"
++# maps to foo::vary(1,1)
++gdb_test "p vart(2,7)" "\\$\[0-9\]* = 8"
++# maps to foo::vary(2,2)
++gdb_test "p vart(3,8)" "\\$\[0-9\]* = 9"
++# maps to foo::vary(1,3)
++gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
+diff --git a/gdb/testsuite/gdb.fortran/dynamic.f90 b/gdb/testsuite/gdb.fortran/dynamic.f90
 new file mode 100644
-index 0000000..bfdd89f
+index 0000000..0f43564
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-mt.c
-@@ -0,0 +1,174 @@
-+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
-+
-+   Copyright 2012 Free Software Foundation, Inc.
-+
-+   This file is part of GDB.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
++++ b/gdb/testsuite/gdb.fortran/dynamic.f90
+@@ -0,0 +1,98 @@
++! Copyright 2007 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub@redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
 +
-+#include <assert.h>
-+#include <unistd.h>
-+#include <sys/wait.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+#include <pthread.h>
++subroutine baz
++  real, target, allocatable :: varx (:, :, :)
++  real, pointer :: varv (:, :, :)
++  real, target :: varu (1, 2, 3)
++  logical :: l
++  allocate (varx (1:6, 5:15, 17:28))            ! varx-init
++  l = allocated (varx)
++  varx(:, :, :) = 6                             ! varx-allocated
++  varx(1, 5, 17) = 7
++  varx(2, 6, 18) = 8
++  varx(6, 15, 28) = 9
++  varv => varx                                  ! varx-filled
++  l = associated (varv)
++  varv(3, 7, 19) = 10                           ! varv-associated
++  varv => null ()                               ! varv-filled
++  l = associated (varv)
++  deallocate (varx)                             ! varv-deassociated
++  l = allocated (varx)
++  varu(:, :, :) = 10                            ! varx-deallocated
++  allocate (varv (1:6, 5:15, 17:28))
++  l = associated (varv)
++  varv(:, :, :) = 6
++  varv(1, 5, 17) = 7
++  varv(2, 6, 18) = 8
++  varv(6, 15, 28) = 9
++  deallocate (varv)
++  l = associated (varv)
++  varv => varu
++  varv(1, 1, 1) = 6
++  varv(1, 2, 3) = 7
++  l = associated (varv)
++end subroutine baz
++subroutine foo (vary, varw)
++  real :: vary (:, :)
++  real :: varw (:, :, :)
++  vary(:, :) = 4                                ! vary-passed
++  vary(1, 1) = 8
++  vary(2, 2) = 9
++  vary(1, 3) = 10
++  varw(:, :, :) = 5                             ! vary-filled
++  varw(1, 1, 1) = 6
++  varw(2, 2, 2) = 7                             ! varw-almostfilled
++end subroutine foo
++subroutine bar (varz, vart)
++  real :: varz (*)
++  real :: vart (2:11, 7:*)
++  varz(1:3) = 4
++  varz(2) = 5                                   ! varz-almostfilled
++  vart(2,7) = vart(2,7)
++end subroutine bar
++program test
++  interface
++    subroutine foo (vary, varw)
++    real :: vary (:, :)
++    real :: varw (:, :, :)
++    end subroutine
++  end interface
++  interface
++    subroutine bar (varz, vart)
++    real :: varz (*)
++    real :: vart (2:11, 7:*)
++    end subroutine
++  end interface
++  real :: x (10, 10), y (5), z(8, 8, 8)
++  x(:,:) = 1
++  y(:) = 2
++  z(:,:,:) = 3
++  call baz
++  call foo (x, z(2:6, 4:7, 6:8))
++  call bar (y, x)
++  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
++  if (x (1, 3) .ne. 10) call abort
++  if (z (2, 4, 6) .ne. 6 .or. z (3, 5, 7) .ne. 7 .or. z (2, 4, 7) .ne. 5) call abort
++  if (any (y .ne. (/4, 5, 4, 2, 2/))) call abort
++  call foo (transpose (x), z)
++  if (x (1, 1) .ne. 8 .or. x (2, 2) .ne. 9 .or. x (1, 2) .ne. 4) call abort
++  if (x (3, 1) .ne. 10) call abort
++end
+diff --git a/gdb/testsuite/gdb.fortran/string.exp b/gdb/testsuite/gdb.fortran/string.exp
+new file mode 100644
+index 0000000..39de2c4
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/string.exp
+@@ -0,0 +1,59 @@
++# Copyright 2008 Free Software Foundation, Inc.
 +
-+#include <asm/unistd.h>
-+#include <unistd.h>
-+#define gettid() syscall (__NR_gettid)
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++# 
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++# 
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 +
-+#include "watchpoint-fork.h"
++# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
 +
-+/* Non-atomic `var++' should not hurt as we synchronize the threads by the STEP
-+   variable.  Hit-comments need to be duplicite there to catch both at-stops
-+   and behind-stops, depending on the target.  */
++# This file is part of the gdb testsuite.  It contains tests for Fortran
++# strings with dynamic length.
 +
-+volatile int var;
++set testfile "string"
++set srcfile ${testfile}.f90
++set binfile ${objdir}/${subdir}/${testfile}
 +
-+void
-+marker (void)
-+{
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f90 quiet}] != "" } {
++    untested "Couldn't compile ${srcfile}"
++    return -1
 +}
 +
-+static void
-+empty (void)
-+{
-+}
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
 +
-+static void
-+mark_exit (void)
-+{
++if ![runto MAIN__] then {
++    perror "couldn't run to breakpoint MAIN__"
++    continue
 +}
 +
-+pthread_t thread;
-+volatile int step;
-+
-+static void *
-+start (void *arg)
-+{
-+  int i;
-+
-+  if (step >= 3)
-+    goto step_3;
-+
-+  while (step != 1)
-+    {
-+      i = pthread_yield ();
-+      assert (i == 0);
-+    }
-+
-+  var++;      /* validity-thread-B */
-+  empty ();   /* validity-thread-B */
-+  step = 2;
-+  while (step != 3)
-+    {
-+      if (step == 99)
-+      goto step_99;
-+
-+      i = pthread_yield ();
-+      assert (i == 0);
-+    }
++gdb_breakpoint [gdb_get_line_number "var-init"]
++gdb_continue_to_breakpoint "var-init"
++gdb_test "ptype c" "type = character(\\(kind=1\\)|\\*1)"
++gdb_test "ptype d" "type = character(\\(kind=8\\)|\\*8)"
++gdb_test "ptype e" "type = character(\\(kind=4\\)|\\*4)"
++gdb_test "ptype f" "type = character(\\(kind=4\\)|\\*4) \\(7,8:10\\)"
++gdb_test "ptype *e" "Attempt to take contents of a non-pointer value."
++gdb_test "ptype *f" "type = character(\\(kind=4\\)|\\*4) \\(7\\)"
++gdb_test "p c" "\\$\[0-9\]* = 'c'"
++gdb_test "p d" "\\$\[0-9\]* = 'd       '"
++gdb_test "p e" "\\$\[0-9\]* = 'g   '"
++gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\( 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   ', 'h   '\\) \\)"
++gdb_test "p *e" "Attempt to take contents of a non-pointer value."
++gdb_test "p *f" "Attempt to take contents of a non-pointer value."
 +
-+step_3:
-+  if (step >= 5)
-+    goto step_5;
++gdb_breakpoint [gdb_get_line_number "var-finish"]
++gdb_continue_to_breakpoint "var-finish"
++gdb_test "p e" "\\$\[0-9\]* = 'e   '" "p e re-set"
++gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f2  ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\( 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   ', 'f   '\\) \\)" "p *f re-set"
+diff --git a/gdb/testsuite/gdb.fortran/string.f90 b/gdb/testsuite/gdb.fortran/string.f90
+new file mode 100644
+index 0000000..226dc5d
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/string.f90
+@@ -0,0 +1,37 @@
++! Copyright 2008 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 2 of the License, or
++! (at your option) any later version.
++!
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++!
++! You should have received a copy of the GNU General Public License
++! along with this program; if not, write to the Free Software
++! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++!
++! Ihis file is the Fortran source file for dynamic.exp.
++! Original file written by Jakub Jelinek <jakub@redhat.com>.
++! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
 +
-+  var++;      /* after-fork1-B */
-+  empty ();   /* after-fork1-B */
-+  step = 4;
-+  while (step != 5)
-+    {
-+      if (step == 99)
-+      goto step_99;
++subroutine foo (e, f)
++  character (len=1) :: c
++  character (len=8) :: d
++  character (len=*) :: e
++  character (len=*) :: f (1:7, 8:10)
++  c = 'c'
++  d = 'd'
++  e = 'e'                                       ! var-init
++  f = 'f'
++  f(1,9) = 'f2'
++  c = 'c'                                       ! var-finish
++end subroutine foo
++  character (len=4) :: g, h (1:7, 8:10)
++  g = 'g'
++  h = 'h'
++  call foo (g, h)
++end
+diff --git a/gdb/testsuite/gdb.fortran/subrange.exp b/gdb/testsuite/gdb.fortran/subrange.exp
+new file mode 100644
+index 0000000..c819e23
+--- /dev/null
++++ b/gdb/testsuite/gdb.fortran/subrange.exp
+@@ -0,0 +1,60 @@
++# Copyright 2011 Free Software Foundation, Inc.
 +
-+      i = pthread_yield ();
-+      assert (i == 0);
-+    }
++# 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 <http://www.gnu.org/licenses/>.
 +
-+step_5:
-+  var++;      /* after-fork2-B */
-+  empty ();   /* after-fork2-B */
-+  return (void *) 5UL;
++if { [skip_fortran_tests] } { return -1 }
 +
-+step_99:
-+  /* We must not get caught here (against a forgotten breakpoint).  */
-+  var++;
-+  marker ();
-+  return (void *) 99UL;
++set testfile "subrange"
++set srcfile ${testfile}.f90
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
++    return -1
 +}
 +
-+int
-+main (void)
-+{
-+  int i;
-+  void *thread_result;
-+
-+  setbuf (stdout, NULL);
-+  printf ("main: %d\n", (int) gettid ());
-+
-+  /* General hardware breakpoints and watchpoints validity.  */
-+  marker ();
-+  var++;      /* validity-first */
-+  empty ();   /* validity-first */
-+
-+  i = pthread_create (&thread, NULL, start, NULL);
-+  assert (i == 0);
-+
-+  var++;      /* validity-thread-A */
-+  empty ();   /* validity-thread-A */
-+  step = 1;
-+  while (step != 2)
-+    {
-+      i = pthread_yield ();
-+      assert (i == 0);
-+    }
-+
-+  /* Hardware watchpoints got disarmed here.  */
-+  forkoff (1);
++if ![runto MAIN__] {
++    perror "Couldn't run to MAIN__"
++    continue
++}
 +
-+  var++;      /* after-fork1-A */
-+  empty ();   /* after-fork1-A */
-+  step = 3;
-+#ifdef FOLLOW_CHILD
-+  /* Spawn new thread as it was deleted in the child of FORK.  */
-+  i = pthread_create (&thread, NULL, start, NULL);
-+  assert (i == 0);
-+#endif
-+  while (step != 4)
-+    {
-+      i = pthread_yield ();
-+      assert (i == 0);
-+    }
++# Depending on the compiler version being used, the name of the 4-byte integer
++# and real types can be printed differently.  For instance, gfortran-4.1 uses
++# "int4" whereas gfortran-4.3 uses "int(kind=4)".
++set int4 "(int4|integer\\(kind=4\\))"
 +
-+  /* A sanity check for double hardware watchpoints removal.  */
-+  forkoff (2);
++gdb_breakpoint [gdb_get_line_number "break-static"]
++gdb_continue_to_breakpoint "break-static" ".*break-static.*"
 +
-+  var++;      /* after-fork2-A */
-+  empty ();   /* after-fork2-A */
-+  step = 5;
-+#ifdef FOLLOW_CHILD
-+  /* Spawn new thread as it was deleted in the child of FORK.  */
-+  i = pthread_create (&thread, NULL, start, NULL);
-+  assert (i == 0);
-+#endif
++foreach var {a alloc ptr} {
++    global pf_prefix
++    set old_prefix $pf_prefix
++    lappend pf_prefix "$var:"
 +
-+  i = pthread_join (thread, &thread_result);
-+  assert (i == 0);
-+  assert (thread_result == (void *) 5UL);
++    gdb_test "p $var (2, 2:3)" { = \(22, 32\)}
++    gdb_test "p $var (2:3, 3)" { = \(32, 33\)}
++    gdb_test "p $var (1, 2:)" { = \(21, 31\)}
++    gdb_test "p $var (2, :2)" { = \(12, 22\)}
++    gdb_test "p $var (3, 2:2)" { = \(23\)}
++    gdb_test "ptype $var (3, 2:2)" " = $int4 \\(2:2\\)"
++    gdb_test "p $var (4, :)" { = \(14, 24, 34\)}
++    gdb_test "p $var (:, :)" { = \(\( *11, 12, 13, 14\) \( *21, 22, 23, 24\) \( *31, 32, 33, 34\) *\)}
++    gdb_test "ptype $var (:, :)" " = $int4 \\(4,3\\)"
++    gdb_test "p $var (:)" "Wrong number of subscripts"
++    gdb_test "p $var (:, :, :)" "Wrong number of subscripts"
 +
-+  mark_exit ();
-+  return 0;
++    set pf_prefix $old_prefix
 +}
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c
++
++gdb_test_no_output {set $a=a}
++delete_breakpoints
++gdb_unload
++gdb_test {p $a (3, 2:2)} { = \(23\)}
+diff --git a/gdb/testsuite/gdb.fortran/subrange.f90 b/gdb/testsuite/gdb.fortran/subrange.f90
 new file mode 100644
-index 0000000..9bbf438
+index 0000000..4747ea9
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-parent.c
-@@ -0,0 +1,74 @@
-+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
-+
-+   Copyright 2012 Free Software Foundation, Inc.
-+
-+   This file is part of GDB.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <string.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <unistd.h>
-+#include <assert.h>
-+#include <stdio.h>
-+#include <sys/wait.h>
-+
-+#include "watchpoint-fork.h"
-+
-+void
-+forkoff (int nr)
-+{
-+  pid_t child, pid_got;
-+  int exit_code = 42 + nr;
-+  int status, i;
++++ b/gdb/testsuite/gdb.fortran/subrange.f90
+@@ -0,0 +1,28 @@
++! Copyright 2011 Free Software Foundation, Inc.
++!
++! This program is free software; you can redistribute it and/or modify
++! it under the terms of the GNU General Public License as published by
++! the Free Software Foundation; either version 3 of the License, or
++! (at your option) any later version.
++! 
++! This program is distributed in the hope that it will be useful,
++! but WITHOUT ANY WARRANTY; without even the implied warranty of
++! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++! GNU General Public License for more details.
++! 
++! You should have received a copy of the GNU General Public License
++! along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+  child = fork ();
-+  switch (child)
-+    {
-+    case -1:
-+      assert (0);
-+    case 0:
-+      printf ("child%d: %d\n", nr, (int) getpid ());
-+      /* Delay to get both the "child%d" and "parent%d" message printed without
-+       a race breaking expect by its endless wait on `$gdb_prompt$':
-+       Breakpoint 3, marker () at ../../../gdb/testsuite/gdb.threads/watchpoint-fork.c:33
-+       33      }
-+       (gdb) parent2: 14223  */
-+      i = sleep (1);
-+      assert (i == 0);
-+
-+      /* We must not get caught here (against a forgotten breakpoint).  */
-+      var++;
-+      marker ();
-+
-+      _exit (exit_code);
-+    default:
-+      printf ("parent%d: %d\n", nr, (int) child);
-+      /* Delay to get both the "child%d" and "parent%d" message printed, see
-+       above.  */
-+      i = sleep (1);
-+      assert (i == 0);
-+
-+      pid_got = wait (&status);
-+      assert (pid_got == child);
-+      assert (WIFEXITED (status));
-+      assert (WEXITSTATUS (status) == exit_code);
-+
-+      /* We must get caught here (against a false watchpoint removal).  */
-+      marker ();
-+    }
-+}
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork-st.c b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c
++program test
++  integer, target :: a (4, 3)
++  integer, allocatable :: alloc (:, :)
++  integer, pointer :: ptr (:, :)
++  do 1 i = 1, 4
++  do 1 j = 1, 3
++    a (i, j) = j * 10 + i
++1 continue
++  allocate (alloc (4, 3))
++  alloc = a
++  ptr => a
++  write (*,*) a                 ! break-static
++end
+diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
+index 7645caf..f4f9c1f 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 cmdarg_vec 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.mi/mi2-var-stale-type.c b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
 new file mode 100644
-index 0000000..17cc058
+index 0000000..ebced3c
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork-st.c
-@@ -0,0 +1,61 @@
-+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
-+
-+   Copyright 2012 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.c
+@@ -0,0 +1,26 @@
++/* Copyright 2011 Free Software Foundation, Inc.
 +
 +   This file is part of GDB.
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2 of the License, or
++   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,
@@ -14794,57 +12882,24 @@ index 0000000..17cc058
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software
-+   Foundation, Inc., 59 Temple Place - Suite 330,
-+   Boston, MA 02111-1307, USA.  */
-+
-+#include <assert.h>
-+#include <unistd.h>
-+#include <sys/wait.h>
-+#include <stdio.h>
-+#include <stdlib.h>
-+
-+#include "watchpoint-fork.h"
-+
-+volatile int var;
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+void
-+marker (void)
++int
++main (int argc, char **argv)
 +{
-+}
++  char vla[argc];
 +
-+static void
-+mark_exit (void)
-+{
-+}
++  vla[0] = 0; /* break-here */
 +
-+int
-+main (void)
-+{
-+  setbuf (stdout, NULL);
-+  printf ("main: %d\n", (int) getpid ());
-+
-+  /* General hardware breakpoints and watchpoints validity.  */
-+  marker ();
-+  var++;
-+  /* Hardware watchpoints got disarmed here.  */
-+  forkoff (1);
-+  /* This watchpoint got lost before.  */
-+  var++;
-+  /* A sanity check for double hardware watchpoints removal.  */
-+  forkoff (2);
-+  var++;
-+
-+  mark_exit ();
 +  return 0;
 +}
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+diff --git a/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
 new file mode 100644
-index 0000000..2e01344
+index 0000000..74a104e
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
-@@ -0,0 +1,149 @@
-+# Copyright 2012 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.mi/mi2-var-stale-type.exp
+@@ -0,0 +1,57 @@
++# Copyright 2011 Free Software Foundation, Inc.
 +#
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
@@ -14859,155 +12914,61 @@ index 0000000..2e01344
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+# Test case for forgotten hw-watchpoints after fork()-off of a process.
-+
-+proc test {type symbol} {
-+    global objdir subdir srcdir gdb_prompt
-+
-+    set testfile watchpoint-fork
-+
-+    global pf_prefix
-+    set prefix_test $pf_prefix
-+    lappend pf_prefix "$type:"
-+    set prefix_mt $pf_prefix
-+
-+    set srcfile_type ${srcdir}/${subdir}/${testfile}-${type}.c
-+
-+
-+    # no threads
-+
-+    set pf_prefix $prefix_mt
-+    lappend pf_prefix "singlethreaded:"
-+
-+    set executable ${testfile}-${type}-st
-+    set srcfile_main ${srcdir}/${subdir}/${testfile}-st.c
-+    if { [gdb_compile "${srcfile_main} ${srcfile_type}" ${objdir}/${subdir}/${executable} executable [list debug additional_flags=-D$symbol]] != "" } {
-+      untested ${testfile}.exp
-+      return
-+    }
-+    clean_restart $executable
-+
-+    gdb_test "show detach-on-fork" "Whether gdb will detach the child of a fork is on\\."
-+    gdb_test_no_output "set follow-fork-mode $type"
-+    gdb_test "show follow-fork-mode" "Debugger response to a program call of fork or vfork is \"$type\"\\."
-+    # Testcase uses it for the `follow-fork-mode child' type.
-+    gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
-+
-+    if ![runto_main] {
-+      return
-+    }
-+
-+    gdb_test "watch var" "atchpoint \[0-9\]+: var" "Set the watchpoint"
++load_lib mi-support.exp
++set MIFLAGS "-i=mi2"
 +
-+    # It is never hit but it should not be left over in the fork()ed-off child.
-+    set hbreak "hbreak"
-+    set test "hbreak marker"
-+    gdb_test_multiple $test $test {
-+      -re "Hardware assisted breakpoint \[0-9\]+ at .*\r\n$gdb_prompt $" {
-+          pass $test
-+      }
-+      -re "(No hardware breakpoint support in the target\\.|Hardware breakpoints used exceeds limit\\.)\r\n$gdb_prompt $" {
-+          pass $test
-+          set hbreak "break"
-+          gdb_test "break marker"
-+      }
-+    }
++gdb_exit
++if [mi_gdb_start] {
++    continue
++}
 +
-+    gdb_breakpoint "mark_exit"
++set testfile "mi2-var-stale-type"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
++    return -1
++}
 +
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "hardware breakpoints work"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 0.*New value = 1.*forkoff *\\(1\\).*" "watchpoints work"
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "breakpoint after the first fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 1.*New value = 2.*forkoff *\\(2\\).*" "watchpoint after the first fork"
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "breakpoint after the second fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 2.*New value = 3.*mark_exit \\(\\);" "watchpoint after the second fork"
-+    gdb_test "continue" "Continuing\\..*\r\nBreakpoint \[0-9\]+, mark_exit .*" "finish"
++mi_delete_breakpoints
++mi_gdb_reinitialize_dir $srcdir/$subdir
++mi_gdb_load ${binfile}
 +
++mi_gdb_test {-interpreter-exec console "maintenance set internal-error quit yes"} \
++  {\^done} \
++  "maintenance set internal-error quit yes"
 +
-+    # threads
++mi_gdb_test {-interpreter-exec console "maintenance set internal-error corefile yes"} \
++  {\^done} \
++  "maintenance set internal-error corefile yes"
 +
-+    set pf_prefix $prefix_mt
-+    lappend pf_prefix "multithreaded:"
++set line [gdb_get_line_number "break-here"]
++set func "main"
 +
-+    set executable ${testfile}-${type}-mt
-+    set srcfile_main ${srcdir}/${subdir}/${testfile}-mt.c
-+    if { [gdb_compile_pthreads "${srcfile_main} ${srcfile_type}" ${objdir}/${subdir}/${executable} executable [list debug "additional_flags=-D$symbol -DTHREAD"]] != "" } {
-+      untested ${testfile}.exp
-+      return
-+    }
-+    clean_restart $executable
++mi_gdb_test "-break-insert -t $srcfile:$line" \
++  "\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(.*\\\)\)?\",file=\".*\",line=\"$line\",times=\"0\",original-location=\".*\"\}" \
++  "breakpoint at $func"
 +
-+    gdb_test_no_output "set follow-fork-mode $type"
-+    # Testcase uses it for the `follow-fork-mode child' type.
-+    gdb_test "handle SIGUSR1 nostop noprint pass" "No\[ \t\]+No\[ \t\]+Yes.*"
++if { [mi_run_cmd] < 0 } {
++    return -1
++}
++mi_expect_stop "breakpoint-hit" $func ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "stop after initializing vla"
 +
-+    if ![runto_main] {
-+      return
-+    }
++mi_create_varobj "vla" "vla" "create local variable vla"
 +
-+    gdb_test "watch var" "atchpoint \[0-9\]+: var" "Set the watchpoint"
-+
-+    # It should not be left over in the fork()ed-off child.
-+    gdb_test "$hbreak marker" {reakpoint [0-9]+.*}
-+
-+    gdb_breakpoint "mark_exit"
-+
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "hardware breakpoints work"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 0.*New value = 1.*validity-first.*" "singlethread watchpoints work"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 1.*New value = 2.*validity-thread-A.*" "multithreaded watchpoints work at A"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 2.*New value = 3.*validity-thread-B.*" "multithreaded watchpoints work at B"
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "breakpoint (A) after the first fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 3.*New value = 4.*after-fork1-A.*" "watchpoint A after the first fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 4.*New value = 5.*after-fork1-B.*" "watchpoint B after the first fork"
-+    gdb_test "continue" \
-+           "reakpoint \[0-9\]+, marker.*" "breakpoint (A) after the second fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 5.*New value = 6.*after-fork2-A.*" "watchpoint A after the second fork"
-+    gdb_test "continue" \
-+           "atchpoint \[0-9\]+: var.*Old value = 6.*New value = 7.*after-fork2-B.*" "watchpoint B after the second fork"
-+    gdb_test "continue" "Continuing\\..*\r\nBreakpoint \[0-9\]+, mark_exit .*" "finish"
-+
-+
-+    # cleanup
-+    set pf_prefix $prefix_test
-+}
-+
-+test parent FOLLOW_PARENT
-+
-+# Only GNU/Linux is known to support `set follow-fork-mode child'.
-+if {[istarget "*-*-linux*"] && ![is_remote target]} {
-+    test child FOLLOW_CHILD
-+} else {
-+    untested "child"
-+}
-diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.h b/gdb/testsuite/gdb.threads/watchpoint-fork.h
++mi_gdb_test "-var-update *" "\\^done,changelist=.*" "-var-update *"
+diff --git a/gdb/testsuite/gdb.opt/array-from-register-func.c b/gdb/testsuite/gdb.opt/array-from-register-func.c
 new file mode 100644
-index 0000000..cb109fa
+index 0000000..729f457
 --- /dev/null
-+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.h
-@@ -0,0 +1,32 @@
-+/* Test case for forgotten hw-watchpoints after fork()-off of a process.
-+
-+   Copyright 2012 Free Software Foundation, Inc.
++++ b/gdb/testsuite/gdb.opt/array-from-register-func.c
+@@ -0,0 +1,22 @@
++/* This file is part of GDB, the GNU debugger.
 +
-+   This file is part of GDB.
++   Copyright 2009 Free Software Foundation, Inc.
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2 of the License, or
++   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,
@@ -15016,30 +12977,22 @@ index 0000000..cb109fa
 +   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.  */
-+
-+#ifdef THREAD
-+#include <pthread.h>
-+
-+extern volatile int step;
-+extern pthread_t thread;
-+#endif /* THREAD */
-+
-+extern volatile int var;
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+extern void marker (void);
-+extern void forkoff (int nr);
-diff --git a/gdb/testsuite/gdb.trace/stap-trace.c b/gdb/testsuite/gdb.trace/stap-trace.c
++int
++func (int *arr)
++{
++  return arr[0];
++}
+diff --git a/gdb/testsuite/gdb.opt/array-from-register.c b/gdb/testsuite/gdb.opt/array-from-register.c
 new file mode 100644
-index 0000000..27f317e
+index 0000000..3090e7e
 --- /dev/null
-+++ b/gdb/testsuite/gdb.trace/stap-trace.c
-@@ -0,0 +1,71 @@
-+/* This testcase is part of GDB, the GNU debugger.
++++ b/gdb/testsuite/gdb.opt/array-from-register.c
+@@ -0,0 +1,28 @@
++/* This file is part of GDB, the GNU debugger.
 +
-+   Copyright 2011 Free Software Foundation, Inc.
++   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
@@ -15054,69 +13007,64 @@ index 0000000..27f317e
 +   You should have received a copy of the GNU General Public License
 +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 +
-+#if USE_PROBES
-+
-+#define _SDT_HAS_SEMAPHORES
-+__extension__ unsigned short teste_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+#define TEST teste_user_semaphore
-+
-+__extension__ unsigned short teste_two_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
-+#define TEST2 teste_two_semaphore
-+
-+#else
-+
-+#define TEST 1
-+#define TEST2 1
-+
-+#endif /* USE_PROBES */
++extern int func (int *arr);
 +
-+#include <sys/sdt.h>
++int
++main (void)
++{
++  int arr[] = { 42 };
 +
-+/* We only support SystemTap and only the v3 form.  */
-+#if _SDT_NOTE_TYPE != 3
-+#error "not using SystemTap v3 probes"
-+#endif
++  func (arr);
 +
-+void
-+m1 (int x)
-+{
-+  if (TEST2)
-+    STAP_PROBE1 (teste, two, x);
++  return 0;
 +}
+diff --git a/gdb/testsuite/gdb.opt/array-from-register.exp b/gdb/testsuite/gdb.opt/array-from-register.exp
+new file mode 100644
+index 0000000..f2de718
+--- /dev/null
++++ b/gdb/testsuite/gdb.opt/array-from-register.exp
+@@ -0,0 +1,33 @@
++# Copyright 2009 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++#
++# This file is part of the gdb testsuite.
 +
-+int
-+f (int x)
-+{
-+  if (TEST)
-+    STAP_PROBE1(teste, user, x);
-+  return x+5;
++if { [prepare_for_testing array-from-register.exp "array-from-register"      \
++                        {array-from-register.c array-from-register-func.c} \
++                        {debug optimize=-O2}] } {
++    return -1
 +}
 +
-+void
-+nothing (void)
-+{
-+  int a = 1 + 1;
-+  return;
++if ![runto func] then {
++    return -1
 +}
 +
-+int
-+main()
-+{
-+  f (f (23));
-+  m1 (46);
-+  nothing (); /* end-here */
++gdb_test "p arr" "\\$\[0-9\]+ = \\(int \\*\\) *0x\[0-9a-f\]+"
 +
-+  return 0;
-+}
-diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp
++# Seen regression:
++# Address requested for identifier "arr" which is in register $rdi
++gdb_test "p arr\[0\]" "\\$\[0-9\]+ = 42"
+diff --git a/gdb/testsuite/gdb.pascal/arrays.exp b/gdb/testsuite/gdb.pascal/arrays.exp
 new file mode 100644
-index 0000000..b0f1d7d
+index 0000000..ccc6e1e
 --- /dev/null
-+++ b/gdb/testsuite/gdb.trace/stap-trace.exp
-@@ -0,0 +1,129 @@
-+# Copyright 2011
-+# Free Software Foundation, Inc.
-+
++++ b/gdb/testsuite/gdb.pascal/arrays.exp
+@@ -0,0 +1,104 @@
++# Copyright 2008, 2009 Free Software Foundation, Inc.
++#
 +# This program is free software; you can redistribute it and/or modify
 +# it under the terms of the GNU General Public License as published by
 +# the Free Software Foundation; either version 3 of the License, or
@@ -15130,124 +13078,235 @@ index 0000000..b0f1d7d
 +# You should have received a copy of the GNU General Public License
 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +
-+load_lib "trace-support.exp"
-+
 +if $tracelevel then {
-+      strace $tracelevel
++    strace $tracelevel
++}
++
++load_lib "pascal.exp"
++
++set testfile "arrays"
++set srcfile ${testfile}.pas
++set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
++
++# These tests only work with fpc, using the -gw3 compile-option
++pascal_init
++if { $pascal_compiler_is_fpc != 1 } {
++  return -1
++}
++
++# Detect if the fpc version is below 2.3.0
++set fpc_generates_dwarf_for_dynamic_arrays 1
++if { ($fpcversion_major < 2) || ( ($fpcversion_major == 2) && ($fpcversion_minor < 3))}  {
++  set fpc_generates_dwarf_for_dynamic_arrays 0
++}
++
++
++if {[gdb_compile_pascal "-gw3 ${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
++  return -1
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
++set bp_location2 [gdb_get_line_number "set breakpoint 2 here"]
++
++
++if { [gdb_breakpoint ${srcfile}:${bp_location1}] } {
++    pass "setting breakpoint 1"
++}
++if { [gdb_breakpoint ${srcfile}:${bp_location2}] } {
++    pass "setting breakpoint 2"
++}
++
++# Verify that "start" lands inside the right procedure.
++if { [gdb_start_cmd] < 0 } {
++    untested start
++    return -1
++}
++
++gdb_test "" ".* at .*${srcfile}.*" "start"
++
++gdb_test "cont" "Breakpoint .*:${bp_location1}.*" "Going to first breakpoint"
++
++gdb_test "print StatArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer type"
++gdb_test "print StatArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61\\}" "Print static array of integer"
++
++gdb_test "cont" "Breakpoint .*:${bp_location2}.*" "Going to second breakpoint"
++
++gdb_test "print StatArrChar" ".* = 'abcdefghijkl'" "Print static array of char"
++gdb_test "print Stat2dArrInt" ".* = \\{\\{0, 1, 2, 3, 4\\}, \\{1, 2, 3, 4, 5\\}, \\{2, 3, 4, 5, 6\\}, \\{3, 4, 5, 6, 7\\}, \\{4, 5, 6, 7, 8\\}, \\{5, 6, 7, 8, 9\\}, \\{6, 7, 8, 9, 10\\}, \\{7, 8, 9, 10, 11\\}, \\{8, 9, 10, 11, 12\\}, \\{9, 10, 11, 12, 13\\}, \\{10, 11, 12, 13, 14\\}, \\{11, 12, 13, 14, 15\\}\\}" "Print static 2-dimensional array of integer"
++
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
++}
++gdb_test "print DynArrInt" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer type"
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
 +}
++gdb_test "print DynArrInt_" ".* = \\{50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62\\}" "Print dynamic array of integer"
 +
-+set testfile "stap-trace"
-+set srcfile ${testfile}.c
-+set executable $testfile
-+set binfile $objdir/$subdir/$executable
-+
-+set ws "\[\r\n\t \]+"
-+set cr "\[\r\n\]+"
-+
-+# Only x86 and x86_64 targets are supported for now.
-+
-+if { ![istarget "x86_64-*"] && ![istarget "i?86-*"] } {
-+    continue
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
 +}
++gdb_test "print s" ".* = 'test'#0'string'" "Print string containing null-char"
 +
-+proc compile_stap_bin {{ arg "" }} {
-+    global srcfile
-+    global binfile
-+    global srcdir
-+    global subdir
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
++}
++gdb_test "print DynArrStr" ".* = \\{'dstr0', 'dstr1', 'dstr2', 'dstr3', 'dstr4', 'dstr5', 'dstr6', 'dstr7', 'dstr8', 'dstr9', 'dstr10', 'dstr11', 'dstr12'\\}" "Print dynamic array of string"
 +
-+    if { $arg != "" } {
-+      set arg "additional_flags=$arg"
-+    }
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
++}
++gdb_test "print StatArrStr" ".* = \\{'str0', 'str1', 'str2', 'str3', 'str4', 'str5', 'str6', 'str7', 'str8', 'str9', 'str10', 'str11', 'str12'\\}" "Print static array of string"
 +
-+    if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-+          executable [concat $arg debug nowarnings]] != "" } {
-+      untested "Could not compile ${srcfile}"
-+      return -1
-+    }
++if { $fpc_generates_dwarf_for_dynamic_arrays == 0} {
++  setup_xfail "*-*-*"
 +}
++gdb_test "print DynArrChar" ".* = 'abcdefghijklm'" "Print dynamic array of char"
 +
-+proc prepare_for_trace_test {} {
-+    global executable
+diff --git a/gdb/testsuite/gdb.pascal/arrays.pas b/gdb/testsuite/gdb.pascal/arrays.pas
+new file mode 100644
+index 0000000..295602d
+--- /dev/null
++++ b/gdb/testsuite/gdb.pascal/arrays.pas
+@@ -0,0 +1,82 @@
++{
++ Copyright 2008, 2009 Free Software Foundation, Inc.
 +
-+    clean_restart $executable
++ 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.
 +
-+    if { ![runto_main] } {
-+      perror "Could not run to `main'."
-+      continue
-+    }
++ 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.
 +
-+    gdb_breakpoint [gdb_get_line_number "end-here"]
++ You should have received a copy of the GNU General Public License
++ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +}
 +
-+proc run_trace_experiment { test_probe msg } {
-+    global gdb_prompt
-+
-+    set test "collect $msg: start trace experiment"
-+    gdb_test_multiple "tstart" "$test" {
-+      -re "^tstart\r\n$gdb_prompt $" {
-+          pass "$test"
-+      }
-+    }
++program arrays;
 +
-+    gdb_test "continue" \
-+          "Continuing.*Breakpoint \[0-9\]+.*" \
-+          "collect $msg: run trace experiment"
-+    gdb_test "tstop" \
-+          "\[\r\n\]+" \
-+          "collect $msg: stop trace experiment"
-+    gdb_test "tfind start" \
-+          "#0 .*" \
-+          "collect $msg: tfind test frame"
-+}
++{$mode objfpc}{$h+}
 +
-+proc gdb_collect_probe_arg { msg probe val_arg0 } {
-+    global gdb_prompt
-+    global cr
++uses sysutils;
 +
-+    prepare_for_trace_test
++type TStatArrInt= array[0..11] of integer;
++     TDynArrInt= array of integer;
++     TStatArrStr= array[0..12] of string;
++     TDynArrStr= array of string;
++     TDynArrChar = array of char;
++     TStatArrChar = array [0..11] of char;
 +
-+    gdb_test "trace $probe" \
-+          "Tracepoint \[0-9\]+ at .*" \
-+          "collect $msg: set tracepoint"
-+    gdb_trace_setactions "collect $msg: define actions" \
-+          "" \
-+          "collect \$_probe_arg0" "^$"
++     TStat2dArrInt = array[0..11,0..4] of integer;
 +
-+    # Begin the test.
-+    run_trace_experiment $msg $probe
++var StatArrInt: TStatArrInt;
++    StatArrInt_: Array[0..11] of integer;
++    DynArrInt:  TDynArrInt;
++    DynArrInt_: Array of integer;
++    StatArrStr: TStatArrStr;
++    DynArrStr: TDynArrStr;
++    StatArrChar: TStatArrChar;
++    DynArrChar: TDynArrChar;
 +
-+    gdb_test "print \$_probe_arg0" \
-+          "\\$\[0-9\]+ = $val_arg0$cr" \
-+          "collect $msg: collected probe arg0"
-+}
++    Stat2dArrInt: TStat2dArrInt;
 +
-+compile_stap_bin ""
++    s: string;
++      
++    i,j : integer;
 +
-+clean_restart $executable
-+if { ![runto_main] } {
-+    perror "Could not run to `main'."
-+    continue
-+}
++begin
++  for i := 0 to 11 do
++    begin
++    StatArrInt[i]:= i+50;
++    StatArrInt_[i]:= i+50;
++    StatArrChar[i]:= chr(ord('a')+i);
++    for j := 0 to 4 do
++      Stat2dArrInt[i,j]:=i+j;
++    end;
++  writeln(StatArrInt_[0]);
++  writeln(StatArrInt[0]); { set breakpoint 1 here }
++  writeln(StatArrChar[0]);
++  writeln(Stat2dArrInt[0,0]);
 +
-+if { ![gdb_target_supports_trace] } {
-+    # Test cannot run on this target.
-+    return 1;
-+}
++  setlength(DynArrInt,13);
++  setlength(DynArrInt_,13);
++  setlength(DynArrStr,13);
++  setlength(DynArrChar,13);
++  for i := 0 to 12 do
++    begin
++    DynArrInt[i]:= i+50;
++    DynArrInt_[i]:= i+50;
++    DynArrChar[i]:= chr(ord('a')+i);
++    StatArrStr[i]:='str'+inttostr(i);
++    DynArrStr[i]:='dstr'+inttostr(i);
++    end;
++  writeln(DynArrInt_[1]);
++  writeln(DynArrInt[1]); 
++  writeln(DynArrStr[1]); 
++  writeln(StatArrStr[1]);
++  writeln(DynArrChar[1]);
 +
-+gdb_collect_probe_arg "probe args without semaphore" "-p user" "23"
-+gdb_exit
++  s := 'test'#0'string';
++  writeln(s); { set breakpoint 2 here }
++end.
+diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
+index 993e774..52dbd17 100644
+--- a/gdb/testsuite/gdb.python/py-frame.exp
++++ b/gdb/testsuite/gdb.python/py-frame.exp
+@@ -74,8 +74,6 @@ gdb_test "python print bframe == gdb.newest_frame()" True \
+ 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"
+@@ -90,3 +88,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"
 +
-+compile_stap_bin "-DUSE_PROBES"
-+gdb_collect_probe_arg "probe args with semaphore" "-p two" "46"
++gdb_test "python print 'result =', f0.block ()" "<gdb.Block object at 0x\[\[:xdigit:\]\]+>" "test Frame.block"
+diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
+index acfd89b..c77d9c2 100644
+--- a/gdb/testsuite/gdb.python/py-value.exp
++++ b/gdb/testsuite/gdb.python/py-value.exp
+@@ -358,6 +358,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"
++}
 +
-+# Finished!
-+gdb_test "tfind none" ".*" ""
+ # 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.
+@@ -494,6 +503,7 @@ test_value_in_inferior
+ test_inferior_function_call
+ test_lazy_strings
+ test_value_after_death
++test_cast_regression
+ # Test either C or C++ values. 
+ test_subscript_regression "${binfile}" "c"
 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
-index 00fe71c..5ca9563 100644
+index 4f2b7c9..0daef25 100644
 --- a/gdb/testsuite/lib/gdb.exp
 +++ b/gdb/testsuite/lib/gdb.exp
-@@ -139,6 +139,11 @@ proc gdb_unload {} {
+@@ -142,6 +142,11 @@ proc gdb_unload {} {
            send_gdb "y\n"
            exp_continue
        }
@@ -15294,48 +13353,11 @@ index dd18d37..f973485 100644
      }
      set pascal_init_done 1
  }   
-diff --git a/gdb/thread.c b/gdb/thread.c
-index 9a29383..1a49b00 100644
---- a/gdb/thread.c
-+++ b/gdb/thread.c
-@@ -1431,7 +1431,8 @@ update_thread_list (void)
-    no thread is selected, or no threads exist.  */
- static struct value *
--thread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var)
-+thread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var,
-+                    void *ignore)
- {
-   struct thread_info *tp = find_thread_ptid (inferior_ptid);
-@@ -1442,6 +1443,15 @@ thread_id_make_value (struct gdbarch *gdbarch, struct internalvar *var)
- /* Commands with a prefix of `thread'.  */
- struct cmd_list_element *thread_cmd_list = NULL;
-+/* Implementation of `thread' variable.  */
-+
-+static struct internalvar_funcs thread_funcs =
-+{
-+  thread_id_make_value,
-+  NULL,
-+  NULL
-+};
-+
- void
- _initialize_thread (void)
- {
-@@ -1487,5 +1497,5 @@ Show printing of thread events (such as thread start and exit)."), NULL,
-          show_print_thread_events,
-          &setprintlist, &showprintlist);
--  create_internalvar_type_lazy ("_thread", thread_id_make_value);
-+  create_internalvar_type_lazy ("_thread", &thread_funcs, NULL);
- }
 diff --git a/gdb/top.c b/gdb/top.c
-index c4e913d..5b79983 100644
+index 061ad48..d615cfc 100644
 --- a/gdb/top.c
 +++ b/gdb/top.c
-@@ -349,6 +349,9 @@ prepare_execute_command (void)
+@@ -352,6 +352,9 @@ prepare_execute_command (void)
  
    mark = value_mark ();
    cleanup = make_cleanup_value_free_to_mark (mark);
@@ -15345,112 +13367,8 @@ index c4e913d..5b79983 100644
  
    /* With multiple threads running while the one we're examining is
       stopped, the dcache can get stale without us being able to detect
-diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
-index ede3742..b20f733 100644
---- a/gdb/tracepoint.c
-+++ b/gdb/tracepoint.c
-@@ -683,7 +683,7 @@ validate_actionline (char **line, struct breakpoint *b)
-   struct cleanup *old_chain = NULL;
-   char *p, *tmp_p;
-   struct bp_location *loc;
--  struct agent_expr *aexpr;
-+  struct agent_expr *aexpr = NULL;
-   struct tracepoint *t = (struct tracepoint *) b;
-   /* If EOF is typed, *line is NULL.  */
-@@ -1352,7 +1352,7 @@ encode_actions_1 (struct command_line *action,
-   int i;
-   struct value *tempval;
-   struct cmd_list_element *cmd;
--  struct agent_expr *aexpr;
-+  struct agent_expr *aexpr = NULL;
-   for (; action; action = action->next)
-     {
-@@ -1716,6 +1716,7 @@ start_tracing (char *notes)
-   for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++)
-     {
-       struct tracepoint *t = (struct tracepoint *) b;
-+      struct bp_location *loc;
-       if (b->enable_state == bp_enabled)
-       any_enabled = 1;
-@@ -1778,6 +1779,9 @@ start_tracing (char *notes)
-       }
-       t->number_on_target = b->number;
-+
-+      for (loc = b->loc; loc; loc = loc->next)
-+      modify_semaphore (loc, 1);
-     }
-   VEC_free (breakpoint_p, tp_vec);
-@@ -1850,9 +1854,28 @@ void
- stop_tracing (char *note)
- {
-   int ret;
-+  VEC(breakpoint_p) *tp_vec = NULL;
-+  int ix;
-+  struct breakpoint *t;
-   target_trace_stop ();
-+  tp_vec = all_tracepoints ();
-+  for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
-+    {
-+      struct bp_location *loc;
-+
-+      if ((t->type == bp_fast_tracepoint
-+         ? !may_insert_fast_tracepoints
-+         : !may_insert_tracepoints))
-+      continue;
-+
-+      for (loc = t->loc; loc; loc = loc->next)
-+      modify_semaphore (loc, 0);
-+    }
-+
-+  VEC_free (breakpoint_p, tp_vec);
-+
-   if (!note)
-     note = trace_stop_notes;
-   ret = target_set_trace_notes (NULL, NULL, note);
-@@ -4924,7 +4947,8 @@ info_static_tracepoint_markers_command (char *arg, int from_tty)
-    available.  */
- static struct value *
--sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var)
-+sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
-+                void *ignore)
- {
-   LONGEST size;
-   gdb_byte *buf;
-@@ -5103,6 +5127,15 @@ traceframe_available_memory (VEC(mem_range_s) **result,
-   return 0;
- }
-+/* Implementation of `sdata' variable.  */
-+
-+static const struct internalvar_funcs sdata_funcs =
-+{
-+  sdata_make_value,
-+  NULL,
-+  NULL
-+};
-+
- /* module initialization */
- void
- _initialize_tracepoint (void)
-@@ -5113,7 +5146,7 @@ _initialize_tracepoint (void)
-      value with a void typed value, and when we get here, gdbarch
-      isn't initialized yet.  At this point, we're quite sure there
-      isn't another convenience variable of the same name.  */
--  create_internalvar_type_lazy ("_sdata", sdata_make_value);
-+  create_internalvar_type_lazy ("_sdata", &sdata_funcs, NULL);
-   traceframe_number = -1;
-   tracepoint_number = -1;
 diff --git a/gdb/typeprint.c b/gdb/typeprint.c
-index de96fd5..75485ff 100644
+index c25e705..498958a 100644
 --- a/gdb/typeprint.c
 +++ b/gdb/typeprint.c
 @@ -35,6 +35,7 @@
@@ -15462,7 +13380,7 @@ index de96fd5..75485ff 100644
  
  extern void _initialize_typeprint (void);
 @@ -76,6 +77,9 @@ void
- type_print (struct type *type, char *varstring, struct ui_file *stream,
+ type_print (struct type *type, const char *varstring, struct ui_file *stream,
            int show)
  {
 +  if (show >= 0 && current_language->la_language != language_ada)
@@ -15496,7 +13414,7 @@ index de96fd5..75485ff 100644
    type = value_type (val);
  
    get_user_print_options (&opts);
-@@ -167,8 +173,7 @@ whatis_exp (char *exp, int show)
+@@ -158,8 +164,7 @@ whatis_exp (char *exp, int show)
    type_print (type, "", gdb_stdout, show);
    printf_filtered ("\n");
  
@@ -15507,10 +13425,32 @@ index de96fd5..75485ff 100644
  
  static void
 diff --git a/gdb/utils.c b/gdb/utils.c
-index 4863e41..c1fec82 100644
+index 5566149..6e1aa34 100644
 --- a/gdb/utils.c
 +++ b/gdb/utils.c
-@@ -1904,6 +1904,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void)
+@@ -27,6 +27,7 @@
+ #include "exceptions.h"
+ #include "gdbthread.h"
+ #include "fnmatch.h"
++#include "gdb_bfd.h"
+ #ifdef HAVE_SYS_RESOURCE_H
+ #include <sys/resource.h>
+ #endif /* HAVE_SYS_RESOURCE_H */
+@@ -198,11 +199,11 @@ make_cleanup_dyn_string_delete (dyn_string_t arg)
+ static void
+ do_bfd_close_cleanup (void *arg)
+ {
+-  bfd_close (arg);
++  gdb_bfd_unref (arg);
+ }
+ struct cleanup *
+-make_cleanup_bfd_close (bfd *abfd)
++make_cleanup_bfd_unref (bfd *abfd)
+ {
+   return make_cleanup (do_bfd_close_cleanup, abfd);
+ }
+@@ -1738,6 +1739,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void)
    return back_to;
  }
  
@@ -15548,7 +13488,7 @@ index 4863e41..c1fec82 100644
  
  static void
 diff --git a/gdb/valarith.c b/gdb/valarith.c
-index b8bcc6b..fb83c70 100644
+index 96d5411..37bd464 100644
 --- a/gdb/valarith.c
 +++ b/gdb/valarith.c
 @@ -197,7 +197,10 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
@@ -15575,7 +13515,7 @@ index b8bcc6b..fb83c70 100644
  }
  
 diff --git a/gdb/valops.c b/gdb/valops.c
-index 5453b1a..5a4a8fa 100644
+index 97d889b..6ae77b8 100644
 --- a/gdb/valops.c
 +++ b/gdb/valops.c
 @@ -45,6 +45,7 @@
@@ -15586,7 +13526,7 @@ index 5453b1a..5a4a8fa 100644
  
  extern int overload_debug;
  /* Local functions.  */
-@@ -915,6 +916,65 @@ value_one (struct type *type)
+@@ -919,6 +920,65 @@ value_one (struct type *type)
    return val;
  }
  
@@ -15652,7 +13592,17 @@ index 5453b1a..5a4a8fa 100644
  /* Helper function for value_at, value_at_lazy, and value_at_lazy_stack.  */
  
  static struct value *
-@@ -1011,12 +1071,20 @@ value_fetch_lazy (struct value *val)
+@@ -981,7 +1041,8 @@ int
+ value_fetch_lazy (struct value *val)
+ {
+   gdb_assert (value_lazy (val));
+-  allocate_value_contents (val);
++  if (VALUE_LVAL (val) != lval_memory)
++    allocate_value_contents (val);
+   if (value_bitsize (val))
+     {
+       /* To read a lazy bitfield, read the entire enclosing value.  This
+@@ -1015,12 +1076,24 @@ value_fetch_lazy (struct value *val)
      }
    else if (VALUE_LVAL (val) == lval_memory)
      {
@@ -15670,15 +13620,19 @@ index 5453b1a..5a4a8fa 100644
 +
 +        if (length)
 +          {
++            /* Delay it after object_address_get_data above.  */
++            allocate_value_contents (val);
 +            addr += value_offset (val);
 +            read_value_memory (val, 0, value_stack (val),
 +                               addr, value_contents_all_raw (val), length);
 +          }
 +      }
++      /* Just to be sure it has been called.  */
++      allocate_value_contents (val);
      }
    else if (VALUE_LVAL (val) == lval_register)
      {
-@@ -1528,7 +1596,18 @@ address_of_variable (struct symbol *var, struct block *b)
+@@ -1530,7 +1603,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)
      {
@@ -15698,7 +13652,7 @@ index 5453b1a..5a4a8fa 100644
  
        return value_from_pointer (lookup_pointer_type (type), addr);
      }
-@@ -1635,6 +1714,7 @@ struct value *
+@@ -1637,6 +1721,7 @@ struct value *
  value_coerce_array (struct value *arg1)
  {
    struct type *type = check_typedef (value_type (arg1));
@@ -15706,7 +13660,7 @@ index 5453b1a..5a4a8fa 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
-@@ -1644,8 +1724,12 @@ value_coerce_array (struct value *arg1)
+@@ -1646,8 +1731,12 @@ value_coerce_array (struct value *arg1)
    if (VALUE_LVAL (arg1) != lval_memory)
      error (_("Attempt to take address of value not located in memory."));
  
@@ -15720,7 +13674,7 @@ index 5453b1a..5a4a8fa 100644
  }
  
  /* Given a value which is a function, return a value which is a pointer
-@@ -3694,6 +3778,8 @@ value_slice (struct value *array, int lowbound, int length)
+@@ -3769,6 +3858,8 @@ value_slice (struct value *array, int lowbound, int length)
                                        TYPE_TARGET_TYPE (range_type),
                                        lowbound, 
                                        lowbound + length - 1);
@@ -15730,7 +13684,7 @@ index 5453b1a..5a4a8fa 100644
      {
        int i;
 diff --git a/gdb/valprint.c b/gdb/valprint.c
-index 325cf40..70a98c2 100644
+index fc5942d..8333eb4 100644
 --- a/gdb/valprint.c
 +++ b/gdb/valprint.c
 @@ -37,6 +37,7 @@
@@ -15741,7 +13695,7 @@ index 325cf40..70a98c2 100644
  
  #include <errno.h>
  
-@@ -240,7 +241,6 @@ scalar_type_p (struct type *type)
+@@ -251,7 +252,6 @@ scalar_type_p (struct type *type)
      case TYPE_CODE_STRUCT:
      case TYPE_CODE_UNION:
      case TYPE_CODE_SET:
@@ -15749,7 +13703,7 @@ index 325cf40..70a98c2 100644
      case TYPE_CODE_BITSTRING:
        return 0;
      default:
-@@ -1198,6 +1198,7 @@ val_print_array_elements (struct type *type,
+@@ -1570,6 +1570,7 @@ val_print_array_elements (struct type *type,
  {
    unsigned int things_printed = 0;
    unsigned len;
@@ -15757,7 +13711,7 @@ index 325cf40..70a98c2 100644
    struct type *elttype, *index_type;
    unsigned eltlen;
    /* Position of the array element we are examining to see
-@@ -1206,9 +1207,33 @@ val_print_array_elements (struct type *type,
+@@ -1578,9 +1579,33 @@ val_print_array_elements (struct type *type,
    /* Number of repetitions we have detected so far.  */
    unsigned int reps;
    LONGEST low_bound, high_bound;
@@ -15793,7 +13747,7 @@ index 325cf40..70a98c2 100644
    index_type = TYPE_INDEX_TYPE (type);
  
    if (get_array_bounds (type, &low_bound, &high_bound))
-@@ -1295,6 +1320,8 @@ val_print_array_elements (struct type *type,
+@@ -1667,6 +1692,8 @@ val_print_array_elements (struct type *type,
      {
        fprintf_filtered (stream, "...");
      }
@@ -15803,18 +13757,18 @@ index 325cf40..70a98c2 100644
  
  /* Read LEN bytes of target memory at address MEMADDR, placing the
 diff --git a/gdb/value.c b/gdb/value.c
-index 583be33..cb73eda 100644
+index a6bb718..7b08d1f 100644
 --- a/gdb/value.c
 +++ b/gdb/value.c
-@@ -41,6 +41,7 @@
- #include "python/python.h"
+@@ -42,6 +42,7 @@
  #include <ctype.h>
  #include "tracepoint.h"
+ #include "cp-abi.h"
 +#include "observer.h"
  
  /* Prototypes for exported functions.  */
  
-@@ -1385,12 +1386,15 @@ void
+@@ -1437,12 +1438,15 @@ void
  set_value_component_location (struct value *component,
                              const struct value *whole)
  {
@@ -15830,7 +13784,7 @@ index 583be33..cb73eda 100644
    if (whole->lval == lval_computed)
      {
        const struct lval_funcs *funcs = whole->location.computed.funcs;
-@@ -1398,6 +1402,12 @@ set_value_component_location (struct value *component,
+@@ -1450,6 +1454,12 @@ set_value_component_location (struct value *component,
        if (funcs->copy_closure)
          component->location.computed.closure = funcs->copy_closure (whole);
      }
@@ -15843,7 +13797,7 @@ index 583be33..cb73eda 100644
  }
  
  \f
-@@ -1531,6 +1541,31 @@ show_values (char *num_exp, int from_tty)
+@@ -1583,6 +1593,31 @@ show_values (char *num_exp, int from_tty)
        num_exp[1] = '\0';
      }
  }
@@ -15875,88 +13829,7 @@ index 583be33..cb73eda 100644
  \f
  /* Internal variables.  These are variables within the debugger
     that hold values assigned by debugger commands.
-@@ -1576,7 +1611,14 @@ struct internalvar
-       struct value *value;
-       /* The call-back routine used with INTERNALVAR_MAKE_VALUE.  */
--      internalvar_make_value make_value;
-+      struct
-+        {
-+        /* The functions to call.  */
-+        const struct internalvar_funcs *functions;
-+
-+        /* The function's user-data.  */
-+        void *data;
-+        } make_value;
-       /* The internal function used with INTERNALVAR_FUNCTION.  */
-       struct
-@@ -1675,18 +1717,39 @@ create_internalvar (const char *name)
- /* Create an internal variable with name NAME and register FUN as the
-    function that value_of_internalvar uses to create a value whenever
-    this variable is referenced.  NAME should not normally include a
--   dollar sign.  */
-+   dollar sign.  DATA is passed uninterpreted to FUN when it is
-+   called.  CLEANUP, if not NULL, is called when the internal variable
-+   is destroyed.  It is passed DATA as its only argument.  */
- struct internalvar *
--create_internalvar_type_lazy (char *name, internalvar_make_value fun)
-+create_internalvar_type_lazy (const char *name,
-+                            const struct internalvar_funcs *funcs,
-+                            void *data)
- {
-   struct internalvar *var = create_internalvar (name);
-   var->kind = INTERNALVAR_MAKE_VALUE;
--  var->u.make_value = fun;
-+  var->u.make_value.functions = funcs;
-+  var->u.make_value.data = data;
-   return var;
- }
-+/* See documentation in value.h.  */
-+
-+int
-+compile_internalvar_to_ax (struct internalvar *var,
-+                         struct agent_expr *expr,
-+                         struct axs_value *value)
-+{
-+  if (var->kind != INTERNALVAR_MAKE_VALUE
-+      || var->u.make_value.functions->compile_to_ax == NULL)
-+    return 0;
-+
-+  var->u.make_value.functions->compile_to_ax (var, expr, value,
-+                                            var->u.make_value.data);
-+  return 1;
-+}
-+
- /* Look up an internal variable with name NAME.  NAME should not
-    normally include a dollar sign.
-@@ -1759,7 +1822,8 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
-       break;
-     case INTERNALVAR_MAKE_VALUE:
--      val = (*var->u.make_value) (gdbarch, var);
-+      val = (*var->u.make_value.functions->make_value) (gdbarch, var,
-+                                                      var->u.make_value.data);
-       break;
-     default:
-@@ -1955,6 +2019,11 @@ clear_internalvar (struct internalvar *var)
-       xfree (var->u.string);
-       break;
-+    case INTERNALVAR_MAKE_VALUE:
-+      if (var->u.make_value.functions->destroy != NULL)
-+      var->u.make_value.functions->destroy (var->u.make_value.data);
-+      break;
-+
-     default:
-       break;
-     }
-@@ -2009,6 +2078,38 @@ call_internal_function (struct gdbarch *gdbarch,
+@@ -2118,6 +2153,38 @@ call_internal_function (struct gdbarch *gdbarch,
    return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv);
  }
  
@@ -15995,7 +13868,7 @@ index 583be33..cb73eda 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
-@@ -2056,11 +2157,10 @@ preserve_one_value (struct value *value, struct objfile *objfile,
+@@ -2165,11 +2232,10 @@ preserve_one_value (struct value *value, struct objfile *objfile,
                    htab_t copied_types)
  {
    if (TYPE_OBJFILE (value->type) == objfile)
@@ -16009,7 +13882,7 @@ index 583be33..cb73eda 100644
                                                 copied_types);
  }
  
-@@ -2075,7 +2175,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile,
+@@ -2184,7 +2250,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile,
      case INTERNALVAR_INTEGER:
        if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile)
        var->u.integer.type
@@ -16018,13 +13891,14 @@ index 583be33..cb73eda 100644
        break;
  
      case INTERNALVAR_VALUE:
-@@ -3137,9 +3237,26 @@ coerce_ref_if_computed (const struct value *arg)
+@@ -3276,10 +3342,27 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
  struct value *
  coerce_ref (struct value *arg)
  {
 -  struct type *value_type_arg_tmp = check_typedef (value_type (arg));
 +  struct type *value_type_arg_tmp;
    struct value *retval;
+   struct type *enc_type;
  
 +  if (TYPE_DYNAMIC (value_type (arg)))
 +    {
@@ -16046,7 +13920,7 @@ index 583be33..cb73eda 100644
    retval = coerce_ref_if_computed (arg);
    if (retval)
      return retval;
-@@ -3241,4 +3358,10 @@ VARIABLE is already initialized."));
+@@ -3386,4 +3469,10 @@ VARIABLE is already initialized."));
    add_prefix_cmd ("function", no_class, function_command, _("\
  Placeholder command for showing help on convenience functions."),
                  &functionlist, "function ", 0, &cmdlist);
@@ -16058,10 +13932,10 @@ index 583be33..cb73eda 100644
 +#endif
  }
 diff --git a/gdb/value.h b/gdb/value.h
-index 4727755..d8d22c8 100644
+index d8b157f..f49e827 100644
 --- a/gdb/value.h
 +++ b/gdb/value.h
-@@ -488,6 +488,10 @@ extern struct value *value_from_decfloat (struct type *type,
+@@ -533,6 +533,10 @@ extern struct value *value_from_decfloat (struct type *type,
                                          const gdb_byte *decbytes);
  extern struct value *value_from_history_ref (char *, char **);
  
@@ -16072,107 +13946,34 @@ index 4727755..d8d22c8 100644
  extern struct value *value_at (struct type *type, CORE_ADDR addr);
  extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
  
-@@ -717,10 +721,52 @@ extern struct internalvar *lookup_only_internalvar (const char *name);
+diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
+index f16588a..afef615 100644
+--- a/gdb/windows-nat.c
++++ b/gdb/windows-nat.c
+@@ -752,7 +752,7 @@ windows_make_so (const char *name, LPVOID load_addr)
+       asection *text = NULL;
+       CORE_ADDR text_vma;
  
- extern struct internalvar *create_internalvar (const char *name);
+-      abfd = bfd_openr (so->so_name, "pei-i386");
++      abfd = gdb_bfd_openr (so->so_name, "pei-i386");
  
--typedef struct value * (*internalvar_make_value) (struct gdbarch *,
--                                                struct internalvar *);
-+/* An internalvar can be dynamically computed by supplying a vector of
-+   function pointers to perform various operations.  */
-+
-+struct internalvar_funcs
-+{
-+  /* Compute the value of the variable.  The DATA argument passed to
-+     the function is the same argument that was passed to
-+     `create_internalvar_type_lazy'.  */
-+
-+  struct value *(*make_value) (struct gdbarch *arch,
-+                             struct internalvar *var,
-+                             void *data);
-+
-+  /* Update the agent expression EXPR with bytecode to compute the
-+     value.  VALUE is the agent value we are updating.  The DATA
-+     argument passed to this function is the same argument that was
-+     passed to `create_internalvar_type_lazy'.  If this pointer is
-+     NULL, then the internalvar cannot be compiled to an agent
-+     expression.  */
-+
-+  void (*compile_to_ax) (struct internalvar *var,
-+                       struct agent_expr *expr,
-+                       struct axs_value *value,
-+                       void *data);
-+
-+  /* If non-NULL, this is called to destroy DATA.  The DATA argument
-+     passed to this function is the same argument that was passed to
-+     `create_internalvar_type_lazy'.  */
-+
-+  void (*destroy) (void *data);
-+};
-+
- extern struct internalvar *
--  create_internalvar_type_lazy (char *name, internalvar_make_value fun);
-+create_internalvar_type_lazy (const char *name,
-+                            const struct internalvar_funcs *funcs,
-+                            void *data);
-+
-+/* Compile an internal variable to an agent expression.  VAR is the
-+   variable to compile; EXPR and VALUE are the agent expression we are
-+   updating.  This will return 0 if there is no known way to compile
-+   VAR, and 1 if VAR was successfully compiled.  It may also throw an
-+   exception on error.  */
-+
-+extern int compile_internalvar_to_ax (struct internalvar *var,
-+                                    struct agent_expr *expr,
-+                                    struct axs_value *value);
+       if (!abfd)
+       return so;
+@@ -762,7 +762,7 @@ windows_make_so (const char *name, LPVOID load_addr)
  
- extern struct internalvar *lookup_internalvar (const char *name);
+       if (!text)
+       {
+-        bfd_close (abfd);
++        gdb_bfd_unref (abfd);
+         return so;
+       }
  
-diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
-index e111d41..18e3180 100644
---- a/gdb/windows-tdep.c
-+++ b/gdb/windows-tdep.c
-@@ -268,7 +268,7 @@ static const struct lval_funcs tlb_value_funcs =
-    if there's no object available.  */
+@@ -773,7 +773,7 @@ windows_make_so (const char *name, LPVOID load_addr)
+                                                  load_addr + 0x1000);
+       cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text);
  
- static struct value *
--tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var)
-+tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
- {
-   if (target_has_stack && !ptid_equal (inferior_ptid, null_ptid))
-     {
-@@ -425,6 +425,15 @@ init_w32_command_list (void)
+-      bfd_close (abfd);
++      gdb_bfd_unref (abfd);
      }
- }
-+/* Implementation of `tlb' variable.  */
-+
-+static const struct internalvar_funcs tlb_funcs =
-+{
-+  tlb_make_value,
-+  NULL,
-+  NULL
-+};
-+
- void
- _initialize_windows_tdep (void)
- {
-@@ -451,5 +460,5 @@ even if their meaning is unknown."),
-      value with a void typed value, and when we get here, gdbarch
-      isn't initialized yet.  At this point, we're quite sure there
-      isn't another convenience variable of the same name.  */
--  create_internalvar_type_lazy ("_tlb", tlb_make_value);
-+  create_internalvar_type_lazy ("_tlb", &tlb_funcs, NULL);
- }
-diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
-index 1a2bb14..d43e946 100644
---- a/gdb/xcoffread.c
-+++ b/gdb/xcoffread.c
-@@ -3123,6 +3123,7 @@ static const struct sym_fns xcoff_sym_fns =
-   default_symfile_segments,   /* Get segment information from a file.  */
-   aix_process_linenos,
-   default_symfile_relocate,   /* Relocate a debug section.  */
-+  NULL,                               /* sym_probe_fns */
-   &psym_functions
- };
+ #endif
  
diff --git a/gdb-attach-fail-reasons-1of5.patch b/gdb-attach-fail-reasons-1of5.patch
deleted file mode 100644 (file)
index 4c547d8..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-http://sourceware.org/ml/gdb-cvs/2012-02/msg00180.html
-
-### src/gdb/gdbserver/ChangeLog        2012/02/25 19:54:50     1.556
-### src/gdb/gdbserver/ChangeLog        2012/02/27 16:19:19     1.557
-## -1,3 +1,9 @@
-+2012-02-27  Pedro Alves  <palves@redhat.com>
-+
-+      PR server/9684
-+      * linux-low.c (pid_is_stopped): New.
-+      (linux_attach_lwp_1): Handle attaching to 'T (stopped)' processes.
-+
- 2012-02-25  Luis Machado  <lgustavo@codesourcery.com>
-       * mem-break.c (clear_gdb_breakpoint_conditions): Fix de-allocation
---- src/gdb/gdbserver/linux-low.c      2012/02/24 15:15:56     1.193
-+++ src/gdb/gdbserver/linux-low.c      2012/02/27 16:19:19     1.194
-@@ -598,6 +598,37 @@
-   return pid;
- }
-+/* Detect `T (stopped)' in `/proc/PID/status'.
-+   Other states including `T (tracing stop)' are reported as false.  */
-+
-+static int
-+pid_is_stopped (pid_t pid)
-+{
-+  FILE *status_file;
-+  char buf[100];
-+  int retval = 0;
-+
-+  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
-+  status_file = fopen (buf, "r");
-+  if (status_file != NULL)
-+    {
-+      int have_state = 0;
-+
-+      while (fgets (buf, sizeof (buf), status_file))
-+      {
-+        if (strncmp (buf, "State:", 6) == 0)
-+          {
-+            have_state = 1;
-+            break;
-+          }
-+      }
-+      if (have_state && strstr (buf, "T (stopped)") != NULL)
-+      retval = 1;
-+      fclose (status_file);
-+    }
-+  return retval;
-+}
-+
- /* Attach to an inferior process.  */
- static void
-@@ -643,6 +674,33 @@
-      ptrace call on this LWP.  */
-   new_lwp->must_set_ptrace_flags = 1;
-+  if (pid_is_stopped (lwpid))
-+    {
-+      if (debug_threads)
-+      fprintf (stderr,
-+               "Attached to a stopped process\n");
-+
-+      /* The process is definitely stopped.  It is in a job control
-+       stop, unless the kernel predates the TASK_STOPPED /
-+       TASK_TRACED distinction, in which case it might be in a
-+       ptrace stop.  Make sure it is in a ptrace stop; from there we
-+       can kill it, signal it, et cetera.
-+
-+       First make sure there is a pending SIGSTOP.  Since we are
-+       already attached, the process can not transition from stopped
-+       to running without a PTRACE_CONT; so we know this signal will
-+       go into the queue.  The SIGSTOP generated by PTRACE_ATTACH is
-+       probably already in the queue (unless this kernel is old
-+       enough to use TASK_STOPPED for ptrace stops); but since
-+       SIGSTOP is not an RT signal, it can only be queued once.  */
-+      kill_lwp (lwpid, SIGSTOP);
-+
-+      /* Finally, resume the stopped process.  This will deliver the
-+       SIGSTOP (or a higher priority signal, just like normal
-+       PTRACE_ATTACH), which we'll catch later on.  */
-+      ptrace (PTRACE_CONT, lwpid, 0, 0);
-+    }
-+
-   /* The next time we wait for this LWP we'll see a SIGSTOP as PTRACE_ATTACH
-      brings it to a halt.
diff --git a/gdb-attach-fail-reasons-2of5.patch b/gdb-attach-fail-reasons-2of5.patch
deleted file mode 100644 (file)
index 92565b9..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-http://sourceware.org/ml/gdb-cvs/2012-02/msg00181.html
-
-### src/gdb/ChangeLog  2012/02/24 23:48:37     1.13869
-### src/gdb/ChangeLog  2012/02/27 16:22:06     1.13870
-## -1,3 +1,13 @@
-+2012-02-27  Pedro Alves  <palves@redhat.com>
-+
-+      * linux-nat.c (pid_is_stopped): Delete, moved to common/.
-+      (linux_nat_post_attach_wait): Adjust to use
-+      linux_proc_pid_is_stopped.
-+      * common/linux-procfs.h (linux_proc_pid_is_stopped): Declare.
-+      * common/linux-procfs.c (linux_proc_pid_is_stopped): New function,
-+      based on pid_is_stopped from both linux-nat.c and
-+      gdbserver/linux-low.c, and renamed.
-+
- 2012-02-24  Maciej W. Rozycki  <macro@codesourcery.com>
-       * remote.c (remote_watchpoint_addr_within_range): New function.
---- src/gdb/linux-nat.c        2012/02/16 21:07:20     1.239
-+++ src/gdb/linux-nat.c        2012/02/27 16:22:13     1.240
-@@ -1356,37 +1356,6 @@
-   delete_lwp (lp->ptid);
- }
--/* Detect `T (stopped)' in `/proc/PID/status'.
--   Other states including `T (tracing stop)' are reported as false.  */
--
--static int
--pid_is_stopped (pid_t pid)
--{
--  FILE *status_file;
--  char buf[100];
--  int retval = 0;
--
--  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
--  status_file = fopen (buf, "r");
--  if (status_file != NULL)
--    {
--      int have_state = 0;
--
--      while (fgets (buf, sizeof (buf), status_file))
--      {
--        if (strncmp (buf, "State:", 6) == 0)
--          {
--            have_state = 1;
--            break;
--          }
--      }
--      if (have_state && strstr (buf, "T (stopped)") != NULL)
--      retval = 1;
--      fclose (status_file);
--    }
--  return retval;
--}
--
- /* Wait for the LWP specified by LP, which we have just attached to.
-    Returns a wait status for that LWP, to cache.  */
-@@ -1397,7 +1366,7 @@
-   pid_t new_pid, pid = GET_LWP (ptid);
-   int status;
--  if (pid_is_stopped (pid))
-+  if (linux_proc_pid_is_stopped (pid))
-     {
-       if (debug_linux_nat)
-       fprintf_unfiltered (gdb_stdlog,
---- src/gdb/common/linux-procfs.c      2012/01/04 08:17:18     1.2
-+++ src/gdb/common/linux-procfs.c      2012/02/27 16:22:14     1.3
-@@ -53,3 +53,34 @@
-   return tgid;
- }
-+
-+/* Detect `T (stopped)' in `/proc/PID/status'.
-+   Other states including `T (tracing stop)' are reported as false.  */
-+
-+int
-+linux_proc_pid_is_stopped (pid_t pid)
-+{
-+  FILE *status_file;
-+  char buf[100];
-+  int retval = 0;
-+
-+  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
-+  status_file = fopen (buf, "r");
-+  if (status_file != NULL)
-+    {
-+      int have_state = 0;
-+
-+      while (fgets (buf, sizeof (buf), status_file))
-+      {
-+        if (strncmp (buf, "State:", 6) == 0)
-+          {
-+            have_state = 1;
-+            break;
-+          }
-+      }
-+      if (have_state && strstr (buf, "T (stopped)") != NULL)
-+      retval = 1;
-+      fclose (status_file);
-+    }
-+  return retval;
-+}
---- src/gdb/common/linux-procfs.h      2012/01/04 08:17:18     1.2
-+++ src/gdb/common/linux-procfs.h      2012/02/27 16:22:15     1.3
-@@ -26,4 +26,9 @@
- extern int linux_proc_get_tgid (int lwpid);
-+/* Detect `T (stopped)' in `/proc/PID/status'.
-+   Other states including `T (tracing stop)' are reported as false.  */
-+
-+extern int linux_proc_pid_is_stopped (pid_t pid);
-+
- #endif /* COMMON_LINUX_PROCFS_H */
-### src/gdb/gdbserver/ChangeLog        2012/02/27 16:19:19     1.557
-### src/gdb/gdbserver/ChangeLog        2012/02/27 16:22:15     1.558
-## -1,5 +1,10 @@
- 2012-02-27  Pedro Alves  <palves@redhat.com>
-+      * linux-low.c (pid_is_stopped): Delete, moved to common/.
-+      (linux_attach_lwp_1): Adjust to use linux_proc_pid_is_stopped.
-+
-+2012-02-27  Pedro Alves  <palves@redhat.com>
-+
-       PR server/9684
-       * linux-low.c (pid_is_stopped): New.
-       (linux_attach_lwp_1): Handle attaching to 'T (stopped)' processes.
---- src/gdb/gdbserver/linux-low.c      2012/02/27 16:19:19     1.194
-+++ src/gdb/gdbserver/linux-low.c      2012/02/27 16:22:16     1.195
-@@ -598,37 +598,6 @@
-   return pid;
- }
--/* Detect `T (stopped)' in `/proc/PID/status'.
--   Other states including `T (tracing stop)' are reported as false.  */
--
--static int
--pid_is_stopped (pid_t pid)
--{
--  FILE *status_file;
--  char buf[100];
--  int retval = 0;
--
--  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
--  status_file = fopen (buf, "r");
--  if (status_file != NULL)
--    {
--      int have_state = 0;
--
--      while (fgets (buf, sizeof (buf), status_file))
--      {
--        if (strncmp (buf, "State:", 6) == 0)
--          {
--            have_state = 1;
--            break;
--          }
--      }
--      if (have_state && strstr (buf, "T (stopped)") != NULL)
--      retval = 1;
--      fclose (status_file);
--    }
--  return retval;
--}
--
- /* Attach to an inferior process.  */
- static void
-@@ -674,7 +643,7 @@
-      ptrace call on this LWP.  */
-   new_lwp->must_set_ptrace_flags = 1;
--  if (pid_is_stopped (lwpid))
-+  if (linux_proc_pid_is_stopped (lwpid))
-     {
-       if (debug_threads)
-       fprintf (stderr,
diff --git a/gdb-attach-fail-reasons-3of5.patch b/gdb-attach-fail-reasons-3of5.patch
deleted file mode 100644 (file)
index a16618e..0000000
+++ /dev/null
@@ -1,583 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-03/msg00169.html
-Subject: [patch 1/3] attach-fail-reasons: Reshuffle code
-
-Hi,
-
-this patch does not make sense on its own but it contains all the
-uninteresting code moves / reconfigurations.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * Makefile.in (linux-ptrace.o): New.
-       * common/linux-procfs.c (linux_proc_pid_is_zombie): New,
-       from linux-nat.c.
-       * common/linux-procfs.h (linux_proc_pid_is_zombie): New declaration.
-       * common/linux-ptrace.c: New file.
-       * config/alpha/alpha-linux.mh (NATDEPFILES): Add linux-ptrace.o.
-       * config/arm/linux.mh: Likewise.
-       * config/i386/linux.mh: Likewise.
-       * config/i386/linux64.mh: Likewise.
-       * config/ia64/linux.mh: Likewise.
-       * config/m32r/linux.mh: Likewise.
-       * config/m68k/linux.mh: Likewise.
-       * config/mips/linux.mh: Likewise.
-       * config/pa/linux.mh: Likewise.
-       * config/powerpc/linux.mh: Likewise.
-       * config/powerpc/ppc64-linux.mh: Likewise.
-       * config/powerpc/spu-linux.mh: Likewise.
-       * config/s390/s390.mh: Likewise.
-       * config/sparc/linux.mh: Likewise.
-       * config/sparc/linux64.mh: Likewise.
-       * config/xtensa/linux.mh: Likewise.
-       * linux-nat.c (linux_lwp_is_zombie): Remove, move it to
-       common/linux-procfs.c.
-       (wait_lwp): Rename linux_lwp_is_zombie to linux_proc_pid_is_zombie.
-
-gdb/gdbserver/
-2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * Makefile.in (linux-ptrace.o): New.
-       * configure.srv (arm*-*-linux*, bfin-*-*linux*, crisv32-*-linux*)
-       (cris-*-linux*, i[34567]86-*-linux*, ia64-*-linux*, m32r*-*-linux*)
-       (m68*-*-linux*, m68*-*-uclinux*, mips*-*-linux*, powerpc*-*-linux*)
-       (s390*-*-linux*, sh*-*-linux*, sparc*-*-linux*, tic6x-*-uclinux)
-       (x86_64-*-linux*, xtensa*-*-linux*): Add linux-ptrace.o to SRV_TGTOBJ
-       of these targets.
-       * linux-low.c (linux_attach_lwp_1): Remove redundent else clause.
-
-Index: gdb-7.4.50.20120120/gdb/Makefile.in
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/Makefile.in   2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/Makefile.in        2012-03-06 07:39:50.771713128 +0100
-@@ -1968,6 +1968,10 @@ linux-procfs.o: $(srcdir)/common/linux-p
-       $(COMPILE) $(srcdir)/common/linux-procfs.c
-       $(POSTCOMPILE)
-+linux-ptrace.o: $(srcdir)/common/linux-ptrace.c
-+      $(COMPILE) $(srcdir)/common/linux-ptrace.c
-+      $(POSTCOMPILE)
-+
- #
- # gdb/tui/ dependencies
- #
-Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.c 2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.c      2012-03-06 07:39:50.771713128 +0100
-@@ -84,3 +84,34 @@ linux_proc_pid_is_stopped (pid_t pid)
-     }
-   return retval;
- }
-+
-+/* See linux-procfs.h declaration.  */
-+
-+int
-+linux_proc_pid_is_zombie (pid_t pid)
-+{
-+  char buffer[100];
-+  FILE *procfile;
-+  int retval;
-+  int have_state;
-+
-+  xsnprintf (buffer, sizeof (buffer), "/proc/%d/status", (int) pid);
-+  procfile = fopen (buffer, "r");
-+  if (procfile == NULL)
-+    {
-+      warning (_("unable to open /proc file '%s'"), buffer);
-+      return 0;
-+    }
-+
-+  have_state = 0;
-+  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
-+    if (strncmp (buffer, "State:", 6) == 0)
-+      {
-+      have_state = 1;
-+      break;
-+      }
-+  retval = (have_state
-+          && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
-+  fclose (procfile);
-+  return retval;
-+}
-Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.h
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.h 2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.h      2012-03-06 07:39:50.771713128 +0100
-@@ -31,4 +31,8 @@ extern int linux_proc_get_tgid (int lwpi
- extern int linux_proc_pid_is_stopped (pid_t pid);
-+/* Return non-zero if PID is a zombie.  */
-+
-+extern int linux_proc_pid_is_zombie (pid_t pid);
-+
- #endif /* COMMON_LINUX_PROCFS_H */
-Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.c      2012-03-06 07:39:50.771713128 +0100
-@@ -0,0 +1,26 @@
-+/* Linux-specific ptrace manipulation routines.
-+   Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.  */
-+
-+#ifdef GDBSERVER
-+#include "server.h"
-+#else
-+#include "defs.h"
-+#include "gdb_string.h"
-+#endif
-+
-+#include "linux-ptrace.h"
-Index: gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/alpha/alpha-linux.mh   2012-01-10 17:30:44.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/alpha/alpha-linux.mh        2012-03-06 07:39:50.771713128 +0100
-@@ -2,7 +2,7 @@
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o alpha-linux-nat.o \
-       fork-child.o proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20120120/gdb/config/arm/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/arm/linux.mh   2011-08-24 14:07:25.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/arm/linux.mh        2012-03-06 07:39:50.772713125 +0100
-@@ -3,7 +3,7 @@
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o arm-linux-nat.o \
-       proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES= -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/i386/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/i386/linux.mh  2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/i386/linux.mh       2012-03-06 07:39:50.772713125 +0100
-@@ -4,7 +4,7 @@ NAT_FILE= nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o \
-       i386-nat.o i386-linux-nat.o \
-       proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20120120/gdb/config/i386/linux64.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/i386/linux64.mh        2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/i386/linux64.mh     2012-03-06 07:39:50.772713125 +0100
-@@ -3,7 +3,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
-       i386-nat.o amd64-nat.o amd64-linux-nat.o \
-       linux-nat.o linux-osdata.o \
-       proc-service.o linux-thread-db.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_FILE= nm-linux64.h
- NAT_CDEPS = $(srcdir)/proc-service.list
-Index: gdb-7.4.50.20120120/gdb/config/ia64/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/ia64/linux.mh  2012-01-10 17:30:44.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/ia64/linux.mh       2012-03-06 07:39:50.772713125 +0100
-@@ -5,7 +5,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
-       core-regset.o ia64-linux-nat.o \
-       proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/m32r/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/m32r/linux.mh  2012-01-10 17:30:44.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/m32r/linux.mh       2012-03-06 07:39:50.773713122 +0100
-@@ -3,7 +3,7 @@
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o                                \
-       m32r-linux-nat.o proc-service.o linux-thread-db.o       \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES= -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/m68k/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/m68k/linux.mh  2012-01-10 17:30:45.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/m68k/linux.mh       2012-03-06 07:39:50.773713122 +0100
-@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o \
-       m68klinux-nat.o \
-       proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20120120/gdb/config/mips/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/mips/linux.mh  2011-08-24 14:07:26.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/mips/linux.mh       2012-03-06 07:39:50.773713122 +0100
-@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
-       linux-thread-db.o proc-service.o \
-       linux-nat.o linux-osdata.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/pa/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/pa/linux.mh    2012-01-10 17:30:45.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/pa/linux.mh 2012-03-06 07:39:50.773713122 +0100
-@@ -3,7 +3,7 @@ NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o \
-       hppa-linux-nat.o proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/powerpc/linux.mh       2011-08-24 14:07:27.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/powerpc/linux.mh    2012-03-06 07:39:50.773713122 +0100
-@@ -5,7 +5,7 @@ XM_CLIBS=
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o \
-       ppc-linux-nat.o proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/powerpc/ppc64-linux.mh 2011-08-24 14:07:27.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/powerpc/ppc64-linux.mh      2012-03-06 07:39:50.774713118 +0100
-@@ -5,7 +5,7 @@ XM_CLIBS=
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o \
-       ppc-linux-nat.o proc-service.o linux-thread-db.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The PowerPC has severe limitations on TOC size, and uses them even
-Index: gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/powerpc/spu-linux.mh   2011-08-24 14:07:27.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/powerpc/spu-linux.mh        2012-03-06 07:39:50.774713118 +0100
-@@ -4,5 +4,5 @@
- # PPU side of the Cell BE and debugging the SPU side.
- NATDEPFILES = spu-linux-nat.o fork-child.o inf-ptrace.o \
--            linux-procfs.o
-+            linux-procfs.o linux-ptrace.o
-Index: gdb-7.4.50.20120120/gdb/config/s390/s390.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/s390/s390.mh   2012-01-05 18:07:05.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/s390/s390.mh        2012-03-06 07:39:50.774713118 +0100
-@@ -2,6 +2,6 @@
- NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o s390-nat.o \
-       linux-thread-db.o proc-service.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/config/sparc/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux.mh 2012-01-10 17:30:49.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/sparc/linux.mh      2012-03-06 07:39:50.774713118 +0100
-@@ -4,7 +4,7 @@ NATDEPFILES= sparc-nat.o sparc-linux-nat
-       core-regset.o fork-child.o inf-ptrace.o \
-       proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/sparc/linux64.mh       2012-01-10 17:30:49.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/config/sparc/linux64.mh    2012-03-06 07:39:50.775713114 +0100
-@@ -5,7 +5,7 @@ NATDEPFILES= sparc-nat.o sparc64-nat.o s
-       fork-child.o inf-ptrace.o \
-       proc-service.o linux-thread-db.o \
-       linux-nat.o linux-osdata.o linux-fork.o \
--      linux-procfs.o
-+      linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/config/xtensa/linux.mh        2011-08-24 14:07:27.000000000 +0200
-+++ gdb-7.4.50.20120120/gdb/config/xtensa/linux.mh     2012-03-06 07:39:50.775713114 +0100
-@@ -4,7 +4,7 @@ NAT_FILE= config/nm-linux.h
- NATDEPFILES= inf-ptrace.o fork-child.o xtensa-linux-nat.o \
-       linux-thread-db.o proc-service.o \
--      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
-+      linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
- NAT_CDEPS = $(srcdir)/proc-service.list
- LOADLIBES = -ldl $(RDYNAMIC)
-Index: gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/gdbserver/Makefile.in 2012-01-04 09:17:23.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/gdbserver/Makefile.in      2012-03-06 07:39:50.775713114 +0100
-@@ -408,6 +408,9 @@ signals.o: ../common/signals.c $(server_
- linux-procfs.o: ../common/linux-procfs.c $(server_h)
-       $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
-+linux-ptrace.o: ../common/linux-ptrace.c $(server_h)
-+      $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
-+
- common-utils.o: ../common/common-utils.c $(server_h)
-       $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
-Index: gdb-7.4.50.20120120/gdb/gdbserver/configure.srv
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/gdbserver/configure.srv       2011-12-06 15:14:49.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/gdbserver/configure.srv    2012-03-06 07:39:50.775713114 +0100
-@@ -47,6 +47,7 @@ case "${target}" in
-                       srv_regobj="${srv_regobj} arm-with-vfpv3.o"
-                       srv_regobj="${srv_regobj} arm-with-neon.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-arm-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_xmlfiles="arm-with-iwmmxt.xml"
-                       srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv2.xml"
-                       srv_xmlfiles="${srv_xmlfiles} arm-with-vfpv3.xml"
-@@ -69,16 +70,19 @@ case "${target}" in
-                       ;;
-   bfin-*-*linux*)     srv_regobj=reg-bfin.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-bfin-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_thread_db=yes
-                       ;;
-   crisv32-*-linux*)   srv_regobj=reg-crisv32.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-crisv32-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-                       ;;
-   cris-*-linux*)      srv_regobj=reg-cris.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-cris-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_thread_db=yes
-                       ;;
-@@ -93,6 +97,7 @@ case "${target}" in
-                           srv_xmlfiles="${srv_xmlfiles} $srv_amd64_linux_xmlfiles"
-                       fi
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-@@ -124,10 +129,12 @@ case "${target}" in
-                       ;;
-   ia64-*-linux*)      srv_regobj=reg-ia64.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-ia64-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       ;;
-   m32r*-*-linux*)     srv_regobj=reg-m32r.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m32r-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_thread_db=yes
-                       ;;
-@@ -137,6 +144,7 @@ case "${target}" in
-                           srv_regobj=reg-m68k.o
-                         fi
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-@@ -147,12 +155,14 @@ case "${target}" in
-                           srv_regobj=reg-m68k.o
-                         fi
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-m68k-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-                       ;;
-   mips*-*-linux*)     srv_regobj="mips-linux.o mips64-linux.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-mips-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_xmlfiles="mips-linux.xml"
-                       srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
-                       srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
-@@ -181,6 +191,7 @@ case "${target}" in
-                       srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
-                       srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-ppc-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_xmlfiles="rs6000/powerpc-32l.xml"
-                       srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
-                       srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-cell32l.xml"
-@@ -223,6 +234,7 @@ case "${target}" in
-                       srv_regobj="${srv_regobj} s390x-linux64v1.o"
-                       srv_regobj="${srv_regobj} s390x-linux64v2.o"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-s390-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_xmlfiles="s390-linux32.xml"
-                       srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
-                       srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
-@@ -243,12 +255,14 @@ case "${target}" in
-                       ;;
-   sh*-*-linux*)               srv_regobj=reg-sh.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-sh-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_usrregs=yes
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-                       ;;
-   sparc*-*-linux*)    srv_regobj=reg-sparc64.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-sparc-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_regsets=yes
-                       srv_linux_thread_db=yes
-                       ;;
-@@ -265,12 +279,14 @@ case "${target}" in
-                       srv_xmlfiles="${srv_xmlfiles} tic6x-gp.xml"
-                       srv_xmlfiles="${srv_xmlfiles} tic6x-c6xp.xml"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-tic6x-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_regsets=yes
-                       srv_linux_usrregs=yes
-                       srv_linux_thread_db=yes
-                       ;;
-   x86_64-*-linux*)    srv_regobj="$srv_amd64_linux_regobj $srv_i386_linux_regobj"
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-x86-low.o i386-low.o i387-fp.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_xmlfiles="$srv_i386_linux_xmlfiles $srv_amd64_linux_xmlfiles"
-                       srv_linux_usrregs=yes # This is for i386 progs.
-                       srv_linux_regsets=yes
-@@ -285,6 +301,7 @@ case "${target}" in
-   xtensa*-*-linux*)   srv_regobj=reg-xtensa.o
-                       srv_tgtobj="linux-low.o linux-osdata.o linux-xtensa-low.o linux-procfs.o"
-+                      srv_tgtobj="${srv_tgtobj} linux-ptrace.o"
-                       srv_linux_regsets=yes
-                       ;;
-   *)                  echo "Error: target not supported by gdbserver."
-Index: gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/gdbserver/linux-low.c 2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c      2012-03-06 07:39:50.776713111 +0100
-@@ -630,10 +630,10 @@ linux_attach_lwp_1 (unsigned long lwpid,
-         fflush (stderr);
-         return;
-       }
--      else
--      /* If we fail to attach to a process, report an error.  */
--      error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
--             strerror (errno), errno);
-+
-+      /* If we fail to attach to a process, report an error.  */
-+      error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
-+           strerror (errno), errno);
-     }
-   if (initial)
-Index: gdb-7.4.50.20120120/gdb/linux-nat.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/linux-nat.c   2012-03-06 07:39:41.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/linux-nat.c        2012-03-06 07:39:50.777713108 +0100
-@@ -2464,37 +2464,6 @@ linux_handle_extended_wait (struct lwp_i
-                 _("unknown ptrace event %d"), event);
- }
--/* Return non-zero if LWP is a zombie.  */
--
--static int
--linux_lwp_is_zombie (long lwp)
--{
--  char buffer[MAXPATHLEN];
--  FILE *procfile;
--  int retval;
--  int have_state;
--
--  xsnprintf (buffer, sizeof (buffer), "/proc/%ld/status", lwp);
--  procfile = fopen (buffer, "r");
--  if (procfile == NULL)
--    {
--      warning (_("unable to open /proc file '%s'"), buffer);
--      return 0;
--    }
--
--  have_state = 0;
--  while (fgets (buffer, sizeof (buffer), procfile) != NULL)
--    if (strncmp (buffer, "State:", 6) == 0)
--      {
--      have_state = 1;
--      break;
--      }
--  retval = (have_state
--          && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
--  fclose (procfile);
--  return retval;
--}
--
- /* Wait for LP to stop.  Returns the wait status, or 0 if the LWP has
-    exited.  */
-@@ -2548,10 +2517,10 @@ wait_lwp (struct lwp_info *lp)
-        This is racy, what if the tgl becomes a zombie right after we check?
-        Therefore always use WNOHANG with sigsuspend - it is equivalent to
--       waiting waitpid but the linux_lwp_is_zombie is safe this way.  */
-+       waiting waitpid but linux_proc_pid_is_zombie is safe this way.  */
-       if (GET_PID (lp->ptid) == GET_LWP (lp->ptid)
--        && linux_lwp_is_zombie (GET_LWP (lp->ptid)))
-+        && linux_proc_pid_is_zombie (GET_LWP (lp->ptid)))
-       {
-         thread_dead = 1;
-         if (debug_linux_nat)
-@@ -3431,7 +3400,7 @@ check_zombie_leaders (void)
-         /* Check if there are other threads in the group, as we may
-            have raced with the inferior simply exiting.  */
-         && num_lwps (inf->pid) > 1
--        && linux_lwp_is_zombie (inf->pid))
-+        && linux_proc_pid_is_zombie (inf->pid))
-       {
-         if (debug_linux_nat)
-           fprintf_unfiltered (gdb_stdlog,
diff --git a/gdb-attach-fail-reasons-4of5.patch b/gdb-attach-fail-reasons-4of5.patch
deleted file mode 100644 (file)
index 564ee72..0000000
+++ /dev/null
@@ -1,402 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-03/msg00170.html
-Subject: [patch 2/3] attach-fail-reasons: Say more than ptrace: Operation not permitted.
-
-Hi,
-
-There is a common question on #gdb and also already described:
-
-http://sourceware.org/gdb/wiki/FAQ
-16. Getting an internal error or other error while attaching to processes on
-    GNU/Linux
-->
-    Try setenforce 0 (SELinux) or echo 0 >/proc/sys/kernel/yama/ptrace_scope
-    (ptrace scope) to disable system security protections. 
-
-and here is a patch to give some explanations.
-
-More reasons can be given later, this is a container for them and it contains
-some useful ones already.
-
-No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu and with
-non-extended gdbserver.
-
-The testcase does not test gdbserver, somehow it is a bit difficult without
-having shell on target.
-
-Attaching to process 27480
-ptrace: Operation not permitted.
-(gdb) _
-->
-Attaching to process 27480
-warning: process 27480 is already traced by process 29011
-ptrace: Operation not permitted.
-(gdb) _
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * common/linux-procfs.c (linux_proc_get_int): New, from
-       linux_proc_get_tgid.
-       (linux_proc_get_tgid): Only call linux_proc_get_int.
-       (linux_proc_get_tracerpid): New.
-       (linux_proc_pid_has_state): New, from linux_proc_pid_is_zombie.
-       (linux_proc_pid_is_stopped, linux_proc_pid_is_zombie): Only call
-       linux_proc_pid_has_state.
-       * common/linux-procfs.h (linux_proc_get_tracerpid): New declaration.
-       * common/linux-ptrace.c: Include linux-procfs.h.
-       (linux_ptrace_attach_warnings): New.
-       * common/linux-ptrace.h (linux_ptrace_attach_warnings): New declaration.
-       * linux-nat.c: Include exceptions.h and linux-ptrace.h.
-       (linux_nat_attach): New variable ex.  Wrap to_attach by TRY_CATCH and
-       call linux_ptrace_attach_warnings.
-
-gdb/gdbserver/
-2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * linux-low.c (linux_attach_lwp_1): Call linux_ptrace_attach_warnings.
-
-gdb/testsuite/
-2012-03-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * gdb.base/attach-twice.c: New files.
-       * gdb.base/attach-twice.exp: New files.
-
-Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.c 2012-03-06 07:34:00.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.c      2012-03-06 07:34:17.586816449 +0100
-@@ -28,67 +28,54 @@
- /* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
-    found.  */
--int
--linux_proc_get_tgid (int lwpid)
-+static int
-+linux_proc_get_int (int lwpid, const char *field)
- {
-+  size_t field_len = strlen (field);
-   FILE *status_file;
-   char buf[100];
--  int tgid = -1;
-+  int retval = -1;
-   snprintf (buf, sizeof (buf), "/proc/%d/status", (int) lwpid);
-   status_file = fopen (buf, "r");
--  if (status_file != NULL)
-+  if (status_file == NULL)
-     {
--      while (fgets (buf, sizeof (buf), status_file))
--      {
--        if (strncmp (buf, "Tgid:", 5) == 0)
--          {
--            tgid = strtoul (buf + strlen ("Tgid:"), NULL, 10);
--            break;
--          }
--      }
--
--      fclose (status_file);
-+      warning (_("unable to open /proc file '%s'"), buf);
-+      return -1;
-     }
--  return tgid;
-+  while (fgets (buf, sizeof (buf), status_file))
-+    if (strncmp (buf, field, field_len) == 0 && buf[field_len] == ':')
-+      {
-+      retval = strtol (&buf[field_len + 1], NULL, 10);
-+      break;
-+      }
-+
-+  fclose (status_file);
-+  return retval;
- }
--/* Detect `T (stopped)' in `/proc/PID/status'.
--   Other states including `T (tracing stop)' are reported as false.  */
-+/* Return the TGID of LWPID from /proc/pid/status.  Returns -1 if not
-+   found.  */
- int
--linux_proc_pid_is_stopped (pid_t pid)
-+linux_proc_get_tgid (int lwpid)
- {
--  FILE *status_file;
--  char buf[100];
--  int retval = 0;
-+  return linux_proc_get_int (lwpid, "Tgid");
-+}
--  snprintf (buf, sizeof (buf), "/proc/%d/status", (int) pid);
--  status_file = fopen (buf, "r");
--  if (status_file != NULL)
--    {
--      int have_state = 0;
-+/* See linux-procfs.h.  */
--      while (fgets (buf, sizeof (buf), status_file))
--      {
--        if (strncmp (buf, "State:", 6) == 0)
--          {
--            have_state = 1;
--            break;
--          }
--      }
--      if (have_state && strstr (buf, "T (stopped)") != NULL)
--      retval = 1;
--      fclose (status_file);
--    }
--  return retval;
-+pid_t
-+linux_proc_get_tracerpid (int lwpid)
-+{
-+  return linux_proc_get_int (lwpid, "TracerPid");
- }
--/* See linux-procfs.h declaration.  */
-+/* Return non-zero if 'State' of /proc/PID/status contains STATE.  */
--int
--linux_proc_pid_is_zombie (pid_t pid)
-+static int
-+linux_proc_pid_has_state (pid_t pid, const char *state)
- {
-   char buffer[100];
-   FILE *procfile;
-@@ -110,8 +97,24 @@ linux_proc_pid_is_zombie (pid_t pid)
-       have_state = 1;
-       break;
-       }
--  retval = (have_state
--          && strcmp (buffer, "State:\tZ (zombie)\n") == 0);
-+  retval = (have_state && strstr (buffer, state) != NULL);
-   fclose (procfile);
-   return retval;
- }
-+
-+/* Detect `T (stopped)' in `/proc/PID/status'.
-+   Other states including `T (tracing stop)' are reported as false.  */
-+
-+int
-+linux_proc_pid_is_stopped (pid_t pid)
-+{
-+  return linux_proc_pid_has_state (pid, "T (stopped)");
-+}
-+
-+/* See linux-procfs.h declaration.  */
-+
-+int
-+linux_proc_pid_is_zombie (pid_t pid)
-+{
-+  return linux_proc_pid_has_state (pid, "Z (zombie)");
-+}
-Index: gdb-7.4.50.20120120/gdb/common/linux-procfs.h
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-procfs.h 2012-03-06 07:34:00.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-procfs.h      2012-03-06 07:34:17.586816449 +0100
-@@ -26,6 +26,11 @@
- extern int linux_proc_get_tgid (int lwpid);
-+/* Return the TracerPid of LWPID from /proc/pid/status.  Returns -1 if not
-+   found.  */
-+
-+extern pid_t linux_proc_get_tracerpid (int lwpid);
-+
- /* Detect `T (stopped)' in `/proc/PID/status'.
-    Other states including `T (tracing stop)' are reported as false.  */
-Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-ptrace.c 2012-03-06 07:34:00.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.c      2012-03-06 07:34:17.586816449 +0100
-@@ -24,3 +24,21 @@
- #endif
- #include "linux-ptrace.h"
-+#include "linux-procfs.h"
-+
-+/* Print all possible reasons we could fail to attach PID.  */
-+
-+void
-+linux_ptrace_attach_warnings (pid_t pid)
-+{
-+  pid_t tracerpid;
-+
-+  tracerpid = linux_proc_get_tracerpid (pid);
-+  if (tracerpid > 0)
-+    warning (_("process %d is already traced by process %d"), (int) pid,
-+           (int) tracerpid);
-+
-+  if (linux_proc_pid_is_zombie (pid))
-+    warning (_("process %d is a zombie - the process has already terminated"),
-+           (int) pid);
-+}
-Index: gdb-7.4.50.20120120/gdb/common/linux-ptrace.h
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/common/linux-ptrace.h 2012-01-04 09:17:18.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/common/linux-ptrace.h      2012-03-06 07:34:17.586816449 +0100
-@@ -65,4 +65,6 @@
- #define __WALL          0x40000000 /* Wait for any child.  */
- #endif
-+extern void linux_ptrace_attach_warnings (pid_t pid);
-+
- #endif /* COMMON_LINUX_PTRACE_H */
-Index: gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/gdbserver/linux-low.c 2012-03-06 07:34:00.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/gdbserver/linux-low.c      2012-03-06 07:34:17.587816446 +0100
-@@ -632,6 +632,7 @@ linux_attach_lwp_1 (unsigned long lwpid,
-       }
-       /* If we fail to attach to a process, report an error.  */
-+      linux_ptrace_attach_warnings (lwpid);
-       error ("Cannot attach to lwp %ld: %s (%d)\n", lwpid,
-            strerror (errno), errno);
-     }
-Index: gdb-7.4.50.20120120/gdb/linux-nat.c
-===================================================================
---- gdb-7.4.50.20120120.orig/gdb/linux-nat.c   2012-03-06 07:34:00.000000000 +0100
-+++ gdb-7.4.50.20120120/gdb/linux-nat.c        2012-03-06 07:34:29.860775803 +0100
-@@ -59,6 +59,8 @@
- #include "solib.h"
- #include "linux-osdata.h"
- #include "cli/cli-utils.h"
-+#include "exceptions.h"
-+#include "linux-ptrace.h"
- #ifndef SPUFS_MAGIC
- #define SPUFS_MAGIC 0x23c9b64e
-@@ -1613,11 +1615,22 @@ linux_nat_attach (struct target_ops *ops
-   struct lwp_info *lp;
-   int status;
-   ptid_t ptid;
-+  volatile struct gdb_exception ex;
-   /* Make sure we report all signals during attach.  */
-   linux_nat_pass_signals (0, NULL);
--  linux_ops->to_attach (ops, args, from_tty);
-+  TRY_CATCH (ex, RETURN_MASK_ERROR)
-+    {
-+      linux_ops->to_attach (ops, args, from_tty);
-+    }
-+  if (ex.reason < 0)
-+    {
-+      pid_t pid = parse_pid_to_attach (args);
-+
-+      linux_ptrace_attach_warnings (pid);
-+      throw_exception (ex);
-+    }
-   /* The ptrace base target adds the main thread with (pid,0,0)
-      format.  Decorate it with lwp info.  */
-Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.c  2012-03-06 07:34:17.589816440 +0100
-@@ -0,0 +1,42 @@
-+/* This testcase is part of GDB, the GNU debugger.
-+
-+   Copyright 2011-2012 Free Software Foundation, Inc.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 3 of the License, or
-+   (at your option) any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-+
-+#include <stdlib.h>
-+#include <unistd.h>
-+#include <sys/ptrace.h>
-+#include <errno.h>
-+
-+int
-+main (void)
-+{
-+  long l;
-+
-+  switch (fork ())
-+  {
-+    case -1:
-+      perror ("fork");
-+      exit (1);
-+    case 0:
-+      errno = 0;
-+      ptrace (PTRACE_ATTACH, getppid (), NULL, NULL);
-+      if (errno != 0)
-+      perror ("PTRACE_ATTACH");
-+      break;
-+  }
-+  sleep (600);
-+  return 0;
-+}
-Index: gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.exp
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20120120/gdb/testsuite/gdb.base/attach-twice.exp        2012-03-06 07:34:17.589816440 +0100
-@@ -0,0 +1,52 @@
-+# Copyright (C) 2012 Free Software Foundation, Inc.
-+#
-+# This program is free software; you can redistribute it and/or modify
-+# it under the terms of the GNU General Public License as published by
-+# the Free Software Foundation; either version 3 of the License, or
-+# (at your option) any later version.
-+#
-+# This program is distributed in the hope that it will be useful,
-+# but WITHOUT ANY WARRANTY; without even the implied warranty of
-+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+# GNU General Public License for more details.
-+#
-+# You should have received a copy of the GNU General Public License
-+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+
-+# Manipulation with PID on target is not supported.
-+if [is_remote target] then {
-+    return 0
-+}
-+
-+set testfile attach-twice
-+set executable ${testfile}
-+set binfile ${objdir}/${subdir}/${executable}
-+
-+if { [prepare_for_testing ${testfile}.exp $executable] } {
-+    return -1
-+}
-+
-+set testpid [eval exec $binfile &]
-+exec sleep 2
-+
-+set parentpid 0
-+
-+set test "attach"
-+gdb_test_multiple "attach $testpid" $test {
-+    -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*warning: process $testpid is already traced by process (\[0-9\]+)\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
-+      set parentpid $expect_out(1,string)
-+      pass $test
-+    }
-+    -re "Attaching to program: \[^\r\n\]*, process $testpid\r\n.*ptrace: Operation not permitted\\.\r\n$gdb_prompt $" {
-+      fail $test
-+    }
-+    -re "\r\n$gdb_prompt $" {
-+      xfail $test
-+    }
-+}
-+
-+eval exec ps xfw
-+if {$parentpid != 0} {
-+  eval exec kill -9 $parentpid
-+}
-+eval exec kill -9 $testpid
index aa4a44fc4cda7ce2de3aa736752ed8e05e79a9c3..71711f0793d6ae91051254d19f160230858f3ac4 100644 (file)
@@ -37,53 +37,66 @@ gdb/gdbserver/
        (linux_create_inferior, linux_tracefork_child): Call it instead of
        direct ptrace.
 
---- a/gdb/common/linux-ptrace.c
-+++ b/gdb/common/linux-ptrace.c
-@@ -26,6 +26,10 @@
- #include "linux-ptrace.h"
- #include "linux-procfs.h"
+Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.c  2012-09-17 20:28:14.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.c       2012-09-26 19:13:53.508780239 +0200
+@@ -28,6 +28,10 @@
+ #include "buffer.h"
+ #include "gdb_assert.h"
  
 +#ifdef HAVE_SELINUX_SELINUX_H
 +# include <selinux/selinux.h>
 +#endif /* HAVE_SELINUX_SELINUX_H */
 +
- /* Print all possible reasons we could fail to attach PID.  */
- void
-@@ -41,4 +45,21 @@ linux_ptrace_attach_warnings (pid_t pid)
-   if (linux_proc_pid_is_zombie (pid))
-     warning (_("process %d is a zombie - the process has already terminated"),
-            (int) pid);
+ /* Find all possible reasons we could fail to attach PID and append these
+    newline terminated reason strings to initialized BUFFER.  '\0' termination
+    of BUFFER must be done by the caller.  */
+@@ -47,6 +51,8 @@ linux_ptrace_attach_warnings (pid_t pid,
+     buffer_xml_printf (buffer, _("warning: process %d is a zombie "
+                                "- the process has already terminated\n"),
+                      (int) pid);
 +
-+  linux_ptrace_create_warnings ();
-+}
++  linux_ptrace_create_warnings (buffer);
+ }
+ #if defined __i386__ || defined __x86_64__
+@@ -242,3 +248,19 @@ linux_ptrace_init_warnings (void)
+   linux_ptrace_test_ret_to_nx ();
+ }
 +
 +/* Print all possible reasons we could fail to create a traced process.  */
 +
 +void
-+linux_ptrace_create_warnings (void)
++linux_ptrace_create_warnings (struct buffer *buffer)
 +{
 +#ifdef HAVE_LIBSELINUX
 +  /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
 +     forbidden.  */
 +  if (security_get_boolean_active ("deny_ptrace") == 1)
-+    warning (_("the SELinux boolean 'deny_ptrace' is enabled, "
-+             "you can disable this process attach protection by: "
-+             "(gdb) shell sudo setsebool deny_ptrace=0"));
++    buffer_xml_printf (buffer,
++                     _("the SELinux boolean 'deny_ptrace' is enabled, "
++                       "you can disable this process attach protection by: "
++                       "(gdb) shell sudo setsebool deny_ptrace=0"));
 +#endif /* HAVE_LIBSELINUX */
- }
---- a/gdb/common/linux-ptrace.h
-+++ b/gdb/common/linux-ptrace.h
-@@ -66,5 +66,6 @@
- #endif
++}
+Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.h
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.h  2012-07-07 14:13:56.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.h       2012-09-26 19:13:28.358765406 +0200
+@@ -69,5 +69,6 @@ struct buffer;
  
- extern void linux_ptrace_attach_warnings (pid_t pid);
-+extern void linux_ptrace_create_warnings (void);
+ extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
+ extern void linux_ptrace_init_warnings (void);
++extern void linux_ptrace_create_warnings (struct buffer *buffer);
  
  #endif /* COMMON_LINUX_PTRACE_H */
---- a/gdb/configure.ac
-+++ b/gdb/configure.ac
-@@ -1748,6 +1748,10 @@ then
+Index: gdb-7.5.0.20120926/gdb/configure.ac
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/configure.ac   2012-09-26 19:13:24.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/configure.ac        2012-09-26 19:13:28.410765451 +0200
+@@ -2008,6 +2008,10 @@ then
              [Define if you support the personality syscall.])
  fi
  
@@ -94,9 +107,11 @@ gdb/gdbserver/
  dnl Handle optional features that can be enabled.
  
  # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
---- a/gdb/gdbserver/configure.ac
-+++ b/gdb/gdbserver/configure.ac
-@@ -411,6 +411,10 @@ if $want_ipa ; then
+Index: gdb-7.5.0.20120926/gdb/gdbserver/configure.ac
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbserver/configure.ac      2012-09-26 19:13:28.446765428 +0200
+@@ -438,6 +438,10 @@ if $want_ipa ; then
     fi
  fi
  
@@ -107,9 +122,11 @@ gdb/gdbserver/
  AC_SUBST(GDBSERVER_DEPFILES)
  AC_SUBST(GDBSERVER_LIBS)
  AC_SUBST(USE_THREAD_DB)
---- a/gdb/gdbserver/linux-low.c
-+++ b/gdb/gdbserver/linux-low.c
-@@ -550,6 +550,25 @@ add_lwp (ptid_t ptid)
+Index: gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/gdbserver/linux-low.c  2012-07-07 14:13:57.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c       2012-09-26 19:13:28.453765471 +0200
+@@ -601,6 +601,28 @@ add_lwp (ptid_t ptid)
    return lwp;
  }
  
@@ -119,15 +136,18 @@ gdb/gdbserver/
 +linux_traceme (const char *program)
 +{
 +  int save_errno;
++  struct buffer buffer;
 +
 +  errno = 0;
 +  if (ptrace (PTRACE_TRACEME, 0, NULL, NULL) == 0)
 +    return;
 +
 +  save_errno = errno;
-+  linux_ptrace_create_warnings ();
-+  fprintf (stderr, _("Cannot trace created process %s: %s.\n"), program,
-+         strerror (save_errno));
++  buffer_init (&buffer);
++  linux_ptrace_create_warnings (&buffer);
++  buffer_grow_str0 (&buffer, "");
++  fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
++         buffer_finish (&buffer), program, strerror (save_errno));
 +  fflush (stderr);
 +  _exit (0177);
 +}
@@ -135,7 +155,7 @@ gdb/gdbserver/
  /* Start an inferior process and returns its pid.
     ALLARGS is a vector of program-name and args. */
  
-@@ -590,7 +609,7 @@ linux_create_inferior (char *program, char **allargs)
+@@ -641,7 +663,7 @@ linux_create_inferior (char *program, ch
  
    if (pid == 0)
      {
@@ -144,7 +164,7 @@ gdb/gdbserver/
  
  #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does.  */
        signal (__SIGRTMIN + 1, SIG_DFL);
-@@ -4386,7 +4405,7 @@ linux_tracefork_grandchild (void *arg)
+@@ -4572,7 +4594,7 @@ linux_tracefork_grandchild (void *arg)
  static int
  linux_tracefork_child (void *arg)
  {
@@ -153,8 +173,10 @@ gdb/gdbserver/
    kill (getpid (), SIGSTOP);
  
  #if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
---- a/gdb/inf-ptrace.c
-+++ b/gdb/inf-ptrace.c
+Index: gdb-7.5.0.20120926/gdb/inf-ptrace.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/inf-ptrace.c   2012-05-24 18:51:34.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/inf-ptrace.c        2012-09-26 19:13:28.458765461 +0200
 @@ -105,7 +105,15 @@ static void
  inf_ptrace_me (void)
  {
@@ -171,9 +193,11 @@ gdb/gdbserver/
  }
  
  /* Start a new inferior Unix child process.  EXEC_FILE is the file to
---- a/gdb/linux-nat.c
-+++ b/gdb/linux-nat.c
-@@ -1570,6 +1570,7 @@ linux_nat_create_inferior (struct target_ops *ops,
+Index: gdb-7.5.0.20120926/gdb/linux-nat.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/linux-nat.c    2012-09-26 19:13:22.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/linux-nat.c 2012-09-26 19:13:28.468765469 +0200
+@@ -1574,6 +1574,7 @@ linux_nat_create_inferior (struct target
  #ifdef HAVE_PERSONALITY
    int personality_orig = 0, personality_set = 0;
  #endif /* HAVE_PERSONALITY */
@@ -181,7 +205,7 @@ gdb/gdbserver/
  
    /* The fork_child mechanism is synchronous and calls target_wait, so
       we have to mask the async mode.  */
-@@ -1594,7 +1595,10 @@ linux_nat_create_inferior (struct target_ops *ops,
+@@ -1598,7 +1599,10 @@ linux_nat_create_inferior (struct target
    /* Make sure we report all signals during startup.  */
    linux_nat_pass_signals (0, NULL);
  
@@ -193,17 +217,28 @@ gdb/gdbserver/
  
  #ifdef HAVE_PERSONALITY
    if (personality_set)
-@@ -1606,6 +1610,12 @@ linux_nat_create_inferior (struct target_ops *ops,
+@@ -1610,6 +1614,24 @@ linux_nat_create_inferior (struct target
                 safe_strerror (errno));
      }
  #endif /* HAVE_PERSONALITY */
 +
 +  if (ex.reason < 0)
 +    {
-+      linux_ptrace_create_warnings ();
-+      throw_exception (ex);
++      struct buffer buffer;
++      char *message, *buffer_s;
++
++      message = xstrdup (ex.message);
++      make_cleanup (xfree, message);
++
++      buffer_init (&buffer);
++      linux_ptrace_create_warnings (&buffer);
++
++      buffer_grow_str0 (&buffer, "");
++      buffer_s = buffer_finish (&buffer);
++      make_cleanup (xfree, buffer_s);
++
++      throw_error (ex.error, "%s%s", buffer_s, message);
 +    }
  }
  
  static void
-
index ea1b3fc14e5b9a24a11ccadc4c347665f62163b4..6098645b8ccfed27c8604fed7291c1ad785e7597 100644 (file)
@@ -1,16 +1,18 @@
---- 1/gdb/config.in    2012-03-09 18:40:28.001871023 +0100
-+++ ./gdb/config.in    2012-03-09 18:41:46.552621113 +0100
-@@ -245,6 +245,9 @@
+Index: gdb-7.4.50.20120602/gdb/config.in
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/config.in     2012-06-02 21:49:26.147399232 +0200
++++ gdb-7.4.50.20120602/gdb/config.in  2012-06-02 21:49:27.206398845 +0200
+@@ -222,6 +222,9 @@
  /* Define if librpm library is being used. */
  #undef HAVE_LIBRPM
  
 +/* Define to 1 if you have the `selinux' library (-lselinux). */
 +#undef HAVE_LIBSELINUX
 +
- /* Define if libunwind library is being used. */
- #undef HAVE_LIBUNWIND
+ /* Define to 1 if you have the <libunwind-ia64.h> header file. */
+ #undef HAVE_LIBUNWIND_IA64_H
  
-@@ -483,6 +486,9 @@
+@@ -363,6 +366,9 @@
  /* Define to 1 if you have the `sbrk' function. */
  #undef HAVE_SBRK
  
  /* Define to 1 if you have the `setlocale' function. */
  #undef HAVE_SETLOCALE
  
---- 1/gdb/configure    2012-03-09 18:40:28.183870443 +0100
-+++ ./gdb/configure    2012-03-09 18:41:45.783623559 +0100
-@@ -15557,6 +15557,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >>
+Index: gdb-7.4.50.20120602/gdb/configure
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/configure     2012-06-02 21:49:27.139398869 +0200
++++ gdb-7.4.50.20120602/gdb/configure  2012-06-02 21:49:50.890390179 +0200
+@@ -12745,6 +12745,64 @@ $as_echo "#define HAVE_PERSONALITY 1" >>
  
  fi
  
  
  # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
  # except that the argument to --with-sysroot is optional.
+Index: gdb-7.4.50.20120602/gdb/gdbserver/config.in
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/gdbserver/config.in   2012-04-19 21:34:51.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/gdbserver/config.in        2012-06-02 21:49:55.945388329 +0200
+@@ -69,6 +69,9 @@
+ /* Define to 1 if you have the `dl' library (-ldl). */
+ #undef HAVE_LIBDL
++/* Define to 1 if you have the `selinux' library (-lselinux). */
++#undef HAVE_LIBSELINUX
++
+ /* Define to 1 if you have the <linux/elf.h> header file. */
+ #undef HAVE_LINUX_ELF_H
+@@ -130,6 +133,9 @@
+ /* Define to 1 if you have the `readlink' function. */
+ #undef HAVE_READLINK
++/* Define to 1 if you have the <selinux/selinux.h> header file. */
++#undef HAVE_SELINUX_SELINUX_H
++
+ /* Define to 1 if you have the <sgtty.h> header file. */
+ #undef HAVE_SGTTY_H
+Index: gdb-7.4.50.20120602/gdb/gdbserver/configure
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure   2012-04-20 19:58:49.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/gdbserver/configure        2012-06-02 21:49:54.485388864 +0200
+@@ -5532,6 +5532,64 @@ if $want_ipa ; then
+    fi
+ fi
++for ac_header in selinux/selinux.h
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default"
++if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_SELINUX_SELINUX_H 1
++_ACEOF
++
++fi
++
++done
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5
++$as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; }
++if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lselinux  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char security_get_boolean_active ();
++int
++main ()
++{
++return security_get_boolean_active ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_selinux_security_get_boolean_active=yes
++else
++  ac_cv_lib_selinux_security_get_boolean_active=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5
++$as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; }
++if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_LIBSELINUX 1
++_ACEOF
++
++  LIBS="-lselinux $LIBS"
++
++fi
++
++
diff --git a/gdb-bz539590-gnu-ifunc-fix-cond.patch b/gdb-bz539590-gnu-ifunc-fix-cond.patch
deleted file mode 100644 (file)
index 98bf5c0..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
---- ./gdb/breakpoint.c 2010-04-26 02:35:53.000000000 +0200
-+++ ./gdb/breakpoint.c 2010-04-26 02:33:26.000000000 +0200
-@@ -8499,6 +8499,11 @@ update_breakpoint_locations (struct brea
-       {
-         struct gdb_exception e;
-+        /* Temporary workaround before the non-intrusive ifunc patch gets in.
-+           exp parsing can now call inferior function invalidating
-+           EXISTING_LOCATIONS.  */
-+        existing_locations = NULL;
-+
-         s = b->cond_string;
-         TRY_CATCH (e, RETURN_MASK_ERROR)
-           {
index 7cc2a38d463ee6e7b338757dbb45bba8d2e0fb55..74604ba3f164cb81a3453c7eaa609751ed22ba56 100644 (file)
@@ -1,20 +1,20 @@
-Index: gdb-7.4.50.20111218/gdb/config/i386/linux64.mh
+Index: gdb-7.4.50.20120602/gdb/config/i386/linux64.mh
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/config/i386/linux64.mh        2011-08-24 14:07:26.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/config/i386/linux64.mh     2011-12-19 01:40:49.492625837 +0100
+--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux64.mh        2012-03-13 16:00:34.000000000 +0100
++++ gdb-7.4.50.20120602/gdb/config/i386/linux64.mh     2012-06-02 19:56:03.196172503 +0200
 @@ -4,7 +4,7 @@ NATDEPFILES= inf-ptrace.o fork-child.o \
        linux-nat.o linux-osdata.o \
        proc-service.o linux-thread-db.o linux-fork.o \
-       linux-procfs.o
+       linux-procfs.o linux-ptrace.o
 -NAT_FILE= config/nm-linux.h
 +NAT_FILE= nm-linux64.h
  NAT_CDEPS = $(srcdir)/proc-service.list
  
  # The dynamically loaded libthread_db needs access to symbols in the
-Index: gdb-7.4.50.20111218/gdb/config/i386/linux.mh
+Index: gdb-7.4.50.20120602/gdb/config/i386/linux.mh
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/config/i386/linux.mh  2011-08-24 14:07:26.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/config/i386/linux.mh       2011-12-19 01:40:32.453689006 +0100
+--- gdb-7.4.50.20120602.orig/gdb/config/i386/linux.mh  2012-03-13 16:00:33.000000000 +0100
++++ gdb-7.4.50.20120602/gdb/config/i386/linux.mh       2012-06-02 19:55:42.418178412 +0200
 @@ -1,6 +1,6 @@
  # Host: Intel 386 running GNU/Linux.
  
@@ -23,10 +23,10 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/linux.mh
  NATDEPFILES= inf-ptrace.o fork-child.o \
        i386-nat.o i386-linux-nat.o \
        proc-service.o linux-thread-db.o \
-Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h
+Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h     2011-12-19 01:40:32.454689002 +0100
++++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux.h     2012-06-02 19:55:42.433178408 +0200
 @@ -0,0 +1,28 @@
 +/* Native support for GNU/Linux i386.
 +
@@ -56,10 +56,10 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux.h
 +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
 +
 +#endif /* NM_LINUX64_H */
-Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h
+Index: gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h   2011-12-19 01:40:32.455688998 +0100
++++ gdb-7.4.50.20120602/gdb/config/i386/nm-linux64.h   2012-06-02 19:55:42.434178407 +0200
 @@ -0,0 +1,28 @@
 +/* Native support for GNU/Linux amd64.
 +
@@ -89,11 +89,11 @@ Index: gdb-7.4.50.20111218/gdb/config/i386/nm-linux64.h
 +#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
 +
 +#endif /* NM_LINUX64_H */
-Index: gdb-7.4.50.20111218/gdb/target.h
+Index: gdb-7.4.50.20120602/gdb/target.h
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/target.h      2011-12-06 21:03:13.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/target.h   2011-12-19 01:40:32.456688995 +0100
-@@ -1391,8 +1391,10 @@ extern char *target_thread_name (struct
+--- gdb-7.4.50.20120602.orig/gdb/target.h      2012-06-01 18:37:59.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/target.h   2012-06-02 19:55:42.436178407 +0200
+@@ -1470,8 +1470,10 @@ extern char *target_thread_name (struct
     bp_hardware_breakpoint.  CNT is the number of such watchpoints used so far
     (including this one?).  OTHERTYPE is who knows what...  */
  
@@ -104,10 +104,10 @@ Index: gdb-7.4.50.20111218/gdb/target.h
  
  /* Returns the number of debug registers needed to watch the given
     memory region, or zero if not supported.  */
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
+Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp    2011-12-19 01:40:32.464688965 +0100
++++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp    2012-06-02 19:55:42.442178406 +0200
 @@ -0,0 +1,40 @@
 +# Copyright 2009, 2010 Free Software Foundation, Inc.
 +
diff --git a/gdb-bz555076-gcore-small-height.patch b/gdb-bz555076-gcore-small-height.patch
deleted file mode 100644 (file)
index acad66b..0000000
+++ /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 <<EOF
-+set pagination off
-+set width 0
-+set height 0
- attach $pid
- gcore $name.$pid
- detach
diff --git a/gdb-bz575292-delayed-physname.patch b/gdb-bz575292-delayed-physname.patch
deleted file mode 100644 (file)
index e15391d..0000000
+++ /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 <http://www.gnu.org/licenses/>.  */
-+
-+/* 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 <http://www.gnu.org/licenses/>.
-+
-+# 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 (file)
index 16c789f..0000000
+++ /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  <jan.kratochvil@redhat.com>
-+      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  <jan.kratochvil@redhat.com>
-+
-       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 (file)
index c5184e0..0000000
+++ /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  <pedro@codesourcery.com>
-+      * 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  <pedro@codesourcery.com>
-+
-       * objfiles.h (ALL_OBJSECTIONS): Handle breaks in the inner loop.
- 2010-09-22  Joel Brobecker  <brobecker@adacore.com>
---- 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  <pedro@codesourcery.com>
-+
-+      * 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  <brobecker@adacore.com>
-       * 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 (file)
index e45c83d..0000000
+++ /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  <jan.kratochvil@redhat.com>
-+
-+      Fix lost siginfo_t for inferior calls.
-+      * infrun.c
-+      (struct inferior_thread_state) <siginfo_gdbarch, siginfo_data>: 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  <tromey@redhat.com>
-       * 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 (&current_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 (&current_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  <jan.kratochvil@redhat.com>
-+
-+      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  <brobecker@adacore.com>
-       * 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 <http://www.gnu.org/licenses/>.  */
-+
-+#include <signal.h>
-+#include <assert.h>
-+#include <string.h>
-+#include <unistd.h>
-+
-+#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 <http://www.gnu.org/licenses/>.
-+
-+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
deleted file mode 100644 (file)
index 3810fec..0000000
+++ /dev/null
@@ -1,994 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2010-09/msg00360.html
-Subject: [patch 3/4]#3 linux-nat: Do not respawn signals
-
-Hi,
-
-linux-nat.c is fixed to never respawn signals; possibly keeping SIGSTOP
-pending, as is done in current in FSF gdbserver and as suggested by Pedro:
-       http://sourceware.org/ml/gdb-patches/2010-08/msg00544.html
-
-The last linux-nat.c removed patch chunk comes from the initial implementation
-by Mark Kettenis:
-       [PATCH] New Linux threads support
-       http://sourceware.org/ml/gdb-patches/2000-09/msg00020.html
-       92280a75e017683bf8e4f339f4f85640b0700509
-It gets in part reimplemented into the new stop_wait_callback <if (lp->step)>
-part and partially just not needed as currently GDB never drops the signals as
-it does not PTRACE_CONT the thread; signal is kept for processing:
-       "RC: Not resuming sibling %s (has pending)\n"
-
-In stop_wait_callback I believe breakpoints cancellation is not needed here,
-it would be done later.
-
-
-The testcase sigstep-threads.exp was written to catch a regression-like
-appearance then the new <if (lp->step)> part of stop_wait_callback gets
-removed.  Still the tecase fails even with FSF HEAD:
-
-32        var++;                /* step-1 */
-(gdb) step
-Program received signal SIGUSR1, User defined signal 1.
-Program received signal SIGUSR1, User defined signal 1.
-31      {                       /* step-0 */
-
-There is no reason why it shouldn't stop on line 33, between line 32 and line
-33 no signal would occur.  Stepping of the current thread should not be
-affected by whatever happens in the other threads as select_event_lwp has:
-  /* Give preference to any LWP that is being single-stepped.  */
-
-There is a problem that with FSF HEAD GDB does PTRACE_SINGLESTEP for thread A,
-PTRACE_CONT for thread B (because of set scheduler-locking off), thread B hits
-SIGUSR1, so GDB tkills thread A with SIGSTOP and it can receive SIGSTOP for
-thread A before the SIGTRAP for completed PTRACE_SINGLESTEP.  At that moment
-select_event_lwp. forgets it was stepping thread A because there is no pending
-SIGTRAP event.  currently_stepping still remembers thread A was stepping so it
-will later stop but as thread A was PTRACE_CONT-ed in the meantime it is too
-late.
-
-There is the new <if (lp->step)> part of stop_wait_callback to always track
-thread A is stepping.  Due to different scheduling without this part the
-changed GDB would very rarely stop in this testcase otherwise, making it look
-as a regression.
-
-I have some another patch I may post separately as if multiple signals happen
-besides SIGTRAP GDB still may switch from thread A away (as not considering it
-stepping) to thread B for SIGUSR and accidentally PTRACE_CONT thread A.
-But I do not find this as a prerequisite for this patchset.
-
-
-
-Thanks,
-Jan
-
-
-gdb/
-2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * linux-nat.c (stop_wait_callback): New gdb_assert.  Remove signals
-       respawning; keep TP with SIGNALLED.  New debugging message "SWC:
-       Delayed SIGSTOP caught for %s.".  Catch next signal if SIGSTOP has
-       been caught and LP->STEP is set.
-       (linux_nat_wait_1) <lp && lp->signalled>: Remove.
-
-gdb/testsuite/
-2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * gdb.threads/siginfo-threads.exp: New file.
-       * gdb.threads/siginfo-threads.c: New file.
-       * gdb.threads/sigstep-threads.exp: New file.
-       * gdb.threads/sigstep-threads.c: New file.
-
-Index: gdb-7.4.50.20111218/gdb/linux-nat.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/linux-nat.c   2011-12-19 01:25:42.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/linux-nat.c        2011-12-19 02:17:05.412607735 +0100
-@@ -2843,6 +2843,8 @@ stop_wait_callback (struct lwp_info *lp,
-     {
-       int status;
-+      gdb_assert (lp->resumed);
-+
-       status = wait_lwp (lp);
-       if (status == 0)
-       return 0;
-@@ -2868,110 +2870,61 @@ stop_wait_callback (struct lwp_info *lp,
-       if (WSTOPSIG (status) != SIGSTOP)
-       {
--        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
--               some random trap signal), then just arrange for it to
--               hit it again later.  We don't keep the SIGTRAP status
--               and don't forward the SIGTRAP signal to the LWP.  We
--               will handle the current event, eventually we will
--               resume all LWPs, and this one will get its breakpoint
--               trap again.
--
--               If we do not do this, then we run the risk that the
--               user will delete or disable the breakpoint, but the
--               thread will have already tripped on it.  */
--
--            /* Save the trap's siginfo in case we need it later.  */
--            save_siginfo (lp);
--
--            save_sigtrap (lp);
--
--            /* Now resume this LWP and get the SIGSTOP event.  */
--            errno = 0;
--            ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
--            if (debug_linux_nat)
--              {
--                fprintf_unfiltered (gdb_stdlog,
--                                    "PTRACE_CONT %s, 0, 0 (%s)\n",
--                                    target_pid_to_str (lp->ptid),
--                                    errno ? safe_strerror (errno) : "OK");
--
--                fprintf_unfiltered (gdb_stdlog,
--                                    "SWC: Candidate SIGTRAP event in %s\n",
--                                    target_pid_to_str (lp->ptid));
--              }
--            /* Hold this event/waitstatus while we check to see if
--               there are any more (we still want to get that SIGSTOP).  */
--            stop_wait_callback (lp, NULL);
-+        /* The thread was stopped with a signal other than SIGSTOP.  */
--            /* Hold the SIGTRAP for handling by linux_nat_wait.  If
--               there's another event, throw it back into the
--               queue.  */
--            if (lp->status)
--              {
--                if (debug_linux_nat)
--                  fprintf_unfiltered (gdb_stdlog,
--                                      "SWC: kill %s, %s\n",
--                                      target_pid_to_str (lp->ptid),
--                                      status_to_str ((int) status));
--                kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
--              }
--
--            /* Save the sigtrap event.  */
--            lp->status = status;
--            return 0;
--          }
--        else
--          {
--            /* The thread was stopped with a signal other than
--               SIGSTOP, and didn't accidentally trip a breakpoint.  */
-+        /* Save the trap's siginfo in case we need it later.  */
-+        save_siginfo (lp);
--            if (debug_linux_nat)
--              {
--                fprintf_unfiltered (gdb_stdlog,
--                                    "SWC: Pending event %s in %s\n",
--                                    status_to_str ((int) status),
--                                    target_pid_to_str (lp->ptid));
--              }
--            /* Now resume this LWP and get the SIGSTOP event.  */
--            errno = 0;
--            ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
--            if (debug_linux_nat)
--              fprintf_unfiltered (gdb_stdlog,
--                                  "SWC: PTRACE_CONT %s, 0, 0 (%s)\n",
--                                  target_pid_to_str (lp->ptid),
--                                  errno ? safe_strerror (errno) : "OK");
-+        save_sigtrap (lp);
--            /* Hold this event/waitstatus while we check to see if
--               there are any more (we still want to get that SIGSTOP).  */
--            stop_wait_callback (lp, NULL);
-+        if (debug_linux_nat)
-+          fprintf_unfiltered (gdb_stdlog,
-+                              "SWC: Pending event %s in %s\n",
-+                              status_to_str ((int) status),
-+                              target_pid_to_str (lp->ptid));
--            /* If the lp->status field is still empty, use it to
--               hold this event.  If not, then this event must be
--               returned to the event queue of the LWP.  */
--            if (lp->status)
--              {
--                if (debug_linux_nat)
--                  {
--                    fprintf_unfiltered (gdb_stdlog,
--                                        "SWC: kill %s, %s\n",
--                                        target_pid_to_str (lp->ptid),
--                                        status_to_str ((int) status));
--                  }
--                kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status));
--              }
--            else
--              lp->status = status;
--            return 0;
--          }
-+        /* Save the sigtrap event.  */
-+        lp->status = status;
-+        gdb_assert (! lp->stopped);
-+        gdb_assert (lp->signalled);
-+        lp->stopped = 1;
-       }
-       else
-       {
-         /* We caught the SIGSTOP that we intended to catch, so
-            there's no SIGSTOP pending.  */
--        lp->stopped = 1;
-+
-+        if (debug_linux_nat)
-+          fprintf_unfiltered (gdb_stdlog,
-+                              "SWC: Delayed SIGSTOP caught for %s.\n",
-+                              target_pid_to_str (lp->ptid));
-+
-+        if (lp->step)
-+          {
-+            /* LP->STATUS is 0 here.  That means SIGTRAP from
-+               PTRACE_SINGLESTEP still has to be delivered for this inferior
-+               stop.  Catching the SIGTRAP event is important to prevent
-+               starvation in select_event_lwp.  */
-+
-+            registers_changed ();
-+            linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
-+                                  1, TARGET_SIGNAL_0);
-+            if (debug_linux_nat)
-+              fprintf_unfiltered (gdb_stdlog,
-+                                  "SWC: %s %s, 0, 0 (discard SIGSTOP)\n",
-+                                  "PTRACE_SINGLESTEP",
-+                                  target_pid_to_str (lp->ptid));
-+
-+            lp->stopped = 0;
-+            gdb_assert (lp->resumed);
-+            stop_wait_callback (lp, NULL);
-+            gdb_assert (lp->stopped);
-+          }
-+        else
-+          lp->stopped = 1;
-+
-+        /* Reset SIGNALLED only after the stop_wait_callback call above as
-+           it does gdb_assert on SIGNALLED.  */
-         lp->signalled = 0;
-       }
-     }
-@@ -3627,54 +3580,6 @@ retry:
-       lp = NULL;
-     }
--  if (lp && lp->signalled && lp->last_resume_kind != resume_stop)
--    {
--      /* A pending SIGSTOP may interfere with the normal stream of
--         events.  In a typical case where interference is a problem,
--         we have a SIGSTOP signal pending for LWP A while
--         single-stepping it, encounter an event in LWP B, and take the
--         pending SIGSTOP while trying to stop LWP A.  After processing
--         the event in LWP B, LWP A is continued, and we'll never see
--         the SIGTRAP associated with the last time we were
--         single-stepping LWP A.  */
--
--      /* Resume the thread.  It should halt immediately returning the
--         pending SIGSTOP.  */
--      registers_changed ();
--      if (linux_nat_prepare_to_resume != NULL)
--      linux_nat_prepare_to_resume (lp);
--      linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
--                          lp->step, TARGET_SIGNAL_0);
--      if (debug_linux_nat)
--      fprintf_unfiltered (gdb_stdlog,
--                          "LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
--                          lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
--                          target_pid_to_str (lp->ptid));
--      lp->stopped = 0;
--      gdb_assert (lp->resumed);
--
--      /* Catch the pending SIGSTOP.  */
--      status = lp->status;
--      lp->status = 0;
--
--      stop_wait_callback (lp, NULL);
--
--      /* If the lp->status field isn't empty, we caught another signal
--       while flushing the SIGSTOP.  Return it back to the event
--       queue of the LWP, as we already have an event to handle.  */
--      if (lp->status)
--      {
--        if (debug_linux_nat)
--          fprintf_unfiltered (gdb_stdlog,
--                              "LLW: kill %s, %s\n",
--                              target_pid_to_str (lp->ptid),
--                              status_to_str (lp->status));
--        kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status));
--      }
--
--      lp->status = status;
--    }
--
-   if (!target_can_async_p ())
-     {
-       /* Causes SIGINT to be passed on to the attached process.  */
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.c    2011-12-19 02:16:35.236720272 +0100
-@@ -0,0 +1,447 @@
-+/* 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 <http://www.gnu.org/licenses/>.  */
-+
-+#define _GNU_SOURCE
-+#include <pthread.h>
-+#include <stdio.h>
-+#include <limits.h>
-+#include <errno.h>
-+#include <stdlib.h>
-+#include <string.h>
-+#include <assert.h>
-+#include <sys/types.h>
-+#include <signal.h>
-+#include <unistd.h>
-+#include <asm/unistd.h>
-+
-+#define gettid() syscall (__NR_gettid)
-+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, tgid, tid, sig)
-+
-+/* Terminate always in the main task, it can lock up with SIGSTOPped GDB
-+   otherwise.  */
-+#define TIMEOUT (gettid () == getpid() ? 10 : 15)
-+
-+static pid_t thread1_tid;
-+static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER;
-+static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-+static int thread1_sigusr1_hit;
-+static int thread1_sigusr2_hit;
-+
-+static pid_t thread2_tid;
-+static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER;
-+static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-+static int thread2_sigusr1_hit;
-+static int thread2_sigusr2_hit;
-+
-+static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-+
-+/* Do not use alarm as it would create a ptrace event which would hang up us if
-+   we are being traced by GDB which we stopped ourselves.  */
-+
-+static void timed_mutex_lock (pthread_mutex_t *mutex)
-+{
-+  int i;
-+  struct timespec start, now;
-+
-+  i = clock_gettime (CLOCK_MONOTONIC, &start);
-+  assert (i == 0);
-+
-+  do
-+    {
-+      i = pthread_mutex_trylock (mutex);
-+      if (i == 0)
-+      return;
-+      assert (i == EBUSY);
-+
-+      i = clock_gettime (CLOCK_MONOTONIC, &now);
-+      assert (i == 0);
-+      assert (now.tv_sec >= start.tv_sec);
-+    }
-+  while (now.tv_sec - start.tv_sec < TIMEOUT);
-+
-+  fprintf (stderr, "Timed out waiting for internal lock!\n");
-+  exit (EXIT_FAILURE);
-+}
-+
-+static void
-+handler (int signo, siginfo_t *siginfo, void *exception)
-+{
-+  int *varp;
-+
-+  assert (siginfo->si_signo == signo);
-+  assert (siginfo->si_code == SI_TKILL);
-+  assert (siginfo->si_pid == getpid ());
-+
-+  if (gettid () == thread1_tid)
-+    {
-+      if (signo == SIGUSR1)
-+      varp = &thread1_sigusr1_hit;
-+      else if (signo == SIGUSR2)
-+      varp = &thread1_sigusr2_hit;
-+      else
-+      assert (0);
-+    }
-+  else if (gettid () == thread2_tid)
-+    {
-+      if (signo == SIGUSR1)
-+      varp = &thread2_sigusr1_hit;
-+      else if (signo == SIGUSR2)
-+      varp = &thread2_sigusr2_hit;
-+      else
-+      assert (0);
-+    }
-+  else
-+    assert (0);
-+
-+  if (*varp)
-+    {
-+      fprintf (stderr, "Signal %d for TID %lu has been already hit!\n", signo,
-+             (unsigned long) gettid ());
-+      exit (EXIT_FAILURE);
-+    }
-+  *varp = 1;
-+}
-+
-+static void *
-+thread1_func (void *unused)
-+{
-+  int i;
-+
-+  timed_mutex_lock (&thread1_tid_mutex);
-+
-+  /* THREAD1_TID_MUTEX must be already locked to avoid race.  */
-+  thread1_tid = gettid ();
-+
-+  i = pthread_cond_signal (&thread1_tid_cond);
-+  assert (i == 0);
-+  i = pthread_mutex_unlock (&thread1_tid_mutex);
-+  assert (i == 0);
-+
-+  /* Be sure the "t (tracing stop)" test can proceed for both threads.  */
-+  timed_mutex_lock (&terminate_mutex);
-+  i = pthread_mutex_unlock (&terminate_mutex);
-+  assert (i == 0);
-+
-+  if (! thread1_sigusr1_hit)
-+    {
-+      fprintf (stderr, "Thread 1 signal SIGUSR1 not hit!\n");
-+      exit (EXIT_FAILURE);
-+    }
-+  if (! thread1_sigusr2_hit)
-+    {
-+      fprintf (stderr, "Thread 1 signal SIGUSR2 not hit!\n");
-+      exit (EXIT_FAILURE);
-+    }
-+
-+  return NULL;
-+}
-+
-+static void *
-+thread2_func (void *unused)
-+{
-+  int i;
-+
-+  timed_mutex_lock (&thread2_tid_mutex);
-+
-+  /* THREAD2_TID_MUTEX must be already locked to avoid race.  */
-+  thread2_tid = gettid ();
-+
-+  i = pthread_cond_signal (&thread2_tid_cond);
-+  assert (i == 0);
-+  i = pthread_mutex_unlock (&thread2_tid_mutex);
-+  assert (i == 0);
-+
-+  /* Be sure the "t (tracing stop)" test can proceed for both threads.  */
-+  timed_mutex_lock (&terminate_mutex);
-+  i = pthread_mutex_unlock (&terminate_mutex);
-+  assert (i == 0);
-+
-+  if (! thread2_sigusr1_hit)
-+    {
-+      fprintf (stderr, "Thread 2 signal SIGUSR1 not hit!\n");
-+      exit (EXIT_FAILURE);
-+    }
-+  if (! thread2_sigusr2_hit)
-+    {
-+      fprintf (stderr, "Thread 2 signal SIGUSR2 not hit!\n");
-+      exit (EXIT_FAILURE);
-+    }
-+
-+  return NULL;
-+}
-+
-+static const char *
-+proc_string (const char *filename, const char *line)
-+{
-+  FILE *f;
-+  static char buf[LINE_MAX];
-+  size_t line_len = strlen (line);
-+
-+  f = fopen (filename, "r");
-+  if (f == NULL)
-+    {
-+      fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line,
-+             strerror (errno));
-+      exit (EXIT_FAILURE);
-+    }
-+  while (errno = 0, fgets (buf, sizeof (buf), f))
-+    {
-+      char *s;
-+
-+      s = strchr (buf, '\n');
-+      assert (s != NULL);
-+      *s = 0;
-+
-+      if (strncmp (buf, line, line_len) != 0)
-+      continue;
-+
-+      if (fclose (f))
-+      {
-+        fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line,
-+                 strerror (errno));
-+        exit (EXIT_FAILURE);
-+      }
-+
-+      return &buf[line_len];
-+    }
-+  if (errno != 0)
-+    {
-+      fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno));
-+      exit (EXIT_FAILURE);
-+    }
-+  fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line);
-+  exit (EXIT_FAILURE);
-+}
-+
-+static unsigned long
-+proc_ulong (const char *filename, const char *line)
-+{
-+  const char *s = proc_string (filename, line);
-+  long retval;
-+  char *end;
-+
-+  errno = 0;
-+  retval = strtol (s, &end, 10);
-+  if (retval < 0 || retval >= LONG_MAX || (end && *end))
-+    {
-+      fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval,
-+             strerror (errno));
-+      exit (EXIT_FAILURE);
-+    }
-+  return retval;
-+}
-+
-+static void
-+state_wait (pid_t process, const char *wanted)
-+{
-+  char *filename;
-+  int i;
-+  struct timespec start, now;
-+  const char *state;
-+
-+  i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process);
-+  assert (i > 0);
-+
-+  i = clock_gettime (CLOCK_MONOTONIC, &start);
-+  assert (i == 0);
-+
-+  do
-+    {
-+      state = proc_string (filename, "State:\t");
-+
-+      /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0
-+       has changed "T (tracing stop)" to "t (tracing stop)".  Make the GDB
-+       testcase backward compatible with older Linux kernels.  */
-+      if (strcmp (state, "T (tracing stop)") == 0)
-+      state = "t (tracing stop)";
-+
-+      if (strcmp (state, wanted) == 0)
-+      {
-+        free (filename);
-+        return;
-+      }
-+
-+      if (sched_yield ())
-+      {
-+        perror ("sched_yield()");
-+        exit (EXIT_FAILURE);
-+      }
-+
-+      i = clock_gettime (CLOCK_MONOTONIC, &now);
-+      assert (i == 0);
-+      assert (now.tv_sec >= start.tv_sec);
-+    }
-+  while (now.tv_sec - start.tv_sec < TIMEOUT);
-+
-+  fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n",
-+         (unsigned long) process, wanted, state);
-+  exit (EXIT_FAILURE);
-+}
-+
-+static volatile pid_t tracer = 0;
-+static pthread_t thread1, thread2;
-+
-+static void
-+cleanup (void)
-+{
-+  printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer);
-+
-+  if (tracer)
-+    {
-+      int i;
-+      int tracer_save = tracer;
-+
-+      tracer = 0;
-+
-+      i = kill (tracer_save, SIGCONT);
-+      assert (i == 0);
-+    }
-+}
-+
-+int
-+main (int argc, char **argv)
-+{
-+  int i;
-+  int standalone = 0;
-+  struct sigaction act;
-+
-+  if (argc == 2 && strcmp (argv[1], "-s") == 0)
-+    standalone = 1;
-+  else
-+    assert (argc == 1);
-+
-+  setbuf (stdout, NULL);
-+
-+  timed_mutex_lock (&thread1_tid_mutex);
-+  timed_mutex_lock (&thread2_tid_mutex);
-+
-+  timed_mutex_lock (&terminate_mutex);
-+
-+  errno = 0;
-+  memset (&act, 0, sizeof (act));
-+  act.sa_sigaction = handler;
-+  act.sa_flags = SA_RESTART | SA_SIGINFO;
-+  i = sigemptyset (&act.sa_mask);
-+  assert_perror (errno);
-+  assert (i == 0);
-+  i = sigaction (SIGUSR1, &act, NULL);
-+  assert_perror (errno);
-+  assert (i == 0);
-+  i = sigaction (SIGUSR2, &act, NULL);
-+  assert_perror (errno);
-+  assert (i == 0);
-+
-+  i = pthread_create (&thread1, NULL, thread1_func, NULL);
-+  assert (i == 0);
-+
-+  i = pthread_create (&thread2, NULL, thread2_func, NULL);
-+  assert (i == 0);
-+
-+  if (!standalone)
-+    {
-+      tracer = proc_ulong ("/proc/self/status", "TracerPid:\t");
-+      if (tracer == 0)
-+      {
-+        fprintf (stderr, "The testcase must be run by GDB!\n");
-+        exit (EXIT_FAILURE);
-+      }
-+      if (tracer != getppid ())
-+      {
-+        fprintf (stderr, "The testcase parent must be our GDB tracer!\n");
-+        exit (EXIT_FAILURE);
-+      }
-+    }
-+
-+  /* SIGCONT our debugger in the case of our crash as we would deadlock
-+     otherwise.  */
-+
-+  atexit (cleanup);
-+
-+  printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer);
-+
-+  if (tracer)
-+    {
-+      i = kill (tracer, SIGSTOP);
-+      assert (i == 0);
-+      state_wait (tracer, "T (stopped)");
-+    }
-+
-+  /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so
-+     they could not trigger the signals before GDB gets unstopped later.
-+     Threads get resumed at pthread_cond_wait below.  Use `while' loops for
-+     protection against spurious pthread_cond_wait wakeups.  */
-+
-+  printf ("Waiting till the threads initialize their TIDs.\n");
-+
-+  while (thread1_tid == 0)
-+    {
-+      i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex);
-+      assert (i == 0);
-+    }
-+
-+  while (thread2_tid == 0)
-+    {
-+      i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex);
-+      assert (i == 0);
-+    }
-+
-+  printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n",
-+        (unsigned long) thread1_tid, (unsigned long) thread2_tid,
-+        (unsigned long) getpid ());
-+
-+  errno = 0;
-+  i = tgkill (getpid (), thread1_tid, SIGUSR1);
-+  assert_perror (errno);
-+  assert (i == 0);
-+  i = tgkill (getpid (), thread1_tid, SIGUSR2);
-+  assert_perror (errno);
-+  assert (i == 0);
-+  i = tgkill (getpid (), thread2_tid, SIGUSR1);
-+  assert_perror (errno);
-+  assert (i == 0);
-+  i = tgkill (getpid (), thread2_tid, SIGUSR2);
-+  assert_perror (errno);
-+  assert (i == 0);
-+
-+  printf ("Waiting till the threads get trapped by the signals.\n");
-+
-+  if (tracer)
-+    {
-+      /* s390x-unknown-linux-gnu will fail with "R (running)".  */
-+
-+      state_wait (thread1_tid, "t (tracing stop)");
-+
-+      state_wait (thread2_tid, "t (tracing stop)");
-+    }
-+
-+  cleanup ();
-+
-+  printf ("Joining the threads.\n");
-+
-+  i = pthread_mutex_unlock (&terminate_mutex);
-+  assert (i == 0);
-+
-+  i = pthread_join (thread1, NULL);
-+  assert (i == 0);
-+
-+  i = pthread_join (thread2, NULL);
-+  assert (i == 0);
-+
-+  printf ("Exiting.\n");      /* break-at-exit */
-+
-+  return EXIT_SUCCESS;
-+}
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/siginfo-threads.exp  2011-12-19 02:16:35.237720268 +0100
-@@ -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 <http://www.gnu.org/licenses/>.
-+
-+set testfile "siginfo-threads"
-+set srcfile ${testfile}.c
-+set binfile ${objdir}/${subdir}/${testfile}
-+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
-+    return -1
-+}
-+
-+clean_restart $testfile
-+
-+if ![runto_main] {
-+    return -1
-+}
-+
-+# `nostop noprint pass' could in some cases report false PASS due to the
-+# (preempt 'handle') code path.
-+
-+gdb_test "handle SIGUSR1 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
-+gdb_test "handle SIGUSR2 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
-+
-+gdb_breakpoint [gdb_get_line_number "break-at-exit"]
-+
-+set test "get pid"
-+gdb_test_multiple "p getpid ()" $test {
-+    -re " = (\[0-9\]+)\r\n$gdb_prompt $" {
-+      set pid $expect_out(1,string)
-+      pass $test
-+    }
-+}
-+
-+for {set sigcount 0} {$sigcount < 4} {incr sigcount} {
-+    set test "catch signal $sigcount"
-+    set sigusr ""
-+    gdb_test_multiple "continue" $test {
-+      -re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" {
-+          set sigusr $expect_out(1,string)
-+          pass $test
-+      }
-+    }
-+    if {$sigusr == ""} {
-+      return -1
-+    }
-+
-+    set test "signal $sigcount si_signo"
-+    if {$sigusr == 1} {
-+      set signo 10
-+    } else {
-+      set signo 12
-+    }
-+    gdb_test_multiple {p $_siginfo.si_signo} $test {
-+      -re " = $signo\r\n$gdb_prompt $" {
-+          pass $test
-+      }
-+      -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
-+          unsupported $test
-+      }
-+    }
-+
-+    set test "signal $sigcount si_code is SI_TKILL"
-+    gdb_test_multiple {p $_siginfo.si_code} $test {
-+      -re " = -6\r\n$gdb_prompt $" {
-+          pass $test
-+      }
-+      -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
-+          unsupported $test
-+      }
-+    }
-+
-+    set test "signal $sigcount si_pid"
-+    gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test {
-+      -re " = $pid\r\n$gdb_prompt $" {
-+          pass $test
-+      }
-+      -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" {
-+          unsupported $test
-+      }
-+    }
-+}
-+
-+gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*"
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.c    2011-12-19 02:16:35.237720268 +0100
-@@ -0,0 +1,54 @@
-+/* 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 <http://www.gnu.org/licenses/>.  */
-+
-+#include <pthread.h>
-+#include <assert.h>
-+#include <signal.h>
-+
-+#include <asm/unistd.h>
-+#include <unistd.h>
-+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig))
-+#define gettid() syscall (__NR_gettid)
-+
-+static volatile int var;
-+
-+static void
-+handler (int signo)   /* step-0 */
-+{                     /* step-0 */
-+  var++;              /* step-1 */
-+  tgkill (getpid (), gettid (), SIGUSR1);     /* step-2 */
-+}
-+
-+static void *
-+start (void *arg)
-+{
-+  signal (SIGUSR1, handler);
-+  tgkill (getpid (), gettid (), SIGUSR1);
-+  assert (0);
-+
-+  return NULL;
-+}
-+
-+int
-+main (void)
-+{
-+  pthread_t thread;
-+
-+  pthread_create (&thread, NULL, start, NULL);
-+  start (NULL);       /* main-start */
-+  return 0;
-+}
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/sigstep-threads.exp  2011-12-19 02:16:35.237720268 +0100
-@@ -0,0 +1,74 @@
-+# 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 <http://www.gnu.org/licenses/>.
-+
-+set testfile sigstep-threads
-+set srcfile ${testfile}.c
-+set executable ${testfile}
-+set binfile ${objdir}/${subdir}/${executable}
-+
-+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-+    untested ${testfile}.exp
-+    return -1
-+}
-+
-+clean_restart $executable
-+
-+if ![runto_main] {
-+    return -1;
-+}
-+
-+# `noprint' would not test the full logic of GDB.
-+gdb_test "handle SIGUSR1 nostop print pass" "\r\nSIGUSR1\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*"
-+
-+gdb_test_no_output "set scheduler-locking off"
-+
-+gdb_breakpoint [gdb_get_line_number "step-1"]
-+gdb_test_no_output {set $step1=$bpnum}
-+gdb_continue_to_breakpoint "step-1" ".* step-1 .*"
-+gdb_test_no_output {disable $step1}
-+
-+# 1 as we are now stopped at the `step-1' label.
-+set step_at 1
-+for {set i 0} {$i < 100} {incr i} {
-+    set test "step $i"
-+    # Presume this step failed - as in the case of a timeout.
-+    set failed 1
-+    gdb_test_multiple "step" $test {
-+      -re "\r\nProgram received signal SIGUSR1, User defined signal 1.\r\n" {
-+          exp_continue -continue_timer
-+      }
-+      -re "step-(\[012\]).*\r\n$gdb_prompt $" {
-+          set now $expect_out(1,string)
-+          if {$step_at == 2 && $now == 1} {
-+              set failed 0
-+          } elseif {$step_at == 1 && $now == 2} {
-+              set failed 0
-+              # Continue over the re-signalling back to the handle entry.
-+              gdb_test_no_output {enable $step1} ""
-+              gdb_test "continue" " step-1 .*" ""
-+              set now 1
-+              gdb_test_no_output {disable $step1} ""
-+          } else  {
-+              fail $test
-+          }
-+          set step_at $now
-+      }
-+    }
-+    if $failed {
-+      return
-+    }
-+}
-+# We can never reliably say the racy problematic case has been tested.
-+pass "step"
diff --git a/gdb-bz592031-siginfo-lost-5of5.patch b/gdb-bz592031-siginfo-lost-5of5.patch
deleted file mode 100644 (file)
index 8f4e440..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
-Subject: [patch 4/4]#3 Remove redundant lp->siginfo
-
-Hi,
-
-this is a simplification which should not affect GDB behavior.  As linux-nat
-now stops on each received signal without any reordering of them then
-PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
-advance.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
-       (linux_nat_resume): Remove LP->SIGINFO clearing.
-       (save_siginfo): Remove.
-       (stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
-       (linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
-       the save_siginfo call.
-       (resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
-       (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
-       * linux-nat.h (struct lwp_info) <siginfo>: Remove.
-
-Index: gdb-7.4.50.20111218/gdb/linux-nat.c
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/linux-nat.c   2011-12-19 02:17:05.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/linux-nat.c        2011-12-19 02:17:43.188466854 +0100
-@@ -1883,7 +1883,6 @@ resume_lwp (struct lwp_info *lp, int ste
-                               step, TARGET_SIGNAL_0);
-         lp->stopped = 0;
-         lp->step = step;
--        memset (&lp->siginfo, 0, sizeof (lp->siginfo));
-         lp->stopped_by_watchpoint = 0;
-       }
-       else
-@@ -2027,7 +2026,6 @@ linux_nat_resume (struct target_ops *ops
-   if (linux_nat_prepare_to_resume != NULL)
-     linux_nat_prepare_to_resume (lp);
-   linux_ops->to_resume (linux_ops, ptid, step, signo);
--  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
-   lp->stopped_by_watchpoint = 0;
-   if (debug_linux_nat)
-@@ -2612,22 +2610,6 @@ wait_lwp (struct lwp_info *lp)
-   return status;
- }
--/* Save the most recent siginfo for LP.  This is currently only called
--   for SIGTRAP; some ports use the si_addr field for
--   target_stopped_data_address.  In the future, it may also be used to
--   restore the siginfo of requeued signals.  */
--
--static void
--save_siginfo (struct lwp_info *lp)
--{
--  errno = 0;
--  ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
--        (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
--
--  if (errno != 0)
--    memset (&lp->siginfo, 0, sizeof (lp->siginfo));
--}
--
- /* Send a SIGSTOP to LP.  */
- static int
-@@ -2872,9 +2854,6 @@ stop_wait_callback (struct lwp_info *lp,
-       {
-         /* The thread was stopped with a signal other than SIGSTOP.  */
--        /* Save the trap's siginfo in case we need it later.  */
--        save_siginfo (lp);
--
-         save_sigtrap (lp);
-         if (debug_linux_nat)
-@@ -3278,12 +3257,7 @@ linux_nat_filter_event (int lwpid, int s
-     }
-   if (linux_nat_status_is_event (status))
--    {
--      /* Save the trap's siginfo in case we need it later.  */
--      save_siginfo (lp);
--
--      save_sigtrap (lp);
--    }
-+    save_sigtrap (lp);
-   /* Check if the thread has exited.  */
-   if ((WIFEXITED (status) || WIFSIGNALED (status))
-@@ -3961,7 +3935,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;
--      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
-       lp->stopped_by_watchpoint = 0;
-     }
-@@ -6029,11 +6002,19 @@ linux_nat_set_prepare_to_resume (struct
- struct siginfo *
- linux_nat_get_siginfo (ptid_t ptid)
- {
--  struct lwp_info *lp = find_lwp_pid (ptid);
-+  static struct siginfo siginfo;
-+  int pid;
--  gdb_assert (lp != NULL);
-+  pid = GET_LWP (ptid);
-+  if (pid == 0)
-+    pid = GET_PID (ptid);
-+
-+  errno = 0;
-+  ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
-+  if (errno != 0)
-+    memset (&siginfo, 0, sizeof (siginfo));
--  return &lp->siginfo;
-+  return &siginfo;
- }
- /* Provide a prototype to silence -Wmissing-prototypes.  */
-Index: gdb-7.4.50.20111218/gdb/linux-nat.h
-===================================================================
---- gdb-7.4.50.20111218.orig/gdb/linux-nat.h   2011-12-18 23:40:59.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/linux-nat.h        2011-12-19 02:17:21.355548276 +0100
-@@ -77,10 +77,6 @@ struct lwp_info
-   /* The kind of stepping of this LWP.  */
-   enum resume_step step;
--  /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
--     be the address of a hardware watchpoint.  */
--  struct siginfo siginfo;
--
-   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
-      watchpoint trap.  */
-   int stopped_by_watchpoint;
diff --git a/gdb-bz594560-core-vs-process.patch b/gdb-bz594560-core-vs-process.patch
deleted file mode 100644 (file)
index 5f7b9d4..0000000
+++ /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 (file)
index 75514ec..0000000
+++ /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
-
-<abstract-higher-point-of-view>
-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.
-</abstract-higher-point-of-view>
-
-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  <jan.kratochvil@redhat.com>
-
-       * 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  <jan.kratochvil@redhat.com>
-
-       * 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 <http://www.gnu.org/licenses/>.
- */
-+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 <stdio.h>
-+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 (file)
index 7a03f17..0000000
+++ /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  <jan.kratochvil@redhat.com>
-
-       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  <jan.kratochvil@redhat.com>
-
-       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 <http://www.gnu.org/licenses/>.  */
-+
-+/* 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 <http://www.gnu.org/licenses/>.  */
-+
-+/* 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 <http://www.gnu.org/licenses/>.
-+
-+# 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 <optimized out>.
-+gdb_test "p f()" { = {static s = <optimized out>}}
-
diff --git a/gdb-bz631158-cxx-this-lookup.patch b/gdb-bz631158-cxx-this-lookup.patch
deleted file mode 100644 (file)
index 0d7ae05..0000000
+++ /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 (file)
index 707a613..0000000
+++ /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  <jan.kratochvil@redhat.com>
-+
-+      * dwarf2read.c (dwarf2_read_index): Return on no SEC_HAS_CONTENTS.
-+
- 2010-09-08  Daniel Jacobowitz  <dan@codesourcery.com>
-       * 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 (file)
index 2223776..0000000
+++ /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  <jan.kratochvil@redhat.com>
-
-       * 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 (file)
index 17015dd..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-commit 30fedadf224a8c119575fcc8a6ced51f0d4aee9f
-Author: Jan Kratochvil <jan.kratochvil@redhat.com>
-Date:   Wed Sep 29 01:25:39 2010 +0200
-
-    Fix the crash.
-
-commit d101ce597f2d6143e9f023a4444352bceffb2679
-Author: Jan Kratochvil <jan.kratochvil@redhat.com>
-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 <http://www.gnu.org/licenses/>.  */
-+
-+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 <http://www.gnu.org/licenses/>.
-+
-+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-check-type.patch b/gdb-check-type.patch
new file mode 100644 (file)
index 0000000..fb44065
--- /dev/null
@@ -0,0 +1,1002 @@
+http://sourceware.org/ml/gdb-cvs/2012-08/msg00133.html
+
+### src/gdb/ChangeLog  2012/08/17 03:06:10     1.14599
+### src/gdb/ChangeLog  2012/08/17 17:36:56     1.14600
+## -1,3 +1,48 @@
++2012-08-17  Keith Seitz  <keiths@redhat.com>
++
++      PR c++/13356
++      * gdbtypes.c (strict_type_checking): New variable.
++      (show_strict_type_checking): New function.
++      (rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS
++      if strict type checking is disabled.
++      (_initialize_gdbtypes): Add "check type" subcommand.
++      * gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct.
++
++2012-08-17  Keith Seitz  <keiths@redhat.com>
++
++      * language.h (type_mode): Remove.
++      (type_check): Remove.
++      (struct language_defn): Remove la_type_check.
++      (STRICT_TYPE): Remove unused macro.
++      (type_error): Remove.
++      * language.c (set_type_range_case): Renamed to ...
++      (set_range_case): ... this.  Update all callers.
++      Remove type_mode/type_check.
++      (type_mode): Remove.
++      (type_check): Remove.
++      (show_type_command): Remove.
++      (set_type_command): Remove.
++      (language_info): Remove type checking output.
++      (type_error): Remove unused function.
++      (range_error): Update comment.
++      (unknown_language_defn): Remove la_type_check.
++      (auto_language_defn): Likewise.
++      (local_language_defn): Likewise.
++      (_initialize_language): Remove "check type" subcommand.
++      * ada-lang.c (ada_language_defn): Remove la_type_check.
++      * c-lang.c (c_language_defn): Likewise.
++      (cplus_language_defn): Likewise.
++      (asm_language_defn): Likewise.
++      (minimal_language_defn): Likewise.
++      * d-lang.c (d_language_defn): Likewise.
++      * f-lang.c (f_language_defn): Likewise.
++      * go-lang.c (go_language_defn): Likewise.
++      * jv-lang.c (java_language_defn): Likewise.
++      * m2-lang.c (m2_language_defn): Likewise.
++      * objc-lang.c (objc_language_defn): Likewise.
++      * opencl-lang.c (opencl_language_defn): Likewise.
++      * p-lang.c (pascal_language_defn): Likewise.
++
+ 2012-08-16  Mike Frysinger  <vapier@gentoo.org>
+       * infcmd.c (_initialize_infcmd): Remove trailing ) in next help text.
+Index: gdb-7.5.0.20120926/gdb/gdbtypes.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c     2012-09-27 22:14:21.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbtypes.c  2012-09-27 22:15:05.807706105 +0200
+@@ -62,6 +62,7 @@ const struct rank BASE_CONVERSION_BADNES
+ const struct rank REFERENCE_CONVERSION_BADNESS = {2,0};
+ const struct rank NULL_POINTER_CONVERSION_BADNESS = {2,0};
+ const struct rank NS_POINTER_CONVERSION_BADNESS = {10,0};
++const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS = {3,0};
+ /* Floatformat pairs.  */
+ const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN] = {
+@@ -134,6 +135,19 @@ show_overload_debug (struct ui_file *fil
+                   value);
+ }
++/* A flag to enable strict type checking.  */
++
++static int strict_type_checking = 1;
++
++/* A function to show the status of strict type checking.  */
++
++static void
++show_strict_type_checking (struct ui_file *file, int from_tty,
++                         struct cmd_list_element *c, const char *value)
++{
++  fprintf_filtered (file, _("Strict type checking is %s.\n"), value);
++}
++
+ struct extra
+   {
+     char str[128];
+@@ -2649,12 +2663,20 @@ rank_one_type (struct type *parm, struct
+       case TYPE_CODE_FUNC:
+         return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL);
+       case TYPE_CODE_INT:
+-        if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT
+-            && value_as_long (value) == 0)
++        if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT)
+           {
+-            /* Null pointer conversion: allow it to be cast to a pointer.
+-               [4.10.1 of C++ standard draft n3290]  */
+-            return NULL_POINTER_CONVERSION_BADNESS;
++            if (value_as_long (value) == 0)
++              {
++                /* Null pointer conversion: allow it to be cast to a pointer.
++                   [4.10.1 of C++ standard draft n3290]  */
++                return NULL_POINTER_CONVERSION_BADNESS;
++              }
++            else
++              {
++                /* If type checking is disabled, allow the conversion.  */
++                if (!strict_type_checking)
++                  return NS_INTEGER_POINTER_CONVERSION_BADNESS;
++              }
+           }
+         /* fall through  */
+       case TYPE_CODE_ENUM:
+@@ -4637,4 +4659,13 @@ _initialize_gdbtypes (void)
+                          NULL, NULL,
+                          show_opaque_type_resolution,
+                          &setlist, &showlist);
++
++  /* Add an option to permit non-strict type checking.  */
++  add_setshow_boolean_cmd ("type", class_support,
++                         &strict_type_checking,
++                         _("Set strict type checking."),
++                         _("Show strict type checking."),
++                         NULL, NULL,
++                         show_strict_type_checking,
++                         &setchecklist, &showchecklist);
+ }
+Index: gdb-7.5.0.20120926/gdb/gdbtypes.h
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h     2012-09-27 22:14:23.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/gdbtypes.h  2012-09-27 22:14:40.690695059 +0200
+@@ -1745,6 +1745,9 @@ extern const struct rank NULL_POINTER_CO
+ /* Converting a pointer to an int is usually OK.  */
+ extern const struct rank NS_POINTER_CONVERSION_BADNESS;
++/* Badness of converting a (non-zero) integer constant
++   to a pointer.  */
++extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS;
+ extern struct rank sum_ranks (struct rank a, struct rank b);
+ extern int compare_ranks (struct rank a, struct rank b);
+Index: gdb-7.5.0.20120926/gdb/language.h
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/language.h     2012-06-13 17:47:14.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/language.h  2012-09-27 22:14:40.834695121 +0200
+@@ -55,27 +55,6 @@ extern enum range_check
+   }
+ range_check;
+-/* type_mode ==
+-   type_mode_auto:   type_check set automatically to default of language.
+-   type_mode_manual: type_check set manually by user.  */
+-
+-extern enum type_mode
+-  {
+-    type_mode_auto, type_mode_manual
+-  }
+-type_mode;
+-
+-/* type_check ==
+-   type_check_on:    Types are checked in GDB expressions, producing errors.
+-   type_check_warn:  Types are checked, producing warnings.
+-   type_check_off:   Types are not checked in GDB expressions.  */
+-
+-extern enum type_check
+-  {
+-    type_check_off, type_check_warn, type_check_on
+-  }
+-type_check;
+-
+ /* case_mode ==
+    case_mode_auto:   case_sensitivity set upon selection of scope.
+    case_mode_manual: case_sensitivity set only by user.  */
+@@ -162,10 +141,6 @@ struct language_defn
+     enum range_check la_range_check;
+-    /* Default type checking.  */
+-
+-    enum type_check la_type_check;
+-
+     /* Default case sensitivity.  */
+     enum case_sensitivity la_case_sensitivity;
+@@ -422,9 +397,6 @@ struct type *language_lookup_primitive_t
+ /* These macros define the behaviour of the expression 
+    evaluator.  */
+-/* Should we strictly type check expressions?  */
+-#define STRICT_TYPE (type_check != type_check_off)
+-
+ /* Should we range check values against the domain of their type?  */
+ #define RANGE_CHECK (range_check != range_check_off)
+@@ -496,8 +468,6 @@ extern void binop_type_check (struct val
+ /* Error messages */
+-extern void type_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
+-
+ extern void range_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
+ /* Data:  Does this value represent "truth" to the current language?  */
+Index: gdb-7.5.0.20120926/gdb/language.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/language.c     2012-03-02 20:29:01.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/language.c  2012-09-27 22:14:40.922695162 +0200
+@@ -55,7 +55,7 @@ static void show_check (char *, int);
+ static void set_check (char *, int);
+-static void set_type_range_case (void);
++static void set_range_case (void);
+ static void unk_lang_emit_char (int c, struct type *type,
+                               struct ui_file *stream, int quoter);
+@@ -81,8 +81,6 @@ extern const struct language_defn unknow
+ enum range_mode range_mode = range_mode_auto;
+ enum range_check range_check = range_check_off;
+-enum type_mode type_mode = type_mode_auto;
+-enum type_check type_check = type_check_off;
+ enum case_mode case_mode = case_mode_auto;
+ enum case_sensitivity case_sensitivity = case_sensitive_on;
+@@ -174,7 +172,7 @@ set_language_command (char *ignore, int
+             /* Enter manual mode.  Set the specified language.  */
+             language_mode = language_mode_manual;
+             current_language = languages[i];
+-            set_type_range_case ();
++            set_range_case ();
+             expected_language = current_language;
+             return;
+           }
+@@ -186,79 +184,6 @@ set_language_command (char *ignore, int
+                 language);
+ }
+-/* Show command.  Display a warning if the type setting does
+-   not match the current language.  */
+-static void
+-show_type_command (struct ui_file *file, int from_tty,
+-                 struct cmd_list_element *c, const char *value)
+-{
+-  if (type_mode == type_mode_auto)
+-    {
+-      char *tmp = NULL;
+-
+-      switch (type_check)
+-      {
+-      case type_check_on:
+-        tmp = "on";
+-        break;
+-      case type_check_off:
+-        tmp = "off";
+-        break;
+-      case type_check_warn:
+-        tmp = "warn";
+-        break;
+-      default:
+-        internal_error (__FILE__, __LINE__,
+-                        "Unrecognized type check setting.");
+-      }
+-
+-      fprintf_filtered (gdb_stdout,
+-                      _("Type checking is \"auto; currently %s\".\n"),
+-                      tmp);
+-    }
+-  else
+-    fprintf_filtered (gdb_stdout, _("Type checking is \"%s\".\n"),
+-                    value);
+-
+-   if (type_check != current_language->la_type_check)
+-    warning (_("the current type check setting"
+-             " does not match the language.\n"));
+-}
+-
+-/* Set command.  Change the setting for type checking.  */
+-static void
+-set_type_command (char *ignore, int from_tty, struct cmd_list_element *c)
+-{
+-  if (strcmp (type, "on") == 0)
+-    {
+-      type_check = type_check_on;
+-      type_mode = type_mode_manual;
+-    }
+-  else if (strcmp (type, "warn") == 0)
+-    {
+-      type_check = type_check_warn;
+-      type_mode = type_mode_manual;
+-    }
+-  else if (strcmp (type, "off") == 0)
+-    {
+-      type_check = type_check_off;
+-      type_mode = type_mode_manual;
+-    }
+-  else if (strcmp (type, "auto") == 0)
+-    {
+-      type_mode = type_mode_auto;
+-      set_type_range_case ();
+-      return;
+-    }
+-  else
+-    internal_error (__FILE__, __LINE__,
+-                  _("Unrecognized type check setting: \"%s\""), type);
+-
+-  if (type_check != current_language->la_type_check)
+-    warning (_("the current type check setting"
+-             " does not match the language.\n"));
+-}
+-
+ /* Show command.  Display a warning if the range setting does
+    not match the current language.  */
+ static void
+@@ -320,7 +245,7 @@ set_range_command (char *ignore, int fro
+   else if (strcmp (range, "auto") == 0)
+     {
+       range_mode = range_mode_auto;
+-      set_type_range_case ();
++      set_range_case ();
+       return;
+     }
+   else
+@@ -389,7 +314,7 @@ set_case_command (char *ignore, int from
+    else if (strcmp (case_sensitive, "auto") == 0)
+      {
+        case_mode = case_mode_auto;
+-       set_type_range_case ();
++       set_range_case ();
+        return;
+      }
+    else
+@@ -409,14 +334,11 @@ set_case_command (char *ignore, int from
+    If SHOW is non-zero, then print out the current language,
+    type and range checking status.  */
+ static void
+-set_type_range_case (void)
++set_range_case (void)
+ {
+   if (range_mode == range_mode_auto)
+     range_check = current_language->la_range_check;
+-  if (type_mode == type_mode_auto)
+-    type_check = current_language->la_type_check;
+-
+   if (case_mode == case_mode_auto)
+     case_sensitivity = current_language->la_case_sensitivity;
+ }
+@@ -437,7 +359,7 @@ set_language (enum language lang)
+       if (languages[i]->la_language == lang)
+       {
+         current_language = languages[i];
+-        set_type_range_case ();
++        set_range_case ();
+         break;
+       }
+     }
+@@ -461,8 +383,6 @@ language_info (int quietly)
+   if (!quietly)
+     {
+-      printf_unfiltered (_("Type checking:     %s\n"), type);
+-      show_type_command (NULL, 1, NULL, NULL);
+       printf_unfiltered (_("Range checking:    %s\n"), range);
+       show_range_command (NULL, 1, NULL, NULL);
+       printf_unfiltered (_("Case sensitivity:  %s\n"), case_sensitive);
+@@ -500,38 +420,11 @@ value_true (struct value *val)
+    error messages that occur during type- and range-
+    checking.  */
+-/* These are called when a language fails a type- or range-check.  The
++/* This is called when a language fails a range-check.  The
+    first argument should be a printf()-style format string, and the
+-   rest of the arguments should be its arguments.  If
+-   [type|range]_check is [type|range]_check_on, an error is printed;
+-   if [type|range]_check_warn, a warning; otherwise just the
+-   message.  */
+-
+-void
+-type_error (const char *string,...)
+-{
+-  va_list args;
+-
+-  va_start (args, string);
+-  switch (type_check)
+-    {
+-    case type_check_warn:
+-      vwarning (string, args);
+-      break;
+-    case type_check_on:
+-      verror (string, args);
+-      break;
+-    case type_check_off:
+-      /* FIXME: cagney/2002-01-30: Should this function print anything
+-         when type error is off?  */
+-      vfprintf_filtered (gdb_stderr, string, args);
+-      fprintf_filtered (gdb_stderr, "\n");
+-      break;
+-    default:
+-      internal_error (__FILE__, __LINE__, _("bad switch"));
+-    }
+-  va_end (args);
+-}
++   rest of the arguments should be its arguments.  If range_check is
++   range_check_on, an error is printed;  if range_check_warn, a warning;
++   otherwise just the message.  */
+ void
+ range_error (const char *string,...)
+@@ -902,7 +795,6 @@ const struct language_defn unknown_langu
+   "unknown",
+   language_unknown,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+@@ -946,7 +838,6 @@ const struct language_defn auto_language
+   "auto",
+   language_auto,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+@@ -988,7 +879,6 @@ const struct language_defn local_languag
+   "local",
+   language_auto,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+@@ -1135,13 +1025,6 @@ _initialize_language (void)
+   add_alias_cmd ("c", "check", no_class, 1, &showlist);
+   add_alias_cmd ("ch", "check", no_class, 1, &showlist);
+-  add_setshow_enum_cmd ("type", class_support, type_or_range_names, &type,
+-                      _("Set type checking.  (on/warn/off/auto)"),
+-                      _("Show type checking.  (on/warn/off/auto)"),
+-                      NULL, set_type_command,
+-                      show_type_command,
+-                      &setchecklist, &showchecklist);
+-
+   add_setshow_enum_cmd ("range", class_support, type_or_range_names,
+                       &range,
+                       _("Set range checking.  (on/warn/off/auto)"),
+Index: gdb-7.5.0.20120926/gdb/ada-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/ada-lang.c     2012-09-27 22:14:17.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/ada-lang.c  2012-09-27 22:14:41.112695245 +0200
+@@ -12503,7 +12503,6 @@ const struct language_defn ada_language_
+   "ada",                        /* Language name */
+   language_ada,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,            /* Yes, Ada is case-insensitive, but
+                                    that's not quite what this means.  */
+   array_row_major,
+Index: gdb-7.5.0.20120926/gdb/c-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/c-lang.c       2012-07-06 07:46:04.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/c-lang.c    2012-09-27 22:14:41.141695257 +0200
+@@ -831,7 +831,6 @@ const struct language_defn c_language_de
+   "c",                                /* Language name */
+   language_c,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+@@ -955,7 +954,6 @@ const struct language_defn cplus_languag
+   "c++",                      /* Language name */
+   language_cplus,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+@@ -997,7 +995,6 @@ const struct language_defn asm_language_
+   "asm",                      /* Language name */
+   language_asm,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+@@ -1044,7 +1041,6 @@ const struct language_defn minimal_langu
+   "minimal",                  /* Language name */
+   language_minimal,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+Index: gdb-7.5.0.20120926/gdb/d-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/d-lang.c       2012-03-15 15:06:20.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/d-lang.c    2012-09-27 22:14:41.143695257 +0200
+@@ -240,7 +240,6 @@ static const struct language_defn d_lang
+   "d",
+   language_d,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+Index: gdb-7.5.0.20120926/gdb/f-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/f-lang.c       2012-09-27 22:14:23.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/f-lang.c    2012-09-27 22:14:41.151695260 +0200
+@@ -260,7 +260,6 @@ const struct language_defn f_language_de
+   "fortran",
+   language_fortran,
+   range_check_on,
+-  type_check_on,
+   case_sensitive_off,
+   array_column_major,
+   macro_expansion_no,
+Index: gdb-7.5.0.20120926/gdb/go-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/go-lang.c      2012-04-25 16:07:20.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/go-lang.c   2012-09-27 22:14:41.152695261 +0200
+@@ -562,7 +562,6 @@ static const struct language_defn go_lan
+   "go",
+   language_go,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+Index: gdb-7.5.0.20120926/gdb/jv-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/jv-lang.c      2012-09-27 22:14:23.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/jv-lang.c   2012-09-27 22:14:41.154695263 +0200
+@@ -1169,7 +1169,6 @@ const struct language_defn java_language
+   "java",                     /* Language name */
+   language_java,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+Index: gdb-7.5.0.20120926/gdb/m2-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/m2-lang.c      2012-03-02 20:29:01.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/m2-lang.c   2012-09-27 22:14:41.161695266 +0200
+@@ -370,7 +370,6 @@ const struct language_defn m2_language_d
+   "modula-2",
+   language_m2,
+   range_check_on,
+-  type_check_on,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+Index: gdb-7.5.0.20120926/gdb/objc-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/objc-lang.c    2012-03-02 20:29:01.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/objc-lang.c 2012-09-27 22:14:41.163695268 +0200
+@@ -509,7 +509,6 @@ const struct language_defn objc_language
+   "objective-c",              /* Language name */
+   language_objc,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+Index: gdb-7.5.0.20120926/gdb/opencl-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/opencl-lang.c  2012-03-02 20:29:01.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/opencl-lang.c       2012-09-27 22:14:41.165695268 +0200
+@@ -993,7 +993,6 @@ const struct language_defn opencl_langua
+   "opencl",                   /* Language name */
+   language_opencl,
+   range_check_off,
+-  type_check_off,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_c,
+Index: gdb-7.5.0.20120926/gdb/p-lang.c
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/p-lang.c       2012-03-02 20:29:01.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/p-lang.c    2012-09-27 22:14:41.170695270 +0200
+@@ -429,7 +429,6 @@ const struct language_defn pascal_langua
+   "pascal",                   /* Language name */
+   language_pascal,
+   range_check_on,
+-  type_check_on,
+   case_sensitive_on,
+   array_row_major,
+   macro_expansion_no,
+Index: gdb-7.5.0.20120926/gdb/doc/gdb.texinfo
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/doc/gdb.texinfo        2012-09-27 22:14:23.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/doc/gdb.texinfo     2012-09-27 22:14:41.188695279 +0200
+@@ -12648,29 +12648,18 @@ List all the filename extensions and the
+ @node Checks
+ @section Type and Range Checking
+-@quotation
+-@emph{Warning:} In this release, the @value{GDBN} commands for type and range
+-checking are included, but they do not yet have any effect.  This
+-section documents the intended facilities.
+-@end quotation
+-@c FIXME remove warning when type/range code added
+-
+ Some languages are designed to guard you against making seemingly common
+ errors through a series of compile- and run-time checks.  These include
+-checking the type of arguments to functions and operators, and making
++checking the type of arguments to functions and operators and making
+ sure mathematical overflows are caught at run time.  Checks such as
+ these help to ensure a program's correctness once it has been compiled
+-by eliminating type mismatches, and providing active checks for range
++by eliminating type mismatches and providing active checks for range
+ errors when your program is running.
+-@value{GDBN} can check for conditions like the above if you wish.
+-Although @value{GDBN} does not check the statements in your program,
+-it can check expressions entered directly into @value{GDBN} for
+-evaluation via the @code{print} command, for example.  As with the
+-working language, @value{GDBN} can also decide whether or not to check
+-automatically based on your program's source language.
+-@xref{Supported Languages, ,Supported Languages}, for the default
+-settings of supported languages.
++By default @value{GDBN} checks for these errors according to the
++rules of the current source language.  Although @value{GDBN} does not check
++the statements in your program, it can check expressions entered directly
++into @value{GDBN} for evaluation via the @code{print} command, for example.
+ @menu
+ * Type Checking::               An overview of type checking
+@@ -12682,69 +12671,51 @@ settings of supported languages.
+ @node Type Checking
+ @subsection An Overview of Type Checking
+-Some languages, such as Modula-2, are strongly typed, meaning that the
++Some languages, such as C and C@t{++}, are strongly typed, meaning that the
+ arguments to operators and functions have to be of the correct type,
+ otherwise an error occurs.  These checks prevent type mismatch
+ errors from ever causing any run-time problems.  For example,
+ @smallexample
+-1 + 2 @result{} 3
++int klass::my_method(char *b) @{ return  b ? 1 : 2; @}
++
++(@value{GDBP}) print obj.my_method (0)
++$1 = 2
+ @exdent but
+-@error{} 1 + 2.3
++(@value{GDBP}) print obj.my_method (0x1234)
++Cannot resolve method klass::my_method to any overloaded instance
+ @end smallexample
+-The second example fails because the @code{CARDINAL} 1 is not
+-type-compatible with the @code{REAL} 2.3.
++The second example fails because in C@t{++} the integer constant
++@samp{0x1234} is not type-compatible with the pointer parameter type.
+-For the expressions you use in @value{GDBN} commands, you can tell the
+-@value{GDBN} type checker to skip checking;
++For the expressions you use in @value{GDBN} commands, you can tell
++@value{GDBN} to not enforce strict type checking or
+ to treat any mismatches as errors and abandon the expression;
+-or to only issue warnings when type mismatches occur,
+-but evaluate the expression anyway.  When you choose the last of
+-these, @value{GDBN} evaluates expressions like the second example above, but
+-also issues a warning.
++When type checking is disabled, @value{GDBN} successfully evaluates
++expressions like the second example above.
+-Even if you turn type checking off, there may be other reasons
++Even if type checking is off, there may be other reasons
+ related to type that prevent @value{GDBN} from evaluating an expression.
+ For instance, @value{GDBN} does not know how to add an @code{int} and
+ a @code{struct foo}.  These particular type errors have nothing to do
+-with the language in use, and usually arise from expressions, such as
+-the one described above, which make little sense to evaluate anyway.
+-
+-Each language defines to what degree it is strict about type.  For
+-instance, both Modula-2 and C require the arguments to arithmetical
+-operators to be numbers.  In C, enumerated types and pointers can be
+-represented as numbers, so that they are valid arguments to mathematical
+-operators.  @xref{Supported Languages, ,Supported Languages}, for further
+-details on specific languages.
++with the language in use and usually arise from expressions which make
++little sense to evaluate anyway.
+-@value{GDBN} provides some additional commands for controlling the type checker:
++@value{GDBN} provides some additional commands for controlling type checking:
+ @kindex set check type
+ @kindex show check type
+ @table @code
+-@item set check type auto
+-Set type checking on or off based on the current working language.
+-@xref{Supported Languages, ,Supported Languages}, for the default settings for
+-each language.
+-
+ @item set check type on
+ @itemx set check type off
+-Set type checking on or off, overriding the default setting for the
+-current working language.  Issue a warning if the setting does not
+-match the language default.  If any type mismatches occur in
++Set strict type checking on or off.  If any type mismatches occur in
+ evaluating an expression while type checking is on, @value{GDBN} prints a
+ message and aborts evaluation of the expression.
+-@item set check type warn
+-Cause the type checker to issue warnings, but to always attempt to
+-evaluate the expression.  Evaluating the expression may still
+-be impossible for other reasons.  For example, @value{GDBN} cannot add
+-numbers and structures.
+-
+-@item show type
+-Show the current setting of the type checker, and whether or not @value{GDBN}
+-is setting it automatically.
++@item show check type
++Show the current setting of type checking and whether @value{GDBN}
++is enforcing strict type checking rules.
+ @end table
+ @cindex range checking
+@@ -13195,8 +13166,8 @@ specification.
+ @cindex C and C@t{++} defaults
+-If you allow @value{GDBN} to set type and range checking automatically, they
+-both default to @code{off} whenever the working language changes to
++If you allow @value{GDBN} to set range checking automatically, it
++defaults to @code{off} whenever the working language changes to
+ C or C@t{++}.  This happens regardless of whether you or @value{GDBN}
+ selects the working language.
+@@ -13207,37 +13178,15 @@ these files, it sets the working languag
+ @xref{Automatically, ,Having @value{GDBN} Infer the Source Language},
+ for further details.
+-@c Type checking is (a) primarily motivated by Modula-2, and (b)
+-@c unimplemented.  If (b) changes, it might make sense to let this node
+-@c appear even if Mod-2 does not, but meanwhile ignore it. roland 16jul93.
+-
+ @node C Checks
+ @subsubsection C and C@t{++} Type and Range Checks
+ @cindex C and C@t{++} checks
+-By default, when @value{GDBN} parses C or C@t{++} expressions, type checking
+-is not used.  However, if you turn type checking on, @value{GDBN}
+-considers two variables type equivalent if:
+-
+-@itemize @bullet
+-@item
+-The two variables are structured and have the same structure, union, or
+-enumerated tag.
+-
+-@item
+-The two variables have the same type name, or types that have been
+-declared equivalent through @code{typedef}.
+-
+-@ignore
+-@c leaving this out because neither J Gilmore nor R Pesch understand it.
+-@c FIXME--beers?
+-@item
+-The two @code{struct}, @code{union}, or @code{enum} variables are
+-declared in the same declaration.  (Note: this may not be true for all C
+-compilers.)
+-@end ignore
+-@end itemize
++By default, when @value{GDBN} parses C or C@t{++} expressions, strict type
++checking is used.  However, if you turn type checking off, @value{GDBN}
++will allow certain non-standard conversions, such as promoting integer
++constants to pointers.
+ Range checking, if turned on, is done on mathematical operations.  Array
+ indices are not checked, since they are often used to index a pointer
+Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/default.exp 2012-04-27 22:52:06.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp      2012-09-27 22:14:41.312695333 +0200
+@@ -495,12 +495,13 @@ gdb_test "section" "Must specify section
+ gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
+ #test set args
+ gdb_test_no_output "set args" "set args"
+-#test set check "c" abbreviation
+-gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation"
+-#test set check "ch" abbreviation
+-gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation"
+-#test set check
+-gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check"
++
++# Test set check abbreviations
++foreach x {"c" "ch" "check"} {
++    gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \
++      "set check \"$x\" abbreviation"
++}
++
+ #test set check range
+ gdb_test "set check range" ".*" "set check range"
+ #test set check type
+@@ -577,16 +578,17 @@ gdb_test "shell echo Hi dad!" "Hi dad!"
+ gdb_test "show annotate" "Annotation_level is 0."      "show annotate"
+ #test show args
+ gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args"
+-#test show check "c" abbreviation
+-gdb_test "show c" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation"
+-#test show check "ch" abbreviation
+-gdb_test "show ch" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation"
+-#test show check
+-gdb_test "show check" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Type checking is \"auto; currently off\"." "show check"
++
++# test show check abbreviations
++foreach x {"c" "ch" "check"} {
++    gdb_test "show $x" "range:  *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type:  *Strict type checking is on\..*" \
++      "show check \"$x\" abbreviation"
++}
++
+ #test show check range
+ gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
+ #test show check type
+-gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type"
++gdb_test "show check type" "Strict type checking is on\." "show check type"
+ #test show commands
+ gdb_test "show commands" ".*" "show commands"
+ #test show complaints
+Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/help.exp    2012-07-02 19:53:19.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp 2012-09-27 22:14:41.315695333 +0200
+@@ -376,22 +376,26 @@ gdb_test "help section" "Change the base
+ gdb_test "help set annotate" "Set annotation_level\.\[\r\n\]+0 == normal;     1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help set annotate"
+ # test help set args
+ gdb_test "help set args" "Set argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\."
+-# test help set check "c" abbreviation
+-test_prefix_command_help {"set c" "set check"} {
+-    "Set the status of the type/range checker\.\[\r\n\]+"
+-} "help set check \"c\" abbreviation"
+-# test help set check "ch" abbreviation
+-test_prefix_command_help {"set ch" "set check"} {
+-    "Set the status of the type/range checker\.\[\r\n\]+"
+-} "help set check \"ch\" abbreviation"
+-# test help set check
++
++# Test help set check abbreviations
++foreach x {"c" "ch"} {
++    test_prefix_command_help [list "set $x" "set check"] {
++      "Set the status of the type/range checker\.\[\r\n\]+"
++    } "help set check \"$x\" abbreviation"
++}
++
++# Test help set check
+ test_prefix_command_help {"set check"} {
+     "Set the status of the type/range checker\.\[\r\n\]+"
+ }
++
+ # test help set check range
+ gdb_test "help set check range" "Set range checking\.  \\(on/warn/off/auto\\)" "help set check range"
+-# test help set check type
+-gdb_test "help set check type" "Set type checking\.  \\(on/warn/off/auto\\)." "help set check type"
++
++# Test help set check type
++gdb_test "help set check type" "Set strict type checking\." \
++    "help set check type"
++
+ # test help set complaints
+ gdb_test "help set complaints" "Set max number of complaints about incorrect symbols\." "help set complaints"
+ # test help set confirm
+@@ -487,18 +491,25 @@ gdb_test "help shell" "Execute the rest
+ gdb_test "help show annotate" "Show annotation_level\.\[\r\n\]+0 == normal;     1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help show annotate"
+ # test help show args
+ gdb_test "help show args" "Show argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\."
+-# test help show check "c" abbreviation
+-test_prefix_command_help {"show c" "show check"} {
+-    "Show the status of the type/range checker\.\[\r\n\]+"
+-} "help show check \"c\" abbreviation"
++
++# Test help show check abbreviations
++foreach x {"c" "check"} {
++    test_prefix_command_help [list "show $x" "show check"] {
++      "Show the status of the type/range checker\.\[\r\n\]+"
++    } "help show check \"$x\" abbreviation"
++}
++
+ # test help show check
+ test_prefix_command_help {"show check"} {
+     "Show the status of the type/range checker\.\[\r\n\]+"
+ }
+ # test help show check range
+ gdb_test "help show check range" "Show range checking\.  \\(on/warn/off/auto\\)" "help show check range"
++
+ # test help show check type
+-gdb_test "help show check type" "Show type checking\.  \\(on/warn/off/auto\\)" "help show check type"
++gdb_test "help show check type" "Show strict type checking\." \
++    "help show check type"
++
+ # test help show commands
+ gdb_test "help show commands" "Show the history of commands you typed\.\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after\[\r\n\]+the previous command number shown\." "help show commands"
+ # test help show complaints
+Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/setshow.exp 2012-03-13 22:02:40.000000000 +0100
++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp      2012-09-27 22:14:41.320695336 +0200
+@@ -110,19 +110,22 @@ gdb_test "show check range" "Range check
+ #test set check range auto
+ gdb_test_no_output "set check range auto" "set check range auto" 
+ #test show check range auto
+-gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" 
+-#test set check type on
+-gdb_test "set check type on" ".*" "set check type on" 
+-#test show check type on
+-gdb_test "show check type" "Type checking is \"on\"..*" "show check type (on)" 
+-#test set check type off with trailing space
+-gdb_test_no_output "set check type off " "set check type off" 
+-#test show check type off
+-gdb_test "show check type" "Type checking is \"off\"..*" "show check type (off)" 
+-#test set check type auto
+-gdb_test_no_output "set check type auto" "set check type auto" 
+-#test show check type
+-gdb_test "show check type" "Type checking is \"auto; currently .*" "show check type (auto)" 
++gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)"
++
++# Test set check type on
++gdb_test "set check type on" ".*" "set check type on"
++
++# Test show check type on
++gdb_test "show check type" "Strict type checking is on\..*" \
++    "show check type (on)"
++
++# Test set check type off with trailing space
++gdb_test_no_output "set check type off " "set check type off"
++
++# Test show check type off
++gdb_test "show check type" "Strict type checking is off\..*" \
++    "show check type (off)"
++
+ #test set complaints 100
+ gdb_test_no_output "set complaints 100" "set complaints 100" 
+ #test show complaints 100
+Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.exp  2012-07-10 17:18:18.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp       2012-09-27 22:14:41.321695337 +0200
+@@ -70,9 +70,37 @@ gdb_test_multiple "p foo3_1 (0, 0)" $t {
+     pass $t
+   }
+ }
++
+ gdb_test "p foo3_1 (0, 1)" \
+     "Cannot resolve function foo3_1 to any overloaded instance"
+ gdb_test "p foo3_1 (0, (const char**) 1)" " = 31"
+ gdb_test "p foo3_2 (0, 0)" "= 32"
+ gdb_test "p foo3_2 (0, (char const**) 0)" " = 320"
++# Test for strict type checking
++set error_str "Cannot resolve function %s to any overloaded instance"
++gdb_test "show check type" "Strict type checking is on\."
++gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"]
++gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"]
++gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"]
++gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"]
++gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"]
++gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"]
++gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"]
++gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"]
++gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"]
++gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"]
++
++gdb_test_no_output "set check type off"
++gdb_test "show check type" "Strict type checking is off\."
++gdb_test "p foo1_type_check (123)" " = 1000"
++gdb_test "p foo2_type_check (0, 1)" " = 1001"
++gdb_test "p foo2_type_check (1, 0)" " = 1001"
++gdb_test "p foo2_type_check (1, 1)" " = 1001"
++gdb_test "p foo3_type_check (0, 0, 1)" " = 1002"
++gdb_test "p foo3_type_check (0, 1, 0)" " = 1002"
++gdb_test "p foo3_type_check (1, 0, 0)" " = 1002"
++gdb_test "p foo3_type_check (0, 1, 1)" " = 1002"
++gdb_test "p foo3_type_check (1, 1, 0)" " = 1002"
++gdb_test "p foo3_type_check (1, 1, 1)" " = 1002"
++gdb_test "p foo3_2 (1,1)" " = 32"
+Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc
+===================================================================
+--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.cc   2011-10-14 22:22:50.000000000 +0200
++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc        2012-09-27 22:14:41.322695337 +0200
+@@ -27,6 +27,10 @@ int foo3_1 (int a, const char **b) { ret
+ int foo3_2 (int a, int b) { return 32; }
+ int foo3_2 (int a, const char **b) { return 320; }
++int foo1_type_check (char *a) { return 1000; }
++int foo2_type_check (char *a, char *b) { return 1001; }
++int foo3_type_check (char *a, char *b, char *c) { return 1002; }
++
+ int main()
+ {
+@@ -62,5 +66,9 @@ int main()
+   foo3_2 (0, static_cast<char const**> (0));
+   foo3_2 (0, 0);
++  foo1_type_check (a);
++  foo2_type_check (a, a);
++  foo3_type_check (a, a, a);
++
+   return 0;          // end of main
+ }
index a4213674d89371dc76d00acdd428458e7f3c6292..b8356573c9cf2043a93971da1aa8c27763ff6813 100644 (file)
@@ -1,43 +1,13 @@
 http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
 Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map:  Input/output error.
 
-Hi,
+[ New patch variant.  ]
 
-GDB currently always prints on loading a core file:
-       warning: Can't read pathname for load map: Input/output error.
-
-The patch is not nice but it was WONTFIXed on the glibc side in:
-       http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
-
-The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name
-but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY.
-
-This fix is intended for Linux system vDSO l_name which is a second entry in
-the DSO list.
-
-Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2009-10-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Do not print false warning on reading core file with vDSO on GNU/Linux.
-       * solib-svr4.c (svr4_current_sos): Suppress the warning if
-       MASTER_SO_LIST is still NULL.
-       * solib.c (update_solib_list): New variable saved_so_list_head.
-       Conditionally restart the function.
-
-[ Context backport.  ]
-
-Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
+Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c  2011-12-19 01:14:31.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/solib-svr4.c       2011-12-19 01:31:10.106752164 +0100
-@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
+--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c  2012-07-06 15:39:57.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/solib-svr4.c       2012-07-06 15:40:01.124816148 +0200
+@@ -1221,8 +1221,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
                          SO_NAME_MAX_PATH_SIZE - 1, &errcode);
        if (errcode != 0)
        {
@@ -57,28 +27,105 @@ Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
          do_cleanups (old_chain);
          continue;
        }
-Index: gdb-7.4.50.20111218/gdb/solib.c
+Index: gdb-7.4.50.20120703/gdb/solib.c
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/solib.c       2011-09-12 21:00:22.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/solib.c    2011-12-19 01:29:04.815227898 +0100
-@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct
+--- gdb-7.4.50.20120703.orig/gdb/solib.c       2012-07-06 15:38:39.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/solib.c    2012-07-06 15:40:01.125816147 +0200
+@@ -672,7 +672,7 @@ solib_used (const struct so_list *const
+    processes we've just attached to, so that's okay.  */
+ static void
+-update_solib_list (int from_tty, struct target_ops *target)
++update_solib_list_1 (int from_tty, struct target_ops *target)
+ {
    struct target_so_ops *ops = solib_ops (target_gdbarch);
    struct so_list *inferior = ops->current_sos();
-   struct so_list *gdb, **gdb_link;
+@@ -843,6 +843,21 @@ Do you need \"set solib-search-path\" or
+     }
+ }
++/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch  */
++
++static void
++update_solib_list (int from_tty, struct target_ops *target)
++{
 +  struct so_list *saved_so_list_head = so_list_head;
++
++  update_solib_list_1 (from_tty, target);
++
++  /* If this was the very first DSO list scan and we possibly read in ld.so
++     recheck all the formerly unreadable DSO names strings.  */
++
++  if (saved_so_list_head == NULL && so_list_head != NULL)
++    update_solib_list_1 (from_tty, target);
++}
  
-   /* We can reach here due to changing solib-search-path or the
-      sysroot, before having any inferior.  */
-@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct
-         observer_notify_solib_loaded (i);
-       }
+ /* Return non-zero if NAME is the libpthread shared library.
  
-+      /* If this was the very first DSO list scan and we possibly read in ld.so
-+       recheck all the formerly unreadable DSO names strings.  */
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp
+===================================================================
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp       2012-07-06 15:39:41.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp    2012-07-06 15:40:10.322805539 +0200
+@@ -286,3 +286,19 @@ if {$buildid == ""} {
+     gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+     pass $wholetest
+ }
++
++
++# Test Linux specific vDSO warning:
++# warning: Can't read pathname for load map: Input/output error.
 +
-+      if (saved_so_list_head == NULL && so_list_head != NULL)
-+      return update_solib_list (from_tty, target);
++clean_restart ${testfile}
 +
-       /* If a library was not found, issue an appropriate warning
-        message.  We have to use a single call to warning in case the
-        front end does something special with warnings, e.g., pop up
++set test "core-file vdso warning"
++gdb_test_multiple "core-file $corefile" $test {
++    -re "warning: Can't read pathname for load map: Input/output error\\.\r\n.*\r\n$gdb_prompt $" {
++      fail $test
++    }
++    -re "\r\n$gdb_prompt $" {
++      pass $test
++    }
++}
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp
+===================================================================
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp   2012-07-06 15:38:39.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp        2012-07-06 15:40:01.127816145 +0200
+@@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B
+ # Binary file.
+ set testfile "solib-symbol-main"
+ set srcfile ${srcdir}/${subdir}/${testfile}.c
+-set binfile ${objdir}/${subdir}/${testfile}
++set executable ${testfile}
++set binfile ${objdir}/${subdir}/${executable}
+ set bin_flags [list debug shlib=${binfile_lib}]
+ if [get_compiler_info] {
+@@ -72,8 +73,26 @@ gdb_test "br foo2" \
+        "Breakpoint.*: foo2. .2 locations..*" \
+        "foo2 in mdlib"
+-gdb_exit
++# Test GDB warns for shared libraris which have not been found.
+-return 0
++gdb_test "info sharedlibrary" "/${libname}.*"
++clean_restart ${executable}
++gdb_breakpoint "main"
++gdb_run_cmd
++set test "no warning for missing libraries"
++gdb_test_multiple "" $test {
++    -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" {
++      fail $test
++    }
++    -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" {
++      pass $test
++    }
++}
++clean_restart ${executable}
++gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
++gdb_breakpoint "main"
++gdb_run_cmd
++gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
++       "warning for missing libraries"
diff --git a/gdb-die-cu-offset-1of2.patch b/gdb-die-cu-offset-1of2.patch
deleted file mode 100644 (file)
index 2b0e91f..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-[commit] [patch] Fix CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback]
-http://sourceware.org/ml/gdb-patches/2012-03/msg00284.html
-http://sourceware.org/ml/gdb-cvs/2012-03/msg00134.html
-
-### src/gdb/ChangeLog  2012/03/08 19:08:09     1.13979
-### src/gdb/ChangeLog  2012/03/08 19:37:04     1.13980
-## -1,5 +1,15 @@
- 2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
-+      Fix CU relative vs. absolute DIE offsets.
-+      * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
-+      offset to offset_in_cu.
-+      * dwarf2read.c (process_enumeration_scope): Add CU offset to
-+      TYPE_OFFSET.
-+      (dwarf2_fetch_die_location_block): Rename parameter offset to
-+      offset_in_cu.  New variable offset, add CU offset to OFFSET_IN_CU.
-+
-+2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
-+
-       * libunwind-frame.c: Rename to ...
-       * ia64-libunwind-tdep.c: ... here.
-       * libunwind-frame.h: Rename to ...
---- src/gdb/dwarf2loc.h        2012/01/05 21:53:14     1.29
-+++ src/gdb/dwarf2loc.h        2012/03/08 19:37:07     1.30
-@@ -61,7 +61,7 @@
-    CORE_ADDR pc);
- struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
--  (unsigned int offset, struct dwarf2_per_cu_data *per_cu,
-+  (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu,
-    CORE_ADDR (*get_frame_pc) (void *baton),
-    void *baton);
---- src/gdb/dwarf2read.c       2012/03/06 23:41:50     1.619
-+++ src/gdb/dwarf2read.c       2012/03/08 19:37:07     1.620
-@@ -8031,7 +8031,8 @@
-       = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
-                                           cu->per_cu->debug_types_section,
-                                           cu->per_cu->offset);
--      if (type_sig->type_offset != die->offset)
-+      if (type_sig->per_cu.offset + type_sig->type_offset
-+        != die->offset)
-       return;
-     }
-@@ -14202,11 +14203,12 @@
-    dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE.  */
- struct dwarf2_locexpr_baton
--dwarf2_fetch_die_location_block (unsigned int offset,
-+dwarf2_fetch_die_location_block (unsigned int offset_in_cu,
-                                struct dwarf2_per_cu_data *per_cu,
-                                CORE_ADDR (*get_frame_pc) (void *baton),
-                                void *baton)
- {
-+  unsigned int offset = per_cu->offset + offset_in_cu;
-   struct dwarf2_cu *cu;
-   struct die_info *die;
-   struct attribute *attr;
-### src/gdb/testsuite/ChangeLog        2012/03/08 07:42:50     1.3127
-### src/gdb/testsuite/ChangeLog        2012/03/08 19:37:07     1.3128
-## -1,5 +1,11 @@
- 2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
-+      Fix CU relative vs. absolute DIE offsets.
-+      * gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing
-+      one.
-+
-+2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
-+
-       Fix false FAIL on distros with relro linkage as default.
-       * gdb.reverse/solib-precsave.exp: Try to compile the test using
-       -Wl,-z,norelro first.
---- src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/01/04 08:17:51     1.5
-+++ src/gdb/testsuite/gdb.dwarf2/dw2-op-call.S 2012/03/08 19:37:08     1.6
-@@ -23,6 +23,23 @@
- array3:       .2byte  3
-       .section .debug_info
-+.Lcu0_begin:
-+      /* CU header */
-+      .4byte  .Lcu0_end - .Lcu0_start         /* Length of Compilation Unit */
-+.Lcu0_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  "file0.txt\0"                   /* DW_AT_name */
-+      .ascii  "GNU C 3.3.3\0"                 /* DW_AT_producer */
-+      .byte   2                               /* DW_LANG_C (C) */
-+
-+      .byte   0                               /* End of children of CU */
-+.Lcu0_end:
-+
- .Lcu1_begin:
-       /* CU header */
-       .4byte  .Lcu1_end - .Lcu1_start         /* Length of Compilation Unit */
diff --git a/gdb-die-cu-offset-2of2.patch b/gdb-die-cu-offset-2of2.patch
deleted file mode 100644 (file)
index 057088c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback
-http://sourceware.org/ml/gdb-patches/2012-03/msg00166.html
-http://sourceware.org/ml/gdb-cvs/2012-03/msg00118.html
-
-### src/gdb/ChangeLog  2012/03/06 22:48:49     1.13968
-### src/gdb/ChangeLog  2012/03/06 23:41:47     1.13969
-## -1,3 +1,8 @@
-+2012-03-06  Joel Brobecker  <brobecker@adacore.com>
-+
-+      * dwarf2read.c (dwarf2_get_die_type): Pass absolute offset
-+      in call to get_die_type_at_offset.
-+
- 2012-03-06  Stan Shebs  <stan@codesourcery.com>
-       * mi/mi-cmd-break.c: Enforce coding standards, fix comments.
---- src/gdb/dwarf2read.c       2012/03/02 01:55:15     1.618
-+++ src/gdb/dwarf2read.c       2012/03/06 23:41:50     1.619
-@@ -14269,7 +14269,7 @@
-                    struct dwarf2_per_cu_data *per_cu)
- {
-   dw2_setup (per_cu->objfile);
--  return get_die_type_at_offset (die_offset, per_cu);
-+  return get_die_type_at_offset (per_cu->offset + die_offset, per_cu);
- }
- /* Follow the signature attribute ATTR in SRC_DIE.
diff --git a/gdb-dlopen-stap-probe-1of7.patch b/gdb-dlopen-stap-probe-1of7.patch
new file mode 100644 (file)
index 0000000..1891fb3
--- /dev/null
@@ -0,0 +1,795 @@
+http://sourceware.org/ml/gdb-cvs/2012-07/msg00123.html
+
+### src/gdb/ChangeLog  2012/07/18 04:36:15     1.14473
+### src/gdb/ChangeLog  2012/07/18 16:12:15     1.14474
+## -1,3 +1,37 @@
++2012-07-18  Sergio Durigan Junior  <sergiodj@redhat.com>
++
++      * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument.
++      (elf_compile_to_ax): Likewise.
++      * infrun.c (insert_exception_resume_from_probe): Likewise.
++      (check_exception_resume): Remove `objfile' variable.
++      * probe.c (find_probe_by_pc): Remove `objfile' argument.
++      (struct probe_and_objfile, probe_and_objfile_s): Delete.
++      (collect_probes): Adjust return value to `VEC (probe_p) *'.
++      (compare_entries): Rename to...
++      (compare_probes): ...this.  Adjust function to work with
++      `struct probe *'.  Rename variables `ea' and `eb' to `pa' and `pb'
++      respectively.
++      (gen_ui_out_table_header_info): Adjust `probes' argument to be
++      `VEC (probe_p) *'.
++      (print_ui_out_info): Adjust argument to be `struct probe *'.
++      (info_probes_for_ops): Adjust internal computations to use
++      `VEC (probe_p) *'.
++      (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore.
++      * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax,
++      gen_info_probes_table_values>: Remove `objfile' argument.
++      (struct probe) <objfile>: New field.
++      (find_probe_by_pc): Remove `objfile' argument.
++      * stap-probe.c (stap_parse_probe_arguments): Likewise.
++      (stap_get_probe_argument_count): Likewise.
++      (stap_get_arg): Likewise.
++      (stap_evaluate_probe_argument): Likewise.
++      (stap_compile_to_ax): Likewise.
++      (compile_probe_arg): Refactor not to pass `objfile' anymore.
++      (handle_stap_probe): Fill `objfile' field from `struct probe'.
++      (stap_gen_info_probes_table_header): Remove `objfile' argument.
++      * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument,
++      sym_compile_to_ax>: Likewise.
++
+ 2012-07-18  Terry Guo  <terry.guo@arm.com>
+       PR 14329
+--- src/gdb/elfread.c  2012/06/26 20:14:01     1.133
++++ src/gdb/elfread.c  2012/07/18 16:12:15     1.134
+@@ -1635,33 +1635,29 @@
+    symfile.h.  */
+ static unsigned
+-elf_get_probe_argument_count (struct objfile *objfile,
+-                            struct probe *probe)
++elf_get_probe_argument_count (struct probe *probe)
+ {
+-  return probe->pops->get_probe_argument_count (probe, objfile);
++  return probe->pops->get_probe_argument_count (probe);
+ }
+ /* Implementation of `sym_evaluate_probe_argument', as documented in
+    symfile.h.  */
+ static struct value *
+-elf_evaluate_probe_argument (struct objfile *objfile,
+-                           struct probe *probe,
+-                           unsigned n)
++elf_evaluate_probe_argument (struct probe *probe, unsigned n)
+ {
+-  return probe->pops->evaluate_probe_argument (probe, objfile, n);
++  return probe->pops->evaluate_probe_argument (probe, n);
+ }
+ /* Implementation of `sym_compile_to_ax', as documented in symfile.h.  */
+ static void
+-elf_compile_to_ax (struct objfile *objfile,
+-                 struct probe *probe,
++elf_compile_to_ax (struct probe *probe,
+                  struct agent_expr *expr,
+                  struct axs_value *value,
+                  unsigned n)
+ {
+-  probe->pops->compile_to_ax (probe, objfile, expr, value, n);
++  probe->pops->compile_to_ax (probe, expr, value, n);
+ }
+ /* Implementation of `sym_relocate_probe', as documented in symfile.h.  */
+--- src/gdb/infrun.c   2012/07/01 10:37:04     1.549
++++ src/gdb/infrun.c   2012/07/18 16:12:16     1.550
+@@ -5518,7 +5518,6 @@
+ static void
+ insert_exception_resume_from_probe (struct thread_info *tp,
+                                   const struct probe *probe,
+-                                  struct objfile *objfile,
+                                   struct frame_info *frame)
+ {
+   struct value *arg_value;
+@@ -5534,7 +5533,7 @@
+   if (debug_infrun)
+     fprintf_unfiltered (gdb_stdlog,
+                       "infrun: exception resume at %s\n",
+-                      paddress (get_objfile_arch (objfile),
++                      paddress (get_objfile_arch (probe->objfile),
+                                 handler));
+   bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
+@@ -5552,7 +5551,6 @@
+                       struct frame_info *frame)
+ {
+   volatile struct gdb_exception e;
+-  struct objfile *objfile;
+   const struct probe *probe;
+   struct symbol *func;
+@@ -5560,11 +5558,10 @@
+      SystemTap probe point.  If so, the probe has two arguments: the
+      CFA and the HANDLER.  We ignore the CFA, extract the handler, and
+      set a breakpoint there.  */
+-  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
++  probe = find_probe_by_pc (get_frame_pc (frame));
+   if (probe)
+     {
+-      insert_exception_resume_from_probe (ecs->event_thread, probe,
+-                                        objfile, frame);
++      insert_exception_resume_from_probe (ecs->event_thread, probe, frame);
+       return;
+     }
+--- src/gdb/probe.c    2012/05/08 01:35:34     1.3
++++ src/gdb/probe.c    2012/07/18 16:12:17     1.4
+@@ -204,7 +204,7 @@
+ /* See definition in probe.h.  */
+ struct probe *
+-find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out)
++find_probe_by_pc (CORE_ADDR pc)
+ {
+   struct objfile *objfile;
+@@ -221,10 +221,7 @@
+     probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile);
+     for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
+       if (probe->address == pc)
+-      {
+-        *objfile_out = objfile;
+-        return probe;
+-      }
++      return probe;
+   }
+   return NULL;
+@@ -232,21 +229,6 @@
\f
+-/* A utility structure.  A VEC of these is built when handling "info
+-   probes".  */
+-
+-struct probe_and_objfile
+-{
+-  /* The probe.  */
+-  struct probe *probe;
+-
+-  /* The probe's objfile.  */
+-  struct objfile *objfile;
+-};
+-
+-typedef struct probe_and_objfile probe_and_objfile_s;
+-DEF_VEC_O (probe_and_objfile_s);
+-
+ /* A helper function for collect_probes that compiles a regexp and
+    throws an exception on error.  This installs a cleanup to free the
+    resulting pattern on success.  If RX is NULL, this does nothing.  */
+@@ -275,16 +257,16 @@
+    If POPS is not NULL, only probes of this certain probe_ops will match.
+    Each argument is a regexp, or NULL, which matches anything.  */
+-static VEC (probe_and_objfile_s) *
++static VEC (probe_p) *
+ collect_probes (char *objname, char *provider, char *probe_name,
+               const struct probe_ops *pops)
+ {
+   struct objfile *objfile;
+-  VEC (probe_and_objfile_s) *result = NULL;
++  VEC (probe_p) *result = NULL;
+   struct cleanup *cleanup, *cleanup_temps;
+   regex_t obj_pat, prov_pat, probe_pat;
+-  cleanup = make_cleanup (VEC_cleanup (probe_and_objfile_s), &result);
++  cleanup = make_cleanup (VEC_cleanup (probe_p), &result);
+   cleanup_temps = make_cleanup (null_cleanup, NULL);
+   compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
+@@ -310,8 +292,6 @@
+       for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
+       {
+-        probe_and_objfile_s entry;
+-
+         if (pops != NULL && probe->pops != pops)
+           continue;
+@@ -323,9 +303,7 @@
+             && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0)
+           continue;
+-        entry.probe = probe;
+-        entry.objfile = objfile;
+-        VEC_safe_push (probe_and_objfile_s, result, &entry);
++        VEC_safe_push (probe_p, result, probe);
+       }
+     }
+@@ -334,36 +312,36 @@
+   return result;
+ }
+-/* A qsort comparison function for probe_and_objfile_s objects.  */
++/* A qsort comparison function for probe_p objects.  */
+ static int
+-compare_entries (const void *a, const void *b)
++compare_probes (const void *a, const void *b)
+ {
+-  const probe_and_objfile_s *ea = a;
+-  const probe_and_objfile_s *eb = b;
++  const struct probe *pa = *((const struct probe **) a);
++  const struct probe *pb = *((const struct probe **) b);
+   int v;
+-  v = strcmp (ea->probe->provider, eb->probe->provider);
++  v = strcmp (pa->provider, pb->provider);
+   if (v)
+     return v;
+-  v = strcmp (ea->probe->name, eb->probe->name);
++  v = strcmp (pa->name, pb->name);
+   if (v)
+     return v;
+-  if (ea->probe->address < eb->probe->address)
++  if (pa->address < pb->address)
+     return -1;
+-  if (ea->probe->address > eb->probe->address)
++  if (pa->address > pb->address)
+     return 1;
+-  return strcmp (ea->objfile->name, eb->objfile->name);
++  return strcmp (pa->objfile->name, pb->objfile->name);
+ }
+ /* Helper function that generate entries in the ui_out table being
+    crafted by `info_probes_for_ops'.  */
+ static void
+-gen_ui_out_table_header_info (VEC (probe_and_objfile_s) *probes,
++gen_ui_out_table_header_info (VEC (probe_p) *probes,
+                             const struct probe_ops *p)
+ {
+   /* `headings' refers to the names of the columns when printing `info
+@@ -392,11 +370,11 @@
+        VEC_iterate (info_probe_column_s, headings, ix, column);
+        ++ix)
+     {
+-      probe_and_objfile_s *entry;
++      struct probe *probe;
+       int jx;
+       size_t size_max = strlen (column->print_name);
+-      for (jx = 0; VEC_iterate (probe_and_objfile_s, probes, jx, entry); ++jx)
++      for (jx = 0; VEC_iterate (probe_p, probes, jx, probe); ++jx)
+       {
+         /* `probe_fields' refers to the values of each new field that this
+            probe will display.  */
+@@ -405,12 +383,11 @@
+         const char *val;
+         int kx;
+-        if (entry->probe->pops != p)
++        if (probe->pops != p)
+           continue;
+         c2 = make_cleanup (VEC_cleanup (const_char_ptr), &probe_fields);
+-        p->gen_info_probes_table_values (entry->probe, entry->objfile,
+-                                         &probe_fields);
++        p->gen_info_probes_table_values (probe, &probe_fields);
+         gdb_assert (VEC_length (const_char_ptr, probe_fields)
+                     == headings_size);
+@@ -437,10 +414,10 @@
+ }
+ /* Helper function to print extra information about a probe and an objfile
+-   represented by ENTRY.  */
++   represented by PROBE.  */
+ static void
+-print_ui_out_info (probe_and_objfile_s *entry)
++print_ui_out_info (struct probe *probe)
+ {
+   int ix;
+   int j = 0;
+@@ -451,23 +428,21 @@
+   info_probe_column_s *column;
+   struct cleanup *c;
+-  gdb_assert (entry != NULL);
+-  gdb_assert (entry->probe != NULL);
+-  gdb_assert (entry->probe->pops != NULL);
++  gdb_assert (probe != NULL);
++  gdb_assert (probe->pops != NULL);
+-  if (entry->probe->pops->gen_info_probes_table_header == NULL
+-      && entry->probe->pops->gen_info_probes_table_values == NULL)
++  if (probe->pops->gen_info_probes_table_header == NULL
++      && probe->pops->gen_info_probes_table_values == NULL)
+     return;
+-  gdb_assert (entry->probe->pops->gen_info_probes_table_header != NULL
+-            && entry->probe->pops->gen_info_probes_table_values != NULL);
++  gdb_assert (probe->pops->gen_info_probes_table_header != NULL
++            && probe->pops->gen_info_probes_table_values != NULL);
+   c = make_cleanup (VEC_cleanup (info_probe_column_s), &headings);
+   make_cleanup (VEC_cleanup (const_char_ptr), &values);
+-  entry->probe->pops->gen_info_probes_table_header (&headings);
+-  entry->probe->pops->gen_info_probes_table_values (entry->probe,
+-                                                  entry->objfile, &values);
++  probe->pops->gen_info_probes_table_header (&headings);
++  probe->pops->gen_info_probes_table_values (probe, &values);
+   gdb_assert (VEC_length (info_probe_column_s, headings)
+             == VEC_length (const_char_ptr, values));
+@@ -515,16 +490,16 @@
+ void
+ info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops)
+ {
+-  char *provider, *probe = NULL, *objname = NULL;
++  char *provider, *probe_name = NULL, *objname = NULL;
+   struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
+-  VEC (probe_and_objfile_s) *items;
++  VEC (probe_p) *probes;
+   int i, any_found;
+   int ui_out_extra_fields = 0;
+   size_t size_addr;
+   size_t size_name = strlen ("Name");
+   size_t size_objname = strlen ("Object");
+   size_t size_provider = strlen ("Provider");
+-  probe_and_objfile_s *entry;
++  struct probe *probe;
+   struct gdbarch *gdbarch = get_current_arch ();
+   /* Do we have a `provider:probe:objfile' style of linespec?  */
+@@ -533,10 +508,10 @@
+     {
+       make_cleanup (xfree, provider);
+-      probe = extract_arg (&arg);
+-      if (probe)
++      probe_name = extract_arg (&arg);
++      if (probe_name)
+       {
+-        make_cleanup (xfree, probe);
++        make_cleanup (xfree, probe_name);
+         objname = extract_arg (&arg);
+         if (objname)
+@@ -564,28 +539,27 @@
+   else
+     ui_out_extra_fields = get_number_extra_fields (pops);
+-  items = collect_probes (objname, provider, probe, pops);
+-  make_cleanup (VEC_cleanup (probe_and_objfile_s), &items);
++  probes = collect_probes (objname, provider, probe_name, pops);
++  make_cleanup (VEC_cleanup (probe_p), &probes);
+   make_cleanup_ui_out_table_begin_end (current_uiout,
+                                      4 + ui_out_extra_fields,
+-                                     VEC_length (probe_and_objfile_s, items),
++                                     VEC_length (probe_p, probes),
+                                      "StaticProbes");
+-  if (!VEC_empty (probe_and_objfile_s, items))
+-    qsort (VEC_address (probe_and_objfile_s, items),
+-         VEC_length (probe_and_objfile_s, items),
+-         sizeof (probe_and_objfile_s), compare_entries);
++  if (!VEC_empty (probe_p, probes))
++    qsort (VEC_address (probe_p, probes), VEC_length (probe_p, probes),
++         sizeof (probe_p), compare_probes);
+   /* What's the size of an address in our architecture?  */
+   size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10;
+   /* Determining the maximum size of each field (`provider', `name' and
+      `objname').  */
+-  for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i)
++  for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i)
+     {
+-      size_name = max (strlen (entry->probe->name), size_name);
+-      size_provider = max (strlen (entry->probe->provider), size_provider);
+-      size_objname = max (strlen (entry->objfile->name), size_objname);
++      size_name = max (strlen (probe->name), size_name);
++      size_provider = max (strlen (probe->provider), size_provider);
++      size_objname = max (strlen (probe->objfile->name), size_objname);
+     }
+   ui_out_table_header (current_uiout, size_provider, ui_left, "provider",
+@@ -601,26 +575,26 @@
+       /* We have to generate the table header for each new probe type that we
+        will print.  */
+       for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); ++ix)
+-      gen_ui_out_table_header_info (items, po);
++      gen_ui_out_table_header_info (probes, po);
+     }
+   else
+-    gen_ui_out_table_header_info (items, pops);
++    gen_ui_out_table_header_info (probes, pops);
+   ui_out_table_header (current_uiout, size_objname, ui_left, "object",
+                      _("Object"));
+   ui_out_table_body (current_uiout);
+-  for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i)
++  for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i)
+     {
+       struct cleanup *inner;
+       inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe");
+-      ui_out_field_string (current_uiout, "provider", entry->probe->provider);
+-      ui_out_field_string (current_uiout, "name", entry->probe->name);
++      ui_out_field_string (current_uiout, "provider", probe->provider);
++      ui_out_field_string (current_uiout, "name", probe->name);
+       ui_out_field_core_addr (current_uiout, "addr",
+-                            get_objfile_arch (entry->objfile),
+-                            entry->probe->address);
++                            get_objfile_arch (probe->objfile),
++                            probe->address);
+       if (pops == NULL)
+       {
+@@ -629,19 +603,19 @@
+         for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po);
+              ++ix)
+-          if (entry->probe->pops == po)
+-            print_ui_out_info (entry);
++          if (probe->pops == po)
++            print_ui_out_info (probe);
+       }
+       else
+-      print_ui_out_info (entry);
++      print_ui_out_info (probe);
+-      ui_out_field_string (current_uiout, "object", entry->objfile->name);
++      ui_out_field_string (current_uiout, "object", probe->objfile->name);
+       ui_out_text (current_uiout, "\n");
+       do_cleanups (inner);
+     }
+-  any_found = !VEC_empty (probe_and_objfile_s, items);
++  any_found = !VEC_empty (probe_p, probes);
+   do_cleanups (cleanup);
+   if (!any_found)
+@@ -662,23 +636,24 @@
+ probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
+ {
+   struct probe *probe;
+-  struct objfile *objfile;
++  const struct sym_probe_fns *probe_fns;
+   unsigned n_probes;
+-  probe = find_probe_by_pc (get_frame_pc (frame), &objfile);
++  probe = find_probe_by_pc (get_frame_pc (frame));
+   if (!probe)
+     return NULL;
+-  gdb_assert (objfile->sf && objfile->sf->sym_probe_fns);
+-  n_probes
+-    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
+-                                                              probe);
++  gdb_assert (probe->objfile != NULL);
++  gdb_assert (probe->objfile->sf != NULL);
++  gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
++
++  probe_fns = probe->objfile->sf->sym_probe_fns;
++  n_probes = probe_fns->sym_get_probe_argument_count (probe);
++
+   if (n >= n_probes)
+     return NULL;
+-  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
+-                                                                probe,
+-                                                                n);
++  return probe_fns->sym_evaluate_probe_argument (probe, n);
+ }
+ /* See comment in probe.h.  */
+--- src/gdb/probe.h    2012/04/27 20:47:55     1.1
++++ src/gdb/probe.h    2012/07/18 16:12:17     1.2
+@@ -66,21 +66,18 @@
+     /* Return the number of arguments of PROBE.  */
+-    unsigned (*get_probe_argument_count) (struct probe *probe,
+-                                        struct objfile *objfile);
++    unsigned (*get_probe_argument_count) (struct probe *probe);
+     /* Evaluate the Nth argument from the PROBE, returning a value
+        corresponding to it.  The argument number is represented N.  */
+     struct value *(*evaluate_probe_argument) (struct probe *probe,
+-                                            struct objfile *objfile,
+                                             unsigned n);
+     /* Compile the Nth argument of the PROBE to an agent expression.
+        The argument number is represented by N.  */
+-    void (*compile_to_ax) (struct probe *probe, struct objfile *objfile,
+-                         struct agent_expr *aexpr,
++    void (*compile_to_ax) (struct probe *probe, struct agent_expr *aexpr,
+                          struct axs_value *axs_value, unsigned n);
+     /* Set the semaphore associated with the PROBE.  This function only makes
+@@ -108,8 +105,8 @@
+     void (*gen_info_probes_table_header) (VEC (info_probe_column_s) **heads);
+     /* Function that will fill VALUES with the values of the extra fields
+-       to be printed for PROBE  and OBJFILE.  If the backend implements
+-       the `gen_ui_out_table_header' method, then it should implement
++       to be printed for PROBE.  If the backend implements the
++       `gen_ui_out_table_header' method, then it should implement
+        this method as well.  The backend should also guarantee that the
+        order and the number of values in the vector is exactly the same
+        as the order of the extra fields provided in the method
+@@ -118,7 +115,6 @@
+        position in the vector.  */
+     void (*gen_info_probes_table_values) (struct probe *probe,
+-                                        struct objfile *objfile,
+                                         VEC (const_char_ptr) **values);
+   };
+@@ -157,6 +153,11 @@
+     /* The operations associated with this probe.  */
+     const struct probe_ops *pops;
++    /* The objfile which contains this probe.  Even if the probe is also
++       present in a separate debug objfile, this variable always points to
++       the non-separate debug objfile.  */
++    struct objfile *objfile;
++
+     /* The name of the probe.  */
+     const char *name;
+@@ -181,11 +182,9 @@
+ extern void register_probe_ops (struct probe *probe);
+ /* Given a PC, find an associated probe with type PTYPE.  If a probe is
+-   found, set *OBJFILE_OUT to the probe's objfile, and return the
+-   probe.  If no probe is found, return NULL.  */
++   found, return it.  If no probe is found, return NULL.  */
+-extern struct probe *find_probe_by_pc (CORE_ADDR pc,
+-                                     struct objfile **objfile_out);
++extern struct probe *find_probe_by_pc (CORE_ADDR pc);
+ /* Search OBJFILE for a probe with the given PROVIDER, NAME and PTYPE.
+    Return a VEC of all probes that were found.  If no matching probe
+--- src/gdb/stap-probe.c       2012/05/08 01:35:35     1.4
++++ src/gdb/stap-probe.c       2012/07/18 16:12:17     1.5
+@@ -903,10 +903,10 @@
+    this information.  */
+ static void
+-stap_parse_probe_arguments (struct stap_probe *probe, struct objfile *objfile)
++stap_parse_probe_arguments (struct stap_probe *probe)
+ {
+   const char *cur;
+-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
++  struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile);
+   gdb_assert (!probe->args_parsed);
+   cur = probe->args_u.text;
+@@ -991,15 +991,14 @@
+    argument string.  */
+ static unsigned
+-stap_get_probe_argument_count (struct probe *probe_generic,
+-                             struct objfile *objfile)
++stap_get_probe_argument_count (struct probe *probe_generic)
+ {
+   struct stap_probe *probe = (struct stap_probe *) probe_generic;
+   gdb_assert (probe_generic->pops == &stap_probe_ops);
+   if (!probe->args_parsed)
+-    stap_parse_probe_arguments (probe, objfile);
++    stap_parse_probe_arguments (probe);
+   gdb_assert (probe->args_parsed);
+   return VEC_length (stap_probe_arg_s, probe->args_u.vec);
+@@ -1042,10 +1041,10 @@
+ }
+ static struct stap_probe_arg *
+-stap_get_arg (struct stap_probe *probe, struct objfile *objfile, unsigned n)
++stap_get_arg (struct stap_probe *probe, unsigned n)
+ {
+   if (!probe->args_parsed)
+-    stap_parse_probe_arguments (probe, objfile);
++    stap_parse_probe_arguments (probe);
+   return VEC_index (stap_probe_arg_s, probe->args_u.vec, n);
+ }
+@@ -1054,8 +1053,7 @@
+    corresponding to it.  Assertion is thrown if N does not exist.  */
+ static struct value *
+-stap_evaluate_probe_argument (struct probe *probe_generic,
+-                            struct objfile *objfile, unsigned n)
++stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n)
+ {
+   struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
+   struct stap_probe_arg *arg;
+@@ -1063,7 +1061,7 @@
+   gdb_assert (probe_generic->pops == &stap_probe_ops);
+-  arg = stap_get_arg (stap_probe, objfile, n);
++  arg = stap_get_arg (stap_probe, n);
+   return evaluate_subexp_standard (arg->atype, arg->aexpr, &pos, EVAL_NORMAL);
+ }
+@@ -1071,9 +1069,8 @@
+    Assertion is thrown if N does not exist.  */
+ static void
+-stap_compile_to_ax (struct probe *probe_generic, struct objfile *objfile,
+-                  struct agent_expr *expr, struct axs_value *value,
+-                  unsigned n)
++stap_compile_to_ax (struct probe *probe_generic, struct agent_expr *expr,
++                  struct axs_value *value, unsigned n)
+ {
+   struct stap_probe *stap_probe = (struct stap_probe *) probe_generic;
+   struct stap_probe_arg *arg;
+@@ -1081,7 +1078,7 @@
+   gdb_assert (probe_generic->pops == &stap_probe_ops);
+-  arg = stap_get_arg (stap_probe, objfile, n);
++  arg = stap_get_arg (stap_probe, n);
+   pc = arg->aexpr->elts;
+   gen_expr (arg->aexpr, &pc, expr, value);
+@@ -1124,20 +1121,24 @@
+   struct frame_info *frame = get_selected_frame (_("No frame selected"));
+   CORE_ADDR pc = get_frame_pc (frame);
+   int sel = (int) (uintptr_t) data;
+-  struct objfile *objfile;
+   struct probe *pc_probe;
++  const struct sym_probe_fns *pc_probe_fns;
+   unsigned n_args;
+   /* SEL == -1 means "_probe_argc".  */
+   gdb_assert (sel >= -1);
+-  pc_probe = find_probe_by_pc (pc, &objfile);
++  pc_probe = find_probe_by_pc (pc);
+   if (pc_probe == NULL)
+     error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
+-  n_args
+-    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
+-                                                              pc_probe);
++  gdb_assert (pc_probe->objfile != NULL);
++  gdb_assert (pc_probe->objfile->sf != NULL);
++  gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
++
++  pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
++
++  n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+   if (sel == -1)
+     return value_from_longest (builtin_type (arch)->builtin_int, n_args);
+@@ -1145,9 +1146,7 @@
+     error (_("Invalid probe argument %d -- probe has %u arguments available"),
+          sel, n_args);
+-  return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile,
+-                                                                pc_probe,
+-                                                                sel);
++  return pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel);
+ }
+ /* This is called to compile one of the $_probe_arg* convenience
+@@ -1159,20 +1158,25 @@
+ {
+   CORE_ADDR pc = expr->scope;
+   int sel = (int) (uintptr_t) data;
+-  struct objfile *objfile;
+   struct probe *pc_probe;
++  const struct sym_probe_fns *pc_probe_fns;
+   int n_probes;
+   /* SEL == -1 means "_probe_argc".  */
+   gdb_assert (sel >= -1);
+-  pc_probe = find_probe_by_pc (pc, &objfile);
++  pc_probe = find_probe_by_pc (pc);
+   if (pc_probe == NULL)
+     error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc));
+-  n_probes
+-    = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile,
+-                                                              pc_probe);
++  gdb_assert (pc_probe->objfile != NULL);
++  gdb_assert (pc_probe->objfile->sf != NULL);
++  gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL);
++
++  pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
++
++  n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
++
+   if (sel == -1)
+     {
+       value->kind = axs_rvalue;
+@@ -1186,8 +1190,7 @@
+     error (_("Invalid probe argument %d -- probe has %d arguments available"),
+          sel, n_probes);
+-  objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe,
+-                                               expr, value, sel);
++  pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
+ }
\f
+@@ -1297,6 +1300,7 @@
+   ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret));
+   ret->p.pops = &stap_probe_ops;
++  ret->p.objfile = objfile;
+   /* Provider and the name of the probe.  */
+   ret->p.provider = &el->data[3 * size];
+@@ -1481,15 +1485,16 @@
+ static void
+ stap_gen_info_probes_table_values (struct probe *probe_generic,
+-                                 struct objfile *objfile,
+                                  VEC (const_char_ptr) **ret)
+ {
+   struct stap_probe *probe = (struct stap_probe *) probe_generic;
+-  struct gdbarch *gdbarch = get_objfile_arch (objfile);
++  struct gdbarch *gdbarch;
+   const char *val = NULL;
+   gdb_assert (probe_generic->pops == &stap_probe_ops);
++  gdbarch = get_objfile_arch (probe->p.objfile);
++
+   if (probe->sem_addr)
+     val = print_core_address (gdbarch, probe->sem_addr);
+--- src/gdb/symfile.h  2012/05/24 22:14:35     1.109
++++ src/gdb/symfile.h  2012/07/18 16:12:17     1.110
+@@ -320,8 +320,7 @@
+      have come from a call to this objfile's sym_get_probes method.
+      If you provide an implementation of sym_get_probes, you must
+      implement this method as well.  */
+-  unsigned (*sym_get_probe_argument_count) (struct objfile *objfile,
+-                                          struct probe *probe);
++  unsigned (*sym_get_probe_argument_count) (struct probe *probe);
+   /* Evaluate the Nth argument available to PROBE.  PROBE will have
+      come from a call to this objfile's sym_get_probes method.  N will
+@@ -330,8 +329,7 @@
+      PC will match the address of the probe.  If you provide an
+      implementation of sym_get_probes, you must implement this method
+      as well.  */
+-  struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile,
+-                                              struct probe *probe,
++  struct value *(*sym_evaluate_probe_argument) (struct probe *probe,
+                                               unsigned n);
+   /* Compile the Nth probe argument to an agent expression.  PROBE
+@@ -339,8 +337,7 @@
+      method.  N will be between 0 and the number of arguments
+      available to this probe.  EXPR and VALUE are the agent expression
+      that is being updated.  */
+-  void (*sym_compile_to_ax) (struct objfile *objfile,
+-                           struct probe *probe,
++  void (*sym_compile_to_ax) (struct probe *probe,
+                            struct agent_expr *expr,
+                            struct axs_value *value,
+                            unsigned n);
diff --git a/gdb-dlopen-stap-probe-2of7.patch b/gdb-dlopen-stap-probe-2of7.patch
new file mode 100644 (file)
index 0000000..81b35e9
--- /dev/null
@@ -0,0 +1,74 @@
+http://sourceware.org/ml/gdb-cvs/2012-07/msg00124.html
+
+### src/gdb/ChangeLog  2012/07/18 16:12:15     1.14474
+### src/gdb/ChangeLog  2012/07/18 16:20:36     1.14475
+## -1,5 +1,10 @@
+ 2012-07-18  Sergio Durigan Junior  <sergiodj@redhat.com>
++      * probe.c (probe_safe_evaluate_at_pc): Rename variable `n_probes'.
++      * stap-probe.c (compile_probe_arg): Likewise.
++
++2012-07-18  Sergio Durigan Junior  <sergiodj@redhat.com>
++
+       * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument.
+       (elf_compile_to_ax): Likewise.
+       * infrun.c (insert_exception_resume_from_probe): Likewise.
+--- src/gdb/probe.c    2012/07/18 16:12:17     1.4
++++ src/gdb/probe.c    2012/07/18 16:20:43     1.5
+@@ -637,7 +637,7 @@
+ {
+   struct probe *probe;
+   const struct sym_probe_fns *probe_fns;
+-  unsigned n_probes;
++  unsigned n_args;
+   probe = find_probe_by_pc (get_frame_pc (frame));
+   if (!probe)
+@@ -648,9 +648,9 @@
+   gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
+   probe_fns = probe->objfile->sf->sym_probe_fns;
+-  n_probes = probe_fns->sym_get_probe_argument_count (probe);
++  n_args = probe_fns->sym_get_probe_argument_count (probe);
+-  if (n >= n_probes)
++  if (n >= n_args)
+     return NULL;
+   return probe_fns->sym_evaluate_probe_argument (probe, n);
+--- src/gdb/stap-probe.c       2012/07/18 16:12:17     1.5
++++ src/gdb/stap-probe.c       2012/07/18 16:20:43     1.6
+@@ -1160,7 +1160,7 @@
+   int sel = (int) (uintptr_t) data;
+   struct probe *pc_probe;
+   const struct sym_probe_fns *pc_probe_fns;
+-  int n_probes;
++  int n_args;
+   /* SEL == -1 means "_probe_argc".  */
+   gdb_assert (sel >= -1);
+@@ -1175,20 +1175,20 @@
+   pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns;
+-  n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
++  n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe);
+   if (sel == -1)
+     {
+       value->kind = axs_rvalue;
+       value->type = builtin_type (expr->gdbarch)->builtin_int;
+-      ax_const_l (expr, n_probes);
++      ax_const_l (expr, n_args);
+       return;
+     }
+   gdb_assert (sel >= 0);
+-  if (sel >= n_probes)
++  if (sel >= n_args)
+     error (_("Invalid probe argument %d -- probe has %d arguments available"),
+-         sel, n_probes);
++         sel, n_args);
+   pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel);
+ }
diff --git a/gdb-dlopen-stap-probe-3of7.patch b/gdb-dlopen-stap-probe-3of7.patch
new file mode 100644 (file)
index 0000000..2337ded
--- /dev/null
@@ -0,0 +1,98 @@
+2012-07-19  Gary Benson  <gbenson@redhat.com>
+
+       * probe.h (get_probe_argument_count): New declaration.
+       (evaluate_probe_argument): Likewise.
+       * probe.c (get_probe_argument_count): New function.
+       (evaluate_probe_argument): Likewise.
+       (probe_safe_evaluate_at_pc): Use the above new functions.
+
+diff --git a/gdb/probe.h b/gdb/probe.h
+index 8d44ca2..1d29b87 100644
+--- a/gdb/probe.h
++++ b/gdb/probe.h
+@@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty,
+ extern struct cmd_list_element **info_probes_cmdlist_get (void);
++/* Return the argument count of the specified probe.  */
++
++extern unsigned get_probe_argument_count (struct probe *probe);
++
++/* Evaluate argument N of the specified probe.  N must be between 0
++   inclusive and get_probe_argument_count exclusive.  */
++
++extern struct value *evaluate_probe_argument (struct probe *probe,
++                                            unsigned n);
++
+ /* A convenience function that finds a probe at the PC in FRAME and
+    evaluates argument N, with 0 <= N < number_of_args.  If there is no
+    probe at that location, or if the probe does not have enough arguments,
+diff --git a/gdb/probe.c b/gdb/probe.c
+index 77f3b13..a61f4ea 100644
+--- a/gdb/probe.c
++++ b/gdb/probe.c
+@@ -632,28 +632,55 @@ info_probes_command (char *arg, int from_tty)
+ /* See comments in probe.h.  */
++unsigned
++get_probe_argument_count (struct probe *probe)
++{
++  const struct sym_probe_fns *probe_fns;
++
++  gdb_assert (probe->objfile != NULL);
++  gdb_assert (probe->objfile->sf != NULL);
++
++  probe_fns = probe->objfile->sf->sym_probe_fns;
++
++  gdb_assert (probe_fns != NULL);
++
++  return probe_fns->sym_get_probe_argument_count (probe);
++}
++
++/* See comments in probe.h.  */
++
++struct value *
++evaluate_probe_argument (struct probe *probe, unsigned n)
++{
++  const struct sym_probe_fns *probe_fns;
++
++  gdb_assert (probe->objfile != NULL);
++  gdb_assert (probe->objfile->sf != NULL);
++
++  probe_fns = probe->objfile->sf->sym_probe_fns;
++
++  gdb_assert (probe_fns != NULL);
++
++  return probe_fns->sym_evaluate_probe_argument (probe, n);
++}
++
++/* See comments in probe.h.  */
++
+ struct value *
+ probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
+ {
+   struct probe *probe;
+-  const struct sym_probe_fns *probe_fns;
+   unsigned n_args;
+   probe = find_probe_by_pc (get_frame_pc (frame));
+   if (!probe)
+     return NULL;
+-  gdb_assert (probe->objfile != NULL);
+-  gdb_assert (probe->objfile->sf != NULL);
+-  gdb_assert (probe->objfile->sf->sym_probe_fns != NULL);
+-
+-  probe_fns = probe->objfile->sf->sym_probe_fns;
+-  n_args = probe_fns->sym_get_probe_argument_count (probe);
+-
++  n_args = get_probe_argument_count (probe);
+   if (n >= n_args)
+     return NULL;
+-  return probe_fns->sym_evaluate_probe_argument (probe, n);
++  return evaluate_probe_argument (probe, n);
+ }
+ /* See comment in probe.h.  */
diff --git a/gdb-dlopen-stap-probe-4of7.patch b/gdb-dlopen-stap-probe-4of7.patch
new file mode 100644 (file)
index 0000000..299931a
--- /dev/null
@@ -0,0 +1,131 @@
+2012-07-19  Gary Benson  <gbenson@redhat.com>
+
+       * solib-svr4.c (svr4_info): Move earlier.
+       (solib_svr4_pspace_data): Likewise.
+       (svr4_pspace_data_cleanup): Likewise.
+       (get_svr4_info): Likewise.
+
+diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+index 307e483..c88b9cb 100644
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -106,6 +106,59 @@ static const  char * const main_name_list[] =
+   NULL
+ };
++/* Per pspace SVR4 specific data.  */
++
++struct svr4_info
++{
++  CORE_ADDR debug_base;       /* Base of dynamic linker structures.  */
++
++  /* Validity flag for debug_loader_offset.  */
++  int debug_loader_offset_p;
++
++  /* Load address for the dynamic linker, inferred.  */
++  CORE_ADDR debug_loader_offset;
++
++  /* Name of the dynamic linker, valid if debug_loader_offset_p.  */
++  char *debug_loader_name;
++
++  /* Load map address for the main executable.  */
++  CORE_ADDR main_lm_addr;
++
++  CORE_ADDR interp_text_sect_low;
++  CORE_ADDR interp_text_sect_high;
++  CORE_ADDR interp_plt_sect_low;
++  CORE_ADDR interp_plt_sect_high;
++};
++
++/* Per-program-space data key.  */
++static const struct program_space_data *solib_svr4_pspace_data;
++
++static void
++svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
++{
++  struct svr4_info *info;
++
++  info = program_space_data (pspace, solib_svr4_pspace_data);
++  xfree (info);
++}
++
++/* Get the current svr4 data.  If none is found yet, add it now.  This
++   function always returns a valid object.  */
++
++static struct svr4_info *
++get_svr4_info (void)
++{
++  struct svr4_info *info;
++
++  info = program_space_data (current_program_space, solib_svr4_pspace_data);
++  if (info != NULL)
++    return info;
++
++  info = XZALLOC (struct svr4_info);
++  set_program_space_data (current_program_space, solib_svr4_pspace_data, info);
++  return info;
++}
++
+ /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent
+    the same shared library.  */
+@@ -291,59 +344,6 @@ lm_addr_check (struct so_list *so, bfd *abfd)
+   return so->lm_info->l_addr;
+ }
+-/* Per pspace SVR4 specific data.  */
+-
+-struct svr4_info
+-{
+-  CORE_ADDR debug_base;       /* Base of dynamic linker structures.  */
+-
+-  /* Validity flag for debug_loader_offset.  */
+-  int debug_loader_offset_p;
+-
+-  /* Load address for the dynamic linker, inferred.  */
+-  CORE_ADDR debug_loader_offset;
+-
+-  /* Name of the dynamic linker, valid if debug_loader_offset_p.  */
+-  char *debug_loader_name;
+-
+-  /* Load map address for the main executable.  */
+-  CORE_ADDR main_lm_addr;
+-
+-  CORE_ADDR interp_text_sect_low;
+-  CORE_ADDR interp_text_sect_high;
+-  CORE_ADDR interp_plt_sect_low;
+-  CORE_ADDR interp_plt_sect_high;
+-};
+-
+-/* Per-program-space data key.  */
+-static const struct program_space_data *solib_svr4_pspace_data;
+-
+-static void
+-svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
+-{
+-  struct svr4_info *info;
+-
+-  info = program_space_data (pspace, solib_svr4_pspace_data);
+-  xfree (info);
+-}
+-
+-/* Get the current svr4 data.  If none is found yet, add it now.  This
+-   function always returns a valid object.  */
+-
+-static struct svr4_info *
+-get_svr4_info (void)
+-{
+-  struct svr4_info *info;
+-
+-  info = program_space_data (current_program_space, solib_svr4_pspace_data);
+-  if (info != NULL)
+-    return info;
+-
+-  info = XZALLOC (struct svr4_info);
+-  set_program_space_data (current_program_space, solib_svr4_pspace_data, info);
+-  return info;
+-}
+-
+ /* Local function prototypes */
+ static int match_main (const char *);
diff --git a/gdb-dlopen-stap-probe-5of7.patch b/gdb-dlopen-stap-probe-5of7.patch
new file mode 100644 (file)
index 0000000..cb18cd6
--- /dev/null
@@ -0,0 +1,17 @@
+2012-07-19  Gary Benson  <gbenson@redhat.com>
+
+       * solib-svr4.c (svr4_info): Made debug_loader_offset_p a bitfield.
+
+diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+index c88b9cb..8e41f19 100644
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -113,7 +113,7 @@ struct svr4_info
+   CORE_ADDR debug_base;       /* Base of dynamic linker structures.  */
+   /* Validity flag for debug_loader_offset.  */
+-  int debug_loader_offset_p;
++  unsigned int debug_loader_offset_p : 1;
+   /* Load address for the dynamic linker, inferred.  */
+   CORE_ADDR debug_loader_offset;
diff --git a/gdb-dlopen-stap-probe-6of7.patch b/gdb-dlopen-stap-probe-6of7.patch
new file mode 100644 (file)
index 0000000..574150e
--- /dev/null
@@ -0,0 +1,1989 @@
+gdb/
+2012-07-30  Gary Benson  <gbenson@redhat.com>
+
+       * breakpoint.h (handle_solib_event): Moved function definition
+       to solib.h, and added a new parameter.
+       * breakpoint.c (handle_solib_event): Moved function to solib.c
+       and added a new parameter.
+       (bpstat_stop_status): Pass new argument to handle_solib_event.
+       * solib.h (breakpoint.h): New include.
+       (handle_solib_event): Moved function definition from breakpoint.h
+       and added a new parameter.
+       (update_solib_breakpoints): New function definition.
+       * solib.c (handle_solib_event): Moved function from breakpoint.c
+       and added a new parameter.
+       (update_solib_breakpoints): New function.
+       * solist.h (breakpoint.h): New include.
+       (target_so_ops): New fields "handle_solib_event" and
+       "update_breakpoints".
+       * infrun.c (set_stop_on_solib_events): New function.
+       (_initialize_infrun): Use the above for "set stop-on-solib-events".
+       (handle_inferior_event): Pass new argument to handle_solib_event.
+       * solib-svr4.c (probe.h): New include.
+       (namespace_table_flatten): New forward declaration.
+       (lm_info): New fields "lmid" and "in_initial_ns".
+       (probe_action): New enum.
+       (probe_info): New struct.
+       (probe_info): New static variable.
+       (NUM_PROBES): New definition.
+       (svr4_info): New fields  "using_probes", "probes" and
+       "namespace_table".
+       (free_probes): New function.
+       (free_namespace_table): Likewise.
+       (svr4_pspace_data_cleanup): Free probes and namespace table.
+       (svr4_same): Also compare namespaces if using probes.
+       (lm_addr_check): Only print .dynamic section at wrong address
+       warning for initial namespace if using probes.
+       (r_map_from_debug_base): New function.
+       (solib_svr4_r_map): Call the above.
+       (svr4_read_so_list): New parameter "prev_lm".
+       Changed return type from void to int.
+       Return nonzero on success, zero on error.
+       (svr4_current_sos_from_debug_base): New function.
+       (svr4_current_sos): Create result from namespace table if available.
+       Use svr4_current_sos_from_debug_base to generate list otherwise.
+       (probe_and_info): New struct.
+       (solib_event_probe_at): New function.
+       (solib_event_probe_action): Likewise.
+       (namespace): New struct.
+       (hash_namespace): New function.
+       (equal_namespace): Likewise.
+       (free_namespace): Likewise.
+       (namespace_update_full): Likewise.
+       (namespace_update_incremental): Likewise.
+       (svr4_handle_solib_event): Likewise.
+       (namespace_table_flatten_helper): Likewise.
+       (namespace_table_flatten): Likewise.
+       (svr4_update_solib_event_breakpoint): Likewise.
+       (svr4_update_solib_event_breakpoints): Likewise.
+       (svr4_create_solib_event_breakpoints): Likewise.
+       (enable_break): Free probes before creating breakpoints.
+       Use svr4_create_solib_event_breakpoints to create breakpoints.
+       (svr4_solib_create_inferior_hook): Free the namespace table.
+       (_initialize_svr4_solib): Initialise svr4_so_ops.handle_solib_event
+       and svr4_so_ops.update_breakpoints.
+
+gdb/testsuite
+2012-07-30  Gary Benson  <gbenson@redhat.com>
+
+       * gdb.base/break-interp.exp (solib_bp): New constant.
+       (reach_1): Use the above instead of "_dl_debug_state".
+       (test_attach): Likewise.
+       (test_ld): Likewise.
+       * gdb.base/break-probes.exp: New file.
+       * gdb.base/break-probes.c: Likewise.
+       * gdb.base/break-probes-solib.c: Likewise.
+       * gdb.base/info-shared.exp: New file.
+       * gdb.base/info-shared.c: Likewise.
+       * gdb.base/info-shared-solib1.c: Likewise.
+       * gdb.base/info-shared-solib2.c: Likewise.
+       * gdb.base/break-dlmopen.exp: Likewise.
+       * gdb.base/break-dlmopen.c: Likewise.
+       * gdb.base/break-dlmopen-solib.c: Likewise.
+
+Index: gdb-7.4.91.20120814/gdb/breakpoint.h
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/breakpoint.h  2012-08-14 17:31:37.050984427 +0200
++++ gdb-7.4.91.20120814/gdb/breakpoint.h       2012-08-14 17:34:44.203746601 +0200
+@@ -1515,8 +1515,6 @@ extern int user_breakpoint_p (struct bre
+ /* Attempt to determine architecture of location identified by SAL.  */
+ extern struct gdbarch *get_sal_arch (struct symtab_and_line sal);
+-extern void handle_solib_event (void);
+-
+ extern void breakpoints_relocate (struct objfile *objfile,
+                                 struct section_offsets *delta);
+Index: gdb-7.4.91.20120814/gdb/breakpoint.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/breakpoint.c  2012-08-14 17:31:37.128984404 +0200
++++ gdb-7.4.91.20120814/gdb/breakpoint.c       2012-08-14 17:34:44.211746597 +0200
+@@ -5205,7 +5205,7 @@ bpstat_stop_status (struct address_space
+     {
+       if (bs->breakpoint_at && bs->breakpoint_at->type == bp_shlib_event)
+       {
+-        handle_solib_event ();
++        handle_solib_event (bs);
+         break;
+       }
+     }
+@@ -5301,25 +5301,6 @@ handle_jit_event (void)
+   target_terminal_inferior ();
+ }
+-/* Handle an solib event by calling solib_add.  */
+-
+-void
+-handle_solib_event (void)
+-{
+-  clear_program_space_solib_cache (current_inferior ()->pspace);
+-
+-  /* Check for any newly added shared libraries if we're supposed to
+-     be adding them automatically.  Switch terminal for any messages
+-     produced by breakpoint_re_set.  */
+-  target_terminal_ours_for_output ();
+-#ifdef SOLIB_ADD
+-  SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
+-#else
+-  solib_add (NULL, 0, &current_target, auto_solib_add);
+-#endif
+-  target_terminal_inferior ();
+-}
+-
+ /* Prepare WHAT final decision for infrun.  */
+ /* Decide what infrun needs to do with this bpstat.  */
+Index: gdb-7.4.91.20120814/gdb/solib.h
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/solib.h       2012-02-03 16:19:37.000000000 +0100
++++ gdb-7.4.91.20120814/gdb/solib.h    2012-08-14 17:34:44.257746587 +0200
+@@ -21,6 +21,9 @@
+ #ifndef SOLIB_H
+ #define SOLIB_H
++/* For bpstat.  */
++#include "breakpoint.h"
++
+ /* Forward decl's for prototypes */
+ struct so_list;
+ struct target_ops;
+@@ -91,4 +94,15 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f
+                                                                     void *),
+                                                   void *data);
++/* Handle an solib event by calling solib_add.  Targets which handle
++   solib events using breakpoints must pass a valid bpstat.  Targets
++   which handle solib events using some other mechanism should pass
++   NULL.  */
++
++extern void handle_solib_event (bpstat bs);
++
++/* Enable or disable optional solib event breakpoints as appropriate.  */
++
++extern void update_solib_breakpoints (void);
++
+ #endif /* SOLIB_H */
+Index: gdb-7.4.91.20120814/gdb/solib.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/solib.c       2012-08-14 17:31:36.832984492 +0200
++++ gdb-7.4.91.20120814/gdb/solib.c    2012-08-14 17:34:44.272746583 +0200
+@@ -1226,6 +1226,42 @@ no_shared_libraries (char *ignored, int
+   objfile_purge_solibs ();
+ }
++/* See solib.h.  */
++
++void
++handle_solib_event (bpstat bs)
++{
++  struct target_so_ops *ops = solib_ops (target_gdbarch);
++
++  if (ops->handle_solib_event != NULL)
++    ops->handle_solib_event (bs);
++
++  clear_program_space_solib_cache (current_inferior ()->pspace);
++
++  /* Check for any newly added shared libraries if we're supposed to
++     be adding them automatically.  Switch terminal for any messages
++     produced by breakpoint_re_set.  */
++  target_terminal_ours_for_output ();
++#ifdef SOLIB_ADD
++  SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
++#else
++  solib_add (NULL, 0, &current_target, auto_solib_add);
++#endif
++  target_terminal_inferior ();
++}
++
++/* See solib.h.  */
++
++void
++update_solib_breakpoints (void)
++{
++  struct target_so_ops *ops = solib_ops (target_gdbarch);
++
++  if (ops->update_breakpoints != NULL)
++    ops->update_breakpoints ();
++}
++
++
+ /* Reload shared libraries, but avoid reloading the same symbol file
+    we already have loaded.  */
+Index: gdb-7.4.91.20120814/gdb/solist.h
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/solist.h      2012-01-04 09:17:11.000000000 +0100
++++ gdb-7.4.91.20120814/gdb/solist.h   2012-08-14 17:34:44.273746584 +0200
+@@ -23,6 +23,8 @@
+ #define SO_NAME_MAX_PATH_SIZE 512     /* FIXME: Should be dynamic */
+ /* For domain_enum domain.  */
+ #include "symtab.h"
++/* For bpstat.  */
++#include "breakpoint.h"
+ /* Forward declaration for target specific link map information.  This
+    struct is opaque to all but the target specific file.  */
+@@ -149,6 +151,20 @@ struct target_so_ops
+        core file (in particular, for readonly sections).  */
+     int (*keep_data_in_core) (CORE_ADDR vaddr,
+                             unsigned long size);
++
++    /* Target-specific handling of solib events.  For targets which
++       handle solib events using breakpoints a valid bpstat must be
++       passed.  Targets which handle solib events using some other
++       mechanism should pass NULL.  This pointer can be NULL, in which
++       case no specific handling is necessary for this target.  */
++    void (*handle_solib_event) (bpstat bs);
++
++    /* Enable or disable optional solib event breakpoints as
++       appropriate.  This should be called whenever
++       stop_on_solib_events is changed.  This pointer can be
++       NULL, in which case no enabling or disabling is necessary
++       for this target.  */
++    void (*update_breakpoints) (void);
+   };
+ /* Free the memory associated with a (so_list *).  */
+Index: gdb-7.4.91.20120814/gdb/infrun.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/infrun.c      2012-08-14 17:33:16.249955007 +0200
++++ gdb-7.4.91.20120814/gdb/infrun.c   2012-08-14 17:34:44.276746583 +0200
+@@ -361,6 +361,16 @@ static struct symbol *step_start_functio
+ /* Nonzero if we want to give control to the user when we're notified
+    of shared library events by the dynamic linker.  */
+ int stop_on_solib_events;
++
++/* Enable or disable optional shared library event breakpoints
++   as appropriate when the above flag is changed.  */
++
++static void
++set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c)
++{
++  update_solib_breakpoints ();
++}
++
+ static void
+ show_stop_on_solib_events (struct ui_file *file, int from_tty,
+                          struct cmd_list_element *c, const char *value)
+@@ -3321,7 +3331,7 @@ handle_inferior_event (struct execution_
+           context_switch (ecs->ptid);
+         regcache = get_thread_regcache (ecs->ptid);
+-        handle_solib_event ();
++        handle_solib_event (NULL);
+         ecs->event_thread->control.stop_bpstat
+           = bpstat_stop_status (get_regcache_aspace (regcache),
+@@ -7226,7 +7236,7 @@ Show stopping for shared library events.
+ If nonzero, gdb will give control to the user when the dynamic linker\n\
+ notifies gdb of shared library events.  The most common event of interest\n\
+ to the user would be loading/unloading of a new library."),
+-                          NULL,
++                          set_stop_on_solib_events,
+                           show_stop_on_solib_events,
+                           &setlist, &showlist);
+Index: gdb-7.4.91.20120814/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c  2012-08-14 17:34:39.346752840 +0200
++++ gdb-7.4.91.20120814/gdb/solib-svr4.c       2012-08-14 17:35:42.635732596 +0200
+@@ -47,10 +47,12 @@
+ #include "auxv.h"
+ #include "exceptions.h"
+ #include "gdb_bfd.h"
++#include "probe.h"
+ static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
+ static int svr4_have_link_map_offsets (void);
+ static void svr4_relocate_main_executable (void);
++static struct so_list *namespace_table_flatten (htab_t namespace_table);
+ /* Link map info to include in an allocated so_list entry.  */
+@@ -71,6 +73,16 @@ struct lm_info
+     /* Values read in from inferior's fields of the same name.  */
+     CORE_ADDR l_ld, l_next, l_prev, l_name;
++
++    /* Numeric link-map ID of the namespace this object is loaded
++       into.  This value is only valid when using the probes-based
++       interface.  */
++    LONGEST lmid;
++
++    /* Nonzero if the namespace list this object is loaded into is the
++       application's initial namespace (LM_ID_BASE).  This value is
++       only valid when using the probes-based interface.  */
++    unsigned int in_initial_ns : 1;
+   };
+ /* On SVR4 systems, a list of symbols in the dynamic linker where
+@@ -107,6 +119,53 @@ static const  char * const main_name_lis
+   NULL
+ };
++/* What to do with the namespace table when a probe stop occurs.  */
++
++enum probe_action
++  {
++    /* Something went seriously wrong.  Stop using probes and
++       revert to using the older interface.  */
++    NAMESPACE_TABLE_INVALIDATE,
++
++    /* No action is required.  This namespace is still valid.  */
++    NAMESPACE_NO_ACTION,
++
++    /* This namespace should be reloaded entirely.  */
++    NAMESPACE_RELOAD,
++
++    /* Attempt to incrementally update this namespace. If the
++       update fails or is not possible, fall back to reloading
++       the namespace in full.  */
++    NAMESPACE_UPDATE_OR_RELOAD,
++  };
++
++/* A probe's name and its associated action.  */
++
++struct probe_info
++{
++  /* The name of the probe.  */
++  const char *name;
++
++  /* What to do with the namespace table when a probe stop occurs.  */
++  enum probe_action action;
++};
++
++/* A list of named probes and their associated actions.  If all
++   probes are present in the dynamic linker then the probes-based
++   interface will be used.  */
++
++static const struct probe_info probe_info[] =
++{
++  { "init_start", NAMESPACE_NO_ACTION },
++  { "init_complete", NAMESPACE_RELOAD },
++  { "map_start", NAMESPACE_NO_ACTION },
++  { "reloc_complete", NAMESPACE_UPDATE_OR_RELOAD },
++  { "unmap_start", NAMESPACE_NO_ACTION },
++  { "unmap_complete", NAMESPACE_RELOAD },
++};
++
++#define NUM_PROBES ARRAY_SIZE (probe_info)
++
+ /* Per pspace SVR4 specific data.  */
+ struct svr4_info
+@@ -129,17 +188,58 @@ struct svr4_info
+   CORE_ADDR interp_text_sect_high;
+   CORE_ADDR interp_plt_sect_low;
+   CORE_ADDR interp_plt_sect_high;
++
++  /* Nonzero if we are using the probes-based interface.  */
++  unsigned int using_probes : 1;
++
++  /* Named probes in the dynamic linker.  */
++  VEC (probe_p) *probes[NUM_PROBES];
++
++  /* Table of dynamic linker namespaces, used by the probes-based
++     interface.  */
++  htab_t namespace_table;
+ };
+ /* Per-program-space data key.  */
+ static const struct program_space_data *solib_svr4_pspace_data;
++/* Free any allocated probe vectors.  */
++
++static void
++free_probes (struct svr4_info *info)
++{
++  int i;
++
++  for (i = 0; i < NUM_PROBES; i++)
++    VEC_free (probe_p, info->probes[i]);
++
++  memset (info->probes, 0, sizeof (info->probes));
++}
++
++/* Free the namespace table.  */
++
++static void
++free_namespace_table (struct svr4_info *info)
++{
++  if (info->namespace_table == NULL)
++    return;
++
++  htab_delete (info->namespace_table);
++  info->namespace_table = NULL;
++}
++
+ static void
+ svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
+ {
+   struct svr4_info *info;
+   info = program_space_data (pspace, solib_svr4_pspace_data);
++  if (info == NULL)
++    return;
++
++  free_probes (info);
++  free_namespace_table (info);
++
+   xfree (info);
+ }
+@@ -188,10 +288,21 @@ svr4_same_1 (const char *gdb_so_name, co
+   return 0;
+ }
++/* Return non-zero if GDB and INFERIOR represent the same shared
++   library.  */
++
+ static int
+ svr4_same (struct so_list *gdb, struct so_list *inferior)
+ {
+-  return (svr4_same_1 (gdb->so_original_name, inferior->so_original_name));
++  struct svr4_info *info = get_svr4_info ();
++
++  if (info->using_probes)
++    {
++      if (gdb->lm_info->lmid != inferior->lm_info->lmid)
++      return 0;
++    }
++
++  return svr4_same_1 (gdb->so_original_name, inferior->so_original_name);
+ }
+ static struct lm_info *
+@@ -322,18 +433,26 @@ lm_addr_check (struct so_list *so, bfd *
+           }
+         else
+           {
+-            /* There is no way to verify the library file matches.  prelink
+-               can during prelinking of an unprelinked file (or unprelinking
+-               of a prelinked file) shift the DYNAMIC segment by arbitrary
+-               offset without any page size alignment.  There is no way to
+-               find out the ELF header and/or Program Headers for a limited
+-               verification if it they match.  One could do a verification
+-               of the DYNAMIC segment.  Still the found address is the best
+-               one GDB could find.  */
+-
+-            warning (_(".dynamic section for \"%s\" "
+-                       "is not at the expected address "
+-                       "(wrong library or version mismatch?)"), so->so_name);
++            struct svr4_info *info = get_svr4_info ();
++
++            if (!info->using_probes || so->lm_info->in_initial_ns)
++              {
++                /* There is no way to verify the library file
++                   matches.  prelink can during prelinking of an
++                   unprelinked file (or unprelinking of a prelinked
++                   file) shift the DYNAMIC segment by arbitrary
++                   offset without any page size alignment.  There is
++                   no way to find out the ELF header and/or Program
++                   Headers for a limited verification if it they
++                   match.  One could do a verification of the
++                   DYNAMIC segment.  Still the found address is the
++                   best one GDB could find.  */
++
++                warning (_(".dynamic section for \"%s\" "
++                           "is not at the expected address "
++                           "(wrong library or version mismatch?)"),
++                         so->so_name);
++              }
+           }
+       }
+@@ -775,16 +894,10 @@ locate_base (struct svr4_info *info)
+   return info->debug_base;
+ }
+-/* Find the first element in the inferior's dynamic link map, and
+-   return its address in the inferior.  Return zero if the address
+-   could not be determined.
+-
+-   FIXME: Perhaps we should validate the info somehow, perhaps by
+-   checking r_version for a known version number, or r_state for
+-   RT_CONSISTENT.  */
++/* Read the r_map field from the supplied r_debug structure.  */
+ static CORE_ADDR
+-solib_svr4_r_map (struct svr4_info *info)
++r_map_from_debug_base (CORE_ADDR debug_base)
+ {
+   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
+   struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+@@ -793,13 +906,27 @@ solib_svr4_r_map (struct svr4_info *info
+   TRY_CATCH (ex, RETURN_MASK_ERROR)
+     {
+-      addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset,
++      addr = read_memory_typed_address (debug_base + lmo->r_map_offset,
+                                         ptr_type);
+     }
+   exception_print (gdb_stderr, ex);
+   return addr;
+ }
++/* Find the first element in the inferior's dynamic link map, and
++   return its address in the inferior.  Return zero if the address
++   could not be determined.
++
++   FIXME: Perhaps we should validate the info somehow, perhaps by
++   checking r_version for a known version number, or r_state for
++   RT_CONSISTENT.  */
++
++static CORE_ADDR
++solib_svr4_r_map (struct svr4_info *info)
++{
++  return r_map_from_debug_base (info->debug_base);
++}
++
+ /* Find r_brk from the inferior's debug base.  */
+ static CORE_ADDR
+@@ -1164,15 +1291,17 @@ svr4_default_sos (void)
+   return new;
+ }
+-/* Read the whole inferior libraries chain starting at address LM.  Add the
+-   entries to the tail referenced by LINK_PTR_PTR.  Ignore the first entry if
+-   IGNORE_FIRST and set global MAIN_LM_ADDR according to it.  */
++/* Read the whole inferior libraries chain starting at address LM.
++   Expect the first entry in the chain's previous entry to be PREV_LM.
++   Add the entries to the tail referenced by LINK_PTR_PTR.  Ignore the
++   first entry if IGNORE_FIRST and set global MAIN_LM_ADDR according
++   to it.  Returns nonzero upon success.  */
+-static void
+-svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr,
+-                 int ignore_first)
++static int
++svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
++                 struct so_list ***link_ptr_ptr, int ignore_first)
+ {
+-  CORE_ADDR prev_lm = 0, next_lm;
++  CORE_ADDR next_lm;
+   for (; lm != 0; prev_lm = lm, lm = next_lm)
+     {
+@@ -1189,7 +1318,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
+       if (new->lm_info == NULL)
+       {
+         do_cleanups (old_chain);
+-        break;
++        return 0;
+       }
+       next_lm = new->lm_info->l_next;
+@@ -1200,7 +1329,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
+                  paddress (target_gdbarch, prev_lm),
+                  paddress (target_gdbarch, new->lm_info->l_prev));
+         do_cleanups (old_chain);
+-        break;
++        return 0;
+       }
+       /* For SVR4 versions, the first entry in the link map is for the
+@@ -1295,20 +1424,61 @@ svr4_read_so_list (CORE_ADDR lm, struct
+       **link_ptr_ptr = new;
+       *link_ptr_ptr = &new->next;
+     }
++
++  return 1;
+ }
+-/* Implement the "current_sos" target_so_ops method.  */
++/* Read the list of loaded libraries from the dynamic linker's base
++   structure.  */
+ static struct so_list *
+-svr4_current_sos (void)
++svr4_current_sos_from_debug_base (void)
+ {
++  struct svr4_info *info = get_svr4_info ();
+   CORE_ADDR lm;
+   struct so_list *head = NULL;
+   struct so_list **link_ptr = &head;
+-  struct svr4_info *info;
+   struct cleanup *back_to;
+   int ignore_first;
++
++  gdb_assert (info->debug_base);
++
++  /* Assume that everything is a library if the dynamic loader was loaded
++     late by a static executable.  */
++  if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
++    ignore_first = 0;
++  else
++    ignore_first = 1;
++
++  back_to = make_cleanup (svr4_free_library_list, &head);
++
++  /* Walk the inferior's link map list, and build our list of
++     `struct so_list' nodes.  */
++  lm = solib_svr4_r_map (info);
++  if (lm)
++    svr4_read_so_list (lm, 0, &link_ptr, ignore_first);
++
++  /* On Solaris, the dynamic linker is not in the normal list of
++     shared objects, so make sure we pick it up too.  Having
++     symbol information for the dynamic linker is quite crucial
++     for skipping dynamic linker resolver code.  */
++  lm = solib_svr4_r_ldsomap (info);
++  if (lm)
++    svr4_read_so_list (lm, 0, &link_ptr, 0);
++
++  discard_cleanups (back_to);
++
++  return head;
++}
++
++/* Implement the "current_sos" target_so_ops method.  */
++
++static struct so_list *
++svr4_current_sos (void)
++{
++  struct svr4_info *info;
+   struct svr4_library_list library_list;
++  struct so_list *result;
+   /* Fall back to manual examination of the target if the packet is not
+      supported or gdbserver failed to find DT_DEBUG.  gdb.server/solib-list.exp
+@@ -1331,6 +1501,10 @@ svr4_current_sos (void)
+   info = get_svr4_info ();
++  /* If we have a namespace table then return a flattened copy.  */
++  if (info->namespace_table != NULL)
++    return namespace_table_flatten (info->namespace_table);
++
+   /* Always locate the debug struct, in case it has moved.  */
+   info->debug_base = 0;
+   locate_base (info);
+@@ -1340,35 +1514,12 @@ svr4_current_sos (void)
+   if (! info->debug_base)
+     return svr4_default_sos ();
+-  /* Assume that everything is a library if the dynamic loader was loaded
+-     late by a static executable.  */
+-  if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL)
+-    ignore_first = 0;
+-  else
+-    ignore_first = 1;
+-
+-  back_to = make_cleanup (svr4_free_library_list, &head);
+-
+-  /* Walk the inferior's link map list, and build our list of
+-     `struct so_list' nodes.  */
+-  lm = solib_svr4_r_map (info);
+-  if (lm)
+-    svr4_read_so_list (lm, &link_ptr, ignore_first);
+-
+-  /* On Solaris, the dynamic linker is not in the normal list of
+-     shared objects, so make sure we pick it up too.  Having
+-     symbol information for the dynamic linker is quite crucial
+-     for skipping dynamic linker resolver code.  */
+-  lm = solib_svr4_r_ldsomap (info);
+-  if (lm)
+-    svr4_read_so_list (lm, &link_ptr, 0);
+-
+-  discard_cleanups (back_to);
++  result = svr4_current_sos_from_debug_base ();
+-  if (head == NULL)
++  if (result == NULL)
+     return svr4_default_sos ();
+-  return head;
++  return result;
+ }
+ /* Get the address of the link_map for a given OBJFILE.  */
+@@ -1450,6 +1601,498 @@ exec_entry_point (struct bfd *abfd, stru
+                                            targ);
+ }
++/* A probe and its associated information structure.  */
++
++struct probe_and_info
++{
++  /* The probe.  */
++  struct probe *probe;
++
++  /* The probe_info from which the probe was created.  */
++  const struct probe_info *info;
++};
++
++/* Get the solib event probe at the specified location, and the
++   probe_info the probe was created with.  Fills in RESULT and
++   returns nonzero if a solib event probe was found at the
++   specified location.  Returns zero if no solib event probe
++   was found.  */
++
++static int
++solib_event_probe_at (struct svr4_info *info, struct bp_location *loc,
++                    struct probe_and_info *result)
++{
++  int i;
++
++  for (i = 0; i < NUM_PROBES; i++)
++    {
++      struct probe *probe;
++      int ix;
++
++      for (ix = 0; VEC_iterate (probe_p, info->probes[i], ix, probe); ++ix)
++      {
++        if (loc->pspace == current_program_space
++            && loc->address == probe->address)
++          {
++            result->info = &probe_info[i];
++            result->probe = probe;
++
++            return 1;
++          }
++      }
++    }
++
++  return 0;
++}
++
++/* Decide what action to take when the specified solib event probe is
++   hit.  */
++
++static enum probe_action
++solib_event_probe_action (struct probe_and_info *pi)
++{
++  enum probe_action action;
++  unsigned probe_argc;
++
++  action = pi->info->action;
++  if (action == NAMESPACE_NO_ACTION || action == NAMESPACE_TABLE_INVALIDATE)
++    return action;
++
++  gdb_assert (action == NAMESPACE_RELOAD
++            || action == NAMESPACE_UPDATE_OR_RELOAD);
++
++  /* Check that an appropriate number of arguments has been supplied.
++     We expect:
++       arg0: Lmid_t lmid (mandatory)
++       arg1: struct r_debug *debug_base (mandatory)
++       arg2: struct link_map *new (optional, for incremental updates)  */
++  probe_argc = get_probe_argument_count (pi->probe);
++  if (probe_argc == 2)
++    action = NAMESPACE_RELOAD;
++  else if (probe_argc < 2)
++    action = NAMESPACE_TABLE_INVALIDATE;
++
++  return action;
++}
++
++/* A namespace in the dynamic linker.  */
++
++struct namespace
++{
++  /* Numeric link-map ID of the namespace.  */
++  LONGEST lmid;
++
++  /* List of objects loaded into the namespace.  */
++  struct so_list *solist;
++};
++
++/* Returns a hash code for the namespace referenced by p.  */
++
++static hashval_t
++hash_namespace (const void *p)
++{
++  const struct namespace *ns = p;
++
++  return (hashval_t) ns->lmid;
++}
++
++/* Returns non-zero if the namespaces referenced by p1 and p2
++   are equal.  */
++
++static int
++equal_namespace (const void *p1, const void *p2)
++{
++  const struct namespace *ns1 = p1;
++  const struct namespace *ns2 = p2;
++
++  return ns1->lmid == ns2->lmid;
++}
++
++/* Free a namespace.  */
++
++static void
++free_namespace (void *p)
++{
++  struct namespace *ns = p;
++
++  svr4_free_library_list (ns->solist);
++  xfree (ns);
++}
++
++/* Populate this namespace by reading the entire list of shared
++   objects from the inferior.  Returns nonzero on success.  */
++
++static int
++namespace_update_full (struct svr4_info *info, LONGEST lmid,
++                     CORE_ADDR debug_base, int is_initial_ns)
++{
++  struct so_list *result = NULL, *so;
++  struct namespace lookup, *ns;
++  void **slot;
++
++  /* Read the list of shared objects from the inferior.  The
++     initial namespace requires extra processing and is handled
++     separately.  */
++  if (is_initial_ns)
++    {
++      result = svr4_current_sos_from_debug_base ();
++    }
++  else
++    {
++      CORE_ADDR lm = r_map_from_debug_base (debug_base);
++      struct so_list **link_ptr = &result;
++
++      if (!svr4_read_so_list (lm, 0, &link_ptr, 0))
++      return 0;
++    }
++
++  /* If the namespace is empty then delete it from the table.  */
++  if (result == NULL)
++    {
++      if (info->namespace_table != NULL)
++      {
++        lookup.lmid = lmid;
++        htab_remove_elt (info->namespace_table, &lookup);
++      }
++
++      return 1;
++    }
++
++  /* Fill in the link-map IDs and initial namespace flags.  */
++  for (so = result; so; so = so->next)
++    {
++      so->lm_info->lmid = lmid;
++      so->lm_info->in_initial_ns = is_initial_ns;
++    }
++
++  /* Create the namespace table, if necessary.  */
++  if (info->namespace_table == NULL)
++    {
++      info->namespace_table = htab_create_alloc (1, hash_namespace,
++                                               equal_namespace,
++                                               free_namespace,
++                                               xcalloc, xfree);
++    }
++
++  /* Update the namespace table with our new list.  */
++  lookup.lmid = lmid;
++  slot = htab_find_slot (info->namespace_table, &lookup, INSERT);
++  if (*slot == HTAB_EMPTY_ENTRY)
++    {
++      ns = XCNEW (struct namespace);
++      ns->lmid = lmid;
++      *slot = ns;
++    }
++  else
++    {
++      ns = *slot;
++      svr4_free_library_list (ns->solist);
++    }
++  ns->solist = result;
++
++  return 1;
++}
++
++/* Update this namespace starting from the link-map entry passed by
++   the linker in the probe's third argument.  Returns nonzero if the
++   list was successfully updated, or zero to indicate failure.  */
++
++static int
++namespace_update_incremental (struct svr4_info *info, LONGEST lmid,
++                            CORE_ADDR lm, int is_initial_ns)
++{
++  struct namespace lookup, *ns;
++  struct so_list *tail, **link, *so;
++  struct value *val;
++
++  /* Find our namespace in the table.  */
++  if (info->namespace_table == NULL)
++    return 0;
++
++  lookup.lmid = lmid;
++  ns = htab_find (info->namespace_table, &lookup);
++  if (ns == NULL)
++    return 0;
++
++  /* Walk to the end of the list.  */
++  tail = ns->solist;
++  if (tail == NULL)
++    return 0;
++
++  while (tail->next)
++    tail = tail->next;
++  link = &tail->next;
++
++  /* Read the new objects.  */
++  if (!svr4_read_so_list (lm, tail->lm_info->lm_addr, &link, 0))
++    return 0;
++
++  /* Fill in the link-map IDs and initial namespace flags.  */
++  for (so = tail; so; so = so->next)
++    {
++      so->lm_info->lmid = lmid;
++      so->lm_info->in_initial_ns = is_initial_ns;
++    }
++
++  return 1;
++}
++
++/* Update the namespace table as appropriate when using the
++   probes-based linker interface.  Do nothing if using the
++   standard interface.  */
++
++static void
++svr4_handle_solib_event (bpstat bs)
++{
++  struct svr4_info *info = get_svr4_info ();
++  struct probe_and_info buf, *pi = &buf;
++  enum probe_action action;
++  struct value *val;
++  LONGEST lmid;
++  CORE_ADDR debug_base, lm = 0;
++  int is_initial_ns;
++
++  /* It is possible that this function will be called incorrectly
++     by the handle_solib_event in handle_inferior_event if GDB goes
++     fully multi-target.  */
++  gdb_assert (bs != NULL);
++
++  if (!info->using_probes)
++    return;
++
++  if (!solib_event_probe_at (info, bs->bp_location_at, pi))
++    goto error;
++
++  action = solib_event_probe_action (pi);
++  if (action == NAMESPACE_TABLE_INVALIDATE)
++    goto error;
++
++  if (action == NAMESPACE_NO_ACTION)
++    return;
++
++  val = evaluate_probe_argument (pi->probe, 0);
++  if (val == NULL)
++    goto error;
++
++  lmid = value_as_long (val);
++
++  val = evaluate_probe_argument (pi->probe, 1);
++  if (val == NULL)
++    goto error;
++
++  debug_base = value_as_address (val);
++  if (debug_base == 0)
++    goto error;
++
++  /* Always locate the debug struct, in case it moved.  */
++  info->debug_base = 0;
++  if (locate_base (info) == 0)
++    goto error;
++
++  is_initial_ns = (debug_base == info->debug_base);
++
++  if (action == NAMESPACE_UPDATE_OR_RELOAD)
++    {
++      val = evaluate_probe_argument (pi->probe, 2);
++      if (val != NULL)
++      lm = value_as_address (val);
++
++      if (lm == 0)
++      action = NAMESPACE_RELOAD;
++    }
++
++  if (action == NAMESPACE_UPDATE_OR_RELOAD)
++    {
++      if (namespace_update_incremental (info, lmid, lm, is_initial_ns))
++      return;
++
++      action = NAMESPACE_RELOAD;
++    }
++
++  gdb_assert (action == NAMESPACE_RELOAD);
++
++  if (namespace_update_full (info, lmid, debug_base, is_initial_ns))
++    return;
++
++ error:
++
++  /* We should never reach here, but if we do we disable the
++     probes interface and revert to the original interface.
++     We don't reset the breakpoints as the ones we've set up
++     are adequate.  */
++  warning (_("Probes-based dynamic linker interface failed.\n"
++           "Reverting to original interface.\n"));
++
++  free_namespace_table (info);
++  free_probes (info);
++  info->using_probes = 0;
++}
++
++/* Helper function for namespace_table_flatten.  */
++
++static int
++namespace_table_flatten_helper (void **slot, void *arg)
++{
++  struct namespace *ns = (struct namespace *) *slot;
++  struct so_list *src = ns->solist;
++  struct so_list **link = (struct so_list **) arg;
++
++  while (*link)
++    link = &(*link)->next;
++
++  while (src != NULL)
++    {
++      struct so_list *dst;
++
++      dst = xmalloc (sizeof (struct so_list));
++      memcpy (dst, src, sizeof (struct so_list));
++
++      dst->lm_info = xmalloc (sizeof (struct lm_info));
++      memcpy (dst->lm_info, src->lm_info, sizeof (struct lm_info));
++
++      *link = dst;
++      link = &dst->next;
++
++      src = src->next;
++    }
++
++  *link = NULL;
++
++  return 1; /* Continue traversal.  */
++}
++
++/* Flatten the namespace table into a single list.  */
++
++static struct so_list *
++namespace_table_flatten (htab_t namespace_table)
++{
++  struct so_list *dst = NULL;
++
++  htab_traverse (namespace_table, namespace_table_flatten_helper, &dst);
++
++  return dst;
++}
++
++/* Helper function for svr4_update_solib_event_breakpoints.  */
++
++static int
++svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
++{
++  struct svr4_info *info = get_svr4_info ();
++  struct bp_location *loc;
++
++  if (b->type != bp_shlib_event)
++    return 0; /* Continue iterating.  */
++
++  for (loc = b->loc; loc; loc = loc->next)
++    {
++      struct probe_and_info buf, *pi = &buf;
++
++      if (solib_event_probe_at (info, loc, pi))
++      {
++        if (pi->info->action == NAMESPACE_NO_ACTION)
++          b->enable_state = (stop_on_solib_events
++                             ? bp_enabled : bp_disabled);
++
++        return 0; /* Continue iterating.  */
++      }
++    }
++
++  return 0; /* Continue iterating.  */
++}
++
++/* Enable or disable optional solib event breakpoints as appropriate.
++   Called whenever stop_on_solib_events is changed.  */
++
++static void
++svr4_update_solib_event_breakpoints (void)
++{
++  struct svr4_info *info = get_svr4_info ();
++
++  if (info->using_probes)
++    iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL);
++}
++
++/* Both the SunOS and the SVR4 dynamic linkers call a marker function
++   before and after mapping and unmapping shared libraries.  The sole
++   purpose of this method is to allow debuggers to set a breakpoint so
++   they can track these changes.
++
++   Some versions of the glibc dynamic linker contain named probes
++   to allow more fine grained stopping.  Given the address of the
++   original marker function, this function attempts to find these
++   probes, and if found, sets breakpoints on those instead.  If the
++   probes aren't found, a single breakpoint is set on the original
++   marker function.  */
++
++static void
++svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch,
++                                   CORE_ADDR address)
++{
++  struct svr4_info *info = get_svr4_info ();
++  struct obj_section *os;
++
++  os = find_pc_section (address);
++  if (os != NULL)
++    {
++      int with_prefix;
++
++      for (with_prefix = 0; with_prefix <= 1; with_prefix++)
++      {
++        int all_probes_found = 1;
++        int i;
++
++        for (i = 0; i < NUM_PROBES; i++)
++          {
++            char name[32] = { '\0' };
++
++            /* Fedora 17, RHEL 6.2, and RHEL 6.3 shipped with an
++               early version of the probes code in which the probes'
++               names were prefixed with "rtld_".  The locations and
++               arguments of the probes are otherwise the same, so we
++               check for the prefixed version if the unprefixed
++               probes are not found.  */
++
++            if (with_prefix)
++              strncat (name, "rtld_", sizeof (name));
++
++            strncat (name, probe_info[i].name, sizeof (name) - sizeof ("rtld_"));
++
++            info->probes[i] = find_probes_in_objfile (os->objfile, "rtld",
++                                                      name);
++
++            if (!VEC_length (probe_p, info->probes[i]))
++              {
++                free_probes (info);
++                all_probes_found = 0;
++                break;
++              }
++          }
++
++        if (all_probes_found)
++          {
++            info->using_probes = 1;
++
++            for (i = 0; i < NUM_PROBES; i++)
++              {
++                struct probe *probe;
++                int ix;
++
++                for (ix = 0;
++                     VEC_iterate (probe_p, info->probes[i], ix, probe);
++                     ++ix)
++                  create_solib_event_breakpoint (gdbarch, probe->address);
++              }
++
++            svr4_update_solib_event_breakpoints ();
++            return;
++          }
++      }
++    }
++
++  create_solib_event_breakpoint (gdbarch, address);
++}
++
+ /* Helper function for gdb_bfd_lookup_symbol.  */
+ static int
+@@ -1502,6 +2145,9 @@ enable_break (struct svr4_info *info, in
+   info->interp_text_sect_low = info->interp_text_sect_high = 0;
+   info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
++  free_probes (info);
++  info->using_probes = 0;
++
+   /* If we already have a shared library list in the target, and
+      r_debug contains r_brk, set the breakpoint there - this should
+      mean r_brk has already been relocated.  Assume the dynamic linker
+@@ -1533,7 +2179,7 @@ enable_break (struct svr4_info *info, in
+        That knowledge is encoded in the address, if it's Thumb the low bit
+        is 1.  However, we've stripped that info above and it's not clear
+        what all the consequences are of passing a non-addr_bits_remove'd
+-       address to create_solib_event_breakpoint.  The call to
++       address to svr4_create_solib_event_breakpoints.  The call to
+        find_pc_section verifies we know about the address and have some
+        hope of computing the right kind of breakpoint to use (via
+        symbol info).  It does mean that GDB needs to be pointed at a
+@@ -1571,7 +2217,7 @@ enable_break (struct svr4_info *info, in
+               + bfd_section_size (tmp_bfd, interp_sect);
+           }
+-        create_solib_event_breakpoint (target_gdbarch, sym_addr);
++        svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
+         return 1;
+       }
+     }
+@@ -1729,7 +2375,8 @@ enable_break (struct svr4_info *info, in
+       if (sym_addr != 0)
+       {
+-        create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
++        svr4_create_solib_event_breakpoints (target_gdbarch,
++                                             load_addr + sym_addr);
+         xfree (interp_name);
+         return 1;
+       }
+@@ -1755,7 +2402,7 @@ enable_break (struct svr4_info *info, in
+         sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+                                                        sym_addr,
+                                                        &current_target);
+-        create_solib_event_breakpoint (target_gdbarch, sym_addr);
++        svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
+         return 1;
+       }
+     }
+@@ -1771,7 +2418,7 @@ enable_break (struct svr4_info *info, in
+             sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
+                                                            sym_addr,
+                                                            &current_target);
+-            create_solib_event_breakpoint (target_gdbarch, sym_addr);
++            svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
+             return 1;
+           }
+       }
+@@ -2281,6 +2928,9 @@ svr4_solib_create_inferior_hook (int fro
+   info = get_svr4_info ();
++  /* Free the probes-based interface's namespace table.  */
++  free_namespace_table (info);
++
+   /* Relocate the main executable if necessary.  */
+   svr4_relocate_main_executable ();
+@@ -2547,4 +3197,6 @@ _initialize_svr4_solib (void)
+   svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
+   svr4_so_ops.same = svr4_same;
+   svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
++  svr4_so_ops.handle_solib_event = svr4_handle_solib_event;
++  svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints;
+ }
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c   2012-08-14 17:34:44.330746591 +0200
+@@ -0,0 +1,24 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++
++int
++foo (int n)
++{
++  printf ("foo %d\n", n);
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c 2012-08-14 17:34:44.339746576 +0200
+@@ -0,0 +1,58 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#define _GNU_SOURCE
++#include <dlfcn.h>
++
++void
++stop ()
++{
++}
++
++int
++main ()
++{
++  void *handle1, *handle2, *handle3;
++  void (*func)(int);
++
++  handle1 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY);
++  stop ();
++
++  func = (void (*)(int)) dlsym (handle1, "foo");
++  func (1);
++
++  handle2 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY);
++  stop ();
++
++  func = (void (*)(int)) dlsym (handle2, "foo");
++  func (2);
++
++  handle3 = dlopen (SHLIB_NAME, RTLD_LAZY);
++  stop ();
++
++  func = (void (*)(int)) dlsym (handle3, "foo");
++  func (3);
++
++  dlclose (handle1);
++  stop ();
++
++  dlclose (handle2);
++  stop ();
++
++  dlclose (handle3);
++  stop ();
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp       2012-08-14 17:34:44.343746563 +0200
+@@ -0,0 +1,125 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if { [skip_shlib_tests] || [is_remote target] } {
++    return 0
++}
++
++standard_testfile
++
++set libname $testfile-solib
++set srcfile_lib $srcdir/$subdir/$libname.c
++set binfile_lib [standard_output_file $libname.so]
++
++set normal_bp "_dl_debug_state"
++set probes_bp "dl_main"
++
++if { [gdb_compile_shlib $srcfile_lib $binfile_lib \
++        [list additional_flags=-fPIC]] != "" } {
++    untested "Could not compile $binfile_lib."
++    return -1
++}
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile \
++        [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } {
++    return -1
++}
++
++# Run "info sharedlibrary" and check our library is shown the expected
++# number of times.
++proc check_info_shared { test expect } {
++    global libname
++    global gdb_prompt
++
++    set actual 0
++
++    gdb_test_multiple "info sharedlibrary" $test {
++      -re $libname {
++          incr actual 1
++          exp_continue
++      }
++      -re "\r\n$gdb_prompt $" {
++          if { $actual == $expect } {
++              pass $test
++          } else {
++              fail $test
++          }
++      }
++    }
++}
++
++# Enable stop-on-solib-events
++gdb_test_no_output "set stop-on-solib-events 1"
++
++# Run to the first stop
++gdb_test "run" ".*Stopped due to shared library event.*"
++
++# XFAIL if we are not using probes
++set test "ensure using probes"
++set using_probes 0
++gdb_test_multiple "bt" $test {
++    -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" {
++      xfail $test
++    }
++    -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" {
++      pass $test
++      set using_probes 1
++    }
++}
++
++if { $using_probes } {
++    # Set up breakpoints.
++    gdb_test_no_output "set stop-on-solib-events 0"
++    gdb_test "break stop" {Breakpoint [0-9]+ at .*}
++    gdb_test_no_output "set breakpoint pending on"
++    gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.}
++
++    # Check our library isn't loaded.
++    check_info_shared "info sharedlibrary #1" 0
++
++    # Run to the first stop and check our library loaded.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #2" 1
++
++    # The next stop should be the function in the library.
++    gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
++
++    # Run to the next stop and check our library is now loaded twice.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #3" 2
++
++    # The next stop should be the function in the library.
++    gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
++
++    # Run to the next stop and check our library is now loaded three
++    # times.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #4" 3
++
++    # The next stop should be the function in the library.
++    gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
++
++    # Run to the next stop and check our library is now loaded twice.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #5" 2
++
++    # Run to the next stop and check our library is now loaded once.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #6" 1
++
++    # Run to the next stop and check our library is not loaded.
++    gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++    check_info_shared "info sharedlibrary #7" 0
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/testsuite/gdb.base/break-interp.exp   2012-06-21 22:46:21.000000000 +0200
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp        2012-08-14 17:34:44.344746565 +0200
+@@ -109,12 +109,19 @@ proc strip_debug {dest} {
+     }
+ }
++# The marker function for the standard runtime linker interface is
++# _dl_debug_state.  The probes-based interface has no specific marker
++# function; the probe we will stop on (init_start) is in dl_main so we
++# check for that.
++
++set solib_bp {(_dl_debug_state|dl_main)}
++
+ # Implementation of reach.
+ proc reach_1 {func command displacement} {
+-    global gdb_prompt expect_out
++    global gdb_prompt expect_out solib_bp
+-    if {$func == "_dl_debug_state"} {
++    if {$func == $solib_bp} {
+       # Breakpoint on _dl_debug_state can have problems due to its overlap
+       # with the existing internal breakpoint from GDB.
+       gdb_test_no_output "set stop-on-solib-events 1"
+@@ -142,21 +149,21 @@ proc reach_1 {func command displacement}
+           exp_continue
+       }
+       -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
+-          if {$func == "_dl_debug_state"} {
++          if {$func == $solib_bp} {
+               fail $test
+           } else {
+               pass $test
+           }
+       }
+       -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" {
+-          if {$func == "_dl_debug_state"} {
++          if {$func == $solib_bp} {
+               fail $test
+           } else {
+               pass $test
+           }
+       }
+       -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" {
+-          if {$func == "_dl_debug_state"} {
++          if {$func == $solib_bp} {
+               if {$debug_state_count == 0} {
+                   # First stop does not yet relocate the _start function
+                   # descriptor on ppc64.
+@@ -175,7 +182,7 @@ proc reach_1 {func command displacement}
+       fail $test_displacement
+     }
+-    if {$func == "_dl_debug_state"} {
++    if {$func == $solib_bp} {
+       gdb_test_no_output "set stop-on-solib-events 0"
+     }
+ }
+@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel
+ }
+ proc test_ld {file ifmain trynosym displacement} {
+-    global srcdir subdir gdb_prompt expect_out inferior_exited_re
++    global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp
+     # First test normal `file'-command loaded $FILE with symbols.
+@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ
+       gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
+     }
+-    reach "_dl_debug_state" "run" $displacement
++    reach $solib_bp "run" $displacement
+-    gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt"
++    gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt"
+     if $ifmain {
+       reach "main" continue "NONE"
+@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ
+     # Try re-run if the new PIE displacement takes effect.
+     gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
+-    reach "_dl_debug_state" "run" $displacement
++    reach $solib_bp "run" $displacement
+     if $ifmain {
+       test_core $file $displacement
+@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ
+       gdb_test "exec-file $file" "exec-file $escapedfile" "load"
+       if $ifmain {
+-          reach "_dl_debug_state" run $displacement
++          reach $solib_bp run $displacement
+           # Use two separate gdb_test_multiple statements to avoid timeouts due
+           # to slow processing of wildcard capturing long output
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c    2012-08-14 17:34:44.355746561 +0200
+@@ -0,0 +1,24 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++
++int
++foo (int n)
++{
++  printf ("foo %d\n", n);
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c  2012-08-14 17:34:44.362746561 +0200
+@@ -0,0 +1,26 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <dlfcn.h>
++
++int
++main ()
++{
++  void *handle = dlopen (SHLIB_NAME, RTLD_LAZY);
++
++  dlclose (handle);
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp        2012-08-14 17:34:44.363746561 +0200
+@@ -0,0 +1,76 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if { [skip_shlib_tests] || [is_remote target] } {
++    return 0
++}
++
++standard_testfile
++
++set libname $testfile-solib
++set srcfile_lib $srcdir/$subdir/$libname.c
++set binfile_lib [standard_output_file $libname.so]
++
++set normal_bp "_dl_debug_state"
++set probes_bp "dl_main"
++
++if { [gdb_compile_shlib $srcfile_lib $binfile_lib \
++        [list additional_flags=-fPIC]] != "" } {
++    untested "Could not compile $binfile_lib."
++    return -1
++}
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile \
++        [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } {
++    return -1
++}
++
++# Enable stop-on-solib-events
++gdb_test_no_output "set stop-on-solib-events 1"
++
++# Run to the first stop
++gdb_test "run" ".*Stopped due to shared library event.*"
++
++# XFAIL if we are not using probes
++set test "ensure using probes"
++set using_probes 0
++gdb_test_multiple "bt" $test {
++    -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" {
++      xfail $test
++    }
++    -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" {
++      pass $test
++      set using_probes 1
++    }
++}
++
++if { $using_probes } {
++    # Run til it loads our library
++    set test "run til our library loads"
++    set loaded_library 0
++    while { !$loaded_library } {
++      gdb_test_multiple "c" $test {
++          -re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" {
++              pass $test
++              set loaded_library 1
++          }
++          -re "Stopped due to shared library event\\M.*$gdb_prompt $" {
++          }
++      }
++    }
++
++    # Call something to ensure that relocation occurred
++    gdb_test "call foo(23)" "foo 23.*\\\$.* = .*"
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c    2012-08-14 17:34:44.365746561 +0200
+@@ -0,0 +1,24 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++
++int
++foo (int n)
++{
++  printf ("foo %d\n", n);
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c    2012-08-14 17:34:44.365746561 +0200
+@@ -0,0 +1,24 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++
++int
++bar (int n)
++{
++  printf ("bar %d\n", n);
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c   2012-08-14 17:34:44.366746561 +0200
+@@ -0,0 +1,48 @@
++/* Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <dlfcn.h>
++
++void
++stop ()
++{
++}
++
++int
++main ()
++{
++  void *handle1, *handle2;
++  void (*func)(int);
++
++  handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY);
++  stop ();
++
++  handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY);
++  stop ();
++
++  func = (void (*)(int)) dlsym (handle1, "foo");
++  func (1);
++
++  func = (void (*)(int)) dlsym (handle2, "bar");
++  func (2);
++
++  dlclose (handle1);
++  stop ();
++
++  dlclose (handle2);
++  stop ();
++
++  return 0;
++}
+Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp 2012-08-14 17:34:44.367746561 +0200
+@@ -0,0 +1,139 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if { [skip_shlib_tests] || [is_remote target] } {
++    return 0
++}
++
++standard_testfile
++
++set lib1name $testfile-solib1
++set srcfile_lib1 $srcdir/$subdir/$lib1name.c
++set binfile_lib1 [standard_output_file $lib1name.so]
++set define1 -DSHLIB1_NAME\=\"$binfile_lib1\"
++
++set lib2name $testfile-solib2
++set srcfile_lib2 $srcdir/$subdir/$lib2name.c
++set binfile_lib2 [standard_output_file $lib2name.so]
++set define2 -DSHLIB2_NAME\=\"$binfile_lib2\"
++
++if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
++        [list additional_flags=-fPIC]] != "" } {
++    untested "Could not compile $binfile_lib1."
++    return -1
++}
++
++if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \
++        [list additional_flags=-fPIC]] != "" } {
++    untested "Could not compile $binfile_lib2."
++    return -1
++}
++
++set cflags "$define1 $define2"
++if { [prepare_for_testing $testfile.exp $testfile $srcfile \
++        [list additional_flags=$cflags libs=-ldl]] } {
++    return -1
++}
++
++# Run "info sharedlibrary" and check for the presence or absence of
++# our libraries.
++proc check_info_shared { test expect1 expect2 } {
++    global lib1name
++    global lib2name
++    global gdb_prompt
++
++    set actual1 0
++    set actual2 0
++
++    gdb_test_multiple "info sharedlibrary" $test {
++      -re $lib1name {
++          set actual1 1
++          exp_continue
++      }
++      -re $lib2name {
++          set actual2 1
++          exp_continue
++      }
++      -re "\r\n$gdb_prompt $" {
++          if { $actual1 == $expect1 && $actual2 == $expect2 } {
++              pass $test
++          } else {
++              fail $test
++          }
++      }
++    }
++}
++
++# Set up breakpoints.
++gdb_test "break stop" {Breakpoint [0-9]+ at .*}
++gdb_test_no_output "set breakpoint pending on"
++gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.}
++gdb_test "break bar" {Breakpoint [0-9]+ \(bar\) pending\.}
++
++# Check neither of the libraries are loaded at the start.
++gdb_test "start" {Temporary breakpoint [0-9]+, .* in main \(\)}
++check_info_shared "info sharedlibrary #1" 0 0
++
++# Run to the first stop and check that only the first library is loaded.
++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++check_info_shared "info sharedlibrary #2" 1 0
++
++# Run to the second stop and check that both libraries are loaded.
++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++check_info_shared "info sharedlibrary #3" 1 1
++
++# Check that the next stop is in foo.
++gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
++
++# Check that the next stop is in bar.
++gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*}
++
++# Restart the inferior and make sure there are no breakpoint reset
++# errors.  These can happen with the probes-based runtime linker
++# interface if the cache is not cleared correctly.
++set test "restart"
++gdb_test_multiple "run" $test {
++    -re {Start it from the beginning\? \(y or n\) } {
++      send_gdb "y\n"
++      exp_continue
++    }
++    -re {Error in re-setting breakpoint} {
++      fail $test
++    }
++    -re "\r\n$gdb_prompt $" {
++      pass $test
++    }
++}
++
++# We're at the first stop.  Check that only the first library is loaded.
++check_info_shared "info sharedlibrary #4" 1 0
++
++# Run to the second stop and check that both libraries are loaded.
++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++check_info_shared "info sharedlibrary #5" 1 1
++
++# Check that the next stop is in foo.
++gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*}
++
++# Check that the next stop is in bar.
++gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*}
++
++# Run to the next stop and check that the first library has been unloaded.
++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++check_info_shared "info sharedlibrary #6" 0 1
++
++# Run to the last stop and check that both libraries are gone.
++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)}
++check_info_shared "info sharedlibrary #7" 0 0
diff --git a/gdb-dlopen-stap-probe-7of7.patch b/gdb-dlopen-stap-probe-7of7.patch
new file mode 100644 (file)
index 0000000..074db24
--- /dev/null
@@ -0,0 +1,147 @@
+2012-07-30  Gary Benson  <gbenson@redhat.com>
+
+       * objfiles.h (inhibit_section_map_updates): New function
+       declaration.
+       (resume_section_map_updates): Likewise.
+       (resume_section_map_updates_cleanup): Likewise.
+       * objfiles.c (objfile_pspace_info): New field "inhibit_updates".
+       (find_pc_section): Do not update the section map if
+       inhibit_updates is set.
+       (inhibit_section_map_updates): New function.
+       (resume_section_map_updates): Likewise.
+       (resume_section_map_updates_cleanup): Likewise.
+       * solib-svr4.c (svr4_handle_solib_event): Inhibit section map
+       updates for calls to evaluate_probe_argument.
+
+Index: gdb-7.4.91.20120814/gdb/objfiles.h
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/objfiles.h    2012-08-14 17:16:54.000000000 +0200
++++ gdb-7.4.91.20120814/gdb/objfiles.h 2012-08-14 17:20:55.913174609 +0200
+@@ -526,6 +526,22 @@ extern void set_objfile_data (struct obj
+ extern void *objfile_data (struct objfile *objfile,
+                          const struct objfile_data *data);
++/* In normal use, the section map will be rebuilt by FIND_PC_SECTION
++   if objfiles have been added, removed or relocated since it was last
++   called.  Calling INHIBIT_SECTION_MAP_UPDATES will inhibit this
++   behavior until RESUME_SECTION_MAP_UPDATES is called.  If you call
++   INHIBIT_SECTION_MAP_UPDATES you must ensure that every call to
++   FIND_PC_SECTION in the inhibited region relates to a section that
++   is already in the section map and has not since been removed or
++   relocated.  */
++extern void inhibit_section_map_updates (void);
++
++/* Resume automatically rebuilding the section map as required.  */
++extern void resume_section_map_updates (void);
++
++/* Version of the above suitable for use as a cleanup.  */
++extern void resume_section_map_updates_cleanup (void *arg);
++
+ extern void default_iterate_over_objfiles_in_search_order
+   (struct gdbarch *gdbarch,
+    iterate_over_objfiles_in_search_order_cb_ftype *cb,
+Index: gdb-7.4.91.20120814/gdb/objfiles.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/objfiles.c    2012-08-14 17:16:55.000000000 +0200
++++ gdb-7.4.91.20120814/gdb/objfiles.c 2012-08-14 17:20:55.915174609 +0200
+@@ -70,6 +70,9 @@ struct objfile_pspace_info
+   int objfiles_changed_p;
+   struct obj_section **sections;
+   int num_sections;
++
++  /* Nonzero if section map updates should be inhibited.  */
++  int inhibit_updates;
+ };
+ /* Per-program-space data key.  */
+@@ -1295,7 +1298,7 @@ find_pc_section (CORE_ADDR pc)
+     return s;
+   pspace_info = get_objfile_pspace_data (current_program_space);
+-  if (pspace_info->objfiles_changed_p != 0)
++  if (pspace_info->objfiles_changed_p && !pspace_info->inhibit_updates)
+     {
+       update_section_map (current_program_space,
+                         &pspace_info->sections,
+@@ -1463,6 +1466,30 @@ objfiles_changed (void)
+   get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1;
+ }
++/* See comments in objfiles.h.  */
++
++void
++inhibit_section_map_updates (void)
++{
++  get_objfile_pspace_data (current_program_space)->inhibit_updates = 1;
++}
++
++/* See comments in objfiles.h.  */
++
++void
++resume_section_map_updates (void)
++{
++  get_objfile_pspace_data (current_program_space)->inhibit_updates = 0;
++}
++
++/* See comments in objfiles.h.  */
++
++void
++resume_section_map_updates_cleanup (void *arg)
++{
++  resume_section_map_updates ();
++}
++
+ /* The default implementation for the "iterate_over_objfiles_in_search_order"
+    gdbarch method.  It is equivalent to use the ALL_OBJFILES macro,
+    searching the objfiles in the order they are stored internally,
+Index: gdb-7.4.91.20120814/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c  2012-08-14 17:20:42.000000000 +0200
++++ gdb-7.4.91.20120814/gdb/solib-svr4.c       2012-08-14 17:21:14.090169216 +0200
+@@ -1847,6 +1847,7 @@ svr4_handle_solib_event (bpstat bs)
+   struct svr4_info *info = get_svr4_info ();
+   struct probe_and_info buf, *pi = &buf;
+   enum probe_action action;
++  struct cleanup *cleanups = NULL;
+   struct value *val;
+   LONGEST lmid;
+   CORE_ADDR debug_base, lm = 0;
+@@ -1870,6 +1871,19 @@ svr4_handle_solib_event (bpstat bs)
+   if (action == NAMESPACE_NO_ACTION)
+     return;
++  /* EVALUATE_PROBE_ARGUMENT looks up symbols in the dynamic linker
++     using FIND_PC_SECTION.  FIND_PC_SECTION is accelerated by a cache
++     called the section map.  The section map is invalidated every
++     time a shared library is loaded or unloaded, and if the inferior
++     is generating a lot of shared library events then the section map
++     will be updated every time SVR4_HANDLE_SOLIB_EVENT is called.
++     We called FIND_PC_SECTION in SVR4_CREATE_SOLIB_EVENT_BREAKPOINTS,
++     so we can guarantee that the dynamic linker's sections are in the
++     section map.  We can therefore inhibit section map updates across
++     these calls to EVALUATE_PROBE_ARGUMENT and save a lot of time.  */
++  inhibit_section_map_updates ();
++  cleanups = make_cleanup (resume_section_map_updates_cleanup, NULL);
++
+   val = evaluate_probe_argument (pi->probe, 0);
+   if (val == NULL)
+     goto error;
+@@ -1901,6 +1915,9 @@ svr4_handle_solib_event (bpstat bs)
+       action = NAMESPACE_RELOAD;
+     }
++  do_cleanups (cleanups);
++  cleanups = NULL;
++
+   if (action == NAMESPACE_UPDATE_OR_RELOAD)
+     {
+       if (namespace_update_incremental (info, lmid, lm, is_initial_ns))
+@@ -1923,6 +1940,8 @@ svr4_handle_solib_event (bpstat bs)
+   warning (_("Probes-based dynamic linker interface failed.\n"
+            "Reverting to original interface.\n"));
++  if (cleanups != NULL)
++    do_cleanups (cleanups);
+   free_namespace_table (info);
+   free_probes (info);
+   info->using_probes = 0;
index 55a6a92eb91cfa548af2d729bcd74d951444d268..fb2ebd162c0c389d91eca1001a325c000ed27e5c 100644 (file)
@@ -4,10 +4,10 @@ Date:   Mon Aug 8 12:08:53 2011 +0200
 
     +testcase
 
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
+Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c      2011-08-10 18:30:56.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c      2012-07-15 08:51:38.238701282 +0200
 @@ -0,0 +1,40 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -49,10 +49,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c
 +  i = pthread_join (t, NULL);
 +  assert (i == 0);
 +}
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c
+Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c  2011-08-10 18:30:56.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c  2012-07-15 08:51:38.239701277 +0200
 @@ -0,0 +1,46 @@
 +/* This testcase is part of GDB, the GNU debugger.
 +
@@ -100,10 +100,10 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.c
 +
 +  return 0;
 +}
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
+Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp        2011-08-10 18:30:56.000000000 +0200
++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp        2012-07-15 09:08:01.760258588 +0200
 @@ -0,0 +1,74 @@
 +# Copyright 2011 Free Software Foundation, Inc.
 +#
@@ -148,12 +148,12 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
 +    return -1
 +}
 +
-+set test "print _dl_debug_notify"
++set test "info probes all rtld rtld_map_complete"
 +gdb_test_multiple $test $test {
-+    -re " 0x\[0-9a-f\]+ <_dl_debug_notify>\r\n$gdb_prompt $" {
++    -re "\[ \t\]rtld_map_complete\[ \t\]+0x\[0-9a-f\]+.*\r\n$gdb_prompt $" {
 +      pass $test
 +    }
-+    -re "No symbol \"_dl_debug_notify\" in current context\\.\r\n$gdb_prompt $" {
++    -re "No probes matched\\.\r\n$gdb_prompt $" {
 +      xfail $test
 +      untested ${testfile}.exp
 +      return
@@ -179,81 +179,80 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.threads/dlopen-libpthread.exp
 +gdb_continue_to_breakpoint "notify" ".* notify-here .*"
 +
 +gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found"
-Index: gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/gdb.exp 2011-08-10 18:30:55.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/lib/gdb.exp      2011-08-10 18:30:56.000000000 +0200
-@@ -3563,30 +3563,49 @@ proc build_executable { testname executa
-         set sources ${executable}.c
-     }
+--- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/gdb.exp 2012-07-15 08:51:36.803709222 +0200
++++ gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp      2012-07-15 09:02:41.983028197 +0200
+@@ -3774,22 +3774,6 @@ proc build_executable_from_specs {testna
+     set binfile [standard_output_file $executable]
  
--    set binfile ${objdir}/${subdir}/${executable}
--
 -    set objects {}
--    for {set i 0} "\$i<[llength $sources]" {incr i} {
--        set s [lindex $sources $i]
--        if  { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } {
+-    set i 0
+-    foreach {s local_options} $args {
+-        if  { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
 -            untested $testname
 -            return -1
 -        }
 -        lappend objects "${binfile}${i}.o"
-+    # get_compiler_info by gdb_compile_shlib and gdb_compile_shlib_pthreads.
-+    set info_options ""
-+    if { [lsearch -exact $options "c++"] >= 0 } {
-+      set info_options "c++"
-     }
+-      incr i
+-    }
 -    
 -    if  { [gdb_compile $objects "${binfile}" executable $options] != "" } {
 -        untested $testname
-+    if [get_compiler_info binfile_unused ${info_options}] {
+-        return -1
+-    }
+-
+     set info_options ""
+     if { [lsearch -exact $options "c++"] >= 0 } {
+       set info_options "c++"
+@@ -3797,6 +3781,42 @@ proc build_executable_from_specs {testna
+     if [get_compiler_info ${info_options}] {
          return -1
      }
--    set info_options ""
--    if { [lsearch -exact $options "c++"] >= 0 } {
--      set info_options "c++"
-+    set binfile ${objdir}/${subdir}/${executable}
++
++    set binfile [standard_output_file $executable]
 +
 +    set func gdb_compile
 +    set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}]
 +    if {$func_index != -1} {
 +      set func "${func}_[lindex $options $func_index]"
-     }
--    if [get_compiler_info ${binfile} ${info_options}] {
++    }
 +
 +    # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd
 +    # parameter.  They also requires $sources while gdb_compile and
-+    # gdb_compile_pthreads require $objects.
++    # gdb_compile_pthreads require $objects.  Moreover they ignore any options.
 +    if [string match gdb_compile_shlib* $func] {
 +      set sources_path {}
-+      foreach s $sources {
++      foreach {s local_options} $args {
 +          lappend sources_path "${srcdir}/${subdir}/${s}"
 +      }
 +      set ret [$func $sources_path "${binfile}" $options]
 +    } else {
 +      set objects {}
-+      for {set i 0} "\$i<[llength $sources]" {incr i} {
-+          set s [lindex $sources $i]
-+          if  { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } {
++      set i 0
++      foreach {s local_options} $args {
++          if  { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } {
 +              untested $testname
 +              return -1
 +          }
 +          lappend objects "${binfile}${i}.o"
++          incr i
 +      }
 +      set ret [$func $objects "${binfile}" executable $options]
 +    }
 +    if  { $ret != "" } {
 +        untested $testname
-         return -1
-     }
++        return -1
++    }
 +
      return 0
  }
  
-Index: gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp
+Index: gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/lib/prelink-support.exp     2011-01-01 16:33:52.000000000 +0100
-+++ gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp  2011-08-10 19:25:41.000000000 +0200
+--- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/prelink-support.exp     2012-01-04 09:27:56.000000000 +0100
++++ gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp  2012-07-15 08:51:38.243701254 +0200
 @@ -95,8 +95,9 @@ proc file_copy {src dest} {
  # Wrap function build_executable so that the resulting executable is fully
  # self-sufficient (without dependencies on system libraries).  Parameter
@@ -306,103 +305,3 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/lib/prelink-support.exp
      return $prelink_args
  }
  
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp
-===================================================================
---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.base/break-interp.exp   2011-07-01 21:12:12.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.base/break-interp.exp        2011-08-10 18:32:21.000000000 +0200
-@@ -108,14 +108,20 @@ proc strip_debug {dest} {
-     }
- }
-+# Former symbol for solib changes notifications was _dl_debug_state, newer one
-+# is _dl_debug_notify, the right one one traps by `set stop-on-solib-events 1'.
-+
-+set solib_bp {(_dl_debug_state|_dl_debug_notify)}
-+
- # Implementation of reach.
- proc reach_1 {func command displacement} {
--    global gdb_prompt expect_out
-+    global gdb_prompt expect_out solib_bp
--    if {$func == "_dl_debug_state"} {
-+    if {$func == $solib_bp} {
-       # Breakpoint on _dl_debug_state can have problems due to its overlap
-       # with the existing internal breakpoint from GDB.
-+      # With also _dl_debug_notify we would need even two breakpoints.
-       gdb_test_no_output "set stop-on-solib-events 1"
-     } elseif {! [gdb_breakpoint $func allow-pending]} {
-       return
-@@ -141,21 +147,21 @@ proc reach_1 {func command displacement}
-           exp_continue
-       }
-       -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
--          if {$func == "_dl_debug_state"} {
-+          if {$func == $solib_bp} {
-               fail $test
-           } else {
-               pass $test
-           }
-       }
-       -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" {
--          if {$func == "_dl_debug_state"} {
-+          if {$func == $solib_bp} {
-               fail $test
-           } else {
-               pass $test
-           }
-       }
-       -re "Stopped due to shared library event\r\n$gdb_prompt $" {
--          if {$func == "_dl_debug_state"} {
-+          if {$func == $solib_bp} {
-               if {$debug_state_count == 0} {
-                   # First stop does not yet relocate the _start function
-                   # descriptor on ppc64.
-@@ -174,7 +180,7 @@ proc reach_1 {func command displacement}
-       fail $test_displacement
-     }
--    if {$func == "_dl_debug_state"} {
-+    if {$func == $solib_bp} {
-       gdb_test_no_output "set stop-on-solib-events 0"
-     }
- }
-@@ -373,7 +379,7 @@ proc test_attach {file displacement {rel
- }
- proc test_ld {file ifmain trynosym displacement} {
--    global srcdir subdir gdb_prompt expect_out inferior_exited_re
-+    global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp
-     # First test normal `file'-command loaded $FILE with symbols.
-@@ -401,9 +407,9 @@ proc test_ld {file ifmain trynosym displ
-       gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
-     }
--    reach "_dl_debug_state" "run" $displacement
-+    reach $solib_bp "run" $displacement
--    gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt"
-+    gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt"
-     if $ifmain {
-       reach "main" continue "NONE"
-@@ -415,7 +421,7 @@ proc test_ld {file ifmain trynosym displ
-     # Try re-run if the new PIE displacement takes effect.
-     gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y"
--    reach "_dl_debug_state" "run" $displacement
-+    reach $solib_bp "run" $displacement
-     if $ifmain {
-       test_core $file $displacement
-@@ -448,7 +454,7 @@ proc test_ld {file ifmain trynosym displ
-     gdb_test "exec-file $file" "exec-file $escapedfile" "load"
-     if $ifmain {
--      reach "_dl_debug_state" run $displacement
-+      reach $solib_bp run $displacement
-       # Use two separate gdb_test_multiple statements to avoid timeouts due
-       # to slow processing of wildcard capturing long output
diff --git a/gdb-dlopen-stap-probe-test2.patch b/gdb-dlopen-stap-probe-test2.patch
new file mode 100644 (file)
index 0000000..9ca4f6b
--- /dev/null
@@ -0,0 +1,69 @@
+http://sourceware.org/ml/gdb-patches/2012-08/msg00500.html
+Subject: [patch] testsuite: Make solib-corrupted.exp untested for probes  [Re: [RFA 0/4 take 2] Improved linker-debugger interface]
+
+On Fri, 17 Aug 2012 22:53:53 +0200, Jan Kratochvil wrote:
+> It regresses with glibc-debuginfo installed:
+> 
+> info sharedlibrary^M
+> From                To                  Syms Read   Shared Object Library^M
+> 0x00007ffff7ddcb20  0x00007ffff7df63d9  Yes         /lib64/ld-linux-x86-64.so.2^M
+> 0x00007ffff7ae05b0  0x00007ffff7b4ad78  Yes         /lib64/libm.so.6^M
+> 0x00007ffff77431a0  0x00007ffff7883cf0  Yes         /lib64/libc.so.6^M
+> (gdb) FAIL: gdb.base/solib-corrupted.exp: corrupted list
+> 
+> But I guess there is no longer a way to test it with probes so it should just
+> run some 'info probes' and make this test UNTESTED if rtld probes are
+> available.
+
+I had to implement it for Fedora already anyway.
+
+
+Regards,
+Jan
+
+
+gdb/testsuite/
+2012-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/solib-corrupted.exp: New variable probes.
+       (info probes): New test.
+
+diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp
+index 84b3b0c..c9f55d6 100644
+--- a/gdb/testsuite/gdb.base/solib-corrupted.exp
++++ b/gdb/testsuite/gdb.base/solib-corrupted.exp
+@@ -36,6 +36,33 @@ if ![runto_main] {
+     return
+ }
++# With probes interface GDB no longer scans the inferior library list so its
++# corruption cannot be tested.  There is no way to disable the probes
++# interface.
++
++set probes { init_start init_complete map_start reloc_complete unmap_start
++           unmap_complete }
++set test "info probes"
++gdb_test_multiple $test $test {
++    -re "^rtld\[ \t\]+(?:rtld_)?(\[a-z_\]+)\[ \t\]" {
++      set idx [lsearch -exact $probes $expect_out(1,string)]
++      if { $idx >= 0 } {
++          set probes [lreplace $probes $idx $idx]
++      }
++      exp_continue
++    }
++    -re "^\[^\r\n\]*\r\n" {
++      exp_continue
++    }
++    -re "^$gdb_prompt $" {
++    }
++}
++if { [llength $probes] == 0 } {
++    xfail $test
++    untested "GDB is using probes"
++    return
++}
++
+ gdb_test "info sharedlibrary" "From * To .*" "normal list"
+ # GDB checks there for matching L_PREV.
+
diff --git a/gdb-dlopen-stap-probe.patch b/gdb-dlopen-stap-probe.patch
deleted file mode 100644 (file)
index 54a3c03..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-From: Gary Benson <gbenson@redhat.com>
-To: Jan Kratochvil <jan.kratochvil@redhat.com>
-Message-ID: <20110810133605.GB7294@redhat.com>
-
-Index: gdb-7.4.50.20120103/gdb/infrun.c
-===================================================================
---- gdb-7.4.50.20120103.orig/gdb/infrun.c      2012-01-04 00:26:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/infrun.c   2012-01-04 00:26:21.960833391 +0100
-@@ -354,6 +354,13 @@ static struct symbol *step_start_functio
- /* Nonzero if we want to give control to the user when we're notified
-    of shared library events by the dynamic linker.  */
- int stop_on_solib_events;
-+
-+static void
-+set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c)
-+{
-+  update_solib_breakpoints ();
-+} 
-+
- static void
- show_stop_on_solib_events (struct ui_file *file, int from_tty,
-                          struct cmd_list_element *c, const char *value)
-@@ -7304,7 +7311,7 @@ Show stopping for shared library events.
- If nonzero, gdb will give control to the user when the dynamic linker\n\
- notifies gdb of shared library events.  The most common event of interest\n\
- to the user would be loading/unloading of a new library."),
--                          NULL,
-+                          set_stop_on_solib_events,
-                           show_stop_on_solib_events,
-                           &setlist, &showlist);
-Index: gdb-7.4.50.20120103/gdb/solib-svr4.c
-===================================================================
---- gdb-7.4.50.20120103.orig/gdb/solib-svr4.c  2012-01-04 00:26:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/solib-svr4.c       2012-01-04 00:29:56.303014562 +0100
-@@ -48,6 +48,8 @@
- #include "auxv.h"
- #include "exceptions.h"
-+#include "stap-probe.h"
-+
- static struct link_map_offsets *svr4_fetch_link_map_offsets (void);
- static int svr4_have_link_map_offsets (void);
- static void svr4_relocate_main_executable (void);
-@@ -93,6 +95,32 @@ static const char * const solib_break_na
-   NULL
- };
-+/* A list of SystemTap probes which, if present in the dynamic linker,
-+   allow more fine-grained breakpoints to be placed on shared library
-+   events.  */
-+
-+struct probe_info
-+  {
-+    /* The name of the probe.  */
-+    const char *name;
-+
-+    /* Nonzero if this probe must be stopped at even when
-+       stop-on-solib-events is off.  */
-+    int mandatory;
-+  };
-+
-+static const struct probe_info probe_info[] =
-+{
-+  {"rtld_init_start", 0},
-+  {"rtld_init_complete", 1},
-+  {"rtld_map_start", 0},
-+  {"rtld_reloc_complete", 1},
-+  {"rtld_unmap_start", 0},
-+  {"rtld_unmap_complete", 1},
-+};
-+
-+#define NUM_PROBES (sizeof(probe_info) / sizeof(probe_info[0]))
-+
- static const char * const bkpt_names[] =
- {
-   "_start",
-@@ -314,6 +342,12 @@ struct svr4_info
-   CORE_ADDR interp_text_sect_high;
-   CORE_ADDR interp_plt_sect_low;
-   CORE_ADDR interp_plt_sect_high;
-+
-+  /* SystemTap probes.  */
-+  VEC (stap_probe_p) *probes[NUM_PROBES];
-+
-+  /* Nonzero if we are using the SystemTap interface.  */
-+  int using_probes;
- };
- /* Per-program-space data key.  */
-@@ -323,8 +357,15 @@ static void
- svr4_pspace_data_cleanup (struct program_space *pspace, void *arg)
- {
-   struct svr4_info *info;
-+  int i;
-   info = program_space_data (pspace, solib_svr4_pspace_data);
-+  if (info == NULL)
-+    return;
-+
-+  for (i = 0; i < NUM_PROBES; i++)
-+    VEC_free (stap_probe_p, info->probes[i]);
-+
-   xfree (info);
- }
-@@ -1445,6 +1486,126 @@ exec_entry_point (struct bfd *abfd, stru
-                                            targ);
- }
-+/* Helper function for svr4_update_solib_event_breakpoints.  */
-+
-+static int
-+svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg)
-+{
-+  struct svr4_info *info = get_svr4_info ();
-+  struct bp_location *loc;
-+
-+  if (b->type != bp_shlib_event)
-+    return 0;
-+
-+  for (loc = b->loc; loc; loc = loc->next)
-+    {
-+      int i;
-+
-+      for (i = 0; i < NUM_PROBES; i++)
-+      {
-+        if (!probe_info[i].mandatory)
-+          {
-+            struct stap_probe *probe;
-+            int ix;
-+
-+            for (ix = 0;
-+                 VEC_iterate (stap_probe_p, info->probes[i], ix, probe);
-+                 ++ix)
-+              {
-+                if (loc->pspace == current_program_space
-+                    && loc->address == probe->address)
-+                  {
-+                    b->enable_state =
-+                      stop_on_solib_events ? bp_enabled : bp_disabled;
-+                    return 0;
-+                  }
-+              }
-+          }
-+      }
-+    }
-+
-+  return 0;
-+}
-+
-+/* Enable or disable optional solib event breakpoints as appropriate.
-+   Called whenever stop_on_solib_events is changed.  */
-+
-+static void
-+svr4_update_solib_event_breakpoints (void)
-+{
-+  struct svr4_info *info = get_svr4_info ();
-+
-+  if (info->using_probes)
-+    iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL);
-+}
-+
-+/* Both the SunOS and the SVR4 dynamic linkers call a marker function
-+   before and after mapping and unmapping shared libraries.  The sole
-+   purpose of this method is to allow debuggers to set a breakpoint so
-+   they can track these changes.
-+
-+   Some versions of the glibc dynamic linker contain SystemTap probes
-+   to allow more fine grained stopping.  Given the address of the
-+   original marker function, this function attempts to find these
-+   probes, and if found, sets breakpoints on those instead.  If the
-+   probes aren't found, a single breakpoint is set on the original
-+   SVR4 marker function.  */
-+
-+static void
-+svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, CORE_ADDR address)
-+{
-+  struct svr4_info *info = get_svr4_info ();
-+  struct obj_section *os;
-+
-+  os = find_pc_section (address);
-+  if (os != NULL)
-+    {
-+      int all_probes_found = 1;
-+      int i;
-+
-+      for (i = 0; i < NUM_PROBES; i++)
-+      {
-+        info->probes[i] = find_probes_in_objfile (os->objfile, "rtld",
-+                                                  probe_info[i].name);
-+
-+        if (!VEC_length(stap_probe_p, info->probes[i]))
-+          {
-+            int j;
-+
-+            for (j = i - 1; j >= 0; j--)
-+              {
-+                VEC_free (stap_probe_p, info->probes[j]);
-+                info->probes[j] = NULL;
-+              }
-+
-+            all_probes_found = 0;
-+            break;
-+          }
-+      }
-+
-+      if (all_probes_found)
-+      {
-+        info->using_probes = 1;
-+
-+        for (i = 0; i < NUM_PROBES; i++)
-+          {
-+            struct stap_probe *probe;
-+            int ix;
-+
-+            for (ix = 0;
-+                 VEC_iterate (stap_probe_p, info->probes[i], ix, probe);
-+                 ++ix)
-+              create_solib_event_breakpoint (gdbarch, probe->address);
-+          }
-+
-+        svr4_update_solib_event_breakpoints ();
-+        return;
-+      }
-+    }
-+
-+  create_solib_event_breakpoint (gdbarch, address);
-+}
-+
- /* Helper function for gdb_bfd_lookup_symbol.  */
- static int
-@@ -1493,10 +1654,18 @@ enable_break (struct svr4_info *info, in
-   asection *interp_sect;
-   gdb_byte *interp_name;
-   CORE_ADDR sym_addr;
-+  int i;
-   info->interp_text_sect_low = info->interp_text_sect_high = 0;
-   info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
-+  for (i = 0; i < NUM_PROBES; i++)
-+    {
-+      VEC_free (stap_probe_p, info->probes[i]);
-+      info->probes[i] = NULL;
-+    }
-+  info->using_probes = 0;
-+
-   /* If we already have a shared library list in the target, and
-      r_debug contains r_brk, set the breakpoint there - this should
-      mean r_brk has already been relocated.  Assume the dynamic linker
-@@ -1528,7 +1697,7 @@ enable_break (struct svr4_info *info, in
-        That knowledge is encoded in the address, if it's Thumb the low bit
-        is 1.  However, we've stripped that info above and it's not clear
-        what all the consequences are of passing a non-addr_bits_remove'd
--       address to create_solib_event_breakpoint.  The call to
-+       address to svr4_create_solib_event_breakpoints.  The call to
-        find_pc_section verifies we know about the address and have some
-        hope of computing the right kind of breakpoint to use (via
-        symbol info).  It does mean that GDB needs to be pointed at a
-@@ -1566,7 +1735,7 @@ enable_break (struct svr4_info *info, in
-               + bfd_section_size (tmp_bfd, interp_sect);
-           }
--        create_solib_event_breakpoint (target_gdbarch, sym_addr);
-+        svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
-         return 1;
-       }
-     }
-@@ -1721,7 +1890,8 @@ enable_break (struct svr4_info *info, in
-       if (sym_addr != 0)
-       {
--        create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
-+        svr4_create_solib_event_breakpoints (target_gdbarch,
-+                                             load_addr + sym_addr);
-         xfree (interp_name);
-         return 1;
-       }
-@@ -1747,7 +1917,7 @@ enable_break (struct svr4_info *info, in
-         sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
-                                                        sym_addr,
-                                                        &current_target);
--        create_solib_event_breakpoint (target_gdbarch, sym_addr);
-+        svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
-         return 1;
-       }
-     }
-@@ -1763,7 +1933,7 @@ enable_break (struct svr4_info *info, in
-             sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch,
-                                                            sym_addr,
-                                                            &current_target);
--            create_solib_event_breakpoint (target_gdbarch, sym_addr);
-+            svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr);
-             return 1;
-           }
-       }
-@@ -2539,4 +2709,5 @@ _initialize_svr4_solib (void)
-   svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
-   svr4_so_ops.same = svr4_same;
-   svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
-+  svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints;
- }
-Index: gdb-7.4.50.20120103/gdb/solib.c
-===================================================================
---- gdb-7.4.50.20120103.orig/gdb/solib.c       2012-01-04 00:26:15.000000000 +0100
-+++ gdb-7.4.50.20120103/gdb/solib.c    2012-01-04 00:29:07.751200038 +0100
-@@ -1214,6 +1214,18 @@ no_shared_libraries (char *ignored, int
-   objfile_purge_solibs ();
- }
-+/* Enable or disable optional solib event breakpoints as appropriate.  */
-+
-+void
-+update_solib_breakpoints (void)
-+{
-+  struct target_so_ops *ops = solib_ops (target_gdbarch);
-+
-+  if (ops->update_breakpoints != NULL)
-+    ops->update_breakpoints ();
-+}
-+  
-+
- /* Reload shared libraries, but avoid reloading the same symbol file
-    we already have loaded.  */
-Index: gdb-7.4.50.20120103/gdb/solib.h
-===================================================================
---- gdb-7.4.50.20120103.orig/gdb/solib.h       2011-08-30 04:48:05.000000000 +0200
-+++ gdb-7.4.50.20120103/gdb/solib.h    2012-01-04 00:27:40.415533686 +0100
-@@ -91,4 +91,8 @@ extern CORE_ADDR bfd_lookup_symbol_from_
-                                                                 void *),
-                                               void *data);
-+/* Enable or disable optional solib event breakpoints as appropriate.  */
-+
-+extern void update_solib_breakpoints (void);
-+
- #endif /* SOLIB_H */
-Index: gdb-7.4.50.20120103/gdb/solist.h
-===================================================================
---- gdb-7.4.50.20120103.orig/gdb/solist.h      2011-08-09 14:51:47.000000000 +0200
-+++ gdb-7.4.50.20120103/gdb/solist.h   2012-01-04 00:26:21.962833383 +0100
-@@ -149,6 +149,13 @@ struct target_so_ops
-        core file (in particular, for readonly sections).  */
-     int (*keep_data_in_core) (CORE_ADDR vaddr,
-                             unsigned long size);
-+
-+    /* Enable or disable optional solib event breakpoints as
-+       appropriate.  This should be called whenever
-+       stop_on_solib_events is changed.  This pointer can be
-+       NULL, in which case no enabling or disabling is necessary
-+       for this target.  */
-+    void (*update_breakpoints) (void);
-   };
- /* Free the memory associated with a (so_list *).  */
diff --git a/gdb-entryval-inlined.patch b/gdb-entryval-inlined.patch
new file mode 100644 (file)
index 0000000..3cbe84b
--- /dev/null
@@ -0,0 +1,888 @@
+http://sourceware.org/ml/gdb-patches/2012-10/msg00095.html
+Subject: [patch] entry values: Fix resolving in inlined frames
+
+Hi,
+
+Breakpoint 1, fn2 (y=<optimized out>, x=6) at gdb.arch/amd64-entry-value-inline.c:32
+32           y = -2 + x;       /* break-here */
+(gdb) info addr y
+(gdb) bt
+#0  fn2 (y=<optimized out>, x=6) at gdb.arch/amd64-entry-value-inline.c:32
+#1  fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42
+#2  0x00000000004004af in main () at gdb.arch/amd64-entry-value-inline.c:48
+(gdb) info frame
+Stack level 0, frame at 0x7fffffffdb68:
+ rip = 0x4005bc in fn2 (gdb.arch/amd64-entry-value-inline.c:32); saved rip 0x4004af
+ inlined into frame 1
+[...]
+(gdb) set debug entry-values 1
+(gdb) p y
+DW_OP_GNU_entry_value resolving expects callee fn1 at 0x4005a0 but the called frame is for fn3 at 0x4005b0
+
+FAIL:
+-----
+$1 = <optimized out>
+PASS:
+-----
+$1 = 25
+
+(gdb) p/x $pc
+$2 = 0x4005bc
+(gdb) up
+#1  fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42
+(gdb) p/x $pc
+$3 = 0x4005bc
+
+The problem is that DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value binding
+exists between DW_TAG_subprogram, nor DW_TAG_inlined_subroutine as described
+by Jakub Jelinek.  This makes sense, when we look at DW_TAG_GNU_call_site and
+we just unwind the current inlined frame we get the same PC - this is no new
+information.
+
+TAILCALL_FRAME is a different case, while also an artificial frame the
+sequence cannot be determined at compile time and the binding
+DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value exists also for
+TAILCALL_FRAMEs.
+
+I will check it in.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2012-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix entry values resolving in inlined frames.
+       * dwarf2loc.c (dwarf_expr_reg_to_entry_parameter): Move func_addr,
+       gdbarch and caller_frame initialization later.  Skip INLINE_FRAME
+       entries of FRAME.
+
+gdb/testsuite/
+2012-10-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix entry values resolving in inlined frames.
+       * gdb.arch/amd64-entry-value-inline.S: New file.
+       * gdb.arch/amd64-entry-value-inline.c: New file.
+       * gdb.arch/amd64-entry-value-inline.exp: New file.
+
+diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
+index e8d39fe..0bdc042 100644
+--- a/gdb/dwarf2loc.c
++++ b/gdb/dwarf2loc.c
+@@ -980,16 +980,27 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame,
+                                  union call_site_parameter_u kind_u,
+                                  struct dwarf2_per_cu_data **per_cu_return)
+ {
+-  CORE_ADDR func_addr = get_frame_func (frame);
+-  CORE_ADDR caller_pc;
+-  struct gdbarch *gdbarch = get_frame_arch (frame);
+-  struct frame_info *caller_frame = get_prev_frame (frame);
++  CORE_ADDR func_addr, caller_pc;
++  struct gdbarch *gdbarch;
++  struct frame_info *caller_frame;
+   struct call_site *call_site;
+   int iparams;
+   /* Initialize it just to avoid a GCC false warning.  */
+   struct call_site_parameter *parameter = NULL;
+   CORE_ADDR target_addr;
++  /* Skip any inlined frames, entry value call sites work between real
++     functions.  They do not make sense between inline functions as even PC
++     does not change there.  */
++  while (get_frame_type (frame) == INLINE_FRAME)
++    {
++      frame = get_prev_frame (frame);
++      gdb_assert (frame != NULL);
++    }
++
++  func_addr = get_frame_func (frame);
++  gdbarch = get_frame_arch (frame);
++  caller_frame = get_prev_frame (frame);
+   if (gdbarch != frame_unwind_arch (frame))
+     {
+       struct minimal_symbol *msym = lookup_minimal_symbol_by_pc (func_addr);
+diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
+new file mode 100644
+index 0000000..5f353f5
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S
+@@ -0,0 +1,672 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++/* This file is compiled from gdb.arch/amd64-entry-value-inline.c
++   using -g -dA -S -O2.  */
++
++      .file   "amd64-entry-value-inline.c"
++      .text
++.Ltext0:
++      .p2align 4,,15
++      .type   fn1, @function
++fn1:
++.LFB0:
++      .file 1 "gdb.arch/amd64-entry-value-inline.c"
++      # gdb.arch/amd64-entry-value-inline.c:22
++      .loc 1 22 0
++      .cfi_startproc
++.LVL0:
++# BLOCK 2 freq:10000 seq:0
++# PRED: ENTRY [100.0%]  (FALLTHRU)
++      # gdb.arch/amd64-entry-value-inline.c:23
++      .loc 1 23 0
++      movl    v(%rip), %eax
++      addl    $1, %eax
++      movl    %eax, v(%rip)
++# SUCC: EXIT [100.0%] 
++      ret
++      .cfi_endproc
++.LFE0:
++      .size   fn1, .-fn1
++      .p2align 4,,15
++      .globl  fn3
++      .type   fn3, @function
++fn3:
++.LFB2:
++      # gdb.arch/amd64-entry-value-inline.c:41
++      .loc 1 41 0
++      .cfi_startproc
++.LVL1:
++# BLOCK 2 freq:10000 seq:0
++# PRED: ENTRY [100.0%]  (FALLTHRU)
++.LBB4:
++.LBB5:
++      # gdb.arch/amd64-entry-value-inline.c:29
++      .loc 1 29 0
++      testl   %esi, %esi
++.LBE5:
++.LBE4:
++      # gdb.arch/amd64-entry-value-inline.c:41
++      .loc 1 41 0
++      pushq   %rbx
++      .cfi_def_cfa_offset 16
++      .cfi_offset 3, -16
++      # gdb.arch/amd64-entry-value-inline.c:41
++      .loc 1 41 0
++      movl    %edi, %ebx
++.LBB7:
++.LBB6:
++# SUCC: 3 [39.0%]  (FALLTHRU,CAN_FALLTHRU) 4 [61.0%]  (CAN_FALLTHRU)
++      # gdb.arch/amd64-entry-value-inline.c:29
++      .loc 1 29 0
++      je      .L3
++# BLOCK 3 freq:3898 seq:1
++# PRED: 2 [39.0%]  (FALLTHRU,CAN_FALLTHRU)
++      # gdb.arch/amd64-entry-value-inline.c:31
++      .loc 1 31 0
++      call    fn1
++.LVL2:
++      # gdb.arch/amd64-entry-value-inline.c:32
++      .loc 1 32 0
++      leal    -2(%rbx), %eax
++.LVL3:
++      # gdb.arch/amd64-entry-value-inline.c:33
++      .loc 1 33 0
++      movl    %eax, %edi
++      imull   %eax, %edi
++      addl    $1, %edi
++.LVL4:
++      imull   %edi, %eax
++.LVL5:
++      # gdb.arch/amd64-entry-value-inline.c:34
++      .loc 1 34 0
++      leal    (%rbx,%rax), %edi
++      call    fn1
++.LVL6:
++# SUCC: 4 [100.0%]  (FALLTHRU,CAN_FALLTHRU)
++# BLOCK 4 freq:10000 seq:2
++# PRED: 2 [61.0%]  (CAN_FALLTHRU) 3 [100.0%]  (FALLTHRU,CAN_FALLTHRU)
++.L3:
++.LBE6:
++.LBE7:
++      # gdb.arch/amd64-entry-value-inline.c:43
++      .loc 1 43 0
++      movl    %ebx, %eax
++      popq    %rbx
++      .cfi_def_cfa_offset 8
++.LVL7:
++# SUCC: EXIT [100.0%] 
++      ret
++      .cfi_endproc
++.LFE2:
++      .size   fn3, .-fn3
++      .section        .text.startup,"ax",@progbits
++      .p2align 4,,15
++      .globl  main
++      .type   main, @function
++main:
++.LFB3:
++      # gdb.arch/amd64-entry-value-inline.c:47
++      .loc 1 47 0
++      .cfi_startproc
++# BLOCK 2 freq:10000 seq:0
++# PRED: ENTRY [100.0%]  (FALLTHRU)
++      # gdb.arch/amd64-entry-value-inline.c:48
++      .loc 1 48 0
++      movl    $25, %esi
++      movl    $6, %edi
++      call    fn3
++.LVL8:
++      # gdb.arch/amd64-entry-value-inline.c:50
++      .loc 1 50 0
++      xorl    %eax, %eax
++# SUCC: EXIT [100.0%] 
++      ret
++      .cfi_endproc
++.LFE3:
++      .size   main, .-main
++      .local  v
++      .comm   v,4,4
++      .text
++.Letext0:
++      .section        .debug_info,"",@progbits
++.Ldebug_info0:
++      .long   0x164   # Length of Compilation Unit Info
++      .value  0x4     # DWARF version number
++      .long   .Ldebug_abbrev0 # Offset Into Abbrev. Section
++      .byte   0x8     # Pointer Size (in bytes)
++      .uleb128 0x1    # (DIE (0xb) DW_TAG_compile_unit)
++      .long   .LASF0  # DW_AT_producer: "GNU C 4.8.0 20121005 (experimental) -mtune=generic -march=x86-64 -g -O2"
++      .byte   0x1     # DW_AT_language
++      .long   .LASF1  # DW_AT_name: "gdb.arch/amd64-entry-value-inline.c"
++      .long   .LASF2  # DW_AT_comp_dir: ""
++      .long   .Ldebug_ranges0+0x30    # DW_AT_ranges
++      .quad   0       # DW_AT_low_pc
++      .long   .Ldebug_line0   # DW_AT_stmt_list
++      .uleb128 0x2    # (DIE (0x29) DW_TAG_subprogram)
++      .ascii "fn1\0"  # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x15    # DW_AT_decl_line
++                      # DW_AT_prototyped
++      .quad   .LFB0   # DW_AT_low_pc
++      .quad   .LFE0-.LFB0     # DW_AT_high_pc
++      .uleb128 0x1    # DW_AT_frame_base
++      .byte   0x9c    # DW_OP_call_frame_cfa
++                      # DW_AT_GNU_all_call_sites
++      .long   0x52    # DW_AT_sibling
++      .uleb128 0x3    # (DIE (0x46) DW_TAG_formal_parameter)
++      .ascii "x\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x15    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .uleb128 0x1    # DW_AT_location
++      .byte   0x55    # DW_OP_reg5
++      .byte   0       # end of children of DIE 0x29
++      .uleb128 0x4    # (DIE (0x52) DW_TAG_base_type)
++      .byte   0x4     # DW_AT_byte_size
++      .byte   0x5     # DW_AT_encoding
++      .ascii "int\0"  # DW_AT_name
++      .uleb128 0x5    # (DIE (0x59) DW_TAG_subprogram)
++      .ascii "fn2\0"  # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x1b    # DW_AT_decl_line
++                      # DW_AT_prototyped
++      .long   0x52    # DW_AT_type
++      .byte   0x1     # DW_AT_inline
++      .long   0x7c    # DW_AT_sibling
++      .uleb128 0x6    # (DIE (0x69) DW_TAG_formal_parameter)
++      .ascii "x\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x1b    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .uleb128 0x6    # (DIE (0x72) DW_TAG_formal_parameter)
++      .ascii "y\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x1b    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .byte   0       # end of children of DIE 0x59
++      .uleb128 0x7    # (DIE (0x7c) DW_TAG_subprogram)
++                      # DW_AT_external
++      .ascii "fn3\0"  # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x28    # DW_AT_decl_line
++                      # DW_AT_prototyped
++      .long   0x52    # DW_AT_type
++      .quad   .LFB2   # DW_AT_low_pc
++      .quad   .LFE2-.LFB2     # DW_AT_high_pc
++      .uleb128 0x1    # DW_AT_frame_base
++      .byte   0x9c    # DW_OP_call_frame_cfa
++                      # DW_AT_GNU_all_call_sites
++      .long   0x115   # DW_AT_sibling
++      .uleb128 0x8    # (DIE (0x9d) DW_TAG_formal_parameter)
++      .ascii "x\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x28    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .long   .LLST0  # DW_AT_location
++      .uleb128 0x8    # (DIE (0xaa) DW_TAG_formal_parameter)
++      .ascii "y\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x28    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .long   .LLST1  # DW_AT_location
++      .uleb128 0x9    # (DIE (0xb7) DW_TAG_inlined_subroutine)
++      .long   0x59    # DW_AT_abstract_origin
++      .quad   .LBB4   # DW_AT_entry_pc
++      .long   .Ldebug_ranges0+0       # DW_AT_ranges
++      .byte   0x1     # DW_AT_call_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x2a    # DW_AT_call_line
++      .uleb128 0xa    # (DIE (0xca) DW_TAG_formal_parameter)
++      .long   0x72    # DW_AT_abstract_origin
++      .long   .LLST2  # DW_AT_location
++      .uleb128 0xa    # (DIE (0xd3) DW_TAG_formal_parameter)
++      .long   0x69    # DW_AT_abstract_origin
++      .long   .LLST0  # DW_AT_location
++      .uleb128 0xb    # (DIE (0xdc) DW_TAG_GNU_call_site)
++      .quad   .LVL2   # DW_AT_low_pc
++      .long   0x29    # DW_AT_abstract_origin
++      .long   0xf4    # DW_AT_sibling
++      .uleb128 0xc    # (DIE (0xed) DW_TAG_GNU_call_site_parameter)
++      .uleb128 0x1    # DW_AT_location
++      .byte   0x55    # DW_OP_reg5
++      .uleb128 0x2    # DW_AT_GNU_call_site_value
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 0
++      .byte   0       # end of children of DIE 0xdc
++      .uleb128 0xd    # (DIE (0xf4) DW_TAG_GNU_call_site)
++      .quad   .LVL6   # DW_AT_low_pc
++      .long   0x29    # DW_AT_abstract_origin
++      .uleb128 0xc    # (DIE (0x101) DW_TAG_GNU_call_site_parameter)
++      .uleb128 0x1    # DW_AT_location
++      .byte   0x55    # DW_OP_reg5
++      .uleb128 0xd    # DW_AT_GNU_call_site_value
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x1e    # DW_OP_mul
++      .byte   0x23    # DW_OP_plus_uconst
++      .uleb128 0x1
++      .byte   0x1e    # DW_OP_mul
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 0
++      .byte   0x22    # DW_OP_plus
++      .byte   0       # end of children of DIE 0xf4
++      .byte   0       # end of children of DIE 0xb7
++      .byte   0       # end of children of DIE 0x7c
++      .uleb128 0xe    # (DIE (0x115) DW_TAG_subprogram)
++                      # DW_AT_external
++      .long   .LASF3  # DW_AT_name: "main"
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x2e    # DW_AT_decl_line
++      .long   0x52    # DW_AT_type
++      .quad   .LFB3   # DW_AT_low_pc
++      .quad   .LFE3-.LFB3     # DW_AT_high_pc
++      .uleb128 0x1    # DW_AT_frame_base
++      .byte   0x9c    # DW_OP_call_frame_cfa
++                      # DW_AT_GNU_all_call_sites
++      .long   0x14f   # DW_AT_sibling
++      .uleb128 0xd    # (DIE (0x136) DW_TAG_GNU_call_site)
++      .quad   .LVL8   # DW_AT_low_pc
++      .long   0x7c    # DW_AT_abstract_origin
++      .uleb128 0xc    # (DIE (0x143) DW_TAG_GNU_call_site_parameter)
++      .uleb128 0x1    # DW_AT_location
++      .byte   0x55    # DW_OP_reg5
++      .uleb128 0x1    # DW_AT_GNU_call_site_value
++      .byte   0x36    # DW_OP_lit6
++      .uleb128 0xc    # (DIE (0x148) DW_TAG_GNU_call_site_parameter)
++      .uleb128 0x1    # DW_AT_location
++      .byte   0x54    # DW_OP_reg4
++      .uleb128 0x1    # DW_AT_GNU_call_site_value
++      .byte   0x49    # DW_OP_lit25
++      .byte   0       # end of children of DIE 0x136
++      .byte   0       # end of children of DIE 0x115
++      .uleb128 0xf    # (DIE (0x14f) DW_TAG_variable)
++      .ascii "v\0"    # DW_AT_name
++      .byte   0x1     # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c)
++      .byte   0x12    # DW_AT_decl_line
++      .long   0x162   # DW_AT_type
++      .uleb128 0x9    # DW_AT_location
++      .byte   0x3     # DW_OP_addr
++      .quad   v
++      .uleb128 0x10   # (DIE (0x162) DW_TAG_volatile_type)
++      .long   0x52    # DW_AT_type
++      .byte   0       # end of children of DIE 0xb
++      .section        .debug_abbrev,"",@progbits
++.Ldebug_abbrev0:
++      .uleb128 0x1    # (abbrev code)
++      .uleb128 0x11   # (TAG: DW_TAG_compile_unit)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x25   # (DW_AT_producer)
++      .uleb128 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 0x55   # (DW_AT_ranges)
++      .uleb128 0x17   # (DW_FORM_sec_offset)
++      .uleb128 0x11   # (DW_AT_low_pc)
++      .uleb128 0x1    # (DW_FORM_addr)
++      .uleb128 0x10   # (DW_AT_stmt_list)
++      .uleb128 0x17   # (DW_FORM_sec_offset)
++      .byte   0
++      .byte   0
++      .uleb128 0x2    # (abbrev code)
++      .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x27   # (DW_AT_prototyped)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x11   # (DW_AT_low_pc)
++      .uleb128 0x1    # (DW_FORM_addr)
++      .uleb128 0x12   # (DW_AT_high_pc)
++      .uleb128 0x7    # (DW_FORM_data8)
++      .uleb128 0x40   # (DW_AT_frame_base)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x1    # (DW_AT_sibling)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0x3    # (abbrev code)
++      .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
++      .byte   0       # DW_children_no
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x2    # (DW_AT_location)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .byte   0
++      .byte   0
++      .uleb128 0x4    # (abbrev code)
++      .uleb128 0x24   # (TAG: DW_TAG_base_type)
++      .byte   0       # DW_children_no
++      .uleb128 0xb    # (DW_AT_byte_size)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3e   # (DW_AT_encoding)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .byte   0
++      .byte   0
++      .uleb128 0x5    # (abbrev code)
++      .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x27   # (DW_AT_prototyped)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x20   # (DW_AT_inline)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x1    # (DW_AT_sibling)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0x6    # (abbrev code)
++      .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
++      .byte   0       # DW_children_no
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0x7    # (abbrev code)
++      .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x3f   # (DW_AT_external)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x27   # (DW_AT_prototyped)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .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 0x7    # (DW_FORM_data8)
++      .uleb128 0x40   # (DW_AT_frame_base)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x1    # (DW_AT_sibling)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0x8    # (abbrev code)
++      .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
++      .byte   0       # DW_children_no
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x2    # (DW_AT_location)
++      .uleb128 0x17   # (DW_FORM_sec_offset)
++      .byte   0
++      .byte   0
++      .uleb128 0x9    # (abbrev code)
++      .uleb128 0x1d   # (TAG: DW_TAG_inlined_subroutine)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x31   # (DW_AT_abstract_origin)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x52   # (DW_AT_entry_pc)
++      .uleb128 0x1    # (DW_FORM_addr)
++      .uleb128 0x55   # (DW_AT_ranges)
++      .uleb128 0x17   # (DW_FORM_sec_offset)
++      .uleb128 0x58   # (DW_AT_call_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x59   # (DW_AT_call_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .byte   0
++      .byte   0
++      .uleb128 0xa    # (abbrev code)
++      .uleb128 0x5    # (TAG: DW_TAG_formal_parameter)
++      .byte   0       # DW_children_no
++      .uleb128 0x31   # (DW_AT_abstract_origin)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x2    # (DW_AT_location)
++      .uleb128 0x17   # (DW_FORM_sec_offset)
++      .byte   0
++      .byte   0
++      .uleb128 0xb    # (abbrev code)
++      .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x11   # (DW_AT_low_pc)
++      .uleb128 0x1    # (DW_FORM_addr)
++      .uleb128 0x31   # (DW_AT_abstract_origin)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x1    # (DW_AT_sibling)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0xc    # (abbrev code)
++      .uleb128 0x410a # (TAG: DW_TAG_GNU_call_site_parameter)
++      .byte   0       # DW_children_no
++      .uleb128 0x2    # (DW_AT_location)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .uleb128 0x2111 # (DW_AT_GNU_call_site_value)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .byte   0
++      .byte   0
++      .uleb128 0xd    # (abbrev code)
++      .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x11   # (DW_AT_low_pc)
++      .uleb128 0x1    # (DW_FORM_addr)
++      .uleb128 0x31   # (DW_AT_abstract_origin)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0xe    # (abbrev code)
++      .uleb128 0x2e   # (TAG: DW_TAG_subprogram)
++      .byte   0x1     # DW_children_yes
++      .uleb128 0x3f   # (DW_AT_external)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0xe    # (DW_FORM_strp)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .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 0x7    # (DW_FORM_data8)
++      .uleb128 0x40   # (DW_AT_frame_base)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
++      .uleb128 0x19   # (DW_FORM_flag_present)
++      .uleb128 0x1    # (DW_AT_sibling)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .uleb128 0xf    # (abbrev code)
++      .uleb128 0x34   # (TAG: DW_TAG_variable)
++      .byte   0       # DW_children_no
++      .uleb128 0x3    # (DW_AT_name)
++      .uleb128 0x8    # (DW_FORM_string)
++      .uleb128 0x3a   # (DW_AT_decl_file)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x3b   # (DW_AT_decl_line)
++      .uleb128 0xb    # (DW_FORM_data1)
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .uleb128 0x2    # (DW_AT_location)
++      .uleb128 0x18   # (DW_FORM_exprloc)
++      .byte   0
++      .byte   0
++      .uleb128 0x10   # (abbrev code)
++      .uleb128 0x35   # (TAG: DW_TAG_volatile_type)
++      .byte   0       # DW_children_no
++      .uleb128 0x49   # (DW_AT_type)
++      .uleb128 0x13   # (DW_FORM_ref4)
++      .byte   0
++      .byte   0
++      .byte   0
++      .section        .debug_loc,"",@progbits
++.Ldebug_loc0:
++.LLST0:
++      .quad   .LVL1   # Location list begin address (*.LLST0)
++      .quad   .LVL2-1 # Location list end address (*.LLST0)
++      .value  0x1     # Location expression size
++      .byte   0x55    # DW_OP_reg5
++      .quad   .LVL2-1 # Location list begin address (*.LLST0)
++      .quad   .LVL7   # Location list end address (*.LLST0)
++      .value  0x1     # Location expression size
++      .byte   0x53    # DW_OP_reg3
++      .quad   .LVL7   # Location list begin address (*.LLST0)
++      .quad   .LFE2   # Location list end address (*.LLST0)
++      .value  0x1     # Location expression size
++      .byte   0x50    # DW_OP_reg0
++      .quad   0       # Location list terminator begin (*.LLST0)
++      .quad   0       # Location list terminator end (*.LLST0)
++.LLST1:
++      .quad   .LVL1   # Location list begin address (*.LLST1)
++      .quad   .LVL2-1 # Location list end address (*.LLST1)
++      .value  0x1     # Location expression size
++      .byte   0x54    # DW_OP_reg4
++      .quad   .LVL2-1 # Location list begin address (*.LLST1)
++      .quad   .LFE2   # Location list end address (*.LLST1)
++      .value  0x4     # Location expression size
++      .byte   0xf3    # DW_OP_GNU_entry_value
++      .uleb128 0x1
++      .byte   0x54    # DW_OP_reg4
++      .byte   0x9f    # DW_OP_stack_value
++      .quad   0       # Location list terminator begin (*.LLST1)
++      .quad   0       # Location list terminator end (*.LLST1)
++.LLST2:
++      .quad   .LVL1   # Location list begin address (*.LLST2)
++      .quad   .LVL2-1 # Location list end address (*.LLST2)
++      .value  0x1     # Location expression size
++      .byte   0x54    # DW_OP_reg4
++      .quad   .LVL2-1 # Location list begin address (*.LLST2)
++      .quad   .LVL3   # Location list end address (*.LLST2)
++      .value  0x4     # Location expression size
++      .byte   0xf3    # DW_OP_GNU_entry_value
++      .uleb128 0x1
++      .byte   0x54    # DW_OP_reg4
++      .byte   0x9f    # DW_OP_stack_value
++      .quad   .LVL3   # Location list begin address (*.LLST2)
++      .quad   .LVL4   # Location list end address (*.LLST2)
++      .value  0x1     # Location expression size
++      .byte   0x50    # DW_OP_reg0
++      .quad   .LVL4   # Location list begin address (*.LLST2)
++      .quad   .LVL5   # Location list end address (*.LLST2)
++      .value  0x6     # Location expression size
++      .byte   0x70    # DW_OP_breg0
++      .sleb128 0
++      .byte   0x75    # DW_OP_breg5
++      .sleb128 0
++      .byte   0x1e    # DW_OP_mul
++      .byte   0x9f    # DW_OP_stack_value
++      .quad   .LVL5   # Location list begin address (*.LLST2)
++      .quad   .LVL6-1 # Location list end address (*.LLST2)
++      .value  0x1     # Location expression size
++      .byte   0x50    # DW_OP_reg0
++      .quad   .LVL6-1 # Location list begin address (*.LLST2)
++      .quad   .LVL6   # Location list end address (*.LLST2)
++      .value  0xb     # Location expression size
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x73    # DW_OP_breg3
++      .sleb128 -2
++      .byte   0x1e    # DW_OP_mul
++      .byte   0x23    # DW_OP_plus_uconst
++      .uleb128 0x1
++      .byte   0x1e    # DW_OP_mul
++      .byte   0x9f    # DW_OP_stack_value
++      .quad   0       # Location list terminator begin (*.LLST2)
++      .quad   0       # Location list terminator end (*.LLST2)
++      .section        .debug_aranges,"",@progbits
++      .long   0x3c    # Length of Address Ranges Info
++      .value  0x2     # DWARF Version
++      .long   .Ldebug_info0   # Offset of Compilation Unit Info
++      .byte   0x8     # Size of Address
++      .byte   0       # Size of Segment Descriptor
++      .value  0       # Pad to 16 byte boundary
++      .value  0
++      .quad   .Ltext0 # Address
++      .quad   .Letext0-.Ltext0        # Length
++      .quad   .LFB3   # Address
++      .quad   .LFE3-.LFB3     # Length
++      .quad   0
++      .quad   0
++      .section        .debug_ranges,"",@progbits
++.Ldebug_ranges0:
++      .quad   .LBB4   # Offset 0
++      .quad   .LBE4
++      .quad   .LBB7
++      .quad   .LBE7
++      .quad   0
++      .quad   0
++      .quad   .Ltext0 # Offset 0x30
++      .quad   .Letext0
++      .quad   .LFB3   # Offset 0x40
++      .quad   .LFE3
++      .quad   0
++      .quad   0
++      .section        .debug_line,"",@progbits
++.Ldebug_line0:
++      .section        .debug_str,"MS",@progbits,1
++.LASF0:
++      .string "GNU C 4.8.0 20121005+patches (experimental) -mtune=generic -march=x86-64 -g -O2"
++.LASF1:
++      .string "gdb.arch/amd64-entry-value-inline.c"
++.LASF2:
++      .string ""
++.LASF3:
++      .string "main"
++      .ident  "GCC: (GNU) 4.8.0 20121005 (experimental)"
++      .section        .note.GNU-stack,"",@progbits
+diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
+new file mode 100644
+index 0000000..f7fefb8
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c
+@@ -0,0 +1,50 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++static volatile int v;
++
++static __attribute__((noinline, noclone)) void
++fn1 (int x)
++{
++  v++;
++}
++
++static int
++fn2 (int x, int y)
++{
++  if (y)
++    {
++      fn1 (x);
++      y = -2 + x;     /* break-here */
++      y = y * y * y + y;
++      fn1 (x + y);
++    }
++  return x;
++}
++
++__attribute__((noinline, noclone)) int
++fn3 (int x, int y)
++{
++  return fn2 (x, y);
++}
++
++int
++main ()
++{
++  fn3 (6, 25);
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+new file mode 100644
+index 0000000..6aa92c1
+--- /dev/null
++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp
+@@ -0,0 +1,40 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set opts {}
++standard_testfile .S
++
++if [info exists COMPILE] {
++    # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
++    standard_testfile
++    lappend opts debug optimize=-O2
++} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
++    verbose "Skipping ${testfile}."
++    return
++}
++
++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } {
++    return -1
++}
++
++if ![runto_main] {
++    return -1
++}
++
++set srcfile $testfile.c
++gdb_breakpoint [gdb_get_line_number "break-here"]
++
++gdb_continue_to_breakpoint "break-here" ".* break-here .*"
++gdb_test "p y" " = 25"
+
diff --git a/gdb-exit-warning.patch b/gdb-exit-warning.patch
deleted file mode 100644 (file)
index 653cc15..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-02/msg00664.html
-Subject: RFA: fix PR breakpoints/13776
-
-I'd appreciate comments on this patch.
-I have no idea whether it is the best way to fix the problem.
-
-Bug 13776 concerns 'next'ing over an exit.  For the trivial:
-
-    #include <stdlib.h> 
-    int
-    main (void)
-    {
-      exit (0);
-    }
-
-We get this behavior:
-
-    (gdb) start
-    Temporary breakpoint 1, main () at exit0.c:5
-    5      exit (0);
-    (gdb) next
-    [Inferior 1 (process 2428) exited normally]
-    warning: Error removing breakpoint 0
-    warning: Error removing breakpoint 0
-    warning: Error removing breakpoint 0
-
-The bug is that exit_inferior ends up calling delete_longjmp_breakpoint,
-which tries to delete the longjmp breakpoints -- but as the inferior is
-dead, this fails.
-
-This patch fixes this problem by moving the breakpoint_init_inferior
-call earlier in generic_mourn_inferior.  This causes the breakpoints to
-be marked as uninserted before they are deleted.
-
-While doing this I noticed that after the inferior exits, we are left
-with a step-resume breakpoint:
-
-(gdb) maint info b
-Num     Type           Disp Enb Address            What
-[...]
-0       step resume    dstp y   0x00000000004004d2  inf 1 thread 1
-       stop only in thread 1
-
-The breakpoint.c patch causes this to be removed as well.
-
-Built and regtested on x86-64 Fedora 16.
-
-Tom
-
-2012-02-28  Tom Tromey  <tromey@redhat.com>
-
-       PR breakpoints/13776:
-       * target.c (generic_mourn_inferior): Call breakpoint_init_inferior
-       earlier.
-       * breakpoint.c (breakpoint_init_inferior): Delete step-resume
-       breakpoints.
-
-diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index db05b97..048cc63 100644
---- a/gdb/breakpoint.c
-+++ b/gdb/breakpoint.c
-@@ -3341,6 +3341,10 @@ breakpoint_init_inferior (enum inf_context context)
-          (gdb) tar rem :9999     # remote Windows gdbserver.
-       */
-+      case bp_step_resume:
-+
-+      /* Also remove step-resume breakpoints.  */
-+
-       delete_breakpoint (b);
-       break;
-diff --git a/gdb/target.c b/gdb/target.c
-index 1f408f6..65a6c23 100644
---- a/gdb/target.c
-+++ b/gdb/target.c
-@@ -3583,13 +3583,14 @@ generic_mourn_inferior (void)
-   ptid = inferior_ptid;
-   inferior_ptid = null_ptid;
-+  breakpoint_init_inferior (inf_exited);
-+
-   if (!ptid_equal (ptid, null_ptid))
-     {
-       int pid = ptid_get_pid (ptid);
-       exit_inferior (pid);
-     }
--  breakpoint_init_inferior (inf_exited);
-   registers_changed ();
-   reopen_exec_file ();
-
diff --git a/gdb-expand-cxx-accel.patch b/gdb-expand-cxx-accel.patch
deleted file mode 100644 (file)
index 2737bfd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-https://bugzilla.redhat.com/show_bug.cgi?id=787487
-http://sourceware.org/ml/gdb-patches/2012-02/msg00112.html
-Subject: RFC: extend symtabs_from_filename skipping for C++
-
-I'd appreciate comments on this.  Barring comments I will check it in
-after a couple days.
-
-A while ago Doug committed a patch to change linespec to skip
-symtabs_from_filename when possible.  This was an important performance
-improvement.
-
-We got a bug report in Red Hat bugzilla asking that this be extended to
-C++ qualified names:
-
-    https://bugzilla.redhat.com/show_bug.cgi?id=787487
-
-This patch implements this idea.
-
-Built and regtested on x86-64 Fedora 15.
-
-Tom
-
-2012-02-08  Tom Tromey  <tromey@redhat.com>
-
-       * linespec.c (decode_line_internal): Skip symtabs_from_filename
-       when we have a C++ qualified name.
-
-diff --git a/gdb/linespec.c b/gdb/linespec.c
-index da88d17..3f53b8e 100644
---- a/gdb/linespec.c
-+++ b/gdb/linespec.c
-@@ -912,9 +912,11 @@ decode_line_internal (struct linespec_state *self, char **argptr)
-   /* First things first: if ARGPTR starts with a filename, get its
-      symtab and strip the filename from ARGPTR.
-      Avoid calling symtab_from_filename if we know can,
--     it can be expensive.  */
-+     it can be expensive.  We know we can avoid the call if we see a
-+     single word (e.g., "break NAME") or if we see a qualified C++
-+     name ("break QUAL::NAME").  */
--  if (*p != '\0')
-+  if (*p != '\0' && p[1] != ':')
-     {
-       TRY_CATCH (file_exception, RETURN_MASK_ERROR)
-       {
-
diff --git a/gdb-false-gcc-warning.patch b/gdb-false-gcc-warning.patch
deleted file mode 100644 (file)
index 22ad08c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- gdb-7.1.90.20100806/gdb/infcall.c.orig     2010-08-10 00:34:10.000000000 +0200
-+++ gdb-7.1.90.20100806/gdb/infcall.c  2010-08-10 00:36:03.000000000 +0200
-@@ -284,7 +284,7 @@ find_function_addr (struct value *functi
-   struct type *ftype = check_typedef (value_type (function));
-   struct gdbarch *gdbarch = get_type_arch (ftype);
-   struct type *value_type = NULL;
--  CORE_ADDR funaddr;
-+  CORE_ADDR funaddr = 0;      /* GCC false -fprofile-use warning.  */
-   /* If it's a member function, just look at the function
-      part of it.  */
index fe1199f207305e678375e11cc1155c30b17f5ceb..238b35593b7429621c4df2202a060cda70213c07 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.2.50.20110117/gdb/f-lang.c
+Index: gdb-7.4.50.20120602/gdb/f-lang.c
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/f-lang.c      2011-01-07 20:36:16.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/f-lang.c   2011-01-17 15:56:07.000000000 +0100
-@@ -57,20 +57,6 @@ typedef struct saved_bf_symnum SAVED_BF,
+--- gdb-7.4.50.20120602.orig/gdb/f-lang.c      2012-03-02 20:29:00.000000000 +0100
++++ gdb-7.4.50.20120602/gdb/f-lang.c   2012-06-02 19:13:31.520050654 +0200
+@@ -59,20 +59,6 @@ typedef struct saved_bf_symnum SAVED_BF,
  /* Local functions */
  
  extern void _initialize_f_language (void);
@@ -23,7 +23,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
  
  static void f_printchar (int c, struct type *type, struct ui_file * stream);
  static void f_emit_char (int c, struct type *type,
-@@ -461,185 +447,7 @@ _initialize_f_language (void)
+@@ -385,185 +371,7 @@ _initialize_f_language (void)
    add_language (&f_language_defn);
  }
  
@@ -209,7 +209,7 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
  
  /* This routine finds the first encountred COMMON block named "name" 
     that belongs to function funcname.  */
-@@ -662,193 +470,3 @@ find_common_for_function (char *name, ch
+@@ -586,193 +394,3 @@ find_common_for_function (const char *na
      }
    return (NULL);
  }
@@ -403,18 +403,19 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.c
 -  saved_function_list = NULL;
 -}
 -#endif
-Index: gdb-7.2.50.20110117/gdb/f-lang.h
+Index: gdb-7.4.50.20120602/gdb/f-lang.h
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/f-lang.h      2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/f-lang.h   2011-01-17 15:54:14.000000000 +0100
-@@ -76,14 +76,9 @@ typedef struct saved_f77_common SAVED_F7
+--- gdb-7.4.50.20120602.orig/gdb/f-lang.h      2012-06-02 19:11:54.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/f-lang.h   2012-06-02 19:13:55.345317970 +0200
+@@ -76,15 +76,10 @@ typedef struct saved_f77_common SAVED_F7
  typedef struct common_entry COMMON_ENTRY, *COMMON_ENTRY_PTR;
  
  extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON  */
 -extern SAVED_F77_COMMON_PTR tail_common_list; /* Ptr to last saved COMMON  */
 -extern SAVED_F77_COMMON_PTR current_common;   /* Ptr to current COMMON */
  
- extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
+ extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+                                                     const char *);
  
 -#define UNINITIALIZED_SECNUM -1
 -#define COMMON_NEEDS_PATCHING(blk) ((blk)->secnum == UNINITIALIZED_SECNUM)
@@ -422,10 +423,10 @@ Index: gdb-7.2.50.20110117/gdb/f-lang.h
  #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM"        /* XLF assigned  */
  #define BLANK_COMMON_NAME_MF77     "__BLNK__" /* MF77 assigned  */
  #define BLANK_COMMON_NAME_LOCAL    "__BLANK"  /* Local GDB */
-Index: gdb-7.2.50.20110117/gdb/f-valprint.c
+Index: gdb-7.4.50.20120602/gdb/f-valprint.c
 ===================================================================
---- gdb-7.2.50.20110117.orig/gdb/f-valprint.c  2011-01-17 15:47:37.000000000 +0100
-+++ gdb-7.2.50.20110117/gdb/f-valprint.c       2011-01-17 15:54:36.000000000 +0100
+--- gdb-7.4.50.20120602.orig/gdb/f-valprint.c  2012-06-02 19:11:54.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/f-valprint.c       2012-06-02 19:14:11.625313432 +0200
 @@ -35,10 +35,6 @@
  #include "command.h"
  #include "block.h"
@@ -436,8 +437,8 @@ Index: gdb-7.2.50.20110117/gdb/f-valprint.c
 -
  extern void _initialize_f_valprint (void);
  static void info_common_command (char *, int);
- static void list_all_visible_commons (char *);
-@@ -604,67 +600,6 @@ info_common_command (char *comname, int 
+ static void list_all_visible_commons (const char *);
+@@ -535,67 +531,6 @@ info_common_command (char *comname, int
                     comname, funname);
  }
  
index 66d46b9762ab57f484549691d3f213c48f7645b7..e07213329cb4241c0d27a9c5cb8544413db6ca08 100644 (file)
@@ -1,8 +1,8 @@
-Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
+Index: gdb-7.4.91.20120801/gdb/dwarf2read.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c  2011-07-22 20:12:05.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/dwarf2read.c       2011-07-22 20:17:22.000000000 +0200
-@@ -7969,12 +7969,14 @@ read_set_type (struct die_info *die, str
+--- gdb-7.4.91.20120801.orig/gdb/dwarf2read.c  2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/dwarf2read.c       2012-08-01 18:38:54.201540500 +0200
+@@ -11073,12 +11073,14 @@ read_set_type (struct die_info *die, str
    return set_die_type (die, set_type, cu);
  }
  
@@ -19,7 +19,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
    struct attribute *attr;
    struct symbol *sym;
    CORE_ADDR base = (CORE_ADDR) 0;
-@@ -7999,20 +8001,67 @@ read_common_block (struct die_info *die,
+@@ -11103,20 +11105,67 @@ read_common_block (struct die_info *die,
      }
    if (die->child != NULL)
      {
@@ -87,7 +87,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
      }
  }
  
-@@ -11695,6 +11744,13 @@ new_symbol_full (struct die_info *die, s
+@@ -15155,6 +15204,13 @@ new_symbol_full (struct die_info *die, s
            {
              var_decode_location (attr, sym, cu);
              attr2 = dwarf2_attr (die, DW_AT_external, cu);
@@ -101,7 +101,7 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c
              if (SYMBOL_CLASS (sym) == LOC_STATIC
                  && SYMBOL_VALUE_ADDRESS (sym) == 0
                  && !dwarf2_per_objfile->has_section_at_zero)
-@@ -11867,6 +11923,11 @@ new_symbol_full (struct die_info *die, s
+@@ -15319,6 +15375,11 @@ new_symbol_full (struct die_info *die, s
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
          list_to_add = &global_symbols;
          break;
@@ -113,11 +113,11 @@ Index: gdb-7.3.50.20110722/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.3.50.20110722/gdb/f-lang.c
+Index: gdb-7.4.91.20120801/gdb/f-lang.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/f-lang.c      2011-07-22 20:17:16.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/f-lang.c   2011-07-22 20:17:22.000000000 +0200
-@@ -371,27 +371,3 @@ _initialize_f_language (void)
+--- gdb-7.4.91.20120801.orig/gdb/f-lang.c      2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-lang.c   2012-08-01 18:38:54.202540495 +0200
+@@ -370,27 +370,3 @@ _initialize_f_language (void)
  
    add_language (&f_language_defn);
  }
@@ -128,7 +128,7 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.c
 -   that belongs to function funcname.  */
 -
 -SAVED_F77_COMMON_PTR
--find_common_for_function (char *name, char *funcname)
+-find_common_for_function (const char *name, const char *funcname)
 -{
 -
 -  SAVED_F77_COMMON_PTR tmp;
@@ -145,11 +145,11 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.c
 -    }
 -  return (NULL);
 -}
-Index: gdb-7.3.50.20110722/gdb/f-lang.h
+Index: gdb-7.4.91.20120801/gdb/f-lang.h
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/f-lang.h      2011-07-22 20:17:16.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/f-lang.h   2011-07-22 20:17:22.000000000 +0200
-@@ -52,36 +52,8 @@ enum f90_range_type
+--- gdb-7.4.91.20120801.orig/gdb/f-lang.h      2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-lang.h   2012-08-01 18:38:54.203540489 +0200
+@@ -52,37 +52,8 @@ enum f90_range_type
      NONE_BOUND_DEFAULT                /* "(low:high)"  */
    };
  
@@ -178,7 +178,8 @@ Index: gdb-7.3.50.20110722/gdb/f-lang.h
 -
 -extern SAVED_F77_COMMON_PTR head_common_list; /* Ptr to 1st saved COMMON  */
 -
--extern SAVED_F77_COMMON_PTR find_common_for_function (char *, char *);
+-extern SAVED_F77_COMMON_PTR find_common_for_function (const char *,
+-                                                    const char *);
 -
  #define BLANK_COMMON_NAME_ORIGINAL "#BLNK_COM"        /* XLF assigned  */
  #define BLANK_COMMON_NAME_MF77     "__BLNK__" /* MF77 assigned  */
@@ -186,10 +187,10 @@ Index: gdb-7.3.50.20110722/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.3.50.20110722/gdb/f-valprint.c
+Index: gdb-7.4.91.20120801/gdb/f-valprint.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/f-valprint.c  2011-07-22 20:17:16.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/f-valprint.c       2011-07-22 20:18:26.000000000 +0200
+--- gdb-7.4.91.20120801.orig/gdb/f-valprint.c  2012-08-01 18:38:24.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/f-valprint.c       2012-08-01 18:41:26.411698186 +0200
 @@ -34,10 +34,11 @@
  #include "gdbcore.h"
  #include "command.h"
@@ -199,24 +200,23 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
  
  extern void _initialize_f_valprint (void);
  static void info_common_command (char *, int);
--static void list_all_visible_commons (char *);
+-static void list_all_visible_commons (const char *);
  static void f77_create_arrayprint_offset_tbl (struct type *,
                                              struct ui_file *);
  static void f77_get_dynamic_length_of_aggregate (struct type *);
-@@ -515,22 +516,54 @@ f_val_print (struct type *type, const gd
-   return 0;
+@@ -420,22 +421,53 @@ f_val_print (struct type *type, const gd
+   gdb_flush (stream);
  }
  
 -static void
--list_all_visible_commons (char *funname)
+-list_all_visible_commons (const char *funname)
 +static int
-+info_common_command_for_block (struct block *block, struct frame_info *frame,
-+                             const char *comname)
++info_common_command_for_block (struct block *block, const char *comname)
  {
 -  SAVED_F77_COMMON_PTR tmp;
 -
 -  tmp = head_common_list;
-+  struct dict_iterator iter;
++  struct block_iterator iter;
 +  struct symbol *sym;
 +  int values_printed = 0;
 +  const char *name;
@@ -257,35 +257,35 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
 +        }
  
 -  printf_filtered (_("All COMMON blocks visible at this level:\n\n"));
-+      putchar_filtered ('\n');
-+      }
+-
 -  while (tmp != NULL)
 -    {
 -      if (strcmp (tmp->owning_function, funname) == 0)
 -      printf_filtered ("%s\n", tmp->name);
--
++      putchar_filtered ('\n');
++      }
 -      tmp = tmp->next;
 -    }
 +  return values_printed;
  }
  
  /* This function is used to print out the values in a given COMMON 
-@@ -540,11 +573,9 @@ list_all_visible_commons (char *funname)
+@@ -445,11 +477,9 @@ list_all_visible_commons (const char *fu
  static void
  info_common_command (char *comname, int from_tty)
  {
 -  SAVED_F77_COMMON_PTR the_common;
 -  COMMON_ENTRY_PTR entry;
    struct frame_info *fi;
--  char *funname = 0;
+-  const char *funname = 0;
 -  struct symbol *func;
 +  struct block *block;
 +  int values_printed = 0;
  
    /* We have been told to display the contents of F77 COMMON 
       block supposedly visible in this function.  Let us 
-@@ -556,74 +587,31 @@ info_common_command (char *comname, int 
+@@ -461,87 +491,31 @@ info_common_command (char *comname, int
    /* The following is generally ripped off from stack.c's routine 
       print_frame_info().  */
  
@@ -339,7 +339,7 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
      {
 -      list_all_visible_commons (funname);
 -      return;
-+      if (info_common_command_for_block (block, fi, comname))
++      if (info_common_command_for_block (block, comname))
 +      values_printed = 1;
 +      /* After handling the function's top-level block, stop.  Don't
 +         continue to its superblock, the block of per-file symbols.  */
@@ -353,6 +353,8 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
 -  if (the_common)
 +  if (!values_printed)
      {
+-      struct frame_id frame_id = get_frame_id (fi);
+-
 -      if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0)
 -      printf_filtered (_("Contents of blank COMMON block:\n"));
 +      if (comname)
@@ -365,7 +367,18 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
 -
 -      while (entry != NULL)
 -      {
+-        fi = frame_find_by_id (frame_id);
+-        if (fi == NULL)
+-          {
+-            warning (_("Unable to restore previously selected frame."));
+-            break;
+-          }
+-
 -        print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0);
+-
+-        /* print_variable_and_value invalidates FI.  */
+-        fi = NULL;
+-
 -        entry = entry->next;
 -      }
 +      printf_filtered (_("No common blocks.\n"));
@@ -376,11 +389,11 @@ Index: gdb-7.3.50.20110722/gdb/f-valprint.c
  }
  
  void
-Index: gdb-7.3.50.20110722/gdb/stack.c
+Index: gdb-7.4.91.20120801/gdb/stack.c
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/stack.c       2011-07-22 20:12:05.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/stack.c    2011-07-22 20:17:22.000000000 +0200
-@@ -1524,6 +1524,8 @@ iterate_over_block_locals (struct block 
+--- gdb-7.4.91.20120801.orig/gdb/stack.c       2012-08-01 18:36:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/stack.c    2012-08-01 18:38:54.206540471 +0200
+@@ -1851,6 +1851,8 @@ iterate_over_block_locals (struct block
        case LOC_COMPUTED:
          if (SYMBOL_IS_ARGUMENT (sym))
            break;
@@ -389,11 +402,11 @@ Index: gdb-7.3.50.20110722/gdb/stack.c
          (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data);
          break;
  
-Index: gdb-7.3.50.20110722/gdb/symtab.h
+Index: gdb-7.4.91.20120801/gdb/symtab.h
 ===================================================================
---- gdb-7.3.50.20110722.orig/gdb/symtab.h      2011-07-22 20:12:05.000000000 +0200
-+++ gdb-7.3.50.20110722/gdb/symtab.h   2011-07-22 20:18:58.000000000 +0200
-@@ -396,7 +396,10 @@ typedef enum domain_enum_tag
+--- gdb-7.4.91.20120801.orig/gdb/symtab.h      2012-06-30 00:46:46.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/symtab.h   2012-08-01 18:38:54.206540471 +0200
+@@ -394,7 +394,10 @@ typedef enum domain_enum_tag
  
    /* LABEL_DOMAIN may be used for names of labels (for gotos).  */
  
@@ -405,10 +418,10 @@ Index: gdb-7.3.50.20110722/gdb/symtab.h
  } domain_enum;
  
  /* Searching domains, used for `search_symbols'.  Element numbers are
-Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.exp
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.exp     2011-07-22 20:17:22.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp     2012-08-01 18:38:54.207540465 +0200
 @@ -0,0 +1,101 @@
 +# Copyright 2008 Free Software Foundation, Inc.
 +
@@ -511,10 +524,10 @@ Index: gdb-7.3.50.20110722/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.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.f90
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.fortran/common-block.f90     2011-07-22 20:17:22.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90     2012-08-01 18:38:54.207540465 +0200
 @@ -0,0 +1,67 @@
 +! Copyright 2008 Free Software Foundation, Inc.
 +!
diff --git a/gdb-gdbindex-ada-regression.patch b/gdb-gdbindex-ada-regression.patch
deleted file mode 100644 (file)
index 9d67d58..0000000
+++ /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  <jan.kratochvil@redhat.com>
-
-       * 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 (file)
index edd4f4f..0000000
+++ /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  <tromey@redhat.com>
-+
-+      * dwarf2read.c (dw2_expand_symtabs_matching): Add missing
-+      MAYBE_SWAPs.
-+      (dw2_map_symbol_names): Likewise.
-+
- 2010-09-24  Sami Wagiaalla  <swagiaal@redhat.com>
-       * 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-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch
new file mode 100644 (file)
index 0000000..308b359
--- /dev/null
@@ -0,0 +1,137 @@
+diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
+index 53100c5..e7586ac 100644
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -13306,6 +13306,25 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
+       /* Cache this symbol's name and the name's demangled form (if any).  */
+       SYMBOL_SET_LANGUAGE (sym, cu->language);
+       linkagename = dwarf2_physname (name, die, cu);
++
++      /* Workaround for:
++       * invalid IFUNC DW_AT_linkage_name: memmove strstr time
++       * http://sourceware.org/bugzilla/show_bug.cgi?id=14166  */
++      if (strcmp (linkagename, "strstr") == 0
++        && strstr (objfile->name, "/libc") != NULL)
++      {
++        struct objfile *objfile_msym;
++        struct minimal_symbol *msym;
++
++        if (objfile->separate_debug_objfile_backlink)
++          objfile_msym = objfile->separate_debug_objfile_backlink;
++        else
++          objfile_msym = objfile;
++        msym = lookup_minimal_symbol ("strstr", NULL, objfile_msym);
++        if (msym && MSYMBOL_TYPE (msym) == mst_text_gnu_ifunc)
++          linkagename = "__strstr";
++      }
++
+       SYMBOL_SET_NAMES (sym, linkagename, strlen (linkagename), 0, objfile);
+       /* Fortran does not have mangling standard and the mangling does differ
+diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+new file mode 100644
+index 0000000..575071f
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp
+@@ -0,0 +1,101 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# Workaround for:
++# invalid IFUNC DW_AT_linkage_name: memmove strstr time
++# http://sourceware.org/bugzilla/show_bug.cgi?id=14166
++
++if {[skip_shlib_tests]} {
++    return 0
++}
++
++set testfile "gnu-ifunc-strstr-workaround"
++set executable ${testfile}
++set srcfile start.c
++set binfile ${objdir}/${subdir}/${executable}
++
++if [prepare_for_testing ${testfile}.exp $executable $srcfile] {
++    return -1
++}
++
++if ![runto_main] {
++    return 0
++}
++
++set test "ptype atoi"
++gdb_test_multiple $test $test {
++    -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" {
++      pass $test
++    }
++    -re "type = int \\(\\)\r\n$gdb_prompt $" {
++      untested "$test (no DWARF)"
++      return 0
++    }
++}
++
++set addr ""
++set test "print strstr"
++gdb_test_multiple $test $test {
++    -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <strstr>\r\n$gdb_prompt $" {
++      set addr $expect_out(1,string)
++      pass $test
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" {
++      set addr $expect_out(1,string)
++      pass "$test (GDB workaround or future fixed glibc)"
++    }
++    -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++      untested "$test (gnu-ifunc not in use by glibc)"
++      return 0
++    }
++}
++
++set test "info sym"
++gdb_test_multiple "info sym $addr" $test {
++    -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" {
++      pass $test
++    }
++    -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++      # unexpected
++      xfail "$test (not in libc.so.6)"
++      return 0
++    }
++}
++
++set test "info addr strstr"
++gdb_test_multiple $test $test {
++    -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" {
++      fail "$test (DWARF for strstr)"
++    }
++    -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" {
++      pass "$test"
++    }
++}
++
++set test "print strstr second time"
++gdb_test_multiple "print strstr" $test {
++    -re " = {<text gnu-indirect-function variable, no debug info>} $addr <strstr>\r\n$gdb_prompt $" {
++      pass $test
++    }
++    -re " = {<text gnu-indirect-function variable, no debug info>} $addr <__strstr>\r\n$gdb_prompt $" {
++      pass "$test (GDB workaround or future fixed glibc)"
++    }
++    -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ <strstr>\r\n$gdb_prompt $" {
++      fail $test
++    }
++}
++
++gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"}
++gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"}
diff --git a/gdb-minidebuginfo.patch b/gdb-minidebuginfo.patch
new file mode 100644 (file)
index 0000000..d6e6f7e
--- /dev/null
@@ -0,0 +1,1056 @@
+http://fedoraproject.org/wiki/Features/MiniDebugInfo
+https://bugzilla.redhat.com/show_bug.cgi?id=834068
+
+Patch by Alexander Larsson.
+Review/modifications and testfile by Jan Kratochvil.
+
+Index: gdb-7.4.91.20120801/gdb/Makefile.in
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/Makefile.in   2012-08-01 18:44:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/Makefile.in        2012-08-01 18:47:05.701820594 +0200
+@@ -151,6 +151,9 @@ READLINE_CFLAGS = @READLINE_CFLAGS@
+ # Where is expat?  This will be empty if expat was not available.
+ LIBEXPAT = @LIBEXPAT@
++# Where is lzma?  This will be empty if lzma was not available.
++LIBLZMA = @LIBLZMA@
++
+ WARN_CFLAGS = @WARN_CFLAGS@
+ WERROR_CFLAGS = @WERROR_CFLAGS@
+ GDB_WARN_CFLAGS = $(WARN_CFLAGS)
+@@ -467,7 +470,7 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CF
+ # LIBIBERTY appears twice on purpose.
+ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
+       $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \
+-      $(LIBEXPAT) \
++      $(LIBEXPAT) $(LIBLZMA) \
+       $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU)
+ CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \
+       $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU)
+Index: gdb-7.4.91.20120801/gdb/config.in
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/config.in     2012-08-01 18:45:21.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/config.in  2012-08-01 18:47:05.701820594 +0200
+@@ -198,6 +198,9 @@
+ /* Define to 1 if you have the `libiconvlist' function. */
+ #undef HAVE_LIBICONVLIST
++/* Define if you have the lzma library. */
++#undef HAVE_LIBLZMA
++
+ /* Define to 1 if you have the `m' library (-lm). */
+ #undef HAVE_LIBM
+Index: gdb-7.4.91.20120801/gdb/configure
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/configure     2012-08-01 18:45:21.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/configure  2012-08-01 18:47:05.703820583 +0200
+@@ -641,6 +641,9 @@ TCL_VERSION
+ WIN32LDAPP
+ GUI_CFLAGS_X
+ LIBGUI
++LTLIBLZMA
++LIBLZMA
++HAVE_LIBLZMA
+ WIN32LIBS
+ SER_HARDWIRE
+ WERROR_CFLAGS
+@@ -813,6 +816,8 @@ with_system_gdbinit
+ enable_werror
+ enable_build_warnings
+ enable_gdb_build_warnings
++with_lzma
++with_liblzma_prefix
+ with_tcl
+ with_tk
+ with_x
+@@ -1532,6 +1537,9 @@ Optional Packages:
+   --with-sysroot[=DIR]    search for usr/lib et al within DIR
+   --with-system-gdbinit=PATH
+                           automatically load a system-wide gdbinit file
++  --with-lzma             support lzma compression (auto/yes/no)
++  --with-liblzma-prefix[=DIR]  search for liblzma in DIR/include and DIR/lib
++  --without-liblzma-prefix     don't search for liblzma in includedir and libdir
+   --with-tcl              directory containing tcl configuration (tclConfig.sh)
+   --with-tk               directory containing tk configuration (tkConfig.sh)
+   --with-x                use the X Window System
+@@ -13151,6 +13159,494 @@ LIBS=$OLD_LIBS
+ # Add any host-specific objects to GDB.
+ CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
++# If building on ELF, look for lzma support for embedded compressed debug info.
++if test $gdb_cv_var_elf = yes; then
++
++# Check whether --with-lzma was given.
++if test "${with_lzma+set}" = set; then :
++  withval=$with_lzma;
++else
++  with_lzma=auto
++fi
++
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use lzma" >&5
++$as_echo_n "checking whether to use lzma... " >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lzma" >&5
++$as_echo "$with_lzma" >&6; }
++
++  if test "${with_lzma}" != no; then
++
++
++
++
++
++
++
++
++    use_additional=yes
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++
++    eval additional_includedir=\"$includedir\"
++    eval additional_libdir=\"$libdir\"
++
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++
++# Check whether --with-liblzma-prefix was given.
++if test "${with_liblzma_prefix+set}" = set; then :
++  withval=$with_liblzma_prefix;
++    if test "X$withval" = "Xno"; then
++      use_additional=no
++    else
++      if test "X$withval" = "X"; then
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++
++          eval additional_includedir=\"$includedir\"
++          eval additional_libdir=\"$libdir\"
++
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++      else
++        additional_includedir="$withval/include"
++        additional_libdir="$withval/lib"
++      fi
++    fi
++
++fi
++
++      LIBLZMA=
++  LTLIBLZMA=
++  INCLZMA=
++  rpathdirs=
++  ltrpathdirs=
++  names_already_handled=
++  names_next_round='lzma '
++  while test -n "$names_next_round"; do
++    names_this_round="$names_next_round"
++    names_next_round=
++    for name in $names_this_round; do
++      already_handled=
++      for n in $names_already_handled; do
++        if test "$n" = "$name"; then
++          already_handled=yes
++          break
++        fi
++      done
++      if test -z "$already_handled"; then
++        names_already_handled="$names_already_handled $name"
++                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
++        eval value=\"\$HAVE_LIB$uppername\"
++        if test -n "$value"; then
++          if test "$value" = yes; then
++            eval value=\"\$LIB$uppername\"
++            test -z "$value" || LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$value"
++            eval value=\"\$LTLIB$uppername\"
++            test -z "$value" || LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$value"
++          else
++                                    :
++          fi
++        else
++                              found_dir=
++          found_la=
++          found_so=
++          found_a=
++          if test $use_additional = yes; then
++            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
++              found_dir="$additional_libdir"
++              found_so="$additional_libdir/lib$name.$shlibext"
++              if test -f "$additional_libdir/lib$name.la"; then
++                found_la="$additional_libdir/lib$name.la"
++              fi
++            else
++              if test -f "$additional_libdir/lib$name.$libext"; then
++                found_dir="$additional_libdir"
++                found_a="$additional_libdir/lib$name.$libext"
++                if test -f "$additional_libdir/lib$name.la"; then
++                  found_la="$additional_libdir/lib$name.la"
++                fi
++              fi
++            fi
++          fi
++          if test "X$found_dir" = "X"; then
++            for x in $LDFLAGS $LTLIBLZMA; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++              case "$x" in
++                -L*)
++                  dir=`echo "X$x" | sed -e 's/^X-L//'`
++                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
++                    found_dir="$dir"
++                    found_so="$dir/lib$name.$shlibext"
++                    if test -f "$dir/lib$name.la"; then
++                      found_la="$dir/lib$name.la"
++                    fi
++                  else
++                    if test -f "$dir/lib$name.$libext"; then
++                      found_dir="$dir"
++                      found_a="$dir/lib$name.$libext"
++                      if test -f "$dir/lib$name.la"; then
++                        found_la="$dir/lib$name.la"
++                      fi
++                    fi
++                  fi
++                  ;;
++              esac
++              if test "X$found_dir" != "X"; then
++                break
++              fi
++            done
++          fi
++          if test "X$found_dir" != "X"; then
++                        LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$found_dir -l$name"
++            if test "X$found_so" != "X"; then
++                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
++                                LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so"
++              else
++                                                                                haveit=
++                for x in $ltrpathdirs; do
++                  if test "X$x" = "X$found_dir"; then
++                    haveit=yes
++                    break
++                  fi
++                done
++                if test -z "$haveit"; then
++                  ltrpathdirs="$ltrpathdirs $found_dir"
++                fi
++                                if test "$hardcode_direct" = yes; then
++                                                      LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so"
++                else
++                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
++                                                            LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so"
++                                                            haveit=
++                    for x in $rpathdirs; do
++                      if test "X$x" = "X$found_dir"; then
++                        haveit=yes
++                        break
++                      fi
++                    done
++                    if test -z "$haveit"; then
++                      rpathdirs="$rpathdirs $found_dir"
++                    fi
++                  else
++                                                                                haveit=
++                    for x in $LDFLAGS $LIBLZMA; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++                      if test "X$x" = "X-L$found_dir"; then
++                        haveit=yes
++                        break
++                      fi
++                    done
++                    if test -z "$haveit"; then
++                      LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir"
++                    fi
++                    if test "$hardcode_minus_L" != no; then
++                                                                                        LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so"
++                    else
++                                                                                                                                                                                LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name"
++                    fi
++                  fi
++                fi
++              fi
++            else
++              if test "X$found_a" != "X"; then
++                                LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_a"
++              else
++                                                LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir -l$name"
++              fi
++            fi
++                        additional_includedir=
++            case "$found_dir" in
++              */lib | */lib/)
++                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
++                additional_includedir="$basedir/include"
++                ;;
++            esac
++            if test "X$additional_includedir" != "X"; then
++                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
++                haveit=
++                if test "X$additional_includedir" = "X/usr/local/include"; then
++                  if test -n "$GCC"; then
++                    case $host_os in
++                      linux*) haveit=yes;;
++                    esac
++                  fi
++                fi
++                if test -z "$haveit"; then
++                  for x in $CPPFLAGS $INCLZMA; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++                    if test "X$x" = "X-I$additional_includedir"; then
++                      haveit=yes
++                      break
++                    fi
++                  done
++                  if test -z "$haveit"; then
++                    if test -d "$additional_includedir"; then
++                                            INCLZMA="${INCLZMA}${INCLZMA:+ }-I$additional_includedir"
++                    fi
++                  fi
++                fi
++              fi
++            fi
++                        if test -n "$found_la"; then
++                                                        save_libdir="$libdir"
++              case "$found_la" in
++                */* | *\\*) . "$found_la" ;;
++                *) . "./$found_la" ;;
++              esac
++              libdir="$save_libdir"
++                            for dep in $dependency_libs; do
++                case "$dep" in
++                  -L*)
++                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
++                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
++                      haveit=
++                      if test "X$additional_libdir" = "X/usr/local/lib"; then
++                        if test -n "$GCC"; then
++                          case $host_os in
++                            linux*) haveit=yes;;
++                          esac
++                        fi
++                      fi
++                      if test -z "$haveit"; then
++                        haveit=
++                        for x in $LDFLAGS $LIBLZMA; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++                          if test "X$x" = "X-L$additional_libdir"; then
++                            haveit=yes
++                            break
++                          fi
++                        done
++                        if test -z "$haveit"; then
++                          if test -d "$additional_libdir"; then
++                                                        LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$additional_libdir"
++                          fi
++                        fi
++                        haveit=
++                        for x in $LDFLAGS $LTLIBLZMA; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++                          if test "X$x" = "X-L$additional_libdir"; then
++                            haveit=yes
++                            break
++                          fi
++                        done
++                        if test -z "$haveit"; then
++                          if test -d "$additional_libdir"; then
++                                                        LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$additional_libdir"
++                          fi
++                        fi
++                      fi
++                    fi
++                    ;;
++                  -R*)
++                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
++                    if test "$enable_rpath" != no; then
++                                                                  haveit=
++                      for x in $rpathdirs; do
++                        if test "X$x" = "X$dir"; then
++                          haveit=yes
++                          break
++                        fi
++                      done
++                      if test -z "$haveit"; then
++                        rpathdirs="$rpathdirs $dir"
++                      fi
++                                                                  haveit=
++                      for x in $ltrpathdirs; do
++                        if test "X$x" = "X$dir"; then
++                          haveit=yes
++                          break
++                        fi
++                      done
++                      if test -z "$haveit"; then
++                        ltrpathdirs="$ltrpathdirs $dir"
++                      fi
++                    fi
++                    ;;
++                  -l*)
++                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
++                    ;;
++                  *.la)
++                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
++                    ;;
++                  *)
++                                        LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$dep"
++                    LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$dep"
++                    ;;
++                esac
++              done
++            fi
++          else
++                                                            LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name"
++            LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-l$name"
++          fi
++        fi
++      fi
++    done
++  done
++  if test "X$rpathdirs" != "X"; then
++    if test -n "$hardcode_libdir_separator"; then
++                        alldirs=
++      for found_dir in $rpathdirs; do
++        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
++      done
++            acl_save_libdir="$libdir"
++      libdir="$alldirs"
++      eval flag=\"$hardcode_libdir_flag_spec\"
++      libdir="$acl_save_libdir"
++      LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag"
++    else
++            for found_dir in $rpathdirs; do
++        acl_save_libdir="$libdir"
++        libdir="$found_dir"
++        eval flag=\"$hardcode_libdir_flag_spec\"
++        libdir="$acl_save_libdir"
++        LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag"
++      done
++    fi
++  fi
++  if test "X$ltrpathdirs" != "X"; then
++            for found_dir in $ltrpathdirs; do
++      LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-R$found_dir"
++    done
++  fi
++
++
++        ac_save_CPPFLAGS="$CPPFLAGS"
++
++  for element in $INCLZMA; do
++    haveit=
++    for x in $CPPFLAGS; do
++
++  acl_save_prefix="$prefix"
++  prefix="$acl_final_prefix"
++  acl_save_exec_prefix="$exec_prefix"
++  exec_prefix="$acl_final_exec_prefix"
++  eval x=\"$x\"
++  exec_prefix="$acl_save_exec_prefix"
++  prefix="$acl_save_prefix"
++
++      if test "X$x" = "X$element"; then
++        haveit=yes
++        break
++      fi
++    done
++    if test -z "$haveit"; then
++      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
++    fi
++  done
++
++
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5
++$as_echo_n "checking for liblzma... " >&6; }
++if test "${ac_cv_liblzma+set}" = set; then :
++  $as_echo_n "(cached) " >&6
++else
++
++    ac_save_LIBS="$LIBS"
++    LIBS="$LIBS $LIBLZMA"
++    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include "lzma.h"
++int
++main ()
++{
++lzma_index_iter iter;
++                         lzma_index_iter_init (&iter, 0);
++                         lzma_mf_is_supported (LZMA_MF_HC3);
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_liblzma=yes
++else
++  ac_cv_liblzma=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++    LIBS="$ac_save_LIBS"
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_liblzma" >&5
++$as_echo "$ac_cv_liblzma" >&6; }
++  if test "$ac_cv_liblzma" = yes; then
++    HAVE_LIBLZMA=yes
++
++$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h
++
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with liblzma" >&5
++$as_echo_n "checking how to link with liblzma... " >&6; }
++    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBLZMA" >&5
++$as_echo "$LIBLZMA" >&6; }
++  else
++    HAVE_LIBLZMA=no
++            CPPFLAGS="$ac_save_CPPFLAGS"
++    LIBLZMA=
++    LTLIBLZMA=
++  fi
++
++
++
++
++
++
++    if test "$HAVE_LIBLZMA" != yes; then
++      if test "$with_lzma" = yes; then
++        as_fn_error "missing liblzma for --with-lzma" "$LINENO" 5
++      fi
++    fi
++  fi
++fi
++
+ LIBGUI="../libgui/src/libgui.a"
+ GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
+Index: gdb-7.4.91.20120801/gdb/configure.ac
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/configure.ac  2012-08-01 18:45:21.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/configure.ac       2012-08-01 18:47:05.704820577 +0200
+@@ -2196,6 +2196,27 @@ LIBS=$OLD_LIBS
+ # Add any host-specific objects to GDB.
+ CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
++# If building on ELF, look for lzma support for embedded compressed debug info.
++if test $gdb_cv_var_elf = yes; then
++  AC_ARG_WITH(lzma,
++    AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
++    [], [with_lzma=auto])
++  AC_MSG_CHECKING([whether to use lzma])
++  AC_MSG_RESULT([$with_lzma])
++
++  if test "${with_lzma}" != no; then
++    AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"],
++                        [lzma_index_iter iter;
++                         lzma_index_iter_init (&iter, 0);
++                         lzma_mf_is_supported (LZMA_MF_HC3);])
++    if test "$HAVE_LIBLZMA" != yes; then
++      if test "$with_lzma" = yes; then
++        AC_MSG_ERROR([missing liblzma for --with-lzma])
++      fi
++    fi
++  fi
++fi
++
+ LIBGUI="../libgui/src/libgui.a"
+ GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
+ AC_SUBST(LIBGUI)
+Index: gdb-7.4.91.20120801/gdb/elfread.c
+===================================================================
+--- gdb-7.4.91.20120801.orig/gdb/elfread.c     2012-08-01 18:44:51.000000000 +0200
++++ gdb-7.4.91.20120801/gdb/elfread.c  2012-08-01 18:57:59.528202398 +0200
+@@ -51,6 +51,10 @@
+ #include "observer.h"
+ #include "elf/external.h"
+ #include <sys/stat.h>
++#include "gdbcore.h"
++#ifdef HAVE_LIBLZMA
++# include <lzma.h>
++#endif
+ extern void _initialize_elfread (void);
+@@ -2210,6 +2214,262 @@ find_separate_debug_file_by_buildid (str
+   return NULL;
+ }
++#ifdef HAVE_LIBLZMA
++
++/* Custom lzma_allocator.alloc so they use the gdb ones.  */
++
++static void *
++alloc_lzma (void *opaque, size_t nmemb, size_t size)
++{
++  return xmalloc (nmemb * size);
++}
++
++/* Custom lzma_allocator.free so they use the gdb ones.  */
++
++static void
++free_lzma (void *opaque, void *ptr)
++{
++  xfree (ptr);
++}
++
++/* It cannot be const due to the lzma library function prototypes.  */
++
++static lzma_allocator gdb_lzma_allocator = { alloc_lzma, free_lzma, NULL};
++
++/* Custom bfd_openr_iovec implementation to read compressed data from a
++   section. This keeps only the last decompressed block in memory to
++   allow larger data without using to much memory.  */
++
++struct lzma_stream
++{
++  /* Section of input BFD we are decoding data from.  */
++  asection *section;
++
++  /* lzma library decompression state.  */
++  lzma_index *index;
++
++  /* Currently decoded block.  */
++  bfd_size_type data_start;
++  bfd_size_type data_end;
++  gdb_byte *data;
++};
++
++/* bfd_openr_iovec OPEN_P implementation for
++   find_separate_debug_file_in_section.  OPEN_CLOSURE is 'asection *' of the
++   section to decompress.
++
++   Return 'struct lzma_stream *' must be freed by caller by xfree, together
++   with its INDEX lzma data.  */
++
++static void *
++lzma_open (struct bfd *nbfd, void *open_closure)
++{
++  asection *section = open_closure;
++  bfd_size_type size, offset;
++  lzma_stream_flags options;
++  gdb_byte footer[LZMA_STREAM_HEADER_SIZE];
++  gdb_byte *indexdata;
++  lzma_index *index;
++  int ret;
++  uint64_t memlimit = UINT64_MAX;
++  struct lzma_stream *lstream;
++  size_t pos;
++
++  size = bfd_get_section_size (section);
++  offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE;
++  if (size < LZMA_STREAM_HEADER_SIZE
++      || bfd_seek (section->owner, offset, SEEK_SET) != 0
++      || bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner)
++         != LZMA_STREAM_HEADER_SIZE
++      || lzma_stream_footer_decode (&options, footer) != LZMA_OK
++      || offset < options.backward_size)
++    {
++      bfd_set_error (bfd_error_wrong_format);
++      return NULL;
++    }
++
++  offset -= options.backward_size;
++  indexdata = xmalloc (options.backward_size);
++  index = NULL;
++  pos = 0;
++  if (bfd_seek (section->owner, offset, SEEK_SET) != 0
++      || bfd_bread (indexdata, options.backward_size, section->owner)
++         != options.backward_size
++      || lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator,
++                                 indexdata, &pos, options.backward_size)
++         != LZMA_OK
++      || lzma_index_size (index) != options.backward_size)
++    {
++      xfree (indexdata);
++      bfd_set_error (bfd_error_wrong_format);
++      return NULL;
++    }
++  xfree (indexdata);
++
++  lstream = xzalloc (sizeof (struct lzma_stream));
++  lstream->section = section;
++  lstream->index = index;
++
++  return lstream;
++}
++
++/* bfd_openr_iovec PREAD_P implementation for
++   find_separate_debug_file_in_section.  Passed STREAM
++   is 'struct lzma_stream *'.  */
++
++static file_ptr
++lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
++          file_ptr offset)
++{
++  struct lzma_stream *lstream = stream;
++  bfd_size_type chunk_size;
++  lzma_index_iter iter;
++  gdb_byte *compressed, *uncompressed;
++  file_ptr block_offset;
++  lzma_filter filters[LZMA_FILTERS_MAX + 1];
++  lzma_block block;
++  size_t compressed_pos, uncompressed_pos;
++  file_ptr res;
++
++  res = 0;
++  while (nbytes > 0)
++    {
++      if (lstream->data == NULL
++        || lstream->data_start > offset || offset >= lstream->data_end)
++      {
++        asection *section = lstream->section;
++
++        lzma_index_iter_init (&iter, lstream->index);
++        if (lzma_index_iter_locate (&iter, offset))
++          break;
++
++        compressed = xmalloc (iter.block.total_size);
++        block_offset = section->filepos + iter.block.compressed_file_offset;
++        if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0
++            || bfd_bread (compressed, iter.block.total_size, section->owner)
++               != iter.block.total_size)
++          {
++            xfree (compressed);
++            break;
++          }
++
++        uncompressed = xmalloc (iter.block.uncompressed_size);
++
++        memset (&block, 0, sizeof (block));
++        block.filters = filters;
++        block.header_size = lzma_block_header_size_decode (compressed[0]);
++        if (lzma_block_header_decode (&block, &gdb_lzma_allocator, compressed)
++            != LZMA_OK)
++          {
++            xfree (compressed);
++            xfree (uncompressed);
++            break;
++          }
++
++        compressed_pos = block.header_size;
++        uncompressed_pos = 0;
++        if (lzma_block_buffer_decode (&block, &gdb_lzma_allocator,
++                                      compressed, &compressed_pos,
++                                      iter.block.total_size,
++                                      uncompressed, &uncompressed_pos,
++                                      iter.block.uncompressed_size)
++            != LZMA_OK)
++          {
++            xfree (compressed);
++            xfree (uncompressed);
++            break;
++          }
++
++        xfree (compressed);
++
++        xfree (lstream->data);
++        lstream->data = uncompressed;
++        lstream->data_start = iter.block.uncompressed_file_offset;
++        lstream->data_end = (iter.block.uncompressed_file_offset
++                             + iter.block.uncompressed_size);
++      }
++
++      chunk_size = min (nbytes, lstream->data_end - offset);
++      memcpy (buf, lstream->data + offset - lstream->data_start, chunk_size);
++      buf = (gdb_byte *) buf + chunk_size;
++      offset += chunk_size;
++      nbytes -= chunk_size;
++      res += chunk_size;
++    }
++
++  return res;
++}
++
++/* bfd_openr_iovec CLOSE_P implementation for
++   find_separate_debug_file_in_section.  Passed STREAM
++   is 'struct lzma_stream *'.  */
++
++static int
++lzma_close (struct bfd *nbfd,
++          void *stream)
++{
++  struct lzma_stream *lstream = stream;
++
++  lzma_index_end (lstream->index, &gdb_lzma_allocator);
++  xfree (lstream->data);
++  xfree (lstream);
++  return 0;
++}
++
++/* bfd_openr_iovec STAT_P implementation for
++   find_separate_debug_file_in_section.  Passed STREAM
++   is 'struct lzma_stream *'.  */
++
++static int
++lzma_stat (struct bfd *abfd,
++         void *stream,
++         struct stat *sb)
++{
++  struct lzma_stream *lstream = stream;
++
++  sb->st_size = lzma_index_uncompressed_size (lstream->index);
++  return 0;
++}
++
++/* This looks for a xz compressed separate debug info object file embedded
++   in a section called .gnu_debugdata. If we find one we create a iovec
++   based bfd that decompresses the object data on demand.  */
++
++static bfd *
++find_separate_debug_file_in_section (struct objfile *objfile)
++{
++  asection *section;
++  bfd *abfd;
++
++  section = bfd_get_section_by_name (objfile->obfd, ".gnu_debugdata");
++  if (section == NULL)
++    return NULL;
++
++  /* objfile->NAME lifetime is longer than the ABFD's lifetime.  */
++  abfd = gdb_bfd_openr_iovec (objfile->name, gnutarget, lzma_open, section,
++                            lzma_pread, lzma_close, lzma_stat);
++  if (abfd == NULL)
++    return NULL;
++
++  if (!bfd_check_format (abfd, bfd_object))
++    {
++      gdb_bfd_unref (abfd);
++      return NULL;
++    }
++
++  return abfd;
++}
++
++#else /* !HAVE_LIBLZMA */
++
++static bfd *
++find_separate_debug_file_in_section (struct objfile *objfile)
++{
++  return NULL;
++}
++
++#endif /* !HAVE_LIBLZMA */
++
+ /* Scan and build partial symbols for a symbol file.
+    We have been initialized by a call to elf_symfile_init, which
+    currently does nothing.
+@@ -2433,6 +2693,8 @@ elf_symfile_read (struct objfile *objfil
+   else if (!objfile_has_partial_symbols (objfile))
+     {
+       char *debugfile, *build_id_filename;
++      bfd *abfd = NULL;
++      struct cleanup *cleanup;
+       debugfile = find_separate_debug_file_by_buildid (objfile,
+                                                      &build_id_filename);
+@@ -2440,14 +2702,11 @@ elf_symfile_read (struct objfile *objfil
+       if (debugfile == NULL)
+       debugfile = find_separate_debug_file_by_debuglink (objfile);
++      cleanup = make_cleanup (xfree, debugfile);
+       if (debugfile)
+       {
+-        struct cleanup *cleanup = make_cleanup (xfree, debugfile);
+-        bfd *abfd = symfile_bfd_open (debugfile);
+-
++        abfd = symfile_bfd_open (debugfile);
+         make_cleanup_bfd_unref (abfd);
+-        symbol_file_add_separate (abfd, symfile_flags, objfile);
+-        do_cleanups (cleanup);
+       }
+       /* Check if any separate debug info has been extracted out.  */
+       else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink")
+@@ -2455,6 +2714,17 @@ elf_symfile_read (struct objfile *objfil
+       debug_print_missing (objfile->name, build_id_filename);
+       xfree (build_id_filename);
++
++      if (abfd == NULL)
++      {
++        abfd = find_separate_debug_file_in_section (objfile);
++        make_cleanup_bfd_unref (abfd);
++      }
++
++      if (abfd != NULL)
++      symbol_file_add_separate (abfd, symfile_flags, objfile);
++
++      do_cleanups (cleanup);
+     }
+   if (symtab_create_debug)
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c   2012-08-01 18:47:05.705820572 +0200
+@@ -0,0 +1,30 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++#include <signal.h>
++
++static int
++debugdata_function (void)
++{
++  return raise (SIGSEGV) + 1;
++}
++
++int
++main (void)
++{
++  return debugdata_function () + 1;
++}
+Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp 2012-08-01 18:47:05.705820572 +0200
+@@ -0,0 +1,91 @@
++# Copyright 2012 Free Software Foundation, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++standard_testfile
++
++load_lib dwarf.exp
++if ![dwarf2_support] {
++    return 0
++}
++
++if [build_executable ${testfile}.exp $testfile] {
++    return -1
++}
++
++proc run { test cmdline } {
++    verbose "cmdline is $cmdline"
++    set result [catch "exec $cmdline" output]
++    verbose "result is $result"
++    verbose "output is $output"
++    if {$result == 0} {
++      pass $test
++      return 0
++    } else {
++      fail $test
++      return -1
++    }
++}
++
++set strip_program [transform strip]
++set nm_program [transform nm]
++
++# Extract the dynamic symbols from the main binary, there is no need to also have these
++# in the normal symbol table
++file delete -- ${binfile}.dynsyms
++if [run "nm -D" "[transform nm] -D ${binfile} --format=posix --defined-only | awk \\{print\\ \\\$1\\} | sort > ${binfile}.dynsyms"] {
++    return -1
++}
++
++# Extract all the text (i.e. function) symbols from the debuginfo
++file delete -- ${binfile}.funcsyms
++if [run "nm" "[transform nm] ${binfile} --format=posix --defined-only | awk \\{if(\\\$2==\"T\"||\\\$2==\"t\")print\\ \\\$1\\} | sort > ${binfile}.funcsyms"] {
++    return -1
++}
++
++# Keep all the function symbols not already in the dynamic symbol table
++file delete -- ${binfile}.keep_symbols
++if [run "comm" "comm -13 ${binfile}.dynsyms ${binfile}.funcsyms > ${binfile}.keep_symbols"] {
++    return -1
++}
++
++# Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
++file delete -- ${binfile}.mini_debuginfo
++if [run "objcopy 1" "[transform objcopy] -S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile} ${binfile}.mini_debuginfo"] {
++    return -1
++}
++
++# GDB specific - we do not have split executable in advance.
++file delete -- ${binfile}.strip
++if [run "strip" "[transform strip] --strip-all -o ${binfile}.strip ${binfile}"] {
++    return -1
++}
++
++# Inject the compressed data into the .gnu_debugdata section of the original binary
++file delete -- ${binfile}.mini_debuginfo.xz
++if [run "xz" "xz ${binfile}.mini_debuginfo"] {
++    return -1
++}
++file delete -- ${binfile}.test
++if [run "objcopy 2" "[transform objcopy] --add-section .gnu_debugdata=${binfile}.mini_debuginfo.xz ${binfile}.strip ${binfile}.test"] {
++    return -1
++}
++
++clean_restart "$testfile.strip"
++
++gdb_test "p debugdata_function" {No symbol table is loaded\.  Use the "file" command\.} "no symtab"
++
++clean_restart "$testfile.test"
++
++gdb_test "p debugdata_function" { = {<text variable, no debug info>} 0x[0-9a-f]+ <debugdata_function>} "have symtab"
diff --git a/gdb-print-class.patch b/gdb-print-class.patch
new file mode 100644 (file)
index 0000000..4f18381
--- /dev/null
@@ -0,0 +1,110 @@
+http://sourceware.org/ml/gdb-cvs/2012-09/msg00169.html
+
+### src/gdb/ChangeLog  2012/09/27 12:53:57     1.14718
+### src/gdb/ChangeLog  2012/09/27 16:04:18     1.14719
+## -1,3 +1,8 @@
++2012-09-27  Tom Tromey  <tromey@redhat.com>
++
++      Fix https://bugzilla.redhat.com/show_bug.cgi?id=849357
++      * cp-valprint.c (cp_print_value_fields): Use get_vptr_fieldno.
++
+ 2012-09-27  Joel Brobecker  <brobecker@adacore.com>
+       * sol-thread.c (sol_thread_fetch_registers)
+--- src/gdb/cp-valprint.c      2012/07/06 05:36:07     1.85
++++ src/gdb/cp-valprint.c      2012/09/27 16:04:22     1.86
+@@ -210,7 +210,9 @@
+     {
+       int statmem_obstack_initial_size = 0;
+       int stat_array_obstack_initial_size = 0;
+-      
++      struct type *vptr_basetype = NULL;
++      int vptr_fieldno;
++
+       if (dont_print_statmem == 0)
+       {
+         statmem_obstack_initial_size =
+@@ -225,6 +227,7 @@
+           }
+       }
++      vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
+       for (i = n_baseclasses; i < len; i++)
+       {
+         /* If requested, skip printing of static fields.  */
+@@ -358,7 +361,7 @@
+                                          v, stream, recurse + 1,
+                                          options);
+               }
+-            else if (i == TYPE_VPTR_FIELDNO (type))
++            else if (i == vptr_fieldno && type == vptr_basetype)
+               {
+                 int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+                 struct type *i_type = TYPE_FIELD_TYPE (type, i);
+### src/gdb/testsuite/ChangeLog        2012/09/26 19:50:12     1.3396
+### src/gdb/testsuite/ChangeLog        2012/09/27 16:04:22     1.3397
+## -1,3 +1,10 @@
++2012-09-27  Tom Tromey  <tromey@redhat.com>
++
++      * gdb.cp/derivation.exp: Add regression test.
++      * gdb.cp/derivation.cc (class V_base, class V_inter, class
++      V_derived): New.
++      (vderived): New global.
++
+ 2012-09-26  Tom Tromey  <tromey@redhat.com>
+       * gdb.dwarf2/dw2-common-block.S: New file.
+--- src/gdb/testsuite/gdb.cp/derivation.cc     2011/12/13 17:22:08     1.2
++++ src/gdb/testsuite/gdb.cp/derivation.cc     2012/09/27 16:04:23     1.3
+@@ -118,8 +118,37 @@
+     
+ };
++class V_base
++{
++public:
++  virtual void m();
++  int base;
++};
++void
++V_base::m()
++{
++}
++
++class V_inter : public virtual V_base
++{
++public:
++  virtual void f();
++  int inter;
++};
++
++void
++V_inter::f()
++{
++}
++
++class V_derived : public V_inter
++{
++public:
++  double x;
++};
++V_derived vderived;
+ int A::afoo() {
+     return 1;
+--- src/gdb/testsuite/gdb.cp/derivation.exp    2012/07/10 15:18:18     1.19
++++ src/gdb/testsuite/gdb.cp/derivation.exp    2012/09/27 16:04:23     1.20
+@@ -176,3 +176,11 @@
+ gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()"
+ gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()"
++
++# This is a regression test for a bug that caused a crash when trying
++# to print the vtbl pointer.  We don't care about the output so much
++# here (it is tested elsewhere), just that gdb doesn't crash.  We test
++# "ptype" first because, before the gdb fix, that was the only code
++# path calling get_vptr_fieldno.
++gdb_test "ptype vderived" "type = .*"
++gdb_test "print vderived" " = {.* inter = 0.*x = 0}"
diff --git a/gdb-prologue-not-skipped.patch b/gdb-prologue-not-skipped.patch
deleted file mode 100644 (file)
index da5ce13..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-02/msg00673.html
-Subject: [patch] Fix regression by me for gcc-4.0...gcc-4.4 i386 -O2 -g parameters (PR 13777)
-
-Hi,
-
-http://sourceware.org/bugzilla/show_bug.cgi?id=13777
-
-for CentOS-5 i386 ls:
-
-$ gdb ls
-(gdb) start
-Temporary breakpoint 1, main (argc=Cannot access memory at address 0x81b7c7cd
-
-instead of GDB before my PR 12573 fix/change:
-
-Temporary breakpoint 1, main (argc=1, ...
-
-I asked before on #gcc since which versions GCC produced DW_AT_location which
-is for any PC either optimized-out or it has valid value.  I was told since
-gcc-4.0.  But that is not true.
-
-I have bisected gcc and I found 4.4.0 was still broken, 4.5.0 was correct,
-thanks to:
-commit 25e880b1917bd6bbf07e86b5574c698f3e9472d9
-Author: rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date:   Sat May 30 00:33:46 2009 +0000
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147995 138bc75d-0d04-0410-961f-82ee72b054a4
-unwind info for epilogues
-
-Curiously 4.4.x branch got later also fixed in this case by:
-commit 61db8bd232daeed3751b43570fab16146145e096
-Author: jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date:   Tue Jun 2 07:18:16 2009 +0000
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch@148070 138bc75d-0d04-0410-961f-82ee72b054a4
-(but that missed 4.4.0)
-
-As 4.5.0 was first FSF GCC with VTA I was trusting more the validity only
-after VTA and these heuristic results seems to confirm that.
-
-I find the change below definitely safe.
-
-Someone may object the original PR 12573 (do not try to skip prologue for -O2
--g code as it may cause more confusion than anything else) as while it fixed
-some GDB crashes there is no such purpose anymore with Tom's
-ambiguous-linespec patch.  Still I believe PR 12573 was right to do.
-
-No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
-
-I will check it in.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-02-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       PR symtab/13777
-       * dwarf2read.c (process_full_comp_unit): Set LOCATIONS_VALID only for
-       GCC >=4.5.
-
-gdb/testsuite/
-2012-02-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       PR symtab/13777
-       * gdb.dwarf2/dw2-skip-prologue.S (DW_AT_producer): Set it to 4.5.0.
-
---- a/gdb/dwarf2read.c
-+++ b/gdb/dwarf2read.c
-@@ -4841,7 +4841,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-       /* GCC-4.0 has started to support -fvar-tracking.  GCC-3.x still can
-        produce DW_AT_location with location lists but it can be possibly
--       invalid without -fvar-tracking.
-+       invalid without -fvar-tracking.  Still up to GCC-4.4.x incl. 4.4.0
-+       there were bugs in prologue debug info, fixed later in GCC-4.5
-+       by "unwind info for epilogues" patch (which is not directly related).
-        For -gdwarf-4 type units LOCATIONS_VALID indication is fortunately not
-        needed, it would be wrong due to missing DW_AT_producer there.
-@@ -4849,7 +4851,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
-        Still one can confuse GDB by using non-standard GCC compilation
-        options - this waits on GCC PR other/32998 (-frecord-gcc-switches).
-        */ 
--      if (cu->has_loclist && gcc_4_minor >= 0)
-+      if (cu->has_loclist && gcc_4_minor >= 5)
-       symtab->locations_valid = 1;
-       if (gcc_4_minor >= 5)
---- a/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
-+++ b/gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S
-@@ -30,7 +30,7 @@
-       .4byte  func_start                      /* DW_AT_low_pc */
-       .4byte  func_end                        /* DW_AT_high_pc */
-       .ascii  "main.c\0"                      /* DW_AT_name */
--      .ascii  "GNU C 4.0.0\0"                 /* DW_AT_producer must be >= 4.0  */
-+      .ascii  "GNU C 4.5.0\0"                 /* DW_AT_producer must be >= 4.5  */
-       .byte   2                               /* DW_AT_language (DW_LANG_C) */
-       .uleb128        2                       /* Abbrev: DW_TAG_subprogram */
-
diff --git a/gdb-readline62-ask-more-rh.patch b/gdb-readline62-ask-more-rh.patch
new file mode 100644 (file)
index 0000000..6f110be
--- /dev/null
@@ -0,0 +1,14 @@
+--- gdb-7.4.50.20120103-orig/gdb/event-top.c   2012-01-11 15:14:01.426206439 +0100
++++ gdb-7.4.50.20120103/gdb/event-top.c        2012-01-11 15:18:29.766577551 +0100
+@@ -982,6 +982,11 @@ set_async_editing_command (char *args, i
+ void
+ gdb_setup_readline (void)
+ {
++  /* 6.2 regression: no longed asks for --more--
++     gdb.base/readline-ask.exp
++     https://bugzilla.redhat.com/show_bug.cgi?id=701131  */
++  RL_SETSTATE (RL_STATE_FEDORA_GDB);
++
+   /* This function is a noop for the sync case.  The assumption is
+      that the sync setup is ALL done in gdb_init, and we would only
+      mess it up here.  The sync stuff should really go away over
diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
new file mode 100644 (file)
index 0000000..446709d
--- /dev/null
@@ -0,0 +1,75 @@
+Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
+===================================================================
+--- /dev/null
++++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
+@@ -0,0 +1,26 @@
++/* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.  */
++
++#include <stdio.h>
++#include <stdlib.h>
++
++int
++main (int argc, char *argv[])
++{
++  printf ("Hello, World.\n");
++  abort ();
++}
+Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
+===================================================================
+--- /dev/null
++++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
+@@ -0,0 +1,39 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set testfile "set-solib-absolute-prefix"
++set srcfile ${testfile}.c
++
++# It is necessary to verify if the binary is 32-bit, so that the system
++# call `__kernel_vsyscall' originates from vDSO.
++
++if { ![is_ilp32_target] } {
++    return -1
++}
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
++    return -1
++}
++
++if { ![runto_main] } {
++    return -1
++}
++
++gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
++    "continue until abort"
++gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
++    ".*warning: Unable to find dynamic linker breakpoint function.*" \
++    "set solib-absolute-prefix"
++gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
diff --git a/gdb-rhel5-compat.patch b/gdb-rhel5-compat.patch
new file mode 100644 (file)
index 0000000..2b947d3
--- /dev/null
@@ -0,0 +1,29 @@
+Index: gdb-7.4.50.20120602/gdb/linux-nat.c
+===================================================================
+--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c   2012-06-02 20:54:30.000000000 +0200
++++ gdb-7.4.50.20120602/gdb/linux-nat.c        2012-06-02 20:56:03.966493352 +0200
+@@ -1816,8 +1816,22 @@ get_pending_status (struct lwp_info *lp,
+                           gdb_signal_to_string (signo));
+     }
+-  if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
+-    *status = W_STOPCODE (SIGSTOP);
++  /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
++     many TIDs are left unstopped).  See RH Bug 496732.  */
++  if (GET_PID (lp->ptid) == pid_was_stopped)
++    {
++      int err;
++
++      errno = 0;
++      err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
++      if (debug_linux_nat)
++      {
++        fprintf_unfiltered (gdb_stdlog,
++                            "SC:  lwp kill %d %s\n",
++                            err,
++                            errno ? safe_strerror (errno) : "ERRNO-OK");
++      }
++    }
+   return 0;
+ }
index ccbb30aed0395d339e12d80633217bed89167f56..241795a67ef6b4388d9f60bf1d01ce58cfd18eab 100644 (file)
@@ -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.4.50.20111218/gdb/testsuite/gdb.base/vla.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/vla.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.base/vla.exp    2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/vla.exp 2011-12-19 02:27:16.745327844 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/vla.exp    2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/vla.exp 2012-07-03 17:50:57.999207540 +0200
 @@ -16,7 +16,25 @@
  set testfile vla
  set srcfile ${testfile}.c
@@ -32,11 +32,11 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/vla.exp
      untested "Couldn't compile test program"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/break-interp.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/break-interp.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.base/break-interp.exp   2011-12-19 02:21:56.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.base/break-interp.exp        2011-12-19 02:27:16.745327844 +0100
-@@ -34,9 +34,29 @@ if [get_compiler_info ${binfile_lib}] {
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/break-interp.exp   2012-07-03 17:44:45.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/break-interp.exp        2012-07-03 17:50:58.000207539 +0200
+@@ -34,9 +34,29 @@ if [get_compiler_info] {
      return -1
  }
  
@@ -67,10 +67,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.base/break-interp.exp
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/common-block.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/common-block.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/common-block.exp        2011-12-19 01:31:24.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/common-block.exp     2011-12-19 02:27:16.746327840 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/common-block.exp        2012-07-03 17:36:21.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/common-block.exp     2012-07-03 17:50:58.001207537 +0200
 @@ -20,7 +20,25 @@ set testfile "common-block"
  set srcfile ${testfile}.f90
  set binfile ${objdir}/${subdir}/${testfile}
@@ -98,10 +98,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/common-block.exp
      untested "Couldn't compile ${srcfile}"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dwarf-stride.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dwarf-stride.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp        2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dwarf-stride.exp     2011-12-19 02:27:16.746327840 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/dwarf-stride.exp        2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dwarf-stride.exp     2012-07-03 17:50:58.002207535 +0200
 @@ -27,7 +27,25 @@
  set testfile dwarf-stride
  set srcfile ${testfile}.f90
@@ -129,10 +129,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dwarf-stride.exp
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dynamic.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dynamic.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/dynamic.exp     2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dynamic.exp  2011-12-19 02:27:16.746327840 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/dynamic.exp     2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/dynamic.exp  2012-07-03 17:50:58.002207535 +0200
 @@ -25,7 +25,25 @@ set testfile "dynamic"
  set srcfile ${testfile}.f90
  set binfile ${objdir}/${subdir}/${testfile}
@@ -160,15 +160,15 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/dynamic.exp
      untested "Couldn't compile ${srcfile}"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/library-module.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/library-module.exp      2011-11-30 09:24:32.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp   2011-12-19 02:31:10.991318026 +0100
-@@ -25,16 +25,34 @@ if [get_compiler_info not-used] {
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/library-module.exp      2012-06-25 22:51:35.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/library-module.exp   2012-07-03 17:52:57.666062981 +0200
+@@ -23,16 +23,34 @@ if [get_compiler_info] {
     return -1
  }
  
--if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f90}] != "" } {
+-if  { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}] != "" } {
 -    untested "Couldn't compile ${srclibfile}"
 -    return -1
 +# Temporarily provide f90compiler=gfortran44 saving the original value around.
@@ -186,9 +186,9 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp
  # just for the linking phase (and not the source compilation phase).  And any
  # warnings on ignored $libfile abort the process.
  
--if  { [gdb_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug f90 shlib=$objdir/$subdir/$libfile]] != "" } {
-+set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f90}]
-+set err2 [gdb_compile $srcdir/$subdir/$srcfile $objdir/$subdir/$binfile executable [list debug f90 shlib=$objdir/$subdir/$libfile]]
+-if  { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 shlib=$libfile]] != "" } {
++set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}]
++set err2 [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 shlib=$libfile]]
 +
 +unset_board_info f90compiler
 +if [info exists old_f90compiler] {
@@ -203,13 +203,13 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/library-module.exp
      untested "Couldn't compile ${srcfile}"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/module.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/module.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/module.exp      2011-06-30 00:05:16.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/module.exp   2011-12-19 02:27:16.747327836 +0100
-@@ -16,7 +16,25 @@
- set testfile "module"
- set srcfile ${testfile}.f90
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/module.exp      2012-06-25 22:51:35.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/module.exp   2012-07-03 17:53:56.464992086 +0200
+@@ -15,7 +15,25 @@
+ standard_testfile .f90
  
 -if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
 +# Temporarily provide f90compiler=gfortran44 saving the original value around.
@@ -234,10 +234,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/module.exp
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/string.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/string.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/string.exp      2011-12-18 23:35:23.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/string.exp   2011-12-19 02:27:16.747327836 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/string.exp      2012-07-03 17:30:07.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/string.exp   2012-07-03 17:50:58.005207532 +0200
 @@ -23,7 +23,25 @@ set testfile "string"
  set srcfile ${testfile}.f90
  set binfile ${objdir}/${subdir}/${testfile}
@@ -265,10 +265,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/string.exp
      untested "Couldn't compile ${srcfile}"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/omp-step.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/omp-step.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/omp-step.exp    2011-12-19 01:31:24.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/omp-step.exp 2011-12-19 02:27:16.748327832 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/omp-step.exp    2012-07-03 17:36:21.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/omp-step.exp 2012-07-03 17:50:58.006207531 +0200
 @@ -15,7 +15,26 @@
  
  set testfile "omp-step"
@@ -297,16 +297,15 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/omp-step.exp
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/derived-type.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/derived-type.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/derived-type.exp        2011-06-29 19:50:47.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/derived-type.exp     2011-12-19 02:27:16.748327832 +0100
-@@ -28,8 +28,26 @@ set testfile "derived-type"
- set srcfile ${testfile}.f90
- set binfile ${objdir}/${subdir}/${testfile}
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/derived-type.exp        2012-06-25 22:51:35.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/derived-type.exp     2012-07-03 17:55:46.583858849 +0200
+@@ -22,7 +22,25 @@ if { [skip_fortran_tests] } { return -1
+ standard_testfile .f90
  
--if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
--       executable {debug f90}] != ""} {
+-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
 +# Temporarily provide f90compiler=gfortran44 saving the original value around.
 +
 +set board [target_info name]
@@ -318,28 +317,26 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/derived-type.exp
 +}
 +set_board_info f90compiler gfortran44
 +
-+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-+       executable {debug f90}]
++set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]
 +
 +unset_board_info f90compiler
 +if [info exists old_f90compiler] {
 +    set_board_info f90compiler $old_f90compiler
 +}
 +
-+if { $err != "" } {
++if $err {
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/subarray.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/subarray.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.fortran/subarray.exp    2011-06-29 19:50:47.000000000 +0200
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/subarray.exp 2011-12-19 02:27:16.748327832 +0100
-@@ -28,8 +28,26 @@ set testfile "subarray"
- set srcfile ${testfile}.f
- set binfile ${objdir}/${subdir}/${testfile}
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.fortran/subarray.exp    2012-06-25 22:51:35.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.fortran/subarray.exp 2012-07-03 17:56:20.454818198 +0200
+@@ -22,7 +22,25 @@ if { [skip_fortran_tests] } { return -1
+ standard_testfile .f
  
--if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
--      executable {debug f90}] != ""} {
+-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
 +# Temporarily provide f90compiler=gfortran44 saving the original value around.
 +
 +set board [target_info name]
@@ -351,22 +348,21 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.fortran/subarray.exp
 +}
 +set_board_info f90compiler gfortran44
 +
-+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-+      executable {debug f90}]
++set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]
 +
 +unset_board_info f90compiler
 +if [info exists old_f90compiler] {
 +    set_board_info f90compiler $old_f90compiler
 +}
 +
-+if { $err != "" } {
++if $err {
      return -1
  }
  
-Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/tls-sepdebug.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/tls-sepdebug.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp        2011-12-19 00:28:11.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/tls-sepdebug.exp     2011-12-19 02:27:16.748327832 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp        2012-07-03 17:32:05.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/tls-sepdebug.exp     2012-07-03 17:50:58.007207530 +0200
 @@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi
  
  # FIXME: gcc dependency (-Wl,-soname).
@@ -394,10 +390,10 @@ Index: gdb-7.4.50.20111218/gdb/testsuite/gdb.threads/tls-sepdebug.exp
      untested "Couldn't compile test library"
      return -1
  }
-Index: gdb-7.4.50.20111218/gdb/testsuite/lib/prelink-support.exp
+Index: gdb-7.4.50.20120703/gdb/testsuite/lib/prelink-support.exp
 ===================================================================
---- gdb-7.4.50.20111218.orig/gdb/testsuite/lib/prelink-support.exp     2011-12-19 02:21:56.000000000 +0100
-+++ gdb-7.4.50.20111218/gdb/testsuite/lib/prelink-support.exp  2011-12-19 02:27:16.749327828 +0100
+--- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/prelink-support.exp     2012-07-03 17:44:45.000000000 +0200
++++ gdb-7.4.50.20120703/gdb/testsuite/lib/prelink-support.exp  2012-07-03 17:50:58.008207529 +0200
 @@ -119,9 +119,31 @@ proc file_copy {src dest} {
  proc build_executable_own_libs {testname executable sources options {interp ""} {dir ""}} {
      global objdir subdir
diff --git a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
new file mode 100644 (file)
index 0000000..27e49dd
--- /dev/null
@@ -0,0 +1,723 @@
+Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S
+===================================================================
+--- /dev/null
++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S
+@@ -0,0 +1,638 @@
++/* Copyright (C) 2012 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 <http://www.gnu.org/licenses/>.  */
++
++/* This file has been generated from the file named `xlf-variable.f', which
++   should be present in this directory.  The command used to generate this
++   file was:
++
++     xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S
++
++   After issuing this command, you must hand-edit this file and remove the
++   mentions for `_xlfExit', since it is only present in XLF-specific
++   libraries.  You must also make sure to remove the file named `mod1.mod'
++   which will be created in the compilation directory.
++
++   In order to generated this file, the following XLF package was used:
++
++     xlf.14.1.0.0.linux.eval.tar.gz
++
++   These instructions may be different for different versions of the XLF
++   compiler.  */
++
++.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4
++.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
++.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
++.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
++.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
++.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
++.set r30,30; .set r31,31
++.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4
++.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9
++.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14
++.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19
++.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24
++.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29
++.set fp30,30; .set fp31,31
++.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4
++.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9
++.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14
++.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19
++.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24
++.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29
++.set v30,30; .set v31,31
++.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4
++.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9
++.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14
++.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19
++.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24
++.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29
++.set q30,30; .set q31,31
++.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6
++.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20
++.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26
++.set SRR_1,27
++.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1
++.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3
++.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6
++.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9
++.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12
++.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16
++.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19
++.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22
++.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25
++.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28
++.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31
++.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3
++.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7
++.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11
++.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15
++.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19
++.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23
++.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27
++.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31
++.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1
++
++      .file   "xlf-variable.f"
++      .globl  __mod1_NMOD_____mod1
++      .type   __mod1_NMOD_____mod1,@function
++      .size   __mod1_NMOD_____mod1,32
++      .globl  main
++      .type   main,@function
++      .size   main,68
++      .globl  __mod1_NMOD_sub1
++      .type   __mod1_NMOD_sub1,@function
++      .size   __mod1_NMOD_sub1,136
++      .globl  _main
++      .type   _main,@function
++      .size   _main,68
++
++      .section        ".text"
++      .align  7
++.LC.text:
++__mod1_NMOD_____mod1:
++      stwu       SP,-32(SP)
++      stw        r31,28(SP)
++      or         r31,SP,SP
++      b          $+0x4
++      addi       r11,r31,32
++      lwz        r31,-4(r11)
++      or         SP,r11,r11
++      bclr       BO_ALWAYS,CR0_LT
++.LC.text32:
++
++__mod1_NMOD_sub1:
++      stwu       SP,-32(SP)
++      stw        r31,28(SP)
++      stw        r30,24(SP)
++      or         r31,SP,SP
++      addis      r30,r0,.const_dr@ha
++      addi       r30,r30,.const_dr@l
++      addis      r3,r0,__N_mod1@ha
++      addi       r3,r3,__N_mod1@l
++      addi       r0,r0,1
++      stb        r0,4(r3)
++      addi       r4,r0,14
++      stb        r4,5(r3)
++      stb        r0,7(r3)
++      addis      r5,r0,__N__mod1@ha
++      addi       r5,r5,__N__mod1@l
++      stw        r5,0(r3)
++      lbz        r5,6(r3)
++      rlwinm     r5,r5,0,25,25
++      ori        r5,r5,0x0040
++      stb        r5,6(r3)
++      lwz        r5,0(r3)
++      lfs        fp0,0(r30)
++      stfs       fp0,0(r5)
++      stb        r0,4(r3)
++      stb        r4,5(r3)
++      addi       r4,r0,0
++      stb        r4,6(r3)
++      stb        r0,7(r3)
++      b          $+0x4
++      addi       r11,r31,32
++      lwz        r30,-8(r11)
++      lwz        r31,-4(r11)
++      or         SP,r11,r11
++      bclr       BO_ALWAYS,CR0_LT
++.LC.text168:
++      .long 0
++      .skip 0x54
++.LC.text256:
++
++main:
++_main:
++      mfspr      r0,LR
++      stwu       SP,-32(SP)
++      stw        r31,28(SP)
++      stw        r0,36(SP)
++      or         r31,SP,SP
++      bl         __mod1_NMOD_sub1
++      addi       r3,r0,0
++.LC.text288:
++
++      tw         TO_EQ,r14,r14
++      addi       r3,r0,0
++      b          $+0x4
++      addi       r11,r31,32
++      lwz        r31,-4(r11)
++      lwz        r0,4(r11)
++      mtspr      LR,r0
++      or         SP,r11,r11
++      bclr       BO_ALWAYS,CR0_LT
++.LC.text324:
++
++
++      .section        ".rodata","a"
++      .align  2
++.LC.rodata:
++      .type    .const_dr,@object
++      .size    .const_dr,4
++.const_dr:
++      .long 0x40400000
++
++      .section        ".eh_frame","wa"
++      .align  2
++.LC.eh_frame:
++      .long 0x0000000c
++      .long 0x00000000
++      .long 0x0100047c
++      .long 0x410c0100
++      .long 0x0000001c
++      .long 0x00000014
++      .long .LC.text
++      .long 0x00000020
++      .long 0x410e2041
++      .long 0x9f01410d
++      .long 0x1f410a42
++      .long 0xdf420b00
++      .long 0x00000020
++      .long 0x00000034
++      .long .LC.text32
++      .long 0x00000088
++      .long 0x410e2041
++      .long 0x9f01419e
++      .long 0x02410d1f
++      .long 0x590a42de
++      .long 0x41df420b
++      .long 0x0000000c
++      .long 0x00000000
++      .long 0x0100047c
++      .long 0x410c0100
++      .long 0x00000020
++      .long 0x00000014
++      .long .LC.text256
++      .long 0x00000044
++      .long 0x420e2041
++      .long 0x9f014111
++      .long 0x417f410d
++      .long 0x1f460a42
++      .long 0xdf440b00
++
++      .section        ".data","wa"
++      .align  4
++.LC.data:
++      .globl __N_mod1
++      .type    __N_mod1,@object
++      .size    __N_mod1,8
++__N_mod1:
++      .long 0x00000000
++      .long 0x01000001
++
++      .section        ".except.1","wa"
++      .align  1
++.LC.except.1:
++      .long .LC.text288
++      .byte 0x01
++      .byte 0x09
++
++      .ident  "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000."
++
++      .section        ".debug_aranges"
++      .align  0
++.LC.debug_aranges:
++      .long 0x0000001c
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info
++      .long 0x04000000
++      .byte 0x00
++      .byte 0x00
++      .long .LC.text
++      .long 0x000000a8
++      .long 0x00000000
++      .long 0x00000000
++      .long 0x0000001c
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info273
++      .long 0x04000000
++      .byte 0x00
++      .byte 0x00
++      .long .LC.text256
++      .long 0x00000044
++      .long 0x00000000
++      .long 0x00000000
++
++      .section        ".debug_pubnames"
++      .align  0
++.LC.debug_pubnames:
++      .long 0x0000002f
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info
++      .long 0x00000111
++      .long 0x000000dc
++      .long 0x79000000
++      .long 0x00ec7a00
++      .long 0x000000fc
++      .long 0x5f5f6d6f
++      .long 0x64315f4e
++      .long 0x4d4f445f
++      .long 0x73756231
++      .long 0x00000000
++      .long 0x00000000
++      .byte 0x18
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info273
++      .long 0x00000127
++      .long 0x0000010f
++      .long 0x5f6d6169
++      .long 0x6e000000
++      .byte 0x00
++      .byte 0x00
++
++      .section        ".debug_info"
++      .align  0
++.LC.debug_info:
++      .long 0x0000010d
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_abbrev
++      .long 0x0401786c
++      .long 0x662d7661
++      .long 0x72696162
++      .long 0x6c652e66
++      .byte 0x00
++      .long .LC.debug_line
++      .long .LC.text
++      .long .LC.text168
++      .long 0x082f726f
++      .long 0x6f742f73
++      .long 0x65726769
++      .long 0x6f646a2f
++      .long 0x6764622d
++      .long 0x372e302e
++      .long 0x312d3432
++      .long 0x2e656c35
++      .long 0x2f676462
++      .long 0x2d372e30
++      .long 0x2e312f67
++      .long 0x64622f74
++      .long 0x65737473
++      .long 0x75697465
++      .long 0x2f676462
++      .long 0x2e666f72
++      .long 0x7472616e
++      .long 0x0049424d
++      .long 0x20584c20
++      .long 0x466f7274
++      .long 0x72616e20
++      .long 0x666f7220
++      .long 0x4c696e75
++      .long 0x782c2056
++      .long 0x31342e31
++      .long 0x20283537
++      .long 0x36352d4a
++      .long 0x30352c20
++      .long 0x35373235
++      .long 0x2d433735
++      .long 0x29205665
++      .long 0x7273696f
++      .long 0x6e203134
++      .long 0x2e30312e
++      .long 0x30303030
++      .long 0x2e303030
++      .long 0x30000249
++      .long 0x4e544547
++      .long 0x45520004
++      .long 0x05030005
++      .long 0x02524541
++      .long 0x4c000404
++      .long 0x04050000
++      .long 0x0000c706
++      .long 0x6d6f6431
++      .long 0x00070503
++      .long __N_mod1
++      .long 0x79000100
++      .long 0x01000000
++      .long 0xd0070503
++      .long __N__mod1
++      .long 0x7a000100
++      .long 0x01000000
++      .long 0xc7087375
++      .byte 0x62
++      .byte 0x31
++      .byte 0x00
++      .long .LC.text32
++      .long .LC.text168
++      .long 0x01180101
++      .byte 0x6f
++      .byte 0x00
++      .byte 0x00
++.LC.debug_info273:
++      .long 0x00000123
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_abbrev97
++      .long 0x0401786c
++      .long 0x662d7661
++      .long 0x72696162
++      .long 0x6c652e66
++      .byte 0x00
++      .long .LC.debug_line98
++      .long .LC.text256
++      .long .LC.text324
++      .long 0x082f726f
++      .long 0x6f742f73
++      .long 0x65726769
++      .long 0x6f646a2f
++      .long 0x6764622d
++      .long 0x372e302e
++      .long 0x312d3432
++      .long 0x2e656c35
++      .long 0x2f676462
++      .long 0x2d372e30
++      .long 0x2e312f67
++      .long 0x64622f74
++      .long 0x65737473
++      .long 0x75697465
++      .long 0x2f676462
++      .long 0x2e666f72
++      .long 0x7472616e
++      .long 0x0049424d
++      .long 0x20584c20
++      .long 0x466f7274
++      .long 0x72616e20
++      .long 0x666f7220
++      .long 0x4c696e75
++      .long 0x782c2056
++      .long 0x31342e31
++      .long 0x20283537
++      .long 0x36352d4a
++      .long 0x30352c20
++      .long 0x35373235
++      .long 0x2d433735
++      .long 0x29205665
++      .long 0x7273696f
++      .long 0x6e203134
++      .long 0x2e30312e
++      .long 0x30303030
++      .long 0x2e303030
++      .long 0x30000249
++      .long 0x4e544547
++      .long 0x45520004
++      .long 0x05030005
++      .long 0x02524541
++      .long 0x4c000404
++      .long 0x04000000
++      .long 0xb9050000
++      .long 0x0000c706
++      .long 0x000000f4
++      .long 0x26264e26
++      .long 0x6d6f6431
++      .long 0x00080779
++      .long 0x00022300
++      .long 0x000000d4
++      .long 0x00060000
++      .long 0x010f2626
++      .long 0x4e26266d
++      .long 0x6f643100
++      .long 0x04077a00
++      .long 0x02230000
++      .long 0x0000c700
++      .long 0x085f6d61
++      .byte 0x69
++      .byte 0x6e
++      .byte 0x00
++      .long .LC.text256
++      .long .LC.text324
++      .long 0x0201016f
++      .long 0x000000b9
++      .byte 0x00
++
++      .section        ".debug_abbrev"
++      .align  0
++.LC.debug_abbrev:
++      .long 0x01110103
++      .long 0x08100611
++      .long 0x01120113
++      .long 0x0b1b0825
++      .long 0x08000002
++      .long 0x24000308
++      .long 0x0b0b3e0b
++      .long 0x00000324
++      .long 0x000b0b3e
++      .long 0x0b000004
++      .long 0x15000000
++      .long 0x050f0033
++      .long 0x0b491300
++      .long 0x00061e01
++      .long 0x03080000
++      .long 0x07340002
++      .long 0x0a03083a
++      .long 0x0b3b0b3f
++      .long 0x0c491300
++      .long 0x00082e00
++      .long 0x03081101
++      .long 0x12013a0b
++      .long 0x3b0b3f0c
++      .long 0x400a0000
++      .byte 0x00
++.LC.debug_abbrev97:
++      .long 0x01110103
++      .long 0x08100611
++      .long 0x01120113
++      .long 0x0b1b0825
++      .long 0x08000002
++      .long 0x24000308
++      .long 0x0b0b3e0b
++      .long 0x00000324
++      .long 0x000b0b3e
++      .long 0x0b000004
++      .long 0x15004913
++      .long 0x0000050f
++      .long 0x00330b49
++      .long 0x13000006
++      .long 0x13010113
++      .long 0x03080b0b
++      .long 0x0000070d
++      .long 0x00030838
++      .long 0x0a491300
++      .long 0x00082e00
++      .long 0x03081101
++      .long 0x1201360b
++      .long 0x3f0c400a
++      .long 0x49130000
++      .byte 0x00
++
++      .section        ".debug_line"
++      .align  0
++.LC.debug_line:
++      .long 0x0000005e
++      .long 0x00020000
++      .long 0x00220101
++      .long 0x9cdc0a00
++      .long 0x01010101
++      .long 0x00000001
++      .long 0x00786c66
++      .long 0x2d766172
++      .long 0x6961626c
++      .long 0x652e6600
++      .long 0x00000000
++      .long 0x04010005
++      .byte 0x02
++      .long .LC.text
++      .long 0x03130109
++      .long 0x000c0309
++      .long 0x01090014
++      .long 0x037b0109
++      .long 0x00180301
++      .long 0x01090038
++      .long 0x03010109
++      .long 0x000c0301
++      .long 0x01090014
++      .long 0x03010109
++      .long 0x00180001
++      .byte 0x01
++.LC.debug_line98:
++      .long 0x00000046
++      .long 0x00020000
++      .long 0x00220101
++      .long 0x9cdc0a00
++      .long 0x01010101
++      .long 0x00000001
++      .long 0x00786c66
++      .long 0x2d766172
++      .long 0x6961626c
++      .long 0x652e6600
++      .long 0x00000000
++      .long 0x04010005
++      .byte 0x02
++      .long .LC.text256
++      .long 0x031f0109
++      .long 0x00140300
++      .long 0x01090004
++      .long 0x03010109
++      .long 0x002c0001
++      .byte 0x01
++
++      .section        ".debug_frame"
++      .align  0
++.LC.debug_frame:
++      .long 0x0000000c
++      .long 0xffffffff
++      .long 0x0100047c
++      .long 0x410c0100
++      .long 0x0000001c
++      .long .LC.debug_frame
++      .long .LC.text
++      .long 0x00000020
++      .long 0x410e2041
++      .long 0x9f01410d
++      .long 0x1f410a42
++      .long 0xdf420b00
++      .long 0x00000020
++      .long .LC.debug_frame
++      .long .LC.text32
++      .long 0x00000088
++      .long 0x410e2041
++      .long 0x9f01419e
++      .long 0x02410d1f
++      .long 0x590a42de
++      .long 0x41df420b
++.LC.debug_frame84:
++      .long 0x0000000c
++      .long 0xffffffff
++      .long 0x0100047c
++      .long 0x410c0100
++      .long 0x00000020
++      .long .LC.debug_frame84
++      .long .LC.text256
++      .long 0x00000044
++      .long 0x420e2041
++      .long 0x9f014111
++      .long 0x417f410d
++      .long 0x1f460a42
++      .long 0xdf440b00
++
++      .section        ".debug_pubtypes"
++      .align  0
++.LC.debug_pubtypes:
++      .long 0x00000023
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info
++      .long 0x00000111
++      .long 0x000000b9
++      .long 0x494e5445
++      .long 0x47455200
++      .long 0x000000c7
++      .long 0x5245414c
++      .long 0x00000000
++      .long 0x00000000
++      .byte 0x3e
++      .byte 0x00
++      .byte 0x02
++      .long .LC.debug_info273
++      .long 0x00000127
++      .long 0x000000b9
++      .long 0x494e5445
++      .long 0x47455200
++      .long 0x000000c7
++      .long 0x5245414c
++      .long 0x00000000
++      .long 0xda26264e
++      .long 0x266d6f64
++      .long 0x31000000
++      .long 0x00f42626
++      .long 0x4e26266d
++      .long 0x6f643100
++      .long 0x00000000
++
++      .comm   __N__mod1,4,16
+Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp
+===================================================================
+--- /dev/null
++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp
+@@ -0,0 +1,37 @@
++# Copyright 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++# This test can only be run on PPC64 machines.
++
++if { ![istarget powerpc64-*] || ![is_ilp32_target] } {
++    return -1
++}
++
++set testfile "xlf-variable"
++set srcfile ${testfile}.S
++
++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
++    return -1
++}
++
++if { ![runto_main] } {
++    return -1
++}
++
++gdb_test "step" ".*y => z.*" "y => z"
++gdb_test "step" ".*y = 3\.0.*" "y = 3.0"
++gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)"
++gdb_test "print z" "= 3" "z = 3"
++gdb_test "ptype z" "= REAL" "z is REAL"
+Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f
+===================================================================
+--- /dev/null
++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f
+@@ -0,0 +1,33 @@
++c Copyright 2012 Free Software Foundation, Inc.
++c
++c This program is free software; you can redistribute it and/or modify
++c it under the terms of the GNU General Public License as published by
++c the Free Software Foundation; either version 3 of the License, or
++c (at your option) any later version.
++c
++c This program is distributed in the hope that it will be useful,
++c but WITHOUT ANY WARRANTY; without even the implied warranty of
++c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++c GNU General Public License for more details.
++c
++c You should have received a copy of the GNU General Public License
++c along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++c This file is the Fortran source file for xlf-variable.f.
++c It was used to generate the assembly output called xlf-variable.S,
++c which was generated using IBM's XLF compiler.
++
++        module mod1
++          real, pointer :: y
++          real, target :: z
++        contains
++          subroutine sub1
++            y => z
++            y = 3.0
++            nullify (y)
++          end subroutine
++        end module
++
++        use mod1
++        call sub1
++        end
diff --git a/gdb-stale-frame_info.patch b/gdb-stale-frame_info.patch
new file mode 100644 (file)
index 0000000..59f8ea1
--- /dev/null
@@ -0,0 +1,174 @@
+http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html
+Subject: [downstream patch FYI] workaround stale frame_info * (PR 13866)
+
+Hi,
+
+I did not look at which commit caused this regression but apparently it was
+introduced at least with multi-inferiors.
+
+I understand this fix is not right fix of the crash; but in most GDB cases one
+does not use multi-inferior so why to regress single-inferior by it.
+Some more simple solutions still fix the single-inferior mode but they
+regressed the multi-inferior mode
+       gdb.threads/no-unwaited-for-left.exp
+       gdb.multi/base.exp
+so I had to put there that sorting magic.
+
+With proper C++ sanity check of stale live frame_info references the testcase
+would be simple without the "frame_garbage_collection" reproducer below.
+It is also reproducible just with valgrind but regularly running the whole
+testsuite under valgrind I did not find feasible.
+
+No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2012-04-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Workaround PR backtrace/13866.
+       * progspace.c (switch_to_program_space_and_thread): Try not to call
+       switch_to_thread.
+
+--- a/gdb/progspace.c
++++ b/gdb/progspace.c
+@@ -481,17 +481,28 @@ save_current_space_and_thread (void)
+ void
+ switch_to_program_space_and_thread (struct program_space *pspace)
+ {
+-  struct inferior *inf;
++  struct inferior *inf = current_inferior ();
+-  inf = find_inferior_for_program_space (pspace);
++  if (inf->pspace != pspace)
++    inf = find_inferior_for_program_space (pspace);
+   if (inf != NULL)
+     {
+-      struct thread_info *tp;
++      struct thread_info *tp, *current_tp = NULL;
++
++      if (ptid_get_pid (inferior_ptid) == inf->pid)
++      current_tp = find_thread_ptid (inferior_ptid);
+       tp = any_live_thread_of_process (inf->pid);
+       if (tp != NULL)
+       {
+-        switch_to_thread (tp->ptid);
++        /* Prefer primarily thread not THREAD_EXITED and secondarily thread
++           not EXECUTING.  */
++        if (current_tp == NULL
++            || (tp->state != THREAD_EXITED
++                && current_tp->state == THREAD_EXITED)
++            || (!tp->executing && current_tp->executing))
++          switch_to_thread (tp->ptid);
++
+         /* Switching thread switches pspace implicitly.  We're
+            done.  */
+         return;
+
+
+Reproducer with:
+./gdb -nx ~/t/thread -ex 'b 24' -ex r -ex 'until 25'
+Breakpoint 1, main () at /home/jkratoch/t/thread.c:24
+24       v++;
+Segmentation fault (core dumped)
+
+#include <pthread.h>
+#include <assert.h>
+#include <unistd.h>
+
+static int v;
+
+static void *start (void *arg)
+{
+  v++;
+  v++;
+  v++;
+  v++;
+  sleep (100);
+  return arg;
+}
+
+int main (void)
+{
+  pthread_t thread1;
+  int i;
+
+  i = pthread_create (&thread1, NULL, start, NULL);
+  assert (i == 0);
+  v++;
+  v++;
+  v++;
+  v++;
+  i = pthread_join (thread1, NULL);
+  assert (i == 0);
+
+  return 0;
+}
+### --- a/gdb/frame.c
+### +++ b/gdb/frame.c
+### @@ -1522,12 +1522,30 @@ frame_observer_target_changed (struct target_ops *target)
+###    reinit_frame_cache ();
+###  }
+###  
+### +typedef struct obstack obstack_s;
+### +DEF_VEC_O (obstack_s);
+### +static VEC (obstack_s) *frame_poison_vec;
+### +
+### +void frame_garbage_collection (void);
+### +void
+### +frame_garbage_collection (void)
+### +{
+### +  struct obstack *obstack_p;
+### +  int ix;
+### +
+### +  for (ix = 0; VEC_iterate (obstack_s, frame_poison_vec, ix, obstack_p); ix++)
+### +    obstack_free (obstack_p, 0);
+### +
+### +  VEC_free (obstack_s, frame_poison_vec);
+### +  frame_poison_vec = NULL;
+### +}
+### +
+###  /* Flush the entire frame cache.  */
+###  
+###  void
+###  reinit_frame_cache (void)
+###  {
+### -  struct frame_info *fi;
+### +  struct frame_info *fi, *fi_prev;
+###  
+###    /* Tear down all frame caches.  */
+###    for (fi = current_frame; fi != NULL; fi = fi->prev)
+### @@ -1538,8 +1556,14 @@ reinit_frame_cache (void)
+###    fi->base->unwind->dealloc_cache (fi, fi->base_cache);
+###      }
+###  
+### +  for (fi = current_frame; fi != NULL; fi = fi_prev)
+### +    {
+### +      fi_prev = fi->prev;
+### +      memset (fi, 0, sizeof (*fi));
+### +    }
+### +  VEC_safe_push (obstack_s, frame_poison_vec, &frame_cache_obstack);
+### +
+###    /* Since we can't really be sure what the first object allocated was.  */
+### -  obstack_free (&frame_cache_obstack, 0);
+###    obstack_init (&frame_cache_obstack);
+###  
+###    if (current_frame != NULL)
+### --- a/gdb/top.c
+### +++ b/gdb/top.c
+### @@ -359,6 +359,11 @@ prepare_execute_command (void)
+###    if (non_stop)
+###      target_dcache_invalidate ();
+###  
+### +  {
+### +    extern void frame_garbage_collection (void);
+### +    frame_garbage_collection ();
+### +  }
+### +
+###    return cleanup;
+###  }
+###  
diff --git a/gdb-stap-double-free.patch b/gdb-stap-double-free.patch
deleted file mode 100644 (file)
index 2c7fc40..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
---- a/gdb/stap-probe.c
-+++ b/gdb/stap-probe.c
-@@ -355,9 +355,7 @@ stap_free_args_info (void *args_info_ptr)
-   int i;
-   for (i = 0; i < a->n_args; i++)
--    {
--      xfree (a->arg[i].arg_str);
--    }
-+    xfree (a->arg[i].arg_str);
-   xfree (a->arg);
-   xfree (a);
-@@ -401,6 +399,7 @@ stap_parse_probe_arguments (struct stap_probe *probe)
-     return;
-   args_info = xmalloc (sizeof (struct stap_args_info));
-+  args_info->n_args = 0;
-   back_to = make_cleanup (stap_free_args_info, args_info);
-   args_info->arg = xcalloc (STAP_MAX_ARGS, sizeof (struct stap_probe_arg));
-@@ -493,6 +492,7 @@ stap_parse_probe_arguments (struct stap_probe *probe)
-             args_info->arg[current_arg].arg_str
-               = savestring (start, cur - start);
-+            ++args_info->n_args;
-             /* Start it over again.  */
-             cur = skip_spaces ((char *) cur);
-             current_state = NEW_ARG;
-@@ -513,7 +513,6 @@ stap_parse_probe_arguments (struct stap_probe *probe)
-       }
-     }
--  args_info->n_args = current_arg + 1;
-   args_info->arg = xrealloc (args_info->arg,
-                             args_info->n_args
-                             * sizeof (struct stap_probe_arg));
-@@ -1526,8 +1525,9 @@ stap_free_parsed_args (struct stap_args_info *parsed_args)
-     return;
-   for (i = 0; i < parsed_args->n_args; i++)
--    xfree (parsed_args->arg);
-+    xfree (parsed_args->arg[i].arg_str);
-+  xfree (parsed_args->arg);
-   xfree (parsed_args);
- }
-@@ -1859,7 +1859,7 @@ parse_stap_probe (char **argptr, struct linespec_result *canonical)
-       if (canonical)
-         {
-           canonical->canonical = xrealloc (canonical->canonical,
--                                           result.nelts * sizeof (char **));
-+                                           result.nelts * sizeof (char *));
-           canonical->canonical[result.nelts - 1] = xstrdup (full_arg);
-         }
-       }
diff --git a/gdb-step-symless.patch b/gdb-step-symless.patch
new file mode 100644 (file)
index 0000000..5bca453
--- /dev/null
@@ -0,0 +1,160 @@
+http://sourceware.org/ml/gdb-patches/2012-09/msg00598.html
+Subject: [patch+7.5] Fix ppc32 7.5 stepping crash regression
+
+Hello,
+
+since
+       [PATCH] PowerPC 32 with Secure PLT
+       http://sourceware.org/ml/gdb-patches/2012-01/msg00655.html
+       http://sourceware.org/ml/gdb-patches/2012-01/msg00656.html
+       commit 4d19ed66762845cdcce95f8b1daaceb97cf90c71
+       Author: eager <eager>
+       Date:   Mon Jan 30 17:09:37 2012 +0000
+           Support stepping through PPC PLT with securePLT.
+
+(gdb) step
+Single stepping until exit from function main,
+which has no line number information.
+
+Program received signal SIGSEGV, Segmentation fault.
+0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
+651      if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
+(gdb) p sym
+$1 = (struct minimal_symbol *) 0x0
+(gdb) bt
+#0  0x00000000100898d8 in powerpc_linux_in_dynsym_resolve_code (pc=268436636) at ppc-linux-tdep.c:651
+#1  0x00000000103fdf44 in in_solib_dynsym_resolve_code (pc=268436636) at solib.c:1185
+#2  0x000000001025d848 in handle_inferior_event (ecs=0xfffffbbdcf0) at infrun.c:4737
+[...]
+
+I will check it in.
+
+Not regression tested.
+
+
+Regards,
+Jan
+
+
+gdb/
+2012-09-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix crash during stepping on ppc32.
+       * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Test NULL
+       SYM.
+
+gdb/testsuite/
+2012-09-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix crash during stepping on ppc32.
+       * gdb.base/step-symless.c: New file.
+       * gdb.base/step-symless.exp: New file.
+
+diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
+index c7b70db..ccded83 100644
+--- a/gdb/ppc-linux-tdep.c
++++ b/gdb/ppc-linux-tdep.c
+@@ -648,8 +648,9 @@ powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
+   /* Check if we are in the resolver.  */
+   sym = lookup_minimal_symbol_by_pc (pc);
+-  if ((strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0)
+-      || (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
++  if (sym != NULL
++      && (strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink") == 0
++        || strcmp (SYMBOL_LINKAGE_NAME (sym), "__glink_PLTresolve") == 0))
+     return 1;
+   return 0;
+diff --git a/gdb/testsuite/gdb.base/step-symless.c b/gdb/testsuite/gdb.base/step-symless.c
+new file mode 100644
+index 0000000..97eaf5e
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-symless.c
+@@ -0,0 +1,38 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++   Copyright 2012 Free Software Foundation, Inc.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 3 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
++
++static volatile int v;
++
++static void
++symful (void)
++{
++  v++;
++}
++
++static void
++symless (void)
++{
++  v++;
++}
++
++int
++main (void)
++{
++  symless ();
++  symful ();
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/step-symless.exp b/gdb/testsuite/gdb.base/step-symless.exp
+new file mode 100644
+index 0000000..d79edb2
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/step-symless.exp
+@@ -0,0 +1,41 @@
++# Copyright (C) 2012 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++standard_testfile
++if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {nodebug}] == -1} {
++    return -1
++}
++
++# We need those symbols global to access them from the .S file.
++set test "strip stub symbols"
++set objcopy_program [transform objcopy]
++set result [catch "exec $objcopy_program -N symless ${binfile}" output]
++verbose "result is $result"
++verbose "output is $output"
++if {$result != 0} {
++    fail $test
++    return
++}
++pass $test
++
++clean_restart $testfile
++
++if ![runto_main] {
++    return -1
++}
++
++gdb_breakpoint symful
++
++gdb_test "step" "Single stepping until exit.*no line number information.*\r\nBreakpoint \[^\r\n\]* in \\.?symful \\(\\)"
+
diff --git a/gdb-unused-revert.patch b/gdb-unused-revert.patch
deleted file mode 100644 (file)
index 2abe3cf..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-[RFA/commit 5/5] Add -Wunused-function to compile flags.
-http://sourceware.org/ml/gdb-patches/2010-01/msg00371.html
-http://sourceware.org/ml/gdb-cvs/2010-01/msg00163.html
-
-REVERTED
-
---- src/gdb/configure.ac       2010/01/15 00:34:37     1.112
-+++ src/gdb/configure.ac       2010/01/19 09:52:31     1.113
-@@ -1544,8 +1544,7 @@
- # gdb/doc/gdbint.texinfo.
- build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
- -Wformat-nonliteral -Wno-pointer-sign \
---Wno-unused -Wunused-value -Wunused-function \
---Wno-switch -Wno-char-subscripts"
-+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
---- src/gdb/configure  2010/01/15 00:34:37     1.297
-+++ src/gdb/configure  2010/01/19 09:52:32     1.298
-@@ -13435,8 +13435,7 @@
- # gdb/doc/gdbint.texinfo.
- build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
- -Wformat-nonliteral -Wno-pointer-sign \
---Wno-unused -Wunused-value -Wunused-function \
---Wno-switch -Wno-char-subscripts"
-+-Wno-unused -Wunused-value -Wno-switch -Wno-char-subscripts"
- # Enable -Wno-format by default when using gcc on mingw since many
- # GCC versions complain about %I64.
-### src/gdb/ChangeLog  2010/01/19 09:50:48     1.11271
-### src/gdb/ChangeLog  2010/01/19 09:52:33     1.11272
-## -1,11 +1,5 @@
- 2010-01-19  Joel Brobecker  <brobecker@adacore.com>
--      Add -Wunused-function to compile flags.
--      * configure.ac: Add -Wunused-function to build_warnings.
--      * configure: Regenerate.
--
--2010-01-19  Joel Brobecker  <brobecker@adacore.com>
--
-       "delete" ada-lex.c:input function, not used.
-       * ada-lex.l: #define YY_NO_INPUT.
diff --git a/gdb-upstream.patch b/gdb-upstream.patch
deleted file mode 100644 (file)
index e66d245..0000000
+++ /dev/null
@@ -1,299 +0,0 @@
-FYI: fix possible crash in find_charset_names
-http://sourceware.org/ml/gdb-patches/2012-02/msg00073.html
-http://sourceware.org/ml/gdb-cvs/2012-02/msg00037.html
-https://bugzilla.redhat.com/show_bug.cgi?id=786091
-
-### src/gdb/ChangeLog  2012/02/07 04:48:14     1.13810
-### src/gdb/ChangeLog  2012/02/07 15:42:33     1.13811
-## -1,3 +1,7 @@
-+2012-02-07  Tom Tromey  <tromey@redhat.com>
-+
-+      * charset.c (find_charset_names): Check 'in' against NULL.
-+
- 2012-02-06  Doug Evans  <dje@google.com>
-       * gdbtypes.h (struct main_type): Change type of name,tag_name,
---- src/gdb/charset.c  2012/01/24 21:36:37     1.47
-+++ src/gdb/charset.c  2012/02/07 15:42:39     1.48
-@@ -839,7 +839,7 @@
-        parse the glibc and libiconv formats; feel free to add others
-        as needed.  */
--      while (!feof (in))
-+      while (in != NULL && !feof (in))
-       {
-         /* The size of buf is chosen arbitrarily.  */
-         char buf[1024];
-
-
-
-http://sourceware.org/ml/gdb-patches/2012-02/msg00151.html
-Subject: [patch] ppc-linux-nat.c: Fix gcc-4.7 aliasing warnings
-
-Hi,
-
-ppc-linux-nat.c: In function 'fetch_register':
-ppc-linux-nat.c:598:9: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
-ppc-linux-nat.c: In function 'store_register':
-ppc-linux-nat.c:1078:8: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
-
-gcc-4.7.0-0.10.fc17.ppc64
-
-Probably clear, I looked at making it using union instead of memcpy but that
-would be too ugly.
-
-No regressions on ppc64-fedorarawhide-linux-gnu only for gdb.base/*.exp.
-
-I will check it in.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-02-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * ppc-linux-nat.c (fetch_register, store_register): Fix GCC aliasing
-       compilation warning.
-
---- a/gdb/ppc-linux-nat.c
-+++ b/gdb/ppc-linux-nat.c
-@@ -593,9 +593,10 @@ fetch_register (struct regcache *regcache, int tid, int regno)
-        bytes_transferred < register_size (gdbarch, regno);
-        bytes_transferred += sizeof (long))
-     {
-+      long l;
-+
-       errno = 0;
--      *(long *) &buf[bytes_transferred]
--        = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
-+      l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
-       regaddr += sizeof (long);
-       if (errno != 0)
-       {
-@@ -604,6 +605,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
-                  gdbarch_register_name (gdbarch, regno), regno);
-         perror_with_name (message);
-       }
-+      memcpy (&buf[bytes_transferred], &l, sizeof (l));
-     }
-   /* Now supply the register.  Keep in mind that the regcache's idea
-@@ -1073,9 +1075,11 @@ store_register (const struct regcache *regcache, int tid, int regno)
-   for (i = 0; i < bytes_to_transfer; i += sizeof (long))
-     {
-+      long l;
-+
-+      memcpy (&l, &buf[i], sizeof (l));
-       errno = 0;
--      ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr,
--            *(long *) &buf[i]);
-+      ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
-       regaddr += sizeof (long);
-       if (errno == EIO 
-
-
-
-http://sourceware.org/ml/gdb-patches/2012-02/msg00409.html
-Subject: FYI: remove extraneous block from dw2_map_symtabs_matching_filename
-http://sourceware.org/ml/gdb-cvs/2012-02/msg00117.html
-commit 61d8161b33b1e7dbc80ba6f7a92500a1594da55c
-
-### src/gdb/ChangeLog  2012/02/20 09:42:34     1.13845
-### src/gdb/ChangeLog  2012/02/20 19:24:34     1.13846
-## -1,3 +1,8 @@
-+2012-02-20  Tom Tromey  <tromey@redhat.com>
-+
-+      * dwarf2read.c (dw2_map_symtabs_matching_filename): Remove
-+      extraneous block.
-+
- 2012-02-20  Tristan Gingold  <gingold@adacore.com>
-       * darwin-nat.h (enum darwin_msg_state): Add comments.
---- src/gdb/dwarf2read.c       2012/02/07 04:48:19     1.612
-+++ src/gdb/dwarf2read.c       2012/02/20 19:24:39     1.613
-@@ -2437,13 +2437,6 @@
-               return 1;
-           }
--          {
--            if (dw2_map_expand_apply (objfile, per_cu,
--                                      name, full_path, real_path,
--                                      callback, data))
--              return 1;
--          }
--
-         /* Before we invoke realpath, which can get expensive when many
-            files are involved, do a quick comparison of the basenames.  */
-         if (! basenames_may_differ
-
-
-
-FYI: fix some performance bugs with .gdb_index
-http://sourceware.org/ml/gdb-patches/2012-02/msg00413.html
-http://sourceware.org/ml/gdb-cvs/2012-02/msg00119.html
-
-### src/gdb/ChangeLog  2012/02/20 19:44:00     1.13847
-### src/gdb/ChangeLog  2012/02/20 20:56:12     1.13848
-## -1,3 +1,10 @@
-+2012-02-20  Tom Tromey  <tromey@redhat.com>
-+
-+      PR gdb/13498:
-+      * dwarf2read.c (dw2_expand_symtabs_matching): Only visit a
-+      particular set of file names once.
-+      (dw2_map_symbol_filenames): Likewise.
-+
- 2012-02-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
-       Code cleanup.
---- src/gdb/dwarf2read.c       2012/02/20 19:24:39     1.613
-+++ src/gdb/dwarf2read.c       2012/02/20 20:56:12     1.614
-@@ -2700,32 +2700,63 @@
-   index = dwarf2_per_objfile->index_table;
-   if (file_matcher != NULL)
--    for (i = 0; i < (dwarf2_per_objfile->n_comp_units
--                   + dwarf2_per_objfile->n_type_units); ++i)
--      {
--      int j;
--      struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
--      struct quick_file_names *file_data;
-+    {
-+      struct cleanup *cleanup;
-+      htab_t visited_found, visited_not_found;
--      per_cu->v.quick->mark = 0;
-+      visited_found = htab_create_alloc (10,
-+                                       htab_hash_pointer, htab_eq_pointer,
-+                                       NULL, xcalloc, xfree);
-+      cleanup = make_cleanup_htab_delete (visited_found);
-+      visited_not_found = htab_create_alloc (10,
-+                                           htab_hash_pointer, htab_eq_pointer,
-+                                           NULL, xcalloc, xfree);
-+      make_cleanup_htab_delete (visited_not_found);
--      /* We only need to look at symtabs not already expanded.  */
--      if (per_cu->v.quick->symtab)
--        continue;
-+      for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-+                     + dwarf2_per_objfile->n_type_units); ++i)
-+      {
-+        int j;
-+        struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
-+        struct quick_file_names *file_data;
-+        void **slot;
--      file_data = dw2_get_file_names (objfile, per_cu);
--      if (file_data == NULL)
--        continue;
-+        per_cu->v.quick->mark = 0;
--      for (j = 0; j < file_data->num_file_names; ++j)
--        {
--          if (file_matcher (file_data->file_names[j], data))
--            {
--              per_cu->v.quick->mark = 1;
--              break;
--            }
--        }
--      }
-+        /* We only need to look at symtabs not already expanded.  */
-+        if (per_cu->v.quick->symtab)
-+          continue;
-+
-+        file_data = dw2_get_file_names (objfile, per_cu);
-+        if (file_data == NULL)
-+          continue;
-+
-+        if (htab_find (visited_not_found, file_data) != NULL)
-+          continue;
-+        else if (htab_find (visited_found, file_data) != NULL)
-+          {
-+            per_cu->v.quick->mark = 1;
-+            continue;
-+          }
-+
-+        for (j = 0; j < file_data->num_file_names; ++j)
-+          {
-+            if (file_matcher (file_data->file_names[j], data))
-+              {
-+                per_cu->v.quick->mark = 1;
-+                break;
-+              }
-+          }
-+
-+        slot = htab_find_slot (per_cu->v.quick->mark
-+                               ? visited_found
-+                               : visited_not_found,
-+                               file_data, INSERT);
-+        *slot = file_data;
-+      }
-+
-+      do_cleanups (cleanup);
-+    }
-   for (iter = 0; iter < index->symbol_table_slots; ++iter)
-     {
-@@ -2787,15 +2818,35 @@
-                         void *data, int need_fullname)
- {
-   int i;
-+  struct cleanup *cleanup;
-+  htab_t visited = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer,
-+                                    NULL, xcalloc, xfree);
-+  cleanup = make_cleanup_htab_delete (visited);
-   dw2_setup (objfile);
-+  /* We can ignore file names coming from already-expanded CUs.  */
-+  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-+                 + dwarf2_per_objfile->n_type_units); ++i)
-+    {
-+      struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
-+
-+      if (per_cu->v.quick->symtab)
-+      {
-+        void **slot = htab_find_slot (visited, per_cu->v.quick->file_names,
-+                                      INSERT);
-+
-+        *slot = per_cu->v.quick->file_names;
-+      }
-+    }
-+
-   for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-                  + dwarf2_per_objfile->n_type_units); ++i)
-     {
-       int j;
-       struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);
-       struct quick_file_names *file_data;
-+      void **slot;
-       /* We only need to look at symtabs not already expanded.  */
-       if (per_cu->v.quick->symtab)
-@@ -2805,6 +2856,14 @@
-       if (file_data == NULL)
-       continue;
-+      slot = htab_find_slot (visited, file_data, INSERT);
-+      if (*slot)
-+      {
-+        /* Already visited.  */
-+        continue;
-+      }
-+      *slot = file_data;
-+
-       for (j = 0; j < file_data->num_file_names; ++j)
-       {
-         const char *this_real_name;
-@@ -2816,6 +2875,8 @@
-         (*fun) (file_data->file_names[j], this_real_name, data);
-       }
-     }
-+
-+  do_cleanups (cleanup);
- }
- static int
diff --git a/gdb-x86-onstack-1of2.patch b/gdb-x86-onstack-1of2.patch
deleted file mode 100644 (file)
index a7f611d..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-03/msg00357.html
-Subject: [patch 1/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
-
-Hi,
-
-posted as a new thread.
-
-As described in
-       cancel: [patch] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #4 [Re: [revert] Regression on PowerPC]
-       http://sourceware.org/ml/gdb-patches/2012-03/msg00322.html
-just ON_STACK had some regressions.
-
-The expectations in that mail were wrong (at least that cleanup/fix is not
-required for gdb.cp/gdb2495.exp).
-
-The problem is that the inferior call return pad breakpoint instruction is
-never removed even after inferior call finishes.  It is even still visible in
-"maintenance info breakpoints".  This does not matter much for AT_ENTRY_POINT
-but for ON_STACK it just corrupts stack.
-
-No regressions on
-{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
-gdbsever non-extended mode.
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-03-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Remove momentary breakpoints for completed inferior calls.
-       * dummy-frame.c: Include gdbthread.h.
-       (pop_dummy_frame_bpt): New function.
-       (pop_dummy_frame): Initialie DUMMY earlier.  Call pop_dummy_frame_bpt.
-
-gdb/testsuite/
-2012-03-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       Remove momentary breakpoints for completed inferior calls.
-       * gdb.base/call-signal-resume.exp (maintenance print dummy-frames)
-       (maintenance info breakpoints): New tests.
-
---- a/gdb/dummy-frame.c
-+++ b/gdb/dummy-frame.c
-@@ -29,6 +29,7 @@
- #include "gdbcmd.h"
- #include "gdb_string.h"
- #include "observer.h"
-+#include "gdbthread.h"
- /* Dummy frame.  This saves the processor state just prior to setting
-    up the inferior function call.  Older targets save the registers
-@@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
-   xfree (dummy);
- }
-+/* Delete any breakpoint B which is a momentary breakpoint for return from
-+   inferior call matching DUMMY_VOIDP.  */
-+
-+static int
-+pop_dummy_frame_bpt (struct breakpoint *b, void *dummy_voidp)
-+{
-+  struct dummy_frame *dummy = dummy_voidp;
-+
-+  if (b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id)
-+      && b->thread == pid_to_thread_id (inferior_ptid))
-+    delete_breakpoint (b);
-+
-+  /* Continue the traversal.  */
-+  return 0;
-+}
-+
- /* Pop *DUMMY_PTR, restoring program state to that before the
-    frame was created.  */
- static void
- pop_dummy_frame (struct dummy_frame **dummy_ptr)
- {
--  struct dummy_frame *dummy;
-+  struct dummy_frame *dummy = *dummy_ptr;
-+
-+  restore_infcall_suspend_state (dummy->caller_state);
--  restore_infcall_suspend_state ((*dummy_ptr)->caller_state);
-+  iterate_over_breakpoints (pop_dummy_frame_bpt, dummy);
-   /* restore_infcall_control_state frees inf_state,
-      all that remains is to pop *dummy_ptr.  */
--  dummy = *dummy_ptr;
-   *dummy_ptr = dummy->next;
-   xfree (dummy);
---- a/gdb/testsuite/gdb.base/call-signal-resume.exp
-+++ b/gdb/testsuite/gdb.base/call-signal-resume.exp
-@@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*"
- gdb_test_no_output "set confirm off"
- gdb_test_no_output "return"
-+# Verify there are no remains of the dummy frame.
-+gdb_test_no_output "maintenance print dummy-frames"
-+set test "maintenance info breakpoints"
-+gdb_test_multiple $test $test {
-+    -re "call dummy.*\r\n$gdb_prompt $" {
-+      fail $test
-+    }
-+    -re "\r\n$gdb_prompt $" {
-+      pass $test
-+    }
-+}
-+
- # Resume execution, the program should continue without any signal.
- gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*"
diff --git a/gdb-x86-onstack-2of2.patch b/gdb-x86-onstack-2of2.patch
deleted file mode 100644 (file)
index a49904a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-http://sourceware.org/ml/gdb-patches/2012-03/msg00358.html
-Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5
-
-Hi,
-
-here is the ON_STACK code again, with fixed alignment for i386 SSE.
-
-It is generalized for all OSes on i386/amd64.  I can move it to
-{i386,amd64)-linux-tdep.c but I find this code much more lightweight than
-i386_push_dummy_call which is already present in i386-tdep.
-
-No regressions on
-{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for
-gdbsever non-extended mode.
-
-For x86_64-fedora17-linux-gnu it fixes:
--FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
--FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame
-+PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler.
-+PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame
-
-
-Thanks,
-Jan
-
-
-gdb/
-2012-03-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
-
-       * amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove.
-       (amd64_dicos_init_abi): Remove its installment.
-       * dicos-tdep.c (dicos_init_abi): Remove the
-       set_gdbarch_call_dummy_location call.  Update the comment here.
-       * i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove.
-       (i386_dicos_init_abi): Remove its installment.
-       * i386-tdep.c (i386_push_dummy_code): New function.
-       (i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install
-       i386_push_dummy_code.
-
---- a/gdb/amd64-dicos-tdep.c
-+++ b/gdb/amd64-dicos-tdep.c
-@@ -23,24 +23,6 @@
- #include "amd64-tdep.h"
- #include "dicos-tdep.h"
--static CORE_ADDR
--amd64_dicos_push_dummy_code (struct gdbarch *gdbarch,
--                           CORE_ADDR sp, CORE_ADDR funaddr,
--                           struct value **args, int nargs,
--                           struct type *value_type,
--                           CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
--                           struct regcache *regcache)
--{
--  int bplen;
--  CORE_ADDR bppc = sp;
--
--  gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
--  *bp_addr = sp - bplen;
--  *real_pc = funaddr;
--
--  return *bp_addr;
--}
--
- static void
- amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
- {
-@@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-   amd64_init_abi (info, gdbarch);
-   dicos_init_abi (gdbarch);
--
--  set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code);
- }
- static enum gdb_osabi
---- a/gdb/dicos-tdep.c
-+++ b/gdb/dicos-tdep.c
-@@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch)
-   /* There's no (standard definition of) entry point or a guaranteed
-      text location with a symbol where to place the call dummy, so we
--     put it on the stack.  */
--  set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
-+     need it on the stack.  Rely on i386_gdbarch_init used also for
-+     amd64 to set up ON_STACK inferior calls.  */
-   /* DICOS rewinds the PC itself.  */
-   set_gdbarch_decr_pc_after_break (gdbarch, 0);
---- a/gdb/i386-dicos-tdep.c
-+++ b/gdb/i386-dicos-tdep.c
-@@ -22,32 +22,12 @@
- #include "gdb_string.h"
- #include "dicos-tdep.h"
--static CORE_ADDR
--i386_dicos_push_dummy_code (struct gdbarch *gdbarch,
--                          CORE_ADDR sp, CORE_ADDR funaddr,
--                          struct value **args, int nargs,
--                          struct type *value_type,
--                          CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
--                          struct regcache *regcache)
--{
--  int bplen;
--  CORE_ADDR bppc = sp;
--
--  gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
--  *bp_addr = sp - bplen;
--  *real_pc = funaddr;
--
--  return *bp_addr;
--}
--
- static void
- i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
- {
-   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-   dicos_init_abi (gdbarch);
--
--  set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code);
- }
- static enum gdb_osabi
---- a/gdb/i386-tdep.c
-+++ b/gdb/i386-tdep.c
-@@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type)
-   return 0;
- }
-+/* Implementation for set_gdbarch_push_dummy_code.  */
-+
-+static CORE_ADDR
-+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
-+                    struct value **args, int nargs, struct type *value_type,
-+                    CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
-+                    struct regcache *regcache)
-+{
-+  int bplen;
-+  CORE_ADDR bppc = sp;
-+
-+  gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen);
-+  sp -= bplen;
-+
-+  /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call
-+     does not.  ABI requires stack alignment for executables using SSE.  */
-+  if (gdbarch_frame_align_p (gdbarch))
-+    sp = gdbarch_frame_align (gdbarch, sp);
-+
-+  *bp_addr = sp;
-+  *real_pc = funaddr;
-+  return sp;
-+}
-+
- static CORE_ADDR
- i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
-                     struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
-@@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
-   set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
-   /* Call dummy code.  */
-+  set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
-+  set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
-   set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
-   set_gdbarch_frame_align (gdbarch, i386_frame_align);
-
index f4a6e506e47314ec58a933f15d0444e5f9ea2e66..46aadbe053a99ded22e9f4ddd7fb56ac7138d959 100644 (file)
--- a/gdb.spec
+++ b/gdb.spec
@@ -18,15 +18,16 @@ Summary(tr.UTF-8):  C ve diğer diller için sembolik hata ayıklayıcı
 Summary(uk.UTF-8):     Символьний відладчик для С та інших мов
 Summary(zh_CN.UTF-8):  [开发]C和其他语言的调试器
 Summary(zh_TW.UTF-8):  [.-A開發]C和.$)B其.-A他語.$)B言的調試器
-%define                snap    20120120
+%define                snap    20120926
+######         /home/users/pluto/rpm/packages/../rpm-build-tools/rpm.groups: no such file
 Name:          gdb
-Version:       7.4.50
-Release:       0.%{snap}.2
+Version:       7.5.0
+Release:       0.%{snap}.0.1
 License:       GPL v3+
 Group:         Development/Debuggers
 #Source0:      http://ftp.gnu.org/gnu/gdb/%{name}-%{version}.tar.bz2
 Source0:       %{name}-%{version}.%{snap}.tar.bz2
-# Source0-md5: 9de84a22e4b96c08d8d31a72d7751c60
+# Source0-md5: 813b1d4f93e0eb56ff81d147de2286fb
 Source1:       http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
 # Source1-md5: 2e8a48939ae282c12bbacdd54e398247
 Source3:       %{name}-gstack.man
@@ -52,7 +53,6 @@ Patch136:     %{name}-6.3-test-movedir-20050125.patch
 Patch140:      %{name}-6.3-gcore-thread-20050204.patch
 Patch145:      %{name}-6.3-threaded-watchpoints2-20050225.patch
 Patch153:      %{name}-6.3-ia64-gcore-page0-20050421.patch
-Patch157:      %{name}-6.3-security-errata-20050610.patch
 Patch158:      %{name}-6.3-ia64-sigtramp-frame-20050708.patch
 Patch160:      %{name}-6.3-ia64-gcore-speedup-20050714.patch
 Patch161:      %{name}-6.3-inferior-notification-20050721.patch
@@ -73,7 +73,6 @@ Patch217:     %{name}-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch
 Patch225:      %{name}-6.5-bz109921-DW_AT_decl_file-test.patch
 Patch229:      %{name}-6.3-bz140532-ppc-unwinding-test.patch
 Patch231:      %{name}-6.3-bz202689-exec-from-pthread-test.patch
-Patch232:      %{name}-upstream.patch
 Patch234:      %{name}-6.6-bz230000-power6-disassembly-test.patch
 Patch235:      %{name}-6.3-bz231832-obstack-2gb.patch
 Patch245:      %{name}-6.6-bz229517-gcore-without-terminal.patch
@@ -83,6 +82,7 @@ Patch258:     %{name}-6.6-bz237572-ppc-atomic-sequence-test.patch
 Patch263:      %{name}-6.3-attach-see-vdso-test.patch
 Patch271:      %{name}-6.5-bz243845-stale-testing-zombie-test.patch
 Patch274:      %{name}-6.6-buildid-locate.patch
+Patch659:      %{name}-6.6-buildid-locate-solib-missing-ids.patch
 Patch353:      %{name}-6.6-buildid-locate-rpm.patch
 Patch415:      %{name}-6.6-buildid-locate-core-as-arg.patch
 Patch519:      %{name}-6.6-buildid-locate-rpm-librpm-workaround.patch
@@ -103,6 +103,8 @@ Patch320:   %{name}-6.5-section-num-fixup-test.patch
 Patch329:      %{name}-6.8-bz254229-gcore-prpsinfo.patch
 Patch330:      %{name}-6.8-bz436037-reg-no-longer-active.patch
 Patch331:      %{name}-6.8-quit-never-aborts.patch
+Patch335:      %{name}-rhel5-compat.patch
+Patch337:      %{name}-6.8-attach-signalled-detach-stopped.patch
 Patch343:      %{name}-6.8-watchpoint-conditionals-test.patch
 Patch348:      %{name}-6.8-bz466901-backtrace-full-prelinked.patch
 Patch349:      %{name}-archer.patch
@@ -111,51 +113,48 @@ Patch381: %{name}-simultaneous-step-resume-breakpoint-test.patch
 Patch382:      %{name}-core-open-vdso-warning.patch
 Patch391:      %{name}-x86_64-i386-syscall-restart.patch
 Patch392:      %{name}-bz533176-fortran-omp-step.patch
-Patch393:      %{name}-rhel5-gcc44.patch
 Patch397:      %{name}-follow-child-stale-parent.patch
 Patch403:      %{name}-ccache-workaround.patch
 Patch404:      %{name}-fortran-common-reduce.patch
 Patch405:      %{name}-fortran-common.patch
 Patch407:      %{name}-lineno-makeup-test.patch
 Patch408:      %{name}-ppc-power7-test.patch
-Patch412:      %{name}-unused-revert.patch
 Patch417:      %{name}-bz541866-rwatch-before-run.patch
 Patch459:      %{name}-moribund-utrace-workaround.patch
 Patch470:      %{name}-archer-next-over-throw-cxx-exec.patch
 Patch475:      %{name}-bz601887-dwarf4-rh-test.patch
-#Patch486:     %{name}-bz562763-pretty-print-2d-vectors.patch                  BROKEN!
-#Patch487:     %{name}-bz562763-pretty-print-2d-vectors-libstdcxx.patch
 Patch490:      %{name}-test-bt-cfi-without-die.patch
 Patch491:      %{name}-gdb-add-index-script.patch
 Patch496:      %{name}-bz568248-oom-is-error.patch
 Patch504:      %{name}-bz623749-gcore-relro.patch
-Patch510:      %{name}-bz592031-siginfo-lost-4of5.patch
-Patch511:      %{name}-bz592031-siginfo-lost-5of5.patch
 Patch526:      %{name}-bz634108-solib_address.patch
 Patch542:      %{name}-test-pid0-core.patch
 Patch547:      %{name}-test-dw2-aranges.patch
 Patch548:      %{name}-test-expr-cumulative-archer.patch
 Patch579:      %{name}-7.2.50-sparc-add-workaround-to-broken-debug-files.patch
-Patch618:      %{name}-dlopen-stap-probe.patch
+Patch618:      %{name}-dlopen-stap-probe-1of7.patch
+Patch717:      %{name}-dlopen-stap-probe-2of7.patch
+Patch718:      %{name}-dlopen-stap-probe-3of7.patch
+Patch719:      %{name}-dlopen-stap-probe-4of7.patch
+Patch720:      %{name}-dlopen-stap-probe-5of7.patch
+Patch721:      %{name}-dlopen-stap-probe-6of7.patch
+Patch722:      %{name}-dlopen-stap-probe-7of7.patch
 Patch619:      %{name}-dlopen-stap-probe-test.patch
+Patch723:      %{name}-dlopen-stap-probe-test2.patch
 Patch627:      %{name}-glibc-vdso-workaround.patch
 Patch634:      %{name}-runtest-pie-override.patch
-#Patch642:     %{name}-readline62-ask-more-rh.patch
 Patch643:      %{name}-python-rdynamic.patch
-Patch644:      %{name}-expand-cxx-accel.patch
-Patch645:      %{name}-prologue-not-skipped.patch
-Patch646:      %{name}-exit-warning.patch
-Patch648:      %{name}-archer-vla-rhel5gcc.patch
-Patch649:      %{name}-attach-fail-reasons-1of5.patch
-Patch650:      %{name}-attach-fail-reasons-2of5.patch
-Patch651:      %{name}-attach-fail-reasons-3of5.patch
-Patch652:      %{name}-attach-fail-reasons-4of5.patch
 Patch653:      %{name}-attach-fail-reasons-5of5.patch
 Patch657:      %{name}-attach-fail-reasons-5of5configure.patch
-Patch654:      %{name}-x86-onstack-1of2.patch
-Patch658:      %{name}-x86-onstack-2of2.patch
-Patch655:      %{name}-die-cu-offset-1of2.patch
-Patch656:      %{name}-die-cu-offset-2of2.patch
+Patch661:      %{name}-stale-frame_info.patch
+Patch690:      %{name}-glibc-strstr-workaround.patch
+Patch698:      %{name}-rhel5.9-testcase-xlf-var-inside-mod.patch
+Patch703:      %{name}-rhbz-818343-set-solib-absolute-prefix-testcase.patch
+Patch716:      %{name}-minidebuginfo.patch
+Patch725:      %{name}-step-symless.patch
+Patch726:      %{name}-print-class.patch
+Patch728:      %{name}-check-type.patch
+Patch729:      %{name}-entryval-inlined.patch
 
 # PLD patches
 Patch1000:     %{name}-readline.patch
@@ -165,7 +164,7 @@ Patch1005:  %{name}-pretty-print-by-default.patch
 Patch1006:     buildid-locate-rpm-pld.patch
 
 URL:           http://www.gnu.org/software/gdb/
-BuildRequires: autoconf >= 2.68
+BuildRequires: autoconf >= 2.69
 BuildRequires: automake
 BuildRequires: bison
 BuildRequires: expat-devel
@@ -245,6 +244,7 @@ verir.
 %package gdbserver
 Summary:       A standalone server for GDB (the GNU source-level debugger)
 Summary(pl.UTF-8):     Samodzielny serwer GDB (debuggera GNU)
+######         /home/users/pluto/rpm/packages/../rpm-build-tools/rpm.groups: no such file
 Group:         Development/Debuggers
 
 %description gdbserver
@@ -267,6 +267,7 @@ maszynie niż ta, na której działa śledzony program.
 %package lib
 Summary:       GDB in the form of a static library
 Summary(pl.UTF-8):     GDB w postaci biblioteki statycznej
+######         /home/users/pluto/rpm/packages/../rpm-build-tools/rpm.groups: no such file
 Group:         Development/Debuggers
 # libraries that needs to be linked to fulfill libgdb.a symbol requirements
 Requires:      binutils-devel >= 2.17.50
@@ -295,7 +296,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 # Match the Fedora's version info.
 %patch2 -p1
 
-%patch232 -p1
 %patch349 -p1
 %patch1 -p1
 %patch3 -p1
@@ -311,7 +311,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch140 -p1
 %patch145 -p1
 %patch153 -p1
-%patch157 -p1
 %patch158 -p1
 %patch160 -p1
 %patch161 -p1
@@ -342,6 +341,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch263 -p1
 %patch271 -p1
 %patch274 -p1
+%patch659 -p1
 %patch353 -p1
 %patch276 -p1
 %patch282 -p1
@@ -375,7 +375,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch394 -p1
 %patch407 -p1
 %patch408 -p1
-%patch412 -p1
 %patch417 -p1
 %patch459 -p1
 %patch470 -p1
@@ -386,34 +385,34 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch491 -p1
 %patch496 -p1
 %patch504 -p1
-%patch510 -p1
-%patch511 -p1
 %patch526 -p1
 %patch542 -p1
 %patch547 -p1
 %patch548 -p1
 %patch579 -p1
 %patch618 -p1
+%patch717 -p1
+%patch718 -p1
+%patch719 -p1
+%patch720 -p1
+%patch721 -p1
+%patch722 -p1
+%patch723 -p1
 %patch619 -p1
 %patch627 -p1
 %patch634 -p1
 %patch643 -p1
-%patch644 -p1
-%patch645 -p1
-%patch646 -p1
-%patch648 -p1
-%patch649 -p1
-%patch650 -p1
-%patch651 -p1
-%patch652 -p1
 %patch653 -p1
 %patch657 -p1
-%patch654 -p1
-%patch658 -p1
-%patch655 -p1
-%patch656 -p1
-
-%patch393 -p1
+%patch661 -p1
+%patch690 -p1
+%patch698 -p1
+%patch703 -p1
+%patch716 -p1
+%patch725 -p1
+%patch726 -p1
+%patch728 -p1
+%patch729 -p1
 
 # PLD patches
 %patch1000 -p1
@@ -427,7 +426,7 @@ cat > gdb/version.in << EOF
 %{version}-%{release} (PLD Linux)
 EOF
 
-sed -i -e 's#_GCC_AUTOCONF_VERSION\], \[2\.64\]#_GCC_AUTOCONF_VERSION], [2.68]#g' config/override.m4
+sed -i -e 's#_GCC_AUTOCONF_VERSION\], \[2\.64\]#_GCC_AUTOCONF_VERSION], [2.69]#g' config/override.m4
 
 %build
 # omit hand-written gdb/testsuite aclocal.m4
@@ -516,7 +515,7 @@ install libdecnumber/libdecnumber.a $RPM_BUILD_ROOT%{_libdir}
 
 # Remove the files that are part of a gdb build but that are owned and provided by other packages.
 # These are part of binutils
-rm -rf $RPM_BUILD_ROOT%{_datadir}/locale
+rm -rf $RPM_BUILD_ROOT%{_localedir}
 rm -f $RPM_BUILD_ROOT%{_infodir}/bfd*
 rm -f $RPM_BUILD_ROOT%{_infodir}/standard*
 rm -f $RPM_BUILD_ROOT%{_infodir}/mmalloc*
This page took 2.194728 seconds and 4 git commands to generate.