From patchwork Fri Jun 13 13:56:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 359551 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A83E4140078 for ; Fri, 13 Jun 2014 23:56:29 +1000 (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=xCLtNUloyZZO+8aZTEHatjhkAFAWyC6rW3uR9LDD7qTwlJxAOlDz/ uX/zUEheOrpS+IB6dUp1116OSfHJ1T9tl3HEzUDD/egpcric79v1JzFwLMuP8Cvp OdaDYLSM1OEPak5N9lmtZuaL8Qd+1LUIUq7zzA3Fz+tUztQyHOMivg= 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=fu9kAlPnx79nNbyeHch5hBAnzZY=; b=N6HJLZiSsl9NekwUhOS4 JiaFG1ETYf94R+5Dr9UwBxm+hm7Zu+h1GLPKtUFMRQuZVhNxSuX2YWlwrLsH6gqs oy4vi1gN/kRUhCkcS0HhxCeCamKD8QCLwrDzyL1m7pBsATNjaINcchmPAo3oOfpK On0cq2YbjPT5iFLijYNvz9k= Received: (qmail 6509 invoked by alias); 13 Jun 2014 13:56:23 -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 6499 invoked by uid 89); 13 Jun 2014 13:56:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f170.google.com Received: from mail-pd0-f170.google.com (HELO mail-pd0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 13 Jun 2014 13:56:21 +0000 Received: by mail-pd0-f170.google.com with SMTP id z10so695721pdj.15 for ; Fri, 13 Jun 2014 06:56:19 -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=R5YTWe8Lx1PUpCIflADUveXdZXIc+HGUJp4dTLfZvTw=; b=Ho0gY15JS+6ga7Q9OqO878yXbMhoRugL9BjUsY+rICUrv2eGBlv0N3+3FAE1pgCP9u 3WFsFKClrj6Q6zwMhxfiBQy+5sySCMftAr/K/70CVT2IlIBmvVFYft8SU5GxF0zXi5SJ uFjV472W+tDeYiTGM9BIzIKMeBGBfsw3GrjcTbc33ETELrv+gDupmPD2Lq9tHtwbizik JJ9JIAGMl464LjcafNcCsusj8vgNbM55iNhcZ+enQWEcTS2dm0qf8h8tLJtVluiFe2QW /0VfPL8ZOIC1Su+9XrPLENNWaAa1ZucOMvku5fHgMlZamR+05pF6LjPCQ5rzs4BHBV/t VWjQ== X-Gm-Message-State: ALoCoQldrGqddw4DWV1Ab+xrSnnTkYCYlOIg3Hg3l+yakWhpQjrPbkZYqZVZSuO+TGL7NF/1qZxU X-Received: by 10.68.130.38 with SMTP id ob6mr3389443pbb.141.1402667779752; Fri, 13 Jun 2014 06:56:19 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([207.198.105.20]) by mx.google.com with ESMTPSA id zb2sm3815697pbb.45.2014.06.13.06.56.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Jun 2014 06:56:19 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Stop backtrace at recognized functions Date: Fri, 13 Jun 2014 06:56:16 -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 stop a backtrace at a few recognized functions. On x86_64 Solaris the makecontext function does not properly indicate that it is at the top of the stack. Attempting to unwind the stack past a call to makecontext tends to crash. This patch changes libgo to look for certain functions that are always found at the top of the stack, and to stop unwinding when it reaches one of those functions. There is never anything interesting past these functions--that is, there is never any code written by the user. This is PR go/52583. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Ran a couple of tests on x86_64-sun-solaris2.11. Committed to mainline. Ian diff -r 20ec6ca8d43f libgo/runtime/go-callers.c --- a/libgo/runtime/go-callers.c Fri Jun 13 06:48:36 2014 -0700 +++ b/libgo/runtime/go-callers.c Fri Jun 13 06:50:22 2014 -0700 @@ -93,6 +93,32 @@ loc->lineno = lineno; ++arg->index; + + /* There is no point to tracing past certain runtime functions. + Stopping the backtrace here can avoid problems on systems that + don't provide proper unwind information for makecontext, such as + Solaris (http://gcc.gnu.org/PR52583 comment #21). */ + if (function != NULL) + { + if (__builtin_strcmp (function, "makecontext") == 0) + return 1; + if (filename != NULL) + { + const char *p; + + p = strrchr (filename, '/'); + if (p == NULL) + p = filename; + if (__builtin_strcmp (p, "/proc.c") == 0) + { + if (__builtin_strcmp (function, "kickoff") == 0 + || __builtin_strcmp (function, "runtime_mstart") == 0 + || __builtin_strcmp (function, "runtime_main") == 0) + return 1; + } + } + } + return arg->index >= arg->max; }