This is an archive of the discontinued LLVM Phabricator instance.

[formatters] Improve documentation
ClosedPublic

Authored by wallace on Dec 17 2021, 3:01 PM.

Details

Summary

This adds some important remarks to the data formatter documentation.

Diff Detail

Event Timeline

wallace requested review of this revision.Dec 17 2021, 3:01 PM
wallace created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 17 2021, 3:01 PM

Please reflow your text to fit in the existing 80 col limit.

Those are useful tips, thanks!

lldb/docs/use/variable.rst
81

This is a nice example, but we should also/instead use an example with v for two reasons.

First, p is super overkill as a way to print a local variable called a_deque, v is the preferred tool.
Second, v actually understands synthetic children, so you can also do:

(lldb) v a_deque[0]

if you only want to see the first element, etc.

This can be convenient, and may not be as widely known.

jingham added inline comments.Dec 17 2021, 6:03 PM
lldb/docs/use/variable.rst
81

It also might be worth pointing out - since you have the example on hand - that the "size=5" bit of that display is the work of the summary formatter?

clayborg added inline comments.Dec 19 2021, 6:22 PM
lldb/docs/use/variable.rst
81

Yeah, p will invoke the expression parser and "v' is an alias to "frame variable". I would vote to just use "frame variable" instead of the "v" shortcut to make it more readable.

wallace updated this revision to Diff 397667.Jan 5 2022, 12:10 PM

per comments

kusmour accepted this revision.Jan 7 2022, 9:59 AM
This revision is now accepted and ready to land.Jan 7 2022, 9:59 AM