This is the mail archive of the 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: [PATCH] PR threads/10729: x86 hw watchpoints and non-stop mode

> From: Pedro Alves <>
> Date: Mon, 5 Dec 2011 16:01:59 +0000
> On native x86 targets, the desired state of hardware watchpoints is
> kept on a local mirror of the inferior's debug registers, and copied
> to each thread whenever the mirror changes.  If any of the threads
> being copied to are currently running, the copying fails with an ugly
> error.
> GDBserver solves this by instead only updating the threads' debug
> registers prior to resume, and, when the local mirror changes, forcing
> a temporary and transparent stop on running threads, so they can
> update the debug registers when re-resumed.  When deciding whether an
> LWP stopped due to a hardware watchpoint or breakpoint, the current
> state of the debug registers in the stopping thread is read, rather
> than trusting the mirror still mirrors what was last copied to the
> thread.
> This patch matches teaches linux-nat.c to do the same as
> GDBserver.
> I suspect this change gets rid of a couple of workarounds we had in
> place (e.g., i386_stopped_data_address), so I removed them --
> GDBserver didn't have them.  No regressions popped up.

Be sure to test it with several watchpoints watching the same address,
either with different conditions or different types (rwatch vs awatch
vs watch), and also with watchpoints that watch regions longer than 4
bytes on IA32 (and similarly on 64-bit hosts).

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