{
  "id": "valgrind",
  "name": "Valgrind",
  "homepage": "https://valgrind.org/",
  "description": "Valgrind is an instrumentation framework for building dynamic analysis tools.",
  "executables": [
    "valgrind"
  ],
  "dotfiles": {
    "paths": [
      "~/.valgrindrc"
    ],
    "secret": [],
    "side_effect": false
  },
  "commands": {
    "format": 1,
    "label": "Run a program under Valgrind",
    "description": "Runs one program under a Valgrind tool with common leak, error and logging options. Arguments for the program itself are not part of this form; add them after the program at the prompt.",
    "quality": "ai-draft",
    "parser": {
      "end_of_options": "--",
      "interleave": "permute",
      "long_equals": true,
      "short_attached": true,
      "short_bundles": false
    },
    "source": [
      {
        "id": "manual",
        "kind": "manual",
        "url": "https://manpages.debian.org/unstable/valgrind/valgrind.1.en.html",
        "revision": "debian unstable",
        "evidence": "valgrind [valgrind-options] [your-program] [your-program-options]\n--tool=<toolname> [default: memcheck]\nmemcheck, cachegrind, callgrind, helgrind, drd, massif, dhat, lackey, none,\n-q, --quiet\n-v, --verbose\n--log-file=<filename>\n--num-callers=<number> [default: 12]\n--error-exitcode=<number> [default: 0]\n--leak-check=<no|summary|yes|full> [default: summary]\n--show-leak-kinds=<set> [default: definite,possible]\n--track-origins=<yes|no> [default: no]\n--trace-children=<yes|no> [default: no]\n--suppressions=<filename>\n"
      }
    ],
    "field": [
      {
        "id": "program",
        "label": "Program to run",
        "type": "path",
        "position": 0,
        "min": 1,
        "path": {
          "kind": "file",
          "role": "input"
        },
        "sources": [
          "manual"
        ]
      },
      {
        "id": "tool",
        "label": "Tool",
        "type": "string",
        "option": [
          "--tool"
        ],
        "suggestions": [
          {
            "value": "memcheck",
            "label": "memcheck (memory errors, default)"
          },
          {
            "value": "cachegrind",
            "label": "cachegrind"
          },
          {
            "value": "callgrind",
            "label": "callgrind"
          },
          {
            "value": "helgrind",
            "label": "helgrind (threads)"
          },
          {
            "value": "drd",
            "label": "drd (threads)"
          },
          {
            "value": "massif",
            "label": "massif (heap profile)"
          },
          {
            "value": "dhat",
            "label": "dhat"
          }
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "leak_check",
        "label": "Leak check",
        "type": "enum",
        "option": [
          "--leak-check"
        ],
        "choices": [
          {
            "value": "no",
            "label": "No"
          },
          {
            "value": "summary",
            "label": "Summary"
          },
          {
            "value": "yes",
            "label": "Yes (full)"
          },
          {
            "value": "full",
            "label": "Full"
          }
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "show_leak_kinds",
        "label": "Leak kinds to show",
        "description": "Comma-separated set, e.g. definite,possible or all.",
        "type": "string",
        "option": [
          "--show-leak-kinds"
        ],
        "suggestions": [
          {
            "value": "definite,possible",
            "label": "definite,possible"
          },
          {
            "value": "all",
            "label": "all"
          }
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "track_origins",
        "label": "Track origins of uninitialised values",
        "type": "enum",
        "option": [
          "--track-origins"
        ],
        "choices": [
          {
            "value": "yes",
            "label": "Yes"
          },
          {
            "value": "no",
            "label": "No"
          }
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "trace_children",
        "label": "Trace child processes",
        "type": "enum",
        "option": [
          "--trace-children"
        ],
        "choices": [
          {
            "value": "yes",
            "label": "Yes"
          },
          {
            "value": "no",
            "label": "No"
          }
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "num_callers",
        "label": "Stack trace depth",
        "type": "integer",
        "option": [
          "--num-callers"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "error_exitcode",
        "label": "Exit code on errors",
        "type": "integer",
        "option": [
          "--error-exitcode"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "log_file",
        "label": "Log file",
        "type": "path",
        "option": [
          "--log-file"
        ],
        "path": {
          "kind": "file",
          "role": "output"
        },
        "effect": "overwrite",
        "sources": [
          "manual"
        ]
      },
      {
        "id": "suppressions",
        "label": "Suppressions file",
        "type": "path",
        "option": [
          "--suppressions"
        ],
        "path": {
          "kind": "file",
          "role": "input"
        },
        "sources": [
          "manual"
        ]
      },
      {
        "id": "verbose",
        "label": "Verbosity",
        "type": "count",
        "option": [
          "--verbose",
          "-v"
        ],
        "sources": [
          "manual"
        ]
      },
      {
        "id": "quiet",
        "label": "Quiet",
        "type": "boolean",
        "option": [
          "--quiet",
          "-q"
        ],
        "sources": [
          "manual"
        ]
      }
    ],
    "task": [
      {
        "id": "leaks",
        "label": "Full leak check",
        "set": {
          "leak_check": [
            "full"
          ],
          "show_leak_kinds": [
            "all"
          ],
          "track_origins": [
            "yes"
          ]
        },
        "fields": [
          "program",
          "leak_check",
          "show_leak_kinds",
          "track_origins",
          "log_file"
        ],
        "required": [
          "program"
        ]
      },
      {
        "id": "ci",
        "label": "Fail on errors",
        "set": {
          "leak_check": [
            "full"
          ],
          "error_exitcode": [
            1
          ]
        },
        "fields": [
          "program",
          "leak_check",
          "error_exitcode",
          "suppressions"
        ],
        "required": [
          "program"
        ]
      }
    ],
    "group": [
      {
        "id": "basic",
        "label": "Basic",
        "fields": [
          "program",
          "tool",
          "leak_check",
          "show_leak_kinds",
          "track_origins",
          "log_file"
        ]
      },
      {
        "id": "advanced",
        "label": "Advanced",
        "fields": [
          "trace_children",
          "num_callers",
          "error_exitcode",
          "suppressions",
          "verbose",
          "quiet"
        ]
      }
    ]
  }
}
