mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: jmerkey@wolfmountaingroup.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.27-rc1 2/25] mdb:  Merkey's Kernel Debugger 2.6.27-rc1
Date: Mon, 04 Aug 2008 16:11:19 +0200	[thread overview]
Message-ID: <48970E07.60804@s5r6.in-berlin.de> (raw)
In-Reply-To: <51617.166.70.238.45.1217831286.squirrel@webmail.wolfmountaingroup.com>

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/

      reply	other threads:[~2008-08-04 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04  6:28 jmerkey
2008-08-04 14:11 ` Stefan Richter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48970E07.60804@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=jmerkey@wolfmountaingroup.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®