From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17237 invoked by alias); 30 Jul 2008 20:28:43 -0000 Received: (qmail 17220 invoked by uid 22791); 30 Jul 2008 20:28:42 -0000 X-Spam-Check-By: sourceware.org Received: from snape.ecoscentric.com (HELO snape.ecoscentric.com) (212.13.207.199) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 30 Jul 2008 20:28:25 +0000 Received: from localhost (snape.ecoscentric.com [127.0.0.1]) by snape.ecoscentric.com (Postfix) with ESMTP id 8B6E1DC8CF7; Wed, 30 Jul 2008 21:28:22 +0100 (BST) Received: from snape.ecoscentric.com ([127.0.0.1]) by localhost (snape.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nX6gcU2fXzoc; Wed, 30 Jul 2008 21:28:21 +0100 (BST) Received: from delenn.bartv.net (unknown [212.13.207.199]) by snape.ecoscentric.com (Postfix) with ESMTP id C6047DC80E6; Wed, 30 Jul 2008 21:28:20 +0100 (BST) Date: Wed, 30 Jul 2008 20:28:00 -0000 Message-Id: From: Bart Veer To: Eli Zaretskii CC: gdb-patches@sourceware.org In-reply-to: (message from Eli Zaretskii on Wed, 30 Jul 2008 21:34:07 +0300) Subject: Re: minor doc fix References: 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: 2008-07/txt/msg00574.txt.bz2 >>>>> "Eli" == Eli Zaretskii writes: >> Date: Wed, 30 Jul 2008 19:17:02 +0100 >> From: Bart Veer >> 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,, 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. 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