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

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