Skip to content

libcxx: In gdb test detect execute_mi with feature check instead of version check. #132291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

pcc
Copy link
Contributor

@pcc pcc commented Mar 20, 2025

The existing version check can lead to test failures on some distribution
packages of gdb where not all components of the version number are
integers, such as Fedora where gdb.VERSION can be something like
"15.2-4.fc41". Fix it by replacing the version check with a feature check.

pcc and others added 2 commits March 20, 2025 14:41
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
@pcc pcc requested a review from a team as a code owner March 20, 2025 21:41
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 20, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 20, 2025

@llvm/pr-subscribers-libcxx

Author: Peter Collingbourne (pcc)

Changes

The existing version check can lead to test failures on some distribution
packages of gdb where not all components of the version number are
integers, such as Fedora where gdb.VERSION can be something like
"15.2-4.fc41". Fix it by replacing the version check with a feature check.


Full diff: https://github.com/llvm/llvm-project/pull/132291.diff

1 Files Affected:

  • (modified) libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py (+1-1)
diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.py
index 254a61a8c633e..630b90c9d77a6 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 = tuple(map(int, gdb.VERSION.split("."))) >= (14, 2)
+has_execute_mi = 'execute_mi' in gdb.__dict__
 
 class CheckResult(gdb.Command):
     def __init__(self):

Copy link

github-actions bot commented Mar 20, 2025

✅ With the latest revision this PR passed the Python code formatter.

pcc added 5 commits March 20, 2025 15:12
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@pcc
Copy link
Contributor Author

pcc commented Apr 8, 2025

Ping @ldionne

@philnik777
Copy link
Contributor

Is it documented somewhere that you're allowed to use gdb.__dict__?

Created using spr 1.3.6-beta.1
@pcc
Copy link
Contributor Author

pcc commented Apr 8, 2025

I guess gdb.__dict__ may not correspond to the actual attributes on the object because GDB could start using a custom tp_getattro for that object, although that seems unlikely. I switched to checking the result of getattr which should be equivalent to checking whether gdb.execute_mi would result in an AttributeError.

@philnik777
Copy link
Contributor

It looks like your merge base is wrong.

@pcc
Copy link
Contributor Author

pcc commented Apr 9, 2025 via email

@philnik777
Copy link
Contributor

Could you not use spr in that case? I can't see the diff as it would be merged AFAICT.

@pcc
Copy link
Contributor Author

pcc commented Apr 9, 2025 via email

@mordante
Copy link
Member

mordante commented Apr 9, 2025

@philnik777 FWIW I also see a normal diff in the webui.

pcc added 2 commits April 9, 2025 20:17
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming the diff landed is the same I see. I'm really not a fan of complicating things unnecessarily though.

andjo403 and others added 2 commits April 10, 2025 10:37
Created using spr 1.3.6-beta.1

[skip ci]
Created using spr 1.3.6-beta.1
@pcc pcc changed the base branch from users/pcc/spr/main.libcxx-in-gdb-test-detect-execute_mi-with-feature-check-instead-of-version-check to main April 10, 2025 17:38
@pcc pcc merged commit a4e6a77 into main Apr 10, 2025
5 of 6 checks passed
@pcc pcc deleted the users/pcc/spr/libcxx-in-gdb-test-detect-execute_mi-with-feature-check-instead-of-version-check branch April 10, 2025 17:38
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Apr 10, 2025
…nstead of version check.

The existing version check can lead to test failures on some distribution
packages of gdb where not all components of the version number are
integers, such as Fedora where gdb.VERSION can be something like
"15.2-4.fc41". Fix it by replacing the version check with a feature check.

Reviewers: philnik777

Reviewed By: philnik777

Pull Request: llvm/llvm-project#132291
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
…ersion check.

The existing version check can lead to test failures on some distribution
packages of gdb where not all components of the version number are
integers, such as Fedora where gdb.VERSION can be something like
"15.2-4.fc41". Fix it by replacing the version check with a feature check.

Reviewers: philnik777

Reviewed By: philnik777

Pull Request: llvm#132291
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants