Replace "exec" with "executable" in messages.
[deliverable/binutils-gdb.git] / gdb / v850ice.c
index d94ccdddfe3aa43f9bddf39c79a94bf78287e5ad..bbf5b9e41c276d251b94f465376c706fc23f4351 100755 (executable)
@@ -56,6 +56,8 @@ extern void continue_command PARAMS ((char *, int));
 
 extern HINSTANCE Tk_GetHINSTANCE PARAMS ((void));
 
+extern void (*ui_loop_hook) PARAMS ((int));
+
 /* Prototypes for local functions */
 static int init_hidden_window PARAMS ((void));
 
@@ -78,6 +80,8 @@ static void v850ice_open PARAMS ((char *name, int from_tty));
 
 static void v850ice_close PARAMS ((int quitting));
 
+static void v850ice_stop PARAMS ((void));
+
 static void v850ice_store_registers PARAMS ((int regno));
 
 static void v850ice_mourn PARAMS ((void));
@@ -118,6 +122,8 @@ static int ice_nexti PARAMS ((char *));
 
 static void togdb_force_update PARAMS ((void));
 
+static void view_source PARAMS ((CORE_ADDR));
+
 /* Globals */
 static HWND hidden_hwnd;                 /* HWND for messages */
 
@@ -171,6 +177,7 @@ static int SimulateCallback;    /* simulate a callback event */
 #define WM_SYM_TO_ADDR  WM_USER+102
 #define WM_ADDR_TO_SYM  WM_USER+103
 #define WM_DISASSEMBLY  WM_USER+104
+#define WM_SOURCE       WM_USER+105
 
 /* STATE_CHANGE codes */
 #define STATE_CHANGE_REGS   1   /* Register(s) changed */
@@ -251,6 +258,9 @@ v850ice_wndproc (hwnd, message, wParam, lParam)
     case WM_ADDR_TO_SYM:
       MessageBox (0, "Address resolution\nNot implemented", "GDB", MB_OK);
       break;
+    case WM_SOURCE:
+      view_source ((CORE_ADDR) lParam);
+      break;
     case WM_STATE_CHANGE:
       switch (wParam)
         {
@@ -382,6 +392,14 @@ v850ice_close (quitting)
     }
 }
 
+/* Stop the process on the ice. */
+static void
+v850ice_stop ()
+{
+  /* This is silly, but it works... */
+  v850ice_command ("stop", 0);
+}
+
 static void
 v850ice_detach (args, from_tty)
      char *args;
@@ -432,11 +450,19 @@ v850ice_wait (pid, status)
   char buf[256];
   struct MessageIO  iob;
   int done = 0;
+  int count = 0;
+
   iob.size = 0;
   iob.buf  = buf;
   
   do
     {
+      if (count++ % 100000)
+        {
+          ui_loop_hook (-2);
+          count = 0;
+        }
+
       v850_status = ExeAppReq ("GDB", GCHECKSTATUS, NULL, &iob);
 
       switch (v850_status)
@@ -767,7 +793,7 @@ v850ice_load (filename, from_tty)
   iob.size = 0;
   iob.buf  = buf;
   generic_load(filename, from_tty);
-  ExeAppReq ("GDB", GDOWNLOAD, NULL, &iob);
+  ExeAppReq ("GDB", GDOWNLOAD, filename, &iob);
 }
 
 static int
@@ -811,9 +837,9 @@ static int
 ice_cont (c)
   char *c;
 {
-  printf_unfiltered ("continue (ice)\n");
-  continue_command (NULL, 1);
-  togdb_force_update ();
+  printf_filtered ("continue (ice)");
+  ReplyMessage ((LRESULT) 1);
+  Tcl_Eval (gdbtk_interp, "gdb_immediate continue");
   return 1;
 }
 
@@ -821,15 +847,13 @@ static int
 ice_stepi (c)
   char *c;
 {
-  char count_string[10] = "\0";
+  char string[50] = "\0";
   int count = (int) c;
 
-  sprintf (count_string, "%d", count);
-
+  sprintf (string, "gdb_immediate stepi %d", count);
   printf_unfiltered ("stepi (ice)\n");
-  stepi_command (count_string, 1);
   ReplyMessage ((LRESULT) 1);
-  togdb_force_update ();
+  Tcl_Eval (gdbtk_interp, string);
   return 1;
 }
 
@@ -837,14 +861,13 @@ static int
 ice_nexti (c)
   char *c;
 {
-  char count_string[10] = "\0";
+  char string[50] = "\0";
   int count = (int) c;
 
-  sprintf (count_string, "%d", count);
-
+  sprintf (string, "gdb_immediate nexti %d", count);
   printf_unfiltered ("nexti (ice)\n");
-  nexti_command (count_string, 1);
-  togdb_force_update ();
+  ReplyMessage ((LRESULT) 1);
+  Tcl_Eval (gdbtk_interp, string);
   return 1;
 }
 
@@ -867,6 +890,16 @@ togdb_force_update (void)
   Tcl_Eval (gdbtk_interp, "gdbtk_update");
 }
 
+static void
+view_source (addr)
+     CORE_ADDR addr;
+{
+  char c[256];
+
+  sprintf (c, "set src [lindex [manage find src] 0]\n$src location [gdb_loc *0x%x]", addr);
+  Tcl_Eval (gdbtk_interp, c);
+}
+
 /* Define the target subroutine names */
 
 static void init_850ice_ops(void)
@@ -900,7 +933,7 @@ static void init_850ice_ops(void)
   v850ice_ops.to_can_run         =   0;                
   v850ice_ops.to_notice_signals  =   0;                
   v850ice_ops.to_thread_alive    =    NULL;    
-  v850ice_ops.to_stop            =   0;                        
+  v850ice_ops.to_stop            =   v850ice_stop;
   v850ice_ops.to_stratum         =   process_stratum;  
   v850ice_ops.DONT_USE           =   NULL;             
   v850ice_ops.to_has_all_memory  =   1;                
This page took 0.025639 seconds and 4 git commands to generate.