This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ping: [patch] aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous ones


On Fri, 20 Apr 2018 16:49:39 +0200, Pedro Alves wrote:
> ~~~~~~~~~~~~
> Previously, when the hardware reported a watchpoint hit on an address
> that did not match our watchpoint (this happens in case of instructions
> which access large chunks of memory such as "stp") the process would
> enter a loop where we would be continually resuming it (because we did
> not recognise that watchpoint hit) and it would keep hitting the
> watchpoint again and again. The tracing process would never get
> notified of the watchpoint hit.
> ~~~~~~~~~~~~
> 
> ... I'm left with the impression that ADDR_TRAP could be even
> lower than addr_watch_aligned, in which case we'll still miss
> watchpoints.  I wondering whether GDB should be using a similar
> trick as that kernel patch does.

This is new for me what you found.  I just did not expect the changed region
region could be larger than aligned 8 bytes.

Unfortunately I cannot reproduce that so I cannot do much with that.
Does anyone know how to reproduce it?


Thanks,
Jan


I was unable to make GCC use the "stp" instruction so I hand-edited it there:
# gcc -o w2.S w2.c -Wall -g -O3 -S -dA
# output attached+edited
gcc -o w2 w2.S -Wall 

aarch64-7s-rhel-alt-v1.ss.eng.rdu.redhat.com
kernel-4.14.0-49.el7a.aarch64

../gdb -data-directory ../data-directory/ ./w2 -batch -ex 'b main' -ex r -ex 'p &g1' -ex 'p &g2' -ex 'b 8' -ex 'watch g2' -ex 'set debug infrun 1' -ex c -ex disas
Breakpoint 1 at 0x400458: file w2.c, line 7.
Breakpoint 1, main () at w2.c:7
7	  f(1,2);
$1 = (long *) 0x420030 <g1>
$2 = (long *) 0x420038 <g2>
Breakpoint 2 at 0x400464: file w2.c, line 9.
Hardware watchpoint 3: g2
infrun: clear_proceed_status_thread (process 30847)
infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
infrun: step-over queue now empty
infrun: resuming [process 30847] for step-over
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process 30847] at 0x400458
infrun: infrun_async(1)
infrun: prepare_to_wait
infrun: proceed: [process 30847] resumed
infrun: target_wait (-1.0.0, status) =
infrun:   30847.30847.0 [process 30847],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x40045c
infrun: no stepping, continue
infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [process 30847] at 0x40045c
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun:   30847.30847.0 [process 30847],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x4005d8
infrun: stopped by watchpoint
infrun: stopped data address = 0x420038
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun:   process 30847 not executing
infrun: stop_all_threads, pass=1, iterations=1
infrun:   process 30847 not executing
infrun: stop_all_threads done
infrun: stepping past non-steppable watchpoint. skipping watchpoint at 0x420038:8
infrun: stepping past non-steppable watchpoint. skipping watchpoint at 0x420038:8
infrun: stepping past non-steppable watchpoint. skipping watchpoint at 0x420038:8
infrun: stepping past non-steppable watchpoint. skipping watchpoint at 0x420038:8
infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [process 30847] at 0x4005d8
infrun: prepare_to_wait
infrun: target_wait (-1.0.0, status) =
infrun:   30847.30847.0 [process 30847],
infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
infrun: TARGET_WAITKIND_STOPPED
infrun: clear_step_over_info
infrun: restart threads: [process 30847] is event thread
infrun: stop_pc = 0x4005dc
infrun: BPSTAT_WHAT_STOP_NOISY
infrun: stop_waiting
infrun: stop_all_threads
infrun: stop_all_threads, pass=0, iterations=0
infrun:   process 30847 not executing
infrun: stop_all_threads, pass=1, iterations=1
infrun:   process 30847 not executing
infrun: stop_all_threads done
Hardware watchpoint 3: g2
Old value = 0
New value = 2
f (p1=p1@entry=1, p2=p2@entry=2) at w2.c:5
5	}
infrun: infrun_async(0)
Dump of assembler code for function f:
   0x00000000004005d0 <+0>:	adrp	x2, 0x420000 <__libc_start_main@got.plt>
   0x00000000004005d4 <+4>:	add	x2, x2, #0x30
   0x00000000004005d8 <+8>:	stp	x0, x1, [x2]
=> 0x00000000004005dc <+12>:	ret
End of assembler dump.

Attachment: w2.S
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]