[llvm-branch-commits] [libcxx] libcxx: In gdb test detect execute_mi with feature check instead of version check. (PR #132291)

Peter Collingbourne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 10 10:38:06 PDT 2025


https://github.com/pcc updated https://github.com/llvm/llvm-project/pull/132291

>From 89ce369ab9b49b8c23a87ad0a888002dd85c094c Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc at google.com>
Date: Thu, 20 Mar 2025 15:12:39 -0700
Subject: [PATCH 1/2] Format

Created using spr 1.3.6-beta.1
---
 libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
index 630b90c9d77a6..927f8958f4b43 100644
--- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
+++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
@@ -30,7 +30,8 @@
 # we exit.
 has_run_tests = False
 
-has_execute_mi = 'execute_mi' in gdb.__dict__
+has_execute_mi = "execute_mi" in gdb.__dict__
+
 
 class CheckResult(gdb.Command):
     def __init__(self):

>From da2f682a8f1a1af58fbe85f760e1844c808b8093 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc at google.com>
Date: Tue, 8 Apr 2025 13:21:06 -0700
Subject: [PATCH 2/2] Use getattr instead

Created using spr 1.3.6-beta.1
---
 libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
index 927f8958f4b43..da09092b690c4 100644
--- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
+++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
@@ -30,7 +30,7 @@
 # we exit.
 has_run_tests = False
 
-has_execute_mi = "execute_mi" in gdb.__dict__
+has_execute_mi = getattr(gdb, "execute_mi", None) is not None
 
 
 class CheckResult(gdb.Command):



More information about the llvm-branch-commits mailing list