Replace "exec" with "executable" in messages.
[deliverable/binutils-gdb.git] / gdb / gdbtk-hooks.c
index b76f2ff03c5467f65abf01dfedb202582b784bb1..ff2e7f51d90dc85efae6d6cf939ea25be30fe361 100644 (file)
@@ -73,13 +73,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 int in_fputs = 0;
 
-int (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
-void (*pre_add_symbol_hook) PARAMS ((char *));
-void (*post_add_symbol_hook) PARAMS ((void));
+extern int  (*ui_load_progress_hook) PARAMS ((char *, unsigned long));
+extern void (*pre_add_symbol_hook) PARAMS ((char *));
+extern void (*post_add_symbol_hook) PARAMS ((void));
+extern void (*selected_frame_level_changed_hook) PARAMS ((int));
 
 #ifdef __CYGWIN32__
 extern void (*ui_loop_hook) PARAMS ((int));
 #endif
+
 static void   gdbtk_create_tracepoint PARAMS ((struct tracepoint *));
 static void   gdbtk_delete_tracepoint PARAMS ((struct tracepoint *));
 static void   gdbtk_modify_tracepoint PARAMS ((struct tracepoint *));
@@ -107,6 +109,8 @@ static void gdbtk_print_frame_info PARAMS ((struct symtab *, int, int, int));
 static void gdbtk_post_add_symbol PARAMS ((void));
 static void pc_changed PARAMS ((void));
 static void tracepoint_notify PARAMS ((struct tracepoint *, const char *));
+static void gdbtk_selected_frame_changed PARAMS ((int));
+static void gdbtk_context_change PARAMS ((int));
 
 /*
  * gdbtk_fputs can't be static, because we need to call it in gdbtk.c.
@@ -153,7 +157,8 @@ gdbtk_add_hooks(void)
   delete_tracepoint_hook = gdbtk_delete_tracepoint;
   modify_tracepoint_hook = gdbtk_modify_tracepoint;
   pc_changed_hook = pc_changed;
-
+  selected_frame_level_changed_hook = gdbtk_selected_frame_changed;
+  context_hook = gdbtk_context_change;
 }
 
 /* These control where to put the gdb output which is created by
@@ -297,16 +302,11 @@ void
 gdbtk_ignorable_warning (warning)
      const char *warning;
 {
-  char buf[200], *merge[2];
-  char *command;
-
+  char buf[512];
   sprintf (buf, warning);
   gdbtk_two_elem_cmd ("gdbtk_tcl_ignorable_warning", buf);
-
 }
 
-
-
 static void
 pc_changed()
 {
@@ -402,8 +402,7 @@ gdbtk_readline_begin (va_alist)
 #endif
 {
   va_list args;
-  char buf[200], *merge[2];
-  char *command;
+  char buf[200];
 
 #ifdef ANSI_PROTOTYPES
   va_start (args, format);
@@ -458,34 +457,34 @@ gdbtk_call_command (cmdblk, arg, from_tty)
   if (cmdblk->class == class_run || cmdblk->class == class_trace)
     {
 
-/* HACK! HACK! This is to get the gui to update the tstart/tstop
-   button only incase of tstart/tstop commands issued from the console
-   We don't want to update the src window, so we need to have specific
-   procedures to do tstart and tstop
-   Unfortunately this will not display errors from tstart or tstop in the 
-   console window itself, but as dialogs.*/
+      /* HACK! HACK! This is to get the gui to update the tstart/tstop
+         button only incase of tstart/tstop commands issued from the console
+         We don't want to update the src window, so we need to have specific
+         procedures to do tstart and tstop
+         Unfortunately this will not display errors from tstart or tstop in the 
+         console window itself, but as dialogs.*/
 
       if (!strcmp(cmdblk->name, "tstart") && !No_Update)
         {
-              Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstart"); 
-              (*cmdblk->function.cfunc)(arg, from_tty);
+          Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstart"); 
+          (*cmdblk->function.cfunc)(arg, from_tty);
         }
       else if (!strcmp(cmdblk->name, "tstop") && !No_Update) 
-             {
-              Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstop"); 
-              (*cmdblk->function.cfunc)(arg, from_tty);
-             }
-/* end of hack */
-           else 
-             {
-                 running_now = 1;
-                 if (!No_Update)
-                   Tcl_Eval (gdbtk_interp, "gdbtk_tcl_busy");
-                 (*cmdblk->function.cfunc)(arg, from_tty);
-                 running_now = 0;
-                 if (!No_Update)
-                   Tcl_Eval (gdbtk_interp, "gdbtk_tcl_idle");
-             }
+        {
+          Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstop"); 
+          (*cmdblk->function.cfunc)(arg, from_tty);
+        }
+      /* end of hack */
+      else 
+        {
+          running_now = 1;
+          if (!No_Update)
+            Tcl_Eval (gdbtk_interp, "gdbtk_tcl_busy");
+          (*cmdblk->function.cfunc)(arg, from_tty);
+          running_now = 0;
+          if (!No_Update)
+            Tcl_Eval (gdbtk_interp, "gdbtk_tcl_idle");
+        }
     }
   else
     (*cmdblk->function.cfunc)(arg, from_tty);
@@ -594,7 +593,9 @@ gdbtk_wait (pid, ourstatus)
      int pid;
      struct target_waitstatus *ourstatus;
 {
-  gdbtk_start_timer ();
+  /* Don't run the timer on various targets... */
+  if (!STREQ (target_shortname, "ice"))
+    gdbtk_start_timer ();
   pid = target_wait (pid, ourstatus);
   gdbtk_stop_timer ();
   return pid;
@@ -674,7 +675,7 @@ tracepoint_notify(tp, action)
   filename = symtab_to_filename (sal.symtab);
   if (filename == NULL)
     filename = "N/A";
-  sprintf (buf, "gdbtk_tcl_tracepoint %s %d 0x%lx %d {%s}", action, tp->number, 
+  sprintf (buf, "gdbtk_tcl_tracepoint %s %d 0x%lx %d {%s} %d", action, tp->number, 
           (long)tp->address, sal.line, filename, tp->pass_count);
 
   v = Tcl_Eval (gdbtk_interp, buf);
@@ -686,4 +687,18 @@ tracepoint_notify(tp, action)
     }
 }
 
+static void
+gdbtk_selected_frame_changed (level)
+     int level;
+{
+  Tcl_UpdateLinkedVar (gdbtk_interp, "gdb_selected_frame_level");
+}
 
+/* Called when the current thread changes. */
+/* gdb_context is linked to the tcl variable "gdb_context_id" */
+static void
+gdbtk_context_change (num)
+     int num;
+{
+  gdb_context = num;
+}
This page took 0.026499 seconds and 4 git commands to generate.