diff --git a/filesys.c b/filesys.c index 5c45a8f..80f5918 100755 --- a/filesys.c +++ b/filesys.c @@ -167,6 +167,7 @@ memory_source_init(void) return; if (!STREQ(pc->live_memsrc, "/dev/mem") && + !STREQ(pc->live_memsrc, "/dev/livedump") && STREQ(pc->live_memsrc, pc->memory_device)) { if (memory_driver_init()) return; @@ -187,6 +188,9 @@ memory_source_init(void) strerror(errno)); } else pc->flags |= MFD_RDWR; + } else if (STREQ(pc->live_memsrc, "/dev/livedump")) { + if ((pc->mfd = open("/dev/livedump", O_RDONLY)) < 0) + error(FATAL, "/dev/livedump: %s\n", strerror(errno)); } else if (STREQ(pc->live_memsrc, "/proc/kcore")) { if ((pc->mfd = open("/proc/kcore", O_RDONLY)) < 0) error(FATAL, "/proc/kcore: %s\n", diff --git a/main.c b/main.c index 5a5e19c..8628cde 100755 --- a/main.c +++ b/main.c @@ -436,6 +436,19 @@ main(int argc, char **argv) pc->writemem = write_dev_mem; pc->live_memsrc = argv[optind]; + } else if (STREQ(argv[optind], "/dev/livedump")) { + if (pc->flags & MEMORY_SOURCES) { + error(INFO, + "too many dumpfile arguments\n"); + program_usage(SHORT_FORM); + } + pc->flags |= DEVMEM; + pc->dumpfile = NULL; + pc->readmem = read_dev_mem; + pc->writemem = write_dev_mem; + pc->live_memsrc = argv[optind]; + pc->program_pid = 1; + } else if (is_proc_kcore(argv[optind], KCORE_LOCAL)) { if (pc->flags & MEMORY_SOURCES) { error(INFO,