Re: [PATCH 0/5]

2009-07-28 Thread Nathan Froyd
On Tue, Jul 28, 2009 at 04:11:57PM +0800, Liu Yu-B13201 wrote:
> > On Sat, Jul 25, 2009 at 04:40:12PM +0800, Liu Yu wrote:
> > > For example booke has a code template for
> > > jumping to and returning from interrupt handlers:
> > >
> > >   bl transfer
> > >   .long handler_addr
> > >   .long ret_addr
> > >
> > > when call transfer, it never return but
> > > in transfer assembly code it will read the handler_addr
> > > and ultimately call the handler.
> > > Gdb doesn't know that and treat it as a normal function call.
> > > so gdb put a software breakpoint instruction at handler_addr,
> > > in order to get trap there when return from transfer.
> > >
> > > Then guest will read software breakpoint as handler_addr 
> > and jump to there..
> > >
> > > I'm not sure if x86 suffer this kind of issue.
> > > Is there any way to avoid this?
> > 
> > You would need to modify GDB to recognize this sort of case with the
> > skip_trampoline_code gdbarch method.
> 
> Hmm.. I am not a gdb expert.
> But even gdb can recognize this pattern, is it safe to skip it?

The code doesn't get skipped.  skip_trampoline_code is a hook for
telling GDB "this function doesn't return in the normal way: here's
where execution will resume once this function finishes."  That way GDB
can place the software breakpoint in the correct location: in this case,
at the address handler_addr.

-Nathan
--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 0/5]

2009-07-28 Thread Liu Yu-B13201
 

> -Original Message-
> From: Nathan Froyd [mailto:froy...@codesourcery.com] 
> Sent: Monday, July 27, 2009 9:14 PM
> To: Liu Yu-B13201
> Cc: qemu-de...@nongnu.org; holl...@us.ibm.com; 
> kvm-ppc@vger.kernel.org; jan.kis...@siemens.com
> Subject: Re: [PATCH 0/5]
> 
> On Sat, Jul 25, 2009 at 04:40:12PM +0800, Liu Yu wrote:
> > For example booke has a code template for
> > jumping to and returning from interrupt handlers:
> >
> > bl transfer
> > .long handler_addr
> > .long ret_addr
> >
> > when call transfer, it never return but
> > in transfer assembly code it will read the handler_addr
> > and ultimately call the handler.
> > Gdb doesn't know that and treat it as a normal function call.
> > so gdb put a software breakpoint instruction at handler_addr,
> > in order to get trap there when return from transfer.
> >
> > Then guest will read software breakpoint as handler_addr 
> and jump to there..
> >
> > I'm not sure if x86 suffer this kind of issue.
> > Is there any way to avoid this?
> 
> You would need to modify GDB to recognize this sort of case with the
> skip_trampoline_code gdbarch method.
> 

Hmm.. I am not a gdb expert.
But even gdb can recognize this pattern, is it safe to skip it?


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html