]>
Commit | Line | Data |
---|---|---|
324d13e1 | 1 | Index: gdb-7.9.90.20150709/gdb/solib-svr4.c |
03ffe914 | 2 | =================================================================== |
324d13e1 JR |
3 | --- gdb-7.9.90.20150709.orig/gdb/solib-svr4.c 2015-07-09 18:18:54.526417766 +0200 |
4 | +++ gdb-7.9.90.20150709/gdb/solib-svr4.c 2015-07-09 18:19:33.074746586 +0200 | |
5 | @@ -1381,14 +1381,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD | |
a7de96f0 PS |
6 | } |
7 | ||
8 | { | |
324d13e1 JR |
9 | - struct bfd_build_id *build_id; |
10 | + struct bfd_build_id *build_id = NULL; | |
a7de96f0 | 11 | |
324d13e1 JR |
12 | strncpy (newobj->so_original_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); |
13 | newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; | |
a7de96f0 | 14 | /* May get overwritten below. */ |
324d13e1 | 15 | strcpy (newobj->so_name, newobj->so_original_name); |
a7de96f0 | 16 | |
324d13e1 | 17 | - build_id = build_id_addr_get (newobj->lm_info->l_ld); |
a7de96f0 PS |
18 | + /* In the case the main executable was found according to its build-id |
19 | + (from a core file) prevent loading a different build of a library | |
20 | + with accidentally the same SO_NAME. | |
21 | + | |
22 | + It suppresses bogus backtraces (and prints "??" there instead) if | |
23 | + the on-disk files no longer match the running program version. | |
24 | + | |
25 | + If the main executable was not loaded according to its build-id do | |
26 | + not do any build-id checking of the libraries. There may be missing | |
27 | + build-ids dumped in the core file and we would map all the libraries | |
28 | + to the only existing file loaded that time - the executable. */ | |
29 | + if (symfile_objfile != NULL | |
30 | + && (symfile_objfile->flags & OBJF_BUILD_ID_CORE_LOADED) != 0) | |
324d13e1 | 31 | + build_id = build_id_addr_get (newobj->lm_info->l_ld); |
a7de96f0 PS |
32 | if (build_id != NULL) |
33 | { | |
34 | char *name, *build_id_filename; | |
324d13e1 | 35 | @@ -1403,23 +1416,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD |
a7de96f0 PS |
36 | xfree (name); |
37 | } | |
38 | else | |
39 | - { | |
324d13e1 | 40 | - debug_print_missing (newobj->so_name, build_id_filename); |
a7de96f0 PS |
41 | - |
42 | - /* In the case the main executable was found according to | |
43 | - its build-id (from a core file) prevent loading | |
44 | - a different build of a library with accidentally the | |
45 | - same SO_NAME. | |
46 | - | |
47 | - It suppresses bogus backtraces (and prints "??" there | |
48 | - instead) if the on-disk files no longer match the | |
49 | - running program version. */ | |
50 | - | |
51 | - if (symfile_objfile != NULL | |
52 | - && (symfile_objfile->flags | |
53 | - & OBJF_BUILD_ID_CORE_LOADED) != 0) | |
324d13e1 | 54 | - newobj->so_name[0] = 0; |
a7de96f0 | 55 | - } |
324d13e1 | 56 | + debug_print_missing (newobj->so_name, build_id_filename); |
a7de96f0 PS |
57 | |
58 | xfree (build_id_filename); | |
59 | xfree (build_id); |