This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Cannot set the PC on mips-irix


Any attempt at setting the pc silently fails. I noticed this while
trying to call a function: The inferior would sometimes run away,
or immediately stopped at the current instruction if there was
a breakpoint inserted there.

This can also be seen by:

  . Attempting a "jump" where the same behavior as during a function
    call is observed.
   
  . Or by simply doing a "set $pc = 0xdeadbeeef"; a stepi after
    the assignment shows that we've stepped the insn at the original
    PC value.

I traced the problem down to a confusion between raw and cooked register
numbers.  We were passing a raw register number to irix5-nat.c:fill_gregset,
while the latter was comparing it with the register number returned
by gdbarch_pc_regnum, which happens to return a cooked register number.
     
The fix is to compare the given register number against the raw PC
register number.  This actually makes this part of the code more consistent
with the rest of this function...

gdb/ChangeLog:

        Cannot set the PC on mips-irix.
        * irix5-nat.c (fill_gregset): Check regno against the raw PC
        register number, no the cooked one.

-- 
Joel
gdb/ChangeLog:

        Cannot set the PC on mips-irix.
        * irix5-nat.c (fill_gregset): Check regno against the raw PC
        register number, no the cooked one.
---
 gdb/irix5-nat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gdb/irix5-nat.c b/gdb/irix5-nat.c
index d8e1073..f7454dc 100644
--- a/gdb/irix5-nat.c
+++ b/gdb/irix5-nat.c
@@ -98,7 +98,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
 	*(regp + regi) = extract_signed_integer (buf, size, byte_order);
       }
 
-  if ((regno == -1) || (regno == gdbarch_pc_regnum (gdbarch)))
+  if ((regno == -1) || (regno == mips_regnum (gdbarch)->pc))
     {
       regi = mips_regnum (gdbarch)->pc;
       size = register_size (gdbarch, regi);
-- 
1.5.4.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]