aboutsummaryrefslogtreecommitdiff
path: root/src/debug/gosym
AgeCommit message (Collapse)Author
2025-11-26cmd/link, runtime, debug/gosym: move pclntab magic to internal/abiIan Lance Taylor
Change-Id: I2d3c41b0e61b994d7b04bd16a791fd226dc45269 Reviewed-on: https://go-review.googlesource.com/c/go/+/720302 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-04cmd/link: don't generate .gosymtab sectionIan Lance Taylor
Since Go 1.2 the section is always empty. Also remove the code looking for .gosymtab in cmd/internal/objfile. For #76038 Change-Id: Icd34c870ed0c6da8001e8d32305f79905ee2b066 Reviewed-on: https://go-review.googlesource.com/c/go/+/717200 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
2024-01-25debug/gosym: add detailed doc for text argument in NewLineTableZxilly
Fixes #65232 Change-Id: I9ef76355cec4bea2d77811a69c61c1806c486be8 GitHub-Last-Rev: 9c617b65be9b01e9708e05a540316f98c8a0d165 GitHub-Pull-Request: golang/go#65263 Reviewed-on: https://go-review.googlesource.com/c/go/+/557957 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2023-10-18debug: add available godoc linkcui fliter
Change-Id: I9e7b7e10d9e3d23e4ed540eb8137cd1f4d103711 Reviewed-on: https://go-review.googlesource.com/c/go/+/534761 Reviewed-by: Carlos Amedee <carlos@golang.org> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-07debug/gosym: rename nameoff to nameOff to match runtimeMichael Pratt
Change-Id: Id33526e56bb25bc06746355f95045c5ef3c795c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/428660 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
2022-08-09debug/gosym: fix missing symbol version for 1.2+ pclntabCuong Manh Le
Updates #37762 Change-Id: Ib587f472304a04ebd9794666228f81ae6cb5c2a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/422315 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-09all: use ":" for compiler generated symbolsCuong Manh Le
As it can't appear in user package paths. There is a hack for handling "go:buildid" and "type:*" on windows/386. Previously, windows/386 requires underscore prefix on external symbols, but that's only applied for SHOSTOBJ/SUNDEFEXT or cgo export symbols. "go.buildid" is STEXT, "type.*" is STYPE, thus they are not prefixed with underscore. In external linking mode, the external linker can't resolve them as external symbols. But we are lucky that they have "." in their name, so the external linker see them as Forwarder RVA exports. See: - https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#export-address-table - https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/pe-dll.c;h=e7b82ba6ffadf74dc1b9ee71dc13d48336941e51;hb=HEAD#l972) This CL changes "." to ":" in symbols name, so theses symbols can not be found by external linker anymore. So a hacky way is adding the underscore prefix for these 2 symbols. I don't have enough knowledge to verify whether adding the underscore for all STEXT/STYPE symbols are fine, even if it could be, that would be done in future CL. Fixes #37762 Change-Id: I92eaaf24c0820926a36e0530fdb07b07af1fcc35 Reviewed-on: https://go-review.googlesource.com/c/go/+/317917 Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-19crypto/internal/nistec,debug/gosym: fix typosDan Kortschak
Change-Id: I228a23754656b41843573bd4217de4df46c9df36 Reviewed-on: https://go-review.googlesource.com/c/go/+/417954 Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jenny Rakoczy <jenny@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-04-01all: fix various doc comment formatting nitsRuss Cox
A run of lines that are indented with any number of spaces or tabs format as a <pre> block. This commit fixes various doc comments that format badly according to that (standard) rule. For example, consider: // - List item. // Second line. // - Another item. Because the - lines are unindented, this is actually two paragraphs separated by a one-line <pre> block. This CL rewrites it to: // - List item. // Second line. // - Another item. Today, that will format as a single <pre> block. In a future release, we hope to format it as a bulleted list. Various other minor fixes as well, all in preparation for reformatting. For #51082. Change-Id: I95cf06040d4186830e571cd50148be3bf8daf189 Reviewed-on: https://go-review.googlesource.com/c/go/+/384257 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-23debug/gosym: skip non-real functions in LineToPC lookupCherry Mui
The code iterates through the func table to find a function with a given file and line number. The code panics if it sees a non- real function (e.g. go.buildid), because its CU offset is -1, which causes an index-out-of-bounds error. The debug/gosym package recovers the panic and returns "not found", without looping through the rest of the entries. Skip the non-real functions. They cannot be looked up by line number anyway. Fixes #51890. Change-Id: I96f64c17b4a53ffdce047c8244b35a402a0d39ac Reviewed-on: https://go-review.googlesource.com/c/go/+/395074 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-11-24cmd/internal/objfile, debug/gosym: use the address of runtime.text as textStartCherry Mui
Tools like objdump uses the pcln table to find the line number of a given PC. For a PIE binary, at least in some cases such as on macOS 12 with ld64-711, the table contains unrelocated address, which does not match the address in the symbol table, causing the lookup to fail. In Go 1.18 the pcln table is essentually position independent, except the start PC. Instead of reading the static content from the table, use the PC of runtime.text from the symbol table. While here, change the type of textStart to uint64. What matters here is the word size of the target program, not the host, so it shouldn't be uintptr. Fixes #49700. Change-Id: I517d79be7ba02dd4dd0275e75a11a136b08d76cd Reviewed-on: https://go-review.googlesource.com/c/go/+/366695 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2021-11-02debug/gosym: bulk allocate SymsJosh Bleecher Snyder
name old time/op new time/op delta 115/NewLineTable-8 80.7ns ± 1% 81.7ns ± 3% ~ (p=0.408 n=10+8) 115/NewTable-8 76.3µs ± 2% 63.3µs ± 3% -17.03% (p=0.000 n=9+9) 115/LineToPC-8 56.8µs ± 2% 56.8µs ± 3% ~ (p=0.905 n=10+9) 115/PCToLine-8 252ns ± 1% 256ns ± 5% ~ (p=0.183 n=10+10) name old alloc/op new alloc/op delta 115/NewLineTable-8 384B ± 0% 384B ± 0% ~ (all equal) 115/NewTable-8 164kB ± 0% 172kB ± 0% +4.97% (p=0.000 n=10+10) 115/LineToPC-8 0.00B 0.00B ~ (all equal) 115/PCToLine-8 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta 115/NewLineTable-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) 115/NewTable-8 1.04k ± 0% 0.01k ± 0% -98.75% (p=0.000 n=10+10) 115/LineToPC-8 0.00 0.00 ~ (all equal) 115/PCToLine-8 0.00 0.00 ~ (all equal) Change-Id: Ibfe6c0cb86737dee8209cb1f58f5b796aa7b30aa Reviewed-on: https://go-review.googlesource.com/c/go/+/353134 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-10-11cmd/compile: adjust debug/gosym to deal with instantiated types/funcs/methodsDan Scales
This changes debug/gosym so it can deal with instantiated types/funcs/methods. I also added tests for instantiated names. My assumption is that the concatenation of PackageName, ReceiverName, and BaseName in order should cover the entire symbol name, so either the ReceiverName or the BaseName should include any bracketed information (either the instantiation of the receiver of a method or the instantiation of function). This can provide a model for how to parse instantiated functions and method names. Fixes #48032 Change-Id: I476781de2d6fc096efbb4be85c197d6f1cafac21 Reviewed-on: https://go-review.googlesource.com/c/go/+/354689 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2021-10-05cmd/link,runtime: remove functab relocationsJosh Bleecher Snyder
Use an offset from runtime.text instead. This removes the last relocation from functab generation, which lets us simplify that code. size before after Δ % addr2line 3680818 3652498 -28320 -0.769% api 4944850 4892418 -52432 -1.060% asm 4757586 4711266 -46320 -0.974% buildid 2418546 2392578 -25968 -1.074% cgo 4197346 4164818 -32528 -0.775% compile 22076882 21875890 -200992 -0.910% cover 4411362 4358418 -52944 -1.200% dist 3091346 3062738 -28608 -0.925% doc 3563234 3532610 -30624 -0.859% fix 3020658 2991666 -28992 -0.960% link 6164642 6110834 -53808 -0.873% nm 3646818 3618482 -28336 -0.777% objdump 4012594 3983042 -29552 -0.736% pack 2153554 2128338 -25216 -1.171% pprof 13011666 12870114 -141552 -1.088% test2json 2383906 2357554 -26352 -1.105% trace 9736514 9631186 -105328 -1.082% vet 6655058 6580370 -74688 -1.122% total 103927380 102914820 -1012560 -0.974% relocs before after Δ % addr2line 25069 22709 -2360 -9.414% api 17176 13321 -3855 -22.444% asm 18271 15630 -2641 -14.455% buildid 9233 7352 -1881 -20.373% cgo 16222 13044 -3178 -19.591% compile 60421 46299 -14122 -23.373% cover 18479 14526 -3953 -21.392% dist 10135 7733 -2402 -23.700% doc 12735 9940 -2795 -21.947% fix 10820 8341 -2479 -22.911% link 21849 17785 -4064 -18.600% nm 24988 22642 -2346 -9.389% objdump 26060 23462 -2598 -9.969% pack 7665 5936 -1729 -22.557% pprof 60764 50998 -9766 -16.072% test2json 8389 6431 -1958 -23.340% trace 37180 29382 -7798 -20.974% vet 24044 19055 -4989 -20.749% total 409499 334585 -74914 -18.294% Caching the field size in debug/gosym.funcTab avoids a 20% PCToLine performance regression. name old time/op new time/op delta 115/LineToPC-8 56.4µs ± 3% 57.3µs ± 2% +1.66% (p=0.006 n=15+13) 115/PCToLine-8 188ns ± 2% 190ns ± 3% +1.46% (p=0.030 n=15+15) Change-Id: I2816a1b28e62b01852e3b306f08546f1e56cd5ac Reviewed-on: https://go-review.googlesource.com/c/go/+/352191 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-10-04debug/gosym: add funcTab abstractionJosh Bleecher Snyder
This clarifies the existing code and makes modifications easier. name old time/op new time/op delta 115/LineToPC-8 58.6µs ± 3% 56.4µs ± 3% -3.80% (p=0.000 n=15+15) 115/PCToLine-8 194ns ± 2% 188ns ± 2% -3.31% (p=0.000 n=15+15) Change-Id: Iafdf57af93d5e3c145965c32e0227e37c69ab017 Reviewed-on: https://go-review.googlesource.com/c/go/+/353880 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-10-04debug/gosym: use sort.Search in findFuncJosh Bleecher Snyder
Use sort.Search instead of open-coding the binary search. This makes the code a lot easier to work on. As a bonus, it speeds it up. name old time/op new time/op delta 115/LineToPC-8 57.4µs ± 5% 59.2µs ± 8% +3.19% (p=0.003 n=15+13) 115/PCToLine-8 255ns ± 1% 192ns ± 3% -24.63% (p=0.000 n=15+15) Change-Id: I41da18bfb0e745c40d24e5b96e50dfdd0c3b79f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/353879 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-09-30debug/gosym: run TestPCLine on Linux/AMD64 in short modeCherry Mui
Currently TestPCLine is skipped in short mode. The test builds a Linux/AMD64 binary, so it makes sense to skip it if we're cross compiling, as building the runtime takes a while. But if we are on Linux/AMD64, it will only build a small amount of code, which isn't really slow. The test runs in 0.14 second on my machine. I think it is acceptable to run in short mode. Then we'll have trybot coverage for this test. Change-Id: If682f88c28050f7daafde35b4f9e59c03b764a35 Reviewed-on: https://go-review.googlesource.com/c/go/+/353330 Trust: Cherry Mui <cherryyz@google.com> Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-09-30debug/gosym: fix version check in file table accessCherry Mui
Go 1.16 and 1.18 table are the same for that part. Accept 1.18 version number in that code. Fixes #48699. Change-Id: I44eafa279a94bd06444f61518aedd541b25390fd Reviewed-on: https://go-review.googlesource.com/c/go/+/353329 Trust: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-09-29cmd/link, runtime: use offset for _func.entryJosh Bleecher Snyder
The first field of the func data stored by the linker is the entry PC for the function. Prior to this change, this was stored as a relocation to the function. Change this to be an offset relative to runtime.text. This reduces the number of relocations on darwin/arm64 by about 10%. It also slightly shrinks binaries: file before after Δ % addr2line 3803058 3791298 -11760 -0.309% api 5140114 5104242 -35872 -0.698% asm 4886850 4840626 -46224 -0.946% buildid 2512466 2503042 -9424 -0.375% cgo 4374770 4342274 -32496 -0.743% compile 22920530 22769202 -151328 -0.660% cover 4624626 4588242 -36384 -0.787% dist 3217570 3205522 -12048 -0.374% doc 3715026 3684498 -30528 -0.822% fix 3148226 3119266 -28960 -0.920% link 6350226 6313362 -36864 -0.581% nm 3768850 3757106 -11744 -0.312% objdump 4140594 4127618 -12976 -0.313% pack 2227474 2218818 -8656 -0.389% pprof 13598706 13506786 -91920 -0.676% test2json 2497234 2487426 -9808 -0.393% trace 10198066 10118498 -79568 -0.780% vet 6930658 6889074 -41584 -0.600% total 108055044 107366900 -688144 -0.637% It should also incrementally speed up binary launching. This is the first step towards removing enough relocations that pages that were previously dirtied by the loader may remain clean, which will offer memory savings useful in constrained environments. Change-Id: Icfba55e696ba2f9c99c4f179125ba5a3ba4369c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/351463 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-29debug/gosym: refactor handling of funcdataJosh Bleecher Snyder
We do a bunch of manual offset calculations everywhere. Add a bit of type safety and some helpers. In addition to making the code clearer and providing a place to hang some documentation, it also makes upcoming changes easier. name old time/op new time/op delta 115/NewLineTable-8 79.9ns ± 1% 90.2ns ±23% ~ (p=0.234 n=9+10) 115/NewTable-8 72.0µs ± 1% 73.4µs ± 1% +1.96% (p=0.000 n=8+8) 115/LineToPC-8 53.3µs ± 1% 54.4µs ± 1% +2.02% (p=0.000 n=10+10) 115/PCToLine-8 249ns ± 0% 249ns ± 2% ~ (p=0.147 n=9+10) name old alloc/op new alloc/op delta 115/NewLineTable-8 384B ± 0% 384B ± 0% ~ (all equal) 115/NewTable-8 164kB ± 0% 164kB ± 0% ~ (p=0.610 n=10+10) 115/LineToPC-8 0.00B 0.00B ~ (all equal) 115/PCToLine-8 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta 115/NewLineTable-8 3.00 ± 0% 3.00 ± 0% ~ (all equal) 115/NewTable-8 1.04k ± 0% 1.04k ± 0% ~ (all equal) 115/LineToPC-8 0.00 0.00 ~ (all equal) 115/PCToLine-8 0.00 0.00 ~ (all equal) Change-Id: If357dce5ae4277e6ddc6d90ba6b5b83e470b9121 Reviewed-on: https://go-review.googlesource.com/c/go/+/352951 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-09-29debug/gosym: add benchmarkJosh Bleecher Snyder
Use a Go 1.15 executable for the benchmark, because it is handy. Most of the code paths are shared for Go 1.2+. Change-Id: Id7ddc76a05d76335108c58ff9f1ab2ff837b7227 Reviewed-on: https://go-review.googlesource.com/c/go/+/353131 Trust: Josh Bleecher Snyder <josharian@gmail.com> Trust: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2021-09-29debug/gosym: adjust go12* method commentsJosh Bleecher Snyder
These methods are for use with Go 1.2 _and later_ pcln tables. Make that clearer. Change-Id: Iee06e0828fd5895639b654363b6d91bf9151d224 Reviewed-on: https://go-review.googlesource.com/c/go/+/352950 Trust: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-29debug/gosym: add hook to disable recoversJosh Bleecher Snyder
debug/gosym assumes throughout that bogus input means a malformed file. That's generally true, but not when you're changing the package. In that case, the panic usually indicates a newly introduced bug, and seeing the panic is really useful. Add a manually-enabled way to make panics panic. Change-Id: I07af6c7b982c4cf61180db29f07aa63576ba7837 Reviewed-on: https://go-review.googlesource.com/c/go/+/352949 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-09-27debug/gosym: add pcHeader parsing helpersJosh Bleecher Snyder
A subsequent change will duplicate most of case ver116. Make it easier to read. Change-Id: I3a93181c7f094b12715b8a618e9efef7a1438a27 Reviewed-on: https://go-review.googlesource.com/c/go/+/351909 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.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-10-20all: update references to symbols moved from io/ioutil to ioRuss Cox
The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-08-18[dev.link] cmd/{compile,link}: remove pcdata tables from pclntab_oldJeremy Faller
Move the pctables out of pclntab_old. Creates a new generator symbol, runtime.pctab, which holds all the deduplicated pctables. Also, tightens up some of the types in runtime. Darwin, cmd/compile statistics: alloc/op Pclntab_GC 26.4MB ± 0% 13.8MB ± 0% allocs/op Pclntab_GC 89.9k ± 0% 86.4k ± 0% liveB Pclntab_GC 25.5M ± 0% 24.2M ± 0% No significant change in binary size. Change-Id: I1560fd4421f8a210f8d4b508fbc54e1780e338f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/248332 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-08-13[dev.link] debug/gosym: fix file mappingsJeremy Faller
CL 246497 introduced bugs in gosym that the long tests caught. These two bugs were: 1) In 1.16, 0 is now a valid file number from pcfile tables. 2) Also, in 1.16, when we scan all functions looking for a pc/file pair, the values returned from pcfile are no longer the direct offset into the file table. Rather, the values from pcfile are the offset into the cu->file look-up table. This CL fixes those two issues. Change-Id: I0cd280bdcaeda89faaf9fac41809abdb87734499 Reviewed-on: https://go-review.googlesource.com/c/go/+/248317 Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2020-08-12[dev.link] cmd/link: stop renumbering files for pclntab generationJeremy Faller
Creates two new symbols: runtime.cutab, and runtime.filetab, and strips the filenames out of runtime.pclntab_old. All stats are for cmd/compile. Time: Pclntab_GC 48.2ms ± 3% 45.5ms ± 9% -5.47% (p=0.004 n=9+9) Alloc/op: Pclntab_GC 30.0MB ± 0% 29.5MB ± 0% -1.88% (p=0.000 n=10+10) Allocs/op: Pclntab_GC 90.4k ± 0% 73.1k ± 0% -19.11% (p=0.000 n=10+10) live-B: Pclntab_GC 29.1M ± 0% 29.2M ± 0% +0.10% (p=0.000 n=10+10) binary sizes: NEW: 18565600 OLD: 18532768 The size differences in the binary are caused by the increased size of the Func objects, and (less likely) some extra alignment padding needed as a result. This is probably the maximum increase in size we'll size from the pclntab reworking. Change-Id: Idd95a9b159fea46f7701cfe6506813b88257fbea Reviewed-on: https://go-review.googlesource.com/c/go/+/246497 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Austin Clements <austin@google.com>
2020-07-31[dev.link] create runtime.funcnametabJeremy Faller
Move the function names out of runtime.pclntab_old, creating runtime.funcnametab. There is an unfortunate artifact in this change in that calculating the funcID still requires loading the name. Future work will likely pull this out and put it into the object file Funcs. ls -l cmd/compile (darwin): before: 18524016 after: 18519952 The difference in size can be attributed to alignment in pclntab_old. Change-Id: Ibcbb230d4632178f8fcd0667165f5335786381f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/243223 Reviewed-by: Austin Clements <austin@google.com>
2020-07-30[dev.link] cmd/link: add runtime.pcheaderJeremy Faller
As of July 2020, a fair amount of the new linker's live memory, and runtime is spent generating pclntab. In an effort to streamline that code, this change starts breaking up the generation of runtime.pclntab into smaller chunks that can run later in a link. These changes are described in an (as yet not widely distributed) document that lays out an improved format. Largely the work consists of breaking up runtime.pclntab into smaller pieces, stopping much of the data rewriting, and getting runtime.pclntab into a form where we can reason about its size and look to shrink it. This change is the first part of that work -- just pulling out the header, and demonstrating where a majority of that work will be. Change-Id: I65618d0d0c780f7e5977c9df4abdbd1696fedfcb Reviewed-on: https://go-review.googlesource.com/c/go/+/241598 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Austin Clements <austin@google.com>
2020-04-30debug/gosym: correct comments for Table.{Files,Objs}Ian Lance Taylor
The fields aren't too useful for Go 1.2 and later, but they aren't actually nil. Fixes #38754 Change-Id: Ia13a224f623697a00dea8ba0225633e1b9308c9f Reviewed-on: https://go-review.googlesource.com/c/go/+/230940 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-22all: shorten some testsRuss Cox
Shorten some of the longest tests that run during all.bash. Removes 7r 50u 21s from all.bash. After this change, all.bash is under 5 minutes again on my laptop. For #26473. Change-Id: Ie0460aa935808d65460408feaed210fbaa1d5d79 Reviewed-on: https://go-review.googlesource.com/c/go/+/177559 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-30all: add new GOOS=illumos, split out of GOOS=solarisJoshua M. Clulow
Like GOOS=android which implies the "linux" build tag, GOOS=illumos implies the "solaris" build tag. This lets the existing ecosystem of packages still work on illumos, but still permits packages to start differentiating between solaris and illumos. Fixes #20603 Change-Id: I8f4eabf1a66060538dca15d7658c1fbc6c826622 Reviewed-on: https://go-review.googlesource.com/c/go/+/174457 Run-TryBot: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Benny Siegert <bsiegert@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-09debug/gosym: simplify parsing symbol name ruleLE Manh Cuong
Symbol name with linker prefix like "type." and "go." is not parsed correctly and returns the prefix as parts of package name. So just returns empty string for symbol name start with linker prefix. Fixes #29551 Change-Id: Idb4ce872345e5781a5a5da2b2146faeeebd9e63b Reviewed-on: https://go-review.googlesource.com/c/go/+/156397 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-08internal/testenv: remove SetModVendorBryan C. Mills
It turns out not to be necessary. Russ expressed a preference for avoiding module fetches over making 'go mod tidy' work within std and cmd right away, so for now we will make the loader use the vendor directory for the standard library even if '-mod=vendor' is not set explicitly. Updates #30228 Change-Id: Idf7208e63da8cb7bfe281b93ec21b61d40334947 Reviewed-on: https://go-review.googlesource.com/c/go/+/166357 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-03-08gosym/pclntab: mark LineTable.LineToPC and LineTable.PCToLine as deprecatedkarthik nayak
Currently they aren't marked as deprecated as Godoc, but the comments mention that they are deprecated. Mark them as officially deprecated. Fixes #29576 Change-Id: I795c698ac715476023d80579d60932fba4c5edde Reviewed-on: https://go-review.googlesource.com/c/go/+/156331 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-05all: add -mod=vendor to GOFLAGS in tests that execute 'go' commands within ↵Bryan C. Mills
std or cmd Updates #30228 Updates #30240 Updates #30241 Change-Id: Idc311ba77e99909318b5b86f8ef82d4878f73e47 Reviewed-on: https://go-review.googlesource.com/c/go/+/165378 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-01-09debug/gosym: remove outdated commentLE Manh Cuong
Change-Id: I2bba13064c8d21ded41499c6ec225ef83d1a533e Reviewed-on: https://go-review.googlesource.com/c/156997 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-12debug/gosym: use "go build" instead of hand-running asm and linkAustin Clements
Currently, TestPCLine manually invokes asm and link on its test data. Once we introduce symbol ABIs this is going to become problematic because the test program defines main.main and main.init in assembly so they use ABI0, but the runtime expects to find them with the internal ABI. There are various ways we could solve this. This CL moves main.main and main.init into Go code and switches to using "go build" to compile and link the test binary. This has the added advantage of simplifying this test. For #27539. Change-Id: I4c0cf6467f7a39e6b1500eca6ad2620b5ef2b73c Reviewed-on: https://go-review.googlesource.com/c/146857 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-13debug/gosym: intern LineTable stringsJosh Bleecher Snyder
This cuts the allocated space while executing go tool objdump -S `go tool -n compile` by over 10%. It also speeds it up slightly: name old time/op new time/op delta ObjdumpSCompiler 9.03s ± 1% 8.88s ± 1% -1.59% (p=0.000 n=20+20) Updates #24725 Change-Id: Ic6ef8e273ede589334ab6e07099ac2e5bdf990c9 Reviewed-on: https://go-review.googlesource.com/106798 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-30debug/gosym: update docs for changes in Go 1.3Hiroshi Ioka
Change-Id: I850d961e0444f8d34284e994aee183afba35eaa7 Reviewed-on: https://go-review.googlesource.com/79597 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-05all: revert "all: prefer strings.LastIndexByte over strings.LastIndex"Marvin Stenger
This reverts https://golang.org/cl/66372. Updates #22148 Change-Id: I3e94af3dfc11a2883bf28e1d5e1f32f98760b3ee Reviewed-on: https://go-review.googlesource.com/68431 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-05all: revert "all: prefer strings.IndexByte over strings.Index"Marvin Stenger
This reverts https://golang.org/cl/65930. Fixes #22148 Change-Id: Ie0712621ed89c43bef94417fc32de9af77607760 Reviewed-on: https://go-review.googlesource.com/68430 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-27all: prefer strings.LastIndexByte over strings.LastIndexMarvin Stenger
strings.LastIndexByte was introduced in go1.5 and it can be used effectively wherever the second argument to strings.LastIndex is exactly one byte long. This avoids generating unnecessary string symbols and saves a few calls to strings.LastIndex. Change-Id: I7b5679d616197b055cffe6882a8675d24a98b574 Reviewed-on: https://go-review.googlesource.com/66372 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-25all: prefer strings.IndexByte over strings.IndexMarvin Stenger
strings.IndexByte was introduced in go1.2 and it can be used effectively wherever the second argument to strings.Index is exactly one byte long. This avoids generating unnecessary string symbols and saves a few calls to strings.Index. Change-Id: I1ab5edb7c4ee9058084cfa57cbcc267c2597e793 Reviewed-on: https://go-review.googlesource.com/65930 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-12-01cmd/objdump: copy gosym.PCValue into internal packageKeith Randall
... so we don't have to export gosym.PCValue. Change-Id: Ie8f196d5e5ab63e3e69d1d7b4bfbbf32b7b5e4f5 Reviewed-on: https://go-review.googlesource.com/33791 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-30all: use testing.GoToolPath instead of "go"Keith Randall
This change makes sure that tests are run with the correct version of the go tool. The correct version is the one that we invoked with "go test", not the one that is first in our path. Fixes #16577 Change-Id: If22c8f8c3ec9e7c35d094362873819f2fbb8559b Reviewed-on: https://go-review.googlesource.com/28089 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-24cmd/objdump: implement objdump of .o filesKeith Randall
Update goobj reader so it can provide all the information necessary to disassemble .o (and .a) files. Grab architecture of .o files from header. .o files have relocations in them. This CL also contains a simple mechanism to disassemble relocations and add relocation info as an extra column in the output. Fixes #13862 Change-Id: I608fd253ff1522ea47f18be650b38d528dae9054 Reviewed-on: https://go-review.googlesource.com/24818 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>