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

David Hunter posted 7 patches 1 month, 1 week ago
[PATCH v1 4/7] streamline_config.pl: include tool to learn about a config option
Posted by David Hunter 1 month, 1 week ago
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(+)

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
Re: [PATCH v1 4/7] streamline_config.pl: include tool to learn about a config option
Posted by Masahiro Yamada 3 weeks ago
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
>


-- 
Best Regards
Masahiro Yamada