aboutsummaryrefslogtreecommitdiff
path: root/disassembler_dex.h
diff options
context:
space:
mode:
authorCalder Kitagawa <ckitagawa@chromium.org>2018-06-12 14:37:39 +0000
committerEdward Lesmes <ehmaldonado@google.com>2021-07-23 22:51:37 +0000
commit1b25709592fb250dd0abeffbbae15206597ec3a2 (patch)
tree0d2f42efece59b5d55a3c66b82ab7a77c6c5aea6 /disassembler_dex.h
parent6b80ac7f4fbd9558e55a335340c23d5d43bbec41 (diff)
downloadzucchini-1b25709592fb250dd0abeffbbae15206597ec3a2.tar.gz
[Zucchini]: Support DEX AnnotationsDirectoryItem
Adds support for AnnotationsDirectoryItem references. These take a similar form to variable length reference lists; however, the header for the list is not just the size of one list but rather three sublists and also contains a reference to class annotations within the header. The CL adds a parser for these items and a few types. The ReferenceReader is reused from the CachedItemListReferenceReader. There isn't a noticeable change in generation or apply time but the memory footprint can potentially be much larger as each annotation can produce on average a few offsets and there can be thousands of instances. Bug: 847571 Change-Id: I04afe4c6e35c66c0c9157ed3ac3e5bf338931f03 Reviewed-on: https://chromium-review.googlesource.com/1095645 Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org> Reviewed-by: agrieve <agrieve@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#566420} NOKEYCHECK=True GitOrigin-RevId: 966646525b939a8fd52a993894bbb3822d9cb674
Diffstat (limited to 'disassembler_dex.h')
-rw-r--r--disassembler_dex.h37
1 files changed, 30 insertions, 7 deletions
diff --git a/disassembler_dex.h b/disassembler_dex.h
index 8c6f691..ecc4be6 100644
--- a/disassembler_dex.h
+++ b/disassembler_dex.h
@@ -73,21 +73,21 @@ class DisassemblerDex : public Disassembler {
kMethodIdToProtoId, // kProtoId
kCodeToFieldId, // kFieldId
- // kAnnotationsDirectoryToFieldId,
+ kAnnotationsDirectoryToFieldId,
kCodeToMethodId, // kMethodId
- // kAnnotationsDirectoryToMethodId,
- // kAnnotationsDirectoryToParameterMethodId,
+ kAnnotationsDirectoryToMethodId,
+ kAnnotationsDirectoryToParameterMethodId,
kProtoIdToParametersTypeList, // kTypeList
kClassDefToInterfacesTypeList,
- // kAnnotationsDirectoryToParameterAnnotationSetRef, // kAnnotationSetRef,
+ kAnnotationsDirectoryToParameterAnnotationSetRef, // kAnnotationSetRef,
kAnnotationSetRefListToAnnotationSet, // kAnnotationSet,
- // kAnnotationsDirectoryToClassAnnotationSet,
- // kAnnotationsDirectoryToFieldAnnotationSet,
- // kAnnotationsDirectoryToMethodAnnotationSet,
+ kAnnotationsDirectoryToClassAnnotationSet,
+ kAnnotationsDirectoryToFieldAnnotationSet,
+ kAnnotationsDirectoryToMethodAnnotationSet,
kClassDefToClassData, // kClassData
@@ -179,6 +179,23 @@ class DisassemblerDex : public Disassembler {
std::unique_ptr<ReferenceReader> MakeReadAnnotationSetRefListToAnnotationSet(
offset_t lo,
offset_t hi);
+ std::unique_ptr<ReferenceReader>
+ MakeReadAnnotationsDirectoryToClassAnnotationSet(offset_t lo, offset_t hi);
+ std::unique_ptr<ReferenceReader> MakeReadAnnotationsDirectoryToFieldId32(
+ offset_t lo,
+ offset_t hi);
+ std::unique_ptr<ReferenceReader>
+ MakeReadAnnotationsDirectoryToFieldAnnotationSet(offset_t lo, offset_t hi);
+ std::unique_ptr<ReferenceReader> MakeReadAnnotationsDirectoryToMethodId32(
+ offset_t lo,
+ offset_t hi);
+ std::unique_ptr<ReferenceReader>
+ MakeReadAnnotationsDirectoryToMethodAnnotationSet(offset_t lo, offset_t hi);
+ std::unique_ptr<ReferenceReader>
+ MakeReadAnnotationsDirectoryToParameterMethodId32(offset_t lo, offset_t hi);
+ std::unique_ptr<ReferenceReader>
+ MakeReadAnnotationsDirectoryToParameterAnnotationSetRef(offset_t lo,
+ offset_t hi);
std::unique_ptr<ReferenceReader> MakeReadCodeToStringId16(offset_t lo,
offset_t hi);
std::unique_ptr<ReferenceReader> MakeReadCodeToStringId32(offset_t lo,
@@ -236,12 +253,18 @@ class DisassemblerDex : public Disassembler {
// Optionally supported (not all DEX files have these).
dex::MapItem annotation_set_ref_list_map_item_ = {};
dex::MapItem annotation_set_map_item_ = {};
+ dex::MapItem annotations_directory_map_item_ = {};
// Sorted list of offsets of parsed items in |image_|.
std::vector<offset_t> code_item_offsets_;
std::vector<offset_t> type_list_offsets_;
std::vector<offset_t> annotation_set_ref_list_offsets_;
std::vector<offset_t> annotation_set_offsets_;
+ std::vector<offset_t> annotations_directory_item_offsets_;
+ std::vector<offset_t> annotations_directory_item_field_annotation_offsets_;
+ std::vector<offset_t> annotations_directory_item_method_annotation_offsets_;
+ std::vector<offset_t>
+ annotations_directory_item_parameter_annotation_offsets_;
DISALLOW_COPY_AND_ASSIGN(DisassemblerDex);
};