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]

[PATCH] Allow writing to registers before the program starts


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
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."));

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