diff mbox series

[v1,4/7] streamline_config.pl: include tool to learn about a config option

Message ID 20241014141345.5680-5-david.hunter.linux@gmail.com (mailing list archive)
State New
Headers show
Series streamline_config.pl: fix: process configs set to "y" | expand

Commit Message

David Hunter Oct. 14, 2024, 2:13 p.m. UTC
Include a debugging tool that can help developers find out about a
particular config option.

It can be challenging to find out what is going on behind the scenes of
the script due to the vast amount of config options and the ways the
config options interact with each other.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
 scripts/kconfig/streamline_config.pl | 49 ++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Masahiro Yamada Nov. 5, 2024, 11:15 p.m. UTC | #1
On Mon, Oct 14, 2024 at 11:14 PM David Hunter
<david.hunter.linux@gmail.com> wrote:
>
> Include a debugging tool that can help developers find out about a
> particular config option.
>
> It can be challenging to find out what is going on behind the scenes of
> the script due to the vast amount of config options and the ways the
> config options interact with each other.
>
> Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
> ---

This is not suitable for upstream.

Indeed, this tool is broken, and hard to figure out
what is happening, but you can add print-debug
when needed.


>  scripts/kconfig/streamline_config.pl | 49 ++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index f5a07b3a1922..bbcd5a6e9726 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -713,4 +713,53 @@ foreach my $module (keys(%modules)) {
>      }
>  }
>
> +# the following tool can be used to check a particular config option.
> +# You can read the output if the variable "debugprint" is set to "1."
> +# Here is a sample way to use the tool:
> +# dprintvar("INET_ESP");
> +#
> +sub dprintvar {
> +    if ($debugprint) {
> +       my $dconfig = $_[0];
> +       my $fconfig = "CONFIG_$dconfig";
> +       my $con_found = "";
> +       my $dep_found = "";
> +       my $def_found = "";
> +       my $sel_found = "";
> +       my $prom_found = "";
> +       my $ori_found = "";
> +       my $proc_found = "";
> +
> +        if (defined($configs{$fconfig})) {
> +            $con_found = $configs{$fconfig};
> +        }
> +        if (defined($depends{$dconfig})) {
> +            $dep_found = $depends{$dconfig};
> +        }
> +        if (defined($defaults{$dconfig})) {
> +            $def_found = $defaults{$dconfig};
> +        }
> +        if (defined($selects{$dconfig})) {
> +            $sel_found = $selects{$dconfig};
> +        }
> +        if (defined($prompts{$dconfig})) {
> +            $prom_found = $prompts{$dconfig};
> +        }
> +        if (defined($orig_configs{$fconfig})) {
> +            $ori_found = $orig_configs{$fconfig};
> +        }
> +        if (defined($process_selects{$dconfig})) {
> +            $proc_found = $process_selects{$dconfig};
> +        }
> +
> +        dprint "config: $dconfig\n";
> +        dprint "config found: $con_found\n";
> +        dprint "depends: $dep_found\n";
> +        dprint "defaults: $def_found\n";
> +        dprint "selects: $sel_found\n";
> +        dprint "prompts: $prom_found\n";
> +        dprint "in original config: $ori_found\n";
> +       dprint "process selected: $proc_found\n";
> +    }
> +}
>  # vim: softtabstop=4
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index f5a07b3a1922..bbcd5a6e9726 100755
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -713,4 +713,53 @@  foreach my $module (keys(%modules)) {
     }
 }
 
+# the following tool can be used to check a particular config option.
+# You can read the output if the variable "debugprint" is set to "1."
+# Here is a sample way to use the tool:
+# dprintvar("INET_ESP");
+#
+sub dprintvar {
+    if ($debugprint) {
+	my $dconfig = $_[0];
+	my $fconfig = "CONFIG_$dconfig";
+	my $con_found = "";
+	my $dep_found = "";
+	my $def_found = "";
+	my $sel_found = "";
+	my $prom_found = "";
+	my $ori_found = "";
+	my $proc_found = "";
+
+        if (defined($configs{$fconfig})) {
+            $con_found = $configs{$fconfig};
+        }
+        if (defined($depends{$dconfig})) {
+            $dep_found = $depends{$dconfig};
+        }
+        if (defined($defaults{$dconfig})) {
+            $def_found = $defaults{$dconfig};
+        }
+        if (defined($selects{$dconfig})) {
+            $sel_found = $selects{$dconfig};
+        }
+        if (defined($prompts{$dconfig})) {
+            $prom_found = $prompts{$dconfig};
+        }
+        if (defined($orig_configs{$fconfig})) {
+            $ori_found = $orig_configs{$fconfig};
+        }
+        if (defined($process_selects{$dconfig})) {
+            $proc_found = $process_selects{$dconfig};
+        }
+
+        dprint "config: $dconfig\n";
+        dprint "config found: $con_found\n";
+        dprint "depends: $dep_found\n";
+        dprint "defaults: $def_found\n";
+        dprint "selects: $sel_found\n";
+        dprint "prompts: $prom_found\n";
+        dprint "in original config: $ori_found\n";
+	dprint "process selected: $proc_found\n";
+    }
+}
 # vim: softtabstop=4