This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Consider the selected traceframe when checking for stack frames


Hi,

The following patch addresses a problem seen when trying to inspect traceframe data while the currently-selected thread is still running. GDB will then fail to display such data because has_stack_frame (...) returns 0 in this case. If a traceframe is selected, we should use data from it and ignore the state of the live inferior.

With this fix, GDB can properly display the traceframe data, like collected locals.

The patch was pre-approved by Pedro.

Regards,
Luis
2011-08-24  Luis Machado  <lgustavo@codesourcery.com>

	* frame.c (has_stack_frames): Check for currently selected
	traceframe.

--- .pc/has_stack.diff/gdb/frame.c    2011-08-23 16:51:35.453049000 -0300
+++ gdb/frame.c	2011-08-23 16:59:47.261049002 -0300
@@ -1328,17 +1328,21 @@ has_stack_frames (void)
   if (!target_has_registers || !target_has_stack || !target_has_memory)
     return 0;
 
-  /* No current inferior, no frame.  */
-  if (ptid_equal (inferior_ptid, null_ptid))
-    return 0;
+  /* Traceframes are effectively a substitute for the live inferior.  */
+  if (get_traceframe_number () < 0)
+    {
+      /* No current inferior, no frame.  */
+      if (ptid_equal (inferior_ptid, null_ptid))
+	return 0;
 
-  /* Don't try to read from a dead thread.  */
-  if (is_exited (inferior_ptid))
-    return 0;
+      /* Don't try to read from a dead thread.  */
+      if (is_exited (inferior_ptid))
+	return 0;
 
-  /* ... or from a spinning thread.  */
-  if (is_executing (inferior_ptid))
-    return 0;
+      /* ... or from a spinning thread.  */
+      if (is_executing (inferior_ptid))
+	return 0;
+    }
 
   return 1;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]