aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-23 11:03:57 -0600
committerTom Tromey <tom@tromey.com>2018-03-26 21:57:11 -0600
commit978d6c756fcb0332ddf12e19305dd0e53b98a93d (patch)
tree4cc45e6fc13330028284e03e5062455237afe342 /gdb/python
parent1cf7e64086d1490649dc56e1c0505be91c600218 (diff)
downloadgdb-978d6c756fcb0332ddf12e19305dd0e53b98a93d.zip
gdb-978d6c756fcb0332ddf12e19305dd0e53b98a93d.tar.gz
gdb-978d6c756fcb0332ddf12e19305dd0e53b98a93d.tar.bz2
Allow hiding of some filtered frames
When a frame filter elides some frames, they are still printed by "bt", indented a few spaces. PR backtrace/15582 notes that it would be nice for users if elided frames could simply be dropped. This patch adds this capability. gdb/ChangeLog 2018-03-26 Tom Tromey <tom@tromey.com> PR backtrace/15582: * stack.c (backtrace_command): Parse "hide" argument. * python/py-framefilter.c (py_print_frame): Handle PRINT_HIDE. * extension.h (enum frame_filter_flags) <PRINT_HIDE>: New constant. gdb/doc/ChangeLog 2018-03-26 Tom Tromey <tom@tromey.com> PR backtrace/15582: * gdb.texinfo (Backtrace): Mention "hide" argument. gdb/testsuite/ChangeLog 2018-03-26 Tom Tromey <tom@tromey.com> PR backtrace/15582: * gdb.python/py-framefilter.exp: Add "bt hide" test.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-framefilter.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 99d47f2..aae8d5d 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1238,37 +1238,37 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
return EXT_LANG_BT_ERROR;
}
- {
- /* Finally recursively print elided frames, if any. */
- gdbpy_ref<> elided (get_py_iter_from_func (filter, "elided"));
- if (elided == NULL)
- return EXT_LANG_BT_ERROR;
+ if ((flags & PRINT_HIDE) == 0)
+ {
+ /* Finally recursively print elided frames, if any. */
+ gdbpy_ref<> elided (get_py_iter_from_func (filter, "elided"));
+ if (elided == NULL)
+ return EXT_LANG_BT_ERROR;
- if (elided != Py_None)
- {
- PyObject *item;
+ if (elided != Py_None)
+ {
+ PyObject *item;
- ui_out_emit_list inner_list_emiter (out, "children");
+ ui_out_emit_list inner_list_emiter (out, "children");
- if (! out->is_mi_like_p ())
- indent++;
+ if (! out->is_mi_like_p ())
+ indent++;
- while ((item = PyIter_Next (elided.get ())))
- {
- gdbpy_ref<> item_ref (item);
+ while ((item = PyIter_Next (elided.get ())))
+ {
+ gdbpy_ref<> item_ref (item);
- enum ext_lang_bt_status success = py_print_frame (item, flags,
- args_type, out,
- indent,
- levels_printed);
+ enum ext_lang_bt_status success
+ = py_print_frame (item, flags, args_type, out, indent,
+ levels_printed);
- if (success == EXT_LANG_BT_ERROR)
- return EXT_LANG_BT_ERROR;
- }
- if (item == NULL && PyErr_Occurred ())
- return EXT_LANG_BT_ERROR;
- }
- }
+ if (success == EXT_LANG_BT_ERROR)
+ return EXT_LANG_BT_ERROR;
+ }
+ if (item == NULL && PyErr_Occurred ())
+ return EXT_LANG_BT_ERROR;
+ }
+ }
return EXT_LANG_BT_COMPLETED;
}