Support for hardware watchpoints for mips-linux was merged into the Linux kernel for version 2.6.28, with some bug fixes in 2.6.29. This patch adds the corresponding gdb support. It has been tested on both mipsel-linux (32-bit kernel) and mips64-linux (64-bit kernel). For this submission I tested on a mipsel-linux system with these results (with comments): --- ./gdb/testsuite/gdb.sum 2009-04-05 20:53:20.000000000 -0700 +++ gdb.sum 2009-04-05 17:53:05.000000000 -0700 @@ -1,4 +1,4 @@ -Test Run By root on Sun Apr 5 18:08:05 2009 +Test Run By root on Sun Apr 5 14:45:02 2009 Native configuration is mipsel-unknown-linux-gnu === gdb tests === @@ -5717,15 +5717,15 @@ PASS: gdb.base/recurse.exp: continue to recurse (a = 5) PASS: gdb.base/recurse.exp: next over b = 0 in second instance PASS: gdb.base/recurse.exp: set second instance watchpoint -PASS: gdb.base/recurse.exp: continue to second instance watchpoint, first time -PASS: gdb.base/recurse.exp: continue to recurse (a = 4) -PASS: gdb.base/recurse.exp: continue to recurse (a = 3) -PASS: gdb.base/recurse.exp: continue to recurse (a = 2) -PASS: gdb.base/recurse.exp: continue to recurse (a = 1) -PASS: gdb.base/recurse.exp: continue to second instance watchpoint, second time -PASS: gdb.base/recurse.exp: second instance watchpoint deleted when leaving scope -PASS: gdb.base/recurse.exp: continue to first instance watchpoint, second time -PASS: gdb.base/recurse.exp: first instance watchpoint deleted when leaving scope +FAIL: gdb.base/recurse.exp: continue to second instance watchpoint, first time +FAIL: gdb.base/recurse.exp: continue to recurse (a = 4) +FAIL: gdb.base/recurse.exp: continue to recurse (a = 3) +FAIL: gdb.base/recurse.exp: continue to recurse (a = 2) +FAIL: gdb.base/recurse.exp: continue to recurse (a = 1) +FAIL: gdb.base/recurse.exp: continue to second instance watchpoint, second time +FAIL: gdb.base/recurse.exp: second instance watchpoint deleted when leaving scope +FAIL: gdb.base/recurse.exp: continue to first instance watchpoint, second time +FAIL: gdb.base/recurse.exp: first instance watchpoint deleted when leaving scope These failures are caused by the fact that the test assumes more than a the single watch register supported by the test system. Although this patch supports up to eight registers, the test platform only has one. We return true from mips_linux_can_use_hw_breakpoint for multiple requests as it is not possible to know how many watchpoints are enabled. Later gdb tries to insert more than one watchpoint and all but the first fail. Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.base/regs.exp ... Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.base/relational.exp ... PASS: gdb.base/relational.exp: set variable x=14 @@ -8312,26 +8312,26 @@ PASS: gdb.base/watch_thread_num.exp: Disable breakpoint 2 PASS: gdb.base/watch_thread_num.exp: Watchpoint on shared variable PASS: gdb.base/watch_thread_num.exp: info breakpoint 3 -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 1 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 1 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 2 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 2 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 3 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 3 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 4 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 4 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 5 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 5 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 6 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 6 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 7 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 7 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 8 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 8 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 9 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 9 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 10 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 10 (timeout) +PASS: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 1 +PASS: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 1 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 2 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 2 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 3 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 3 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 4 +PASS: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 4 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 5 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 5 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 6 +PASS: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 6 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 7 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 7 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 8 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 8 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 9 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 9 +FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 10 +FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 10 Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.base/watchpoint-hw.exp ... Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.base/watchpoint-solib.exp ... PASS: gdb.base/watchpoint-solib.exp: set pending breakpoint @@ -8516,7 +8516,7 @@ PASS: gdb.cp/annota2.exp: breakpoint at main PASS: gdb.cp/annota2.exp: run until main breakpoint PASS: gdb.cp/annota2.exp: set watch on a.x -PASS: gdb.cp/annota2.exp: watch triggered on a.x +FAIL: gdb.cp/annota2.exp: watch triggered on a.x PASS: gdb.cp/annota2.exp: annotate-quit Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.cp/annota3.exp ... PASS: gdb.cp/annota3.exp: breakpoint main @@ -8528,7 +8528,7 @@ PASS: gdb.cp/annota3.exp: break at main PASS: gdb.cp/annota3.exp: second run until main breakpoint PASS: gdb.cp/annota3.exp: set watch on a.x -PASS: gdb.cp/annota3.exp: watch triggered on a.x +FAIL: gdb.cp/annota3.exp: watch triggered on a.x These two regressions are due to an extra: frame-address 0x00400860 frame-address-end Sequence emitted by gdb with 'set annotate 2'. The watchpoints are triggering but the output is slightly different than the test expects. I chalk it up to a defect in the test. PASS: gdb.cp/annota3.exp: annotate-quit Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.cp/anon-union.exp ... PASS: gdb.cp/anon-union.exp: next 1 @@ -12005,7 +12005,7 @@ PASS: gdb.mi/mi-watch.exp: hw: mi runto callee4 PASS: gdb.mi/mi-watch.exp: hw: break-watch operation PASS: gdb.mi/mi-watch.exp: hw: list of watchpoints -PASS: gdb.mi/mi-watch.exp: hw: watchpoint trigger +FAIL: gdb.mi/mi-watch.exp: hw: watchpoint trigger (unknown output after running) Reported instruction location of the watchpoint trigger is one instruction later and one line later. FAIL: gdb.mi/mi-watch.exp: hw: watchpoint trigger (unknown output after running) Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.mi/mi2-basics.exp ... PASS: gdb.mi/mi2-basics.exp: acceptance of MI operations @@ -12638,7 +12638,7 @@ PASS: gdb.mi/mi2-watch.exp: hw: mi runto callee4 PASS: gdb.mi/mi2-watch.exp: hw: break-watch operation PASS: gdb.mi/mi2-watch.exp: hw: list of watchpoints -PASS: gdb.mi/mi2-watch.exp: hw: watchpoint trigger +FAIL: gdb.mi/mi2-watch.exp: hw: watchpoint trigger (unknown output after running) Reported instruction location of the watchpoint trigger is one instruction later and one line later. FAIL: gdb.mi/mi2-watch.exp: hw: watchpoint trigger (unknown output after running) Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.modula2/unbounded-array.exp ... PASS: gdb.modula2/unbounded-array.exp: switch to modula-2 @@ -13297,10 +13297,10 @@ UNSUPPORTED: gdb.threads/tls.exp: Couldn't compile /home/daney/gdbcvs/src/gdb/testsuite/gdb.threads/tls.c /home/daney/gdbcvs/src/ gdb/testsuite/gdb.threads/tls2.c: unrecognized error Running /home/daney/gdbcvs/src/gdb/testsuite/gdb.threads/watchthreads.exp ... PASS: gdb.threads/watchthreads.exp: successfully compiled posix threads test case -FAIL: gdb.threads/watchthreads.exp: watch args[0] -FAIL: gdb.threads/watchthreads.exp: watch args[1] +PASS: gdb.threads/watchthreads.exp: watch args[0] +PASS: gdb.threads/watchthreads.exp: watch args[1] FAIL: gdb.threads/watchthreads.exp: threaded watch loop -FAIL: gdb.threads/watchthreads.exp: first watchpoint on args[0] hit +PASS: gdb.threads/watchthreads.exp: first watchpoint on args[0] hit FAIL: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit FAIL: gdb.threads/watchthreads.exp: watchpoint on args[0] hit in thread FAIL: gdb.threads/watchthreads.exp: watchpoint on args[1] hit in thread @@ -13455,8 +13455,8 @@ === gdb Summary === -# of expected passes 12556 -# of unexpected failures 151 +# of expected passes 12550 +# of unexpected failures 157 # of expected failures 40 # of known failures 52 # of unresolved testcases 18 OK to commit?