2004-06-24 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / rdi-share / ardi.c
index f61f7242f737dad157a24c2a70d86083984d811f..d7092ddcc77334a05d35e5e96a3a0089713a7746 100644 (file)
 #undef uint
 
 
-#include "endian.h"
+#include "angel_endian.h"
 #include "ardi.h"
 #include "buffers.h"
 #include "channels.h"
 #include "hostchan.h"
 #include "host.h"
-#include "bytesex.h"
+#include "angel_bytesex.h"
 #include "dbg_cp.h"
 #include "adp.h"
 #include "hsys.h"
@@ -154,7 +154,7 @@ static int wait_for_debug_message(int *rcode, int *debugID,
 
   unpack_message(BUFFERDATA((*packet)->pk_buffer), "%w%w%w%w%w", &reason, debugID,
                  OSinfo1, OSinfo2, status);
-  if (reason&0xffffff == ADP_HADPUnrecognised)
+  if ((reason&0xffffff) == ADP_HADPUnrecognised)
     return RDIError_UnimplementedMessage;
   if (reason != (unsigned ) *rcode) {
     if((reason&0xffffff) == ADP_HADPUnrecognised)
@@ -320,9 +320,12 @@ static AdpErrs negotiate_params( const ParameterOptions *user_options )
 
     time_t t;
 
-    static volatile NegotiateState    n_state = {
-        FALSE, FALSE, FALSE, &accepted_config };
-
+    static volatile NegotiateState    n_state;
+    n_state.negotiate_resp = FALSE;
+    n_state.negotiate_ack = FALSE;
+    n_state.link_check_resp = FALSE;
+    n_state.accepted_config = &accepted_config;
+    
 #ifdef DEBUG
     angel_DebugPrint( "negotiate_params\n" );
 #endif
@@ -392,6 +395,8 @@ static void (*old_handler)();
 #endif
 
 static bool boot_interrupted = FALSE;
+static volatile bool interrupt_request = FALSE;
+static volatile bool stop_request = FALSE;
 
 static void ardi_sigint_handler(int sig) {
 #ifdef DEBUG
@@ -401,6 +406,7 @@ static void ardi_sigint_handler(int sig) {
     IGNORE(sig);
 #endif
     boot_interrupted = TRUE;
+    interrupt_request = TRUE;
 #ifndef __unix
     signal(SIGINT, ardi_sigint_handler);
 #endif
@@ -1300,13 +1306,12 @@ static int HandleStoppedMessage(Packet *packet, void *stateptr) {
     stopped_info->stopped_status = RDIError_NoError;
     break;
   default:
-    stopped_info->stopped_status = RDIError_NoError;
+    stopped_info->stopped_status = RDIError_Error;
     break;
   }
   return RDIError_NoError;
 }
 
-static volatile bool interrupt_request = FALSE;
 
 static void interrupt_target( void )
 {
@@ -1339,6 +1344,11 @@ static void interrupt_target( void )
                                     Packet *packet );
 #endif
 
+void angel_RDI_stop_request(void)
+{
+  stop_request = 1;
+}
+
 /* Core functionality for execute and step */
 static int angel_RDI_ExecuteOrStep(PointHandle *handle, word type, 
                                    unsigned ninstr)
@@ -1397,15 +1407,25 @@ static int angel_RDI_ExecuteOrStep(PointHandle *handle, word type,
   angel_DebugPrint("Waiting for program to finish...\n");
 #endif
 
+  interrupt_request = FALSE;
+  stop_request = FALSE;
+  
+  signal(SIGINT, ardi_sigint_handler);
   while( executing )
   {
-      if (interrupt_request)
+    if (ui_loop_hook)
+      ui_loop_hook(0);
+    
+    if (interrupt_request || stop_request)
       {
         interrupt_target();
         interrupt_request = FALSE;
+        stop_request = FALSE;
       }
-      Adp_AsynchronousProcessing( async_block_on_nothing );
+    Adp_AsynchronousProcessing( async_block_on_nothing );
   }
+  signal(SIGINT, SIG_IGN);
+
 
 #ifdef TEST_DC_APPL
   Adp_Install_DC_Appl_Handler( NULL );
@@ -1821,7 +1841,7 @@ int angel_RDI_info(unsigned type, ARMword *arg1, ARMword *arg2) {
     len +=msgbuild(BUFFERDATA(packet->pk_buffer)+20, "%b%b%b%b%b", cpnum,
                    cpd->regdesc[cpnum].rmin, cpd->regdesc[cpnum].rmax,
                    cpd->regdesc[cpnum].nbytes, cpd->regdesc[cpnum].access);
-    if (cpd->regdesc[cpnum].access&0x3 == 0x3){
+    if ((cpd->regdesc[cpnum].access&0x3) == 0x3){
       len += msgbuild(BUFFERDATA(packet->pk_buffer)+25, "%b%b%b%b%b",
                       cpd->regdesc[cpnum].accessinst.cprt.read_b0,
                       cpd->regdesc[cpnum].accessinst.cprt.read_b1,
This page took 0.03687 seconds and 4 git commands to generate.