From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4168 invoked by alias); 12 Dec 2011 02:30:58 -0000 Received: (qmail 4152 invoked by uid 22791); 12 Dec 2011 02:30:57 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM 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; Mon, 12 Dec 2011 02:30:40 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RZvf5-0001xm-Cx from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Sun, 11 Dec 2011 18:30:39 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 11 Dec 2011 18:30:38 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Sun, 11 Dec 2011 18:30:38 -0800 Message-ID: <4EE5674B.7050205@codesourcery.com> Date: Mon, 12 Dec 2011 09:39:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111110 Thunderbird/8.0 MIME-Version: 1.0 To: Subject: [patch] Replace magic numbers with macros in gdbserver/tracepoint.c Content-Type: multipart/mixed; boundary="------------080500080900010708050707" 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: 2011-12/txt/msg00342.txt.bz2 --------------080500080900010708050707 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 241 I happen to read gdbserver/tracepoint.c and find there have been some macros defined but some magic numbers are still there. This patch is replace exiting magic numbers with existing macros. I'll check it in later today. -- Yao (齐尧) --------------080500080900010708050707 Content-Type: text/x-patch; name="0002-replace-magic-number.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-replace-magic-number.patch" Content-length: 1885 gdb/gdbserver/ 2011-12-12 Yao Qi * tracepoint.c (trace_buffer_alloc): Replace magic numbers with macros. (upload_fast_traceframes, upload_fast_traceframes): Likewise. --- gdb/gdbserver/tracepoint.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 585f18d..d53d26b 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -1588,8 +1588,9 @@ trace_buffer_alloc (size_t amt) #ifdef IN_PROCESS_AGENT /* Build the tentative token. */ - commit_count = (((prev & 0x0007ff00) + 0x100) & 0x0007ff00); - commit = (((prev & 0x0007ff00) << 12) + commit_count = (((prev & GDBSERVER_FLUSH_COUNT_MASK_CURR) + 0x100) + & GDBSERVER_FLUSH_COUNT_MASK_CURR); + commit = (((prev & GDBSERVER_FLUSH_COUNT_MASK_CURR) << 12) | commit_count | curr); @@ -1621,8 +1622,8 @@ trace_buffer_alloc (size_t amt) refetch = trace_buffer_ctrl_curr; - if ((refetch == commit - || ((refetch & 0x7ff00000) >> 12) == commit_count)) + if (refetch == commit + || ((refetch & GDBSERVER_FLUSH_COUNT_MASK_PREV) >> 12) == commit_count) { /* effective */ trace_debug ("change is effective: (prev=%08x, commit=%08x, " @@ -7080,10 +7081,10 @@ upload_fast_traceframes (void) /* Update the token, with new counters, and the GDBserver stamp bit. Alway reuse the current TBC index. */ - prev = ipa_trace_buffer_ctrl_curr & 0x0007ff00; - counter = (prev + 0x100) & 0x0007ff00; + prev = ipa_trace_buffer_ctrl_curr & GDBSERVER_FLUSH_COUNT_MASK_CURR; + counter = (prev + 0x100) & GDBSERVER_FLUSH_COUNT_MASK_CURR; - ipa_trace_buffer_ctrl_curr = (0x80000000 + ipa_trace_buffer_ctrl_curr = ( GDBSERVER_UPDATED_FLUSH_COUNT_BIT | (prev << 12) | counter | curr_tbctrl_idx); -- 1.7.0.4 --------------080500080900010708050707--