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