aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
AgeCommit message (Collapse)Author
2022-05-25[release-branch.go1.17] runtime: skip TestGdbBacktrace flakes matching a ↵Bryan C. Mills
known GDB internal error TestGdbBacktrace occasionally fails due to a GDB internal error. We have observed the error on various linux builders since at least October 2020, and it has been reported upstream at least twice.¹² Since the bug is external to the Go project and does not appear to be fixed upstream, this failure mode can only add noise. ¹https://sourceware.org/bugzilla/show_bug.cgi?id=24628 ²https://sourceware.org/bugzilla/show_bug.cgi?id=28551 Fixes #53049 Updates #43068 Change-Id: I6c92006a5d730f1c4df54b0307f080b3d643cc6b Reviewed-on: https://go-review.googlesource.com/c/go/+/384234 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> (cherry picked from commit 275aedccd4f2beae82dbf96c94a6c1c9b365a647) Reviewed-on: https://go-review.googlesource.com/c/go/+/408054 Reviewed-by: Alex Rakoczy <alex@golang.org>
2021-04-08runtime: replace os.MkdirTemp with T.TempDirianwoolf
Updates #45402 Change-Id: I3aa82fc2486b4de49b45388bbab24f5ffe558f91 Reviewed-on: https://go-review.googlesource.com/c/go/+/307989 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-03runtime: repair gdb printing fix for 7.12, 8.{1,2,3}.1, 9.2David Chase
Hand-verified for listed gdb versions. Gdb (apparently) changed the way it names certain Go types, and this change broke the pretty-printer-activating code in runtime-gdb.py runtime-gdb_test.go now checks channel, map, string, and slice printing unconditionally (i.e., no opt-out for old versions). Updates #39368. Change-Id: I98d72e1291c66bd40d970990e1a377ff2ed0c5d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/236164 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-06-02runtime: repair slice, string, and channel printing in gdbDavid Chase
"Something" changed the names of types in gdb, causing the pretty-printer matchers to fail to match. This tracks that change. Updated runtime-gdb_test.go to include a slice and a channel printing test. (The straightforward printing of a slicevar doesn't work because of compiler DWARF problems describing the slicevar, not gdb problems). Change-Id: I21607a955b9c894f11ecf3763aea2a6dd59a3f42 Reviewed-on: https://go-review.googlesource.com/c/go/+/235926 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-05-29runtime: no SIGWINCH to pgrp while GDB is runningMichael Pratt
When run with stdin == /dev/null and stdout/stderr == pipe (i.e., as os/exec.Command.CombinedOutput), GDB suffers from a bug (https://sourceware.org/bugzilla/show_bug.cgi?id=26056) that causes SIGSEGV when sent a SIGWINCH signal. Package runtime tests TestEINTR and TestSignalDuringExec both send SIGWINCH signals to the entire process group, thus including GDB if one of the GDB tests is running in parallel. TestEINTR only intends its signals for the current process, so it is changed to do so. TestSignalDuringExec, really does want its signals to go to children. However, it does not call t.Parallel(), so it won't run at the same time as GDB tests. This is a simple fix, but GDB is vulnerable, so we must be careful not to add new parallel tests that send SIGWINCH to the entire process group. Fixes #39021 Change-Id: I803606fb000f08c65c1b10ec554d4ef6819e5dd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/235557 Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-05-27runtime: check gdb exit status and log outputMichael Pratt
All GDB tests currently ignore non-zero exit statuses. When tests flakes, we don't even know if GDB exited successfully or not. Add checks for non-zero exits, which are not expected. Furthermore, always log the output from GDB. The tests are currently inconsistent about whether they always log, or only on error. Updates #39021 Change-Id: I7af1d795fc2fdf58093cb2731d616d4aa44e9996 Reviewed-on: https://go-review.googlesource.com/c/go/+/235282 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-05-14runtime: remove flaky "goroutine 2 bt" from gdb testJosh Bleecher Snyder
This part of the test has been flaky despite repeated attempts to fix it, and it is unclear what exactly it is testing. Remove it. Fixes #24616. Change-Id: If7234f99dd3d3e92f15ccb94ee13e75c6da12537 Reviewed-on: https://go-review.googlesource.com/c/go/+/233942 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-04-21test/codegen, runtime/pprof, runtime: apply fmtalex-semenyuk
Change-Id: Ife4e065246729319c39e57a4fbd8e6f7b37724e1 GitHub-Last-Rev: e71803eaeb366c00f6c156de0b0b2c50927a0e82 GitHub-Pull-Request: golang/go#38527 Reviewed-on: https://go-review.googlesource.com/c/go/+/228901 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-09test: deflaking measures for runtime gdb testThan McIntosh
Tweak the runtime's GDB python test to try to reduce flake failures. Background: the intent of the testpoint in question is to make sure that python-supported commands like "info goroutines" or "goroutine 1 backtrace" work properly. The Go code being run under the debugger as part of the test is single-threaded, but the test is written assuming that in addition to the primary goroutine there will be other background goroutines available (owned by the runtime). The flakiness seems to crop up the most when requesting a backtrace for one of these background goroutines; the speculation is that if we catch a runtime-owned goroutine in an odd state, this could interfere with the test. The change in this patch is to explicitly start an additional goroutine from the main thread, so that when the debugger stops the main thread we can be sure that there is some other non-main goroutine in a known state. This change authored by Josh Bleecher Snyder <josharian@gmail.com>. Updates #24616. Change-Id: I45682323d5898e5187c0adada7c5d117e92f403b Reviewed-on: https://go-review.googlesource.com/c/go/+/226558 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-08runtime: fix infinite callstack of cgo on arm64Xiangdong Ji
This change adds CFA information to the assembly function 'crosscall1' and reorgnizes its code to establish well-formed prologue and epilogue. It will fix an infinite callstack issue when debugging cgo program with GDB on arm64. Brief root cause analysis: GDB's aarch64 unwinder parses prologue to determine current frame's size and previous PC&SP if CFA information is not available. The unwinder parses the prologue of 'crosscall1' to determine a frame size of 0x10, then turns to its next frame trying to compute its previous PC&SP as they are not saved on current frame's stack as per its 'traditional frame unwind' rules, which ends up getting an endless frame chain like: [callee] : pc:<pc0>, sp:<sp0> crosscall1: pc:<pc1>, sp:<sp0>+0x10 [caller] : pc:<pc1>, sp:<sp0>+0x10+0x10 [caller] : pc:<pc1>, sp:<sp0>+0x10+0x10+0x10 ... GDB fails to detect the 'caller' frame is same as 'crosscall1' and terminate unwinding since SP increases everytime. Fixes #37238 Change-Id: Ia6bd8555828541a3a61f7dc9b94dfa00775ec52a Reviewed-on: https://go-review.googlesource.com/c/go/+/226999 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-31runtime: skip gdb tests on Plan 9Richard Miller
There's no gdb on Plan 9. Change-Id: Ibeb0fbd3c096a69181c19b1fb2bc6291612b6da3 Reviewed-on: https://go-review.googlesource.com/c/go/+/226657 Reviewed-by: David du Colombier <0intro@gmail.com>
2019-11-20runtime: disable GDB tests on AIX with -shortClément Chigot
Since the new page allocator, AIX's GDB has trouble running Go programs. It does work but it can be really slow. Therefore, they are disable when tests are run with -short. Updates: #35710 Change-Id: Ibfc4bd2cd9714268f1fe172aaf32a73612e262d6 Reviewed-on: https://go-review.googlesource.com/c/go/+/207919 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-21runtime: temporarily skip gdb python-related tests on illumosJoshua M. Clulow
Updates golang/go#20821 Change-Id: I186356a78ac385a15b4604e0ea6110c4c212ebc4 Reviewed-on: https://go-review.googlesource.com/c/go/+/202357 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-29runtime: support all as parameter in gdb goroutine commands.Haosdent Huang
For example, can use `goroutine all bt` to dump all goroutines' information. Change-Id: I51b547c2b837913e4bdabf0f45b28f09250a3e34 GitHub-Last-Rev: d04dcd4f581f97e35ee45969a864f1270d79e49b GitHub-Pull-Request: golang/go#26283 Reviewed-on: https://go-review.googlesource.com/c/go/+/122589 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: David Chase <drchase@google.com>
2019-04-26runtime: test for cgo build tag in TestGdbPythonCgoIan Lance Taylor
Testing whether cgo is enabled in go/build is not the same as testing whether the go tool supports cgo. They differ, for example, when using GOARCH=386 on an amd64 system, as for a cross-build cgo is disabled by default. Change-Id: Ib59106c92a3131b73ac6a91c0f7658a1769acf73 Reviewed-on: https://go-review.googlesource.com/c/go/+/174098 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-19runtime: suppress thread event prints in gdb testCherry Zhang
Pass "set print thread-events off" to gdb to suppress thread event prints, like "[New Thread 0xe7b83b40 (LWP 18609)]". We don't check them, and the extra output may confuse our other checks, in particular, checkCleanBacktrace. Hopefully fixes #31569. Change-Id: I6549e1280da7afa1d2e38da2b2fa7cc18c2f0373 Reviewed-on: https://go-review.googlesource.com/c/go/+/172980 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-15cmd/link, runtime: mark goexit as the top of the call stackMichael Munday
This CL adds a new attribute, TOPFRAME, which can be used to mark functions that should be treated as being at the top of the call stack. The function `runtime.goexit` has been marked this way on architectures that use a link register. This will stop programs that use DWARF to unwind the call stack from unwinding past `runtime.goexit` on architectures that use a link register. For example, it eliminates "corrupt stack?" warnings when generating a backtrace that hits `runtime.goexit` in GDB on s390x. Similar code should be added for non-link-register architectures (i.e. amd64, 386). They mark the top of the call stack slightly differently to link register architectures so I haven't added that code (they need to mark "rip" as undefined). Fixes #24385. Change-Id: I15b4c69ac75b491daa0acf0d981cb80eb06488de Reviewed-on: https://go-review.googlesource.com/c/go/+/169726 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-03-06runtime: disable TestGdbAutotmpTypes in short mode on aix/ppc64Clément Chigot
TestGdbAutotmpTypes takes more than one minute due to gdb performances. Therefore, it must be skipped in short mode. Change-Id: I253ebce62264cc7367c9b0f6ce9c5088a9994641 Reviewed-on: https://go-review.googlesource.com/c/go/+/164339 Reviewed-by: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-19runtime: make tests that invoke 'go build' module-agnosticBryan C. Mills
In module mode, building the current directory requires a go.mod file (in order to determine the import path of the package). Change the tests to pass explicit file arguments instead, since those can be built in module mode without defining a module. Updates #30228 Change-Id: I680c658d1f79645f73ad4d1e88189ea50a4852e9 Reviewed-on: https://go-review.googlesource.com/c/162837 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-01-08runtime: disable GDB tests on freebsd on all GOARCH valuesYuval Pavel Zholkover
The in-tree GDB is too old (6.1.1) on all the builders except the FreeBSD 12.0 one, where it was removed from the base system. Update #29508 Change-Id: Ib6091cd86440ea005f3f903549a0223a96621a6f Reviewed-on: https://go-review.googlesource.com/c/156717 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-02runtime: disable GDB tests on freebsd/arm for nowBrad Fitzpatrick
Updates #29508 Updates #28679 Change-Id: I19bc9f88aeb2b1f3e69856173a00c5a4d5ed3613 Reviewed-on: https://go-review.googlesource.com/c/155932 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
2018-11-08cmd/compile: encourage inlining of functions with single-call bodiesKeith Randall
This is a simple tweak to allow a bit more mid-stack inlining. In cases like this: func f() { g() } We'd really like to inline f into its callers. It can't hurt. We implement this optimization by making calls a bit cheaper, enough to afford a single call in the function body, but not 2. The remaining budget allows for some argument modification, or perhaps a wrapping conditional: func f(x int) { g(x, 0) } func f(x int) { if x > 0 { g() } } Update #19348 Change-Id: Ifb1ea0dd1db216c3fd5c453c31c3355561fe406f Reviewed-on: https://go-review.googlesource.com/c/147361 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com>
2018-11-02all: skip unsupported tests on AIXClément Chigot
This commit skips tests which aren't yet supported on AIX. nosplit.go is disabled because stackGuardMultiplier is increased for syscalls. Change-Id: Ib5ff9a4539c7646bcb6caee159f105ff8a160ad7 Reviewed-on: https://go-review.googlesource.com/c/146939 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02runtime: only check the existence of variables in gdb info locals testMartin Möhrmann
As discussed in golang.org/cl/28499: Only test that all expected variables are listed in 'info locals' since different versions of gdb print variables in different order and with differing amount of information and formats. Fixes #28499 Change-Id: I76627351170b5fdf2bf8cbf143e54f628b45dc4e Reviewed-on: https://go-review.googlesource.com/c/146598 Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-10-29cmd/compile: move slice construction to callers of makesliceMartin Möhrmann
Only return a pointer p to the new slices backing array from makeslice. Makeslice callers then construct sliceheader{p, len, cap} explictly instead of makeslice returning the slice. Reduces go binary size by ~0.2%. Removes 92 (~3.5%) panicindex calls from go binary. Change-Id: I29b7c3b5fe8b9dcec96e2c43730575071cfe8a94 Reviewed-on: https://go-review.googlesource.com/c/141822 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2018-10-01runtime: fix runtime gdb test with gdb v8.2Shulhan
Previously, some of output from gdb matched with literal string, while gdb v8.2 print the address of variable (e.g. map key and value) in output. This commit fix the regex in testing the output. Fixes #27608 Change-Id: Ic3fe8280b9f93fda2799116804822616caa66beb Reviewed-on: https://go-review.googlesource.com/135055 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2018-09-26all: use strings.ReplaceAll and bytes.ReplaceAll where applicableBrad Fitzpatrick
I omitted vendor directories and anything necessary for bootstrapping. (Tested by bootstrapping with Go 1.4) Updates #27864 Change-Id: I7d9b68d0372d3a34dee22966cca323513ece7e8a Reviewed-on: https://go-review.googlesource.com/137856 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-26runtime: rename _MSpan* constants to mSpan*Austin Clements
We already aliased mSpanInUse to _MSpanInUse. The dual constants are getting annoying, so fix all of these to use the mSpan* naming convention. This was done automatically with: sed -i -re 's/_?MSpan(Dead|InUse|Manual|Free)/mSpan\1/g' *.go plus deleting the existing definition of mSpanInUse. Change-Id: I09979d9d491d06c10689cea625dc57faa9cc6767 Reviewed-on: https://go-review.googlesource.com/137875 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-08-09runtime: fix TestGdbPythonCgo failure with ld.goldDaniel Martí
See the added comment for the reasoning behind the workaround. Fixes #26868. Change-Id: Idede020ec88a49595dc233d9a1346b12691186f4 Reviewed-on: https://go-review.googlesource.com/128815 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-18runtime: skip gdb tests on mips after DWARF compressionHeschi Kreinick
DWARF compression appears to break GDB on mips for reasons unknown. Skip the GDB tests there. Fixes #25939. Change-Id: Id76860d3a2ff8055999ac12ea891c37565bb6685 Reviewed-on: https://go-review.googlesource.com/119539 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2018-06-06cmd/compile: fix panic-okay-to-inline change; adjust testsDavid Chase
This line of the inlining tuning experiment https://go-review.googlesource.com/c/go/+/109918/1/src/cmd/compile/internal/gc/inl.go#347 was incorrectly rewritten in a later patch to use the call cost, not the panic cost, and thus the inlining of panic didn't occur when it should. I discovered this when I realized that tests should have failed, but didn't. Fix is to make the correct change, and also to modify the tests that this causes to fail. One test now asserts the new normal, the other calls "ppanic" instead which is designed to behave like panic but not be inlined. Change-Id: I423bb7f08bd66a70d999826dd9b87027abf34cdf Reviewed-on: https://go-review.googlesource.com/116656 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2018-05-11runtime: skip GDB tests on WindowsBryan C. Mills
Updates #22687. Change-Id: Iedccd9d2416ae7150cd2febe81c8bc9493d8d65c Reviewed-on: https://go-review.googlesource.com/112915 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-30runtime: perform crashes outside systemstackElias Naur
CL 93658 moved stack trace printing inside a systemstack call to sidestep complexity in case the runtime is in a inconsistent state. Unfortunately, debuggers generating backtraces for a Go panic will be confused and come up with a technical correct but useless stack. This CL moves just the crash performing - typically a SIGABRT signal - outside the systemstack call to improve backtraces. Unfortunately, the crash function now needs to be marked nosplit and that triggers the no split stackoverflow check. To work around that, split fatalpanic in two: fatalthrow for runtime.throw and fatalpanic for runtime.gopanic. Only Go panics really needs crashes on the right stack and there is enough stack for gopanic. Example program: package main import "runtime/debug" func main() { debug.SetTraceback("crash") crash() } func crash() { panic("panic!") } Before: (lldb) bt * thread #1, name = 'simple', stop reason = signal SIGABRT * frame #0: 0x000000000044ffe4 simple`runtime.raise at <autogenerated>:1 frame #1: 0x0000000000438cfb simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424 frame #2: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525 frame #3: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758 frame #4: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657 frame #5: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1 frame #6: 0x000000000042a980 simple at proc.go:1094 frame #7: 0x0000000000438ec9 simple`runtime.crash at signal_unix.go:525 frame #8: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758 frame #9: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657 frame #10: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1 frame #11: 0x000000000042a980 simple at proc.go:1094 frame #12: 0x00000000004268f5 simple`runtime.dopanic_m(gp=<unavailable>, pc=<unavailable>, sp=<unavailable>) at panic.go:758 frame #13: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657 frame #14: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1 frame #15: 0x000000000042a980 simple at proc.go:1094 frame #16: 0x000000000044bead simple`runtime.fatalpanic.func1 at panic.go:657 frame #17: 0x000000000044d066 simple`runtime.systemstack at <autogenerated>:1 After: (lldb) bt * thread #7, stop reason = signal SIGABRT * frame #0: 0x0000000000450024 simple`runtime.raise at <autogenerated>:1 frame #1: 0x0000000000438d1b simple`runtime.dieFromSignal(sig=<unavailable>) at signal_unix.go:424 frame #2: 0x0000000000438ee9 simple`runtime.crash at signal_unix.go:525 frame #3: 0x00000000004264e3 simple`runtime.fatalpanic(msgs=<unavailable>) at panic.go:664 frame #4: 0x0000000000425f1b simple`runtime.gopanic(e=<unavailable>) at panic.go:537 frame #5: 0x0000000000470c62 simple`main.crash at simple.go:11 frame #6: 0x0000000000470c00 simple`main.main at simple.go:6 frame #7: 0x0000000000427be7 simple`runtime.main at proc.go:198 frame #8: 0x000000000044ef91 simple`runtime.goexit at <autogenerated>:1 Updates #22716 Change-Id: Ib5fa35c13662c1dac2f1eac8b59c4a5824b98d92 Reviewed-on: https://go-review.googlesource.com/110065 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2018-04-07runtime: improve Windows gdb testsEgon Elbre
This ensures that gdb tests run on Windows by ignoring any line ending. Works with gdb 7.7, however with gdb 7.9 and 7.12 gets an error error: internal-error: buildsym_init: Assertion `free_pendings == NULL' failed. Updates #21380 Change-Id: I6a6e5b2a1b5efdca4dfce009fcb9c134c87497d6 Reviewed-on: https://go-review.googlesource.com/102419 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2018-03-15cmd/compile: turn on DWARF locations lists for ssa varsDavid Chase
This changes the default setting for -dwarflocationlists from false to true, removes the flag from ssa/debug_test.go, and updates runtime/runtime-gdb_test.go to match a change in debugging output for composite variables. Current benchmarks (perflock, -count 10) benchstat -geomean before.log after.log name old time/op new time/op delta Template 175ms ± 0% 182ms ± 1% +3.68% (p=0.000 n=8+9) Unicode 82.0ms ± 2% 82.8ms ± 1% +0.96% (p=0.019 n=9+9) GoTypes 590ms ± 1% 611ms ± 1% +3.42% (p=0.000 n=9+10) Compiler 2.85s ± 0% 2.95s ± 1% +3.60% (p=0.000 n=9+10) SSA 6.42s ± 1% 6.70s ± 1% +4.31% (p=0.000 n=10+9) Flate 113ms ± 2% 117ms ± 1% +3.11% (p=0.000 n=10+9) GoParser 140ms ± 1% 145ms ± 1% +3.47% (p=0.000 n=10+9) Reflect 384ms ± 0% 398ms ± 1% +3.56% (p=0.000 n=8+9) Tar 165ms ± 1% 171ms ± 1% +3.33% (p=0.000 n=9+9) XML 207ms ± 2% 214ms ± 1% +3.41% (p=0.000 n=9+9) StdCmd 11.8s ± 2% 12.4s ± 2% +4.41% (p=0.000 n=10+9) [Geo mean] 489ms 506ms +3.38% name old user-ns/op new user-ns/op delta Template 247M ± 4% 254M ± 4% +2.76% (p=0.040 n=10+10) Unicode 118M ±16% 121M ±11% ~ (p=0.364 n=10+10) GoTypes 805M ± 2% 824M ± 2% +2.37% (p=0.003 n=9+8) Compiler 3.92G ± 2% 4.01G ± 2% +2.20% (p=0.001 n=9+9) SSA 9.63G ± 4% 10.00G ± 2% +3.81% (p=0.000 n=10+9) Flate 155M ±10% 154M ± 7% ~ (p=0.718 n=9+10) GoParser 184M ±11% 190M ± 7% ~ (p=0.220 n=10+9) Reflect 506M ± 4% 528M ± 2% +4.27% (p=0.000 n=10+10) Tar 224M ± 4% 227M ± 5% ~ (p=0.207 n=10+9) XML 272M ± 7% 286M ± 4% +5.23% (p=0.010 n=10+9) [Geo mean] 489M 502M +2.76% name old text-bytes new text-bytes delta HelloSize 672k ± 0% 672k ± 0% ~ (all equal) CmdGoSize 7.21M ± 0% 7.21M ± 0% ~ (all equal) [Geo mean] 2.20M 2.20M +0.00% name old data-bytes new data-bytes delta HelloSize 9.88k ± 0% 9.88k ± 0% ~ (all equal) CmdGoSize 248k ± 0% 248k ± 0% ~ (all equal) [Geo mean] 49.5k 49.5k +0.00% name old bss-bytes new bss-bytes delta HelloSize 125k ± 0% 125k ± 0% ~ (all equal) CmdGoSize 144k ± 0% 144k ± 0% ~ (all equal) [Geo mean] 135k 135k +0.00% name old exe-bytes new exe-bytes delta HelloSize 1.10M ± 0% 1.30M ± 0% +17.82% (p=0.000 n=10+10) CmdGoSize 11.6M ± 0% 13.5M ± 0% +16.90% (p=0.000 n=10+10) [Geo mean] 3.57M 4.19M +17.36% Change-Id: I250055813cadd25cebee8da1f9a7f995a6eae432 Reviewed-on: https://go-review.googlesource.com/100738 Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-02-13runtime/gdb: use goroutine atomicstatus to determine the stateHana Kim
Previously find_goroutine determined whether a goroutine is stopped by checking the sched.sp field. This heuristic doesn't always hold but causes find_goroutine to return bogus pc/sp info for running goroutines. This change uses the atomicstatus bit to determine the state which is more accurate. R=go1.11 Change-Id: I537d432d9e0363257120a196ce2ba52da2970f59 Reviewed-on: https://go-review.googlesource.com/49691 Reviewed-by: Austin Clements <austin@google.com>
2017-12-01runtime: skip gdb tests earlier before blocking goroutines in a t.ParallelBrad Fitzpatrick
Minor. Makes reading failing runtime test stacktraces easier (by having fewer goroutines to read) on machines where these gdb tests wouldn't have ever run anyway. Change-Id: I3fab0667e017f20ef3bf96a8cc4cfcc614d25b5c Reviewed-on: https://go-review.googlesource.com/81575 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-30runtime: more specific reason for skipping GDB tests on NetBSDAustin Clements
Updates #22893. Change-Id: I2cf5efb4fa6b77aaf82de5d8877c99f9aa5d519a Reviewed-on: https://go-review.googlesource.com/81195 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-30compiler,linker: support for DWARF inlined instancesThan McIntosh
Compiler and linker changes to support DWARF inlined instances, see https://go.googlesource.com/proposal/+/HEAD/design/22080-dwarf-inlining.md for design details. This functionality is gated via the cmd/compile option -gendwarfinl=N, where N={0,1,2}, where a value of 0 disables dwarf inline generation, a value of 1 turns on dwarf generation without tracking of formal/local vars from inlined routines, and a value of 2 enables inlines with variable tracking. Updates #22080 Change-Id: I69309b3b815d9fed04aebddc0b8d33d0dbbfad6e Reviewed-on: https://go-review.googlesource.com/75550 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2017-11-28runtime: skip GDB tests on NetBSDIan Lance Taylor
TestGdbAutotmpTypes times out for unknown reasons on NetBSd. Skip the gdb tests on NetBSD for now. Updates #22893 Change-Id: Ibb05b7260eabb74d805d374b25a43770939fa5f2 Reviewed-on: https://go-review.googlesource.com/80136 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-09cmd/go: implement per-package asmflags, gcflags, ldflags, gccgoflagsRuss Cox
It has always been problematic that there was no way to specify tool flags that applied only to the build of certain packages; it was only to specify flags for all packages being built. The usual workaround was to install all dependencies of something, then build just that one thing with different flags. Since the dependencies appeared to be up-to-date, they were not rebuilt with the different flags. The new content-based staleness (up-to-date) checks see through this trick, because they detect changes in flags. This forces us to address the underlying problem of providing a way to specify per-package flags. The solution is to allow -gcflags=pattern=flags, which means that flags apply to packages matching pattern, in addition to the usual -gcflags=flags, which is now redefined to apply only to the packages named on the command line. See #22527 for discussion and rationale. Fixes #22527. Change-Id: I6716bed69edc324767f707b5bbf3aaa90e8e7302 Reviewed-on: https://go-review.googlesource.com/76551 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-02cmd/compile: specialize map creation for small hint sizesMartin Möhrmann
Handle make(map[any]any) and make(map[any]any, hint) where hint <= BUCKETSIZE special to allow for faster map initialization and to improve binary size by using runtime calls with fewer arguments. Given hint is smaller or equal to BUCKETSIZE in which case overLoadFactor(hint, 0) is false and no buckets would be allocated by makemap: * If hmap needs to be allocated on the stack then only hmap's hash0 field needs to be initialized and no call to makemap is needed. * If hmap needs to be allocated on the heap then a new special makehmap function will allocate hmap and intialize hmap's hash0 field. Reduces size of the godoc by ~36kb. AMD64 name old time/op new time/op delta NewEmptyMap 16.6ns ± 2% 5.5ns ± 2% -66.72% (p=0.000 n=10+10) NewSmallMap 64.8ns ± 1% 56.5ns ± 1% -12.75% (p=0.000 n=9+10) Updates #6853 Change-Id: I624e90da6775afaa061178e95db8aca674f44e9b Reviewed-on: https://go-review.googlesource.com/61190 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2017-10-09cmd/compile: add ideal int constants to dwarfKeith Randall
The core dump reader would like a bunch of ideal int constants to be available in dwarf. Makes the go binary 0.9% bigger. Update #14517 Change-Id: I00cdfc7f53bcdc56fccba576c1d33010f03bdd95 Reviewed-on: https://go-review.googlesource.com/69270 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-09-25runtime: fix TestGdbConst on windowsAlessandro Arzilli
Some (all?) versions of gdb on windows output "\r\n" as line ending instead of "\n". Fixes #22012 Change-Id: I798204fd9f616d6d2c9c28eb5227fadfc63c0d45 Reviewed-on: https://go-review.googlesource.com/65850 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-22cmd/compile,cmd/link: export int global consts to DWARFAlessandro Arzilli
Updates #14517 Change-Id: I23ef88e71c89da12dffcadf5562ea2d7557b62cf Reviewed-on: https://go-review.googlesource.com/61019 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-13cmd/compile: add TestIntendedInlining from runtimeDaniel Martí
Move it from the runtime package, as we will soon add more packages and functions for it to check. The test used the testEnv func, which cleaned certain environment variables from a command, so it was moved to internal/testenv under a more descriptive (and less ambiguous) name. Add a simple godoc to it too. For #21851. Change-Id: I6f39c1f23b45377718355fafe66ffd87047d8ab6 Reviewed-on: https://go-review.googlesource.com/63550 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-08-24cmd/compile: eliminate stores to unread auto variablesMichael Munday
This is a crude compiler pass to eliminate stores to auto variables that are only ever written to. Eliminates an unnecessary store to x from the following code: func f() int { var x := 1 return *(&x) } Fixes #19765. Change-Id: If2c63a8ae67b8c590b6e0cc98a9610939a3eeffa Reviewed-on: https://go-review.googlesource.com/38746 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2017-06-28runtime: temporarily skip gdb python-related tests on solarisShawn Walker-Salas
Updates #20821 Change-Id: I77a5b9a3bbb931845ef52a479549d71069af9540 Reviewed-on: https://go-review.googlesource.com/46913 Run-TryBot: Shawn Walker-Salas <shawn.walker@oracle.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-15runtime: enable GDB tests on mips64 (except TestGdbPythonCgo)Vladimir Stefanovic
They were failing when run on 32bit RFS, with 32bit gdb. (mips64 builder now has 64bit RFS, with gdb 7.9.) Leaving TestGdbPythonCgo disabled, it behaves as described in #18784. Fixes #18173 Change-Id: I3c438cd5850b7bfd118ac6396f40c1208bac8c2d Reviewed-on: https://go-review.googlesource.com/45874 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>