Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: selected frame in read_var_value
@ 2003-08-01 19:29 Daniel Jacobowitz
  2003-08-07 17:45 ` Andrew Cagney
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Jacobowitz @ 2003-08-01 19:29 UTC (permalink / raw)
  To: gdb-patches

Thoughts on this?  I observed one case where the selected frame hadn't been
initialized yet: when checking watchpoint values.  Oops!  The condition
matches the case in which get_current_frame () can be reasonably expected to
succeed.  There are a couple other places that need this same check, mostly
functions which will work on globals as well as locals.

An alternative would be to create a lifeless_frame and have
get_current_frame return that when there is no running target; have it call
error if a register is read, its base is requested, et cetera.  I suspect
that would require some serious surgery.  We'd also need to pass
lifeless_frame everywhere we could be passing a NULL frame now.  For
instance, several callers of read_var_value will give it no frame.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-08-01  Daniel Jacobowitz  <drow@mvista.com>

	* findvar.c (read_var_value): If the target is running, call
	get_selected_frame instead of checking deprecated_selected_frame.

--- gdb-5.3.20030801/gdb/findvar.c.orig	2003-08-01 14:46:12.000000000 -0400
+++ gdb-5.3.20030801/gdb/findvar.c	2003-08-01 14:50:27.000000000 -0400
@@ -388,7 +388,7 @@ symbol_read_needs_frame (struct symbol *
    and a stack frame id, read the value of the variable
    and return a (pointer to a) struct value containing the value. 
    If the variable cannot be found, return a zero pointer.
-   If FRAME is NULL, use the deprecated_selected_frame.  */
+   If FRAME is NULL, use the selected frame.  */
 
 struct value *
 read_var_value (register struct symbol *var, struct frame_info *frame)
@@ -404,8 +404,9 @@ read_var_value (register struct symbol *
 
   len = TYPE_LENGTH (type);
 
-  if (frame == NULL)
-    frame = deprecated_selected_frame;
+  if (frame == NULL && target_has_registers && target_has_stack
+      && target_has_memory)
+    frame = get_selected_frame ();
 
   switch (SYMBOL_CLASS (var))
     {


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

end of thread, other threads:[~2004-02-08 17:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01 19:29 RFC: selected frame in read_var_value Daniel Jacobowitz
2003-08-07 17:45 ` Andrew Cagney
2003-08-28 19:55   ` Daniel Jacobowitz
2003-09-05 17:14     ` Andrew Cagney
2003-09-05 17:18       ` Daniel Jacobowitz
2003-09-05 17:39         ` Andrew Cagney
2003-09-07  3:53       ` Daniel Jacobowitz
2003-09-08 13:33         ` Andrew Cagney
2003-09-08 13:37           ` Daniel Jacobowitz
2003-09-08 18:59           ` Daniel Jacobowitz
2004-02-08  4:17           ` Daniel Jacobowitz
2004-02-08 17:33             ` Andrew Cagney

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