mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
Fix some minor style problems
This commit is contained in:
parent
a7448f4ce6
commit
32974c3c98
@ -108,6 +108,7 @@ def main() -> None:
|
||||
symbols = parse_symbol_file(f)
|
||||
|
||||
core_reader = CoreReader('/proc/kcore')
|
||||
|
||||
def lookup_variable(name: str) -> Tuple[int, Type]:
|
||||
address = symbols[name][-1]
|
||||
dwarf_type = dwarf_index.find(name, DW_TAG.variable).type()
|
||||
|
@ -18,7 +18,6 @@ class _State(enum.IntEnum):
|
||||
RBRACKET = 5
|
||||
|
||||
|
||||
|
||||
_TOKEN_REGEX = re.compile('|'.join('(?P<%s>%s)' % pair for pair in [
|
||||
('IDENTIFIER', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||
('NUMBER', r'(?:0x)?[0-9]+'),
|
||||
|
@ -723,7 +723,7 @@ class EnumType(Type):
|
||||
def __init__(self, name: Optional[str], type: Optional[IntType],
|
||||
enumerators: Optional[List[Tuple[str, int]]],
|
||||
qualifiers: FrozenSet[str] = frozenset()) -> None:
|
||||
if type is None != enumerators is None:
|
||||
if (type is None) != (enumerators is None):
|
||||
raise ValueError('incomplete enum type must not have type or enumerators')
|
||||
super().__init__(qualifiers)
|
||||
self.name = name
|
||||
@ -922,7 +922,7 @@ class PointerType(Type):
|
||||
super().__init__(qualifiers)
|
||||
self.size = size
|
||||
self.type = type
|
||||
setattr(self, 'read',_INT_READ[size, False])
|
||||
setattr(self, 'read', _INT_READ[size, False])
|
||||
|
||||
def __repr__(self) -> str:
|
||||
parts = [
|
||||
|
@ -212,7 +212,7 @@ class _TypeNameParser:
|
||||
elif size is not None:
|
||||
raise _TypeNameParser._specifier_error(size, specifier)
|
||||
if (data_type is not None and data_type != 'int' and
|
||||
(data_type != 'double' or specifier != 'long')):
|
||||
(data_type != 'double' or specifier != 'long')):
|
||||
raise _TypeNameParser._specifier_error(data_type, specifier)
|
||||
specifiers['size'] = specifier
|
||||
elif specifier == 'signed' or specifier == 'unsigned':
|
||||
@ -256,7 +256,7 @@ class _TypeNameParser:
|
||||
# First, the sign specifier. "signed" is the default for "int", so
|
||||
# omit it.
|
||||
if ('sign' in specifiers and
|
||||
(specifiers['sign'] != 'signed' or data_type != 'int')):
|
||||
(specifiers['sign'] != 'signed' or data_type != 'int')):
|
||||
parts.append(specifiers['sign'])
|
||||
# Then, the size specifier.
|
||||
if 'size' in specifiers:
|
||||
@ -348,7 +348,7 @@ class _TypeNameParser:
|
||||
self._lexer.pop()
|
||||
token2 = self._lexer.peek()
|
||||
if (token2.kind == 'ASTERISK' or token2.kind == 'LPAREN' or
|
||||
token2.kind == 'LBRACKET'):
|
||||
token2.kind == 'LBRACKET'):
|
||||
type_name, inner_type = self._parse_abstract_declarator(type_name)
|
||||
if self._lexer.pop().kind != 'RPAREN':
|
||||
raise ValueError("expected ')'")
|
||||
|
Loading…
Reference in New Issue
Block a user