Fwd: GSOC 2015 : Structured Output

Amish Mittal amishmittal12 at gmail.com
Tue Apr 14 19:16:32 UTC 2015


hi
Dmitry V. Levin
    i grep the code of strace 4.10 in and out for this project. This is
what all i got for this project:
we don't need to change the tprintf and tprints calls, we only need to
slightly change their definition.
My idea for this project:
1) crate one global char buffer in strace.c
2) if json flag is set then tprintf and tprints will not print write
anything in current_tcp->outf , they will just write the whole string in
our char buffer
3) one JsonFormatter which converts and writes our string in json format

example :
JsonFormatter(execve( current_tcp->outf   ,"\"./a.out", ["./a.out"], [/* 80
vars */]) = 0" , sizeOfBuffer)

will write
{
  "Function" : execve
  "Arguments" : ("./a.out", ["./a.out"], [/* 80 vars */])
  "Return" : 0
}

we will call JsonFormatter function ALTERNATE ,so that we have full
information(entering and exiting) one syscall in our buffer, in strace.c in
trace() function definition , exact location is given below

if (trace_syscall(tcp) < 0)
{
return true;
}
if(json flag set && alternate flag is set)
{
       JsonFormatter(current_tcp->outf, char buffer,sizeof buffer);
       clear buffer;
}
restart_tracee_with_sig_0:
sig = 0;



i guess , this will work
plz correct me if have mentioned anything wrong

thank you

Amish Mittal

waiting for your reply to start working on this idea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150415/fa2ac1de/attachment.html>


More information about the Strace-devel mailing list