blob: a19431c143d83cd40fff3c1c39bbd4472216df2c [file] [log] [blame]
Jeff Haoec7f1a92017-03-13 16:24:24 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * Header file of dex ir verifier.
17 *
18 * Compares two dex files at the IR level, allowing differences in layout, but not in data.
19 */
20
21#ifndef ART_DEXLAYOUT_DEX_VERIFY_H_
22#define ART_DEXLAYOUT_DEX_VERIFY_H_
23
24#include "dex_ir.h"
25
26namespace art {
27
28// Check that the output dex file contains the same data as the original.
29// Compares the dex IR of both dex files. Allows the dex files to have different layouts.
30bool VerifyOutputDexFile(dex_ir::Header* orig_header,
31 dex_ir::Header* output_header,
32 std::string* error_msg);
33template<class T> bool VerifyIds(std::vector<std::unique_ptr<T>>& orig,
34 std::vector<std::unique_ptr<T>>& output,
35 const char* section_name,
36 std::string* error_msg);
37bool VerifyId(dex_ir::StringId* orig, dex_ir::StringId* output, std::string* error_msg);
38bool VerifyId(dex_ir::TypeId* orig, dex_ir::TypeId* output, std::string* error_msg);
39bool VerifyId(dex_ir::ProtoId* orig, dex_ir::ProtoId* output, std::string* error_msg);
40bool VerifyId(dex_ir::FieldId* orig, dex_ir::FieldId* output, std::string* error_msg);
41bool VerifyId(dex_ir::MethodId* orig, dex_ir::MethodId* output, std::string* error_msg);
42bool VerifyTypeList(const dex_ir::TypeList* orig, const dex_ir::TypeList* output);
43
44} // namespace art
45
46#endif // ART_DEXLAYOUT_DEX_VERIFY_H_