On 13/05/18(Sun) 05:36, Artturi Alm wrote:
> Hi,
> 
> 
> I was looking at fixing my code for ctf pprinting arrays in ddb(4),
> and came across ctf in section 5 man pages for freebsd with google,
> which lead me to wondering about this, and even think about possibility
> of an bug here, since the ctf(5)[0] mostly matches what i've seen so
> far in OpenBSD otherwise(didn't see direct asserts/ifs yet to make
> sure CTF_K_ARRAY is always handled in the ctf_stype short form thought).
> 
> In it, under "Type Encoding" vlen is described like:
>       +o   The length of the variable data
> 
> and under "Encoding of Arrays" has this:
> "Arrays, which are of type CTF_K_ARRAY, have no variable length arguments."
> 
> so the above doesn't hold currently, should it?

You can check yourself by comparing the generated CTF from
devel/ctftools.  If you find out we do not generate the same
data as the reference, then it's a bug.

> 
> While nearly on-topic, is there any definitive docs for CTF?
> + typofix for making up the use of bugs@; sorry:)
> 
> -Artturi
> 
> [0] https://www.freebsd.org/cgi/man.cgi?query=ctf
> 
> 
> diff --git usr.bin/ctfconv/generate.c usr.bin/ctfconv/generate.c
> index e19094fe231..299c0d12eb6 100644
> --- usr.bin/ctfconv/generate.c
> +++ usr.bin/ctfconv/generate.c
> @@ -183,7 +183,7 @@ imcs_add_type(struct imcs *imcs, struct itype *it)
>  
>       assert(it->it_type != CTF_K_UNKNOWN && it->it_type != CTF_K_FORWARD);
>  
> -     vlen = it->it_nelems;
> +     vlen = it->it_type != CTF_K_ARRAY ? it->it_nelems : 0;
>       size = it->it_size;
>       kind = it->it_type;
>       root = 0;
> diff --git usr.bin/ctfconv/itype.h usr.bin/ctfconv/itype.h
> index 408a2140558..c4878f2783e 100644
> --- usr.bin/ctfconv/itype.h
> +++ usr.bin/ctfconv/itype.h
> @@ -36,7 +36,7 @@ struct itype {
>       TAILQ_ENTRY(itype)       it_symb;   /* itype: global queue of symbol */
>       RB_ENTRY(itype)          it_node;   /* itype: per-type tree of types */
>  
> -     SIMPLEQ_HEAD(, itref)    it_refs;   /* itpye: backpointing refs */
> +     SIMPLEQ_HEAD(, itref)    it_refs;   /* itype: backpointing refs */
>  
>       TAILQ_HEAD(, imember)    it_members;/* itype: members of struct/union */
>  
> 

Reply via email to