Skip to content

Commit f11109b

Browse files
committed
coredump: fix ruff warnings on gdbstuc scripts
This fixes ruff warnings on coredump gdbstuc scripts. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent db2b5ae commit f11109b

File tree

8 files changed

+12
-44
lines changed

8 files changed

+12
-44
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -137,36 +137,6 @@
137137
"./scripts/coredump/coredump_serial_log_parser.py" = [
138138
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
139139
]
140-
"./scripts/coredump/gdbstubs/arch/arm64.py" = [
141-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
142-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
143-
]
144-
"./scripts/coredump/gdbstubs/arch/arm_cortex_m.py" = [
145-
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
146-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
147-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
148-
]
149-
"./scripts/coredump/gdbstubs/arch/risc_v.py" = [
150-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
151-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
152-
]
153-
"./scripts/coredump/gdbstubs/arch/x86.py" = [
154-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
155-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
156-
]
157-
"./scripts/coredump/gdbstubs/arch/x86_64.py" = [
158-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
159-
"UP039", # https://docs.astral.sh/ruff/rules/unnecessary-class-parentheses
160-
]
161-
"./scripts/coredump/gdbstubs/arch/xtensa.py" = [
162-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
163-
"SIM113", # https://docs.astral.sh/ruff/rules/enumerate-for-loop
164-
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
165-
]
166-
"./scripts/coredump/gdbstubs/gdbstub.py" = [
167-
"E501", # https://docs.astral.sh/ruff/rules/line-too-long
168-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
169-
]
170140
"./scripts/dts/gen_defines.py" = [
171141
"B007", # https://docs.astral.sh/ruff/rules/unused-loop-control-variable
172142
"E501", # https://docs.astral.sh/ruff/rules/line-too-long

scripts/coredump/gdbstubs/arch/arm64.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from gdbstubs.gdbstub import GdbStub
1212

13-
1413
logger = logging.getLogger("gdbstub")
1514

1615

scripts/coredump/gdbstubs/arch/arm_cortex_m.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import struct
1010

1111
from coredump_parser.elf_parser import ThreadInfoOffset
12-
from gdbstubs.gdbstub import GdbStub
1312

13+
from gdbstubs.gdbstub import GdbStub
1414

1515
logger = logging.getLogger("gdbstub")
1616

@@ -179,7 +179,8 @@ def handle_thread_register_group_read_packet(self):
179179
)
180180
exc_return = int.from_bytes(exc_return_bytes, "little")
181181

182-
# If the bit 4 is not set, the stack frame is extended for floating point data, adjust the SP accordingly
182+
# If the bit 4 is not set, the stack frame is extended for floating point
183+
# data, adjust the SP accordingly
183184
if (exc_return & (1 << 4)) == 0:
184185
thread_registers[RegNum.SP] = thread_registers[RegNum.SP] + 72
185186

scripts/coredump/gdbstubs/arch/risc_v.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from gdbstubs.gdbstub import GdbStub
1212

13-
1413
logger = logging.getLogger("gdbstub")
1514

1615

scripts/coredump/gdbstubs/arch/x86.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
from gdbstubs.gdbstub import GdbStub
1414

15-
1615
logger = logging.getLogger("gdbstub")
1716

1817

scripts/coredump/gdbstubs/arch/x86_64.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
from gdbstubs.gdbstub import GdbStub
1414

15-
1615
logger = logging.getLogger("gdbstub")
1716

1817

scripts/coredump/gdbstubs/arch/xtensa.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import logging
99
import struct
1010
import sys
11-
1211
from enum import Enum
12+
1313
from gdbstubs.gdbstub import GdbStub
1414

1515
logger = logging.getLogger("gdbstub")
@@ -155,11 +155,11 @@ def parse_arch_data_block(self):
155155
arch_data_blk = self.logfile.get_arch_data()['data']
156156

157157
self.version = struct.unpack('H', arch_data_blk[1:3])[0]
158-
logger.debug("Xtensa GDB stub version: %d" % self.version)
158+
logger.debug(f"Xtensa GDB stub version: {self.version}")
159159

160160
# Get SOC and toolchain to get correct format for unpack
161161
self.soc = XtensaSoc(bytearray(arch_data_blk)[0])
162-
logger.debug("Xtensa SOC: %s" % self.soc.name)
162+
logger.debug(f"Xtensa SOC: {self.soc.name}")
163163

164164
if self.version >= 2:
165165
self.toolchain = XtensaToolchain(bytearray(arch_data_blk)[3])
@@ -173,7 +173,7 @@ def parse_arch_data_block(self):
173173
self.toolchain = XtensaToolchain.ZEPHYR
174174
arch_data_blk_regs = arch_data_blk[3:]
175175

176-
logger.debug("Xtensa toolchain: %s" % self.toolchain.name)
176+
logger.debug(f"Xtensa toolchain: {self.toolchain.name}")
177177

178178
self.gdb_reg_def = get_gdb_reg_definition(self.soc, self.toolchain)
179179

@@ -198,7 +198,7 @@ def map_registers(self, tu):
198198
if r == self.gdb_reg_def.RegNum.EXCCAUSE:
199199
self.exception_code = tu[i]
200200
self.registers[reg_num] = tu[i]
201-
i += 1
201+
i = i + 1
202202

203203
def compute_signal(self):
204204
sig = self.GDB_SIGNAL_DEFAULT

scripts/coredump/gdbstubs/gdbstub.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from coredump_parser.elf_parser import ThreadInfoOffset
1212

13-
1413
logger = logging.getLogger("gdbstub")
1514

1615

@@ -213,7 +212,8 @@ def handle_general_query_packet(self, pkt):
213212
thread_count += 1
214213
response += b"," + bytes(str(thread_count), 'ascii')
215214

216-
# Next walk the linked list, counting the number of threads and construct the response for qfThreadInfo along the way
215+
# Next walk the linked list, counting the number of threads and construct
216+
# the response for qfThreadInfo along the way
217217
t_next_thread_offset = self.elffile.get_kernel_thread_info_offset(
218218
ThreadInfoOffset.THREAD_INFO_OFFSET_T_NEXT_THREAD
219219
)
@@ -239,7 +239,8 @@ def handle_general_query_packet(self, pkt):
239239
elif pkt[0:12] == b"qsThreadInfo":
240240
self.put_gdb_packet(b"l")
241241

242-
# For qThreadExtraInfo, obtain a printable string description of thread attributes for the provided thread
242+
# For qThreadExtraInfo, obtain a printable string description of thread attributes for
243+
# the provided thread
243244
elif pkt[0:16] == b"qThreadExtraInfo":
244245
thread_info_bytes = b''
245246

0 commit comments

Comments
 (0)