Blame SOURCES/gdb-core-open-vdso-warning.patch

861f93
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
861f93
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map:  Input/output error.
861f93
861f93
[ New patch variant.  ]
861f93
861f93
Index: gdb-7.5.50.20130118/gdb/solib-svr4.c
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/solib-svr4.c	2013-01-18 23:05:19.414210015 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/solib-svr4.c	2013-01-18 23:05:34.813231664 +0100
861f93
@@ -1221,8 +1221,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
861f93
 			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
861f93
       if (errcode != 0)
861f93
 	{
861f93
-	  warning (_("Can't read pathname for load map: %s."),
861f93
-		   safe_strerror (errcode));
861f93
+	  /* During the first ever DSO list reading some strings may be
861f93
+	     unreadable as residing in the ld.so readonly memory not being
861f93
+	     present in a dumped core file.  Delay the error check after
861f93
+	     the first pass of DSO list scanning when ld.so should be
861f93
+	     already mapped in and all the DSO list l_name memory gets
861f93
+	     readable.  */
861f93
+
861f93
+	  if (master_so_list () != NULL)
861f93
+	    warning (_("Can't read pathname for load map: %s."),
861f93
+		     safe_strerror (errcode));
861f93
+
861f93
 	  do_cleanups (old_chain);
861f93
 	  continue;
861f93
 	}
861f93
Index: gdb-7.5.50.20130118/gdb/solib.c
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/solib.c	2013-01-18 23:05:19.415210017 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/solib.c	2013-01-18 23:05:57.421263173 +0100
861f93
@@ -666,7 +666,7 @@ solib_used (const struct so_list *const
861f93
    processes we've just attached to, so that's okay.  */
861f93
 
861f93
 static void
861f93
-update_solib_list (int from_tty, struct target_ops *target)
861f93
+update_solib_list_1 (int from_tty, struct target_ops *target)
861f93
 {
861f93
   struct target_so_ops *ops = solib_ops (target_gdbarch ());
861f93
   struct so_list *inferior = ops->current_sos();
861f93
@@ -837,6 +837,21 @@ Do you need \"set solib-search-path\" or
861f93
     }
861f93
 }
861f93
 
861f93
+/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch  */
861f93
+
861f93
+static void
861f93
+update_solib_list (int from_tty, struct target_ops *target)
861f93
+{
861f93
+  struct so_list *saved_so_list_head = so_list_head;
861f93
+
861f93
+  update_solib_list_1 (from_tty, target);
861f93
+
861f93
+  /* If this was the very first DSO list scan and we possibly read in ld.so
861f93
+     recheck all the formerly unreadable DSO names strings.  */
861f93
+
861f93
+  if (saved_so_list_head == NULL && so_list_head != NULL)
861f93
+    update_solib_list_1 (from_tty, target);
861f93
+}
861f93
 
861f93
 /* Return non-zero if NAME is the libpthread shared library.
861f93
 
861f93
Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.base/corefile.exp
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/corefile.exp	2013-01-18 23:05:19.416210020 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/corefile.exp	2013-01-18 23:05:34.814231667 +0100
861f93
@@ -286,3 +286,19 @@ if {$buildid == ""} {
861f93
     gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
861f93
     pass $wholetest
861f93
 }
861f93
+
861f93
+
861f93
+# Test Linux specific vDSO warning:
861f93
+# warning: Can't read pathname for load map: Input/output error.
861f93
+
861f93
+clean_restart ${testfile}
861f93
+
861f93
+set test "core-file vdso warning"
861f93
+gdb_test_multiple "core-file $corefile" $test {
861f93
+    -re "warning: Can't read pathname for load map: Input/output error\\.\r\n.*\r\n$gdb_prompt $" {
861f93
+	fail $test
861f93
+    }
861f93
+    -re "\r\n$gdb_prompt $" {
861f93
+	pass $test
861f93
+    }
861f93
+}
861f93
Index: gdb-7.5.50.20130118/gdb/testsuite/gdb.base/solib-symbol.exp
861f93
===================================================================
861f93
--- gdb-7.5.50.20130118.orig/gdb/testsuite/gdb.base/solib-symbol.exp	2013-01-18 23:05:19.416210020 +0100
861f93
+++ gdb-7.5.50.20130118/gdb/testsuite/gdb.base/solib-symbol.exp	2013-01-18 23:05:34.814231667 +0100
861f93
@@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B
861f93
 # Binary file.
861f93
 set testfile "solib-symbol-main"
861f93
 set srcfile ${srcdir}/${subdir}/${testfile}.c
861f93
-set binfile ${objdir}/${subdir}/${testfile}
861f93
+set executable ${testfile}
861f93
+set binfile ${objdir}/${subdir}/${executable}
861f93
 set bin_flags [list debug shlib=${binfile_lib}]
861f93
 
861f93
 if [get_compiler_info] {
861f93
@@ -72,8 +73,26 @@ gdb_test "br foo2" \
861f93
 	 "Breakpoint.*: foo2. .2 locations..*" \
861f93
 	 "foo2 in mdlib"
861f93
 
861f93
-gdb_exit
861f93
+# Test GDB warns for shared libraris which have not been found.
861f93
 
861f93
-return 0
861f93
+gdb_test "info sharedlibrary" "/${libname}.*"
861f93
 
861f93
+clean_restart ${executable}
861f93
+gdb_breakpoint "main"
861f93
+gdb_run_cmd
861f93
+set test "no warning for missing libraries"
861f93
+gdb_test_multiple "" $test {
861f93
+    -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" {
861f93
+	fail $test
861f93
+    }
861f93
+    -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" {
861f93
+	pass $test
861f93
+    }
861f93
+}
861f93
 
861f93
+clean_restart ${executable}
861f93
+gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST"
861f93
+gdb_breakpoint "main"
861f93
+gdb_run_cmd
861f93
+gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \
861f93
+	 "warning for missing libraries"