aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>1998-08-30 07:53:29 +0000
committerMartin Hunt <hunt@redhat.com>1998-08-30 07:53:29 +0000
commit4ff5d55a081fbb280b68d912bf3a4b5f26541b5c (patch)
tree39ec26e18a03d02cc992a5afe7b352eb3b36b6e6 /gdb
parentd405c4a1aec90299f768f191e63494407ce84536 (diff)
downloadfsf-binutils-gdb-4ff5d55a081fbb280b68d912bf3a4b5f26541b5c.zip
fsf-binutils-gdb-4ff5d55a081fbb280b68d912bf3a4b5f26541b5c.tar.gz
fsf-binutils-gdb-4ff5d55a081fbb280b68d912bf3a4b5f26541b5c.tar.bz2
Sun Aug 30 00:49:18 1998 Martin M. Hunt <hunt@cygnus.com>
* gdbtk-cmds.c (Gdbtk_Init): Link C variable gdb_context with tcl variable gdb_context_id. * gdbtk-hooks.c (gdbtk_context_change): Implement new hook called context_hook. Called when threads change. * gdbtk.c: Initialize gdb_context. * gdbtk.h: Declare gdb_context. * infrun (wait_for_inferior): Call context_hook. * thread.c (thread_command): Call context_hook. * defs.h: Declare context_hook.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog-gdbtk18
-rw-r--r--gdb/gdbtk-cmds.c7
-rw-r--r--gdb/gdbtk-hooks.c13
-rw-r--r--gdb/gdbtk.c6
-rw-r--r--gdb/gdbtk.h3
-rw-r--r--gdb/thread.c3
6 files changed, 44 insertions, 6 deletions
diff --git a/gdb/ChangeLog-gdbtk b/gdb/ChangeLog-gdbtk
index db6dfaf..ca33c68 100644
--- a/gdb/ChangeLog-gdbtk
+++ b/gdb/ChangeLog-gdbtk
@@ -1,3 +1,21 @@
+Sun Aug 30 00:49:18 1998 Martin M. Hunt <hunt@cygnus.com>
+
+ * gdbtk-cmds.c (Gdbtk_Init): Link C variable gdb_context
+ with tcl variable gdb_context_id.
+
+ * gdbtk-hooks.c (gdbtk_context_change): Implement new hook called
+ context_hook. Called when threads change.
+
+ * gdbtk.c: Initialize gdb_context.
+
+ * gdbtk.h: Declare gdb_context.
+
+ * infrun (wait_for_inferior): Call context_hook.
+
+ * thread.c (thread_command): Call context_hook.
+
+ * defs.h: Declare context_hook.
+
Fri Aug 28 12:14:49 1998 Martin M. Hunt <hunt@cygnus.com>
* gdbtk-cmds.c (gdb_loadfile): Open the file after doing
diff --git a/gdb/gdbtk-cmds.c b/gdb/gdbtk-cmds.c
index fba5357..15ba833 100644
--- a/gdb/gdbtk-cmds.c
+++ b/gdb/gdbtk-cmds.c
@@ -304,10 +304,15 @@ Gdbtk_Init (interp)
call_wrapper, gdb_get_trace_frame_num, NULL);
Tcl_CreateObjCommand (interp, "gdb_stack", call_wrapper, gdb_stack, NULL);
- Tcl_LinkVar (interp, "gdb_selected_frame_level",
+ Tcl_LinkVar (interp, "gdb_selected_frame_level",
(char *) &selected_frame_level,
TCL_LINK_INT | TCL_LINK_READ_ONLY);
+ /* gdb_context is used for debugging multiple threads or tasks */
+ Tcl_LinkVar (interp, "gdb_context_id",
+ (char *) &gdb_context,
+ TCL_LINK_INT | TCL_LINK_READ_ONLY);
+
Tcl_PkgProvide(interp, "Gdbtk", GDBTK_VERSION);
return TCL_OK;
}
diff --git a/gdb/gdbtk-hooks.c b/gdb/gdbtk-hooks.c
index b3178bb..d4a9fa1 100644
--- a/gdb/gdbtk-hooks.c
+++ b/gdb/gdbtk-hooks.c
@@ -110,6 +110,8 @@ 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));
+void (*context_hook) PARAMS ((int));
/*
* gdbtk_fputs can't be static, because we need to call it in gdbtk.c.
@@ -157,7 +159,7 @@ gdbtk_add_hooks(void)
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
@@ -690,3 +692,12 @@ gdbtk_selected_frame_changed (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;
+}
diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c
index e8d31ad..c59821f 100644
--- a/gdb/gdbtk.c
+++ b/gdb/gdbtk.c
@@ -102,21 +102,21 @@ Tcl_Interp *gdbtk_interp = NULL;
static int gdbtk_timer_going = 0;
+/* linked variable used to tell tcl what the current thread is */
+int gdb_context = 0;
+
/* This variable is true when the inferior is running. See note in
* gdbtk.h for details.
*/
-
int running_now;
/* This variable determines where memory used for disassembly is read from.
* See note in gdbtk.h for details.
*/
-
int disassemble_from_exec = -1;
/* This variable holds the name of a Tcl file which should be sourced by the
interpreter when it goes idle at startup. Used with the testsuite. */
-
static char *gdbtk_source_filename = NULL;
#ifndef _WIN32
diff --git a/gdb/gdbtk.h b/gdb/gdbtk.h
index a98be7a..a138a33 100644
--- a/gdb/gdbtk.h
+++ b/gdb/gdbtk.h
@@ -120,6 +120,9 @@ typedef struct gdbtk_result {
extern gdbtk_result *result_ptr;
+/* GDB context identifier */
+extern int gdb_context;
+
/*
* These functions are used in all the modules of Gdbtk.
*
diff --git a/gdb/thread.c b/gdb/thread.c
index 4c158ff..8c61a56 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -518,7 +518,8 @@ see the IDs of currently known threads.", num);
error ("Thread ID %d has terminated.\n", num);
switch_to_thread (tp->pid);
-
+ if (context_hook)
+ context_hook (num);
printf_filtered ("[Switching to %s]\n", target_pid_to_str (inferior_pid));
print_stack_frame (selected_frame, selected_frame_level, 1);
}