From: "Richard W.M. Jones" <rjones@redhat.com>
To: Skippy VonDrake <skippyvondrake@gmail.com>,
libguestfs@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] debugging qemu-nbd.c
Date: Tue, 9 Apr 2013 15:45:55 +0100 [thread overview]
Message-ID: <20130409144554.GK1461@rhmail.home.annexia.org> (raw)
In-Reply-To: <CAAj=x+PU-f2Q0D6NJ+Rix0haeyuOFWo+cDEZzSs8KRj6kGn5iA@mail.gmail.com>
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 <rjones@redhat.com> 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#)
prev parent reply other threads:[~2013-04-09 14:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 14:18 [Qemu-devel] debugging qemu-nbd.c Skippy VonDrake
2013-04-09 14:33 ` Richard W.M. Jones
[not found] ` <CAAj=x+PU-f2Q0D6NJ+Rix0haeyuOFWo+cDEZzSs8KRj6kGn5iA@mail.gmail.com>
2013-04-09 14:45 ` Richard W.M. Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130409144554.GK1461@rhmail.home.annexia.org \
--to=rjones@redhat.com \
--cc=libguestfs@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=skippyvondrake@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).