diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-12-15 15:17:13 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-12-15 15:17:13 +0100 |
| commit | def91db3fe955168c82038ac2ee39783e81a2af0 (patch) | |
| tree | b6cbf100001e7b9fe34a8e2eb4ab00438f3e0154 /prog/encodingexec.go | |
| parent | 7a944a0a666587f229291814b30644cc0859674c (diff) | |
prog, pkg/csource: more readable serialization for strings
Always serialize strings in readable format (non-hex).
Serialize binary data in readable format in more cases.
Fixes #792
Diffstat (limited to 'prog/encodingexec.go')
| -rw-r--r-- | prog/encodingexec.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/prog/encodingexec.go b/prog/encodingexec.go index 651ecef51..2d2f02e57 100644 --- a/prog/encodingexec.go +++ b/prog/encodingexec.go @@ -35,6 +35,8 @@ const ( execArgResult execArgData execArgCsum + + execArgDataReadable = uint64(1 << 63) ) const ( @@ -255,8 +257,15 @@ func (w *execContext) writeArg(arg Arg) { w.writeConstArg(a.Size(), w.target.PhysicalAddr(a), 0, 0, 0, FormatNative) case *DataArg: data := a.Data() + if len(data) == 0 { + return + } w.write(execArgData) - w.write(uint64(len(data))) + flags := uint64(len(data)) + if isReadableDataType(a.Type().(*BufferType)) { + flags |= execArgDataReadable + } + w.write(flags) padded := len(data) if pad := 8 - len(data)%8; pad != 8 { padded += pad |
