From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32280 invoked by alias); 19 Aug 2013 14:44:21 -0000 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 Received: (qmail 32266 invoked by uid 89); 19 Aug 2013 14:44:20 -0000 X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD autolearn=ham version=3.3.2 Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 19 Aug 2013 14:44:19 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Aug 2013 15:37:38 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Aug 2013 15:37:37 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4003E1B0805D for ; Mon, 19 Aug 2013 15:44:16 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7JEi33t51380304 for ; Mon, 19 Aug 2013 14:44:03 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7JEiEh1029402 for ; Mon, 19 Aug 2013 08:44:14 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-143.boeblingen.de.ibm.com [9.152.212.143]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r7JEiDXL029377; Mon, 19 Aug 2013 08:44:14 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Andreas Krebbel Subject: [PATCH] Skip VDSO when reading SO list Date: Mon, 19 Aug 2013 14:44:00 -0000 Message-ID: <87d2p9oi4i.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13081914-5024-0000-0000-000006F4DC14 X-SW-Source: 2013-08/txt/msg00504.txt.bz2 On some Linux versions, the file name (l_name) of a VDSO's link map entry lies in read-only memory that is excluded from a core dump. When reading such a core dump, GDB complains: warning: Can't read pathname for load map: Input/output error. When GDB walks through the link map again after establishing the file mappings, the file name will be recognized as the empty string, and the entry will be ignored. However, if the user supplied the wrong version of the executable, a bogus entry with a garbage file name may be created instead. This patch tries to avoid the warning and the potential bogus entry. In the cases I've looked at, the VDSO's l_name address matches that of the main executable. Thus the patch uses this as a criteria for identifying (and skipping) the VDSO. 2013-08-19 Andreas Arnez * solib-svr4.c (svr4_read_so_list): Skip the VDSO when reading link map entries. Index: gdb/gdb/solib-svr4.c =================================================================== --- gdb.orig/gdb/solib-svr4.c +++ gdb/gdb/solib-svr4.c @@ -1310,6 +1310,7 @@ static int svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, struct so_list ***link_ptr_ptr, int ignore_first) { + struct so_list *first = NULL; CORE_ADDR next_lm; for (; lm != 0; prev_lm = lm, lm = next_lm) @@ -1349,10 +1350,22 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD { struct svr4_info *info = get_svr4_info (); + first = new; info->main_lm_addr = new->lm_info->lm_addr; do_cleanups (old_chain); continue; } + + /* The l_name of a VDSO sometimes lies in read-only memory that + is excluded from a core dump. In order to avoid the "can't + read pathname" warning, we try to identify the VDSO. One + criteria is that the l_name address matches that of the main + executable. */ + if (first && new->lm_info->l_name == first->lm_info->l_name) + { + do_cleanups (old_chain); + continue; + } /* Extract this shared object's name. */ target_read_string (new->lm_info->l_name, &buffer,