From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1363 invoked by alias); 20 Nov 2004 17:45:29 -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 1194 invoked from network); 20 Nov 2004 17:45:19 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sourceware.org with SMTP; 20 Nov 2004 17:45:19 -0000 Received: from hiauly1.hia.nrc.ca (hiauly1.hia.nrc.ca [127.0.0.1] (may be forged)) by hiauly1.hia.nrc.ca (8.12.9-20030917/8.12.9) with ESMTP id iAKHjIko020711 for ; Sat, 20 Nov 2004 12:45:18 -0500 (EST) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.9-20030917/8.12.9/Submit) id iAKHjHTL020710 for gdb-patches@sources.redhat.com; Sat, 20 Nov 2004 12:45:17 -0500 (EST) Message-Id: <200411201745.iAKHjHTL020710@hiauly1.hia.nrc.ca> Subject: [patch] Remove uses of deprecated_registers from hppah-nat.c To: gdb-patches@sources.redhat.com Date: Sat, 20 Nov 2004 17:45:00 -0000 From: "John David Anglin" Cc: randolph@tausq.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2004-11/txt/msg00406.txt.bz2 The enclosed patch fixes the build problem of gdb on hppa64-hp-hpux11.11 due to the removal of deprecated_registers. It's had a small amount of real world testing on this port. I've tried to address the issue of accessing 64-bit registers in 32-bit chunks as required by the current code by using regcache_raw_read_part and regcache_raw_write_part. Ok? Dave -- J. David Anglin dave.anglin@nrc-cnrc.gc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6602) 2004-11-20 John David Anglin * infttrace.h (ttrace_write_reg_64): Add prototype. * hppah-nat.c (store_inferior_registers): Fix warning from ambiguous expression. (store_inferior_registers): Correct formatting. Replace uses of deprecated_registers with calls to regcache_raw_read, regcache_raw_write_part and regcache_raw_read_part. Index: infttrace.h =================================================================== RCS file: /cvs/src/src/gdb/infttrace.h,v retrieving revision 1.4 diff -u -3 -p -r1.4 infttrace.h --- infttrace.h 26 May 2004 15:38:40 -0000 1.4 +++ infttrace.h 19 Nov 2004 04:07:38 -0000 @@ -31,5 +31,6 @@ extern int hpux_has_vforked (int pid, in extern int hpux_has_execd (int pid, char **execd_pathname); extern int hpux_has_syscall_event (int pid, enum target_waitkind *kind, int *syscall_id); +extern int ttrace_write_reg_64 (int, CORE_ADDR, CORE_ADDR); #endif Index: hppah-nat.c =================================================================== RCS file: /cvs/src/src/gdb/hppah-nat.c,v retrieving revision 1.34 diff -u -3 -p -r1.34 hppah-nat.c --- hppah-nat.c 5 Oct 2004 21:53:33 -0000 1.34 +++ hppah-nat.c 19 Nov 2004 04:07:40 -0000 @@ -141,11 +141,11 @@ store_inferior_registers (int regno) layering will not allow us to perform a 64bit register store. What a crock. */ - if (regno == HPPA_PCOQ_HEAD_REGNUM || regno == HPPA_PCOQ_TAIL_REGNUM && len == 8) + if ((regno == HPPA_PCOQ_HEAD_REGNUM || regno == HPPA_PCOQ_TAIL_REGNUM) && len == 8) { CORE_ADDR temp; - temp = *(CORE_ADDR *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)]; + regcache_raw_read (current_regcache, regno, &temp); /* Set the priv level (stored in the low two bits of the PC. */ temp |= 0x3; @@ -155,7 +155,7 @@ store_inferior_registers (int regno) /* If we fail to write the PC, give a true error instead of just a warning. */ - if (errno != 0) + if (errno != 0) { char *err = safe_strerror (errno); char *msg = alloca (strlen (err) + 128); @@ -170,15 +170,24 @@ store_inferior_registers (int regno) the high part of IPSW. What will it take for HP to catch a clue about building sensible interfaces? */ if (regno == HPPA_IPSW_REGNUM && len == 8) - *(int *)&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)] = 0; + { + int temp = 0; + + regcache_raw_write_part (current_regcache, regno, 0, + sizeof (int), &temp); + } #endif for (i = 0; i < len; i += sizeof (int)) { + int temp; + errno = 0; + regcache_raw_read_part (current_regcache, regno, i, + sizeof (int), &temp); call_ptrace (PT_WUREGS, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) addr + i, - *(int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno) + i]); + temp); if (errno != 0) { /* Warning, not error, in case we are attached; sometimes