From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13140 invoked by alias); 27 Jun 2012 13:48:12 -0000 Received: (qmail 13132 invoked by uid 22791); 27 Jun 2012 13:48:10 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jun 2012 13:47:58 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Sjsb7-0002hE-8s from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 27 Jun 2012 06:47:57 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 27 Jun 2012 06:47:12 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Wed, 27 Jun 2012 06:47:56 -0700 From: Yao Qi To: Subject: [RFC] remove set_tfile_traceframe and cur_traceframe_number Date: Wed, 27 Jun 2012 13:48:00 -0000 Message-ID: <1340804875-23979-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes 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 X-SW-Source: 2012-06/txt/msg00830.txt.bz2 Hi, I can't see the necessity to use function set_tfile_traceframe and variable cur_traceframe_number. IIUC, both set_tfile_traceframe and cur_traceframe_number are equivalent to remote.c:set_remote_traceframe and remote.c:remote_traceframe_number. set_remote_traceframe and remote_traceframe_number are used to switch between traceframe and live inferior in a lazy mode. However, this requirement doesn't exists in tfile, because GDB only reads from trace file. This is the reason I propose to remove them. Regression tested on native and gdbserver on x86_64-linux. OK to apply? gdb: 2012-06-27 Yao Qi * tracepoint.c (set_tfile_traceframe): Removed. (tfile_trace_find, tfile_fetch_registers): Update callers. (tfile_xfer_partial, tfile_get_trace_state_variable_value): Likewise. Remove cur_traceframe_number. (tfile_open, tfile_trace_find): Likewise. --- gdb/tracepoint.c | 40 ++-------------------------------------- 1 files changed, 2 insertions(+), 38 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 4445256..398ba6a 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3631,7 +3631,6 @@ char *trace_filename; int trace_fd = -1; off_t trace_frames_offset; off_t cur_offset; -int cur_traceframe_number; int cur_data_size; int trace_regblock_size; @@ -3724,8 +3723,6 @@ tfile_open (char *filename, int from_tty) ts->disconnected_tracing = 0; ts->circular_buffer = 0; - cur_traceframe_number = -1; - TRY_CATCH (ex, RETURN_MASK_ALL) { /* Read through a section of newline-terminated lines that @@ -4225,28 +4222,6 @@ tfile_get_traceframe_address (off_t tframe_offset) return addr; } -/* Make tfile's selected traceframe match GDB's selected - traceframe. */ - -static void -set_tfile_traceframe (void) -{ - int newnum; - - if (cur_traceframe_number == get_traceframe_number ()) - return; - - /* Avoid recursion, tfile_trace_find calls us again. */ - cur_traceframe_number = get_traceframe_number (); - - newnum = target_trace_find (tfind_number, - get_traceframe_number (), 0, 0, NULL); - - /* Should not happen. If it does, all bets are off. */ - if (newnum != get_traceframe_number ()) - warning (_("could not set tfile's traceframe")); -} - /* Given a type of search and some parameters, scan the collection of traceframes in the file looking for a match. When found, return both the traceframe and tracepoint number, otherwise -1 for @@ -4263,12 +4238,7 @@ tfile_trace_find (enum trace_find_type type, int num, off_t offset, tframe_offset; ULONGEST tfaddr; - /* Lookups other than by absolute frame number depend on the current - trace selected, so make sure it is correct on the tfile end - first. */ - if (type != tfind_number) - set_tfile_traceframe (); - else if (num == -1) + if (num == -1) { if (tpp) *tpp = -1; @@ -4327,7 +4297,7 @@ tfile_trace_find (enum trace_find_type type, int num, *tpp = tpnum; cur_offset = offset; cur_data_size = data_size; - cur_traceframe_number = tfnum; + return tfnum; } /* Skip past the traceframe's data. */ @@ -4442,8 +4412,6 @@ tfile_fetch_registers (struct target_ops *ops, if (!trace_regblock_size) return; - set_tfile_traceframe (); - regs = alloca (trace_regblock_size); if (traceframe_find_block_type ('R', 0) >= 0) @@ -4527,8 +4495,6 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object, if (readbuf == NULL) error (_("tfile_xfer_partial: trace file is read-only")); - set_tfile_traceframe (); - if (traceframe_number != -1) { int pos = 0; @@ -4614,8 +4580,6 @@ tfile_get_trace_state_variable_value (int tsvnum, LONGEST *val) { int pos; - set_tfile_traceframe (); - pos = 0; while ((pos = traceframe_find_block_type ('V', pos)) >= 0) { -- 1.7.7.6