/* Memory-access and commands for "inferior" process, for GDB.
- Copyright (C) 1986-2018 Free Software Foundation, Inc.
+ Copyright (C) 1986-2019 Free Software Foundation, Inc.
This file is part of GDB.
step_1 (1, 1, count_string);
}
-void
-delete_longjmp_breakpoint_cleanup (void *arg)
-{
- int thread = * (int *) arg;
- delete_longjmp_breakpoint (thread);
-}
-
/* Data for the FSM that manages the step/next/stepi/nexti
commands. */
of the wrong thread. */
if (!non_stop)
{
- struct thread_info *tp;
- ptid_t resume_ptid;
int must_confirm = 0;
/* This indicates what will be resumed. Either a single thread,
a whole process, or all threads of all processes. */
- resume_ptid = user_visible_resume_ptid (0);
+ ptid_t resume_ptid = user_visible_resume_ptid (0);
- ALL_NON_EXITED_THREADS (tp)
+ for (thread_info *tp : all_non_exited_threads (resume_ptid))
{
if (tp->ptid == inferior_ptid)
continue;
- if (!tp->ptid.matches (resume_ptid))
- continue;
if (tp->suspend.stop_signal != GDB_SIGNAL_0
&& signal_pass_state (tp->suspend.stop_signal))
struct symtab_and_line sal;
struct thread_info *tp = inferior_thread ();
int thread = tp->global_num;
- struct cleanup *old_chain;
struct until_next_fsm *sm;
clear_proceed_status (0);
tp->control.step_over_calls = STEP_OVER_ALL;
set_longjmp_breakpoint (tp, get_frame_id (frame));
- old_chain = make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
+ delete_longjmp_breakpoint_cleanup lj_deleter (thread);
sm = new_until_next_fsm (command_interp (), tp->global_num);
tp->thread_fsm = &sm->thread_fsm;
- discard_cleanups (old_chain);
+ lj_deleter.release ();
proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
void
print_return_value (struct ui_out *uiout, struct return_value_info *rv)
{
- if (rv->type == NULL || TYPE_CODE (rv->type) == TYPE_CODE_VOID)
+ if (rv->type == NULL
+ || TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID)
return;
TRY
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
- if (TYPE_CODE (rv->type) != TYPE_CODE_VOID)
+ if (TYPE_CODE (check_typedef (rv->type)) != TYPE_CODE_VOID)
{
struct value *func;
int regnum, int print_all)
{
int i;
- const int numregs = gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch);
+ const int numregs = gdbarch_num_cooked_regs (gdbarch);
for (i = 0; i < numregs; i++)
{
/* User registers lie completely outside of the range of
normal registers. Catch them early so that the target
never sees them. */
- if (regnum >= gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch))
+ if (regnum >= gdbarch_num_cooked_regs (gdbarch))
{
struct value *regval = value_of_user_reg (regnum, frame);
const char *regname = user_reg_map_regnum_to_name (gdbarch,
int regnum;
for (regnum = 0;
- regnum < gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch);
+ regnum < gdbarch_num_cooked_regs (gdbarch);
regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
int regnum;
int printed_something = 0;
- for (regnum = 0;
- regnum < gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch);
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, vector_reggroup))
{
bfd_cache_close_all ();
}
-/* Used in `attach&' command. ARG is a point to an integer
- representing a process id. Proceed threads of this process iff
+/* Used in `attach&' command. Proceed threads of inferior INF iff
they stopped due to debugger request, and when they did, they
- reported a clean stop (GDB_SIGNAL_0). Do not proceed threads
- that have been explicitly been told to stop. */
-
-static int
-proceed_after_attach_callback (struct thread_info *thread,
- void *arg)
-{
- int pid = * (int *) arg;
-
- if (thread->ptid.pid () == pid
- && thread->state != THREAD_EXITED
- && !thread->executing
- && !thread->stop_requested
- && thread->suspend.stop_signal == GDB_SIGNAL_0)
- {
- switch_to_thread (thread);
- clear_proceed_status (0);
- proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
- }
-
- return 0;
-}
+ reported a clean stop (GDB_SIGNAL_0). Do not proceed threads that
+ have been explicitly been told to stop. */
static void
-proceed_after_attach (int pid)
+proceed_after_attach (inferior *inf)
{
/* Don't error out if the current thread is running, because
there may be other stopped threads. */
/* Backup current thread and selected frame. */
scoped_restore_current_thread restore_thread;
- iterate_over_threads (proceed_after_attach_callback, &pid);
+ for (thread_info *thread : inf->non_exited_threads ())
+ if (!thread->executing
+ && !thread->stop_requested
+ && thread->suspend.stop_signal == GDB_SIGNAL_0)
+ {
+ switch_to_thread (thread);
+ clear_proceed_status (0);
+ proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
+ }
}
/* See inferior.h. */
already running threads. If a thread has been stopped with a
signal, leave it be. */
if (non_stop)
- proceed_after_attach (inferior->pid);
+ proceed_after_attach (inferior);
else
{
if (inferior_thread ()->suspend.stop_signal == GDB_SIGNAL_0)
target_stop (ptid_t (inferior->pid));
else if (target_is_non_stop_p ())
{
- struct thread_info *thread;
struct thread_info *lowest = inferior_thread ();
- int pid = current_inferior ()->pid;
stop_all_threads ();
stop. For consistency, always select the thread with
lowest GDB number, which should be the main thread, if it
still exists. */
- ALL_NON_EXITED_THREADS (thread)
- {
- if (thread->ptid.pid () == pid)
- {
- if (thread->inf->num < lowest->inf->num
- || thread->per_inf_num < lowest->per_inf_num)
- lowest = thread;
- }
- }
+ for (thread_info *thread : current_inferior ()->non_exited_threads ())
+ if (thread->inf->num < lowest->inf->num
+ || thread->per_inf_num < lowest->per_inf_num)
+ lowest = thread;
switch_to_thread (lowest);
}
if (!gdbarch_has_global_solist (target_gdbarch ()))
no_shared_libraries (NULL, from_tty);
- /* If we still have inferiors to debug, then don't mess with their
- threads. */
- if (!have_inferiors ())
- init_thread_list ();
-
if (deprecated_detach_hook)
deprecated_detach_hook ();
}
int regnum;
int printed_something = 0;
- for (regnum = 0;
- regnum < gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch);
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, float_reggroup))
{
add_prefix_cmd ("proc", class_info, info_proc_cmd,
_("\
-Show /proc process information about any running process.\n\
+Show additional information about a process.\n\
Specify any process id, or use the program being debugged by default."),
&info_proc_cmdlist, "info proc ",
1/*allow-unknown*/, &infolist);
add_cmd ("mappings", class_info, info_proc_cmd_mappings, _("\
-List of mapped memory regions."),
+List memory regions mapped by the specified process."),
&info_proc_cmdlist);
add_cmd ("stat", class_info, info_proc_cmd_stat, _("\
&info_proc_cmdlist);
add_cmd ("cwd", class_info, info_proc_cmd_cwd, _("\
-List current working directory of the process."),
+List current working directory of the specified process."),
&info_proc_cmdlist);
add_cmd ("cmdline", class_info, info_proc_cmd_cmdline, _("\
-List command line arguments of the process."),
+List command line arguments of the specified process."),
&info_proc_cmdlist);
add_cmd ("exe", class_info, info_proc_cmd_exe, _("\
-List absolute filename for executable of the process."),
+List absolute filename for executable of the specified process."),
&info_proc_cmdlist);
add_cmd ("files", class_info, info_proc_cmd_files, _("\
&info_proc_cmdlist);
add_cmd ("all", class_info, info_proc_cmd_all, _("\
-List all available /proc info."),
+List all available info about the specified process."),
&info_proc_cmdlist);
}