tools: add type information

Additional information here:
- no code logic change, just add type hint
- make the code easy to work with
- minor python3 requirement without any complex type feature

Signed-off-by: renweibo <renweibo@xiaomi.com>
This commit is contained in:
renweibo
2023-04-10 11:04:55 +08:00
committed by Xiang Xiao
parent 0d39246b4e
commit f3208c1def
+4 -4
View File
@@ -48,7 +48,7 @@ class dump_elf_file:
and can be retrieved from the ELF file.
"""
def __init__(self, elffile):
def __init__(self, elffile: str):
self.elffile = elffile
self.fd = None
self.elf = None
@@ -210,7 +210,7 @@ reg_table = {
class dump_log_file:
def __init__(self, logfile):
def __init__(self, logfile: str):
self.logfile = logfile
self.fd = None
self.arch = ""
@@ -311,7 +311,7 @@ GDB_SIGNAL_DEFAULT = 7
class gdb_stub:
def __init__(self, logfile, elffile):
def __init__(self, logfile: dump_log_file, elffile: dump_elf_file):
self.logfile = logfile
self.elffile = elffile
self.socket = None
@@ -470,7 +470,7 @@ class gdb_stub:
def handle_general_query_packet(self, pkt):
self.put_gdb_packet(b"")
def run(self, socket):
def run(self, socket: socket.socket):
self.socket = socket
while True: