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

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