Hi Dave, Based on your comments, please see the interdiff below. Changes: - s/LIVEDUMP/LIVE_RAMDUMP/ - redefine LOCAL_ACTIVE() using LIVE_RAMDUMP - change pc->dumpfile to be the name of the first ramdump file - remove the stale label in ramdump_to_elf() Oleg. --- diff --git a/defs.h b/defs.h index d3a03c1..61497a5 100644 --- a/defs.h +++ b/defs.h @@ -212,7 +212,7 @@ struct number_option { #define DEVMEM (0x2000000ULL) #define REM_LIVE_SYSTEM (0x4000000ULL) #define NAMELIST_LOCAL (0x8000000ULL) -#define LIVEDUMP (0x10000000ULL) +#define LIVE_RAMDUMP (0x10000000ULL) #define NAMELIST_SAVED (0x20000000ULL) #define DUMPFILE_SAVED (0x40000000ULL) #define UNLINK_NAMELIST (0x80000000ULL) @@ -251,11 +251,11 @@ struct number_option { #define PROC_KCORE (0x8000000000000000ULL) #define ACTIVE() (pc->flags & LIVE_SYSTEM) -#define LOCAL_ACTIVE() ((pc->flags & LIVE_SYSTEM) && (pc->flags2 & MEMSRC_LOCAL)) +#define LOCAL_ACTIVE() ((pc->flags & (LIVE_SYSTEM|LIVE_RAMDUMP)) == LIVE_SYSTEM) #define DUMPFILE() (!(pc->flags & LIVE_SYSTEM)) #define LIVE() (pc->flags2 & LIVE_DUMP || pc->flags & LIVE_SYSTEM) -#define MEMORY_SOURCES (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP|VMWARE_VMSS|LIVEDUMP) -#define DUMPFILE_TYPES (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP|VMWARE_VMSS|LIVEDUMP) +#define MEMORY_SOURCES (NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP|VMWARE_VMSS|LIVE_RAMDUMP) +#define DUMPFILE_TYPES (DISKDUMP|NETDUMP|KDUMP|MCLXCD|LKCD|S390D|XENDUMP|KVMDUMP|SADUMP|VMWARE_VMSS|LIVE_RAMDUMP) #define REMOTE() (pc->flags2 & REMOTE_DAEMON) #define REMOTE_ACTIVE() (pc->flags & REM_LIVE_SYSTEM) #define REMOTE_DUMPFILE() \ diff --git a/filesys.c b/filesys.c index 2779b2f..c291298 100644 --- a/filesys.c +++ b/filesys.c @@ -124,7 +124,6 @@ fd_init(void) if (!pc->dumpfile) { pc->flags |= LIVE_SYSTEM; - pc->flags2 |= MEMSRC_LOCAL; get_live_memory_source(); } @@ -209,8 +208,7 @@ memory_source_init(void) } if (pc->dumpfile) { - if (!(pc->flags & LIVEDUMP) && - !file_exists(pc->dumpfile, NULL)) + if (!file_exists(pc->dumpfile, NULL)) error(FATAL, "%s: %s\n", pc->dumpfile, strerror(ENOENT)); diff --git a/main.c b/main.c index 0fbd10a..075a1e8 100644 --- a/main.c +++ b/main.c @@ -430,9 +430,7 @@ main(int argc, char **argv) } if (ACTIVE()) { - pc->flags |= LIVEDUMP; - /* disable get_live_memory_source() logic in fd_init() */ - pc->dumpfile = "livedump"; + pc->flags |= LIVE_RAMDUMP; pc->readmem = read_ramdump; pc->writemem = NULL; optind++; diff --git a/memory.c b/memory.c index 3339aa2..aa8be87 100644 --- a/memory.c +++ b/memory.c @@ -16463,7 +16463,7 @@ memory_page_size(void) case CRASHBUILTIN: case KVMDUMP: case PROC_KCORE: - case LIVEDUMP: + case LIVE_RAMDUMP: psz = (uint)getpagesize(); break; diff --git a/ramdump.c b/ramdump.c index 12bfe05..941851c 100644 --- a/ramdump.c +++ b/ramdump.c @@ -227,7 +227,7 @@ char *ramdump_to_elf(void) } e_file = write_elf(load, e_head, data_offset); -end: + free(e_head); return e_file; } @@ -242,7 +242,7 @@ int is_ramdump(char *p) size_t len; char *pattern; struct stat64 st; - int is_live = 0; + int is_live; int err = 0; is_live = PREFIX(p, "live:"); @@ -283,9 +283,11 @@ int is_ramdump(char *p) pat = NULL; } - if (nodes && is_live) + if (nodes && is_live) { pc->flags |= LIVE_SYSTEM; - + pc->dumpfile = ramdump[0].path; + pc->live_memsrc = pc->dumpfile; + } return nodes; } -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility