1 // Copyright (C) 2017 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 
16 
17 #ifndef ART_TOOLS_TITRACE_INSTRUCTION_DECODER_H_
18 #define ART_TOOLS_TITRACE_INSTRUCTION_DECODER_H_
19 
20 #include <stddef.h>
21 
22 namespace titrace {
23 
24 enum class InstructionFileFormat {
25   kClass,
26   kDex
27 };
28 
29 class InstructionDecoder {
30  public:
31   virtual size_t GetMaximumOpcode() = 0;
32   virtual const char* GetName(size_t opcode) = 0;
33   virtual size_t LocationToOffset(size_t j_location) = 0;
34 
~InstructionDecoder()35   virtual ~InstructionDecoder() {}
36 
37   static InstructionDecoder* NewInstance(InstructionFileFormat file_format);
38 };
39 
40 }  // namespace titrace
41 
42 #endif  // ART_TOOLS_TITRACE_INSTRUCTION_DECODER_H_
43