[PATCH v4 2/7] Use printpid in decoders

Dmitry V. Levin ldv at altlinux.org
Thu Jul 30 20:42:21 UTC 2020


On Mon, Jul 27, 2020 at 08:54:05PM +0200, Ákos Uzonyi wrote:
[...]
> @@ -59,8 +59,23 @@ print_f_owner_ex(struct tcb *const tcp, const kernel_ulong_t addr)
>  		return;
>  
>  	PRINT_FIELD_XVAL("{", owner, type, f_owner_types, "F_OWNER_???");
> -	PRINT_FIELD_D(", ", owner, pid);
> -	tprints("}");
> +
> +	enum pid_type pid_type = PT_NONE;
> +	switch (owner.type)
> +	{
> +	case F_OWNER_TID:
> +		pid_type = PT_TID;
> +		break;
> +	case F_OWNER_PID:
> +		pid_type = PT_TGID;
> +		break;
> +	case F_OWNER_PGRP:
> +		pid_type = PT_PGID;
> +		break;
> +	}
> +	tprintf(", pid=");
> +	printpid(tcp, owner.pid, pid_type);
> +	tprintf("}");
>  }

Please make sure your changes do not replace tprints with tprintf
for printing strings without format specifiers.

I sometimes forget to check this, so I have to commit cleanups like
55d126a8d7dfedf51a862c377db36ce674b478d1 and
c5108cc878bfb65014c996be0eba0f9847bcb407 from time to time.


-- 
ldv


More information about the Strace-devel mailing list