This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Build arm-elf-gdb on mingw host


When building the bfd/doc directory under mingw/msys chew.c converts line endings to crlf. I've patched so the files are read as binary, preventing this conversion.


Currently the rdi-share directory can't be built for a windows native host http://sourceware.org/ml/gdb/2005-08/msg00058.html. I've copied the embed.mt file, renamed to mingw_embed.mt and removed the parts which don't build then patched configure.tgt so that the new .mt file is used when building for a mingw host.


SIGTRAP isn't defined in the MinGW headers, I patched remote-sim.c to define this if it's not defined.

There are some other problems to deal with to get the debugger working with thumb code, my arm-elf toolchain is binutils 2.16.1, gcc 4.0.1 and newlib 1.13.0. With this combination gdb doesn't recognise thumb symbols in the generated elf, at least when setting breakpoints. Debugging ARM only code seems to work well.

The attached patch is against current CVS HEAD. To whomever is responsible for getting the gdb sources to a point where such minimal patching is required on MinGW, great work, it's very much appreciated.

Dave.
2005-09-25  Dave Murphy  <davem@devkitpro.org>

	* chew.c: Prevent conversion of line endings on mingw.
	* configure.tgt: Use mingw_embed.mt on mingw.
	* remote-sim.c: Define SIMTRAP on mingw.
	* mingw_embed.mt: Add.
	
Index: bfd/doc/chew.c
===================================================================
RCS file: /cvs/src/src/bfd/doc/chew.c,v
retrieving revision 1.19
diff -u -r1.19 chew.c
--- bfd/doc/chew.c	24 Jul 2005 16:57:42 -0000	1.19
+++ bfd/doc/chew.c	25 Sep 2005 21:47:59 -0000
@@ -92,6 +92,12 @@
 #define DEF_SIZE 5000
 #define STACK 50
 
+#ifdef __MINGW32__
+/* Prevent \r\n\ line endings */
+#include <fcntl.h>
+unsigned int _CRT_fmode = _O_BINARY;
+#endif
+
 int internal_wanted;
 int internal_mode;
 
Index: gdb/configure.tgt
===================================================================
RCS file: /cvs/src/src/gdb/configure.tgt,v
retrieving revision 1.169
diff -u -r1.169 configure.tgt
--- gdb/configure.tgt	15 Aug 2005 21:46:38 -0000	1.169
+++ gdb/configure.tgt	25 Sep 2005 21:48:03 -0000
@@ -61,9 +61,14 @@
 arm-*-nto*)		gdb_target=nto ;;
 arm*-*-openbsd*)	gdb_target=nbsd ;;
 arm*-*-* | thumb*-*-* | strongarm*-*-*)
-			gdb_target=embed
-			build_rdi_share=yes
-                        ;;
+  case "${host}" in
+  *mingw*)	gdb_target=mingw_embed
+            ;;
+  * )  gdb_target=embed
+			 build_rdi_share=yes
+       ;;
+  esac
+  ;;
 xscale-*-*)		gdb_target=embed
 			build_rdi_share=yes
                         ;;
Index: gdb/remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.49
diff -u -r1.49 remote-sim.c
--- gdb/remote-sim.c	19 Jun 2005 20:08:37 -0000	1.49
+++ gdb/remote-sim.c	25 Sep 2005 21:48:07 -0000
@@ -44,6 +44,10 @@
 #include "sim-regno.h"
 #include "arch-utils.h"
 
+#ifndef SIGTRAP
+#define SIGTRAP 5
+#endif
+
 /* Prototypes */
 
 extern void _initialize_remote_sim (void);
Index: gdb/config/arm/mingw_embed.mt
===================================================================
RCS file: gdb/config/arm/mingw_embed.mt
diff -N gdb/config/arm/mingw_embed.mt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/config/arm/mingw_embed.mt	25 Sep 2005 21:48:09 -0000
@@ -0,0 +1,7 @@
+# Target: ARM embedded system
+TDEPFILES= arm-tdep.o remote-rdp.o
+TDEPLIBS=
+DEPRECATED_TM_FILE= tm-embed.h
+
+SIM_OBS = remote-sim.o
+SIM = ../sim/arm/libsim.a

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]