From 8c1e25f7f8384f40ec4a24ad67f7e279f32f8b35 Mon Sep 17 00:00:00 2001 From: Zhou Wenjian Date: Wed, 10 Dec 2014 09:39:17 +0800 Subject: [PATCH 5/5] Make qemu32 note human readable --- netdump.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/netdump.c b/netdump.c index ac15125..4c720f6 100644 --- a/netdump.c +++ b/netdump.c @@ -2263,6 +2263,13 @@ dump_Elf64_Nhdr(Elf64_Off offset, int store) } if (BITS32() && (xen_core || (note->n_type == NT_PRSTATUS))) { + if (!xen_core && nd->ofp) { + char *l_buf = (char *)malloc(2 * BUFSIZE); + display_note_elf64(note, l_buf); + fprintf(fp, l_buf); + free(l_buf); + } + iptr = (int *)uptr; for (i = lf = 0; i < note->n_descsz/sizeof(ulong); i++) { if (((i%4)==0)) { @@ -2772,6 +2779,19 @@ display_qemu_elf64(void *note_ptr, char *buf) } void +display_qemu_elf32(void *note_ptr, char *buf) +{ + Elf32_Nhdr *note; + QEMUCPUState *ptr; + + note = (Elf32_Nhdr *)note_ptr; + ptr = (QEMUCPUState *)( + (char *)note + sizeof(Elf32_Nhdr) + note->n_namesz); + + display_qemu_elf(ptr, buf, KDUMP_ELF32); +} + +void display_note(void *note_ptr, char *buf, int descsz) { if (descsz == (2 * sizeof(struct x86_64_prstatus))) @@ -2780,6 +2800,8 @@ display_note(void *note_ptr, char *buf, int descsz) display_prstatus_elf32(note_ptr, buf); else if (descsz == (2 * sizeof(QEMUCPUState))) display_qemu_elf64(note_ptr, buf); + else if (descsz == sizeof(QEMUCPUState)) + display_qemu_elf32(note_ptr, buf); } void -- 1.7.1