From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8479 invoked by alias); 24 Jul 2013 00:27:12 -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 8465 invoked by uid 89); 24 Jul 2013 00:27:12 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Jul 2013 00:27:12 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1V1mv2-00067W-E7 from Maciej_Rozycki@mentor.com for gdb-patches@sourceware.org; Tue, 23 Jul 2013 17:27:04 -0700 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 23 Jul 2013 17:27:03 -0700 Received: from [172.30.64.136] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Wed, 24 Jul 2013 01:27:02 +0100 Date: Wed, 24 Jul 2013 00:27:00 -0000 From: "Maciej W. Rozycki" To: Yao Qi CC: Subject: Re: [PATCH 3/5] Refactor in mips-linux-nat.c In-Reply-To: <1372475427-24862-4-git-send-email-yao@codesourcery.com> Message-ID: References: <1369881867-11372-1-git-send-email-yao@codesourcery.com> <1372475427-24862-1-git-send-email-yao@codesourcery.com> <1372475427-24862-4-git-send-email-yao@codesourcery.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2013-07/txt/msg00551.txt.bz2 On Sat, 29 Jun 2013, Yao Qi wrote: > 2013-06-29 Yao Qi > > * mips-linux-nat.c (get_irw_mask): Rename to ... > (mips_linux_watch_get_irw_mask): ... this. Rename parameter > 'set' to 'n'. Update function comment. All callers changed. > (get_reg_mask): Rename parameter 'set' to 'n'. Update function > comment. All callers changed. > (get_num_valid): Rename to ... > (mips_linux_watch_get_num_valid): ... this. Rename parameter > 'set' to 'n'. Update function comment. All callers changed. > (get_watchlo): Rename to ... > (mips_linux_watch_get_watchlo): ... this. Rename parameter 'set' > to 'n'. Update function comment. All callers changed. > (set_watchlo): Rename to ... > (mips_linux_watch_set_watchlo): ... this. Rename parameter 'set' > to 'n'. Update function comment. All callers changed. > (get_watchhi): Rename to ... > (mips_linux_watch_get_watchhi): ... this. Update function > comment. All callers changed. > (set_watchhi): Rename to ... > (mips_linux_watch_set_watchhi): ... this. Update function > comment. All callers changed. > (mips_linux_read_watch_registers): Update function comment. > Add new parameters 'lwpid', 'watch_readback', and > 'watch_readback_valid'. Update. > (type_to_irw): Rename to ... > (mips_linux_watch_type_to_irw): ... this. Update function > comment. All callers changed. > (fill_mask): Update function comment. > (try_one_watch): Rename to ... > (mips_linux_watch_try_one_watch): ... this. Change the type of > parameter 'irw' from 'unsigned' to 'uint32_t'. > (populate_regs_from_watches): Rename to ... > (mips_linux_watch_populate_regs): ... this. Add parameter > 'current_watches'. All callers changed. > --- > gdb/mips-linux-nat.c | 208 +++++++++++++++++++++++++++++--------------------- > 1 files changed, 121 insertions(+), 87 deletions(-) > > diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c > index 44d23a6..af70945 100644 > --- a/gdb/mips-linux-nat.c > +++ b/gdb/mips-linux-nat.c > @@ -874,29 +892,31 @@ try_one_watch (struct pt_watch_regs *regs, CORE_ADDR addr, > base_addr = addr & ~mask_bits; > > /* Check to see if it is covered by current registers. */ > - for (i = 0; i < get_num_valid (regs); i++) > + for (i = 0; i < mips_linux_watch_get_num_valid (regs); i++) > { > - t_low = get_watchlo (regs, i); > - if (t_low != 0 && irw == ((unsigned)t_low & irw)) > + t_low = mips_linux_watch_get_watchlo (regs, i); > + if (t_low != 0 && irw == ((uint32_t) t_low & irw)) > { > - t_hi = get_watchhi (regs, i) | IRW_MASK; > - t_low &= ~(CORE_ADDR)t_hi; > + t_hi = mips_linux_watch_get_watchhi (regs, i) | IRW_MASK; > + t_low &= ~(CORE_ADDR) t_hi; > if (addr >= t_low && last_byte <= (t_low + t_hi)) > return 1; > } > } > /* Try to find an empty register. */ > free_watches = 0; > - for (i = 0; i < get_num_valid (regs); i++) > + for (i = 0; i < mips_linux_watch_get_num_valid (regs); i++) > { > - t_low = get_watchlo (regs, i); > - if (t_low == 0 && irw == (get_irw_mask (regs, i) & irw)) > + t_low = mips_linux_watch_get_watchlo (regs, i); > + if (t_low == 0 > + && irw == (mips_linux_watch_get_irw_mask (regs, i) & irw)) > { > if (mask_bits <= (get_reg_mask (regs, i) | IRW_MASK)) > { > /* It fits, we'll take it. */ > - set_watchlo (regs, i, base_addr | irw); > - set_watchhi (regs, i, mask_bits & ~IRW_MASK); > + mips_linux_watch_set_watchlo (regs, i, base_addr | irw); > + mips_linux_watch_set_watchhi (regs, i, > + mask_bits & ~IRW_MASK); This fits on one line, please adjust. > @@ -910,21 +930,25 @@ try_one_watch (struct pt_watch_regs *regs, CORE_ADDR addr, > { > /* Try to split it across several registers. */ > regs_copy = *regs; > - for (i = 0; i < get_num_valid (®s_copy); i++) > + for (i = 0; > + i < mips_linux_watch_get_num_valid (®s_copy); > + i++) Likewise. OK with these changes, thanks. Maciej