This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Consider the selected traceframe when checking for stack frames
- From: Luis Machado <lgustavo at codesourcery dot com>
- To: gdb-patches at sourceware dot org, Pedro Alves <pedro at codesourcery dot com>
- Date: Wed, 24 Aug 2011 09:46:39 -0300
- Subject: [PATCH] Consider the selected traceframe when checking for stack frames
- Reply-to: lgustavo at codesourcery dot com
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;
}