]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: remove unused "global" statements in Python files
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 29 Oct 2025 17:49:17 +0000 (13:49 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 30 Oct 2025 16:15:13 +0000 (12:15 -0400)
Fix the flake8 warnings of this type:

  gdb/testsuite/gdb.python/py-disasm.py:855:9: F824 `global current_pc` is unused: name is never assigned in scope

Change-Id: If492c69553cebea932cfb21e6fea26529761254c
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.base/inline-frame-cycle-unwind.py
gdb/testsuite/gdb.base/pc-not-saved.py
gdb/testsuite/gdb.base/shlib-unload.py
gdb/testsuite/gdb.python/py-disasm.py
gdb/testsuite/gdb.python/py-missing-debug.py
gdb/testsuite/gdb.python/py-missing-objfile.py
gdb/testsuite/gdb.python/py-unwind.py
gdb/testsuite/gdb.python/tui-window-disabled.py

index 4ab725761aa5eebbd6b571fef1713ee0f4ac983c..4eeb8985e1bb91cb5c5e7d8cf72141c7f4a40225 100644 (file)
@@ -46,9 +46,6 @@ class TestUnwinder(Unwinder):
         Unwinder.__init__(self, "stop at level")
 
     def __call__(self, pending_frame):
-        global stop_at_level
-        global stack_adjust
-
         if stop_at_level is None or pending_frame.level() != stop_at_level:
             return None
 
index b8bc361712e42e1a338d0f39012a6a08ffd10cea..e08f3c452b529bd731f90ea7b2924e7f563dad97 100644 (file)
@@ -60,7 +60,6 @@ class break_unwinding(Unwinder):
         if str(func) != "break_bt_here":
             return None
 
-        global break_bt_here_frame_id
         if break_bt_here_frame_id is None:
             return None
 
index 66ff7a594e3163250116f27fdd401361c6c0a0f8..464852b2acd46a921a04658954fd762808efb034 100644 (file)
@@ -24,7 +24,6 @@ bp_modified_counts = {}
 # Record breakpoint modification events into the global
 # bp_modified_counts dictionary.
 def bp_modified(bp):
-    global bp_modified_counts
     if bp.number not in bp_modified_counts:
         bp_modified_counts[bp.number] = 1
     else:
index 9761337550a345bd0b2e1144adc1cbed13d1202e..5ebc51f652a64f161bfb9501f86b0f37e5b6d435 100644 (file)
@@ -62,16 +62,12 @@ class TestDisassembler(Disassembler):
     disassembly wrapping for the global CURRENT_PC."""
 
     def __init__(self):
-        global current_pc
-
         super().__init__("TestDisassembler")
         self.__info = None
         if current_pc == None:
             raise gdb.GdbError("no current_pc set")
 
     def __call__(self, info):
-        global current_pc
-
         if info.address != current_pc:
             return None
         self.__info = info
@@ -618,8 +614,6 @@ class Build_Result_Using_All_Parts(TestDisassembler):
     text and address parts."""
 
     def disassemble(self, info):
-        global current_pc
-
         parts = []
         parts.append(info.text_part(gdb.disassembler.STYLE_MNEMONIC, "fake"))
         parts.append(info.text_part(gdb.disassembler.STYLE_TEXT, "\t"))
@@ -852,7 +846,6 @@ class InvalidDisassembleInfo(gdb.disassembler.DisassembleInfo):
 
     @property
     def address(self):
-        global current_pc
         return current_pc
 
     @property
index c018d4dc9b80e1968833049e4d949a825829c1b4..18d37ce0996704b8d017594592fd17496946b593 100644 (file)
@@ -38,7 +38,6 @@ class handler(MissingDebugHandler):
         self._mode = Mode.RETURN_NONE
 
     def __call__(self, objfile):
-        global handler_call_log
         handler_call_log.append(self.name)
         self._call_count += 1
         if self._mode == Mode.RETURN_NONE:
@@ -95,7 +94,6 @@ class exception_handler(MissingDebugHandler):
         self.exception_type = None
 
     def __call__(self, objfile):
-        global handler_call_log
         handler_call_log.append(self.name)
         assert self.exception_type is not None
         raise self.exception_type("message")
@@ -103,7 +101,6 @@ class exception_handler(MissingDebugHandler):
 
 class log_handler(MissingDebugHandler):
     def __call__(self, objfile):
-        global handler_call_log
         handler_call_log.append(self.name)
         return None
 
index 5efc36a2a92371f1a3490b433a9f0a7fb0078cd0..bdd7a599b636db5e426029f7b86324f8e076f895 100644 (file)
@@ -65,7 +65,7 @@ class handler(MissingObjfileHandler):
         self._mode = Mode.RETURN_NONE
 
     def __call__(self, pspace, buildid, filename):
-        global handler_call_log, handler_last_buildid, handler_last_filename
+        global handler_last_buildid, handler_last_filename
         check_args(pspace, buildid, filename)
         handler_call_log.append(self.name)
         handler_last_buildid = buildid
@@ -135,7 +135,6 @@ class exception_handler(MissingObjfileHandler):
         self.exception_type = None
 
     def __call__(self, pspace, buildid, filename):
-        global handler_call_log
         check_args(pspace, buildid, filename)
         handler_call_log.append(self.name)
         assert self.exception_type is not None
@@ -148,7 +147,6 @@ class exception_handler(MissingObjfileHandler):
 # then be checked from the test script.
 class log_handler(MissingObjfileHandler):
     def __call__(self, pspace, buildid, filename):
-        global handler_call_log
         check_args(pspace, buildid, filename)
         handler_call_log.append(self.name)
         return None
index 0faccf2ca13eb44ca739140098f481620919b626..183c6b1eb67c5895a2111c9e9f336917c6413706 100644 (file)
@@ -106,7 +106,6 @@ class TestUnwinder(Unwinder):
             unwind_info.add_saved_register(value=previous_ip, register="rip")
             unwind_info.add_saved_register(register="rsp", value=previous_sp)
 
-            global add_saved_register_errors
             try:
                 unwind_info.add_saved_register("nosuchregister", previous_sp)
             except ValueError as ve:
@@ -230,7 +229,6 @@ def capture_all_frame_information():
 # Assert that every entry in the global ALL_FRAME_INFORMATION list was
 # matched by the validating_unwinder.
 def check_all_frame_information_matched():
-    global all_frame_information
     for entry in all_frame_information:
         assert entry["matched"]
 
@@ -245,8 +243,6 @@ class validating_unwinder(Unwinder):
     def __call__(self, pending_frame):
         info = capture_frame_information(pending_frame)
         level = info["level"]
-
-        global all_frame_information
         old_info = all_frame_information[level]
 
         assert old_info is not None
index 8d140c4e2fe0040b62c1b26274e7e9a334865d68..2adde773ce8cf4125cf6869bdf9352ac20866a27 100644 (file)
@@ -46,9 +46,6 @@ class EventWindow:
         self._win.write("Hello world...")
 
     def close(self):
-        global cleanup_properly
-        global titles_at_the_close
-
         # Ensure that window properties can be read within the close method.
         titles_at_the_close[self._win.title] = dict(
             width=self._win.width, height=self._win.height
@@ -70,9 +67,6 @@ class EventWindow:
             self._exit_listener = None
 
     def _event(self, type, event):
-        global perform_valid_check
-        global update_title
-
         self._count += 1
         self._events.insert(0, type)
         if not perform_valid_check or self._win.is_valid():