From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZoG-0006Sh-Ay for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPZo8-0005eb-Ab for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:46:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPZo8-0005eR-2v for qemu-devel@nongnu.org; Tue, 09 Apr 2013 10:46:00 -0400 Date: Tue, 9 Apr 2013 15:45:55 +0100 From: "Richard W.M. Jones" Message-ID: <20130409144554.GK1461@rhmail.home.annexia.org> References: <20130409143319.GC12147@rhmail.home.annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] debugging qemu-nbd.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Skippy VonDrake , libguestfs@redhat.com, qemu-devel@nongnu.org On Tue, Apr 09, 2013 at 10:41:47AM -0400, Skippy VonDrake wrote: > On Tue, Apr 9, 2013 at 10:33 AM, Richard W.M. Jones wrote: > > On Tue, Apr 09, 2013 at 10:18:50AM -0400, Skippy VonDrake wrote: > >> Hello, > >> > >> Apologies upfront if posting to this list is inappropriate. > >> > >> I have an app that forks a process with calls qemu-nbd with an offset > >> into an image. > >> The app then uses libguestfs to attach the nbd device. > >> But it appears that qemu is failing. > > > > When you say "qemu is failing", do you mean qemu-nbd, or the qemu > > subprocess that libguestfs uses? Does it print any error? > > I believe it is the qemu subprocess that libguestfs is using. > I'm basing that assumption on the log file statements from both libguestfs > and qemu, and from stderr from libguestfs. > > The only stderr from libguestfs is "child_cleanup:... child process died" Enable debugging in libguestfs to find out what's going on: http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs > >> I'm using the latest qemu sources and placed file log statements within > >> qemu-nbd.c to pinpoint the problem. > >> > >> The statement: " if (chdir("/") < 0)" > >> appears to be the culprit. > >> > >> But the subsequent err() call is never reached. If I pull 'chdir' out of > >> the 'IF' and assign a local var to its return - execution still seems to > >> stop on the 'chdir'. So there is no opportunity to examine its return. > >> > >> What is the best approach to debugging this section of code? > > > > As a first step I would just add 'fprintf (stderr, ...)' straight into > > the qemu-nbd.c file. Or run it under gdb. > > I haven't tried this with gdb yet but the log statements I described > above were in the qemu-nbd.c file. And are successfully written > up until the chdir command. > > I'll try attaching gdb... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)