aboutsummaryrefslogtreecommitdiff
path: root/src/debug
AgeCommit message (Collapse)Author
2015-04-27debug/dwarf: update class_string.go to add ClassReferenceSig using stringer.John Dethridge
Change-Id: I677a5ee273a4d285a8adff71ffcfeac34afc887f Reviewed-on: https://go-review.googlesource.com/9235 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/gosym: skip tests when .gosymtab section not foundMichael Hudson-Doyle
Skip the test when there is no .gosymtab section in the executable rather than crashing. Change-Id: Ieb3df07e307f50c33cdafab38f9b5d1ac0e55c04 Reviewed-on: https://go-review.googlesource.com/5110 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
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-14debug/elf: support reading debug info from 32-bit PPC objectsIan Lance Taylor
Fixes #10118. Change-Id: I4a2e6748db609c6eed1d68c824b81c59bd7b875c Reviewed-on: https://go-review.googlesource.com/7590 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14debug/gosym: fix typo in commentIan Lance Taylor
Change-Id: Ieb13359c5bbe26bbf7baaaa8eb63d5e90bdefdd8 Reviewed-on: https://go-review.googlesource.com/7591 Reviewed-by: Minux Ma <minux@golang.org>
2015-03-11debug/dwarf: factor parsing of unit lengthsAustin Clements
Many headers in DWARF sections have a "unit length" that can be either 4 bytes or 12 bytes and indicates both the length of the unit and whether the unit is in 32-bit or 64-bit format. Currently, we implement unit length parsing in four different places. Add a "unitLength" method to buf that parses a unit length and use it in these four places. Change-Id: I7950b91caaa92aa5e19aa63debc8ae46178ecc4d Reviewed-on: https://go-review.googlesource.com/7281 Reviewed-by: Nigel Tao <nigeltao@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-11debug/elf: fix arm buildDave Cheney
This change adds the minimum necessary to implement applyRelocations. For adg, this code uses the switch statement. Change-Id: I0989daab8d0e36c2a4f6a315ced258b832744616 Reviewed-on: https://go-review.googlesource.com/7266 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-10debug/dwarf: add unit tests for line table readerAustin Clements
This adds simple ELF test binaries generated by gcc and clang and compares the line tables returned by the line table reader against tables based on the output of readelf. The binaries were generated with # gcc --version | head -n1 gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 # gcc -g -o line-gcc.elf line*.c # clang --version | head -n1 Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) # clang -g -o line-clang.elf line*.c Change-Id: Id210fdc1d007ac9719e8f5dc845f2b94eed12234 Reviewed-on: https://go-review.googlesource.com/7070 Reviewed-by: Nigel Tao <nigeltao@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2015-03-10debug/dwarf: add support for line tablesAustin Clements
This implements a LineReader for line tables that parallels the existing Reader for debug entries. This code is partly based on the debug subrepo's fork of dwarf, but it is a more complete (and, I believe, correct) implementation of the spec and exposes a more general API. While the debug subrepo's implementation exposed only a PC-to-line function, this version exposes the line table rows to the caller. This way the caller can make its own trade-offs when implementing PC-to-line (or line-to-PC), such as whether or not to build an index for fast lookup. Change-Id: Ie157bc817f55e940b6f2e1ae010c5a4e1f29c5c8 Reviewed-on: https://go-review.googlesource.com/6734 Reviewed-by: Nigel Tao <nigeltao@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>
2015-03-10debug/macho, debug/pe: load DWARF line section and pass to dwarf.NewAustin Clements
Change-Id: I1e6c6b3e2984528c0331e17755cc057e7199193e Reviewed-on: https://go-review.googlesource.com/7071 Reviewed-by: Nigel Tao <nigeltao@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2015-03-10debug/elf: load .debug_line section and pass to dwarf.NewAustin Clements
Change-Id: Ia6f9bd77a3d4250339dcb054edc76942864dd358 Reviewed-on: https://go-review.googlesource.com/6781 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-10debug/elf: regularize DWARF section loadingAustin Clements
Previously, different DWARF sections had relocations applied in very different ways. .debug_info was relocated, but only on x86-64 and 386 and using hard-coded relocation section names instead of relocation links. .debug_abbrev and .debug_str were never relocated (which is excusable because they shouldn't need it). .debug_types sections were relocated on all architectures and found their relocation section using a relocation link because section names could be ambiguous. Simplify all of this so that every DWARF section that has a linked relocation section gets those relocations applied. This prepares this code to load .debug_line sections without the need for yet more ad hoc relocation logic. Change-Id: Ia00ac8e656b22f22bb31a5f6ef9b0f23cda64d19 Reviewed-on: https://go-review.googlesource.com/6780 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-02all: mv 5a old5a and so onRuss Cox
This CL will break any uses of 'go tool 5a' etc. That is intentional. Code that invokes an assembler directly should be updated to use go tool asm. We plan to keep the old5a around for bit-for-bit verification during the release testing phase, but we plan to remove those tools for the actual release. Renaming the directory now makes sure that lingering references to 'go tool 5a' will be caught, changed to use asm, and tested during the release evaluation. Change-Id: I98748a7ddb34cc7f1b151c2ef421d3656821f5c2 Reviewed-on: https://go-review.googlesource.com/6366 Reviewed-by: Rob Pike <r@golang.org>
2014-12-05all: power64 is now ppc64Russ Cox
Fixes #8654. LGTM=austin R=austin CC=golang-codereviews https://golang.org/cl/180600043
2014-11-20[dev.cc] all: merge default (e4ab8f908aac) into dev.ccRuss Cox
TBR=austin CC=golang-codereviews https://golang.org/cl/179040044
2014-11-16debug/goobj: move to cmd/internal/goobjRuss Cox
debug/goobj is not ready to be published but it is needed for the various binary-reading commands. Move to cmd/internal/goobj. (The Go 1.3 release branch deleted it, but that's not an option anymore due to the command dependencies. The API is still not vetted nor terribly well designed.) LGTM=adg, dsymonds R=adg, dsymonds CC=golang-codereviews https://golang.org/cl/174250043
2014-11-14[dev.cc] all: merge dev.power64 (7667e41f3ced) into dev.ccRuss Cox
This is to reduce the delta between dev.cc and dev.garbage to just garbage collector changes. These are the files that had merge conflicts and have been edited by hand: malloc.go mem_linux.go mgc.go os1_linux.go proc1.go panic1.go runtime1.go LGTM=austin R=austin CC=golang-codereviews https://golang.org/cl/174180043
2014-11-10all: use golang.org/x/... import pathsAndrew Gerrand
LGTM=rsc, r R=r, rsc CC=golang-codereview, golang-codereviews https://golang.org/cl/168050043
2014-10-22[dev.power64] all: merge default into dev.power64Austin Clements
This brings dev.power64 up-to-date with the current tip of default. go_bootstrap is still panicking with a bad defer when initializing the runtime (even on amd64). LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/152570049
2014-10-22build: merge the great pkg/ rename into dev.power64Austin Clements
This also removes pkg/runtime/traceback_lr.c, which was ported to Go in an earlier commit and then moved to runtime/traceback.go. Reviewer: rsc@golang.org rsc: LGTM
2014-10-21debug/pe: use appropriate type for sizeofOptionalHeader32Alex Brainman
LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/157220043
2014-10-20debug/pe: remove use of unsafeRuss Cox
Helps in environments with restricted support for unsafe. LGTM=bradfitz R=r, bradfitz CC=dsymonds, golang-codereviews https://golang.org/cl/156410044
2014-10-09debug/elf: add comments explaining applyRelocations for amd64/arm64Ian Lance Taylor
LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/155190043
2014-09-24debug/dwarf: correct name for clang-generated complex typeRuss Cox
Fixes #8694. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/143570043
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.