This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: patch for info threads problem with target arm-elf (PR 1199).
On Fri, Jul 25, 2003 at 10:10:40PM -0400, Andrew Cagney wrote:
> >- /* Avoid coredumps which would happen if we tried to access a NULL
> >- deprecated_selected_frame. */
> >- if (!target_has_stack)
> >- error ("No stack.");
> >+ /* Check that there really is a frame. This happens when a simulator
> >+ is connected but not loaded or running, for instance. */
> >+ if (saved_frame_level < 0)
> >+ error ("No frame.");
>
> This would only happen to old architectures (legacy_get_prev_frame).
> With new architectures (get_prev_frame), frame creation is so lazy that
> an inner most frame is (hopefully?) always created. Can you make this
> check conditional on legacy_frame_p?
Ah, that's the bit I was missing. Thanks, sounds reasonable to me.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-07-25 Daniel Jacobowitz <drow@mvista.com>
* thread.c (info_threads_command): Use get_selected_frame ().
Check that there is at least one non-sentinel frame.
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.31
diff -u -p -r1.31 thread.c
--- thread.c 5 May 2003 00:27:08 -0000 1.31
+++ thread.c 26 Jul 2003 01:47:08 -0000
@@ -417,14 +417,14 @@ info_threads_command (char *arg, int fro
struct thread_info *tp;
ptid_t current_ptid;
struct frame_info *cur_frame;
- int saved_frame_level = frame_relative_level (deprecated_selected_frame);
+ int saved_frame_level = frame_relative_level (get_selected_frame ());
int counter;
char *extra_info;
- /* Avoid coredumps which would happen if we tried to access a NULL
- deprecated_selected_frame. */
- if (!target_has_stack)
- error ("No stack.");
+ /* Check that there really is a frame. This happens when a simulator
+ is connected but not loaded or running, for instance. */
+ if (legacy_frame_p (current_gdbarch) && saved_frame_level < 0)
+ error ("No frame.");
prune_threads ();
target_find_new_threads ();
@@ -448,10 +448,7 @@ info_threads_command (char *arg, int fro
puts_filtered (" ");
switch_to_thread (tp->ptid);
- if (deprecated_selected_frame)
- print_stack_frame (deprecated_selected_frame, -1, 0);
- else
- printf_filtered ("[No stack.]\n");
+ print_stack_frame (get_selected_frame (), -1, 0);
}
switch_to_thread (current_ptid);
@@ -463,12 +460,12 @@ info_threads_command (char *arg, int fro
* of the stack (leaf frame).
*/
counter = saved_frame_level;
- cur_frame = find_relative_frame (deprecated_selected_frame, &counter);
+ cur_frame = find_relative_frame (get_selected_frame (), &counter);
if (counter != 0)
{
/* Ooops, can't restore, tell user where we are. */
warning ("Couldn't restore frame in current thread, at frame 0");
- print_stack_frame (deprecated_selected_frame, -1, 0);
+ print_stack_frame (get_selected_frame (), -1, 0);
}
else
{