unwind: refactor stacktrace_walk

* unwind.c (stacktrace_walk): Move stack frame printing code
to separate function print_stack_frame.
unwind: remove unused field from mmap_cache_t

* unwind.c (mmap_cache_t): Remove "deleted" field.
(build_mmap_cache): Remove initialization of "deleted" field.
unwind: cleanup build_mmap_cache

* unwind.c (build_mmap_cache): Move local variables to the code branch
where they are used.  Check return code of sscanf and strdup.  Do not
treat unusual memory mappings as fatal errors.  Do not skip memory
mappings with path names starting with "[".
unwind: ignore memory mappings that have no PROT_EXEC bit set

* unwind.c (build_mmap_cache): For each memory mapping being scanned,
save its PROT_EXEC bit and skip the mapping if it is not set.
tests: enhance -k test

Add two more function calls to the stack.  Suggested by Masatake YAMATO.

* tests/stack-fcall.c (f1): Rename to f3.
(f1, f2): New functions.
* tests/strace-k.test: Update.
tests: robustify -k test

Split stack-fcall.c into several compilation units so that intermediate
function calls would not be optimized out by compiler.

* tests/stack-fcall.c: Move intermediate functions to ...
* tests/stack-fcall-*.c: ... new files.
* tests/Makefile.am (stack_fcall_SOURCES): Add stack-fcall-*.c.
Document -k option as experimental

strace -k does not produce a reliable output on all supported
configurations yet, even basic strace-k.test is known to fail
on some of them.

* strace.c (usage): Document -k option as experimental.
* strace.1: Likewise.
* NEWS: Likewise.
xtensa: sort values in struct_user_offsets

Otherwise ptrace syscall argument decoding is wrong:
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x4048eb]) = 0
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x3fa6cd30]) = 0
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x8040676d]) = 0
instead of
  ptrace(PTRACE_PEEKUSER, 296, pc, [0x4048eb]) = 0
  ptrace(PTRACE_PEEKUSER, 296, a1, [0x3fa6cd30]) = 0
  ptrace(PTRACE_PEEKUSER, 296, a0, [0x8040676d]) = 0

* process.c (struct_user_offsets) [XTENSA]: Sort values.
JSON: Add -j option to print traced results in JSON format

The JSON format is used to make it more easy to parse the
trace results by other program. It is enabled by -j option.

* Makefile.am: Add json.c to compile list.
* strace.1: Add documents for -j option.
* strace.c(init, usage, tprintf, tprints, tvprintf): Add support
for the '-j' option. Modify tprintf() to use tvprintf(new function)
to use the hook framework, Modify tprints() to use the hook framework.
* defs.h: Add declarations for the hook framework of JSON output.
* json.c: New file. Implementation of the hook framework.
JSON: Add support to entering/exiting of syscall

Now the JSON output is one dict object each line, representing a
the enter/exit of a syscall. The dict object contain key filed
such as 'type', 'name', 'ret' of a syscall. All the value are string.

* syscall.c(trace_syscall_entering, trace_syscall_exiting): Modify to support
in JSON format.
* process.c(sys_exit): Modify to support in JSON format.
* strace.c(trace): Modify to support the last exited signal in JSON format.
JSON: Add basic support for syscalls in io.c

The basic means that all the arguments are simply wrapped in
a string value even for those complicated arguments printed by
specific functions such as printflags(). We need to do more work
to change those functions to be more like JSON-style.

* io.c(sys_read, sys_write, sys_readv, sys_writev,
sys_pread, sys_pwrite, sys_preadv, sys_pwritev,
sys_sendfile, sys_sendfile64, sys_tee, sys_splice,
sys_vmsplice, sys_ioctl): Modified to use the hook
framework to support printing in JSON format. Note: The
support of ioctl() is very limited and need to be improved.
JSON: Add basic test for JSON output

We will do 3 compare to check the output:
1) Compare the Unmodified strace output to the Normal outputs;
2) Compare the JSON parsed results to the Normal outputs(ignore space);
3) Compare the JSON parsed results to the Unmodified strace outputs(ignore space);

The 1st comparison should be identical to make sure we didn't break
the output content of strace.

The 2nd,3rd comparison may be different which remind us our implementation
need to be checked to see why we got this different.

Note: All the comparison may be different in some cases that the traced
results are random depending the runtime.

* test/json_io.c: New file. Test for syscalls in io.c .
* test/Makefile: Add json_io.c .
* test/.gitignore: Add json_io.
* test/json_parse.py: New file. Translate the JSON output to Normal
format using Python's json module.
* test/json_test.sh: New file. Generate the trace results, translate the
JSON output using json_parse.py and then make the comparison using diff.