| Summary: | [patch] hw watchpoints work unreliable under gdb(1) | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | kostik <kostik> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed Overcome By Events | ||||||
| Severity: | Affects Only Me | CC: | jhb, kostya | ||||
| Priority: | Normal | ||||||
| Version: | 4.3-RELEASE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: freebsd-bugs->obrien Over to in-tree toolchain maintainer. Responsible Changed From-To: obrien->freebsd-bugs I am not the maintainer. Responsible Changed From-To: freebsd-bugs->mp Over to maintainer. Responsible Changed From-To: mp->marcel It may be too late to worry about this now, but it's a gdb issue nontheless. Responsible Changed From-To: marcel->freebsd-bugs Assign back to the pool. I haven't been working on it and it's unlikely I will in the near future. This code has been reworked upstream and should not have the problem of the missing return statement anymore. Furthermore, the upstream code contains a workaround already to clear reserved bits. |
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(). Fix: The following is the proposed diff for /usr/src/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c How-To-Repeat: Some attempts of setting hw watchpoint under gdb fail.