Hi Dmitry, > > In this example, since va_list processing is easier and more efficient > than string parsing, I'd recommend > json_printf(JSON_ARG, JSON_SEP, 0L); > instead of > json_printf("arg sepa"); > > Also, when a function name ends with "printf", it is expected to take a > printf-style format string. If it doesn't, give it a different name. >
I'm working on the refactor as we discussed earlier, you can see the code in [1]. Once I finished the refactor I will clean and send the patches to the mailing list. I used a macro to add the 'JSON_LAST' automatically, and renamed json_event() to json_output_event: void json_output_event(json_type_event event, ...); #define json_event(...) json_output_event( __VA_ARGS__ , JSON_LAST) I also changed a lot of the inner implementation of json_output_event(), but this will not affect how to use it. I'm implementing the JSON support inside those detail-output functions(such as printfd()), so we could not care about how to use it, and just use it in normal way and it will then finish all the JSON output automatically. After this refactor, we can modify all sys_* functions like this one: int sys_read(struct tcb *tcp) { if (entering(tcp)) { printfd(tcp, tcp->u_arg[0]); tprints(", "); json_event(JSON_SEPA); } else { if (syserror(tcp)) { tprintf("%#lx", tcp->u_arg[1]); json_event(JSON_ERROR); } else printstr(tcp, tcp->u_arg[1], tcp->u_rval); tprintf(", %lu", tcp->u_arg[2]); json_event(JSON_SEPA, JSON_ARG); } return 0; } [1] https://github.com/zym0017d/strace_GSOC/commits/refactor Thank you! --- YangMin ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel