Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 4, 2023
1 parent 0588a62 commit 664e833
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 6 additions & 2 deletions cle/backends/elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,9 @@ def _load_dies(self, dwarf: DWARFInfo):
self.type_list = type_list
self.compilation_units = compilation_units

def _load_die_lex_block(self, dwarf, die: DIE, expr_parser, type_list, cu, file_path, cu_low_pc: int, subprogram) -> LexicalBlock:
def _load_die_lex_block(
self, dwarf, die: DIE, expr_parser, type_list, cu, file_path, cu_low_pc: int, subprogram
) -> LexicalBlock:
if "DW_AT_name" in die.attributes:
name = die.attributes["DW_AT_name"].value.decode("utf-8")
else:
Expand All @@ -852,7 +854,9 @@ def _load_die_lex_block(self, dwarf, die: DIE, expr_parser, type_list, cu, file_
var.decl_file = file_path
subprogram.local_variables.append(var)
elif sub_die.tag == "DW_TAG_lexical_block":
sub_block = self._load_die_lex_block(dwarf, sub_die, expr_parser, type_list, cu, file_path, cu_low_pc, subprogram)
sub_block = self._load_die_lex_block(
dwarf, sub_die, expr_parser, type_list, cu, file_path, cu_low_pc, subprogram
)
if sub_block is not None:
block.child_blocks.append(sub_block)

Expand Down
8 changes: 5 additions & 3 deletions cle/backends/elf/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def __init__(self, elf_object: "ELF"):
self._location: Optional[List[Tuple[int, int, Optional[VariableLocation]]]] = None

@staticmethod
def from_die(die: DIE, expr_parser, elf_object: "ELF", dwarf, cu_low_pc: int, lexical_block: Optional["LexicalBlock"] = None):
def from_die(
die: DIE, expr_parser, elf_object: "ELF", dwarf, cu_low_pc: int, lexical_block: Optional["LexicalBlock"] = None
):
# first the address
var = None
if "DW_AT_location" in die.attributes:
Expand Down Expand Up @@ -153,11 +155,11 @@ def rebased_addr_from_cfa(self, cfa: int):
return self.rebased_addr

@property
def location(self) -> Optional[List[Tuple[int,int, Optional[VariableLocation]]]]:
def location(self) -> Optional[List[Tuple[int, int, Optional[VariableLocation]]]]:
if self._location is None:
return None
# rebase all addresses
locs = [ ]
locs = []
for lo, hi, vl in self._location:
tpl = AT.from_rva(lo, self._elf_object).to_mva(), AT.from_rva(hi, self._elf_object).to_mva(), vl
locs.append(tpl)
Expand Down

0 comments on commit 664e833

Please sign in to comment.