[PATCH 5/8] Turn target_can_execute_reverse into function-like macro
Tom Tromey
tom@tromey.com
Tue Jul 21 01:49:11 GMT 2020
This changes target_can_execute_reverse from an object-like macro to a
function-like macro.
gdb/ChangeLog
2020-07-20 Tom Tromey <tom@tromey.com>
* mi/mi-main.c (exec_reverse_continue)
(mi_cmd_list_target_features): Update.
* infrun.c (set_exec_direction_func): Update.
* target.c (default_execution_direction): Update.
* reverse.c (exec_reverse_once): Update.
* target.h (target_can_execute_reverse): Now a function-like
macro.
---
gdb/ChangeLog | 10 ++++++++++
gdb/infrun.c | 2 +-
gdb/mi/mi-main.c | 4 ++--
gdb/reverse.c | 2 +-
gdb/target.c | 2 +-
gdb/target.h | 2 +-
6 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 4178e54051d..2298088910e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -9409,7 +9409,7 @@ static void
set_exec_direction_func (const char *args, int from_tty,
struct cmd_list_element *cmd)
{
- if (target_can_execute_reverse)
+ if (target_can_execute_reverse ())
{
if (!strcmp (exec_direction, exec_forward))
execution_direction = EXEC_FORWARD;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 99da554c444..c5c7be7246a 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -321,7 +321,7 @@ exec_reverse_continue (char **argv, int argc)
if (dir == EXEC_REVERSE)
error (_("Already in reverse mode."));
- if (!target_can_execute_reverse)
+ if (!target_can_execute_reverse ())
error (_("Target %s does not support this command."), target_shortname);
scoped_restore save_exec_dir = make_scoped_restore (&execution_direction,
@@ -1684,7 +1684,7 @@ mi_cmd_list_target_features (const char *command, char **argv, int argc)
ui_out_emit_list list_emitter (uiout, "features");
if (mi_async_p ())
uiout->field_string (NULL, "async");
- if (target_can_execute_reverse)
+ if (target_can_execute_reverse ())
uiout->field_string (NULL, "reverse");
return;
}
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 583e0d02da2..4aa22251b27 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -44,7 +44,7 @@ exec_reverse_once (const char *cmd, const char *args, int from_tty)
error (_("Already in reverse mode. Use '%s' or 'set exec-dir forward'."),
cmd);
- if (!target_can_execute_reverse)
+ if (!target_can_execute_reverse ())
error (_("Target %s does not support this command."), target_shortname);
std::string reverse_command = string_printf ("%s %s", cmd, args ? args : "");
diff --git a/gdb/target.c b/gdb/target.c
index ba9532dcb27..a186b1b163c 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -525,7 +525,7 @@ default_get_ada_task_ptid (struct target_ops *self, long lwp, long tid)
static enum exec_direction_kind
default_execution_direction (struct target_ops *self)
{
- if (!target_can_execute_reverse)
+ if (!target_can_execute_reverse ())
return EXEC_FORWARD;
else if (!target_can_async_p ())
return EXEC_FORWARD;
diff --git a/gdb/target.h b/gdb/target.h
index c9291ab59f1..a0a8d082f0d 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2099,7 +2099,7 @@ extern int target_ranged_break_num_registers (void);
extern int target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask);
/* Target can execute in reverse? */
-#define target_can_execute_reverse \
+#define target_can_execute_reverse() \
current_top_target ()->can_execute_reverse ()
extern const struct target_desc *target_read_description (struct target_ops *);
--
2.17.2
More information about the Gdb-patches
mailing list