This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb-6.5 produces infinite backtrace on ARM
On Wed, Sep 06, 2006 at 11:19:15AM -0400, Daniel Jacobowitz wrote:
> On Wed, Sep 06, 2006 at 05:03:10PM +0200, Zarges, Olav wrote:
> >
> > Daniel Jacobowitz wrote:
> > > The error should be caught in backtrace_command now. The finished
> > > output should still be printed.
> >
> > Eclipse seems to read the stack via gdb/mi commands stack-info-depth
> > and stack-list-frames and that was what I was referring to (sorry).
> > Please see log below. I tried to print the message with warning(...)
> > and return NULL instead of calling error(...) which seems to work but
> > I don't know about the side-effects this might involve.
>
> Oh, I see. Interesting. We'll see what we can do about this; that
> does make more sense.
Hi Olav,
Does this patch work for you? I am not sure if it is the right
solution or not - it's careless about discarding errors - but I want
to make sure it works for you also before I start any discussion on
that.
--
Daniel Jacobowitz
CodeSourcery
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.840
diff -u -p -r1.840 Makefile.in
--- Makefile.in 22 Aug 2006 19:08:31 -0000 1.840
+++ Makefile.in 10 Sep 2006 14:48:01 -0000
@@ -3067,7 +3067,7 @@ mi-cmds.o: $(srcdir)/mi/mi-cmds.c $(defs
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmds.c
mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
$(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h) \
- $(stack_h) $(dictionary_h) $(gdb_string_h)
+ $(stack_h) $(dictionary_h) $(exceptions_h) $(gdb_string_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
$(mi_out_h) $(varobj_h) $(value_h) $(gdb_string_h)
Index: mi/mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.30
diff -u -p -r1.30 mi-cmd-stack.c
--- mi/mi-cmd-stack.c 7 Sep 2006 16:40:18 -0000 1.30
+++ mi/mi-cmd-stack.c 10 Sep 2006 14:48:01 -0000
@@ -29,6 +29,7 @@
#include "block.h"
#include "stack.h"
#include "dictionary.h"
+#include "exceptions.h"
#include "gdb_string.h"
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
@@ -46,6 +47,7 @@ mi_cmd_stack_list_frames (char *command,
int i;
struct cleanup *cleanup_stack;
struct frame_info *fi;
+ volatile struct gdb_exception e;
if (argc > 2 || argc == 1)
error (_("mi_cmd_stack_list_frames: Usage: [FRAME_LOW FRAME_HIGH]"));
@@ -75,16 +77,23 @@ mi_cmd_stack_list_frames (char *command,
cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack");
- /* Now let;s print the frames up to frame_high, or until there are
- frames in the stack. */
+ /* Now let's print the frames up to frame_high, or until there are
+ no more frames in the stack. */
for (;
fi && (i <= frame_high || frame_high == -1);
- i++, fi = get_prev_frame (fi))
+ i++)
{
QUIT;
/* Print the location and the address always, even for level 0.
args == 0: don't print the arguments. */
print_frame_info (fi, 1, LOC_AND_ADDRESS, 0 /* args */ );
+
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ fi = get_prev_frame (fi);
+ }
+ if (e.reason == RETURN_ERROR)
+ break;
}
do_cleanups (cleanup_stack);
@@ -98,6 +107,7 @@ mi_cmd_stack_info_depth (char *command,
int frame_high;
int i;
struct frame_info *fi;
+ volatile struct gdb_exception e;
if (argc > 1)
error (_("mi_cmd_stack_info_depth: Usage: [MAX_DEPTH]"));
@@ -111,8 +121,16 @@ mi_cmd_stack_info_depth (char *command,
for (i = 0, fi = get_current_frame ();
fi && (i < frame_high || frame_high == -1);
- i++, fi = get_prev_frame (fi))
- QUIT;
+ i++)
+ {
+ QUIT;
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ fi = get_prev_frame (fi);
+ }
+ if (e.reason == RETURN_ERROR)
+ break;
+ }
ui_out_field_int (uiout, "depth", i);
@@ -161,6 +179,7 @@ mi_cmd_stack_list_args (char *command, c
int i;
struct frame_info *fi;
struct cleanup *cleanup_stack_args;
+ volatile struct gdb_exception e;
if (argc < 1 || argc > 3 || argc == 2)
error (_("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));
@@ -194,7 +213,7 @@ mi_cmd_stack_list_args (char *command, c
frames in the stack. */
for (;
fi && (i <= frame_high || frame_high == -1);
- i++, fi = get_prev_frame (fi))
+ i++)
{
struct cleanup *cleanup_frame;
QUIT;
@@ -202,6 +221,13 @@ mi_cmd_stack_list_args (char *command, c
ui_out_field_int (uiout, "level", i);
list_args_or_locals (0, atoi (argv[0]), fi);
do_cleanups (cleanup_frame);
+
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ fi = get_prev_frame (fi);
+ }
+ if (e.reason == RETURN_ERROR)
+ break;
}
do_cleanups (cleanup_stack_args);