summaryrefslogtreecommitdiff
path: root/src/cmd/nm
Commit message (Collapse)AuthorAgeFilesLines
* all: use sort.Slice where applicableBrad Fitzpatrick2016-10-041-21/+3
| | | | | | | | | | | | | | | | | I avoided anywhere in the compiler or things which might be used by the compiler in the future, since they need to build with Go 1.4. I also avoided anywhere where there was no benefit to changing it. I probably missed some. Updates #16721 Change-Id: Ib3c895ff475c6dec2d4322393faaf8cb6a6d4956 Reviewed-on: https://go-review.googlesource.com/30250 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
* all: use testing.GoToolPath instead of "go"Keith Randall2016-08-301-1/+1
| | | | | | | | | | | | | | 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>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* all: extract "can I exec?" check from tests into internal/testenvRuss Cox2015-06-161-9/+2
| | | | | | | | Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/nm: skip fork test on darwin/arm64David Crawshaw2015-04-121-2/+3
| | | | | | | | Just like darwin/arm. Change-Id: Iabb6282f18548da43117ee60f7ad6e272502f09d Reviewed-on: https://go-review.googlesource.com/8825 Reviewed-by: Minux Ma <minux@golang.org>
* cmd/nm: exclude Go tool test on darwin/armDavid Crawshaw2015-02-261-0/+4
| | | | | | Change-Id: I44f1240a766f20de5997faca4f13f96af6da3534 Reviewed-on: https://go-review.googlesource.com/6190 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
* build: adjustments for move from src/pkg to srcRuss Cox2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | | This CL adjusts code referring to src/pkg to refer to src. Immediately after submitting this CL, I will submit a change doing 'hg mv src/pkg/* src'. That change will be too large to review with Rietveld but will contain only the 'hg mv'. This CL will break the build. The followup 'hg mv' will fix it. For more about the move, see golang.org/s/go14nopkg. LGTM=r R=r CC=golang-codereviews https://golang.org/cl/134570043
* cmd/addr2line, cmd/nm: factor object reading into cmd/internal/objfileRuss Cox2014-08-077-387/+14
| | | | | | | | | | | | | | | To do in another CL: make cmd/objdump use cmd/internal/objfile too. There is a package placement decision in this CL: cmd/internal/objfile instead of internal/objfile. I chose to put internal under cmd to make clear (and enforce) that no standard library packages should use this (it's a bit dependency-heavy). LGTM=r R=r CC=golang-codereviews https://golang.org/cl/123910043
* cmd/nm: skip test on android (no Go tool)David Crawshaw2014-07-081-2/+3
| | | | | | | LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/107590043
* build: make nacl passRuss Cox2014-05-201-0/+4
| | | | | | | | | | | | | | | | Add nacl.bash, the NaCl version of all.bash. It's a separate script because it builds a variant of package syscall with a large zip file embedded in it, containing all the input files needed for tests. Disable various tests new since the last round, mostly the ones using os/exec. Fixes #7945. LGTM=dave R=golang-codereviews, remyoudompheng, dave, bradfitz CC=golang-codereviews https://golang.org/cl/100590044
* cmd/nm, cmd/objdump: fix elf symbol typesRuss Cox2014-05-141-2/+2
| | | | | | | | | | | | | | | | | Turns out elf.File.Sections is indexed by the actual section number, not the number minus one. I don't know why I thought the -1 was necessary. Fixes objdump test (and therefore build) on ELF systems. While we're here, fix bounds on gnuDump so that we don't crash when asked to disassemble outside the text segment. May fix Windows build or at least make the failure more interesting. TBR=iant CC=golang-codereviews https://golang.org/cl/92390043
* cmd/nm: do not write to GOROOT testdata directories during TestNMAlex Brainman2014-05-121-5/+12
| | | | | | | LGTM=bradfitz R=bradfitz, 0intro CC=golang-codereviews https://golang.org/cl/95280043
* cmd/nm: do not fail TestNM if symbol has less then 3 columns in nm outputAlex Brainman2014-04-211-5/+0
| | | | | | | | | Fixes #7829 LGTM=dave R=golang-codereviews, aram, dave CC=golang-codereviews https://golang.org/cl/89830043
* cmd/nm: disable TestNM on darwin, linux and solarisAlex Brainman2014-04-211-0/+4
| | | | | | | | | Update #7829 LGTM=dave R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/89810043
* cmd/ld: correct addresses in windows pe symbol tableAlex Brainman2014-04-211-0/+49
| | | | | | | | | | | This should have been part of 36eb4a62fbb6, but I later discovered that addresses are all wrong. Appropriate test added now. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/89470043
* cmd/nm: print symbol sizes for windows pe executablesAlex Brainman2014-04-191-0/+14
| | | | | | | | | Fixes #6973 LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/88820043
* cmd/nm: windows pe handling fixesAlex Brainman2014-04-163-2/+73
| | | | | | | | | | | | | - output absolute addresses, not relative; - accept negative section numbers. Update #6936 Fixes #7738 LGTM=rsc R=golang-codereviews, bradfitz, ruiu, rsc CC=golang-codereviews https://golang.org/cl/85240046
* debug/plan9obj: implement parsing of Plan 9 a.out executablesDavid du Colombier2014-01-222-0/+52
| | | | | | | | | | It implements parsing of the header and symbol table for both 32-bit and 64-bit Plan 9 binaries. The nm tool was updated to use this package. R=rsc, aram CC=golang-codereviews https://golang.org/cl/49970044
* cmd/nm: add -sort=sizeRob Pike2014-01-082-2/+11
| | | | | | | | | | | | When printing the size, we often want to sort on that key. Because it's used when looking for large things, make the sort go from largest to smallest. Perfect recreation of CL 45150044, which was lost to some blunder. R=golang-codereviews, gobot, rsc CC=golang-codereviews https://golang.org/cl/48500044
* all: fix a few spelling errors in source commentsMartin Olsson2013-12-271-1/+1
| | | | | | R=golang-codereviews, dave, iant CC=golang-codereviews https://golang.org/cl/45750044
* cmd/nm: minor cleanup from previous CLRuss Cox2013-12-184-11/+12
| | | | | | | | I forgot to apply Ian's suggestions before submitting CL 40600043. R=iant CC=golang-dev https://golang.org/cl/43560045
* cmd/nm: reimplement in GoRuss Cox2013-12-168-425/+454
| | | | | | | | | | | | | | | | | | | | | The immediate goal is to support the new object file format, which libmach (nm's support library) does not understand. Rather than add code to libmach or reengineer liblink to support this new use, just write it in Go. The C version of nm reads the Plan 9 symbol table stored in Go binaries, now otherwise unused. This reimplementation uses the standard symbol table for the corresponding file format instead, bringing us one step closer to removing the Plan 9 symbol table from Go binaries. Tell cmd/dist not to build cmd/nm anymore. Tell cmd/go to install cmd/nm in the tool directory. R=golang-dev, r, iant, alex.brainman CC=golang-dev https://golang.org/cl/40600043
* cmd/nm: make -S listing a bit more accurateRuss Cox2013-09-161-2/+33
| | | | | | | | | | | Hide container symbols like text and etext so that the individual pieces inside are shown instead. For example, if text and main.init have the same address, it was a toss-up which name was printed. R=golang-dev, iant CC=golang-dev https://golang.org/cl/13722046
* cmd/nm: put the -S flag in the usage messageRob Pike2013-09-162-2/+2
| | | | | | | | The -S flag reports symbol size, but is missing from the usage message. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/13660046
* cmd/nm: don't add filename elements for m symbolsAnthony Martin2013-04-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | The compilers used to generate only one 'm' symbol to record the stack frame size for each function. In cmd/nm, the 'm' and 'f' symbols are handled in the same switch case with a special exception for the symbol described above called ".frame". Now that the compilers emit additional 'm' symbols for precise garbage collection of the stack, the current logic is incorrect. cmd/nm will attempt to interpret these new 'm' symbols as 'f' symbols and add them to the file name index table. This fails with an out-of-memory condition when zenter encounters an 'm' symbol with a very large value (usually the .args symbol indicating a variadic NOSPLIT function). R=iant CC=dave, gobot, golang-dev, rsc https://golang.org/cl/7962045
* cmd/godoc: use go/build to determine package and example filesRobert Griesemer2013-02-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Also: - faster code for example extraction - simplify handling of command documentation: all "main" packages are treated as commands - various minor cleanups along the way For commands written in Go, any doc.go file containing documentation must now be part of package main (rather then package documentation), otherwise the documentation won't show up in godoc (it will still build, though). For commands written in C, documentation may still be in doc.go files defining package documentation, but the recommended way is to explicitly ignore those files with a +build ignore constraint to define package main. Fixes #4806. R=adg, rsc, dave, bradfitz CC=golang-dev https://golang.org/cl/7333046
* gofmt: apply gofmt -w src miscRobert Griesemer2012-10-301-1/+1
| | | | | | | | | Remove trailing whitespace in comments. No other changes. R=r CC=golang-dev https://golang.org/cl/6815053
* cmd/pack: rename __.SYMDEF to __.GOSYMDEFRuss Cox2012-09-131-1/+1
| | | | | | | | | | | | | | | | This fixes a problem with ELF tools thinking they know the format of the symbol table, as we do not use any of the standard formats for that table. This change will probably annoy the Plan 9 users, but I believe there are other incompatibilities already that mean they have to use a Go-specific nm. Fixes #3473. R=golang-dev, iant CC=golang-dev https://golang.org/cl/6500117
* doc: various update to command documentsShenghou Ma2012-03-091-1/+2
| | | | | | | | | | | | 1. consistent usage section (go tool xxx) 2. reformat cmd/ld document with minor correction document which -H flags are valid on which ld document -d flag can't be used on Windows. document -Hwindowsgui R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/5782043
* build: delete make paraphernaliaRuss Cox2012-02-061-12/+2
| | | | | | | | | | As a convenience to people working on the tools, leave Makefiles that invoke the go dist tool appropriately. They are not used during the build. R=golang-dev, bradfitz, n13m3y3r, gustavo CC=golang-dev https://golang.org/cl/5636050
* docs: replace references to gofix etc. with tool invocationsRob Pike2012-02-041-2/+1
| | | | | | R=rsc CC=golang-dev https://golang.org/cl/5630045
* cmd/go: c tools not used during compilationRob Pike2012-01-291-2/+2
| | | | | | | | cov, nm, pprof, prof R=rsc, r, rsc CC=golang-dev https://golang.org/cl/5576067
* Make.ccmd: link with mach lib,Joe Poirier2011-06-191-3/+0
| | | | | | | | remove explicit linking in make files R=golang-dev, r CC=golang-dev https://golang.org/cl/4629051
* nm: document -S flagRuss Cox2011-03-081-0/+3
| | | | | | R=r CC=golang-dev https://golang.org/cl/4247066
* nm: silently ignore .o files in .a filesRuss Cox2010-12-101-6/+9
| | | | | | | | Update #1334. R=r CC=golang-dev https://golang.org/cl/3553041
* various: avoid %ld etcRuss Cox2010-10-131-1/+1
| | | | | | | | | | | | | | | The Plan 9 tools assume that long is 32 bits. We converted all instances of long to int32 when importing the code but missed the print formats. Because int32 is always int on the compilers we use, it is never correct to use %lux, %ld, etc. Convert to %ux, %d, etc. (It matters because on 64-bit gcc, long is 64 bits, so we were printing 32-bit quantities with 64-bit formats.) R=ken2 CC=golang-dev https://golang.org/cl/2491041
* build: $GOBIN defaults to $GOROOT/binRuss Cox2010-08-241-12/+6
| | | | | | R=r CC=golang-dev https://golang.org/cl/1982049
* go: makes it build for the case $GOROOT has whitespacesSergio Luis O. B. Correia2009-11-231-2/+2
| | | | | | | | | | | | | | | the bash scripts and makefiles for building go didn't take into account the fact $GOROOT / $GOBIN could both be directories containing whitespaces, and was not possible to build it in such a situation. this commit adjusts the various makefiles/scripts to make it aware of that possibility, and now it builds successfully when using a path with whitespaces as well. Fixes #115. R=rsc, dsymonds1 https://golang.org/cl/157067
* tweak documentation of commandsRuss Cox2009-11-091-1/+1
| | | | | | | | | so that first sentence is better for cmd page. live at http://r45:3456/cmd/ R=gri, r http://go/go-review/1024034
* stylistic issues in a couple of cmd docsRob Pike2009-11-041-1/+1
| | | | | R=rsc http://go/go-review/1017028
* more command documentation, including nm and profRob Pike2009-11-031-0/+18
| | | | | R=rsc http://go/go-review/1017022
* clean moreRuss Cox2009-10-031-1/+1
| | | | | | | R=r DELTA=40 (9 added, 3 deleted, 28 changed) OCL=35277 CL=35305
* add -S flag to print size of symbolRuss Cox2009-09-081-13/+28
| | | | | | | R=r DELTA=24 (15 added, 0 deleted, 9 changed) OCL=34447 CL=34458
* rename libmach_amd64 libmachRob Pike2009-08-142-14/+14
| | | | | | R=rsc OCL=33273 CL=33276
* change gotype in symbol table fromRuss Cox2009-08-121-2/+2
| | | | | | | | | | character string to machine address. not filled in, just carved out. R=austin DELTA=77 (11 added, 34 deleted, 32 changed) OCL=33122 CL=33124
* Support use of $GOBINDIR to override $HOME/binPhil Pennock2009-07-281-1/+1
| | | | | | | | R=r,gri,rsc APPROVED=rsc DELTA=53 (12 added, 6 deleted, 35 changed) OCL=31822 CL=32282
* fix gotest by fixing nm -s to print in file order by storing a sequence numberRob Pike2009-04-151-3/+4
| | | | | | | | | as the .6 file is read. now tests will be run in file order. R=rsc DELTA=9 (6 added, 1 deleted, 2 changed) OCL=27542 CL=27544
* symbol table changesRuss Cox2008-11-201-3/+8
| | | | | | | | | | | | | | | | | | * add gotype string to symbol table * fill in gotype in 6l for known funcs/vars * print gotype with nm -t * load symbol and pc/ln tables into memory at magic address 0x99<<32. * add sys.symdat() to retrieve raw bytes of symbol table and pc/ln table. most of this should be considered experimental and subject to change. R=r DELTA=157 (128 added, 0 deleted, 29 changed) OCL=19746 CL=19750
* add nmRuss Cox2008-08-032-0/+368
R=r DELTA=339 (339 added, 0 deleted, 0 changed) OCL=13786 CL=13794