[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48970E07.60804@s5r6.in-berlin.de>
Date: Mon, 04 Aug 2008 16:11:19 +0200
From: Stefan Richter <stefanr@...6.in-berlin.de>
To: jmerkey@...fmountaingroup.com
CC: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2.6.27-rc1 2/25] mdb: Merkey's Kernel Debugger 2.6.27-rc1
jmerkey@...fmountaingroup.com wrote:
> Netware style debugger for Linux written by Jeffrey Vernon Merkey
>
> --- a/arch/x86/kernel/traps_32.c 2008-08-03 16:09:54.000000000 -0600
> +++ b/arch/x86/kernel/traps_32.c 2008-08-03 17:33:06.000000000 -0600
...
> @@ -865,6 +896,16 @@
> }
> #endif
>
> +#if defined(CONFIG_MDB) && !defined(CONFIG_KPROBES)
> +fastcall void do_int3(struct pt_regs * regs, long error_code)
> +{
> +#ifdef CONFIG_MDB
> + if (mdb(BREAKPOINT_EXCEPTION, error_code, regs))
> + return;
> +#endif
> + do_trap(3, SIGTRAP, "int3", 1, regs, error_code, NULL);
> +}
> +#endif /* CONFIG_KDB && !CONFIG_KPROBES */
The inner #ifdef is always true.
> /*
> * Our handling of the processor debug registers is non-trivial.
> * We do not clear them on entry and exit from the kernel. Therefore
> @@ -895,6 +936,10 @@
> trace_hardirqs_fixup();
>
> get_debugreg(condition, 6);
> +#ifdef CONFIG_MDB
> + if (mdb(DEBUGGER_EXCEPTION, error_code, regs))
> + return;
> +#endif
>
> /*
> * The processor cleared BTF, so don't mark that we need it set.
I wonder if it would be beneficial to
- include an mdb header file in source files like this one,
- in the mdb header, define mdb() as a static inline function which
does nothing but return false if CONFIG_MDB is not defined.
Would get rid of the visual clutter introduced by #ifdef/#endif and
catch potential syntax errors when people later modify this code. I
assume that a compiler is used which eliminates code properly when mdb()
is nothing but constant false...
--
Stefan Richter
-=====-==--- =--- --=--
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists