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.
6 GDB currently always prints on loading a core file:
7 warning: Can't read pathname for load map: Input/output error.
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
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.
15 This fix is intended for Linux system vDSO l_name which is a second entry in
18 Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
26 2009-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
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.
36 Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
37 ===================================================================
38 --- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100
39 +++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100
40 @@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
41 SO_NAME_MAX_PATH_SIZE - 1, &errcode);
44 - warning (_("Can't read pathname for load map: %s."),
45 - safe_strerror (errcode));
46 + /* During the first ever DSO list reading some strings may be
47 + unreadable as residing in the ld.so readonly memory not being
48 + present in a dumped core file. Delay the error check after
49 + the first pass of DSO list scanning when ld.so should be
50 + already mapped in and all the DSO list l_name memory gets
53 + if (master_so_list () != NULL)
54 + warning (_("Can't read pathname for load map: %s."),
55 + safe_strerror (errcode));
57 do_cleanups (old_chain);
60 Index: gdb-7.4.50.20111218/gdb/solib.c
61 ===================================================================
62 --- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200
63 +++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100
64 @@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct
65 struct target_so_ops *ops = solib_ops (target_gdbarch);
66 struct so_list *inferior = ops->current_sos();
67 struct so_list *gdb, **gdb_link;
68 + struct so_list *saved_so_list_head = so_list_head;
70 /* We can reach here due to changing solib-search-path or the
71 sysroot, before having any inferior. */
72 @@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct
73 observer_notify_solib_loaded (i);
76 + /* If this was the very first DSO list scan and we possibly read in ld.so
77 + recheck all the formerly unreadable DSO names strings. */
79 + if (saved_so_list_head == NULL && so_list_head != NULL)
80 + return update_solib_list (from_tty, target);
82 /* If a library was not found, issue an appropriate warning
83 message. We have to use a single call to warning in case the
84 front end does something special with warnings, e.g., pop up