1
0
Fork 0
forked from nuttx/nuttx-update

tools/gdb: init superclass in python3 code style

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-09-17 01:27:38 +08:00 committed by Xiang Xiao
parent 74bac56539
commit 68d47ee847
9 changed files with 25 additions and 29 deletions

View file

@ -26,7 +26,7 @@ CONFIG_RAMLOG_SYSLOG = utils.get_symbol_value("CONFIG_RAMLOG_SYSLOG")
class Dmesg(gdb.Command):
def __init__(self):
super(Dmesg, self).__init__("dmesg", gdb.COMMAND_USER)
super().__init__("dmesg", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
sysdev = utils.gdb_eval_or_none("g_sysdev")

View file

@ -145,9 +145,7 @@ class Fdinfo(gdb.Command):
"""Dump fd info information of process"""
def __init__(self):
super(Fdinfo, self).__init__(
"fdinfo", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION
)
super().__init__("fdinfo", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION)
def print_file_info(self, fd, file, formatter):
backtrace_formatter = "{0:<5} {1:<36} {2}"
@ -222,7 +220,7 @@ class Fdinfo(gdb.Command):
class Mount(gdb.Command):
def __init__(self):
super(Mount, self).__init__("mount", gdb.COMMAND_USER)
super().__init__("mount", gdb.COMMAND_USER)
def mountpt_filter(self, node, path):
if inode_gettype(node) == InodeType.MOUNTPT:
@ -239,7 +237,7 @@ class ForeachInode(gdb.Command):
"""Dump each inode info"""
def __init__(self):
super(ForeachInode, self).__init__("foreach_inode", gdb.COMMAND_USER)
super().__init__("foreach_inode", gdb.COMMAND_USER)
self.level = 4096
def get_root_inode(self, addr_or_expr):
@ -341,7 +339,7 @@ class InfoShmfs(gdb.Command):
"""Show share memory usage"""
def __init__(self):
super(InfoShmfs, self).__init__("info shm", gdb.COMMAND_USER)
super().__init__("info shm", gdb.COMMAND_USER)
def shm_filter(self, node, path):
if inode_gettype(node) != InodeType.SHM:

View file

@ -60,7 +60,7 @@ class NXGcore(gdb.Command):
if not self.tempfile:
return
super(NXGcore, self).__init__("nxgcore", gdb.COMMAND_USER)
super().__init__("nxgcore", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
try:

View file

@ -225,9 +225,7 @@ class ListCheck(gdb.Command):
"""Verify a list consistency"""
def __init__(self):
super(ListCheck, self).__init__(
"list_check", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION
)
super().__init__("list_check", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION)
def invoke(self, arg, from_tty):
argv = gdb.string_to_argv(arg)
@ -247,7 +245,7 @@ class ForeachListEntry(gdb.Command):
"""Dump list members for a given list"""
def __init__(self):
super(ForeachListEntry, self).__init__(
super().__init__(
"foreach_list_entry", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION
)

View file

@ -345,7 +345,7 @@ class Memdump(gdb.Command):
"""Dump the heap and mempool memory"""
def __init__(self):
super(Memdump, self).__init__("memdump", gdb.COMMAND_USER)
super().__init__("memdump", gdb.COMMAND_USER)
def check_alive(self, pid):
return self.pidhash[pid & self.npidhash - 1] != 0
@ -652,7 +652,7 @@ class Memleak(gdb.Command):
if not self.elf:
return
super(Memleak, self).__init__("memleak", gdb.COMMAND_USER)
super().__init__("memleak", gdb.COMMAND_USER)
def check_alive(self, pid):
return self.pidhash[pid & self.npidhash - 1] != 0
@ -906,7 +906,7 @@ class Memmap(gdb.Command):
if not self.np or not self.plt or not self.math:
return
super(Memmap, self).__init__("memmap", gdb.COMMAND_USER)
super().__init__("memmap", gdb.COMMAND_USER)
def save_memory_map(self, mallinfo, output_file):
mallinfo = sorted(mallinfo, key=lambda item: item["addr"])
@ -961,7 +961,7 @@ class Memmap(gdb.Command):
class Memfrag(gdb.Command):
def __init__(self):
super(Memfrag, self).__init__("memfrag", gdb.COMMAND_USER)
super().__init__("memfrag", gdb.COMMAND_USER)
def parse_arguments(self, argv):
parser = argparse.ArgumentParser(description="memfrag command")

View file

@ -112,7 +112,7 @@ class NetStats(gdb.Command):
"""
def __init__(self):
super(NetStats, self).__init__("netstats", gdb.COMMAND_USER)
super().__init__("netstats", gdb.COMMAND_USER)
def iob_stats(self):
try:

View file

@ -168,7 +168,7 @@ class StackUsage(gdb.Command):
"""Display the stack usage of each thread, similar to cat /proc/<pid>/stack"""
def __init__(self):
super(StackUsage, self).__init__("stack-usage", gdb.COMMAND_USER)
super().__init__("stack-usage", gdb.COMMAND_USER)
self._stacks = []
# format template
self._fmt = (

View file

@ -100,7 +100,7 @@ class SetRegs(gdb.Command):
"""
def __init__(self):
super(SetRegs, self).__init__("setregs", gdb.COMMAND_USER)
super().__init__("setregs", gdb.COMMAND_USER)
def invoke(self, arg, from_tty):
global regoffset
@ -161,7 +161,7 @@ class Nxinfothreads(gdb.Command):
"""Display information of all threads"""
def __init__(self):
super(Nxinfothreads, self).__init__("info nxthreads", gdb.COMMAND_USER)
super().__init__("info nxthreads", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
npidhash = gdb.parse_and_eval("g_npidhash")
@ -252,7 +252,7 @@ class Nxthread(gdb.Command):
"""Switch to a specified thread"""
def __init__(self):
super(Nxthread, self).__init__("nxthread", gdb.COMMAND_USER)
super().__init__("nxthread", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
npidhash = gdb.parse_and_eval("g_npidhash")
@ -329,7 +329,7 @@ class Nxcontinue(gdb.Command):
"""Restore the registers and continue the execution"""
def __init__(self):
super(Nxcontinue, self).__init__("nxcontinue", gdb.COMMAND_USER)
super().__init__("nxcontinue", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
restore_regs()
@ -340,7 +340,7 @@ class Nxstep(gdb.Command):
"""Restore the registers and step the execution"""
def __init__(self):
super(Nxstep, self).__init__("nxstep", gdb.COMMAND_USER)
super().__init__("nxstep", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
restore_regs()
@ -382,7 +382,7 @@ class TaskState(Enum):
class Ps(gdb.Command):
def __init__(self):
super(Ps, self).__init__("ps", gdb.COMMAND_USER)
super().__init__("ps", gdb.COMMAND_USER)
self._fmt_wxl = "{0: <{width}}"
# By default we align to the right, whcih respects the nuttx foramt
self._fmt_wx = "{0: >{width}}"
@ -550,7 +550,7 @@ class Ps(gdb.Command):
class DeadLock(gdb.Command):
def __init__(self):
super(DeadLock, self).__init__("deadlock", gdb.COMMAND_USER)
super().__init__("deadlock", gdb.COMMAND_USER)
def has_deadlock(self, pid):
"""Check if the thread has a deadlock"""

View file

@ -100,7 +100,7 @@ class ContainerOf(gdb.Function):
Note that TYPE and ELEMENT have to be quoted as strings."""
def __init__(self):
super(ContainerOf, self).__init__("container_of")
super().__init__("container_of")
def invoke(self, ptr, typename, elementname):
return container_of(
@ -294,7 +294,7 @@ class Hexdump(gdb.Command):
"""hexdump address/symbol <size>"""
def __init__(self):
super(Hexdump, self).__init__("hexdump", gdb.COMMAND_USER)
super().__init__("hexdump", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
args = shlex.split(args)
@ -325,7 +325,7 @@ class Addr2Line(gdb.Command):
"""
def __init__(self):
super(Addr2Line, self).__init__("addr2line", gdb.COMMAND_USER)
super().__init__("addr2line", gdb.COMMAND_USER)
def invoke(self, args, from_tty):
if not args:
@ -364,7 +364,7 @@ class Profile(gdb.Command):
if not self.cProfile:
return
super(Profile, self).__init__("profile", gdb.COMMAND_USER)
super().__init__("profile", gdb.COMMAND_USER)
def invoke(self, args, from_tty):