diff options
author | Matthias Maennich <maennich@google.com> | 2021-12-03 22:49:07 +0000 |
---|---|---|
committer | Matthias Maennich <maennich@google.com> | 2021-12-08 13:12:12 +0000 |
commit | b09c721b95e08f3e0446a3d201dae8ee930be4b0 (patch) | |
tree | eeaeb316c090378704ffd22f49266868d9955877 | |
parent | 28d23c975ec11679945b4a72a085a08dc176321c (diff) | |
download | interceptor-b09c721b95e08f3e0446a3d201dae8ee930be4b0.tar.gz |
interceptor: add FixdepAnalyzer
This implements tracing for the fixdep command of kernel builds. In
particular it allows us to run this command in dry-run mode later.
Bug: 205735739
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: I4ea3f41edcd64150be0a890e59356e48de4b036d
-rw-r--r-- | interceptor.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/interceptor.cc b/interceptor.cc index 1f9f93d..e9efccc 100644 --- a/interceptor.cc +++ b/interceptor.cc @@ -272,6 +272,24 @@ class ArchiverAnalyzer : public Analyzer { bool should_recurse(Command*) const final { return false; } }; +class FixdepAnalyzer : public Analyzer { + InputsOutputs determine_inputs_outputs(const Command& command) const final { + InputsOutputs result; + const auto& arguments = command.arguments(); + + if (arguments.size() < 3) { + return result; + } + + // fixdep reads the object file and the .d file and outputs to the .d file + result.outputs.push_back(arguments[1]); + result.inputs.push_back(arguments[1]); + result.inputs.push_back(arguments[2]); + + return result; + }; +}; + static const std::initializer_list< std::pair<std::regex, std::function<std::unique_ptr<Analyzer>()>>> analyzers{ @@ -283,6 +301,10 @@ static const std::initializer_list< std::regex("^(.*/)?(llvm-)?ar$"), []() { return std::make_unique<ArchiverAnalyzer>(); }, }, + { + std::regex("^scripts/basic/fixdep$"), + []() { return std::make_unique<FixdepAnalyzer>(); }, + }, }; std::unique_ptr<Analyzer> Analyzer::get(const Command& command) { |