From 28d4ab53280853d2aeefdfb7c369331e89ab9ac2 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Thu, 8 Mar 2012 14:39:38 +0800 Subject: Add generic debug option Currently the debugging code is under #ifdef DEBUG, which means when we want to debug, we have to re-compile the source code with -DDEBUG. This is not convenient, we want to have a generic --debug option so that we can enable debugging code without re-compiling. This patch moves the arch-specific --debug to generic place and moves code under #ifdef DEBUG to --debug on x86. BTW, the size of kexec binary increases very little after this patch. Signed-off-by: Cong Wang Signed-off-by: Simon Horman --- kexec/kexec.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'kexec/kexec.c') diff --git a/kexec/kexec.c b/kexec/kexec.c index 89e725e..19133fa 100644 --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -50,6 +50,7 @@ unsigned long long mem_min = 0; unsigned long long mem_max = ULONG_MAX; static unsigned long kexec_flags = 0; +int kexec_debug = 0; void die(char *fmt, ...) { @@ -893,6 +894,7 @@ void usage(void) " context of current kernel during kexec.\n" " --load-jump-back-helper Load a helper image to jump back\n" " to original kernel.\n" + " -d, --debug Enable debugging to help spot a failure.\n" "\n" "Supported kernel file types and options: \n"); for (i = 0; i < file_types; i++) { @@ -1066,6 +1068,8 @@ int main(int argc, char *argv[]) case OPT_VERSION: version(); return 0; + case OPT_DEBUG: + kexec_debug = 1; case OPT_NOIFDOWN: do_ifdown = 0; break; -- cgit