Return-Path: Received: from localhost (bix [127.0.0.1]) by localhost.localdomain (8.12.10/8.12.10) with ESMTP id i4DMbF4i024668 for ; Thu, 13 May 2004 15:37:16 -0700 Received: from bix [127.0.0.1] by localhost with POP3 (fetchmail-6.2.0) for akpm@localhost (single-drop); Thu, 13 May 2004 15:37:16 -0700 (PDT) Received: from fire-2.osdl.org (air1.pdx.osdl.net [172.20.0.5]) by mail.osdl.org (8.11.6/8.11.6) with ESMTP id i4DMalJ31147 for ; Thu, 13 May 2004 15:36:47 -0700 Received: from zmamail05.zma.compaq.com (zmamail05.zma.compaq.com [161.114.64.105]) by fire-2.osdl.org (8.12.8/8.12.8) with ESMTP id i4DMajwr008976 for ; Thu, 13 May 2004 15:36:45 -0700 Received: from mailrelay01.cac.cpqcorp.net (mailrelay01.cac.cpqcorp.net [16.47.132.152]) by zmamail05.zma.compaq.com (Postfix) with ESMTP id 31B7635B9 for ; Thu, 13 May 2004 18:36:44 -0400 (EDT) Received: from kitche.zk3.dec.com (kitche4.zk3.dec.com [16.140.160.166]) by mailrelay01.cac.cpqcorp.net (Postfix) with ESMTP id 32D3D278B; Thu, 13 May 2004 15:36:43 -0700 (PDT) Received: from hp.com by kitche.zk3.dec.com (8.9.3/1.1.27.5/27Oct00-1235PM) id SAA0002336256; Thu, 13 May 2004 18:36:42 -0400 (EDT) Message-ID: <40A3FA03.4000907@hp.com> Date: Thu, 13 May 2004 18:43:15 -0400 From: Robert Picco User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031030 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Morton Subject: gdb patch for IA64 kgdb Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-MIMEDefang-Filter: osdl$Revision: 1.59 $ X-Scanned-By: MIMEDefang 2.36 X-Spam-Status: No, hits=-4.9 required=1.0 tests=BAYES_00 autolearn=ham version=2.60 X-Spam-Checker-Version: SpamAssassin 2.60 (1.212-2003-09-23-exp) on bix X-Spam-Level: *** gdb-6.1-orig/gdb/remote.c 2004-02-25 15:41:00.000000000 -0500 --- gdb-6.1/gdb/remote.c 2004-05-06 14:05:47.000000000 -0400 *************** *** 809,814 **** --- 809,831 ---- show_packet_config_cmd (&remote_protocol_E); } + static struct packet_config remote_protocol_p; + + static void + set_remote_protocol_p_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) + { + update_packet_config (&remote_protocol_p); + } + + static void + show_remote_protocol_p_packet_cmd (char *args, int from_tty, + struct cmd_list_element *c) + { + show_packet_config_cmd (&remote_protocol_p); + } + + /* Should we try the 'P' (set register) request? */ *************** *** 2080,2085 **** --- 2097,2103 ---- update_packet_config (&remote_protocol_e); update_packet_config (&remote_protocol_E); update_packet_config (&remote_protocol_P); + update_packet_config (&remote_protocol_p); update_packet_config (&remote_protocol_qSymbol); update_packet_config (&remote_protocol_vcont); for (i = 0; i < NR_Z_PACKET_TYPES; i++) *************** *** 3240,3245 **** --- 3258,3293 ---- /* Read the remote registers into the block REGS. */ /* Currently we just read all the registers, so we don't use regnum. */ + static int + fetch_register_using_p (int regnum) + { + struct remote_state *rs = get_remote_state (); + char *buf = alloca (rs->remote_packet_size), *p; + char regp[MAX_REGISTER_SIZE]; + int i; + + buf[0] = 'p'; + bin2hex((char *) ®num, &buf[1], sizeof(regnum)); + buf[9] = 0; + remote_send (buf, rs->remote_packet_size); + if (buf[0] != 0 && buf[0] != 'E') { + p = buf; + i = 0; + while (p[0] != 0) { + if (p[1] == 0) { + error("fetch_register_using_p: early buf termination"); + return 0; + } + regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]); + p += 2; + } + regcache_raw_supply (current_regcache, regnum, regp); + return 1; + } + + return 0; + } + static void remote_fetch_registers (int regnum) { *************** *** 3260,3265 **** --- 3308,3338 ---- "Attempt to fetch a non G-packet register when this " "remote.c does not support the p-packet."); } + switch (remote_protocol_p.support) + { + case PACKET_DISABLE: + break; + case PACKET_ENABLE: + if (fetch_register_using_p (regnum)) + return; + else + error ("Protocol error: p packet not recognized by stub"); + case PACKET_SUPPORT_UNKNOWN: + if (fetch_register_using_p (regnum)) + { + /* The stub recognized the 'p' packet. Remember this. */ + remote_protocol_p.support = PACKET_ENABLE; + return; + } + else + { + /* The stub does not support the 'P' packet. Use 'G' + instead, and don't try using 'P' in the future (it + will just waste our time). */ + remote_protocol_p.support = PACKET_DISABLE; + break; + } + } sprintf (buf, "g"); remote_send (buf, (rs->remote_packet_size)); *************** *** 5419,5424 **** --- 5492,5498 ---- show_remote_protocol_e_packet_cmd (args, from_tty, NULL); show_remote_protocol_E_packet_cmd (args, from_tty, NULL); show_remote_protocol_P_packet_cmd (args, from_tty, NULL); + show_remote_protocol_p_packet_cmd (args, from_tty, NULL); show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL); show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL); show_remote_protocol_binary_download_cmd (args, from_tty, NULL); *************** *** 5631,5636 **** --- 5705,5717 ---- &remote_set_cmdlist, &remote_show_cmdlist, 1); + add_packet_config_cmd (&remote_protocol_p, + "p", "fetch-register", + set_remote_protocol_p_packet_cmd, + show_remote_protocol_p_packet_cmd, + &remote_set_cmdlist, &remote_show_cmdlist, + 1); + add_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP], "Z0", "software-breakpoint", set_remote_protocol_Z_software_bp_packet_cmd,