================
@@ -46,6 +48,107 @@ static bool ShouldDisplayAssemblySource(
   return false;
 }
 
+static uint64_t GetDebugInfoSizeInSection(lldb::SBSection section) {
+  uint64_t debug_info_size = 0;
+  const llvm::StringRef section_name(section.GetName());
+  if (section_name.starts_with(".debug") ||
+      section_name.starts_with("__debug") ||
+      section_name.starts_with(".apple") || 
section_name.starts_with("__apple"))
+    debug_info_size += section.GetFileByteSize();
+
+  const size_t num_sub_sections = section.GetNumSubSections();
+  for (size_t i = 0; i < num_sub_sections; i++) {
+    debug_info_size +=
+        GetDebugInfoSizeInSection(section.GetSubSectionAtIndex(i));
+  }
+  return debug_info_size;
+}
+
+static uint64_t GetDebugInfoSize(lldb::SBModule module) {
+  uint64_t debug_info_size = 0;
+  const size_t num_sections = module.GetNumSections();
+  for (size_t i = 0; i < num_sections; i++) {
+    debug_info_size += GetDebugInfoSizeInSection(module.GetSectionAtIndex(i));
+  }
----------------
JDevlieghere wrote:

```suggestion
  for (size_t i = 0; i < num_sections; i++)
    debug_info_size += GetDebugInfoSizeInSection(module.GetSectionAtIndex(i));
```

https://github.com/llvm/llvm-project/pull/146966
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to