From f17d9474776e50ae47aa71c52211ea6e21adf5d5 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Fri, 8 Dec 2017 17:27:03 +0000 Subject: Clear non-significant bits of address in watchpoint Nowadays, GDB can't set watchpoint on tagged address on AArch64, (gdb) p p2 $1 = (int *) 0xf000fffffffff474 (gdb) watch *((int *) 0xf000fffffffff474) Hardware watchpoint 2: *((int *) 0xf000fffffffff474) (gdb) c Continuing. main () at binutils-gdb/gdb/testsuite/gdb.arch/aarch64-tagged-pointer.c:45 45 void (*func_ptr) (void) = foo; Unexpected error setting hardware debug registers This patch is about setting watchpoint on a tagged address. Unlike breakpoint, watchpoint record the expression rather than the address, and when a watchpoint is fired, GDB checks the expression value changed instead of matching address, so we can mask the watchpoint address by getting rid of non-significant bits of address. gdb: 2017-12-08 Yao Qi * breakpoint.c (update_watchpoint): Call address_significant. gdb/testsuite: 2017-12-08 Yao Qi * gdb.arch/aarch64-tagged-pointer.c (main): Update. * gdb.arch/aarch64-tagged-pointer.exp: Add tests for watchpoint. --- gdb/breakpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/breakpoint.c') diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1cee730..b68718d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1864,7 +1864,7 @@ update_watchpoint (struct watchpoint *b, int reparse) loc->gdbarch = get_type_arch (value_type (v)); loc->pspace = frame_pspace; - loc->address = addr; + loc->address = address_significant (loc->gdbarch, addr); if (bitsize != 0) { -- cgit v1.1