From patchwork Fri Oct 9 15:34:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 9012 Received: (qmail 74279 invoked by alias); 9 Oct 2015 15:34:54 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 74253 invoked by uid 89); 9 Oct 2015 15:34:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 09 Oct 2015 15:34:50 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 2C9B591596; Fri, 9 Oct 2015 15:34:49 +0000 (UTC) Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t99FYl0Q014249; Fri, 9 Oct 2015 11:34:48 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] Fix execution_direction's type Date: Fri, 9 Oct 2015 16:34:47 +0100 Message-Id: <1444404887-10192-1-git-send-email-palves@redhat.com> MIME-Version: 1.0 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 2015-10-09 Pedro Alves * 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/infrun.c | 16 ++++++++++++++-- gdb/infrun.h | 6 ++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 123d73f..77b9079 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3800,6 +3800,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 @@ -3817,6 +3828,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; @@ -3849,7 +3861,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, @@ -8939,7 +8951,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; diff --git a/gdb/infrun.h b/gdb/infrun.h index ab27538..7364065 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -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);