diff options
author | Matthias Maennich <maennich@google.com> | 2021-12-08 23:07:55 +0000 |
---|---|---|
committer | Matthias Männich <maennich@google.com> | 2021-12-09 16:29:48 +0000 |
commit | d11a88cb93cdad7d8508d600ff158163459a0a39 (patch) | |
tree | 6ceaaf6dcaf9aacac4a5d8a6a8362f059f27e089 | |
parent | b519019a0ebf6f65611327f572cf751360550078 (diff) | |
download | interceptor-d11a88cb93cdad7d8508d600ff158163459a0a39.tar.gz |
interceptor: give analyzers names
This is useful to recognize the used analyzer from the interceptor log.
Bug: 205577427
Change-Id: Iaf536b87341acc533fdf2675c5b1b933e6061450
-rw-r--r-- | interceptor.cc | 9 | ||||
-rw-r--r-- | log.proto | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/interceptor.cc b/interceptor.cc index 30eab52..4d4e84c 100644 --- a/interceptor.cc +++ b/interceptor.cc @@ -179,6 +179,8 @@ class Analyzer { virtual bool should_recurse(Command*) const { return true; } virtual bool make_fake(Command*) const { return false; } + virtual std::string name() const { return "Generic"; }; + protected: virtual InputsOutputs determine_inputs_outputs(const Command&) const { return {}; } }; @@ -220,6 +222,8 @@ int default_fake(Command* command) { } class CompileLinkerAnalyzer : public Analyzer { + std::string name() const final { return "CompilerLinker"; }; + InputsOutputs determine_inputs_outputs(const Command& command) const final { static constexpr std::array kSkipNextArguments{ "-isystem", "-I", "-L", "-m", "-soname", "-z", @@ -276,6 +280,8 @@ class CompileLinkerAnalyzer : public Analyzer { }; class ArchiverAnalyzer : public Analyzer { + std::string name() const final { return "Archiver"; }; + InputsOutputs determine_inputs_outputs(const Command& command) const final { InputsOutputs result; @@ -301,6 +307,8 @@ class ArchiverAnalyzer : public Analyzer { }; class FixdepAnalyzer : public Analyzer { + std::string name() const final { return "Fixdep"; }; + InputsOutputs determine_inputs_outputs(const Command& command) const final { InputsOutputs result; const auto& arguments = command.arguments(); @@ -365,6 +373,7 @@ static std::optional<interceptor::Command> process_command(const char* filename, auto command = interceptor::instantiate_command(filename, argv, envp); const auto analyzer = interceptor::Analyzer::get(command); + command.set_analyzer(analyzer->name()); bool transformed = false; @@ -26,6 +26,7 @@ message Command { string current_directory = 4; repeated string inputs = 5; repeated string outputs = 6; + string analyzer = 7; }; // A single message as emitted by an intercepted process. It can contain any of |