From 3a96427b7a48054f7c8732e5fc7ed38e908ff824 Mon Sep 17 00:00:00 2001 From: Andreas Ziegler <andreas.ziegler@fau.de> Date: Mon, 7 Feb 2022 13:03:55 +0100 Subject: [PATCH] library, store, calls: fix some pylint warnings --- librarytrader/interface_calls.py | 10 +++++----- librarytrader/library.py | 2 +- librarytrader/librarystore.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/librarytrader/interface_calls.py b/librarytrader/interface_calls.py index 08c2ee6..3db4785 100644 --- a/librarytrader/interface_calls.py +++ b/librarytrader/interface_calls.py @@ -18,7 +18,6 @@ # along with librarytrader. If not, see <http://www.gnu.org/licenses/>. from bisect import bisect_right -from collections import defaultdict from distutils.spawn import find_executable import logging import multiprocessing @@ -29,7 +28,6 @@ import sys import time import capstone -from elftools.common.exceptions import ELFError from elftools.common.utils import parse_cstring_from_stream # In order to be able to use librarytrader from git without having installed it, @@ -138,7 +136,7 @@ def _locate_parameter(library, disas, start_idx, target_register, mem_tag): while idx > 0: idx -= 1 earlier_insn = disas[idx] - read, written = earlier_insn.regs_access() + _, written = earlier_insn.regs_access() if target_register not in written: continue elif earlier_insn.id != capstone.x86_const.X86_INS_LEA: @@ -146,7 +144,7 @@ def _locate_parameter(library, disas, start_idx, target_register, mem_tag): # Here we know it was a <lea ..., %rsi>, and these # accesses will mostly be RIP-relative on x86_64 so we only support # <lea xxx(%rip), %rsi> for now. - to, val = list(earlier_insn.operands) + _, val = list(earlier_insn.operands) if val.type == mem_tag and val.value.mem.base == capstone.x86.X86_REG_RIP: stroff = earlier_insn.address + val.value.mem.disp + earlier_insn.size # Does this need library._elffile.address_offsets()? @@ -178,7 +176,9 @@ def find_calls_from_capstone(library, disas): mem_tag = capstone.x86.X86_OP_MEM else: logging.error('Unsupported machine type: %s', library.elfheader['e_machine']) - return (calls_to_exports, calls_to_imports, calls_to_locals) + return (calls_to_exports, calls_to_imports, calls_to_locals, indirect_calls, + imported_object_refs, exported_object_refs, local_object_refs, + dlsym_refs, dlopen_refs) thunk_reg = None thunk_val = None diff --git a/librarytrader/library.py b/librarytrader/library.py index 42d79d1..15394cf 100644 --- a/librarytrader/library.py +++ b/librarytrader/library.py @@ -814,7 +814,7 @@ class Library: symbol_idx = reloc['r_info_sym'] symbol = dynsym.get_symbol(symbol_idx) symbol_offset = self._get_symbol_offset(symbol) - if symbol_offset not in self._fini_functions: + if symbol_offset not in self.fini_functions: self.fini_functions.append(symbol_offset) logging.debug('%s: relocation into fini: %x -> %s', self.fullname, real_offset, diff --git a/librarytrader/librarystore.py b/librarytrader/librarystore.py index d063f4e..de16ea9 100644 --- a/librarytrader/librarystore.py +++ b/librarytrader/librarystore.py @@ -192,8 +192,8 @@ class LibraryStore(BaseStore): return retval def get_executable_objects(self): - exclude_set = set(['libc\.so\.6', 'libpthread\.so\.0', - 'libc-2\.[0-9]+\.so', 'libpthread-2\.[0-9]+\.so']) + exclude_set = set([r'libc\.so\.6', r'libpthread\.so\.0', + r'libc-2\.[0-9]+\.so', r'libpthread-2\.[0-9]+\.so']) executables = [library for library in self.get_library_objects() if os.access(library.fullname, os.X_OK) and -- GitLab