This implements a debuginfod server in llvm using the DebuginfodCollection and DebuginfodServer classes. This is tested with lit tests against the debuginfod-find client.
The server scans 0 or more local directories for artifacts. It serves the debuginfod protocol over HTTP. Only the executable and debuginfo endpoints are supported (no /source endpoint).
The server also uses the debuginfod client as a fallback, so it can hit the local debuginfod cache or federate to other known debuginfod servers.
The client behavior is controllable through the standard environment variables (DEBUGINFOD_URLS, DEBUGINFOD_CACHE_PATH, DEBUGINFOD_TIMEOUT)
The server implements on-demand collection updates as follows:
If the build-id is not found by a local lookup, rescan immediately and look up the build-id again before returning 404. To protect against DoS attacks, do not rescan more frequently than once per N seconds (specified by -m).
Lit tests are provided which test the llvm-debuginfod-find client against the llvm-debuginfod server.
It doesn't seem like the python script does anything for these two invocations; the DEBUGINFOD_CACHE_PATH is set manually, and there's nothing to wait for. It'd be clearer just to use llvm-debuginfod-find directly. This should also help remove conditional logic from the Python script.