On Thu, 4 Jun 2009 20:55:40 -0400
Mike Frysinger <[email protected]> wrote:

> On Thu, Jun 4, 2009 at 20:50, Andrew Morton wrote:
> > On Tue, __2 Jun 2009 03:17:30 -0400
> > Mike Frysinger <[email protected]> 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.

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to