Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d00442ab
Commit
d00442ab
authored
Jun 02, 2014
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[release-branch.go1.3] remove package debug/goobj and copy functionality to cmd/nm
https://golang.org/cl/103760043/
parent
f40040b0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
181 additions
and
204 deletions
+181
-204
src/cmd/nm/debug_goobj.go
src/cmd/nm/debug_goobj.go
+171
-165
src/cmd/nm/goobj.go
src/cmd/nm/goobj.go
+10
-11
src/pkg/debug/goobj/read_test.go
src/pkg/debug/goobj/read_test.go
+0
-28
No files found.
src/
pkg/debug/goobj/read
.go
→
src/
cmd/nm/debug_goobj
.go
View file @
d00442ab
This diff is collapsed.
Click to expand it.
src/cmd/nm/goobj.go
View file @
d00442ab
...
...
@@ -7,12 +7,11 @@
package
main
import
(
"debug/goobj"
"fmt"
"os"
)
func
goobjName
(
id
goobj
.
SymID
)
string
{
func
goobjName
(
id
goobj
_
SymID
)
string
{
if
id
.
Version
==
0
{
return
id
.
Name
}
...
...
@@ -20,28 +19,28 @@ func goobjName(id goobj.SymID) string {
}
func
goobjSymbols
(
f
*
os
.
File
)
[]
Sym
{
pkg
,
err
:=
goobj
.
Parse
(
f
,
`""`
)
pkg
,
err
:=
goobj
_
Parse
(
f
,
`""`
)
if
err
!=
nil
{
errorf
(
"parsing %s: %v"
,
f
.
Name
(),
err
)
return
nil
}
seen
:=
make
(
map
[
goobj
.
SymID
]
bool
)
seen
:=
make
(
map
[
goobj
_
SymID
]
bool
)
var
syms
[]
Sym
for
_
,
s
:=
range
pkg
.
Syms
{
seen
[
s
.
SymID
]
=
true
sym
:=
Sym
{
Addr
:
uint64
(
s
.
Data
.
Offset
),
Name
:
goobjName
(
s
.
SymID
),
Size
:
int64
(
s
.
Size
),
Type
:
s
.
Type
.
Name
,
Code
:
'?'
}
seen
[
s
.
goobj_
SymID
]
=
true
sym
:=
Sym
{
Addr
:
uint64
(
s
.
Data
.
Offset
),
Name
:
goobjName
(
s
.
goobj_
SymID
),
Size
:
int64
(
s
.
Size
),
Type
:
s
.
Type
.
Name
,
Code
:
'?'
}
switch
s
.
Kind
{
case
goobj
.
STEXT
,
goobj
.
SELFRXSECT
:
case
goobj
_STEXT
,
goobj_
SELFRXSECT
:
sym
.
Code
=
'T'
case
goobj
.
STYPE
,
goobj
.
SSTRING
,
goobj
.
SGOSTRING
,
goobj
.
SGOFUNC
,
goobj
.
SRODATA
,
goobj
.
SFUNCTAB
,
goobj
.
STYPELINK
,
goobj
.
SSYMTAB
,
goobj
.
SPCLNTAB
,
goobj
.
SELFROSECT
:
case
goobj
_STYPE
,
goobj_SSTRING
,
goobj_SGOSTRING
,
goobj_SGOFUNC
,
goobj_SRODATA
,
goobj_SFUNCTAB
,
goobj_STYPELINK
,
goobj_SSYMTAB
,
goobj_SPCLNTAB
,
goobj_
SELFROSECT
:
sym
.
Code
=
'R'
case
goobj
.
SMACHOPLT
,
goobj
.
SELFSECT
,
goobj
.
SMACHO
,
goobj
.
SMACHOGOT
,
goobj
.
SNOPTRDATA
,
goobj
.
SINITARR
,
goobj
.
SDATA
,
goobj
.
SWINDOWS
:
case
goobj
_SMACHOPLT
,
goobj_SELFSECT
,
goobj_SMACHO
,
goobj_SMACHOGOT
,
goobj_SNOPTRDATA
,
goobj_SINITARR
,
goobj_SDATA
,
goobj_
SWINDOWS
:
sym
.
Code
=
'D'
case
goobj
.
SBSS
,
goobj
.
SNOPTRBSS
,
goobj
.
STLSBSS
:
case
goobj
_SBSS
,
goobj_SNOPTRBSS
,
goobj_
STLSBSS
:
sym
.
Code
=
'B'
case
goobj
.
SXREF
,
goobj
.
SMACHOSYMSTR
,
goobj
.
SMACHOSYMTAB
,
goobj
.
SMACHOINDIRECTPLT
,
goobj
.
SMACHOINDIRECTGOT
,
goobj
.
SFILE
,
goobj
.
SFILEPATH
,
goobj
.
SCONST
,
goobj
.
SDYNIMPORT
,
goobj
.
SHOSTOBJ
:
case
goobj
_SXREF
,
goobj_SMACHOSYMSTR
,
goobj_SMACHOSYMTAB
,
goobj_SMACHOINDIRECTPLT
,
goobj_SMACHOINDIRECTGOT
,
goobj_SFILE
,
goobj_SFILEPATH
,
goobj_SCONST
,
goobj_SDYNIMPORT
,
goobj_
SHOSTOBJ
:
sym
.
Code
=
'X'
// should not see
}
if
s
.
Version
!=
0
{
...
...
src/pkg/debug/goobj/read_test.go
deleted
100644 → 0
View file @
f40040b0
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
goobj
import
"testing"
var
importPathToPrefixTests
=
[]
struct
{
in
string
out
string
}{
{
"runtime"
,
"runtime"
},
{
"sync/atomic"
,
"sync/atomic"
},
{
"code.google.com/p/go.tools/godoc"
,
"code.google.com/p/go.tools/godoc"
},
{
"foo.bar/baz.quux"
,
"foo.bar/baz%2equux"
},
{
""
,
""
},
{
"%foo%bar"
,
"%25foo%25bar"
},
{
"
\x01\x00\x7F
☺"
,
"%01%00%7f%e2%98%ba"
},
}
func
TestImportPathToPrefix
(
t
*
testing
.
T
)
{
for
_
,
tt
:=
range
importPathToPrefixTests
{
if
out
:=
importPathToPrefix
(
tt
.
in
);
out
!=
tt
.
out
{
t
.
Errorf
(
"importPathToPrefix(%q) = %q, want %q"
,
tt
.
in
,
out
,
tt
.
out
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment