lkml.org 
[lkml]   [2008]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2.6.27-rc1 2/25] mdb: Merkey's Kernel Debugger 2.6.27-rc1
jmerkey@wolfmountaingroup.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/


\
 
 \ /
  Last update: 2008-08-04 16:15    [W:0.065 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site