This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Improve display of absolute symbol lookup
ClosedPublic

Authored by alvinhochun on Sep 22 2022, 11:52 PM.

Details

Summary

When running target module lookup command, show the name of absolute
symbols. Also fix indentation issue after printing an absolute symbol.

Diff Detail

Event Timeline

alvinhochun created this revision.Sep 22 2022, 11:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 11:52 PM
alvinhochun requested review of this revision.Sep 22 2022, 11:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2022, 11:52 PM
DavidSpickett added a subscriber: DavidSpickett.
DavidSpickett added inline comments.
lldb/source/Commands/CommandObjectTarget.cpp
1552

Could you use the stream's indent here instead of " Foo:"? You can pass a number of spaces to pad void IndentMore(unsigned amount = 2);.

lldb/test/Shell/SymbolFile/absolute-symbol.test
4

This is my ignorance talking, but isn't it redundant to print the name given that it's shown in the match line?

Perhaps that lookup isn't exact and mangling or partial matches can lead to multiple matches in which case printing the line is very useful.

alvinhochun added inline comments.Sep 23 2022, 2:40 AM
lldb/source/Commands/CommandObjectTarget.cpp
1552

I was just following the pre-existing code below and also in DumpAddress. I do have some issues with the output of the lookup command when there are multiple results -- there is no separation between different results which makes the output a bit hard to parse (and is why I made a semi-related patch in D134111), perhaps we can try to improve it more in a separate change.

lldb/test/Shell/SymbolFile/absolute-symbol.test
4

The lookup command can use regex filters which does usually return multiple matches.

DavidSpickett accepted this revision.Sep 23 2022, 2:59 AM

LGTM

lldb/source/Commands/CommandObjectTarget.cpp
1552

Fair enough, I'd like it to be all stream.Indent but the result is the same so that's fine.

It mostly helps if you come back later and add another level within this, but that doesn't seem likely here.

This revision is now accepted and ready to land.Sep 23 2022, 2:59 AM
clayborg accepted this revision.Sep 23 2022, 1:00 PM

Thanks for fixing the issue!

This revision was automatically updated to reflect the committed changes.