Make "bt N" print correct number of frames when using a frame filter
PR python/16497 notes that using "bt" with a positive argument prints the wrong number of frames when a frame filter is in use. Also, in this case, the non-frame-filter path will print a message about "More stack frames" when there are more; but this is not done in the frame-filter case. The first problem is that backtrace_command_1 passes the wrong value to apply_ext_lang_frame_filter -- that function takes the final frame's number as an argument, but backtrace_command_1 passes the count, which is off by one. The solution to the second problem is to have the C stack-printing code stop at the correct number of frames and then print the message. Tested using the buildbot. ChangeLog 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> PR python/16497: * gdb.python/py-framefilter.exp: Update test.
This commit is contained in:
parent
2ddeaf8a7d
commit
6893c19a8b
6 changed files with 49 additions and 2 deletions
|
@ -1744,7 +1744,9 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
|
|||
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
|
||||
|
@ -1778,6 +1780,8 @@ backtrace_command_1 (const char *count_exp, int show_locals, int no_filters,
|
|||
|
||||
if (show_locals)
|
||||
flags |= PRINT_LOCALS;
|
||||
if (from_tty)
|
||||
flags |= PRINT_MORE_FRAMES;
|
||||
|
||||
if (!strcmp (print_frame_arguments, "scalars"))
|
||||
arg_type = CLI_SCALAR_VALUES;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue