|
|
26bbde |
Index: gdb-7.9.90.20150709/gdb/solib-svr4.c
|
|
|
26bbde |
===================================================================
|
|
|
26bbde |
--- gdb-7.9.90.20150709.orig/gdb/solib-svr4.c 2015-07-09 18:18:54.526417766 +0200
|
|
|
26bbde |
+++ gdb-7.9.90.20150709/gdb/solib-svr4.c 2015-07-09 18:19:33.074746586 +0200
|
|
|
26bbde |
@@ -1381,14 +1381,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD
|
|
|
26bbde |
}
|
|
|
26bbde |
|
|
|
26bbde |
{
|
|
|
26bbde |
- struct bfd_build_id *build_id;
|
|
|
26bbde |
+ struct bfd_build_id *build_id = NULL;
|
|
|
26bbde |
|
|
|
26bbde |
strncpy (newobj->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
|
|
|
26bbde |
newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
|
|
|
26bbde |
/* May get overwritten below. */
|
|
|
26bbde |
strcpy (newobj->so_name, newobj->so_original_name);
|
|
|
26bbde |
|
|
|
26bbde |
- build_id = build_id_addr_get (newobj->lm_info->l_ld);
|
|
|
26bbde |
+ /* In the case the main executable was found according to its build-id
|
|
|
26bbde |
+ (from a core file) prevent loading a different build of a library
|
|
|
26bbde |
+ with accidentally the same SO_NAME.
|
|
|
26bbde |
+
|
|
|
26bbde |
+ It suppresses bogus backtraces (and prints "??" there instead) if
|
|
|
26bbde |
+ the on-disk files no longer match the running program version.
|
|
|
26bbde |
+
|
|
|
26bbde |
+ If the main executable was not loaded according to its build-id do
|
|
|
26bbde |
+ not do any build-id checking of the libraries. There may be missing
|
|
|
26bbde |
+ build-ids dumped in the core file and we would map all the libraries
|
|
|
26bbde |
+ to the only existing file loaded that time - the executable. */
|
|
|
26bbde |
+ if (symfile_objfile != NULL
|
|
|
26bbde |
+ && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
|
|
26bbde |
+ build_id = build_id_addr_get (newobj->lm_info->l_ld);
|
|
|
26bbde |
if (build_id != NULL)
|
|
|
26bbde |
{
|
|
|
26bbde |
char *name, *build_id_filename;
|
|
|
26bbde |
@@ -1403,23 +1416,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD
|
|
|
26bbde |
xfree (name);
|
|
|
26bbde |
}
|
|
|
26bbde |
else
|
|
|
26bbde |
- {
|
|
|
26bbde |
- debug_print_missing (newobj->so_name, build_id_filename);
|
|
|
26bbde |
-
|
|
|
26bbde |
- /* In the case the main executable was found according to
|
|
|
26bbde |
- its build-id (from a core file) prevent loading
|
|
|
26bbde |
- a different build of a library with accidentally the
|
|
|
26bbde |
- same SO_NAME.
|
|
|
26bbde |
-
|
|
|
26bbde |
- It suppresses bogus backtraces (and prints "??" there
|
|
|
26bbde |
- instead) if the on-disk files no longer match the
|
|
|
26bbde |
- running program version. */
|
|
|
26bbde |
-
|
|
|
26bbde |
- if (symfile_objfile != NULL
|
|
|
26bbde |
- && (symfile_objfile->flags
|
|
|
26bbde |
- & OBJF_BUILD_ID_CORE_LOADED) != 0)
|
|
|
26bbde |
- newobj->so_name[0] = 0;
|
|
|
26bbde |
- }
|
|
|
26bbde |
+ debug_print_missing (newobj->so_name, build_id_filename);
|
|
|
26bbde |
|
|
|
26bbde |
xfree (build_id_filename);
|
|
|
26bbde |
xfree (build_id);
|