|
|
861f93 |
Index: gdb-7.5.50.20130310/gdb/solib-svr4.c
|
|
|
861f93 |
===================================================================
|
|
|
861f93 |
--- gdb-7.5.50.20130310.orig/gdb/solib-svr4.c 2013-03-10 16:37:49.000000000 +0100
|
|
|
861f93 |
+++ gdb-7.5.50.20130310/gdb/solib-svr4.c 2013-03-10 16:43:45.498585091 +0100
|
|
|
861f93 |
@@ -1225,14 +1225,27 @@ svr4_read_so_list (CORE_ADDR lm, struct
|
|
|
861f93 |
}
|
|
|
861f93 |
|
|
|
861f93 |
{
|
|
|
861f93 |
- struct elf_build_id *build_id;
|
|
|
861f93 |
+ struct elf_build_id *build_id = NULL;
|
|
|
861f93 |
|
|
|
861f93 |
strncpy (new->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
|
|
861f93 |
new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
|
|
861f93 |
/* May get overwritten below. */
|
|
|
861f93 |
strcpy (new->so_name, new->so_original_name);
|
|
|
861f93 |
|
|
|
861f93 |
- build_id = build_id_addr_get (new->lm_info->l_ld);
|
|
|
861f93 |
+ /* In the case the main executable was found according to its build-id
|
|
|
861f93 |
+ (from a core file) prevent loading a different build of a library
|
|
|
861f93 |
+ with accidentally the same SO_NAME.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ It suppresses bogus backtraces (and prints "??" there instead) if
|
|
|
861f93 |
+ the on-disk files no longer match the running program version.
|
|
|
861f93 |
+
|
|
|
861f93 |
+ If the main executable was not loaded according to its build-id do
|
|
|
861f93 |
+ not do any build-id checking of the libraries. There may be missing
|
|
|
861f93 |
+ build-ids dumped in the core file and we would map all the libraries
|
|
|
861f93 |
+ to the only existing file loaded that time - the executable. */
|
|
|
861f93 |
+ if (symfile_objfile != NULL
|
|
|
861f93 |
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
|
|
861f93 |
+ build_id = build_id_addr_get (new->lm_info->l_ld);
|
|
|
861f93 |
if (build_id != NULL)
|
|
|
861f93 |
{
|
|
|
861f93 |
char *name, *build_id_filename;
|
|
|
861f93 |
@@ -1247,23 +1260,7 @@ svr4_read_so_list (CORE_ADDR lm, struct
|
|
|
861f93 |
xfree (name);
|
|
|
861f93 |
}
|
|
|
861f93 |
else
|
|
|
861f93 |
- {
|
|
|
861f93 |
- debug_print_missing (new->so_name, build_id_filename);
|
|
|
861f93 |
-
|
|
|
861f93 |
- /* In the case the main executable was found according to
|
|
|
861f93 |
- its build-id (from a core file) prevent loading
|
|
|
861f93 |
- a different build of a library with accidentally the
|
|
|
861f93 |
- same SO_NAME.
|
|
|
861f93 |
-
|
|
|
861f93 |
- It suppresses bogus backtraces (and prints "??" there
|
|
|
861f93 |
- instead) if the on-disk files no longer match the
|
|
|
861f93 |
- running program version. */
|
|
|
861f93 |
-
|
|
|
861f93 |
- if (symfile_objfile != NULL
|
|
|
861f93 |
- && (symfile_objfile->flags
|
|
|
861f93 |
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
|
|
861f93 |
- new->so_name[0] = 0;
|
|
|
861f93 |
- }
|
|
|
861f93 |
+ debug_print_missing (new->so_name, build_id_filename);
|
|
|
861f93 |
|
|
|
861f93 |
xfree (build_id_filename);
|
|
|
861f93 |
xfree (build_id);
|