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

e1d87d
Index: gdb-7.12.50.20170207/gdb/valops.c
e1d87d
===================================================================
e1d87d
--- gdb-7.12.50.20170207.orig/gdb/valops.c	2017-02-26 17:26:43.839146565 +0100
e1d87d
+++ gdb-7.12.50.20170207/gdb/valops.c	2017-02-26 17:28:40.840988272 +0100
e1d87d
@@ -1112,6 +1112,8 @@
e1d87d
 	struct gdbarch *gdbarch;
e1d87d
 	int value_reg;
e1d87d
 
e1d87d
+	value_reg = VALUE_REGNUM (toval);
e1d87d
+
e1d87d
 	/* Figure out which frame this is in currently.
e1d87d
 	
e1d87d
 	   We use VALUE_FRAME_ID for obtaining the value's frame id instead of
e1d87d
@@ -1121,8 +1123,14 @@
e1d87d
 	   frame.  */
e1d87d
 	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
e1d87d
 
e1d87d
-	value_reg = VALUE_REGNUM (toval);
e1d87d
-
e1d87d
+	/* "set $reg+=1" should work on programs with no debug info,
e1d87d
+	   but frame_find_by_id returns NULL here (RH bug 436037).
e1d87d
+	   Use current frame, it represents CPU state in this case.
e1d87d
+	   If frame_find_by_id is changed to do it internally
e1d87d
+	   (it is contemplated there), remove this.  */
e1d87d
+	if (!frame)
e1d87d
+	  frame = get_current_frame ();
e1d87d
+	/* Probably never happens.  */
e1d87d
 	if (!frame)
e1d87d
 	  error (_("Value being assigned to is no longer active."));
e1d87d