+2011-03-09 Tom Tromey <tromey@redhat.com>
+
+ * thread.c (restore_selected_frame): Handle frame_level == -1.
+ (make_cleanup_restore_current_thread): Use
+ get_selected_frame_if_set.
+ * frame.h (get_selected_frame_if_set): Declare.
+ * frame.c (get_selected_frame_if_set): New function.
+
2011-03-09 Pedro Alves <pedro@codesourcery.com>
* cli/cli-cmds.c (shell_escape): Use lbasename.
return selected_frame;
}
+/* If there is a selected frame, return it. Otherwise, return NULL. */
+
+struct frame_info *
+get_selected_frame_if_set (void)
+{
+ return selected_frame;
+}
+
/* This is a variant of get_selected_frame() which can be called when
the inferior does not have a frame; in that case it will return
NULL instead of calling error(). */
and then return that thread's previously selected frame. */
extern struct frame_info *get_selected_frame (const char *message);
+/* If there is a selected frame, return it. Otherwise, return NULL. */
+extern struct frame_info *get_selected_frame_if_set (void);
+
/* Select a specific frame. NULL, apparently implies re-select the
inner most frame. */
extern void select_frame (struct frame_info *);
struct frame_info *frame = NULL;
int count;
+ /* This means there was no selected frame. */
+ if (frame_level == -1)
+ {
+ select_frame (NULL);
+ return;
+ }
+
gdb_assert (frame_level >= 0);
/* Restore by level first, check if the frame id is the same as
&& target_has_registers
&& target_has_stack
&& target_has_memory)
- frame = get_selected_frame (NULL);
+ {
+ /* When processing internal events, there might not be a
+ selected frame. If we naively call get_selected_frame
+ here, then we can end up reading debuginfo for the
+ current frame, but we don't generally need the debuginfo
+ at this point. */
+ frame = get_selected_frame_if_set ();
+ }
else
frame = NULL;