Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Allow writing to registers before the program starts
@ 2006-05-03 14:06 Andrew STUBBS
  2006-05-03 14:40 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew STUBBS @ 2006-05-03 14:06 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

Hi,

It used to be possible to write to registers before starting the program 
(on a simulator or other target that has registers that early). This is 
useful to start a program from a non-standard point, or else, with a 
target which retains it state between runs, reset the target to a usable 
state.

E.g:

(gdb) target sim
(gdb) load
(gdb) set $pc = 0x100

However, this now results in the message 'Value being assigned to is no 
longer active.'.

I have tracked this to a patch here: 
http://sourceware.org/ml/gdb-patches/2004-11/msg00317.html

Reverting the valops.c portion of this patch solves the problem for me. 
I have tested it and it produced no regressions.

Ok to apply the attached reversion?

Andrew

[-- Attachment #2: register-write.patch --]
[-- Type: text/plain, Size: 954 bytes --]

2006-05-03  Andrew Stubbs  <andrew.stubbs@st.com>

	* valops.c (value_assign): Revert Andrew Cagney's patch from
	2004-11-15:  re-allow writing of registers before there is
	a current frame.


Index: src/gdb/valops.c
===================================================================
--- src.orig/gdb/valops.c	2006-05-03 14:13:36.000000000 +0100
+++ src/gdb/valops.c	2006-05-03 14:14:28.000000000 +0100
@@ -610,8 +610,16 @@ value_assign (struct value *toval, struc
 	int value_reg;
 
 	/* Figure out which frame this is in currently.  */
-	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
-	value_reg = VALUE_REGNUM (toval);
+	if (VALUE_LVAL (toval) == lval_register)
+	  {
+	    frame = get_current_frame ();
+	    value_reg = VALUE_REGNUM (toval);
+	  }
+	else
+	  {
+	    frame = frame_find_by_id (VALUE_FRAME_ID (toval));
+	    value_reg = VALUE_REGNUM (toval);
+	  }
 
 	if (!frame)
 	  error (_("Value being assigned to is no longer active."));

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

end of thread, other threads:[~2006-05-04  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-03 14:06 [PATCH] Allow writing to registers before the program starts Andrew STUBBS
2006-05-03 14:40 ` Daniel Jacobowitz
2006-05-04  9:43   ` Andrew STUBBS

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