+2018-02-26 Tom Tromey <tom@tromey.com>
+
+ PR python/16497:
+ * stack.c (backtrace_command_1): Set PRINT_MORE_FRAMES flag. Fix
+ off-by-one in py_end computation.
+ * python/py-framefilter.c (gdbpy_apply_frame_filter): Handle
+ PRINT_MORE_FRAMES.
+ * extension.h (enum frame_filter_flags) <PRINT_MORE_FRAMES>: New
+ constant.
+
2018-02-26 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct variant_field): New.
/* Set this flag if frame locals are to be printed. */
PRINT_LOCALS = 8,
+
+ /* Set this flag if a "More frames" message is to be printed. */
+ PRINT_MORE_FRAMES = 16,
};
/* A choice of the different frame argument printing strategies that
gdbpy_enter enter_py (gdbarch, current_language);
+ /* When we're limiting the number of frames, be careful to request
+ one extra frame, so that we can print a message if there are more
+ frames. */
+ int frame_countdown = -1;
+ if ((flags & PRINT_MORE_FRAMES) != 0 && frame_low >= 0 && frame_high >= 0)
+ {
+ ++frame_high;
+ /* This has an extra +1 because it is checked before a frame is
+ printed. */
+ frame_countdown = frame_high - frame_low + 1;
+ }
+
gdbpy_ref<> iterable (bootstrap_python_frame_filters (frame, frame_low,
frame_high));
break;
}
+ if (frame_countdown != -1)
+ {
+ gdb_assert ((flags & PRINT_MORE_FRAMES) != 0);
+ --frame_countdown;
+ if (frame_countdown == 0)
+ {
+ /* We've printed all the frames we were asked to
+ print, but more frames existed. */
+ printf_filtered (_("(More stack frames follow...)\n"));
+ break;
+ }
+ }
+
success = py_print_frame (item.get (), flags, args_type, out, 0,
levels_printed.get ());
else
{
py_start = 0;
- py_end = count;
+ /* The argument to apply_ext_lang_frame_filter is the number
+ of the final frame to print, and frames start at 0. */
+ py_end = count - 1;
}
}
else
if (show_locals)
flags |= PRINT_LOCALS;
+ if (from_tty)
+ flags |= PRINT_MORE_FRAMES;
if (!strcmp (print_frame_arguments, "scalars"))
arg_type = CLI_SCALAR_VALUES;
+2018-02-26 Tom Tromey <tom@tromey.com>
+
+ PR python/16497:
+ * gdb.python/py-framefilter.exp: Update test.
+
2018-02-26 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/variant.c: New file.
".*#26.*func5.*#27.*in main \\(\\).*" \
"bt -2 with frame-filter Reverse disabled"
gdb_test "bt 3" \
- ".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*" \
+ ".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\)\[^#\]*More stack frames follow.*" \
"bt 3 with frame-filter Reverse disabled"
gdb_test "bt no-filter full" \
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*" \