Remove target_has_execution macro
This removes the object-like macro target_has_execution, replacing it with a function call. target_has_execution_current is also now handled by this function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * inferior.h (class inferior) <has_execution>: Update. * windows-tdep.c (windows_solib_create_inferior_hook): Update. * valops.c (find_function_in_inferior) (value_allocate_space_in_inferior): Update. * top.c (kill_or_detach): Update. * target.c (target_preopen, set_target_permissions): Update. (target_has_execution_current): Remove. * sparc64-tdep.c (adi_examine_command, adi_assign_command): Update. * solib.c (update_solib_list, reload_shared_libraries): Update. * solib-svr4.c (svr4_solib_create_inferior_hook): Update. * solib-dsbt.c (enable_break): Update. * score-tdep.c (score7_fetch_inst): Update. * rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries): Update. * remote.c (remote_target::start_remote) (remote_target::remote_check_symbols, remote_target::open_1) (remote_target::remote_detach_1, remote_target::verify_memory) (remote_target::xfer_partial, remote_target::read_description) (remote_target::get_min_fast_tracepoint_insn_len): Update. * record-full.c (record_full_open_1): Update. * record-btrace.c (record_btrace_target_open): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring): Update. * linux-thread-db.c (add_thread_db_info) (thread_db_find_new_threads_silently, check_thread_db_callback) (try_thread_db_load_1, record_thread): Update. * linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw): Update. * linux-fork.c (checkpoint_command): Update. * infrun.c (set_non_stop, set_observer_mode) (check_multi_target_resumption, for_each_just_stopped_thread) (maybe_remove_breakpoints, normal_stop) (class infcall_suspend_state): Update. * infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running) (info_program_command, attach_command): Update. * infcall.c (call_function_by_hand_dummy): Update. * inf-loop.c (inferior_event_handler): Update. * gcore.c (gcore_command, derive_heap_segment): Update. * exec.c (exec_file_command): Update. * eval.c (evaluate_subexp): Update. * compile/compile.c (compile_to_object): Update. * cli/cli-dump.c (restore_command): Update. * breakpoint.c (update_watchpoint) (update_inserted_breakpoint_locations) (insert_breakpoint_locations, get_bpstat_thread): Update. * target.h (target_has_execution): Remove macro. (target_has_execution_current): Don't declare. (target_has_execution): Rename from target_has_execution_1. Add argument default.
This commit is contained in:
parent
05374cfd90
commit
55f6301ac0
30 changed files with 124 additions and 79 deletions
|
@ -1,3 +1,56 @@
|
||||||
|
2020-09-28 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* inferior.h (class inferior) <has_execution>: Update.
|
||||||
|
* windows-tdep.c (windows_solib_create_inferior_hook): Update.
|
||||||
|
* valops.c (find_function_in_inferior)
|
||||||
|
(value_allocate_space_in_inferior): Update.
|
||||||
|
* top.c (kill_or_detach): Update.
|
||||||
|
* target.c (target_preopen, set_target_permissions): Update.
|
||||||
|
(target_has_execution_current): Remove.
|
||||||
|
* sparc64-tdep.c (adi_examine_command, adi_assign_command):
|
||||||
|
Update.
|
||||||
|
* solib.c (update_solib_list, reload_shared_libraries): Update.
|
||||||
|
* solib-svr4.c (svr4_solib_create_inferior_hook): Update.
|
||||||
|
* solib-dsbt.c (enable_break): Update.
|
||||||
|
* score-tdep.c (score7_fetch_inst): Update.
|
||||||
|
* rs6000-nat.c (rs6000_nat_target::xfer_shared_libraries):
|
||||||
|
Update.
|
||||||
|
* remote.c (remote_target::start_remote)
|
||||||
|
(remote_target::remote_check_symbols, remote_target::open_1)
|
||||||
|
(remote_target::remote_detach_1, remote_target::verify_memory)
|
||||||
|
(remote_target::xfer_partial, remote_target::read_description)
|
||||||
|
(remote_target::get_min_fast_tracepoint_insn_len): Update.
|
||||||
|
* record-full.c (record_full_open_1): Update.
|
||||||
|
* record-btrace.c (record_btrace_target_open): Update.
|
||||||
|
* objc-lang.c (lookup_objc_class, lookup_child_selector)
|
||||||
|
(value_nsstring): Update.
|
||||||
|
* linux-thread-db.c (add_thread_db_info)
|
||||||
|
(thread_db_find_new_threads_silently, check_thread_db_callback)
|
||||||
|
(try_thread_db_load_1, record_thread): Update.
|
||||||
|
* linux-tdep.c (linux_info_proc, linux_vsyscall_range_raw):
|
||||||
|
Update.
|
||||||
|
* linux-fork.c (checkpoint_command): Update.
|
||||||
|
* infrun.c (set_non_stop, set_observer_mode)
|
||||||
|
(check_multi_target_resumption, for_each_just_stopped_thread)
|
||||||
|
(maybe_remove_breakpoints, normal_stop)
|
||||||
|
(class infcall_suspend_state): Update.
|
||||||
|
* infcmd.c (ERROR_NO_INFERIOR, kill_if_already_running)
|
||||||
|
(info_program_command, attach_command): Update.
|
||||||
|
* infcall.c (call_function_by_hand_dummy): Update.
|
||||||
|
* inf-loop.c (inferior_event_handler): Update.
|
||||||
|
* gcore.c (gcore_command, derive_heap_segment): Update.
|
||||||
|
* exec.c (exec_file_command): Update.
|
||||||
|
* eval.c (evaluate_subexp): Update.
|
||||||
|
* compile/compile.c (compile_to_object): Update.
|
||||||
|
* cli/cli-dump.c (restore_command): Update.
|
||||||
|
* breakpoint.c (update_watchpoint)
|
||||||
|
(update_inserted_breakpoint_locations)
|
||||||
|
(insert_breakpoint_locations, get_bpstat_thread): Update.
|
||||||
|
* target.h (target_has_execution): Remove macro.
|
||||||
|
(target_has_execution_current): Don't declare.
|
||||||
|
(target_has_execution): Rename from target_has_execution_1. Add
|
||||||
|
argument default.
|
||||||
|
|
||||||
2020-09-28 Tom Tromey <tom@tromey.com>
|
2020-09-28 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* mi/mi-main.c (exec_reverse_continue)
|
* mi/mi-main.c (exec_reverse_continue)
|
||||||
|
|
|
@ -1768,7 +1768,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
|
||||||
don't try to insert watchpoint. We don't automatically delete
|
don't try to insert watchpoint. We don't automatically delete
|
||||||
such watchpoint, though, since failure to parse expression
|
such watchpoint, though, since failure to parse expression
|
||||||
is different from out-of-scope watchpoint. */
|
is different from out-of-scope watchpoint. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Without execution, memory can't change. No use to try and
|
/* Without execution, memory can't change. No use to try and
|
||||||
set watchpoint locations. The watchpoint will be reset when
|
set watchpoint locations. The watchpoint will be reset when
|
||||||
|
@ -2878,7 +2878,7 @@ update_inserted_breakpoint_locations (void)
|
||||||
if we aren't attached to any process yet, we should still
|
if we aren't attached to any process yet, we should still
|
||||||
insert breakpoints. */
|
insert breakpoints. */
|
||||||
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
|
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
|
||||||
&& (inferior_ptid == null_ptid || !target_has_execution))
|
&& (inferior_ptid == null_ptid || !target_has_execution ()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
|
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
|
||||||
|
@ -2934,7 +2934,7 @@ insert_breakpoint_locations (void)
|
||||||
if we aren't attached to any process yet, we should still
|
if we aren't attached to any process yet, we should still
|
||||||
insert breakpoints. */
|
insert breakpoints. */
|
||||||
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
|
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
|
||||||
&& (inferior_ptid == null_ptid || !target_has_execution))
|
&& (inferior_ptid == null_ptid || !target_has_execution ()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
|
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
|
||||||
|
@ -4410,7 +4410,7 @@ bpstat_do_actions_1 (bpstat *bsp)
|
||||||
static thread_info *
|
static thread_info *
|
||||||
get_bpstat_thread ()
|
get_bpstat_thread ()
|
||||||
{
|
{
|
||||||
if (inferior_ptid == null_ptid || !target_has_execution)
|
if (inferior_ptid == null_ptid || !target_has_execution ())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
thread_info *tp = inferior_thread ();
|
thread_info *tp = inferior_thread ();
|
||||||
|
|
|
@ -497,7 +497,7 @@ restore_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
int binary_flag = 0;
|
int binary_flag = 0;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
noprocess ();
|
noprocess ();
|
||||||
|
|
||||||
CORE_ADDR load_offset = 0;
|
CORE_ADDR load_offset = 0;
|
||||||
|
|
|
@ -641,7 +641,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
|
||||||
struct gdbarch *gdbarch = get_current_arch ();
|
struct gdbarch *gdbarch = get_current_arch ();
|
||||||
std::string triplet_rx;
|
std::string triplet_rx;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("The program must be running for the compile command to "\
|
error (_("The program must be running for the compile command to "\
|
||||||
"work."));
|
"work."));
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ evaluate_subexp (struct type *expect_type, struct expression *exp,
|
||||||
struct value *retval;
|
struct value *retval;
|
||||||
|
|
||||||
gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
|
gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
|
||||||
if (*pos == 0 && target_has_execution
|
if (*pos == 0 && target_has_execution ()
|
||||||
&& exp->language_defn->la_language == language_cplus
|
&& exp->language_defn->la_language == language_cplus
|
||||||
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
|
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
|
||||||
stack_temporaries.emplace (inferior_thread ());
|
stack_temporaries.emplace (inferior_thread ());
|
||||||
|
|
|
@ -545,7 +545,7 @@ exec_file_attach (const char *filename, int from_tty)
|
||||||
static void
|
static void
|
||||||
exec_file_command (const char *args, int from_tty)
|
exec_file_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
if (from_tty && target_has_execution
|
if (from_tty && target_has_execution ()
|
||||||
&& !query (_("A program is being debugged already.\n"
|
&& !query (_("A program is being debugged already.\n"
|
||||||
"Are you sure you want to change the file? ")))
|
"Are you sure you want to change the file? ")))
|
||||||
error (_("File not changed."));
|
error (_("File not changed."));
|
||||||
|
|
|
@ -129,7 +129,7 @@ gcore_command (const char *args, int from_tty)
|
||||||
gdb::unique_xmalloc_ptr<char> corefilename;
|
gdb::unique_xmalloc_ptr<char> corefilename;
|
||||||
|
|
||||||
/* No use generating a corefile without a target process. */
|
/* No use generating a corefile without a target process. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
noprocess ();
|
noprocess ();
|
||||||
|
|
||||||
if (args && *args)
|
if (args && *args)
|
||||||
|
@ -321,7 +321,7 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
|
||||||
|
|
||||||
/* This function depends on being able to call a function in the
|
/* This function depends on being able to call a function in the
|
||||||
inferior. */
|
inferior. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* The following code assumes that the link map is arranged as
|
/* The following code assumes that the link map is arranged as
|
||||||
|
|
|
@ -48,7 +48,7 @@ inferior_event_handler (enum inferior_event_type event_type)
|
||||||
/* Unregister the inferior from the event loop. This is done
|
/* Unregister the inferior from the event loop. This is done
|
||||||
so that when the inferior is not running we don't get
|
so that when the inferior is not running we don't get
|
||||||
distracted by spurious inferior output. */
|
distracted by spurious inferior output. */
|
||||||
if (target_has_execution && target_can_async_p ())
|
if (target_has_execution () && target_can_async_p ())
|
||||||
target_async (0);
|
target_async (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -786,7 +786,7 @@ call_function_by_hand_dummy (struct value *function,
|
||||||
error (_("Cannot call functions in the program: "
|
error (_("Cannot call functions in the program: "
|
||||||
"may-call-functions is off."));
|
"may-call-functions is off."));
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
noprocess ();
|
noprocess ();
|
||||||
|
|
||||||
if (get_traceframe_number () >= 0)
|
if (get_traceframe_number () >= 0)
|
||||||
|
@ -1353,7 +1353,7 @@ When the function is done executing, GDB will silently stop."),
|
||||||
/* If the program has exited, or we stopped at a different thread,
|
/* If the program has exited, or we stopped at a different thread,
|
||||||
exit and inform the user. */
|
exit and inform the user. */
|
||||||
|
|
||||||
if (! target_has_execution)
|
if (! target_has_execution ())
|
||||||
{
|
{
|
||||||
const char *name = get_function_name (funaddr,
|
const char *name = get_function_name (funaddr,
|
||||||
name_buf, sizeof (name_buf));
|
name_buf, sizeof (name_buf));
|
||||||
|
|
|
@ -64,7 +64,7 @@ static void until_next_command (int);
|
||||||
static void step_1 (int, int, const char *);
|
static void step_1 (int, int, const char *);
|
||||||
|
|
||||||
#define ERROR_NO_INFERIOR \
|
#define ERROR_NO_INFERIOR \
|
||||||
if (!target_has_execution) error (_("The program is not being run."));
|
if (!target_has_execution ()) error (_("The program is not being run."));
|
||||||
|
|
||||||
/* Scratch area where string containing arguments to give to the
|
/* Scratch area where string containing arguments to give to the
|
||||||
program will be stored by 'set args'. As soon as anything is
|
program will be stored by 'set args'. As soon as anything is
|
||||||
|
@ -358,7 +358,7 @@ post_create_inferior (struct target_ops *target, int from_tty)
|
||||||
static void
|
static void
|
||||||
kill_if_already_running (int from_tty)
|
kill_if_already_running (int from_tty)
|
||||||
{
|
{
|
||||||
if (inferior_ptid != null_ptid && target_has_execution)
|
if (inferior_ptid != null_ptid && target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Bail out before killing the program if we will not be able to
|
/* Bail out before killing the program if we will not be able to
|
||||||
restart it. */
|
restart it. */
|
||||||
|
@ -1861,7 +1861,7 @@ info_program_command (const char *args, int from_tty)
|
||||||
ptid_t ptid;
|
ptid_t ptid;
|
||||||
process_stratum_target *proc_target;
|
process_stratum_target *proc_target;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
{
|
{
|
||||||
printf_filtered (_("The program being debugged is not being run.\n"));
|
printf_filtered (_("The program being debugged is not being run.\n"));
|
||||||
return;
|
return;
|
||||||
|
@ -2569,7 +2569,7 @@ attach_command (const char *args, int from_tty)
|
||||||
/* Don't complain if all processes share the same symbol
|
/* Don't complain if all processes share the same symbol
|
||||||
space. */
|
space. */
|
||||||
;
|
;
|
||||||
else if (target_has_execution)
|
else if (target_has_execution ())
|
||||||
{
|
{
|
||||||
if (query (_("A program is being debugged already. Kill it? ")))
|
if (query (_("A program is being debugged already. Kill it? ")))
|
||||||
target_kill ();
|
target_kill ();
|
||||||
|
|
|
@ -377,7 +377,7 @@ public:
|
||||||
{ return m_target_stack.at (stratum); }
|
{ return m_target_stack.at (stratum); }
|
||||||
|
|
||||||
bool has_execution ()
|
bool has_execution ()
|
||||||
{ return target_has_execution_1 (this); }
|
{ return target_has_execution (this); }
|
||||||
|
|
||||||
/* Pointer to next inferior in singly-linked list of inferiors. */
|
/* Pointer to next inferior in singly-linked list of inferiors. */
|
||||||
struct inferior *next = NULL;
|
struct inferior *next = NULL;
|
||||||
|
|
16
gdb/infrun.c
16
gdb/infrun.c
|
@ -218,7 +218,7 @@ static void
|
||||||
set_non_stop (const char *args, int from_tty,
|
set_non_stop (const char *args, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
non_stop_1 = non_stop;
|
non_stop_1 = non_stop;
|
||||||
error (_("Cannot change this setting while the inferior is running."));
|
error (_("Cannot change this setting while the inferior is running."));
|
||||||
|
@ -247,7 +247,7 @@ static void
|
||||||
set_observer_mode (const char *args, int from_tty,
|
set_observer_mode (const char *args, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
observer_mode_1 = observer_mode;
|
observer_mode_1 = observer_mode;
|
||||||
error (_("Cannot change this setting while the inferior is running."));
|
error (_("Cannot change this setting while the inferior is running."));
|
||||||
|
@ -2884,7 +2884,7 @@ check_multi_target_resumption (process_stratum_target *resume_target)
|
||||||
{
|
{
|
||||||
switch_to_inferior_no_thread (inf);
|
switch_to_inferior_no_thread (inf);
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
process_stratum_target *proc_target
|
process_stratum_target *proc_target
|
||||||
|
@ -3308,7 +3308,7 @@ typedef void (*for_each_just_stopped_thread_callback_func)
|
||||||
static void
|
static void
|
||||||
for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
|
for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
|
||||||
{
|
{
|
||||||
if (!target_has_execution || inferior_ptid == null_ptid)
|
if (!target_has_execution () || inferior_ptid == null_ptid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target_is_non_stop_p ())
|
if (target_is_non_stop_p ())
|
||||||
|
@ -8146,7 +8146,7 @@ print_stop_event (struct ui_out *uiout, bool displays)
|
||||||
void
|
void
|
||||||
maybe_remove_breakpoints (void)
|
maybe_remove_breakpoints (void)
|
||||||
{
|
{
|
||||||
if (!breakpoints_should_be_inserted_now () && target_has_execution)
|
if (!breakpoints_should_be_inserted_now () && target_has_execution ())
|
||||||
{
|
{
|
||||||
if (remove_breakpoints ())
|
if (remove_breakpoints ())
|
||||||
{
|
{
|
||||||
|
@ -8302,7 +8302,7 @@ normal_stop (void)
|
||||||
informing of a stop. */
|
informing of a stop. */
|
||||||
if (!non_stop
|
if (!non_stop
|
||||||
&& previous_inferior_ptid != inferior_ptid
|
&& previous_inferior_ptid != inferior_ptid
|
||||||
&& target_has_execution
|
&& target_has_execution ()
|
||||||
&& last.kind != TARGET_WAITKIND_SIGNALLED
|
&& last.kind != TARGET_WAITKIND_SIGNALLED
|
||||||
&& last.kind != TARGET_WAITKIND_EXITED
|
&& last.kind != TARGET_WAITKIND_EXITED
|
||||||
&& last.kind != TARGET_WAITKIND_NO_RESUMED)
|
&& last.kind != TARGET_WAITKIND_NO_RESUMED)
|
||||||
|
@ -8407,7 +8407,7 @@ normal_stop (void)
|
||||||
|
|
||||||
annotate_stopped ();
|
annotate_stopped ();
|
||||||
|
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
if (last.kind != TARGET_WAITKIND_SIGNALLED
|
if (last.kind != TARGET_WAITKIND_SIGNALLED
|
||||||
&& last.kind != TARGET_WAITKIND_EXITED
|
&& last.kind != TARGET_WAITKIND_EXITED
|
||||||
|
@ -8923,7 +8923,7 @@ public:
|
||||||
|
|
||||||
/* The inferior can be gone if the user types "print exit(0)"
|
/* The inferior can be gone if the user types "print exit(0)"
|
||||||
(and perhaps other times). */
|
(and perhaps other times). */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
/* NB: The register write goes through to the target. */
|
/* NB: The register write goes through to the target. */
|
||||||
regcache->restore (registers ());
|
regcache->restore (registers ());
|
||||||
}
|
}
|
||||||
|
|
|
@ -645,7 +645,7 @@ checkpoint_command (const char *args, int from_tty)
|
||||||
struct fork_info *fp;
|
struct fork_info *fp;
|
||||||
pid_t retpid;
|
pid_t retpid;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("The program is not being run."));
|
error (_("The program is not being run."));
|
||||||
|
|
||||||
/* Ensure that the inferior is not multithreaded. */
|
/* Ensure that the inferior is not multithreaded. */
|
||||||
|
|
|
@ -772,7 +772,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("No current process: you must name one."));
|
error (_("No current process: you must name one."));
|
||||||
if (current_inferior ()->fake_pid_p)
|
if (current_inferior ()->fake_pid_p)
|
||||||
error (_("Can't determine the current process's PID: you must name one."));
|
error (_("Can't determine the current process's PID: you must name one."));
|
||||||
|
@ -2317,7 +2317,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
|
||||||
/* It doesn't make sense to access the host's /proc when debugging a
|
/* It doesn't make sense to access the host's /proc when debugging a
|
||||||
core file. Instead, look for the PT_LOAD segment that matches
|
core file. Instead, look for the PT_LOAD segment that matches
|
||||||
the vDSO. */
|
the vDSO. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
{
|
{
|
||||||
long phdrs_size;
|
long phdrs_size;
|
||||||
int num_phdrs, i;
|
int num_phdrs, i;
|
||||||
|
|
|
@ -237,7 +237,7 @@ add_thread_db_info (void *handle)
|
||||||
|
|
||||||
/* The workaround works by reading from /proc/pid/status, so it is
|
/* The workaround works by reading from /proc/pid/status, so it is
|
||||||
disabled for core files. */
|
disabled for core files. */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
info->need_stale_parent_threads_check = 1;
|
info->need_stale_parent_threads_check = 1;
|
||||||
|
|
||||||
info->next = thread_db_list;
|
info->next = thread_db_list;
|
||||||
|
@ -531,7 +531,7 @@ thread_db_find_new_threads_silently (thread_info *stopped)
|
||||||
corrupted. For core files it does not apply, no 'later enumeration'
|
corrupted. For core files it does not apply, no 'later enumeration'
|
||||||
is possible. */
|
is possible. */
|
||||||
|
|
||||||
if (!target_has_execution || !inferior_has_bug ("nptl_version", 2, 7))
|
if (!target_has_execution () || !inferior_has_bug ("nptl_version", 2, 7))
|
||||||
{
|
{
|
||||||
exception_fprintf (gdb_stderr, except,
|
exception_fprintf (gdb_stderr, except,
|
||||||
_("Warning: couldn't activate thread debugging "
|
_("Warning: couldn't activate thread debugging "
|
||||||
|
@ -658,7 +658,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
|
||||||
memset (&th2, 23, sizeof (td_thrhandle_t));
|
memset (&th2, 23, sizeof (td_thrhandle_t));
|
||||||
CALL_UNCHECKED (td_ta_map_lwp2thr, th->th_ta_p, ti.ti_lid, &th2);
|
CALL_UNCHECKED (td_ta_map_lwp2thr, th->th_ta_p, ti.ti_lid, &th2);
|
||||||
|
|
||||||
if (tdb_testinfo->last_result == TD_ERR && !target_has_execution)
|
if (tdb_testinfo->last_result == TD_ERR && !target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Some platforms require execution for td_ta_map_lwp2thr. */
|
/* Some platforms require execution for td_ta_map_lwp2thr. */
|
||||||
LOG (_("; can't map_lwp2thr"));
|
LOG (_("; can't map_lwp2thr"));
|
||||||
|
@ -884,7 +884,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
|
||||||
|
|
||||||
td_ta_map_lwp2thr uses ps_get_thread_area, but we can't use that
|
td_ta_map_lwp2thr uses ps_get_thread_area, but we can't use that
|
||||||
currently on core targets, as it uses ptrace directly. */
|
currently on core targets, as it uses ptrace directly. */
|
||||||
if (target_has_execution
|
if (target_has_execution ()
|
||||||
&& linux_proc_task_list_dir_exists (inferior_ptid.pid ()))
|
&& linux_proc_task_list_dir_exists (inferior_ptid.pid ()))
|
||||||
info->td_ta_thr_iter_p = NULL;
|
info->td_ta_thr_iter_p = NULL;
|
||||||
else
|
else
|
||||||
|
@ -1358,7 +1358,7 @@ record_thread (struct thread_db_info *info,
|
||||||
else
|
else
|
||||||
tp->priv.reset (priv);
|
tp->priv.reset (priv);
|
||||||
|
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
check_thread_signals ();
|
check_thread_signals ();
|
||||||
|
|
||||||
return tp;
|
return tp;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
#include "target.h" /* for target_has_execution */
|
#include "target.h"
|
||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
@ -112,7 +112,7 @@ lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
|
||||||
struct type *char_type = builtin_type (gdbarch)->builtin_char;
|
struct type *char_type = builtin_type (gdbarch)->builtin_char;
|
||||||
struct value * function, *classval;
|
struct value * function, *classval;
|
||||||
|
|
||||||
if (! target_has_execution)
|
if (! target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Can't call into inferior to lookup class. */
|
/* Can't call into inferior to lookup class. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -141,7 +141,7 @@ lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
|
||||||
struct type *char_type = builtin_type (gdbarch)->builtin_char;
|
struct type *char_type = builtin_type (gdbarch)->builtin_char;
|
||||||
struct value * function, *selstring;
|
struct value * function, *selstring;
|
||||||
|
|
||||||
if (! target_has_execution)
|
if (! target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Can't call into inferior to lookup selector. */
|
/* Can't call into inferior to lookup selector. */
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -172,7 +172,7 @@ value_nsstring (struct gdbarch *gdbarch, char *ptr, int len)
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
struct type *type;
|
struct type *type;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return 0; /* Can't call into inferior to create NSString. */
|
return 0; /* Can't call into inferior to create NSString. */
|
||||||
|
|
||||||
stringValue[2] = value_string(ptr, len, char_type);
|
stringValue[2] = value_string(ptr, len, char_type);
|
||||||
|
|
|
@ -390,7 +390,7 @@ record_btrace_target_open (const char *args, int from_tty)
|
||||||
|
|
||||||
record_preopen ();
|
record_preopen ();
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("The program is not being run."));
|
error (_("The program is not being run."));
|
||||||
|
|
||||||
for (thread_info *tp : current_inferior ()->non_exited_threads ())
|
for (thread_info *tp : current_inferior ()->non_exited_threads ())
|
||||||
|
|
|
@ -947,7 +947,7 @@ record_full_open_1 (const char *name, int from_tty)
|
||||||
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open_1\n");
|
fprintf_unfiltered (gdb_stdlog, "Process record: record_full_open_1\n");
|
||||||
|
|
||||||
/* check exec */
|
/* check exec */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("Process record: the program is not being run."));
|
error (_("Process record: the program is not being run."));
|
||||||
if (non_stop)
|
if (non_stop)
|
||||||
error (_("Process record target can't debug inferior in non-stop mode "
|
error (_("Process record target can't debug inferior in non-stop mode "
|
||||||
|
|
17
gdb/remote.c
17
gdb/remote.c
|
@ -4843,7 +4843,7 @@ remote_target::start_remote (int from_tty, int extended_p)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we connected to a live target, do some additional setup. */
|
/* If we connected to a live target, do some additional setup. */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
if (symfile_objfile) /* No use without a symbol-file. */
|
if (symfile_objfile) /* No use without a symbol-file. */
|
||||||
remote_check_symbols ();
|
remote_check_symbols ();
|
||||||
|
@ -4946,7 +4946,7 @@ remote_target::remote_check_symbols ()
|
||||||
but our current inferior is not running, we should not invite the
|
but our current inferior is not running, we should not invite the
|
||||||
remote target to request symbol lookups related to its
|
remote target to request symbol lookups related to its
|
||||||
(unrelated) current process. */
|
(unrelated) current process. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (packet_support (PACKET_qSymbol) == PACKET_DISABLE)
|
if (packet_support (PACKET_qSymbol) == PACKET_DISABLE)
|
||||||
|
@ -5544,7 +5544,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
|
||||||
/* If we're connected to a running target, target_preopen will kill it.
|
/* If we're connected to a running target, target_preopen will kill it.
|
||||||
Ask this question first, before target_preopen has a chance to kill
|
Ask this question first, before target_preopen has a chance to kill
|
||||||
anything. */
|
anything. */
|
||||||
if (curr_remote != NULL && !target_has_execution)
|
if (curr_remote != NULL && !target_has_execution ())
|
||||||
{
|
{
|
||||||
if (from_tty
|
if (from_tty
|
||||||
&& !query (_("Already connected to a remote target. Disconnect? ")))
|
&& !query (_("Already connected to a remote target. Disconnect? ")))
|
||||||
|
@ -5727,7 +5727,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
|
||||||
struct remote_state *rs = get_remote_state ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
int is_fork_parent;
|
int is_fork_parent;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("No process to detach from."));
|
error (_("No process to detach from."));
|
||||||
|
|
||||||
target_announce_detach (from_tty);
|
target_announce_detach (from_tty);
|
||||||
|
@ -10718,7 +10718,8 @@ remote_target::verify_memory (const gdb_byte *data, CORE_ADDR lma, ULONGEST size
|
||||||
|
|
||||||
/* It doesn't make sense to use qCRC if the remote target is
|
/* It doesn't make sense to use qCRC if the remote target is
|
||||||
connected but not running. */
|
connected but not running. */
|
||||||
if (target_has_execution && packet_support (PACKET_qCRC) != PACKET_DISABLE)
|
if (target_has_execution ()
|
||||||
|
&& packet_support (PACKET_qCRC) != PACKET_DISABLE)
|
||||||
{
|
{
|
||||||
enum packet_result result;
|
enum packet_result result;
|
||||||
|
|
||||||
|
@ -10980,7 +10981,7 @@ remote_target::xfer_partial (enum target_object object,
|
||||||
/* If the remote target is connected but not running, we should
|
/* If the remote target is connected but not running, we should
|
||||||
pass this request down to a lower stratum (e.g. the executable
|
pass this request down to a lower stratum (e.g. the executable
|
||||||
file). */
|
file). */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return TARGET_XFER_EOF;
|
return TARGET_XFER_EOF;
|
||||||
|
|
||||||
if (writebuf != NULL)
|
if (writebuf != NULL)
|
||||||
|
@ -11720,7 +11721,7 @@ remote_target::read_description ()
|
||||||
|
|
||||||
/* Do not try this during initial connection, when we do not know
|
/* Do not try this during initial connection, when we do not know
|
||||||
whether there is a running but stopped thread. */
|
whether there is a running but stopped thread. */
|
||||||
if (!target_has_execution || inferior_ptid == null_ptid)
|
if (!target_has_execution () || inferior_ptid == null_ptid)
|
||||||
return beneath ()->read_description ();
|
return beneath ()->read_description ();
|
||||||
|
|
||||||
if (!data->guesses.empty ())
|
if (!data->guesses.empty ())
|
||||||
|
@ -13584,7 +13585,7 @@ remote_target::get_min_fast_tracepoint_insn_len ()
|
||||||
|
|
||||||
/* If we're not debugging a process yet, the IPA can't be
|
/* If we're not debugging a process yet, the IPA can't be
|
||||||
loaded. */
|
loaded. */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Make sure the remote is pointing at the right process. */
|
/* Make sure the remote is pointing at the right process. */
|
||||||
|
|
|
@ -650,7 +650,7 @@ rs6000_nat_target::xfer_shared_libraries
|
||||||
|
|
||||||
/* This function assumes that it is being run with a live process.
|
/* This function assumes that it is being run with a live process.
|
||||||
Core files are handled via gdbarch. */
|
Core files are handled via gdbarch. */
|
||||||
gdb_assert (target_has_execution);
|
gdb_assert (target_has_execution ());
|
||||||
|
|
||||||
if (writebuf)
|
if (writebuf)
|
||||||
return TARGET_XFER_E_IO;
|
return TARGET_XFER_E_IO;
|
||||||
|
|
|
@ -123,7 +123,7 @@ score7_fetch_inst (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *memblock)
|
||||||
int big;
|
int big;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (target_has_execution && memblock != NULL)
|
if (target_has_execution () && memblock != NULL)
|
||||||
{
|
{
|
||||||
/* Fetch instruction from local MEMBLOCK. */
|
/* Fetch instruction from local MEMBLOCK. */
|
||||||
memcpy (buf, memblock, SCORE_INSTLEN);
|
memcpy (buf, memblock, SCORE_INSTLEN);
|
||||||
|
|
|
@ -781,7 +781,7 @@ enable_break (void)
|
||||||
if (exec_bfd == NULL)
|
if (exec_bfd == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
info = get_dsbt_info ();
|
info = get_dsbt_info ();
|
||||||
|
|
|
@ -3014,7 +3014,7 @@ svr4_solib_create_inferior_hook (int from_tty)
|
||||||
|
|
||||||
/* No point setting a breakpoint in the dynamic linker if we can't
|
/* No point setting a breakpoint in the dynamic linker if we can't
|
||||||
hit it (e.g., a core file, or a trace file). */
|
hit it (e.g., a core file, or a trace file). */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!svr4_have_link_map_offsets ())
|
if (!svr4_have_link_map_offsets ())
|
||||||
|
|
|
@ -729,7 +729,7 @@ update_solib_list (int from_tty)
|
||||||
|
|
||||||
/* We can reach here due to changing solib-search-path or the
|
/* We can reach here due to changing solib-search-path or the
|
||||||
sysroot, before having any inferior. */
|
sysroot, before having any inferior. */
|
||||||
if (target_has_execution && inferior_ptid != null_ptid)
|
if (target_has_execution () && inferior_ptid != null_ptid)
|
||||||
{
|
{
|
||||||
struct inferior *inf = current_inferior ();
|
struct inferior *inf = current_inferior ();
|
||||||
|
|
||||||
|
@ -1351,7 +1351,7 @@ reload_shared_libraries (const char *ignored, int from_tty,
|
||||||
Absent this call, if we've just connected to a target and set
|
Absent this call, if we've just connected to a target and set
|
||||||
solib-absolute-prefix or solib-search-path, we'll lose all information
|
solib-absolute-prefix or solib-search-path, we'll lose all information
|
||||||
about ld.so. */
|
about ld.so. */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
/* Reset or free private data structures not associated with
|
/* Reset or free private data structures not associated with
|
||||||
so_list entries. */
|
so_list entries. */
|
||||||
|
|
|
@ -448,7 +448,7 @@ static void
|
||||||
adi_examine_command (const char *args, int from_tty)
|
adi_examine_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
/* make sure program is active and adi is available */
|
/* make sure program is active and adi is available */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("ADI command requires a live process/thread"));
|
error (_("ADI command requires a live process/thread"));
|
||||||
|
|
||||||
if (!adi_available ())
|
if (!adi_available ())
|
||||||
|
@ -484,7 +484,7 @@ adi_assign_command (const char *args, int from_tty)
|
||||||
= N_("Usage: adi assign|a[/COUNT] ADDR = VERSION");
|
= N_("Usage: adi assign|a[/COUNT] ADDR = VERSION");
|
||||||
|
|
||||||
/* make sure program is active and adi is available */
|
/* make sure program is active and adi is available */
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("ADI command requires a live process/thread"));
|
error (_("ADI command requires a live process/thread"));
|
||||||
|
|
||||||
if (!adi_available ())
|
if (!adi_available ())
|
||||||
|
|
17
gdb/target.c
17
gdb/target.c
|
@ -200,8 +200,11 @@ target_has_registers ()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
target_has_execution_1 (inferior *inf)
|
target_has_execution (inferior *inf)
|
||||||
{
|
{
|
||||||
|
if (inf == nullptr)
|
||||||
|
inf = current_inferior ();
|
||||||
|
|
||||||
for (target_ops *t = inf->top_target ();
|
for (target_ops *t = inf->top_target ();
|
||||||
t != nullptr;
|
t != nullptr;
|
||||||
t = inf->find_target_beneath (t))
|
t = inf->find_target_beneath (t))
|
||||||
|
@ -211,12 +214,6 @@ target_has_execution_1 (inferior *inf)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
target_has_execution_current (void)
|
|
||||||
{
|
|
||||||
return target_has_execution_1 (current_inferior ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is used to implement the various target commands. */
|
/* This is used to implement the various target commands. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1914,12 +1911,12 @@ target_preopen (int from_tty)
|
||||||
if (current_inferior ()->pid != 0)
|
if (current_inferior ()->pid != 0)
|
||||||
{
|
{
|
||||||
if (!from_tty
|
if (!from_tty
|
||||||
|| !target_has_execution
|
|| !target_has_execution ()
|
||||||
|| query (_("A program is being debugged already. Kill it? ")))
|
|| query (_("A program is being debugged already. Kill it? ")))
|
||||||
{
|
{
|
||||||
/* Core inferiors actually should be detached, not
|
/* Core inferiors actually should be detached, not
|
||||||
killed. */
|
killed. */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
target_kill ();
|
target_kill ();
|
||||||
else
|
else
|
||||||
target_detach (current_inferior (), 0);
|
target_detach (current_inferior (), 0);
|
||||||
|
@ -3932,7 +3929,7 @@ static void
|
||||||
set_target_permissions (const char *args, int from_tty,
|
set_target_permissions (const char *args, int from_tty,
|
||||||
struct cmd_list_element *c)
|
struct cmd_list_element *c)
|
||||||
{
|
{
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
update_target_permissions ();
|
update_target_permissions ();
|
||||||
error (_("Cannot change this setting while the inferior is running."));
|
error (_("Cannot change this setting while the inferior is running."));
|
||||||
|
|
12
gdb/target.h
12
gdb/target.h
|
@ -1829,16 +1829,10 @@ extern int target_has_registers ();
|
||||||
whether or not the target is capable of execution, but there are
|
whether or not the target is capable of execution, but there are
|
||||||
also targets which can be current while not executing. In that
|
also targets which can be current while not executing. In that
|
||||||
case this will become true after to_create_inferior or
|
case this will become true after to_create_inferior or
|
||||||
to_attach. */
|
to_attach. INF is the inferior to use; nullptr means to use the
|
||||||
|
current inferior. */
|
||||||
|
|
||||||
extern bool target_has_execution_1 (inferior *inf);
|
extern bool target_has_execution (inferior *inf = nullptr);
|
||||||
|
|
||||||
/* Like target_has_execution_1, but always passes
|
|
||||||
current_inferior(). */
|
|
||||||
|
|
||||||
extern int target_has_execution_current (void);
|
|
||||||
|
|
||||||
#define target_has_execution target_has_execution_current ()
|
|
||||||
|
|
||||||
/* Can the target support the debugger control of thread execution?
|
/* Can the target support the debugger control of thread execution?
|
||||||
Can it lock the thread scheduler? */
|
Can it lock the thread scheduler? */
|
||||||
|
|
|
@ -1677,7 +1677,7 @@ kill_or_detach (inferior *inf, int from_tty)
|
||||||
switch_to_thread (thread);
|
switch_to_thread (thread);
|
||||||
|
|
||||||
/* Leave core files alone. */
|
/* Leave core files alone. */
|
||||||
if (target_has_execution)
|
if (target_has_execution ())
|
||||||
{
|
{
|
||||||
if (inf->attach_flag)
|
if (inf->attach_flag)
|
||||||
target_detach (inf, from_tty);
|
target_detach (inf, from_tty);
|
||||||
|
|
|
@ -155,7 +155,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("evaluation of this expression "
|
error (_("evaluation of this expression "
|
||||||
"requires the target program to be active"));
|
"requires the target program to be active"));
|
||||||
else
|
else
|
||||||
|
@ -182,7 +182,7 @@ value_allocate_space_in_inferior (int len)
|
||||||
val = call_function_by_hand (val, NULL, blocklen);
|
val = call_function_by_hand (val, NULL, blocklen);
|
||||||
if (value_logical_not (val))
|
if (value_logical_not (val))
|
||||||
{
|
{
|
||||||
if (!target_has_execution)
|
if (!target_has_execution ())
|
||||||
error (_("No memory available to program now: "
|
error (_("No memory available to program now: "
|
||||||
"you need to start the target first"));
|
"you need to start the target first"));
|
||||||
else
|
else
|
||||||
|
|
|
@ -902,7 +902,7 @@ windows_solib_create_inferior_hook (int from_tty)
|
||||||
}
|
}
|
||||||
CORE_ADDR tlb;
|
CORE_ADDR tlb;
|
||||||
gdb_byte buf[8];
|
gdb_byte buf[8];
|
||||||
if (target_has_execution
|
if (target_has_execution ()
|
||||||
&& target_get_tib_address (inferior_ptid, &tlb)
|
&& target_get_tib_address (inferior_ptid, &tlb)
|
||||||
&& !target_read_memory (tlb + peb_offset, buf, ptr_bytes))
|
&& !target_read_memory (tlb + peb_offset, buf, ptr_bytes))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue