[GSOC 2014]update for JSON output support

yangmin zhu zym0017d at gmail.com
Sun Aug 10 18:43:47 UTC 2014


Hi all,

here is my update to the JSON support for strace, I upload some test
output and diff patch to gist for your review, you can see it all
here:
https://gist.github.com/zym0017d

there are 3 kind files in my Gists:
1, you can see the test outputs with and without option '-j' for a
comparison. The 2 tests below give the JSON output for most syscalls
in process.c and io.c (except ioctl). And some syscall's output are
invalid JSON format because they are not modified yet. Strace prints a
log of things in hex format (such as address and flags), the JSON
output will print all these hex numbers in unsigned decimal format.
a1)  https://gist.github.com/zym0017d/d4b3667592cd07c5ea00
a2)  https://gist.github.com/zym0017d/49aed6896fbe556689e8

b1)  https://gist.github.com/zym0017d/a368665bae867a72d344
b2)  https://gist.github.com/zym0017d/093f090cac4d85bd618e


2, I introduced some new output functions such as jprintf(), jprinta()
and jprints() to support JSON output. The first letter 'j' means
'json',  and they are used almost the same to tprintf() and tprints()
with only one extra format argument to support JSON output, you can
find the implementations here:
https://gist.github.com/zym0017d/80cdae83b3d6c70926d6

3, Another important question is how to modify the existing strace
code to use jprintf(),jpinrtf() and jprints() to support JSON output,
these modification are much simple than before and very intuitive to
understand, most modifications just simply replace the old tprintf()
with jprinta() or jprintf() and add one extra format string to specify
how to output it in JSON format.
here are my modifications to io.c, util.c and syscall.c:
a) https://gist.github.com/zym0017d/fa163698d88c2b270882
b) https://gist.github.com/zym0017d/5f239a9f2325d7d36f7f
c) https://gist.github.com/zym0017d/856c2e5882522f5f628d


I will clean the code and write more test for JSON output and then
send them to the mailing list.

Thank you!
---
YangMin




More information about the Strace-devel mailing list