summaryrefslogtreecommitdiff
path: root/gdb/gdbthread.h
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2008-07-09 22:16:15 +0000
committerPedro Alves <pedro@codesourcery.com>2008-07-09 22:16:15 +0000
commitd065f280b0e34d3e76f483f1c8eb50dcb491eab9 (patch)
tree36f31c3a12e0059770381f206d62d17f637e9689 /gdb/gdbthread.h
parent37f7f50449affa0e4d50deb20b422d98491ee664 (diff)
downloadgdb-d065f280b0e34d3e76f483f1c8eb50dcb491eab9.tar.gz
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/gdbthread.h')
-rw-r--r--gdb/gdbthread.h35
1 files changed, 30 insertions, 5 deletions
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 2ed3cb6444f..389b2fc24fc 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -41,6 +41,25 @@ struct thread_info
In fact, this may be overloaded with
kernel thread id, etc. */
int num; /* Convenient handle (GDB thread id) */
+
+ /* Non-zero means the thread is executing. 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
+ thread is off and running. */
+ /* This field is internal to thread.c. Never access it directly,
+ use is_executing instead. */
+ int executing_;
+
+ /* Frontend view of the running state. Note that this is different
+ from EXECUTING. When the thread is stopped internally while
+ handling an internal event, like a software single-step
+ breakpoint, executing will be false, but running will still be
+ true. As a possible future extension, this could turn into
+ enum { stopped, stepping, finishing, until(ling), ... } */
+ /* This field is internal to thread.c. Never access it directly,
+ use is_running instead. */
+ int running_;
+
/* State from wait_for_inferior */
CORE_ADDR prev_pc;
struct breakpoint *step_resume_breakpoint;
@@ -63,10 +82,6 @@ struct thread_info
when we finally do stop stepping. */
bpstat stepping_through_solib_catchpoints;
- /* This field is internal for thread.c. Never access it directly,
- use is_running instead. */
- int running_;
-
/* Private data used by the target vector implementation. */
struct private_thread_info *private;
};
@@ -161,9 +176,19 @@ extern void switch_to_thread (ptid_t ptid);
If PIDGET (PTID) is -1, marks all threads. */
extern void set_running (ptid_t ptid, int running);
-/* Reports if thread PTID is know to be running right now. */
+/* Reports if thread PTID is known to be running right now. */
extern int is_running (ptid_t ptid);
+/* Reports if any thread is known to be running right now. */
+extern int any_running (void);
+
+/* Marks thread PTID as executing, or as stopped.
+ If PIDGET (PTID) is -1, marks all threads. */
+extern void set_executing (ptid_t ptid, int executing);
+
+/* Reports if thread PTID is executing. */
+extern int is_executing (ptid_t ptid);
+
/* Commands with a prefix of `thread'. */
extern struct cmd_list_element *thread_cmd_list;