Subject: Re: function calls from GDB on powerpc
To: Aymeric Vincent <Aymeric.Vincent@labri.fr>
From: Andrew Cagney <cagney@mac.com>
List: tech-toolchain
Date: 09/20/2002 13:14:14
> when trying to call a function of the program being debugged from
> within GDB on powerpc, you get:
> 
> read_register_bytes:  Couldn't update register 65.
> 
> After a little investigation, here are a few facts:
> 
> - register 65 is the msr.
> - this error is triggered in findvar.c:read_register_bytes() when
>   called with a REGISTER_BYTES argument (in order to load all the
>   registers from the target, so the MSR is not specifically wanted).
> - replacing the error by a warning (a printf) shows that register 65
>   is the only register that is displayed as having problems.
> 
> Consequently, as the MSR is not used in my setup (and I don't think it
> is widely used in gdb in "native" mode), I have removed the
> above-mentioned error and can happily call functions from gdb.
> 
> Here are the possible correct fixes that come to my mind:
> 
> 1) Change the name of register 65 to NULL or "" so that it is ignored
>    by read_register_bytes() [requires changing stuff in rs6000 definitions]
> 2) Provide means to read the MSR with ptrace(2) [requires changing the
>    kernel, powerpc/reg.h and ppcnbsd-nat.c]
> 3) Make up a correct (but fake) value for the MSR in ppcnbsd-nat.c

Suggest doing two things:

- down load a current GDB and see if the problem still occurs.
- assuming it does, hack around the problem with 3.

The way FSF GDB handles the above is very different to the code you're 
looking at.

> Has anyone looked into this yet or plans to do so?
> 
> My preference goes to 3) because it is the least intrusive, and it
> only impacts the "native" use of GDB.
> 
> ... And 1) is a "no-no" IMHO and 2) seems quite useless.
> 
>  Aymeric

Andrew