[Crash-utility] [PATCH 10/10] teach crash to accept live:MEMORY-IMAGE[@ADDRESS]

Oleg Nesterov oleg at redhat.com
Mon Apr 25 14:49:08 UTC 2016


Now I can run qemu with the memory-backend-file option and use /usr/bin/crash
in "live" mode.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 ramdump.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ramdump.c b/ramdump.c
index e9716ae..5501752 100644
--- a/ramdump.c
+++ b/ramdump.c
@@ -242,11 +242,13 @@ int is_ramdump(char *p)
 	size_t len;
 	char *pattern;
 	struct stat64 st;
-	int is_raw = 0;
+	int is_raw = 0, is_live = 0;
 	int err = 0;
 
 	if (PREFIX(p, "raw:"))
 		is_raw = 1;
+	else if (PREFIX(p, "live:"))
+		is_raw = is_live = 1;
 
 	if (nodes || !strchr(p, '@'))
 		return 0;
@@ -290,6 +292,10 @@ int is_ramdump(char *p)
 		pc->dumpfile = "ramdump";
 		pc->readmem = read_ramdump;
 		pc->writemem = NULL;
+		if (is_live) {
+			pc->flags |= LIVE_SYSTEM;
+			pc->live_memsrc = pc->dumpfile;
+		}
 	}
 	return nodes;
 }
-- 
2.5.0




More information about the Crash-utility mailing list