Skip to content

Conversation

@artemmukhin
Copy link
Member

@artemmukhin artemmukhin commented Nov 7, 2018

This PR adds Rc and Arc support to LLDB pretty-printers.

rc1

rc2

Merge after #3017.

@artemmukhin artemmukhin force-pushed the debugger-rc-arc branch 3 times, most recently from dd5bc92 to 28294a4 Compare November 13, 2018 11:02
Copy link
Member

@Undin Undin left a 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

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)
Copy link
Member

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

Copy link
Member

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)

Copy link
Member Author

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.

# type: (str) -> int
if name == "strong":
return 0
if name == "weak":
Copy link
Member

@Undin Undin Nov 24, 2018

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

Copy link
Member Author

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.

@Undin
Copy link
Member

Undin commented Nov 25, 2018

bors r+

bors bot added a commit that referenced this pull request Nov 25, 2018
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]>
@bors
Copy link
Contributor

bors bot commented Nov 25, 2018

@bors bors bot merged commit ce718d5 into intellij-rust:master Nov 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants