diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 122eb3ddd711f..35bd7f8a66e05 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -144,9 +144,8 @@ struct StatisticsOptions { bool GetIncludeTargets() const { if (m_include_targets.has_value()) return m_include_targets.value(); - // `m_include_targets` has no value set, so return a value based on - // `m_summary_only`. - return !GetSummaryOnly(); + // Default to true in both default mode and summary mode. + return true; } void SetIncludeModules(bool value) { m_include_modules = value; } diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index ba256e5ab917a..fa8af7cb3d762 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -1429,9 +1429,8 @@ let Command = "statistics dump" in { Arg<"Boolean">, Desc<"Dump statistics for the targets, including breakpoints, expression " "evaluations, frame variables, etc. " - "Defaults to true, unless the '--summary' mode is enabled, in which case " - "this is turned off unless specified. " - "If both the '--targets' and the '--modules' options are 'true', a list " + "Defaults to true in both default mode and summary mode. " + "In default mode, if both '--targets' and '--modules' are 'true', a list " "of module identifiers will be added to the 'targets' section.">; def statistics_dump_modules: Option<"modules", "m">, Group<1>, Arg<"Boolean">, @@ -1439,7 +1438,7 @@ let Command = "statistics dump" in { "aspects of the module and debug information, type system, path, etc. " "Defaults to true, unless the '--summary' mode is enabled, in which case " "this is turned off unless specified. " - "If both the '--targets' and the '--modules' options are 'true', a list " + "In default mode, if both '--targets' and '--modules' are 'true', a list " "of module identifiers will be added to the 'targets' section.">; def statistics_dump_transcript: Option<"transcript", "t">, Group<1>, Arg<"Boolean">, diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py index 136c44e17c645..a8ac60090a760 100644 --- a/lldb/test/API/commands/statistics/basic/TestStats.py +++ b/lldb/test/API/commands/statistics/basic/TestStats.py @@ -702,6 +702,8 @@ def get_test_cases_for_sections_existence(self): "targets.moduleIdentifiers": True, "targets.breakpoints": True, "targets.expressionEvaluation": True, + "targets.frameVariable": True, + "targets.totalSharedLibraryEventHitCount": True, "modules": True, "transcript": True, }, @@ -713,10 +715,12 @@ def get_test_cases_for_sections_existence(self): }, "expect": { "commands": False, - "targets": False, + "targets": True, "targets.moduleIdentifiers": False, "targets.breakpoints": False, "targets.expressionEvaluation": False, + "targets.frameVariable": False, + "targets.totalSharedLibraryEventHitCount": True, "modules": False, "transcript": False, }, @@ -733,11 +737,25 @@ def get_test_cases_for_sections_existence(self): "targets.moduleIdentifiers": False, "targets.breakpoints": False, "targets.expressionEvaluation": False, + "targets.frameVariable": False, "targets.totalSharedLibraryEventHitCount": True, "modules": False, "transcript": False, }, }, + { # Summary mode without targets + "command_options": " --summary --targets=false", + "api_options": { + "SetSummaryOnly": True, + "SetIncludeTargets": False, + }, + "expect": { + "commands": False, + "targets": False, + "modules": False, + "transcript": False, + }, + }, { # Summary mode with modules "command_options": " --summary --modules=true", "api_options": { @@ -746,15 +764,17 @@ def get_test_cases_for_sections_existence(self): }, "expect": { "commands": False, - "targets": False, + "targets": True, "targets.moduleIdentifiers": False, "targets.breakpoints": False, "targets.expressionEvaluation": False, + "targets.frameVariable": False, + "targets.totalSharedLibraryEventHitCount": True, "modules": True, "transcript": False, }, }, - { # Everything mode but without modules and transcript + { # Default mode without modules and transcript "command_options": " --modules=false --transcript=false", "api_options": { "SetIncludeModules": False, @@ -766,11 +786,13 @@ def get_test_cases_for_sections_existence(self): "targets.moduleIdentifiers": False, "targets.breakpoints": True, "targets.expressionEvaluation": True, + "targets.frameVariable": True, + "targets.totalSharedLibraryEventHitCount": True, "modules": False, "transcript": False, }, }, - { # Everything mode but without modules + { # Default mode without modules "command_options": " --modules=false", "api_options": { "SetIncludeModules": False, @@ -781,6 +803,8 @@ def get_test_cases_for_sections_existence(self): "targets.moduleIdentifiers": False, "targets.breakpoints": True, "targets.expressionEvaluation": True, + "targets.frameVariable": True, + "targets.totalSharedLibraryEventHitCount": True, "modules": False, "transcript": True, },