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 Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
7 ===================================================================
8 --- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-06 15:39:57.000000000 +0200
9 +++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-06 15:40:01.124816148 +0200
10 @@ -1221,8 +1221,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
11 SO_NAME_MAX_PATH_SIZE - 1, &errcode);
14 - warning (_("Can't read pathname for load map: %s."),
15 - safe_strerror (errcode));
16 + /* During the first ever DSO list reading some strings may be
17 + unreadable as residing in the ld.so readonly memory not being
18 + present in a dumped core file. Delay the error check after
19 + the first pass of DSO list scanning when ld.so should be
20 + already mapped in and all the DSO list l_name memory gets
23 + if (master_so_list () != NULL)
24 + warning (_("Can't read pathname for load map: %s."),
25 + safe_strerror (errcode));
27 do_cleanups (old_chain);
30 Index: gdb-7.4.50.20120703/gdb/solib.c
31 ===================================================================
32 --- gdb-7.4.50.20120703.orig/gdb/solib.c 2012-07-06 15:38:39.000000000 +0200
33 +++ gdb-7.4.50.20120703/gdb/solib.c 2012-07-06 15:40:01.125816147 +0200
34 @@ -672,7 +672,7 @@ solib_used (const struct so_list *const
35 processes we've just attached to, so that's okay. */
38 -update_solib_list (int from_tty, struct target_ops *target)
39 +update_solib_list_1 (int from_tty, struct target_ops *target)
41 struct target_so_ops *ops = solib_ops (target_gdbarch);
42 struct so_list *inferior = ops->current_sos();
43 @@ -843,6 +843,21 @@ Do you need \"set solib-search-path\" or
47 +/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch */
50 +update_solib_list (int from_tty, struct target_ops *target)
52 + struct so_list *saved_so_list_head = so_list_head;
54 + update_solib_list_1 (from_tty, target);
56 + /* If this was the very first DSO list scan and we possibly read in ld.so
57 + recheck all the formerly unreadable DSO names strings. */
59 + if (saved_so_list_head == NULL && so_list_head != NULL)
60 + update_solib_list_1 (from_tty, target);
63 /* Return non-zero if NAME is the libpthread shared library.
65 Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp
66 ===================================================================
67 --- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:39:41.000000000 +0200
68 +++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:40:10.322805539 +0200
69 @@ -286,3 +286,19 @@ if {$buildid == ""} {
70 gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
75 +# Test Linux specific vDSO warning:
76 +# warning: Can't read pathname for load map: Input/output error.
78 +clean_restart ${testfile}
80 +set test "core-file vdso warning"
81 +gdb_test_multiple "core-file $corefile" $test {
82 + -re "warning: Can't read pathname for load map: Input/output error\\.\r\n.*\r\n$gdb_prompt $" {
85 + -re "\r\n$gdb_prompt $" {
89 Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp
90 ===================================================================
91 --- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:38:39.000000000 +0200
92 +++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:40:01.127816145 +0200
93 @@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B
95 set testfile "solib-symbol-main"
96 set srcfile ${srcdir}/${subdir}/${testfile}.c
97 -set binfile ${objdir}/${subdir}/${testfile}
98 +set executable ${testfile}
99 +set binfile ${objdir}/${subdir}/${executable}
100 set bin_flags [list debug shlib=${binfile_lib}]
102 if [get_compiler_info] {
103 @@ -72,8 +73,26 @@ gdb_test "br foo2" \
104 "Breakpoint.*: foo2. .2 locations..*" \
108 +# Test GDB warns for shared libraris which have not been found.
111 +gdb_test "info sharedlibrary" "/${libname}.*"
113 +clean_restart ${executable}
114 +gdb_breakpoint "main"
116 +set test "no warning for missing libraries"
117 +gdb_test_multiple "" $test {
118 + -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" {
121 + -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" {
126 +clean_restart ${executable}
127 +gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
128 +gdb_breakpoint "main"
130 +gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
131 + "warning for missing libraries"