aboutsummaryrefslogtreecommitdiffstats
path: root/tools/syz-query-subsystems/query_subsystems.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/syz-query-subsystems/query_subsystems.go')
-rw-r--r--tools/syz-query-subsystems/query_subsystems.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/syz-query-subsystems/query_subsystems.go b/tools/syz-query-subsystems/query_subsystems.go
index 8f0fbae76..74da8ee8d 100644
--- a/tools/syz-query-subsystems/query_subsystems.go
+++ b/tools/syz-query-subsystems/query_subsystems.go
@@ -28,6 +28,7 @@ var (
flagName = flag.String("name", "", "the name under which the list should be saved")
flagFilter = flag.String("filter", "", "comma-separated list of subsystems to keep")
flagEmails = flag.Bool("emails", true, "save lists and maintainer fields")
+ flagDebug = flag.Bool("debug", false, "print the debugging information")
)
var nameRe = regexp.MustCompile(`^[a-z]\w*$`)
@@ -48,10 +49,11 @@ func main() {
tool.Failf("the name is not acceptable")
}
// Query the subsystems.
- list, err := linux.ListFromRepo(*flagKernelRepo)
+ list, debugInfo, err := linux.ListFromRepo(*flagKernelRepo)
if err != nil {
tool.Failf("failed to query subsystems: %v", err)
}
+ printDebugInfo(debugInfo)
list = postProcessList(list)
// Save the list.
folder := filepath.Join(*flagSyzkallerRepo, "pkg", "subsystem", "lists")
@@ -62,7 +64,7 @@ func main() {
if err != nil {
tool.Failf("failed to fetch commit info: %v", err)
}
- code, err := generateSubsystemsFile(*flagName, list, commitInfo)
+ code, err := generateSubsystemsFile(*flagName, list, commitInfo, debugInfo)
if err != nil {
tool.Failf("failed to generate code: %s", err)
}
@@ -72,6 +74,19 @@ func main() {
}
}
+func printDebugInfo(info *subsystem.DebugInfo) {
+ if !*flagDebug {
+ return
+ }
+ for item, list := range info.FileLists {
+ fmt.Printf("****\n")
+ fmt.Printf("Subsystem %q (%d paths)\n", item.Name, len(list))
+ for _, path := range list {
+ fmt.Printf("%s\n", path)
+ }
+ }
+}
+
func postProcessList(list []*subsystem.Subsystem) []*subsystem.Subsystem {
if *flagFilter != "" {
list = subsystem.FilterList(list, prepareFilter())