[PATCH] D74205: [WIP][llvm-dwarfdump] Add the --show-sections-sizes option

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 03:32:26 PST 2020


jhenderson added a comment.

What is the purpose of this new option. Why would something like llvm-size or llvm-readobj --section-headers not be sufficient?

Please make sure to add any new switches to the documentation contained at llvm/docs/CommandGuide/llvm-dwarfdump.rst.

This seems to only calculate the sizes of a fairly limited selection of DWARF sections. Why not just do it for all .debug_* sections?



================
Comment at: llvm/tools/llvm-dwarfdump/SectionsSizes.cpp:1
+//===- SectionsSizes.cpp ---------------------------------------- *- C++ *-===//
+//
----------------
I'd rename this file to "SectionSizes.cpp"


================
Comment at: llvm/tools/llvm-dwarfdump/SectionsSizes.cpp:19
+/// Holds cumulative section sizes for an object file.
+struct SectionsSizes {
+  /// Total number of bytes of the object file.
----------------
`SectionsSizes` -> `SectionSizes`


================
Comment at: llvm/tools/llvm-dwarfdump/SectionsSizes.cpp:21
+  /// Total number of bytes of the object file.
+  /// This includes .text,.data, .bss and all .debug_* sections.
+  uint64_t TotalObjectSize = 0;
----------------
Nit: missing space after comma.


================
Comment at: llvm/tools/llvm-dwarfdump/SectionsSizes.cpp:148
+  if (!calculateSizes(Obj, Sizes)) {
+    WithColor::error() << " \n";
+    exit(1);
----------------
This will just print "error: ", which is not useful. Have calculateSizes and this function return an llvm::Error and use that to print a more useful error message much further up the stack by using the llvm-dwarfdump.cpp `error` function.


================
Comment at: llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp:213
+    ShowSecSizes("show-sections-sizes",
+                 cl::desc("Show the sizes of the .debug_* sections."),
+                 cat(DwarfDumpCategory));
----------------
of the .debug_* -> of all .debug_*


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74205/new/

https://reviews.llvm.org/D74205





More information about the llvm-commits mailing list