This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA]: Watchpoints per thread patch


Jeff Johnston wrote:
The following patch adds needed support for the ia64 and s390 platforms. For these platforms, watchpoints need to be inserted / removed on each thread so as to work across all threads. The patch adds support for detecting this at configuration time and setting a new flag WATCHPOINTS_PER_THREAD. This flag is used when inserting/removing watchpoints and when a new thread event occurs.

This patch in itself does not give these platforms threaded watchpoint support to pass the watchthreads.exp test case, but I am breaking up my bigger patch that works for x86, x86_64, and ia64. It still fails on the S390 but gets part marks because threaded watchpoints actually trigger properly however the S390 cannot determine which watchpoint gets triggered when multiple watchpoint events occur. On ia64, the watchthreads.exp test case will fail differently than before because the low-level register and watchpoint code does not properly calculate the LWP for accessing registers so we end up eating through the maximum number of watchpoints quicker than anticipated. I have a subsequent patch for getting the LWP reliably, but this subsequent patch may be made unnecessary depending on what Daniel does with ptids and the thread-db layer. Regardless of Daniel's redesign, the watchpoints still must be inserted/removed on each thread.

The controversy here appears to be with the target dependant code being added to breakpoint.c.


For the target's that have the problem, modify target_insert_watchpoint to include the code your adding. That way, instead of:

+  /* If watchpoints do not apply to all threads automatically, we have to insert
+     and delete them for every thread.  Otherwise, we can insert or delete them
+     once from any thread.  */
+#ifdef WATCHPOINTS_PER_THREAD
+  val = thread_switch_and_call (bpt->owner->thread, &insert_one_watchpoint, &args);
+#else
+  val = insert_one_watchpoint (&args);
+#endif

the underlying target (ia64-linux-nat, ...) can locally override the method and handle the problem. The code's the same, but how it is wired up is different


Sound reasonable to all?

Andrew


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