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
34305993
Commit
34305993
authored
Feb 16, 2012
by
David Symonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug/gosym: Remove Makefile, rewrite test using go tool.
Update #2573. R=r CC=golang-dev
https://golang.org/cl/5656071
parent
8bb7f779
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
26 deletions
+25
-26
src/pkg/debug/gosym/Makefile
src/pkg/debug/gosym/Makefile
+0
-19
src/pkg/debug/gosym/pclinetest.asm
src/pkg/debug/gosym/pclinetest.asm
+0
-2
src/pkg/debug/gosym/pclntab_test.go
src/pkg/debug/gosym/pclntab_test.go
+25
-5
No files found.
src/pkg/debug/gosym/Makefile
deleted
100644 → 0
View file @
8bb7f779
# Copyright 2009 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.
include
../../../Make.inc
TARG
=
debug/gosym
GOFILES
=
\
pclntab.go
\
symtab.go
\
include
../../../Make.pkg
test
:
make-pclinetest
testshort
:
make-pclinetest
make-pclinetest
:
@
if
[
"
`
uname
`
-
`
uname
-m
`
"
=
Linux-x86_64
-a
$(GOARCH)
=
amd64
]
;
then
mkdir
-p
_test
&&
$(AS)
pclinetest.s
&&
$(LD)
-E
main
-o
_test/pclinetest pclinetest.
$O
;
fi
src/pkg/debug/gosym/pclinetest.
s
→
src/pkg/debug/gosym/pclinetest.
asm
View file @
34305993
//
+
build
ignore
TEXT
linefrompc
(
SB
),
7
,
$
0
//
Each
byte
stores
its
line
delta
BYTE
$
2
;
BYTE
$
1
;
...
...
src/pkg/debug/gosym/pclntab_test.go
View file @
34305993
...
...
@@ -7,14 +7,31 @@ package gosym
import
(
"debug/elf"
"os"
"os/exec"
"runtime"
"strings"
"testing"
)
var
pclinetestBinary
string
func
dotest
()
bool
{
// For now, only works on ELF platforms.
// TODO: convert to work with new go tool
return
false
&&
runtime
.
GOOS
==
"linux"
&&
runtime
.
GOARCH
==
"amd64"
if
runtime
.
GOOS
!=
"linux"
||
runtime
.
GOARCH
!=
"amd64"
{
return
false
}
if
pclinetestBinary
!=
""
{
return
true
}
// This command builds pclinetest from pclinetest.asm;
// the resulting binary looks like it was built from pclinetest.s,
// but we have renamed it to keep it away from the go tool.
pclinetestBinary
=
os
.
TempDir
()
+
"/pclinetest"
cmd
:=
exec
.
Command
(
"sh"
,
"-c"
,
"go tool 6a pclinetest.asm && go tool 6l -E main -o "
+
pclinetestBinary
+
" pclinetest.6"
)
if
err
:=
cmd
.
Run
();
err
!=
nil
{
panic
(
err
)
}
return
true
}
func
getTable
(
t
*
testing
.
T
)
*
Table
{
...
...
@@ -149,7 +166,7 @@ func TestPCLine(t *testing.T) {
return
}
f
,
tab
:=
crack
(
"_test/pclinetest"
,
t
)
f
,
tab
:=
crack
(
pclinetestBinary
,
t
)
text
:=
f
.
Section
(
".text"
)
textdat
,
err
:=
text
.
Data
()
if
err
!=
nil
{
...
...
@@ -163,10 +180,13 @@ func TestPCLine(t *testing.T) {
file
,
line
,
fn
:=
tab
.
PCToLine
(
pc
)
off
:=
pc
-
text
.
Addr
// TODO(rsc): should not need off; bug in 8g
wantLine
+=
int
(
textdat
[
off
])
t
.
Logf
(
"off is %d"
,
off
)
if
fn
==
nil
{
t
.
Errorf
(
"failed to get line of PC %#x"
,
pc
)
}
else
if
len
(
file
)
<
12
||
file
[
len
(
file
)
-
12
:
]
!=
"pclinetest.s"
||
line
!=
wantLine
||
fn
!=
sym
{
t
.
Errorf
(
"expected %s:%d (%s) at PC %#x, got %s:%d (%s)"
,
"pclinetest.s"
,
wantLine
,
sym
.
Name
,
pc
,
file
,
line
,
fn
.
Name
)
}
else
if
!
strings
.
HasSuffix
(
file
,
"pclinetest.s"
)
{
t
.
Errorf
(
"expected %s (%s) at PC %#x, got %s (%s)"
,
"pclinetest.s"
,
sym
.
Name
,
pc
,
file
,
fn
.
Name
)
}
else
if
line
!=
wantLine
||
fn
!=
sym
{
t
.
Errorf
(
"expected :%d (%s) at PC %#x, got :%d (%s)"
,
wantLine
,
sym
.
Name
,
pc
,
line
,
fn
.
Name
)
}
}
...
...
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