From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3091 invoked by alias); 9 Aug 2011 15:43:59 -0000 Received: (qmail 3061 invoked by uid 22791); 9 Aug 2011 15:43:58 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hermes.mlbassoc.com (HELO mail.chez-thomas.org) (64.234.241.98) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Aug 2011 15:43:44 +0000 Received: by mail.chez-thomas.org (Postfix, from userid 999) id 863A9166046B; Tue, 9 Aug 2011 09:43:43 -0600 (MDT) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by mail.chez-thomas.org (Postfix) with ESMTP id 166EF16603C3; Tue, 9 Aug 2011 09:43:43 -0600 (MDT) Message-ID: <4E4155AF.60309@mlbassoc.com> Date: Tue, 09 Aug 2011 15:43:00 -0000 From: Gary Thomas User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 MIME-Version: 1.0 To: Michael Bergandi CC: eCos Developer List Subject: Re: diag_dump_* References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2011-08/txt/msg00001.txt.bz2 On 2011-08-09 09:33, Michael Bergandi wrote: > Hi all, > > I have been poking around looking at the diag_dump_* routines in > infra/current/src/diag.cxx and I see the following test in > diag_vdump_buf_with_offset() that makes me wonder what the intent was: > > diag_vdump_buf_with_offset(__printf_fun *pf, > cyg_uint8 *p, > CYG_ADDRWORD s, > cyg_uint8 *base) > { > int i, c; > if ((CYG_ADDRWORD)s> (CYG_ADDRWORD)p) { > s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p; > } > > My understanding of the parameters are: > > pf = pointer to function to use to print > p = pointer to buffer that you want to print > s = size (number of bytes to print) > base = base address to use for printing the addresses > > I hope this is right. I can't find any documentation that actually > says what these parameters are. There is no documentation for the > function in diag.cxx, diag.hxx, or the reference manual. > > So, the test above doesn't make much sense based on what I understand > the parameters to be. > > If I stretch my brain a bit, it looks like 's' is being treated as a > pointer in the test and not a size or length value. Is this right or > what is intended? 's' can either be a size (length of buffer) or an upper address bound. These calls would be equivalent: diag_dump_buf(p, 256); -or- diag_dump_buf(p, (char *)p+256); -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------