From patchwork Wed Feb 13 07:15:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1040994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495984-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gdcproject.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ki3p6H+3"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43zrQx195Nz9s5c for ; Wed, 13 Feb 2019 18:15:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=cmFfGmaFzyHzKakzAh3ckA1o9pd2OC5C8ytKV/3wu3y0rE FpY+E+q1ZIQlwemp3IkXJmVYAyVfVe/bby7J95mahc9xhtc0zBvqTcZKUPIsqBw7 r5ZTqTaYj4Kds5TE3TCNYmorpmOAPQEpsSky8fHgUly7ibxqgzMOIBvOKS24A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=AvT41B6zQJHObEeDWfDLxR3jE1A=; b=ki3p6H+3WbI+cKDiNw1t 8FnJ4inAqU7sc2z9tHd+1xgi7jHL5/iXW3xiVRDXlolQgVXz2RyCT06FIesgGhJe Kjh2OaZorGGUuA7uM7rlSfamZZGHxeA/ztwNVLIuE9ImHim6FRdzirX/+WOPlk+P 9CACHM5EQves6p9lt5rEBjM= Received: (qmail 52148 invoked by alias); 13 Feb 2019 07:15:27 -0000 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 Received: (qmail 42901 invoked by uid 89); 13 Feb 2019 07:15:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt1-f176.google.com Received: from mail-qt1-f176.google.com (HELO mail-qt1-f176.google.com) (209.85.160.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Feb 2019 07:15:18 +0000 Received: by mail-qt1-f176.google.com with SMTP id n32so1431678qte.11 for ; Tue, 12 Feb 2019 23:15:14 -0800 (PST) MIME-Version: 1.0 From: Iain Buclaw Date: Wed, 13 Feb 2019 08:15:00 +0100 Message-ID: Subject: [PATCH, libphobos] Committed fallback UnwindBacktrace if LibBacktrace unfound To: gcc-patches X-IsSubscribed: yes Hi, In the gcc.backtrace module, either one of LibBacktrace or UnwindBacktrace will always be defined. This patch gives UnwindBacktrace a higher precedence over the libc backtrace as the default backtrace handler as the latter depends on a rt.backtrace module that is not compiled in. Only useful if building --without-libbacktrace or libbacktrace is unsupported for whatever reason. Bootstrapped and regression tested on x86_64-linux-gnu. Committed to trunk as r268836. diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d index a78363cf477..0ead04752e4 100644 --- a/libphobos/libdruntime/core/runtime.d +++ b/libphobos/libdruntime/core/runtime.d @@ -619,6 +619,22 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null ) } return new LibBacktrace(FIRSTFRAME); } + else static if ( __traits( compiles, new UnwindBacktrace(0) ) ) + { + version (Posix) + { + static enum FIRSTFRAME = 5; + } + else version (Win64) + { + static enum FIRSTFRAME = 4; + } + else + { + static enum FIRSTFRAME = 0; + } + return new UnwindBacktrace(FIRSTFRAME); + } else static if ( __traits( compiles, backtrace ) ) { import core.demangle; @@ -885,22 +901,6 @@ Throwable.TraceInfo defaultTraceHandler( void* ptr = null ) auto s = new StackTrace(FIRSTFRAME, cast(CONTEXT*)ptr); return s; } - else static if ( __traits( compiles, new UnwindBacktrace(0) ) ) - { - version (Posix) - { - static enum FIRSTFRAME = 5; - } - else version (Win64) - { - static enum FIRSTFRAME = 4; - } - else - { - static enum FIRSTFRAME = 0; - } - return new UnwindBacktrace(FIRSTFRAME); - } else { return null;