PR gdb/16483 - simplify "info frame-filters" output
PR gdb/16483 notes that the output of "info frame-filters" is quite voluminous. In particular it prints an entry for each objfile, even if only to say that the objfile does not have any associated frame filters. I think it's better to only print output when there is a frame filter. There's nothing worth doing with the no-frame-filter information, and limiting the output makes it much more readable. Built and regtested on x86-64 Fedora 23. 2016-06-23 Tom Tromey <tom@tromey.com> PR gdb/16483: * python/lib/gdb/command/frame_filters.py (InfoFrameFilter.list_frame_filters): Rename to print_list. Print nothing if no filters found. Return value indicating whether filters were printed. (InfoFrameFilter.print_list): Remove. (InfoFrameFilter.invoke): Print message if no frame filters found. 2016-06-23 Tom Tromey <tom@tromey.com> PR gdb/16483: * gdb.python/py-framefilter.exp: Add "info frame-filter" test before any filters are loaded.
This commit is contained in:
parent
0e9c5a5c99
commit
17621150cc
4 changed files with 44 additions and 31 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2016-06-23 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
PR gdb/16483:
|
||||||
|
* python/lib/gdb/command/frame_filters.py
|
||||||
|
(InfoFrameFilter.list_frame_filters): Rename to print_list. Print
|
||||||
|
nothing if no filters found. Return value indicating whether
|
||||||
|
filters were printed.
|
||||||
|
(InfoFrameFilter.print_list): Remove.
|
||||||
|
(InfoFrameFilter.invoke): Print message if no frame filters
|
||||||
|
found.
|
||||||
|
|
||||||
2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
|
2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
|
||||||
|
|
||||||
* f-valprint.c (f_val_print): Add field names for printing
|
* f-valprint.c (f_val_print): Add field names for printing
|
||||||
|
|
|
@ -56,52 +56,44 @@ class InfoFrameFilter(gdb.Command):
|
||||||
else:
|
else:
|
||||||
return "No"
|
return "No"
|
||||||
|
|
||||||
def list_frame_filters(self, frame_filters):
|
def print_list(self, title, frame_filters, blank_line):
|
||||||
""" Internal worker function to list and print frame filters
|
|
||||||
in a dictionary.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
frame_filters: The name of the dictionary, as
|
|
||||||
specified by GDB user commands.
|
|
||||||
"""
|
|
||||||
|
|
||||||
sorted_frame_filters = sorted(frame_filters.items(),
|
sorted_frame_filters = sorted(frame_filters.items(),
|
||||||
key=lambda i: gdb.frames.get_priority(i[1]),
|
key=lambda i: gdb.frames.get_priority(i[1]),
|
||||||
reverse=True)
|
reverse=True)
|
||||||
|
|
||||||
if len(sorted_frame_filters) == 0:
|
if len(sorted_frame_filters) == 0:
|
||||||
print(" No frame filters registered.")
|
return 0
|
||||||
else:
|
|
||||||
print(" Priority Enabled Name")
|
|
||||||
for frame_filter in sorted_frame_filters:
|
|
||||||
name = frame_filter[0]
|
|
||||||
try:
|
|
||||||
priority = '{:<8}'.format(
|
|
||||||
str(gdb.frames.get_priority(frame_filter[1])))
|
|
||||||
enabled = '{:<7}'.format(
|
|
||||||
self.enabled_string(gdb.frames.get_enabled(frame_filter[1])))
|
|
||||||
except Exception:
|
|
||||||
e = sys.exc_info()[1]
|
|
||||||
print(" Error printing filter '"+name+"': "+str(e))
|
|
||||||
else:
|
|
||||||
print(" %s %s %s" % (priority, enabled, name))
|
|
||||||
|
|
||||||
def print_list(self, title, filter_list, blank_line):
|
|
||||||
print(title)
|
print(title)
|
||||||
self.list_frame_filters(filter_list)
|
print(" Priority Enabled Name")
|
||||||
|
for frame_filter in sorted_frame_filters:
|
||||||
|
name = frame_filter[0]
|
||||||
|
try:
|
||||||
|
priority = '{:<8}'.format(
|
||||||
|
str(gdb.frames.get_priority(frame_filter[1])))
|
||||||
|
enabled = '{:<7}'.format(
|
||||||
|
self.enabled_string(gdb.frames.get_enabled(frame_filter[1])))
|
||||||
|
print(" %s %s %s" % (priority, enabled, name))
|
||||||
|
except Exception:
|
||||||
|
e = sys.exc_info()[1]
|
||||||
|
print(" Error printing filter '"+name+"': "+str(e))
|
||||||
if blank_line:
|
if blank_line:
|
||||||
print("")
|
print("")
|
||||||
|
return 1
|
||||||
|
|
||||||
def invoke(self, arg, from_tty):
|
def invoke(self, arg, from_tty):
|
||||||
self.print_list("global frame-filters:", gdb.frame_filters, True)
|
any_printed = self.print_list("global frame-filters:", gdb.frame_filters, True)
|
||||||
|
|
||||||
cp = gdb.current_progspace()
|
cp = gdb.current_progspace()
|
||||||
self.print_list("progspace %s frame-filters:" % cp.filename,
|
any_printed += self.print_list("progspace %s frame-filters:" % cp.filename,
|
||||||
cp.frame_filters, True)
|
cp.frame_filters, True)
|
||||||
|
|
||||||
for objfile in gdb.objfiles():
|
for objfile in gdb.objfiles():
|
||||||
self.print_list("objfile %s frame-filters:" % objfile.filename,
|
any_printed += self.print_list("objfile %s frame-filters:" % objfile.filename,
|
||||||
objfile.frame_filters, False)
|
objfile.frame_filters, False)
|
||||||
|
|
||||||
|
if any_printed == 0:
|
||||||
|
print ("No frame filters.")
|
||||||
|
|
||||||
# Internal enable/disable functions.
|
# Internal enable/disable functions.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
2016-06-23 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
PR gdb/16483:
|
||||||
|
* gdb.python/py-framefilter.exp: Add "info frame-filter" test
|
||||||
|
before any filters are loaded.
|
||||||
|
|
||||||
2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
|
2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>
|
||||||
|
|
||||||
* gdb.fortran/derived-type.exp (print q): Add fields to the output.
|
* gdb.fortran/derived-type.exp (print q): Add fields to the output.
|
||||||
|
|
|
@ -33,6 +33,10 @@ gdb_start
|
||||||
# Skip all tests if Python scripting is not enabled.
|
# Skip all tests if Python scripting is not enabled.
|
||||||
if { [skip_python_tests] } { continue }
|
if { [skip_python_tests] } { continue }
|
||||||
|
|
||||||
|
gdb_test "info frame-filter" \
|
||||||
|
"No frame filters\\." \
|
||||||
|
"info frame filter before loading filters"
|
||||||
|
|
||||||
# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
|
# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
|
||||||
# Care is taken to put it in the same directory as the binary so that
|
# Care is taken to put it in the same directory as the binary so that
|
||||||
# gdb will find it.
|
# gdb will find it.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue