[Ltrace-devel] Quick question about conf file

Petr Machata pmachata at redhat.com
Wed Apr 23 14:16:56 UTC 2014


"Thierry Fauck at linux.vnet.ibm.com" <thierry at linux.vnet.ibm.com> writes:

> I get a corner case where a function returns a struct of string < 16
> Bytes, I get an optimization.
>  
> What should be the conf file to have in the info structure the size of
> the string ?
> is
>     struct(array(char,16)) struct_func_str16(struct(string[16]));
>
> the best defintion, knowing that the output of the array won't be
> truncated.... and I would check for the 16 chars ?

I'm not sure what you are asking for.

struct(string(array(char, 16))) is how I think a return of a buffer of
static 16 chars should be returned.  Technically ltrace conf file should
allow string(array(char,16)) as the return type as well, but there might
be bugs in support of naked arrays.

For determining the size of a arg_type_info, use type_sizeof.

> If I say struct(string[16]) struct_func_str16(struct(string[16]));
> I don't have the proper size if the size is > 17

I think string[16] expands to string(array(char, 16)*), i.e. what in C
would be struct{char *buf;}, not struct{char buf[16];}.

I don't know what you mean by the size > 17.  The return type must be
compile-time static, I very much doubt that return "blah" in C just
happens to pass the return value in different registers than return
"blahblahblahblah" (a 17-character string).

Thanks,
PM



More information about the Ltrace-devel mailing list