From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1734 invoked by alias); 12 Nov 2001 05:24:10 -0000 Mailing-List: contact gdb-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1676 invoked from network); 12 Nov 2001 05:24:03 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by sourceware.cygnus.com with SMTP; 12 Nov 2001 05:24:03 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id 254703EF7 for ; Mon, 12 Nov 2001 00:24:04 -0500 (EST) Message-ID: <3BEF5CF4.4010201@cygnus.com> Date: Thu, 01 Nov 2001 09:37:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.3) Gecko/20011020 X-Accept-Language: en-us MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: G packet format ... Content-Type: multipart/mixed; boundary="------------020100070007000502090007" X-SW-Source: 2001-11/txt/msg00014.txt.bz2 This is a multi-part message in MIME format. --------------020100070007000502090007 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 2731 Hello, For those that don't know, GDB's remote protocol G packet currently determins the layout of GDB's internal register cache. Doh! As part of breaking^D^D^Dfixing this, I'd like to introduce a new CLI command that allows the user to specify the G packet (and in fact the entire remote protocol numbering) at runtime. The commands are: set remote registers and show remote registers (better names welcome). The interesting thing is the spec: ::= { }* ;; ::= [ ":" [ ":" ] ] ;; ::= ";" | "\n" ;; Where: is the name of a raw register is the byte size of a register is the [Pp] register number Eg: 8:r0 8:r1 4:r2 4 8:r3 4:spr0:1000 4:spr1 or: 8:r0;8:r1;4:r2;4;8:r3;;4:spr0:1000;4:spr1 GDBserver might use the first form (\n) while GDB's CLI would use the second form. For want of a better way to define the semantics, try the attached shell script. What follows is an attempt at an english description: The spec is divided into two parts separated by a blank entry. Additional blank entries, after the first, are ignored. The first part describes registers that are transfered via either the [Gg] packets or the [Pp] packets. Each entry specifies a number of bytes in the [Gg] packet and then, optionally, the GDB internal name corresponding to those bytes. Unnamed entries are written as zero. The second part describes registers that are only transferable via the [Pp] packets. Size entries in this part of the spec are ignored. The [Pp] packet register number of the first register is zero (unless explicitly specified). The [Pp] packet register number of succeeding registers, if not explicitly specified, is determined by adding one to the previous register's number. (Yes ``1:r1:1000;;4:r0;0'', while stupid, is still legal.) If GDB's internal register is smaller than the packet specification then high bits are discarded to fit. If GDB's internal register is larger than the packet specification then we've got a problem. A guess is zero extend unless a -ve size is specified which would imply sign extend. Worry about this when it actually happens. -- NB: If you didn't catch on. GDB currently doesn't implement the ``read single register'' packet yet this spec assumes this. -- NB: Why do this? The objective is to decouple the remote protocol's G packet from the rest of GDB. That way, GDB has greater flexability in how it implements its regcache. For instance, with the MIPS, it will be possible to have a single internal register layout while still being able to connect to all the remote MIPS targets. -- comments, better suggestions, code? Andrew --------------020100070007000502090007 Content-Type: text/plain; name="reg.sh" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reg.sh" Content-length: 430 #!/bin/sh pnum=0 offset=0 IFS=: printf "name\tsize\tpnum\toffset\n" while read size name num do if test x"${size}" = x; then echo "--- END -- OF -- G -- PACKET --" offset= continue fi if test x"${num}" = x; then num=${pnum} fi if test x"${name}" != x; then printf "${name}\t${size}\t${num}\t${offset}\n" fi pnum=`expr ${num} + 1` test "${offset}" && offset=`expr ${offset} + ${size}` done --------------020100070007000502090007--