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] Don't use pseudo-register when invalidating regcache in remote-mips.c


I've committed the patch below.  It avoids an assertion failure caused
by calling regcache_invalidate() with a register number belonging to a
pseudo-register:  

regcache.c:407: internal-error: regcache_invalidate: Assertion `regnum < regcache->descr->nr_raw_registers' failed.

Note that mips_regnum (...)->pc is used in several other locations within
remote-mips.c.  (Which is as it should be...)

I've also noticed that gdbarch_pc_regnum() is called from other locations
within remote-mips.c.  These uses of gdbarch_pc_regnum() don't seem to
cause a problem, so I'm leaving them alone for now.

Lastly, I'll note that remote-mips.c has several other problems which,
at the moment, make it unusable.  I'll be submitting other patches for
these problems.  This was the only patch that I felt comfortable committing
outright.

Kevin

	* remote-mips.c (mips_load): Don't use pseudo-register when
	invalidating regcache.

Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.107
diff -u -p -r1.107 remote-mips.c
--- remote-mips.c	1 Jan 2010 07:31:40 -0000	1.107
+++ remote-mips.c	26 Feb 2010 22:47:30 -0000
@@ -3292,7 +3292,7 @@ mips_load (char *file, int from_tty)
          to a different value than GDB thinks it has. The following ensures
          that the regcache_write_pc() WILL update the PC value: */
       regcache_invalidate (regcache,
-			   gdbarch_pc_regnum (get_regcache_arch (regcache)));
+			   mips_regnum (get_regcache_arch (regcache))->pc);
     }
   if (exec_bfd)
     regcache_write_pc (regcache, bfd_get_start_address (exec_bfd));


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