diff options
author | Michael Pratt <mpratt@google.com> | 2018-12-06 15:46:20 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-12-06 15:47:06 -0800 |
commit | 51900fe3a42ae8523c2b123343347a3215b93dc3 (patch) | |
tree | 0854364539d41f890707743a55fa7b11b93816b5 /pkg/abi | |
parent | 1b1a42ba6dc7953db742959a54fd19124348f3fc (diff) |
Format signals, signal masks in strace
Sample:
I1205 16:51:49.869701 2492 x:0] [ 1] ioctl_test E rt_sigaction(SIGIO, 0x7e0e5b5e8500, 0x7e0e5b5e85a0)
I1205 16:51:49.869766 2492 x:0] [ 1] ioctl_test X rt_sigaction(SIGIO, 0x7e0e5b5e8500, 0x7e0e5b5e85a0) = 0x0 (44.336?s)
I1205 16:51:49.869831 2492 x:0] [ 1] ioctl_test E rt_sigprocmask(SIG_UNBLOCK, 0x7e0e5b5e8878 [SIGIO], 0x7e0e5b5e87c0, 0x8)
I1205 16:51:49.869866 2492 x:0] [ 1] ioctl_test X rt_sigprocmask(SIG_UNBLOCK, 0x7e0e5b5e8878 [SIGIO], 0x7e0e5b5e87c0 [SIGIO 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64], 0x8) = 0x0 (2.575?s)
PiperOrigin-RevId: 224422404
Change-Id: I3ed3f2ec6b1a639baa9cacd37ce7ee325c3703e4
Diffstat (limited to 'pkg/abi')
-rw-r--r-- | pkg/abi/flag.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/abi/flag.go b/pkg/abi/flag.go index 049c1b0dd..ec87c9cee 100644 --- a/pkg/abi/flag.go +++ b/pkg/abi/flag.go @@ -59,6 +59,15 @@ func (s ValueSet) Parse(val uint64) string { return fmt.Sprintf("%#x", val) } +// ParseDecimal returns the name of the value associated with `val`. Unknown +// values are converted to decimal. +func (s ValueSet) ParseDecimal(val uint64) string { + if v, ok := s[val]; ok { + return v + } + return fmt.Sprintf("%d", val) +} + // ParseName returns the flag value associated with 'name'. Returns false // if no value is found. func (s ValueSet) ParseName(name string) (uint64, bool) { |