GDB and ARM Frame Pointer strangeness

Steven Johnson
2004-06-07T08:50:57Z

Hi all,

I have compiled GDB 6.1 for ARM Cross Debugging. Hosted on X86 Linux.
Ive been doing this for a while with PowerPC, so im no stranger to it.
Well, now I have an ARM target and I am writing an ARM remote interface
to my target communicating using the Remote Protocol over TCP/IP. The
strange thing is, right after startup, if I try and write an absolute
memory location GDB insists on dereferencing the Frame Pointer (R11) and
reading the address stored there. It then does something with the
result and dereferences that.

The problem is, I havent got a program loaded yet. And the Registers are
just in any old state, a program not having been loaded and run.
Dereferencing the FP (R11) is causing the target to crash, becasue the
memory it is trying to access is a random address (being the default
garbage in the register) and this is causing the target to get a memory
exception and die.

Not Good.

Why is GDB insisting on de-referencing the FP when all I asked it to do
is write to an absolute memory location. I have not told it to do
anything that is frame pointer relative. The last thing I expect to see
is 2 memory read packets when i execute:

set (unsigned int)0x0 0x12345

all i should see is the memory write packet. The single memory write
packet is all i ever saw with my PowerPC target, it never dereferenced
the FP on a memory write operation????

Is there a way to turn this undesirable operation off?

Any help would be appreciated.

Also, as an aside, 2 other strange things ive noticed with the ARM GDB:

it seems "set architecture" causes GDB to crash for ARM targets. eg
set architecture armv4t followed by the write indicated above crashes
GDB. Leaving it on Auto does not.

and, set osabi does not work with ARM for anything other than "none" or
"auto" I was trying to set an ABI to an embedded ABI, that theoretically
doesnt use an FP, but the command doesnt work. Eg,
(gdb) set osabi ARM EABI v1
Ambiguous item "ARM EABI v1 ".

same goes for "ARM EABI v2" and "ARM APCS"

only "none" "default" and "auto" works.

Also, this is a raw GDB, meaning I havent loaded any application. Im
just trying to get GDB to talk to my target, so am not interested in
debugging an actual application yet. Reading and writing
registers/memory and disassembling are the big ticket items at the moment.

Steven Johnson