diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-03-22 13:15:52 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-03-22 13:15:52 +0000 |
commit | 99728ba3ec9b8795ff7191ea75a2a8c0329c29a5 (patch) | |
tree | fe64d29fb86b50ba92001990609b5d803d71d2f8 | |
parent | b2ce07de4e0fdc6119f7f59c13c4db7534a7920b (diff) | |
parent | 4b17bc933fc26f7a4a306a43597f4d97e3c2dc38 (diff) | |
download | qemu-99728ba3ec9b8795ff7191ea75a2a8c0329c29a5.zip qemu-99728ba3ec9b8795ff7191ea75a2a8c0329c29a5.tar.gz qemu-99728ba3ec9b8795ff7191ea75a2a8c0329c29a5.tar.bz2 |
Merge remote-tracking branch 'remotes/elmarco/tags/dump-pull-request' into staging
Pull request
# gpg: Signature made Wed 21 Mar 2018 14:37:05 GMT
# gpg: using RSA key DAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>"
# gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>"
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5
* remotes/elmarco/tags/dump-pull-request:
dump-guest-memory: more descriptive lookup_type failure
dump.c: allow fd_write_vmcore to return errno on failure
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | dump.c | 23 | ||||
-rw-r--r-- | scripts/dump-guest-memory.py | 7 |
2 files changed, 20 insertions, 10 deletions
@@ -107,7 +107,7 @@ static int fd_write_vmcore(const void *buf, size_t size, void *opaque) written_size = qemu_write_full(s->fd, buf, size); if (written_size != size) { - return -1; + return -errno; } return 0; @@ -140,7 +140,7 @@ static void write_elf64_header(DumpState *s, Error **errp) ret = fd_write_vmcore(&elf_header, sizeof(elf_header), s); if (ret < 0) { - error_setg(errp, "dump: failed to write elf header"); + error_setg_errno(errp, -ret, "dump: failed to write elf header"); } } @@ -171,7 +171,7 @@ static void write_elf32_header(DumpState *s, Error **errp) ret = fd_write_vmcore(&elf_header, sizeof(elf_header), s); if (ret < 0) { - error_setg(errp, "dump: failed to write elf header"); + error_setg_errno(errp, -ret, "dump: failed to write elf header"); } } @@ -194,7 +194,8 @@ static void write_elf64_load(DumpState *s, MemoryMapping *memory_mapping, ret = fd_write_vmcore(&phdr, sizeof(Elf64_Phdr), s); if (ret < 0) { - error_setg(errp, "dump: failed to write program header table"); + error_setg_errno(errp, -ret, + "dump: failed to write program header table"); } } @@ -217,7 +218,8 @@ static void write_elf32_load(DumpState *s, MemoryMapping *memory_mapping, ret = fd_write_vmcore(&phdr, sizeof(Elf32_Phdr), s); if (ret < 0) { - error_setg(errp, "dump: failed to write program header table"); + error_setg_errno(errp, -ret, + "dump: failed to write program header table"); } } @@ -237,7 +239,8 @@ static void write_elf64_note(DumpState *s, Error **errp) ret = fd_write_vmcore(&phdr, sizeof(Elf64_Phdr), s); if (ret < 0) { - error_setg(errp, "dump: failed to write program header table"); + error_setg_errno(errp, -ret, + "dump: failed to write program header table"); } } @@ -302,7 +305,8 @@ static void write_elf32_note(DumpState *s, Error **errp) ret = fd_write_vmcore(&phdr, sizeof(Elf32_Phdr), s); if (ret < 0) { - error_setg(errp, "dump: failed to write program header table"); + error_setg_errno(errp, -ret, + "dump: failed to write program header table"); } } @@ -355,7 +359,8 @@ static void write_elf_section(DumpState *s, int type, Error **errp) ret = fd_write_vmcore(&shdr, shdr_size, s); if (ret < 0) { - error_setg(errp, "dump: failed to write section header table"); + error_setg_errno(errp, -ret, + "dump: failed to write section header table"); } } @@ -365,7 +370,7 @@ static void write_data(DumpState *s, void *buf, int length, Error **errp) ret = fd_write_vmcore(buf, length, s); if (ret < 0) { - error_setg(errp, "dump: failed to save memory"); + error_setg_errno(errp, -ret, "dump: failed to save memory"); } else { s->written_size += length; } diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py index 51acfcd..276eebf 100644 --- a/scripts/dump-guest-memory.py +++ b/scripts/dump-guest-memory.py @@ -16,7 +16,12 @@ the COPYING file in the top-level directory. import ctypes import struct -UINTPTR_T = gdb.lookup_type("uintptr_t") +try: + UINTPTR_T = gdb.lookup_type("uintptr_t") +except Exception as inst: + raise gdb.GdbError("Symbols must be loaded prior to sourcing dump-guest-memory.\n" + "Symbols may be loaded by 'attach'ing a QEMU process id or by " + "'load'ing a QEMU binary.") TARGET_PAGE_SIZE = 0x1000 TARGET_PAGE_MASK = 0xFFFFFFFFFFFFF000 |