public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Update for interpreter API
@ 2011-11-02 19:47 Keith Seitz
  0 siblings, 0 replies; only message in thread
From: Keith Seitz @ 2011-11-02 19:47 UTC (permalink / raw)
  To: insight

[-- Attachment #1: Type: text/plain, Size: 1163 bytes --]

Hi,

Some recent churn in GDB's interpreter API has left the insight build 
broken with:

../../src/gdb/gdbtk/generic/gdbtk-interp.c: In function 
‘_initialize_gdbtk_interp’:
../../src/gdb/gdbtk/generic/gdbtk-interp.c:168:5: error: initialization 
from incompatible pointer type
../../src/gdb/gdbtk/generic/gdbtk-interp.c:185:9: error: passing 
argument 2 of ‘interp_new’ from incompatible pointer type
../../src/gdb/interps.h:65:23: note: expected ‘const struct interp_procs 
*’ but argument is of type ‘struct gdbtk_interp_data *’
../../src/gdb/gdbtk/generic/gdbtk-interp.c:185:9: error: too many 
arguments to function ‘interp_new’
../../src/gdb/interps.h:65:23: note: declared here

The attached patch should fix that.

Keith

ChangeLog
2011-11-02  Keith Seitz  <keiths@redhat.com>

	* generic/gdbtk-interp.c (struct gdbtk_interp_data)
	<uiout>: New member.
	(gdbtk_data): Remove global.
	(gdbtk_interpreter_init): Update with GDB API changes.
	Allocate private intepreter data.
	(gdbtk_interpreter_ui_out): New function.
	(_initialize_gdbtk_interp): Add gdbtk_interpreter_ui_out to
	PROCS.
	Remove gdbtk_data and related allocation/initialization.

[-- Attachment #2: insight-interp.patch --]
[-- Type: text/x-patch, Size: 3148 bytes --]

Index: generic/gdbtk-interp.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-interp.c,v
retrieving revision 1.10
diff -u -p -r1.10 gdbtk-interp.c
--- generic/gdbtk-interp.c	18 Mar 2008 18:43:13 -0000	1.10
+++ generic/gdbtk-interp.c	2 Nov 2011 19:37:07 -0000
@@ -1,7 +1,7 @@
 /* Insight Definitions for GDB, the GNU debugger.
    Written by Keith Seitz <kseitz@sources.redhat.com>
 
-   Copyright (C) 2003, 2004, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2008, 2011 Free Software Foundation, Inc.
 
    This file is part of Insight.
 
@@ -50,10 +50,9 @@ struct gdbtk_interp_data
   struct ui_file *_stdlog;
   struct ui_file *_stdtarg;
   struct ui_file *_stdtargin;
+  struct ui_out *uiout;
 };
 
-static struct gdbtk_interp_data *gdbtk_data;
-
 /* See note in gdbtk_interpreter_init */
 static void
 hack_disable_interpreter_exec (char *args, int from_tty)
@@ -62,12 +61,21 @@ hack_disable_interpreter_exec (char *arg
 }
 
 static void *
-gdbtk_interpreter_init (int top_level)
+gdbtk_interpreter_init (struct interp *interp, int top_level)
 {
   /* Disable interpreter-exec. It causes us big trouble right now. */
   struct cmd_list_element *cmd = NULL;
   struct cmd_list_element *alias = NULL;
   struct cmd_list_element *prefix = NULL;
+  struct gdbtk_interp_data *data;
+
+  data = XZALLOC (struct gdbtk_interp_data);
+  data->_stdout = gdbtk_fileopen ();
+  data->_stderr = gdbtk_fileopen ();
+  data->_stdlog = gdbtk_fileopen ();
+  data->_stdtarg = gdbtk_fileopen ();
+  data->_stdtargin = gdbtk_fileopenin ();
+  data->uiout = cli_out_new (data->_stdout),
 
   gdbtk_init ();
 
@@ -76,7 +84,7 @@ gdbtk_interpreter_init (int top_level)
       set_cmd_cfunc (cmd, hack_disable_interpreter_exec);
     }
 
-  return gdbtk_data;
+  return data;
 }
 
 static int
@@ -161,6 +169,14 @@ gdbtk_command_loop (void)
   Tk_MainLoop ();
 }
 
+static struct ui_out *
+gdbtk_interpreter_ui_out (struct interp *interp)
+{
+  struct gdbtk_interp_data *data = interp_data (interp);
+
+  return data->uiout;
+}
+
 void
 _initialize_gdbtk_interp (void)
 {
@@ -169,19 +185,8 @@ _initialize_gdbtk_interp (void)
     gdbtk_interpreter_resume,           /* resume_proc */
     gdbtk_interpreter_suspend,	        /* suspend_proc */
     gdbtk_interpreter_exec,             /* exec_proc */
-    gdbtk_interpreter_display_prompt_p  /* prompt_proc_p */
+    gdbtk_interpreter_display_prompt_p, /* prompt_proc_p */
+    gdbtk_interpreter_ui_out		/* ui_out_proc */
   };
-  struct interp *gdbtk_interp;
-
-  gdbtk_data = 
-    (struct gdbtk_interp_data *) xmalloc (sizeof (struct gdbtk_interp_data));
-  memset (gdbtk_data, 0, sizeof (struct gdbtk_interp_data));
-  gdbtk_data->_stdout = gdbtk_fileopen ();
-  gdbtk_data->_stderr = gdbtk_fileopen ();
-  gdbtk_data->_stdlog = gdbtk_fileopen ();
-  gdbtk_data->_stdtarg = gdbtk_fileopen ();
-  gdbtk_data->_stdtargin = gdbtk_fileopenin ();
-  gdbtk_interp = interp_new ("insight", gdbtk_data, cli_out_new (gdbtk_data->_stdout),
-			     &procs);
-  interp_add (gdbtk_interp);
+  interp_add (interp_new ("insight", &procs));
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-02 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-02 19:47 [PATCH] Update for interpreter API Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).