delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/08/11:51:09

Date: Sun, 8 Aug 1999 14:42:44 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
cc: Robert Hoehne <robert DOT hoehne AT gmx DOT net>,
Pierre Muller <muller AT cerbere DOT u-strasbg DOT fr>
Subject: Watching larger regions in GDB
Message-ID: <Pine.SUN.3.91.990808144021.23423q-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

GDB's go32-nat.c can insert non-aligned watchpoints, but
go32_remove_watchpoint only seems to handle aligned watchpoints.  Why
is that?

Also, go32_insert_watchpoint is able to handle data types longer than
4 bytes (by setting several debug registers to watch consecutive
addresses), but we still use the default definition of the macro
TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (on target.h) that effectively
limits us to 4-byte data only, see can_use_hardware_watchpoint on
breakpoint.c for how it works.  This means that if you try to watch,
say, a double, you cannot use hardware watchpoints, so the program
will run several orders of magnitude slower.  (Well, there is a
work-around of watching *(int *)foo instead, but that defeats some of
the smart features in GDB.)

I think we need to define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT
something like this:

#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(v) \
  (TYPE_LENGTH (VALUE_TYPE (v)) <= 16 \
   - (((v)->location.address + (v)->offset) & 3) \
   - 4*((((v)->location.address + (v)->offset) & 3) == 1))

(In practice, it's better to rewrite the above so as to avoid
side-effects of multiple evaluation of the argument, e.g. by using the
GCC extension that allows compound statements inside parentheses.)

If we enable this feature, we will also need to extend
go32_remove_watchpoint to handle watchpoints that span several debug
registers, but that's pretty easy to do, given the model used by
go32_insert_aligned_watchpoint.

Comments?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019