public inbox for ecos-devel@sourceware.org
 help / color / mirror / Atom feed
* diag_dump_*
@ 2011-08-09 15:33 Michael Bergandi
  2011-08-09 15:43 ` diag_dump_* Gary Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Bergandi @ 2011-08-09 15:33 UTC (permalink / raw)
  To: eCos Developer List

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?

-- 
Mike

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: diag_dump_*
  2011-08-09 15:33 diag_dump_* Michael Bergandi
@ 2011-08-09 15:43 ` Gary Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 2011-08-09 15:43 UTC (permalink / raw)
  To: Michael Bergandi; +Cc: eCos Developer List

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
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-09 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 15:33 diag_dump_* Michael Bergandi
2011-08-09 15:43 ` diag_dump_* Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).