diff --git a/cmd/xgo/runtime_gen/trace/stack.go b/cmd/xgo/runtime_gen/trace/stack.go index 635c838f..476c8983 100755 --- a/cmd/xgo/runtime_gen/trace/stack.go +++ b/cmd/xgo/runtime_gen/trace/stack.go @@ -41,8 +41,9 @@ type ExportOptions struct { // suppress error when marshalling // arguments and results DisableErrSilent bool - SizeLimit int // 0: default limit 16K - AppearanceLimit int // 0: default limit 100 + + SizeLimit int // 0: default limit 16K + AppearanceLimit int // 0: default limit 100 FilterStack func(stack *StackExport) *StackExport diff --git a/cmd/xgo/runtime_gen/trace/trace.go b/cmd/xgo/runtime_gen/trace/trace.go index 5b4dca2e..ec263d01 100755 --- a/cmd/xgo/runtime_gen/trace/trace.go +++ b/cmd/xgo/runtime_gen/trace/trace.go @@ -147,11 +147,19 @@ func Begin() func() { return enableLocal(&collectOpts{}) } +type CollectOptions struct { + // ignore args, will be set to nil + IgnoreArgs bool + // ignore result, will be set to nil + IgnoreResults bool +} + type collectOpts struct { name string onComplete func(root *Root) filter []func(stack *Stack) bool root *Root + options *CollectOptions exportOptions *ExportOptions } @@ -173,6 +181,10 @@ func (c *collectOpts) WithFilter(f func(stack *Stack) bool) *collectOpts { c.filter = append(c.filter, f) return c } +func (c *collectOpts) WithOptions(opts *CollectOptions) *collectOpts { + c.options = opts + return c +} func (c *collectOpts) WithExport(expOpts *ExportOptions) *collectOpts { c.exportOptions = expOpts @@ -251,6 +263,14 @@ func handleTracePre(ctx context.Context, f *core.FuncInfo, args core.Object, res if localRoot == nil { initial = true } + if localOpts.options != nil { + if localOpts.options.IgnoreArgs { + stack.Args = nil + } + if localOpts.options.IgnoreResults { + stack.Results = nil + } + } } if initial { // initial stack diff --git a/cmd/xgo/version.go b/cmd/xgo/version.go index 51d10cac..efe71c7f 100644 --- a/cmd/xgo/version.go +++ b/cmd/xgo/version.go @@ -4,8 +4,8 @@ import "fmt" // auto updated const VERSION = "1.0.44" -const REVISION = "84c03999158dacf6ef0b1d5e070dbf0651a1874e+1" -const NUMBER = 290 +const REVISION = "012b5e4ef44917264a5e6e47e70a88ee40f4facc+1" +const NUMBER = 291 // manually updated const CORE_VERSION = "1.0.43" diff --git a/runtime/trace/stack.go b/runtime/trace/stack.go index 635c838f..476c8983 100644 --- a/runtime/trace/stack.go +++ b/runtime/trace/stack.go @@ -41,8 +41,9 @@ type ExportOptions struct { // suppress error when marshalling // arguments and results DisableErrSilent bool - SizeLimit int // 0: default limit 16K - AppearanceLimit int // 0: default limit 100 + + SizeLimit int // 0: default limit 16K + AppearanceLimit int // 0: default limit 100 FilterStack func(stack *StackExport) *StackExport diff --git a/runtime/trace/trace.go b/runtime/trace/trace.go index 5b4dca2e..ec263d01 100644 --- a/runtime/trace/trace.go +++ b/runtime/trace/trace.go @@ -147,11 +147,19 @@ func Begin() func() { return enableLocal(&collectOpts{}) } +type CollectOptions struct { + // ignore args, will be set to nil + IgnoreArgs bool + // ignore result, will be set to nil + IgnoreResults bool +} + type collectOpts struct { name string onComplete func(root *Root) filter []func(stack *Stack) bool root *Root + options *CollectOptions exportOptions *ExportOptions } @@ -173,6 +181,10 @@ func (c *collectOpts) WithFilter(f func(stack *Stack) bool) *collectOpts { c.filter = append(c.filter, f) return c } +func (c *collectOpts) WithOptions(opts *CollectOptions) *collectOpts { + c.options = opts + return c +} func (c *collectOpts) WithExport(expOpts *ExportOptions) *collectOpts { c.exportOptions = expOpts @@ -251,6 +263,14 @@ func handleTracePre(ctx context.Context, f *core.FuncInfo, args core.Object, res if localRoot == nil { initial = true } + if localOpts.options != nil { + if localOpts.options.IgnoreArgs { + stack.Args = nil + } + if localOpts.options.IgnoreResults { + stack.Results = nil + } + } } if initial { // initial stack