From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12417 invoked by alias); 19 Nov 2001 19:24:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12393 invoked from network); 19 Nov 2001 19:24:25 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sourceware.cygnus.com with SMTP; 19 Nov 2001 19:24:25 -0000 Received: from rtl.cygnus.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id LAA19214 for ; Mon, 19 Nov 2001 11:24:24 -0800 (PST) Received: (from ezannoni@localhost) by rtl.cygnus.com (8.11.2/8.11.0) id fAJJUp601661; Mon, 19 Nov 2001 14:30:51 -0500 X-Authentication-Warning: krustylu.cygnus.com: ezannoni set sender to ezannoni@cygnus.com using -f From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15353.24043.102000.208495@krustylu.cygnus.com> Date: Wed, 07 Nov 2001 15:02:00 -0000 To: gdb-patches@sources.redhat.com Subject: [RFA] infptrace.c: use regcache_collect X-Mailer: VM 6.97 under Emacs 20.7.1 X-SW-Source: 2001-11/txt/msg00120.txt.bz2 Is this ok? Thanks Elena 2001-11-19 Elena Zannoni * infptrace.c (fetch_register): Dynamically allocate buffer for register. (store_register): Use regcache_collect, instead of accessing the register buffer directly. Index: infptrace.c =================================================================== RCS file: /cvs/uberbaum/gdb/infptrace.c,v retrieving revision 1.18 diff -u -p -c -r1.18 infptrace.c cvs server: conflicting specifications of output style *** infptrace.c 2001/10/21 14:53:46 1.18 --- infptrace.c 2001/11/19 19:23:08 *************** fetch_register (int regno) *** 359,365 **** char mess[128]; /* For messages */ register int i; unsigned int offset; /* Offset of registers within the u area. */ ! char buf[MAX_REGISTER_RAW_SIZE]; int tid; if (CANNOT_FETCH_REGISTER (regno)) --- 359,365 ---- char mess[128]; /* For messages */ register int i; unsigned int offset; /* Offset of registers within the u area. */ ! char *buf = alloca (MAX_REGISTER_RAW_SIZE); int tid; if (CANNOT_FETCH_REGISTER (regno)) *************** store_register (int regno) *** 424,429 **** --- 424,430 ---- register int i; unsigned int offset; /* Offset of registers within the u area. */ int tid; + char *buf = alloca (MAX_REGISTER_RAW_SIZE); if (CANNOT_STORE_REGISTER (regno)) { *************** store_register (int regno) *** 437,447 **** offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, ! *(PTRACE_XFER_TYPE *) & registers[REGISTER_BYTE (regno) + i]); regaddr += sizeof (PTRACE_XFER_TYPE); if (errno != 0) { --- 438,453 ---- offset = U_REGS_OFFSET; regaddr = register_addr (regno, offset); + + /* Put the contents of regno into a local buffer */ + regcache_collect (regno, buf); + + /* Store the local buffer into the inferior a chunk at the time. */ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (PTRACE_XFER_TYPE)) { errno = 0; ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr, ! *(PTRACE_XFER_TYPE *) (buf + i)); regaddr += sizeof (PTRACE_XFER_TYPE); if (errno != 0) {