[win32] Fix suspend count handling

Pierre Muller muller@ics.u-strasbg.fr
Wed Nov 21 15:32:00 GMT 2007



> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Pedro Alves
> Sent: Wednesday, November 21, 2007 4:08 PM
> To: Pierre Muller
> Cc: gdb-patches@sourceware.org
> Subject: Re: [win32] Fix suspend count handling
> 
> On Nov 21, 2007 2:13 PM, Pierre Muller wrote:
> 
> >   Your patch does indeed correct this to 3, which is what is wanted.
> > But if you use 'continue' instead of 'next' when you are at line
> > 37, you will get '4' printed out instead of three, because
> > the main thread will have call SuspendThread before gdb does.
> > This is at least what happens on my computer.
> >
> 
> Are you sure this was from a gdb with this patch installed?  I get 4
> without the patch, but with this patch (*without* the other
> watchpoint patch on top) I still get 3 no matter how I try it:
> 
> $ gdb/gdb.exe main.exe
> GNU gdb 6.7.50.20071121
> Copyright (C) 2007 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"...
> (gdb) b 37
> Breakpoint 1 at 0x40119a: file main.c, line 37.
> (gdb) r
> Starting program: /d/gdb/build/main.exe
> 
> Breakpoint 1, main (argc=1, argv=0x6b3270) at main.c:37
> 37        suspend_count = ResumeThread (h); /* set breakpoint here */
> (gdb) c
> Continuing.
> 3
  You need to switch to the thread that is suspended to get '4' as a result,
otherwise you get '3'.

> Program exited normally.
> (gdb)
> 
> >
> >   OK, in that case it is indeed correct to do all the ResumeThread
> calls
> > before ContinueDebugEvent is called, and thus the suspend_count can
> be
> > replaced
> > by suspended Boolean value.
> 
> Not a boolean, its a three state -- suspend_count also accepted -1, and
> I've
> kept that.
> 
> >   But only the combination of the two patches will ensure to
> > always obtain '3' using 'continue' or 'next'.
> 
> That's not what I see here.  Can you show me a run where you get 4
> only this patch applied?
Just add a 'thread 3' after the breakpoint is trigged and 'continue'.

Pierre





More information about the Gdb-patches mailing list