forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 341
Add the new "parsed cmd" from llvm mainline to 2030725 #8204
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
Merged
jimingham
merged 8 commits into
swiftlang:stable/20230725
from
jimingham:parsed-cmd-for-2030725
Feb 16, 2024
Merged
Add the new "parsed cmd" from llvm mainline to 2030725 #8204
jimingham
merged 8 commits into
swiftlang:stable/20230725
from
jimingham:parsed-cmd-for-2030725
Feb 16, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch moves the template files for the various scripting affordances to a separate directory. This is a preparatory work for upcoming improvements and consolidations to other scripting affordances. Differential Revision: https://reviews.llvm.org/D159310 Signed-off-by: Med Ismail Bennani <[email protected]> (cherry picked from commit 6bff2d5)
…ectParsed (llvm#70734) This allows you to specify options and arguments and their definitions and then have lldb handle the completions, help, etc. in the same way that lldb does for its parsed commands internally. This feature has some design considerations as well as the code, so I've also set up an RFC, but I did this one first and will put the RFC address in here once I've pushed it... Note, the lldb "ParsedCommand interface" doesn't actually do all the work that it should. For instance, saying the type of an option that has a completer doesn't automatically hook up the completer, and ditto for argument values. We also do almost no work to verify that the arguments match their definition, or do auto-completion for them. This patch allows you to make a command that's bug-for-bug compatible with built-in ones, but I didn't want to stall it on getting the auto-command checking to work all the way correctly. As an overall design note, my primary goal here was to make an interface that worked well in the script language. For that I needed, for instance, to have a property-based way to get all the option values that were specified. It was much more convenient to do that by making a fairly bare-bones C interface to define the options and arguments of a command, and set their values, and then wrap that in a Python class (installed along with the other bits of the lldb python module) which you can then derive from to make your new command. This approach will also make it easier to experiment. See the file test_commands.py in the test case for examples of how this works. (cherry picked from commit a69ecb2)
why it's crashing on the x86_64 Debian Linux worker. (cherry picked from commit f0b271e)
The Linux std has more asserts enabled by default, so it complained, even though this worked on Darwin... (cherry picked from commit 3647ff1)
When the parsed command python code is run on 3.9, I get: File ".../lib/python3.9/site-packages/lldb/plugins/parsed_cmd.py", line 124, in translate_value return cls.translators[value_type](value) TypeError: 'staticmethod' object is not callable But this works correctly in Python 3.10 on macOS and Linux. I'm guessing something changed between those versions, and I'll have to do something to work around the difference. But I'm going to skip the test on 3.9 while I figure that out. (cherry picked from commit 1ec8197)
Python3.9 does not allow you to put a reference to a class staticmethod in a table and call it from there. Python3.10 and following do allow this, but we still support 3.9. staticmethod was slightly cleaner, but this will do. (cherry picked from commit 22d2f3a)
This comes from a larger patch (f22d82c) but I don't want to try to incorporate that, so I'm just copying this bit in.
@swift-ci please test |
JDevlieghere
approved these changes
Feb 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently added the ability to define commands from Python that use the lldb command parser. That allows lldb to do completion on the arguments and options, and it makes help consistent with lldb help.
This PR is what we need to cherry-pick that feature onto the stable/20230725 branch.