Turn target_can_lock_scheduler into a function
authorTom Tromey <tom@tromey.com>
Tue, 29 Sep 2020 01:38:25 +0000 (19:38 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 29 Sep 2020 01:52:21 +0000 (19:52 -0600)
This changes the object-like macro target_can_lock_scheduler into an
inline function.

gdb/ChangeLog
2020-09-28  Tom Tromey  <tom@tromey.com>

* infrun.c (set_schedlock_func): Update.
* target.h (target_can_lock_scheduler): Now a function.

gdb/ChangeLog
gdb/infrun.c
gdb/target.h

index 2c29fff35ed3a3e58299a3dc9611014b3116247e..fb533aea58224863056aaba2a5f650ab75db5c74 100644 (file)
@@ -1,3 +1,8 @@
+2020-09-28  Tom Tromey  <tom@tromey.com>
+
+       * infrun.c (set_schedlock_func): Update.
+       * target.h (target_can_lock_scheduler): Now a function.
+
 2020-09-28  Tom Tromey  <tom@tromey.com>
 
        * inferior.h (class inferior) <has_execution>: Update.
index 6ff362cb6dfefb535994909bc9042e36bd1bdcaa..17b406d6a92a14b64fb236a7f4c329fb14e7ba34 100644 (file)
@@ -2099,7 +2099,7 @@ show_scheduler_mode (struct ui_file *file, int from_tty,
 static void
 set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (!target_can_lock_scheduler)
+  if (!target_can_lock_scheduler ())
     {
       scheduler_mode = schedlock_off;
       error (_("Target '%s' cannot support this command."), target_shortname);
index 20e7ae36ace776e5334075ba4475db371fe10395..9ebb0c3f6d046f0c3fe2fe9fec4174a379432028 100644 (file)
@@ -1837,8 +1837,12 @@ extern bool target_has_execution (inferior *inf = nullptr);
 /* Can the target support the debugger control of thread execution?
    Can it lock the thread scheduler?  */
 
-#define target_can_lock_scheduler \
-  (current_top_target ()->get_thread_control_capabilities () & tc_schedlock)
+static inline bool
+target_can_lock_scheduler ()
+{
+  return (current_top_target ()->get_thread_control_capabilities ()
+         & tc_schedlock) != 0;
+}
 
 /* Controls whether async mode is permitted.  */
 extern bool target_async_permitted;