From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52466 invoked by alias); 4 Aug 2017 10:54:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 51959 invoked by uid 89); 4 Aug 2017 10:54:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=1280 X-HELO: mail-ua0-f179.google.com Received: from mail-ua0-f179.google.com (HELO mail-ua0-f179.google.com) (209.85.217.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Aug 2017 10:54:33 +0000 Received: by mail-ua0-f179.google.com with SMTP id f9so5484569uaf.4 for ; Fri, 04 Aug 2017 03:54:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/N5reYF6ixV3tt/ueLfg2kekS7E/y9xnYsx0SplmaSE=; b=TjeVqgzAzsehceZEwDlMV4nSn/pJ8pDxEC5WaHlYUZTFQwFtjkFPl82LhLqpBlMhHv ctI7tCgzFPjTeVl2M6oU/aauNlnMVSFfmR0bGoQmcG+JZFy3K19Tg4cC2YM6xYSPYdbI uCO9dmW4Go8/mrPHKn1cjk0ETZ5zFXC95j/lzSDtcBe/Yw+mx4txlN1QGCkRofIlAOw5 fK57pndP8i3blYrlq8R2LtwT0LGf7hVndUBcnVaSUO8P7sxI4U79Ira+6We4/noajYuH Y60n2bixwYJXM4LSNrhXO+ett/v2yTw7EFc/xsNIE0aMXPRkPBwCNUpzW7qn9m+gemvJ kRgw== X-Gm-Message-State: AHYfb5hmlkMe7pK3q5h++3Msc8BIASssQ/B390gJi0cAfj/jQ1FGm8tU pRmquc/bXz4jjbnHpmOhzZtRffn8pQ== X-Received: by 10.176.24.97 with SMTP id j33mr1133378uag.125.1501844071324; Fri, 04 Aug 2017 03:54:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.68.218 with HTTP; Fri, 4 Aug 2017 03:54:30 -0700 (PDT) In-Reply-To: References: From: Uros Bizjak Date: Fri, 04 Aug 2017 10:54:00 -0000 Message-ID: Subject: Re: gotools patch committed: Test runtime, misc/cgo/{test,testcarchive} To: Ian Lance Taylor Cc: "gcc-patches@gcc.gnu.org" , "gofrontend-dev@googlegroups.com" Content-Type: multipart/mixed; boundary="f403043c4260613ce90555eb5268" X-SW-Source: 2017-08/txt/msg00368.txt.bz2 --f403043c4260613ce90555eb5268 Content-Type: text/plain; charset="UTF-8" Content-length: 3733 On Wed, Jul 26, 2017 at 10:26 PM, Ian Lance Taylor wrote: > On Sat, Jul 22, 2017 at 11:08 AM, Uros Bizjak wrote: >>> This patch to the gotools Makefile adds tests to `make check`. We now >>> test the runtime package using the newly built go tool, and test that >>> cgo works by running the misc/cgo/test and misc/cgo/testcarchive >>> tests. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. >>> Committed to mainline. >> >> There is now only one remaining gotools testsuite failure on alpha: >> >> FAIL: TestBreakpoint >> crash_test.go:106: testprog Breakpoint exit status: exit status 2 >> crash_test.go:310: output: >> SIGTRAP: trace trap >> PC=2199039253124 m=0 sigcode=0 >> >> goroutine 1 [running]: >> >> goroutine 3 [runnable]: >> created by runtime.SetFinalizer >> >> /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/mfinal.go:355 >> +1280 >> >> >> >> want output containing: runtime.Breakpoint >> >> I would like to debug this one failure only. Is there a way to run >> only one gotools test? Can you perhaps give a hint where to look in >> the source? > > The test is TestBreakpoint in libgo/go/runtime/crash_test.go. It is > testing that if it runs a program that calls `runtime.Breakpoint`, > then `runtime.Breakpoint` will appear in the stack trace that the > program emits. > > It does this by building a test program. The easy way to do this > yourself is to run `make install` in your GCC build directory, set > LD_LIBRARY_PATH if needed to include the newly installed libgo.so, and > then do > > cd SRCDIR/libgo/go/runtime/testdata/testprog > go build # run the `go` program installed from gotools, building > ./testprog; you can use `go build -o /tmp/x` if you like > ./testprog Breakpoint > > On my x86_64 system that prints the appended, which includes the > desired `runtime.Breakpoint` string. On your system it fails to print > a stack trace, but I don't know why. The problem was following: runtime.Breakpoint comprises only call to __builtin_trap (), which in case of alpha maps to "call_pall 0x81". Since __builtin_trap () is a noreturn function, no other instructions are emitted after call_pal. However, when call_pal insn is executed, alpha updates program counter before the signal is raised. As call_pal was the last insn, updated PC points outside of the function boundaries, and backtrace (and gdb, FWIW) failed to found enclosing function. The solution is to emit nop after call_pal insn, so PC will always remain between function boundaries. Attached patch implements dumpregs function for alpha. Bootstrapped and regression tested on alphaev68-linux-gnu, and also checked that gdb and dumpregs produce the same register layout and values. Using both pathces, I get: $ ./testprog Breakpoint SIGTRAP: trace trap PC=2199039251764 m=0 sigcode=0 goroutine 1 [running]: runtime.Breakpoint /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/proc.go:2862 main.Breakpoint /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/testdata/testprog/deadlock.go:145 main.main /space/homedirs/uros/gcc-svn/trunk/libgo/go/runtime/testdata/testprog/main.go:34 v0 0x20000f41530 t0 0x120023f30 t1 0x200000ca328 t2 0x20000038000 t3 0x200002e7766 t4 0x40 t5 0x4 t6 0x1f t7 0x3f s0 0x20001f49fb9 s1 0x10 s2 0xc420004960 s3 0x0 s4 0x200017da6a8 s5 0x0 fp 0x20001f49df0 a0 0x11fffd4f4 a1 0x12000dd6c a2 0x11fffd4fe a3 0x1 a4 0x17 a5 0x3 t8 0x2000002e030 t9 0x1 t10 0x0 t11 0x20001f49b20 ra 0x120006a3c t12 0x20000f41530 at 0x6974f985 gp 0x2000003e030 sp 0x20001f49df0 pc 0x20000f41534 Uros. --f403043c4260613ce90555eb5268 Content-Type: text/plain; charset="US-ASCII"; name="g.diff.txt" Content-Disposition: attachment; filename="g.diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_j5xr64f00 Content-length: 2562 SW5kZXg6IHJ1bnRpbWUvZ28tc2lnbmFsLmMKPT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PQotLS0gcnVudGltZS9nby1zaWduYWwuYwkocmV2aXNpb24gMjUwODUz KQorKysgcnVudGltZS9nby1zaWduYWwuYwkod29ya2luZyBjb3B5KQpAQCAt Mjk4LDQgKzI5OCw0NSBAQCBkdW1wcmVncyhzaWdpbmZvX3QgKmluZm8gX19h dHRyaWJ1dGVfXygodW51c2VkKSksCiAJICB9CiAgI2VuZGlmCiAjZW5kaWYK KworI2lmZGVmIF9fYWxwaGFfXworICAjaWZkZWYgX19saW51eF9fCisJewor CQltY29udGV4dF90ICptID0gJigodWNvbnRleHRfdCopKGNvbnRleHQpKS0+ dWNfbWNvbnRleHQ7CisKKwkJcnVudGltZV9wcmludGYoInYwICAlWFxuIiwg bS0+c2NfcmVnc1swXSk7CisJCXJ1bnRpbWVfcHJpbnRmKCJ0MCAgJVhcbiIs IG0tPnNjX3JlZ3NbMV0pOworCQlydW50aW1lX3ByaW50ZigidDEgICVYXG4i LCBtLT5zY19yZWdzWzJdKTsKKwkJcnVudGltZV9wcmludGYoInQyICAlWFxu IiwgbS0+c2NfcmVnc1szXSk7CisJCXJ1bnRpbWVfcHJpbnRmKCJ0MyAgJVhc biIsIG0tPnNjX3JlZ3NbNF0pOworCQlydW50aW1lX3ByaW50ZigidDQgICVY XG4iLCBtLT5zY19yZWdzWzVdKTsKKwkJcnVudGltZV9wcmludGYoInQ1ICAl WFxuIiwgbS0+c2NfcmVnc1s2XSk7CisJCXJ1bnRpbWVfcHJpbnRmKCJ0NiAg JVhcb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