diff --git a/gdb-7.1.x/gdb/gdbserver/server.c b/gdb-7.1.x/gdb/gdbserver/server.c
index a03f877..c4214f9 100644
--- a/gdb-7.1.x/gdb/gdbserver/server.c
+++ b/gdb-7.1.x/gdb/gdbserver/server.c
@@ -76,12 +76,14 @@ pid_t old_foreground_pgrp;
 
 /* Hand back terminal ownership to the original foreground group.  */
 
+#ifndef __ANDROID__
 static void
 restore_old_foreground_pgrp (void)
 {
   tcsetpgrp (terminal_fd, old_foreground_pgrp);
 }
 #endif
+#endif
 
 /* Set if you want to disable optional thread related packets support
    in gdbserver, for the sake of testing GDB against stubs that don't
@@ -257,11 +259,13 @@ start_inferior (char **argv)
 #ifdef SIGTTOU
   signal (SIGTTOU, SIG_IGN);
   signal (SIGTTIN, SIG_IGN);
+#ifndef __ANDROID__
   terminal_fd = fileno (stderr);
   old_foreground_pgrp = tcgetpgrp (terminal_fd);
   tcsetpgrp (terminal_fd, signal_pid);
   atexit (restore_old_foreground_pgrp);
 #endif
+#endif
 
   if (wrapper_argv != NULL)
     {
diff --git a/gdb-7.3.x/gdb/gdbserver/config.in b/gdb-7.3.x/gdb/gdbserver/config.in
index 4882d80..62d2fe1 100644
--- a/gdb-7.3.x/gdb/gdbserver/config.in
+++ b/gdb-7.3.x/gdb/gdbserver/config.in
@@ -41,6 +41,12 @@
 /* Define to 1 if you have the `dladdr' function. */
 #undef HAVE_DLADDR
 
+/* Define to 1 if the system has the type `Elf32_auxv_t'. */
+#undef HAVE_ELF32_AUXV_T
+
+/* Define to 1 if the system has the type `Elf64_auxv_t'. */
+#undef HAVE_ELF64_AUXV_T
+
 /* Define if <sys/procfs.h> has elf_fpregset_t. */
 #undef HAVE_ELF_FPREGSET_T
 
@@ -257,6 +257,9 @@
    when building for Cygwin. */
 #undef USE_WIN32API
 
+/* Define to 1 if you have the <sys/un.h> header file. */
+#undef HAVE_SYS_UN_H
+
 /* Define if an XML target description is available. */
 #undef USE_XML
 
diff --git a/gdb-7.3.x/gdb/gdbserver/configure b/gdb-7.3.x/gdb/gdbserver/configure
index 110e406..0696030 100755
--- a/gdb-7.3.x/gdb/gdbserver/configure
+++ b/gdb-7.3.x/gdb/gdbserver/configure
@@ -587,6 +587,9 @@ ac_includes_default="\
 #endif
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
 #endif"
 
 ac_subst_vars='LTLIBOBJS
@@ -3994,7 +3997,7 @@ _ACEOF
 
 fi
 
-for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h thread_db.h linux/elf.h 		 stdlib.h unistd.h 		 errno.h fcntl.h signal.h sys/file.h malloc.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h sys/wait.h
+for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h 		 proc_service.h sys/procfs.h thread_db.h linux/elf.h 		 stdlib.h unistd.h 		 errno.h fcntl.h signal.h sys/file.h malloc.h 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h 		 netinet/tcp.h arpa/inet.h sys/wait.h sys/un.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -4319,6 +4319,30 @@ _ACEOF
 fi
 
 
+ac_fn_c_check_type "$LINENO" "Elf32_auxv_t" "ac_cv_type_Elf32_auxv_t" "#include <elf.h>
+
+"
+if test "x$ac_cv_type_Elf32_auxv_t" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ELF32_AUXV_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "Elf64_auxv_t" "ac_cv_type_Elf64_auxv_t" "#include <elf.h>
+
+"
+if test "x$ac_cv_type_Elf64_auxv_t" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ELF64_AUXV_T 1
+_ACEOF
+
+
+fi
+
+
 # Check whether --enable-googleisms was given.
 if test "${enable_googleisms+set}" = set; then :
   enableval=$enable_googleisms; case "${enableval}" in
diff --git a/gdb-7.3.x/gdb/gdbserver/configure.ac b/gdb-7.3.x/gdb/gdbserver/configure.ac
index c70f3cf..d78f267 100644
--- a/gdb-7.3.x/gdb/gdbserver/configure.ac
+++ b/gdb-7.3.x/gdb/gdbserver/configure.ac
@@ -42,7 +42,7 @@ AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
 		 stdlib.h unistd.h dnl
 		 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
 		 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
-		 netinet/tcp.h arpa/inet.h sys/wait.h)
+		 netinet/tcp.h arpa/inet.h sys/wait.h sys/un.h)
 AC_CHECK_FUNCS(pread pwrite pread64)
 AC_REPLACE_FUNCS(memmem vasprintf vsnprintf)
 
diff --git a/gdb-7.3.x/gdb/gdbserver/linux-low.c b/gdb-7.3.x/gdb/gdbserver/linux-low.c
index e65ec96..f91129f 100644
--- a/gdb-7.3.x/gdb/gdbserver/linux-low.c
+++ b/gdb-7.3.x/gdb/gdbserver/linux-low.c
@@ -110,6 +110,36 @@
 #endif
 #endif
 
+#ifndef HAVE_ELF32_AUXV_T
+/* Copied from glibc's elf.h.  */
+typedef struct
+{
+  uint32_t a_type;		/* Entry type */
+  union
+    {
+      uint32_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf32_auxv_t;
+#endif
+
+#ifndef HAVE_ELF64_AUXV_T
+/* Copied from glibc's elf.h.  */
+typedef struct
+{
+  uint64_t a_type;		/* Entry type */
+  union
+    {
+      uint64_t a_val;		/* Integer value */
+      /* We use to have pointer elements added here.  We cannot do that,
+	 though, since it does not work when using 32-bit definitions
+	 on 64-bit platforms and vice versa.  */
+    } a_un;
+} Elf64_auxv_t;
+#endif
+
 /* ``all_threads'' is keyed by the LWP ID, which we use as the GDB protocol
    representation of the thread ID.
 
@@ -3816,7 +3846,7 @@ regsets_fetch_inferior_registers (struct regcache *regcache)
 	data = buf;
 
 #ifndef __sparc__
-      res = ptrace (regset->get_request, pid, nt_type, data);
+      res = ptrace (regset->get_request, pid, (PTRACE_ARG3_TYPE)nt_type, data);
 #else
       res = ptrace (regset->get_request, pid, data, nt_type);
 #endif
@@ -3889,7 +3919,7 @@ regsets_store_inferior_registers (struct regcache *regcache)
 	data = buf;
 
 #ifndef __sparc__
-      res = ptrace (regset->get_request, pid, nt_type, data);
+      res = ptrace (regset->get_request, pid, (PTRACE_ARG3_TYPE)nt_type, data);
 #else
       res = ptrace (regset->get_request, pid, &iov, data);
 #endif
@@ -3901,7 +3931,7 @@ regsets_store_inferior_registers (struct regcache *regcache)
 
 	  /* Only now do we write the register set.  */
 #ifndef __sparc__
-	  res = ptrace (regset->set_request, pid, nt_type, data);
+	  res = ptrace (regset->set_request, pid, (PTRACE_ARG3_TYPE)nt_type, data);
 #else
 	  res = ptrace (regset->set_request, pid, data, nt_type);
 #endif
diff --git a/gdb-7.3.x/gdb/gdbserver/linux-x86-low.c b/gdb-7.3.x/gdb/gdbserver/linux-x86-low.c
index 69c6b57..cdc0a18 100644
--- a/gdb-7.3.x/gdb/gdbserver/linux-x86-low.c
+++ b/gdb-7.3.x/gdb/gdbserver/linux-x86-low.c
@@ -57,8 +57,13 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
 </target>";
 #endif
 
+#ifdef HAVE_SYS_REG_H
 #include <sys/reg.h>
+#endif
+#ifdef HAVE_SYS_PROCFS_H
 #include <sys/procfs.h>
+#endif
+
 #include <sys/ptrace.h>
 #include <sys/uio.h>
 
@@ -80,6 +85,9 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
 #define PTRACE_ARCH_PRCTL      30
 #endif
 
+#define PTRACE_ARG3_TYPE       void*
+#define PTRACE_ARG4_TYPE       void*
+
 /* The following definitions come from prctl.h, but may be absent
    for certain configurations.  */
 #ifndef ARCH_GET_FS
@@ -187,7 +195,7 @@ ps_get_thread_area (const struct ps_prochandle *ph,
     unsigned int desc[4];
 
     if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
-		(void *) (intptr_t) idx, (unsigned long) &desc) < 0)
+		(void *) (intptr_t) idx, (PTRACE_ARG4_TYPE) &desc) < 0)
       return PS_ERR;
 
     *(int *)base = desc[1];
@@ -233,7 +241,7 @@ x86_get_thread_area (int lwpid, CORE_ADDR *addr)
 
     if (ptrace (PTRACE_GET_THREAD_AREA,
 		lwpid_of (lwp),
-		(void *) (long) idx, (unsigned long) &desc) < 0)
+		(void *) (long) idx, (PTRACE_ARG4_TYPE) &desc) < 0)
       return -1;
 
     *addr = desc[1];
@@ -441,7 +449,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
 
   errno = 0;
   value = ptrace (PTRACE_PEEKUSER, tid,
-		  offsetof (struct user, u_debugreg[regnum]), 0);
+		  (PTRACE_ARG3_TYPE)offsetof (struct user, u_debugreg[regnum]), 0);
   if (errno != 0)
     error ("Couldn't read debug register");
 
@@ -457,7 +465,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
 
   errno = 0;
   ptrace (PTRACE_POKEUSER, tid,
-	  offsetof (struct user, u_debugreg[regnum]), value);
+	  (PTRACE_ARG3_TYPE)offsetof (struct user, u_debugreg[regnum]), (PTRACE_ARG4_TYPE)value);
   if (errno != 0)
     error ("Couldn't write debug register");
 }
@@ -963,7 +971,7 @@ x86_linux_update_xmltarget (void)
 	{
 	  elf_fpxregset_t fpxregs;
 
-	  if (ptrace (PTRACE_GETFPXREGS, pid, 0, (int) &fpxregs) < 0)
+	  if (ptrace (PTRACE_GETFPXREGS, pid, 0, (PTRACE_ARG4_TYPE) &fpxregs) < 0)
 	    {
 	      have_ptrace_getfpxregs = 0;
 	      x86_xcr0 = I386_XSTATE_X87_MASK;
@@ -1018,7 +1026,7 @@ x86_linux_update_xmltarget (void)
       iov.iov_len = sizeof (xstateregs);
 
       /* Check if PTRACE_GETREGSET works.  */
-      if (ptrace (PTRACE_GETREGSET, pid, (unsigned int) NT_X86_XSTATE,
+      if (ptrace (PTRACE_GETREGSET, pid, (PTRACE_ARG3_TYPE) NT_X86_XSTATE,
 		  &iov) < 0)
 	{
 	  have_ptrace_getregset = 0;
diff --git a/gdb-7.3.x/gdb/gdbserver/remote-utils.c b/gdb-7.3.x/gdb/gdbserver/remote-utils.c
index 02f13f4..3ce10f7 100644
--- a/gdb-7.3.x/gdb/gdbserver/remote-utils.c
+++ b/gdb-7.3.x/gdb/gdbserver/remote-utils.c
@@ -61,10 +61,12 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-
 #if USE_WIN32API
 #include <winsock2.h>
 #endif
+#if HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
 
 #if __QNX__
 #include <sys/iomgr.h>
@@ -240,6 +242,45 @@ remote_open (char *name)
 {
   char *port_str;
 
+#ifdef HAVE_SYS_UN_H
+  if (name[0] == '+')
+    {
+#ifdef USE_WIN32API
+      error ("Only <host>:<port> is supported on this platform.");
+#else
+      struct sockaddr_un sockaddr;
+      socklen_t sockaddrlen;
+
+      name += 1; // skip the initial +
+
+      listen_desc = socket (AF_UNIX, SOCK_STREAM, 0);
+      if (listen_desc < 0)
+        perror_with_name ("Could not create Unix-domain socket");
+
+      memset (&sockaddr, 0, sizeof sockaddr);
+      sockaddr.sun_family = AF_UNIX;
+      strlcpy(sockaddr.sun_path, name, sizeof sockaddr.sun_path);
+
+      unlink (sockaddr.sun_path);
+      sockaddrlen = sizeof(sockaddr.sun_family) + strlen(sockaddr.sun_path) + 1;
+      if (bind (listen_desc, (struct sockaddr *)&sockaddr, sockaddrlen) < 0)
+        perror_with_name ("Could not bind to Unix-domain socket");
+      if (listen (listen_desc, 1) < 0)
+        perror_with_name ("Could not listen to Unix-domain socket");
+
+      fprintf (stderr, "Listening on Unix socket %s\n", sockaddr.sun_path);
+      fflush (stderr);
+
+      /* Register the event loop handler.  */
+      add_file_handler (listen_desc, handle_accept_event, NULL);
+
+      transport_is_reliable = 1;
+#endif
+    }
+  else
+#endif /* HAVE_SYS_UN_H */
+  {
+
   port_str = strchr (name, ':');
 
   if (remote_connection_is_stdio (name))
@@ -392,6 +433,7 @@ remote_open (char *name)
 
       transport_is_reliable = 1;
     }
+  }
 }
 
 void
diff --git a/gdb-7.3.x/gdb/gdbserver/server.c b/gdb-7.3.x/gdb/gdbserver/server.c
index 5148dc8..9daceff 100644
--- a/gdb-7.3.x/gdb/gdbserver/server.c
+++ b/gdb-7.3.x/gdb/gdbserver/server.c
@@ -75,12 +75,14 @@ pid_t old_foreground_pgrp;
 
 /* Hand back terminal ownership to the original foreground group.  */
 
+#ifndef __ANDROID__
 static void
 restore_old_foreground_pgrp (void)
 {
-  tcsetpgrp (terminal_fd, old_foreground_pgrp);
+   tcsetpgrp (terminal_fd, old_foreground_pgrp);
 }
 #endif
+#endif
 
 /* Set if you want to disable optional thread related packets support
    in gdbserver, for the sake of testing GDB against stubs that don't
@@ -266,11 +268,13 @@ start_inferior (char **argv)
 #ifdef SIGTTOU
   signal (SIGTTOU, SIG_IGN);
   signal (SIGTTIN, SIG_IGN);
+#ifndef __ANDROID__
   terminal_fd = fileno (stderr);
   old_foreground_pgrp = tcgetpgrp (terminal_fd);
   tcsetpgrp (terminal_fd, signal_pid);
   atexit (restore_old_foreground_pgrp);
 #endif
+#endif
 
   if (wrapper_argv != NULL)
     {
diff --git a/gdb-7.3.x/gdb/gdbserver/thread-db.c b/gdb-7.3.x/gdb/gdbserver/thread-db.c
index 741c48b..3467b64 100644
--- a/gdb-7.3.x/gdb/gdbserver/thread-db.c
+++ b/gdb-7.3.x/gdb/gdbserver/thread-db.c
@@ -565,7 +565,7 @@ thread_db_load_search (void)
   tdb->td_symbol_list_p = &td_symbol_list;
 
   /* This is required only when thread_db_use_events is on.  */
-  tdb->td_thr_event_enable_p = &td_thr_event_enable;
+  tdb->td_thr_event_enable_p = (void*)&td_thr_event_enable;
 
   /* These are not essential.  */
   tdb->td_ta_event_addr_p = &td_ta_event_addr;
diff --git a/gdb-7.3.x/include/elf/common.h b/gdb-7.3.x/include/elf/common.h
index 52ce9a5..a01e40c 100644
--- a/gdb-7.3.x/include/elf/common.h
+++ b/gdb-7.3.x/include/elf/common.h
@@ -35,7 +35,9 @@
 /* Fields in e_ident[].  */
 
 #define EI_MAG0		0	/* File identification byte 0 index */
+#ifndef ELFMAG0
 #define ELFMAG0		   0x7F	/* Magic number byte 0 */
+#endif
 
 #define EI_MAG1		1	/* File identification byte 1 index */
 #define ELFMAG1		    'E'	/* Magic number byte 1 */
@@ -82,7 +84,9 @@
 
 #define EI_ABIVERSION	8	/* ABI version */
 
+#ifndef EI_PAD
 #define EI_PAD		9	/* Start of padding bytes */
+#endif
 
 
 /* Values for e_type, which identifies the object file type.  */
@@ -94,8 +98,12 @@
 #define ET_CORE		4	/* Core file */
 #define ET_LOOS		0xFE00	/* Operating system-specific */
 #define ET_HIOS		0xFEFF	/* Operating system-specific */
+#ifndef ET_LOPROC
 #define ET_LOPROC	0xFF00	/* Processor-specific */
+#endif
+#ifndef ET_HIPROC
 #define ET_HIPROC	0xFFFF	/* Processor-specific */
+#endif
 
 /* Values for e_machine, which identifies the architecture.  These numbers
    are officially assigned by registry@sco.com.  See below for a list of
@@ -370,7 +378,9 @@
 #define EM_CYGNUS_V850		0x9080
 
 /* old S/390 backend magic number. Written in the absence of an ABI.  */
+#ifndef EM_S390_OLD
 #define EM_S390_OLD		0xa390
+#endif
 
 /* Old, unofficial value for Xtensa.  */
 #define EM_XTENSA_OLD		0xabc7
@@ -423,18 +433,28 @@
 #define PT_LOOS		0x60000000	/* OS-specific */
 #define PT_HIOS		0x6fffffff	/* OS-specific */
 #define PT_LOPROC	0x70000000	/* Processor-specific */
+#ifndef PT_HIPROC
 #define PT_HIPROC	0x7FFFFFFF	/* Processor-specific */
+#endif
 
+#ifndef PT_GNU_EH_FRAME
 #define PT_GNU_EH_FRAME	(PT_LOOS + 0x474e550) /* Frame unwind information */
+#endif
 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
 #define PT_GNU_STACK	(PT_LOOS + 0x474e551) /* Stack flags */
 #define PT_GNU_RELRO	(PT_LOOS + 0x474e552) /* Read-only after relocation */
 
 /* Program segment permissions, in program header p_flags field.  */
 
+#ifndef PF_X
 #define PF_X		(1 << 0)	/* Segment is executable */
+#endif
+#ifndef PF_W
 #define PF_W		(1 << 1)	/* Segment is writable */
+#endif
+#ifndef PF_R
 #define PF_R		(1 << 2)	/* Segment is readable */
+#endif
 /* #define PF_MASKOS	0x0F000000    *//* OS-specific reserved bits */
 #define PF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
 #define PF_MASKPROC	0xF0000000	/* Processor-specific reserved bits */
@@ -480,16 +500,26 @@
 #define SHT_GNU_versym	SHT_SUNW_versym
 
 #define SHT_LOPROC	0x70000000	/* Processor-specific semantics, lo */
+#ifndef SHT_HIPROC
 #define SHT_HIPROC	0x7FFFFFFF	/* Processor-specific semantics, hi */
+#endif
 #define SHT_LOUSER	0x80000000	/* Application-specific semantics */
 /* #define SHT_HIUSER	0x8FFFFFFF    *//* Application-specific semantics */
+#ifndef SHT_HIUSER
 #define SHT_HIUSER	0xFFFFFFFF	/* New value, defined in Oct 4, 1999 Draft */
+#endif
 
 /* Values for section header, sh_flags field.  */
 
+#ifndef SHF_WRITE
 #define SHF_WRITE	(1 << 0)	/* Writable data during execution */
+#endif
+#ifndef SHF_ALLOC
 #define SHF_ALLOC	(1 << 1)	/* Occupies memory during execution */
+#endif
+#ifndef SHF_EXECINSTR
 #define SHF_EXECINSTR	(1 << 2)	/* Executable machine instructions */
+#endif
 #define SHF_MERGE	(1 << 4)	/* Data in this section can be merged */
 #define SHF_STRINGS	(1 << 5)	/* Contains null terminated character strings */
 #define SHF_INFO_LINK	(1 << 6)	/* sh_info holds section header table index */
@@ -500,7 +530,9 @@
 
 /* #define SHF_MASKOS	0x0F000000    *//* OS-specific semantics */
 #define SHF_MASKOS	0x0FF00000	/* New value, Oct 4, 1999 Draft */
+#ifndef SHF_MASKPROC
 #define SHF_MASKPROC	0xF0000000	/* Processor-specific semantics */
+#endif
 
 /* This used to be implemented as a processor specific section flag.
    We just make it generic.  */
@@ -607,17 +639,29 @@
    which contains the symbol binding and symbol type.  The STB_ and STT_
    defines identify the binding and type.  */
 
+#ifndef ELF_ST_BIND
 #define ELF_ST_BIND(val)		(((unsigned int)(val)) >> 4)
+#endif
+#ifndef ELF_ST_TYPE
 #define ELF_ST_TYPE(val)		((val) & 0xF)
+#endif
 #define ELF_ST_INFO(bind,type)		(((bind) << 4) + ((type) & 0xF))
 
 /* The 64bit and 32bit versions of these macros are identical, but
    the ELF spec defines them, so here they are.  */
+#ifndef ELF32_ST_BIND
 #define ELF32_ST_BIND  ELF_ST_BIND
+#endif
+#ifndef ELF32_ST_TYPE
 #define ELF32_ST_TYPE  ELF_ST_TYPE
+#endif
 #define ELF32_ST_INFO  ELF_ST_INFO
+#ifndef ELF64_ST_BIND
 #define ELF64_ST_BIND  ELF_ST_BIND
+#endif
+#ifndef ELF64_ST_TYPE
 #define ELF64_ST_TYPE  ELF_ST_TYPE
+#endif
 #define ELF64_ST_INFO  ELF_ST_INFO
 
 /* This macro disassembles and assembles a symbol's visibility into
@@ -667,8 +711,12 @@
 
 /* Relocation info handling macros.  */
 
+#ifndef ELF32_R_SYM
 #define ELF32_R_SYM(i)		((i) >> 8)
+#endif
+#ifndef ELF32_R_TYPE
 #define ELF32_R_TYPE(i)		((i) & 0xff)
+#endif
 #define ELF32_R_INFO(s,t)	(((s) << 8) + ((t) & 0xff))
 
 #define ELF64_R_SYM(i)		((i) >> 32)