mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 02:48:37 +08:00
tools/gdb: register commands gracefully
Report any error and continue to try to register next command. Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
65a93e972c
commit
db9b5c4cee
1 changed files with 10 additions and 2 deletions
|
@ -49,10 +49,18 @@ def register_commands(event):
|
|||
gdb.write('"handle SIGUSR1 "nostop" "pass" "noprint"\n')
|
||||
|
||||
def init_gdb_commands(m: str):
|
||||
module = importlib.import_module(f"{__package__}.{m}")
|
||||
try:
|
||||
module = importlib.import_module(f"{__package__}.{m}")
|
||||
except Exception:
|
||||
gdb.write(f"\x1b[31;1mIgnore module: {m}\n\x1b[m")
|
||||
return
|
||||
|
||||
for c in module.__dict__.values():
|
||||
if isinstance(c, type) and issubclass(c, gdb.Command):
|
||||
c()
|
||||
try:
|
||||
c()
|
||||
except Exception:
|
||||
gdb.write(f"\x1b[31;1mIgnore command: {c}\n\x1b[m")
|
||||
|
||||
# import utils module
|
||||
utils = importlib.import_module(f"{__package__}.utils")
|
||||
|
|
Loading…
Reference in a new issue