Blame SOURCES/gdb-6.8-bz436037-reg-no-longer-active.patch

861f93
Index: gdb-6.8.50.20090803/gdb/valops.c
861f93
===================================================================
861f93
--- gdb-6.8.50.20090803.orig/gdb/valops.c	2009-08-04 06:30:45.000000000 +0200
861f93
+++ gdb-6.8.50.20090803/gdb/valops.c	2009-08-04 06:33:05.000000000 +0200
861f93
@@ -926,10 +926,18 @@ value_assign (struct value *toval, struc
861f93
 	struct gdbarch *gdbarch;
861f93
 	int value_reg;
861f93
 
861f93
-	/* Figure out which frame this is in currently.  */
861f93
-	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
861f93
 	value_reg = VALUE_REGNUM (toval);
861f93
 
861f93
+	/* Figure out which frame this is in currently.  */
861f93
+	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
861f93
+	/* "set $reg+=1" should work on programs with no debug info,
861f93
+	   but frame_find_by_id returns NULL here (RH bug 436037).
861f93
+	   Use current frame, it represents CPU state in this case.
861f93
+	   If frame_find_by_id is changed to do it internally
861f93
+	   (it is contemplated there), remove this.  */
861f93
+	if (!frame)
861f93
+	  frame = get_current_frame ();
861f93
+	/* Probably never happens.  */
861f93
 	if (!frame)
861f93
 	  error (_("Value being assigned to is no longer active."));
861f93