* Is this a bug or as designed? @ 2009-02-11 11:59 Amker.Cheng 2009-02-11 12:31 ` Pierre Muller 0 siblings, 1 reply; 4+ messages in thread From: Amker.Cheng @ 2009-02-11 11:59 UTC (permalink / raw) To: gdb Hi All: I got a problem about the behavior of gdb 6.8. When remote debugging win32 inferior with gdb and gdbserver(both running on the same machine), I found that gdb always missing watchpoints. just like following outputs: ----------------start here GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 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 "i386-pc-cygwin". (gdb) file a.exe Reading symbols from /cygdrive/e/work/gdb/native-target/bin/a.exe...done. (gdb) target remote :2345 Remote debugging using :2345 [New Thread 1980] Reading symbols from /cygdrive/c/WINDOWS/system32/ntdll.dll...done. Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll Reading symbols from /cygdrive/c/WINDOWS/system32/kernel32.dll...done. Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll Reading symbols from /usr/bin/cygwin1.dll...done. Loaded symbols for /usr/bin/cygwin1.dll Reading symbols from /cygdrive/c/WINDOWS/system32/advapi32.dll...done. Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll Reading symbols from /cygdrive/c/WINDOWS/system32/rpcrt4.dll...done. Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll 0x7c921231 in ntdll!DbgUiConnectToDbg () from /cygdrive/c/WINDOWS/system32/ntdll.dll (gdb) awatch b Hardware access (read/write) watchpoint 1: b (gdb) c Continuing. Program exited normally. (gdb) q ------------------cut here According to above output, gdb just let inferior run to end normally, although it said hardware watchpoint was set successfully. I checked the remotelogfile and found there is no "Z" packets at all. Further more, I think there is something wrong when handling hardware watchpoint in gdbserver for win32, because the debug register is not set at all in gdbserver. BTW It is sure that there are access to b in the inferior program and There is no such problem with native debug with GDB under win32+cygwin. Thanks for help! Regards. ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Is this a bug or as designed? 2009-02-11 11:59 Is this a bug or as designed? Amker.Cheng @ 2009-02-11 12:31 ` Pierre Muller 2009-02-22 9:03 ` Amker.Cheng 0 siblings, 1 reply; 4+ messages in thread From: Pierre Muller @ 2009-02-11 12:31 UTC (permalink / raw) To: 'Amker.Cheng', gdb This is a limitation of windows native GDB 6.8 I wrote two patches that should solve that issue for next release if they are accepted. http://sourceware.org/ml/gdb-patches/2009-02/msg00194.html and http://sourceware.org/ml/gdb-patches/2009-02/msg00206.html If you are willing to test these out, you will need to get GDB cvs HEAD source and apply the two patches above. Pierre Muller Pascal language support maintainer for GDB > -----Message d'origine----- > De : gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la > part de Amker.Cheng > Envoyé : Wednesday, February 11, 2009 12:59 PM > À : gdb@sourceware.org > Objet : Is this a bug or as designed? > > Hi All: > I got a problem about the behavior of gdb 6.8. > When remote debugging win32 inferior with gdb and gdbserver(both > running on the same machine), > I found that gdb always missing watchpoints. just like following > outputs: > > ----------------start here > GNU gdb 6.8 > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > 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 "i386-pc-cygwin". > (gdb) file a.exe > Reading symbols from /cygdrive/e/work/gdb/native- > target/bin/a.exe...done. > (gdb) target remote :2345 > Remote debugging using :2345 > [New Thread 1980] > Reading symbols from /cygdrive/c/WINDOWS/system32/ntdll.dll...done. > Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll > Reading symbols from /cygdrive/c/WINDOWS/system32/kernel32.dll...done. > Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll > Reading symbols from /usr/bin/cygwin1.dll...done. > Loaded symbols for /usr/bin/cygwin1.dll > Reading symbols from /cygdrive/c/WINDOWS/system32/advapi32.dll...done. > Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll > Reading symbols from /cygdrive/c/WINDOWS/system32/rpcrt4.dll...done. > Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll > 0x7c921231 in ntdll!DbgUiConnectToDbg () from > /cygdrive/c/WINDOWS/system32/ntdll.dll > (gdb) awatch b > Hardware access (read/write) watchpoint 1: b > (gdb) c > Continuing. > > Program exited normally. > (gdb) q > ------------------cut here > > > > According to above output, gdb just let inferior run to end normally, > although it said > hardware watchpoint was set successfully. > > I checked the remotelogfile and found there is no "Z" packets at all. > Further more, I > think there is something wrong when handling hardware watchpoint in > gdbserver for win32, > because the debug register is not set at all in gdbserver. > > BTW It is sure that there are access to b in the inferior program and > There is no such problem with native debug with GDB under win32+cygwin. > > Thanks for help! > Regards. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Is this a bug or as designed? 2009-02-11 12:31 ` Pierre Muller @ 2009-02-22 9:03 ` Amker.Cheng 2009-02-22 10:35 ` Pierre Muller 0 siblings, 1 reply; 4+ messages in thread From: Amker.Cheng @ 2009-02-22 9:03 UTC (permalink / raw) To: gdb; +Cc: Pierre Muller Hi: Sorry being so late to reply your last message. I tried your patch(es) on weekly release gdb-weekly-CVS-6.8.50.20090210.tar.bz2 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 TARGET_CAN_USE_HARDWARE_WATCHPOINT 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) 6.8.50.20090209-cvs Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 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: <http://www.gnu.org/software/gdb/bugs/>. (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. (gdb) -----------------------------cut here There are several other macros influenced by I386_WATCHPOINTS_IN_TARGET_VECTOR too, 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. 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 Regards. On Wed, Feb 11, 2009 at 8:30 PM, Pierre Muller <muller@ics.u-strasbg.fr> wrote: > This is a limitation of windows native GDB 6.8 > I wrote two patches that should solve that issue > for next release if they are accepted. > > http://sourceware.org/ml/gdb-patches/2009-02/msg00194.html > and > http://sourceware.org/ml/gdb-patches/2009-02/msg00206.html > > If you are willing to test these out, > you will need to get GDB cvs HEAD source > and apply the two patches above. > > > Pierre Muller > Pascal language support maintainer for GDB > > > >> -----Message d'origine----- >> De : gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la >> part de Amker.Cheng >> Envoyé : Wednesday, February 11, 2009 12:59 PM >> À : gdb@sourceware.org >> Objet : Is this a bug or as designed? >> >> Hi All: >> I got a problem about the behavior of gdb 6.8. >> When remote debugging win32 inferior with gdb and gdbserver(both >> running on the same machine), >> I found that gdb always missing watchpoints. just like following >> outputs: >> >> ----------------start here >> GNU gdb 6.8 >> Copyright (C) 2008 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> >> 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 "i386-pc-cygwin". >> (gdb) file a.exe >> Reading symbols from /cygdrive/e/work/gdb/native- >> target/bin/a.exe...done. >> (gdb) target remote :2345 >> Remote debugging using :2345 >> [New Thread 1980] >> Reading symbols from /cygdrive/c/WINDOWS/system32/ntdll.dll...done. >> Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll >> Reading symbols from /cygdrive/c/WINDOWS/system32/kernel32.dll...done. >> Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll >> Reading symbols from /usr/bin/cygwin1.dll...done. >> Loaded symbols for /usr/bin/cygwin1.dll >> Reading symbols from /cygdrive/c/WINDOWS/system32/advapi32.dll...done. >> Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll >> Reading symbols from /cygdrive/c/WINDOWS/system32/rpcrt4.dll...done. >> Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll >> 0x7c921231 in ntdll!DbgUiConnectToDbg () from >> /cygdrive/c/WINDOWS/system32/ntdll.dll >> (gdb) awatch b >> Hardware access (read/write) watchpoint 1: b >> (gdb) c >> Continuing. >> >> Program exited normally. >> (gdb) q >> ------------------cut here >> >> >> >> According to above output, gdb just let inferior run to end normally, >> although it said >> hardware watchpoint was set successfully. >> >> I checked the remotelogfile and found there is no "Z" packets at all. >> Further more, I >> think there is something wrong when handling hardware watchpoint in >> gdbserver for win32, >> because the debug register is not set at all in gdbserver. >> >> BTW It is sure that there are access to b in the inferior program and >> There is no such problem with native debug with GDB under win32+cygwin. >> >> Thanks for help! >> Regards. > > ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Is this a bug or as designed? 2009-02-22 9:03 ` Amker.Cheng @ 2009-02-22 10:35 ` Pierre Muller 0 siblings, 0 replies; 4+ messages in thread From: Pierre Muller @ 2009-02-22 10:35 UTC (permalink / raw) To: 'Amker.Cheng', gdb > -----Message d'origine----- > De : Amker.Cheng [mailto:amker.cheng@gmail.com] > Envoyé : Sunday, February 22, 2009 10:03 AM > À : gdb@sourceware.org > 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- > 6.8.50.20090210.tar.bz2 > 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 > TARGET_CAN_USE_HARDWARE_WATCHPOINT > 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) 6.8.50.20090209-cvs > Copyright (C) 2009 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > 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: > <http://www.gnu.org/software/gdb/bugs/>. > (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 multi-target. 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 > I386_WATCHPOINTS_IN_TARGET_VECTOR too, > 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. http://sourceware.org/ml/gdb-patches/2009-02/msg00206.html Pierre Muller Pascal language support maintainer for GDB ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-22 10:35 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-02-11 11:59 Is this a bug or as designed? Amker.Cheng 2009-02-11 12:31 ` Pierre Muller 2009-02-22 9:03 ` Amker.Cheng 2009-02-22 10:35 ` Pierre Muller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox