strace: Fix and enable tracing of msghdr structures.

Useful for sendmsg/recvmsg. However at present it only works for recvmsg,
as sendmsg's parameter is const, and this is not automatically matched.
This commit is contained in:
Augustin Cavalier 2022-06-03 17:05:41 -04:00
parent 00f1e7c5e4
commit 8af65cc461
2 changed files with 18 additions and 15 deletions

View File

@ -562,19 +562,6 @@ format_pointer(Context &context, socket_args *args)
}
static string
get_iovec(Context &context, iovec *iov, int iovlen)
{
if (iov == NULL && iovlen == 0)
return "(empty)";
string r = "{";
r += context.FormatPointer(iov);
r += ", " + context.FormatSigned(iovlen);
return r + "}";
}
static string
format_pointer(Context &context, message_args *msg)
{
@ -587,6 +574,20 @@ format_pointer(Context &context, message_args *msg)
return r;
}
#endif
static string
get_iovec(Context &context, iovec *iov, int iovlen)
{
if (iov == NULL && iovlen == 0)
return "(empty)";
string r = "{";
r += context.FormatPointer(iov);
r += ", " + context.FormatSigned(iovlen);
return r + "}";
}
static string
@ -605,7 +606,7 @@ format_pointer(Context &context, msghdr *h)
return r;
}
#endif
static string
format_pointer(Context &context, ifreq *ifr)
@ -710,9 +711,9 @@ POINTER_TYPE(ifconf_ptr, ifconf);
POINTER_TYPE(ifreq_ptr, ifreq);
DEFINE_TYPE(pollfd_ptr, pollfd *);
POINTER_TYPE(siginfo_t_ptr, siginfo_t);
POINTER_TYPE(msghdr_ptr, msghdr);
#if 0
POINTER_TYPE(message_args_ptr, message_args);
POINTER_TYPE(msghdr_ptr, msghdr);
POINTER_TYPE(sockaddr_args_ptr, sockaddr_args);
POINTER_TYPE(sockopt_args_ptr, sockopt_args);
POINTER_TYPE(socket_args_ptr, socket_args);

View File

@ -101,6 +101,7 @@ struct fd_set;
struct flock;
struct ifconf;
struct ifreq;
struct msghdr;
struct message_args;
struct pollfd;
struct sockaddr_args;
@ -111,6 +112,7 @@ DEFINE_FACTORY(fdset_ptr, fd_set *);
DEFINE_FACTORY(flock_ptr, flock *);
DEFINE_FACTORY(ifconf_ptr, ifconf *);
DEFINE_FACTORY(ifreq_ptr, ifreq *);
DEFINE_FACTORY(msghdr_ptr, msghdr *);
DEFINE_FACTORY(message_args_ptr, message_args *);
DEFINE_FACTORY(pollfd_ptr, pollfd *);
DEFINE_FACTORY(siginfo_t_ptr, siginfo_t *);