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

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