On Fri, 29 May 2026 10:59:34 +0800
Tianchen Ding <[email protected]> wrote:

> We can take advantage of this by having make_str return the escape-sequence 
> text 
> instead of binary, and letting write_buffer handle the conversion:
> 
>    make_str() {
>          ...
>          printf '%s' "${val}${data}"
>    }
> 
>    write_buffer() {
>          id=$1
>          size=$2
> 
>          str=`make_str $id $size`
>          len=$(printf "$str" | wc -c)
>          printf "$str" | dd of=trace_marker_raw bs=$len iflag=fullblock
>    }
> 
> This way str holds only printable escape-sequence text (no NUL), printf 
> "$str" 
> converts it to real binary through the pipe, and wc -c measures the true 
> binary 
> length.

This is quite hacky, but at least it removes the hardcoded assumptions.

OK, you can send a v3 that does that.

Thanks,

-- Steve

Reply via email to