From 99b9a5f5e0668f2f66698481d9ad23da7159287c Mon Sep 17 00:00:00 2001 From: Zhou Wenjian Date: Thu, 11 Dec 2014 11:14:47 +0800 Subject: [PATCH 3/5] Show kdump note information when help -D --- diskdump.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/diskdump.c b/diskdump.c index 3d33fdc..e5053f5 100644 --- a/diskdump.c +++ b/diskdump.c @@ -83,6 +83,9 @@ static char *vmcoreinfo_read_string(const char *); static void diskdump_get_osrelease(void); static int valid_note_address(unsigned char *); +void display_note_elf64(void *note_ptr, char *buf); +void display_note_elf32(void *note_ptr, char *buf); + /* For split dumpfile */ static struct diskdump_data **dd_list = NULL; static int num_dd = 0; @@ -1736,10 +1739,20 @@ __diskdump_memory_dump(FILE *fp) dd->num_prstatus_notes); fprintf(fp, " notes_buf: %lx\n", (ulong)dd->notes_buf); + + char *l_buf = (char *)malloc(2 * BUFSIZE); for (i = 0; i < dd->num_prstatus_notes; i++) { fprintf(fp, " notes[%d]: %lx\n", i, (ulong)dd->nt_prstatus_percpu[i]); + + if (dd->machine_type == EM_386) + display_note_elf32(dd->nt_prstatus_percpu[i],l_buf); + else if (dd->machine_type == EM_X86_64) + display_note_elf64(dd->nt_prstatus_percpu[i],l_buf); + fprintf(fp, "%s", l_buf); + memset(l_buf, 0, 2 * BUFSIZE); } + free(l_buf); dump_nt_prstatus_offset(fp); } if (dh->header_version >= 5) { -- 1.7.1