Date: Mon, 14 May 2001 00:46:35 +0300 (EEST) From: kostik@kieb.kiev.ua To: FreeBSD-gnats-submit@freebsd.org Cc: kostya@tessart.kiev.ua Subject: i386/27306: hw watchpoints work unreliable under gdb Message-ID: <200105132146.f4DLkZJ12935@kib.kiev.ua>
next in thread | raw e-mail | index | archive | help
>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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105132146.f4DLkZJ12935>