Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefane Fermigier
neo
Commits
84c4f5f2
Commit
84c4f5f2
authored
7 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a1a10ade
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
go/xcommon/tracing/cmd/gotrace/gotrace.go
go/xcommon/tracing/cmd/gotrace/gotrace.go
+18
-10
No files found.
go/xcommon/tracing/cmd/gotrace/gotrace.go
View file @
84c4f5f2
...
...
@@ -736,15 +736,24 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
prologue
.
emit
(
"
\t
%q"
,
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
)
prologue
.
emit
(
"
\t
%q"
,
"unsafe"
)
// pkgpaths of all packages needed for used types
needPkg
:=
StrSet
{}
// some packages are imported with explicit name
importedAs
:=
map
[
string
]
string
{}
// pkgpath -> pkgname
// code for trace:event definitions
text
:=
&
Buffer
{}
// export hash symbol so that if importing package is out of
// sync - it will have it different and linking will fail.
if
len
(
tpkg
.
Eventv
)
>
0
{
//text.emit("\n---- 8< ---- (export signature)")
//fmt.Fprintf(text, "%s", traceExport(tpkg, kind))
//text.emit("---- 8< ----")
text
.
emit
(
"
\n
var _t_exporthash_%s bool"
,
traceExportHash
(
tpkg
,
kind
))
}
// code for trace:event definitions
for
_
,
event
:=
range
tpkg
.
Eventv
{
needPkg
.
Add
(
event
.
NeedPkgv
()
...
)
err
=
traceEventCodeTmpl
.
Execute
(
text
,
event
)
...
...
@@ -753,12 +762,6 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
}
}
// emit export hash symbol
text
.
emit
(
"
\n
---- 8< ----"
)
fmt
.
Fprintf
(
text
,
"%s"
,
traceExport
(
tpkg
,
kind
))
text
.
emit
(
"---- 8< ----
\n
"
)
//text.emit("var xxx_export_%s bool", traceExportHash(tpkg, kind))
// code for trace:import imports
for
_
,
timport
:=
range
tpkg
.
Importv
{
text
.
emit
(
"
\n
// traceimport: %s"
,
timport
.
ImportSpec
())
...
...
@@ -780,6 +783,13 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
return
err
// XXX err ctx
}
if
len
(
impPkg
.
Eventv
)
==
0
{
return
fmt
.
Errorf
(
"%v: package %v does not export anything trace-related"
,
timport
.
Pos
,
timport
.
PkgPath
)
}
// verify export hash
text
.
emit
(
"
\n
zzz_t_exporthash_%s"
,
traceExportHash
(
impPkg
,
""
/*regular pkg*/
))
for
_
,
event
:=
range
impPkg
.
Eventv
{
needPkg
.
Add
(
event
.
NeedPkgv
()
...
)
importedEvent
:=
traceImported
{
...
...
@@ -795,8 +805,6 @@ func tracegen1(P *Program, tpkg *Package, pkgdir string, kind string) error {
}
}
// TODO check export hash
// finish prologue with needed imports
needPkg
.
Delete
(
tpkg
.
Pkgi
.
Pkg
.
Path
())
// our pkg - no need to import
needPkgv
:=
needPkg
.
Itemv
()
...
...
This diff is collapsed.
Click to expand it.
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