[Lldb-commits] [PATCH] D83731: Add Debug Info Size to Symbol Status

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 13 16:51:40 PDT 2020


wallace requested changes to this revision.
wallace added a comment.
This revision now requires changes to proceed.

Please include a test case



================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:351-362
+      char debug_info_size[10];
+      if (debug_info < 1024) {
+        sprintf(debug_info_size, " (%lluKB)", debug_info);
+      } else if (debug_info < 1024*1024) {
+        debug_info = double(debug_info*10/1024);
+        sprintf(debug_info_size, " (%.1fKB)", double(debug_info/10));
+      } else if (debug_info < 1024*1024*1024) {
----------------
Move this logic to another function, so that this function is simpler


================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:356
+        debug_info = double(debug_info*10/1024);
+        sprintf(debug_info_size, " (%.1fKB)", double(debug_info/10));
+      } else if (debug_info < 1024*1024*1024) {
----------------
debug_info is int, thus, if you do `debug_info/10`, then the result with be an int rounded down. If you cast it to double, you'll have a double without decimals. The correct way to do is to do `double(debug_info) / 10`. 


================
Comment at: lldb/tools/lldb-vscode/JSONUtils.cpp:390
 
+uint64_t DebugInfoInSection(lldb::SBSection section) {
+  uint64_t section_size = 0;
----------------
This is a method, therefore it should start with a verb


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83731





More information about the lldb-commits mailing list