]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/{testsuite,system-gdbinit}: import gdb module in Python scripts
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 29 Oct 2025 17:49:14 +0000 (13:49 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Oct 2025 16:15:13 +0000 (12:15 -0400)
commit0c830fc5745dcc4b57765602f9138759c6d09729
tree51d36bcd7591272fea8cbc0aad17daae0de0d6ad
parent3344d5a4aa77de344deaf45254f26f700676b41e
gdb/{testsuite,system-gdbinit}: import gdb module in Python scripts

Fix flake8 warnings like:

    gdb/system-gdbinit/wrs-linux.py:21:5: F821 undefined name 'gdb'

These scripts get executed in a context where the gdb module is already
loaded, so this is not strictly necessary.  However, adding these
imports removes a lot of red lines when editing these files in an IDE.
Without them, the code uses this `gdb` thing that appears to be
undefined.  Pylance is able to pull the module definition from typeshed
[1] and provide a good experience with typings.

[1] https://github.com/python/typeshed/tree/main/stubs/gdb/gdb

Change-Id: I09c6ae1866ef66f10d8270457771687343c84e32
Approved-By: Tom Tromey <tom@tromey.com>
27 files changed:
gdb/system-gdbinit/wrs-linux.py
gdb/testsuite/gdb.base/bp-disabled-by-cond.py
gdb/testsuite/gdb.base/frame-view.py
gdb/testsuite/gdb.base/reset-catchpoint-cond.py
gdb/testsuite/gdb.base/shlib-unload.py
gdb/testsuite/gdb.perf/backtrace.py
gdb/testsuite/gdb.perf/disassemble.py
gdb/testsuite/gdb.perf/single-step.py
gdb/testsuite/gdb.perf/skip-command.py
gdb/testsuite/gdb.perf/skip-prologue.py
gdb/testsuite/gdb.perf/solib.py
gdb/testsuite/gdb.perf/template-breakpoints.py
gdb/testsuite/gdb.python/pretty-print-call-by-hand.py
gdb/testsuite/gdb.python/py-auto-load-chaining-f1.o-gdb.py
gdb/testsuite/gdb.python/py-auto-load-chaining-f2.o-gdb.py
gdb/testsuite/gdb.python/py-color-leak.py
gdb/testsuite/gdb.python/py-corefile.py
gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.py
gdb/testsuite/gdb.python/py-finish-breakpoint.py
gdb/testsuite/gdb.python/py-finish-breakpoint2.py
gdb/testsuite/gdb.python/py-inferior-leak.py
gdb/testsuite/gdb.python/py-objfile-script-gdb.py
gdb/testsuite/gdb.python/py-read-memory-leak.py
gdb/testsuite/gdb.python/py-section-script.py
gdb/testsuite/gdb.python/py-watchpoint.py
gdb/testsuite/gdb.python/tui-window-factory.py
gdb/testsuite/gdb.server/fileio-packets.py