Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
elicn committed Feb 28, 2024
1 parent 67ca97c commit 96ebbc1
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions qiling/core_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from __future__ import annotations

from functools import wraps
from typing import Any, Callable, MutableMapping, MutableSequence, Protocol
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Protocol

from unicorn.unicorn_const import (
UC_HOOK_INTR,
Expand Down Expand Up @@ -152,14 +151,14 @@ class QlCoreHooks:
def __init__(self, uc: Uc):
self._h_uc = uc

self._hook: MutableMapping[int, MutableSequence[Hook]] = {}
self._hook_fuc: MutableMapping[int, int] = {}
self._hook: Dict[int, List[Hook]] = {}
self._hook_fuc: Dict[int, int] = {}

self._insn_hook: MutableMapping[int, MutableSequence[Hook]] = {}
self._insn_hook_fuc: MutableMapping[int, int] = {}
self._insn_hook: Dict[int, List[Hook]] = {}
self._insn_hook_fuc: Dict[int, int] = {}

self._addr_hook: MutableMapping[int, MutableSequence[HookAddr]] = {}
self._addr_hook_fuc: MutableMapping[int, int] = {}
self._addr_hook: Dict[int, List[HookAddr]] = {}
self._addr_hook_fuc: Dict[int, int] = {}

########################
# Callback definitions #
Expand Down Expand Up @@ -229,7 +228,7 @@ def _hook_trace_cb(self, uc: Uc, addr: int, size: int, pack_data) -> None:
if type(ret) is int and ret & QL_HOOK_BLOCK:
break

def _hook_mem_cb(self, uc: Uc, access: int, addr: int, size: int, value: int, pack_data):
def _hook_mem_cb(self, uc: Uc, access: int, addr: int, size: int, value: int, pack_data) -> bool:
"""Memory access hooks dispatcher.
"""

Expand Down Expand Up @@ -751,11 +750,11 @@ def clear_hooks(self):
self.clear_ql_hooks()

def clear_ql_hooks(self):
self._hook = {}
self._hook_fuc = {}
self._hook.clear()
self._hook_fuc.clear()

self._insn_hook = {}
self._insn_hook_fuc = {}
self._insn_hook.clear()
self._insn_hook_fuc.clear()

self._addr_hook = {}
self._addr_hook_fuc = {}
self._addr_hook.clear()
self._addr_hook_fuc.clear()

0 comments on commit 96ebbc1

Please sign in to comment.