mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
Change ints to bools around thread_info executing/resumed
Switch thread_info::resumed to bool (thread_info::executing already is a bool), and try to change everything more or less related to that to consistently use true/false instead of 1/0. gdb/ChangeLog: * fork-child.c (gdb_startup_inferior): Use bool instead of int. * gdbthread.h (class thread_info) <resumed>: Likewise. * infrun.c (resume_1): Likewise. (proceed): Likewise. (infrun_thread_stop_requested): Likewise. (stop_all_threads): Likewise. (handle_inferior_event): Likewise. (restart_threads): Likewise. (finish_step_over): Likewise. (keep_going_stepped_thread): Likewise. * linux-nat.c (attach_proc_task_lwp_callback): Likewise. (linux_handle_extended_wait): Likewise. * record-btrace.c (get_thread_current_frame_id): Likewise. * record-full.c (record_full_wait_1): Likewise. * remote.c (remote_target::process_initial_stop_replies): Likewise. * target.c (target_resume): Likewise. * thread.c (set_running_thread): Likewise.
This commit is contained in:
parent
c5d7be0c97
commit
719546c44f
@ -1,3 +1,23 @@
|
|||||||
|
2020-02-03 Simon Marchi <simon.marchi@efficios.com>
|
||||||
|
|
||||||
|
* fork-child.c (gdb_startup_inferior): Use bool instead of int.
|
||||||
|
* gdbthread.h (class thread_info) <resumed>: Likewise.
|
||||||
|
* infrun.c (resume_1): Likewise.
|
||||||
|
(proceed): Likewise.
|
||||||
|
(infrun_thread_stop_requested): Likewise.
|
||||||
|
(stop_all_threads): Likewise.
|
||||||
|
(handle_inferior_event): Likewise.
|
||||||
|
(restart_threads): Likewise.
|
||||||
|
(finish_step_over): Likewise.
|
||||||
|
(keep_going_stepped_thread): Likewise.
|
||||||
|
* linux-nat.c (attach_proc_task_lwp_callback): Likewise.
|
||||||
|
(linux_handle_extended_wait): Likewise.
|
||||||
|
* record-btrace.c (get_thread_current_frame_id): Likewise.
|
||||||
|
* record-full.c (record_full_wait_1): Likewise.
|
||||||
|
* remote.c (remote_target::process_initial_stop_replies): Likewise.
|
||||||
|
* target.c (target_resume): Likewise.
|
||||||
|
* thread.c (set_running_thread): Likewise.
|
||||||
|
|
||||||
2020-02-03 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
|
2020-02-03 Alok Kumar Sharma <AlokKumar.Sharma@amd.com>
|
||||||
|
|
||||||
* f-valprint.c (f77_print_array_1): Changed datatype of index
|
* f-valprint.c (f77_print_array_1): Changed datatype of index
|
||||||
|
@ -134,7 +134,7 @@ gdb_startup_inferior (pid_t pid, int num_traps)
|
|||||||
ptid_t ptid = startup_inferior (proc_target, pid, num_traps, NULL, NULL);
|
ptid_t ptid = startup_inferior (proc_target, pid, num_traps, NULL, NULL);
|
||||||
|
|
||||||
/* Mark all threads non-executing. */
|
/* Mark all threads non-executing. */
|
||||||
set_executing (proc_target, ptid, 0);
|
set_executing (proc_target, ptid, false);
|
||||||
|
|
||||||
return ptid;
|
return ptid;
|
||||||
}
|
}
|
||||||
|
@ -301,20 +301,20 @@ class thread_info : public refcounted_object
|
|||||||
if the thread does not have a user-given name. */
|
if the thread does not have a user-given name. */
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
||||||
/* Non-zero means the thread is executing. Note: this is different
|
/* True means the thread is executing. Note: this is different
|
||||||
from saying that there is an active target and we are stopped at
|
from saying that there is an active target and we are stopped at
|
||||||
a breakpoint, for instance. This is a real indicator whether the
|
a breakpoint, for instance. This is a real indicator whether the
|
||||||
thread is off and running. */
|
thread is off and running. */
|
||||||
bool executing = false;
|
bool executing = false;
|
||||||
|
|
||||||
/* Non-zero if this thread is resumed from infrun's perspective.
|
/* True if this thread is resumed from infrun's perspective.
|
||||||
Note that a thread can be marked both as not-executing and
|
Note that a thread can be marked both as not-executing and
|
||||||
resumed at the same time. This happens if we try to resume a
|
resumed at the same time. This happens if we try to resume a
|
||||||
thread that has a wait status pending. We shouldn't let the
|
thread that has a wait status pending. We shouldn't let the
|
||||||
thread really run until that wait status has been processed, but
|
thread really run until that wait status has been processed, but
|
||||||
we should not process that wait status if we didn't try to let
|
we should not process that wait status if we didn't try to let
|
||||||
the thread run. */
|
the thread run. */
|
||||||
int resumed = 0;
|
bool resumed = false;
|
||||||
|
|
||||||
/* Frontend view of the thread state. Note that the THREAD_RUNNING/
|
/* Frontend view of the thread state. Note that the THREAD_RUNNING/
|
||||||
THREAD_STOPPED states are different from EXECUTING. When the
|
THREAD_STOPPED states are different from EXECUTING. When the
|
||||||
|
24
gdb/infrun.c
24
gdb/infrun.c
@ -2282,7 +2282,7 @@ resume_1 (enum gdb_signal sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tp->inf->process_target ()->threads_executing = true;
|
tp->inf->process_target ()->threads_executing = true;
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
|
|
||||||
/* FIXME: What should we do if we are supposed to resume this
|
/* FIXME: What should we do if we are supposed to resume this
|
||||||
thread with a signal? Maybe we should maintain a queue of
|
thread with a signal? Maybe we should maintain a queue of
|
||||||
@ -2410,7 +2410,7 @@ resume_1 (enum gdb_signal sig)
|
|||||||
|
|
||||||
resume_ptid = internal_resume_ptid (user_step);
|
resume_ptid = internal_resume_ptid (user_step);
|
||||||
do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
|
do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2622,7 +2622,7 @@ resume_1 (enum gdb_signal sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_target_resume (resume_ptid, step, sig);
|
do_target_resume (resume_ptid, step, sig);
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resume the inferior. SIG is the signal to give the inferior
|
/* Resume the inferior. SIG is the signal to give the inferior
|
||||||
@ -3022,7 +3022,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
|
|||||||
inferior function, as in that case we pretend the inferior
|
inferior function, as in that case we pretend the inferior
|
||||||
doesn't run at all. */
|
doesn't run at all. */
|
||||||
if (!cur_thr->control.in_infcall)
|
if (!cur_thr->control.in_infcall)
|
||||||
set_running (resume_target, resume_ptid, 1);
|
set_running (resume_target, resume_ptid, true);
|
||||||
|
|
||||||
if (debug_infrun)
|
if (debug_infrun)
|
||||||
fprintf_unfiltered (gdb_stdlog,
|
fprintf_unfiltered (gdb_stdlog,
|
||||||
@ -3306,7 +3306,7 @@ infrun_thread_stop_requested (ptid_t ptid)
|
|||||||
/* Otherwise we can process the (new) pending event now. Set
|
/* Otherwise we can process the (new) pending event now. Set
|
||||||
it so this pending event is considered by
|
it so this pending event is considered by
|
||||||
do_target_wait. */
|
do_target_wait. */
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4749,7 +4749,7 @@ stop_all_threads (void)
|
|||||||
|
|
||||||
/* The thread may be not executing, but still be
|
/* The thread may be not executing, but still be
|
||||||
resumed with a pending status to process. */
|
resumed with a pending status to process. */
|
||||||
t->resumed = 0;
|
t->resumed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4788,7 +4788,7 @@ stop_all_threads (void)
|
|||||||
|
|
||||||
t->stop_requested = 0;
|
t->stop_requested = 0;
|
||||||
t->executing = 0;
|
t->executing = 0;
|
||||||
t->resumed = 0;
|
t->resumed = false;
|
||||||
t->control.may_range_step = 0;
|
t->control.may_range_step = 0;
|
||||||
|
|
||||||
/* This may be the first time we see the inferior report
|
/* This may be the first time we see the inferior report
|
||||||
@ -5126,10 +5126,10 @@ handle_inferior_event (struct execution_control_state *ecs)
|
|||||||
else
|
else
|
||||||
mark_ptid = ecs->ptid;
|
mark_ptid = ecs->ptid;
|
||||||
|
|
||||||
set_executing (ecs->target, mark_ptid, 0);
|
set_executing (ecs->target, mark_ptid, false);
|
||||||
|
|
||||||
/* Likewise the resumed flag. */
|
/* Likewise the resumed flag. */
|
||||||
set_resumed (ecs->target, mark_ptid, 0);
|
set_resumed (ecs->target, mark_ptid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ecs->ws.kind)
|
switch (ecs->ws.kind)
|
||||||
@ -5623,7 +5623,7 @@ restart_threads (struct thread_info *event_thread)
|
|||||||
"infrun: restart threads: "
|
"infrun: restart threads: "
|
||||||
"[%s] has pending status\n",
|
"[%s] has pending status\n",
|
||||||
target_pid_to_str (tp->ptid).c_str ());
|
target_pid_to_str (tp->ptid).c_str ());
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5763,7 +5763,7 @@ finish_step_over (struct execution_control_state *ecs)
|
|||||||
/* This was cleared early, by handle_inferior_event. Set it
|
/* This was cleared early, by handle_inferior_event. Set it
|
||||||
so this pending event is considered by
|
so this pending event is considered by
|
||||||
do_target_wait. */
|
do_target_wait. */
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
|
|
||||||
gdb_assert (!tp->executing);
|
gdb_assert (!tp->executing);
|
||||||
|
|
||||||
@ -7424,7 +7424,7 @@ keep_going_stepped_thread (struct thread_info *tp)
|
|||||||
get_frame_address_space (frame),
|
get_frame_address_space (frame),
|
||||||
tp->suspend.stop_pc);
|
tp->suspend.stop_pc);
|
||||||
|
|
||||||
tp->resumed = 1;
|
tp->resumed = true;
|
||||||
resume_ptid = internal_resume_ptid (tp->control.stepping_command);
|
resume_ptid = internal_resume_ptid (tp->control.stepping_command);
|
||||||
do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
|
do_target_resume (resume_ptid, 0, GDB_SIGNAL_0);
|
||||||
}
|
}
|
||||||
|
@ -1166,8 +1166,8 @@ attach_proc_task_lwp_callback (ptid_t ptid)
|
|||||||
matching libthread_db is not found (or the process uses
|
matching libthread_db is not found (or the process uses
|
||||||
raw clone). */
|
raw clone). */
|
||||||
add_thread (linux_target, lp->ptid);
|
add_thread (linux_target, lp->ptid);
|
||||||
set_running (linux_target, lp->ptid, 1);
|
set_running (linux_target, lp->ptid, true);
|
||||||
set_executing (linux_target, lp->ptid, 1);
|
set_executing (linux_target, lp->ptid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -2038,8 +2038,8 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
|
|||||||
internal to this module, from the perspective of infrun
|
internal to this module, from the perspective of infrun
|
||||||
and the user/frontend, this new thread is running until
|
and the user/frontend, this new thread is running until
|
||||||
it next reports a stop. */
|
it next reports a stop. */
|
||||||
set_running (linux_target, new_lp->ptid, 1);
|
set_running (linux_target, new_lp->ptid, true);
|
||||||
set_executing (linux_target, new_lp->ptid, 1);
|
set_executing (linux_target, new_lp->ptid, true);
|
||||||
|
|
||||||
if (WSTOPSIG (status) != SIGSTOP)
|
if (WSTOPSIG (status) != SIGSTOP)
|
||||||
{
|
{
|
||||||
|
@ -1958,7 +1958,7 @@ static struct frame_id
|
|||||||
get_thread_current_frame_id (struct thread_info *tp)
|
get_thread_current_frame_id (struct thread_info *tp)
|
||||||
{
|
{
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
int executing;
|
bool executing;
|
||||||
|
|
||||||
/* Set current thread, which is implicitly used by
|
/* Set current thread, which is implicitly used by
|
||||||
get_current_frame. */
|
get_current_frame. */
|
||||||
|
@ -1267,12 +1267,12 @@ record_full_wait_1 (struct target_ops *ops,
|
|||||||
|
|
||||||
/* Try to insert the software single step breakpoint.
|
/* Try to insert the software single step breakpoint.
|
||||||
If insert success, set step to 0. */
|
If insert success, set step to 0. */
|
||||||
set_executing (proc_target, inferior_ptid, 0);
|
set_executing (proc_target, inferior_ptid, false);
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
|
|
||||||
step = !insert_single_step_breakpoints (gdbarch);
|
step = !insert_single_step_breakpoints (gdbarch);
|
||||||
|
|
||||||
set_executing (proc_target, inferior_ptid, 1);
|
set_executing (proc_target, inferior_ptid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record_debug)
|
if (record_debug)
|
||||||
|
@ -4449,8 +4449,8 @@ remote_target::process_initial_stop_replies (int from_tty)
|
|||||||
|| ws.value.sig != GDB_SIGNAL_0)
|
|| ws.value.sig != GDB_SIGNAL_0)
|
||||||
evthread->suspend.waitstatus_pending_p = 1;
|
evthread->suspend.waitstatus_pending_p = 1;
|
||||||
|
|
||||||
set_executing (this, event_ptid, 0);
|
set_executing (this, event_ptid, false);
|
||||||
set_running (this, event_ptid, 0);
|
set_running (this, event_ptid, false);
|
||||||
get_remote_thread_info (evthread)->vcont_resumed = 0;
|
get_remote_thread_info (evthread)->vcont_resumed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2127,7 +2127,7 @@ target_resume (ptid_t ptid, int step, enum gdb_signal signal)
|
|||||||
/* We only set the internal executing state here. The user/frontend
|
/* We only set the internal executing state here. The user/frontend
|
||||||
running state is set at a higher level. This also clears the
|
running state is set at a higher level. This also clears the
|
||||||
thread's stop_pc as side effect. */
|
thread's stop_pc as side effect. */
|
||||||
set_executing (curr_target, ptid, 1);
|
set_executing (curr_target, ptid, true);
|
||||||
clear_inline_frame_state (curr_target, ptid);
|
clear_inline_frame_state (curr_target, ptid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,13 +823,13 @@ set_resumed (process_stratum_target *targ, ptid_t ptid, bool resumed)
|
|||||||
/* Helper for set_running, that marks one thread either running or
|
/* Helper for set_running, that marks one thread either running or
|
||||||
stopped. */
|
stopped. */
|
||||||
|
|
||||||
static int
|
static bool
|
||||||
set_running_thread (struct thread_info *tp, int running)
|
set_running_thread (struct thread_info *tp, bool running)
|
||||||
{
|
{
|
||||||
int started = 0;
|
bool started = false;
|
||||||
|
|
||||||
if (running && tp->state == THREAD_STOPPED)
|
if (running && tp->state == THREAD_STOPPED)
|
||||||
started = 1;
|
started = true;
|
||||||
tp->state = running ? THREAD_RUNNING : THREAD_STOPPED;
|
tp->state = running ? THREAD_RUNNING : THREAD_STOPPED;
|
||||||
|
|
||||||
if (!running)
|
if (!running)
|
||||||
|
Loading…
Reference in New Issue
Block a user