Re: problem with exec-file when targetting remote machine

Kris Warkentin
2003-03-30T01:12:01Z

> Assume the code was originally added because of a bug :-) I'm guessing
> something like:
>
> (gdb) file executable
> (gdb) disassemble main
>
> will break. It will select the wrong disassembler. Why isn't the
> executable being recognized, and why do the defaults fail? (NickC
> pointed me at an endian problem recently).

In case anyone is curious as to what the problem was, here it is.

I was suspicious about the $pc being incorrect even though it hit the
breakpoint at main. I stepped into our register stuffing code and observed
that everything was fine. As soon as I continued and checked the registers,
they were changed but only from $r15 onward (this is an sh4 target). I set
a watchpoint and it turns out that our floating point stuffing routine was
calculating the offset incorrectly and clobbering some of the gp registers.

The reason it was only happening with exec-file is that the default sh arch
wasn't retrieving fpregs and when it got a slightly different arch based on
the bfd, it would start asking for them and they'd get clobbered.

Cheers,

Kris