aboutsummaryrefslogtreecommitdiff
path: root/src/debug/dwarf/entry.go
AgeCommit message (Collapse)Author
2025-10-17all: correct name for commentsJes Cok
Change-Id: I390c380349e99ad421264b673ad7734eddb639d3 GitHub-Last-Rev: 32e849a6420574b0d878b9a449a8c044fd6ebdd1 GitHub-Pull-Request: golang/go#75905 Reviewed-on: https://go-review.googlesource.com/c/go/+/711941 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-07-28all: omit unnecessary type conversionsJes Cok
Found by github.com/mdempsky/unconvert Change-Id: Ib78cceb718146509d96dbb6da87b27dbaeba1306 GitHub-Last-Rev: dedf354811701ce8920c305b6f7aa78914a4171c GitHub-Pull-Request: golang/go#74771 Reviewed-on: https://go-review.googlesource.com/c/go/+/690735 Reviewed-by: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2025-03-11debug/dwarf: read DWARF 5 cu base offsets on SeekPC() pathThan McIntosh
This patch fixes a bug in CL 655976 relating to DWARF 5 support; we were reading in compile unit base offsets on the Seek() path but not on the corresponding SeekPC path (we need the offsets to be read in both cases). Updates #26379. Fixes #72778. Change-Id: I02850b786a53142307219292f2c5099eb0271559 Reviewed-on: https://go-review.googlesource.com/c/go/+/656675 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-03-10debug/dwarf: fix problem with DWARF 5 and Seek methodThan McIntosh
When clients use debug/dwarf to examine DWARF 5 binaries, we can run into problems when the Seek() method is used to skip ahead from a DIE in one compilation unit to a DIE in another unit. The problem here is that it is common for DWARF 5 comp units to have attributes (ex: DW_AT_addr_base) whose value must be applied as an offset when reading certain forms (ex: DW_FORM_addrx) within that unit. The existing implementation didn't have a good way to recover these attrs following the Seek call, and had to essentially punt in this case, resulting in incorrect attr values. This patch adds new support for reading and caching the key comp unit DIE attributes (DW_AT_addr_base, DW_AT_loclists_base, etc) prior to visiting any of the DIE entries in a unit, storing the cache values of these attrs the main table of units. This base attribute reading/caching behavior also happens (where needed) after Seek calls. Should resolve delve issue 3861. Supercedes Go pull request 70400. Updates #26379. Fixes #57046. Change-Id: I536a57e2ba4fc55132d91c7f36f67a91ac408dc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/655976 Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-03-10debug/dwarf: refactor entry DIE reading helperThan McIntosh
Simplify the signature of the "entry()" buf method to accept a unit as opposed to a collection of unit components (version, atable, etc). No change in functionality, this is a pure refactoring that will be needed in subsequent patch. Change-Id: I688def34e39d36b6a62733bc73dc42b49f78ca41 Reviewed-on: https://go-review.googlesource.com/c/go/+/655975 Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
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>
2023-03-18debug/dwarf: return ErrUnknownPC rather than nil on unknown PCJoel Sing
Currently, on e == nil or e.Tag == 0, SeekPC returns with a nil error. Instead, indicate that the PC is unknown. Change-Id: I9594296034e2df872e399bd800b00cb565c413c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/473695 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-11-05all: fix comment typosDan Kortschak
Change-Id: Ic16824482142d4de4d0b949459e36505ee944ff7 Reviewed-on: https://go-review.googlesource.com/c/go/+/448175 Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Dan Kortschak <dan@kortschak.io> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dan Kortschak <dan@kortschak.io> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-10-01debug/dwarf: don't crash on negative range/rnglist offsetIan Lance Taylor
No test case because the problem can only happen for invalid data. Let the fuzzer find cases like this. Fixes #55948 Change-Id: I7ba40ba928d2a14d4ac5b39f966173f3868d4729 Reviewed-on: https://go-review.googlesource.com/c/go/+/436876 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-09-27debug/dwarf: don't crash on invalid range/rnglist offsetIan Lance Taylor
No test case because the problem can only happen for invalid data. Let the fuzzer find cases like this. Fixes #53529 Change-Id: I318c87795e545fe5a006d16b4d361cd4bf5d502d Reviewed-on: https://go-review.googlesource.com/c/go/+/434936 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2022-04-11all: gofmt main repoRuss Cox
[This CL is part of a sequence implementing the proposal #51082. The design doc is at https://go.dev/s/godocfmt-design.] Run the updated gofmt, which reformats doc comments, on the main repository. Vendored files are excluded. For #51082. Change-Id: I7332f099b60f716295fb34719c98c04eb1a85407 Reviewed-on: https://go-review.googlesource.com/c/go/+/384268 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-05all: replace `` and '' with “ (U+201C) and ” (U+201D) in doc commentsRuss Cox
go/doc in all its forms applies this replacement when rendering the comments. We are considering formatting doc comments, including doing this replacement as part of the formatting. Apply it to our source files ahead of time. For #51082. Change-Id: Ifcc1f5861abb57c5d14e7d8c2102dfb31b7a3a19 Reviewed-on: https://go-review.googlesource.com/c/go/+/384262 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-04-01all: remove trailing blank doc comment linesRuss Cox
A future change to gofmt will rewrite // Doc comment. // func f() to // Doc comment. func f() Apply that change preemptively to all doc comments. For #51082. Change-Id: I4023e16cfb0729b64a8590f071cd92f17343081d Reviewed-on: https://go-review.googlesource.com/c/go/+/384259 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-04-01debug/dwarf: better error handling in SeekPCThan McIntosh
The dwarf.Reader "SeekPC" method was not properly handling the case of a truncated/empty unit (something that has header information but an empty abbrev table and no DIEs). Add some guards to handle this case. Fixes #52045. Change-Id: I978163eca3b610f7528058693b840931e90d3f63 Reviewed-on: https://go-review.googlesource.com/c/go/+/397054 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-06all: fix some typosDan Kortschak
Change-Id: I7dfae0fc91c2d70873ec7ec920be7c0a4888153a Reviewed-on: https://go-review.googlesource.com/c/go/+/390175 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Trust: Daniel Martí <mvdan@mvdan.cc>
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-15debug/dwarf: better error message when reading absent debug_line_strAlessandro Arzilli
When a DW_FORM_line_strp is used without a debug_line_str section a good error message (about the missing section) is generated but immediately overwritten by the underflow error generated by trying to read the non-existent section. Updates #49590 Change-Id: I1c431392123a86c78c95ef1f185ebd6f17f2476a Reviewed-on: https://go-review.googlesource.com/c/go/+/363894 Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com> Trust: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
2021-03-17debug/dwarf: support DW_FORM_rnglistx aka formRnglistxIan Lance Taylor
Change-Id: I7df915978af3488f46a27595a1b04d0d33f81f7b Reviewed-on: https://go-review.googlesource.com/c/go/+/302369 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-12-14debug/dwarf: don't try to parse addr/rnglists headerIan Lance Taylor
In an executable, the debug_addr and debug_rnglists sections are assembled by concatenating the input sections, and each input section has a header, and each header may have different attributes. So just parsing the single header isn't right. Parsing the header is not necessary to handle offsets into these sections which is all we do. Looking at the header is also problematic because GCC with -gsplit-dwarf when using DWARF versions 2 through 4 emits a .debug_addr section, but it has no header. The header was only added for DWARF 5. So we can't parse the header at all for that case, and we can't even detect that case in general. This CL also fixes SeekPC with addrx and strx formats, by not using the wrong compilation unit to find the address or string base. To make that work when parsing the compilation unit itself, we add support for delay the resolution of those values until we know the base. New test binaries built with gcc -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c (gcc (Debian 10.2.0-15) 10.2.0) clang -gdwarf-5 -no-pie debug/dwarf/testdata/line[12].c (clang version 9.0.1-14) Change-Id: I66783e0eded629bf80c467767f781164d344a54d Reviewed-on: https://go-review.googlesource.com/c/go/+/277233 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2020-10-24debug/dwarf: add support for DWARFv5 to (*Data).RangesAlessandro Arzilli
Updates the (*Data).Ranges method to work with DWARFv5 which uses the new debug_rnglists section instead of debug_ranges. This does not include supporting DW_FORM_rnglistx. General support for DWARFv5 was added by CL 175138. Change-Id: I01f919a865616a3ff12f5bf649c2c9abf89fcf52 Reviewed-on: https://go-review.googlesource.com/c/go/+/236657 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Emmanuel Odeke <emm.odeke@gmail.com>
2020-09-21debug/dwarf: speed up SkipChildren for compilation unitsDmitry Vyukov
For a common pattern of iterating only over top-level compilation units (CU) Reader.SkipChildren has decode and meterialize all CU subentries just to skip them, because DW_TAG_compile_unit does not have DW_AT_sibling. However, CUs have total size encoded before the unit and we already parse them and know all unit sizes. Optimize Reader.SkipChildren to use that size when skipping CUs children. This speeds up iteration over a 1.3GB object file from 7.5s to 0.73s. Change-Id: I2a8f00955159b4bd13571409f4817805f934cb69 Reviewed-on: https://go-review.googlesource.com/c/go/+/256217 Run-TryBot: Dmitry Vyukov <dvyukov@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Than McIntosh <thanm@google.com>
2019-09-18debug/dwarf: expose CU byte orderAustin Clements
Currently, dwarf.Reader exposes the current compilation unit's address size, but doesn't expose its byte order. Both are important for decoding many attributes. For example, location descriptions include addresses that are encoded in native form for the CU. This CL exposes the byte order of the compilation unit in the same way we already expose its address size, which makes it possible to decode attributes containing native addresses. Change-Id: I92f156818fe92b049d1dfc1613816bb1689cfadf Reviewed-on: https://go-review.googlesource.com/c/go/+/192698 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-09-03debug/dwarf: better handling for DW_FORM_indirectThan McIntosh
Fix a buglet in abbrev processing related to DW_FORM_indirect. When reading an abbrev entry if we encounter an attribute with form DW_FORM_indirect, leave the class as ClassUnknown, then when the abbrev is walked during the reading of the DIE fill in the class based on the value read at that point (code for handling DW_FORM_indirect seems to be already partially in place in the DIE reader). Updates #33488. Change-Id: I9dc89abf5cc8d7ea96824c0011bef979de0540bf Reviewed-on: https://go-review.googlesource.com/c/go/+/190158 Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2019-09-03debug/dwarf, debug/elf: support DWARF 5Ian Lance Taylor
Change-Id: I6e9d47865c198299d497911c58235cd40f775e34 Reviewed-on: https://go-review.googlesource.com/c/go/+/175138 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2018-02-15debug/dwarf: formStrp uses a 64-bit value for 64-bit DWARFIan Lance Taylor
No test as the only system I know that uses 64-bit DWARF is AIX. Change-Id: I24e225253075be188845656b6778993c2d24ebf5 Reviewed-on: https://go-review.googlesource.com/84379 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2017-10-17debug/dwarf: support 64-bit DWARF in byte order checkIan Lance Taylor
Also fix 64-bit DWARF to read a 64-bit abbrev offset in the compilation unit. Change-Id: Idc22e59ffb354d58e9973b62fdbd342acf695859 Reviewed-on: https://go-review.googlesource.com/71171 Reviewed-by: Austin Clements <austin@google.com>
2016-03-22debug/dwarf: add Reader.SeekPC and Data.RangesIan Lance Taylor
These new methods help find the compilation unit to pass to the LineReader method in order to find the line information for a PC. The Ranges method also helps identify the specific function for a PC, needed to determine the function name. This uses the .debug.ranges section if necessary, and changes the object file format packages to pass in the section contents if available. Change-Id: I5ebc3d27faaf1a126ffb17a1e6027efdf64af836 Reviewed-on: https://go-review.googlesource.com/20769 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-02all: single space after period.Brad Fitzpatrick
The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-01all: make copyright headers consistent with one space after periodBrad Fitzpatrick
This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-24all: fix typos and spellingMartin Möhrmann
Change-Id: Icd06d99c42b8299fd931c7da821e1f418684d913 Reviewed-on: https://go-review.googlesource.com/19829 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-09-15debug/dwarf: return ClassUnknown if attribute class cannot be determinedAustin Clements
Currently, if the .debug_abbrev section of an ELF file contains attributes that aren't known to the dwarf package and that have form formSecOffset, the dwarf package will fail to open the DWARF data with an error like "decoding dwarf section abbrev at offset 0x17: cannot determine class of unknown attribute with formSecOffset". For the most part, the class is implied by the form encoded in the abbrev section, but formSecOffset can imply many different DWARF classes. Hence, debug/dwarf disambiguates these using a table of known attributes. However, it will reject the entire image if it encounters an attribute it can't determine the class of. This is particularly unfortunate because the caller may never even uses the offending attribute. Fix this by introducing a ClassUnknown attribute class to use as a fallback in these cases. This allows the dwarf package to load the DWARF data and isolates the problem to just the affected attributes. Fixes #12592. Change-Id: I766227b136e9757f8b89c0b3ab8e9ddea899d94f Reviewed-on: https://go-review.googlesource.com/14541 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: jcd . <jcd@golang.org>
2015-06-11all: fix misprints in commentsAinar Garipov
These were found by grepping the comments from the go code and feeding the output to aspell. Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395 Reviewed-on: https://go-review.googlesource.com/10941 Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-07debug/dwarf: compute ByteSize for more DWARF typesJohn Dethridge
When AttrByteSize is not present for a type, we can still determine the size in two more cases: when the type is a Typedef referring to another type, and when the type is a pointer and we know the default address size. entry.go: return after setting an error if the offset is out of range. Change-Id: I63a922ca4e4ad2fc9e9be3e5b47f59fae7d0eb5c Reviewed-on: https://go-review.googlesource.com/9663 Reviewed-by: Austin Clements <austin@google.com>
2015-04-12debug/dwarf: add Entry.AttrField method to get *Field by AttrAustin Clements
Currently, Entry has a Val method that looks up an attribute and returns its value. Now that Field has more fields than the attribute and its value, it's useful to return the whole Field and let the caller retrieve the parts it needs. This change adds an AttrField method to Entry that does the same lookup at Val, but returns the whole *Field rather than just the value. Change-Id: Ic629744c14c0e09d7528fa1026b0e1857789948c Reviewed-on: https://go-review.googlesource.com/8503 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-12debug/dwarf: add DWARF attribute value class to FieldAustin Clements
To return DWARF attribute values, debug/dwarf maps the DWARF attribute value classes to Go types. Unfortunately, this mapping is ambiguous in a way that makes it impossible to correctly interpret some DWARF attributes as of DWARF 4. For example, AttrStartScope can be either a constant or a rangelistptr. The attribute is interpreted differently depending on its class, but debug/dwarf maps both classes to int64, so the caller can't distinguish them from the Go type. AttrDataMemberLocation is similar. To address this, this change adds a field to type Field that indicates the exact DWARF attribute value class of that field's value. This makes it possible to distinguish value classes that can't be distinguished by their Go type alone. The root of this type ambiguity was DWARF itself. For example, DWARF 2 made no distinction between constants that were just constants and constants that were section offsets because no attribute could have both meanings. Hence, the single int64 type was sufficient. To avoid introducing just another layer of ambiguity, this change takes pains to canonicalize ambiguous classes in DWARF 2 and 3 files into the unambiguous classes of DWARF 4. Of course, there's no guarantee that future DWARF versions won't do the same thing again and further subdivide the DWARF 4 classes. This change gets ahead of this somewhat by distinguishing the various *ptr classes even though the encoding does not. If there's some other form of split, we can handle this in a backwards-compatible way by introducing, for example, a Class5 field and type. Change-Id: I4ef96d1223b0fd7f96ecf44fcc0e704a36af02b4 Reviewed-on: https://go-review.googlesource.com/8502 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-04-10debug/dwarf: document DWARF class -> Go type mappingAustin Clements
Currently, the only way to know the Go type of an attribute of some DWARF attribute class was to read the dwarf package code (or experiment). This makes it hard to go from the DWARF specification to writing code that uses the dwarf package. Fix this by adding a table to the documentation comment of the Field type that gives the correspondence between DWARF attribute classes and Go types. Change-Id: I57c678a551fa1eb46f8207085d5a53d44985e3e7 Reviewed-on: https://go-review.googlesource.com/7280 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-03-24debug/dwarf, encoding/asn1, go/ast: fix old commentsMatthew Dempsky
The debug/dwarf and encoding/asn1 examples were added in 2009, a few months before Go added implicit semicolons, and never updated. The go/ast node types have always been named just "Expr", "Stmt", and "Decl", so the comments about "ExprNode", "StmtNode", and "DeclNode" were likely just mistaken because the interface tag methods are "exprNode", "stmtNode", and "declNode", respectively. Change-Id: I9d138cc3a16c1a51453da1406914d7b320bf6270 Reviewed-on: https://go-review.googlesource.com/7980 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-10debug/dwarf: factor finding unit containing entry offsetAustin Clements
This factors out the code for finding which unit contains an offset in the "info" section. The new code also replaces linear search with a binary search. The line table reader will also need this functionality. Change-Id: I2076e4fc6719b6f06fd2796cbbc7548ec1876cb3 Reviewed-on: https://go-review.googlesource.com/6733 Reviewed-by: Rob Pike <r@golang.org> 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.