Make check_gn_headers.py more robust on the bots

Check whether the build is dirty first, and abort when dirty. This can
be skipped by using option --skip-dirty-check.

Dump JSON output on error, so that the result is still valid.

Filter out generated headers more aggressively.

Report non-existing headers in JSON as well.

BUG=725877

Review-Url: https://codereview.chromium.org/2911543002
Cr-Commit-Position: refs/heads/master@{#476895}
2 files changed