From: Tom Tromey Date: Wed, 14 Jun 2023 14:32:08 +0000 (-0600) Subject: Simplify FrameVars X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f921fe93188991bf20fa2b9b5e7de6e591097b72;p=binutils-gdb.git Simplify FrameVars FrameVars implements its own variant of Symbol.is_variable. This patch replaces this code. --- diff --git a/gdb/python/lib/gdb/FrameDecorator.py b/gdb/python/lib/gdb/FrameDecorator.py index 7293be86185..050cb934b7c 100644 --- a/gdb/python/lib/gdb/FrameDecorator.py +++ b/gdb/python/lib/gdb/FrameDecorator.py @@ -223,31 +223,6 @@ class FrameVars(object): def __init__(self, frame): self.frame = frame - self.symbol_class = { - gdb.SYMBOL_LOC_STATIC: True, - gdb.SYMBOL_LOC_REGISTER: True, - gdb.SYMBOL_LOC_ARG: True, - gdb.SYMBOL_LOC_REF_ARG: True, - gdb.SYMBOL_LOC_LOCAL: True, - gdb.SYMBOL_LOC_REGPARM_ADDR: True, - gdb.SYMBOL_LOC_COMPUTED: True, - } - - def fetch_b(self, sym): - """Local utility method to determine if according to Symbol - type whether it should be included in the iterator. Not all - symbols are fetched, and only symbols that return - True from this method should be fetched.""" - - # SYM may be a string instead of a symbol in the case of - # synthetic local arguments or locals. If that is the case, - # always fetch. - if isinstance(sym, str): - return True - - sym_type = sym.addr_class - - return self.symbol_class.get(sym_type, False) def fetch_frame_locals(self): """Public utility method to fetch frame local variables for @@ -266,7 +241,7 @@ class FrameVars(object): for sym in block: if sym.is_argument: continue - if self.fetch_b(sym): + if sym.is_variable: lvars.append(SymValueWrapper(sym, None)) # Stop when the function itself is seen, to avoid showing