]>
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 | ||
a7de96f0 | 4 | [ New patch variant. ] |
ab050a48 | 5 | |
a7de96f0 | 6 | Index: gdb-7.4.50.20120703/gdb/solib-svr4.c |
51a5ef0f | 7 | =================================================================== |
a7de96f0 PS |
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 | |
f412e1b4 PS |
11 | SO_NAME_MAX_PATH_SIZE - 1, &errcode); |
12 | if (errcode != 0) | |
13 | { | |
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 | |
21 | + readable. */ | |
ab050a48 | 22 | + |
f412e1b4 PS |
23 | + if (master_so_list () != NULL) |
24 | + warning (_("Can't read pathname for load map: %s."), | |
25 | + safe_strerror (errcode)); | |
26 | + | |
27 | do_cleanups (old_chain); | |
28 | continue; | |
29 | } | |
a7de96f0 | 30 | Index: gdb-7.4.50.20120703/gdb/solib.c |
51a5ef0f | 31 | =================================================================== |
a7de96f0 PS |
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. */ | |
36 | ||
37 | static void | |
38 | -update_solib_list (int from_tty, struct target_ops *target) | |
39 | +update_solib_list_1 (int from_tty, struct target_ops *target) | |
40 | { | |
ab050a48 BZ |
41 | struct target_so_ops *ops = solib_ops (target_gdbarch); |
42 | struct so_list *inferior = ops->current_sos(); | |
a7de96f0 PS |
43 | @@ -843,6 +843,21 @@ Do you need \"set solib-search-path\" or |
44 | } | |
45 | } | |
46 | ||
47 | +/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch */ | |
48 | + | |
49 | +static void | |
50 | +update_solib_list (int from_tty, struct target_ops *target) | |
51 | +{ | |
ab050a48 | 52 | + struct so_list *saved_so_list_head = so_list_head; |
a7de96f0 PS |
53 | + |
54 | + update_solib_list_1 (from_tty, target); | |
55 | + | |
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. */ | |
58 | + | |
59 | + if (saved_so_list_head == NULL && so_list_head != NULL) | |
60 | + update_solib_list_1 (from_tty, target); | |
61 | +} | |
ab050a48 | 62 | |
a7de96f0 | 63 | /* Return non-zero if NAME is the libpthread shared library. |
51a5ef0f | 64 | |
a7de96f0 PS |
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 .*" | |
71 | pass $wholetest | |
72 | } | |
73 | + | |
74 | + | |
75 | +# Test Linux specific vDSO warning: | |
76 | +# warning: Can't read pathname for load map: Input/output error. | |
ab050a48 | 77 | + |
a7de96f0 | 78 | +clean_restart ${testfile} |
ab050a48 | 79 | + |
a7de96f0 PS |
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 $" { | |
83 | + fail $test | |
84 | + } | |
85 | + -re "\r\n$gdb_prompt $" { | |
86 | + pass $test | |
87 | + } | |
88 | +} | |
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 | |
94 | # Binary file. | |
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}] | |
101 | ||
102 | if [get_compiler_info] { | |
103 | @@ -72,8 +73,26 @@ gdb_test "br foo2" \ | |
104 | "Breakpoint.*: foo2. .2 locations..*" \ | |
105 | "foo2 in mdlib" | |
106 | ||
107 | -gdb_exit | |
108 | +# Test GDB warns for shared libraris which have not been found. | |
109 | ||
110 | -return 0 | |
111 | +gdb_test "info sharedlibrary" "/${libname}.*" | |
112 | ||
113 | +clean_restart ${executable} | |
114 | +gdb_breakpoint "main" | |
115 | +gdb_run_cmd | |
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 $" { | |
119 | + fail $test | |
120 | + } | |
121 | + -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" { | |
122 | + pass $test | |
123 | + } | |
124 | +} | |
125 | ||
126 | +clean_restart ${executable} | |
127 | +gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST" | |
128 | +gdb_breakpoint "main" | |
129 | +gdb_run_cmd | |
130 | +gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \ | |
131 | + "warning for missing libraries" |