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

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