From a739972c7c9818241fac0da589edb29adafc78c9 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 28 Sep 2020 19:38:25 -0600 Subject: [PATCH] Remove target_has_memory macro This removes the target_has_memory object-like macro, replacing it with the underlying function. gdb/ChangeLog 2020-09-28 Tom Tromey * target.c (target_has_memory): Rename from target_has_memory_1. * tui/tui-regs.c (tui_data_window::show_registers): Update. * thread.c (scoped_restore_current_thread::restore) (scoped_restore_current_thread::scoped_restore_current_thread): Update. * frame.c (get_current_frame, has_stack_frames): Update. * target.h (target_has_memory): Remove macro. (target_has_memory): Rename from target_has_memory_1. --- gdb/ChangeLog | 11 +++++++++++ gdb/frame.c | 4 ++-- gdb/target.c | 2 +- gdb/target.h | 3 +-- gdb/thread.c | 4 ++-- gdb/tui/tui-regs.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9bdd1f2a8e9..1e2bee69b4b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2020-09-28 Tom Tromey + + * target.c (target_has_memory): Rename from target_has_memory_1. + * tui/tui-regs.c (tui_data_window::show_registers): Update. + * thread.c (scoped_restore_current_thread::restore) + (scoped_restore_current_thread::scoped_restore_current_thread): + Update. + * frame.c (get_current_frame, has_stack_frames): Update. + * target.h (target_has_memory): Remove macro. + (target_has_memory): Rename from target_has_memory_1. + 2020-09-28 Tom Tromey * target.c (target_has_all_memory_1): Remove. diff --git a/gdb/frame.c b/gdb/frame.c index 0b708e66827..113fe8ace40 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1657,7 +1657,7 @@ get_current_frame (void) error (_("No registers.")); if (!target_has_stack) error (_("No stack.")); - if (!target_has_memory) + if (!target_has_memory ()) error (_("No memory.")); /* Traceframes are effectively a substitute for the live inferior. */ if (get_traceframe_number () < 0) @@ -1692,7 +1692,7 @@ static struct frame_info *selected_frame; bool 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; /* Traceframes are effectively a substitute for the live inferior. */ diff --git a/gdb/target.c b/gdb/target.c index 6596efa6984..3bcd6cbc91f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -170,7 +170,7 @@ show_targetdebug (struct ui_file *file, int from_tty, } int -target_has_memory_1 (void) +target_has_memory () { for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ()) if (t->has_memory ()) diff --git a/gdb/target.h b/gdb/target.h index 23022a118ad..2024b1340be 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1812,8 +1812,7 @@ extern void default_target_pass_ctrlc (struct target_ops *ops); /* Does the target include memory? (Dummy targets don't.) */ -extern int target_has_memory_1 (void); -#define target_has_memory target_has_memory_1 () +extern int target_has_memory (); /* Does the target have a stack? (Exec files don't, VxWorks doesn't, until we start a process.) */ diff --git a/gdb/thread.c b/gdb/thread.c index 0217f3b54f7..ba119b009b2 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1407,7 +1407,7 @@ scoped_restore_current_thread::restore () && m_thread->state == THREAD_STOPPED && target_has_registers && target_has_stack - && target_has_memory) + && target_has_memory ()) restore_selected_frame (m_selected_frame_id, m_selected_frame_level); } @@ -1441,7 +1441,7 @@ scoped_restore_current_thread::scoped_restore_current_thread () if (m_was_stopped && target_has_registers && target_has_stack - && target_has_memory) + && target_has_memory ()) { /* When processing internal events, there might not be a selected frame. If we naively call get_selected_frame diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 04d7469de5a..d7d13045d09 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -182,7 +182,7 @@ tui_data_window::show_registers (struct reggroup *group) if (group == 0) 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), group == m_current_group); -- 2.30.2