[v4,1/2] gdb, testsuite, python: Add missing imports.

Message ID 20240906093926.2133400-2-christina.schimpe@intel.com
State New
Headers
Series Remove MPX |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Schimpe, Christina Sept. 6, 2024, 9:39 a.m. UTC
  Removing the pretty printer (bound_registers.py) in the next commit
leads to failures due to a missing import of 'gdb.printing':

"AttributeError: module 'gdb' has no attribute 'printing'".

Add this import to each file requiring it, as it's not imported by the
pretty-printer anymore.

Approved-By: Andrew Burgess <aburgess@redhat.com>
---
 gdb/python/lib/gdb/dap/varref.py                | 1 +
 gdb/testsuite/gdb.python/py-pp-cast.py          | 1 +
 gdb/testsuite/gdb.python/py-pp-re-notag.py      | 2 +-
 gdb/testsuite/gdb.python/py-prettyprint-stub.py | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/python/lib/gdb/dap/varref.py b/gdb/python/lib/gdb/dap/varref.py
index 57e84a1676e..0dd98797086 100644
--- a/gdb/python/lib/gdb/dap/varref.py
+++ b/gdb/python/lib/gdb/dap/varref.py
@@ -18,6 +18,7 @@  from collections import defaultdict
 from contextlib import contextmanager
 
 import gdb
+import gdb.printing
 
 from .server import client_bool_capability
 from .startup import DAPException, in_gdb_thread
diff --git a/gdb/testsuite/gdb.python/py-pp-cast.py b/gdb/testsuite/gdb.python/py-pp-cast.py
index 6eff8008ebe..a0c48f9548a 100644
--- a/gdb/testsuite/gdb.python/py-pp-cast.py
+++ b/gdb/testsuite/gdb.python/py-pp-cast.py
@@ -13,6 +13,7 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import gdb.printing
 
 class PpIntPrinter(object):
     def __init__(self, val):
diff --git a/gdb/testsuite/gdb.python/py-pp-re-notag.py b/gdb/testsuite/gdb.python/py-pp-re-notag.py
index 6aefad13d85..3bbf5887084 100644
--- a/gdb/testsuite/gdb.python/py-pp-re-notag.py
+++ b/gdb/testsuite/gdb.python/py-pp-re-notag.py
@@ -16,7 +16,7 @@ 
 from time import asctime, gmtime
 
 import gdb  # silence pyflakes
-
+import gdb.printing
 
 class TimePrinter:
     def __init__(self, val):
diff --git a/gdb/testsuite/gdb.python/py-prettyprint-stub.py b/gdb/testsuite/gdb.python/py-prettyprint-stub.py
index 565ae192d20..75d5f35f164 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint-stub.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint-stub.py
@@ -16,6 +16,7 @@ 
 # This file is part of the GDB testsuite.
 # It tests Python-based pretty-printing of stubs.
 
+import gdb.printing
 
 class SPrinter:
     def __init__(self, val):