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

689258
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
689258
From: Fedora GDB patches <invalid@email.com>
689258
Date: Fri, 27 Oct 2017 21:07:50 +0200
689258
Subject: gdb-6.8-bz436037-reg-no-longer-active.patch
689258
689258
;; Fix register assignments with no GDB stack frames (BZ 436037).
689258
;;=push+jan: This fix is incorrect.
689258
689258
diff --git a/gdb/valops.c b/gdb/valops.c
689258
--- a/gdb/valops.c
689258
+++ b/gdb/valops.c
689258
@@ -1104,6 +1104,8 @@ value_assign (struct value *toval, struct value *fromval)
689258
 	struct gdbarch *gdbarch;
689258
 	int value_reg;
689258
 
689258
+	value_reg = VALUE_REGNUM (toval);
689258
+
689258
 	/* Figure out which frame this is in currently.
689258
 	
689258
 	   We use VALUE_FRAME_ID for obtaining the value's frame id instead of
689258
@@ -1113,8 +1115,14 @@ value_assign (struct value *toval, struct value *fromval)
689258
 	   frame.  */
689258
 	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
689258
 
689258
-	value_reg = VALUE_REGNUM (toval);
689258
-
689258
+	/* "set $reg+=1" should work on programs with no debug info,
689258
+	   but frame_find_by_id returns NULL here (RH bug 436037).
689258
+	   Use current frame, it represents CPU state in this case.
689258
+	   If frame_find_by_id is changed to do it internally
689258
+	   (it is contemplated there), remove this.  */
689258
+	if (!frame)
689258
+	  frame = get_current_frame ();
689258
+	/* Probably never happens.  */
689258
 	if (!frame)
689258
 	  error (_("Value being assigned to is no longer active."));
689258