This is an archive of the discontinued LLVM Phabricator instance.

Change to individual pretty printer classes, remove generic `make_printer`.
ClosedPublic

Authored by csigg on Jan 29 2020, 1:00 AM.

Diff Detail

Event Timeline

csigg created this revision.Jan 29 2020, 1:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2020, 1:00 AM

Unit tests: pass. 62283 tests passed, 0 failed and 827 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

csigg updated this revision to Diff 241360.Jan 30 2020, 12:40 AM

Rebase from master.

Unit tests: pass. 62322 tests passed, 0 failed and 838 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

dblaikie added inline comments.Feb 3 2020, 2:53 PM
llvm/utils/gdb-scripts/prettyprinters.py
321–324

I think I asked this elsewhere, but not sure there was an answer (apologies if I forgot - might be worth a comment) - what is this error case for? Are there types in LLVM that don't provide this expected nested type?

Might be nice if it could be removed & then wouldn't need the factory layer of indirection for PointerIntPair and PointerUnion below.

csigg marked an inline comment as done.Feb 4 2020, 1:03 PM
csigg added inline comments.
llvm/utils/gdb-scripts/prettyprinters.py
321–324

GDB gets confused about template arguments of 'std::_u::pair' (not sure I remember the exact name), and the lookup_type may fail.

Unfortunately GDB spews the console when a printer factory throws an exception, so it's better to catch it and handle it.

I will add a comment.

csigg updated this revision to Diff 243143.Feb 7 2020, 5:11 AM

Rebase from master.

dblaikie added inline comments.Feb 7 2020, 11:50 AM
llvm/utils/gdb-scripts/prettyprinters.py
321–324

Where does std::pair come into this? The 4th template argument to PointerIntPair is the PointerLikeTypeTraits, right?

csigg marked an inline comment as done.Feb 9 2020, 11:36 AM
csigg added inline comments.
llvm/utils/gdb-scripts/prettyprinters.py
321–324

It's zero-based, so it's the PointerIntPairInfo, and if PointerTy is a std::pair<...>* gdb fails to look up the type.

Something like that. Is it important enough to dig up the details?

dblaikie added inline comments.Feb 10 2020, 12:37 PM
llvm/utils/gdb-scripts/prettyprinters.py
321–324

Given the existence of this error path adds complexity to how this function is used, error paths to its callers, etc - yeah, I'd like to know why it's there & have a test case for it if it's needed (but hope there might be other solutions to addressing the underlying issue that might allow the error handling to be unnecessary/avoided), etc.

csigg updated this revision to Diff 249309.Mar 10 2020, 4:20 AM

Add test case for PointerUnion that cannot be pretty-printed.

csigg added a comment.Mar 10 2020, 4:25 AM

Hi David, I finally had time to get back to this and spend a few hours to root cause why some PointerUnions can't be pretty printed.
It was unrelated to std::__u::pair. The issue is that the PointerUnionUIntTraits may be invisible to the current GDB block if it's only been instanced in a different translation unit.
I've added a test case to show the issue.

dblaikie accepted this revision.Mar 10 2020, 2:23 PM

Dandy - thanks a bunch!

This revision is now accepted and ready to land.Mar 10 2020, 2:23 PM
This revision was automatically updated to reflect the committed changes.