Bug 1555253 - Request for improving error infos when users wrongly use "/usr/share/qemu-kvm/dump-guest-memory.py"
Summary: Request for improving error infos when users wrongly use "/usr/share/qemu-kv...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Marc-Andre Lureau
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-14 10:12 UTC by Pei Zhang
Modified: 2018-11-01 11:06 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-01 11:06:51 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Pei Zhang 2018-03-14 10:12:14 UTC
Description of problem:
When source dump-guest-memory.py, it fails and gdb prompt errors like below:

(gdb) source /usr/share/qemu-kvm/dump-guest-memory.py
Traceback (most recent call last):
  File "/usr/share/qemu-kvm/dump-guest-memory.py", line 19, in <module>
    UINTPTR_T = gdb.lookup_type("uintptr_t")
gdb.error: No type named uintptr_t.


Version-Release number of selected component (if applicable):
3.10.0-860.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7.x86_64
gdb-7.6.1-110.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. 
# gdb
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) source /usr/share/qemu-kvm/dump-guest-memory.py
Traceback (most recent call last):
  File "/usr/share/qemu-kvm/dump-guest-memory.py", line 19, in <module>
    UINTPTR_T = gdb.lookup_type("uintptr_t")
gdb.error: No type named uintptr_t.
(gdb) 


Actual results:
Source dump-guest-memory.py in gdb fail.

Expected results:
Source dump-guest-memory.py in gdb should work.

Additional info:
1. This should be a debug tool to users. So set a low priority. 

2. I am not sure if it's gdb bug or qemu bug. Please help to change the component if any wrong. Thanks.

Comment 2 Andrew Jones 2018-03-14 14:11:57 UTC
The QEMU program symbols need to be loaded prior to sourcing the script, i.e. either launch with the program name on the command line or call 'load <program name>' first, or 'attach' to a process id (either from the command line or with 'attach').

While this bug is technically user error, this isn't the first report of this issue, so we should probably improve the error message to avoid future reports. I've written a patch which I'll post upstream now.

I'm not sure what to do with this bug. If we want to protect against user error then I guess we can keep it and target it for 7.6, otherwise we can just close it as not-a-bug.

Comment 5 Pei Zhang 2018-03-15 06:38:12 UTC
(In reply to Andrew Jones from comment #2)
> The QEMU program symbols need to be loaded prior to sourcing the script,
> i.e. either launch with the program name on the command line or call 'load
> <program name>' first, or 'attach' to a process id (either from the command
> line or with 'attach').

I was using wrong steps to try to dump memory, after launch gdb with qemu, then it works as expected. 

> 
> While this bug is technically user error, this isn't the first report of
> this issue, so we should probably improve the error message to avoid future
> reports. I've written a patch which I'll post upstream now.

Sorry this was my first time to use dump-guest-memory.py, when this error shows it looks like version incompatible, that's why I report it.

> 
> I'm not sure what to do with this bug. If we want to protect against user
> error then I guess we can keep it and target it for 7.6, otherwise we can
> just close it as not-a-bug.

So this is not a bug. However I prefer to improving the error message like you mentioned above, which can help users to be more clear about this issue.

I'll change the bug title accordingly, however please feel free to close it as 'not-a-bug'. Both solutions are ok for me. 


Thanks,
Pei

Comment 7 Ademar Reis 2018-03-22 19:47:19 UTC
Low priority but probably worth fixing. We'll get it in our downstream packages via rebase.

Comment 8 Marc-Andre Lureau 2018-03-23 10:50:08 UTC
upstream commit 4b17bc933fc26f7a4a306a43597f4d97e3c2dc38 (tag: dump-pull-request, github/dump, dump)
Author: Andrew Jones <drjones@redhat.com>
Date:   Wed Mar 14 16:38:20 2018 +0100

    dump-guest-memory: more descriptive lookup_type failure
    
    We've seen a few reports of
    
     (gdb) source /usr/share/qemu-kvm/dump-guest-memory.py
     Traceback (most recent call last):
       File "/usr/share/qemu-kvm/dump-guest-memory.py", line 19, in <module>
         UINTPTR_T = gdb.lookup_type("uintptr_t")
     gdb.error: No type named uintptr_t.
    
    This occurs when symbols haven't been loaded first, i.e. neither a
    QEMU binary was loaded nor a QEMU process was attached first. Let's
    better inform the user of how to fix the issue themselves in order
    to avoid more reports.
    
    Acked-by: Janosch Frank <frankja@linux.vnet.ibm.com>
    Signed-off-by: Andrew Jones <drjones@redhat.com>
    Message-Id: <20180314153820.18426-1-drjones@redhat.com>
    Reviewed-by: Fam Zheng <famz@redhat.com>
    Tested-by: Fam Zheng <famz@redhat.com>
    Reviewed-by: Laszlo Ersek <lersek@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Are we going to rebase qemu to 2.12 in 7.6 ? If not, I am not sure it's worth the backport. Let me know

Comment 11 cliao 2018-05-07 03:24:55 UTC
There is no error.
 
The results are shown below:
gdb
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) source /usr/share/qemu-kvm/dump-guest-memory.py
Traceback (most recent call last):
  File "/usr/share/qemu-kvm/dump-guest-memory.py", line 22, in <module>
    raise gdb.GdbError("Symbols must be loaded prior to sourcing dump-guest-memory.\n"
gdb.GdbError: Symbols must be loaded prior to sourcing dump-guest-memory.
Symbols may be loaded by 'attach'ing a QEMU process id or by 'load'ing a QEMU binary.
(gdb)

Comment 14 errata-xmlrpc 2018-11-01 11:06:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3443


Note You need to log in before you can comment on or make changes to this bug.