From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19548 invoked by alias); 1 Oct 2008 18:10:06 -0000 Received: (qmail 19536 invoked by uid 22791); 1 Oct 2008 18:10:05 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Oct 2008 18:09:28 +0000 Received: (qmail 28378 invoked from network); 1 Oct 2008 18:09:26 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Oct 2008 18:09:26 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFC] fix win32-nat failure Date: Wed, 01 Oct 2008 18:10:00 -0000 User-Agent: KMail/1.9.9 Cc: "Pierre Muller" References: <005401c923c0$be5ae250$3b10a6f0$@u-strasbg.fr> In-Reply-To: <005401c923c0$be5ae250$3b10a6f0$@u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810011909.10343.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00027.txt.bz2 On Wednesday 01 October 2008 13:25:08, Pierre Muller wrote: > Current GDB head has a problem with win32-nat: > > When starting ./gdb ./gdb > (gdb) run > Starting program: /usr/local/src/gdbcvs/build-bare/gdb/gdb.exe ./gdb > ../../purecvs/gdb/inferior.c:41: internal-error: current_inferior: Assertion > `inf' failed. Ah, I know why I didn't see this happening. When running GDB under GDB itself, GDB considers that it doesn't have a terminal at all, so this code path isn't exercised. Maybe this applies to the testsuite as well. :-/ > I was able to fix this by setting inferior_ptid before terminal_inferior was > called, > but I did this using also the ThreadId available when starting with > CreateProcess. > But there is no thread number available for processes to which we attach, > thus I simply passed zero in that case... > I don't know, maybe the correct fix is to only set inferior_ptid > to ptid_build(pid, 0, 0) Yes, you don't need the tid at this point even when creating instead of attaching. A smaller change would be something like this: + inferior_ptid = pid_to_ptid (pid); terminal_init_inferior_with_pgrp (pid); Perhaps also adding a comment saying something like: /* Make the new process the current inferior, so terminal handling can rely on it. When attaching, we don't know about any thread id here, but that's OK --- nothing should be referencing the current thread until we report an event out of win32_wait. */ Do you want to give it a try and confirm on your end? -- Pedro Alves