[GSOC 2014] JSON support for strace - problems

yangmin zhu zym0017d at gmail.com
Mon Jul 28 15:44:26 UTC 2014

Hi Dmitry,

I'm working to modify strace to support JSON, but I just encounter a
big problem recently and I could not find
out a suitable way to get through.

the problem is:
1), as you know, I designed a framework to support the JSON output and
the core of the framework is to hook the metadata printed by
I then modify strace code to use this framework. But I found that the
code is becoming more and more complicated(or ugly)
when I modify some complicated functions such as sys_clone() and sys_ioctl().

2), I also found a flaw in my hook framework: I passed the va_list
variable to vfprintf() and reuse this variable after the call, But I
just found that
the man-page of va_arg says: "If ap is passed to a function that uses
va_arg(ap,type) then the value of ap is undefined after the return of
that function."
this indicate that although my current code worked, but the behavior
is in fact undefined which may not work in another system.

so I rethink my design to support JSON output:
The basic framework is designed too complicated and it seems we can in
fact modify only small part of strace to make it support JSON. (maybe
we can reuse most
of the current tprintf/tprints functions).
I'm also trying to find workaround for arg_list() problem, I thought
about the arg_copy(), But It couldn't fix the problem in a clean
way(especially when the format string contain multiple specifier). and
because of this I'm trying to redesign the framework to bypass these

IMHO, I'm afraid that I could not finish modifying all the sys_*
functions in strace (there are 300+ such functions in about 35 files)
before the deadline of GSOC.
But I think once I got a better basic framework design it would help
to modify the current to suport JSON output witout heavy effort.

I will post my new design to mailing list ASAP, and I will continue my
work after the GSOC deadline. So I hope
If you have any suggestions, please let me know.

Thank you.

More information about the Strace-devel mailing list