Hi all,

The attached patch limits the -U__i386__ -D__arm__ fugly hack to where it is really needed.

I tried it on arm-wince-mingw32ce-gdb and it builds for me. Unfortunately, I still get a slow
debugging experience.
Maybe this patch solves some of the problems some where seeing, specifically the
#warning about machine not __i386__.
The error with the funny characters is still a mystery to me though.

Warning: Gdb will still not work when compiled in 64-bit mode, as there are some
assumptions about (at least) pointers being 32-bit wide.

Can anyone try this, please?

The patch also touches src/build-mingw32ce.sh, specifically, it changes -I$(w32api) to -idirafter $(w32api),
to be sure win32 headers are always found after the system headers.

if you just want to build gdb, you can type:
'./build-mingw32ce.sh gdb'

followed by:
'./build-mingw32ce.sh gdbstub'.

Cheers,
Pedro Alves

Index: build-mingw32ce.sh
===================================================================
--- build-mingw32ce.sh  (revisão 769)
+++ build-mingw32ce.sh  (cópia de trabalho)
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+export CFLAGS="-g3 -O0"
+
 if [ $# -lt 2 ] ; then
 
 echo "Using defaults:"
@@ -182,12 +184,9 @@
     cd ${BUILD_DIR}/gdb || exit 1
 
     PREV_CFLAGS=${CFLAGS}
-    export CFLAGS="-I${BASE_DIRECTORY}/w32api/include"
+    export CFLAGS="-idirafter ${BASE_DIRECTORY}/w32api/include"
 
     ${BASE_DIRECTORY}/gdb/configure  \
-       --with-gcc                     \
-       --with-gnu-ld                  \
-       --with-gnu-as                  \
        --target=${TARGET}             \
        --prefix=${PREFIX}             \
        --disable-nls                  \
Index: gdb/gdb/wince.c
===================================================================
--- gdb/gdb/wince.c     (revisão 769)
+++ gdb/gdb/wince.c     (cópia de trabalho)
@@ -26,11 +26,6 @@
 
 /* We assume we're being built with and will be used for cygwin.  */
 
-#ifdef SHx
-#undef SH4
-#define SH4            /* Just to get all of the CONTEXT defines.  */
-#endif
-
 #include "defs.h"
 #include "frame.h"     /* required by inferior.h */
 #include "inferior.h"
@@ -38,12 +33,6 @@
 #include "gdbcore.h"
 #include <fcntl.h>
 #include <stdlib.h>
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include <basetyps.h>  /* required for <rapi.h> on linux + w32api.  */
-#include <rapi.h>
 #include <netdb.h>
 #ifdef CYGWIN
 #include <cygwin/in.h>
@@ -60,14 +49,86 @@
 #include "gdbthread.h"
 #include "gdbcmd.h"
 #include <sys/param.h>
-#include "wince-stub.h"
 #include <time.h>
 #include "regcache.h"
+#include "gdb_assert.h"
 
+#undef _X86_
+#undef _M_IX86
+#undef __i386__
+#undef __i486__
+#undef __i586__
+#undef __i686__
+#define UNICODE
+#define UNDER_CE
+#define _WIN32_WCE 0x300
+#define __MINGW32CE__
+#define __arm__
+#define ARM
+
+#ifdef SHx
+#undef SH4
+#define SH4            /* Just to get all of the CONTEXT defines.  */
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+typedef int16_t   CSHORT;
+#define STDAPI
+
+/* XXX: sizeof(double) must be 8 */
+typedef double    DATE;
+
+typedef struct _TIME_FIELDS {
+  CSHORT  Year;
+  CSHORT  Month;
+  CSHORT  Day;
+  CSHORT  Hour;
+  CSHORT  Minute;
+  CSHORT  Second;
+  CSHORT  Milliseconds;
+  CSHORT  Weekday;
+} TIME_FIELDS, *PTIME_FIELDS;
+
+BOOL CeCreateDirectory(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES 
lpSecurityAttributes);
+HANDLE CeCreateFile(
+               LPCWSTR lpFileName, 
+               DWORD dwDesiredAccess, 
+               DWORD dwShareMode, 
+               LPSECURITY_ATTRIBUTES lpSecurityAttributes, 
+               DWORD dwCreationDisposition, 
+               DWORD dwFlagsAndAttributes, 
+               HANDLE hTemplateFile); 
+BOOL CeCloseHandle( 
+               HANDLE hObject);
+DWORD CeGetLastError( void );
+
+BOOL CeWriteFile(HANDLE hFile, 
+               LPCVOID lpBuffer, 
+               DWORD nNumberOfBytesToWrite, 
+               LPDWORD lpNumberOfBytesWritten, 
+               LPOVERLAPPED lpOverlapped); 
+
+HRESULT CeRapiInit(void);
+STDAPI HRESULT CeRapiUninit(void);
+
+BOOL CeCreateProcess(LPCWSTR lpApplicationName,                LPCWSTR 
lpCommandLine, 
+               void* lpProcessAttributes, 
+               void* lpThreadAttributes, 
+               BOOL bInheritHandles, 
+               DWORD dwCreationFlags, 
+               LPVOID lpEnvironment, 
+               LPWSTR lpCurrentDirectory, 
+               void* lpStartupInfo, 
+               LPPROCESS_INFORMATION lpProcessInformation);
+
+// Look ma, another fugly hack.
+#include <basetyps.h>  /* required for <rapi.h> on linux + w32api.  */
+
 #include "win32.h"
+#include "wince-stub.h"
 
-#include "gdb_assert.h"
-
 #ifndef __CYGWIN__
 static int MyMbstowcs(wchar_t *dest, const char *src, int n);
 #endif
@@ -1613,12 +1674,12 @@
 { ERROR_WRONG_PASSWORD, "Unable to update the password. The value provided as 
the current password is incorrect. " /* 1323  */ },
 { ERROR_ILL_FORMED_PASSWORD, "Unable to update the password. The value 
provided for the new password contains values that are not allowed in 
passwords. " /* 1324  */ },
 { ERROR_PASSWORD_RESTRICTION, "Unable to update the password because a 
password update rule has been violated. " /* 1325  */ },
-{ ERROR_LOGON_FAILURE, "Logon failure \u2014 unknown user name or bad 
password. " /* 1326  */ },
-{ ERROR_ACCOUNT_RESTRICTION, "Logon failure \u2014 user account restriction. " 
/* 1327  */ },
-{ ERROR_INVALID_LOGON_HOURS, "Logon failure \u2014 account logon time 
restriction violation. " /* 1328  */ },
-{ ERROR_INVALID_WORKSTATION, "Logon failure \u2014 user not allowed to log on 
to this computer. " /* 1329  */ },
-{ ERROR_PASSWORD_EXPIRED, "Logon failure \u2014 the specified account password 
has expired. " /* 1330  */ },
-{ ERROR_ACCOUNT_DISABLED, "Logon failure \u2014 account currently disabled. " 
/* 1331  */ },
+{ ERROR_LOGON_FAILURE, "Logon failure - unknown user name or bad password. " 
/* 1326  */ },
+{ ERROR_ACCOUNT_RESTRICTION, "Logon failure - user account restriction. " /* 
1327  */ },
+{ ERROR_INVALID_LOGON_HOURS, "Logon failure - account logon time restriction 
violation. " /* 1328  */ },
+{ ERROR_INVALID_WORKSTATION, "Logon failure - user not allowed to log on to 
this computer. " /* 1329  */ },
+{ ERROR_PASSWORD_EXPIRED, "Logon failure - the specified account password has 
expired. " /* 1330  */ },
+{ ERROR_ACCOUNT_DISABLED, "Logon failure - account currently disabled. " /* 
1331  */ },
 { ERROR_NONE_MAPPED, "No mapping between account names and security IDs was 
done. " /* 1332  */ },
 { ERROR_TOO_MANY_LUIDS_REQUESTED, "Too many LUIDs were requested at one time. 
" /* 1333  */ },
 { ERROR_LUIDS_EXHAUSTED, "No more LUIDs are available. " /* 1334  */ },
@@ -1665,12 +1726,12 @@
 { ERROR_MEMBER_NOT_IN_ALIAS, "The specified account name is not a member of 
the local group. " /* 1377  */ },
 { ERROR_MEMBER_IN_ALIAS, "The specified account name is already a member of 
the local group. " /* 1378  */ },
 { ERROR_ALIAS_EXISTS, "The specified local group already exists. " /* 1379  */ 
},
-{ ERROR_LOGON_NOT_GRANTED, "Logon failure \u2014 the user has not been granted 
the requested logon type at this computer. " /* 1380  */ },
+{ ERROR_LOGON_NOT_GRANTED, "Logon failure - the user has not been granted the 
requested logon type at this computer. " /* 1380  */ },
 { ERROR_TOO_MANY_SECRETS, "The maximum number of secrets that may be stored in 
a single system has been exceeded. " /* 1381  */ },
 { ERROR_SECRET_TOO_LONG, "The length of a secret exceeds the maximum length 
allowed. " /* 1382  */ },
 { ERROR_INTERNAL_DB_ERROR, "The local security authority database contains an 
internal inconsistency. " /* 1383  */ },
 { ERROR_TOO_MANY_CONTEXT_IDS, "During a logon attempt, the user's security 
context accumulated too many security IDs. " /* 1384  */ },
-{ ERROR_LOGON_TYPE_NOT_GRANTED, "Logon failure \u2014 the user has not been 
granted the requested logon type at this computer. " /* 1385  */ },
+{ ERROR_LOGON_TYPE_NOT_GRANTED, "Logon failure - the user has not been granted 
the requested logon type at this computer. " /* 1385  */ },
 { ERROR_NT_CROSS_ENCRYPTION_REQUIRED, "A cross-encrypted password is necessary 
to change a user password. " /* 1386  */ },
 { ERROR_NO_SUCH_MEMBER, "A new member could not be added to a local group 
because the member does not exist. " /* 1387  */ },
 { ERROR_INVALID_MEMBER, "A new member could not be added to a local group 
because the member has the wrong account type. " /* 1388  */ },
Index: gdb/gdb/win32-nat.c
===================================================================
--- gdb/gdb/win32-nat.c (revisão 769)
+++ gdb/gdb/win32-nat.c (cópia de trabalho)
@@ -24,16 +24,6 @@
 
 /* Originally by Steve Chamberlain, [EMAIL PROTECTED] */
 
-#define        WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-/* We assume we're being built with and will be used for cygwin.  */
-
-#ifdef SHx
-#undef SH4
-#define SH4            /* Just to get all of the CONTEXT defines.  */
-#endif
-
 #include "defs.h"
 #include "frame.h"             /* required by inferior.h */
 #include "inferior.h"
@@ -48,10 +38,12 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <stdlib.h>
-#include <windows.h>
-#include <imagehlp.h>
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>
+#else
+#include <ctype.h>
+/* In wince.c.  */
+int MyWcstombs(char *dest, const wchar_t *src, int n);
 #endif
 
 
@@ -69,6 +61,28 @@
 
 #include "gdb_assert.h"
 
+#undef _X86_
+#undef _M_IX86
+#undef __i386__
+#undef __i486__
+#undef __i586__
+#undef __i686__
+#define UNICODE
+#define UNDER_CE
+#define _WIN32_WCE 0x300
+#define __MINGW32CE__
+#define __arm__
+#define ARM
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <imagehlp.h>
+
+#ifdef SHx
+#undef SH4
+#define SH4            /* Just to get all of the CONTEXT defines.  */
+#endif
+
 #if defined(__i386__)
 # include "i386-tdep.h"
 # include "i387-tdep.h"
@@ -981,9 +995,9 @@
   const int CHUNK_SIZE = 16;
   char *address_ptr;
 
-       char *p, *bufp , *dll_basename;
-       const char *imgp;
-       int len = 0;
+  char *p, *bufp , *dll_basename;
+  const char *imgp;
+  int len = 0;
   DWORD done;
 
   /* Attempt to read the name of the dll that was detected.
@@ -995,7 +1009,7 @@
 #ifdef _WIN32_WCE
        /* WinCE is different from NT/9x in that *address doesn't contain a 
pointer into 
           the image name, but contains the image name itself. */
-       address_ptr = address;
+  address_ptr = address;
 #else
   /* See if we could read the address of a string, and that the
      address isn't null. */
@@ -1047,7 +1061,7 @@
                WideCharToMultiByte (CP_ACP, 0, (LPCWSTR) read_buf, len,
                                buf, len, 0, 0);
 #else
-               (void)MyWcstombs(buf, read_buf, len);
+               (void)MyWcstombs(buf, (wchar_t*)read_buf, len);
 #endif
        }
 
Index: gdb/gdb/config/arm/wince.mt
===================================================================
--- gdb/gdb/config/arm/wince.mt (revisão 769)
+++ gdb/gdb/config/arm/wince.mt (cópia de trabalho)
@@ -1,7 +1,5 @@
-# Target: Acorn RISC machine (ARM) with simulator
+# Target: ARM Windows CE.
 TDEPFILES= arm-tdep.o win32-nat.o wince.o corelow.o
 DEPRECATED_TM_FILE= tm-wince.h
-MT_CFLAGS=-D__arm__ -DARM \
-                 -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ 
\
-                 -DUNICODE -DUNDER_CE -D_WIN32_WCE 
-DWINCE_STUB='"${target_alias}-stub.exe"'
+MT_CFLAGS=-DWINCE_STUB='"${target_alias}-stub.exe"'
 TM_CLIBS=-lrapi
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Cegcc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to