From patchwork Fri Oct 26 20:08:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 194562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AAD252C00A3 for ; Sat, 27 Oct 2012 07:09:16 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351886956; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=tCAyCyF f/+gDEOfPaFy/e1Lcw/w=; b=ORX57mjiPKoKEK5awnqDN4hPoYm6Ib7FYomaTK1 TpkKiymvfJJKxOwIZeUql4ZyIOYD2NWHXHYybpqC40tanHwJUKqUYyv6QekCVozI rcSQb/BN9ag5olAT5Z7VxRD8u2qRulnuz9DQSUnrtFTo9FaSh4IiQ+wSgs1d1apI w46I= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KEyWLS4SmktKvoBHT7Jnyv8bqQ8oaOo1d993yMrQ4WThBIR9JgrU9FhO2m71LN lZYOfmcdf1iW2bIa1q1CEjFqqbHhXiubU8iP2Dz+HStkIUQLiP5wmKzi1l5FA40j LWXLufG6Z/s4+RE3iydWPpNVe+oSCCfoQvVWi6SmpI4Wg=; Received: (qmail 22030 invoked by alias); 26 Oct 2012 20:09:05 -0000 Received: (qmail 21859 invoked by uid 22791); 26 Oct 2012 20:09:01 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-da0-f47.google.com (HELO mail-da0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Oct 2012 20:08:54 +0000 Received: by mail-da0-f47.google.com with SMTP id s35so1386169dak.20 for ; Fri, 26 Oct 2012 13:08:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=N8aSro8UD4nfkIHBxpQTUTAqbD509PdpMfNvN17dbo4=; b=bl4hUDQEQjTxHHCoX9tA1f6A5E460imf6C2lkIZmxn1V3rBw+x6MnT/a9My0+kfzKh EkHhKV6OdiYheaIJmv/ACpm2TTWHNLcVdl5zHD4UEnZz59Lj3mdSuza9ms44ewqVTSuz +NaD1zsbMrS0GToNl/vzuR95vAAGBov7bOmVMU4hp064WIuuBlf7FxlJ7mSnEU5RvWQy H3u3PdP7xHdNpHhQZmFB2TidBlSS6NT0uEsJNQcDce2FP2IUYiE+yjOOSXRdpcSk9Llo BOtPKcUhDbObZP8djuWF+NcIf7ONUTEuxOaFhWOhAXkosvFHIBOwmGXekRKWDdbGndL7 rROg== Received: by 10.66.84.40 with SMTP id v8mr64694340pay.47.1351282133734; Fri, 26 Oct 2012 13:08:53 -0700 (PDT) Received: from coign.google.com ([2620:0:1000:1804:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id v9sm1490649paz.6.2012.10.26.13.08.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Oct 2012 13:08:53 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: libbacktrace patch committed: Don't warn about missing shared libs Date: Fri, 26 Oct 2012 13:08:51 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmrpIVKV6FE5jA8TbbkdT57QPxZZfla2EeIJ90P2fhuaAaOKBgipRW/sKL/CjMDazW8ikdab+Ent8fSmFPfHKfBpaeNZ5Jv8mwBwQD3qudzWvjjGPQbLQMhCFKOwPgwYfdMXUgAFVKjhus1ZCoJgF2KuO7MLwwuESaIzJNUAvW9wiHWnl6Zy8GkVnfMYqRaHElieBRBbRmTeKiNAxCPqL1G5EZ7uA== X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I have not been able to recreate PR 55087, but it seems to be pointing out a case where libbacktrace is issuing an error attempting to open a shared library that does not exist (in this case it's the VDSO library, which never exists in the file system as far as I know). This patch to libbacktrace avoids issuing an error in such a case. Bootstrapped and ran libbacktrace testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2012-10-26 Ian Lance Taylor PR other/55087 * posix.c (backtrace_open): Add does_not_exist parameter. * elf.c (phdr_callback): Do not warn if shared library could not be opened. * fileline.c (fileline_initialize): Update calls to backtrace_open. * internal.h (backtrace_open): Update declaration. Index: posix.c =================================================================== --- posix.c (revision 192860) +++ posix.c (working copy) @@ -57,14 +57,20 @@ POSSIBILITY OF SUCH DAMAGE. */ int backtrace_open (const char *filename, backtrace_error_callback error_callback, - void *data) + void *data, int *does_not_exist) { int descriptor; + if (does_not_exist != NULL) + *does_not_exist = 0; + descriptor = open (filename, O_RDONLY | O_BINARY | O_CLOEXEC); if (descriptor < 0) { - error_callback (data, filename, errno); + if (does_not_exist != NULL && errno == ENOENT) + *does_not_exist = 1; + else + error_callback (data, filename, errno); return -1; } Index: elf.c =================================================================== --- elf.c (revision 192860) +++ elf.c (working copy) @@ -810,6 +810,7 @@ phdr_callback (struct dl_phdr_info *info { struct phdr_data *pd = (struct phdr_data *) pdata; int descriptor; + int does_not_exist; fileline elf_fileline_fn; int found_dwarf; @@ -821,7 +822,8 @@ phdr_callback (struct dl_phdr_info *info || info->dlpi_addr == 0) return 0; - descriptor = backtrace_open (info->dlpi_name, pd->error_callback, pd->data); + descriptor = backtrace_open (info->dlpi_name, pd->error_callback, pd->data, + &does_not_exist); if (descriptor < 0) return 0; Index: internal.h =================================================================== --- internal.h (revision 192860) +++ internal.h (working copy) @@ -109,10 +109,16 @@ struct backtrace_state struct backtrace_freelist_struct *freelist; }; -/* Open a file for reading. Returns -1 on error. */ +/* Open a file for reading. Returns -1 on error. If DOES_NOT_EXIST + is not NULL, *DOES_NOT_EXIST will be set to 0 normally and set to 1 + if the file does not exist. If the file does not exist and + DOES_NOT_EXIST is not NULL, the function will return -1 and will + not call ERROR_CALLBACK. On other errors, or if DOES_NOT_EXIST is + NULL, the function will call ERROR_CALLBACK before returning. */ extern int backtrace_open (const char *filename, backtrace_error_callback error_callback, - void *data); + void *data, + int *does_not_exist); /* A view of the contents of a file. This supports mmap when available. A view will remain in memory even after backtrace_close Index: fileline.c =================================================================== --- fileline.c (revision 192860) +++ fileline.c (working copy) @@ -80,9 +80,9 @@ fileline_initialize (struct backtrace_st /* We have not initialized the information. Do it now. */ if (state->filename != NULL) - descriptor = backtrace_open (state->filename, error_callback, data); + descriptor = backtrace_open (state->filename, error_callback, data, NULL); else - descriptor = backtrace_open ("/proc/self/exe", error_callback, data); + descriptor = backtrace_open ("/proc/self/exe", error_callback, data, NULL); if (descriptor < 0) failed = 1;