-Index: gdb-7.1.90.20100711/gdb/corelow.c
+Index: gdb-7.2.90.20110429/gdb/corelow.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/corelow.c 2010-05-14 01:53:32.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/corelow.c 2010-07-12 11:07:33.000000000 +0200
+--- gdb-7.2.90.20110429.orig/gdb/corelow.c 2011-02-26 03:07:07.000000000 +0100
++++ gdb-7.2.90.20110429/gdb/corelow.c 2011-05-03 05:14:57.000000000 +0200
@@ -47,6 +47,9 @@
#include "filenames.h"
#include "progspace.h"
#ifndef O_LARGEFILE
-@@ -289,6 +292,52 @@ add_to_thread_list (bfd *abfd, asection
- inferior_ptid = ptid; /* Yes, make it current */
+@@ -278,6 +281,52 @@ add_to_thread_list (bfd *abfd, asection
+ inferior_ptid = ptid; /* Yes, make it current. */
}
+static int build_id_core_loads = 1;
/* This routine opens and sets up the core file bfd. */
static void
-@@ -386,6 +435,12 @@ core_open (char *filename, int from_tty)
+@@ -379,6 +428,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
/* Do this before acknowledging the inferior, so if
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
-@@ -924,4 +979,11 @@ _initialize_corelow (void)
+@@ -932,4 +987,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
+ NULL, NULL, NULL,
+ &setlist, &showlist);
}
-Index: gdb-7.1.90.20100711/gdb/doc/gdb.texinfo
+Index: gdb-7.2.90.20110429/gdb/doc/gdb.texinfo
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/doc/gdb.texinfo 2010-07-12 10:59:30.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/doc/gdb.texinfo 2010-07-12 11:05:57.000000000 +0200
-@@ -14980,6 +14980,27 @@ information files.
+--- gdb-7.2.90.20110429.orig/gdb/doc/gdb.texinfo 2011-05-03 05:14:56.000000000 +0200
++++ gdb-7.2.90.20110429/gdb/doc/gdb.texinfo 2011-05-03 05:14:57.000000000 +0200
+@@ -15356,6 +15356,27 @@ information files.
@end table
@cindex @code{.gnu_debuglink} sections
@cindex debug link sections
A debug link is a special section of the executable file named
-Index: gdb-7.1.90.20100711/gdb/solib-svr4.c
+Index: gdb-7.2.90.20110429/gdb/solib-svr4.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/solib-svr4.c 2010-07-12 10:00:56.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/solib-svr4.c 2010-07-12 11:05:57.000000000 +0200
-@@ -1181,9 +1181,49 @@ svr4_current_sos (void)
+--- gdb-7.2.90.20110429.orig/gdb/solib-svr4.c 2011-05-03 05:14:56.000000000 +0200
++++ gdb-7.2.90.20110429/gdb/solib-svr4.c 2011-05-03 05:14:57.000000000 +0200
+@@ -1179,9 +1179,49 @@ svr4_current_sos (void)
safe_strerror (errcode));
else
{
}
xfree (buffer);
-Index: gdb-7.1.90.20100711/gdb/elfread.c
+Index: gdb-7.2.90.20110429/gdb/elfread.c
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/elfread.c 2010-07-12 10:00:56.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/elfread.c 2010-07-12 11:30:30.000000000 +0200
-@@ -38,6 +38,10 @@
- #include "demangle.h"
- #include "psympriv.h"
- #include "gdbtypes.h"
+--- gdb-7.2.90.20110429.orig/gdb/elfread.c 2011-05-03 05:14:56.000000000 +0200
++++ gdb-7.2.90.20110429/gdb/elfread.c 2011-05-03 05:19:27.000000000 +0200
+@@ -49,6 +49,11 @@
+ #include "infcall.h"
+ #include "gdbthread.h"
+ #include "regcache.h"
+#include "libbfd.h"
+#include "gdbcore.h"
+#include "gdbcmd.h"
+#include "observer.h"
++#include <sys/stat.h>
extern void _initialize_elfread (void);
-@@ -818,16 +822,65 @@ resolve_gnu_ifunc (const char *function_
- return 0;
+@@ -1077,16 +1082,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
+ update_breakpoint_locations (b, sals, sals_end);
}
-+/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
-+ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
-+
+#define BUILD_ID_VERBOSE_NONE 0
+#define BUILD_ID_VERBOSE_FILENAMES 1
+#define BUILD_ID_VERBOSE_BINARY_PARSE 2
};
-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
++/* Locate NT_GNU_BUILD_ID and return its matching debug filename.
++ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */
++
+struct build_id *
+build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size)
+{
{
struct build_id *retval;
-@@ -843,6 +896,348 @@ build_id_bfd_get (bfd *abfd)
+@@ -1102,6 +1156,348 @@ build_id_bfd_get (bfd *abfd)
return retval;
}
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
-@@ -857,7 +1252,7 @@ build_id_verify (const char *filename, s
+@@ -1116,7 +1512,7 @@ build_id_verify (const char *filename, s
if (abfd == NULL)
return 0;
if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename);
-@@ -874,14 +1269,16 @@ build_id_verify (const char *filename, s
+@@ -1134,14 +1530,15 @@ build_id_verify (const char *filename, s
return retval;
}
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- 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);
++ link = xmalloc (strlen (debug_file_directory) + 2 * build_id->size + 50);
/* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
cause "/.build-id/..." lookups. */
-@@ -912,7 +1309,10 @@ build_id_to_debug_filename (struct build
+@@ -1152,6 +1549,8 @@ build_id_to_debug_filename (struct build
+ char *s, *debugdir_end;
+ gdb_byte *data = build_id->data;
+ size_t size = build_id->size;
++ unsigned seqno;
++ struct stat statbuf_trash;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+@@ -1172,39 +1571,242 @@ 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)
+- retval = lrealpath (link);
- /* lrealpath() is expensive even for the usually non-existent files. */
- if (access (link, F_OK) == 0)
-@@ -925,26 +1325,201 @@ build_id_to_debug_filename (struct build
+- if (retval != NULL && !build_id_verify (retval, build_id))
++ for (seqno = 0;; seqno++)
+ {
+- xfree (retval);
+- retval = NULL;
++ char *s2;
++
++ if (seqno)
++ {
++ /* There can be multiple build-id symlinks pointing to real files
++ with the same build-id (such as hard links). Some of the real
++ files may not be installed. */
++
++ s2 = s + sprintf (s, ".%u", seqno);
++ }
++ else
++ s2 = s;
++
++ if (add_debug_suffix)
++ strcpy (s2, ".debug");
++ else
++ *s2 = 0;
++
++ /* `access' automatically dereferences LINK. */
++ if (lstat (link, &statbuf_trash) != 0)
++ {
++ /* Stop increasing SEQNO. */
++ break;
++ }
++
++ retval = lrealpath (link);
++
++ if (retval != NULL && !build_id_verify (retval, build_id))
++ {
++ xfree (retval);
++ retval = NULL;
++ }
++
++ if (retval)
++ break;
}
if (retval != NULL)
+ 1);
xfree (build_id);
/* Prevent looping on a stripped .debug file. */
- if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
-@@ -954,7 +1529,7 @@ find_separate_debug_file_by_buildid (str
+ if (build_id_name != NULL
+@@ -1215,7 +1817,7 @@ find_separate_debug_file_by_buildid (str
xfree (build_id_name);
}
else if (build_id_name != NULL)
}
return NULL;
}
-@@ -1131,9 +1706,10 @@ elf_symfile_read (struct objfile *objfil
- `.gnu_debuglink' may no longer be present with `.note.gnu.build-id'. */
- if (!objfile_has_partial_symbols (objfile))
+@@ -1418,9 +2020,10 @@ elf_symfile_read (struct objfile *objfil
+ `.note.gnu.build-id'. */
+ else if (!objfile_has_partial_symbols (objfile))
{
- char *debugfile;
+ char *debugfile, *build_id_filename;
if (debugfile == NULL)
debugfile = find_separate_debug_file_by_debuglink (objfile);
-@@ -1145,6 +1721,12 @@ elf_symfile_read (struct objfile *objfil
+@@ -1432,6 +2035,12 @@ elf_symfile_read (struct objfile *objfil
symbol_file_add_separate (abfd, symfile_flags, objfile);
xfree (debugfile);
}
}
}
-@@ -1304,4 +1886,16 @@ void
- _initialize_elfread (void)
- {
- add_symtab_fns (&elf_sym_fns);
+@@ -1911,4 +2520,16 @@ _initialize_elfread (void)
+
+ elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
+ gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
+
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\
+
+ observer_attach_executable_changed (debug_print_executable_changed);
}
-Index: gdb-7.1.90.20100711/gdb/symfile.h
+Index: gdb-7.2.90.20110429/gdb/symfile.h
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/symfile.h 2010-05-08 06:58:45.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/symfile.h 2010-07-12 11:06:18.000000000 +0200
-@@ -562,6 +562,13 @@ void free_symfile_segment_data (struct s
+--- gdb-7.2.90.20110429.orig/gdb/symfile.h 2011-05-03 05:14:56.000000000 +0200
++++ gdb-7.2.90.20110429/gdb/symfile.h 2011-05-03 05:14:57.000000000 +0200
+@@ -605,6 +605,13 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
-Index: gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp
+Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/gdb.exp 2010-07-12 10:00:56.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/testsuite/lib/gdb.exp 2010-07-12 11:05:57.000000000 +0200
-@@ -1353,6 +1353,16 @@ proc default_gdb_start { } {
+--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/gdb.exp 2011-05-03 05:14:56.000000000 +0200
++++ gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp 2011-05-03 05:14:57.000000000 +0200
+@@ -1381,6 +1381,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
}
return 0;
}
-Index: gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp
+Index: gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/testsuite/lib/mi-support.exp 2010-03-15 04:43:13.000000000 +0100
-+++ gdb-7.1.90.20100711/gdb/testsuite/lib/mi-support.exp 2010-07-12 11:05:57.000000000 +0200
+--- gdb-7.2.90.20110429.orig/gdb/testsuite/lib/mi-support.exp 2011-03-07 17:03:04.000000000 +0100
++++ gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp 2011-05-03 05:14:57.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
}
}
detect_async
-Index: gdb-7.1.90.20100711/gdb/objfiles.h
+Index: gdb-7.2.90.20110429/gdb/objfiles.h
===================================================================
---- gdb-7.1.90.20100711.orig/gdb/objfiles.h 2010-04-14 19:26:11.000000000 +0200
-+++ gdb-7.1.90.20100711/gdb/objfiles.h 2010-07-12 11:07:08.000000000 +0200
-@@ -426,6 +426,10 @@ struct objfile
+--- gdb-7.2.90.20110429.orig/gdb/objfiles.h 2011-03-07 17:17:29.000000000 +0100
++++ gdb-7.2.90.20110429/gdb/objfiles.h 2011-05-03 05:14:57.000000000 +0200
+@@ -441,6 +441,10 @@ struct objfile
- #define OBJF_USERLOADED (1 << 3) /* User loaded */
+ #define OBJF_PSYMTABS_READ (1 << 4)
+/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */
+
+#define OBJF_BUILD_ID_CORE_LOADED (1 << 12)
+
/* The object file that contains the runtime common minimal symbols
- for SunOS4. Note that this objfile has no associated BFD. */
+ for SunOS4. Note that this objfile has no associated BFD. */