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