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

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