From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29480 invoked by alias); 16 Apr 2004 00:45:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 29471 invoked from network); 16 Apr 2004 00:45:03 -0000 Received: from unknown (HELO zmamail03.zma.compaq.com) (161.114.64.103) by sources.redhat.com with SMTP; 16 Apr 2004 00:45:03 -0000 Received: from mailrelay01.cce.cpqcorp.net (mailrelay01.cce.cpqcorp.net [16.47.68.171]) by zmamail03.zma.compaq.com (Postfix) with ESMTP id 7EA70FA9C for ; Thu, 15 Apr 2004 20:45:02 -0400 (EDT) Received: from kitche.zk3.dec.com (kitche1.zk3.dec.com [16.140.160.161]) by mailrelay01.cce.cpqcorp.net (Postfix) with ESMTP id 199583BAF; Thu, 15 Apr 2004 19:45:01 -0500 (CDT) Received: from hp.com by kitche.zk3.dec.com (8.9.3/1.1.27.5/27Oct00-1235PM) id UAA0000838197; Thu, 15 Apr 2004 20:45:00 -0400 (EDT) Message-ID: <407F2BAB.4060408@hp.com> Date: Fri, 16 Apr 2004 00:45:00 -0000 From: Robert Picco User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031030 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: new gdb remote packet type Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-04/txt/msg00334.txt.bz2 Hi: I encountered an issue when attempting to get the kernel debugger (kgdb) running for IA64 on Linux. The debugger works fine over ethernet but won't work over a serial line because of the size of the g-packet (>10K bytes). Most registers in the g-packet aren't required for kernel debugging. The patch below has introduced a new gdb packet which asks the target (kgdb) for the register offsets in the g-packet. In my kernel kgdb stub all stacked registers, nearly all floating point (kernel uses small subset of floating point), all predicate registers, all nat registers and most of the application registers are excluded. The patch won't break any existing targets of gdb because the new packet won't be recognized. No other architectures (at least those I'm aware of) suffer from such a huge g-packet. Do you think a solution like this is possible for inclusion into gdb? thanks, Bob --- gdb-6.0-orig/gdb/remote.c 2003-06-30 11:51:49.000000000 -0400 +++ gdb-6.0/gdb/remote.c 2004-04-13 11:46:38.000000000 -0400 @@ -2131,6 +2131,44 @@ return 1; } +static int register_init; + +static void +remote_register_size(void) +{ + struct remote_state *rs = get_remote_state (); + char *buf = alloca (rs->remote_packet_size); + int regnum, offset, size; + + + register_init = 1; + + for (size = 0, regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++) + { + struct packet_reg *r = &rs->regs[regnum]; + buf[0] = 'r'; + bin2hex ((char *) ®num, &buf[1], sizeof(regnum)); + putpkt(buf); + getpkt (buf, (rs->remote_packet_size), 0); + if (buf[0] != 'r') { + if (regnum) + fprintf_unfiltered (gdb_stdlog, + "Received some valid register packets and later failed\n"); + return; + } + hex2bin(&buf[1], (char *)&offset, sizeof(offset)); + r->offset = offset; + if (offset != -1) { + r->in_g_packet = 1; + size += register_size (current_gdbarch, regnum); + } + else + r->in_g_packet = 0; + + } + rs->sizeof_g_packet = size; +} + static int remote_start_remote (struct ui_out *uiout, void *dummy) { @@ -2139,9 +2177,13 @@ /* Ack any packet which the remote side has already sent. */ serial_write (remote_desc, "+", 1); + /* Let the stub know that we want it to return the thread. */ set_thread (-1, 0); + if (!register_init) + remote_register_size(); + inferior_ptid = remote_current_thread (inferior_ptid); get_offsets (); /* Get text, data & bss offsets */ @@ -3438,8 +3480,8 @@ gdb_assert (reg != NULL); if (!reg->in_g_packet) internal_error (__FILE__, __LINE__, - "Attempt to fetch a non G-packet register when this " - "remote.c does not support the p-packet."); + "Attempt to fetch a non G-packet register (%d) when this " + "remote.c does not support the p-packet.", regnum); } sprintf (buf, "g");