This is the mail archive of the gdb-patches@sourceware.org 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] gdb/win32-nat.c: do not call CloseHandle on process and thread handles


On Thu, Nov 22, 2007 at 02:37:26PM +0000, Pedro Alves wrote:
>Don't know, you'll have to check, but I doubt it.  It just might be
>easier to always open a handle to the process (OpenProcess), and not
>touch the one coming on the event.  Then you would always close the
>process handle, because you know you're the one who opened it.  OTTOMH,
>gdbserver does something similar, but leaks.  This uses an extra handle
>on the normal case, but I don't think I'd care, as long as there are no
>leaks.  Otherwise, you'll just have to keep a flag somewhere.

Are you sure that it's always possible for the debugger to open a handle
to the process?  It is a given that there will always be a handle
available via the debugging interface but I don't know that it is a
given that a nonprivileged process would necessarily be able to open a
handle to a privileged process.  I think I'd prefer a flag.

And, it should be easy to create a program which has no main thread.
Just write a program which has two threads, exit the main thread and
attach to the program.

cgf


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