Re: [rfc] Strip Thumb bit from PC returned by arm_get_longjmp_target

Ulrich Weigand
2010-08-20T12:00:26Z

Matthew Gretton-Dann wrote:
> On Thu, 2010-08-19 at 10:49 +0200, Ulrich Weigand wrote:
> > Actually, it turns out this new patch doesn't work. It leads to:
> >
> > Breakpoint 4 at 0x84ec: file ../../../gdb-head/gdb/testsuite/gdb.threads/threxit-hop-specific.c, line 47.^M
> > (gdb) next^M
> > ^M
> > Program received signal SIGTRAP, Trace/breakpoint trap.^M
> >
> > This happens because GDB now no longer recognizes the PC address
> > when the breakpoint trap arrives. The PC is compared against
> > the breakpoint location's loc->address value -- which now has the
> > Thumb bit set, but the PC doesn't.
> >
> > Note that while the Thumb bit gets removes in arm_breakpoint_from_pc,
> > this affects only loc->placed_address, not loc->address.
> >
> > This seems to indicate that in fact, breakpoint addresses must
> > *not* have the Thumb bit set ...
> >
> > Do you have a case where this works for you?
>
> I don't have a case. I think this means that the original patch is the
> correct one for the moment - but I'm not a maintainer so this isn't an
> approval.

OK, thanks for your feedback. I'm happy to wait for Richard's approval ...

> Also, looking at the code in arm_adjust_breakpoint_address I think there
> are other cases that may cause the failure you are seeing above (for
> instance when using Thumb-2 in the absence of mapping symbols and
> setting the breakpoint on 0x8001).

I'm now wondering whether it can in fact ever happen that an address with
the Thumb bit set can come into arm_adjust_breakpoint_address; it seems
that (except for the longjmp target case) no such values are ever exposed.
Am I missing a possible path here?