Skip to content

Commit 339baae

Browse files
authored
Revert "Report only loaded debug info in statistics dump (#81706)" (#82150)
This reverts commit 21ddd7f because it breaks a bunch of tests: https://lab.llvm.org/buildbot/#/builders/68/builds/69018 https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/16273
1 parent 5c96e71 commit 339baae

24 files changed

+21
-346
lines changed

lldb/bindings/interface/SBStatisticsOptionsDocstrings.i

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,3 @@
66
) lldb::SBStatisticsOptions::SetSummaryOnly;
77
%feature("docstring", "Gets whether the statistics only dump a summary."
88
) lldb::SBStatisticsOptions::GetSummaryOnly;
9-
%feature("docstring", "
10-
Sets whether the statistics will force loading all possible debug info."
11-
) lldb::SBStatisticsOptions::SetReportAllAvailableDebugInfo;
12-
%feature("docstring", "
13-
Gets whether the statistics will force loading all possible debug info."
14-
) lldb::SBStatisticsOptions::GetReportAllAvailableDebugInfo;

lldb/include/lldb/API/SBStatisticsOptions.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ class LLDB_API SBStatisticsOptions {
2525
void SetSummaryOnly(bool b);
2626
bool GetSummaryOnly();
2727

28-
/// If set to true, the debugger will load all debug info that is available
29-
/// and report statistics on the total amount. If this is set to false, then
30-
/// only report statistics on the currently loaded debug information.
31-
/// This can avoid loading debug info from separate files just so it can
32-
/// report the total size which can slow down statistics reporting.
33-
void SetReportAllAvailableDebugInfo(bool b);
34-
bool GetReportAllAvailableDebugInfo();
35-
3628
protected:
3729
friend class SBTarget;
3830
const lldb_private::StatisticsOptions &ref() const;

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ class SymbolFile : public PluginInterface {
381381

382382
/// Metrics gathering functions
383383

384-
/// Return the size in bytes of all loaded debug information or total possible
385-
/// debug info in the symbol file.
384+
/// Return the size in bytes of all debug information in the symbol file.
386385
///
387386
/// If the debug information is contained in sections of an ObjectFile, then
388387
/// this call should add the size of all sections that contain debug
@@ -392,14 +391,7 @@ class SymbolFile : public PluginInterface {
392391
/// entire file should be returned. The default implementation of this
393392
/// function will iterate over all sections in a module and add up their
394393
/// debug info only section byte sizes.
395-
///
396-
/// \param load_all_debug_info
397-
/// If true, force loading any symbol files if they are not yet loaded and
398-
/// add to the total size. Default to false.
399-
///
400-
/// \returns
401-
/// Total currently loaded debug info size in bytes
402-
virtual uint64_t GetDebugInfoSize(bool load_all_debug_info = false) = 0;
394+
virtual uint64_t GetDebugInfoSize() = 0;
403395

404396
/// Return the time taken to parse the debug information.
405397
///
@@ -542,7 +534,7 @@ class SymbolFileCommon : public SymbolFile {
542534

543535
void Dump(Stream &s) override;
544536

545-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
537+
uint64_t GetDebugInfoSize() override;
546538

547539
bool GetDebugInfoIndexWasLoadedFromCache() const override {
548540
return m_index_was_loaded_from_cache;

lldb/include/lldb/Symbol/SymbolFileOnDemand.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class SymbolFileOnDemand : public lldb_private::SymbolFile {
178178

179179
void PreloadSymbols() override;
180180

181-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
181+
uint64_t GetDebugInfoSize() override;
182182
lldb_private::StatsDuration::Duration GetDebugInfoParseTime() override;
183183
lldb_private::StatsDuration::Duration GetDebugInfoIndexTime() override;
184184

lldb/include/lldb/Target/Statistics.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ struct ConstStringStats {
132132

133133
struct StatisticsOptions {
134134
bool summary_only = false;
135-
bool load_all_debug_info = false;
136135
};
137136

138137
/// A class that represents statistics for a since lldb_private::Target.

lldb/source/API/SBStatisticsOptions.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ void SBStatisticsOptions::SetSummaryOnly(bool b) {
4444

4545
bool SBStatisticsOptions::GetSummaryOnly() { return m_opaque_up->summary_only; }
4646

47-
void SBStatisticsOptions::SetReportAllAvailableDebugInfo(bool b) {
48-
m_opaque_up->load_all_debug_info = b;
49-
}
50-
51-
bool SBStatisticsOptions::GetReportAllAvailableDebugInfo() {
52-
return m_opaque_up->load_all_debug_info;
53-
}
54-
5547
const lldb_private::StatisticsOptions &SBStatisticsOptions::ref() const {
5648
return *m_opaque_up;
5749
}

lldb/source/Commands/CommandObjectStats.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ class CommandObjectStatsDump : public CommandObjectParsed {
7878
case 's':
7979
m_stats_options.summary_only = true;
8080
break;
81-
case 'f':
82-
m_stats_options.load_all_debug_info = true;
83-
break;
8481
default:
8582
llvm_unreachable("Unimplemented option");
8683
}

lldb/source/Commands/Options.td

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,10 +1419,6 @@ let Command = "statistics dump" in {
14191419
def statistics_dump_all: Option<"all-targets", "a">, Group<1>,
14201420
Desc<"Include statistics for all targets.">;
14211421
def statistics_dump_summary: Option<"summary", "s">, Group<1>,
1422-
Desc<"Dump only high-level summary statistics. "
1422+
Desc<"Dump only high-level summary statistics."
14231423
"Exclude targets, modules, breakpoints etc... details.">;
1424-
def statistics_dump_force: Option<"load-all-debug-info", "f">, Group<1>,
1425-
Desc<"Dump the total possible debug info statistics. "
1426-
"Force loading all the debug information if not yet loaded, and collect "
1427-
"statistics with those.">;
14281424
}

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ void SymbolFileBreakpad::ParseUnwindData() {
918918
m_unwind_data->win.Sort();
919919
}
920920

921-
uint64_t SymbolFileBreakpad::GetDebugInfoSize(bool load_all_debug_info) {
921+
uint64_t SymbolFileBreakpad::GetDebugInfoSize() {
922922
// Breakpad files are all debug info.
923923
return m_objfile_sp->GetByteSize();
924924
}

lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class SymbolFileBreakpad : public SymbolFileCommon {
141141

142142
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
143143

144-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
144+
uint64_t GetDebugInfoSize() override;
145145

146146
private:
147147
// A class representing a position in the breakpad file. Useful for

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -896,9 +896,8 @@ void DWARFUnit::ComputeAbsolutePath() {
896896
m_file_spec->MakeAbsolute(GetCompilationDirectory());
897897
}
898898

899-
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile(bool load_all_debug_info) {
900-
if (load_all_debug_info)
901-
ExtractUnitDIEIfNeeded();
899+
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile() {
900+
ExtractUnitDIEIfNeeded();
902901
if (m_dwo)
903902
return &llvm::cast<SymbolFileDWARFDwo>(m_dwo->GetSymbolFileDWARF());
904903
return nullptr;

lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class DWARFUnit : public UserID {
241241
FileSpec GetFile(size_t file_idx);
242242
FileSpec::Style GetPathStyle();
243243

244-
SymbolFileDWARFDwo *GetDwoSymbolFile(bool load_all_debug_info = false);
244+
SymbolFileDWARFDwo *GetDwoSymbolFile();
245245

246246
die_iterator_range dies() {
247247
ExtractDIEsIfNeeded();

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,7 @@ static bool UpdateCompilerContextForSimpleTemplateNames(TypeQuery &match) {
26722672
return any_context_updated;
26732673
}
26742674

2675-
uint64_t SymbolFileDWARF::GetDebugInfoSize(bool load_all_debug_info) {
2675+
uint64_t SymbolFileDWARF::GetDebugInfoSize() {
26762676
DWARFDebugInfo &info = DebugInfo();
26772677
uint32_t num_comp_units = info.GetNumUnits();
26782678

@@ -2687,7 +2687,7 @@ uint64_t SymbolFileDWARF::GetDebugInfoSize(bool load_all_debug_info) {
26872687
if (cu == nullptr)
26882688
continue;
26892689

2690-
SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile(load_all_debug_info);
2690+
SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
26912691
if (dwo)
26922692
debug_info_size += dwo->GetDebugInfoSize();
26932693
}

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class SymbolFileDWARF : public SymbolFileCommon {
186186
GetMangledNamesForFunction(const std::string &scope_qualified_name,
187187
std::vector<ConstString> &mangled_names) override;
188188

189-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
189+
uint64_t GetDebugInfoSize() override;
190190

191191
void FindTypes(const lldb_private::TypeQuery &match,
192192
lldb_private::TypeResults &results) override;

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
8585
return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
8686
}
8787

88-
uint64_t SymbolFileDWARFDwo::GetDebugInfoSize(bool load_all_debug_info) {
88+
uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
8989
// Directly get debug info from current dwo object file's section list
9090
// instead of asking SymbolFileCommon::GetDebugInfo() which parses from
9191
// owning module which is wrong.

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
4747
const lldb::offset_t data_offset,
4848
const uint8_t op) const override;
4949

50-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
50+
uint64_t GetDebugInfoSize() override;
5151

5252
bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes,
5353
lldb::offset_t &offset,

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ SymbolFileNativePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
21562156
return type_system_or_err;
21572157
}
21582158

2159-
uint64_t SymbolFileNativePDB::GetDebugInfoSize(bool load_all_debug_info) {
2159+
uint64_t SymbolFileNativePDB::GetDebugInfoSize() {
21602160
// PDB files are a separate file that contains all debug info.
21612161
return m_index->pdb().getFileSize();
21622162
}

lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SymbolFileNativePDB : public SymbolFileCommon {
7777

7878
void InitializeObject() override;
7979

80-
uint64_t GetDebugInfoSize(bool load_all_debug_info = false) override;
80+
uint64_t GetDebugInfoSize() override;
8181

8282
// Compile Unit function calls
8383

lldb/source/Symbol/SymbolFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ SymbolFileCommon::GetTypeSystemForLanguage(lldb::LanguageType language) {
227227
return type_system_or_err;
228228
}
229229

230-
uint64_t SymbolFileCommon::GetDebugInfoSize(bool load_all_debug_info) {
230+
uint64_t SymbolFileCommon::GetDebugInfoSize() {
231231
if (!m_objfile_sp)
232232
return 0;
233233
ModuleSP module_sp(m_objfile_sp->GetModule());

lldb/source/Symbol/SymbolFileOnDemand.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,11 @@ void SymbolFileOnDemand::PreloadSymbols() {
535535
return m_sym_file_impl->PreloadSymbols();
536536
}
537537

538-
uint64_t SymbolFileOnDemand::GetDebugInfoSize(bool load_all_debug_info) {
538+
uint64_t SymbolFileOnDemand::GetDebugInfoSize() {
539539
// Always return the real debug info size.
540540
LLDB_LOG(GetLog(), "[{0}] {1} is not skipped", GetSymbolFileName(),
541541
__FUNCTION__);
542-
return m_sym_file_impl->GetDebugInfoSize(load_all_debug_info);
542+
return m_sym_file_impl->GetDebugInfoSize();
543543
}
544544

545545
StatsDuration::Duration SymbolFileOnDemand::GetDebugInfoParseTime() {

lldb/source/Target/Statistics.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ llvm::json::Value DebuggerStats::ReportStatistics(
224224
const lldb_private::StatisticsOptions &options) {
225225

226226
const bool summary_only = options.summary_only;
227-
const bool load_all_debug_info = options.load_all_debug_info;
228227

229228
json::Array json_targets;
230229
json::Array json_modules;
@@ -281,8 +280,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(
281280
++debug_index_saved;
282281
module_stat.debug_index_time = sym_file->GetDebugInfoIndexTime().count();
283282
module_stat.debug_parse_time = sym_file->GetDebugInfoParseTime().count();
284-
module_stat.debug_info_size =
285-
sym_file->GetDebugInfoSize(load_all_debug_info);
283+
module_stat.debug_info_size = sym_file->GetDebugInfoSize();
286284
module_stat.symtab_stripped = module->GetObjectFile()->IsStripped();
287285
if (module_stat.symtab_stripped)
288286
++num_stripped_modules;

lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -117,38 +117,3 @@ def test_command_stats_api(self):
117117
self.assertNotIn("bt", command_stats)
118118
# Verify bt's regex command is not duplicatedly captured.
119119
self.assertNotIn("_regexp-bt", command_stats)
120-
121-
def test_command_stats_force(self):
122-
"""
123-
Test reporting all pssible debug info stats by force loading all debug
124-
info. For example, dwo files
125-
"""
126-
src_dir = self.getSourceDir()
127-
dwo_yaml_path = os.path.join(src_dir, "main.dwo.yaml")
128-
obj_yaml_path = os.path.join(src_dir, "main.o.yaml")
129-
dwo_path = self.getBuildArtifact("main.dwo")
130-
obj_path = self.getBuildArtifact("main.o")
131-
self.yaml2obj(dwo_yaml_path, dwo_path)
132-
self.yaml2obj(obj_yaml_path, obj_path)
133-
134-
# We need the current working directory to be set to the build directory
135-
os.chdir(self.getBuildDir())
136-
# Create a target with the object file we just created from YAML
137-
target = self.dbg.CreateTarget(obj_path)
138-
self.assertTrue(target, VALID_TARGET)
139-
140-
# Get statistics
141-
stats_options = lldb.SBStatisticsOptions()
142-
stats = target.GetStatistics(stats_options)
143-
stream = lldb.SBStream()
144-
stats.GetAsJSON(stream)
145-
debug_stats = json.loads(stream.GetData())
146-
self.assertEqual(debug_stats["totalDebugInfoByteSize"], 188)
147-
148-
# Get statistics with force loading
149-
stats_options.SetReportAllAvailableDebugInfo(True)
150-
stats_force = target.GetStatistics(stats_options)
151-
stream_force = lldb.SBStream()
152-
stats_force.GetAsJSON(stream_force)
153-
debug_stats_force = json.loads(stream_force.GetData())
154-
self.assertEqual(debug_stats_force["totalDebugInfoByteSize"], 435)

lldb/test/API/functionalities/stats_api/main.dwo.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)