Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bart Veer <bartv@ecoscentric.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: minor doc fix
Date: Wed, 30 Jul 2008 20:28:00 -0000	[thread overview]
Message-ID: <pn8wvjf76k.fsf@delenn.bartv.net> (raw)
In-Reply-To: <uvdynnrvk.fsf@gnu.org> (message from Eli Zaretskii on Wed, 30 	Jul 2008 21:34:07 +0300)

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

    >> Date: Wed, 30 Jul 2008 19:17:02 +0100
    >> From: Bart Veer <bartv@ecoscentric.com>
    >> CC: gdb-patches@sourceware.org
    >> 
    >> The text is not talking about host-side or target-side data
    >> structures. It is describing a protocol, what gets transferred
    >> between host and target for a gettimeofday request, which
    >> happens to be 12 bytes and not 8.

    Eli> Sorry, you lost me. Perhaps I'm confused, but `long' takes 8
    Eli> bytes only on 64-bit Unix machines. Otherwise it's 4 bytes.
    Eli> What am I missing?

That we are talking about a communication protocol which is
independent of any given architecture.

On an embedded target, the target-side stub code can send a packet
Fgettimeofday,<buf1>,<buf2> to the host-side gdb. This is part of the
remote protocol as documented in appendix D, "GDB Remote Serial
Protocol" of the gdb info pages. Communication can happen over a
serial line, a network socket, whatever. The Fgettimeofday packet is
part of the File-I/O Remote Protocol Extension documented in that
appendix.

<buf1> is a pointer to a target-side buffer where gdb should store the
desired information. The protocol specification says that the first 4
bytes of that buffer will be filled with the tv_sec value in
big-endian format, and the next 8 bytes of that buffer will be filled
with the tv_usec value, again in big-endian format. When gdb resumes
the target, target-side code is responsible for converting the
contents of that buffer into appropriate data structures. That may
involve swapping the endianness, truncating the 8 bytes of tv_usec
data to the 4 bytes that are actually required, whatever.

The current documentation states that that target-side buffer only
needs to be 8 bytes, not 12, so anybody implementing target-side code
may reserve insufficient memory. Result: confusion and memory
corruption.

Bart


      parent reply	other threads:[~2008-07-30 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 15:55 Bart Veer
2008-07-30 17:55 ` Eli Zaretskii
2008-07-30 18:17   ` Bart Veer
2008-07-30 18:34     ` Eli Zaretskii
2008-07-30 18:49       ` Daniel Jacobowitz
2008-07-30 19:08         ` Eli Zaretskii
2008-07-30 19:15           ` Daniel Jacobowitz
2008-07-30 20:28       ` Bart Veer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pn8wvjf76k.fsf@delenn.bartv.net \
    --to=bartv@ecoscentric.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox