[DTrace-devel] [PATCH 1/7] parser: check for all types of char

Eugene Loh eugene.loh at oracle.com
Mon May 8 18:11:40 UTC 2023


I'm not 100% sure but:
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

Would be nice to have tests, but that might be impractical.

On 5/2/23 13:12, Nick Alcock via DTrace-devel wrote:
> A while back I changed the check for IS_CHAR() in the parser to check
> specifically for a char in the native signedness.  This fails now
> the kernel might be using a char in the non-native signedness.

s/fails/can fail/

s/now the/now that the/

and...

> Consider all such types to be equally-valid chars.  We really
> don't care if they're signed or not, they're still chars.
>
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>   libdtrace/dt_parser.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libdtrace/dt_parser.h b/libdtrace/dt_parser.h
> index a8aecb9a6ffef..1acbf4ed49b23 100644
> --- a/libdtrace/dt_parser.h
> +++ b/libdtrace/dt_parser.h
> @@ -238,7 +238,7 @@ struct dtrace_typeinfo;	/* see <dtrace.h> */
>   struct dt_pcb;		/* see <dt_impl.h> */
>   
>   #define	IS_CHAR(e) \
> -	((((e).cte_format & CTF_CHAR) == CTF_CHAR) &&	\
> +	((((e).cte_format & CTF_INT_CHAR) == CTF_INT_CHAR) && \
>   	(e).cte_bits == NBBY)

Since we're going from CTF_CHAR (potentially two nonzero bits) to 
CTF_INT_CHAR (a single nonzero bit), it suffices to say
(cte_format & CTF_INT_CHAR)
instead of
((cte_format & CTF_INT_CHAR) == CTF_INT_CHAR)
but maybe the latter form is better for maintenance purposes???



More information about the DTrace-devel mailing list