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

85 lines
3.2 KiB
Diff
Raw Normal View History

2010-01-12 22:15:57 +00:00
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
Hi,
GDB currently always prints on loading a core file:
warning: Can't read pathname for load map: Input/output error.
The patch is not nice but it was WONTFIXed on the glibc side in:
http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name
but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY.
This fix is intended for Linux system vDSO l_name which is a second entry in
the DSO list.
Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
Thanks,
Jan
gdb/
2009-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Do not print false warning on reading core file with vDSO on GNU/Linux.
* solib-svr4.c (svr4_current_sos): Suppress the warning if
MASTER_SO_LIST is still NULL.
* solib.c (update_solib_list): New variable saved_so_list_head.
Conditionally restart the function.
[ Context backport. ]
2012-01-03 15:00:12 +00:00
Index: gdb-7.4.50.20111218/gdb/solib-svr4.c
===================================================================
2012-01-03 15:00:12 +00:00
--- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100
+++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100
@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
{
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ /* During the first ever DSO list reading some strings may be
+ unreadable as residing in the ld.so readonly memory not being
+ present in a dumped core file. Delay the error check after
+ the first pass of DSO list scanning when ld.so should be
+ already mapped in and all the DSO list l_name memory gets
+ readable. */
2010-01-12 22:15:57 +00:00
+
2012-01-03 15:00:12 +00:00
+ if (master_so_list () != NULL)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+
do_cleanups (old_chain);
continue;
}
Index: gdb-7.4.50.20111218/gdb/solib.c
===================================================================
2012-01-03 15:00:12 +00:00
--- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200
+++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100
@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct
2010-01-12 22:15:57 +00:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
+ struct so_list *saved_so_list_head = so_list_head;
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
2012-01-03 15:00:12 +00:00
@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct
2010-01-12 22:15:57 +00:00
observer_notify_solib_loaded (i);
}
+ /* If this was the very first DSO list scan and we possibly read in ld.so
+ recheck all the formerly unreadable DSO names strings. */
2010-01-12 22:15:57 +00:00
+
+ if (saved_so_list_head == NULL && so_list_head != NULL)
+ return update_solib_list (from_tty, target);
2010-01-12 22:15:57 +00:00
+
/* If a library was not found, issue an appropriate warning
message. We have to use a single call to warning in case the
front end does something special with warnings, e.g., pop up