-
Notifications
You must be signed in to change notification settings - Fork 383
Bundled pretty-printer for LLDB: Rc, Arc support #3024
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
dd5bc92 to
28294a4
Compare
Undin
left a comment
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.
Rebase onto master please
prettyPrinters/providers.py
Outdated
| if index == 1: | ||
| count = self.weak.GetValueAsSigned() | ||
| data = SBData.CreateDataFromUInt64Array(self.endianness, self.pointer_size, [count]) | ||
| return self.valobj.CreateValueFromData("weak", data, self.count_type) |
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.
It seems we should move code about usize to SBValue conversion into a separate function because we already have two similar pieces of code in this PR. Also, there is another one in #3037
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.
Probably, it should be a method of some new class because we also need to store process properties too (endianness and pointer_size)
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.
Good idea! I've created ValueBuilder for such needs.
prettyPrinters/providers.py
Outdated
| # type: (str) -> int | ||
| if name == "strong": | ||
| return 0 | ||
| if name == "weak": |
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.
Do we need strong and weak children at all? For example, formatter for C++ shared_ptr doesn't provide such children, only add them into summary
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.
Yes, C++ pretty-printer uses the interesting trick:
def num_children(self):
return 1
def get_child_at_index(self, index):
if index == 0: ...
if index == 1: ...
if index == 2: ...
So the synthtetic provider doesn't show the 1st and 2nd children, but summary provider can access (and show) these.
I will use it too.
b2e5364 to
8f12ae2
Compare
8f12ae2 to
ce718d5
Compare
|
bors r+ |
3024: Bundled pretty-printer for LLDB: Rc, Arc support r=Undin a=ortem This PR adds `Rc` and `Arc` support to LLDB pretty-printers. <img width="374" alt="rc1" src="https://user-images.githubusercontent.com/4854600/48424354-86958000-e773-11e8-971d-e0fdeeb2eadb.png"> <img width="334" alt="rc2" src="https://user-images.githubusercontent.com/4854600/48424355-86958000-e773-11e8-9d02-233e00ff62fb.png"> Merge after #3017. Co-authored-by: ortem <[email protected]>
This PR adds
RcandArcsupport to LLDB pretty-printers.Merge after #3017.