This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[commit] `insight -i=gdbtk' works
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: insight at sources dot redhat dot com
- Date: Wed, 12 Feb 2003 17:13:43 +0100
- Subject: [commit] `insight -i=gdbtk' works
Hello,
The attached half fixes the insight startup problems. If you run either:
./insight -i=gdbtk
./gdb -w -i=gdbtk
it will start (well at least for me). However, if you run either of:
./insight -nx -i=gdbtk
./gdb -nw -i=gdbtk
it dumps core. If you haven't guessed, the missing bit involves
gdbtk_init(), init_ui_hook and use_windows.
committed,
Andrew
2003-02-12 Andrew Cagney <ac131313@redhat.com>
* generic/gdbtk-hooks.c (tk_command_loop): Move function ...
* generic/gdbtk.c (gdbtk_command_loop): ... to here. Add data
parameter.
* generic/gdbtk.c: Include "interps.h".
(_initialize_gdbtk): Register the "gdbtk" interpreter. Don't set
init_ui_hook.
(gdbtk_init): Change parameter to a void data pointer.
(tk_init, gdbtk_resume, gdbtk_suspend): New functions.
(gdbtk_prompt_p, gdbtk_exec): New functions.
* generic/gdbtk-hooks.c (gdbtk_add_hooks): Don't set
command_loop_hook. Update copyright.
Index: gdbtk/generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.30
diff -u -r1.30 gdbtk-hooks.c
--- gdbtk/generic/gdbtk-hooks.c 11 Feb 2003 16:08:38 -0000 1.30
+++ gdbtk/generic/gdbtk-hooks.c 12 Feb 2003 15:58:31 -0000
@@ -1,6 +1,7 @@
/* Startup code for Insight.
- Copyright 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002
- Free Software Foundation, Inc.
+
+ Copyright 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002, 2003 Free
+ Software Foundation, Inc.
Written by Stu Grossman <grossman@cygnus.com> of Cygnus Support.
@@ -84,7 +85,6 @@
static void gdbtk_detach (void);
static void gdbtk_file_changed (char *);
static void gdbtk_exec_file_display (char *);
-static void tk_command_loop (void);
static void gdbtk_call_command (struct cmd_list_element *, char *, int);
static ptid_t gdbtk_wait (ptid_t, struct target_waitstatus *);
int x_event (int);
@@ -134,7 +134,6 @@
set_gdb_event_hooks (&handlers);
/* Hooks */
- command_loop_hook = tk_command_loop;
call_command_hook = gdbtk_call_command;
set_hook = gdbtk_set_hook;
readline_begin_hook = gdbtk_readline_begin;
@@ -359,40 +358,6 @@
report_error ();
}
-
-/* This function is called instead of gdb's internal command loop. This is the
- last chance to do anything before entering the main Tk event loop.
- At the end of the command, we enter the main loop. */
-
-static void
-tk_command_loop ()
-{
- extern FILE *instream;
-
- /* We no longer want to use stdin as the command input stream */
- instream = NULL;
-
- if (Tcl_Eval (gdbtk_interp, "gdbtk_tcl_preloop") != TCL_OK)
- {
- const char *msg;
-
- /* Force errorInfo to be set up propertly. */
- Tcl_AddErrorInfo (gdbtk_interp, "");
-
- msg = Tcl_GetVar (gdbtk_interp, "errorInfo", TCL_GLOBAL_ONLY);
-#ifdef _WIN32
- MessageBox (NULL, msg, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
-#else
- fputs_unfiltered (msg, gdb_stderr);
-#endif
- }
-
-#ifdef _WIN32
- close_bfds ();
-#endif
-
- Tk_MainLoop ();
-}
/* This hook is installed as the ui_loop_hook, which is used in several
* places to keep the gui alive (x_event runs gdbtk's event loop). Users
Index: gdbtk/generic/gdbtk.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk.c,v
retrieving revision 1.32
diff -u -r1.32 gdbtk.c
--- gdbtk/generic/gdbtk.c 11 Feb 2003 16:08:38 -0000 1.32
+++ gdbtk/generic/gdbtk.c 12 Feb 2003 15:58:31 -0000
@@ -32,6 +32,7 @@
#include "cli-out.h"
#include "top.h"
#include "annotate.h"
+#include "interps.h"
#if defined(_WIN32) || defined(__CYGWIN__)
#define WIN32_LEAN_AND_MEAN
@@ -682,11 +683,90 @@
return 1;
}
+void *
+tk_init (void)
+{
+ /* FIXME: Should return the interpreter's context. */
+ return NULL;
+}
+
+int
+gdbtk_resume (void *data)
+{
+ return 1;
+}
+
+int
+gdbtk_suspend (void *data)
+{
+ return 1;
+}
+
+int
+gdbtk_prompt_p (void *data)
+{
+ return 0;
+}
+
+int
+gdbtk_exec (void *data, const char *command)
+{
+ internal_error (__FILE__, __LINE__, "tk_exec not implemented");
+}
+
+/* This function is called instead of gdb's internal command loop. This is the
+ last chance to do anything before entering the main Tk event loop.
+ At the end of the command, we enter the main loop. */
+
+static void
+gdbtk_command_loop (void *data)
+{
+ extern FILE *instream;
+
+ /* We no longer want to use stdin as the command input stream */
+ instream = NULL;
+
+ if (Tcl_Eval (gdbtk_interp, "gdbtk_tcl_preloop") != TCL_OK)
+ {
+ const char *msg;
+
+ /* Force errorInfo to be set up propertly. */
+ Tcl_AddErrorInfo (gdbtk_interp, "");
+
+ msg = Tcl_GetVar (gdbtk_interp, "errorInfo", TCL_GLOBAL_ONLY);
+#ifdef _WIN32
+ MessageBox (NULL, msg, NULL, MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+ fputs_unfiltered (msg, gdb_stderr);
+#endif
+ }
+
+#ifdef _WIN32
+ close_bfds ();
+#endif
+
+ Tk_MainLoop ();
+}
+
/* Come here during initialize_all_files () */
void
_initialize_gdbtk ()
{
+ static const struct interp_procs tk_procs =
+ {
+ tk_init,
+ gdbtk_resume,
+ gdbtk_suspend,
+ gdbtk_exec,
+ gdbtk_prompt_p,
+ gdbtk_command_loop,
+ };
+
+ interp_add (interp_new ("gdbtk", NULL, NULL, &tk_procs));
+
+ /* FIXME: cagney/2003-02-12: This is wrong. The initialization
+ should be done via the init function. */
if (use_windows)
{
/* Tell the rest of the world that Gdbtk is now set up. */