mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-31 22:04:12 +08:00
gdb/python: fix a few flake8 warnings
Fix these rather obvious warnings reported by flake8: ./lib/gdb/FrameIterator.py:16:1: F401 'gdb' imported but unused ./lib/gdb/FrameIterator.py:17:1: F401 'itertools' imported but unused ./lib/gdb/command/prompt.py:55:26: E712 comparison to False should be 'if cond is False:' or 'if not cond:' ./lib/gdb/command/explore.py:526:9: F841 local variable 'has_explorable_fields' is assigned to but never used ./lib/gdb/command/explore.py:697:56: E712 comparison to False should be 'if cond is False:' or 'if not cond:' ./lib/gdb/command/explore.py:736:62: E712 comparison to False should be 'if cond is False:' or 'if not cond:' ./lib/gdb/command/explore.py:767:61: E712 comparison to False should be 'if cond is False:' or 'if not cond:' ./lib/gdb/command/frame_filters.py:21:1: F401 'copy' imported but unused ./lib/gdb/command/frame_filters.py:22:1: F401 'gdb.FrameIterator.FrameIterator' imported but unused ./lib/gdb/command/frame_filters.py:23:1: F401 'gdb.FrameDecorator.FrameDecorator' imported but unused ./lib/gdb/command/frame_filters.py:25:1: F401 'itertools' imported but unused ./lib/gdb/command/frame_filters.py:179:17: E712 comparison to True should be 'if cond is True:' or 'if cond:' Change-Id: I4f49c0cb430359ee872222600c61d9c5283b09ab
This commit is contained in:
@ -13,9 +13,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import gdb
|
|
||||||
import itertools
|
|
||||||
|
|
||||||
|
|
||||||
class FrameIterator(object):
|
class FrameIterator(object):
|
||||||
"""A gdb.Frame iterator. Iterates over gdb.Frames or objects that
|
"""A gdb.Frame iterator. Iterates over gdb.Frames or objects that
|
||||||
|
@ -523,7 +523,6 @@ class CompoundExplorer(object):
|
|||||||
else:
|
else:
|
||||||
print("'%s' is a %s with the following " "fields:\n" % (name, type_desc))
|
print("'%s' is a %s with the following " "fields:\n" % (name, type_desc))
|
||||||
|
|
||||||
has_explorable_fields = False
|
|
||||||
current_choice = 0
|
current_choice = 0
|
||||||
choice_to_compound_field_map = {}
|
choice_to_compound_field_map = {}
|
||||||
print_list = []
|
print_list = []
|
||||||
@ -694,7 +693,7 @@ class ExploreCommand(gdb.Command):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def invoke(self, arg_str, from_tty):
|
def invoke(self, arg_str, from_tty):
|
||||||
if ExploreUtils.check_args("explore", arg_str) == False:
|
if ExploreUtils.check_args("explore", arg_str) is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Check if it is a value
|
# Check if it is a value
|
||||||
@ -733,7 +732,7 @@ class ExploreValueCommand(gdb.Command):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def invoke(self, arg_str, from_tty):
|
def invoke(self, arg_str, from_tty):
|
||||||
if ExploreUtils.check_args("explore value", arg_str) == False:
|
if ExploreUtils.check_args("explore value", arg_str) is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
value = ExploreUtils.get_value_from_str(arg_str)
|
value = ExploreUtils.get_value_from_str(arg_str)
|
||||||
@ -764,7 +763,7 @@ class ExploreTypeCommand(gdb.Command):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def invoke(self, arg_str, from_tty):
|
def invoke(self, arg_str, from_tty):
|
||||||
if ExploreUtils.check_args("explore type", arg_str) == False:
|
if ExploreUtils.check_args("explore type", arg_str) is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
datatype = ExploreUtils.get_type_from_str(arg_str)
|
datatype = ExploreUtils.get_type_from_str(arg_str)
|
||||||
|
@ -18,11 +18,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import gdb
|
import gdb
|
||||||
import copy
|
|
||||||
from gdb.FrameIterator import FrameIterator
|
|
||||||
from gdb.FrameDecorator import FrameDecorator
|
|
||||||
import gdb.frames
|
import gdb.frames
|
||||||
import itertools
|
|
||||||
|
|
||||||
# GDB Commands.
|
# GDB Commands.
|
||||||
class SetFilterPrefixCmd(gdb.Command):
|
class SetFilterPrefixCmd(gdb.Command):
|
||||||
@ -176,7 +172,7 @@ def _complete_frame_filter_list(text, word, all_flag):
|
|||||||
from text/word analysis. This list can be empty when there
|
from text/word analysis. This list can be empty when there
|
||||||
are no suggestions for completion.
|
are no suggestions for completion.
|
||||||
"""
|
"""
|
||||||
if all_flag == True:
|
if all_flag:
|
||||||
filter_locations = ["all", "global", "progspace"]
|
filter_locations = ["all", "global", "progspace"]
|
||||||
else:
|
else:
|
||||||
filter_locations = ["global", "progspace"]
|
filter_locations = ["global", "progspace"]
|
||||||
|
@ -52,7 +52,7 @@ class _ExtendedPrompt(gdb.Parameter):
|
|||||||
return "The extended prompt is not set."
|
return "The extended prompt is not set."
|
||||||
|
|
||||||
def get_set_string(self):
|
def get_set_string(self):
|
||||||
if self.hook_set == False:
|
if self.hook_set is False:
|
||||||
gdb.prompt_hook = self.before_prompt_hook
|
gdb.prompt_hook = self.before_prompt_hook
|
||||||
self.hook_set = True
|
self.hook_set = True
|
||||||
return ""
|
return ""
|
||||||
|
Reference in New Issue
Block a user