From mboxrd@z Thu Jan 1 00:00:00 1970 From: "John Hughes" To: Subject: Hardware watchpoints for UnixWare; based on snapshot 20010627 Date: Fri, 29 Jun 2001 01:52:00 -0000 Message-id: X-SW-Source: 2001-06/msg00509.html Uses new i386-nat.c generic watchpoint support. Interface between procfs.c and i386v42-nat.c is unclean, but I don't see how to do it better. Code in i386v42-nat.c is pretty much a straight copy of i386-linux-nat.c, using procfs to touch the debug regs instead of ptrace. -- John Hughes --- ./config/i386/i386v42mp.mh.orig Tue Mar 20 03:37:55 2001 +++ ./config/i386/i386v42mp.mh Thu Jun 28 16:01:54 2001 @@ -15,5 +15,5 @@ # continuation character (backslash) to extend a commented line. As a # consequence, make considers subsequent tab-indented lines to be # some sort of error. -NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o solib.o solib-svr4.o solib-legacy.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o uw-thread.o +NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o i386v42mp-nat.o i386-nat.o solib.o solib-svr4.o solib-legacy.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o uw-thread.o --- ./config/i386/nm-i386v42mp.h.orig Tue Mar 6 09:21:28 2001 +++ ./config/i386/nm-i386v42mp.h Thu Jun 28 17:57:48 2001 @@ -20,4 +20,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define I386_USE_GENERIC_WATCHPOINTS + +#include "i386/nm-i386.h" #include "nm-sysv4.h" + +/* Provide access to the i386 hardware debugging registers. */ + +extern void i386v42mp_dr_set_control (unsigned long control); +#define I386_DR_LOW_SET_CONTROL(control) \ + i386v42mp_dr_set_control (control) + +extern void i386v42mp_dr_set_addr (int regnum, CORE_ADDR addr); +#define I386_DR_LOW_SET_ADDR(regnum, addr) \ + i386v42mp_dr_set_addr (regnum, addr) + +extern void i386v42mp_dr_reset_addr (int regnum); +#define I386_DR_LOW_RESET_ADDR(regnum) \ + i386v42mp_dr_reset_addr (regnum) + +extern unsigned long i386v42mp_dr_get_status (void); +#define I386_DR_LOW_GET_STATUS() \ + i386v42mp_dr_get_status () + --- ./procfs.c.orig Tue May 15 02:03:36 2001 +++ ./procfs.c Thu Jun 28 15:35:28 2001 @@ -2860,6 +2860,45 @@ #endif } + +#ifdef UNIXWARE + +/* Messy debug register interface for UW7 */ + +pfamily_t * +proc_family (ptid) + ptid_t ptid; +{ + procinfo *pi; + pi = find_procinfo_or_die (PIDGET (ptid), 0); + return &pi->prstatus.pr_lwp.pr_family; +} + +#include + +int +proc_command (ptid, cmd, buf, len) + ptid_t ptid; + int cmd; + void *buf; + int len; +{ + procinfo *pi; + int res; + struct iovec iov [2]; + + pi = find_procinfo_or_die (PIDGET (ptid), 0); + + iov [0].iov_len = sizeof cmd; + iov [0].iov_base = &cmd; + iov [1].iov_len = len; + iov [1].iov_base = buf; + + return writev (pi->ctl_fd, iov, 2); +} + +#endif + /* * Function: proc_iterate_over_mappings * --- ./i386v42mp-nat.c.orig Fri Jun 29 10:00:54 2001 +++ ./i386v42mp-nat.c Thu Jun 28 18:11:49 2001 @@ -0,0 +1,99 @@ +/* Native-dependent code for SVR4.2mp Unix running on i386's, for GDB. + Copyright 1988, 1989, 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "value.h" +#include "inferior.h" +#include "regcache.h" +#include "gdb_assert.h" + +#include +#include + +/* Hardware watchpoint support. */ + +/* Eurgh: */ + +extern pfamily_t *proc_family (); +extern int proc_command (); + +/* Pass the address ADDR to the inferior in the I'th debug register. */ + +static void +i386v42mp_dr_set (int regnum, unsigned long value) +{ + pfamily_t *family = proc_family (inferior_ptid); + + if (!family) + { + perror_with_name ("Couldn't read debug registers"); + return; + } + + family->pf_dbreg.debugreg[regnum] = value; + + if (proc_command (inferior_ptid, PCSDBREG, + &family->pf_dbreg, sizeof family->pf_dbreg) == -1) + { + perror_with_name ("Couldn't set debug registers"); + } +} + +/* Get the value of the DR6 debug status register from the inferior. */ +static unsigned long +i386v42mp_dr_get (int regnum) +{ + pfamily_t *family = proc_family (inferior_ptid); + if (!family) + { + perror_with_name ("Couldn't read debug registers"); + return 0; + } + return family->pf_dbreg.debugreg [regnum]; +} + +void +i386v42mp_dr_set_control (unsigned long control) +{ + i386v42mp_dr_set (DR_CONTROL, control); +} + +void +i386v42mp_dr_set_addr (int regnum, CORE_ADDR addr) +{ + gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); + + i386v42mp_dr_set (DR_FIRSTADDR + regnum, addr); +} + +void +i386v42mp_dr_reset_addr (int regnum) +{ + gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR); + + i386v42mp_dr_set (DR_FIRSTADDR + regnum, 0L); +} + +unsigned long +i386v42mp_dr_get_status (void) +{ + return i386v42mp_dr_get (DR_STATUS); +} >From eliz@is.elta.co.il Fri Jun 29 02:03:00 2001 From: "Eli Zaretskii" To: ac131313@cygnus.com Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa(arm)/rfc] Eliminate HOST_{FLOAT,DOUBLE,...}_FORMAT Date: Fri, 29 Jun 2001 02:03:00 -0000 Message-id: <5137-Fri29Jun2001120040+0300-eliz@is.elta.co.il> References: <3B3C1A5C.3060906@cygnus.com> X-SW-Source: 2001-06/msg00510.html Content-length: 994 > Date: Fri, 29 Jun 2001 02:04:12 -0400 > From: Andrew Cagney > > This patch eliminates the short cut. Instead the conversion is always > routed through floatformat_{to,from}_doublest(). The most telling > comment and the reason this will probably catch a few eyebrows can be > found in i387-tdep.c: > > ! /* Avoid call to floatformat_to_doublest if possible to preserve as > ! much information as possible. */ > > To me, the comment doesn't make sense. If sizeof (host long double) == > size of (target long double) and information is still being lost then I > think floatformat_* has a bug. You could lose information if the original value's bit pattern is not a valid FP number. Does floatformat_to_doublest handle these situations 110% correctly? I see at least one FIXME comment in the code there. If there are some pitfalls in what floatformat_to_doublest do, then I think it's justified to favor native debugging by avoiding those pitfalls.