Subject: function calls from GDB on powerpc
To: None <firstname.lastname@example.org, email@example.com>
From: Aymeric Vincent <Aymeric.Vincent@labri.fr>
Date: 09/13/2002 17:23:58
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
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.