From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26549 invoked by alias); 24 Sep 2013 17:47:19 -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 26533 invoked by uid 89); 24 Sep 2013 17:47:18 -0000 Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 24 Sep 2013 17:47:18 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Sep 2013 18:47:13 +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; Tue, 24 Sep 2013 18:47:11 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 732FB1B0805D for ; Tue, 24 Sep 2013 18:47:12 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r8OHkwjp31195290 for ; Tue, 24 Sep 2013 17:46:58 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r8OHlALP012198 for ; Tue, 24 Sep 2013 11:47:10 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-143.boeblingen.de.ibm.com [9.152.212.143]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r8OHl9Gl012177; Tue, 24 Sep 2013 11:47:10 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Ulrich Weigand , jan.kratochvil@redhat.com Subject: [PATCH v2] Skip vDSO when reading SO list (PR 8882) Date: Tue, 24 Sep 2013 17:47:00 -0000 Message-ID: <87eh8ep0wy.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: 13092417-5024-0000-0000-00000750F0F3 X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00876.txt.bz2 Suppress the warning when the vDSO's pathname from the SO list in a core file can not be accessed. The glibc's dynamic loader uses empty-string literals for both the executable as well as the vDSO, and the compiler collates both of them to a single string literal. Thus the vDSO's l_name address matches the main executable's. This property is used as a criteria for identifying and silently skipping the vDSO. This version includes a small test case and follows Jan's proposal of moving the suppression logic after the pathname read has already failed. OK to apply? ChangeLog: 2013-09-24 Andreas Arnez * solib-svr4.c (svr4_read_so_list): Skip the vDSO when reading link map entries. testsuite/ChangeLog: 2013-09-24 Andreas Arnez * gdb.base/corefile.exp: Add a check to assure warning-free core-file load. 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,6 +1350,7 @@ 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; @@ -1359,8 +1361,16 @@ svr4_read_so_list (CORE_ADDR lm, CORE_AD SO_NAME_MAX_PATH_SIZE - 1, &errcode); if (errcode != 0) { - warning (_("Can't read pathname for load map: %s."), - safe_strerror (errcode)); + /* If this entry's l_name address matches that of the + inferior executable, then this is not a normal shared + object, but (most likely) a vDSO. In this case, silently + skip it; otherwise emit a warning. */ + if (! (first != NULL + && new->lm_info->l_name == first->lm_info->l_name)) + { + warning (_("Can't read pathname for load map: %s."), + safe_strerror (errcode)); + } do_cleanups (old_chain); continue; } Index: gdb/gdb/testsuite/gdb.base/corefile.exp =================================================================== --- gdb.orig/gdb/testsuite/gdb.base/corefile.exp +++ gdb/gdb/testsuite/gdb.base/corefile.exp @@ -255,3 +255,19 @@ if ![is_remote target] { gdb_exit } + +# Test warning-free core file load. E.g., a Linux vDSO used to +# trigger this warning: +# warning: Can't read pathname for load map: Input/output error. + +clean_restart ${testfile} + +set test "core-file warning-free" +gdb_test_multiple "core-file $corefile" $test { + -re "warning: .*\r\n.*\r\n$gdb_prompt $" { + fail $test + } + -re "\r\n$gdb_prompt $" { + pass $test + } +}