Re: [rfa/arm] Handle bx and blx

Richard Earnshaw
2004-03-08T10:18:29Z

> On Wed, Mar 03, 2004 at 04:01:55PM +0000, Richard Earnshaw wrote:
> > > The software single-step implementation in GDB doesn't know either BX or
> > > BLX. This results in losing control of the inferior when we single-step
> > > over them. I based this on the ARM ARM, so I'm pretty sure I've got the
> > > numbers correct.
> > >
> > > OK to check in?
> > >
> > > --
> > > Daniel Jacobowitz
> > > MontaVista Software Debian GNU/Linux Developer
> > >
> > > 2004-02-28 Daniel Jacobowitz <drow@mvista.com>
> > >
> > > * arm-tdep.c (thumb_get_next_pc): Handle BX.
> > > (arm_get_next_pc): Handle BX and BLX.
> >
> > Yikes! Yes, this is OK. However, Thumb has BLX (2 variants) as well.
>
> Right you are. I've checked in the above; if I'm reading
> thumb_get_next_pc and the ARM correctly, then the below is all I need
> for BLX. The first form is already handled since we don't check H.
> The second form can be handled identically to BX by relaxing a test.
>
> OK?
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2004-03-07 Daniel Jacobowitz <drow@mvista.com>
>
> * arm-tdep.c (thumb_get_next_pc): Handle Thumb BLX.

Very close, and possibly good enough for most purposes. But the ARM ARM
says that in the blx(1) case, the resulting address should be masked with
0xfffffffc. That means that there are two theoretical encodings for each
target ARM-state instruction. I think you need to add a test for H=01 and
if so, to apply the mask to nextpc.

R.