RFA/ARM: Switch mode when setting PC
Richard Earnshaw
rearnsha@arm.com
Fri Jan 16 14:34:00 GMT 2004
>
> Unless the "Thumb bit" is being stripped out by GDB, then I suspect that
> this is a bug in the gdb/simulator binding layer. Any attempt to force
> the PC value by the debugger should be taken as a potential state change.
> If that is not happening, then all sorts of things may not work.
>
> I've suspected that there is a problem in the way that gdb drives the
> simulator for a while now.
>
sim_store_register in sim/arm/wrapper.c is currently usring ARMul_SetReg
to set the PC. I think this is wrong.
RDI_CPUwrite in sim/arm/armrdi.c uses ARMul_SetPC in a similar context.
ARMul_SetReg should only be used on the PC in specific circumstances,
specifically from within the main simulation loop. Even then it should
probably be using ARMul_SetR15.
I suspect that this is why several rather gross hacks were introduced over
the years to make single stepping work, and what you are seeing now may be
another artifact of this general problem.
Unfortunately, it may be quite difficult to unwind some of these hacks now
(I'm not sure all the changes are in the public repository -- someone with
access to the old Cygnus CVS tree may be able to check, but I certainly
can't), so the knowledge that there is a problem may not help much in the
search for a solution :-(
R.
More information about the Gdb-patches
mailing list