From owner-freebsd-bugs Sun May 13 14:50: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 9F44E37B424 for ; Sun, 13 May 2001 14:50:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4DLo1W49264; Sun, 13 May 2001 14:50:01 -0700 (PDT) (envelope-from gnats) Received: from smtp.lucky.net (smtp.lucky.net [193.193.193.117]) by hub.freebsd.org (Postfix) with ESMTP id 52A2237B422 for ; Sun, 13 May 2001 14:48:38 -0700 (PDT) (envelope-from kostik@kib.kiev.ua) Received: from kozlik.carrier.kiev.ua (kozlik.carrier.kiev.ua [193.193.193.111]) by smtp.lucky.net (20001217) with ESMTP id 075712C7105 for ; Mon, 14 May 2001 00:48:34 +0300 (EEST) Received: (from uucp@localhost) by kozlik.carrier.kiev.ua with UUCP id ASQ79214; Mon, 14 May 2001 00:48:27 +0300 (EEST) (envelope-from kostik@kib.kiev.ua) Received: from kib.UUCP (uucp@localhost) by kozlik.carrier.kiev.ua (rmail mypid=79213 childpid=79214) with UUCP; Sun, 13 May 2001 21:48:27 +0000 GMT Received: (from kostik@localhost) by kib.kiev.ua (8.11.3/8.11.3) id f4DLkZJ12935; Mon, 14 May 2001 00:46:35 +0300 (EEST) (envelope-from kostik) Message-Id: <200105132146.f4DLkZJ12935@kib.kiev.ua> Date: Mon, 14 May 2001 00:46:35 +0300 (EEST) From: kostik@kieb.kiev.ua Reply-To: kostya@tessart.kiev.ua To: FreeBSD-gnats-submit@freebsd.org Cc: kostya@tessart.kiev.ua X-Send-Pr-Version: 3.113 Subject: i386/27306: hw watchpoints work unreliable under gdb Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 27306 >Category: i386 >Synopsis: hw watchpoints work unreliable under gdb >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 13 14:50:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Kostik I. Belousov >Release: FreeBSD 4.3-RELEASE i386 >Organization: @home >Environment: System: FreeBSD little.home 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Wed Apr 25 22:39:00 EEST 2001 root@little.home:/usr/src/sys/compile/LITTLE i386 K6-2/266, 64 Mb, ... - not relevant >Description: The insert_watchpoint() in the /usr/src/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c contains at least 2 bugs: 1. at line 604, fragment if (ptrace(PT_SETDBREGS, pid, (caddr_t)&dbr, 0) == -1) { perror("ptrace(PT_SETDBREGS) failed"); return 0; } } does not specify return value. insert_breakpoints() sometimes is misinformed on the result of the watch insertion. It seems that the "return 0;" statement is missed. 2. At least on my K6-2, reserved bit 10 of dr7 could be eq 1. In this case, ptrace(PT_SETDBREGS, ...) fails. Might be, all reserved bits in the dr7 should be explicitly cleared after ptrace(PT_GETDBREGS,...) at line 535. The same is true for remove_watchpoint(). >How-To-Repeat: Some attempts of setting hw watchpoint under gdb fail. >Fix: The following is the proposed diff for /usr/src/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c --- freebsd-nat.c.orig Fri Jan 5 19:51:06 2001 +++ freebsd-nat.c Mon May 14 00:25:36 2001 @@ -534,4 +534,5 @@ return 0; } + dbr.dr7 &= ~0xfc00; for (i = 0, mask = 0x03; i < 4; i++, mask <<= 2) @@ -603,4 +604,5 @@ return 0; } + return 0; } else @@ -634,4 +636,5 @@ return 0; } + dbr.dr7 &= ~0xfc00; for (i = 0, dbregp = &dbr.dr0; i < 4; i++, dbregp++) @@ -658,4 +661,5 @@ return 0; } + return 0; } else >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message