Search also for .<seqno> files in /usr/lib/debug/.build-id (BZ 641377).
This commit is contained in:
parent
7180591ac5
commit
4adfc8b85c
3 changed files with 143 additions and 94 deletions
|
|
@ -1,7 +1,7 @@
|
|||
Index: gdb-7.2.90.20110411/gdb/corelow.c
|
||||
Index: gdb-7.2.90.20110429/gdb/corelow.c
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/corelow.c 2011-02-26 03:07:07.000000000 +0100
|
||||
+++ gdb-7.2.90.20110411/gdb/corelow.c 2011-04-11 19:16:15.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"
|
||||
|
|
@ -90,10 +90,10 @@ Index: gdb-7.2.90.20110411/gdb/corelow.c
|
|||
+ NULL, NULL, NULL,
|
||||
+ &setlist, &showlist);
|
||||
}
|
||||
Index: gdb-7.2.90.20110411/gdb/doc/gdb.texinfo
|
||||
Index: gdb-7.2.90.20110429/gdb/doc/gdb.texinfo
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/doc/gdb.texinfo 2011-04-11 19:15:51.000000000 +0200
|
||||
+++ gdb-7.2.90.20110411/gdb/doc/gdb.texinfo 2011-04-11 19:16:15.000000000 +0200
|
||||
--- 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
|
||||
|
|
@ -122,10 +122,10 @@ Index: gdb-7.2.90.20110411/gdb/doc/gdb.texinfo
|
|||
@cindex @code{.gnu_debuglink} sections
|
||||
@cindex debug link sections
|
||||
A debug link is a special section of the executable file named
|
||||
Index: gdb-7.2.90.20110411/gdb/solib-svr4.c
|
||||
Index: gdb-7.2.90.20110429/gdb/solib-svr4.c
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/solib-svr4.c 2011-04-11 19:11:55.000000000 +0200
|
||||
+++ gdb-7.2.90.20110411/gdb/solib-svr4.c 2011-04-11 19:16:15.000000000 +0200
|
||||
--- 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
|
||||
|
|
@ -179,11 +179,11 @@ Index: gdb-7.2.90.20110411/gdb/solib-svr4.c
|
|||
}
|
||||
xfree (buffer);
|
||||
|
||||
Index: gdb-7.2.90.20110411/gdb/elfread.c
|
||||
Index: gdb-7.2.90.20110429/gdb/elfread.c
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/elfread.c 2011-04-11 19:11:55.000000000 +0200
|
||||
+++ gdb-7.2.90.20110411/gdb/elfread.c 2011-04-11 19:17:40.000000000 +0200
|
||||
@@ -49,6 +49,10 @@
|
||||
--- 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"
|
||||
|
|
@ -191,10 +191,11 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
+#include "gdbcore.h"
|
||||
+#include "gdbcmd.h"
|
||||
+#include "observer.h"
|
||||
+#include <sys/stat.h>
|
||||
|
||||
extern void _initialize_elfread (void);
|
||||
|
||||
@@ -1077,16 +1081,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
|
||||
@@ -1077,16 +1082,65 @@ elf_gnu_ifunc_resolver_return_stop (stru
|
||||
update_breakpoint_locations (b, sals, sals_end);
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +263,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
{
|
||||
struct build_id *retval;
|
||||
|
||||
@@ -1102,6 +1155,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
@@ -1102,6 +1156,348 @@ build_id_bfd_get (bfd *abfd)
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -611,7 +612,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
|
||||
|
||||
static int
|
||||
@@ -1116,7 +1511,7 @@ build_id_verify (const char *filename, s
|
||||
@@ -1116,7 +1512,7 @@ build_id_verify (const char *filename, s
|
||||
if (abfd == NULL)
|
||||
return 0;
|
||||
|
||||
|
|
@ -620,7 +621,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
|
||||
if (found == NULL)
|
||||
warning (_("File \"%s\" has no build-id, file skipped"), filename);
|
||||
@@ -1134,14 +1529,16 @@ build_id_verify (const char *filename, s
|
||||
@@ -1134,14 +1530,15 @@ build_id_verify (const char *filename, s
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -636,24 +637,69 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
/* 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. */
|
||||
@@ -1172,7 +1569,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)
|
||||
@@ -1185,26 +1585,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)
|
||||
|
|
@ -723,9 +769,9 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
+
|
||||
+ retval = obstack_alloc (&missing_filepair_obstack, size);
|
||||
+ memset (retval, 0, size);
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
|
||||
+static hashval_t
|
||||
+missing_filepair_hash_func (const struct missing_filepair *elem)
|
||||
+{
|
||||
|
|
@ -735,9 +781,9 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
+ if (elem->debug != NULL)
|
||||
+ retval ^= htab_hash_string (elem->debug);
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+missing_filepair_eq (const struct missing_filepair *elem1,
|
||||
+ const struct missing_filepair *elem2)
|
||||
|
|
@ -859,7 +905,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
xfree (build_id);
|
||||
/* Prevent looping on a stripped .debug file. */
|
||||
if (build_id_name != NULL
|
||||
@@ -1215,7 +1790,7 @@ find_separate_debug_file_by_buildid (str
|
||||
@@ -1215,7 +1817,7 @@ find_separate_debug_file_by_buildid (str
|
||||
xfree (build_id_name);
|
||||
}
|
||||
else if (build_id_name != NULL)
|
||||
|
|
@ -868,7 +914,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1413,9 +1988,10 @@ elf_symfile_read (struct objfile *objfil
|
||||
@@ -1418,9 +2020,10 @@ elf_symfile_read (struct objfile *objfil
|
||||
`.note.gnu.build-id'. */
|
||||
else if (!objfile_has_partial_symbols (objfile))
|
||||
{
|
||||
|
|
@ -881,7 +927,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
|
||||
if (debugfile == NULL)
|
||||
debugfile = find_separate_debug_file_by_debuglink (objfile);
|
||||
@@ -1427,6 +2003,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);
|
||||
}
|
||||
|
|
@ -894,7 +940,7 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1906,4 +2488,16 @@ _initialize_elfread (void)
|
||||
@@ -1911,4 +2520,16 @@ _initialize_elfread (void)
|
||||
|
||||
elf_objfile_gnu_ifunc_cache_data = register_objfile_data ();
|
||||
gnu_ifunc_fns_p = &elf_gnu_ifunc_fns;
|
||||
|
|
@ -911,11 +957,11 @@ Index: gdb-7.2.90.20110411/gdb/elfread.c
|
|||
+
|
||||
+ observer_attach_executable_changed (debug_print_executable_changed);
|
||||
}
|
||||
Index: gdb-7.2.90.20110411/gdb/symfile.h
|
||||
Index: gdb-7.2.90.20110429/gdb/symfile.h
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/symfile.h 2011-04-11 19:11:55.000000000 +0200
|
||||
+++ gdb-7.2.90.20110411/gdb/symfile.h 2011-04-11 19:16:15.000000000 +0200
|
||||
@@ -611,6 +611,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);
|
||||
|
||||
|
|
@ -929,10 +975,10 @@ Index: gdb-7.2.90.20110411/gdb/symfile.h
|
|||
/* From dwarf2read.c */
|
||||
|
||||
extern int dwarf2_has_info (struct objfile *);
|
||||
Index: gdb-7.2.90.20110411/gdb/testsuite/lib/gdb.exp
|
||||
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/gdb.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/testsuite/lib/gdb.exp 2011-04-11 19:11:55.000000000 +0200
|
||||
+++ gdb-7.2.90.20110411/gdb/testsuite/lib/gdb.exp 2011-04-11 19:16:15.000000000 +0200
|
||||
--- 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."
|
||||
}
|
||||
|
|
@ -950,10 +996,10 @@ Index: gdb-7.2.90.20110411/gdb/testsuite/lib/gdb.exp
|
|||
return 0;
|
||||
}
|
||||
|
||||
Index: gdb-7.2.90.20110411/gdb/testsuite/lib/mi-support.exp
|
||||
Index: gdb-7.2.90.20110429/gdb/testsuite/lib/mi-support.exp
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/testsuite/lib/mi-support.exp 2011-03-07 17:03:04.000000000 +0100
|
||||
+++ gdb-7.2.90.20110411/gdb/testsuite/lib/mi-support.exp 2011-04-11 19:16:15.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 } {
|
||||
}
|
||||
}
|
||||
|
|
@ -971,10 +1017,10 @@ Index: gdb-7.2.90.20110411/gdb/testsuite/lib/mi-support.exp
|
|||
|
||||
detect_async
|
||||
|
||||
Index: gdb-7.2.90.20110411/gdb/objfiles.h
|
||||
Index: gdb-7.2.90.20110429/gdb/objfiles.h
|
||||
===================================================================
|
||||
--- gdb-7.2.90.20110411.orig/gdb/objfiles.h 2011-03-07 17:17:29.000000000 +0100
|
||||
+++ gdb-7.2.90.20110411/gdb/objfiles.h 2011-04-11 19:16:15.000000000 +0200
|
||||
--- 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_PSYMTABS_READ (1 << 4)
|
||||
|
|
|
|||
Loading…
Reference in a new issue