]> git.pld-linux.org Git - packages/gdb.git/commitdiff
- up to 7.0 from Fedora rel 0.5
authorBartłomiej Zimoń <cactus@pld-linux.org>
Tue, 8 Dec 2009 01:53:10 +0000 (01:53 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    gdb-6.3-bz182116-exec-from-pthread.patch -> 1.1
    gdb-6.3-ia64-corefile-fix-20050127.patch -> 1.1
    gdb-6.3-test-pie-20050107.patch -> 1.3
    gdb-6.6-buildid-locate.patch -> 1.4
    gdb-7.0-upstream.patch -> 1.1
    gdb-archer-pie-addons.patch -> 1.1
    gdb-archer-pie.patch -> 1.1
    gdb-archer.patch -> 1.4
    gdb-bz528668-symfile-cleanup.patch -> 1.1
    gdb-bz528668-symfile-multi.patch -> 1.1
    gdb-bz528668-symfile-sepcrc.patch -> 1.1
    gdb-bz538626-bp_location-accel-bp-cond.patch -> 1.1
    gdb-bz539590-gnu-ifunc.patch -> 1.1
    gdb-core-open-vdso-warning.patch -> 1.1
    gdb-readline-6.0-signal.patch -> 1.1
    gdb-x86_64-i386-syscall-restart.patch -> 1.1
    gdb.spec -> 1.116

17 files changed:
gdb-6.3-bz182116-exec-from-pthread.patch [new file with mode: 0644]
gdb-6.3-ia64-corefile-fix-20050127.patch [new file with mode: 0644]
gdb-6.3-test-pie-20050107.patch
gdb-6.6-buildid-locate.patch
gdb-7.0-upstream.patch [new file with mode: 0644]
gdb-archer-pie-addons.patch [new file with mode: 0644]
gdb-archer-pie.patch [new file with mode: 0644]
gdb-archer.patch
gdb-bz528668-symfile-cleanup.patch [new file with mode: 0644]
gdb-bz528668-symfile-multi.patch [new file with mode: 0644]
gdb-bz528668-symfile-sepcrc.patch [new file with mode: 0644]
gdb-bz538626-bp_location-accel-bp-cond.patch [new file with mode: 0644]
gdb-bz539590-gnu-ifunc.patch [new file with mode: 0644]
gdb-core-open-vdso-warning.patch [new file with mode: 0644]
gdb-readline-6.0-signal.patch [new file with mode: 0644]
gdb-x86_64-i386-syscall-restart.patch [new file with mode: 0644]
gdb.spec

diff --git a/gdb-6.3-bz182116-exec-from-pthread.patch b/gdb-6.3-bz182116-exec-from-pthread.patch
new file mode 100644 (file)
index 0000000..bf7f58c
--- /dev/null
@@ -0,0 +1,23 @@
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=182116
+
+
+Index: gdb-6.5/gdb/linux-thread-db.c
+===================================================================
+--- gdb-6.5.orig/gdb/linux-thread-db.c 2006-08-24 02:55:24.000000000 -0300
++++ gdb-6.5/gdb/linux-thread-db.c      2006-08-24 02:56:16.000000000 -0300
+@@ -939,6 +939,15 @@ thread_db_wait (ptid_t ptid, struct targ
+       || ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
+     return pid_to_ptid (-1);
++  if (ourstatus->kind == TARGET_WAITKIND_EXECD)
++    {
++      remove_thread_event_breakpoints ();
++      unpush_target (&thread_db_ops);
++      using_thread_db = 0;
++
++      return pid_to_ptid (GET_PID (ptid));
++    }
++
+   if (ourstatus->kind == TARGET_WAITKIND_STOPPED
+       && (ourstatus->value.sig == TARGET_SIGNAL_TRAP
+           || ourstatus->value.sig == TARGET_SIGNAL_ILL))
diff --git a/gdb-6.3-ia64-corefile-fix-20050127.patch b/gdb-6.3-ia64-corefile-fix-20050127.patch
new file mode 100644 (file)
index 0000000..45a84cc
--- /dev/null
@@ -0,0 +1,28 @@
+2005-01-25  Jeff Johnston  <jjohnstn@redhat.com>
+
+       * ia64-tdep.c (getunwind_table): Call the low-level xfer
+       unwind table syscall to support backtracing from syscalls in
+       a corefile.
+
+Index: gdb-6.5/gdb/ia64-tdep.c
+===================================================================
+--- gdb-6.5.orig/gdb/ia64-tdep.c       2006-04-18 16:20:06.000000000 -0300
++++ gdb-6.5/gdb/ia64-tdep.c    2006-07-07 02:18:40.000000000 -0300
+@@ -2470,8 +2470,17 @@ getunwind_table (void *buf, size_t len)
+      we want to preserve fall back to the running kernel's table, then
+      we should find a way to override the corefile layer's
+      xfer_partial method.  */
++#if 0
+   x = target_read_partial (&current_target, TARGET_OBJECT_UNWIND_TABLE, NULL,
+                          buf, 0, len);
++#endif
++  /* FIXME: This is a temporary solution to backtracing syscalls in corefiles.
++            To do this properly, the AUXV section should be used.  This
++          fix will work as long as the kernel used to generate the corefile
++          is equivalent to the kernel used to debug the corefile.  */
++  x = ia64_linux_xfer_unwind_table (&current_target,
++                                  TARGET_OBJECT_UNWIND_TABLE, NULL,
++                                  buf, NULL, 0, len);
+   return (int)x;
+ }
index 6ba24a0cc12a0257222e6d88f0e1c20d99507f3e..9208981db92d7517afcb342b0d2b636ffb85c985 100644 (file)
@@ -436,7 +436,7 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
 +++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp       2009-09-09 19:06:01.000000000 +0200
-@@ -0,0 +1,432 @@
+@@ -0,0 +1,433 @@
 +#   Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
@@ -817,7 +817,8 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
 +      -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
 +         fail "attach call, read register 3 error"
 +     }
-+     -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
++     -re "Attaching to.*process $testpid.*$gdb_prompt $" {
++         # libc is relocated, not relocated, therefore not printed.
 +         pass "attach call"
 +     }
 +      -re "$gdb_prompt $" {fail "attach call"}
index edc52bd988b4754e48d8e43b67e62b5f257e5029..5f2679cdaf08795a0469cdaf95ac4fd87ac53f9b 100644 (file)
@@ -1,7 +1,7 @@
-Index: gdb-6.8.91.20090925/gdb/corelow.c
+Index: gdb-7.0/gdb/corelow.c
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/corelow.c     2009-07-31 17:25:21.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/corelow.c  2009-09-25 09:39:09.000000000 +0200
+--- gdb-7.0.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
++++ gdb-7.0/gdb/corelow.c      2009-10-23 00:17:29.000000000 +0200
 @@ -45,6 +45,10 @@
  #include "exceptions.h"
  #include "solib.h"
@@ -91,11 +91,11 @@ Index: gdb-6.8.91.20090925/gdb/corelow.c
 +                         NULL, NULL, NULL,
 +                         &setlist, &showlist);
  }
-Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
+Index: gdb-7.0/gdb/doc/gdb.texinfo
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/doc/gdb.texinfo       2009-09-25 09:29:58.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/doc/gdb.texinfo    2009-09-25 09:29:58.000000000 +0200
-@@ -13895,6 +13895,27 @@ information files.
+--- gdb-7.0.orig/gdb/doc/gdb.texinfo   2009-10-23 00:12:39.000000000 +0200
++++ gdb-7.0/gdb/doc/gdb.texinfo        2009-10-23 00:17:29.000000000 +0200
+@@ -13896,6 +13896,27 @@ information files.
  
  @end table
  
@@ -123,10 +123,10 @@ Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
  @cindex @code{.gnu_debuglink} sections
  @cindex debug link sections
  A debug link is a special section of the executable file named
-Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
+Index: gdb-7.0/gdb/solib-svr4.c
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c  2009-09-25 09:29:57.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/solib-svr4.c       2009-09-25 09:43:14.000000000 +0200
+--- gdb-7.0.orig/gdb/solib-svr4.c      2009-10-23 00:12:38.000000000 +0200
++++ gdb-7.0/gdb/solib-svr4.c   2009-10-23 00:17:29.000000000 +0200
 @@ -1101,9 +1101,49 @@ svr4_current_sos (void)
                     safe_strerror (errcode));
          else
@@ -180,10 +180,10 @@ Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
            }
          xfree (buffer);
  
-Index: gdb-6.8.91.20090925/gdb/symfile.c
+Index: gdb-7.0/gdb/symfile.c
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/symfile.c     2009-09-25 09:29:57.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/symfile.c  2009-09-25 09:29:58.000000000 +0200
+--- gdb-7.0.orig/gdb/symfile.c 2009-10-23 00:12:38.000000000 +0200
++++ gdb-7.0/gdb/symfile.c      2009-10-23 00:43:28.000000000 +0200
 @@ -56,6 +56,7 @@
  #include "elf-bfd.h"
  #include "solib.h"
@@ -618,7 +618,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
  
    if (found == NULL)
      warning (_("File \"%s\" has no build-id, file skipped"), filename);
-@@ -1234,8 +1626,9 @@ build_id_verify (const char *filename, s
+@@ -1234,14 +1626,16 @@ build_id_verify (const char *filename, s
    return retval;
  }
  
@@ -628,48 +628,77 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
 +build_id_to_filename (struct build_id *build_id, char **link_return,
 +                    int add_debug_suffix)
  {
-   char *link, *s, *retval = NULL;
-   gdb_byte *data = build_id->data;
-@@ -1243,7 +1636,9 @@ build_id_to_debug_filename (struct build
+   char *link, *debugdir, *retval = NULL;
++  char *link_all = NULL;
  
    /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
-   link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
--                + 2 * size + (sizeof ".debug" - 1) + 1);
-+                + 2 * size
-+                + (add_debug_suffix ? sizeof ".debug" - 1 : 0)
-+                + 1);
-   s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
-   if (size > 0)
-     {
-@@ -1254,12 +1649,14 @@ build_id_to_debug_filename (struct build
-     *s++ = '/';
-   while (size-- > 0)
-     s += sprintf (s, "%02x", (unsigned) *data++);
--  strcpy (s, ".debug");
-+  if (add_debug_suffix)
-+    strcpy (s, ".debug");
-+  else
-+    *s = 0;
+-  link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+-               + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
++  link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
++                + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+   /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+      cause "/.build-id/..." lookups.  */
+@@ -1272,7 +1666,10 @@ build_id_to_debug_filename (struct build
+       *s++ = '/';
+       while (size-- > 0)
+       s += sprintf (s, "%02x", (unsigned) *data++);
+-      strcpy (s, ".debug");
++      if (add_debug_suffix)
++      strcpy (s, ".debug");
++      else
++      *s = 0;
+       /* lrealpath() is expensive even for the usually non-existent files.  */
+       if (access (link, F_OK) == 0)
+@@ -1285,15 +1682,185 @@ build_id_to_debug_filename (struct build
+       }
  
-   /* lrealpath() is expensive even for the usually non-existent files.  */
-   if (access (link, F_OK) == 0)
-     retval = lrealpath (link);
--  xfree (link);
+       if (retval != NULL)
+-      break;
++      {
++        /* LINK_ALL is not used below in this non-NULL RETVAL case.  */
++        break;
++      }
++
++      if (link_all == NULL)
++        link_all = xstrdup (link);
++      else
++        {
++          size_t len_orig = strlen (link_all);
++
++          link_all = xrealloc (link_all, len_orig + 1 + strlen (link) + 1);
++
++          /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with
++             its possible use as an argument for installation command.  */
++          link_all[len_orig] = ' ';
++
++          strcpy (&link_all[len_orig + 1], link);
++        }
  
-   if (retval != NULL && !build_id_verify (retval, build_id))
-     {
-@@ -1267,9 +1664,150 @@ build_id_to_debug_filename (struct build
-       retval = NULL;
+       debugdir = debugdir_end;
      }
+   while (*debugdir != 0);
  
 +  if (link_return != NULL)
-+    *link_return = link;
-+  else
-+    xfree (link);
++    {
++      if (retval != NULL)
++       {
++         *link_return = link;
++         link = NULL;
++       }
++      else
++       {
++         *link_return = link_all;
++         link_all = NULL;
++       }
++    }
++  xfree (link);
++  xfree (link_all);
++
++  return retval;
++}
 +
-   return retval;
- }
 +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
 +     Try to install the hash file ...
 +   avoidance.  */
@@ -692,9 +721,9 @@ Index: gdb-6.8.91.20090925/gdb/symfile.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)
 +{
@@ -809,20 +838,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
  static char *
  get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
  {
-@@ -1352,32 +1890,36 @@ static char *
- find_separate_debug_file (struct objfile *objfile)
- {
-   asection *sect;
--  char *basename;
--  char *dir;
--  char *debugfile;
-+  char *basename = NULL;
-+  char *dir = NULL;
-+  char *debugfile = NULL;
-   char *name_copy;
--  char *canon_name;
-+  char *canon_name = NULL;
-   bfd_size_type debuglink_size;
+@@ -1384,13 +1951,14 @@ find_separate_debug_file (struct objfile
    unsigned long crc32;
    int i;
    struct build_id *build_id;
@@ -839,123 +855,34 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
        xfree (build_id);
        /* Prevent looping on a stripped .debug file.  */
        if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
-         {
--        warning (_("\"%s\": separate debug info file has no debug info"),
-+        warning (_("\"%s\": The separate debug info file has no debug info"),
-                  build_id_name);
+@@ -1400,7 +1968,10 @@ find_separate_debug_file (struct objfile
          xfree (build_id_name);
        }
        else if (build_id_name != NULL)
 -        return build_id_name;
-+        {
++      {
 +        xfree (build_id_filename);
 +        return build_id_name;
 +      }
      }
  
    basename = get_debug_link_info (objfile, &crc32);
-@@ -1385,7 +1927,7 @@ find_separate_debug_file (struct objfile
-   if (basename == NULL)
-     /* There's no separate debug info, hence there's no way we could
-        load it => no warning.  */
--    return NULL;
-+    goto cleanup_return_debugfile;
-   dir = xstrdup (objfile->name);
-@@ -1407,24 +1949,19 @@ find_separate_debug_file (struct objfile
-   if (canon_name && strlen (canon_name) > i)
-     i = strlen (canon_name);
--  debugfile = alloca (strlen (debug_file_directory) + 1
--                      + i
--                      + strlen (DEBUG_SUBDIRECTORY)
--                      + strlen ("/")
--                      + strlen (basename)
--                      + 1);
-+  debugfile = xmalloc (strlen (debug_file_directory) + 1
-+                     + i
-+                     + strlen (DEBUG_SUBDIRECTORY)
-+                     + strlen ("/")
-+                     + strlen (basename)
-+                     + 1);
-   /* First try in the same directory as the original file.  */
-   strcpy (debugfile, dir);
-   strcat (debugfile, basename);
-   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
--    {
--      xfree (basename);
--      xfree (dir);
--      xfree (canon_name);
--      return xstrdup (debugfile);
--    }
-+    goto cleanup_return_debugfile;
-   /* Then try in the subdirectory named DEBUG_SUBDIRECTORY.  */
-   strcpy (debugfile, dir);
-@@ -1433,12 +1970,7 @@ find_separate_debug_file (struct objfile
-   strcat (debugfile, basename);
-   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
--    {
--      xfree (basename);
--      xfree (dir);
--      xfree (canon_name);
--      return xstrdup (debugfile);
--    }
-+    goto cleanup_return_debugfile;
-   /* Then try in the global debugfile directory.  */
-   strcpy (debugfile, debug_file_directory);
-@@ -1447,12 +1979,7 @@ find_separate_debug_file (struct objfile
-   strcat (debugfile, basename);
-   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
--    {
--      xfree (basename);
--      xfree (dir);
--      xfree (canon_name);
--      return xstrdup (debugfile);
--    }
-+    goto cleanup_return_debugfile;
-   /* If the file is in the sysroot, try using its base path in the
-      global debugfile directory.  */
-@@ -1466,20 +1993,18 @@ find_separate_debug_file (struct objfile
-       strcat (debugfile, basename);
-       if (separate_debug_file_exists (debugfile, crc32, objfile->name))
--      {
--        xfree (canon_name);
--        xfree (basename);
--        xfree (dir);
--        return xstrdup (debugfile);
--      }
-+      goto cleanup_return_debugfile;
-     }
+@@ -1501,8 +2072,10 @@ find_separate_debug_file (struct objfile
    
--  if (canon_name)
--    xfree (canon_name);
-+  debugfile = NULL;
+   xfree (debugfile);
+   debugfile = NULL;
 +  debug_print_missing (objfile->name, build_id_filename);
  
-+cleanup_return_debugfile:
+ cleanup_return_debugfile:
 +  xfree (build_id_filename);
-+  xfree (canon_name);
+   xfree (canon_name);
    xfree (basename);
    xfree (dir);
--  return NULL;
-+  return debugfile;
- }
-@@ -4229,4 +4754,16 @@ the global debug-file directory prepende
+@@ -4256,4 +4829,16 @@ each global debug-file-directory compone
                                     NULL,
                                     show_debug_file_directory,
                                     &setlist, &showlist);
-+ 
++
 +   add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
 +                          _("\
 + Set debugging level of the build-id locator."), _("\
@@ -965,13 +892,13 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
 +                          NULL,
 +                          show_build_id_verbose,
 +                          &setlist, &showlist);
-+ 
++
 +   observer_attach_executable_changed (debug_print_executable_changed);
  }
-Index: gdb-6.8.91.20090925/gdb/symfile.h
+Index: gdb-7.0/gdb/symfile.h
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/symfile.h     2009-09-25 09:29:57.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/symfile.h  2009-09-25 09:29:58.000000000 +0200
+--- gdb-7.0.orig/gdb/symfile.h 2009-10-23 00:12:38.000000000 +0200
++++ gdb-7.0/gdb/symfile.h      2009-10-23 00:17:29.000000000 +0200
 @@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen
  struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
  void free_symfile_segment_data (struct symfile_segment_data *data);
@@ -986,10 +913,10 @@ Index: gdb-6.8.91.20090925/gdb/symfile.h
  /* From dwarf2read.c */
  
  extern int dwarf2_has_info (struct objfile *);
-Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.0/gdb/testsuite/lib/gdb.exp
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:57.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp      2009-09-25 09:29:58.000000000 +0200
+--- gdb-7.0.orig/gdb/testsuite/lib/gdb.exp     2009-10-23 00:12:38.000000000 +0200
++++ gdb-7.0/gdb/testsuite/lib/gdb.exp  2009-10-23 00:17:29.000000000 +0200
 @@ -1248,6 +1248,16 @@ proc default_gdb_start { } {
            warning "Couldn't set the width to 0."
        }
@@ -1007,10 +934,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
      return 0;
  }
  
-Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
+Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/mi-support.exp  2009-09-15 20:51:26.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp       2009-09-25 09:29:58.000000000 +0200
+--- gdb-7.0.orig/gdb/testsuite/lib/mi-support.exp      2009-09-15 20:51:26.000000000 +0200
++++ gdb-7.0/gdb/testsuite/lib/mi-support.exp   2009-10-23 00:17:29.000000000 +0200
 @@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
            }
        }
@@ -1028,10 +955,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
  
      detect_async
  
-Index: gdb-6.8.91.20090925/gdb/objfiles.h
+Index: gdb-7.0/gdb/objfiles.h
 ===================================================================
---- gdb-6.8.91.20090925.orig/gdb/objfiles.h    2009-09-25 09:29:57.000000000 +0200
-+++ gdb-6.8.91.20090925/gdb/objfiles.h 2009-09-25 09:38:27.000000000 +0200
+--- gdb-7.0.orig/gdb/objfiles.h        2009-10-23 00:12:38.000000000 +0200
++++ gdb-7.0/gdb/objfiles.h     2009-10-23 00:17:29.000000000 +0200
 @@ -428,6 +428,10 @@ struct objfile
  
  #define OBJF_MAIN (1 << 7)
diff --git a/gdb-7.0-upstream.patch b/gdb-7.0-upstream.patch
new file mode 100644 (file)
index 0000000..4f466c7
--- /dev/null
@@ -0,0 +1,627 @@
+### ./gdb/ChangeLog    6 Oct 2009 16:32:30 -0000       1.10874.2.46
+### ./gdb/ChangeLog    22 Oct 2009 20:31:36 -0000      1.10874.2.52
+## -1,3 +1,33 @@
++2009-10-22  Paul Pluzhnikov  <ppluzhnikov@google.com>
++
++      PR gdb/10819
++      * dwarf2-frame.c (find_cie): Don't call bsearch on empty cie_table.
++      * objfiles.c (find_pc_section): Likewise.
++      (update_section_map): Don't allocate empty table.
++      
++2009-10-19  Don Lee  <don.lee@sunplusct.com>
++
++      * score-tdep.c: Delete some simulator dependent codes.
++      * score-tdep.h: Delete some simulator dependent macro definitions.
++
++2008-10-16  Steven G. Kargl  <kargl@gcc.gnu.org>  (tiny patch)
++
++      * amd64fbsd-nat.c (amd64fbsd_supply_pcb): Conditionally compile in
++      support for pcb->pcb_{fs,ds,es,gs} on FreeBSD older than 8.0.
++
++2009-10-08  Paul Pluzhnikov  <ppluzhnikov@google.com>
++
++      PR gdb/10457
++      * elfread.c (elf_symtab_read): Don't use alloca in a loop.
++      
++2009-10-06  Joel Brobecker  <brobecker@adacore.com>
++
++      * version.in: Set version to 7.0.0.20091006-cvs.
++
++2009-10-06  Joel Brobecker  <brobecker@adacore.com>
++
++      GDB 7.0 released.
++
+ 2009-10-06  Joel Brobecker  <brobecker@adacore.com>
+       * NEWS: Change "Changes since GDB 6.8" into "Changes in GDB 7.0".
+--- ./gdb/amd64fbsd-nat.c      3 Jan 2009 05:57:50 -0000       1.22
++++ ./gdb/amd64fbsd-nat.c      17 Oct 2009 04:19:19 -0000      1.22.4.1
+@@ -95,6 +95,7 @@ static int amd64fbsd32_r_reg_offset[I386
+ #include <sys/types.h>
+ #include <machine/pcb.h>
++#include <osreldate.h>
+ #include "bsd-kvm.h"
+@@ -123,10 +124,12 @@ amd64fbsd_supply_pcb (struct regcache *r
+   regcache_raw_supply (regcache, 13, &pcb->pcb_r13);
+   regcache_raw_supply (regcache, 14, &pcb->pcb_r14);
+   regcache_raw_supply (regcache, 15, &pcb->pcb_r15);
++#if (__FreeBSD_version <  800075)
+   regcache_raw_supply (regcache, AMD64_DS_REGNUM, &pcb->pcb_ds);
+   regcache_raw_supply (regcache, AMD64_ES_REGNUM, &pcb->pcb_es);
+   regcache_raw_supply (regcache, AMD64_FS_REGNUM, &pcb->pcb_fs);
+   regcache_raw_supply (regcache, AMD64_GS_REGNUM, &pcb->pcb_gs);
++#endif
+   return 1;
+ }
+--- ./gdb/dwarf2-frame.c       15 Sep 2009 16:20:53 -0000      1.99
++++ ./gdb/dwarf2-frame.c       22 Oct 2009 20:31:36 -0000      1.99.2.1
+@@ -1525,6 +1525,14 @@ find_cie (struct dwarf2_cie_table *cie_t
+ {
+   struct dwarf2_cie **p_cie;
++  /* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
++     bsearch be non-NULL.  */
++  if (cie_table->entries == NULL)
++    {
++      gdb_assert (cie_table->num_entries == 0);
++      return NULL;
++    }
++
+   p_cie = bsearch (&cie_pointer, cie_table->entries, cie_table->num_entries,
+                    sizeof (cie_table->entries[0]), bsearch_cie_cmp);
+   if (p_cie != NULL)
+--- ./gdb/elfread.c    30 Apr 2009 21:59:03 -0000      1.77
++++ ./gdb/elfread.c    8 Oct 2009 17:42:10 -0000       1.77.4.1
+@@ -535,7 +535,7 @@ elf_symtab_read (struct objfile *objfile
+             if (len > 4 && strcmp (sym->name + len - 4, "@plt") == 0)
+               {
+-                char *base_name = alloca (len - 4 + 1);
++                char *base_name = xmalloc (len - 4 + 1);
+                 struct minimal_symbol *mtramp;
+                 memcpy (base_name, sym->name, len - 4);
+@@ -543,6 +543,7 @@ elf_symtab_read (struct objfile *objfile
+                 mtramp = record_minimal_symbol (base_name, symaddr,
+                                                 mst_solib_trampoline,
+                                                 sym->section, objfile);
++                xfree (base_name);
+                 if (mtramp)
+                   {
+                     MSYMBOL_SIZE (mtramp) = MSYMBOL_SIZE (msym);
+--- ./gdb/objfiles.c   18 Sep 2009 17:39:36 -0000      1.96.2.1
++++ ./gdb/objfiles.c   22 Oct 2009 20:31:36 -0000      1.96.2.2
+@@ -1045,6 +1045,14 @@ update_section_map (struct obj_section *
+     if (insert_section_p (objfile->obfd, s->the_bfd_section))
+       alloc_size += 1;
++  /* This happens on detach/attach (e.g. in gdb.base/attach.exp).  */
++  if (alloc_size == 0)
++    {
++      *pmap = NULL;
++      *pmap_size = 0;
++      return;
++    }
++
+   map = xmalloc (alloc_size * sizeof (*map));
+   i = 0;
+@@ -1105,6 +1113,14 @@ find_pc_section (CORE_ADDR pc)
+       objfiles_changed_p = 0;
+     }
++  /* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
++     bsearch be non-NULL.  */
++  if (sections == NULL)
++    {
++      gdb_assert (num_sections == 0);
++      return NULL;
++    }
++
+   sp = (struct obj_section **) bsearch (&pc, sections, num_sections,
+                                       sizeof (*sections), bsearch_cmp);
+   if (sp != NULL)
+--- ./gdb/score-tdep.c 6 Aug 2009 10:28:38 -0000       1.21
++++ ./gdb/score-tdep.c 19 Oct 2009 09:02:18 -0000      1.21.2.1
+@@ -56,58 +56,6 @@ struct score_frame_cache
+ static int target_mach = bfd_mach_score7;
+-#if WITH_SIM
+-int
+-score_target_can_use_watch (int type, int cnt, int othertype)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_can_use_watch (type, cnt);
+-  return (*current_target.to_can_use_hw_breakpoint) (type, cnt, othertype);
+-}
+-
+-int
+-score_stopped_by_watch (void)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_stopped_by_watch ();
+-  return (*current_target.to_stopped_by_watchpoint) ();
+-}
+-
+-int
+-score_target_insert_watchpoint (CORE_ADDR addr, int len, int type)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_add_watch (addr, len, type);
+-  return (*current_target.to_insert_watchpoint) (addr, len, type); 
+-}
+-
+-int
+-score_target_remove_watchpoint (CORE_ADDR addr, int len, int type)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_del_watch (addr, len, type);
+-  return (*current_target.to_remove_watchpoint) (addr, len, type); 
+-}
+-
+-int
+-score_target_insert_hw_breakpoint (struct gdbarch *gdbarch,
+-                                 struct bp_target_info * bp_tgt)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_add_hardbp (bp_tgt->placed_address);
+-  return (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt);
+-}
+-
+-int
+-score_target_remove_hw_breakpoint (struct gdbarch *gdbarch,
+-                                 struct bp_target_info * bp_tgt)
+-{
+-  if (strcmp (current_target.to_shortname, "sim") == 0)
+-      return soc_gh_del_hardbp (bp_tgt->placed_address);
+-  return (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt); 
+-}
+-#endif
+-
+ static struct type *
+ score_register_type (struct gdbarch *gdbarch, int regnum)
+ {
+--- ./gdb/score-tdep.h 6 Aug 2009 10:28:38 -0000       1.6
++++ ./gdb/score-tdep.h 19 Oct 2009 09:02:18 -0000      1.6.2.1
+@@ -85,68 +85,4 @@ struct pt_regs {
+ typedef struct pt_regs elf_gregset_t;
+-#ifdef WITH_SIM
+-
+-#include <breakpoint.h>
+-
+-int soc_gh_can_use_watch(int type, int cnt);
+-int soc_gh_add_watch(unsigned int addr, int len, int type);
+-int soc_gh_del_watch(unsigned int addr, int len, int type);
+-int soc_gh_stopped_by_watch(void);
+-int soc_gh_add_hardbp(unsigned int addr); 
+-int soc_gh_del_hardbp(unsigned int addr); 
+-
+-int score_target_can_use_watch(int type, int cnt, int ot);
+-int score_stopped_by_watch(void);
+-int score_target_insert_watchpoint (CORE_ADDR addr, int len, int type);
+-int score_target_remove_watchpoint (CORE_ADDR addr, int len, int type);
+-int score_target_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info * bp_tgt);
+-int score_target_remove_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info * bp_tgt);
+-
+-#define TARGET_HAS_HARDWARE_WATCHPOINTS
+-
+-#ifdef TARGET_CAN_USE_HARDWARE_WATCHPOINT
+-#undef TARGET_CAN_USE_HARDWARE_WATCHPOINT
+-
+-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+-    score_target_can_use_watch(type, cnt, ot)
+-#endif
+-
+-#ifdef STOPPED_BY_WATCHPOINT
+-#undef STOPPED_BY_WATCHPOINT
+-
+-#define STOPPED_BY_WATCHPOINT(w) \
+-    score_stopped_by_watch()
+-#endif
+-
+-#ifdef target_insert_watchpoint
+-#undef target_insert_watchpoint
+-
+-#define target_insert_watchpoint(addr, len, type) \
+-    score_target_insert_watchpoint (addr, len, type)
+-#endif
+-
+-#ifdef target_remove_watchpoint
+-#undef target_remove_watchpoint
+-
+-#define target_remove_watchpoint(addr, len, type) \
+-    score_target_remove_watchpoint (addr, len, type)
+-#endif
+-
+-#ifdef target_insert_hw_breakpoint
+-#undef target_insert_hw_breakpoint
+-
+-#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
+-    score_target_insert_hw_breakpoint (gdbarch, bp_tgt)
+-#endif
+-
+-#ifdef target_remove_hw_breakpoint
+-#undef target_remove_hw_breakpoint
+-
+-#define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
+-    score_target_remove_hw_breakpoint (gdbarch, bp_tgt)
+-#endif
+-
+-#endif /* WITH_SIM */
+-
+ #endif /* SCORE_TDEP_H */
+### ./gdb/version.in   6 Oct 2009 16:25:13 -0000       1.2997.2.26
+### ./gdb/version.in   30 Oct 2009 00:00:33 -0000      1.2997.2.51
+## -1 +1 @@
+-7.0
++7.0.0.20091030-cvs
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-11/msg00594.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00233.html
+Subject: [patch] testsuite: bigcore.exp fuzzy PASS message fix
+
+Hi,
+
+seen needlessly fuzzy results:
+       -PASS: gdb.base/bigcore.exp: extract next heap (stop at 50)
+       -PASS: gdb.base/bigcore.exp: extract prev heap (stop at 50)
+       +PASS: gdb.base/bigcore.exp: extract next heap
+       +PASS: gdb.base/bigcore.exp: extract prev heap
+
+but the .exp file just is not patient enough:
+       -Total of 4292375328 (0xffd87320) bytes bytes 53 chunks
+       +Total of 4292422432 (0xffd92b20) bytes bytes 41 chunks
+
+Increased to 200.  Tested on {x86_64,x86_64-m32}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/testsuite/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/bigcore.exp (extract_heap): Set $lim limit to 200.
+
+--- a/gdb/testsuite/gdb.base/bigcore.exp
++++ b/gdb/testsuite/gdb.base/bigcore.exp
+@@ -96,7 +96,7 @@ proc extract_heap { dir } {
+       }
+       -re " = \\(struct list \\*\\) (0x\[0-9a-f\]*).*$gdb_prompt $" {
+           set heap [concat $heap $expect_out(1,string)]
+-          if { $lim >= 50 } {
++          if { $lim >= 200 } {
+               pass "$test (stop at $lim)"
+           } else {
+               incr lim
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-11/msg00593.html
+http://sourceware.org/ml/gdb-cvs/2009-12/msg00013.html
+Subject: [patch] testcase: Fix spurious structs.exp FAILs
+
+Hi,
+
+There were some rare unreproducible fuzzy FAILs seen on i386 (32-bit) inferiors:
+
+ return foo2
+ The location at which to store the function's return value is unknown.
+ If you continue, the return value that you specified will be ignored.
+ Make fun2 return now? (y or n) y
+ #0  main () at /rpmbuild/BUILD/gdb-7.0/gdb/testsuite/gdb.base/structs.c:435
+ 435          L2  = fun2();     
+ (gdb) next
+ 436          L3  = fun3();     
+ (gdb) PASS: gdb.base/structs.exp: return foo<n>; return 2 structs-tf-td
+ p/c L2
+-$4 = {a = -16 '\360', b = 0 '\000'}
+-(gdb) PASS: gdb.base/structs.exp: value foo<n> returned; return 2 structs-tf-td
++$4 = {a = 44 ',', b = 0 '\000'}
++(gdb) FAIL: gdb.base/structs.exp: value foo<n> returned; return 2 structs-tf-td
+
+Apparently
+       a = 44 ',',
+does not match
+       a = \[^,\}\]*,
+which is needed for cases where L2 (L*) remains uninitialized with random
+content.
+
+Alternative patch would just use regex `.*' and the whole new `chartest' and
+`anychar_re' parts can be dropped.
+
+Formerly 9s, now 11s, without the $first optimization it would cost 47s.
+
+Testcase has been run on {x86_64,x86_64-m32}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/testsuite/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix spurious false FAILs.
+       * gdb.base/structs.c (chartest): New.
+       (main): Fill-in chartest.
+       * gdb.base/structs.exp (anychar_re, first): New.
+       (start_structs_test): Import global anychar_re and first.
+       New gdb_test call "set print elements 300; ${testfile}"
+       (start_structs_test <$first>): New block.
+       (any): Import global anychar_re.  New variable ac.  Use ${ac}.
+
+--- a/gdb/testsuite/gdb.base/structs.c
++++ b/gdb/testsuite/gdb.base/structs.c
+@@ -396,6 +396,8 @@ zed ()
+   L18.r = 'Z';
+ }
++static struct { char c; } chartest[256];
++
+ int main()
+ {
+ #ifdef usestubs
+@@ -404,6 +406,10 @@ int main()
+ #endif
+   int i;
++  for (i = 0; i < 256; i++)
++    chartest[i].c = i;
++  chartest[0].c = 0;  /* chartest-done */
++
+   Fun1(foo1); 
+   Fun2(foo2); 
+   Fun3(foo3); 
+--- a/gdb/testsuite/gdb.base/structs.exp
++++ b/gdb/testsuite/gdb.base/structs.exp
+@@ -36,6 +36,9 @@ set testfile "structs"
+ set srcfile ${testfile}.c
+ set binfile ${objdir}/${subdir}/${testfile}
++# Regex matching any value of `char' type like: a = 65 'A'
++set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'}
++
+ # Create and source the file that provides information about the
+ # compiler used to compile the test case.
+@@ -48,6 +51,7 @@ if [get_compiler_info ${binfile}] {
+ # the last TYPES field).  Run the compmiled program up to "main".
+ # Also updates the global "testfile" to reflect the most recent build.
++set first 1
+ proc start_structs_test { types } {
+     global testfile
+     global srcfile
+@@ -56,6 +60,8 @@ proc start_structs_test { types } {
+     global subdir
+     global srcdir
+     global gdb_prompt
++    global anychar_re
++    global first
+     # Create the additional flags
+     set flags "debug"
+@@ -91,6 +97,8 @@ proc start_structs_test { types } {
+           "set print address off; ${testfile}"
+     gdb_test "set width 0" "" \
+           "set width 0; ${testfile}"
++    gdb_test "set print elements 300" "" \
++          "set print elements 300; ${testfile}"
+     # Advance to main
+     if { ![runto_main] } then {
+@@ -100,6 +108,16 @@ proc start_structs_test { types } {
+     # Get the debug format
+     get_debug_format
++    # Limit the slow $anychar_re{256} matching for better performance.
++    if $first {
++      set first 0
++
++      # Verify $anychar_re can match all the values of `char' type.
++      gdb_breakpoint [gdb_get_line_number "chartest-done"]
++      gdb_continue_to_breakpoint "chartest-done" ".*chartest-done.*"
++      gdb_test "p chartest" "= {({c = ${anychar_re}}, ){255}{c = ${anychar_re}}}"
++    }
++
+     # check that at the struct containing all the relevant types is correct
+     set foo_t "type = struct struct[llength ${types}] \{"
+     for {set n 0} {$n<[llength ${types}]} {incr n} {
+@@ -161,26 +179,28 @@ proc zed { n } {
+ }
+ proc any { n } {
+-    return [lindex {
+-      "{}"
+-      "{a = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*}"
+-      "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*, q = \[^,\}\]*}"
+-    } $n]
++    global anychar_re
++    set ac $anychar_re
++    return [lindex [list \
++      "{}" \
++      "{a = ${ac}}" \
++      "{a = ${ac}, b = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}}" \
++      "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}, q = ${ac}}" \
++    ] $n]
+ }
+ # Given N (0..25), return the corresponding alphabetic letter in lower
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-11/msg00573.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00232.html
+Subject: [patch] testsuite fuzzy results fixup: foll-fork.exp
+
+Hi,
+
+one occasional timeout:
+
+ (gdb) PASS: gdb.base/foll-fork.exp: default show parent follow, no catchpoints
+ next 2
+-callee: 9949
+ 25       if (pid == 0) /* set breakpoint here */
+-(gdb) PASS: gdb.base/foll-fork.exp: default parent follow, no catchpoints
++(gdb) callee: 18747
++FAIL: gdb.base/foll-fork.exp: (timeout) default parent follow, no catchpoints
+
+Dropped the strings as there is no "callee" string expectation in
+foll-fork.exp.
+
+
+and with glibc-debuginfo installed one gets:
+
+(gdb) break 39
+Reading in symbols for ../nptl/sysdeps/unix/sysv/linux/fork.c...done.
+Breakpoint 12 at 0x3ad22a4876: file ../nptl/sysdeps/unix/sysv/linux/fork.c, line 39.
+(gdb) FAIL: gdb.base/foll-fork.exp: unpatch child, breakpoint at exit call
++
+Breakpoint 12, __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:158
+158           fresetlockfiles ();
+(gdb) FAIL: gdb.base/foll-fork.exp: unpatch child, unpatched parent breakpoints from child (unknown output)
+
+
+Thanks,
+Jan
+
+
+gdb/testsuite/
+2009-11-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/foll-fork.exp (unpatch child, breakpoint at exit call):
+       Force $srcfile file.
+       * gdb.base/foll-fork.c (callee): Comment out the printf call.
+
+--- a/gdb/testsuite/gdb.base/foll-fork.c
++++ b/gdb/testsuite/gdb.base/foll-fork.c
+@@ -9,7 +9,8 @@ void callee (i)
+   int  i;
+ #endif
+ {
+-  printf("callee: %d\n", i);
++  /* Any output corrupts GDB CLI expect strings.
++     printf("callee: %d\n", i);  */
+ }
+ #ifdef PROTOTYPES
+--- a/gdb/testsuite/gdb.base/foll-fork.exp
++++ b/gdb/testsuite/gdb.base/foll-fork.exp
+@@ -240,7 +240,8 @@ proc catch_fork_unpatch_child {} {
+    # Delete all breakpoints and catchpoints.
+    delete_breakpoints
+-   gdb_test "break $bp_exit" \
++   # Force $srcfile as the current GDB source can be in glibc sourcetree.
++   gdb_test "break $srcfile:$bp_exit" \
+        "Breakpoint .*file .*$srcfile, line .*" \
+        "unpatch child, breakpoint at exit call"
+
+
+
+http://sourceware.org/ml/gdb-patches/2009-11/msg00388.html
+http://sourceware.org/ml/gdb-cvs/2009-11/msg00156.html
+Subject: [patch] Fix crash on reading stabs
+
+Hi,
+
+there is a crash on reading stabs fpc binary:
+       https://bugzilla.redhat.com/show_bug.cgi?id=537837
+
+Program received signal SIGSEGV, Segmentation fault.
+0x000000000069db3d in read_dbx_symtab (objfile=0x1daf5f0) at dbxread.c:1369
+1369              if ((namestring[0] == '-' && namestring[1] == 'l')
+
+(gdb) p/x nlist.n_strx
+$7 = 0xfffffff8
+(gdb) p sizeof(nlist.n_strx)
+$10 = 8
+
+Below the patch context is:
+    namestring = (nlist->n_strx + file_string_table_offset
+                  + DBX_STRINGTAB (objfile));
+
+so IMO the `(unsigned)' cast is excessive as it does not match the expression
+below.  Such cast is there since the GDB "Initial revision" (1999).
+
+`n_strx' type:
+struct internal_nlist
+{
+  unsigned long n_strx;                 /* Index into string table of name.  */
+...
+};
+
+Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu which does not
+mean anything with the default DWARF debug info.  It was hanging for stabs so
+tried just a large part of gdb.base/*.exp on x86_64-m32 - `unix/-gstabs+/-m32'.
+
+If it isn't obviously approved please feel free to drop it as one should not
+use STABS in the first place.
+
+
+Regards,
+Jan
+
+
+gdb/
+2009-11-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * dbxread.c (set_namestring): Remove cast to unsigned.  Check N_STRX
+       overflow.
+
+--- a/gdb/dbxread.c
++++ b/gdb/dbxread.c
+@@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
+ {
+   char *namestring;
+-  if (((unsigned) nlist->n_strx + file_string_table_offset)
+-      >= DBX_STRINGTAB_SIZE (objfile))
++  if (nlist->n_strx + file_string_table_offset
++      >= DBX_STRINGTAB_SIZE (objfile)
++      || nlist->n_strx + file_string_table_offset < nlist->n_strx)
+     {
+       complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
+                symnum);
+
diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch
new file mode 100644 (file)
index 0000000..387dfc1
--- /dev/null
@@ -0,0 +1,290 @@
+--- a/gdb/dwarf2read.c
++++ b/gdb/dwarf2read.c
+@@ -5754,7 +5754,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+ {
+   struct attribute *attr;
+   struct symbol *sym;
+-  CORE_ADDR base = (CORE_ADDR) 0;
++  struct objfile *objfile = cu->objfile;
++  CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
++                               SECT_OFF_TEXT (objfile));
++  /* This is used only for DW_AT_data_member_location entries.  */
++  CORE_ADDR base = 0;
++  int base_p = 0;
+   attr = dwarf2_attr (die, DW_AT_location, cu);
+   if (attr)
+@@ -5763,6 +5768,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+       if (attr_form_is_block (attr))
+       {
+         base = decode_locdesc (DW_BLOCK (attr), cu);
++        base_p = 1;
+       }
+       else if (attr_form_is_section_offset (attr))
+       {
+@@ -5824,12 +5830,15 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+             else
+               dwarf2_complex_location_expr_complaint ();
+-            SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
++            if (!base_p)
++              dwarf2_invalid_attrib_class_complaint
++                ("DW_AT_data_member_location", "common block member");
++            SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset + baseaddr;
+             add_symbol_to_list (sym, &global_symbols);
+           }
+         if (SYMBOL_CLASS (sym) == LOC_STATIC)
+-          SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
++          SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym) - baseaddr);
+         else
+           SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
+         FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
+@@ -5843,7 +5852,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+       sym = new_symbol (die, type, cu);
+       /* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static.  */
+-      SYMBOL_VALUE_ADDRESS (sym) = base;
++      SYMBOL_VALUE_ADDRESS (sym) = base + baseaddr;
+       set_die_type (die, type, cu);
+     }
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -32,6 +32,7 @@
+ #include "exec.h"
+ #include "observer.h"
+ #include "arch-utils.h"
++#include "solib.h"
+ #include <fcntl.h>
+ #include "readline/readline.h"
+@@ -220,6 +221,10 @@ exec_file_attach (char *filename, int from_tty)
+       char *scratch_pathname;
+       int scratch_chan;
+       struct target_section *sections = NULL, *sections_end = NULL;
++      struct target_section *p;
++      int addr_bit;
++      CORE_ADDR mask = CORE_ADDR_MAX;
++      CORE_ADDR displacement;
+       scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
+                  write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
+@@ -288,12 +293,23 @@ exec_file_attach (char *filename, int from_tty)
+                scratch_pathname, bfd_errmsg (bfd_get_error ()));
+       }
++      set_gdbarch_from_file (exec_bfd);
++
++      addr_bit = gdbarch_addr_bit (target_gdbarch);
++      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++      mask = ((CORE_ADDR) 1 << addr_bit) - 1;
++
++      displacement = solib_exec_displacement ();
++      for (p = sections; p < sections_end; p++)
++      {
++        p->addr = (p->addr + displacement) & mask;
++        p->endaddr = (p->endaddr + displacement) & mask;
++      }
++
+       exec_bfd_mtime = bfd_get_mtime (exec_bfd);
+       validate_files ();
+-      set_gdbarch_from_file (exec_bfd);
+-
+       /* Add the executable's sections to the current address spaces'
+        list of sections.  */
+       add_target_sections (sections, sections_end);
+--- a/gdb/gdbtypes.h
++++ b/gdb/gdbtypes.h
+@@ -966,6 +966,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
+ #define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
+ #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)                     \
+@@ -974,6 +975,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define SET_FIELD_PHYSNAME(thisfld, name)                     \
+   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME,                \
+    FIELD_STATIC_PHYSNAME (thisfld) = (name))
++/* This address is unrelocated by the objfile's ANOFFSET.  */
+ #define SET_FIELD_PHYSADDR(thisfld, addr)                     \
+   (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR,                \
+    FIELD_STATIC_PHYSADDR (thisfld) = (addr))
+@@ -989,6 +991,7 @@ extern void allocate_cplus_struct_type (struct type *);
+ #define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
+ #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
++/* 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))
+--- a/gdb/jv-lang.c
++++ b/gdb/jv-lang.c
+@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gdbarch,
+   fields = NULL;
+   nfields--;                  /* First set up dummy "class" field. */
+-  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
++  SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)
++    - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+   TYPE_FIELD_NAME (type, nfields) = "class";
+   TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
+   SET_TYPE_FIELD_PRIVATE (type, nfields);
+@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gdbarch,
+         SET_TYPE_FIELD_PROTECTED (type, i);
+       }
+       if (accflags & 0x0008)  /* ACC_STATIC */
+-      SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
++      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;
+       if (accflags & 0x8000)  /* FIELD_UNRESOLVED_FLAG */
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -1621,7 +1621,10 @@ svr4_exec_displacement (void)
+   if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
+     return entry_point - exec_entry_point (exec_bfd, &current_target);
+-  return svr4_static_exec_displacement ();
++  if (!ptid_equal (inferior_ptid, null_ptid))
++    return svr4_static_exec_displacement ();
++
++  return 0;
+ }
+ /* Relocate the main executable.  This function should be called upon
+@@ -1632,7 +1635,7 @@ svr4_exec_displacement (void)
+ static void
+ svr4_relocate_main_executable (void)
+ {
+-  CORE_ADDR displacement = svr4_exec_displacement ();
++  CORE_ADDR displacement = solib_exec_displacement ();
+   /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
+      difference of in-memory vs. in-file addresses and we could already
+@@ -1975,6 +1978,7 @@ _initialize_svr4_solib (void)
+   svr4_so_ops.free_so = svr4_free_so;
+   svr4_so_ops.clear_solib = svr4_clear_solib;
+   svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
++  svr4_so_ops.exec_displacement = svr4_exec_displacement;
+   svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
+   svr4_so_ops.current_sos = svr4_current_sos;
+   svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -1014,6 +1014,19 @@ solib_create_inferior_hook (int from_tty)
+   ops->solib_create_inferior_hook (from_tty);
+ }
++/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
++
++CORE_ADDR
++solib_exec_displacement (void)
++{
++  struct target_so_ops *ops = solib_ops (target_gdbarch);
++
++  if (ops->exec_displacement != NULL)
++    return (*ops->exec_displacement) ();
++  else
++    return 0;
++}
++
+ /* GLOBAL FUNCTION
+    in_solib_dynsym_resolve_code -- check to see if an address is in
+--- a/gdb/solib.h
++++ b/gdb/solib.h
+@@ -43,6 +43,8 @@ extern int solib_read_symbols (struct so_list *, int);
+ extern void solib_create_inferior_hook (int from_tty);
++extern CORE_ADDR solib_exec_displacement (void);
++
+ /* If ADDR lies in a shared library, return its name.  */
+ extern char *solib_name_from_address (CORE_ADDR);
+--- a/gdb/solist.h
++++ b/gdb/solist.h
+@@ -89,6 +89,9 @@ struct target_so_ops
+     /* Target dependent code to run after child process fork.  */
+     void (*solib_create_inferior_hook) (int from_tty);
++    /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs.  */
++    CORE_ADDR (*exec_displacement) (void);
++
+     /* Do additional symbol handling, lookup, etc. after symbols
+        for a shared object have been loaded.  */
+     void (*special_symbol_handling) (void);
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -873,15 +873,36 @@ syms_from_objfile (struct objfile *objfile,
+      if an error occurs during symbol reading.  */
+   old_chain = make_cleanup_free_objfile (objfile);
+-  /* If ADDRS and OFFSETS are both NULL, put together a dummy address
+-     list.  We now establish the convention that an addr of zero means
+-     no load address was specified. */
++  /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list.  */
++
+   if (! addrs && ! offsets)
+     {
+-      local_addr
+-      = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
+-      make_cleanup (xfree, local_addr);
+-      addrs = local_addr;
++      /* Relocateble files have an exception in default_symfile_offsets which
++       applies only for ADDRS.  But calling solib_exec_displacement is more
++       suitable for OFFSETS.  Fortunately we never need the both
++       functionalities simultaneously and in other cases zeroed ADDRS and
++       zeroed OFFSETS are equivalent.  */
++
++      if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
++      {
++        local_addr
++               = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
++        make_cleanup (xfree, local_addr);
++        addrs = local_addr;
++      }
++      else
++      {
++        CORE_ADDR displacement = 0;
++        int i;
++
++        if (mainline)
++          displacement = solib_exec_displacement ();
++
++        num_offsets = bfd_count_sections (objfile->obfd);
++        offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
++        for (i = 0; i < num_offsets; i++)
++          offsets->offsets[i] = displacement;
++      }
+     }
+   /* Now either addrs or offsets is non-zero.  */
+--- a/gdb/value.c
++++ b/gdb/value.c
+@@ -1890,7 +1890,8 @@ value_static_field (struct type *type, int fieldno)
+   if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
+     {
+       retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
+-                       TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
++                       TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
++                         + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+     }
+   else
+     {
+@@ -1920,7 +1921,8 @@ value_static_field (struct type *type, int fieldno)
+       }
+       if (retval && VALUE_LVAL (retval) == lval_memory)
+       SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
+-                          value_address (retval));
++                          value_address (retval)
++                            - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
+     }
+   return retval;
+ }
diff --git a/gdb-archer-pie.patch b/gdb-archer-pie.patch
new file mode 100644 (file)
index 0000000..0c8aabb
--- /dev/null
@@ -0,0 +1,2647 @@
+http://sourceware.org/gdb/wiki/ProjectArcher
+http://sourceware.org/gdb/wiki/ArcherBranchManagement
+
+archer-jankratochvil-pie-fedora12
+GIT snapshot:
+commit 2ae60b5156d43aabfe5757940eaf7b4370fb05d2
+
+
+diff --git a/gdb/auxv.c b/gdb/auxv.c
+index 7b4ecbe..7df8eb5 100644
+--- a/gdb/auxv.c
++++ b/gdb/auxv.c
+@@ -25,6 +25,7 @@
+ #include "inferior.h"
+ #include "valprint.h"
+ #include "gdb_assert.h"
++#include "gdbcore.h"
+ #include "auxv.h"
+ #include "elf/common.h"
+@@ -33,15 +34,11 @@
+ #include <fcntl.h>
+-/* This function is called like a to_xfer_partial hook, but must be
+-   called with TARGET_OBJECT_AUXV.  It handles access via
+-   /proc/PID/auxv, which is a common method for native targets.  */
++/* This function handles access via /proc/PID/auxv, which is a common method
++   for native targets.  */
+-LONGEST
+-procfs_xfer_auxv (struct target_ops *ops,
+-                enum target_object object,
+-                const char *annex,
+-                gdb_byte *readbuf,
++static LONGEST
++procfs_xfer_auxv (gdb_byte *readbuf,
+                 const gdb_byte *writebuf,
+                 ULONGEST offset,
+                 LONGEST len)
+@@ -50,9 +47,6 @@ procfs_xfer_auxv (struct target_ops *ops,
+   int fd;
+   LONGEST n;
+-  gdb_assert (object == TARGET_OBJECT_AUXV);
+-  gdb_assert (readbuf || writebuf);
+-
+   pathname = xstrprintf ("/proc/%d/auxv", PIDGET (inferior_ptid));
+   fd = open (pathname, writebuf != NULL ? O_WRONLY : O_RDONLY);
+   xfree (pathname);
+@@ -72,6 +66,152 @@ procfs_xfer_auxv (struct target_ops *ops,
+   return n;
+ }
++/* This function handles access via ld.so's symbol `_dl_auxv'.  */
++
++static LONGEST
++ld_so_xfer_auxv (gdb_byte *readbuf,
++               const gdb_byte *writebuf,
++               ULONGEST offset,
++               LONGEST len)
++{
++  struct minimal_symbol *msym;
++  CORE_ADDR data_address, pointer_address;
++  struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
++  size_t ptr_size = TYPE_LENGTH (ptr_type);
++  size_t auxv_pair_size = 2 * ptr_size;
++  gdb_byte *ptr_buf = alloca (ptr_size);
++  LONGEST retval;
++  size_t block;
++
++  msym = lookup_minimal_symbol ("_dl_auxv", NULL, NULL);
++  if (msym == NULL)
++    return -1;
++
++  if (MSYMBOL_SIZE (msym) != ptr_size)
++    return -1;
++
++  /* POINTER_ADDRESS is a location where the `_dl_auxv' variable resides.
++     DATA_ADDRESS is the inferior value present in `_dl_auxv', therefore the
++     real inferior AUXV address.  */
++
++  pointer_address = SYMBOL_VALUE_ADDRESS (msym);
++
++  data_address = read_memory_typed_address (pointer_address, ptr_type);
++
++  /* Possibly still not initialized such as during an inferior startup.  */
++  if (data_address == 0)
++    return -1;
++
++  data_address += offset;
++
++  if (writebuf != NULL)
++    {
++      if (target_write_memory (data_address, writebuf, len) == 0)
++      return len;
++      else
++      return -1;
++    }
++
++  /* Stop if trying to read past the existing AUXV block.  The final AT_NULL
++     was already returned before.  */
++
++  if (offset >= auxv_pair_size)
++    {
++      if (target_read_memory (data_address - auxv_pair_size, ptr_buf,
++                            ptr_size) != 0)
++      return -1;
++
++      if (extract_typed_address (ptr_buf, ptr_type) == AT_NULL)
++      return 0;
++    }
++
++  retval = 0;
++  block = 0x400;
++  gdb_assert (block % auxv_pair_size == 0);
++
++  while (len > 0)
++    {
++      if (block > len)
++      block = len;
++
++      /* Reading sizes smaller than AUXV_PAIR_SIZE is not supported.  Tails
++       unaligned to AUXV_PAIR_SIZE will not be read during a call (they
++       should be completed during next read with new/extended buffer).  */
++
++      block &= -auxv_pair_size;
++      if (block == 0)
++      return retval;
++
++      if (target_read_memory (data_address, readbuf, block) != 0)
++      {
++        if (block <= auxv_pair_size)
++          return retval;
++
++        block = auxv_pair_size;
++        continue;
++      }
++
++      data_address += block;
++      len -= block;
++
++      /* Check terminal AT_NULL.  This function is being called indefinitely
++         being extended its READBUF until it returns EOF (0).  */
++
++      while (block >= auxv_pair_size)
++      {
++        retval += auxv_pair_size;
++
++        if (extract_typed_address (readbuf, ptr_type) == AT_NULL)
++          return retval;
++
++        readbuf += auxv_pair_size;
++        block -= auxv_pair_size;
++      }
++    }
++
++  return retval;
++}
++
++/* This function is called like a to_xfer_partial hook, but must be
++   called with TARGET_OBJECT_AUXV.  It handles access to AUXV.  */
++
++LONGEST
++memory_xfer_auxv (struct target_ops *ops,
++                enum target_object object,
++                const char *annex,
++                gdb_byte *readbuf,
++                const gdb_byte *writebuf,
++                ULONGEST offset,
++                LONGEST len)
++{
++  /* Workaround gdb-7.0 bug where linux_nat_xfer_partial() does
++       inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
++     and current_inferior() assertion fails not finding the LWP->PID.
++     It got fixed post-gdb-7.0 by:
++       Add base multi-executable/process support to GDB.
++       40ff0a289e6165aa930af284df5c52162cb0cd5f
++     by introducing `current_inferior_'.  */
++  struct inferior *inf = find_inferior_pid (ptid_get_pid (inferior_ptid));
++
++  gdb_assert (object == TARGET_OBJECT_AUXV);
++  gdb_assert (readbuf || writebuf);
++
++   /* ld_so_xfer_auxv is the only function safe for virtual executables being
++      executed by valgrind's memcheck.  As using ld_so_xfer_auxv is problematic
++      during inferior startup GDB does call it only for attached processes.  */
++
++  if (inf == NULL || inf->attach_flag != 0)
++    {
++      LONGEST retval;
++
++      retval = ld_so_xfer_auxv (readbuf, writebuf, offset, len);
++      if (retval != -1)
++      return retval;
++    }
++
++  return procfs_xfer_auxv (readbuf, writebuf, offset, len);
++}
++
+ /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
+    Return 0 if *READPTR is already at the end of the buffer.
+    Return -1 if there is insufficient buffer for a whole entry.
+diff --git a/gdb/auxv.h b/gdb/auxv.h
+index 71e6562..87c24ae 100644
+--- a/gdb/auxv.h
++++ b/gdb/auxv.h
+@@ -43,11 +43,7 @@ extern int target_auxv_search (struct target_ops *ops,
+ /* Print the contents of the target's AUXV on the specified file. */
+ extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
+-/* This function is called like a to_xfer_partial hook, but must be
+-   called with TARGET_OBJECT_AUXV.  It handles access via
+-   /proc/PID/auxv, which is a common method for native targets.  */
+-
+-extern LONGEST procfs_xfer_auxv (struct target_ops *ops,
++extern LONGEST memory_xfer_auxv (struct target_ops *ops,
+                                enum target_object object,
+                                const char *annex,
+                                gdb_byte *readbuf,
+diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
+index 0f35101..bffc5a6 100644
+--- a/gdb/breakpoint.c
++++ b/gdb/breakpoint.c
+@@ -4805,7 +4805,8 @@ disable_breakpoints_in_shlibs (void)
+        to insert those breakpoints and fail.  */
+     if (((b->type == bp_breakpoint)
+        || (b->type == bp_hardware_breakpoint)
+-       || (b->type == bp_tracepoint))
++       || (b->type == bp_tracepoint)
++       || b->type == bp_shlib_event)
+       && !loc->shlib_disabled
+ #ifdef PC_SOLIB
+       && PC_SOLIB (loc->address)
+diff --git a/gdb/defs.h b/gdb/defs.h
+index 94674dc..57aaae2 100644
+--- a/gdb/defs.h
++++ b/gdb/defs.h
+@@ -98,7 +98,20 @@
+ /* A byte from the program being debugged.  */
+ typedef bfd_byte gdb_byte;
+-/* An address in the program being debugged.  Host byte order.  */
++/* An address in the program being debugged.  Host byte order.
++
++   Its width is the maximum width of all the supported targets.  That means
++   32-bit target will run on such GDB using 64-bit CORE_ADDR cluttering the
++   bits 32...63 with random data from internal GDB calculations.  GDB currently
++   in general truncates the address width only when it is being presented/used
++   externally (such as by the paddress function).
++
++   FIXME: This is still not right as any GDB internal comparisons (such as >=)
++   of CORE_ADDR do not use the properly truncated width.  As converting all the
++   CORE_ADDR operations to width-aware functions is not feasible the way out
++   could be a width-aware C++ class CORE_ADDR referencing gdbarch as its
++   constructor parameter.  */
++
+ typedef bfd_vma CORE_ADDR;
+ /* The largest CORE_ADDR value.  */
+diff --git a/gdb/exec.c b/gdb/exec.c
+index 455151e..67f40d9 100644
+--- a/gdb/exec.c
++++ b/gdb/exec.c
+@@ -656,8 +656,33 @@ print_section_info (struct target_section_table *t, bfd *abfd)
+   wrap_here ("        ");
+   printf_filtered (_("file type %s.\n"), bfd_get_target (abfd));
+   if (abfd == exec_bfd)
+-    printf_filtered (_("\tEntry point: %s\n"),
+-                     paddress (gdbarch, bfd_get_start_address (abfd)));
++    {
++      bfd_vma displacement = 0;
++
++      for (p = t->sections; p < t->sections_end; p++)
++      {
++        asection *asect = p->the_bfd_section;
++
++        if ((bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD))
++            != (SEC_ALLOC | SEC_LOAD))
++          continue;
++
++        if (bfd_get_section_vma (abfd, asect) <= abfd->start_address
++            && abfd->start_address < bfd_get_section_vma (abfd, asect)
++                                     + bfd_get_section_size (asect))
++          {
++            displacement = p->addr - bfd_get_section_vma (abfd, asect);
++            break;
++          }
++      }
++      if (p == t->sections_end)
++      warning (_("Cannot find section for the entry point of %s.\n"),
++               bfd_get_filename (abfd));
++
++      printf_filtered (_("\tEntry point: %s\n"),
++                     paddress (gdbarch, bfd_get_start_address (abfd)
++                                        + displacement));
++    }
+   for (p = t->sections; p < t->sections_end; p++)
+     {
+       printf_filtered ("\t%s", hex_string_custom (p->addr, wid));
+diff --git a/gdb/infcmd.c b/gdb/infcmd.c
+index fab1892..fc0f05d 100644
+--- a/gdb/infcmd.c
++++ b/gdb/infcmd.c
+@@ -395,22 +395,6 @@ post_create_inferior (struct target_ops *target, int from_tty)
+   /* Now that we know the register layout, retrieve current PC.  */
+   stop_pc = regcache_read_pc (get_current_regcache ());
+-  /* If the solist is global across processes, there's no need to
+-     refetch it here.  */
+-  if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
+-    {
+-      /* Sometimes the platform-specific hook loads initial shared
+-       libraries, and sometimes it doesn't.  Try to do so first, so
+-       that we can add them with the correct value for FROM_TTY.
+-       If we made all the inferior hook methods consistent,
+-       this call could be removed.  */
+-#ifdef SOLIB_ADD
+-      SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
+-#else
+-      solib_add (NULL, from_tty, target, auto_solib_add);
+-#endif
+-    }
+-
+   if (exec_bfd)
+     {
+       /* Create the hooks to handle shared library load and unload
+@@ -418,7 +402,25 @@ post_create_inferior (struct target_ops *target, int from_tty)
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+       SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-      solib_create_inferior_hook ();
++      solib_create_inferior_hook (from_tty);
++#endif
++    }
++
++  /* If the solist is global across processes, there's no need to
++     refetch it here.  */
++  if (exec_bfd && !gdbarch_has_global_solist (target_gdbarch))
++    {
++      /* Sometimes the platform-specific hook loads initial shared
++       libraries, and sometimes it doesn't.  If it doesn't FROM_TTY will be
++       incorrectly 0 but such solib targets should be fixed anyway.  If we
++       made all the inferior hook methods consistent, this call could be
++       removed.  Call it only after the solib target has been initialized by
++       solib_create_inferior_hook.  */
++
++#ifdef SOLIB_ADD
++      SOLIB_ADD (NULL, 0, target, auto_solib_add);
++#else
++      solib_add (NULL, 0, target, auto_solib_add);
+ #endif
+     }
+diff --git a/gdb/infrun.c b/gdb/infrun.c
+index 9d29b15..ed451d5 100644
+--- a/gdb/infrun.c
++++ b/gdb/infrun.c
+@@ -544,7 +544,7 @@ follow_exec (ptid_t pid, char *execd_pathname)
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+   SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-  solib_create_inferior_hook ();
++  solib_create_inferior_hook (0);
+ #endif
+   jit_inferior_created_hook ();
+diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
+index 0907f03..1c18782 100644
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
+@@ -4674,7 +4674,7 @@ linux_xfer_partial (struct target_ops *ops, enum target_object object,
+   LONGEST xfer;
+   if (object == TARGET_OBJECT_AUXV)
+-    return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
++    return memory_xfer_auxv (ops, object, annex, readbuf, writebuf,
+                            offset, len);
+   if (object == TARGET_OBJECT_OSDATA)
+diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
+index 6634703..37770f5 100644
+--- a/gdb/linux-tdep.c
++++ b/gdb/linux-tdep.c
+@@ -18,12 +18,8 @@
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+ #include "defs.h"
+-#include "gdbcore.h"
+ #include "gdbtypes.h"
+ #include "linux-tdep.h"
+-#include "observer.h"
+-
+-#include "elf-bfd.h"
+ /* This function is suitable for architectures that don't
+    extend/override the standard siginfo structure.  */
+@@ -138,30 +134,3 @@ linux_get_siginfo_type (struct gdbarch *gdbarch)
+   return siginfo_type;
+ }
+-
+-/* Observer for the executable_changed event, to check whether the new
+-   exec binary is a PIE (Position Independent Executable) specimen, which
+-   is currently unsupported.  */
+-
+-static void
+-check_is_pie_binary (void)
+-{
+-  Elf_Internal_Ehdr *elf_hdr;
+-
+-  if (!exec_bfd)
+-    return;
+-  else if (bfd_get_flavour (exec_bfd) != bfd_target_elf_flavour)
+-    return;
+-
+-  if (elf_tdata (exec_bfd)->elf_header->e_type == ET_DYN)
+-    warning (_("\
+-The current binary is a PIE (Position Independent Executable), which\n\
+-GDB does NOT currently support.  Most debugger features will fail if used\n\
+-in this session.\n"));
+-}
+-
+-void
+-_initialize_linux_tdep (void)
+-{
+-  observer_attach_executable_changed (check_is_pie_binary);
+-}
+diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
+index 0adb045..ea89331 100644
+--- a/gdb/nto-procfs.c
++++ b/gdb/nto-procfs.c
+@@ -652,7 +652,7 @@ static void
+ procfs_post_attach (pid_t pid)
+ {
+   if (exec_bfd)
+-    solib_create_inferior_hook ();
++    solib_create_inferior_hook (0);
+ }
+ static ptid_t
+@@ -1212,7 +1212,7 @@ procfs_create_inferior (struct target_ops *ops, char *exec_file,
+   if (exec_bfd != NULL
+       || (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
+-    solib_create_inferior_hook ();
++    solib_create_inferior_hook (0);
+ }
+ static void
+diff --git a/gdb/objfiles.c b/gdb/objfiles.c
+index e5442ca..fb0cea9 100644
+--- a/gdb/objfiles.c
++++ b/gdb/objfiles.c
+@@ -544,9 +544,10 @@ free_all_objfiles (void)
+ }
\f
+ /* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
+-   entries in new_offsets.  */
+-void
+-objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
++   entries in new_offsets.  SEPARATE_DEBUG_OBJFILE is not touched here.  */
++
++static void
++objfile_relocate1 (struct objfile *objfile, struct section_offsets *new_offsets)
+ {
+   struct obj_section *s;
+   struct section_offsets *delta =
+@@ -624,6 +625,10 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+     }
+   }
++  if (objfile->psymtabs_addrmap)
++    addrmap_relocate (objfile->psymtabs_addrmap,
++                    ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
++
+   {
+     struct partial_symtab *p;
+@@ -701,6 +706,49 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+       exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
+                               obj_section_addr (s));
+     }
++}
++
++/* Relocate OBJFILE to NEW_OFFSETS.  There should be OBJFILE->NUM_SECTIONS
++   entries in new_offsets.  Process also OBJFILE's SEPARATE_DEBUG_OBJFILE.
++
++   The number and ordering of sections does differ between the two objfiles.
++   Only their names match.  Also the file offsets will differ (objfile being
++   possibly prelinked but separate_debug_objfile is probably not prelinked) but
++   the in-memory absolute address as specified by NEW_OFFSETS must match both
++   files.  */
++
++void
++objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
++{
++  objfile_relocate1 (objfile, new_offsets);
++
++  if (objfile->separate_debug_objfile != NULL)
++    {
++      struct objfile *debug_objfile = objfile->separate_debug_objfile;
++      struct section_addr_info *objfile_addrs;
++      struct section_offsets *new_debug_offsets;
++      int new_debug_num_sections;
++      struct cleanup *my_cleanups;
++
++      objfile_addrs = build_section_addr_info_from_objfile (objfile);
++      my_cleanups = make_cleanup (xfree, objfile_addrs);
++
++      /* Here OBJFILE_ADDRS contain the correct absolute addresses, the
++       relative ones must be already created according to debug_objfile.  */
++
++      addr_info_make_relative (objfile_addrs, debug_objfile->obfd);
++
++      gdb_assert (debug_objfile->num_sections
++                == bfd_count_sections (debug_objfile->obfd));
++      new_debug_offsets = alloca (SIZEOF_N_SECTION_OFFSETS
++                                               (debug_objfile->num_sections));
++      relative_addr_info_to_section_offsets (new_debug_offsets,
++                                           debug_objfile->num_sections,
++                                           objfile_addrs);
++      do_cleanups (my_cleanups);
++
++      objfile_relocate1 (debug_objfile, new_debug_offsets);
++    }
+   /* Relocate breakpoints as necessary, after things are relocated. */
+   breakpoint_re_set ();
+diff --git a/gdb/procfs.c b/gdb/procfs.c
+index b569bac..15829c2 100644
+--- a/gdb/procfs.c
++++ b/gdb/procfs.c
+@@ -4376,7 +4376,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
+ #ifdef NEW_PROC_API
+     case TARGET_OBJECT_AUXV:
+-      return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
++      return memory_xfer_auxv (ops, object, annex, readbuf, writebuf,
+                              offset, len);
+ #endif
+diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
+index 9428d92..3591168 100644
+--- a/gdb/solib-darwin.c
++++ b/gdb/solib-darwin.c
+@@ -277,7 +277,7 @@ darwin_special_symbol_handling (void)
+ /* Shared library startup support.  See documentation in solib-svr4.c  */
+ static void
+-darwin_solib_create_inferior_hook (void)
++darwin_solib_create_inferior_hook (int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   char **bkpt_namep;
+diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
+index b8d5528..002c589 100644
+--- a/gdb/solib-frv.c
++++ b/gdb/solib-frv.c
+@@ -971,7 +971,7 @@ frv_relocate_main_executable (void)
+  */
+ static void
+-frv_solib_create_inferior_hook (void)
++frv_solib_create_inferior_hook (int from_tty)
+ {
+   /* Relocate main executable.  */
+   frv_relocate_main_executable ();
+diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c
+index a0c1cd2..f94f7dc 100644
+--- a/gdb/solib-irix.c
++++ b/gdb/solib-irix.c
+@@ -386,7 +386,7 @@ enable_break (void)
+    SYNOPSIS
+-   void solib_create_inferior_hook ()
++   void solib_create_inferior_hook (int from_tty)
+    DESCRIPTION
+@@ -431,7 +431,7 @@ enable_break (void)
+  */
+ static void
+-irix_solib_create_inferior_hook (void)
++irix_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+diff --git a/gdb/solib-null.c b/gdb/solib-null.c
+index b39ccdb..87f7848 100644
+--- a/gdb/solib-null.c
++++ b/gdb/solib-null.c
+@@ -32,7 +32,7 @@ null_special_symbol_handling (void)
+ }
+ static void
+-null_solib_create_inferior_hook (void)
++null_solib_create_inferior_hook (int from_tty)
+ {
+ }
+diff --git a/gdb/solib-osf.c b/gdb/solib-osf.c
+index c295335..0acc7fb 100644
+--- a/gdb/solib-osf.c
++++ b/gdb/solib-osf.c
+@@ -306,7 +306,7 @@ osf_clear_solib (void)
+    Also, what if child has exit()ed?  Must exit loop somehow.  */
+ static void
+-osf_solib_create_inferior_hook (void)
++osf_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c
+index 637fc1a..16d4010 100644
+--- a/gdb/solib-pa64.c
++++ b/gdb/solib-pa64.c
+@@ -329,7 +329,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
+    with shared libraries mapped shareable.  */
+ static void
+-pa64_solib_create_inferior_hook (void)
++pa64_solib_create_inferior_hook (int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   unsigned int dld_flags, status;
+diff --git a/gdb/solib-som.c b/gdb/solib-som.c
+index 16f00a3..37ac8cd 100644
+--- a/gdb/solib-som.c
++++ b/gdb/solib-som.c
+@@ -182,7 +182,7 @@ struct {
+    means running until the "_start" is called.  */
+ static void
+-som_solib_create_inferior_hook (void)
++som_solib_create_inferior_hook (int from_tty)
+ {
+   enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+   struct minimal_symbol *msymbol;
+diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
+index 9f06fa9..45e7e69 100644
+--- a/gdb/solib-spu.c
++++ b/gdb/solib-spu.c
+@@ -52,25 +52,19 @@
+ static void
+ spu_relocate_main_executable (int spufs_fd)
+ {
+-  struct objfile *objfile;
+-  struct cleanup *old_chain;
+   struct section_offsets *new_offsets;
+   int i;
+-  for (objfile = symfile_objfile;
+-       objfile;
+-       objfile = objfile->separate_debug_objfile)
+-    {
+-      new_offsets = xcalloc (objfile->num_sections,
+-                           sizeof (struct section_offsets));
+-      old_chain = make_cleanup (xfree, new_offsets);
++  if (symfile_objfile == NULL)
++    return;
+-      for (i = 0; i < objfile->num_sections; i++)
+-        new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
++  new_offsets = alloca (symfile_objfile->num_sections
++                      * sizeof (struct section_offsets));
+-      objfile_relocate (objfile, new_offsets);
+-      do_cleanups (old_chain);
+-    }
++  for (i = 0; i < symfile_objfile->num_sections; i++)
++    new_offsets->offsets[i] = SPUADDR (spufs_fd, 0);
++
++  objfile_relocate (symfile_objfile, new_offsets);
+ }
+ /* When running a stand-alone SPE executable, we may need to skip one more
+@@ -370,7 +364,7 @@ spu_enable_break (struct objfile *objfile)
+ /* Create inferior hook.  */
+ static void
+-spu_solib_create_inferior_hook (void)
++spu_solib_create_inferior_hook (int from_tty)
+ {
+   /* Remove all previously installed solib breakpoints.  Both the SVR4
+      code and us will re-install all required breakpoints.  */
+@@ -401,7 +395,7 @@ spu_solib_create_inferior_hook (void)
+     }
+   /* Call SVR4 hook -- this will re-insert the SVR4 solib breakpoints.  */
+-  svr4_so_ops.solib_create_inferior_hook ();
++  svr4_so_ops.solib_create_inferior_hook (from_tty);
+   /* If the inferior is statically linked against libspe, we need to install
+      our own solib breakpoint right now.  Otherwise, it will be installed by
+diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
+index 9b2a470..b2a147d 100644
+--- a/gdb/solib-sunos.c
++++ b/gdb/solib-sunos.c
+@@ -740,7 +740,7 @@ sunos_special_symbol_handling (void)
+  */
+ static void
+-sunos_solib_create_inferior_hook (void)
++sunos_solib_create_inferior_hook (int from_tty)
+ {
+   struct thread_info *tp;
+   struct inferior *inf;
+diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
+index 68aadc0..efbe717 100644
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -50,6 +50,7 @@
+ 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);
+ /* Link map info to include in an allocated so_list entry */
+@@ -599,11 +600,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+ {
+   int arch_size, step, sect_size;
+   long dyn_tag;
+-  CORE_ADDR dyn_ptr, dyn_addr;
++  CORE_ADDR dyn_ptr;
+   gdb_byte *bufend, *bufstart, *buf;
+   Elf32_External_Dyn *x_dynp_32;
+   Elf64_External_Dyn *x_dynp_64;
+   struct bfd_section *sect;
++  struct target_section *target_section;
+   if (abfd == NULL)
+     return 0;
+@@ -619,7 +621,13 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+   sect = bfd_get_section_by_name (abfd, ".dynamic");
+   if (sect == NULL)
+     return 0;
+-  dyn_addr = bfd_section_vma (abfd, sect);
++
++  for (target_section = target_get_section_table (&exec_ops)->sections;
++       target_section < target_get_section_table (&exec_ops)->sections_end;
++       target_section++)
++    if (sect == target_section->the_bfd_section)
++      break;
++  gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
+   /* Read in .dynamic from the BFD.  We will get the actual value
+      from memory later.  */
+@@ -661,7 +669,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
+            CORE_ADDR ptr_addr;
+            ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
+-           ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
++           ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
+            if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
+              dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+            *ptr = dyn_ptr;
+@@ -1258,7 +1266,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
+  */
+ static int
+-enable_break (struct svr4_info *info)
++enable_break (struct svr4_info *info, int from_tty)
+ {
+   struct minimal_symbol *msymbol;
+   char **bkpt_namep;
+@@ -1279,7 +1287,7 @@ enable_break (struct svr4_info *info)
+      mean r_brk has already been relocated.  Assume the dynamic linker
+      is the object containing r_brk.  */
+-  solib_add (NULL, 0, &current_target, auto_solib_add);
++  solib_add (NULL, from_tty, &current_target, auto_solib_add);
+   sym_addr = 0;
+   if (info->debug_base && solib_svr4_r_map (info) != 0)
+     sym_addr = solib_svr4_r_brk (info);
+@@ -1339,6 +1347,11 @@ enable_break (struct svr4_info *info)
+       bfd *tmp_bfd = NULL;
+       struct target_ops *tmp_bfd_target;
+       volatile struct gdb_exception ex;
++      int addr_bit = gdbarch_addr_bit (target_gdbarch);
++      CORE_ADDR mask = CORE_ADDR_MAX;
++
++      if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++      mask = ((CORE_ADDR) 1 << addr_bit) - 1;
+       sym_addr = 0;
+@@ -1404,7 +1417,7 @@ enable_break (struct svr4_info *info)
+         info->debug_loader_name = xstrdup (interp_name);
+         info->debug_loader_offset_p = 1;
+         info->debug_loader_offset = load_addr;
+-        solib_add (NULL, 0, &current_target, auto_solib_add);
++        solib_add (NULL, from_tty, &current_target, auto_solib_add);
+       }
+       /* Record the relocated start and end address of the dynamic linker
+@@ -1414,16 +1427,20 @@ enable_break (struct svr4_info *info)
+       {
+         interp_text_sect_low =
+           bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
++        interp_text_sect_low &= mask;
+         interp_text_sect_high =
+           interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
++        interp_text_sect_high &= mask;
+       }
+       interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
+       if (interp_sect)
+       {
+         interp_plt_sect_low =
+           bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
++        interp_text_sect_low &= mask;
+         interp_plt_sect_high =
+           interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
++        interp_text_sect_high &= mask;
+       }
+       /* Now try to set a breakpoint in the dynamic linker.  */
+@@ -1448,7 +1465,7 @@ enable_break (struct svr4_info *info)
+       if (sym_addr != 0)
+       {
+-        create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr);
++        create_solib_event_breakpoint (target_gdbarch, (load_addr + sym_addr) & mask);
+         xfree (interp_name);
+         return 1;
+       }
+@@ -1517,113 +1534,131 @@ enable_break (struct svr4_info *info)
+ static void
+ svr4_special_symbol_handling (void)
+ {
++  svr4_relocate_main_executable ();
+ }
+-/* Relocate the main executable.  This function should be called upon
+-   stopping the inferior process at the entry point to the program. 
+-   The entry point from BFD is compared to the PC and if they are
+-   different, the main executable is relocated by the proper amount. 
++/* Decide if the objfile needs to be relocated.  As indicated above,
++   we will only be here when execution is stopped at the beginning
++   of the program.  Relocation is necessary if the address at which
++   we are presently stopped differs from the start address stored in
++   the executable AND there's no interpreter section.  The condition
++   regarding the interpreter section is very important because if
++   there *is* an interpreter section, execution will begin there
++   instead.  When there is an interpreter section, the start address
++   is (presumably) used by the interpreter at some point to start
++   execution of the program.
++
++   If there is an interpreter, it is normal for it to be set to an
++   arbitrary address at the outset.  The job of finding it is
++   handled in enable_break().
++
++   So, to summarize, relocations are necessary when there is no
++   interpreter section and the start address obtained from the
++   executable is different from the address at which GDB is
++   currently stopped.
+    
+-   As written it will only attempt to relocate executables which
+-   lack interpreter sections.  It seems likely that only dynamic
+-   linker executables will get relocated, though it should work
+-   properly for a position-independent static executable as well.  */
++   [ The astute reader will note that we also test to make sure that
++     the executable in question has the DYNAMIC flag set.  It is my
++     opinion that this test is unnecessary (undesirable even).  It
++     was added to avoid inadvertent relocation of an executable
++     whose e_type member in the ELF header is not ET_DYN.  There may
++     be a time in the future when it is desirable to do relocations
++     on other types of files as well in which case this condition
++     should either be removed or modified to accomodate the new file
++     type.  (E.g, an ET_EXEC executable which has been built to be
++     position-independent could safely be relocated by the OS if
++     desired.  It is true that this violates the ABI, but the ABI
++     has been known to be bent from time to time.)  - Kevin, Nov 2000. ]
++   */
+-static void
+-svr4_relocate_main_executable (void)
++static CORE_ADDR
++svr4_static_exec_displacement (void)
+ {
+   asection *interp_sect;
+   struct regcache *regcache
+     = get_thread_arch_regcache (inferior_ptid, target_gdbarch);
+   CORE_ADDR pc = regcache_read_pc (regcache);
+-  /* Decide if the objfile needs to be relocated.  As indicated above,
+-     we will only be here when execution is stopped at the beginning
+-     of the program.  Relocation is necessary if the address at which
+-     we are presently stopped differs from the start address stored in
+-     the executable AND there's no interpreter section.  The condition
+-     regarding the interpreter section is very important because if
+-     there *is* an interpreter section, execution will begin there
+-     instead.  When there is an interpreter section, the start address
+-     is (presumably) used by the interpreter at some point to start
+-     execution of the program.
+-
+-     If there is an interpreter, it is normal for it to be set to an
+-     arbitrary address at the outset.  The job of finding it is
+-     handled in enable_break().
+-
+-     So, to summarize, relocations are necessary when there is no
+-     interpreter section and the start address obtained from the
+-     executable is different from the address at which GDB is
+-     currently stopped.
+-     
+-     [ The astute reader will note that we also test to make sure that
+-       the executable in question has the DYNAMIC flag set.  It is my
+-       opinion that this test is unnecessary (undesirable even).  It
+-       was added to avoid inadvertent relocation of an executable
+-       whose e_type member in the ELF header is not ET_DYN.  There may
+-       be a time in the future when it is desirable to do relocations
+-       on other types of files as well in which case this condition
+-       should either be removed or modified to accomodate the new file
+-       type.  (E.g, an ET_EXEC executable which has been built to be
+-       position-independent could safely be relocated by the OS if
+-       desired.  It is true that this violates the ABI, but the ABI
+-       has been known to be bent from time to time.)  - Kevin, Nov 2000. ]
+-     */
+-
+   interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
+   if (interp_sect == NULL 
+       && (bfd_get_file_flags (exec_bfd) & DYNAMIC) != 0
+       && (exec_entry_point (exec_bfd, &exec_ops) != pc))
++    return pc - exec_entry_point (exec_bfd, &exec_ops);
++
++  return 0;
++}
++
++/* We relocate all of the sections by the same amount.  This
++   behavior is mandated by recent editions of the System V ABI. 
++   According to the System V Application Binary Interface,
++   Edition 4.1, page 5-5:
++
++     ...  Though the system chooses virtual addresses for
++     individual processes, it maintains the segments' relative
++     positions.  Because position-independent code uses relative
++     addressesing between segments, the difference between
++     virtual addresses in memory must match the difference
++     between virtual addresses in the file.  The difference
++     between the virtual address of any segment in memory and
++     the corresponding virtual address in the file is thus a
++     single constant value for any one executable or shared
++     object in a given process.  This difference is the base
++     address.  One use of the base address is to relocate the
++     memory image of the program during dynamic linking.
++
++   The same language also appears in Edition 4.0 of the System V
++   ABI and is left unspecified in some of the earlier editions.  */
++
++static CORE_ADDR
++svr4_exec_displacement (void)
++{
++  int found;
++  CORE_ADDR entry_point;
++
++  if (exec_bfd == NULL)
++    return 0;
++
++  if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
++    return entry_point - exec_entry_point (exec_bfd, &current_target);
++
++  return svr4_static_exec_displacement ();
++}
++
++/* Relocate the main executable.  This function should be called upon
++   stopping the inferior process at the entry point to the program. 
++   The entry point from BFD is compared to the AT_ENTRY of AUXV and if they are
++   different, the main executable is relocated by the proper amount.  */
++
++static void
++svr4_relocate_main_executable (void)
++{
++  CORE_ADDR displacement = svr4_exec_displacement ();
++
++  /* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
++     difference of in-memory vs. in-file addresses and we could already
++     relocate the executable at this function to improper address before.  */
++
++  if (symfile_objfile)
+     {
+-      struct cleanup *old_chain;
+       struct section_offsets *new_offsets;
+-      int i, changed;
+-      CORE_ADDR displacement;
+-      
+-      /* It is necessary to relocate the objfile.  The amount to
+-       relocate by is simply the address at which we are stopped
+-       minus the starting address from the executable.
+-
+-       We relocate all of the sections by the same amount.  This
+-       behavior is mandated by recent editions of the System V ABI. 
+-       According to the System V Application Binary Interface,
+-       Edition 4.1, page 5-5:
+-
+-         ...  Though the system chooses virtual addresses for
+-         individual processes, it maintains the segments' relative
+-         positions.  Because position-independent code uses relative
+-         addressesing between segments, the difference between
+-         virtual addresses in memory must match the difference
+-         between virtual addresses in the file.  The difference
+-         between the virtual address of any segment in memory and
+-         the corresponding virtual address in the file is thus a
+-         single constant value for any one executable or shared
+-         object in a given process.  This difference is the base
+-         address.  One use of the base address is to relocate the
+-         memory image of the program during dynamic linking.
+-
+-       The same language also appears in Edition 4.0 of the System V
+-       ABI and is left unspecified in some of the earlier editions.  */
+-
+-      displacement = pc - exec_entry_point (exec_bfd, &exec_ops);
+-      changed = 0;
+-
+-      new_offsets = xcalloc (symfile_objfile->num_sections,
+-                           sizeof (struct section_offsets));
+-      old_chain = make_cleanup (xfree, new_offsets);
++      int i;
++
++      new_offsets = alloca (symfile_objfile->num_sections
++                          * sizeof (*new_offsets));
+       for (i = 0; i < symfile_objfile->num_sections; i++)
+-      {
+-        if (displacement != ANOFFSET (symfile_objfile->section_offsets, i))
+-          changed = 1;
+-        new_offsets->offsets[i] = displacement;
+-      }
++      new_offsets->offsets[i] = displacement;
+-      if (changed)
+-      objfile_relocate (symfile_objfile, new_offsets);
++      objfile_relocate (symfile_objfile, new_offsets);
++    }
++  else if (exec_bfd)
++    {
++      asection *asect;
+-      do_cleanups (old_chain);
++      for (asect = exec_bfd->sections; asect != NULL; asect = asect->next)
++      exec_set_section_address (bfd_get_filename (exec_bfd), asect->index,
++                                bfd_section_vma (exec_bfd, asect)
++                                + displacement);
+     }
+ }
+@@ -1635,7 +1670,7 @@ svr4_relocate_main_executable (void)
+    SYNOPSIS
+-   void svr4_solib_create_inferior_hook ()
++   void svr4_solib_create_inferior_hook (int from_tty)
+    DESCRIPTION
+@@ -1680,7 +1715,7 @@ svr4_relocate_main_executable (void)
+  */
+ static void
+-svr4_solib_create_inferior_hook (void)
++svr4_solib_create_inferior_hook (int from_tty)
+ {
+   struct inferior *inf;
+   struct thread_info *tp;
+@@ -1689,12 +1724,13 @@ svr4_solib_create_inferior_hook (void)
+   info = get_svr4_info (PIDGET (inferior_ptid));
+   /* Relocate the main executable if necessary.  */
+-  svr4_relocate_main_executable ();
++  if (current_inferior ()->attach_flag == 0)
++    svr4_relocate_main_executable ();
+   if (!svr4_have_link_map_offsets ())
+     return;
+-  if (!enable_break (info))
++  if (!enable_break (info, from_tty))
+     return;
+ #if defined(_SCO_DS)
+@@ -1910,8 +1946,19 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
+                      const char *name,
+                      const domain_enum domain)
+ {
+-  if (objfile->obfd == NULL
+-     || scan_dyntag (DT_SYMBOLIC, objfile->obfd, NULL) != 1)
++  bfd *abfd;
++
++  if (objfile == symfile_objfile)
++    abfd = exec_bfd;
++  else
++    {
++      /* OBJFILE should have been passed as the non-debug one.  */
++      gdb_assert (objfile->separate_debug_objfile_backlink == NULL);
++
++      abfd = objfile->obfd;
++    }
++
++  if (abfd == NULL || scan_dyntag (DT_SYMBOLIC, abfd, NULL) != 1)
+     return NULL;
+   return lookup_global_symbol_from_objfile (objfile, name, domain);
+diff --git a/gdb/solib-target.c b/gdb/solib-target.c
+index 07415e4..d160a70 100644
+--- a/gdb/solib-target.c
++++ b/gdb/solib-target.c
+@@ -306,7 +306,7 @@ solib_target_special_symbol_handling (void)
+ }
+ static void
+-solib_target_solib_create_inferior_hook (void)
++solib_target_solib_create_inferior_hook (int from_tty)
+ {
+   /* Nothing needed.  */
+ }
+diff --git a/gdb/solib.c b/gdb/solib.c
+index 3574e62..7ea3663 100644
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -998,7 +998,7 @@ clear_solib (void)
+    SYNOPSIS
+-   void solib_create_inferior_hook ()
++   void solib_create_inferior_hook (int from_tty)
+    DESCRIPTION
+@@ -1008,10 +1008,10 @@ clear_solib (void)
+    SOLIB_CREATE_INFERIOR_HOOK.  */
+ void
+-solib_create_inferior_hook (void)
++solib_create_inferior_hook (int from_tty)
+ {
+   struct target_so_ops *ops = solib_ops (target_gdbarch);
+-  ops->solib_create_inferior_hook();
++  ops->solib_create_inferior_hook (from_tty);
+ }
+ /* GLOBAL FUNCTION
+@@ -1087,7 +1087,6 @@ reload_shared_libraries (char *ignored, int from_tty,
+                        struct cmd_list_element *e)
+ {
+   no_shared_libraries (NULL, from_tty);
+-  solib_add (NULL, from_tty, NULL, auto_solib_add);
+   /* Creating inferior hooks here has two purposes. First, if we reload 
+      shared libraries then the address of solib breakpoint we've computed
+      previously might be no longer valid.  For example, if we forgot to set
+@@ -1102,9 +1101,19 @@ reload_shared_libraries (char *ignored, int from_tty,
+ #ifdef SOLIB_CREATE_INFERIOR_HOOK
+       SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+ #else
+-      solib_create_inferior_hook ();
++      solib_create_inferior_hook (from_tty);
+ #endif
+     }
++
++  /* Sometimes the platform-specific hook loads initial shared
++     libraries, and sometimes it doesn't.  If it doesn't FROM_TTY will be
++     incorrectly 0 but such solib targets should be fixed anyway.  If we
++     made all the inferior hook methods consistent, this call could be
++     removed.  Call it only after the solib target has been initialized by
++     solib_create_inferior_hook.  */
++
++  solib_add (NULL, 0, NULL, auto_solib_add);
++
+   /* We have unloaded and then reloaded debug info for all shared libraries.
+      However, frames may still reference them, for example a frame's 
+      unwinder might still point of DWARF FDE structures that are now freed.
+diff --git a/gdb/solib.h b/gdb/solib.h
+index ccc5b63..abe5e19 100644
+--- a/gdb/solib.h
++++ b/gdb/solib.h
+@@ -41,7 +41,7 @@ extern int solib_read_symbols (struct so_list *, int);
+    addresses to which they are linked, and sufficient information to
+    read in their symbols at a later time.  */
+-extern void solib_create_inferior_hook (void);
++extern void solib_create_inferior_hook (int from_tty);
+ /* If ADDR lies in a shared library, return its name.  */
+diff --git a/gdb/solist.h b/gdb/solist.h
+index 005e8f7..9724fe7 100644
+--- a/gdb/solist.h
++++ b/gdb/solist.h
+@@ -87,7 +87,7 @@ struct target_so_ops
+     void (*clear_solib) (void);
+     /* Target dependent code to run after child process fork.  */
+-    void (*solib_create_inferior_hook) (void);
++    void (*solib_create_inferior_hook) (int from_tty);
+     /* Do additional symbol handling, lookup, etc. after symbols
+        for a shared object have been loaded.  */
+diff --git a/gdb/symfile.c b/gdb/symfile.c
+index c31b72a..6d7fa10 100644
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -536,40 +536,151 @@ place_section (bfd *abfd, asection *sect, void *obj)
+   arg->lowest = start_addr + bfd_get_section_size (sect);
+ }
+-/* Parse the user's idea of an offset for dynamic linking, into our idea
+-   of how to represent it for fast symbol reading.  This is the default
+-   version of the sym_fns.sym_offsets function for symbol readers that
+-   don't need to do anything special.  It allocates a section_offsets table
+-   for the objectfile OBJFILE and stuffs ADDR into all of the offsets.  */
++/* Build (allocate and populate) struct section_addr_info with absolute
++   addresses from OBJFILE->OBFD and OBJFILE->SECTION_OFFSETS.  */
++
++struct section_addr_info *
++build_section_addr_info_from_objfile (struct objfile *objfile)
++{
++  struct target_section *sections = NULL, *sections_end;
++  struct target_section *p;
++  int addr_bit = gdbarch_addr_bit (objfile->gdbarch);
++  CORE_ADDR mask = CORE_ADDR_MAX;
++  struct section_addr_info *retval;
++  struct cleanup *my_cleanups;
++
++  if (build_section_table (objfile->obfd, &sections, &sections_end))
++    error (_("Can't find the file sections in `%s': %s"),
++         bfd_get_filename (objfile->obfd), bfd_errmsg (bfd_get_error ()));
++  my_cleanups = make_cleanup (xfree, sections);
++
++  if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
++    mask = ((CORE_ADDR) 1 << addr_bit) - 1;
++
++  for (p = sections; p < sections_end; p++)
++    {
++      CORE_ADDR baseaddr;
++
++      gdb_assert (p->the_bfd_section->index < objfile->num_sections);
++      baseaddr = ANOFFSET (objfile->section_offsets,
++                         p->the_bfd_section->index);
++
++      p->addr = (p->addr + baseaddr) & mask;
++      p->endaddr = (p->endaddr + baseaddr) & mask;
++    }
++
++  retval = build_section_addr_info_from_section_table (sections, sections_end);
++
++  do_cleanups (my_cleanups);
++
++  return retval;
++}
++
++/* Store struct section_addr_info as prepared (made relative and with SECTINDEX
++   filled-in) by addr_info_make_relative into SECTION_OFFSETS of NUM_SECTIONS
++   entries.  */
+ void
+-default_symfile_offsets (struct objfile *objfile,
+-                       struct section_addr_info *addrs)
++relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
++                                     int num_sections,
++                                     struct section_addr_info *addrs)
+ {
+   int i;
+-  objfile->num_sections = bfd_count_sections (objfile->obfd);
+-  objfile->section_offsets = (struct section_offsets *)
+-    obstack_alloc (&objfile->objfile_obstack,
+-                 SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
+-  memset (objfile->section_offsets, 0,
+-        SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
++  memset (section_offsets, 0, SIZEOF_N_SECTION_OFFSETS (num_sections));
+-  /* Now calculate offsets for section that were specified by the
+-     caller. */
++  /* Now calculate offsets for section that were specified by the caller. */
+   for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+     {
+-      struct other_sections *osp ;
++      struct other_sections *osp;
+-      osp = &addrs->other[i] ;
++      osp = &addrs->other[i];
+       if (osp->addr == 0)
+       continue;
+       /* Record all sections in offsets */
+       /* The section_offsets in the objfile are here filled in using
+          the BFD index. */
+-      (objfile->section_offsets)->offsets[osp->sectindex] = osp->addr;
++      section_offsets->offsets[osp->sectindex] = osp->addr;
++    }
++}
++
++/* Relativize absolute addresses in ADDRS into offsets based on ABFD.  Fill-in
++   also SECTINDEXes there.  */
++
++void
++addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
++{
++  asection *lower_sect;
++  asection *sect;
++  CORE_ADDR lower_offset;
++  int i;
++
++  /* Find lowest loadable section to be used as starting point for
++     continguous sections. FIXME!! won't work without call to find
++     .text first, but this assumes text is lowest section. */
++  lower_sect = bfd_get_section_by_name (abfd, ".text");
++  if (lower_sect == NULL)
++    bfd_map_over_sections (abfd, find_lowest_section, &lower_sect);
++  if (lower_sect == NULL)
++    {
++      warning (_("no loadable sections found in added symbol-file %s"),
++             bfd_get_filename (abfd));
++      lower_offset = 0;
++    }
++  else
++    lower_offset = bfd_section_vma (bfd_get_filename (abfd), lower_sect);
++
++  /* Calculate offsets for the loadable sections.
++     FIXME! Sections must be in order of increasing loadable section
++     so that contiguous sections can use the lower-offset!!!
++
++     Adjust offsets if the segments are not contiguous.
++     If the section is contiguous, its offset should be set to
++     the offset of the highest loadable section lower than it
++     (the loadable section directly below it in memory).
++     this_offset = lower_offset = lower_addr - lower_orig_addr */
++
++  for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
++    {
++      if (addrs->other[i].addr != 0)
++      {
++        sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
++        if (sect)
++          {
++            addrs->other[i].addr -= bfd_section_vma (abfd, sect);
++            lower_offset = addrs->other[i].addr;
++            /* This is the index used by BFD. */
++            addrs->other[i].sectindex = sect->index;
++          }
++        else
++          {
++            warning (_("section %s not found in %s"), addrs->other[i].name,
++                     bfd_get_filename (abfd));
++            addrs->other[i].addr = 0;
++          }
++      }
++      else
++      addrs->other[i].addr = lower_offset;
+     }
++}
++
++/* Parse the user's idea of an offset for dynamic linking, into our idea
++   of how to represent it for fast symbol reading.  This is the default
++   version of the sym_fns.sym_offsets function for symbol readers that
++   don't need to do anything special.  It allocates a section_offsets table
++   for the objectfile OBJFILE and stuffs ADDR into all of the offsets.  */
++
++void
++default_symfile_offsets (struct objfile *objfile,
++                       struct section_addr_info *addrs)
++{
++  objfile->num_sections = bfd_count_sections (objfile->obfd);
++  objfile->section_offsets = (struct section_offsets *)
++    obstack_alloc (&objfile->objfile_obstack,
++                 SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
++  relative_addr_info_to_section_offsets (objfile->section_offsets,
++                                       objfile->num_sections, addrs);
+   /* For relocatable files, all loadable sections will start at zero.
+      The zero is meaningless, so try to pick arbitrary addresses such
+@@ -803,65 +914,8 @@ syms_from_objfile (struct objfile *objfile,
+      We no longer warn if the lowest section is not a text segment (as
+      happens for the PA64 port.  */
+-  if (!mainline && addrs && addrs->other[0].name)
+-    {
+-      asection *lower_sect;
+-      asection *sect;
+-      CORE_ADDR lower_offset;
+-      int i;
+-
+-      /* Find lowest loadable section to be used as starting point for
+-         continguous sections. FIXME!! won't work without call to find
+-       .text first, but this assumes text is lowest section. */
+-      lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
+-      if (lower_sect == NULL)
+-      bfd_map_over_sections (objfile->obfd, find_lowest_section,
+-                             &lower_sect);
+-      if (lower_sect == NULL)
+-      {
+-        warning (_("no loadable sections found in added symbol-file %s"),
+-                 objfile->name);
+-        lower_offset = 0;
+-      }
+-      else
+-      lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
+-
+-      /* Calculate offsets for the loadable sections.
+-       FIXME! Sections must be in order of increasing loadable section
+-       so that contiguous sections can use the lower-offset!!!
+-
+-         Adjust offsets if the segments are not contiguous.
+-         If the section is contiguous, its offset should be set to
+-       the offset of the highest loadable section lower than it
+-       (the loadable section directly below it in memory).
+-       this_offset = lower_offset = lower_addr - lower_orig_addr */
+-
+-        for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
+-          {
+-            if (addrs->other[i].addr != 0)
+-              {
+-                sect = bfd_get_section_by_name (objfile->obfd,
+-                                                addrs->other[i].name);
+-                if (sect)
+-                  {
+-                    addrs->other[i].addr
+-                      -= bfd_section_vma (objfile->obfd, sect);
+-                    lower_offset = addrs->other[i].addr;
+-                    /* This is the index used by BFD. */
+-                    addrs->other[i].sectindex = sect->index ;
+-                  }
+-                else
+-                  {
+-                    warning (_("section %s not found in %s"),
+-                             addrs->other[i].name,
+-                             objfile->name);
+-                    addrs->other[i].addr = 0;
+-                  }
+-              }
+-            else
+-              addrs->other[i].addr = lower_offset;
+-          }
+-    }
++  if (addrs && addrs->other[0].name)
++    addr_info_make_relative (addrs, objfile->obfd);
+   /* Initialize symbol reading routines for this objfile, allow complaints to
+      appear for this new file, and record how verbose to be, then do the
+@@ -959,7 +1013,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+   struct objfile *objfile;
+   struct partial_symtab *psymtab;
+   char *debugfile = NULL;
+-  struct section_addr_info *orig_addrs = NULL;
+   struct cleanup *my_cleanups;
+   const char *name = bfd_get_filename (abfd);
+   const int from_tty = add_flags & SYMFILE_VERBOSE;
+@@ -981,12 +1034,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+     objfile->flags |= OBJF_MAIN;
+   discard_cleanups (my_cleanups);
+-  if (addrs)
+-    {
+-      orig_addrs = copy_section_addr_info (addrs);
+-      make_cleanup_free_section_addr_info (orig_addrs);
+-    }
+-
+   /* We either created a new mapped symbol table, mapped an existing
+      symbol table file which has not had initial symbol reading
+      performed, or need to read an unmapped symbol table. */
+@@ -1033,18 +1080,17 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
+      `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'.  */
+   if (!has_any_debug_symbols (objfile))
+     debugfile = find_separate_debug_file (objfile);
++
+   if (debugfile)
+     {
+-      if (addrs != NULL)
+-      {
+-        objfile->separate_debug_objfile
+-            = symbol_file_add (debugfile, add_flags, orig_addrs, flags);
+-      }
+-      else
+-      {
+-        objfile->separate_debug_objfile
+-            = symbol_file_add (debugfile, add_flags, NULL, flags);
+-      }
++      struct section_addr_info *objfile_addrs;
++
++      objfile_addrs = build_section_addr_info_from_objfile (objfile);
++      make_cleanup (xfree, objfile_addrs);
++
++      objfile->separate_debug_objfile = symbol_file_add (debugfile, add_flags,
++                                                       objfile_addrs, flags);
++
+       objfile->separate_debug_objfile->separate_debug_objfile_backlink
+         = objfile;
+diff --git a/gdb/symfile.h b/gdb/symfile.h
+index bf9d9e7..bff6bd8 100644
+--- a/gdb/symfile.h
++++ b/gdb/symfile.h
+@@ -181,6 +181,16 @@ struct sym_fns
+ };
++extern struct section_addr_info *
++               build_section_addr_info_from_objfile (struct objfile *objfile);
++
++extern void relative_addr_info_to_section_offsets
++  (struct section_offsets *section_offsets, int num_sections,
++   struct section_addr_info *addrs);
++
++extern void addr_info_make_relative (struct section_addr_info *addrs,
++                                   bfd *abfd);
++
+ /* The default version of sym_fns.sym_offsets for readers that don't
+    do anything special.  */
+diff --git a/gdb/symtab.c b/gdb/symtab.c
+index 82e0163..01117e3 100644
+--- a/gdb/symtab.c
++++ b/gdb/symtab.c
+@@ -1449,7 +1449,12 @@ lookup_objfile_from_block (const struct block *block)
+   /* Go through SYMTABS.  */
+   ALL_SYMTABS (obj, s)
+     if (block == BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK))
+-      return obj;
++      {
++      if (obj->separate_debug_objfile_backlink)
++        obj = obj->separate_debug_objfile_backlink;
++
++      return obj;
++      }
+   return NULL;
+ }
+diff --git a/gdb/testsuite/gdb.base/break-interp-lib.c b/gdb/testsuite/gdb.base/break-interp-lib.c
+new file mode 100644
+index 0000000..9ca943e
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp-lib.c
+@@ -0,0 +1,40 @@
++/* 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/>.  */
++
++#include <signal.h>
++#include <unistd.h>
++#include <assert.h>
++#include <stdio.h>
++
++void
++libfunc (const char *action)
++{
++  assert (action != NULL);
++
++  if (strcmp (action, "segv") == 0)
++    raise (SIGSEGV);
++
++  if (strcmp (action, "sleep") == 0)
++    {
++      puts ("sleeping");
++      fflush (stdout);
++
++      sleep (60);
++    }
++
++  assert (0);
++}
+diff --git a/gdb/testsuite/gdb.base/break-interp-main.c b/gdb/testsuite/gdb.base/break-interp-main.c
+new file mode 100644
+index 0000000..e12ec2b
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp-main.c
+@@ -0,0 +1,30 @@
++/* 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/>.  */
++
++#include <assert.h>
++
++extern void libfunc (const char *action);
++
++int
++main (int argc, char **argv)
++{
++  assert (argc == 2);
++
++  libfunc (argv[1]);
++
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/break-interp.exp b/gdb/testsuite/gdb.base/break-interp.exp
+new file mode 100644
+index 0000000..52f460c
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/break-interp.exp
+@@ -0,0 +1,545 @@
++# 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/>.
++
++# This test only works on GNU/Linux.
++if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
++    continue
++}
++
++set test "break-interp"
++set binprefix ${objdir}/${subdir}/${test}
++# Only to get the $interp_system name.
++set srcfile_test "start.c"
++set binfile_test ${test}-test
++set binfile_lib ${objdir}/${subdir}/${test}.so
++set srcfile "${test}-main.c"
++set srcfile_lib "${test}-lib.c"
++
++if [get_compiler_info ${binfile_lib}] {
++    return -1
++}
++
++# Use -soname so that it is listed with " => " by ldd and this testcase makes
++# a copy of ${binfile_lib} for each prelink variant.
++
++if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} {
++    return -1
++}
++
++if {[build_executable ${test}.exp $binfile_test ${srcfile_test} {}] == -1} {
++    return -1
++}
++
++# Return the interpreter filename string.
++# Return "" if no interpreter was found.
++proc section_get {exec section} {
++    global objdir
++    global subdir
++    set tmp "${objdir}/${subdir}/break-interp.interp"
++    set objcopy_program [transform objcopy]
++
++    set command "exec $objcopy_program -O binary --set-section-flags $section=A --change-section-address $section=0 -j $section $exec $tmp"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    if {$result == 1} {
++      return ""
++    }
++    set fi [open $tmp]
++    fconfigure $fi -translation binary
++    set data [read $fi]
++    close $fi
++    #file delete $tmp
++    # .interp has size $len + 1 but .gnu_debuglink contains garbage after \000.
++    set len [string first \000 $data]
++    if {$len < 0} {
++      verbose -log "section $section not found"
++      return ""
++    }
++    set retval [string range $data 0 [expr $len - 1]]
++    verbose -log "section $section is <$retval>"
++    return $retval
++}
++
++# Note: The separate debug info file content build-id/crc32 are not verified
++# contrary to the GDB search algorithm skipping non-matching ones.
++proc system_debug_get {exec} {
++    global debug_root
++
++    set exec_build_id_debug [build_id_debug_filename_get $exec]
++    set debug_base "[file tail $exec].debug"
++    set exec_dir [file dirname $exec]
++
++    # isfile returns 1 even for symlinks to files.
++    set retval $debug_root/$exec_build_id_debug
++    if [file isfile $retval] {
++      return $retval
++    }
++    set retval $exec_dir/$debug_base
++    if [file isfile $retval] {
++      return $retval
++    }
++    set retval $exec_dir/.debug/$debug_base
++    if [file isfile $retval] {
++      return $retval
++    }
++    set retval $debug_root/$exec_dir/$debug_base
++    if [file isfile $retval] {
++      return $retval
++    }
++    return ""
++}
++
++gdb_exit
++gdb_start
++set debug_root ""
++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 debug_root $expect_out(1,string)
++    }
++}
++
++set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp]
++set interp_system_debug [system_debug_get $interp_system]
++verbose -log "$interp_system has debug $interp_system_debug"
++
++proc prelinkNO_run {arg} {
++    set command "exec /usr/sbin/prelink -uN $arg"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    return [list $result $output]
++}
++
++proc prelinkNO {arg {name {}}} {
++    if {$name == ""} {
++      set name [file tail $arg]
++    }
++    set test "unprelink $name"
++    set run [prelinkNO_run $arg]
++    set result [lindex $run 0]
++    set output [lindex $run 1]
++    if {$result == 0 && $output == ""} {
++      verbose -log "$name has been now unprelinked"
++      set run [prelinkNO_run $arg]
++      set result [lindex $run 0]
++      set output [lindex $run 1]
++    }
++    # Last line does miss the trailing \n.
++    if {$result == 1 && [regexp {^(/usr/sbin/prelink: [^ ]* does not have .gnu.prelink_undo section\n?)*$} $output]} {
++      pass $test
++      return 1
++    } else {
++      fail $test
++      return 0
++    }
++}
++
++proc prelinkYES {arg {name ""}} {
++    if {$name == ""} {
++      set name [file tail $arg]
++    }
++    set test "prelink $name"
++    set command "exec /usr/sbin/prelink -qNR --no-exec-shield $arg"
++    verbose -log "command is $command"
++    set result [catch $command output]
++    verbose -log "result is $result"
++    verbose -log "output is $output"
++    if {$result == 0 && $output == ""} {
++      pass $test
++      return 1
++    } else {
++      fail $test
++      return 0
++    }
++}
++
++# Resolve symlinks.
++proc symlink_resolve {file} {
++    set loop 0
++    while {[file type $file] == "link"} {
++      set target [file readlink $file]
++      if {[file pathtype $target] == "relative"} {
++          set src2 [file dirname $file]/$target
++      } else {
++          set src2 $target
++      }
++      verbose -log "Resolved symlink $file targetting $target as $src2"
++      set file $src2
++
++      set loop [expr $loop + 1]
++      if {$loop > 30} {
++          fail "Looping symlink resolution for $file"
++          return ""
++      }
++    }
++    return $file
++}
++
++proc copy {src dest} {
++    set src [symlink_resolve $src]
++    # Test name would contain build-id hash for symlink-unresolved $src.
++    set test "copy [file tail $src] to [file tail $dest]"
++    set command "file copy -force $src $dest"
++    verbose -log "command is $command"
++    if [catch $command] {
++      fail $test
++      return 0
++    } else {
++      pass $test
++      return 1
++    }
++}
++
++proc strip_debug {dest} {
++    set test "strip [file tail $dest]"
++    set strip_program [transform strip]
++    set command "exec $strip_program --strip-debug $dest"
++    verbose -log "command is $command"
++    if [catch $command] {
++      fail $test
++      return 0
++    } else {
++      pass $test
++      return 1
++    }
++}
++
++# `runto' does not check we stopped really at the function we specified.
++proc reach {func command} {
++    global gdb_prompt
++
++    if [gdb_breakpoint $func allow-pending] {
++      set test "reach $func"
++      gdb_test_multiple $command $test {
++          -re "Breakpoint \[0-9\]+, $func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" {
++              pass $test
++          }
++          -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in $func \\(\\)( from .*)?\r\n$gdb_prompt $" { 
++              pass $test
++          }
++      }
++    }
++}
++
++proc test_core {file} {
++    global srcdir subdir gdb_prompt
++
++    set corefile [core_find $file {} "segv"]
++    if {$corefile == ""} {
++      return
++    }
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory" "" "set debug-file-directory for core"
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load $file
++
++    # Do not check the binary filename as it may be truncated.
++    gdb_test "core-file $corefile" "Core was generated by .*\r\n#0 .*" "core loaded"
++
++    # Check there is no "argc=can't compute CFA for this frame".
++    gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "core main bt"
++}
++
++proc test_attach {file} {
++    global board_info
++
++    gdb_exit
++
++    set test "sleep function started"
++
++    set command "${file} sleep"
++    set res [remote_spawn host $command];
++    if { $res < 0 || $res == "" } {
++      perror "Spawning $command failed."
++      fail $test
++      return
++    }
++    set pid [exp_pid -i $res]
++    gdb_expect {
++      -re "sleeping\r\n" {
++          pass $test
++      }
++      eof {
++          fail "$test (eof)"
++          return
++      }
++      timeout {
++          fail "$test (timeout)"
++          return
++      }
++    }
++
++    gdb_exit
++    gdb_start
++    gdb_test "attach $pid" "Attaching to process $pid\r\n.*" "attach"
++    # Check there is no "argc=can't compute CFA for this frame".
++    gdb_test "bt" "#\[0-9\]+ +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#\[0-9\]+ +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "attach main bt"
++    gdb_exit
++
++    remote_exec host "kill -9 $pid"
++}
++
++proc test_ld {file ifmain trynosym} {
++    global srcdir subdir gdb_prompt
++
++    # First test normal `file'-command loaded $FILE with symbols.
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory"
++    gdb_reinitialize_dir $srcdir/$subdir
++    gdb_load $file
++
++    reach "dl_main" "run segv"
++
++    gdb_test "bt" "#0 +\[^\r\n\]*\\mdl_main\\M.*" "dl bt"
++
++    if $ifmain {
++      reach "main" continue
++
++      reach "libfunc" continue
++
++      # Check there is no "argc=can't compute CFA for this frame".
++      gdb_test "bt" "#0 +\[^\r\n\]*\\mlibfunc\\M\[^\r\n\]*\r\n#1 +\[^\r\n\]*\\mmain \\((argc=2,.*)?\\).*" "main bt"
++
++      test_core $file
++
++      test_attach $file
++    }
++
++    if !$trynosym {
++      return
++    }
++
++    global pf_prefix
++    set old_ldprefix $pf_prefix
++    lappend pf_prefix "symbol-less:"
++
++    # Test also `exec-file'-command loaded $FILE - therefore without symbols.
++    # SYMBOL_OBJFILE is not available and only EXEC_BFD must be used.
++
++    gdb_exit
++    gdb_start
++    # Clear it to never find any separate debug infos in $debug_root.
++    gdb_test "set debug-file-directory"
++    gdb_reinitialize_dir $srcdir/$subdir
++
++    # Test no (error) message has been printed by `exec-file'.
++    set escapedfile [string_to_regexp $file]
++    gdb_test "exec-file $file" "exec-file $escapedfile" "load"
++
++    if $ifmain {
++      reach "dl_main" run
++
++      set test "info files"
++      set entrynohex ""
++      gdb_test_multiple $test $test {
++          -re "\r\n\[\t \]*Entry point:\[\t \]*0x(\[0-9a-f\]+)\r\n.*$gdb_prompt $" {
++              set entrynohex $expect_out(1,string) 
++              pass $test
++          }
++      }
++      if {$entrynohex != ""} {
++          gdb_test "break *0x$entrynohex" "" "break at entry point"
++          gdb_test "continue" "\r\nBreakpoint \[0-9\]+, 0x0*$entrynohex in .*" "entry point reached"
++      }
++    } else {
++      # There is no symbol to break at ld.so.  Moreover it can exit with an
++      # error code.
++      gdb_test "run" "Program exited (normally|with code \[0-9\]+)\\." "ld.so exit"
++    }
++
++    set pf_prefix $old_ldprefix
++}
++
++# Create separate binaries for each testcase - to make the possible reported
++# problem reproducible after the whole test run finishes.
++
++set old_ldprefix $pf_prefix
++foreach ldprelink {NO YES} {
++    foreach ldsepdebug {NO IN SEP} {
++      # Skip running the ldsepdebug test if we do not have system separate
++      # debug info available.
++      if {$interp_system_debug == "" && $ldsepdebug == "SEP"} {
++          continue
++      }
++
++      set ldname "LDprelink${ldprelink}debug${ldsepdebug}"
++      set interp $binprefix-$ldname
++
++      # prelink needs to always prelink all the dependencies to do any file
++      # modifications of its files.  ld.so also needs all the dependencies to
++      # be prelinked to omit the relocation process.  In-memory file offsets
++      # are not dependent whether ld.so went the prelink way or through the
++      # relocation process.
++      #
++      # For GDB we are not interested whether prelink succeeds as it is
++      # transparent to GDB.  GDB is being tested for differences of file
++      # offsets vs. in-memory offsets.  So we have to prelink even ld.so for
++      # the BIN modification to happen but we need to restore the original
++      # possibly unprelinked ld.so to test all the combinations for GDB.
++      set interp_saved ${interp}-saved
++
++      set pf_prefix $old_ldprefix
++      lappend pf_prefix "$ldname:"
++
++      if {$ldsepdebug == "NO"} {
++          copy $interp_system $interp
++          # Never call strip-debug before unprelink:
++          # prelink: ...: Section .note.gnu.build-id created after prelinking
++          if ![prelinkNO $interp] {
++              continue
++          }
++          strip_debug $interp
++      } elseif {$ldsepdebug == "IN" && $interp_system_debug == ""} {
++          copy $interp_system $interp
++      } elseif {$ldsepdebug == "IN" && $interp_system_debug != ""} {
++          copy $interp_system $interp
++          copy $interp_system_debug "${interp}.debug"
++          # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
++          if {![prelinkNO $interp] || ![prelinkNO "${interp}.debug"]} {
++              continue
++          }
++          set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
++          set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
++          verbose -log "command is $command"
++          if [catch $command] {
++              setup_xfail *-*-*
++              fail $test
++              continue
++          } else {
++              pass $test
++          }
++      } elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
++          copy $interp_system $interp
++          # eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
++          if ![prelinkNO $interp] {
++              continue
++          }
++          gdb_gnu_strip_debug $interp
++      } elseif {$ldsepdebug == "SEP" && $interp_system_debug != ""} {
++          copy $interp_system $interp
++          copy $interp_system_debug "${interp}.debug"
++      }
++
++      if {$ldsepdebug == "SEP"} {
++          if ![prelinkNO "${interp}.debug"] {
++              continue
++          }
++      } else {
++          file delete "${interp}.debug"
++      }
++
++      if ![prelink$ldprelink $interp] {
++          continue
++      }
++      test_ld $interp 0 [expr {$ldsepdebug == "NO"}]
++
++      if ![copy $interp $interp_saved] {
++          continue
++      }
++      set old_binprefix $pf_prefix
++      foreach binprelink {NO YES} {
++          foreach binsepdebug {NO IN SEP} {
++              foreach binpie {NO YES} {
++                  # This combination is not possible, non-PIE (fixed address)
++                  # binary cannot be prelinked to any (other) address.
++                  if {$binprelink == "YES" && $binpie == "NO"} {
++                      continue
++                  }
++
++                  set binname "BINprelink${binprelink}debug${binsepdebug}pie${binpie}"
++                  set exec $binprefix-$binname
++                  set dir ${exec}.d
++
++                  set pf_prefix $old_binprefix
++                  lappend pf_prefix "$binname:"
++
++                  set opts "additional_flags=-Wl,--dynamic-linker,$interp,-rpath,$dir"
++                  lappend opts "additional_flags=-Wl,$binfile_lib,-rpath,[file dirname $binfile_lib]"
++                  if {$binsepdebug != "NO"} {
++                      lappend opts {debug}
++                  }
++                  if {$binpie == "YES"} {
++                      lappend opts {additional_flags=-fPIE -pie}
++                  }
++                  if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
++                      continue;
++                  }
++                  if {$binsepdebug == "SEP"} {
++                      gdb_gnu_strip_debug $exec
++                      # Just a sanity check.  As gdb_gnu_strip_debug uses the
++                      # "[file dirname $exec]/.debug/[file tail $exec].debug"
++                      # variant delete the higher-priority exec.debug file.
++                      file delete "$exec.debug"
++                  }
++
++                  # Supply a self-sufficent directory $dir with the required
++                  # libraries.  To make an executable properly prelinked all
++                  # its dependencies on libraries must be also prelinked.  If
++                  # some of the system libraries is currently not prelinked
++                  # we have no right to prelink (modify it) at its current
++                  # system place.
++
++                  file delete -force $dir
++                  file mkdir $dir
++
++                  set command "ldd $exec"
++                  set result [catch "exec $command" output]
++                  verbose -log "result of $command is $result"
++                  verbose -log "output of $command is $output"
++                  if {$result != 0 || $output == ""} {
++                      fail $command
++                  } else {
++                      pass $command
++                  }
++
++                  # gdb testsuite will put there also needless -lm.
++                  set test "$command output contains libc"
++                  set libc [regexp -all -inline -line {^.* => (/[^ ]+).*$} $output]
++                  if {[llength $libc] == 0} {
++                      fail $test
++                  } else {
++                      pass $test
++                  }
++
++                  set dests {}
++                  for {set i 1} {$i < [llength $libc]} {incr i 2} {
++                      set abspath [lindex $libc $i]
++                      set dest "$dir/[file tail $abspath]"
++                      copy $abspath $dest
++                      lappend dests $dest
++                  }
++
++                  if {[prelink$binprelink "--dynamic-linker=$interp --ld-library-path=$dir $exec $interp [concat $dests]" $exec]
++                      && [copy $interp_saved $interp]} {
++                      test_ld $exec 1 [expr {$binsepdebug == "NO"}]
++                  }
++              }
++          }
++      }
++
++      file delete $interp_saved
++    }
++}
++set pf_prefix $old_ldprefix
+diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp
+index a1003e1..547a898 100644
+--- a/gdb/testsuite/gdb.base/corefile.exp
++++ b/gdb/testsuite/gdb.base/corefile.exp
+@@ -42,65 +42,12 @@ if [get_compiler_info ${binfile}] {
+     return -1;
+ }
+-# Create a core file named "corefile" rather than just "core", to
+-# avoid problems with sys admin types that like to regularly prune all
+-# files named "core" from the system.
+-#
+-# Arbitrarily try setting the core size limit to "unlimited" since
+-# this does not hurt on systems where the command does not work and
+-# allows us to generate a core on systems where it does.
+-#
+-# Some systems append "core" to the name of the program; others append
+-# the name of the program to "core"; still others (like Linux, as of
+-# May 2003) create cores named "core.PID".  In the latter case, we
+-# could have many core files lying around, and it may be difficult to
+-# tell which one is ours, so let's run the program in a subdirectory.
+-set found 0
+-set coredir "${objdir}/${subdir}/coredir.[getpid]"
+-file mkdir $coredir
+-catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
+-#      remote_exec host "${binfile}"
+-foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
+-    if [remote_file build exists $i] {
+-      remote_exec build "mv $i ${objdir}/${subdir}/corefile"
+-      set found 1
+-    }
+-}
+-# Check for "core.PID".
+-if { $found == 0 } {
+-    set names [glob -nocomplain -directory $coredir core.*]
+-    if {[llength $names] == 1} {
+-        set corefile [file join $coredir [lindex $names 0]]
+-        remote_exec build "mv $corefile ${objdir}/${subdir}/corefile"
+-        set found 1
+-    }
+-}
+-if { $found == 0 } {
+-    # The braindamaged HPUX shell quits after the ulimit -c above
+-    # without executing ${binfile}.  So we try again without the
+-    # ulimit here if we didn't find a core file above.
+-    # Oh, I should mention that any "braindamaged" non-Unix system has
+-    # the same problem. I like the cd bit too, it's really neat'n stuff.
+-    catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
+-    foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
+-      if [remote_file build exists $i] {
+-          remote_exec build "mv $i ${objdir}/${subdir}/corefile"
+-          set found 1
+-      }
+-    }
++set corefile [core_find $binfile {coremmap.data}]
++if {$corefile == ""} {
++    return 0;
+ }
+-# Try to clean up after ourselves. 
+-remote_file build delete [file join $coredir coremmap.data]
+-remote_exec build "rmdir $coredir"
+-    
+-if { $found == 0  } {
+-    warning "can't generate a core file - core tests suppressed - check ulimit -c"
+-    return 0
+-}
+-
+-#
+-# Test that we can simply startup with a "-core=corefile" command line arg
++# Test that we can simply startup with a "-core=$corefile" command line arg
+ # and recognize that the core file is a valid, usable core file.
+ # To do this, we must shutdown the currently running gdb and restart
+ # with the -core args.  We can't use gdb_start because it looks for
+@@ -114,27 +61,27 @@ if { $found == 0  } {
+ gdb_exit
+ if $verbose>1 then {
+-    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile\n"
++    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile\n"
+ }
+ set oldtimeout $timeout
+ set timeout [expr "$timeout + 60"]
+ verbose "Timeout is now $timeout seconds" 2
+-eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$objdir/$subdir/corefile"
++eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS -core=$corefile"
+ expect {
+     -re "Couldn't find .* registers in core file.*$gdb_prompt $" {
+-        fail "args: -core=corefile (couldn't find regs)"
++        fail "args: -core=[file tail $corefile] (couldn't find regs)"
+     }
+     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-      pass "args: -core=corefile"
++      pass "args: -core=[file tail $corefile]"
+     }
+     -re "Core was generated by .*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-      pass "args: -core=corefile (with bad program name)"
++      pass "args: -core=[file tail $corefile] (with bad program name)"
+     }
+     -re ".*registers from core file: File in wrong format.* $" {
+-      fail "args: -core=corefile (could not read registers from core file)"
++      fail "args: -core=[file tail $corefile] (could not read registers from core file)"
+     }
+-    -re ".*$gdb_prompt $"     { fail "args: -core=corefile" }
++    -re ".*$gdb_prompt $"     { fail "args: -core=[file tail $corefile]" }
+     timeout           { fail "(timeout) starting with -core" }
+ }
+@@ -147,22 +94,22 @@ expect {
+ close;
+ if $verbose>1 then {
+-    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
++    send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile\n"
+ }
+-eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
++eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile";
+ expect {
+     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$gdb_prompt $" {
+-      pass "args: execfile -core=corefile"
++      pass "args: execfile -core=[file tail $corefile]"
+     }
+     -re "Core was generated by .*\r\n\#0  .*\(\).*\r\n$gdb_prompt $"   {
+-      pass "args: execfile -core=corefile (with bad program name)"
++      pass "args: execfile -core=[file tail $corefile] (with bad program name)"
+     }
+     -re ".*registers from core file: File in wrong format.* $" {
+-      fail "args: execfile -core=corefile (could not read registers from core file)"
++      fail "args: execfile -core=[file tail $corefile] (could not read registers from core file)"
+     }
+-    -re ".*$gdb_prompt $"     { fail "args: execfile -core=corefile" }
++    -re ".*$gdb_prompt $"     { fail "args: execfile -core=[file tail $corefile]" }
+     timeout           { fail "(timeout) starting with -core" }
+ }
+ set timeout $oldtimeout
+@@ -178,7 +125,7 @@ gdb_load ${binfile}
+ # Test basic corefile recognition via core-file command.
+-send_gdb "core-file $objdir/$subdir/corefile\n"
++send_gdb "core-file $corefile\n"
+ gdb_expect {
+     -re ".* program is being debugged already.*y or n. $" {
+       # gdb_load may connect us to a gdbserver.
+diff --git a/gdb/testsuite/gdb.base/pie-support.c b/gdb/testsuite/gdb.base/pie-support.c
+deleted file mode 100644
+index 63768b9..0000000
+--- a/gdb/testsuite/gdb.base/pie-support.c
++++ /dev/null
+@@ -1,34 +0,0 @@
+-/* 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/>.
+-
+-*/
+-
+-#include <stdio.h>
+-
+-void
+-f1 (int a)
+-{
+-  printf ("a = %d\n", a);
+-}
+-
+-int
+-main (int argc, char *argv[])
+-{
+-  f1 (1);
+-
+-  return 0;
+-}
+diff --git a/gdb/testsuite/gdb.base/pie-support.exp b/gdb/testsuite/gdb.base/pie-support.exp
+deleted file mode 100644
+index 7d118c0..0000000
+--- a/gdb/testsuite/gdb.base/pie-support.exp
++++ /dev/null
+@@ -1,58 +0,0 @@
+-# 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 testfile pie-support
+-set srcfile ${testfile}.c
+-set objfile ${objdir}/${subdir}/${testfile}.o
+-set binfile ${objdir}/${subdir}/${testfile}
+-
+-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {quiet debug additional_flags=-fpie}] != "" } {
+-    untested "Couldn't compile test PIE object file."
+-    return -1
+-}
+-if  { [gdb_compile "${objfile}" "${binfile}" executable {quiet debug additional_flags=-pie}] != "" } {
+-    untested "Couldn't compile test PIE binary."
+-    return -1
+-}
+-
+-# Get things started.
+-
+-gdb_exit
+-gdb_start
+-gdb_reinitialize_dir $srcdir/$subdir
+-
+-if [is_remote host] {
+-  set binfile [remote_download host $binfile]
+-    if { $binfile == "" } {
+-      untested "Couldn't download remote test binary."
+-      return -1
+-    }
+-}
+-
+-# The file command used to kill the remote target.  For the benefit
+-# of the testsuite, preserve this behavior.
+-send_gdb "kill\n"
+-gdb_expect 120 {
+-    -re "Kill the program being debugged. .y or n. $" {
+-      send_gdb "y\n"
+-      verbose "\t\tKilling previous program being debugged"
+-      exp_continue
+-    }
+-    -re "$gdb_prompt $" {
+-      # OK.
+-    }
+-}
+-
+-gdb_test "file $binfile" "current binary is a PIE.*" "correctly detected PIE binary"
+diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.c b/gdb/testsuite/gdb.base/valgrind-db-attach.c
+new file mode 100644
+index 0000000..5faaaac
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/valgrind-db-attach.c
+@@ -0,0 +1,30 @@
++/* 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/>.  */
++
++#include <stdlib.h>
++
++int main()
++{
++  void *p;
++
++  p = malloc (1);
++  if (p == NULL)
++    return 1;
++  free (p);
++  free (p);   /* double-free */
++  return 0;
++}
+diff --git a/gdb/testsuite/gdb.base/valgrind-db-attach.exp b/gdb/testsuite/gdb.base/valgrind-db-attach.exp
+new file mode 100644
+index 0000000..ac06fd3
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/valgrind-db-attach.exp
+@@ -0,0 +1,74 @@
++# Copyright 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++set test valgrind-db-attach
++set srcfile $test.c
++set executable $test
++set binfile ${objdir}/${subdir}/${executable}
++if {[build_executable $test.exp $executable $srcfile {debug}] == -1} {
++    return -1
++}
++
++gdb_exit
++
++# remote_spawn breaks the command on each whitespace despite possible quoting.
++# Use backslash-escaped whitespace there instead:
++
++set db_command "--db-command=$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] %f %p"
++regsub -all " " $db_command "\\ " db_command
++
++set test "spawn valgrind"
++set cmd "valgrind --db-attach=yes $db_command $binfile"
++set res [remote_spawn host $cmd];
++if { $res < 0 || $res == "" } {
++    verbose -log "Spawning $cmd failed."
++    setup_xfail *-*-*
++    fail $test
++    return -1
++}
++pass $test
++# Declare GDB now as running.
++set gdb_spawn_id -1
++
++set test "valgrind started"
++# The trailing '.' differs for different memcheck versions.
++gdb_test_multiple "" $test {
++    -re "Memcheck, a memory error detector\\.?\r\n" {
++      pass $test
++    }
++    -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" {
++      setup_xfail *-*-*
++      fail $test
++      return -1
++    }
++}
++
++set double_free [gdb_get_line_number "double-free"]
++
++gdb_test_multiple "" $test {
++    -re "Invalid free\\(\\) / delete / delete\\\[\\\]\r\n.*: main \\(${srcfile}:$double_free\\)\r\n.*---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
++      send_gdb "y\r"
++    }
++    -re "---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
++      send_gdb "n\r"
++      exp_continue
++    }
++}
++
++# Initialization from default_gdb_start.
++gdb_test "set height 0"
++gdb_test "set width 0"
++
++gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free"
+diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+index 61e1fe4..9109030 100644
+--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
++++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+@@ -55,6 +55,12 @@ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
++# Test also objfile->psymtabs_addrmap relocations for -fPIE -pie builds below.
++# On some targets it may possibly fail but the program is being started only
++# for the PIE build so try it anyway.
++
++runto_main
++
+ # Correct output:
+ #     Line 39 of "../.././gdb/testsuite/gdb.dwarf2/dw2-ranges.S" starts at address 0x4 and ends at 0x8.
+ # Wrong output:
+diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+index d0c3493..fbf9124 100644
+--- a/gdb/testsuite/lib/gdb.exp
++++ b/gdb/testsuite/lib/gdb.exp
+@@ -2778,6 +2778,11 @@ proc gdb_gnu_strip_debug { dest args } {
+       return 1
+     }
++    # Workaround PR binutils/10802:
++    # Preserve the 'x' bit also for PIEs (Position Independent Executables).
++    set perm [file attributes ${dest} -permissions]
++    file attributes ${stripped_file} -permissions $perm
++
+     # Get rid of everything but the debug info, and store result in debug_file
+     # This will be in the .debug subdirectory, see above.
+     set result [catch "exec $strip_to_file_program --only-keep-debug ${dest} -o ${debug_file}" output]
+@@ -2814,7 +2819,12 @@ proc gdb_gnu_strip_debug { dest args } {
+       return 1
+     }
+-   return 0
++    # Workaround PR binutils/10802:
++    # Preserve the 'x' bit also for PIEs (Position Independent Executables).
++    set perm [file attributes ${stripped_file} -permissions]
++    file attributes ${dest} -permissions $perm
++
++    return 0
+ }
+ # Test the output of GDB_COMMAND matches the pattern obtained
+@@ -3043,3 +3053,70 @@ if {[info exists TRANSCRIPT]} {
+     return [uplevel real_send_gdb $args]
+   }
+ }
++
++proc core_find {binfile {deletefiles {}} {arg ""}} {
++    global objdir subdir
++
++    set destcore "$binfile.core"
++    file delete $destcore
++
++    # Create a core file named "$destcore" rather than just "core", to
++    # avoid problems with sys admin types that like to regularly prune all
++    # files named "core" from the system.
++    #
++    # Arbitrarily try setting the core size limit to "unlimited" since
++    # this does not hurt on systems where the command does not work and
++    # allows us to generate a core on systems where it does.
++    #
++    # Some systems append "core" to the name of the program; others append
++    # the name of the program to "core"; still others (like Linux, as of
++    # May 2003) create cores named "core.PID".  In the latter case, we
++    # could have many core files lying around, and it may be difficult to
++    # tell which one is ours, so let's run the program in a subdirectory.
++    set found 0
++    set coredir "${objdir}/${subdir}/coredir.[getpid]"
++    file mkdir $coredir
++    catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile} ${arg}; true) >/dev/null 2>&1\""
++    #      remote_exec host "${binfile}"
++    foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
++      if [remote_file build exists $i] {
++          remote_exec build "mv $i $destcore"
++          set found 1
++      }
++    }
++    # Check for "core.PID".
++    if { $found == 0 } {
++      set names [glob -nocomplain -directory $coredir core.*]
++      if {[llength $names] == 1} {
++          set corefile [file join $coredir [lindex $names 0]]
++          remote_exec build "mv $corefile $destcore"
++          set found 1
++      }
++    }
++    if { $found == 0 } {
++      # The braindamaged HPUX shell quits after the ulimit -c above
++      # without executing ${binfile}.  So we try again without the
++      # ulimit here if we didn't find a core file above.
++      # Oh, I should mention that any "braindamaged" non-Unix system has
++      # the same problem. I like the cd bit too, it's really neat'n stuff.
++      catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
++      foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
++          if [remote_file build exists $i] {
++              remote_exec build "mv $i $destcore"
++              set found 1
++          }
++      }
++    }
++
++    # Try to clean up after ourselves. 
++    foreach deletefile $deletefiles {
++      remote_file build delete [file join $coredir $deletefile]
++    }
++    remote_exec build "rmdir $coredir"
++      
++    if { $found == 0  } {
++      warning "can't generate a core file - core tests suppressed - check ulimit -c"
++      return ""
++    }
++    return $destcore
++}
index c33021234f209a0fe6e2bc6f72032ea04749dfb0..330c50d0aeaba1311e87eb63d91f392e75dea1f6 100644 (file)
@@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
 http://sourceware.org/gdb/wiki/ArcherBranchManagement
 
 GIT snapshot:
-commit 7cb860f03e2437c97239334ebe240d06f45723e0
+commit 16276c1aad1366b92e687c72cab30192280e1906
 
 branch `archer' - the merge of branches:
 archer-tromey-call-frame-cfa
@@ -19,12 +19,12 @@ archer-pmuldoon-next-over-throw
 
 
 diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index f5e1dde..73ee55c 100644
+index 7d53205..319fac4 100644
 --- a/gdb/Makefile.in
 +++ b/gdb/Makefile.in
 @@ -169,6 +169,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
  # Did the user give us a --with-gdb-datadir option?
- GDB_DATADIR_PATH = @GDB_DATADIR_PATH@
+ GDB_DATADIR = @GDB_DATADIR@
  
 +# The argument to --with-pythondir.  If not given, this is
 +# GDB_DATADIR_PATH/python.
@@ -194,10 +194,10 @@ index f5e1dde..73ee55c 100644
  # Dependency tracking.  Most of this is conditional on GNU Make being
  # found by configure; if GNU Make is not found, we fall back to a
 diff --git a/gdb/NEWS b/gdb/NEWS
-index 4fc6dcd..6744b23 100644
+index 8d32c34..f7ea21b 100644
 --- a/gdb/NEWS
 +++ b/gdb/NEWS
-@@ -462,6 +462,13 @@ x86/x86_64 Darwin         i[34567]86-*-darwin*
+@@ -476,6 +476,13 @@ x86/x86_64 Darwin         i[34567]86-*-darwin*
  
  x86_64 MinGW                  x86_64-*-mingw*
  
@@ -290,7 +290,7 @@ index 9b5d2c6..61676a9 100644
    ada_dump_subexp_body,
    ada_evaluate_subexp
 diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
-index 7d8461c..a6d35d7 100644
+index 7d8461c..fc4b3e0 100644
 --- a/gdb/amd64-linux-nat.c
 +++ b/gdb/amd64-linux-nat.c
 @@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum)
@@ -340,7 +340,7 @@ index 7d8461c..a6d35d7 100644
    return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
  }
  
-+/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST.  */
++/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST.  */
 +
 +static void
 +amd64_linux_dr_unset_status (unsigned long mask)
@@ -463,7 +463,7 @@ index 53e7371..d373f8a 100644
 +
  #endif /* BLOCK_H */
 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
-index 811cdfb..b0bf314 100644
+index 811cdfb..0f35101 100644
 --- a/gdb/breakpoint.c
 +++ b/gdb/breakpoint.c
 @@ -61,6 +61,7 @@
@@ -684,14 +684,14 @@ index 811cdfb..b0bf314 100644
 +
 +  /* Find BC_L which is a leftmost element which may affect BUF content.  It is
 +     safe to report lower value but a failure to report higher one.  */
-+
+-  ALL_BP_LOCATIONS (b)
 +  bc_l = 0;
 +  bc_r = bp_location_count;
 +  while (bc_l + 1 < bc_r)
 +    {
 +      struct bp_location *b;
--  ALL_BP_LOCATIONS (b)
++
 +      bc = (bc_l + bc_r) / 2;
 +      b = bp_location[bc];
 +
@@ -1553,7 +1553,7 @@ index 811cdfb..b0bf314 100644
  /* If SHOULD_INSERT is false, do not insert any breakpoint locations
     into the inferior, only remove already-inserted locations that no
     longer should be inserted.  Functions that delete a breakpoint or
-@@ -7777,49 +7951,66 @@ static void
+@@ -7777,49 +7951,78 @@ static void
  update_global_location_list (int should_insert)
  {
    struct breakpoint *b;
@@ -1625,11 +1625,11 @@ index 811cdfb..b0bf314 100644
      {
 -      /* Tells if 'loc' is found amoung the new locations.  If not, we
 +      struct bp_location *old_loc = *old_locp;
++      struct bp_location **loc2p;
 +
 +      /* Tells if 'old_loc' is found amoung the new locations.  If not, we
         have to free it.  */
--      int found_object = 0;
-+      int found_object;
+       int found_object = 0;
        /* Tells if the location should remain inserted in the target.  */
        int keep_in_target = 0;
        int removed = 0;
@@ -1643,13 +1643,24 @@ index 811cdfb..b0bf314 100644
 +      /* Skip LOCP entries which will definitely never be needed.  Stop either
 +       at or being the one matching OLD_LOC.  */
 +      while (locp < bp_location + bp_location_count
-+           && bp_location_compare (*locp, old_loc) < 0)
++           && (*locp)->address < old_loc->address)
 +      locp++;
-+      found_object = locp < bp_location + bp_location_count && *locp == old_loc;
++
++      for (loc2p = locp;
++         (loc2p < bp_location + bp_location_count
++          && (*loc2p)->address == old_loc->address);
++         loc2p++)
++      {
++        if (*loc2p == old_loc)
++          {
++            found_object = 1;
++            break;
++          }
++      }
  
        /* If this location is no longer present, and inserted, look if there's
         maybe a new location at the same address.  If so, mark that one 
-@@ -7827,11 +8018,11 @@ update_global_location_list (int should_insert)
+@@ -7827,11 +8030,11 @@ update_global_location_list (int should_insert)
         don't have a time window where a breakpoint at certain location is not
         inserted.  */
  
@@ -1663,7 +1674,7 @@ index 811cdfb..b0bf314 100644
            {
              /* The location is still present in the location list, and still
                 should be inserted.  Don't do anything.  */
-@@ -7842,37 +8033,46 @@ update_global_location_list (int should_insert)
+@@ -7842,37 +8045,46 @@ update_global_location_list (int should_insert)
              /* The location is either no longer present, or got disabled.
                 See if there's another location at the same address, in which 
                 case we don't need to remove this one from the target.  */
@@ -1685,24 +1696,24 @@ index 811cdfb..b0bf314 100644
 +
 +            if (breakpoint_address_is_meaningful (old_loc->owner))
 +              {
-+                struct bp_location **loc2p;
-+
 +                for (loc2p = locp;
-+                     loc2p < bp_location + bp_location_count
-+                     && (*loc2p)->address == old_loc->address;
++                     (loc2p < bp_location + bp_location_count
++                      && (*loc2p)->address == old_loc->address);
 +                     loc2p++)
 +                  {
 +                    struct bp_location *loc2 = *loc2p;
 +
-+                    /* For the sake of should_be_inserted.
-+                       Duplicates check below will fix up this later.  */
-+                    loc2->duplicate = 0;
-+                    if (loc2 != old_loc && should_be_inserted (loc2))
-+                      {                 
-+                        loc2->inserted = 1;
-+                        loc2->target_info = old_loc->target_info;
-+                        keep_in_target = 1;
-+                        break;
++                      {
++                        /* For the sake of should_be_inserted.
++                           Duplicates check below will fix up this later.  */
++                        loc2->duplicate = 0;
++                        if (loc2 != old_loc && should_be_inserted (loc2))
++                          {
++                            loc2->inserted = 1;
++                            loc2->target_info = old_loc->target_info;
++                            keep_in_target = 1;
++                            break;
++                          }
 +                      }
 +                  }
 +              }
@@ -1728,7 +1739,7 @@ index 811cdfb..b0bf314 100644
                }
              removed = 1;
            }
-@@ -7894,19 +8094,59 @@ update_global_location_list (int should_insert)
+@@ -7894,19 +8106,59 @@ update_global_location_list (int should_insert)
                 longer need to keep this breakpoint.  This is just a
                 heuristic, but if it's wrong, we'll report unexpected SIGTRAP,
                 which is usability issue, but not a correctness problem.  */
@@ -1794,7 +1805,7 @@ index 811cdfb..b0bf314 100644
      }
  
    if (breakpoints_always_inserted_mode () && should_insert
-@@ -8083,6 +8323,7 @@ delete_command (char *arg, int from_tty)
+@@ -8083,6 +8335,7 @@ delete_command (char *arg, int from_tty)
            && b->type != bp_thread_event
            && b->type != bp_overlay_event
            && b->type != bp_longjmp_master
@@ -1802,7 +1813,7 @@ index 811cdfb..b0bf314 100644
            && b->number >= 0)
          {
            breaks_to_delete = 1;
-@@ -8102,6 +8343,7 @@ delete_command (char *arg, int from_tty)
+@@ -8102,6 +8355,7 @@ delete_command (char *arg, int from_tty)
                && b->type != bp_jit_event
                && b->type != bp_overlay_event
                && b->type != bp_longjmp_master
@@ -1810,7 +1821,7 @@ index 811cdfb..b0bf314 100644
                && b->number >= 0)
              delete_breakpoint (b);
          }
-@@ -8404,6 +8646,7 @@ breakpoint_re_set_one (void *bint)
+@@ -8404,6 +8658,7 @@ breakpoint_re_set_one (void *bint)
         reset later by breakpoint_re_set.  */
      case bp_overlay_event:
      case bp_longjmp_master:
@@ -1818,7 +1829,7 @@ index 811cdfb..b0bf314 100644
        delete_breakpoint (b);
        break;
  
-@@ -8427,6 +8670,8 @@ breakpoint_re_set_one (void *bint)
+@@ -8427,6 +8682,8 @@ breakpoint_re_set_one (void *bint)
      case bp_longjmp:
      case bp_longjmp_resume:
      case bp_jit_event:
@@ -1827,7 +1838,7 @@ index 811cdfb..b0bf314 100644
        break;
      }
  
-@@ -8462,6 +8707,7 @@ breakpoint_re_set (void)
+@@ -8462,6 +8719,7 @@ breakpoint_re_set (void)
    create_longjmp_master_breakpoint ("_longjmp");
    create_longjmp_master_breakpoint ("siglongjmp");
    create_longjmp_master_breakpoint ("_siglongjmp");
@@ -1835,7 +1846,7 @@ index 811cdfb..b0bf314 100644
  }
  \f
  /* Reset the thread number of this breakpoint:
-@@ -9327,6 +9573,22 @@ all_tracepoints ()
+@@ -9327,6 +9585,22 @@ all_tracepoints ()
    return tp_vec;
  }
  
@@ -1858,7 +1869,7 @@ index 811cdfb..b0bf314 100644
  \f
  /* This help string is used for the break, hbreak, tbreak and thbreak commands.
     It is defined as a macro to prevent duplication.
-@@ -9850,4 +10112,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
+@@ -9850,4 +10124,5 @@ inferior in all-stop mode, gdb behaves as if always-inserted mode is off."),
    automatic_hardware_breakpoints = 1;
  
    observer_attach_about_to_proceed (breakpoint_about_to_proceed);
@@ -2900,7 +2911,7 @@ index 0000000..49ac420
 +#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1
 +
 diff --git a/gdb/configure b/gdb/configure
-index 99acc2f..a2ea1ae 100755
+index 46e7bfe..ea667f0 100755
 --- a/gdb/configure
 +++ b/gdb/configure
 @@ -676,6 +676,8 @@ REPORT_BUGS_TO
@@ -3015,7 +3026,7 @@ index 99acc2f..a2ea1ae 100755
  
    # Flags needed to compile Python code (taken from python-config --cflags).
 diff --git a/gdb/configure.ac b/gdb/configure.ac
-index b31d9b7..a1969bc 100644
+index 0e42182..e7f97cf 100644
 --- a/gdb/configure.ac
 +++ b/gdb/configure.ac
 @@ -107,6 +107,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
@@ -3102,7 +3113,7 @@ index 62800b8..97d587b 100644
                        { $$ = $1.comp;
                          if ($2) $$ = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, $$, $2); }
 diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
-index d2d8f2e..af0ba28 100644
+index d2d8f2e..db26a01 100644
 --- a/gdb/cp-namespace.c
 +++ b/gdb/cp-namespace.c
 @@ -36,14 +36,17 @@ static struct using_direct *cp_copy_usings (struct using_direct *using,
@@ -3282,7 +3293,7 @@ index d2d8f2e..af0ba28 100644
        if (sym != NULL)
        return sym;
      }
-@@ -320,25 +377,87 @@ lookup_namespace_scope (const char *name,
+@@ -320,25 +377,98 @@ lookup_namespace_scope (const char *name,
    namespace = alloca (scope_len + 1);
    strncpy (namespace, scope, scope_len);
    namespace[scope_len] = '\0';
@@ -3319,6 +3330,16 @@ index d2d8f2e..af0ba28 100644
 +    }
 +}
 +
++/* Used for cleanups to reset the "searched" flag incase
++   of an error.  */
++
++static void
++reset_directive_searched (void *data)
++{
++  struct using_direct *direct = data;
++  direct->searched = 0;
++}
++
 +/* Search for NAME by applying all import statements belonging
 +   to BLOCK which are applicable in SCOPE. If DECLARATION_ONLY the search
 +   is restricted to using declarations.
@@ -3351,11 +3372,11 @@ index d2d8f2e..af0ba28 100644
 -                          const struct block *block,
 -                          const domain_enum domain)
 +cp_lookup_symbol_imports (const char *scope,
-+                            const char *name,
-+                            const struct block *block,
-+                            const domain_enum domain,
-+                            int declaration_only,
-+                            int search_parents)
++                          const char *name,
++                          const struct block *block,
++                          const domain_enum domain,
++                          int declaration_only,
++                          int search_parents)
  {
 -  const struct using_direct *current;
 -  struct symbol *sym;
@@ -3363,6 +3384,7 @@ index d2d8f2e..af0ba28 100644
 +  struct symbol *sym = NULL;
 +  int directive_match;
 +  int current_line;
++  struct cleanup *searched_cleanup;
 +
 +  if(!declaration_only)
 +    /* First, try to find the symbol in the given namespace.  */
@@ -3382,7 +3404,7 @@ index d2d8f2e..af0ba28 100644
       names to the namespace we're searching in, see if we can find a
       match by applying them.  */
  
-@@ -346,39 +465,74 @@ cp_lookup_symbol_namespace (const char *namespace,
+@@ -346,39 +476,78 @@ cp_lookup_symbol_namespace (const char *namespace,
         current != NULL;
         current = current->next)
      {
@@ -3405,6 +3427,8 @@ index d2d8f2e..af0ba28 100644
 -                                          block,
 -                                          domain);
 +        current->searched = 1;
++        searched_cleanup = make_cleanup (reset_directive_searched, current);
++
 +        /* If there is an import of a single declaration, compare the imported
 +           declaration with the sought out name. If there is a match pass
 +           current->import_src as NAMESPACE to direct the search towards the
@@ -3413,23 +3437,25 @@ index d2d8f2e..af0ba28 100644
 +          {
 +          if (strcmp (name, current->declaration) == 0)
 +            {
-+              sym = cp_lookup_symbol_in_namespace (current->import_src,
-+                                                name,
-+                                                block,
-+                                                domain);
++            sym = cp_lookup_symbol_in_namespace (current->import_src,
++                                                 name,
++                                                 block,
++                                                 domain);
 +            }
++
++          current->searched = 0;
++          if (sym)
++            return sym;
++
++          continue;
 +          }
 +         
 +        if (declaration_only)
-+            {
-+              current->searched = 0;
-+              if (sym)
-+                {
-+                  return sym;
-+                } else {
-+                  continue;
-+                }
-+            }
++          {
++          current->searched = 0;
++          discard_cleanups (searched_cleanup);
++          continue;
++          }
 +
 +        if (strcmp (name, current->alias) == 0)
 +          /* If the import is creating an alias and the alias matches the
@@ -3437,26 +3463,25 @@ index d2d8f2e..af0ba28 100644
 +             search towards the aliased namespace */
 +          {
 +          sym = cp_lookup_symbol_in_namespace (scope,
-+                                            current->import_src,
-+                                            block,
-+                                            domain);
++                                               current->import_src,
++                                               block,
++                                               domain);
 +          } else if (strcmp ("", current->alias) == 0){
 +          /* If this import statement creates no alias, pass current->inner as
 +             NAMESPACE to direct the search towards the imported namespace. */
 +            sym = cp_lookup_symbol_imports (current->import_src,
-+                                              name,
-+                                              block,
-+                                              domain,
-+                                              0,
-+                                              0);
++                                            name,
++                                            block,
++                                            domain,
++                                            0,
++                                            0);
 +          }
 +
 +        current->searched = 0;
++        discard_cleanups (searched_cleanup);
++
          if (sym != NULL)
--          return sym;
-+          {
-+            return sym;
-+          }
+           return sym;
        }
      }
  
@@ -3485,7 +3510,7 @@ index d2d8f2e..af0ba28 100644
  }
  
  /* Look up NAME in BLOCK's static block and in global blocks.  If
-@@ -388,17 +542,15 @@ cp_lookup_symbol_namespace (const char *namespace,
+@@ -388,17 +557,15 @@ cp_lookup_symbol_namespace (const char *namespace,
  
  static struct symbol *
  lookup_symbol_file (const char *name,
@@ -3504,7 +3529,7 @@ index d2d8f2e..af0ba28 100644
    if (anonymous_namespace)
      {
        /* Symbols defined in anonymous namespaces have external linkage
-@@ -408,12 +560,11 @@ lookup_symbol_file (const char *name,
+@@ -408,12 +575,11 @@ lookup_symbol_file (const char *name,
        const struct block *global_block = block_global_block (block);
        
        if (global_block != NULL)
@@ -3519,7 +3544,7 @@ index d2d8f2e..af0ba28 100644
      }
  
    if (sym != NULL)
-@@ -434,6 +585,7 @@ lookup_symbol_file (const char *name,
+@@ -434,6 +600,7 @@ lookup_symbol_file (const char *name,
        sym = lookup_possible_namespace_symbol (name);
        if (sym != NULL)
        return sym;
@@ -3527,7 +3552,7 @@ index d2d8f2e..af0ba28 100644
      }
  
    return NULL;
-@@ -461,9 +613,8 @@ cp_lookup_nested_type (struct type *parent_type,
+@@ -461,9 +628,8 @@ cp_lookup_nested_type (struct type *parent_type,
           lookup_symbol_namespace works when looking them up.  */
  
        const char *parent_name = TYPE_TAG_NAME (parent_type);
@@ -3538,7 +3563,7 @@ index d2d8f2e..af0ba28 100644
                                                         block,
                                                         VAR_DOMAIN);
        if (sym == NULL || SYMBOL_CLASS (sym) != LOC_TYPEDEF)
-@@ -709,7 +860,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
+@@ -709,7 +875,7 @@ check_one_possible_namespace_symbol (const char *name, int len,
  
    memcpy (name_copy, name, len);
    name_copy[len] = '\0';
@@ -3547,7 +3572,7 @@ index d2d8f2e..af0ba28 100644
  
    if (sym == NULL)
      {
-@@ -749,7 +900,7 @@ lookup_possible_namespace_symbol (const char *name)
+@@ -749,7 +915,7 @@ lookup_possible_namespace_symbol (const char *name)
        struct symbol *sym;
  
        sym = lookup_block_symbol (get_possible_namespace_block (objfile),
@@ -3832,7 +3857,7 @@ index 7cb016d..bb9e35a 100644
    default_symfile_offsets, /* sym_offsets: parse user's offsets to
                              internal form */
 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
-index f16b6e2..fe328c7 100644
+index 1f98fa5..9e24482 100644
 --- a/gdb/doc/gdb.texinfo
 +++ b/gdb/doc/gdb.texinfo
 @@ -959,8 +959,10 @@ Connect to process ID @var{number}, as with the @code{attach} command.
@@ -3865,7 +3890,7 @@ index f16b6e2..fe328c7 100644
  @c resolve the situation of these eventually
  @item -tui
  @cindex @code{--tui}
-@@ -18650,7 +18662,7 @@ command:
+@@ -18660,7 +18672,7 @@ command:
  @table @code
  @kindex source
  @cindex execute commands from a file
@@ -3874,7 +3899,7 @@ index f16b6e2..fe328c7 100644
  Execute the command file @var{filename}.
  @end table
  
-@@ -18667,6 +18679,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays
+@@ -18677,6 +18689,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays
  each command as it is executed.  The option must be given before
  @var{filename}, and is interpreted as part of the filename anywhere else.
  
@@ -3886,7 +3911,7 @@ index f16b6e2..fe328c7 100644
  Commands that would ask for confirmation if used interactively proceed
  without asking when used in a command file.  Many @value{GDBN} commands that
  normally print messages to say what they are doing omit the messages
-@@ -18928,8 +18945,6 @@ containing @code{end}.  For example:
+@@ -18938,8 +18955,6 @@ containing @code{end}.  For example:
  
  @smallexample
  (@value{GDBP}) python
@@ -3895,7 +3920,7 @@ index f16b6e2..fe328c7 100644
  >print 23
  >end
  23
-@@ -18942,6 +18957,14 @@ in a Python script.  This can be controlled using @code{maint set
+@@ -18952,6 +18967,14 @@ in a Python script.  This can be controlled using @code{maint set
  python print-stack}: if @code{on}, the default, then Python stack
  printing is enabled; if @code{off}, then Python stack printing is
  disabled.
@@ -3910,7 +3935,7 @@ index f16b6e2..fe328c7 100644
  @end table
  
  @node Python API
-@@ -18949,6 +18972,14 @@ disabled.
+@@ -18959,6 +18982,14 @@ disabled.
  @cindex python api
  @cindex programming in python
  
@@ -3925,7 +3950,7 @@ index f16b6e2..fe328c7 100644
  @cindex python stdout
  @cindex python pagination
  At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
-@@ -18961,13 +18992,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
+@@ -18971,13 +19002,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
  * Basic Python::                Basic Python Functions.
  * Exception Handling::
  * Auto-loading::                Automatically loading Python code.
@@ -3944,7 +3969,7 @@ index f16b6e2..fe328c7 100644
  * Frames In Python::            Acessing inferior stack frames from Python.
  @end menu
  
-@@ -18994,6 +19029,12 @@ command as having originated from the user invoking it interactively.
+@@ -19004,6 +19039,12 @@ command as having originated from the user invoking it interactively.
  It must be a boolean value.  If omitted, it defaults to @code{False}.
  @end defun
  
@@ -3957,7 +3982,7 @@ index f16b6e2..fe328c7 100644
  @findex gdb.parameter
  @defun parameter parameter
  Return the value of a @value{GDBN} parameter.  @var{parameter} is a
-@@ -19010,6 +19051,7 @@ a Python value of the appropriate type, and returned.
+@@ -19020,6 +19061,7 @@ a Python value of the appropriate type, and returned.
  @defun history number
  Return a value from @value{GDBN}'s value history (@pxref{Value
  History}).  @var{number} indicates which history element to return.
@@ -3965,7 +3990,7 @@ index f16b6e2..fe328c7 100644
  If @var{number} is negative, then @value{GDBN} will take its absolute value
  and count backward from the last element (i.e., the most recent element) to
  find the value to return.  If @var{number} is zero, then @value{GDBN} will
-@@ -19021,6 +19063,28 @@ If no exception is raised, the return value is always an instance of
+@@ -19031,6 +19073,28 @@ If no exception is raised, the return value is always an instance of
  @code{gdb.Value} (@pxref{Values From Inferior}).
  @end defun
  
@@ -3994,7 +4019,7 @@ index f16b6e2..fe328c7 100644
  @findex gdb.write
  @defun write string
  Print a string to @value{GDBN}'s paginated standard output stream.
-@@ -19035,6 +19099,11 @@ Flush @value{GDBN}'s paginated standard output stream.  Flushing
+@@ -19045,6 +19109,11 @@ Flush @value{GDBN}'s paginated standard output stream.  Flushing
  function.
  @end defun
  
@@ -4006,7 +4031,7 @@ index f16b6e2..fe328c7 100644
  @node Exception Handling
  @subsubsection Exception Handling
  @cindex python exceptions
-@@ -19171,6 +19240,13 @@ The type of this @code{gdb.Value}.  The value of this attribute is a
+@@ -19181,6 +19250,13 @@ The type of this @code{gdb.Value}.  The value of this attribute is a
  The following methods are provided:
  
  @table @code
@@ -4020,7 +4045,7 @@ index f16b6e2..fe328c7 100644
  @defmethod Value dereference
  For pointer data types, this method returns a new @code{gdb.Value} object
  whose contents is the object pointed to by the pointer.  For example, if
-@@ -19242,6 +19318,9 @@ module:
+@@ -19252,6 +19328,9 @@ module:
  This function looks up a type by name.  @var{name} is the name of the
  type to look up.  It must be a string.
  
@@ -4030,7 +4055,7 @@ index f16b6e2..fe328c7 100644
  Ordinarily, this function will return an instance of @code{gdb.Type}.
  If the named type cannot be found, it will throw an exception.
  @end defun
-@@ -19294,6 +19373,12 @@ This is @code{True} if the field is artificial, usually meaning that
+@@ -19304,6 +19383,12 @@ This is @code{True} if the field is artificial, usually meaning that
  it was provided by the compiler and not the user.  This attribute is
  always provided, and is @code{False} if the field is not artificial.
  
@@ -4043,7 +4068,7 @@ index f16b6e2..fe328c7 100644
  @item bitsize
  If the field is packed, or is a bitfield, then this will have a
  non-zero value, which is the size of the field in bits.  Otherwise,
-@@ -19346,7 +19431,7 @@ If the type does not have a target, this method will throw an
+@@ -19356,7 +19441,7 @@ If the type does not have a target, this method will throw an
  exception.
  @end defmethod
  
@@ -4052,7 +4077,7 @@ index f16b6e2..fe328c7 100644
  If this @code{gdb.Type} is an instantiation of a template, this will
  return a new @code{gdb.Type} which represents the type of the
  @var{n}th template argument.
-@@ -19354,7 +19439,8 @@ return a new @code{gdb.Type} which represents the type of the
+@@ -19364,7 +19449,8 @@ return a new @code{gdb.Type} which represents the type of the
  If this @code{gdb.Type} is not a template type, this will throw an
  exception.  Ordinarily, only C@t{++} code will have template types.
  
@@ -4062,7 +4087,7 @@ index f16b6e2..fe328c7 100644
  @end defmethod
  @end table
  
-@@ -19708,6 +19794,121 @@ import gdb.libstdcxx.v6
+@@ -19718,6 +19804,121 @@ import gdb.libstdcxx.v6
  gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
  @end smallexample
  
@@ -4184,7 +4209,7 @@ index f16b6e2..fe328c7 100644
  @node Commands In Python
  @subsubsection Commands In Python
  
-@@ -19960,6 +20161,135 @@ registration of the command with @value{GDBN}.  Depending on how the
+@@ -19970,6 +20171,135 @@ registration of the command with @value{GDBN}.  Depending on how the
  Python code is read into @value{GDBN}, you may need to import the
  @code{gdb} module explicitly.
  
@@ -4320,7 +4345,7 @@ index f16b6e2..fe328c7 100644
  @node Functions In Python
  @subsubsection Writing new convenience functions
  
-@@ -20064,6 +20394,82 @@ which is used to format the value.  @xref{Pretty Printing}, for more
+@@ -20074,6 +20404,82 @@ which is used to format the value.  @xref{Pretty Printing}, for more
  information.
  @end defivar
  
@@ -4403,7 +4428,7 @@ index f16b6e2..fe328c7 100644
  @node Frames In Python
  @subsubsection Acessing inferior stack frames from Python.
  
-@@ -20128,6 +20534,14 @@ function to a string.
+@@ -20138,6 +20544,14 @@ function to a string.
  Returns the frame's resume address.
  @end defmethod
  
@@ -4418,7 +4443,7 @@ index f16b6e2..fe328c7 100644
  @defmethod Frame older
  Return the frame that called this frame.
  @end defmethod
-@@ -20136,10 +20550,18 @@ Return the frame that called this frame.
+@@ -20146,10 +20560,18 @@ Return the frame that called this frame.
  Return the frame called by this frame.
  @end defmethod
  
@@ -4963,7 +4988,7 @@ index 0bfcfca..01018d6 100644
  
  #endif /* dwarf2loc.h */
 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
-index 4cce36b..c2f5f23 100644
+index 4cce36b..fb0a693 100644
 --- a/gdb/dwarf2read.c
 +++ b/gdb/dwarf2read.c
 @@ -48,6 +48,12 @@
@@ -5701,7 +5726,7 @@ index 4cce36b..c2f5f23 100644
        if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
                                 || cu->language != language_fortran))
        complaint (&symfile_complaints, _("Tag '%s' has unexpected children"),
-@@ -3310,41 +3583,68 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3310,41 +3583,71 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
  /* Return the fully qualified name of DIE, based on its DW_AT_name.
     If scope qualifiers are appropriate they will be added.  The result
     will be allocated on the objfile_obstack, or NULL if the DIE does
@@ -5776,14 +5801,17 @@ index 4cce36b..c2f5f23 100644
    return name;
  }
  
-+/* read the given die's decl_line number. Return -1 if in case of an error */
-+static const int dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu){
++/* Read the given DIE's DW_AT_decl_line number.  Return -1 if in case of an
++   error.  */
++
++static int
++dwarf2_read_decl_line (struct die_info *die, struct dwarf2_cu *cu)
++{
 +  struct attribute *line_attr;
 +
 +  line_attr = dwarf2_attr (die, DW_AT_decl_line, cu);
-+  if (line_attr){
-+    return  DW_UNSND (line_attr);
-+  }
++  if (line_attr)
++    return DW_UNSND (line_attr);
 +
 +  return -1;
 +}
@@ -5791,7 +5819,7 @@ index 4cce36b..c2f5f23 100644
  /* Read the import statement specified by the given die and record it.  */
  
  static void
-@@ -3354,9 +3654,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3354,9 +3657,15 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
    struct die_info *imported_die;
    const char *imported_name;
    const char *imported_name_prefix;
@@ -5809,7 +5837,7 @@ index 4cce36b..c2f5f23 100644
    import_attr = dwarf2_attr (die, DW_AT_import, cu);
    if (import_attr == NULL)
      {
-@@ -3404,17 +3710,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3404,17 +3713,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
        return;
      }
  
@@ -5843,7 +5871,7 @@ index 4cce36b..c2f5f23 100644
        canonical_name = alloca (strlen (imported_name_prefix) + 2 + strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name_prefix);
        strcat (canonical_name, "::");
-@@ -3425,8 +3741,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3425,8 +3744,14 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
        canonical_name = alloca (strlen (imported_name) + 1);
        strcpy (canonical_name, imported_name);
      }
@@ -5860,7 +5888,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  static void
-@@ -3695,6 +4017,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3695,6 +4020,14 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
    struct attribute *attr;
  
    attr = dwarf2_attr (die, DW_AT_abstract_origin, cu);
@@ -5875,7 +5903,7 @@ index 4cce36b..c2f5f23 100644
    if (!attr)
      return;
  
-@@ -3793,6 +4123,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3793,6 +4126,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
    char *name;
    CORE_ADDR baseaddr;
    struct block *block;
@@ -5883,7 +5911,7 @@ index 4cce36b..c2f5f23 100644
    int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
  
    if (inlined_func)
-@@ -3811,13 +4142,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3811,13 +4145,23 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -5910,7 +5938,7 @@ index 4cce36b..c2f5f23 100644
    lowpc += baseaddr;
    highpc += baseaddr;
  
-@@ -3844,14 +4185,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3844,14 +4188,19 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
  
    cu->list_in_scope = &local_symbols;
  
@@ -5937,7 +5965,7 @@ index 4cce36b..c2f5f23 100644
      }
  
    inherit_abstract_dies (die, cu);
-@@ -3867,6 +4213,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3867,6 +4216,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
                        determine_prefix (die, cu),
                        processing_has_namespace_info);
  
@@ -5951,7 +5979,7 @@ index 4cce36b..c2f5f23 100644
    /* If we have address ranges, record them.  */
    dwarf2_record_block_ranges (die, block, baseaddr, cu);
    
-@@ -3903,7 +4256,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3903,7 +4259,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
       as multiple lexical blocks?  Handling children in a sane way would
       be nasty.  Might be easier to properly extend generic blocks to 
       describe ranges.  */
@@ -5960,7 +5988,7 @@ index 4cce36b..c2f5f23 100644
      return;
    lowpc += baseaddr;
    highpc += baseaddr;
-@@ -3920,7 +4273,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -3920,7 +4276,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
      }
    new = pop_context ();
  
@@ -5969,7 +5997,7 @@ index 4cce36b..c2f5f23 100644
      {
        struct block *block
          = finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
-@@ -4075,7 +4428,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
+@@ -4075,7 +4431,8 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
     discontinuous, i.e. derived from DW_AT_ranges information.  */
  static int
  dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
@@ -5979,7 +6007,7 @@ index 4cce36b..c2f5f23 100644
  {
    struct attribute *attr;
    CORE_ADDR low = 0;
-@@ -4103,7 +4457,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
+@@ -4103,7 +4460,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
        {
          /* Value of the DW_AT_ranges attribute is the offset in the
             .debug_ranges section.  */
@@ -5988,7 +6016,7 @@ index 4cce36b..c2f5f23 100644
            return 0;
          /* Found discontinuous range of addresses.  */
          ret = -1;
-@@ -4142,7 +4496,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
+@@ -4142,7 +4499,7 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
    CORE_ADDR low, high;
    struct die_info *child = die->child;
  
@@ -5997,7 +6025,7 @@ index 4cce36b..c2f5f23 100644
      {
        *lowpc = min (*lowpc, low);
        *highpc = max (*highpc, high);
-@@ -4179,7 +4533,7 @@ get_scope_pc_bounds (struct die_info *die,
+@@ -4179,7 +4536,7 @@ get_scope_pc_bounds (struct die_info *die,
    CORE_ADDR best_high = (CORE_ADDR) 0;
    CORE_ADDR current_low, current_high;
  
@@ -6006,7 +6034,7 @@ index 4cce36b..c2f5f23 100644
      {
        best_low = current_low;
        best_high = current_high;
-@@ -4474,7 +4828,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
+@@ -4474,7 +4831,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
        return;
  
        /* Get physical name.  */
@@ -6015,7 +6043,7 @@ index 4cce36b..c2f5f23 100644
  
        /* The name is already allocated along with this objfile, so we don't
         need to duplicate it for the type.  */
-@@ -4617,7 +4971,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4617,7 +4974,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      return;
  
    /* Get the mangled name.  */
@@ -6024,7 +6052,7 @@ index 4cce36b..c2f5f23 100644
  
    /* Look up member function name in fieldlist.  */
    for (i = 0; i < fip->nfnfields; i++)
-@@ -4661,7 +5015,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4661,7 +5018,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
    /* The name is already allocated along with this objfile, so we don't
       need to duplicate it for the type.  */
    fnp->physname = physname ? physname : "";
@@ -6033,7 +6061,7 @@ index 4cce36b..c2f5f23 100644
    this_type = read_type_die (die, cu);
    if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
      {
-@@ -4721,18 +5075,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
+@@ -4721,18 +5078,18 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
      {
        /* Support the .debug_loc offsets */
        if (attr_form_is_block (attr))
@@ -6059,7 +6087,7 @@ index 4cce36b..c2f5f23 100644
     }
  }
  
-@@ -4845,7 +5199,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4845,7 +5202,7 @@ quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu)
      return NULL;
  
    domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
@@ -6068,7 +6096,7 @@ index 4cce36b..c2f5f23 100644
    smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type),
                        TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
                        TYPE_VARARGS (pfn_type));
-@@ -4898,7 +5252,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4898,7 +5255,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
        return set_die_type (die, type, cu);
      }
  
@@ -6077,7 +6105,7 @@ index 4cce36b..c2f5f23 100644
    INIT_CPLUS_SPECIFIC (type);
  
    name = dwarf2_name (die, cu);
-@@ -4907,14 +5261,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -4907,14 +5264,18 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
        if (cu->language == language_cplus
          || cu->language == language_java)
        {
@@ -6099,7 +6127,7 @@ index 4cce36b..c2f5f23 100644
        }
      }
  
-@@ -5124,7 +5482,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5124,7 +5485,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
        return set_die_type (die, type, cu);
      }
  
@@ -6108,7 +6136,7 @@ index 4cce36b..c2f5f23 100644
  
    TYPE_CODE (type) = TYPE_CODE_ENUM;
    name = dwarf2_full_name (die, cu);
-@@ -5152,51 +5510,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5152,51 +5513,6 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
    return set_die_type (die, type, cu);
  }
  
@@ -6160,7 +6188,7 @@ index 4cce36b..c2f5f23 100644
  /* Given a pointer to a die which begins an enumeration, process all
     the dies that define the members of the enumeration, and create the
     symbol for the enumeration type.
-@@ -5274,6 +5587,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5274,6 +5590,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
    new_symbol (die, this_type, cu);
  }
  
@@ -6190,7 +6218,7 @@ index 4cce36b..c2f5f23 100644
  /* Extract all information from a DW_TAG_array_type DIE and put it in
     the DIE's type field.  For now, this only handles one dimensional
     arrays.  */
-@@ -5287,7 +5623,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5287,7 +5626,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;
@@ -6199,7 +6227,7 @@ index 4cce36b..c2f5f23 100644
    struct cleanup *back_to;
    char *name;
  
-@@ -5334,16 +5670,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5334,16 +5673,11 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
    type = element_type;
  
    if (read_array_order (die, cu) == DW_ORD_col_major)
@@ -6221,7 +6249,7 @@ index 4cce36b..c2f5f23 100644
  
    /* Understand Dwarf2 support for vector types (like they occur on
       the PowerPC w/ AltiVec).  Gcc just adds another attribute to the
-@@ -5410,12 +5741,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5410,12 +5744,14 @@ read_set_type (struct die_info *die, struct dwarf2_cu *cu)
    return set_die_type (die, set_type, cu);
  }
  
@@ -6238,7 +6266,7 @@ index 4cce36b..c2f5f23 100644
    struct attribute *attr;
    struct symbol *sym;
    CORE_ADDR base = (CORE_ADDR) 0;
-@@ -5425,25 +5758,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5425,25 +5761,55 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
      {
        /* Support the .debug_loc offsets */
        if (attr_form_is_block (attr))
@@ -6301,7 +6329,7 @@ index 4cce36b..c2f5f23 100644
          attr = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
          if (attr)
            {
-@@ -5461,8 +5824,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5461,8 +5827,25 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
              SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
              add_symbol_to_list (sym, &global_symbols);
            }
@@ -6327,7 +6355,7 @@ index 4cce36b..c2f5f23 100644
      }
  }
  
-@@ -5530,7 +5910,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5530,7 +5913,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
        if (is_anonymous)
        {
          const char *previous_prefix = determine_prefix (die, cu);
@@ -6336,7 +6364,7 @@ index 4cce36b..c2f5f23 100644
        }
      }
  
-@@ -5546,20 +5926,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5546,20 +5929,155 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
      }
  }
  
@@ -6376,18 +6404,18 @@ index 4cce36b..c2f5f23 100644
 +
 +  if (die_is_declaration (die, cu))
 +    return NULL;
--  /* FIXME: Support the separate Fortran module namespaces.  */
++
 +  module_name = dwarf2_name (die, cu);
 +  if (!module_name)
 +    complaint (&symfile_complaints, _("DW_TAG_module has no name, offset 0x%x"),
 +               die->offset);
 +  type = init_type (TYPE_CODE_MODULE, 0, 0, module_name, objfile);
-+  /* Create a context for reading the module variables.  */
 +
++  /* Create a context for reading the module variables.  */
+-  /* FIXME: Support the separate Fortran module namespaces.  */
 +  new = push_context (0, 0);
-+
 +  save_file_symbols = file_symbols;
 +  file_symbols = NULL;
 +  save_global_symbols = global_symbols;
@@ -6495,7 +6523,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Return the name of the namespace represented by DIE.  Set
-@@ -5724,29 +6239,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5724,29 +6242,113 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
    struct gdbarch *gdbarch = get_objfile_arch (objfile);
    struct type *type, *range_type, *index_type, *char_type;
    struct attribute *attr;
@@ -6623,7 +6651,7 @@ index 4cce36b..c2f5f23 100644
    char_type = language_string_char_type (cu->language_defn, gdbarch);
    type = create_string_type (NULL, char_type, range_type);
  
-@@ -5841,7 +6440,6 @@ static struct type *
+@@ -5841,7 +6443,6 @@ static struct type *
  read_typedef (struct die_info *die, struct dwarf2_cu *cu)
  {
    struct objfile *objfile = cu->objfile;
@@ -6631,7 +6659,7 @@ index 4cce36b..c2f5f23 100644
    const char *name = NULL;
    struct type *this_type;
  
-@@ -5949,8 +6547,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5949,8 +6550,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
    struct type *base_type;
    struct type *range_type;
    struct attribute *attr;
@@ -6641,7 +6669,7 @@ index 4cce36b..c2f5f23 100644
    char *name;
    
    base_type = die_type (die, cu);
-@@ -5963,42 +6560,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+@@ -5963,42 +6563,89 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
                     0, NULL, cu->objfile);
      }
  
@@ -6760,7 +6788,7 @@ index 4cce36b..c2f5f23 100644
  
    name = dwarf2_name (die, cu);
    if (name)
-@@ -6469,6 +7113,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
+@@ -6469,6 +7116,7 @@ load_partial_dies (bfd *abfd, gdb_byte *buffer, gdb_byte *info_ptr,
          && abbrev->tag != DW_TAG_lexical_block
          && abbrev->tag != DW_TAG_variable
          && abbrev->tag != DW_TAG_namespace
@@ -6768,7 +6796,7 @@ index 4cce36b..c2f5f23 100644
          && abbrev->tag != DW_TAG_member)
        {
          /* Otherwise we skip to the next sibling, if any.  */
-@@ -6689,9 +7334,6 @@ read_partial_die (struct partial_die_info *part_die,
+@@ -6689,9 +7337,6 @@ read_partial_die (struct partial_die_info *part_die,
          if (part_die->dirname == NULL)
            part_die->dirname = DW_STRING (&attr);
          break;
@@ -6778,7 +6806,7 @@ index 4cce36b..c2f5f23 100644
        case DW_AT_low_pc:
          has_low_pc_attr = 1;
          part_die->lowpc = DW_ADDR (&attr);
-@@ -6923,7 +7565,8 @@ fixup_partial_die (struct partial_die_info *part_die,
+@@ -6923,7 +7568,8 @@ fixup_partial_die (struct partial_die_info *part_die,
    /* If we found a reference attribute and the DIE has no name, try
       to find a name in the referred to DIE.  */
  
@@ -6788,7 +6816,7 @@ index 4cce36b..c2f5f23 100644
      {
        struct partial_die_info *spec_die;
  
-@@ -8265,10 +8908,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
+@@ -8265,10 +8911,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
@@ -6803,7 +6831,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Given a pointer to a DWARF information entry, figure out if we need
-@@ -8290,21 +8935,30 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8290,21 +8938,30 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  
    baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
  
@@ -6841,7 +6869,7 @@ index 4cce36b..c2f5f23 100644
  
        /* Default assumptions.
           Use the passed type or decode it from the die.  */
-@@ -8402,9 +9056,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8402,9 +9059,28 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
          if (attr)
            {
              var_decode_location (attr, sym, cu);
@@ -6871,7 +6899,7 @@ index 4cce36b..c2f5f23 100644
              else
                add_symbol_to_list (sym, cu->list_in_scope);
            }
-@@ -8534,7 +9207,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8534,7 +9210,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
          add_symbol_to_list (sym, cu->list_in_scope);
          break;
        case DW_TAG_enumerator:
@@ -6880,7 +6908,7 @@ index 4cce36b..c2f5f23 100644
          attr = dwarf2_attr (die, DW_AT_const_value, cu);
          if (attr)
            {
-@@ -8558,6 +9231,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8558,6 +9234,16 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
          SYMBOL_CLASS (sym) = LOC_TYPEDEF;
          add_symbol_to_list (sym, &global_symbols);
          break;
@@ -6897,7 +6925,7 @@ index 4cce36b..c2f5f23 100644
        default:
          /* Not a tag we recognize.  Hopefully we aren't processing
             trash data, but since we must specifically ignore things
-@@ -8571,8 +9254,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -8571,8 +9257,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
        /* For the benefit of old versions of GCC, check for anonymous
         namespaces based on the demangled name.  */
        if (!processing_has_namespace_info
@@ -6907,7 +6935,7 @@ index 4cce36b..c2f5f23 100644
        cp_scan_for_anonymous_namespaces (sym);
      }
    return (sym);
-@@ -8823,12 +9505,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8823,12 +9508,18 @@ read_type_die (struct die_info *die, struct dwarf2_cu *cu)
      case DW_TAG_namespace:
        this_type = read_namespace_type (die, cu);
        break;
@@ -6926,7 +6954,7 @@ index 4cce36b..c2f5f23 100644
    return this_type;
  }
  
-@@ -8910,10 +9598,100 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
+@@ -8910,10 +9601,100 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
             So it does not need a prefix.  */
          return "";
        default:
@@ -7028,7 +7056,7 @@ index 4cce36b..c2f5f23 100644
  /* Return a newly-allocated string formed by concatenating PREFIX and
     SUFFIX with appropriate separator.  If PREFIX or SUFFIX is NULL or empty, then
     simply copy the SUFFIX or PREFIX, respectively.  If OBS is non-null,
-@@ -8963,17 +9741,111 @@ sibling_die (struct die_info *die)
+@@ -8963,17 +9744,111 @@ sibling_die (struct die_info *die)
    return die->sibling;
  }
  
@@ -7146,7 +7174,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Get name of a die, return NULL if not found.  */
-@@ -10200,11 +11072,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
+@@ -10200,11 +11075,11 @@ dwarf2_get_ref_die_offset (struct attribute *attr)
    return 0;
  }
  
@@ -7161,7 +7189,7 @@ index 4cce36b..c2f5f23 100644
  {
    if (attr->form == DW_FORM_sdata)
      return DW_SND (attr);
-@@ -11009,8 +11881,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11009,8 +11884,6 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
  {
    gdb_byte *mac_ptr, *mac_end;
    struct macro_source_file *current_file = 0;
@@ -7170,7 +7198,7 @@ index 4cce36b..c2f5f23 100644
  
    if (dwarf2_per_objfile->macinfo.buffer == NULL)
      {
-@@ -11018,29 +11888,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11018,29 +11891,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
        return;
      }
  
@@ -7205,7 +7233,7 @@ index 4cce36b..c2f5f23 100644
          }
  
        macinfo_type = read_1_byte (abfd, mac_ptr);
-@@ -11051,92 +11911,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11051,92 +11914,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
            /* A zero macinfo type indicates the end of the macro
               information.  */
          case 0:
@@ -7299,7 +7327,7 @@ index 4cce36b..c2f5f23 100644
  
          case DW_MACINFO_define:
          case DW_MACINFO_undef:
-@@ -11151,31 +11926,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11151,31 +11929,19 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
              mac_ptr += bytes_read;
  
              if (! current_file)
@@ -7342,7 +7370,7 @@ index 4cce36b..c2f5f23 100644
            }
            break;
  
-@@ -11189,22 +11952,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11189,22 +11955,9 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
              file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
              mac_ptr += bytes_read;
  
@@ -7368,7 +7396,7 @@ index 4cce36b..c2f5f23 100644
            }
            break;
  
-@@ -11258,7 +12008,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
+@@ -11258,7 +12011,7 @@ dwarf_decode_macros (struct line_header *lh, unsigned int offset,
            }
            break;
          }
@@ -7377,7 +7405,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* Check if the attribute's form is a DW_FORM_block*
-@@ -11318,6 +12068,34 @@ attr_form_is_constant (struct attribute *attr)
+@@ -11318,6 +12071,34 @@ attr_form_is_constant (struct attribute *attr)
      }
  }
  
@@ -7412,7 +7440,7 @@ index 4cce36b..c2f5f23 100644
  static void
  dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
                             struct dwarf2_cu *cu)
-@@ -11347,35 +12125,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
+@@ -11347,35 +12128,25 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
        SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs;
        SYMBOL_LOCATION_BATON (sym) = baton;
      }
@@ -7463,7 +7491,7 @@ index 4cce36b..c2f5f23 100644
      }
  }
  
-@@ -11663,6 +12431,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
+@@ -11663,6 +12434,31 @@ offset_and_type_eq (const void *item_lhs, const void *item_rhs)
    return ofs_lhs->offset == ofs_rhs->offset;
  }
  
@@ -7495,7 +7523,7 @@ index 4cce36b..c2f5f23 100644
  /* Set the type associated with DIE to TYPE.  Save it in CU's hash
     table if necessary.  For convenience, return TYPE.  */
  
-@@ -11671,6 +12464,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
+@@ -11671,6 +12467,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
  {
    struct dwarf2_offset_and_type **slot, ofs;
  
@@ -7504,7 +7532,7 @@ index 4cce36b..c2f5f23 100644
    if (cu->type_hash == NULL)
      {
        gdb_assert (cu->per_cu != NULL);
-@@ -11813,23 +12608,13 @@ show_dwarf2_cmd (char *args, int from_tty)
+@@ -11813,23 +12611,13 @@ show_dwarf2_cmd (char *args, int from_tty)
    cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
  }
  
@@ -7532,7 +7560,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  /* munmap debug sections for OBJFILE, if necessary.  */
-@@ -11838,15 +12623,15 @@ static void
+@@ -11838,15 +12626,15 @@ static void
  dwarf2_per_objfile_free (struct objfile *objfile, void *d)
  {
    struct dwarf2_per_objfile *data = d;
@@ -7557,7 +7585,7 @@ index 4cce36b..c2f5f23 100644
  }
  
  void _initialize_dwarf2_read (void);
-@@ -11854,6 +12639,7 @@ void _initialize_dwarf2_read (void);
+@@ -11854,6 +12642,7 @@ void _initialize_dwarf2_read (void);
  void
  _initialize_dwarf2_read (void)
  {
@@ -10995,7 +11023,7 @@ index 0f9d44e..c910e88 100644
    /* We didn't find it; print the raw data.  */
    if (vbit)
 diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
-index fe848ff..170e6cd 100644
+index fe848ff..905dcc3 100644
 --- a/gdb/i386-linux-nat.c
 +++ b/gdb/i386-linux-nat.c
 @@ -586,6 +586,8 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
@@ -11054,7 +11082,7 @@ index fe848ff..170e6cd 100644
    return i386_linux_dr_get (inferior_ptid, DR_STATUS);
  }
  
-+/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST.  */
++/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST.  */
 +
 +static void
 +i386_linux_dr_unset_status (unsigned long mask)
@@ -11100,7 +11128,7 @@ index fe848ff..170e6cd 100644
  
    /* Override the default ptrace resume method.  */
 diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
-index ab1bd8a..ee330b8 100644
+index 325b4df..631ccd6 100644
 --- a/gdb/i386-nat.c
 +++ b/gdb/i386-nat.c
 @@ -137,8 +137,11 @@ struct i386_dr_low_type i386_dr_low;
@@ -11157,7 +11185,7 @@ index ab1bd8a..ee330b8 100644
  /* Return non-zero if we can watch a memory region that starts at
     address ADDR and whose length is LEN bytes.  */
  
-@@ -575,28 +598,7 @@ static int
+@@ -578,28 +601,7 @@ static int
  i386_stopped_by_watchpoint (void)
  {
    CORE_ADDR addr = 0;
@@ -11187,7 +11215,7 @@ index ab1bd8a..ee330b8 100644
  }
  
  /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
-@@ -690,6 +692,7 @@ i386_use_watchpoints (struct target_ops *t)
+@@ -693,6 +695,7 @@ i386_use_watchpoints (struct target_ops *t)
    t->to_stopped_data_address = i386_stopped_data_address;
    t->to_insert_watchpoint = i386_insert_watchpoint;
    t->to_remove_watchpoint = i386_remove_watchpoint;
@@ -11236,6 +11264,39 @@ index f49b9f6..cd31958 100644
      int debug_register_length;
    };
  
+diff --git a/gdb/infcall.c b/gdb/infcall.c
+index c9d98cf..277399a 100644
+--- a/gdb/infcall.c
++++ b/gdb/infcall.c
+@@ -441,6 +441,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
+   struct gdbarch *gdbarch;
+   struct breakpoint *terminate_bp = NULL;
+   struct minimal_symbol *tm;
++  struct cleanup *terminate_bp_cleanup = NULL;
+   ptid_t call_thread_ptid;
+   struct gdb_exception e;
+   const char *name;
+@@ -772,7 +773,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
+   /* Register a clean-up for unwind_on_terminating_exception_breakpoint.  */
+   if (terminate_bp)
+-    make_cleanup_delete_breakpoint (terminate_bp);
++    terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
+   /* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
+      If you're looking to implement asynchronous dummy-frames, then
+@@ -987,6 +988,11 @@ When the function is done executing, GDB will silently stop."),
+       internal_error (__FILE__, __LINE__, _("... should not be here"));
+     }
++  /* If we get here and the std::terminate() breakpoint has been set,
++     it has to be cleaned manually.  */
++  if (terminate_bp)
++    do_cleanups (terminate_bp_cleanup);
++
+   /* If we get here the called FUNCTION ran to completion,
+      and the dummy frame has already been popped.  */
 diff --git a/gdb/infcmd.c b/gdb/infcmd.c
 index 9e98290..fab1892 100644
 --- a/gdb/infcmd.c
@@ -11349,7 +11410,7 @@ index f1b5d17..31add7d 100644
  
  extern void notice_new_inferior (ptid_t, int, int);
 diff --git a/gdb/infrun.c b/gdb/infrun.c
-index 1a83a25..2ee2164 100644
+index ff7c6b9..9d29b15 100644
 --- a/gdb/infrun.c
 +++ b/gdb/infrun.c
 @@ -45,6 +45,8 @@
@@ -11392,7 +11453,26 @@ index 1a83a25..2ee2164 100644
        /* This causes the eventpoints and symbol table to be reset.
           Must do this now, before trying to determine whether to
           stop.  */
-@@ -3468,23 +3480,33 @@ process_event_stop_test:
+@@ -2845,6 +2857,9 @@ targets should add new threads to the thread list themselves in non-stop mode.")
+     {
+       struct regcache *regcache = get_thread_regcache (ecs->ptid);
+       struct gdbarch *gdbarch = get_regcache_arch (regcache);
++      struct cleanup *old_chain = save_inferior_ptid ();
++
++      inferior_ptid = ecs->ptid;
+       fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n",
+                           paddress (gdbarch, stop_pc));
+@@ -2861,6 +2876,8 @@ targets should add new threads to the thread list themselves in non-stop mode.")
+             fprintf_unfiltered (gdb_stdlog,
+                                 "infrun: (no data address available)\n");
+       }
++
++      do_cleanups (old_chain);
+     }
+   if (stepping_past_singlestep_breakpoint)
+@@ -3468,23 +3485,33 @@ process_event_stop_test:
  
        ecs->event_thread->stepping_over_breakpoint = 1;
  
@@ -11438,7 +11518,7 @@ index 1a83a25..2ee2164 100644
        keep_going (ecs);
        return;
  
-@@ -3496,6 +3518,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
+@@ -3496,6 +3523,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
        gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
        delete_step_resume_breakpoint (ecs->event_thread);
  
@@ -11492,7 +11572,7 @@ index 1a83a25..2ee2164 100644
        ecs->event_thread->stop_step = 1;
        print_stop_reason (END_STEPPING_RANGE, 0);
        stop_stepping (ecs);
-@@ -4500,6 +4569,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
+@@ -4500,6 +4574,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
      set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
  }
  
@@ -11589,7 +11669,7 @@ index 1a83a25..2ee2164 100644
  static void
  stop_stepping (struct execution_control_state *ecs)
  {
-@@ -4568,6 +4727,8 @@ keep_going (struct execution_control_state *ecs)
+@@ -4568,6 +4732,8 @@ keep_going (struct execution_control_state *ecs)
            }
          if (e.reason < 0)
            {
@@ -12165,10 +12245,22 @@ index a84003f..924c1c5 100644
    default_symfile_offsets,    /* sym_offsets: dummy FIXME til implem sym reloc */
    default_symfile_segments,   /* sym_segments: Get segment information from
 diff --git a/gdb/objfiles.c b/gdb/objfiles.c
-index 8dcca70..4b25a5a 100644
+index 8dcca70..e5442ca 100644
 --- a/gdb/objfiles.c
 +++ b/gdb/objfiles.c
-@@ -731,6 +731,20 @@ have_partial_symbols (void)
+@@ -634,6 +634,11 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
+     }
+   }
++  /* Alread QUICK_ADDRMAP tiself assumes all sections have the same offset.  */
++  if (objfile->quick_addrmap)
++    addrmap_relocate (objfile->quick_addrmap,
++                    ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
++
+   {
+     struct partial_symbol **psym;
+@@ -731,6 +736,20 @@ have_partial_symbols (void)
      if (objfile_has_partial_symbols (ofp))
        return 1;
    }
@@ -18014,7 +18106,7 @@ index 49c0437..84a476e 100644
 +  return 1;
 +}
 diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
-index 58bcee3..b2e7b7d 100644
+index 0146593..b82fcb6 100644
 --- a/gdb/python/py-value.c
 +++ b/gdb/python/py-value.c
 @@ -25,6 +25,7 @@
@@ -20070,7 +20162,7 @@ index e5d14fd..37fab72 100644
    current_target.to_stopped_data_address = debug_to_stopped_data_address;
    current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range;
 diff --git a/gdb/target.h b/gdb/target.h
-index b1cb852..adff946 100644
+index b1cb852..3c06eba 100644
 --- a/gdb/target.h
 +++ b/gdb/target.h
 @@ -395,6 +395,7 @@ struct target_ops
@@ -20081,7 +20173,16 @@ index b1cb852..adff946 100644
      int (*to_stopped_by_watchpoint) (void);
      int to_have_steppable_watchpoint;
      int to_have_continuable_watchpoint;
-@@ -1166,6 +1167,15 @@ extern char *normal_pid_to_str (ptid_t ptid);
+@@ -1124,7 +1125,7 @@ extern char *normal_pid_to_str (ptid_t ptid);
+ /* Hardware watchpoint interfaces.  */
+ /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
+-   write).  */
++   write).  Only the INFERIOR_PTID task is being queried.  */
+ #define target_stopped_by_watchpoint \
+    (*current_target.to_stopped_by_watchpoint)
+@@ -1166,14 +1167,26 @@ extern char *normal_pid_to_str (ptid_t ptid);
  #define       target_remove_watchpoint(addr, len, type)       \
       (*current_target.to_remove_watchpoint) (addr, len, type)
  
@@ -20097,7 +20198,20 @@ index b1cb852..adff946 100644
  #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
       (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt)
  
-@@ -1203,6 +1213,20 @@ extern int target_search_memory (CORE_ADDR start_addr,
+ #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
+      (*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt)
+-#define target_stopped_data_address(target, x) \
+-    (*target.to_stopped_data_address) (target, x)
++/* Return non-zero if target knows the data address which triggered this
++   target_stopped_by_watchpoint, in such case place it to *ADDR_P.  Only the
++   INFERIOR_PTID task is being queried.  */
++#define target_stopped_data_address(target, addr_p) \
++    (*target.to_stopped_data_address) (target, addr_p)
+ #define target_watchpoint_addr_within_range(target, addr, start, length) \
+   (*target.to_watchpoint_addr_within_range) (target, addr, start, length)
+@@ -1203,6 +1216,20 @@ extern int target_search_memory (CORE_ADDR start_addr,
                                   ULONGEST pattern_len,
                                   CORE_ADDR *found_addrp);
  
@@ -20118,7 +20232,7 @@ index b1cb852..adff946 100644
  /* Command logging facility.  */
  
  #define target_log_command(p)                                         \
-@@ -1322,6 +1346,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *);
+@@ -1322,6 +1349,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *);
  
  extern char *target_get_osdata (const char *type);
  
@@ -23174,6 +23288,162 @@ index 0000000..5543757
 +
 +setup_kfail "gdb/10541" "*-*-*"
 +gdb_test "print G::GF::FE::ex" "= 9999"
+diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
+new file mode 100644
+index 0000000..173e49b
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.cc
+@@ -0,0 +1,93 @@
++int a;
++int b;
++int c;
++int d;
++int e;
++int f;
++int g;
++int h;
++int i;
++int j;
++int k;
++int l;
++int m;
++int n;
++int o;
++int p;
++int q;
++int r;
++int s;
++int t;
++int u;
++int v;
++int w;
++int x;
++int y;
++int z;
++
++namespace A
++{
++  int xyz;
++
++  using ::a;
++  using ::b;
++  using ::c;
++  using ::d;
++  using ::e;
++  using ::f;
++  using ::g;
++  using ::h;
++  using ::i;
++  using ::j;
++  using ::k;
++  using ::l;
++  using ::m;
++  using ::n;
++  using ::o;
++  using ::p;
++  using ::q;
++  using ::r;
++  using ::s;
++  using ::t;
++  using ::u;
++  using ::v;
++  using ::w;
++  using ::x;
++  using ::y;
++  using ::z;
++
++}
++
++using A::a;
++using A::b;
++using A::c;
++using A::d;
++using A::e;
++using A::f;
++using A::g;
++using A::h;
++using A::i;
++using A::j;
++using A::k;
++using A::l;
++using A::m;
++using A::n;
++using A::o;
++using A::p;
++using A::q;
++using A::r;
++using A::s;
++using A::t;
++using A::u;
++using A::v;
++using A::w;
++using A::x;
++using A::y;
++using A::z;
++
++using namespace A;
++
++int main ()
++{
++  return 0;
++}
+\ No newline at end of file
+diff --git a/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
+new file mode 100644
+index 0000000..f22a14e
+--- /dev/null
++++ b/gdb/testsuite/gdb.cp/namespace-stress-declarations.exp
+@@ -0,0 +1,50 @@
++# Copyright 2008 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if $tracelevel then {
++    strace $tracelevel
++}
++
++set prms_id 0
++set bug_id 0
++
++set testfile namespace-stress-declarations
++set srcfile ${testfile}.cc
++set binfile ${objdir}/${subdir}/${testfile}
++if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
++    untested "Couldn't compile test program"
++    return -1
++}
++
++if [get_compiler_info ${binfile}] {
++    return -1;
++}
++
++# Get things started.
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++if ![runto_main] then {
++    perror "couldn't run to breakpoint main"
++    continue
++}
++
++############################################
++# Test that the search can fail efficiently 
++
++gdb_test "print fakex" "No symbol \"fakex\" in current context."
 diff --git a/gdb/testsuite/gdb.cp/namespace-stress.cc b/gdb/testsuite/gdb.cp/namespace-stress.cc
 new file mode 100644
 index 0000000..f34083e
@@ -25369,10 +25639,10 @@ index 495ae45..d08d7a4 100644
                set command "next"
 diff --git a/gdb/testsuite/gdb.java/jnpe.exp b/gdb/testsuite/gdb.java/jnpe.exp
 new file mode 100644
-index 0000000..74d4d58
+index 0000000..e71391e
 --- /dev/null
 +++ b/gdb/testsuite/gdb.java/jnpe.exp
-@@ -0,0 +1,72 @@
+@@ -0,0 +1,77 @@
 +# Copyright 2009 Free Software Foundation, Inc.
 +
 +# This program is free software; you can redistribute it and/or modify
@@ -25395,10 +25665,10 @@ index 0000000..74d4d58
 +load_lib "java.exp"
 +
 +set testfile "jnpe"
-+set srcfile ${srcdir}/$subdir/${testfile}.java
++set srcfile ${testfile}.java
 +set binfile ${objdir}/${subdir}/${testfile}
-+if  { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
-+    untested "Couldn't compile ${srcfile}"
++if  { [compile_java_from_source ${srcdir}/$subdir/${srcfile} ${binfile} "-g"] != "" } {
++    untested "Couldn't compile ${srcdir}/$subdir/${srcfile}"
 +    return -1
 +}
 +
@@ -25416,7 +25686,7 @@ index 0000000..74d4d58
 +gdb_test "break $testfile.java:$line" ""
 +
 +gdb_test "run" \
-+  "Current language.*java" \
++  "// break here.*" \
 +  "run java next-over-throw"
 +
 +# See whether we have the needed unwinder hooks.
@@ -25425,9 +25695,10 @@ index 0000000..74d4d58
 +    -re "= .*_Unwind_DebugHook.*\r\n$gdb_prompt $" {
 +      pass "check for unwinder hook in java"
 +    }
-+    -re "No symbol .* in current context.\r\n$gdb_prompt $" {
++    -re "No symbol .* in current context.?\r\n$gdb_prompt $" {
 +      # Pass the test so we don't get bogus fails in the results.
-+      pass "check for unwinder hook in java"
++      setup_xfail *-*-*
++      fail "check for unwinder hook in java"
 +      set ok 0
 +    }
 +}
@@ -25440,14 +25711,18 @@ index 0000000..74d4d58
 +  "SIGSEGV.*fault" \
 +  "disable SIGSEGV for next-over-NPE"
 +
-+# We sometimes stop at line 37, not line 35.  This seems to be a gcj
-+# oddity -- another next will solve it.
++# The line where we stop differ according to gcj; check just we did not already
++# execute the catch point.
++
 +gdb_test "next" \
-+  "3\[57\].*" \
++  "" \
 +  "next over NPE"
++
++gdb_breakpoint [gdb_get_line_number "catch point"]
++gdb_continue_to_breakpoint "catch point" ".*// catch point.*"
 diff --git a/gdb/testsuite/gdb.java/jnpe.java b/gdb/testsuite/gdb.java/jnpe.java
 new file mode 100644
-index 0000000..ffca3ab
+index 0000000..3524830
 --- /dev/null
 +++ b/gdb/testsuite/gdb.java/jnpe.java
 @@ -0,0 +1,38 @@
@@ -25485,7 +25760,7 @@ index 0000000..ffca3ab
 +      }
 +    catch (NullPointerException n)
 +      {
-+      System.out.println ("success");
++      System.out.println ("success"); // catch point
 +      }
 +  }
 +}
@@ -27292,10 +27567,10 @@ index 0000000..14f42d6
 +}
 diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
 new file mode 100644
-index 0000000..8f65364
+index 0000000..5ad1a4e
 --- /dev/null
 +++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
-@@ -0,0 +1,101 @@
+@@ -0,0 +1,105 @@
 +# This testcase is part of GDB, the GNU debugger.
 +
 +# Copyright 2009 Free Software Foundation, Inc.
@@ -27393,6 +27668,10 @@ index 0000000..8f65364
 +           "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \
 +           "continue b"
 +
++    # While the debug output itself is not checked in this testcase one bug was
++    # found in the DEBUG_INFRUN code path.
++    gdb_test "set debug infrun 1"
++
 +    gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
 +
 +    set pf_prefix $prefix_test
@@ -27803,7 +28082,7 @@ index a9c875d..12f6f07 100644
  }
  
 diff --git a/gdb/valops.c b/gdb/valops.c
-index b64cb21..b7d31cc 100644
+index 012ea6a..9b4d2a8 100644
 --- a/gdb/valops.c
 +++ b/gdb/valops.c
 @@ -38,6 +38,7 @@
@@ -27917,7 +28196,7 @@ index b64cb21..b7d31cc 100644
        }
      }
    else if (VALUE_LVAL (val) == lval_register)
-@@ -1070,7 +1133,18 @@ address_of_variable (struct symbol *var, struct block *b)
+@@ -1072,7 +1135,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)
      {
@@ -27937,7 +28216,7 @@ index b64cb21..b7d31cc 100644
        return value_from_pointer (lookup_pointer_type (type), addr);
      }
  
-@@ -1176,6 +1250,7 @@ struct value *
+@@ -1178,6 +1252,7 @@ struct value *
  value_coerce_array (struct value *arg1)
  {
    struct type *type = check_typedef (value_type (arg1));
@@ -27945,7 +28224,7 @@ index b64cb21..b7d31cc 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
-@@ -1185,8 +1260,12 @@ value_coerce_array (struct value *arg1)
+@@ -1187,8 +1262,12 @@ value_coerce_array (struct value *arg1)
    if (VALUE_LVAL (arg1) != lval_memory)
      error (_("Attempt to take address of value not located in memory."));
  
@@ -27959,7 +28238,7 @@ index b64cb21..b7d31cc 100644
  }
  
  /* Given a value which is a function, return a value which is a pointer
-@@ -2069,12 +2148,25 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2071,12 +2150,25 @@ find_overload_match (struct type **arg_types, int nargs,
    if (method)
      {
        gdb_assert (obj);
@@ -27990,7 +28269,7 @@ index b64cb21..b7d31cc 100644
  
        fns_ptr = value_find_oload_method_list (&temp, name, 
                                              0, &num_fns, 
-@@ -2094,16 +2186,29 @@ find_overload_match (struct type **arg_types, int nargs,
+@@ -2096,16 +2188,29 @@ find_overload_match (struct type **arg_types, int nargs,
      }
    else
      {
@@ -28028,7 +28307,7 @@ index b64cb21..b7d31cc 100644
        if (func_name == NULL)
          {
          *symp = fsym;
-@@ -2534,8 +2639,8 @@ check_field (struct type *type, const char *name)
+@@ -2536,8 +2641,8 @@ check_field (struct type *type, const char *name)
     the comment before value_struct_elt_for_reference.  */
  
  struct value *
@@ -28039,7 +28318,7 @@ index b64cb21..b7d31cc 100644
                     enum noside noside)
  {
    switch (TYPE_CODE (curtype))
-@@ -2543,7 +2648,7 @@ value_aggregate_elt (struct type *curtype,
+@@ -2545,7 +2650,7 @@ value_aggregate_elt (struct type *curtype,
      case TYPE_CODE_STRUCT:
      case TYPE_CODE_UNION:
        return value_struct_elt_for_reference (curtype, 0, curtype, 
@@ -28048,7 +28327,7 @@ index b64cb21..b7d31cc 100644
                                             want_address, noside);
      case TYPE_CODE_NAMESPACE:
        return value_namespace_elt (curtype, name, 
-@@ -2554,6 +2659,56 @@ value_aggregate_elt (struct type *curtype,
+@@ -2556,6 +2661,56 @@ value_aggregate_elt (struct type *curtype,
      }
  }
  
@@ -28105,7 +28384,7 @@ index b64cb21..b7d31cc 100644
  /* C++: Given an aggregate type CURTYPE, and a member name NAME,
     return the address of this member as a "pointer to member" type.
     If INTYPE is non-null, then it will be the type of the member we
-@@ -2631,23 +2786,46 @@ value_struct_elt_for_reference (struct type *domain, int offset,
+@@ -2633,23 +2788,46 @@ value_struct_elt_for_reference (struct type *domain, int offset,
        }
        if (t_field_name && strcmp (t_field_name, name) == 0)
        {
@@ -28162,7 +28441,7 @@ index b64cb21..b7d31cc 100644
  
          if (TYPE_FN_FIELD_STATIC_P (f, j))
            {
-@@ -2761,7 +2939,7 @@ value_maybe_namespace_elt (const struct type *curtype,
+@@ -2763,7 +2941,7 @@ value_maybe_namespace_elt (const struct type *curtype,
    struct symbol *sym;
    struct value *result;
  
@@ -28171,7 +28450,7 @@ index b64cb21..b7d31cc 100644
                                    get_selected_block (0), 
                                    VAR_DOMAIN);
  
-@@ -2905,7 +3083,7 @@ value_of_local (const char *name, int complain)
+@@ -2907,7 +3085,7 @@ value_of_local (const char *name, int complain)
  
    /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
       symbol instead of the LOC_ARG one (if both exist).  */
@@ -28180,7 +28459,7 @@ index b64cb21..b7d31cc 100644
    if (sym == NULL)
      {
        if (complain)
-@@ -2959,8 +3137,6 @@ value_slice (struct value *array, int lowbound, int length)
+@@ -2961,8 +3139,6 @@ value_slice (struct value *array, int lowbound, int length)
        || lowbound + length - 1 > upperbound)
      error (_("slice out of range"));
  
diff --git a/gdb-bz528668-symfile-cleanup.patch b/gdb-bz528668-symfile-cleanup.patch
new file mode 100644 (file)
index 0000000..2a843fa
--- /dev/null
@@ -0,0 +1,137 @@
+http://sourceware.org/ml/gdb-patches/2009-10/msg00509.html
+Subject: [patch 2/3] find_separate_debug_file cleanup
+
+Hi,
+
+current code was:
+* difficult to maintain as a new variable required xfree on many places
+* was causing memory corruptions due to silently misapplied 3rd party patches
+  as the close code fragments unfortunately match patch context
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-10-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * symfile.c (find_separate_debug_file): Initialize dir, debugfile and
+       canon_name to NULL.  Change alloca to xmalloc, newly call xfree for it.
+       New label cleanup_return_debugfile, jump to it from the failure paths.
+
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -1333,11 +1333,10 @@ static char *
+ find_separate_debug_file (struct objfile *objfile)
+ {
+   asection *sect;
+-  char *basename;
+-  char *dir;
+-  char *debugfile;
+-  char *name_copy;
+-  char *canon_name;
++  char *basename, *name_copy;
++  char *dir = NULL;
++  char *debugfile = NULL;
++  char *canon_name = NULL;
+   bfd_size_type debuglink_size;
+   unsigned long crc32;
+   int i;
+@@ -1366,7 +1365,7 @@ find_separate_debug_file (struct objfile *objfile)
+   if (basename == NULL)
+     /* There's no separate debug info, hence there's no way we could
+        load it => no warning.  */
+-    return NULL;
++    goto cleanup_return_debugfile;
+   dir = xstrdup (objfile->name);
+@@ -1388,24 +1387,19 @@ find_separate_debug_file (struct objfile *objfile)
+   if (canon_name && strlen (canon_name) > i)
+     i = strlen (canon_name);
+-  debugfile = alloca (strlen (debug_file_directory) + 1
+-                      + i
+-                      + strlen (DEBUG_SUBDIRECTORY)
+-                      + strlen ("/")
+-                      + strlen (basename)
+-                      + 1);
++  debugfile = xmalloc (strlen (debug_file_directory) + 1
++                     + i
++                     + strlen (DEBUG_SUBDIRECTORY)
++                     + strlen ("/")
++                     + strlen (basename)
++                     + 1);
+   /* First try in the same directory as the original file.  */
+   strcpy (debugfile, dir);
+   strcat (debugfile, basename);
+   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+-    {
+-      xfree (basename);
+-      xfree (dir);
+-      xfree (canon_name);
+-      return xstrdup (debugfile);
+-    }
++    goto cleanup_return_debugfile;
+   /* Then try in the subdirectory named DEBUG_SUBDIRECTORY.  */
+   strcpy (debugfile, dir);
+@@ -1414,12 +1408,7 @@ find_separate_debug_file (struct objfile *objfile)
+   strcat (debugfile, basename);
+   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+-    {
+-      xfree (basename);
+-      xfree (dir);
+-      xfree (canon_name);
+-      return xstrdup (debugfile);
+-    }
++    goto cleanup_return_debugfile;
+   /* Then try in the global debugfile directory.  */
+   strcpy (debugfile, debug_file_directory);
+@@ -1428,12 +1417,7 @@ find_separate_debug_file (struct objfile *objfile)
+   strcat (debugfile, basename);
+   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+-    {
+-      xfree (basename);
+-      xfree (dir);
+-      xfree (canon_name);
+-      return xstrdup (debugfile);
+-    }
++    goto cleanup_return_debugfile;
+   /* If the file is in the sysroot, try using its base path in the
+      global debugfile directory.  */
+@@ -1447,20 +1431,17 @@ find_separate_debug_file (struct objfile *objfile)
+       strcat (debugfile, basename);
+       if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+-      {
+-        xfree (canon_name);
+-        xfree (basename);
+-        xfree (dir);
+-        return xstrdup (debugfile);
+-      }
++      goto cleanup_return_debugfile;
+     }
+   
+-  if (canon_name)
+-    xfree (canon_name);
++  xfree (debugfile);
++  debugfile = NULL;
++cleanup_return_debugfile:
++  xfree (canon_name);
+   xfree (basename);
+   xfree (dir);
+-  return NULL;
++  return debugfile;
+ }
+
diff --git a/gdb-bz528668-symfile-multi.patch b/gdb-bz528668-symfile-multi.patch
new file mode 100644 (file)
index 0000000..e773f2f
--- /dev/null
@@ -0,0 +1,271 @@
+http://sourceware.org/ml/gdb-patches/2009-10/msg00508.html
+Subject: [patch 3/3] debug-file-directory with multiple components
+
+Hi,
+
+for various reasons `debug-file-directory' would be sometimes useful to have
+multiple components such as `solib-search-path' has.
+
+I found it useful myself during various separate debuginfo tests/scripts.
+
+It was requested for the ABRT bugreporting project at the preceding mail of:
+       https://fedorahosted.org/pipermail/crash-catcher/2009-October/000054.html
+
+It should be a backward compatible extension as DIRNAME_SEPARATOR should never
+be a valid part of a single DEBUG_FILE_DIRECTORY component.
+
+
+Thanks,
+Jan
+
+
+gdb/doc/
+2009-10-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.texinfo (set debug-file-directory, show debug-file-directory)
+       (Auto-loading): Use plural and note one can use multiple components now.
+
+gdb/
+2009-10-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * symfile.c (build_id_to_debug_filename): New variable debugdir.  Move
+       variables size, s and data into a new inner block.  Change xmalloc for
+       alloca, use direct BUILDID->SIZE there now.  Loop for the
+       DEBUG_FILE_DIRECTORY components.
+       (find_separate_debug_file): New variable debugdir and debugdir_end.
+       Loop for the DEBUG_FILE_DIRECTORY components.
+       (_initialize_symfile): For "debug-file-directory" use plural and note
+       one can use multiple components now.
+
+gdb/testsuite/
+2009-10-22  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/sepdebug.exp: New test_different_dir call for multiple-dirs.
+
+--- a/gdb/doc/gdb.texinfo
++++ b/gdb/doc/gdb.texinfo
+@@ -14066,13 +14066,14 @@ name @value{GDBN} is currently using.
+ @table @code
+ @kindex set debug-file-directory
+-@item set debug-file-directory @var{directory}
+-Set the directory which @value{GDBN} searches for separate debugging
+-information files to @var{directory}.
++@item set debug-file-directory @var{directories}
++Set the directories which @value{GDBN} searches for separate debugging
++information files to @var{directory}.  Multiple directory components can be set
++concatenating them by a directory separator.
+ @kindex show debug-file-directory
+ @item show debug-file-directory
+-Show the directory @value{GDBN} searches for separate debugging
++Show the directories @value{GDBN} searches for separate debugging
+ information files.
+ @end table
+@@ -19336,8 +19337,8 @@ readable, @value{GDBN} will evaluate it as a Python script.
+ If this file does not exist, and if the parameter
+ @code{debug-file-directory} is set (@pxref{Separate Debug Files}),
+-then @value{GDBN} will use the file named
+-@file{@var{debug-file-directory}/@var{real-name}}, where
++then @value{GDBN} will use for its each separated directory component
++@code{component} the file named @file{@code{component}/@var{real-name}}, where
+ @var{real-name} is the object file's real name, as described above.
+ Finally, if this file does not exist, then @value{GDBN} will look for
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -1218,35 +1218,59 @@ build_id_verify (const char *filename, struct build_id *check)
+ static char *
+ build_id_to_debug_filename (struct build_id *build_id)
+ {
+-  char *link, *s, *retval = NULL;
+-  gdb_byte *data = build_id->data;
+-  size_t size = build_id->size;
++  char *link, *debugdir, *retval = NULL;
+   /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
+-  link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+-                + 2 * size + (sizeof ".debug" - 1) + 1);
+-  s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
+-  if (size > 0)
+-    {
+-      size--;
+-      s += sprintf (s, "%02x", (unsigned) *data++);
+-    }
+-  if (size > 0)
+-    *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);
+-  xfree (link);
+-
+-  if (retval != NULL && !build_id_verify (retval, build_id))
++  link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
++               + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
++
++  /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
++     cause "/.build-id/..." lookups.  */
++
++  debugdir = debug_file_directory;
++  do
+     {
+-      xfree (retval);
+-      retval = NULL;
++      char *s, *debugdir_end;
++      gdb_byte *data = build_id->data;
++      size_t size = build_id->size;
++
++      while (*debugdir == DIRNAME_SEPARATOR)
++      debugdir++;
++
++      debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
++      if (debugdir_end == NULL)
++      debugdir_end = &debugdir[strlen (debugdir)];
++
++      memcpy (link, debugdir, debugdir_end - debugdir);
++      s = &link[debugdir_end - debugdir];
++      s += sprintf (s, "/.build-id/");
++      if (size > 0)
++      {
++        size--;
++        s += sprintf (s, "%02x", (unsigned) *data++);
++      }
++      if (size > 0)
++      *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))
++      {
++        xfree (retval);
++        retval = NULL;
++      }
++
++      if (retval != NULL)
++      break;
++
++      debugdir = debugdir_end;
+     }
++  while (*debugdir != 0);
+   return retval;
+ }
+@@ -1333,7 +1357,7 @@ static char *
+ find_separate_debug_file (struct objfile *objfile)
+ {
+   asection *sect;
+-  char *basename, *name_copy;
++  char *basename, *name_copy, *debugdir;
+   char *dir = NULL;
+   char *debugfile = NULL;
+   char *canon_name = NULL;
+@@ -1410,29 +1434,51 @@ find_separate_debug_file (struct objfile *objfile)
+   if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+     goto cleanup_return_debugfile;
+-  /* Then try in the global debugfile directory.  */
+-  strcpy (debugfile, debug_file_directory);
+-  strcat (debugfile, "/");
+-  strcat (debugfile, dir);
+-  strcat (debugfile, basename);
+-
+-  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+-    goto cleanup_return_debugfile;
++  /* Then try in the global debugfile directories.
++ 
++     Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
++     cause "/..." lookups.  */
+-  /* If the file is in the sysroot, try using its base path in the
+-     global debugfile directory.  */
+-  if (canon_name
+-      && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
+-      && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
++  debugdir = debug_file_directory;
++  do
+     {
+-      strcpy (debugfile, debug_file_directory);
+-      strcat (debugfile, canon_name + strlen (gdb_sysroot));
++      char *debugdir_end;
++
++      while (*debugdir == DIRNAME_SEPARATOR)
++      debugdir++;
++
++      debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
++      if (debugdir_end == NULL)
++      debugdir_end = &debugdir[strlen (debugdir)];
++
++      memcpy (debugfile, debugdir, debugdir_end - debugdir);
++      debugfile[debugdir_end - debugdir] = 0;
+       strcat (debugfile, "/");
++      strcat (debugfile, dir);
+       strcat (debugfile, basename);
+       if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+       goto cleanup_return_debugfile;
++
++      /* If the file is in the sysroot, try using its base path in the
++       global debugfile directory.  */
++      if (canon_name
++        && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
++        && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
++      {
++        memcpy (debugfile, debugdir, debugdir_end - debugdir);
++        debugfile[debugdir_end - debugdir] = 0;
++        strcat (debugfile, canon_name + strlen (gdb_sysroot));
++        strcat (debugfile, "/");
++        strcat (debugfile, basename);
++
++        if (separate_debug_file_exists (debugfile, crc32, objfile->name))
++          goto cleanup_return_debugfile;
++      }
++
++      debugdir = debugdir_end;
+     }
++  while (*debugdir != 0);
+   
+   xfree (debugfile);
+   debugfile = NULL;
+@@ -4173,12 +4219,12 @@ Usage: set extension-language .foo bar"),
+   add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
+                                    &debug_file_directory, _("\
+-Set the directory where separate debug symbols are searched for."), _("\
+-Show the directory where separate debug symbols are searched for."), _("\
++Set the directories where separate debug symbols are searched for."), _("\
++Show the directories where separate debug symbols are searched for."), _("\
+ Separate debug symbols are first searched for in the same\n\
+ directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
+ and lastly at the path of the directory of the binary with\n\
+-the global debug-file directory prepended."),
++each global debug-file-directory component prepended."),
+                                    NULL,
+                                    show_debug_file_directory,
+                                    &setlist, &showlist);
+--- a/gdb/testsuite/gdb.base/sepdebug.exp
++++ b/gdb/testsuite/gdb.base/sepdebug.exp
+@@ -995,6 +995,12 @@ if ![string compare $build_id_debug_filename ""] then {
+     test_different_dir build-id "${objdir}/${subdir}" $xfail
++    # Test also multiple directories can be specified.  Without the build-id
++    # reference GDB would find the separate debug info just at the same
++    # location as the executable file.
++
++    test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail
++
+     # Spare debug files may confuse testsuite runs in the future.
+     remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
+ }
+
diff --git a/gdb-bz528668-symfile-sepcrc.patch b/gdb-bz528668-symfile-sepcrc.patch
new file mode 100644 (file)
index 0000000..387e45f
--- /dev/null
@@ -0,0 +1,151 @@
+http://sourceware.org/ml/gdb-patches/2009-10/msg00507.html
+Subject: [patch 1/3] print the .debug file name having CRC mismatch
+
+Hi,
+
+this patch is left as is from Andrew Cagney.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2005-04-02  Andrew Cagney  <cagney@gnu.org>
+
+       * symfile.c (separate_debug_file_exists): When the CRCs mismatch
+       print a warning.
+       (find_separate_debug_file): Pass in the objfile's name.
+
+gdb/testsuite/
+2009-10-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.base/sepdebug.exp (CRC mismatch is reported): New test.
+       * gdb.base/sepdebug2.c: New file.
+
+--- a/gdb/symfile.c
++++ b/gdb/symfile.c
+@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
+ }
+ static int
+-separate_debug_file_exists (const char *name, unsigned long crc)
++separate_debug_file_exists (const char *name, unsigned long crc,
++                          const char *parent_name)
+ {
+   unsigned long file_crc = 0;
+   bfd *abfd;
+@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc)
+   bfd_close (abfd);
+-  return crc == file_crc;
++  if (crc != file_crc)
++    {
++      warning (_("the debug information found in \"%s\""
++               " does not match \"%s\" (CRC mismatch).\n"),
++             name, parent_name);
++      return 0;
++    }
++
++  return 1;
+ }
+ char *debug_file_directory = NULL;
+@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile)
+   basename = get_debug_link_info (objfile, &crc32);
+   if (basename == NULL)
++    /* There's no separate debug info, hence there's no way we could
++       load it => no warning.  */
+     return NULL;
+   dir = xstrdup (objfile->name);
+@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile)
+   strcpy (debugfile, dir);
+   strcat (debugfile, basename);
+-  if (separate_debug_file_exists (debugfile, crc32))
++  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+     {
+       xfree (basename);
+       xfree (dir);
+@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile)
+   strcat (debugfile, "/");
+   strcat (debugfile, basename);
+-  if (separate_debug_file_exists (debugfile, crc32))
++  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+     {
+       xfree (basename);
+       xfree (dir);
+@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile)
+   strcat (debugfile, dir);
+   strcat (debugfile, basename);
+-  if (separate_debug_file_exists (debugfile, crc32))
++  if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+     {
+       xfree (basename);
+       xfree (dir);
+@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile)
+       strcat (debugfile, "/");
+       strcat (debugfile, basename);
+-      if (separate_debug_file_exists (debugfile, crc32))
++      if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+       {
+         xfree (canon_name);
+         xfree (basename);
+--- a/gdb/testsuite/gdb.base/sepdebug.exp
++++ b/gdb/testsuite/gdb.base/sepdebug.exp
+@@ -952,6 +952,23 @@ set debugfile "${objdir}/${subdir}/${testfile}.debug"
+ test_different_dir debuglink "${objdir}/${subdir}" 0
++# Test CRC mismatch is reported.
++
++if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
++    && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} {
++
++    remote_exec build "cp ${debugfile} ${objdir}/${subdir}/.debug/sepdebug2.debug"
++
++    gdb_exit
++    gdb_start
++    gdb_reinitialize_dir $srcdir/$subdir
++
++    set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}]
++
++    gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/\\.debug/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
++}
++
++
+ # NT_GNU_BUILD_ID / .note.gnu.build-id test:
+ set build_id_debug_filename [build_id_debug_filename_get $binfile]
+--- /dev/null
++++ b/gdb/testsuite/gdb.base/sepdebug2.c
+@@ -0,0 +1,22 @@
++/* 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/>.  */
++
++int
++main (void)
++{
++  return 0;
++}
+
diff --git a/gdb-bz538626-bp_location-accel-bp-cond.patch b/gdb-bz538626-bp_location-accel-bp-cond.patch
new file mode 100644 (file)
index 0000000..f734d51
--- /dev/null
@@ -0,0 +1,134 @@
+Index: gdb-7.0/gdb/breakpoint.c
+===================================================================
+--- gdb-7.0.orig/gdb/breakpoint.c      2009-11-25 10:24:49.000000000 +0100
++++ gdb-7.0/gdb/breakpoint.c   2009-11-25 10:28:35.000000000 +0100
+@@ -337,14 +337,21 @@ static int executing_startup;
+            B ? (TMP=B->next, 1): 0;   \
+            B = TMP)
+-/* Similar iterator for the low-level breakpoints.  SAFE variant is not
+-   provided so update_global_location_list must not be called while executing
+-   the block of ALL_BP_LOCATIONS.  */
+-
+-#define ALL_BP_LOCATIONS(B,BP_TMP)                                    \
+-      for (BP_TMP = bp_location;                                      \
+-           BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \
+-           BP_TMP++)
++/* Similar iterator for the low-level breakpoints.  This iterator
++   requires a defined BP_LOCATION array and BP_LOCATION_COUNT.  */
++
++#define ALL_BP_LOCATIONS_FROM(B,BP_TMP,BP_LOCATION,BP_LOCATION_COUNT) \
++  for (BP_TMP = BP_LOCATION;                                          \
++       BP_TMP < BP_LOCATION + BP_LOCATION_COUNT && (B = *BP_TMP);     \
++       BP_TMP++)
++
++/* Iterator that calls ALL_BP_LOCATIONS_FROM with the global
++   bp_locations and bp_location_count variables.  SAFE variant is not
++   provided so update_global_location_list must not be called while
++   executing the block of ALL_BP_LOCATIONS.  */
++
++#define ALL_BP_LOCATIONS(B,BP_TMP) \
++  ALL_BP_LOCATIONS_FROM(B,BP_TMP,bp_location, bp_location_count)
+ /* Iterator for tracepoints only.  */
+@@ -3313,6 +3320,7 @@ bpstat_check_breakpoint_conditions (bpst
+ bpstat
+ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid)
+ {
++  struct cleanup *old_chain;
+   struct breakpoint *b = NULL;
+   struct bp_location *bl, **blp_tmp;
+   struct bp_location *loc;
+@@ -3322,8 +3330,14 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
+   bpstat bs = root_bs;
+   int ix;
+   int need_remove_insert, update_locations = 0;
++  struct bp_location  **saved_bp_location; 
++  int saved_bp_location_count = bp_location_count; 
+-  ALL_BP_LOCATIONS (bl, blp_tmp)
++  saved_bp_location = xmalloc (sizeof (*bp_location) * bp_location_count);
++  memcpy (saved_bp_location, bp_location, sizeof (*bp_location) * bp_location_count);
++  old_chain = make_cleanup (xfree, saved_bp_location);
++
++  ALL_BP_LOCATIONS_FROM (bl, blp_tmp, saved_bp_location, saved_bp_location_count)
+   {
+     bpstat bs_prev = bs;
+@@ -3460,6 +3474,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
+       insert_breakpoints ();
+     }
++  do_cleanups (old_chain);
+   return root_bs->next;
+ }
\f
+Index: gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp
+===================================================================
+--- gdb-7.0.orig/gdb/testsuite/gdb.base/condbreak.exp  2009-01-03 06:58:03.000000000 +0100
++++ gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp       2009-11-25 10:27:50.000000000 +0100
+@@ -68,6 +68,8 @@ set bp_location1  [gdb_get_line_number "
+ set bp_location6  [gdb_get_line_number "set breakpoint 6 here"]
+ set bp_location8  [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
+ set bp_location9  [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
++set bp_location13  [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
++set bp_location14  [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
+ set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
+ set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
+@@ -110,15 +112,23 @@ gdb_test "break marker2 if (a==43)" \
+     "Breakpoint.*at.* file .*$srcfile1, line.*"
+ #
++# Check break involving inferior function call.
++#
++gdb_test "break marker4 if (multi_line_if_conditional(1,1,1)==0)" \
++    "Breakpoint.*at.* file .*$srcfile1, line.*"
++
++#
+ # check to see what breakpoints are set
+ #
+ if {$hp_aCC_compiler} {
+     set marker1_proto "\\(void\\)"
+     set marker2_proto "\\(int\\)"
++    set marker4_proto "\\(long\\)"
+ } else {
+     set marker1_proto ""
+     set marker2_proto ""
++    set marker4_proto ""
+ }
+ gdb_test "info break" \
+@@ -129,7 +139,9 @@ gdb_test "info break" \
+ \[0-9\]+\[\t \]+breakpoint     keep y.* in main at .*$srcfile:$bp_location1.*
+ \[\t \]+stop only if \\(1==1\\).*
+ \[0-9\]+\[\t \]+breakpoint     keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
+-\[\t \]+stop only if \\(a==43\\).*" \
++\[\t \]+stop only if \\(a==43\\).*
++\[0-9\]+\[\t \]+breakpoint     keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*
++\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*" \
+     "breakpoint info"
+@@ -220,3 +232,19 @@ gdb_expect {
+       fail "(timeout) run until breakpoint at marker2"
+     }
+ }
++
++send_gdb "continue\n"
++gdb_expect {
++    -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" {
++      pass "run until breakpoint at marker4"
++    }
++    -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" {
++      xfail "run until breakpoint at marker4"
++    }
++    -re "$gdb_prompt $" {
++      fail "run until breakpoint at marker4"
++    }
++    timeout {
++      fail "(timeout) run until breakpoint at marker4"
++    }
++}
diff --git a/gdb-bz539590-gnu-ifunc.patch b/gdb-bz539590-gnu-ifunc.patch
new file mode 100644 (file)
index 0000000..2f1b80b
--- /dev/null
@@ -0,0 +1,511 @@
+gdb/
+2009-11-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Transparent GNU-IFUNCs support.
+       * elfread.c (record_minimal_symbol): Apply also for mst_text_gnu_ifunc.
+       (elf_symtab_read): Set also mst_text_gnu_ifunc.
+       * gdbtypes.c (init_type): Support TYPE_FLAG_GNU_IFUNC.
+       (gdbtypes_post_init): Initialize builtin_func_func_ptr.
+       (objfile_type): Initialize nodebug_text_gnu_ifunc_symbol.
+       * gdbtypes.h (enum type_flag_value <TYPE_FLAG_GNU_IFUNC>)
+       (TYPE_GNU_IFUNC, struct main_type <flag_gnu_ifunc>)
+       (struct builtin_type <builtin_func_func_ptr>)
+       (struct objfile_type <nodebug_text_gnu_ifunc_symbol>): New.
+       * infcall.c (find_function_addr <TYPE_GNU_IFUNC (ftype)>): New.
+       * minsyms.c (lookup_minimal_symbol_text, prim_record_minimal_symbol)
+       (find_solib_trampoline_target): Support also mst_text_gnu_ifunc.
+       (in_gnu_ifunc_stub): New.
+       * parse.c (write_exp_msymbol <mst_text_gnu_ifunc>): New.
+       * solib-svr4.c (svr4_in_dynsym_resolve_code): Call also
+       in_gnu_ifunc_stub.
+       * symmisc.c (dump_msymbols <mst_text_gnu_ifunc>): New.
+       * symtab.c (search_symbols): Support also mst_text_gnu_ifunc.
+       * symtab.h (enum minimal_symbol_type <mst_text_gnu_ifunc>)
+       (in_gnu_ifunc_stub): New.
+       * linespec.c: Include infcall.h.
+       (minsym_found <MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc>): New.
+
+gdb/testsuite/
+2009-11-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Transparent GNU-IFUNCs support.
+       * gdb.base/gnu-ifunc-lib.c, gdb.base/gnu-ifunc.c,
+       gdb.base/gnu-ifunc.exp: New.
+
+Index: gdb-7.0/gdb/elfread.c
+===================================================================
+--- gdb-7.0.orig/gdb/elfread.c 2009-11-25 10:24:45.000000000 +0100
++++ gdb-7.0/gdb/elfread.c      2009-11-25 10:25:50.000000000 +0100
+@@ -168,7 +168,8 @@ record_minimal_symbol (char *name, CORE_
+ {
+   struct gdbarch *gdbarch = get_objfile_arch (objfile);
+-  if (ms_type == mst_text || ms_type == mst_file_text)
++  if (ms_type == mst_text || ms_type == mst_file_text
++      || ms_type == mst_text_gnu_ifunc)
+     address = gdbarch_smash_text_address (gdbarch, address);
+   return prim_record_minimal_symbol_and_info
+@@ -373,7 +374,10 @@ elf_symtab_read (struct objfile *objfile
+           {
+             if (sym->flags & (BSF_GLOBAL | BSF_WEAK))
+               {
+-                ms_type = mst_text;
++                if (sym->flags & BSF_GNU_INDIRECT_FUNCTION)
++                  ms_type = mst_text_gnu_ifunc;
++                else
++                  ms_type = mst_text;
+               }
+             else if ((sym->name[0] == '.' && sym->name[1] == 'L')
+                      || ((sym->flags & BSF_LOCAL)
+Index: gdb-7.0/gdb/gdbtypes.c
+===================================================================
+--- gdb-7.0.orig/gdb/gdbtypes.c        2009-11-25 10:24:47.000000000 +0100
++++ gdb-7.0/gdb/gdbtypes.c     2009-11-25 10:24:56.000000000 +0100
+@@ -1904,6 +1904,8 @@ init_type (enum type_code code, int leng
+     TYPE_NOTTEXT (type) = 1;
+   if (flags & TYPE_FLAG_FIXED_INSTANCE)
+     TYPE_FIXED_INSTANCE (type) = 1;
++  if (flags & TYPE_FLAG_GNU_IFUNC)
++    TYPE_GNU_IFUNC (type) = 1;
+   if (name)
+     TYPE_NAME (type) = obsavestring (name, strlen (name),
+@@ -3762,6 +3764,8 @@ gdbtypes_post_init (struct gdbarch *gdba
+     = lookup_pointer_type (builtin_type->builtin_void);
+   builtin_type->builtin_func_ptr
+     = lookup_pointer_type (lookup_function_type (builtin_type->builtin_void));
++  builtin_type->builtin_func_func_ptr
++    = lookup_pointer_type (lookup_function_type (builtin_type->builtin_func_ptr));
+   /* This type represents a GDB internal function.  */
+   builtin_type->internal_fn
+@@ -3878,6 +3882,11 @@ objfile_type (struct objfile *objfile)
+                "<text variable, no debug info>", objfile);
+   TYPE_TARGET_TYPE (objfile_type->nodebug_text_symbol)
+     = objfile_type->builtin_int;
++  objfile_type->nodebug_text_gnu_ifunc_symbol
++    = init_type (TYPE_CODE_FUNC, 1, TYPE_FLAG_GNU_IFUNC,
++               "<text gnu-ifunc variable, no debug info>", objfile);
++  TYPE_TARGET_TYPE (objfile_type->nodebug_text_gnu_ifunc_symbol)
++    = objfile_type->nodebug_text_symbol;
+   objfile_type->nodebug_data_symbol
+     = init_type (TYPE_CODE_INT,
+                gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+Index: gdb-7.0/gdb/gdbtypes.h
+===================================================================
+--- gdb-7.0.orig/gdb/gdbtypes.h        2009-11-25 10:24:48.000000000 +0100
++++ gdb-7.0/gdb/gdbtypes.h     2009-11-25 10:25:17.000000000 +0100
+@@ -187,6 +187,7 @@ enum type_flag_value
+   TYPE_FLAG_FIXED_INSTANCE = (1 << 15),
+   TYPE_FLAG_STUB_SUPPORTED = (1 << 16),
+   TYPE_FLAG_NOTTEXT = (1 << 17),
++  TYPE_FLAG_GNU_IFUNC = (1 << 18),
+   /* Used for error-checking.  */
+   TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED
+@@ -292,6 +293,12 @@ enum type_instance_flag_value
+ #define TYPE_NOTTEXT(t)               (TYPE_MAIN_TYPE (t)->flag_nottext)
++/* Currently used only for TYPE_CODE_FUNC where specifies the real function
++   address is returned by this function call.  TYPE_TARGET_TYPE determines the
++   final returned function type to be presented to user.  */
++
++#define TYPE_GNU_IFUNC(t)     (TYPE_MAIN_TYPE (t)->flag_gnu_ifunc)
++
+ /* Type owner.  If TYPE_OBJFILE_OWNED is true, the type is owned by
+    the objfile retrieved as TYPE_OBJFILE.  Otherweise, the type is
+    owned by an architecture; TYPE_OBJFILE is NULL in this case.  */
+@@ -427,6 +434,7 @@ struct main_type
+   unsigned int flag_vector : 1;
+   unsigned int flag_stub_supported : 1;
+   unsigned int flag_nottext : 1;
++  unsigned int flag_gnu_ifunc : 1;
+   unsigned int flag_fixed_instance : 1;
+   unsigned int flag_objfile_owned : 1;
+   unsigned int flag_discardable : 1;
+@@ -1144,6 +1152,10 @@ struct builtin_type
+      (*) () can server as a generic function pointer.  */
+   struct type *builtin_func_ptr;
++  /* `pointer to function returning pointer to function (returning void)' type.
++     The final void return type is not significant for it.  */
++  struct type *builtin_func_func_ptr;
++
+   /* Special-purpose types.  */
+@@ -1186,6 +1198,7 @@ struct objfile_type
+   /* Types used for symbols with no debug information.  */
+   struct type *nodebug_text_symbol;
++  struct type *nodebug_text_gnu_ifunc_symbol;
+   struct type *nodebug_data_symbol;
+   struct type *nodebug_unknown_symbol;
+   struct type *nodebug_tls_symbol;
+Index: gdb-7.0/gdb/infcall.c
+===================================================================
+--- gdb-7.0.orig/gdb/infcall.c 2009-11-25 10:24:45.000000000 +0100
++++ gdb-7.0/gdb/infcall.c      2009-11-25 10:24:56.000000000 +0100
+@@ -286,6 +286,27 @@ find_function_addr (struct value *functi
+   else
+     error (_("Invalid data type for function to be called."));
++  if (TYPE_GNU_IFUNC (ftype))
++    {
++      struct type *func_func_ptr;
++
++      funaddr += gdbarch_deprecated_function_start_offset (gdbarch);
++
++      /* Cast FUNADDR to drop TYPE_GNU_IFUNC and being able to call gnu-ifunc
++       FUNADDR without causing deadlock by this block of code.  */
++
++      func_func_ptr = builtin_type (gdbarch)->builtin_func_func_ptr;
++      function = value_from_pointer (func_func_ptr, funaddr);
++
++      /* gnu-ifuncs have no arguments.  */
++      function = call_function_by_hand (function, 0, NULL);
++
++      funaddr = value_as_address (function);
++
++      /* This is `int' as the return type of the final function.  */
++      value_type = TYPE_TARGET_TYPE (value_type);
++    }
++
+   if (retval_type != NULL)
+     *retval_type = value_type;
+   return funaddr + gdbarch_deprecated_function_start_offset (gdbarch);
+Index: gdb-7.0/gdb/linespec.c
+===================================================================
+--- gdb-7.0.orig/gdb/linespec.c        2009-11-25 10:24:45.000000000 +0100
++++ gdb-7.0/gdb/linespec.c     2009-11-25 10:24:56.000000000 +0100
+@@ -40,6 +40,7 @@
+ #include "interps.h"
+ #include "mi/mi-cmds.h"
+ #include "target.h"
++#include "infcall.h"
+ /* We share this one with symtab.c, but it is not exported widely. */
+@@ -1875,6 +1876,22 @@ minsym_found (int funfirstline, struct m
+   pc = gdbarch_convert_from_func_ptr_addr (gdbarch,
+                                            values.sals[0].pc,
+                                            &current_target);
++
++  /* Call gnu-ifunc to resolve breakpoint at its returned function.  */
++  if (MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
++    {
++      struct type *func_func_ptr;
++      struct value *function;
++
++      func_func_ptr = builtin_type (gdbarch)->builtin_func_func_ptr;
++      function = value_from_pointer (func_func_ptr, pc);
++
++      /* gnu-ifuncs have no arguments.  */
++      function = call_function_by_hand (function, 0, NULL);
++
++      pc = value_as_address (function);
++    }
++
+   if (pc != values.sals[0].pc)
+     values.sals[0] = find_pc_sect_line (pc, NULL, 0);
+Index: gdb-7.0/gdb/minsyms.c
+===================================================================
+--- gdb-7.0.orig/gdb/minsyms.c 2009-11-25 10:24:47.000000000 +0100
++++ gdb-7.0/gdb/minsyms.c      2009-11-25 10:24:56.000000000 +0100
+@@ -331,8 +331,9 @@ lookup_minimal_symbol_text (const char *
+              msymbol = msymbol->hash_next)
+           {
+             if (strcmp (SYMBOL_LINKAGE_NAME (msymbol), name) == 0 &&
+-                (MSYMBOL_TYPE (msymbol) == mst_text ||
+-                 MSYMBOL_TYPE (msymbol) == mst_file_text))
++                (MSYMBOL_TYPE (msymbol) == mst_text
++                 || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc
++                 || MSYMBOL_TYPE (msymbol) == mst_file_text))
+               {
+                 switch (MSYMBOL_TYPE (msymbol))
+                   {
+@@ -699,6 +700,16 @@ lookup_minimal_symbol_by_pc (CORE_ADDR p
+ {
+   return lookup_minimal_symbol_by_pc_section (pc, NULL);
+ }
++
++/* Return non-zero iff PC is in function implementing gnu-ifunc selection.  */
++
++int
++in_gnu_ifunc_stub (CORE_ADDR pc)
++{
++  struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (pc);
++
++  return msymbol && MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc;
++}
\f
+ /* Return leading symbol character for a BFD. If BFD is NULL,
+@@ -738,6 +749,7 @@ prim_record_minimal_symbol (const char *
+   switch (ms_type)
+     {
+     case mst_text:
++    case mst_text_gnu_ifunc:
+     case mst_file_text:
+     case mst_solib_trampoline:
+       section = SECT_OFF_TEXT (objfile);
+@@ -1184,7 +1196,8 @@ find_solib_trampoline_target (struct fra
+     {
+       ALL_MSYMBOLS (objfile, msymbol)
+       {
+-      if (MSYMBOL_TYPE (msymbol) == mst_text
++      if ((MSYMBOL_TYPE (msymbol) == mst_text
++          || MSYMBOL_TYPE (msymbol) == mst_text_gnu_ifunc)
+           && strcmp (SYMBOL_LINKAGE_NAME (msymbol),
+                      SYMBOL_LINKAGE_NAME (tsymbol)) == 0)
+         return SYMBOL_VALUE_ADDRESS (msymbol);
+Index: gdb-7.0/gdb/parse.c
+===================================================================
+--- gdb-7.0.orig/gdb/parse.c   2009-11-25 10:24:47.000000000 +0100
++++ gdb-7.0/gdb/parse.c        2009-11-25 10:26:16.000000000 +0100
+@@ -517,6 +517,11 @@ write_exp_msymbol (struct minimal_symbol
+       write_exp_elt_type (objfile_type (objfile)->nodebug_text_symbol);
+       break;
++    case mst_text_gnu_ifunc:
++      write_exp_elt_type (objfile_type (objfile)
++                                             ->nodebug_text_gnu_ifunc_symbol);
++      break;
++
+     case mst_data:
+     case mst_file_data:
+     case mst_bss:
+Index: gdb-7.0/gdb/solib-svr4.c
+===================================================================
+--- gdb-7.0.orig/gdb/solib-svr4.c      2009-11-25 10:24:49.000000000 +0100
++++ gdb-7.0/gdb/solib-svr4.c   2009-11-25 10:26:41.000000000 +0100
+@@ -1242,7 +1242,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR p
+ {
+   return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
+         || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
+-        || in_plt_section (pc, NULL));
++        || in_plt_section (pc, NULL)
++        || in_gnu_ifunc_stub (pc));
+ }
+ /* Given an executable's ABFD and target, compute the entry-point
+Index: gdb-7.0/gdb/symmisc.c
+===================================================================
+--- gdb-7.0.orig/gdb/symmisc.c 2009-11-25 10:24:47.000000000 +0100
++++ gdb-7.0/gdb/symmisc.c      2009-11-25 10:24:56.000000000 +0100
+@@ -287,6 +287,9 @@ dump_msymbols (struct objfile *objfile, 
+       case mst_text:
+         ms_type = 'T';
+         break;
++      case mst_text_gnu_ifunc:
++        ms_type = 'i';
++        break;
+       case mst_solib_trampoline:
+         ms_type = 'S';
+         break;
+Index: gdb-7.0/gdb/symtab.c
+===================================================================
+--- gdb-7.0.orig/gdb/symtab.c  2009-11-25 10:24:47.000000000 +0100
++++ gdb-7.0/gdb/symtab.c       2009-11-25 10:24:56.000000000 +0100
+@@ -3155,7 +3155,7 @@ search_symbols (char *regexp, domain_enu
+   {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
+   static enum minimal_symbol_type types4[]
+   =
+-  {mst_file_bss, mst_text, mst_abs, mst_unknown};
++  {mst_file_bss, mst_text_gnu_ifunc, mst_abs, mst_unknown};
+   enum minimal_symbol_type ourtype;
+   enum minimal_symbol_type ourtype2;
+   enum minimal_symbol_type ourtype3;
+Index: gdb-7.0/gdb/symtab.h
+===================================================================
+--- gdb-7.0.orig/gdb/symtab.h  2009-11-25 10:24:45.000000000 +0100
++++ gdb-7.0/gdb/symtab.h       2009-11-25 10:24:56.000000000 +0100
+@@ -275,6 +275,8 @@ enum minimal_symbol_type
+ {
+   mst_unknown = 0,            /* Unknown type, the default */
+   mst_text,                   /* Generally executable instructions */
++  mst_text_gnu_ifunc,         /* Executable code returning address
++                                 of executable code */
+   mst_data,                   /* Generally initialized data */
+   mst_bss,                    /* Generally uninitialized data */
+   mst_abs,                    /* Generally absolute (nonrelocatable) */
+@@ -1149,6 +1151,8 @@ extern struct minimal_symbol *lookup_min
+ extern struct minimal_symbol *lookup_minimal_symbol_by_pc (CORE_ADDR);
++extern int in_gnu_ifunc_stub (CORE_ADDR pc);
++
+ extern struct minimal_symbol
+   *lookup_minimal_symbol_by_pc_section (CORE_ADDR, struct obj_section *);
+Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc-lib.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc-lib.c     2009-11-25 10:24:56.000000000 +0100
+@@ -0,0 +1,45 @@
++/* 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/>.  */
++
++#include <assert.h>
++
++typedef int (*final_t) (int arg);
++
++static int
++final (int arg)
++{
++  return arg + 1;
++}
++
++static volatile int gnu_ifunc_initialized;
++
++void
++gnu_ifunc_pre (void)
++{
++  assert (!gnu_ifunc_initialized);
++}
++
++final_t gnu_ifuncX (void) asm ("gnu_ifunc");
++asm (".type gnu_ifunc, @gnu_indirect_function");
++
++final_t
++gnu_ifuncX (void)
++{
++  gnu_ifunc_initialized = 1;
++
++  return final;
++}
+Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.c 2009-11-25 10:24:56.000000000 +0100
+@@ -0,0 +1,36 @@
++/* 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/>.  */
++
++#include <assert.h>
++
++extern int gnu_ifunc (int arg);
++extern void gnu_ifunc_pre (void);
++
++int
++main (void)
++{
++  int i;
++
++  gnu_ifunc_pre ();
++  
++  i = gnu_ifunc (1);  /* break-at-call */
++  assert (i == 2);
++
++  gnu_ifunc (2);      /* break-at-nextcall */
++
++  return 0;   /* break-at-exit */
++}
+Index: gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.exp
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gdb-7.0/gdb/testsuite/gdb.base/gnu-ifunc.exp       2009-11-25 10:24:56.000000000 +0100
+@@ -0,0 +1,72 @@
++# Copyright (C) 2009 Free Software Foundation, Inc.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program.  If not, see <http://www.gnu.org/licenses/>.
++
++if {[skip_shlib_tests]} {
++    return 0
++}
++
++set testfile "gnu-ifunc"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}
++
++set libfile "${testfile}-lib"
++set libsrc ${libfile}.c
++set lib_so ${objdir}/${subdir}/${libfile}.so
++
++set lib_opts [list debug]
++set exec_opts [list debug shlib=$lib_so]
++
++if [get_compiler_info ${binfile}] {
++    return -1
++}
++
++if { [gdb_compile_shlib ${srcdir}/${subdir}/$libsrc $lib_so $lib_opts] != ""
++     || [gdb_compile ${srcdir}/${subdir}/$srcfile $binfile executable $exec_opts] != ""} {
++    untested "Could not compile either $libsrc or $srcfile."
++    return -1
++}
++
++# Start with a fresh gdb.
++
++clean_restart $testfile
++gdb_load_shlibs ${lib_so}
++
++if ![runto_main] then {
++    fail "Can't run to main"
++    return 1;
++}
++
++gdb_breakpoint [gdb_get_line_number "break-at-nextcall"]
++
++gdb_breakpoint [gdb_get_line_number "break-at-call"]
++gdb_continue_to_breakpoint "break-at-call" ".*break-at-call.*"
++
++# Test GDB will automatically indirect the call.
++
++gdb_test "p gnu_ifunc (3)" " = 4"
++
++# Test GDB will skip the gnu_ifunc resolver on first call.
++
++gdb_test "step" "\r\nfinal .*"
++
++# Test GDB will not break before the final chosen implementation.
++
++gdb_continue_to_breakpoint "break-at-nextcall" ".*break-at-nextcall.*"
++
++gdb_breakpoint "gnu_ifunc"
++
++gdb_continue_to_breakpoint "nextcall gnu_ifunc"
++
++gdb_test "frame" "#0 +final \\(.*" "nextcall gnu_ifunc skipped"
diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch
new file mode 100644 (file)
index 0000000..d05e72b
--- /dev/null
@@ -0,0 +1,82 @@
+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,
+
+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.  ]
+
+--- a/gdb/solib-svr4.c
++++ b/gdb/solib-svr4.c
+@@ -1097,8 +1097,18 @@ svr4_current_sos (void)
+         target_read_string (LM_NAME (new), &buffer,
+                             SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+         if (errcode != 0)
+-          warning (_("Can't read pathname for load map: %s."),
+-                   safe_strerror (errcode));
++          {
++            /* During the first ever DSO list reading some strings may be
++               unreadable as residing in the ld.so readonly memory not being
++               present in a dumped core file.  Delay the error check after
++               the first pass of DSO list scanning when ld.so should be
++               already mapped in and all the DSO list l_name memory gets
++               readable.  */
++
++            if (master_so_list () != NULL)
++              warning (_("Can't read pathname for load map: %s."),
++                       safe_strerror (errcode));
++          }
+         else
+           {
+             struct build_id *build_id;
+--- a/gdb/solib.c
++++ b/gdb/solib.c
+@@ -538,6 +538,7 @@ update_solib_list (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;
++  struct so_list *saved_so_list_head = so_list_head;
+   /* We can reach here due to changing solib-search-path or the
+      sysroot, before having any inferior.  */
+@@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target)
+         observer_notify_solib_loaded (i);
+       }
+     }
++
++  /* 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 (from_tty, target);
+ }
+
diff --git a/gdb-readline-6.0-signal.patch b/gdb-readline-6.0-signal.patch
new file mode 100644 (file)
index 0000000..0873bea
--- /dev/null
@@ -0,0 +1,312 @@
+http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
+Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
+
+Hi Chet,
+
+FSF GDB currently ships bundled with readline-5.2 which works fine.
+But using --with-system-readline and readline-6.0-patchlevel4 has
+a regression:
+
+readline-5.2: Run `gdb -nx -q' and type CTRL-C:
+(gdb) Quit
+(gdb) _
+
+readline-6.0: Run `gdb -nx -q' and type CTRL-C:
+(gdb) _
+ = nothing happens (it gets buffered and executed later)
+       (It does also FAIL on gdb.gdb/selftest.exp.)
+
+It is because GDB waits in its own poll() mainloop and readline uses via
+rl_callback_handler_install and rl_callback_handler_remove.  This way the
+readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
+only stored to _rl_caught_signal but not executed.
+
+Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
+_rl_handle_signal is called then the signal is still stored to
+_rl_caught_signal.  In the _rl_interrupt_immediately case it should not be
+stored when it was already processed.
+
+rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
+of its meaning it breaks the nest-counting of other routines which do
+`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
+creating problematic `_rl_interrupt_immediately == -1'.
+
+`_rl_interrupt_immediately' is an internal variable, how it could be accessed
+by a readline application? (OK, maybe it should not be used.)
+
+Attaching a current GDB-side patch but it must access readline internal
+variable _rl_caught_signal and it is generally just a workaround.  Could you
+please include support for signals in this asynchronous mode in readline-6.1?
+I find it would be enough to make RL_CHECK_SIGNALS public?
+
+
+GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+But this is not a patch intended to be accepted.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * config.in, configure: Regenerate.
+       * configure.ac (for readline_echoing_p): Move inside $LIBS change.
+       (for _rl_caught_signal): New.
+       * event-loop.c: Include readline/readline.h.
+       (gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
+
+gdb/testsuite/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * gdb.gdb/selftest.exp (backtrace through signal handler): Move before
+       SIGINT pass, drop the timeout case.
+       (send SIGINT signal to child process): Use gdb_test.
+       (backtrace through readline handler): New.
+
+--- a/gdb/config.in
++++ b/gdb/config.in
+@@ -351,6 +351,9 @@
+ /* Define if Python interpreter is being linked in. */
+ #undef HAVE_PYTHON
++/* readline-6.0 workaround of blocked signals. */
++#undef HAVE_READLINE_CAUGHT_SIGNAL
++
+ /* Define to 1 if you have the `realpath' function. */
+ #undef HAVE_REALPATH
+--- a/gdb/configure.ac
++++ b/gdb/configure.ac
+@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then
+   # readline-6.0 started to use the name `_rl_echoing_p'.
+   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+-  AC_MSG_CHECKING([for readline_echoing_p])
+   save_LIBS=$LIBS
+   LIBS="$LIBS $READLINE"
++  AC_MSG_CHECKING([for readline_echoing_p])
+   AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
+                                   return readline_echoing_p;]]),
+                [READLINE_ECHOING_P=yes],
+                [READLINE_ECHOING_P=no
+                 AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
+                           [readline-6.0 started to use different name.])])
+-  LIBS="$save_LIBS"
+   AC_MSG_RESULT([$READLINE_ECHOING_P])
++  AC_MSG_CHECKING([for _rl_caught_signal])
++  AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
++                                  return _rl_caught_signal;]]),
++               [READLINE_CAUGHT_SIGNAL=yes
++                AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
++                          [readline-6.0 workaround of blocked signals.])],
++               [READLINE_CAUGHT_SIGNAL=no])
++  AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
++  LIBS="$save_LIBS"
+ else
+   READLINE='$(READLINE_DIR)/libreadline.a'
+   READLINE_DEPS='$(READLINE)'
+--- a/gdb/event-loop.c
++++ b/gdb/event-loop.c
+@@ -37,6 +37,7 @@
+ #include "exceptions.h"
+ #include "gdb_assert.h"
+ #include "gdb_select.h"
++#include "readline/readline.h"
+ /* Data point to pass to the event handler.  */
+ typedef union event_data
+@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
+   static int event_source_head = 0;
+   const int number_of_sources = 3;
+   int current = 0;
++#ifdef HAVE_READLINE_CAUGHT_SIGNAL
++  extern int volatile _rl_caught_signal;
++#endif
+   /* Any events already waiting in the queue?  */
+   if (process_event ())
+@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
+   if (gdb_wait_for_event (1) < 0)
+     return -1;
++#ifdef HAVE_READLINE_CAUGHT_SIGNAL
++  if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
++      && _rl_caught_signal)
++    {
++      /* Call RL_CHECK_SIGNALS this way.  */
++      rl_callback_handler_remove ();
++      rl_callback_handler_install (NULL, input_handler);
++    }
++#endif
++
+   /* Handle any new events occurred while waiting.  */
+   if (process_event ())
+     return 1;
+--- a/gdb/testsuite/gdb.gdb/selftest.exp
++++ b/gdb/testsuite/gdb.gdb/selftest.exp
+@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
+           fail "$description (timeout)"
+       }
+     }
+-    
+-    set description "send SIGINT signal to child process"
+-    send_gdb "signal SIGINT\n"
+-    gdb_expect {
+-      -re "Continuing with signal SIGINT.*$gdb_prompt $" {
++
++    # get a stack trace with the poll function
++    #
++    # This fails on some linux systems for unknown reasons.  On the
++    # systems where it fails, sometimes it works fine when run manually.
++    # The testsuite failures may not be limited to just aout systems.
++    setup_xfail "i*86-pc-linuxaout-gnu"
++    set description "backtrace through signal handler"
++    gdb_test_multiple "backtrace" $description {
++      -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+           pass "$description"
+       }
+       -re ".*$gdb_prompt $" {
++          # On the alpha, we hit the infamous problem about gdb
++          # being unable to get the frame pointer (mentioned in
++          # gdb/README).  As it is intermittent, there is no way to
++          # XFAIL it which will give us an XPASS if the problem goes
++          # away.
++          setup_xfail "alpha*-*-osf*"
+           fail "$description"
+       }
+-      timeout {
+-          fail "$description (timeout)"
+-      }
+     }
+     
+-    # get a stack trace
++    gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
++           "send SIGINT signal to child process"
++    
++    # get a stack trace being redelivered by readline
+     #
+     # This fails on some linux systems for unknown reasons.  On the
+     # systems where it fails, sometimes it works fine when run manually.
+     # The testsuite failures may not be limited to just aout systems.
++    # Optional system readline may not have symbols to be shown.
+     setup_xfail "i*86-pc-linuxaout-gnu"
+-    set description "backtrace through signal handler"
+-    send_gdb "backtrace\n"
+-    gdb_expect {
+-      -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
++    set description "backtrace through readline handler"
++    gdb_test_multiple "backtrace" $description {
++      -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+           pass "$description"
+       }
+       -re ".*$gdb_prompt $" {
+@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
+           setup_xfail "alpha*-*-osf*"
+           fail "$description"
+       }
+-      timeout {
+-          fail "$description (timeout)"
+-      }
+     }
+--- gdb-7.0/gdb/configure      2009-12-07 18:53:30.000000000 +0100
++++ gdb-7.0-x/gdb/configure    2009-12-07 18:53:14.000000000 +0100
+@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t
+   # readline-6.0 started to use the name `_rl_echoing_p'.
+   # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+-  echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
+-echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
+   save_LIBS=$LIBS
+   LIBS="$LIBS $READLINE"
+-  cat >conftest.$ac_ext <<_ACEOF
+-/* confdefs.h.  */
+-_ACEOF
+-cat confdefs.h >>conftest.$ac_ext
+-cat >>conftest.$ac_ext <<_ACEOF
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
++$as_echo_n "checking for readline_echoing_p... " >&6; }
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ int
+@@ -9221,45 +9217,45 @@ extern int readline_echoing_p;
+   return 0;
+ }
+ _ACEOF
+-rm -f conftest.$ac_objext conftest$ac_exeext
+-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+-  (eval $ac_link) 2>conftest.er1
+-  ac_status=$?
+-  grep -v '^ *+' conftest.er1 >conftest.err
+-  rm -f conftest.er1
+-  cat conftest.err >&5
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); } &&
+-       { ac_try='test -z "$ac_c_werror_flag"
+-                       || test ! -s conftest.err'
+-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+-  (eval $ac_try) 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; } &&
+-       { ac_try='test -s conftest$ac_exeext'
+-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+-  (eval $ac_try) 2>&5
+-  ac_status=$?
+-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+-  (exit $ac_status); }; }; then
++if ac_fn_c_try_link "$LINENO"; then :
+   READLINE_ECHOING_P=yes
+ else
+-  echo "$as_me: failed program was:" >&5
+-sed 's/^/| /' conftest.$ac_ext >&5
++  READLINE_ECHOING_P=no
+-READLINE_ECHOING_P=no
++$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
++
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
++$as_echo "$READLINE_ECHOING_P" >&6; }
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
++$as_echo_n "checking for _rl_caught_signal... " >&6; }
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
+-cat >>confdefs.h <<\_ACEOF
+-#define readline_echoing_p _rl_echoing_p
++int
++main ()
++{
++extern int volatile _rl_caught_signal;
++                                  return _rl_caught_signal;
++  ;
++  return 0;
++}
+ _ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  READLINE_CAUGHT_SIGNAL=yes
++
++$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
++else
++  READLINE_CAUGHT_SIGNAL=no
+ fi
+-rm -f conftest.err conftest.$ac_objext \
+-      conftest$ac_exeext conftest.$ac_ext
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
++$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
+   LIBS="$save_LIBS"
+-  echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
+-echo "${ECHO_T}$READLINE_ECHOING_P" >&6
+ else
+   READLINE='$(READLINE_DIR)/libreadline.a'
+   READLINE_DEPS='$(READLINE)'
diff --git a/gdb-x86_64-i386-syscall-restart.patch b/gdb-x86_64-i386-syscall-restart.patch
new file mode 100644 (file)
index 0000000..d5d6b10
--- /dev/null
@@ -0,0 +1,121 @@
+http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
+Subject: [patch] Fix syscall restarts for amd64->i386 biarch
+
+Hi,
+
+tested only on recent Linux kernels, it should apply also on vanilla ones.
+There were various changes of the kernels behavior in the past.
+
+FSF GDB HEAD state:
+kernel debugger inferior state
+x86_64 x86_64   x86_64   PASS
+x86_64 x86_64   i386     FAIL without this patch, PASS with this patch
+x86_64 i386     i386     PASS on recent kernels
+                         (FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12)
+                         (PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64)
+i386   i386     i386     PASS
+
+
+Currently gdb.base/interrupt.exp fails on amd64 host running under
+--target_board unix/-m32 with:
+       continue
+       Continuing.
+       Unknown error 512
+
+<linux/errno.h>:
+/*
+ * These should never be seen by user programs.  To return one of ERESTART*
+ * codes, signal_pending() MUST be set.  Note that ptrace can observe these
+ * at syscall exit tracing, but they will never be left for the debugged user
+ * process to see.
+ */
+#define ERESTARTSYS     512
+
+"Unknown error 512" printed above is printed by the inferior itself, not by GDB.
+
+It is because GDB reads it as 0xfffffffffffffe00 but writes it back as
+0xfffffe00.
++      /* Sign-extend %eax as during return from a syscall it is being checked
++       for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++       interrupt.exp.  */
+
+
+Quote of Roland McGrath from IRC:
+
+roland: in the user_regset model, there are 64-bit user_regset flavors and
+32-bit user_regset flavors, so at the kabi level the (kernel) caller can say
+what it means: calls on the 32-bit user_regset flavor will behave as if on
+a 32-bit kernel/userland.  in ptrace, there is no way for x86_64 ptrace calls
+to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc
+and/or sparc have ptr
+roland: ace requests that do that iirc)
+roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so
+the kernel's sign-extension choices are preserved, or else grok magic ways to
+expand stored 32-bit register contents to 64-bit values to stuff via 64-bit
+ptrace
+[...]
+roland: there is a "32-bit-flavored task", but it's not really true that it
+has 32-bit registers.  there is no 32-bit-only userland condition.  any task
+can always ljmp to the 64-bit code segment and run 64-bit insns including
+a 64-bit syscall
+roland: so a 64-bit debugger should see and be able to fiddle the full
+registers.  it can even change cs via ptrace to force the inferior into
+running 32 or 64 bit code.
+
+
+Saving whole 64bits for i386 targets on x86_64 hosts does not much match the
+GDB architecture as `struct type' for these registers still should be 32bit
+etc.   Therefore provided just this exception.
+
+The problem is reproducible only if one does an inferior call during the
+interruption to do full inferior save/restore from GDB regcache.
+
+Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
+
+
+Thanks,
+Jan
+
+
+gdb/
+2009-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax.
+       Sign extend it afterwards.
+
+--- a/gdb/amd64-nat.c
++++ b/gdb/amd64-nat.c
+@@ -131,9 +131,9 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+     {
+       num_regs = amd64_native_gregset32_num_regs;
+-      /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
++      /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
+          %eip get zero-extended to 64 bits.  */
+-      for (i = 0; i <= I386_EIP_REGNUM; i++)
++      for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++)
+       {
+         if (regnum == -1 || regnum == i)
+           memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8);
+@@ -159,4 +159,20 @@ amd64_collect_native_gregset (const struct regcache *regcache,
+           regcache_raw_collect (regcache, i, regs + offset);
+       }
+     }
++
++  if (gdbarch_ptr_bit (gdbarch) == 32)
++    {
++      /* Sign-extend %eax as during return from a syscall it is being checked
++       for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
++       interrupt.exp.  */
++
++      int i = I386_EAX_REGNUM;
++
++      if (regnum == -1 || regnum == i)
++      {
++        void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i);
++
++        *(int64_t *) ptr = *(int32_t *) ptr;
++      }
++    }
+ }
+
index 0d2d7b1a902943aa873821e4955511f4af40c3f4..be63a317a411d2eb340d57caf4516874ca8acf77 100644 (file)
--- a/gdb.spec
+++ b/gdb.spec
@@ -4,6 +4,7 @@
 # TODO
 # - python subpkg
 # - gdbtui is as big as gdb, but different md5, some kind of duplicate?
+# - change yum install msg to poldek one in buildid-locate-rpm.patch
 #
 # Conditional build:
 %bcond_without python          # build without python support
@@ -22,12 +23,14 @@ Summary(uk.UTF-8):  Символьний відладчик для С та інш
 Summary(zh_CN.UTF-8):  [开发]C和其他语言的调试器
 Summary(zh_TW.UTF-8):  [.-A開發]C和.$)B其.-A他語.$)B言的調試器
 Name:          gdb
-Version:       6.8.91
-Release:       1.%{snap}.%{rel}
+Version:       7.0
+Release:       0.5
 License:       GPL v3+
 Group:         Development/Debuggers
-Source0:       ftp://sourceware.org/pub/gdb/snapshots/branch/%{name}-%{version}.%{snap}.tar.bz2
-# Source0-md5: 729517cc8e6ca6e25cf4be343ffc4c3d
+# Source0:     ftp://sourceware.org/pub/gdb/snapshots/current/gdb-%{version}.%{snap}.tar.bz2
+# Source0:     gdb-%{version}.%{snap}.tar.bz2
+Source0:       http://ftp.gnu.org/gnu/gdb/%{name}-%{version}.tar.bz2
+# Source0-md5: 3386a7b69c010785c920ffc1e9cb890a
 Source1:       http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2
 # Source1-md5: 2e8a48939ae282c12bbacdd54e398247
 # libstdc++ pretty printers from GCC SVN HEAD (4.5 experimental).
@@ -44,6 +47,10 @@ Patch1005:   %{name}-pretty-print-by-default.patch
 Patch1:                %{name}-6.3-rh-dummykfail-20041202.patch
 Patch2:                %{name}-6.3-rh-testversion-20041202.patch
 Patch3:                %{name}-6.3-rh-testlibunwind-20041202.patch
+
+# Backported post gdb-7.0 fixups.
+Patch232:      %{name}-7.0-upstream.patch
+
 Patch104:      %{name}-6.3-ppcdotsolib-20041022.patch
 Patch105:      %{name}-6.3-ppc64syscall-20040622.patch
 Patch106:      %{name}-6.3-framepczero-20040927.patch
@@ -52,9 +59,9 @@ Patch112:     %{name}-6.6-scheduler_locking-step-sw-watchpoints2.patch
 Patch260:      %{name}-6.6-scheduler_locking-step-is-default.patch
 Patch118:      %{name}-6.3-gstack-20050411.patch
 Patch122:      %{name}-6.3-test-pie-20050107.patch
-Patch124:      %{name}-6.3-pie-20050110.patch
+Patch124:      %{name}-archer-pie.patch
+Patch389:      %{name}-archer-pie-addons.patch
 Patch125:      %{name}-6.3-test-self-20050110.patch
-Patch128:      %{name}-6.3-nonthreaded-wp-20050117.patch
 Patch133:      %{name}-6.3-test-dtorfix-20050121.patch
 Patch136:      %{name}-6.3-test-movedir-20050125.patch
 Patch140:      %{name}-6.3-gcore-thread-20050204.patch
@@ -63,8 +70,6 @@ Patch259:     %{name}-6.3-step-thread-exit-20050211-test.patch
 Patch142:      %{name}-6.3-terminal-fix-20050214.patch
 Patch145:      %{name}-6.3-threaded-watchpoints2-20050225.patch
 Patch148:      %{name}-6.3-inheritance-20050324.patch
-Patch150:      %{name}-6.3-test-sepcrc-20050402.patch
-Patch151:      %{name}-6.3-sepcrc-20050402.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
@@ -146,6 +151,15 @@ Patch360:  %{name}-6.8-bz457187-largefile-test.patch
 Patch375:      %{name}-readline-6.0.patch
 Patch376:      libstdc++-v3-python-common-prefix.patch
 Patch381:      %{name}-simultaneous-step-resume-breakpoint-test.patch
+Patch382:      %{name}-core-open-vdso-warning.patch
+Patch383:      %{name}-bz528668-symfile-sepcrc.patch
+Patch384:      %{name}-bz528668-symfile-cleanup.patch
+Patch385:      %{name}-bz528668-symfile-multi.patch
+Patch387:      %{name}-bz539590-gnu-ifunc.patch
+Patch388:      %{name}-bz538626-bp_location-accel-bp-cond.patch
+Patch390:      %{name}-readline-6.0-signal.patch
+Patch391:      %{name}-x86_64-i386-syscall-restart.patch
+
 URL:           http://www.gnu.org/software/gdb/
 BuildRequires: autoconf >= 2.53
 BuildRequires: automake
@@ -157,6 +171,7 @@ BuildRequires:      python-devel
 BuildRequires: readline-devel >= 6.0
 BuildRequires: rpm-pythonprov
 BuildRequires: texinfo >= 4.4
+BuildRequires: zlib-devel
 %{?with_python:Requires: python-libs}
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -238,7 +253,7 @@ GDB in the form of a static library.
 GDB w postaci biblioteki statycznej.
 
 %prep
-%setup -q -n %{name}-%{version}.%{snap}
+%setup -q -n %{name}-%{version}
 
 # libstdc++ pretty printers.
 bzip2 -dc %{SOURCE4} | tar xf -
@@ -252,10 +267,22 @@ bzip2 -dc %{SOURCE4} | tar xf -
 rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c
 rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 
+# Apply patches defined above.
+
+# Match the Fedora's version info.
 %patch2 -p1
+
+# backported fixes
+%patch232 -p1
+
 %patch349 -p1
+%patch383 -p1
+%patch384 -p1
+%patch385 -p1
+%patch124 -p1
 %patch1 -p1
 %patch3 -p1
+
 %patch104 -p1
 %patch105 -p1
 %patch106 -p1
@@ -264,7 +291,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch118 -p1
 %patch122 -p1
 %patch125 -p1
-%patch128 -p1
 %patch133 -p1
 %patch136 -p1
 %patch140 -p1
@@ -273,8 +299,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch142 -p1
 %patch145 -p1
 %patch148 -p1
-%patch150 -p1
-%patch151 -p1
 %patch153 -p1
 %patch157 -p1
 %patch158 -p1
@@ -352,11 +376,16 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
 %patch343 -p1
 %patch348 -p1
 %patch352 -p1
-%patch124 -p1
 %patch360 -p1
 %patch375 -p1
 %patch376 -p1
 %patch381 -p1
+%patch382 -p1
+%patch387 -p1
+%patch388 -p1
+%patch389 -p1
+%patch390 -p1
+%patch391 -p1
 
 mv $(basename %{SOURCE4} .tar.bz2) libstdcxxpython
 
This page took 0.461417 seconds and 4 git commands to generate.