]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix execution_direction's type
authorPedro Alves <palves@redhat.com>
Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 13 Oct 2015 18:40:50 +0000 (19:40 +0100)
This fixes a few build errors like these in C++ mode:

  src/gdb/reverse.c: In function ‘void exec_reverse_once(char*, char*, int)’:
  src/gdb/reverse.c:49:34: error: invalid conversion from ‘int’ to ‘exec_direction_kind’ [-fpermissive]
     enum exec_direction_kind dir = execution_direction;
    ^
  make: *** [reverse.o] Error 1

gdb/ChangeLog:
2015-10-13  Pedro Alves  <palves@redhat.com>

* infrun.c (restore_execution_direction): New function.
(fetch_inferior_event): Use it instead of
make_cleanup_restore_integer.
(execution_direction): Change type to enum
exec_direction_kind.
* infrun.h (execution_direction): Likewise.

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

index 63d05600e18fdeff1d4d1c4c703f78390a8149d5..84eb37c0ffb5d4a2e53aacbdc4324291e3bfd52a 100644 (file)
@@ -1,3 +1,12 @@
+2015-10-13  Pedro Alves  <palves@redhat.com>
+
+       * infrun.c (restore_execution_direction): New function.
+       (fetch_inferior_event): Use it instead of
+       make_cleanup_restore_integer.
+       (execution_direction): Change type to enum
+       exec_direction_kind.
+       * infrun.h (execution_direction): Likewise.
+
 2015-10-13  Pedro Alves  <palves@redhat.com>
 
        * ada-lang.c (ada_value_primitive_packed_val): Constify
index cf9137031979b0339c5bc620a3a7f9a68207152e..0c268ff55c374f4e0c20cbf35d42c9881f6ca195 100644 (file)
@@ -3798,6 +3798,17 @@ clean_up_just_stopped_threads_fsms (struct execution_control_state *ecs)
     }
 }
 
+/* A cleanup that restores the execution direction to the value saved
+   in *ARG.  */
+
+static void
+restore_execution_direction (void *arg)
+{
+  enum exec_direction_kind *save_exec_dir = (enum exec_direction_kind *) arg;
+
+  execution_direction = *save_exec_dir;
+}
+
 /* Asynchronous version of wait_for_inferior.  It is called by the
    event loop whenever a change of state is detected on the file
    descriptor corresponding to the target.  It can be called more than
@@ -3815,6 +3826,7 @@ fetch_inferior_event (void *client_data)
   struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
   struct cleanup *ts_old_chain;
   int was_sync = sync_execution;
+  enum exec_direction_kind save_exec_dir = execution_direction;
   int cmd_done = 0;
   ptid_t waiton_ptid = minus_one_ptid;
 
@@ -3847,7 +3859,7 @@ fetch_inferior_event (void *client_data)
      event.  */
   target_dcache_invalidate ();
 
-  make_cleanup_restore_integer (&execution_direction);
+  make_cleanup (restore_execution_direction, &save_exec_dir);
   execution_direction = target_execution_direction ();
 
   ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws,
@@ -8937,7 +8949,7 @@ clear_exit_convenience_vars (void)
    Set exec-direction / show exec-direction commands
    (returns error unless target implements to_set_exec_direction method).  */
 
-int execution_direction = EXEC_FORWARD;
+enum exec_direction_kind execution_direction = EXEC_FORWARD;
 static const char exec_forward[] = "forward";
 static const char exec_reverse[] = "reverse";
 static const char *exec_direction = exec_forward;
index ab27538bd382756c68f7adc121bca6c3307fa49d..736406553128dfe039fce5e108dcbd1f72edbbec 100644 (file)
@@ -74,10 +74,8 @@ enum exec_direction_kind
     EXEC_REVERSE
   };
 
-/* The current execution direction.  This should only be set to enum
-   exec_direction_kind values.  It is only an int to make it
-   compatible with make_cleanup_restore_integer.  */
-extern int execution_direction;
+/* The current execution direction.  */
+extern enum exec_direction_kind execution_direction;
 
 extern void start_remote (int from_tty);