summaryrefslogtreecommitdiff
path: root/dexlayout/dex_verify.h
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2017-03-14 02:33:20 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-03-14 02:33:20 +0000
commit224f6ab7620ddbc20a338e56ccf9952d86b08b51 (patch)
treef07435d668c04c239dca0036b6b072611d45b046 /dexlayout/dex_verify.h
parent13ef0447b43ecbf18d3c4e4c72d66bbbc1815f0c (diff)
parentec7f1a96683836d9375adc48c6bf802c0ce2160e (diff)
Merge "Added new -v option to dexlayout to verify output dex file."
Diffstat (limited to 'dexlayout/dex_verify.h')
-rw-r--r--dexlayout/dex_verify.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/dexlayout/dex_verify.h b/dexlayout/dex_verify.h
new file mode 100644
index 0000000000..a19431c143
--- /dev/null
+++ b/dexlayout/dex_verify.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Header file of dex ir verifier.
+ *
+ * Compares two dex files at the IR level, allowing differences in layout, but not in data.
+ */
+
+#ifndef ART_DEXLAYOUT_DEX_VERIFY_H_
+#define ART_DEXLAYOUT_DEX_VERIFY_H_
+
+#include "dex_ir.h"
+
+namespace art {
+
+// Check that the output dex file contains the same data as the original.
+// Compares the dex IR of both dex files. Allows the dex files to have different layouts.
+bool VerifyOutputDexFile(dex_ir::Header* orig_header,
+ dex_ir::Header* output_header,
+ std::string* error_msg);
+template<class T> bool VerifyIds(std::vector<std::unique_ptr<T>>& orig,
+ std::vector<std::unique_ptr<T>>& output,
+ const char* section_name,
+ std::string* error_msg);
+bool VerifyId(dex_ir::StringId* orig, dex_ir::StringId* output, std::string* error_msg);
+bool VerifyId(dex_ir::TypeId* orig, dex_ir::TypeId* output, std::string* error_msg);
+bool VerifyId(dex_ir::ProtoId* orig, dex_ir::ProtoId* output, std::string* error_msg);
+bool VerifyId(dex_ir::FieldId* orig, dex_ir::FieldId* output, std::string* error_msg);
+bool VerifyId(dex_ir::MethodId* orig, dex_ir::MethodId* output, std::string* error_msg);
+bool VerifyTypeList(const dex_ir::TypeList* orig, const dex_ir::TypeList* output);
+
+} // namespace art
+
+#endif // ART_DEXLAYOUT_DEX_VERIFY_H_