From bf7c7531e54e2f1b995e7ba52213c1df585d7fcc Mon Sep 17 00:00:00 2001
From: Mahesh Bodapati <mbodapat@xilinx.com>
Date: Mon, 23 Jan 2017 19:07:44 +0530
Subject: [PATCH 33/38] Add initial port of linux gdbserver add
 gdb_proc_service_h to gdbserver microblaze-linux

gdbserver needs to initialise the microblaze registers

other archs use this step to run a *_arch_setup() to carry out all
architecture specific setup - may need to add in future

 * add linux-ptrace.o to gdbserver configure
 * Update breakpoint opcode
 * fix segfault on connecting gdbserver
 * add microblaze_linux_memory_remove_breakpoint
 * add set_solib_svr4_fetch_link_map_offsets
 * add set_gdbarch_fetch_tls_load_module_address
 * Force reading of r0 as 0, prevent stores

Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>

Conflicts:
	gdb/gdbserver/Makefile.in
	gdb/gdbserver/configure.srv
---
 gdb/configure.host                   |   3 +
 gdb/features/microblaze-linux.xml    |  12 +
 gdb/gdbserver/Makefile.in            | 712 +++++++++++++++++++++++++++
 gdb/gdbserver/configure.srv          | 398 +++++++++++++++
 gdb/gdbserver/linux-microblaze-low.c | 189 +++++++
 gdb/microblaze-linux-tdep.c          |  29 +-
 gdb/microblaze-tdep.c                |  35 +-
 gdb/microblaze-tdep.h                |   4 +-
 gdb/regformats/reg-microblaze.dat    |  41 ++
 9 files changed, 1420 insertions(+), 3 deletions(-)
 create mode 100644 gdb/features/microblaze-linux.xml
 create mode 100644 gdb/gdbserver/Makefile.in
 create mode 100644 gdb/gdbserver/configure.srv
 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
 create mode 100644 gdb/regformats/reg-microblaze.dat

diff --git a/gdb/configure.host b/gdb/configure.host
index e94a19b0332..4d73af78bc3 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -66,6 +66,7 @@ hppa*)			gdb_host_cpu=pa ;;
 i[34567]86*)		gdb_host_cpu=i386 ;;
 m68*)			gdb_host_cpu=m68k ;;
 mips*)			gdb_host_cpu=mips ;;
+microblaze*)		gdb_host_cpu=microblaze ;;
 powerpc* | rs6000)	gdb_host_cpu=powerpc ;;
 sparcv9 | sparc64)	gdb_host_cpu=sparc ;;
 s390*)			gdb_host_cpu=s390 ;;
@@ -136,6 +137,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
 mips*-*-freebsd*)	gdb_host=fbsd ;;
 mips64*-*-openbsd*)	gdb_host=obsd64 ;;
 
+microblaze*-*linux*)	gdb_host=linux ;;
+
 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
 			gdb_host=aix ;;
 powerpc*-*-freebsd*)	gdb_host=fbsd ;;
diff --git a/gdb/features/microblaze-linux.xml b/gdb/features/microblaze-linux.xml
new file mode 100644
index 00000000000..8983e66eb3d
--- /dev/null
+++ b/gdb/features/microblaze-linux.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE target SYSTEM "gdb-target.dtd">
+<target>
+  <osabi>GNU/Linux</osabi>
+  <xi:include href="microblaze-core.xml"/>
+</target>
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
new file mode 100644
index 00000000000..fb4762a22d5
--- /dev/null
+++ b/gdb/gdbserver/Makefile.in
@@ -0,0 +1,712 @@
+# Copyright (C) 1989-2020 Free Software Foundation, Inc.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please keep lists in this file sorted alphabetically, with one item per line.
+# See gdb/Makefile.in for guidelines on ordering files and directories.
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+host_alias = @host_noncanonical@
+target_alias = @target_noncanonical@
+program_transform_name = @program_transform_name@
+bindir = @bindir@
+libdir = @libdir@
+tooldir = $(libdir)/$(target_alias)
+
+datarootdir = @datarootdir@
+datadir = @datadir@
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+man9dir = $(mandir)/man9
+infodir = @infodir@
+htmldir = $(prefix)/html
+includedir = @includedir@
+CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
+
+SHELL = @SHELL@
+EXEEXT = @EXEEXT@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+RANLIB = @RANLIB@
+
+CC = @CC@
+CXX = @CXX@
+CXX_DIALECT = @CXX_DIALECT@
+AR = @AR@
+AR_FLAGS = rc
+
+# Dependency tracking information.
+DEPMODE = @CCDEPMODE@
+DEPDIR = @DEPDIR@
+depcomp = $(SHELL) $(srcdir)/../../depcomp
+
+# Directory containing source files.  Don't clean up the spacing,
+# this exact string is matched for by the "configure" script.
+srcdir = @srcdir@
+abs_top_srcdir = @abs_top_srcdir@
+abs_srcdir = @abs_srcdir@
+VPATH = @srcdir@
+
+include $(srcdir)/../silent-rules.mk
+
+# Note that these are overridden by GNU make-specific code below if
+# GNU make is used.  The overrides implement dependency tracking.
+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
+COMPILE.post = -c -o $@
+COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
+POSTCOMPILE = @true
+
+# It is also possible that you will need to add -I/usr/include/sys to the
+# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
+# is where it should be according to Posix).
+
+# Set this up with gcc if you have gnu ld and the loader will print out
+# line numbers for undefinded refs.
+#CC_LD = g++ -static
+CC_LD = $(CXX) $(CXX_DIALECT)
+
+# Where is the "include" directory?  Traditionally ../include or ./include
+INCLUDE_DIR = ${srcdir}/../../include
+INCLUDE_DEP = $$(INCLUDE_DIR)
+
+LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
+LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a
+
+# Where is ust?  These will be empty if ust was not available.
+ustlibs = @ustlibs@
+ustinc = @ustinc@
+
+# gnulib
+GNULIB_BUILDDIR = build-gnulib-gdbserver
+LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
+INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
+
+# Generated headers in the gnulib directory.  These must be listed
+# so that they are generated before other files are compiled.
+GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
+
+# All the includes used for CFLAGS and for lint.
+# -I. for config files.
+# -I${srcdir} for our headers.
+# -I$(srcdir)/../regformats for regdef.h.
+#
+# We do not include ../target or ../nat in here because headers
+# in those directories should be included with the subdirectory.
+# e.g.: "target/wait.h".
+#
+INCLUDE_CFLAGS = -I. -I${srcdir} \
+	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
+	$(INCGNU)
+
+# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
+# from the config/ directory.
+GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS}
+#PROFILE_CFLAGS = -pg
+
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
+
+WARN_CFLAGS_NO_FORMAT = `echo " $(WARN_CFLAGS) " \
+		   | sed "s/ -Wformat-nonliteral / -Wno-format-nonliteral /g"`
+
+# These are specifically reserved for setting from the command line
+# when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
+CFLAGS = @CFLAGS@
+CXXFLAGS = @CXXFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+
+# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
+INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
+	${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
+INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
+
+# LDFLAGS is specifically reserved for setting from the command line
+# when running make.
+LDFLAGS = @LDFLAGS@
+INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
+
+# All source files that go into linking GDB remote server.
+
+SFILES = \
+	$(srcdir)/debug.c \
+	$(srcdir)/dll.c \
+	$(srcdir)/gdbreplay.c \
+	$(srcdir)/hostio.c \
+	$(srcdir)/hostio-errno.c \
+	$(srcdir)/i387-fp.c \
+	$(srcdir)/inferiors.c \
+	$(srcdir)/linux-aarch64-low.c \
+	$(srcdir)/linux-arm-low.c \
+	$(srcdir)/linux-bfin-low.c \
+	$(srcdir)/linux-cris-low.c \
+	$(srcdir)/linux-crisv32-low.c \
+	$(srcdir)/linux-ia64-low.c \
+	$(srcdir)/linux-low.c \
+	$(srcdir)/linux-m32r-low.c \
+	$(srcdir)/linux-m68k-low.c \
+	$(srcdir)/linux-microblaze-low.c \
+	$(srcdir)/linux-mips-low.c \
+	$(srcdir)/linux-nios2-low.c \
+	$(srcdir)/linux-ppc-low.c \
+	$(srcdir)/linux-s390-low.c \
+	$(srcdir)/linux-sh-low.c \
+	$(srcdir)/linux-sparc-low.c \
+	$(srcdir)/linux-tile-low.c \
+	$(srcdir)/linux-x86-low.c \
+	$(srcdir)/linux-xtensa-low.c \
+	$(srcdir)/mem-break.c \
+	$(srcdir)/proc-service.c \
+	$(srcdir)/proc-service.list \
+	$(srcdir)/regcache.c \
+	$(srcdir)/remote-utils.c \
+	$(srcdir)/server.c \
+	$(srcdir)/symbol.c \
+	$(srcdir)/target.c \
+	$(srcdir)/thread-db.c \
+	$(srcdir)/utils.c \
+	$(srcdir)/win32-arm-low.c \
+	$(srcdir)/win32-i386-low.c \
+	$(srcdir)/win32-low.c \
+	$(srcdir)/wincecompat.c \
+	$(srcdir)/x86-low.c \
+	$(srcdir)/arch/arm.c \
+	$(srcdir)/arch/arm-get-next-pcs.c \
+	$(srcdir)/arch/arm-linux.c \
+	$(srcdir)/arch/ppc-linux-common.c \
+	$(srcdir)/../alloc.c \
+	$(srcdir)/gdbsupport/btrace-common.c \
+	$(srcdir)/gdbsupport/buffer.c \
+	$(srcdir)/gdbsupport/cleanups.c \
+	$(srcdir)/gdbsupport/common-debug.c \
+	$(srcdir)/gdbsupport/common-exceptions.c \
+	$(srcdir)/gdbsupport/common-inferior.c \
+	$(srcdir)/gdbsupport/common-regcache.c \
+	$(srcdir)/gdbsupport/common-utils.c \
+	$(srcdir)/gdbsupport/errors.c \
+	$(srcdir)/gdbsupport/environ.c \
+	$(srcdir)/gdbsupport/fileio.c \
+	$(srcdir)/gdbsupport/filestuff.c \
+	$(srcdir)/gdbsupport/job-control.c \
+	$(srcdir)/gdbsupport/gdb-dlfcn.c \
+	$(srcdir)/gdbsupport/gdb_tilde_expand.c \
+	$(srcdir)/gdbsupport/gdb_vecs.c \
+	$(srcdir)/gdbsupport/netstuff.c \
+	$(srcdir)/gdbsupport/new-op.c \
+	$(srcdir)/gdbsupport/pathstuff.c \
+	$(srcdir)/gdbsupport/print-utils.c \
+	$(srcdir)/gdbsupport/ptid.c \
+	$(srcdir)/gdbsupport/rsp-low.c \
+	$(srcdir)/gdbsupport/safe-strerror.c \
+	$(srcdir)/gdbsupport/tdesc.c \
+	$(srcdir)/gdbsupport/xml-utils.c \
+	$(srcdir)/nat/aarch64-sve-linux-ptrace.c \
+	$(srcdir)/nat/linux-btrace.c \
+	$(srcdir)/nat/linux-namespaces.c \
+	$(srcdir)/nat/linux-osdata.c \
+	$(srcdir)/nat/linux-personality.c \
+	$(srcdir)/nat/microblaze-linux.c \
+	$(srcdir)/nat/mips-linux-watch.c \
+	$(srcdir)/nat/ppc-linux.c \
+	$(srcdir)/nat/fork-inferior.c \
+	$(srcdir)/target/waitstatus.c
+
+DEPFILES = @GDBSERVER_DEPFILES@
+
+LIBOBJS = @LIBOBJS@
+
+SOURCES = $(SFILES)
+TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
+
+OBS = \
+	alloc.o \
+	ax.o \
+	gdbsupport/agent.o \
+	gdbsupport/btrace-common.o \
+	gdbsupport/buffer.o \
+	gdbsupport/cleanups.o \
+	gdbsupport/common-debug.o \
+	gdbsupport/common-exceptions.o \
+	gdbsupport/common-inferior.o \
+	gdbsupport/job-control.o \
+	gdbsupport/common-regcache.o \
+	gdbsupport/common-utils.o \
+	gdbsupport/errors.o \
+	gdbsupport/environ.o \
+	gdbsupport/fileio.o \
+	gdbsupport/filestuff.o \
+	gdbsupport/format.o \
+	gdbsupport/gdb-dlfcn.o \
+	gdbsupport/gdb_tilde_expand.o \
+	gdbsupport/gdb_vecs.o \
+	gdbsupport/netstuff.o \
+	gdbsupport/new-op.o \
+	gdbsupport/pathstuff.o \
+	gdbsupport/print-utils.o \
+	gdbsupport/ptid.o \
+	gdbsupport/rsp-low.o \
+	gdbsupport/safe-strerror.o \
+	gdbsupport/signals.o \
+	gdbsupport/signals-state-save-restore.o \
+	gdbsupport/tdesc.o \
+	gdbsupport/xml-utils.o \
+	debug.o \
+	dll.o \
+	event-loop.o \
+	hostio.o \
+	inferiors.o \
+	mem-break.o \
+	notif.o \
+	regcache.o \
+	remote-utils.o \
+	server.o \
+	symbol.o \
+	target.o \
+	tdesc.o \
+	tracepoint.o \
+	utils.o \
+	version.o \
+	waitstatus.o \
+	$(DEPFILES) \
+	$(LIBOBJS) \
+	$(XML_BUILTIN)
+
+GDBREPLAY_OBS = \
+	gdbsupport/cleanups.o \
+	gdbsupport/common-exceptions.o \
+	gdbsupport/common-utils.o \
+	gdbsupport/rsp-low.o \
+	gdbsupport/errors.o \
+	gdbsupport/netstuff.o \
+	gdbsupport/print-utils.o \
+	gdbsupport/safe-strerror.o \
+	gdbreplay.o \
+	utils.o \
+	version.o
+
+GDBSERVER_LIBS = @GDBSERVER_LIBS@ $(PTHREAD_LIBS)
+XM_CLIBS = @LIBS@
+CDEPS = $(srcdir)/proc-service.list
+
+# XML files to compile in to gdbserver, if any.
+XML_DIR = $(srcdir)/../features
+XML_FILES = @srv_xmlfiles@
+XML_BUILTIN = @srv_xmlbuiltin@
+
+IPA_DEPFILES = @IPA_DEPFILES@
+extra_libraries = @extra_libraries@
+
+SUBDIRS = $(GNULIB_BUILDDIR) $(LIBIBERTY_BUILDDIR)
+CLEANDIRS = $(SUBDIRS)
+
+# List of subdirectories in the build tree that must exist.
+# This is used to force build failures in existing trees when
+# a new directory is added.
+# The format here is for the `case' shell command.
+REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR) | $(LIBIBERTY_BUILDDIR)
+
+FLAGS_TO_PASS = \
+	"prefix=$(prefix)" \
+	"exec_prefix=$(exec_prefix)" \
+	"infodir=$(infodir)" \
+	"datarootdir=$(datarootdir)" \
+	"docdir=$(docdir)" \
+	"htmldir=$(htmldir)" \
+	"pdfdir=$(pdfdir)" \
+	"libdir=$(libdir)" \
+	"mandir=$(mandir)" \
+	"datadir=$(datadir)" \
+	"includedir=$(includedir)" \
+	"against=$(against)" \
+	"DESTDIR=$(DESTDIR)" \
+	"AR=$(AR)" \
+	"AR_FLAGS=$(AR_FLAGS)" \
+	"CC=$(CC)" \
+	"CFLAGS=$(CFLAGS)" \
+	"CXX=$(CXX)" \
+	"CXXFLAGS=$(CXXFLAGS)" \
+	"DLLTOOL=$(DLLTOOL)" \
+	"LDFLAGS=$(LDFLAGS)" \
+	"RANLIB=$(RANLIB)" \
+	"MAKEINFO=$(MAKEINFO)" \
+	"MAKEHTML=$(MAKEHTML)" \
+	"MAKEHTMLFLAGS=$(MAKEHTMLFLAGS)" \
+	"INSTALL=$(INSTALL)" \
+	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
+	"INSTALL_DATA=$(INSTALL_DATA)" \
+	"RUNTEST=$(RUNTEST)" \
+	"RUNTESTFLAGS=$(RUNTESTFLAGS)"
+
+# All generated files which can be included by another file.
+generated_files = config.h $(GNULIB_H)
+
+all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT) $(extra_libraries)
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+# Traditionally "install" depends on "all".  But it may be useful
+# not to; for example, if the user has made some trivial change to a
+# source file and doesn't care about rebuilding or just wants to save the
+# time it takes for make to check that all is up to date.
+# install-only is intended to address that need.
+install: all
+	@$(MAKE) $(FLAGS_TO_PASS) install-only
+
+install-only:
+	n=`echo gdbserver | sed '$(program_transform_name)'`; \
+	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
+	if [ x"$(IPA_DEPFILES)" != x ]; then \
+		$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
+		$(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
+	fi; \
+	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
+	$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
+	# Note that we run install and not install-only, as the latter
+	# is not part of GNU standards and in particular not provided
+	# in libiberty.
+	@$(MAKE) $(FLAGS_TO_PASS) DO=install "DODIRS=$(SUBDIRS)" subdir_do
+
+uninstall: force
+	n=`echo gdbserver | sed '$(program_transform_name)'`; \
+	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
+	rm -f $(DESTDIR)/$(bindir)/$$n$(EXEEXT) $(DESTDIR)$(man1dir)/$$n.1
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+installcheck:
+check:
+info dvi pdf:
+install-info:
+install-pdf:
+html:
+install-html:
+clean-info: force
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY)
+	$(SILENCE) rm -f gdbserver$(EXEEXT)
+	$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
+		-o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \
+		$(GDBSERVER_LIBS) $(XM_CLIBS)
+
+$(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib
+all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
+	@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS="$(SUBDIRS)" subdir_do
+.PHONY: all-lib
+
+gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY)
+	$(SILENCE) rm -f gdbreplay$(EXEEXT)
+	$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
+		-o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) $(LIBGNU) \
+		$(LIBIBERTY)
+
+IPA_OBJS = \
+	alloc-ipa.o \
+	ax-ipa.o \
+	gdbsupport/common-utils-ipa.o \
+	gdbsupport/errors-ipa.o \
+	gdbsupport/format-ipa.o \
+	gdbsupport/print-utils-ipa.o \
+	gdbsupport/rsp-low-ipa.o \
+	gdbsupport/safe-strerror-ipa.o \
+	gdbsupport/tdesc-ipa.o \
+	regcache-ipa.o \
+	remote-utils-ipa.o \
+	tdesc-ipa.o \
+	tracepoint-ipa.o \
+	utils-ipa.o \
+	${IPA_DEPFILES}
+
+IPA_LIB = libinproctrace.so
+
+$(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS}
+	$(SILENCE) rm -f $(IPA_LIB)
+	$(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \
+		-Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \
+		-o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread
+
+# Put the proper machine-specific files first, so M-. on a machine
+# specific routine gets the one for the correct machine.
+# The xyzzy stuff below deals with empty DEPFILES
+TAGS:	${TAGFILES}
+	etags `find ${srcdir}/../config -name $(DEPRECATED_TM_FILE) -print` \
+	  `find ${srcdir}/../config -name ${XM_FILE} -print` \
+	  `find ${srcdir}/../config -name ${NAT_FILE} -print` \
+	  `for i in yzzy ${DEPFILES}; do \
+	     if [ x$$i != xyzzy ]; then \
+	       echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \
+	     fi; \
+	   done` \
+	  ${TAGFILES}
+tags: TAGS
+
+clean:
+	rm -f *.o ${ADD_FILES} *~
+	rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log
+	rm -f $(IPA_LIB)
+	rm -f *-generated.c
+	rm -f stamp-xml
+	rm -f $(DEPDIR)/*.Po
+	for i in $(CONFIG_SRC_SUBDIR); do \
+		rm -f $$i/*.o;	\
+		rm -f $$i/$(DEPDIR)/*; \
+	done
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+
+maintainer-clean realclean distclean: clean
+	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
+	rm -rf $(GNULIB_BUILDDIR)
+	rm -f Makefile config.status config.h stamp-h config.log
+	rm -f Makefile
+	for i in $(CONFIG_SRC_SUBDIR); do \
+		rmdir $$i/$(DEPDIR); \
+	done
+
+subdir_do: force
+	@for i in $(DODIRS); do \
+		case $$i in \
+		$(REQUIRED_SUBDIRS)) \
+			if [ ! -f ./$$i/Makefile ] ; then \
+				echo "Missing $$i/Makefile" >&2 ; \
+				exit 1 ; \
+			fi ;; \
+		esac ; \
+		if [ -f ./$$i/Makefile ] ; then \
+			if (cd ./$$i; \
+				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
+			else exit 1 ; fi ; \
+		else true ; fi ; \
+	done
+
+config.h: stamp-h ; @true
+stamp-h: config.in config.status
+	$(SHELL) ./config.status config.h
+
+Makefile: Makefile.in config.status
+	$(SHELL) ./config.status $@
+
+$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../../gnulib/Makefile.in config.status
+	  @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
+	  CONFIG_COMMANDS="depfiles" \
+	  CONFIG_HEADERS= \
+	  CONFIG_LINKS= \
+	  $(SHELL) config.status
+
+config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
+	$(SHELL) ./config.status --recheck
+
+# automatic rebuilding in automake-generated Makefiles requires
+# this rule in the toplevel Makefile, which, with GNU make, causes
+# the desired updates through the implicit regeneration of the Makefile
+# and all of its prerequisites.
+am--refresh:
+	@:
+
+force:
+
+version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/.. \
+		$(host_alias) $(target_alias) $@
+
+xml-builtin-generated.c: stamp-xml; @true
+stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
+	$(SILENCE) rm -f xml-builtin.tmp
+	$(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
+		xml-builtin.tmp $(XML_FILES)
+	$(SILENCE) $(SHELL) $(srcdir)/../../move-if-change xml-builtin.tmp xml-builtin-generated.c
+	$(SILENCE) echo stamp > stamp-xml
+
+.PRECIOUS: xml-builtin.c
+
+# GNU Make has an annoying habit of putting *all* the Makefile variables
+# into the environment, unless you include this target as a circumvention.
+# Rumor is that this will be fixed (and this target can be removed)
+# in GNU Make 4.0.
+.NOEXPORT:
+
+# GNU Make 3.63 has a different problem: it keeps tacking command line
+# overrides onto the definition of $(MAKE).  This variable setting
+# will remove them.
+MAKEOVERRIDES =
+
+regdat_sh = $(srcdir)/../regformats/regdat.sh
+
+UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
+
+# Undo gnulib replacements for the IPA shared library build.
+# The gnulib headers are still needed, but gnulib is not linked
+# into the IPA lib so replacement apis don't work.
+UNDO_GNULIB_CFLAGS = -Drpl_strerror_r=strerror_r
+
+# Note, we only build the IPA if -fvisibility=hidden is supported in
+# the first place.
+IPAGENT_CFLAGS = $(INTERNAL_CFLAGS) $(UST_CFLAGS) \
+	$(UNDO_GNULIB_CFLAGS) \
+	-fPIC -DIN_PROCESS_AGENT \
+	-fvisibility=hidden
+
+IPAGENT_COMPILE = $(ECHO_CXX) $(COMPILE.pre) $(IPAGENT_CFLAGS) $(COMPILE.post)
+
+# Rules for special cases.
+
+ax-ipa.o: ax.c
+	$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
+	$(POSTCOMPILE)
+
+ax.o: ax.c
+	$(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
+	$(POSTCOMPILE)
+
+alloc-ipa.o: ../alloc.c
+	$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
+	$(POSTCOMPILE)
+
+# Rules for objects that go in the in-process agent.
+
+arch/%-ipa.o: ../arch/%.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
+gdbsupport/%-ipa.o: ../gdbsupport/%.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
+%-ipa.o: %-generated.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
+%-ipa.o: %.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
+# Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one.
+# Therefore, this one needs to be before "%.o: %.c" for it to be considered for
+# files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c.
+#
+# Later versions of GNU Make choose the rule with the shortest stem, so it would
+# work in any order.
+
+%-ipa.o: %-ipa.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
+# Rules for objects that go in the gdbserver binary.
+
+arch/%.o: ../arch/%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+gdbsupport/%.o: ../gdbsupport/%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: %-generated.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: %.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: ../nat/%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: ../target/%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+%.o: ../%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+# Rules for register format descriptions.  Suffix destination files with
+# -generated to identify and clean them easily.
+
+%-generated.c: ../regformats/%.dat | $(regdat_sh)
+	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
+
+%-generated.c: ../regformats/arm/%.dat | $(regdat_sh)
+	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
+
+%-generated.c: ../regformats/i386/%.dat | $(regdat_sh)
+	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
+
+%-generated.c: ../regformats/rs6000/%.dat | $(regdat_sh)
+	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
+	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
+
+#
+# Dependency tracking.
+#
+
+ifeq ($(DEPMODE),depmode=gcc3)
+# Note that we put the dependencies into a .Tpo file, then move them
+# into place if the compile succeeds.  We need this because gcc does
+# not atomically write the dependency output file.
+override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
+	-MF $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo
+override POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(basename $(@F)).Tpo \
+	$(@D)/$(DEPDIR)/$(basename $(@F)).Po
+else
+override COMPILE.pre = source='$<' object='$@' libtool=no \
+	DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) \
+	$(CXX) -x c++ $(CXX_DIALECT)
+# depcomp handles atomicity for us, so we don't need a postcompile
+# step.
+override POSTCOMPILE =
+endif
+
+# A list of all the objects we might care about in this build, for
+# dependency tracking.
+all_object_files = $(OBS) $(GDBREPLAY_OBS) $(IPA_OBJS)
+
+# Ensure that generated files are created early.  Use order-only
+# dependencies if available.  They require GNU make 3.80 or newer,
+# and the .VARIABLES variable was introduced at the same time.
+ifdef .VARIABLES
+$(all_object_files): | $(generated_files)
+else
+$(all_object_files) : $(generated_files)
+endif
+
+# All the .deps files to include.
+all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
+		   $(dir $(dep))/$(DEPDIR)/$(notdir $(dep)))
+
+# Dependencies.
+-include $(all_deps_files)
+
+# Disable implicit make rules.
+include $(srcdir)/../disable-implicit-rules.mk
+
+# Do not delete intermediate files (e.g. *-generated.c).
+.SECONDARY:
+
+# This is the end of "Makefile.in".
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
new file mode 100644
index 00000000000..e0d2b2fe04a
--- /dev/null
+++ b/gdb/gdbserver/configure.srv
@@ -0,0 +1,398 @@
+# Mappings from configuration triplets to gdbserver build options.
+# This is invoked from the autoconf-generated configure script, to
+# produce the appropriate Makefile substitutions.
+
+# This file sets the following shell variables:
+#   srv_regobj		The register protocol appropriate for this target.
+#   srv_tgtobj		Any other target-specific modules appropriate
+#			for this target.
+#   srv_hostio_err	The object implementing the hostio_last_error
+#			target method.
+#   srv_xmlfiles	All XML files which should be available for
+#			gdbserver in this configuration.
+#   ipa_obj		Any other target-specific modules appropriate
+#			for this target's in-process agent.
+#
+# In addition, on GNU/Linux the following shell variables will be set:
+#   srv_linux_regsets	Set to "yes" if ptrace(PTRACE_GETREGS) and friends
+#			may be available on this platform;  unset otherwise.
+#			They will only be used if <sys/ptrace.h> defines
+#			PTRACE_GETREGS.
+#   srv_linux_usrregs	Set to "yes" if we can get at registers via
+#			PTRACE_PEEKUSR / PTRACE_POKEUSR.
+
+# Default hostio_last_error implementation
+srv_hostio_err_objs="hostio-errno.o"
+
+ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o"
+
+# Linux object files.  This is so we don't have to repeat
+# these files over and over again.
+srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-waitpid.o linux-personality.o linux-namespaces.o fork-child.o fork-inferior.o"
+
+# Input is taken from the "${target}" variable.
+
+case "${target}" in
+  aarch64*-*-linux*)	srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
+			srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
+			srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o"
+			srv_tgtobj="${srv_tgtobj} arch/aarch32.o"
+			srv_tgtobj="${srv_tgtobj} arch/arm.o"
+			srv_tgtobj="$srv_tgtobj aarch64-linux.o"
+			srv_tgtobj="$srv_tgtobj arch/aarch64-insn.o"
+			srv_tgtobj="$srv_tgtobj arch/aarch64.o"
+			srv_tgtobj="$srv_tgtobj linux-aarch64-tdesc.o"
+			srv_tgtobj="$srv_tgtobj aarch64-sve-linux-ptrace.o"
+			srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			ipa_obj="linux-aarch64-ipa.o"
+			ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o"
+			ipa_obj="${ipa_obj} arch/aarch64-ipa.o"
+			;;
+  arm*-*-linux*)	srv_tgtobj="$srv_linux_obj linux-arm-low.o"
+			srv_tgtobj="$srv_tgtobj linux-arm-tdesc.o"
+			srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
+			srv_tgtobj="$srv_tgtobj linux-aarch32-tdesc.o"
+			srv_tgtobj="${srv_tgtobj} arch/aarch32.o"
+			srv_tgtobj="${srv_tgtobj} arch/arm.o"
+			srv_tgtobj="${srv_tgtobj} arch/arm-linux.o"
+			srv_tgtobj="${srv_tgtobj} arch/arm-get-next-pcs.o"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  arm*-*-mingw32ce*)	srv_regobj=reg-arm.o
+			srv_tgtobj="win32-low.o win32-arm-low.o"
+			srv_tgtobj="${srv_tgtobj} wincecompat.o"
+			# hostio_last_error implementation is in win32-low.c
+			srv_hostio_err_objs=""
+			srv_mingw=yes
+			srv_mingwce=yes
+			;;
+  bfin-*-*linux*)	srv_regobj=reg-bfin.o
+			srv_tgtobj="$srv_linux_obj linux-bfin-low.o"
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  crisv32-*-linux*)	srv_regobj=reg-crisv32.o
+			srv_tgtobj="$srv_linux_obj linux-crisv32-low.o"
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  cris-*-linux*)	srv_regobj=reg-cris.o
+			srv_tgtobj="$srv_linux_obj linux-cris-low.o"
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  i[34567]86-*-cygwin*)	srv_regobj=""
+			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/i386.o"
+			;;
+  i[34567]86-*-linux*)	srv_tgtobj="${srv_tgtobj} arch/i386.o"
+			srv_tgtobj="${srv_tgtobj} $srv_linux_obj linux-x86-low.o x86-low.o x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
+			srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
+			srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			srv_linux_btrace=yes
+			ipa_obj="linux-i386-ipa.o linux-x86-tdesc-ipa.o"
+			ipa_obj="${ipa_obj} arch/i386-ipa.o"
+			;;
+  i[34567]86-*-lynxos*)	srv_regobj=""
+			srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
+			srv_tgtobj="${srv_tgtobj} arch/i386.o"
+			srv_lynxos=yes
+			;;
+  i[34567]86-*-mingw32ce*)
+			srv_regobj=""
+			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/i386.o"
+			srv_tgtobj="${srv_tgtobj} wincecompat.o"
+			# hostio_last_error implementation is in win32-low.c
+			srv_hostio_err_objs=""
+			srv_mingw=yes
+			srv_mingwce=yes
+			;;
+  i[34567]86-*-mingw*)	srv_regobj=""
+			srv_tgtobj="x86-low.o x86-dregs.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/i386.o"
+			srv_mingw=yes
+			;;
+  i[34567]86-*-nto*)	srv_regobj=""
+			srv_tgtobj="nto-low.o nto-x86-low.o arch/i386.o"
+			srv_qnx="yes"
+			;;
+  ia64-*-linux*)	srv_regobj=reg-ia64.o
+			srv_tgtobj="$srv_linux_obj linux-ia64-low.o"
+			srv_linux_usrregs=yes
+			;;
+  m32r*-*-linux*)	srv_regobj=reg-m32r.o
+			srv_tgtobj="$srv_linux_obj linux-m32r-low.o"
+			srv_linux_usrregs=yes
+ 			srv_linux_thread_db=yes
+			;;
+  m68*-*-linux*)	if test "$gdb_cv_m68k_is_coldfire" = yes; then
+                          srv_regobj=reg-cf.o
+                        else
+                          srv_regobj=reg-m68k.o
+                        fi
+			srv_tgtobj="$srv_linux_obj linux-m68k-low.o"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  m68*-*-uclinux*)	if test "$gdb_cv_m68k_is_coldfire" = yes; then
+                          srv_regobj=reg-cf.o
+                        else
+                          srv_regobj=reg-m68k.o
+                        fi
+			srv_tgtobj="$srv_linux_obj linux-m68k-low.o"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  mips*-*-linux*)	srv_regobj="mips-linux.o"
+			srv_regobj="${srv_regobj} mips-dsp-linux.o"
+			srv_regobj="${srv_regobj} mips64-linux.o"
+			srv_regobj="${srv_regobj} mips64-dsp-linux.o"
+			srv_tgtobj="$srv_linux_obj linux-mips-low.o"
+			srv_tgtobj="${srv_tgtobj} mips-linux-watch.o"
+			srv_xmlfiles="mips-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips-dsp-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips-cpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips-cp0.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips-fpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips-dsp.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-dsp-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-cpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-cp0.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-fpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} mips64-dsp.xml"
+			srv_linux_regsets=yes
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  nios2*-*-linux*)	srv_regobj="nios2-linux.o"
+			srv_tgtobj="$srv_linux_obj linux-nios2-low.o"
+			srv_xmlfiles="nios2-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} nios2-cpu.xml"
+			srv_linux_regsets=yes
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  microblaze*-*-linux*)	srv_regobj="microblaze-linux.o"
+			srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
+			srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
+			srv_xmlfiles="microblaze-linux.xml"
+			srv_linux_regsets=yes
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  powerpc*-*-linux*)	srv_regobj="powerpc-32l.o"
+			srv_regobj="${srv_regobj} powerpc-altivec32l.o"
+			srv_regobj="${srv_regobj} powerpc-vsx32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-altivec32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-vsx32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa207-vsx32l.o"
+			srv_regobj="${srv_regobj} powerpc-isa207-htm-vsx32l.o"
+			srv_regobj="${srv_regobj} powerpc-e500l.o"
+			srv_regobj="${srv_regobj} powerpc-64l.o"
+			srv_regobj="${srv_regobj} powerpc-altivec64l.o"
+			srv_regobj="${srv_regobj} powerpc-vsx64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-altivec64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-vsx64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa205-ppr-dscr-vsx64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa207-vsx64l.o"
+			srv_regobj="${srv_regobj} powerpc-isa207-htm-vsx64l.o"
+			srv_tgtobj="$srv_linux_obj linux-ppc-low.o ppc-linux.o"
+			srv_tgtobj="${srv_tgtobj} arch/ppc-linux-common.o"
+			srv_xmlfiles="rs6000/powerpc-32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-vsx32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-htm-vsx32l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-altivec.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-vsx.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu-isa205.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-dscr.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-ppr.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-tar.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-ebb.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-linux-pmu.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-spr.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-core.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-fpu.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-altivec.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-vsx.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-ppr.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-dscr.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-htm-tar.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-e500l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-spe.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-altivec64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-vsx64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-altivec64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-vsx64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa205-ppr-dscr-vsx64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-vsx64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/powerpc-isa207-htm-vsx64l.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power64-core.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power64-linux.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power64-htm-core.xml"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			ipa_obj="${ipa_ppc_linux_regobj} linux-ppc-ipa.o"
+			;;
+  powerpc-*-lynxos*)	srv_regobj="powerpc-32.o"
+			srv_tgtobj="lynx-low.o lynx-ppc-low.o"
+			srv_xmlfiles="rs6000/powerpc-32.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml"
+			srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml"
+			srv_lynxos=yes
+			;;
+  s390*-*-linux*)	srv_regobj="s390-linux32.o"
+			srv_regobj="${srv_regobj} s390-linux32v1.o"
+			srv_regobj="${srv_regobj} s390-linux32v2.o"
+			srv_regobj="${srv_regobj} s390-linux64.o"
+			srv_regobj="${srv_regobj} s390-linux64v1.o"
+			srv_regobj="${srv_regobj} s390-linux64v2.o"
+			srv_regobj="${srv_regobj} s390-te-linux64.o"
+			srv_regobj="${srv_regobj} s390-vx-linux64.o"
+			srv_regobj="${srv_regobj} s390-tevx-linux64.o"
+			srv_regobj="${srv_regobj} s390-gs-linux64.o"
+			srv_regobj="${srv_regobj} s390x-linux64.o"
+			srv_regobj="${srv_regobj} s390x-linux64v1.o"
+			srv_regobj="${srv_regobj} s390x-linux64v2.o"
+			srv_regobj="${srv_regobj} s390x-te-linux64.o"
+			srv_regobj="${srv_regobj} s390x-vx-linux64.o"
+			srv_regobj="${srv_regobj} s390x-tevx-linux64.o"
+			srv_regobj="${srv_regobj} s390x-gs-linux64.o"
+			srv_tgtobj="$srv_linux_obj linux-s390-low.o"
+			srv_xmlfiles="s390-linux32.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-linux32v1.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-linux32v2.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-linux64v1.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-linux64v2.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-te-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-vx-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-tevx-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-gs-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-linux64v1.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-linux64v2.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-te-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-vx-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-tevx-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-gs-linux64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-core32.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-core64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390x-core64.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-acr.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-fpr.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-tdb.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-vx.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-gs.xml"
+			srv_xmlfiles="${srv_xmlfiles} s390-gsbc.xml"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			ipa_obj="linux-s390-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux32-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux32v1-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux32v2-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux64v1-ipa.o"
+			ipa_obj="${ipa_obj} s390-linux64v2-ipa.o"
+			ipa_obj="${ipa_obj} s390-vx-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390-te-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390-tevx-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390-gs-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390x-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390x-linux64v1-ipa.o"
+			ipa_obj="${ipa_obj} s390x-linux64v2-ipa.o"
+			ipa_obj="${ipa_obj} s390x-vx-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390x-te-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390x-tevx-linux64-ipa.o"
+			ipa_obj="${ipa_obj} s390x-gs-linux64-ipa.o"
+			;;
+  sh*-*-linux*)		srv_regobj=reg-sh.o
+			srv_tgtobj="$srv_linux_obj linux-sh-low.o"
+			srv_linux_usrregs=yes
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  sparc*-*-linux*)	srv_regobj=reg-sparc64.o
+			srv_tgtobj="$srv_linux_obj linux-sparc-low.o"
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  tic6x-*-uclinux)	if $development; then
+			  srv_regobj="tic6x-c64xp-linux.o"
+			  srv_regobj="${srv_regobj} tic6x-c64x-linux.o"
+			  srv_regobj="${srv_regobj} tic6x-c62x-linux.o"
+                        else
+			  srv_regobj=""
+                        fi
+			srv_tgtobj="$srv_linux_obj linux-tic6x-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/tic6x.o"
+			srv_linux_regsets=yes
+			srv_linux_usrregs=yes
+			srv_linux_thread_db=yes
+			;;
+  x86_64-*-linux*)	srv_tgtobj="$srv_linux_obj linux-x86-low.o x86-low.o"
+			srv_tgtobj="${srv_tgtobj} x86-dregs.o i387-fp.o"
+			srv_tgtobj="${srv_tgtobj} arch/i386.o arch/amd64.o"
+			srv_tgtobj="${srv_tgtobj} linux-x86-tdesc.o"
+			srv_tgtobj="${srv_tgtobj} linux-btrace.o x86-linux.o"
+			srv_tgtobj="${srv_tgtobj} x86-linux-dregs.o"
+			srv_tgtobj="${srv_tgtobj} amd64-linux-siginfo.o"
+			srv_linux_usrregs=yes # This is for i386 progs.
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			srv_linux_btrace=yes
+			ipa_obj="linux-amd64-ipa.o linux-x86-tdesc-ipa.o"
+			ipa_obj="${ipa_obj} arch/amd64-ipa.o"
+			;;
+  x86_64-*-mingw*)	srv_regobj=""
+			srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/amd64.o"
+			srv_mingw=yes
+			;;
+  x86_64-*-cygwin*)	srv_regobj=""
+			srv_tgtobj="x86-low.o x86-dregs.o i387-fp.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="${srv_tgtobj} arch/amd64.o"
+			;;
+
+  xtensa*-*-linux*)	srv_regobj=reg-xtensa.o
+			srv_tgtobj="$srv_linux_obj linux-xtensa-low.o"
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  tilegx-*-linux*)	srv_regobj=reg-tilegx.o
+			srv_regobj="${srv_regobj} reg-tilegx32.o"
+			srv_tgtobj="$srv_linux_obj linux-tile-low.o"
+			srv_linux_regsets=yes
+			srv_linux_thread_db=yes
+			;;
+  *)			echo "Error: target not supported by gdbserver."
+			exit 1
+			;;
+esac
diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
new file mode 100644
index 00000000000..cba5d6fc585
--- /dev/null
+++ b/gdb/gdbserver/linux-microblaze-low.c
@@ -0,0 +1,189 @@
+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
+   GDB.
+   Copyright (C) 1995-2013 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include "server.h"
+#include "linux-low.h"
+
+#include <asm/ptrace.h>
+#include <sys/procfs.h>
+#include <sys/ptrace.h>
+
+#include "gdb_proc_service.h"
+
+static int microblaze_regmap[] =
+ {PT_GPR(0),     PT_GPR(1),     PT_GPR(2),     PT_GPR(3),
+  PT_GPR(4),     PT_GPR(5),     PT_GPR(6),     PT_GPR(7),
+  PT_GPR(8),     PT_GPR(9),     PT_GPR(10),    PT_GPR(11),
+  PT_GPR(12),    PT_GPR(13),    PT_GPR(14),    PT_GPR(15),
+  PT_GPR(16),    PT_GPR(17),    PT_GPR(18),    PT_GPR(19),
+  PT_GPR(20),    PT_GPR(21),    PT_GPR(22),    PT_GPR(23),
+  PT_GPR(24),    PT_GPR(25),    PT_GPR(26),    PT_GPR(27),
+  PT_GPR(28),    PT_GPR(29),    PT_GPR(30),    PT_GPR(31),
+  PT_PC,         PT_MSR,        PT_EAR,        PT_ESR,
+  PT_FSR
+  };
+
+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
+
+/* Defined in auto-generated file microblaze-linux.c.  */
+void init_registers_microblaze (void);
+
+static int
+microblaze_cannot_store_register (int regno)
+{
+  if (microblaze_regmap[regno] == -1 || regno == 0)
+    return 1;
+
+  return 0;
+}
+
+static int
+microblaze_cannot_fetch_register (int regno)
+{
+  return 0;
+}
+
+static CORE_ADDR
+microblaze_get_pc (struct regcache *regcache)
+{
+  unsigned long pc;
+
+  collect_register_by_name (regcache, "pc", &pc);
+  return (CORE_ADDR) pc;
+}
+
+static void
+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
+{
+  unsigned long newpc = pc;
+
+  supply_register_by_name (regcache, "pc", &newpc);
+}
+
+/* dbtrap insn */
+/* brki r16, 0x18; */
+static const unsigned long microblaze_breakpoint = 0xba0c0018;
+#define microblaze_breakpoint_len 4
+
+static int
+microblaze_breakpoint_at (CORE_ADDR where)
+{
+  unsigned long insn;
+
+  (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
+  if (insn == microblaze_breakpoint)
+    return 1;
+  /* If necessary, recognize more trap instructions here.  GDB only uses the
+     one.  */
+  return 0;
+}
+
+static CORE_ADDR
+microblaze_reinsert_addr (struct regcache *regcache)
+{
+  unsigned long pc;
+  collect_register_by_name (regcache, "r15", &pc);
+  return pc;
+}
+
+#ifdef HAVE_PTRACE_GETREGS
+
+static void
+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
+{
+  int size = register_size (regno);
+
+  memset (buf, 0, sizeof (long));
+
+  if (size < sizeof (long))
+    collect_register (regcache, regno, buf + sizeof (long) - size);
+  else
+    collect_register (regcache, regno, buf);
+}
+
+static void
+microblaze_supply_ptrace_register (struct regcache *regcache,
+			    int regno, const char *buf)
+{
+  int size = register_size (regno);
+
+  if (regno == 0) {
+    unsigned long regbuf_0 = 0;
+    /* clobbering r0 so that it is always 0 as enforced by hardware */
+    supply_register (regcache, regno, (const char*)&regbuf_0);
+  } else {
+      if (size < sizeof (long))
+        supply_register (regcache, regno, buf + sizeof (long) - size);
+      else
+        supply_register (regcache, regno, buf);
+  }
+}
+
+/* Provide only a fill function for the general register set.  ps_lgetregs
+   will use this for NPTL support.  */
+
+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
+{
+  int i;
+
+  for (i = 0; i < 32; i++)
+    microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
+}
+
+static void
+microblaze_store_gregset (struct regcache *regcache, const void *buf)
+{
+  int i;
+
+  for (i = 0; i < 32; i++)
+    supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
+}
+
+#endif /* HAVE_PTRACE_GETREGS */
+
+struct regset_info target_regsets[] = {
+#ifdef HAVE_PTRACE_GETREGS
+  { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
+  { 0, 0, 0, -1, -1, NULL, NULL },
+#endif /* HAVE_PTRACE_GETREGS */
+  { 0, 0, 0, -1, -1, NULL, NULL }
+};
+
+struct linux_target_ops the_low_target = {
+  init_registers_microblaze,
+  microblaze_num_regs,
+  microblaze_regmap,
+  NULL,
+  microblaze_cannot_fetch_register,
+  microblaze_cannot_store_register,
+  NULL, /* fetch_register */
+  microblaze_get_pc,
+  microblaze_set_pc,
+  (const unsigned char *) &microblaze_breakpoint,
+  microblaze_breakpoint_len,
+  microblaze_reinsert_addr,
+  0,
+  microblaze_breakpoint_at,
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  microblaze_collect_ptrace_register,
+  microblaze_supply_ptrace_register,
+};
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 17cdc2516d4..7d488d12b52 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -37,6 +37,22 @@
 #include "tramp-frame.h"
 #include "linux-tdep.h"
 
+static int microblaze_debug_flag = 0;
+
+static void
+microblaze_debug (const char *fmt, ...)
+{
+  if (microblaze_debug_flag)
+    {
+       va_list args;
+
+       va_start (args, fmt);
+       printf_unfiltered ("MICROBLAZE LINUX: ");
+       vprintf_unfiltered (fmt, args);
+       va_end (args);
+    }
+}
+
 static int
 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch, 
 					   struct bp_target_info *bp_tgt)
@@ -50,13 +66,20 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
   /* Determine appropriate breakpoint contents and size for this address.  */
   bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
 
+  /* Make sure we see the memory breakpoints.  */
+  scoped_restore restore_memory
+    = make_scoped_restore_show_memory_breakpoints (1);
+
   val = target_read_memory (addr, old_contents, bplen);
 
   /* If our breakpoint is no longer at the address, this means that the
      program modified the code on us, so it is wrong to put back the
      old value.  */
   if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
-    val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
+  {
+      val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
+      microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
+  }
 
   return val;
 }
@@ -129,6 +152,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
   /* Trampolines.  */
   tramp_frame_prepend_unwinder (gdbarch,
 				&microblaze_linux_sighandler_tramp_frame);
+
+  /* Enable TLS support.  */
+  set_gdbarch_fetch_tls_load_module_address (gdbarch,
+                                             svr4_fetch_objfile_link_map);
 }
 
 void _initialize_microblaze_linux_tdep ();
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 0c3316dece1..2d6eb8ce94e 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -137,7 +137,38 @@ microblaze_fetch_instruction (CORE_ADDR pc)
 constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
 
 typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
-
+static int
+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
+				    struct bp_target_info *bp_tgt)
+{
+  CORE_ADDR addr = bp_tgt->placed_address;
+  const unsigned char *bp;
+  int val;
+  int bplen;
+  gdb_byte old_contents[BREAKPOINT_MAX];
+
+  /* Determine appropriate breakpoint contents and size for this address.  */
+  bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
+  if (bp == NULL)
+    error (_("Software breakpoints not implemented for this target."));
+
+  /* Make sure we see the memory breakpoints.  */
+  scoped_restore restore_memory
+    = make_scoped_restore_show_memory_breakpoints (1);
+
+  val = target_read_memory (addr, old_contents, bplen);
+
+  /* If our breakpoint is no longer at the address, this means that the
+     program modified the code on us, so it is wrong to put back the
+     old value.  */
+  if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
+  {
+    val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
+    microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
+  }
+
+  return val;
+}
 
 /* Allocate and initialize a frame cache.  */
 
@@ -729,6 +760,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 				       microblaze_breakpoint::kind_from_pc);
   set_gdbarch_sw_breakpoint_from_kind (gdbarch,
 				       microblaze_breakpoint::bp_from_kind);
+  set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
 
   set_gdbarch_frame_args_skip (gdbarch, 8);
 
@@ -769,4 +801,5 @@ When non-zero, microblaze specific debugging is enabled."),
 			     NULL,
 			     &setdebuglist, &showdebuglist);
 
+
 }
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index 08af0d191c5..8a429cbf001 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -117,6 +117,8 @@ struct microblaze_frame_cache
 
 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
    Only used for native debugging.  */
-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
+
 
 #endif /* microblaze-tdep.h */
diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
new file mode 100644
index 00000000000..bd8a4384424
--- /dev/null
+++ b/gdb/regformats/reg-microblaze.dat
@@ -0,0 +1,41 @@
+name:microblaze
+expedite:r1,pc
+32:r0
+32:r1
+32:r2
+32:r3
+32:r4
+32:r5
+32:r6
+32:r7
+32:r8
+32:r9
+32:r10
+32:r11
+32:r12
+32:r13
+32:r14
+32:r15
+32:r16
+32:r17
+32:r18
+32:r19
+32:r20
+32:r21
+32:r22
+32:r23
+32:r24
+32:r25
+32:r26
+32:r27
+32:r28
+32:r29
+32:r30
+32:r31
+32:pc
+32:msr
+32:ear
+32:esr
+32:fsr
+32:slr
+32:shr
-- 
2.17.1

