Skip to content

Commit efc7168

Browse files
committed
Add statistics option to force loading debug info
1 parent 8cfd1ee commit efc7168

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

lldb/bindings/interface/SBStatisticsOptionsDocstrings.i

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@
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::SetForceLoading;
12+
%feature("docstring", "
13+
Gets whether the statistics will force loading all possible debug info."
14+
) lldb::SBStatisticsOptions::GetForceLoading;

lldb/include/lldb/API/SBStatisticsOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class LLDB_API SBStatisticsOptions {
2424

2525
void SetSummaryOnly(bool b);
2626
bool GetSummaryOnly();
27+
28+
void SetForceLoading(bool b);
29+
bool GetForceLoading();
2730

2831
protected:
2932
friend class SBTarget;

lldb/include/lldb/Target/Statistics.h

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

133133
struct StatisticsOptions {
134134
bool summary_only = false;
135+
bool force_loading = false;
135136
};
136137

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

lldb/source/API/SBStatisticsOptions.cpp

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

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

47+
void SBStatisticsOptions::SetForceLoading(bool b) {
48+
m_opaque_up->force_loading = b;
49+
}
50+
51+
bool SBStatisticsOptions::GetForceLoading() { return m_opaque_up->force_loading; }
52+
4753
const lldb_private::StatisticsOptions &SBStatisticsOptions::ref() const {
4854
return *m_opaque_up;
4955
}

lldb/source/Commands/CommandObjectStats.cpp

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

lldb/source/Commands/Options.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,10 @@ 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<"force", "f">, Group<1>,
1425+
Desc<"Dump the total possible debug info statistics. "
1426+
"Force loading the debug information if not yet loaded, and collect "
1427+
"statistics with those.">;
14241428
}

lldb/source/Target/Statistics.cpp

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

226226
const bool summary_only = options.summary_only;
227+
const bool force_laoding = options.force_loading;
227228

228229
json::Array json_targets;
229230
json::Array json_modules;
@@ -280,7 +281,7 @@ llvm::json::Value DebuggerStats::ReportStatistics(
280281
++debug_index_saved;
281282
module_stat.debug_index_time = sym_file->GetDebugInfoIndexTime().count();
282283
module_stat.debug_parse_time = sym_file->GetDebugInfoParseTime().count();
283-
module_stat.debug_info_size = sym_file->GetDebugInfoSize();
284+
module_stat.debug_info_size = sym_file->GetDebugInfoSize(force_laoding);
284285
module_stat.symtab_stripped = module->GetObjectFile()->IsStripped();
285286
if (module_stat.symtab_stripped)
286287
++num_stripped_modules;

0 commit comments

Comments
 (0)