aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb.py
AgeCommit message (Collapse)Author
2020-06-03runtime: make runtime-gdb.py tolerant of creatively-named gdb versionsDavid Chase
"Fedora" and "Red Hat" are not numbers, it turns out. Don't rely on version numbers, instead use a regexp to handle variation across the 2 patterns thus far observed for gdb-generated Go type names. Change-Id: I18c81aa2848265a47daf1180d8f6678566ae3f19 Reviewed-on: https://go-review.googlesource.com/c/go/+/236280 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@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>
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-15runtime: fix GDB tests on s390x running Ubuntu 18.04Michael Munday
On Ubuntu 18.04 I am seeing GDB fail to restore the stack pointer during this test because stack unwinding can't find the PC. This CL is essentially a partial revert of CL 23940 and fixes the issue on s390x. Change-Id: Ib4c41162dc85dc882eb6e248330f4082c3fa94c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/169857 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-01-02runtime: fix string formattingDaniel Ingram
Change-Id: I87d0bc78a246e479d97b3f83cf77c1f701975413 GitHub-Last-Rev: 22cd684e08464f0e01f1cba2235443371dba3a5d GitHub-Pull-Request: golang/go#29157 Reviewed-on: https://go-review.googlesource.com/c/153298 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Austin Clements <austin@google.com>
2018-12-07runtime: fix runtime-gdb.py when switching sp valueLynn Boger
After a recent change to runtime-gdb_test.go the ppc64le builder has had intermittent failures. The failures occur when trying to invoke the goroutineCmd function to display the backtrace for a selected goroutine. There is nothing wrong with the testcase but it seems to intermittently leave goroutines in a state where an error can occur. The error message indicates that the problem occurs when trying to change the sp back to the original after displaying the stacktrace for the goroutine. gdb.error: Attempt to assign to an unmodifiable value. After some searching I found that this error message can happen if the sp register is changed when on a frame that is not the top-most frame. To fix the problem, frame 0 is selected before changing the value of sp. This fixes the problem in my reproducer environment, and hopefully will fix the problem on the builder. Updates #28679 Change-Id: I329bc95b30f8c95acfb161b0d9cfdcbd917a1954 Reviewed-on: https://go-review.googlesource.com/c/152540 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-15runtime: fix another typo in runtime-gdb.pyJosh Bleecher Snyder
tuple, touple, gdb, gdv, let's call the whole thing off. Change-Id: I72d12f6c75061777474e7dec2c90d2a8a3715da6 Reviewed-on: https://go-review.googlesource.com/100836 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-15runtime: refactor gdb PC parsingJosh Bleecher Snyder
Change-Id: I91607edaf9c256e6723eb3d6e18c8210eb86b704 Reviewed-on: https://go-review.googlesource.com/100464 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2018-03-14runtime: fix typo in gdb scriptJosh Bleecher Snyder
Change-Id: I9d4b3e25b00724f0e4870c6082671b4f14cc18fc Reviewed-on: https://go-review.googlesource.com/100463 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
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>
2018-02-13runtime: remove hardcoded runtime consts from gdb scriptHana Kim
Instead evaluate and read the runtime internal constants defined in runtime2.go R=go1.11 Change-Id: If2f4b87e5b3f62f0c0ff1e86a90db8e37a78abb6 Reviewed-on: https://go-review.googlesource.com/87877 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Austin Clements <austin@google.com>
2017-06-08runtime: fix tab/space inconsistency in runtime-gdb.pyAustin Clements
Change-Id: I78c6198eb909e679cf0f776b77dda52211bfd347 Reviewed-on: https://go-review.googlesource.com/45133 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-08runtime: fix GDB goroutine N command when N is runningAustin Clements
The current implementation of "goroutine N cmd" assumes it can get goroutine N's state from the goroutine's sched buffer. But this only works if the goroutine is blocked. Extend find_goroutine so that, if there is no saved scheduler state for a goorutine, it tries to find the thread the goroutine is running on and use the thread's current register state. We also extend find_goroutine to understand saved syscall register state. Fixes #13887. Change-Id: I739008a8987471deaa4a9da918655e4042cf969b Reviewed-on: https://go-review.googlesource.com/45031 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-09runtime: set $sp before $pc in gdb python scriptCherry Zhang
When setting $pc, gdb does a backtrace using the current value of $sp, and it may complain if $sp does not match that $pc (although the assignment went through successfully). This happens with ARM SSA backend: when setting $pc it prints > Cannot access memory at address 0x0 As well as occasionally on MIPS64: > warning: GDB can't find the start of the function at 0xc82003fe07. > ... Setting $sp before setting $pc makes it happy. Change-Id: Idd96dbef3e9b698829da553c6d71d5b4c6d492db Reviewed-on: https://go-review.googlesource.com/23940 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2015-04-10runtime: Fix GDB integration with Python 2Derek Buitenhuis
A similar fix was applied in 545686857bc4c2e7a5306d97e5ef48f631d277bc but another instance of 'pc' was missed. Also adds a test for the goroutine gdb command. It currently uses goroutine 2 for the test, since goroutine 1 has its stack pointer set to 0 for some reason. Change-Id: I53ca22be6952f03a862edbdebd9b5c292e0853ae Reviewed-on: https://go-review.googlesource.com/8729 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-30runtime: allow pointers to strings to be printedLee Packham
Being able to printer pointers to strings means one will able to output the result of things like the flag library and other components that use string pointers. While here, adjusted the tests for gdb to test original string pretty printing as well as pointers to them. It was doing it via the map before but for completeness this ensures it's tested as a unit. Change-Id: I4926547ae4fa6c85ef74301e7d96d49ba4a7b0c6 Reviewed-on: https://go-review.googlesource.com/8217 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-25gdb: fix map prettyprinterJan Kratochvil
(gdb) p x Python Exception <class 'gdb.error'> There is no member named b.: $2 = map[string]string -> (gdb) p x $1 = map[string]string = {["shane"] = "hansen"} Change-Id: I874d02a029f2ac9afc5ab666afb65760ec2c3177 Reviewed-on: https://go-review.googlesource.com/5522 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-22gdb: fix "gdb.error: No struct named reflect.rtype."Jan Kratochvil
With a trivial Golang-built program loaded in gdb-7.8.90.20150214-7.fc23.x86_64 I get this error: (gdb) source ./src/runtime/runtime-gdb.py Loading Go Runtime support. Traceback (most recent call last): File "./src/runtime/runtime-gdb.py", line 230, in <module> _rctp_type = gdb.lookup_type("struct reflect.rtype").pointer() gdb.error: No struct type named reflect.rtype. (gdb) q No matter if this struct should or should not be in every Golang-built binary this change should fix that with no disadvantages. Change-Id: I0c490d3c9bbe93c65a2183b41bfbdc0c0f405bd1 Reviewed-on: https://go-review.googlesource.com/5521 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-17runtime: in runtime-gdb.py, use SliceValue wrapperAustin Clements
Rather than reaching in to slices directly in the slice pretty printer, use the newly introduced SliceValue wrapper. Change-Id: Ibb25f8c618c2ffb3fe1a8dd044bb9a6a085df5b7 Reviewed-on: https://go-review.googlesource.com/4936 Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17runtime: fix GDB "info goroutines" for Go 1.5Austin Clements
"info goroutines" is failing because it hasn't kept up with changes in the 1.5 runtime. This fixes three issues preventing "info goroutines" from working. allg is no longer a linked list, so switch to using the allgs slice. The g struct's 'status' field is now called 'atomicstatus', so rename uses of 'status'. Finally, this was trying to parse str(pc) as an int, but str(pc) can return symbolic information after the raw hex value; fix this by stripping everything after the first space. This also adds a test for "info goroutines" to runtime-gdb_test, which was previously quite skeletal. Change-Id: I8ad83ee8640891cdd88ecd28dad31ed9b5833b7a Reviewed-on: https://go-review.googlesource.com/4935 Reviewed-by: Minux Ma <minux@golang.org>
2015-01-15runtime: fix runtime-gdb script loadingPaul Nasrat
runtime.rtype was a copy of reflect.rtype - update script to use that directly. Introduces a basic test which will skip on systems without appropriate GDB. Fixes #9326 Change-Id: I6ec74e947bd2e1295492ca34b3a8c1b49315a8cb Reviewed-on: https://go-review.googlesource.com/2821 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.