This is the mail archive of the insight@sourceware.org mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove use of deprecated_init_ui_hook


We currently use deprecated_init_ui_hook in order to
get hold of argv0 that started up gdb (this is used
in a call to Tcl_FindExecutable).

This patch to gdb:
  https://sourceware.org/ml/gdb-patches/2013-09/msg00225.html
adds a new function get_gdb_program_name () that allows
direct access to argv0.

The patch below switches to use the new function, and
removes the use of deprecated_init_ui_hook.

OK to apply?

Thanks,
Andrew

2013-09-18  Andrew Burgess  <aburgess@broadcom.com>

	* generic/gdbtk.c: Add include of "main.h".
	(gdbtk_init_1): Remove.
	(argv0): Remove.
	(_initialize_gdbtk): No longer set deprecated_init_ui_hook.
	(gdbtk_init): Use get_gdb_program_name function from main.h.

diff -u -p -r1.56 gdbtk.c
--- ./gdb/gdbtk/generic/gdbtk.c	23 Jul 2013 16:40:47 -0000	1.56
+++ ./gdb/gdbtk/generic/gdbtk.c	18 Sep 2013 13:38:51 -0000
@@ -31,6 +31,7 @@
 #include "top.h"
 #include "annotate.h"
 #include "exceptions.h"
+#include "main.h"
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 #define WIN32_LEAN_AND_MEAN
@@ -88,8 +89,6 @@ extern int Tktable_Init (Tcl_Interp * in
 
 void gdbtk_init (void);
 
-static void gdbtk_init_1 (char *argv0);
-
 void gdbtk_interactive (void);
 
 static void cleanup_init (void *ignore);
@@ -122,8 +121,6 @@ int running_now;
 static char *gdbtk_source_filename = NULL;
 
 int gdbtk_disable_fputs = 1;
-
-static const char *argv0; 
 
 #ifndef _WIN32
 
@@ -372,7 +369,7 @@ gdbtk_init (void)
   old_chain = make_cleanup (cleanup_init, 0);
 
   /* First init tcl and tk. */
-  Tcl_FindExecutable (argv0);
+  Tcl_FindExecutable (get_gdb_program_name ());
   gdbtk_interp = Tcl_CreateInterp ();
 
 #ifdef TCL_MEM_DEBUG
@@ -664,13 +661,6 @@ gdbtk_find_main";
     }
 }
 
-static void
-gdbtk_init_1 (char *arg0)
-{
-  argv0 = arg0;
-  deprecated_init_ui_hook = NULL;
-}
-
 /* gdbtk_test is used in main.c to validate the -tclcommand option to
    gdb, which sources in a file of tcl code after idle during the
    startup procedure. */
@@ -690,13 +680,11 @@ gdbtk_test (char *filename)
 void
 _initialize_gdbtk (void)
 {
+#ifdef __CYGWIN__
   /* Current_interpreter not set yet, so we must check
      if "interpreter_p" is set to "insight" to know if
      insight is GOING to run. */
-  if (strcmp (interpreter_p, "insight") == 0)
-    deprecated_init_ui_hook = gdbtk_init_1;
-#ifdef __CYGWIN__
-  else
+  if (strcmp (interpreter_p, "insight") != 0)
     {
       DWORD ft = GetFileType (GetStdHandle (STD_INPUT_HANDLE));
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]