This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA/ARM: Switch mode when setting PC
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: Andrew Cagney <cagney at gnu dot org>, gdb-patches at sources dot redhat dot com, rearnsha at arm dot com
- Date: Fri, 16 Jan 2004 14:34:23 +0000
- Subject: Re: RFA/ARM: Switch mode when setting PC
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
>
> 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.