[PATCH] Remove use of deprecated_init_ui_hook

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Remove use of deprecated_init_ui_hook

Andrew Burgess-3
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  <[hidden email]>

        * 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));
 

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Remove use of deprecated_init_ui_hook

Andrew Burgess-3
On 20/09/2013 1:12 AM, Keith Seitz wrote:
> On 09/18/2013 06:45 AM, Andrew Burgess wrote:
>> The patch below switches to use the new function, and
>> removes the use of deprecated_init_ui_hook.
>>
>> OK to apply?
>
> Yes, this looks good. Thank you!

Committed.

Thanks,
Andrew