aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encodingexec.go
diff options
context:
space:
mode:
Diffstat (limited to 'prog/encodingexec.go')
-rw-r--r--prog/encodingexec.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/prog/encodingexec.go b/prog/encodingexec.go
index 5afd83fd6..304440d0e 100644
--- a/prog/encodingexec.go
+++ b/prog/encodingexec.go
@@ -35,8 +35,10 @@ const (
// SerializeForExec serializes program p for execution by process pid into the provided buffer.
// If the provided buffer is too small for the program an error is returned.
func (p *Prog) SerializeForExec(buffer []byte, pid int) error {
- if err := p.validate(); err != nil {
- panic(fmt.Errorf("serializing invalid program: %v", err))
+ if debug {
+ if err := p.validate(); err != nil {
+ panic(fmt.Errorf("serializing invalid program: %v", err))
+ }
}
var instrSeq uintptr
w := &execContext{