-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[lldb] Fix object format in the Triple of Mach-O files (approach 4) #145157
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
Changes from all commits
a9931d4
1e11372
d2514d7
d6878b1
2278c19
3ea1296
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -463,6 +463,27 @@ class Triple { | |||
|
|
||||
| const std::string &str() const { return Data; } | ||||
|
|
||||
| /// Return the triple string but only keep the first \p N components. | ||||
| /// | ||||
| /// The returned string will preserve the first \p N components exactly the | ||||
| /// same as the original (including the leading "-" and the value, empty or | ||||
| /// not). | ||||
| /// | ||||
| /// E.g. Triple("arm64-apple-ios").str(5) == "arm64-apple-ios" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(5) == "arm64-apple-ios--" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(4) == "arm64-apple-ios-" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(3) == "arm64-apple-ios" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(2) == "arm64-apple" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(1) == "arm64" | ||||
| /// E.g. Triple("arm64-apple-ios--").str(0) == "" | ||||
| /// | ||||
| /// This method does not normalize any triple strings. Clients that need to | ||||
| /// handle the non-canonical triples that users often specify should use the | ||||
| /// normalize method. | ||||
| /// | ||||
| /// \returns the (shorterned) triple string. | ||||
| StringRef str(size_t N) const; | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we already have this capability in the
For the use cases in this PR we could do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference between this new method From method doc of
So I think The use cases in this PR doesn't call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@clayborg / @jasonmolenda: Do you see a downside of what @dmpots suggested? @dmpots had a good point in offline discussion that these are for display in LLDB, so it maybe preferred that they are normalized. I agree with that, but I'm just not sure if that will change thing that you guys end up not like (similar to how I initially made the objfmt component to show up in the triple string). |
||||
|
|
||||
| const std::string &getTriple() const { return Data; } | ||||
|
|
||||
| /// Whether the triple is empty / default constructed. | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to add a couple of methods to
ArchSpecso that we have a single place that specifies how we format the triple.Then if we have an
ArchSpecwe can just call theGetTripleStr()function on it and if we just have theTriplewe can still use the static version.