qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: mst@redhat.com, Eduardo Habkost <ehabkost@redhat.com>,
	Cleber Rosa <crosa@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] dump-guest-memory.py: fix "You can't do that without a process to debug"
Date: Tue, 12 Dec 2017 18:32:30 +0100	[thread overview]
Message-ID: <91c30ae2-e391-a4bc-a17b-86f574939b51@redhat.com> (raw)
In-Reply-To: <20171212172208.13588-1-marcandre.lureau@redhat.com>

On 12/12/17 18:22, Marc-André Lureau wrote:
> If the script is run with a core (no running process), it produces an
> error:
> 
> (gdb)  dump-guest-memory /tmp/vmcore X86_64
> guest RAM blocks:
> target_start     target_end       host_addr        message count
> ---------------- ---------------- ---------------- ------- -----
> 0000000000000000 00000000000a0000 00007f7935800000 added       1
> 00000000000a0000 00000000000b0000 00007f7934200000 added       2
> 00000000000c0000 00000000000ca000 00007f79358c0000 added       3
> 00000000000ca000 00000000000cd000 00007f79358ca000 joined      3
> 00000000000cd000 00000000000e8000 00007f79358cd000 joined      3
> 00000000000e8000 00000000000f0000 00007f79358e8000 joined      3
> 00000000000f0000 0000000000100000 00007f79358f0000 joined      3
> 0000000000100000 0000000080000000 00007f7935900000 joined      3
> 00000000fd000000 00000000fe000000 00007f7934200000 added       4
> 00000000fffc0000 0000000100000000 00007f7935600000 added       5
> Python Exception <class 'gdb.error'> You can't do that without a process to debug.:
> Error occurred in Python command: You can't do that without a process
> to debug.
> 
> Replace the object_resolve_path_type() function call call with a
> local volatile variable.

Patch looks great and the above is fine with me too -- I just note we
have "call call", which could be improved. But, I don't insist.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo

> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> 
> v2:
>  - use a vmcoreinfo_realize() local volatile variable
>  - tweak commit message
> 
> scripts/dump-guest-memory.py | 3 +--
>  hw/misc/vmcoreinfo.c         | 3 +++
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py
> index 1af26c1a45..09bec92b50 100644
> --- a/scripts/dump-guest-memory.py
> +++ b/scripts/dump-guest-memory.py
> @@ -546,8 +546,7 @@ shape and this command should mostly work."""
>          return None
>  
>      def add_vmcoreinfo(self):
> -        vmci = '(VMCoreInfoState *)' + \
> -               'object_resolve_path_type("", "vmcoreinfo", 0)'
> +        vmci = 'vmcoreinfo_realize::vmcoreinfo_state'
>          if not gdb.parse_and_eval("%s" % vmci) \
>             or not gdb.parse_and_eval("(%s)->has_vmcoreinfo" % vmci):
>              return
> diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c
> index 31db57ab44..a2805527cb 100644
> --- a/hw/misc/vmcoreinfo.c
> +++ b/hw/misc/vmcoreinfo.c
> @@ -35,6 +35,8 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
>  {
>      VMCoreInfoState *s = VMCOREINFO(dev);
>      FWCfgState *fw_cfg = fw_cfg_find();
> +    /* for gdb script dump-guest-memory.py */
> +    static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED;
>  
>      /* Given that this function is executing, there is at least one VMCOREINFO
>       * device. Check if there are several.
> @@ -56,6 +58,7 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp)
>                               &s->vmcoreinfo, sizeof(s->vmcoreinfo), false);
>  
>      qemu_register_reset(vmcoreinfo_reset, dev);
> +    vmcoreinfo_state = s;
>  }
>  
>  static const VMStateDescription vmstate_vmcoreinfo = {
> 

      parent reply	other threads:[~2017-12-12 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 17:22 [Qemu-devel] [PATCH v2] dump-guest-memory.py: fix "You can't do that without a process to debug" Marc-André Lureau
2017-12-12 17:26 ` no-reply
2017-12-12 17:30   ` Laszlo Ersek
2017-12-15  8:13     ` Fam Zheng
2017-12-12 17:32 ` Laszlo Ersek [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=91c30ae2-e391-a4bc-a17b-86f574939b51@redhat.com \
    --to=lersek@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).