Decode paths associated with file descriptors returned by syscalls

* defs.h (RVAL_FD): New macro.
(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
* desc.c (sys_dup, sys_delete_module): New functions.
(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
* linux/dummy.h (sys_delete_module, sys_dup): Remove.
* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
* syscall.c (trace_syscall_exiting): Handle RVAL_FD.

Signed-off-by: Zubin Mithra <zubin.mithra@gmail.com>
Fix delete_module decoding

* xlat/delete_module_flags.in: New file.
* file.c (sys_delete_module): Move ...
* bjm.c (sys_delete_module): ... to here.
Decode 1st argument using printstr instead of printpath.
* NEWS: Mention it.
tests: robustify -w option test

* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.
unwind: fix build on 32-bit architectures

Fix compilation warnings in unwind.c on 32-bit architectures.
On some architectures getuid is actually getuid32, so change the test
to use getpid instead of getuid.

* unwind.c (STACK_ENTRY_SYMBOL_FMT): Explicitly cast function_off_set
to unsigned long.
(queue_put_error): Change the 3rd argument's type to unsigned long.
* tests/stack-fcall.c (f1): Use getpid instead of getuid.
* tests/strace-k.test: Likewise.
unwind: use fopen64 instead of fopen

* unwind.c (fopen_for_input): Define to fopen64 iff
[_LARGEFILE64_SOURCE && HAVE_FOPEN64], otherwise define it to fopen.
(build_mmap_cache): Use fopen_for_input instead of fopen.
unwind: fix a bug in range updating of binary search

* unwind.c (print_stacktrace): Fix another off-by-one error in binary search.
unwind: rename function_off_set to function_offset

* unwind.c (call_action_fn, stacktrace_walk, STACK_ENTRY_SYMBOL_FMT,
print_call_cb, sprint_call_or_error, queue_put, queue_put_call):
Rename function_off_set to function_offset.
unwind: disable stack trace with multiple personalities

* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
unwind_capture_stacktrace): Disable stack tracing of non-default
personality processes.
unwind: constify binary_filename and symbol_name functions arguments

* unwind.c (call_action_fn, print_call_cb, sprint_call_or_error,
queue_put, queue_put_call): Add const qualifier to binary_filename and
symbol_name arguments.
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.