From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29480 invoked by alias); 14 May 2013 19:10:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 29469 invoked by uid 89); 14 May 2013 19:10:37 -0000 X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 14 May 2013 19:10:36 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4EJAZ5x014830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 May 2013 15:10:35 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4EJAYgJ017920 for ; Tue, 14 May 2013 15:10:34 -0400 Subject: [PATCH 1/5] Factor out in-stepping-range checks. To: gdb-patches@sourceware.org From: Pedro Alves Date: Tue, 14 May 2013 19:10:00 -0000 Message-ID: <20130514191033.13213.74286.stgit@brno.lan> In-Reply-To: <20130514191026.13213.39574.stgit@brno.lan> References: <20130514191026.13213.39574.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00486.txt.bz2 This adds a function for doing within-thread's-stepping-range checks, and converts a couple spots to use it. Following patches will add more uses. v3: - macro -> function, and rename it. gdb/ 2013-05-09 Yao Qi Pedro Alves * gdbthread.h (pc_in_thread_step_range): New declaration. * thread.c (pc_in_thread_step_range): New function. * infrun.c (handle_inferior_event): Use it. --- gdb/gdbthread.h | 4 ++++ gdb/infrun.c | 6 ++---- gdb/thread.c | 7 +++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 0846322..a9f8a94 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -399,6 +399,10 @@ extern struct thread_info* inferior_thread (void); extern void update_thread_list (void); +/* Return true if PC is in the stepping range of THREAD. */ + +int pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread); + extern struct thread_info *thread_list; #endif /* GDBTHREAD_H */ diff --git a/gdb/infrun.c b/gdb/infrun.c index 54e92f2..57c427d 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4337,8 +4337,7 @@ process_event_stop_test: if (ecs->event_thread->control.step_range_end != 0 && ecs->event_thread->suspend.stop_signal != GDB_SIGNAL_0 - && (ecs->event_thread->control.step_range_start <= stop_pc - && stop_pc < ecs->event_thread->control.step_range_end) + && pc_in_thread_step_range (stop_pc, ecs->event_thread) && frame_id_eq (get_stack_frame_id (frame), ecs->event_thread->control.step_stack_frame_id) && ecs->event_thread->control.step_resume_breakpoint == NULL) @@ -4707,8 +4706,7 @@ process_event_stop_test: through a function epilogue and therefore must detect when the current-frame changes in the middle of a line. */ - if (stop_pc >= ecs->event_thread->control.step_range_start - && stop_pc < ecs->event_thread->control.step_range_end + if (pc_in_thread_step_range (stop_pc, ecs->event_thread) && (execution_direction != EXEC_REVERSE || frame_id_eq (get_frame_id (frame), ecs->event_thread->control.step_frame_id))) diff --git a/gdb/thread.c b/gdb/thread.c index 2a1d723..2eb506b 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -750,6 +750,13 @@ finish_thread_state_cleanup (void *arg) finish_thread_state (*ptid_p); } +int +pc_in_thread_step_range (CORE_ADDR pc, struct thread_info *thread) +{ + return (pc >= thread->control.step_range_start + && pc < thread->control.step_range_end); +} + /* Prints the list of threads and their details on UIOUT. This is a version of 'info_threads_command' suitable for use from MI.