Upgrade to strace 4.7.

* Changes in behavior
  * strace no longer suspends waitpid until there is a child
    for waitpid'ing process to collect status from.
  * strace no longer detaches from a tracee which is supposed
    to be going to die.
  * strace now issues a new message: "+++ exited with EXITCODE +++"
    which shows exact moment strace got exit notification,
    analogous to existing "+++ killed by SIG +++" message.

* Improvements
  * Added x32 personality support (x86_64 architecture).
  * Added -y and -P options to print file descriptor paths and
    filter by those paths.
  * Added -I option to control strace interactivity.
  * Allowed -p option to take comma or whitespace-separated list of PIDs.
  * Added strace_log_merge script helper to merge timestamped "strace -ff"
    log files.
  * Implemented decoding of clock_adjtime, get_robust_list, migrate_pages,
    preadv, prlimit64, process_vm_readv, process_vm_writev, pwritev,
    recvmmsg, recvmsg, rt_tgsigqueueinfo, sendmmsg, setns, set_robust_list,
    sched_rr_get_interval, splice, syslog, tee and vmsplice syscalls.
  * Enhanced decoding of capget, capset, getrlimit, flistxattr, io_submit,
    listxattr, setrlimit and swapon syscalls.
  * Implemented decoding of loop and mtd ioctls.
  * Added syscall entries for new linux syscalls.
  * Added syscall entries for direct socket system calls on powerpc.
  * Updated the list of errno constants.
  * Updated lists of MSG_*, STA_*, and TCP_* constants.
  * Regenerated the list of ioctl names from Linux 3.3.
  * Enhanced switching between processes with different personalities.
  * Enhanced signals reporting by using short signal names.
  * Made ERESTART* messages more descriptive.
  * Made parsing of numbers from strings more robust.
  * Added support for compat_statfs64 and statfs64.f_flags.
  * Changed read of data blocks to use single process_vm_readv syscall
    (when available) instead of several PTRACE_PEEKDATA operations.
  * Changed read of registers on x86 and x86-64 to use single PTRACE_GETREGS
    operation instead of several PTRACE_PEEKUSER operations.
  * Applied various optimizations to make strace work faster.

* Bug fixes
  * Implemented proper handling of real SIGTRAPs on kernels supporting
    PTRACE_O_TRACESYSGOOD.
    (Addresses Fedora bug #162774).
  * Fixed sockaddr_un.sun_path name in decoded output.
    (Addresses Debian bug #554946).
  * Fixed to avoid potential core file clobbering on exit.
    (Addresses Debian bug #656398).
  * Fixed a typo in documentation.
    (Addresses Debian bug #653309).
  * Fixed decoding of timer id returned by timer_create.
  * Fixed epoll_create1, epoll_wait and epoll_pwait decoding.
  * Fixed *at syscalls flags decoding.
  * Fixed ARM EABI 64-bit syscall's arguments decoding.
  * Fixed semtimedop decoding on s390.
  * Fixed osf_sigprocmask decoding on alpha.
  * Fixed ipc and socket subcall decoding on several architectures.
  * Corrected syscall entries for epoll_pwait, epoll_create, epoll_ctl,
    epoll_wait, mincore, mlockall, prctl, reboot, sendfile, sendfile64,
    sendmsg, sgetmask, ssetmask, swapon, tgkill and tkill syscalls.
  * Corrected io_* syscall entries on ARM.
  * Fixed PID prefix printing in "strace -oLOG -ff -p1 -p2 -p3" case.
  * Fixed logging of unfinished lines in "strace -oLOG -ff" case.
  * Fixed build when libaio-devel is not available.
  * Fixed configure checks for PTRACE_* constants.
  * Fixed compilation warnings remained on several architectures.

* Portability
  * Removed all non-Linux code.  After years of neglect, that dead code
    just hampered further strace development.
  * Linux kernel >= 2.6.18 is recommended.  Older versions might still
    work but they haven't been thoroughly tested with this release.

Change-Id: Ic2287760ba9f604ede83894670b8b382febf6099
diff --git a/Android.mk b/Android.mk
index 341f6f1..7682998 100644
--- a/Android.mk
+++ b/Android.mk
@@ -3,23 +3,47 @@
 LOCAL_PATH := $(my-dir)
 include $(CLEAR_VARS)
 
-# From autoconf-generated Makefile
-strace_SOURCES = strace.c syscall.c count.c util.c desc.c file.c ipc.c \
-                 io.c ioctl.c mem.c net.c process.c bjm.c quota.c \
-                 resource.c signal.c sock.c system.c term.c time.c \
-                 proc.c stream.c block.c
+strace_VERSION = 4.7
 
-#excluded_sources = scsi.c
-
-strace_VERSION = 4.6
-
-LOCAL_SRC_FILES:= $(strace_SOURCES)
+LOCAL_SRC_FILES := \
+    bjm.c \
+    block.c \
+    count.c \
+    desc.c \
+    file.c \
+    io.c \
+    ioctl.c \
+    ipc.c \
+    loop.c \
+    mem.c \
+    mtd.c \
+    net.c \
+    pathtrace.c \
+    proc.c \
+    process.c \
+    quota.c \
+    resource.c \
+    signal.c \
+    sock.c \
+    strace.c \
+    stream.c \
+    syscall.c \
+    system.c \
+    term.c \
+    time.c \
+    util.c \
 
 LOCAL_SHARED_LIBRARIES :=
 
 LOCAL_CFLAGS := -DLINUX=1 \
 	-DGETGROUPS_T=gid_t \
 	-DHAVE_ASM_SIGCONTEXT_H=1 \
+	-DHAVE_DECL_PTRACE_O_TRACECLONE=1 \
+	-DHAVE_DECL_PTRACE_O_TRACEEXEC=1 \
+	-DHAVE_DECL_PTRACE_O_TRACEEXIT=1 \
+	-DHAVE_DECL_PTRACE_O_TRACEFORK=1 \
+	-DHAVE_DECL_PTRACE_O_TRACESYSGOOD=1 \
+	-DHAVE_DECL_PTRACE_O_TRACEVFORK=1 \
 	-DHAVE_DECL_SYS_ERRLIST=1 \
 	-DHAVE_DECL_SYS_SIGLIST=1 \
 	-DHAVE_DECL_____PTRACE_EVENT_CLONE=1 \
@@ -45,6 +69,7 @@
 	-DHAVE_LINUX_IN6_H=1 \
 	-DHAVE_LINUX_NETLINK_H=1 \
 	-DHAVE_LINUX_UTSNAME_H=1 \
+	-DHAVE_LITTLE_ENDIAN_LONG_LONG=1 \
 	-DHAVE_LONG_LONG=1 \
 	-DHAVE_LONG_LONG_RLIM_T=1 \
 	-DHAVE_MEMORY_H=1 \
@@ -91,6 +116,7 @@
 	-DPACKAGE_TARNAME='"strace"' \
 	-DPACKAGE_VERSION='"$(strace_VERSION)"' \
 	-DRETSIGTYPE=void \
+	-DSIZEOF_RLIM_T=8 \
 	-DSTDC_HEADER=1 \
 	-DVERSION='"$(strace_VERSION)"' \
 	-D_GNU_SOURCE=1 \
@@ -98,7 +124,12 @@
 	-Dfopen64=fopen \
 	-Dd_fileno=d_ino \
 	-D_LFS64_LARGEFILE=1 \
-	-D__KERNEL__=1
+	-D__KERNEL__=1 \
+
+# bionic doesn't have fputs_unlocked.
+LOCAL_CFLAGS += -Dfputs_unlocked=fputs
+# uapi's asm/sigcontext.h doesn't have sigcontext_struct.
+LOCAL_CFLAGS += -Dsigcontext_struct=sigcontext
 
 #These are defined in AndroidConfig.h so we omit them above.
 #	-DHAVE_SYS_UIO_H=1 \
@@ -107,21 +138,22 @@
 
 arch := $(TARGET_ARCH)
 ifeq ($(TARGET_ARCH),arm)
-	LOCAL_CFLAGS += -DARM=1 -DHAVE_LITTLE_ENDIAN_LONG_LONG=1
+	LOCAL_CFLAGS += -DARM=1
 	LOCAL_CFLAGS += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
+else ifeq ($(TARGET_ARCH),mips)
+	LOCAL_CFLAGS += -DMIPS=1
+	LOCAL_CFLAGS += -DHAVE_ASM_SYSMIPS_H=1
+#	Mips does not use STRUCT__OLD_KERNEL_STAT type
 else ifeq ($(TARGET_ARCH),x86)
-	LOCAL_CFLAGS += -DI386=1 -DHAVE_LITTLE_ENDIAN_LONG_LONG=1
+	LOCAL_CFLAGS += -DI386=1
         LOCAL_CFLAGS += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
 	arch := i386
-else ifeq ($(TARGET_ARCH),sh)
-	LOCAL_CFLAGS += -DSH=1 -DHAVE_LITTLE_ENDIAN_LONG_LONG=1
-        LOCAL_CFLAGS += -DHAVE_STRUCT___OLD_KERNEL_STAT=1
-else ifeq ($(TARGET_ARCH),mips)
-	LOCAL_CFLAGS += -DMIPS=1 -DHAVE_LITTLE_ENDIAN_LONG_LONG=1
-#	Mips does not use STRUCT__OLD_KERNEL_STAT type
 endif
 
-LOCAL_CFLAGS += -Wno-missing-field-initializers
+LOCAL_CFLAGS += \
+    -Wno-missing-field-initializers \
+    -Wno-unused-parameter \
+    -Wno-sign-compare \
 
 LOCAL_C_INCLUDES := \
 	$(KERNEL_HEADERS) \
@@ -134,4 +166,6 @@
 
 LOCAL_MODULE_TAGS := debug
 
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
 include $(BUILD_EXECUTABLE)