-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Fix debug info size statistics for split dwarf #80218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: None (jeffreytan81) Changes
New yaml tests are added. Patch is 62.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/80218.diff 8 Files Affected:
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index fed97858c83f8..7ab75a9ce2c6b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2667,6 +2667,29 @@ static bool UpdateCompilerContextForSimpleTemplateNames(TypeQuery &match) {
}
return any_context_updated;
}
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+ DWARFDebugInfo &info = DebugInfo();
+ uint32_t num_comp_units = info.GetNumUnits();
+
+ uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+ // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+ if (std::shared_ptr<SymbolFileDWARFDwo> dwp_sp = GetDwpSymbolFile())
+ return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+ // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+ for (uint32_t i = 0; i < num_comp_units; i++) {
+ DWARFUnit *cu = info.GetUnitAtIndex(i);
+ if (cu == nullptr)
+ continue;
+
+ SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+ if (dwo)
+ debug_info_size += dwo->GetDebugInfoSize();
+ }
+ return debug_info_size;
+}
+
void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
// Make sure we haven't already searched this SymbolFile before.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 26a9502f90aa0..6d87530acf833 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,6 +186,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
GetMangledNamesForFunction(const std::string &scope_qualified_name,
std::vector<ConstString> &mangled_names) override;
+ uint64_t GetDebugInfoSize() override;
+
void FindTypes(const lldb_private::TypeQuery &match,
lldb_private::TypeResults &results) override;
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ca698a84a9146..b52cb514fb190 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -85,6 +85,17 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
}
+uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
+ // Directly get debug info from current dwo object file's section list
+ // instead of asking SymbolFileCommon::GetDebugInfo() which parses from
+ // owning module which is wrong.
+ SectionList *section_list =
+ m_objfile_sp->GetSectionList(/*update_module_section_list=*/false);
+ if (section_list)
+ return section_list->GetDebugInfoSize();
+ return 0;
+}
+
bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
uint8_t op, const lldb_private::DataExtractor &opcodes,
lldb::offset_t &offset, std::vector<lldb_private::Value> &stack) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 9f5950e51b0c1..5c4b36328cbac 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,6 +47,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
const lldb::offset_t data_offset,
const uint8_t op) const override;
+ uint64_t GetDebugInfoSize() override;
+
bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
lldb::offset_t &offset,
std::vector<Value> &stack) const override;
diff --git a/lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py b/lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
new file mode 100644
index 0000000000000..ecb155d016a07
--- /dev/null
+++ b/lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
@@ -0,0 +1,133 @@
+"""
+Test SBTarget.GetStatistics() reporting for dwo files.
+"""
+
+import json
+import os
+
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test_event.build_exception import BuildError
+
+
+SKELETON_DEBUGINFO_SIZE = 602
+MAIN_DWO_DEBUGINFO_SIZE = 385
+FOO_DWO_DEBUGINFO_SIZE = 380
+
+
+class TestDebugInfoSize(lldbtest.TestBase):
+
+ def get_output_from_yaml(self):
+ exe = self.getBuildArtifact("a.out")
+ main_dwo = self.getBuildArtifact("a.out-main.dwo")
+ foo_dwo = self.getBuildArtifact("a.out-foo.dwo")
+
+ src_dir = self.getSourceDir()
+ exe_yaml_path = os.path.join(src_dir, "a.out.yaml")
+ self.yaml2obj(exe_yaml_path, exe)
+
+ main_dwo_yaml_path = os.path.join(src_dir, "a.out-main.dwo.yaml")
+ self.yaml2obj(main_dwo_yaml_path, main_dwo)
+
+ foo_dwo_yaml_path = os.path.join(src_dir, "a.out-foo.dwo.yaml")
+ self.yaml2obj(foo_dwo_yaml_path, foo_dwo)
+ return (exe, main_dwo, foo_dwo)
+
+ @add_test_categories(["dwo"])
+ def test_dwo(self):
+ (exe, main_dwo, foo_dwo) = self.get_output_from_yaml()
+
+ # Make sure dwo files exist
+ self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists')
+ self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists')
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, lldbtest.VALID_TARGET)
+
+ stats = target.GetStatistics()
+ stream = lldb.SBStream()
+ res = stats.GetAsJSON(stream)
+ debug_stats = json.loads(stream.GetData())
+ self.assertEqual(
+ "totalDebugInfoByteSize" in debug_stats,
+ True,
+ 'Make sure the "totalDebugInfoByteSize" key is in target.GetStatistics()',
+ )
+ self.assertEqual(
+ debug_stats["totalDebugInfoByteSize"],
+ SKELETON_DEBUGINFO_SIZE + MAIN_DWO_DEBUGINFO_SIZE + FOO_DWO_DEBUGINFO_SIZE,
+ )
+
+ @add_test_categories(["dwo"])
+ def test_only_load_skeleton_debuginfo(self):
+ (exe, main_dwo, foo_dwo) = self.get_output_from_yaml()
+
+ # REMOVE one of the dwo files
+ os.unlink(main_dwo)
+ os.unlink(foo_dwo)
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, lldbtest.VALID_TARGET)
+
+ stats = target.GetStatistics()
+ stream = lldb.SBStream()
+ res = stats.GetAsJSON(stream)
+ debug_stats = json.loads(stream.GetData())
+ self.assertEqual(
+ "totalDebugInfoByteSize" in debug_stats,
+ True,
+ 'Make sure the "totalDebugInfoByteSize" key is in target.GetStatistics()',
+ )
+ self.assertEqual(debug_stats["totalDebugInfoByteSize"], SKELETON_DEBUGINFO_SIZE)
+
+ @add_test_categories(["dwo"])
+ def test_load_partial_dwos(self):
+ (exe, main_dwo, foo_dwo) = self.get_output_from_yaml()
+
+ # REMOVE one of the dwo files
+ os.unlink(main_dwo)
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, lldbtest.VALID_TARGET)
+
+ stats = target.GetStatistics()
+ stream = lldb.SBStream()
+ res = stats.GetAsJSON(stream)
+ debug_stats = json.loads(stream.GetData())
+ self.assertEqual(
+ "totalDebugInfoByteSize" in debug_stats,
+ True,
+ 'Make sure the "totalDebugInfoByteSize" key is in target.GetStatistics()',
+ )
+ self.assertEqual(
+ debug_stats["totalDebugInfoByteSize"],
+ SKELETON_DEBUGINFO_SIZE + FOO_DWO_DEBUGINFO_SIZE,
+ )
+
+ @add_test_categories(["dwo"])
+ def test_dwos_loaded_symbols_on_demand(self):
+ (exe, main_dwo, foo_dwo) = self.get_output_from_yaml()
+
+ # Make sure dwo files exist
+ self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" file exists')
+ self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file exists')
+
+ # Load symbols on-demand
+ self.runCmd("settings set symbols.load-on-demand true")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, lldbtest.VALID_TARGET)
+
+ stats = target.GetStatistics()
+ stream = lldb.SBStream()
+ res = stats.GetAsJSON(stream)
+ debug_stats = json.loads(stream.GetData())
+ self.assertEqual(
+ "totalDebugInfoByteSize" in debug_stats,
+ True,
+ 'Make sure the "totalDebugInfoByteSize" key is in target.GetStatistics()',
+ )
+ self.assertEqual(
+ debug_stats["totalDebugInfoByteSize"],
+ SKELETON_DEBUGINFO_SIZE + MAIN_DWO_DEBUGINFO_SIZE + FOO_DWO_DEBUGINFO_SIZE,
+ )
diff --git a/lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml b/lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml
new file mode 100644
index 0000000000000..7a59fd67bc08b
--- /dev/null
+++ b/lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml
@@ -0,0 +1,37 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+ SectionHeaderStringTable: .strtab
+Sections:
+ - Name: .debug_str_offsets.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 180000000500000000000000040000000800000097000000F6000000
+ - Name: .debug_str.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x1
+ EntSize: 0x1
+ Content: 666F6F00696E740046616365626F6F6B20636C616E672076657273696F6E2031352E302E3020287373683A2F2F6769742E7669702E66616365626F6F6B2E636F6D2F646174612F6769747265706F732F6F736D6574612F65787465726E616C2F6C6C766D2D70726F6A656374203435616538646332373465366362636264343064353734353136643533343337393662653135323729002F686F6D652F6A65666672657974616E2F6C6C766D2D73616E642F65787465726E616C2F6C6C766D2D70726F6A6563742F6C6C64622F746573742F4150492F636F6D6D616E64732F7461726765742F6465627567696E666F2F666F6F2E6300612E6F75742D666F6F2E64776F00
+ - Name: .debug_info.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 2A0000000500050800000000495EA96AE5C99FC401021D00030402000B0000000156000003290000000301050400
+ - Name: .debug_abbrev.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 01110125251305032576250000022E00111B1206401803253A0B3B0B49133F19000003240003253E0B0B0B000000
+ - Type: SectionHeaderTable
+ Sections:
+ - Name: .strtab
+ - Name: .debug_str_offsets.dwo
+ - Name: .debug_str.dwo
+ - Name: .debug_info.dwo
+ - Name: .debug_abbrev.dwo
+...
diff --git a/lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml b/lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml
new file mode 100644
index 0000000000000..997158b8f918b
--- /dev/null
+++ b/lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml
@@ -0,0 +1,37 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+ SectionHeaderStringTable: .strtab
+Sections:
+ - Name: .debug_str_offsets.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 180000000500000000000000050000000900000098000000F8000000
+ - Name: .debug_str.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE, SHF_MERGE, SHF_STRINGS ]
+ AddressAlign: 0x1
+ EntSize: 0x1
+ Content: 6D61696E00696E740046616365626F6F6B20636C616E672076657273696F6E2031352E302E3020287373683A2F2F6769742E7669702E66616365626F6F6B2E636F6D2F646174612F6769747265706F732F6F736D6574612F65787465726E616C2F6C6C766D2D70726F6A656374203435616538646332373465366362636264343064353734353136643533343337393662653135323729002F686F6D652F6A65666672657974616E2F6C6C766D2D73616E642F65787465726E616C2F6C6C766D2D70726F6A6563742F6C6C64622F746573742F4150492F636F6D6D616E64732F7461726765742F6465627567696E666F2F6D61696E2E6300612E6F75742D6D61696E2E64776F00
+ - Name: .debug_info.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 2A000000050005080000000037AA38DE48449DD701021D00030402001C0000000156000103290000000301050400
+ - Name: .debug_abbrev.dwo
+ Type: SHT_PROGBITS
+ Flags: [ SHF_EXCLUDE ]
+ AddressAlign: 0x1
+ Content: 01110125251305032576250000022E00111B1206401803253A0B3B0B271949133F19000003240003253E0B0B0B000000
+ - Type: SectionHeaderTable
+ Sections:
+ - Name: .strtab
+ - Name: .debug_str_offsets.dwo
+ - Name: .debug_str.dwo
+ - Name: .debug_info.dwo
+ - Name: .debug_abbrev.dwo
+...
diff --git a/lldb/test/API/commands/target/debuginfo/a.out.yaml b/lldb/test/API/commands/target/debuginfo/a.out.yaml
new file mode 100644
index 0000000000000..95578c358f497
--- /dev/null
+++ b/lldb/test/API/commands/target/debuginfo/a.out.yaml
@@ -0,0 +1,1273 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+ Entry: 0x4F0
+ProgramHeaders:
+ - Type: PT_PHDR
+ Flags: [ PF_R ]
+ VAddr: 0x40
+ Align: 0x8
+ Offset: 0x40
+ - Type: PT_INTERP
+ Flags: [ PF_R ]
+ FirstSec: .interp
+ LastSec: .interp
+ VAddr: 0x238
+ Offset: 0x238
+ - Type: PT_LOAD
+ Flags: [ PF_X, PF_R ]
+ FirstSec: .interp
+ LastSec: .eh_frame
+ Align: 0x200000
+ Offset: 0x0
+ - Type: PT_LOAD
+ Flags: [ PF_W, PF_R ]
+ FirstSec: .init_array
+ LastSec: .bss
+ VAddr: 0x200DE0
+ Align: 0x200000
+ Offset: 0xDE0
+ - Type: PT_DYNAMIC
+ Flags: [ PF_W, PF_R ]
+ FirstSec: .dynamic
+ LastSec: .dynamic
+ VAddr: 0x200DF8
+ Align: 0x8
+ Offset: 0xDF8
+ - Type: PT_NOTE
+ Flags: [ PF_R ]
+ FirstSec: .note.ABI-tag
+ LastSec: .note.ABI-tag
+ VAddr: 0x254
+ Align: 0x4
+ Offset: 0x254
+ - Type: PT_GNU_EH_FRAME
+ Flags: [ PF_R ]
+ FirstSec: .eh_frame_hdr
+ LastSec: .eh_frame_hdr
+ VAddr: 0x69C
+ Align: 0x4
+ Offset: 0x69C
+ - Type: PT_GNU_STACK
+ Flags: [ PF_W, PF_R ]
+ Align: 0x10
+ Offset: 0x0
+ - Type: PT_GNU_RELRO
+ Flags: [ PF_R ]
+ FirstSec: .init_array
+ LastSec: .got
+ VAddr: 0x200DE0
+ Offset: 0xDE0
+Sections:
+ - Name: .interp
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x238
+ AddressAlign: 0x1
+ Content: 2F6C696236342F6C642D6C696E75782D7838362D36342E736F2E3200
+ - Name: .note.ABI-tag
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Address: 0x254
+ AddressAlign: 0x4
+ Notes:
+ - Name: GNU
+ Desc: '00000000030000000200000000000000'
+ Type: NT_VERSION
+ - Name: .gnu.hash
+ Type: SHT_GNU_HASH
+ Flags: [ SHF_ALLOC ]
+ Address: 0x278
+ Link: .dynsym
+ AddressAlign: 0x8
+ Header:
+ SymNdx: 0x1
+ Shift2: 0x0
+ BloomFilter: [ 0x0 ]
+ HashBuckets: [ 0x0 ]
+ HashValues: [ ]
+ - Name: .dynsym
+ Type: SHT_DYNSYM
+ Flags: [ SHF_ALLOC ]
+ Address: 0x298
+ Link: .dynstr
+ AddressAlign: 0x8
+ - Name: .dynstr
+ Type: SHT_STRTAB
+ Flags: [ SHF_ALLOC ]
+ Address: 0x328
+ AddressAlign: 0x1
+ - Name: .gnu.version
+ Type: SHT_GNU_versym
+ Flags: [ SHF_ALLOC ]
+ Address: 0x3A6
+ Link: .dynsym
+ AddressAlign: 0x2
+ Entries: [ 0, 1, 2, 1, 1, 2 ]
+ - Name: .gnu.version_r
+ Type: SHT_GNU_verneed
+ Flags: [ SHF_ALLOC ]
+ Address: 0x3B8
+ Link: .dynstr
+ AddressAlign: 0x8
+ Dependencies:
+ - Version: 1
+ File: libc.so.6
+ Entries:
+ - Name: GLIBC_2.2.5
+ Hash: 157882997
+ Flags: 0
+ Other: 2
+ - Name: .rela.dyn
+ Type: SHT_RELA
+ Flags: [ SHF_ALLOC ]
+ Address: 0x3D8
+ Link: .dynsym
+ AddressAlign: 0x8
+ Relocations:
+ - Offset: 0x200DE0
+ Type: R_X86_64_RELATIVE
+ Addend: 1488
+ - Offset: 0x200DE8
+ Type: R_X86_64_RELATIVE
+ Addend: 1424
+ - Offset: 0x200DF0
+ Type: R_X86_64_RELATIVE
+ Addend: 2100720
+ - Offset: 0x200FD8
+ Symbol: _ITM_deregisterTMCloneTable
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x200FE0
+ Symbol: __libc_start_main
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x200FE8
+ Symbol: __gmon_start__
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x200FF0
+ Symbol: _ITM_registerTMCloneTable
+ Type: R_X86_64_GLOB_DAT
+ - Offset: 0x200FF8
+ Symbol: __cxa_finalize
+ Type: R_X86_64_GLOB_DAT
+ - Name: .rela.plt
+ Type: SHT_RELA
+ Flags: [ SHF_ALLOC, SHF_INFO_LINK ]
+ Address: 0x498
+ Link: .dynsym
+ AddressAlign: 0x8
+ Info: .got.plt
+ Relocations:
+ - Offset: 0x201018
+ Symbol: __cxa_finalize
+ Type: R_X86_64_JUMP_SLOT
+ - Name: .init
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x4B0
+ AddressAlign: 0x4
+ Content: F30F1EFA4883EC08488B05290B20004885C07402FFD04883C408C3
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x4D0
+ AddressAlign: 0x10
+ EntSize: 0x10
+ Content: FF35320B2000FF25340B20000F1F4000FF25320B20006800000000E9E0FFFFFF
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x4F0
+ AddressAlign: 0x10
+ Content: F30F1EFA31ED4989D15E4889E24883E4F050544C8D0576010000488D0DFF000000488D3DC8000000FF15C20A2000F490488D3D010B2000488D05FA0A20004839F87415488B059E0A20004885C07409FFE00F1F8000000000C30F1F8000000000488D3DD10A2000488D35CA0A20004829FE48C1FE034889F048C1E83F4801C648D1FE7414488B05750A20004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D890A200000752B5548833D520A2000004889E5740C488D3D3E082000E829FFFFFFE864FFFFFFC605610A2000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFF0F1F8000000000554889E54883EC10C745FC00000000B000E80A0000004883C4105DC30F1F4000554889E5B8010000005DC30F1F440000F30F1EFA41574989D741564989F641554189FD41544C8D25B407200055488D2DB4072000534C29E54883EC08E86FFEFFFF48C1FD03741F31DB0F1F80000000004C89FA4C89F64489EF41FF14DC4883C3014839DD75EA4883C4085B5D415C415D415E415FC366662E...
[truncated]
|
✅ With the latest revision this PR passed the Python code formatter. |
FOO_DWO_DEBUGINFO_SIZE = 380 | ||
|
||
|
||
class TestDebugInfoSize(lldbtest.TestBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this just inside the class:
class TestDebugInfoSize(lldbtest.TestBase):
# Concurrency is the primary test factor here, not debug info variants.
NO_DEBUG_INFO_TESTCASE = True
This creates its own binaries and doesn't need to be run for all of the DWARF variants
if (cu == nullptr) | ||
continue; | ||
|
||
SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call will force the .dwo files to be loaded, even if they are not. I would suggest adding a default boolean parameter to this function in SymbolFileWARFDwo.h:
SymbolFileDWARFDwo *GetDwoSymbolFile(bool load_if_needed = true);
And then change the implementation to:
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile(bool load_if_needed) {
if (load_if_needed)
ExtractUnitDIEIfNeeded();
if (m_dwo)
return &llvm::cast<SymbolFileDWARFDwo>(m_dwo->GetSymbolFileDWARF());
return nullptr;
}
This way we won't end up pulling in all of the debug info just to answer the questions.
It all comes down to what we want to know from a call to SymbolFileDWARF::GetDebugInfoSize()
:
- total currently loaded debug info (then my suggestion above stands)
- total possible debug info size (ignore suggestion)
So I would suggest we figure this out and then document the SymbolFile::GetDebugInfoSize()
headerdoc appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes sense but I would leave that to @kusmour who is working on a follow-up patch to only load dwo files already loaded from "statistics dump".
stream = lldb.SBStream() | ||
res = stats.GetAsJSON(stream) | ||
debug_stats = json.loads(stream.GetData()) | ||
self.assertEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.assertIn
`statistics dump` command relies on `SymbolFile::GetDebugInfoSize()` to get total debug info size. The current implementation is missing debug info for split dwarf scenarios which requires getting debug info from separate dwo/dwp files. This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo. New yaml tests are added. --------- Co-authored-by: jeffreytan81 <[email protected]>
`statistics dump` command relies on `SymbolFile::GetDebugInfoSize()` to get total debug info size. The current implementation is missing debug info for split dwarf scenarios which requires getting debug info from separate dwo/dwp files. This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo. New yaml tests are added. --------- Co-authored-by: jeffreytan81 <[email protected]>
`statistics dump` command relies on `SymbolFile::GetDebugInfoSize()` to get total debug info size. The current implementation is missing debug info for split dwarf scenarios which requires getting debug info from separate dwo/dwp files. This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo. New yaml tests are added. --------- Co-authored-by: jeffreytan81 <[email protected]>
Add a new --summary option to statistics dump command so that it is much more light weight than the full version. Introduce a new SBStatisticsOptions API setting the verbosity of statistics dump. [PR #80218](#80218 (comment))
statistics dump
command relies onSymbolFile::GetDebugInfoSize()
to get total debug info size.The current implementation is missing debug info for split dwarf scenarios which requires getting debug info from separate dwo/dwp files.
This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo.
New yaml tests are added.