* [Qemu-devel] debugging qemu-nbd.c
@ 2013-04-09 14:18 Skippy VonDrake
2013-04-09 14:33 ` Richard W.M. Jones
0 siblings, 1 reply; 3+ messages in thread
From: Skippy VonDrake @ 2013-04-09 14:18 UTC (permalink / raw)
To: qemu-devel
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.
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?
Thanks,
Skippy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] debugging qemu-nbd.c
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>
0 siblings, 1 reply; 3+ messages in thread
From: Richard W.M. Jones @ 2013-04-09 14:33 UTC (permalink / raw)
To: Skippy VonDrake, libguestfs; +Cc: qemu-devel
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'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.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] debugging qemu-nbd.c
[not found] ` <CAAj=x+PU-f2Q0D6NJ+Rix0haeyuOFWo+cDEZzSs8KRj6kGn5iA@mail.gmail.com>
@ 2013-04-09 14:45 ` Richard W.M. Jones
0 siblings, 0 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2013-04-09 14:45 UTC (permalink / raw)
To: Skippy VonDrake, libguestfs, qemu-devel
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#)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-09 14:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).