Remove target_has_registers macro
This removes the target_has_registers object-like macro, replacing it with the underlying function. gdb/ChangeLog 2020-09-28 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_get_register) (tui_data_window::show_registers): Update. * thread.c (scoped_restore_current_thread::restore) (scoped_restore_current_thread::scoped_restore_current_thread): Update. * regcache-dump.c (regcache_print): Update. * python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb): Update. * mi/mi-main.c (mi_cmd_data_write_register_values): Update. * mep-tdep.c (current_me_module, current_options): Update. * linux-thread-db.c (thread_db_load): Update. * infcmd.c (registers_info, info_vector_command) (info_float_command): Update. * ia64-tdep.c (ia64_frame_prev_register) (ia64_sigtramp_frame_prev_register): Update. * ia64-libunwind-tdep.c (libunwind_frame_prev_register): Update. * gcore.c (derive_stack_segment): Update. * frame.c (get_current_frame, has_stack_frames): Update. * findvar.c (language_defn::read_var_value): Update. * arm-tdep.c (arm_pc_is_thumb): Update. * target.c (target_has_registers): Rename from target_has_registers_1. * target.h (target_has_registers): Remove macro. (target_has_registers): Rename from target_has_registers_1.
This commit is contained in:
parent
841de12014
commit
9dccd06e8a
17 changed files with 52 additions and 25 deletions
|
@ -1,3 +1,30 @@
|
||||||
|
2020-09-28 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-regs.c (tui_get_register)
|
||||||
|
(tui_data_window::show_registers): Update.
|
||||||
|
* thread.c (scoped_restore_current_thread::restore)
|
||||||
|
(scoped_restore_current_thread::scoped_restore_current_thread):
|
||||||
|
Update.
|
||||||
|
* regcache-dump.c (regcache_print): Update.
|
||||||
|
* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
|
||||||
|
Update.
|
||||||
|
* mi/mi-main.c (mi_cmd_data_write_register_values): Update.
|
||||||
|
* mep-tdep.c (current_me_module, current_options): Update.
|
||||||
|
* linux-thread-db.c (thread_db_load): Update.
|
||||||
|
* infcmd.c (registers_info, info_vector_command)
|
||||||
|
(info_float_command): Update.
|
||||||
|
* ia64-tdep.c (ia64_frame_prev_register)
|
||||||
|
(ia64_sigtramp_frame_prev_register): Update.
|
||||||
|
* ia64-libunwind-tdep.c (libunwind_frame_prev_register): Update.
|
||||||
|
* gcore.c (derive_stack_segment): Update.
|
||||||
|
* frame.c (get_current_frame, has_stack_frames): Update.
|
||||||
|
* findvar.c (language_defn::read_var_value): Update.
|
||||||
|
* arm-tdep.c (arm_pc_is_thumb): Update.
|
||||||
|
* target.c (target_has_registers): Rename from
|
||||||
|
target_has_registers_1.
|
||||||
|
* target.h (target_has_registers): Remove macro.
|
||||||
|
(target_has_registers): Rename from target_has_registers_1.
|
||||||
|
|
||||||
2020-09-28 Tom Tromey <tom@tromey.com>
|
2020-09-28 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* windows-tdep.c (tlb_make_value): Update.
|
* windows-tdep.c (tlb_make_value): Update.
|
||||||
|
|
|
@ -461,7 +461,7 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
|
||||||
"display/i $pc" always show the correct mode (though if there is
|
"display/i $pc" always show the correct mode (though if there is
|
||||||
a symbol table we will not reach here, so it still may not be
|
a symbol table we will not reach here, so it still may not be
|
||||||
displayed in the mode it will be executed). */
|
displayed in the mode it will be executed). */
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
return arm_frame_is_thumb (get_current_frame ());
|
return arm_frame_is_thumb (get_current_frame ());
|
||||||
|
|
||||||
/* Otherwise we're out of luck; we assume ARM. */
|
/* Otherwise we're out of luck; we assume ARM. */
|
||||||
|
|
|
@ -608,7 +608,7 @@ language_defn::read_var_value (struct symbol *var,
|
||||||
sym_need = symbol_read_needs (var);
|
sym_need = symbol_read_needs (var);
|
||||||
if (sym_need == SYMBOL_NEEDS_FRAME)
|
if (sym_need == SYMBOL_NEEDS_FRAME)
|
||||||
gdb_assert (frame != NULL);
|
gdb_assert (frame != NULL);
|
||||||
else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers)
|
else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers ())
|
||||||
error (_("Cannot read `%s' without registers"), var->print_name ());
|
error (_("Cannot read `%s' without registers"), var->print_name ());
|
||||||
|
|
||||||
if (frame != NULL)
|
if (frame != NULL)
|
||||||
|
|
|
@ -1653,7 +1653,7 @@ get_current_frame (void)
|
||||||
have registers is very confusing. Besides, "printcmd.exp"
|
have registers is very confusing. Besides, "printcmd.exp"
|
||||||
explicitly checks that ``print $pc'' with no registers prints "No
|
explicitly checks that ``print $pc'' with no registers prints "No
|
||||||
registers". */
|
registers". */
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("No registers."));
|
error (_("No registers."));
|
||||||
if (!target_has_stack ())
|
if (!target_has_stack ())
|
||||||
error (_("No stack."));
|
error (_("No stack."));
|
||||||
|
@ -1692,7 +1692,8 @@ static struct frame_info *selected_frame;
|
||||||
bool
|
bool
|
||||||
has_stack_frames ()
|
has_stack_frames ()
|
||||||
{
|
{
|
||||||
if (!target_has_registers || !target_has_stack () || !target_has_memory ())
|
if (!target_has_registers () || !target_has_stack ()
|
||||||
|
|| !target_has_memory ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Traceframes are effectively a substitute for the live inferior. */
|
/* Traceframes are effectively a substitute for the live inferior. */
|
||||||
|
|
|
@ -224,7 +224,7 @@ derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
|
||||||
gdb_assert (top);
|
gdb_assert (top);
|
||||||
|
|
||||||
/* Can't succeed without stack and registers. */
|
/* Can't succeed without stack and registers. */
|
||||||
if (!target_has_stack () || !target_has_registers)
|
if (!target_has_stack () || !target_has_registers ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Can't succeed without current frame. */
|
/* Can't succeed without current frame. */
|
||||||
|
|
|
@ -335,7 +335,7 @@ libunwind_frame_prev_register (struct frame_info *this_frame,
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("No registers."));
|
error (_("No registers."));
|
||||||
|
|
||||||
if (uw_regnum < 0)
|
if (uw_regnum < 0)
|
||||||
|
|
|
@ -1913,7 +1913,7 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("No registers."));
|
error (_("No registers."));
|
||||||
|
|
||||||
if (regnum == gdbarch_sp_regnum (gdbarch))
|
if (regnum == gdbarch_sp_regnum (gdbarch))
|
||||||
|
@ -2284,7 +2284,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("No registers."));
|
error (_("No registers."));
|
||||||
|
|
||||||
if (regnum == IA64_IP_REGNUM)
|
if (regnum == IA64_IP_REGNUM)
|
||||||
|
|
|
@ -2208,7 +2208,7 @@ registers_info (const char *addr_exp, int fpregs)
|
||||||
struct frame_info *frame;
|
struct frame_info *frame;
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("The program has no registers now."));
|
error (_("The program has no registers now."));
|
||||||
frame = get_selected_frame (NULL);
|
frame = get_selected_frame (NULL);
|
||||||
gdbarch = get_frame_arch (frame);
|
gdbarch = get_frame_arch (frame);
|
||||||
|
@ -2349,7 +2349,7 @@ print_vector_info (struct ui_file *file,
|
||||||
static void
|
static void
|
||||||
info_vector_command (const char *args, int from_tty)
|
info_vector_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("The program has no registers now."));
|
error (_("The program has no registers now."));
|
||||||
|
|
||||||
print_vector_info (gdb_stdout, get_selected_frame (NULL), args);
|
print_vector_info (gdb_stdout, get_selected_frame (NULL), args);
|
||||||
|
@ -2887,7 +2887,7 @@ info_float_command (const char *args, int from_tty)
|
||||||
{
|
{
|
||||||
struct frame_info *frame;
|
struct frame_info *frame;
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("The program has no registers now."));
|
error (_("The program has no registers now."));
|
||||||
|
|
||||||
frame = get_selected_frame (NULL);
|
frame = get_selected_frame (NULL);
|
||||||
|
|
|
@ -1194,7 +1194,7 @@ thread_db_load (void)
|
||||||
|
|
||||||
/* Don't attempt to use thread_db on executables not running
|
/* Don't attempt to use thread_db on executables not running
|
||||||
yet. */
|
yet. */
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Don't attempt to use thread_db for remote targets. */
|
/* Don't attempt to use thread_db for remote targets. */
|
||||||
|
|
|
@ -844,7 +844,7 @@ mep_pseudo_cr_index (int pseudo)
|
||||||
static CONFIG_ATTR
|
static CONFIG_ATTR
|
||||||
current_me_module (void)
|
current_me_module (void)
|
||||||
{
|
{
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
{
|
{
|
||||||
ULONGEST regval;
|
ULONGEST regval;
|
||||||
regcache_cooked_read_unsigned (get_current_regcache (),
|
regcache_cooked_read_unsigned (get_current_regcache (),
|
||||||
|
@ -867,7 +867,7 @@ current_me_module (void)
|
||||||
static unsigned int
|
static unsigned int
|
||||||
current_options (void)
|
current_options (void)
|
||||||
{
|
{
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
{
|
{
|
||||||
ULONGEST regval;
|
ULONGEST regval;
|
||||||
regcache_cooked_read_unsigned (get_current_regcache (),
|
regcache_cooked_read_unsigned (get_current_regcache (),
|
||||||
|
|
|
@ -1150,7 +1150,7 @@ mi_cmd_data_write_register_values (const char *command, char **argv, int argc)
|
||||||
error (_("-data-write-register-values: Usage: -data-write-register-"
|
error (_("-data-write-register-values: Usage: -data-write-register-"
|
||||||
"values <format> [<regnum1> <value1>...<regnumN> <valueN>]"));
|
"values <format> [<regnum1> <value1>...<regnumN> <valueN>]"));
|
||||||
|
|
||||||
if (!target_has_registers)
|
if (!target_has_registers ())
|
||||||
error (_("-data-write-register-values: No registers."));
|
error (_("-data-write-register-values: No registers."));
|
||||||
|
|
||||||
if (!(argc - 1))
|
if (!(argc - 1))
|
||||||
|
|
|
@ -361,7 +361,7 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (b->pspace == current_inferior ()->pspace
|
if (b->pspace == current_inferior ()->pspace
|
||||||
&& (!target_has_registers
|
&& (!target_has_registers ()
|
||||||
|| frame_find_by_id (b->frame_id) == NULL))
|
|| frame_find_by_id (b->frame_id) == NULL))
|
||||||
bpfinishpy_out_of_scope (finish_bp);
|
bpfinishpy_out_of_scope (finish_bp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
|
||||||
std::unique_ptr<regcache> regs;
|
std::unique_ptr<regcache> regs;
|
||||||
gdbarch *gdbarch;
|
gdbarch *gdbarch;
|
||||||
|
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
gdbarch = get_current_regcache ()->arch ();
|
gdbarch = get_current_regcache ()->arch ();
|
||||||
else
|
else
|
||||||
gdbarch = target_gdbarch ();
|
gdbarch = target_gdbarch ();
|
||||||
|
@ -257,7 +257,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
|
||||||
{
|
{
|
||||||
auto dump_pseudo = (what_to_dump == regcache_dump_cooked);
|
auto dump_pseudo = (what_to_dump == regcache_dump_cooked);
|
||||||
|
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
dump.reset (new register_dump_regcache (get_current_regcache (),
|
dump.reset (new register_dump_regcache (get_current_regcache (),
|
||||||
dump_pseudo));
|
dump_pseudo));
|
||||||
else
|
else
|
||||||
|
|
|
@ -190,7 +190,7 @@ target_has_stack ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
target_has_registers_1 (void)
|
target_has_registers ()
|
||||||
{
|
{
|
||||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||||
if (t->has_registers ())
|
if (t->has_registers ())
|
||||||
|
|
|
@ -1821,8 +1821,7 @@ extern int target_has_stack ();
|
||||||
|
|
||||||
/* Does the target have registers? (Exec files don't.) */
|
/* Does the target have registers? (Exec files don't.) */
|
||||||
|
|
||||||
extern int target_has_registers_1 (void);
|
extern int target_has_registers ();
|
||||||
#define target_has_registers target_has_registers_1 ()
|
|
||||||
|
|
||||||
/* Does the target have execution? Can we make it jump (through
|
/* Does the target have execution? Can we make it jump (through
|
||||||
hoops), or pop its stack a few times? This means that the current
|
hoops), or pop its stack a few times? This means that the current
|
||||||
|
|
|
@ -1405,7 +1405,7 @@ scoped_restore_current_thread::restore ()
|
||||||
if (inferior_ptid != null_ptid
|
if (inferior_ptid != null_ptid
|
||||||
&& m_was_stopped
|
&& m_was_stopped
|
||||||
&& m_thread->state == THREAD_STOPPED
|
&& m_thread->state == THREAD_STOPPED
|
||||||
&& target_has_registers
|
&& target_has_registers ()
|
||||||
&& target_has_stack ()
|
&& target_has_stack ()
|
||||||
&& target_has_memory ())
|
&& target_has_memory ())
|
||||||
restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
|
restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
|
||||||
|
@ -1439,7 +1439,7 @@ scoped_restore_current_thread::scoped_restore_current_thread ()
|
||||||
|
|
||||||
m_was_stopped = m_thread->state == THREAD_STOPPED;
|
m_was_stopped = m_thread->state == THREAD_STOPPED;
|
||||||
if (m_was_stopped
|
if (m_was_stopped
|
||||||
&& target_has_registers
|
&& target_has_registers ()
|
||||||
&& target_has_stack ()
|
&& target_has_stack ()
|
||||||
&& target_has_memory ())
|
&& target_has_memory ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,7 +117,7 @@ tui_get_register (struct frame_info *frame,
|
||||||
{
|
{
|
||||||
if (changedp)
|
if (changedp)
|
||||||
*changedp = false;
|
*changedp = false;
|
||||||
if (target_has_registers)
|
if (target_has_registers ())
|
||||||
{
|
{
|
||||||
std::string new_content = tui_register_format (frame, regnum);
|
std::string new_content = tui_register_format (frame, regnum);
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ tui_data_window::show_registers (struct reggroup *group)
|
||||||
if (group == 0)
|
if (group == 0)
|
||||||
group = general_reggroup;
|
group = general_reggroup;
|
||||||
|
|
||||||
if (target_has_registers && target_has_stack () && target_has_memory ())
|
if (target_has_registers () && target_has_stack () && target_has_memory ())
|
||||||
{
|
{
|
||||||
show_register_group (group, get_selected_frame (NULL),
|
show_register_group (group, get_selected_frame (NULL),
|
||||||
group == m_current_group);
|
group == m_current_group);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue