Commit a4a4c832 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e592a53a
...@@ -226,12 +226,16 @@ func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) (*Package, err ...@@ -226,12 +226,16 @@ func packageTrace(prog *loader.Program, pkgi *loader.PackageInfo) (*Package, err
} }
// go through files of the original package and process //trace: directives // go through files of the original package and process //trace: directives
//
// FIXME we currently don't process cgo files as go/loader passes to us
// already preprocessed results with comments stripped, not original source.
// Maybe in some time it will be possible to have AST of original source:
// https://github.com/golang/go/issues/16623
for _, file := range pkgi.Files { // ast.File for _, file := range pkgi.Files { // ast.File
fmt.Println("\tfile:", prog.Fset.Position(file.Pos()))
for _, commgroup := range file.Comments { // ast.CommentGroup for _, commgroup := range file.Comments { // ast.CommentGroup
for _, comment := range commgroup.List { // ast.Comment for _, comment := range commgroup.List { // ast.Comment
pos := prog.Fset.Position(comment.Slash) pos := prog.Fset.Position(comment.Slash)
fmt.Printf("%v %q\n", pos, comment.Text) //fmt.Printf("%v %q\n", pos, comment.Text)
// only directives starting from beginning of line // only directives starting from beginning of line
if pos.Column != 1 { if pos.Column != 1 {
......
...@@ -9,6 +9,7 @@ void hello() { ...@@ -9,6 +9,7 @@ void hello() {
*/ */
import "C" import "C"
// FIXME vvv does not currently work
// trace event defined in a cgo file // trace event defined in a cgo file
//trace:event traceHello() //trace:event traceHello()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment