From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27159 invoked by alias); 29 Nov 2002 23:38:26 -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 27148 invoked from network); 29 Nov 2002 23:38:25 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 29 Nov 2002 23:38:25 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 643B53F30; Fri, 29 Nov 2002 18:38:19 -0500 (EST) Message-ID: <3DE7FA6B.5080702@redhat.com> Date: Fri, 29 Nov 2002 15:38:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andreas Schwab Cc: gdb-patches@sources.redhat.com, Daniel Jacobowitz Subject: Re: gdbserver m68k-*-linux* References: Content-Type: multipart/mixed; boundary="------------010807000306070207020302" X-SW-Source: 2002-11/txt/msg00755.txt.bz2 This is a multi-part message in MIME format. --------------010807000306070207020302 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 44 Andreas, Have you seen this patch? Andrew --------------010807000306070207020302 Content-Type: message/rfc822; name="mailbox-message://ac131313@movemail/fsf/gdb/patches#11678506" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mailbox-message://ac131313@movemail/fsf/gdb/patches#11678506" Content-length: 10234 X-Mozilla-Status2: 00000000 Return-Path: Delivered-To: ac131313@localhost.redhat.com Received: from localhost (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 8B25D3FE7 for ; Tue, 26 Nov 2002 12:32:04 -0500 (EST) Envelope-to: cagney@gnu.org Delivery-date: Tue, 26 Nov 2002 12:29:53 -0500 Received: from fencepost.gnu.org by localhost with IMAP (fetchmail-5.9.13) for ac131313@localhost (single-drop); Tue, 26 Nov 2002 12:32:04 -0500 (EST) Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.10) id 18GjWz-0006um-00 for cagney@gnu.org; Tue, 26 Nov 2002 12:29:53 -0500 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18GjWZ-00045U-00 for cagney@gnu.org; Tue, 26 Nov 2002 12:29:29 -0500 Received: from sources.redhat.com ([209.249.29.67]) by monty-python.gnu.org with smtp (Exim 4.10) id 18GjWY-00045J-00 for cagney@gnu.org; Tue, 26 Nov 2002 12:29:27 -0500 Received: (qmail 796 invoked by alias); 26 Nov 2002 17:29:23 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Delivered-To: mailing list gdb-patches@sources.redhat.com Received: (qmail 780 invoked from network); 26 Nov 2002 17:29:20 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.250) by sources.redhat.com with SMTP; 26 Nov 2002 17:29:20 -0000 Received: from laocoon.ics.u-strasbg.fr (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (Postfix) with ESMTP id A2E912C26A9 for ; Tue, 26 Nov 2002 18:30:18 +0100 (CET) Message-Id: <5.0.2.1.2.20021126162728.02a31e50@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr Date: Tue, 26 Nov 2002 18:27:36 +0100 To: gdb-patches@sources.redhat.com From: Pierre Muller Subject: [RFC] Correct gdbserver register packets Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, hits=0.0 required=5.0 tests=PATCH_UNIFIED_DIFF,SPAM_PHRASE_00_01 version=2.41 X-Spam-Level: Content-length: 7715 Currently the cvs sources of gdbserver for m68k linux have a problem. The problem comes from the fact that the register packet is build from the data in regformats directory. But the m68k cpu file contains two registers that are apparently not accessible (or at least not fetched by current gdb). This causes connection to remote server to stay stucked affect that warning. reading register 29: Input/output error My patch is a liitle bit more genral because I read that there are similar problems for other configuration. The main idea is to add a new function int register_present( int regno) that by default allways returns one but that can be implmented by the target that do no supply all the regsiters that are in the regformats dir. The final patches can be separated probably, but I would first like to get comments on the general direction. ChangeLog entry 2002-11-26 Pierre Muller * config.in: Add HAVE_REGISTER_PRESENT. * configure.srv: Set srv_register_present for m68k-linux. * configure.in: Handle srv_register_present. * configure.in: Handle srv_register_present. * linux-m68k-low.c (m68k_regmap): Add missing -1. (m68k_cannot_fetch_register): Handle -1 values. (m68k_cannot_store_register): Handle -1 values. (register_present): Implement m68k linux specific version. * regcache.c (register_present): Implement default version. (set_register_cache): Use register_present function to compute correct size for register packet. * server.h: Include "regdef.h" header. Index: config.in =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/config.in,v retrieving revision 1.5 diff -u -p -r1.5 config.in --- config.in 24 Jul 2002 21:30:46 -0000 1.5 +++ config.in 26 Nov 2002 15:26:46 -0000 @@ -9,6 +9,9 @@ /* Define if the target supports PTRACE_GETREGS for register access. */ #undef HAVE_LINUX_REGSETS +/* Define if the target implements its own register_present function. */ +#undef HAVE_REGISTER_PRESENT + /* Define if the target supports PTRACE_GETFPXREGS for extended register access. */ #undef HAVE_PTRACE_GETFPXREGS Index: configure =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/configure,v retrieving revision 1.10 diff -u -p -r1.10 configure --- configure 24 Jul 2002 21:30:46 -0000 1.10 +++ configure 26 Nov 2002 15:26:47 -0000 @@ -1155,6 +1155,13 @@ EOF fi +if test "${srv_register_present}" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_REGISTER_PRESENT 1 +EOF + +fi + if test "${srv_linux_regsets}" = "yes"; then echo $ac_n "checking for PTRACE_GETREGS""... $ac_c" 1>&6 echo "configure:1161: checking for PTRACE_GETREGS" >&5 Index: configure.in =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/configure.in,v retrieving revision 1.11 diff -u -p -r1.11 configure.in --- configure.in 24 Jul 2002 21:30:46 -0000 1.11 +++ configure.in 26 Nov 2002 15:26:47 -0000 @@ -39,6 +39,10 @@ if test "${srv_linux_usrregs}" = "yes"; AC_DEFINE(HAVE_LINUX_USRREGS) fi +if test "${srv_register_present}" = "yes"; then + AC_DEFINE(HAVE_REGISTER_PRESENT) +fi + if test "${srv_linux_regsets}" = "yes"; then AC_MSG_CHECKING(for PTRACE_GETREGS) AC_CACHE_VAL(gdbsrv_cv_have_ptrace_getregs, Index: configure.srv =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v retrieving revision 1.5 diff -u -p -r1.5 configure.srv --- configure.srv 11 Jun 2002 17:32:39 -0000 1.5 +++ configure.srv 26 Nov 2002 15:26:47 -0000 @@ -36,6 +36,7 @@ case "${target}" in m68*-*-linux*) srv_regobj=reg-m68k.o srv_tgtobj="linux-low.o linux-m68k-low.o" srv_linux_usrregs=yes + srv_register_present=yes ;; mips*-*-linux*) srv_regobj=reg-mips.o srv_tgtobj="linux-low.o linux-mips-low.o" Index: linux-m68k-low.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/linux-m68k-low.c,v retrieving revision 1.3 diff -u -p -r1.3 linux-m68k-low.c --- linux-m68k-low.c 9 Apr 2002 22:44:43 -0000 1.3 +++ linux-m68k-low.c 26 Nov 2002 15:26:47 -0000 @@ -45,24 +45,36 @@ static int m68k_regmap[] = #ifdef PT_FP0 PT_FP0 * 4, PT_FP1 * 4, PT_FP2 * 4, PT_FP3 * 4, PT_FP4 * 4, PT_FP5 * 4, PT_FP6 * 4, PT_FP7 * 4, - PT_FPCR * 4, PT_FPSR * 4, PT_FPIAR * 4 + PT_FPCR * 4, PT_FPSR * 4, PT_FPIAR * 4, #else 21 * 4, 24 * 4, 27 * 4, 30 * 4, 33 * 4, 36 * 4, - 39 * 4, 42 * 4, 45 * 4, 46 * 4, 47 * 4 + 39 * 4, 42 * 4, 45 * 4, 46 * 4, 47 * 4, #endif + -1, -1 }; static int m68k_cannot_store_register (int regno) { - return (regno >= m68k_num_regs); + return (regno >= m68k_num_regs + || m68k_regmap [regno] == -1); } static int m68k_cannot_fetch_register (int regno) { - return (regno >= m68k_num_regs); + return (regno >= m68k_num_regs + || m68k_regmap [regno] == -1); } + +int +register_present (int regno) +{ + return (regno >= 0 + && regno < m68k_num_regs + && m68k_regmap [regno] != -1); +} + struct linux_target_ops the_low_target = { m68k_num_regs, Index: regcache.c =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/regcache.c,v retrieving revision 1.6 diff -u -p -r1.6 regcache.c --- regcache.c 13 Jun 2002 19:29:46 -0000 1.6 +++ regcache.c 26 Nov 2002 15:26:47 -0000 @@ -20,11 +20,19 @@ Boston, MA 02111-1307, USA. */ #include "server.h" -#include "regdef.h" #include #include + +#ifndef HAVE_REGISTER_PRESENT +int +register_present (int n) +{ + return 1; +} +#endif /* not HAS_REGISTER_PRESENT */ + /* The private data for the register cache. Note that we have one per inferior; this is primarily for simplicity, as the performance benefit is minimal. */ @@ -130,10 +138,11 @@ set_register_cache (struct reg *regs, in offset = 0; for (i = 0; i < n; i++) - { - regs[i].offset = offset; - offset += regs[i].size; - } + if (register_present (i)) + { + regs[i].offset = offset; + offset += regs[i].size; + } register_bytes = offset / 8; } Index: regcache.h =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/regcache.h,v retrieving revision 1.5 diff -u -p -r1.5 regcache.h --- regcache.h 11 Jun 2002 17:32:39 -0000 1.5 +++ regcache.h 26 Nov 2002 15:26:47 -0000 @@ -45,6 +45,10 @@ void registers_to_string (char *buf); void registers_from_string (char *buf); +/* Return 1 if register in packets. */ + +extern int register_present (int n); + /* Return the size in bytes of a string-encoded register packet. */ int registers_length (void); Index: server.h =================================================================== RCS file: /cvs/src/src/gdb/gdbserver/server.h,v retrieving revision 1.12 diff -u -p -r1.12 server.h --- server.h 11 Jun 2002 17:32:40 -0000 1.12 +++ server.h 26 Nov 2002 15:26:47 -0000 @@ -70,6 +70,7 @@ struct inferior_list_entry /* Opaque type for user-visible threads. */ struct thread_info; +#include "regdef.h" #include "regcache.h" #include "gdb/signals.h" Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99 --------------010807000306070207020302--