Compile fixes for non-i386 archs.

diff --git a/debugger/break.c b/debugger/break.c
index 338a737..7c00b59 100644
--- a/debugger/break.c
+++ b/debugger/break.c
@@ -179,7 +179,6 @@
 	 {
 #ifdef __i386__
 	    char ch = set ? INT3 : breakpoints[i].u.b.opcode;
-#endif
 	    
 	    if (!DEBUG_WRITE_MEM( (void*)DEBUG_ToLinear(&breakpoints[i].addr), 
 				  &ch, sizeof(ch) ))
@@ -187,6 +186,7 @@
 	       DEBUG_Printf(DBG_CHN_MESG, "Invalid address for breakpoint %d, disabling it\n", i);
 	       breakpoints[i].enabled = FALSE;
 	    }
+#endif
 	 }
 	 break;
       case DBG_WATCH:
@@ -331,7 +331,9 @@
 
     assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
 
+#ifdef __i386__
     DEBUG_FixAddress( &value.addr, DEBUG_context.SegCs );
+#endif
 
     if( value.type != NULL && value.type == DEBUG_TypeIntConst )
     {
@@ -376,7 +378,7 @@
 void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
 {
    DBG_VALUE	value = *_value;
-   int		num, reg;
+   int		num, reg = -1;
    unsigned	seg2;
    DWORD	mask = 0;
    
@@ -497,7 +499,6 @@
 {
    int 				i;
    int				found = -1;
-   DWORD			val = 0;
    
    /* Method 1 => get triggered watchpoint from context (doesn't work on Linux
     * 2.2.x)
@@ -505,6 +506,8 @@
    for (i = 0; i < next_bp; i++) 
    {
 #ifdef __i386__
+      DWORD val = 0;
+
       if (breakpoints[i].refcount && breakpoints[i].enabled && 
 	  breakpoints[i].type == DBG_WATCH &&
 	  (DEBUG_context.Dr6 & (1 << breakpoints[i].u.w.reg)))
@@ -529,6 +532,8 @@
    for (i = 0; i < next_bp; i++) 
    {
 #ifdef __i386__
+      DWORD val = 0;
+
       if (breakpoints[i].refcount && breakpoints[i].enabled && 
 	  breakpoints[i].type == DBG_WATCH && 
 	  DEBUG_GetWatchedValue(i, &val)) 
@@ -644,6 +649,7 @@
     int 	bpnum;
     DWORD	oldval;
     int 	wpnum;
+    int		addrlen = 32;
     struct symbol_info syminfo;
 
 #ifdef __i386__
@@ -683,9 +689,11 @@
        }
        if (!DEBUG_ShallBreak(wpnum)) return TRUE;
        
+#ifdef __i386__
+       addrlen = !addr.seg? 32 : DEBUG_GetSelectorType( addr.seg );
+#endif
        DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum);
-       syminfo = DEBUG_PrintAddress( &addr, !addr.seg ? 32 :
-				     DEBUG_GetSelectorType( addr.seg ), TRUE );
+       syminfo = DEBUG_PrintAddress( &addr, addrlen, TRUE );
        
        DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n", 
 	       oldval, breakpoints[wpnum].u.w.oldval);
diff --git a/debugger/debugger.h b/debugger/debugger.h
index fe13566..3514380 100644
--- a/debugger/debugger.h
+++ b/debugger/debugger.h
@@ -224,6 +224,20 @@
 
 #define	OFFSET_OF(__c,__f)		((int)(((char*)&(((__c*)0)->__f))-((char*)0)))
 
+
+
+#ifdef __i386__
+# define GET_IP(context) ((DWORD)(context)->Eip)
+#endif
+#ifdef __sparc__
+# define GET_IP(context) ((DWORD)(context)->pc)
+#endif
+
+#if !defined(GET_IP)
+# error You must define GET_IP for this CPU
+#endif
+
+
   /* debugger/break.c */
 extern void DEBUG_SetBreakpoints( BOOL set );
 extern void DEBUG_AddBreakpoint( const DBG_VALUE *addr, BOOL (*func)(void) );
@@ -348,9 +362,9 @@
 extern void DEBUG_ExamineMemory( const DBG_VALUE *addr, int count, char format);
 extern void DEBUG_InvalAddr( const DBG_ADDR* addr );
 extern void DEBUG_InvalLinAddr( void* addr );
-#ifdef __i386__
-extern void DEBUG_GetCurrentAddress( DBG_ADDR * );
 extern DWORD DEBUG_ToLinear( const DBG_ADDR *address );
+extern void DEBUG_GetCurrentAddress( DBG_ADDR * );
+#ifdef __i386__
 extern void DEBUG_FixAddress( DBG_ADDR *address, DWORD def );
 extern BOOL DEBUG_FixSegment( DBG_ADDR* addr );
 extern int  DEBUG_GetSelectorType( WORD sel );
diff --git a/debugger/hash.c b/debugger/hash.c
index 2d921aa..29c7a94 100644
--- a/debugger/hash.c
+++ b/debugger/hash.c
@@ -462,7 +462,11 @@
     if (!nh) return FALSE;
     nh->value = *value;
     nh->flags &= ~SYM_INVALID;
+
+#ifdef __i386__
     DEBUG_FixAddress( &nh->value.addr, DEBUG_context.SegDs );
+#endif
+
     return TRUE;
 }
 
diff --git a/debugger/memory.c b/debugger/memory.c
index 453e3e0..d1feb93 100644
--- a/debugger/memory.c
+++ b/debugger/memory.c
@@ -19,6 +19,7 @@
 
 #define DBG_V86_MODULE(seg) ((seg)>>16)
 #define IS_SELECTOR_V86(seg) DBG_V86_MODULE(seg)
+#endif
 
 static	void	DEBUG_Die(const char* msg)
 {
@@ -51,6 +52,7 @@
    return res;
 }
 
+#ifdef __i386__
 void DEBUG_FixAddress( DBG_ADDR *addr, DWORD def) 
 {
    if (addr->seg == 0xffffffff) addr->seg = def;
@@ -67,21 +69,6 @@
    return FALSE;
 }
 
-DWORD DEBUG_ToLinear( const DBG_ADDR *addr )
-{
-   LDT_ENTRY	le;
-   
-   if (IS_SELECTOR_V86(addr->seg))
-      return (DWORD) DOSMEM_MemoryBase(DBG_V86_MODULE(addr->seg)) + (((addr->seg)&0xFFFF)<<4) + addr->off;
-   if (DEBUG_IsSelectorSystem(addr->seg))
-      return addr->off;
-   
-   if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, addr->seg, &le)) {
-      return (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->off;
-   }
-   return 0;
-}
-
 int	DEBUG_GetSelectorType( WORD sel )
 {
     LDT_ENTRY	le;
@@ -103,6 +90,25 @@
 }
 #endif /* __i386__ */
 
+DWORD DEBUG_ToLinear( const DBG_ADDR *addr )
+{
+#ifdef __i386__
+   LDT_ENTRY	le;
+   
+   if (IS_SELECTOR_V86(addr->seg))
+      return (DWORD) DOSMEM_MemoryBase(DBG_V86_MODULE(addr->seg)) + (((addr->seg)&0xFFFF)<<4) + addr->off;
+   if (DEBUG_IsSelectorSystem(addr->seg))
+      return addr->off;
+   
+   if (GetThreadSelectorEntry( DEBUG_CurrThread->handle, addr->seg, &le)) {
+      return (le.HighWord.Bits.BaseHi << 24) + (le.HighWord.Bits.BaseMid << 16) + le.BaseLow + addr->off;
+   }
+   return 0;
+#else
+   return addr->off;
+#endif
+}
+
 void DEBUG_GetCurrentAddress( DBG_ADDR *addr )
 {
 #ifdef __i386__
@@ -113,7 +119,7 @@
     addr->off  = DEBUG_context.Eip;
 #else
     addr->seg  = 0;
-    addr->off  = 0;
+    addr->off  = GET_IP( &DEBUG_context );
 #endif
 }
 
@@ -155,7 +161,9 @@
        DBG_ADDR	addr = val->addr;
        void*	lin;
 
+#ifdef __i386__
        DEBUG_FixAddress( &addr, DEBUG_context.SegDs );
+#endif
        lin = (void*)DEBUG_ToLinear( &addr );
        
        DEBUG_READ_MEM_VERBOSE(lin, &value, os);
@@ -184,7 +192,9 @@
        DBG_ADDR addr = val->addr;
        void*	lin;
 
+#ifdef __i386__
        DEBUG_FixAddress( &addr, DEBUG_context.SegDs );
+#endif
        lin = (void*)DEBUG_ToLinear( &addr );
        DEBUG_WRITE_MEM_VERBOSE(lin, &value, os);
     } else {
@@ -207,10 +217,12 @@
 
     assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
 
+#ifdef __i386__
     DEBUG_FixAddress( &value.addr, 
 		      (format == 'i') ?
 		      DEBUG_context.SegCs : 
 		      DEBUG_context.SegDs );
+#endif
 
     /*
      * Dereference pointer to get actual memory address we need to be
diff --git a/debugger/source.c b/debugger/source.c
index a43b0a1..595ff5b 100644
--- a/debugger/source.c
+++ b/debugger/source.c
@@ -103,7 +103,7 @@
   int				i;
   struct open_filelist	      * ol;
   int				nlines;
-  char			      * basename;
+  char			      * basename = NULL;
   char			      * pnt;
   int				rtn;
   struct searchlist	      * sl;
@@ -445,7 +445,9 @@
 
     assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
 
+#ifdef __i386__
     DEBUG_FixAddress(&value->addr, DEBUG_context.SegCs);
+#endif
 
     if( value->type != NULL )
       {
diff --git a/debugger/stack.c b/debugger/stack.c
index 9139a97..36ed896 100644
--- a/debugger/stack.c
+++ b/debugger/stack.c
@@ -383,6 +383,7 @@
 int
 DEBUG_SetFrame(int newframe)
 {
+#ifdef __i386__
   int		rtn = FALSE;
 
   curr_frame = newframe;
@@ -404,12 +405,16 @@
 
   rtn = TRUE;
   return (rtn);
+#else /* __i386__ */
+  return FALSE;
+#endif /* __i386__ */
 }
 
 int
 DEBUG_GetCurrentFrame(struct name_hash ** name, unsigned int * eip,
 		      unsigned int * ebp)
 {
+#ifdef __i386__
   /*
    * If we don't have a valid backtrace, then just return.
    */
@@ -432,5 +437,8 @@
   *ebp = frames[curr_frame].ebp;
 
   return TRUE;
+#else /* __i386__ */
+  return FALSE;
+#endif /* __i386__ */
 }
 
diff --git a/debugger/winedbg.c b/debugger/winedbg.c
index 6ebda1f..10db639 100644
--- a/debugger/winedbg.c
+++ b/debugger/winedbg.c
@@ -326,14 +326,22 @@
 
     DEBUG_Printf(DBG_CHN_TRACE, 
 		 "Entering debugger 	PC=%lx EFL=%08lx mode=%d count=%d\n",
+#ifdef __i386__
 		 DEBUG_context.Eip, DEBUG_context.EFlags, 
+#else
+		 0L, 0L,
+#endif
 		 DEBUG_CurrThread->dbg_exec_mode, DEBUG_CurrThread->dbg_exec_count);
 
     ret = DEBUG_Main( is_debug, force, rec->ExceptionCode );
 
     DEBUG_Printf(DBG_CHN_TRACE, 
 		 "Exiting debugger 	PC=%lx EFL=%08lx mode=%d count=%d\n",
+#ifdef __i386__
 		 DEBUG_context.Eip, DEBUG_context.EFlags, 
+#else
+		 0L, 0L,
+#endif
 		 DEBUG_CurrThread->dbg_exec_mode, DEBUG_CurrThread->dbg_exec_count);
 
     return ret;
@@ -376,7 +384,16 @@
 		}
 	    }
 
-	    DEBUG_context.ContextFlags = CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS|CONTEXT_DEBUG_REGISTERS;
+	    DEBUG_context.ContextFlags =  CONTEXT_CONTROL
+                                        | CONTEXT_INTEGER
+#ifdef CONTEXT_SEGMENTS
+	                                | CONTEXT_SEGMENTS
+#endif
+#ifdef CONTEXT_DEBUG_REGISTERS
+		                        | CONTEXT_DEBUG_REGISTERS
+#endif
+					;
+
 	    if (!GetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context)) {
 		DEBUG_Printf(DBG_CHN_WARN, "Can't get thread's context\n");
 		break;