keiths / rpms / gdb

Forked from rpms/gdb 5 months ago
Clone
e5611bf
Index: gdb-6.8.50.20090803/gdb/valops.c
e5611bf
===================================================================
e5611bf
--- gdb-6.8.50.20090803.orig/gdb/valops.c	2009-08-04 06:30:45.000000000 +0200
e5611bf
+++ gdb-6.8.50.20090803/gdb/valops.c	2009-08-04 06:33:05.000000000 +0200
e5611bf
@@ -926,10 +926,18 @@ value_assign (struct value *toval, struc
e5611bf
 	struct gdbarch *gdbarch;
3a094fb
 	int value_reg;
3a094fb
 
3a094fb
-	/* Figure out which frame this is in currently.  */
3a094fb
-	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
3a094fb
 	value_reg = VALUE_REGNUM (toval);
3a094fb
 
3a094fb
+	/* Figure out which frame this is in currently.  */
3a094fb
+	frame = frame_find_by_id (VALUE_FRAME_ID (toval));
3a094fb
+	/* "set $reg+=1" should work on programs with no debug info,
3a094fb
+	   but frame_find_by_id returns NULL here (RH bug 436037).
3a094fb
+	   Use current frame, it represents CPU state in this case.
3a094fb
+	   If frame_find_by_id is changed to do it internally
3a094fb
+	   (it is contemplated there), remove this.  */
3a094fb
+	if (!frame)
3a094fb
+	  frame = get_current_frame ();
3a094fb
+	/* Probably never happens.  */
3a094fb
 	if (!frame)
3a094fb
 	  error (_("Value being assigned to is no longer active."));
e5611bf