[Lldb-commits] [lldb] [lldb] Add support for sorting by size to `target module dump symtab` (PR #83527)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 4 10:22:46 PST 2024
================
@@ -138,6 +134,21 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder sort_order,
}
} break;
+ case eSortOrderBySize: {
+ s->PutCString(" (sorted by size):\n");
+ DumpSymbolHeader(s);
+
+ std::multimap<size_t, const Symbol *, std::greater<size_t>> size_map;
+ for (const Symbol &symbol : m_symbols)
+ size_map.emplace(symbol.GetByteSize(), &symbol);
+
+ for (const auto &size_to_symbol : size_map) {
+ const Symbol *symbol = size_to_symbol.second;
+ s->Indent();
+ symbol->Dump(s, target, symbol - &m_symbols[0], name_preference);
----------------
jasonmolenda wrote:
I don't have a strong opinion here but when it's sorted by address, the index is still sorted-ordering. This is showing the original symtab index numbers. I think it should show the sorted index ordering, if someone wants to correspond a symbol to the original symtab, they can search for the symbol name.
https://github.com/llvm/llvm-project/pull/83527
More information about the lldb-commits
mailing list