This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Reduce duplication in the Disassembler class
ClosedPublic

Authored by labath on Mar 6 2020, 2:33 AM.

Details

Summary

The class has two pairs of functions whose functionalities differ in
only how one specifies how much he wants to disasseble. One limits the
process by the size of the input memory region. The other based on the
total amount of instructions disassembled. They also differ in various
features (like error reporting) that were only added to one of the
versions.

There are various ways in which this could be addressed. This patch
does it by introducing a helper struct called "Limit", which is
effectively a pair specifying the value that you want to limit, and the
actual limit itself.

Diff Detail

Event Timeline

labath created this revision.Mar 6 2020, 2:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2020, 2:33 AM
labath marked an inline comment as done.Mar 6 2020, 2:35 AM
labath added inline comments.
lldb/source/Commands/CommandObjectDisassemble.cpp
462–469

The idea is that further refactorings will change ranges from a vector<AddressRange> to a vector<pair<Address, Limit>> and this will become a simple ranged for loop.

This revision is now accepted and ready to land.Mar 6 2020, 9:55 AM
This revision was automatically updated to reflect the committed changes.