Is this a bug or as designed?

Pierre Muller
Sun Feb 22 10:35:00 GMT 2009

> -----Message d'origine-----
> De : Amker.Cheng []
> Envoyé : Sunday, February 22, 2009 10:03 AM
> À :
> Cc : Pierre Muller
> Objet : Re: Is this a bug or as designed?
> Hi:
> Sorry being so late to reply your last message.
> I tried your patch(es) on weekly release gdb-weekly-CVS-
> and found following problems.
> 1
> It seems macro I386_WATCHPOINTS_IN_TARGET_VECTOR was introduced into
> file nm-i386.h some time after version 6.8.
> If your patch applied, It undefines macro
> in nm-i386, which breaks gdb when debug on i386 with target exec.
> I checked sources and found that gdb won't push target win32_ops till
> the inferior's
> first running, leading to hardware watchpoint not supported at first,
> like following outputs:
> >./gdb.exe
> GNU gdb (GDB)
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show
> copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-cygwin".
> For bug reporting instructions, please see:
> <>.
> (gdb) file dummy.exe
> Reading symbols from
> /cygdrive/g/work/gdb/gdb-updated/native-target/bin/dummy.exe...done.
> (gdb) awatch a
> Target does not support this type of hardware watchpoint.

  I am afraid that this is a natural drawback of the idea of
  As the target is not yet defined,
you could use 'target remote ...'
later that could not support this feature.

The answer from gdb saying that it does not support
hardware watchpoint at that point is thus logical.

> (gdb)
> -----------------------------cut here
> There are several other macros influenced by
> But I think at least TARGET_CAN_USE_HARDWARE_WATCHPOINT should be moved
> out of
> the #ifndef I386_WATCHPOINTS_IN_TARGET_VECTOR ... #endif context.
> I'm afraid this problem also exist under linux now.

  You are right that older vdersions of gdb on linux
(I checked 6.4 that was installed on a linux machine
on which I have an acoount) did allow
the 'awatch' command before starting the debuggee,
while current CVS HEAD does not.

> 2
> as why hardware watchpoint not working in windows gdbserver,
> It is because windows gdbserver does not implement the "Z" packets
> right now.
> So it still unavailable after applying your patch.
> I guess maybe the reason is no one will debug win32/linux applications
> remotely.
> Anyway I found it's quite easy to support "Z" packets for windows
> gdbserver
> just by reusing following functions in file i386-nat.c:
>   i386_insert_watchpoint,
>   i386_remove_watchpoint,
>   i386_stopped_by_watchpoint,
>   i386_stopped_data_address,
> Thanks

  I already submitted a patch that does exactly this.

Pierre Muller
Pascal language support maintainer for GDB

More information about the Gdb mailing list