summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils/0033-Add-initial-port-of-linux-gdbserver-add-gdb_proc_ser.patch
blob: d2753fe9812810a87715193c4ef709e1189d928d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
From 48166e74b46787b10073fcec3c133463504e2dbc 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
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 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 da71675b201..3a0c4443a93 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -61,6 +61,7 @@ i[34567]86*)		gdb_host_cpu=i386 ;;
 loongarch*)		gdb_host_cpu=loongarch ;;
 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 ;;
@@ -135,6 +136,8 @@ mips64*-*-openbsd*)	gdb_host=obsd64 ;;
 
 or1k-*-linux*)		gdb_host=linux ;;
 
+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 daa7ddf7e4d..5748556a556 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 3d5dd669341..3e8e8fe35b9 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -128,7 +128,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.  */
 
@@ -716,6 +747,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);
 
@@ -756,4 +788,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 4d90e8785dc..53fcb2297e6 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -118,6 +118,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.25.1