Jelajahi Sumber

LibDebug: Put DWARF debug logging spam behind DEBUG_SPAM

With this logging enabled, it takes way too long to load debug info.
Andreas Kling 5 tahun lalu
induk
melakukan
4a572df465
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      Libraries/LibDebug/DebugInfo.cpp

+ 8 - 0
Libraries/LibDebug/DebugInfo.cpp

@@ -30,6 +30,8 @@
 #include <LibDebug/Dwarf/DwarfInfo.h>
 #include <LibDebug/Dwarf/DwarfInfo.h>
 #include <LibDebug/Dwarf/Expression.h>
 #include <LibDebug/Dwarf/Expression.h>
 
 
+//#define DEBUG_SPAM
+
 DebugInfo::DebugInfo(NonnullRefPtr<const ELF::Loader> elf)
 DebugInfo::DebugInfo(NonnullRefPtr<const ELF::Loader> elf)
     : m_elf(elf)
     : m_elf(elf)
     , m_dwarf_info(Dwarf::DwarfInfo::create(m_elf))
     , m_dwarf_info(Dwarf::DwarfInfo::create(m_elf))
@@ -55,11 +57,15 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
             return;
             return;
 
 
         if (child.get_attribute(Dwarf::Attribute::Inline).has_value()) {
         if (child.get_attribute(Dwarf::Attribute::Inline).has_value()) {
+#ifdef DEBUG_SPAM
             dbg() << "DWARF inlined functions are not supported";
             dbg() << "DWARF inlined functions are not supported";
+#endif
             return;
             return;
         }
         }
         if (child.get_attribute(Dwarf::Attribute::Ranges).has_value()) {
         if (child.get_attribute(Dwarf::Attribute::Ranges).has_value()) {
+#ifdef DEBUG_SPAM
             dbg() << "DWARF ranges are not supported";
             dbg() << "DWARF ranges are not supported";
+#endif
             return;
             return;
         }
         }
         auto name = child.get_attribute(Dwarf::Attribute::Name);
         auto name = child.get_attribute(Dwarf::Attribute::Name);
@@ -70,7 +76,9 @@ void DebugInfo::parse_scopes_impl(const Dwarf::DIE& die)
             scope.name = name.value().data.as_string;
             scope.name = name.value().data.as_string;
 
 
         if (!child.get_attribute(Dwarf::Attribute::LowPc).has_value()) {
         if (!child.get_attribute(Dwarf::Attribute::LowPc).has_value()) {
+#ifdef DEBUG_SPAM
             dbg() << "DWARF: Couldn't find attribtue LowPc for scope";
             dbg() << "DWARF: Couldn't find attribtue LowPc for scope";
+#endif
             return;
             return;
         }
         }
         scope.address_low = child.get_attribute(Dwarf::Attribute::LowPc).value().data.as_u32;
         scope.address_low = child.get_attribute(Dwarf::Attribute::LowPc).value().data.as_u32;