All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	jason.wessel@windriver.com, kgdb-bugreport@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kgdbts: unify/generalize gdb breakpoint adjustment
Date: Thu, 4 Jun 2009 18:04:20 -0700	[thread overview]
Message-ID: <20090604180420.2805fcdd.akpm@linux-foundation.org> (raw)
In-Reply-To: <8bd0f97a0906041755q7588ba76l1e4e1eb8bdbe336@mail.gmail.com>

On Thu, 4 Jun 2009 20:55:40 -0400
Mike Frysinger <vapier.adi@gmail.com> wrote:

> On Thu, Jun 4, 2009 at 20:50, Andrew Morton wrote:
> > On Tue, __2 Jun 2009 03:17:30 -0400
> > Mike Frysinger <vapier@gentoo.org> wrote:
> >
> >> + __ __ instruction_pointer(&kgdbts_regs) += offset;
> >
> > instruction_pointer() cannot be used as an lvalue, thankfully.
> >
> > x86_64:
> >
> > drivers/misc/kgdbts.c: In function 'check_and_rewind_pc':
> > drivers/misc/kgdbts.c:306: error: invalid lvalue in assignment
> 
> should be easy to fix:
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -236,10 +236,7 @@
>  #endif
>  }
> 
> -static inline unsigned long instruction_pointer(struct pt_regs *regs)
> -{
> -   return regs->ip;
> -}
> +#define instruction_pointer(regs) ((regs)->ip)
> 
>  static inline unsigned long frame_pointer(struct pt_regs *regs)
>  {

argh, that's soooooo tasteless.  Look, this:

	instruction_pointer(&kgdbts_regs) += offset;

is just daft.  It's not C!  It makes no sense to define something which
looks like a function and to then assign values to it.  It means that
instruction_pointer() _must_ be implemented as a macro, violating basic
concepts of encapsualtion/layering/hiding/etc.

Doing

void instruction_pointer_set(struct pt_regs *regs, some_suitable_type val);

will save many vomit bags.

  reply	other threads:[~2009-06-05  1:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02  7:17 [PATCH] kgdbts: unify/generalize gdb breakpoint adjustment Mike Frysinger
2009-06-05  0:50 ` Andrew Morton
2009-06-05  0:55   ` Mike Frysinger
2009-06-05  1:04     ` Andrew Morton [this message]
2009-06-05  1:50       ` Mike Frysinger
2009-06-05  2:27         ` Andrew Morton
2009-06-05  4:00           ` Mike Frysinger
2009-06-05  4:13             ` Andrew Morton
2009-06-05  4:19               ` Mike Frysinger

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=20090604180420.2805fcdd.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vapier.adi@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.