From patchwork Wed Oct 9 00:18:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 281689 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 303002C008C for ; Wed, 9 Oct 2013 11:19:10 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=PejkUF2bRpQSyq6Rr2S6f0K/9OI7xrkSLmaJtY+IaM9E2YPdv/WXA oxzq0ClOsn+V+QmAk0BMrUmqfdPKGY+r5mrxscL8mpWO1ZwyqkzQGC5nNknBIisn yuT4SzsyDO+R5A6RfRbgI0qu4gd7UfEyzTvOcIaNHPLfARiIy2EFB0= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=uGV/LGiZjieYolHqvoWxvaErWlA=; b=I4Oym7iV/VVeb8CDBctW FFOj5y58EWvIOj+06ZWn2Ggu5NXp8zC0CIDhlPTb93sxk9ETfrK8d1n0fKW6D1tp oMsYdG+vC3m86ODMMeaPi1IGpV/SnSBqMQ4IMPLAqEyRxYbhydYFo++TK5d9Cw0J 6zmtII72Di8fEQjwns0ePr8= Received: (qmail 17630 invoked by alias); 9 Oct 2013 00:19:03 -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 17615 invoked by uid 89); 9 Oct 2013 00:19:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f44.google.com Received: from mail-pb0-f44.google.com (HELO mail-pb0-f44.google.com) (209.85.160.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 09 Oct 2013 00:19:02 +0000 Received: by mail-pb0-f44.google.com with SMTP id xa7so66249pbc.31 for ; Tue, 08 Oct 2013 17:19:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-type; bh=VzSfIkF9xX1P5YqeYhK8aU40l/UkzzMUuLAzYFmR1Qo=; b=KiqMLgP90eNK2MHRA0FTIa2VNYg4arc6LLQp4MTyAv3dXad540dx65mw10BOwcLtMK eN2o7JO/w4NEeilD/u5G2+lWJ4kcC11japZu6/fj5l5nhw1KXKE6nsf7vEPep7LWSdPh BFvddYcOGkF/7pzAjEKCzi7W4XYfT14UAEXt8MUor6VKgY5ZDzOQuMpS/dVKJKpb4d7b yAllB5d3FoffFDZ2gbgk0onCYpqqgIz9bytLB6Qo+mUM4u6o6EoAQQ25JX0ekdn3AcjF HdVNZFrOY0bwk52N0PSuJy113OtlVpe6fQC/xUj7J3pG0+kR2lO1B0xamOxKc2k379Uj vZYA== X-Gm-Message-State: ALoCoQmQXIgYg3bQL8PktQeurzRoGXM0XukWLNfbdl6Vsl3M/4YlugqH3alz9xf1/zoiWIr444Nu/fs2Ff3wdpsQdWdPSKtDLGCOijNGkMVnM2WvWJUQJTaT4G/h39Gl0ZpmS7LyV9TQEMOIo+oXYnXIkunEw1Xp2mtdB30MCD/ExKfZjwsi0Dty3smT6fRdryFfMCr31TgsRz0rTLW2+rHORe1Yg3am4A== X-Received: by 10.66.218.98 with SMTP id pf2mr6478810pac.120.1381277939995; Tue, 08 Oct 2013 17:18:59 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([207.198.105.20]) by mx.google.com with ESMTPSA id os4sm42686703pbb.25.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Oct 2013 17:18:59 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Do not report thunks/recover in backtrace Date: Tue, 08 Oct 2013 17:18:57 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes This patch to libgo avoids returning thunk or recover functions in a backtrace or when calling runtime.Caller or friends. This is to give a stack backtrace more like that generated by the gc compiler. In particular, it is so that runtime.Caller(n) will return stack trace that more closely corresponds to that returned by the gc toolchain. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.8 branch. Ian diff -r 17075de125b7 libgo/runtime/go-callers.c --- a/libgo/runtime/go-callers.c Tue Oct 08 16:51:52 2013 -0700 +++ b/libgo/runtime/go-callers.c Tue Oct 08 16:54:42 2013 -0700 @@ -53,6 +53,21 @@ return 0; } + /* Skip thunks and recover functions. There is no equivalent to + these functions in the gc toolchain, so returning them here means + significantly different results for runtime.Caller(N). */ + if (function != NULL) + { + const char *p; + + p = __builtin_strchr (function, '.'); + if (p != NULL && __builtin_strncmp (p + 1, "$thunk", 6) == 0) + return 0; + p = __builtin_strrchr (function, '$'); + if (p != NULL && __builtin_strcmp(p, "$recover") == 0) + return 0; + } + if (arg->skip > 0) { --arg->skip;