aboutsummaryrefslogtreecommitdiff
path: root/gdb/top.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-07-09 22:16:15 +0000
committerPedro Alves <palves@redhat.com>2008-07-09 22:16:15 +0000
commit8ea051c51f64f1f720b12a7424c56ac31ff9a58b (patch)
tree9ec47d09116f6c80e49cdf1d3a3bc1dce8c944b5 /gdb/top.c
parent4487aabf2e89820ee5243a62c3d7ea9c0c5353f4 (diff)
downloadfsf-binutils-gdb-8ea051c51f64f1f720b12a7424c56ac31ff9a58b.zip
fsf-binutils-gdb-8ea051c51f64f1f720b12a7424c56ac31ff9a58b.tar.gz
fsf-binutils-gdb-8ea051c51f64f1f720b12a7424c56ac31ff9a58b.tar.bz2
Add "executing" property to threads.
* inferior.h (target_executing): Delete. * gdbthread.h (struct thread_info): Add executing_ field. (set_executing, is_executing): New. * thread.c (main_thread_executing): New. (init_thread_list): Clear it and also main_thread_running. (is_running): Return false if target has no execution. (any_running, is_executing, set_executing): New. * top.c: Include "gdbthread.h". (target_executing): Delete. (execute_command): Replace target_executing check by any_running. * event-top.c: Include "gdbthread.h". (display_gdb_prompt, command_handler): Replace target_executing by is_running. * inf-loop.c: Include "gdbthread.h". Don't mark as not executing here. Replace target_executing by is_running. * infrun.c (handle_inferior_event): Mark all threads as not-executing. * linux-nat.c (linux_nat_resume): Don't mark thread as executing here. * stack.c (get_selected_block): Return null if inferior is executing. * target.c (target_resume): Mark resumed ptid as executing. * breakpoint.c (until_break_command): Replace target_executing check by is_executing. * remote.c (remote_async_resume): Don't mark inferior as executing here. * mi/mi-interp.c (mi_cmd_interpreter_exec): Replace target_executing by any_running. * mi/mi-main.c (mi_cmd_exec_interrupt, mi_cmd_execute) (mi_execute_async_cli_command): Replace target_executing by is_running. * frame.c (get_current_frame): Error out if the current thread is executing. (has_stack_frames): New. (get_selected_frame, deprecated_safe_get_selected_frame): Check has_stack_frames. * Makefile.in (event-top.o, frame.o, inf-loop.o, top.o): Depend on $(gdbthread_h).
Diffstat (limited to 'gdb/top.c')
-rw-r--r--gdb/top.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gdb/top.c b/gdb/top.c
index 4f0c58d..8489434 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -46,6 +46,7 @@
#include "gdb_assert.h"
#include "main.h"
#include "event-loop.h"
+#include "gdbthread.h"
/* readline include files */
#include "readline/readline.h"
@@ -181,12 +182,6 @@ int remote_timeout = 2;
int remote_debug = 0;
-/* Non-zero means the target is running. Note: this is different from
- saying that there is an active target and we are stopped at a
- breakpoint, for instance. This is a real indicator whether the
- target is off and running, which gdb is doing something else. */
-int target_executing = 0;
-
/* Sbrk location on entry to main. Used for statistics only. */
#ifdef HAVE_SBRK
char *lim_at_start;
@@ -422,7 +417,9 @@ execute_command (char *p, int from_tty)
/* If the target is running, we allow only a limited set of
commands. */
- if (target_can_async_p () && target_executing && !get_cmd_async_ok (c))
+ if (target_can_async_p ()
+ && any_running ()
+ && !get_cmd_async_ok (c))
error (_("Cannot execute this command while the target is running."));
/* Pass null arg rather than an empty one. */
@@ -486,7 +483,7 @@ execute_command (char *p, int from_tty)
/* FIXME: This should be cacheing the frame and only running when
the frame changes. */
- if (!target_executing && target_has_stack)
+ if (target_has_stack && !is_running (inferior_ptid))
{
flang = get_frame_language ();
if (!warned