Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: assert that target_fetch_registers did its job
@ 2004-07-23 23:00 Jim Blandy
  2004-07-24  0:45 ` Daniel Jacobowitz
  2004-08-06 20:50 ` Nathan J. Williams
  0 siblings, 2 replies; 11+ messages in thread
From: Jim Blandy @ 2004-07-23 23:00 UTC (permalink / raw)
  To: gdb-patches


Does anyone see anything wrong with this?  Should it be an error, or a
warning, instead of an internal error?  It seems to me that the error
should be furnished by the target-specific code; if
target_fetch_registers returns silently, it should have done its job.

But thread_db_fetch_registers doesn't follow that assumption.  In the
threaded case, given any register number, it fetches the gprs, and the
fprs, supplies them, and assumes its job is done.  It seems to me it
sholud be calling register_valid_p (current_regcache, regno) to check
that the register's value has really been supplied, and complaining if
it hasn't.

Or should regcache.c check these conditions and report the warning /
error?  The behavior being hoped for here is target-independent.


2004-07-21  Jim Blandy  <jimb@redhat.com>

	* regcache.c (legacy_read_register_gen, regcache_raw_read): Assert
	that, after calling target_fetch_registers, the register we're
	reading is cached.

Index: gdb/regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.116
diff -c -p -r1.116 regcache.c
*** gdb/regcache.c	10 Jul 2004 01:17:52 -0000	1.116
--- gdb/regcache.c	21 Jul 2004 23:04:46 -0000
*************** legacy_read_register_gen (int regnum, ch
*** 735,740 ****
--- 735,742 ----
    if (!register_cached (regnum))
      target_fetch_registers (regnum);
  
+   gdb_assert (register_cached (regnum));
+ 
    memcpy (myaddr, register_buffer (current_regcache, regnum),
  	  DEPRECATED_REGISTER_RAW_SIZE (regnum));
  }
*************** regcache_raw_read (struct regcache *regc
*** 768,773 ****
--- 770,776 ----
  	}
        if (!register_cached (regnum))
  	target_fetch_registers (regnum);
+       gdb_assert (register_cached (regnum));
      }
    /* Copy the value directly into the register cache.  */
    memcpy (buf, register_buffer (regcache, regnum),


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-08-07 18:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23 23:00 RFA: assert that target_fetch_registers did its job Jim Blandy
2004-07-24  0:45 ` Daniel Jacobowitz
2004-08-03 14:23   ` Andrew Cagney
2004-08-07 18:42     ` Daniel Jacobowitz
2004-08-07 18:54       ` Andrew Cagney
2004-08-04 17:51   ` Jim Blandy
2004-08-06 20:50 ` Nathan J. Williams
2004-08-06 23:43   ` Jim Blandy
2004-08-07  1:47     ` Ian Lance Taylor
2004-08-07 16:13       ` Andrew Cagney
2004-08-07 18:31         ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox