]>
Commit | Line | Data |
---|---|---|
ab050a48 BZ |
1 | http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html |
2 | Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. | |
3 | ||
4 | Hi, | |
5 | ||
6 | GDB currently always prints on loading a core file: | |
7 | warning: Can't read pathname for load map: Input/output error. | |
8 | ||
9 | The patch is not nice but it was WONTFIXed on the glibc side in: | |
10 | http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html | |
11 | ||
12 | The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name | |
13 | but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY. | |
14 | ||
15 | This fix is intended for Linux system vDSO l_name which is a second entry in | |
16 | the DSO list. | |
17 | ||
18 | Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu. | |
19 | ||
20 | ||
21 | Thanks, | |
22 | Jan | |
23 | ||
24 | ||
25 | gdb/ | |
26 | 2009-10-06 Jan Kratochvil <jan.kratochvil@redhat.com> | |
27 | ||
28 | Do not print false warning on reading core file with vDSO on GNU/Linux. | |
29 | * solib-svr4.c (svr4_current_sos): Suppress the warning if | |
30 | MASTER_SO_LIST is still NULL. | |
31 | * solib.c (update_solib_list): New variable saved_so_list_head. | |
32 | Conditionally restart the function. | |
33 | ||
34 | [ Context backport. ] | |
35 | ||
36 | --- a/gdb/solib-svr4.c | |
37 | +++ b/gdb/solib-svr4.c | |
38 | @@ -1097,8 +1097,18 @@ svr4_current_sos (void) | |
39 | target_read_string (LM_NAME (new), &buffer, | |
40 | SO_NAME_MAX_PATH_SIZE - 1, &errcode); | |
41 | if (errcode != 0) | |
42 | - warning (_("Can't read pathname for load map: %s."), | |
43 | - safe_strerror (errcode)); | |
44 | + { | |
45 | + /* During the first ever DSO list reading some strings may be | |
46 | + unreadable as residing in the ld.so readonly memory not being | |
47 | + present in a dumped core file. Delay the error check after | |
48 | + the first pass of DSO list scanning when ld.so should be | |
49 | + already mapped in and all the DSO list l_name memory gets | |
50 | + readable. */ | |
51 | + | |
52 | + if (master_so_list () != NULL) | |
53 | + warning (_("Can't read pathname for load map: %s."), | |
54 | + safe_strerror (errcode)); | |
55 | + } | |
56 | else | |
57 | { | |
58 | struct build_id *build_id; | |
59 | --- a/gdb/solib.c | |
60 | +++ b/gdb/solib.c | |
61 | @@ -538,6 +538,7 @@ update_solib_list (int from_tty, struct target_ops *target) | |
62 | struct target_so_ops *ops = solib_ops (target_gdbarch); | |
63 | struct so_list *inferior = ops->current_sos(); | |
64 | struct so_list *gdb, **gdb_link; | |
65 | + struct so_list *saved_so_list_head = so_list_head; | |
66 | ||
67 | /* We can reach here due to changing solib-search-path or the | |
68 | sysroot, before having any inferior. */ | |
69 | @@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target) | |
70 | observer_notify_solib_loaded (i); | |
71 | } | |
72 | } | |
73 | + | |
74 | + /* If this was the very first DSO list scan and we possibly read in ld.so | |
75 | + recheck all the formerly unreadable DSO names strings. */ | |
76 | + | |
77 | + if (saved_so_list_head == NULL && so_list_head != NULL) | |
78 | + update_solib_list (from_tty, target); | |
79 | } | |
80 | ||
81 | ||
82 |