From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6146 invoked by alias); 6 Oct 2009 21:46:07 -0000 Received: (qmail 6136 invoked by uid 22791); 6 Oct 2009 21:46:05 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Oct 2009 21:46:01 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n96Lk0sk013013 for ; Tue, 6 Oct 2009 17:46:00 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n96LjvbN024093 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 6 Oct 2009 17:46:00 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n96Ljv0X013312 for ; Tue, 6 Oct 2009 23:45:57 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n96LjuUL013310 for gdb-patches@sourceware.org; Tue, 6 Oct 2009 23:45:56 +0200 Date: Tue, 06 Oct 2009 21:46:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. Message-ID: <20091006214556.GA12955@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00142.txt.bz2 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 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. --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1097,8 +1097,18 @@ svr4_current_sos (void) target_read_string (LM_NAME (new), &buffer, 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. */ + + if (master_so_list () != NULL) + warning (_("Can't read pathname for load map: %s."), + safe_strerror (errcode)); + } else { strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1); --- a/gdb/solib.c +++ b/gdb/solib.c @@ -538,6 +538,7 @@ update_solib_list (int from_tty, struct target_ops *target) 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. */ @@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target) 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. */ + + if (saved_so_list_head == NULL && so_list_head != NULL) + update_solib_list (from_tty, target); }