diff options
Diffstat (limited to 'tapset/aux_syscalls.stp')
-rw-r--r-- | tapset/aux_syscalls.stp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 3818ae75..05c7dc98 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -1520,7 +1520,7 @@ typedef struct { void _stp_lookup_str(const _stp_val_array * const array, long val, char *ptr, int len) { - int i = 0; + int i = 0, slen; while (array[i].name) { if (array[i].val == val) { strlcat (ptr, array[i].name, len); @@ -1528,11 +1528,18 @@ void _stp_lookup_str(const _stp_val_array * const array, long val, char *ptr, in } i++; } - snprintf(ptr, len, "0x%lx", val); + slen = strlen(ptr); + _stp_snprintf(ptr + slen, len - slen, "0x%lx", val); } void _stp_lookup_or_str(const _stp_val_array * const array, long val, char *ptr, int len) { int i = 0, flag = 0; + + if (val == 0) { + _stp_lookup_str(array, val, ptr, len); + return; + } + while (array[i].name) { if (array[i].val & val) { if (flag) @@ -1587,7 +1594,7 @@ void _stp_sigset_str(sigset_t *mask, char *ptr, int len) const _stp_val_array * const array = _stp_signal_list; int i = 0, flag = 0; while (array[i].name) { - if (sigismember(mask, array[i].val)) { + if (array[i].val && sigismember(mask, array[i].val)) { if (flag) strlcat(ptr, "|", len); strlcat(ptr, array[i].name, len); @@ -1785,6 +1792,17 @@ function get_mmap_args:string (args:long) strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN); %} + +function _sighandler_str:string(uaddr:long) +%{ /* pure */ + static const _stp_val_array const _stp_sa_handler_list[] = { + {0, "SIG_DFL"}, + {1, "SIG_IGN"}, + {0, NULL} + }; + _stp_lookup_str(_stp_sa_handler_list, (long)THIS->uaddr, THIS->__retvalue, MAXSTRINGLEN); +%} + function _struct_sigaction_u:string(uaddr:long) %{ /* pure */ static const _stp_val_array const _stp_sa_handler_list[] = { @@ -1818,8 +1836,12 @@ function _struct_sigaction_u:string(uaddr:long) strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN); _stp_lookup_or_str(_stp_sa_flags_list, act.sa_flags, THIS->__retvalue, MAXSTRINGLEN); strlcat (THIS->__retvalue, ", ", MAXSTRINGLEN); +#if !defined (__ia64__) len = strlen(THIS->__retvalue); _stp_snprintf(THIS->__retvalue + len, MAXSTRINGLEN - len, "0x%lx, [", (long)act.sa_restorer); +#else + strlcat (THIS->__retvalue, "[", MAXSTRINGLEN); +#endif _stp_sigset_str(&act.sa_mask, THIS->__retvalue, MAXSTRINGLEN); strlcat (THIS->__retvalue, "]", MAXSTRINGLEN); } |