Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_DEX_FILE_H_ |
| 4 | #define ART_SRC_DEX_FILE_H_ |
| 5 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 6 | #include <map> |
Elliott Hughes | 0c424cb | 2011-08-26 10:16:25 -0700 | [diff] [blame] | 7 | #include <string> |
Brian Carlstrom | 74eb46a | 2011-08-02 20:10:14 -0700 | [diff] [blame] | 8 | #include <vector> |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 9 | |
Elliott Hughes | 90a3369 | 2011-08-30 13:27:07 -0700 | [diff] [blame] | 10 | #include "UniquePtr.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 11 | #include "globals.h" |
Jesse Wilson | 6bf1915 | 2011-09-29 13:12:33 -0400 | [diff] [blame] | 12 | #include "jni.h" |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 13 | #include "logging.h" |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 14 | #include "mem_map.h" |
Jesse Wilson | 6bf1915 | 2011-09-29 13:12:33 -0400 | [diff] [blame] | 15 | #include "mutex.h" |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 16 | #include "stringpiece.h" |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 17 | #include "utils.h" |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 18 | |
| 19 | namespace art { |
| 20 | |
Brian Carlstrom | a6cc893 | 2012-01-04 14:44:07 -0800 | [diff] [blame] | 21 | class ZipArchive; |
| 22 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 23 | // TODO: move all of the macro functionality into the DexCache class. |
Brian Carlstrom | f615a61 | 2011-07-23 12:50:34 -0700 | [diff] [blame] | 24 | class DexFile { |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 25 | public: |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 26 | static const byte kDexMagic[]; |
| 27 | static const byte kDexMagicVersion[]; |
| 28 | static const size_t kSha1DigestSize = 20; |
Carl Shapiro | 80d4dde | 2011-06-28 16:24:07 -0700 | [diff] [blame] | 29 | |
Brian Carlstrom | b7bbba4 | 2011-10-13 14:58:47 -0700 | [diff] [blame] | 30 | // name of the DexFile entry within a zip archive |
| 31 | static const char* kClassesDex; |
| 32 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 33 | // The value of an invalid index. |
| 34 | static const uint32_t kDexNoIndex = 0xFFFFFFFF; |
| 35 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 36 | // The value of an invalid index. |
| 37 | static const uint16_t kDexNoIndex16 = 0xFFFF; |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 38 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 39 | // Raw header_item. |
| 40 | struct Header { |
| 41 | uint8_t magic_[8]; |
| 42 | uint32_t checksum_; |
| 43 | uint8_t signature_[kSha1DigestSize]; |
| 44 | uint32_t file_size_; // length of entire file |
| 45 | uint32_t header_size_; // offset to start of next section |
| 46 | uint32_t endian_tag_; |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 47 | uint32_t link_size_; // unused |
| 48 | uint32_t link_off_; // unused |
| 49 | uint32_t map_off_; // unused |
| 50 | uint32_t string_ids_size_; // number of StringIds |
| 51 | uint32_t string_ids_off_; // file offset of StringIds array |
| 52 | uint32_t type_ids_size_; // number of TypeIds, we don't support more than 65535 |
| 53 | uint32_t type_ids_off_; // file offset of TypeIds array |
| 54 | uint32_t proto_ids_size_; // number of ProtoIds, we don't support more than 65535 |
| 55 | uint32_t proto_ids_off_; // file offset of ProtoIds array |
| 56 | uint32_t field_ids_size_; // number of FieldIds |
| 57 | uint32_t field_ids_off_; // file offset of FieldIds array |
| 58 | uint32_t method_ids_size_; // number of MethodIds |
| 59 | uint32_t method_ids_off_; // file offset of MethodIds array |
| 60 | uint32_t class_defs_size_; // number of ClassDefs |
| 61 | uint32_t class_defs_off_; // file offset of ClassDef array |
| 62 | uint32_t data_size_; // unused |
| 63 | uint32_t data_off_; // unused |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 64 | private: |
| 65 | DISALLOW_COPY_AND_ASSIGN(Header); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 66 | }; |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 67 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 68 | // Raw string_id_item. |
| 69 | struct StringId { |
| 70 | uint32_t string_data_off_; // offset in bytes from the base address |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 71 | private: |
| 72 | DISALLOW_COPY_AND_ASSIGN(StringId); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | // Raw type_id_item. |
| 76 | struct TypeId { |
| 77 | uint32_t descriptor_idx_; // index into string_ids |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 78 | private: |
| 79 | DISALLOW_COPY_AND_ASSIGN(TypeId); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | // Raw field_id_item. |
| 83 | struct FieldId { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 84 | uint16_t class_idx_; // index into type_ids_ array for defining class |
| 85 | uint16_t type_idx_; // index into type_ids_ array for field type |
| 86 | uint32_t name_idx_; // index into string_ids_ array for field name |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 87 | private: |
| 88 | DISALLOW_COPY_AND_ASSIGN(FieldId); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | // Raw method_id_item. |
| 92 | struct MethodId { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 93 | uint16_t class_idx_; // index into type_ids_ array for defining class |
| 94 | uint16_t proto_idx_; // index into proto_ids_ array for method prototype |
| 95 | uint32_t name_idx_; // index into string_ids_ array for method name |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 96 | private: |
| 97 | DISALLOW_COPY_AND_ASSIGN(MethodId); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | // Raw proto_id_item. |
| 101 | struct ProtoId { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 102 | uint32_t shorty_idx_; // index into string_ids array for shorty descriptor |
| 103 | uint16_t return_type_idx_; // index into type_ids array for return type |
| 104 | uint16_t pad_; // padding = 0 |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 105 | uint32_t parameters_off_; // file offset to type_list for parameter types |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 106 | private: |
| 107 | DISALLOW_COPY_AND_ASSIGN(ProtoId); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 108 | }; |
| 109 | |
| 110 | // Raw class_def_item. |
| 111 | struct ClassDef { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 112 | uint16_t class_idx_; // index into type_ids_ array for this class |
| 113 | uint16_t pad1_; // padding = 0 |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 114 | uint32_t access_flags_; |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 115 | uint16_t superclass_idx_; // index into type_ids_ array for superclass |
| 116 | uint16_t pad2_; // padding = 0 |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 117 | uint32_t interfaces_off_; // file offset to TypeList |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 118 | uint32_t source_file_idx_; // index into string_ids_ for source file name |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 119 | uint32_t annotations_off_; // file offset to annotations_directory_item |
| 120 | uint32_t class_data_off_; // file offset to class_data_item |
| 121 | uint32_t static_values_off_; // file offset to EncodedArray |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 122 | private: |
| 123 | DISALLOW_COPY_AND_ASSIGN(ClassDef); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 124 | }; |
| 125 | |
| 126 | // Raw type_item. |
| 127 | struct TypeItem { |
| 128 | uint16_t type_idx_; // index into type_ids section |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 129 | private: |
| 130 | DISALLOW_COPY_AND_ASSIGN(TypeItem); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | // Raw type_list. |
| 134 | class TypeList { |
| 135 | public: |
| 136 | uint32_t Size() const { |
| 137 | return size_; |
| 138 | } |
| 139 | |
| 140 | const TypeItem& GetTypeItem(uint32_t idx) const { |
| 141 | CHECK_LT(idx, this->size_); |
| 142 | return this->list_[idx]; |
| 143 | } |
| 144 | |
| 145 | private: |
| 146 | uint32_t size_; // size of the list, in entries |
| 147 | TypeItem list_[1]; // elements of the list |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 148 | DISALLOW_COPY_AND_ASSIGN(TypeList); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 149 | }; |
| 150 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 151 | // Raw code_item. |
| 152 | struct CodeItem { |
| 153 | uint16_t registers_size_; |
| 154 | uint16_t ins_size_; |
| 155 | uint16_t outs_size_; |
| 156 | uint16_t tries_size_; |
| 157 | uint32_t debug_info_off_; // file offset to debug info stream |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 158 | uint32_t insns_size_in_code_units_; // size of the insns array, in 2 byte code units |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 159 | uint16_t insns_[1]; |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 160 | private: |
| 161 | DISALLOW_COPY_AND_ASSIGN(CodeItem); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 162 | }; |
| 163 | |
Carl Shapiro | 2eaa968 | 2011-08-04 19:26:11 -0700 | [diff] [blame] | 164 | // Raw try_item. |
| 165 | struct TryItem { |
| 166 | uint32_t start_addr_; |
| 167 | uint16_t insn_count_; |
| 168 | uint16_t handler_off_; |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 169 | private: |
| 170 | DISALLOW_COPY_AND_ASSIGN(TryItem); |
Carl Shapiro | 2eaa968 | 2011-08-04 19:26:11 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
Brian Carlstrom | 74eb46a | 2011-08-02 20:10:14 -0700 | [diff] [blame] | 173 | typedef std::pair<const DexFile*, const DexFile::ClassDef*> ClassPathEntry; |
| 174 | typedef std::vector<const DexFile*> ClassPath; |
| 175 | |
| 176 | // Search a collection of DexFiles for a descriptor |
| 177 | static ClassPathEntry FindInClassPath(const StringPiece& descriptor, |
Brian Carlstrom | 9ea1cb1 | 2011-08-24 23:18:18 -0700 | [diff] [blame] | 178 | const ClassPath& class_path); |
Brian Carlstrom | 74eb46a | 2011-08-02 20:10:14 -0700 | [diff] [blame] | 179 | |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 180 | // Opens a collection of .dex files |
Brian Carlstrom | ae82698 | 2011-11-09 01:33:42 -0800 | [diff] [blame] | 181 | static void OpenDexFiles(const std::vector<const char*>& dex_filenames, |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 182 | std::vector<const DexFile*>& dex_files, |
| 183 | const std::string& strip_location_prefix); |
| 184 | |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 185 | // Opens .dex file, guessing the container format based on file extension |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 186 | static const DexFile* Open(const std::string& filename, |
| 187 | const std::string& strip_location_prefix); |
jeffhao | 262bf46 | 2011-10-20 18:36:32 -0700 | [diff] [blame] | 188 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 189 | // Opens .dex file, backed by existing memory |
| 190 | static const DexFile* Open(const uint8_t* base, size_t length, const std::string& location) { |
| 191 | return OpenMemory(base, length, location, NULL); |
| 192 | } |
| 193 | |
Brian Carlstrom | a6cc893 | 2012-01-04 14:44:07 -0800 | [diff] [blame] | 194 | // Opens .dex file from the classes.dex in a zip archive |
| 195 | static const DexFile* Open(const ZipArchive& zip_archive, const std::string& location); |
| 196 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 197 | // Closes a .dex file. |
Brian Carlstrom | f615a61 | 2011-07-23 12:50:34 -0700 | [diff] [blame] | 198 | virtual ~DexFile(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 199 | |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 200 | const std::string& GetLocation() const { |
| 201 | return location_; |
| 202 | } |
| 203 | |
Jesse Wilson | 6bf1915 | 2011-09-29 13:12:33 -0400 | [diff] [blame] | 204 | // Returns a com.android.dex.Dex object corresponding to the mapped-in dex file. |
| 205 | // Used by managed code to implement annotations. |
| 206 | jobject GetDexObject(JNIEnv* env) const; |
| 207 | |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 208 | const Header& GetHeader() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 209 | CHECK(header_ != NULL) << GetLocation(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 210 | return *header_; |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 211 | } |
| 212 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 213 | // Decode the dex magic version |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 214 | uint32_t GetVersion() const; |
| 215 | |
Brian Carlstrom | 6e3b1d9 | 2012-01-11 01:36:32 -0800 | [diff] [blame] | 216 | // Returns true if the byte string points to the magic value. |
| 217 | static bool IsMagicValid(const byte* magic); |
| 218 | |
| 219 | // Returns true if the byte string after the magic is the correct value. |
| 220 | static bool IsVersionValid(const byte* magic); |
| 221 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 222 | // Returns the number of string identifiers in the .dex file. |
| 223 | size_t NumStringIds() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 224 | CHECK(header_ != NULL) << GetLocation(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 225 | return header_->string_ids_size_; |
Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 226 | } |
| 227 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 228 | // Returns the StringId at the specified index. |
| 229 | const StringId& GetStringId(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 230 | CHECK_LT(idx, NumStringIds()) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 231 | return string_ids_[idx]; |
| 232 | } |
| 233 | |
| 234 | uint32_t GetIndexForStringId(const StringId& string_id) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 235 | CHECK_GE(&string_id, string_ids_) << GetLocation(); |
| 236 | CHECK_LT(&string_id, string_ids_ + header_->string_ids_size_) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 237 | return &string_id - string_ids_; |
| 238 | } |
| 239 | |
| 240 | int32_t GetStringLength(const StringId& string_id) const; |
| 241 | |
| 242 | // Returns a pointer to the UTF-8 string data referred to by the given string_id. |
| 243 | const char* GetStringDataAndLength(const StringId& string_id, int32_t* length) const; |
| 244 | |
| 245 | const char* GetStringData(const StringId& string_id) const { |
| 246 | int32_t length; |
| 247 | return GetStringDataAndLength(string_id, &length); |
| 248 | } |
| 249 | |
| 250 | // return the UTF-8 encoded string with the specified string_id index |
| 251 | const char* StringDataAndLengthByIdx(uint32_t idx, int32_t* unicode_length) const { |
| 252 | if (idx == kDexNoIndex) { |
| 253 | *unicode_length = 0; |
| 254 | return NULL; |
| 255 | } |
| 256 | const StringId& string_id = GetStringId(idx); |
| 257 | return GetStringDataAndLength(string_id, unicode_length); |
| 258 | } |
| 259 | |
| 260 | const char* StringDataByIdx(uint32_t idx) const { |
| 261 | int32_t unicode_length; |
| 262 | return StringDataAndLengthByIdx(idx, &unicode_length); |
| 263 | } |
| 264 | |
| 265 | // Looks up a string id for a given string |
| 266 | const StringId* FindStringId(const std::string& string) const; |
| 267 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 268 | // Returns the number of type identifiers in the .dex file. |
| 269 | size_t NumTypeIds() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 270 | CHECK(header_ != NULL) << GetLocation(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 271 | return header_->type_ids_size_; |
Carl Shapiro | 5fafe2b | 2011-07-09 15:34:41 -0700 | [diff] [blame] | 272 | } |
| 273 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 274 | // Returns the TypeId at the specified index. |
| 275 | const TypeId& GetTypeId(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 276 | CHECK_LT(idx, NumTypeIds()) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 277 | return type_ids_[idx]; |
Carl Shapiro | 5fafe2b | 2011-07-09 15:34:41 -0700 | [diff] [blame] | 278 | } |
| 279 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 280 | uint16_t GetIndexForTypeId(const TypeId& type_id) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 281 | CHECK_GE(&type_id, type_ids_) << GetLocation(); |
| 282 | CHECK_LT(&type_id, type_ids_ + header_->type_ids_size_) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 283 | size_t result = &type_id - type_ids_; |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 284 | DCHECK_LT(result, 65536U) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 285 | return static_cast<uint16_t>(result); |
| 286 | } |
| 287 | |
| 288 | // Get the descriptor string associated with a given type index. |
| 289 | const char* StringByTypeIdx(uint32_t idx, int32_t* unicode_length) const { |
| 290 | const TypeId& type_id = GetTypeId(idx); |
| 291 | return StringDataAndLengthByIdx(type_id.descriptor_idx_, unicode_length); |
| 292 | } |
| 293 | |
| 294 | const char* StringByTypeIdx(uint32_t idx) const { |
| 295 | const TypeId& type_id = GetTypeId(idx); |
| 296 | return StringDataByIdx(type_id.descriptor_idx_); |
| 297 | } |
| 298 | |
| 299 | // Returns the type descriptor string of a type id. |
| 300 | const char* GetTypeDescriptor(const TypeId& type_id) const { |
| 301 | return StringDataByIdx(type_id.descriptor_idx_); |
| 302 | } |
| 303 | |
| 304 | // Looks up a type for the given string index |
| 305 | const TypeId* FindTypeId(uint32_t string_idx) const; |
| 306 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 307 | // Returns the number of field identifiers in the .dex file. |
| 308 | size_t NumFieldIds() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 309 | CHECK(header_ != NULL) << GetLocation(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 310 | return header_->field_ids_size_; |
Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 313 | // Returns the FieldId at the specified index. |
| 314 | const FieldId& GetFieldId(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 315 | CHECK_LT(idx, NumFieldIds()) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 316 | return field_ids_[idx]; |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 317 | } |
| 318 | |
Ian Rogers | 9b1a4f4 | 2011-11-14 18:35:10 -0800 | [diff] [blame] | 319 | uint32_t GetIndexForFieldId(const FieldId& field_id) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 320 | CHECK_GE(&field_id, field_ids_) << GetLocation(); |
| 321 | CHECK_LT(&field_id, field_ids_ + header_->field_ids_size_) << GetLocation(); |
Ian Rogers | 9b1a4f4 | 2011-11-14 18:35:10 -0800 | [diff] [blame] | 322 | return &field_id - field_ids_; |
| 323 | } |
| 324 | |
| 325 | // Looks up a field by its declaring class, name and type |
| 326 | const FieldId* FindFieldId(const DexFile::TypeId& declaring_klass, |
| 327 | const DexFile::StringId& name, |
| 328 | const DexFile::TypeId& type) const; |
| 329 | |
Brian Carlstrom | 6b4ef02 | 2011-10-23 14:59:04 -0700 | [diff] [blame] | 330 | // Returns the declaring class descriptor string of a field id. |
| 331 | const char* GetFieldDeclaringClassDescriptor(const FieldId& field_id) const { |
Brian Carlstrom | b9edb84 | 2011-08-28 16:31:06 -0700 | [diff] [blame] | 332 | const DexFile::TypeId& type_id = GetTypeId(field_id.class_idx_); |
| 333 | return GetTypeDescriptor(type_id); |
| 334 | } |
| 335 | |
Brian Carlstrom | 6b4ef02 | 2011-10-23 14:59:04 -0700 | [diff] [blame] | 336 | // Returns the class descriptor string of a field id. |
| 337 | const char* GetFieldTypeDescriptor(const FieldId& field_id) const { |
| 338 | const DexFile::TypeId& type_id = GetTypeId(field_id.type_idx_); |
| 339 | return GetTypeDescriptor(type_id); |
| 340 | } |
| 341 | |
Brian Carlstrom | b9edb84 | 2011-08-28 16:31:06 -0700 | [diff] [blame] | 342 | // Returns the name of a field id. |
| 343 | const char* GetFieldName(const FieldId& field_id) const { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 344 | return StringDataByIdx(field_id.name_idx_); |
Brian Carlstrom | b9edb84 | 2011-08-28 16:31:06 -0700 | [diff] [blame] | 345 | } |
| 346 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 347 | // Returns the number of method identifiers in the .dex file. |
| 348 | size_t NumMethodIds() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 349 | CHECK(header_ != NULL) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 350 | return header_->method_ids_size_; |
| 351 | } |
| 352 | |
| 353 | // Returns the MethodId at the specified index. |
| 354 | const MethodId& GetMethodId(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 355 | CHECK_LT(idx, NumMethodIds()) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 356 | return method_ids_[idx]; |
| 357 | } |
| 358 | |
| 359 | uint32_t GetIndexForMethodId(const MethodId& method_id) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 360 | CHECK_GE(&method_id, method_ids_) << GetLocation(); |
| 361 | CHECK_LT(&method_id, method_ids_ + header_->method_ids_size_) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 362 | return &method_id - method_ids_; |
| 363 | } |
| 364 | |
Ian Rogers | 9b1a4f4 | 2011-11-14 18:35:10 -0800 | [diff] [blame] | 365 | // Looks up a method by its declaring class, name and proto_id |
| 366 | const MethodId* FindMethodId(const DexFile::TypeId& declaring_klass, |
| 367 | const DexFile::StringId& name, |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 368 | const DexFile::ProtoId& signature) const; |
| 369 | |
Brian Carlstrom | 6b4ef02 | 2011-10-23 14:59:04 -0700 | [diff] [blame] | 370 | // Returns the declaring class descriptor string of a method id. |
| 371 | const char* GetMethodDeclaringClassDescriptor(const MethodId& method_id) const { |
Brian Carlstrom | 7540ff4 | 2011-09-04 16:38:46 -0700 | [diff] [blame] | 372 | const DexFile::TypeId& type_id = GetTypeId(method_id.class_idx_); |
| 373 | return GetTypeDescriptor(type_id); |
| 374 | } |
| 375 | |
jeffhao | 98eacac | 2011-09-14 16:11:53 -0700 | [diff] [blame] | 376 | // Returns the prototype of a method id. |
Brian Carlstrom | aded5f7 | 2011-10-07 17:15:04 -0700 | [diff] [blame] | 377 | const ProtoId& GetMethodPrototype(const MethodId& method_id) const { |
| 378 | return GetProtoId(method_id.proto_idx_); |
| 379 | } |
| 380 | |
| 381 | // Returns the signature of a method id. |
| 382 | const std::string GetMethodSignature(const MethodId& method_id) const { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 383 | return CreateMethodSignature(method_id.proto_idx_, NULL); |
jeffhao | 98eacac | 2011-09-14 16:11:53 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Brian Carlstrom | 7540ff4 | 2011-09-04 16:38:46 -0700 | [diff] [blame] | 386 | // Returns the name of a method id. |
| 387 | const char* GetMethodName(const MethodId& method_id) const { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 388 | return StringDataByIdx(method_id.name_idx_); |
Brian Carlstrom | 7540ff4 | 2011-09-04 16:38:46 -0700 | [diff] [blame] | 389 | } |
| 390 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 391 | // Returns the shorty of a method id. |
| 392 | const char* GetMethodShorty(const MethodId& method_id) const { |
| 393 | return StringDataByIdx(GetProtoId(method_id.proto_idx_).shorty_idx_); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 394 | } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 395 | const char* GetMethodShorty(const MethodId& method_id, int32_t* length) const { |
| 396 | return StringDataAndLengthByIdx(GetProtoId(method_id.proto_idx_).shorty_idx_, length); |
| 397 | } |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 398 | // Returns the number of class definitions in the .dex file. |
| 399 | size_t NumClassDefs() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 400 | CHECK(header_ != NULL) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 401 | return header_->class_defs_size_; |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 402 | } |
| 403 | |
| 404 | // Returns the ClassDef at the specified index. |
| 405 | const ClassDef& GetClassDef(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 406 | CHECK_LT(idx, NumClassDefs()) << GetLocation(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 407 | return class_defs_[idx]; |
| 408 | } |
| 409 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 410 | uint32_t GetIndexForClassDef(const ClassDef& class_def) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 411 | CHECK_GE(&class_def, class_defs_) << GetLocation(); |
| 412 | CHECK_LT(&class_def, class_defs_ + header_->class_defs_size_) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 413 | return &class_def - class_defs_; |
| 414 | } |
| 415 | |
| 416 | // Returns the class descriptor string of a class definition. |
| 417 | const char* GetClassDescriptor(const ClassDef& class_def) const { |
| 418 | return StringByTypeIdx(class_def.class_idx_); |
| 419 | } |
| 420 | |
| 421 | // Looks up a class definition by its class descriptor. |
| 422 | const ClassDef* FindClassDef(const StringPiece& descriptor) const; |
| 423 | |
| 424 | // Looks up a class definition index by its class descriptor. |
| 425 | bool FindClassDefIndex(const StringPiece& descriptor, uint32_t& idx) const; |
| 426 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 427 | const TypeList* GetInterfacesList(const ClassDef& class_def) const { |
| 428 | if (class_def.interfaces_off_ == 0) { |
| 429 | return NULL; |
| 430 | } else { |
| 431 | const byte* addr = base_ + class_def.interfaces_off_; |
| 432 | return reinterpret_cast<const TypeList*>(addr); |
| 433 | } |
| 434 | } |
| 435 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 436 | // Returns a pointer to the raw memory mapped class_data_item |
| 437 | const byte* GetClassData(const ClassDef& class_def) const { |
| 438 | if (class_def.class_data_off_ == 0) { |
| 439 | return NULL; |
| 440 | } else { |
| 441 | return base_ + class_def.class_data_off_; |
| 442 | } |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 443 | } |
| 444 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 445 | // |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 446 | const CodeItem* GetCodeItem(const uint32_t code_off) const { |
| 447 | if (code_off == 0) { |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 448 | return NULL; // native or abstract method |
| 449 | } else { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 450 | const byte* addr = base_ + code_off; |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 451 | return reinterpret_cast<const CodeItem*>(addr); |
| 452 | } |
| 453 | } |
| 454 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 455 | const char* GetReturnTypeDescriptor(const ProtoId& proto_id) const { |
| 456 | return StringByTypeIdx(proto_id.return_type_idx_); |
| 457 | } |
| 458 | |
| 459 | // Returns the number of prototype identifiers in the .dex file. |
| 460 | size_t NumProtoIds() const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 461 | CHECK(header_ != NULL) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 462 | return header_->proto_ids_size_; |
| 463 | } |
| 464 | |
| 465 | // Returns the ProtoId at the specified index. |
| 466 | const ProtoId& GetProtoId(uint32_t idx) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 467 | CHECK_LT(idx, NumProtoIds()) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 468 | return proto_ids_[idx]; |
| 469 | } |
| 470 | |
| 471 | uint16_t GetIndexForProtoId(const ProtoId& proto_id) const { |
Brian Carlstrom | 61e513c | 2011-12-09 15:30:06 -0800 | [diff] [blame] | 472 | CHECK_GE(&proto_id, proto_ids_) << GetLocation(); |
| 473 | CHECK_LT(&proto_id, proto_ids_ + header_->proto_ids_size_) << GetLocation(); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 474 | return &proto_id - proto_ids_; |
| 475 | } |
| 476 | |
| 477 | // Looks up a proto id for a given return type and signature type list |
| 478 | const ProtoId* FindProtoId(uint16_t return_type_id, |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 479 | const std::vector<uint16_t>& signature_type_idxs_) const; |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 480 | |
| 481 | // Given a signature place the type ids into the given vector, returns true on success |
| 482 | bool CreateTypeList(uint16_t* return_type_idx, std::vector<uint16_t>* param_type_idxs, |
| 483 | const std::string& signature) const; |
| 484 | |
| 485 | // Given a proto_idx decode the type list and return type into a method signature |
| 486 | std::string CreateMethodSignature(uint32_t proto_idx, int32_t* unicode_length) const; |
| 487 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 488 | // Returns the short form method descriptor for the given prototype. |
| 489 | const char* GetShorty(uint32_t proto_idx) const { |
| 490 | const ProtoId& proto_id = GetProtoId(proto_idx); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 491 | return StringDataByIdx(proto_id.shorty_idx_); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | const TypeList* GetProtoParameters(const ProtoId& proto_id) const { |
| 495 | if (proto_id.parameters_off_ == 0) { |
| 496 | return NULL; |
| 497 | } else { |
| 498 | const byte* addr = base_ + proto_id.parameters_off_; |
| 499 | return reinterpret_cast<const TypeList*>(addr); |
| 500 | } |
| 501 | } |
| 502 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 503 | const byte* GetEncodedStaticFieldValuesArray(const ClassDef& class_def) const { |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 504 | if (class_def.static_values_off_ == 0) { |
| 505 | return 0; |
| 506 | } else { |
| 507 | return base_ + class_def.static_values_off_; |
| 508 | } |
| 509 | } |
| 510 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 511 | static const TryItem* GetTryItems(const CodeItem& code_item, uint32_t offset) { |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 512 | const uint16_t* insns_end_ = &code_item.insns_[code_item.insns_size_in_code_units_]; |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 513 | return reinterpret_cast<const TryItem*> |
| 514 | (RoundUp(reinterpret_cast<uint32_t>(insns_end_), 4)) + offset; |
| 515 | } |
| 516 | |
| 517 | // Get the base of the encoded data for the given DexCode. |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 518 | static const byte* GetCatchHandlerData(const CodeItem& code_item, uint32_t offset) { |
| 519 | const byte* handler_data = |
| 520 | reinterpret_cast<const byte*>(GetTryItems(code_item, code_item.tries_size_)); |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 521 | return handler_data + offset; |
| 522 | } |
| 523 | |
| 524 | // Find the handler associated with a given address, if any. |
| 525 | // Initializes the given iterator and returns true if a match is |
| 526 | // found. Returns end if there is no applicable handler. |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 527 | static int32_t FindCatchHandlerOffset(const CodeItem &code_item, int32_t tries_size, |
| 528 | uint32_t address); |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 529 | |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 530 | // Get the pointer to the start of the debugging data |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 531 | const byte* GetDebugInfoStream(const CodeItem* code_item) const { |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 532 | if (code_item->debug_info_off_ == 0) { |
| 533 | return NULL; |
| 534 | } else { |
| 535 | return base_ + code_item->debug_info_off_; |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | // Callback for "new position table entry". |
| 540 | // Returning true causes the decoder to stop early. |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 541 | typedef bool (*DexDebugNewPositionCb)(void* cnxt, uint32_t address, uint32_t line_num); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 542 | |
| 543 | // Callback for "new locals table entry". "signature" is an empty string |
| 544 | // if no signature is available for an entry. |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 545 | typedef void (*DexDebugNewLocalCb)(void* cnxt, uint16_t reg, |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 546 | uint32_t startAddress, |
| 547 | uint32_t endAddress, |
Brian Carlstrom | 40381fb | 2011-10-19 14:13:40 -0700 | [diff] [blame] | 548 | const char* name, |
| 549 | const char* descriptor, |
| 550 | const char* signature); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 551 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 552 | static bool LineNumForPcCb(void* cnxt, uint32_t address, uint32_t line_num); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 553 | |
| 554 | // Debug info opcodes and constants |
| 555 | enum { |
| 556 | DBG_END_SEQUENCE = 0x00, |
| 557 | DBG_ADVANCE_PC = 0x01, |
| 558 | DBG_ADVANCE_LINE = 0x02, |
| 559 | DBG_START_LOCAL = 0x03, |
| 560 | DBG_START_LOCAL_EXTENDED = 0x04, |
| 561 | DBG_END_LOCAL = 0x05, |
| 562 | DBG_RESTART_LOCAL = 0x06, |
| 563 | DBG_SET_PROLOGUE_END = 0x07, |
| 564 | DBG_SET_EPILOGUE_BEGIN = 0x08, |
| 565 | DBG_SET_FILE = 0x09, |
| 566 | DBG_FIRST_SPECIAL = 0x0a, |
| 567 | DBG_LINE_BASE = -4, |
| 568 | DBG_LINE_RANGE = 15, |
| 569 | }; |
| 570 | |
| 571 | struct LocalInfo { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 572 | LocalInfo() : name_(NULL), descriptor_(NULL), signature_(NULL), start_address_(0), |
| 573 | is_live_(false) {} |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 574 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 575 | const char* name_; // E.g., list |
| 576 | const char* descriptor_; // E.g., Ljava/util/LinkedList; |
| 577 | const char* signature_; // E.g., java.util.LinkedList<java.lang.Integer> |
| 578 | uint16_t start_address_; // PC location where the local is first defined. |
| 579 | bool is_live_; // Is the local defined and live. |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 580 | |
| 581 | private: |
| 582 | DISALLOW_COPY_AND_ASSIGN(LocalInfo); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | struct LineNumFromPcContext { |
| 586 | LineNumFromPcContext(uint32_t address, uint32_t line_num) : |
| 587 | address_(address), line_num_(line_num) {} |
| 588 | uint32_t address_; |
| 589 | uint32_t line_num_; |
Brian Carlstrom | d2fbb2b | 2011-08-23 11:57:08 -0700 | [diff] [blame] | 590 | private: |
| 591 | DISALLOW_COPY_AND_ASSIGN(LineNumFromPcContext); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 592 | }; |
| 593 | |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 594 | void InvokeLocalCbIfLive(void* cnxt, int reg, uint32_t end_address, |
| 595 | LocalInfo* local_in_reg, DexDebugNewLocalCb local_cb) const { |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 596 | if (local_cb != NULL && local_in_reg[reg].is_live_) { |
| 597 | local_cb(cnxt, reg, local_in_reg[reg].start_address_, end_address, |
Elliott Hughes | dbb4079 | 2011-11-18 17:05:22 -0800 | [diff] [blame] | 598 | local_in_reg[reg].name_, local_in_reg[reg].descriptor_, |
| 599 | local_in_reg[reg].signature_ != NULL ? local_in_reg[reg].signature_ : ""); |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 600 | } |
| 601 | } |
| 602 | |
| 603 | // Determine the source file line number based on the program counter. |
| 604 | // "pc" is an offset, in 16-bit units, from the start of the method's code. |
| 605 | // |
| 606 | // Returns -1 if no match was found (possibly because the source files were |
| 607 | // compiled without "-g", so no line number information is present). |
| 608 | // Returns -2 for native methods (as expected in exception traces). |
| 609 | // |
| 610 | // This is used by runtime; therefore use art::Method not art::DexFile::Method. |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 611 | int32_t GetLineNumFromPC(const Method* method, uint32_t rel_pc) const; |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 612 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 613 | void DecodeDebugInfo(const CodeItem* code_item, bool is_static, uint32_t method_idx, |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 614 | DexDebugNewPositionCb posCb, DexDebugNewLocalCb local_cb, |
| 615 | void* cnxt) const; |
Shih-wei Liao | 195487c | 2011-08-20 13:29:04 -0700 | [diff] [blame] | 616 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 617 | const char* GetSourceFile(const ClassDef& class_def) const { |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 618 | if (class_def.source_file_idx_ == 0xffffffff) { |
| 619 | return NULL; |
| 620 | } else { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 621 | return StringDataByIdx(class_def.source_file_idx_); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 622 | } |
Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame] | 623 | } |
| 624 | |
jeffhao | b4df514 | 2011-09-19 20:25:32 -0700 | [diff] [blame] | 625 | void ChangePermissions(int prot) const; |
| 626 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 627 | private: |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 628 | |
| 629 | // Opens a .dex file |
| 630 | static const DexFile* OpenFile(const std::string& filename, |
| 631 | const std::string& original_location, |
| 632 | const std::string& strip_location_prefix); |
| 633 | |
| 634 | // Opens a dex file from within a .jar, .zip, or .apk file |
| 635 | static const DexFile* OpenZip(const std::string& filename, |
| 636 | const std::string& strip_location_prefix); |
| 637 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 638 | // Opens a .dex file at the given address backed by a MemMap |
| 639 | static const DexFile* OpenMemory(const std::string& location, |
| 640 | MemMap* mem_map) { |
| 641 | return OpenMemory(mem_map->GetAddress(), |
| 642 | mem_map->GetLength(), |
| 643 | location, |
| 644 | mem_map); |
| 645 | } |
| 646 | |
| 647 | // Opens a .dex file at the given address, optionally backed by a MemMap |
Brian Carlstrom | 58ae941 | 2011-10-04 00:56:06 -0700 | [diff] [blame] | 648 | static const DexFile* OpenMemory(const byte* dex_file, |
| 649 | size_t length, |
| 650 | const std::string& location, |
| 651 | MemMap* mem_map); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 652 | |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 653 | DexFile(const byte* base, size_t length, const std::string& location, MemMap* mem_map) |
| 654 | : base_(base), |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 655 | length_(length), |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 656 | location_(location), |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 657 | mem_map_(mem_map), |
Jesse Wilson | 6bf1915 | 2011-09-29 13:12:33 -0400 | [diff] [blame] | 658 | dex_object_lock_("a dex_object_lock_"), |
| 659 | dex_object_(NULL), |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 660 | header_(0), |
| 661 | string_ids_(0), |
| 662 | type_ids_(0), |
| 663 | field_ids_(0), |
| 664 | method_ids_(0), |
| 665 | proto_ids_(0), |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 666 | class_defs_(0) { |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 667 | CHECK(base_ != NULL) << GetLocation(); |
| 668 | CHECK_GT(length_, 0U) << GetLocation(); |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 669 | } |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 670 | |
| 671 | // Top-level initializer that calls other Init methods. |
| 672 | bool Init(); |
| 673 | |
| 674 | // Caches pointers into to the various file sections. |
| 675 | void InitMembers(); |
| 676 | |
| 677 | // Builds the index of descriptors to class definitions. |
| 678 | void InitIndex(); |
| 679 | |
Brian Carlstrom | 6e3b1d9 | 2012-01-11 01:36:32 -0800 | [diff] [blame] | 680 | // Returns true if the header magic and version numbers are of the expected values. |
| 681 | bool CheckMagicAndVersion(); |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 682 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 683 | void DecodeDebugInfo0(const CodeItem* code_item, bool is_static, uint32_t method_idx, |
Elliott Hughes | 03181a8 | 2011-11-17 17:22:21 -0800 | [diff] [blame] | 684 | DexDebugNewPositionCb posCb, DexDebugNewLocalCb local_cb, |
| 685 | void* cnxt, const byte* stream, LocalInfo* local_in_reg) const; |
| 686 | |
| 687 | |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 688 | // The index of descriptors to class definition indexes (as opposed to type id indexes) |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 689 | typedef std::map<const StringPiece, uint32_t> Index; |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 690 | Index index_; |
| 691 | |
| 692 | // The base address of the memory mapping. |
| 693 | const byte* base_; |
| 694 | |
| 695 | // The size of the underlying memory allocation in bytes. |
| 696 | size_t length_; |
| 697 | |
Elliott Hughes | 64bf5a3 | 2011-09-20 14:43:12 -0700 | [diff] [blame] | 698 | // Typically the dex file name when available, alternatively some identifying string. |
Brian Carlstrom | a663ea5 | 2011-08-19 23:33:41 -0700 | [diff] [blame] | 699 | // |
| 700 | // The ClassLinker will use this to match DexFiles the boot class |
| 701 | // path to DexCache::GetLocation when loading from an image. |
| 702 | const std::string location_; |
| 703 | |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 704 | // Manages the underlying memory allocation. |
| 705 | UniquePtr<MemMap> mem_map_; |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 706 | |
Jesse Wilson | 6bf1915 | 2011-09-29 13:12:33 -0400 | [diff] [blame] | 707 | // A cached com.android.dex.Dex instance, possibly NULL. Use GetDexObject. |
| 708 | mutable Mutex dex_object_lock_; |
| 709 | mutable jobject dex_object_; |
| 710 | |
Brian Carlstrom | 7e49dca | 2011-07-22 18:07:34 -0700 | [diff] [blame] | 711 | // Points to the header section. |
| 712 | const Header* header_; |
| 713 | |
| 714 | // Points to the base of the string identifier list. |
| 715 | const StringId* string_ids_; |
| 716 | |
| 717 | // Points to the base of the type identifier list. |
| 718 | const TypeId* type_ids_; |
| 719 | |
| 720 | // Points to the base of the field identifier list. |
| 721 | const FieldId* field_ids_; |
| 722 | |
| 723 | // Points to the base of the method identifier list. |
| 724 | const MethodId* method_ids_; |
| 725 | |
| 726 | // Points to the base of the prototype identifier list. |
| 727 | const ProtoId* proto_ids_; |
| 728 | |
| 729 | // Points to the base of the class definition list. |
| 730 | const ClassDef* class_defs_; |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 731 | }; |
| 732 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 733 | // Iterate over a dex file's ProtoId's paramters |
| 734 | class DexFileParameterIterator { |
| 735 | public: |
| 736 | DexFileParameterIterator(const DexFile& dex_file, const DexFile::ProtoId& proto_id) |
| 737 | : dex_file_(dex_file), size_(0), pos_(0) { |
| 738 | type_list_ = dex_file_.GetProtoParameters(proto_id); |
| 739 | if (type_list_ != NULL) { |
| 740 | size_ = type_list_->Size(); |
| 741 | } |
| 742 | } |
| 743 | bool HasNext() const { return pos_ < size_; } |
| 744 | void Next() { ++pos_; } |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 745 | uint16_t GetTypeIdx() { |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 746 | return type_list_->GetTypeItem(pos_).type_idx_; |
| 747 | } |
| 748 | const char* GetDescriptor() { |
Ian Rogers | 6d4d9fc | 2011-11-30 16:24:48 -0800 | [diff] [blame] | 749 | return dex_file_.StringByTypeIdx(GetTypeIdx()); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 750 | } |
| 751 | private: |
| 752 | const DexFile& dex_file_; |
| 753 | const DexFile::TypeList* type_list_; |
| 754 | uint32_t size_; |
| 755 | uint32_t pos_; |
| 756 | DISALLOW_IMPLICIT_CONSTRUCTORS(DexFileParameterIterator); |
| 757 | }; |
| 758 | |
| 759 | // Iterate and decode class_data_item |
| 760 | class ClassDataItemIterator { |
| 761 | public: |
| 762 | ClassDataItemIterator(const DexFile& dex_file, const byte* raw_class_data_item) |
| 763 | : dex_file_(dex_file), pos_(0), ptr_pos_(raw_class_data_item), last_idx_(0) { |
| 764 | ReadClassDataHeader(); |
| 765 | if (EndOfInstanceFieldsPos() > 0) { |
| 766 | ReadClassDataField(); |
| 767 | } else if (EndOfVirtualMethodsPos() > 0) { |
| 768 | ReadClassDataMethod(); |
| 769 | } |
| 770 | } |
| 771 | uint32_t NumStaticFields() const { |
| 772 | return header_.static_fields_size_; |
| 773 | } |
| 774 | uint32_t NumInstanceFields() const { |
| 775 | return header_.instance_fields_size_; |
| 776 | } |
| 777 | uint32_t NumDirectMethods() const { |
| 778 | return header_.direct_methods_size_; |
| 779 | } |
| 780 | uint32_t NumVirtualMethods() const { |
| 781 | return header_.virtual_methods_size_; |
| 782 | } |
| 783 | bool HasNextStaticField() const { |
| 784 | return pos_ < EndOfStaticFieldsPos(); |
| 785 | } |
| 786 | bool HasNextInstanceField() const { |
| 787 | return pos_ >= EndOfStaticFieldsPos() && pos_ < EndOfInstanceFieldsPos(); |
| 788 | } |
| 789 | bool HasNextDirectMethod() const { |
| 790 | return pos_ >= EndOfInstanceFieldsPos() && pos_ < EndOfDirectMethodsPos(); |
| 791 | } |
| 792 | bool HasNextVirtualMethod() const { |
| 793 | return pos_ >= EndOfDirectMethodsPos() && pos_ < EndOfVirtualMethodsPos(); |
| 794 | } |
| 795 | bool HasNext() const { |
| 796 | return pos_ < EndOfVirtualMethodsPos(); |
| 797 | } |
| 798 | void Next() { |
| 799 | pos_++; |
| 800 | if (pos_ < EndOfStaticFieldsPos()) { |
| 801 | last_idx_ = GetMemberIndex(); |
| 802 | ReadClassDataField(); |
| 803 | } else if (pos_ == EndOfStaticFieldsPos() && NumInstanceFields() > 0) { |
| 804 | last_idx_ = 0; // transition to next array, reset last index |
| 805 | ReadClassDataField(); |
| 806 | } else if (pos_ < EndOfInstanceFieldsPos()) { |
| 807 | last_idx_ = GetMemberIndex(); |
| 808 | ReadClassDataField(); |
| 809 | } else if (pos_ == EndOfInstanceFieldsPos() && NumDirectMethods() > 0) { |
| 810 | last_idx_ = 0; // transition to next array, reset last index |
| 811 | ReadClassDataMethod(); |
| 812 | } else if (pos_ < EndOfDirectMethodsPos()) { |
| 813 | last_idx_ = GetMemberIndex(); |
| 814 | ReadClassDataMethod(); |
| 815 | } else if (pos_ == EndOfDirectMethodsPos() && NumVirtualMethods() > 0) { |
| 816 | last_idx_ = 0; // transition to next array, reset last index |
| 817 | ReadClassDataMethod(); |
| 818 | } else if (pos_ < EndOfVirtualMethodsPos()) { |
| 819 | last_idx_ = GetMemberIndex(); |
| 820 | ReadClassDataMethod(); |
| 821 | } else { |
| 822 | DCHECK(!HasNext()); |
| 823 | } |
| 824 | } |
| 825 | uint32_t GetMemberIndex() const { |
| 826 | if (pos_ < EndOfInstanceFieldsPos()) { |
| 827 | return last_idx_ + field_.field_idx_delta_; |
| 828 | } else { |
| 829 | CHECK_LT(pos_, EndOfVirtualMethodsPos()); |
| 830 | return last_idx_ + method_.method_idx_delta_; |
| 831 | } |
| 832 | } |
| 833 | uint32_t GetMemberAccessFlags() const { |
| 834 | if (pos_ < EndOfInstanceFieldsPos()) { |
| 835 | return field_.access_flags_; |
| 836 | } else { |
| 837 | CHECK_LT(pos_, EndOfVirtualMethodsPos()); |
| 838 | return method_.access_flags_; |
| 839 | } |
| 840 | } |
| 841 | const DexFile::CodeItem* GetMethodCodeItem() const { |
| 842 | return dex_file_.GetCodeItem(method_.code_off_); |
| 843 | } |
| 844 | uint32_t GetMethodCodeItemOffset() const { |
| 845 | return method_.code_off_; |
| 846 | } |
| 847 | private: |
| 848 | // A dex file's class_data_item is leb128 encoded, this structure holds a decoded form of the |
| 849 | // header for a class_data_item |
| 850 | struct ClassDataHeader { |
| 851 | uint32_t static_fields_size_; // the number of static fields |
| 852 | uint32_t instance_fields_size_; // the number of instance fields |
| 853 | uint32_t direct_methods_size_; // the number of direct methods |
| 854 | uint32_t virtual_methods_size_; // the number of virtual methods |
| 855 | } header_; |
| 856 | |
| 857 | // Read and decode header from a class_data_item stream into header |
| 858 | void ReadClassDataHeader(); |
| 859 | |
| 860 | uint32_t EndOfStaticFieldsPos() const { |
| 861 | return header_.static_fields_size_; |
| 862 | } |
| 863 | uint32_t EndOfInstanceFieldsPos() const { |
| 864 | return EndOfStaticFieldsPos() + header_.instance_fields_size_; |
| 865 | } |
| 866 | uint32_t EndOfDirectMethodsPos() const { |
| 867 | return EndOfInstanceFieldsPos() + header_.direct_methods_size_; |
| 868 | } |
| 869 | uint32_t EndOfVirtualMethodsPos() const { |
| 870 | return EndOfDirectMethodsPos() + header_.virtual_methods_size_; |
| 871 | } |
| 872 | |
| 873 | // A decoded version of the field of a class_data_item |
| 874 | struct ClassDataField { |
| 875 | uint32_t field_idx_delta_; // delta of index into the field_ids array for FieldId |
| 876 | uint32_t access_flags_; // access flags for the field |
| 877 | ClassDataField() : field_idx_delta_(0), access_flags_(0) {} |
| 878 | private: |
| 879 | DISALLOW_COPY_AND_ASSIGN(ClassDataField); |
| 880 | } field_; |
| 881 | |
| 882 | // Read and decode a field from a class_data_item stream into field |
| 883 | void ReadClassDataField(); |
| 884 | |
| 885 | // A decoded version of the method of a class_data_item |
| 886 | struct ClassDataMethod { |
| 887 | uint32_t method_idx_delta_; // delta of index into the method_ids array for MethodId |
| 888 | uint32_t access_flags_; |
| 889 | uint32_t code_off_; |
| 890 | ClassDataMethod() : method_idx_delta_(0), access_flags_(0), code_off_(0) {} |
| 891 | private: |
| 892 | DISALLOW_COPY_AND_ASSIGN(ClassDataMethod); |
| 893 | } method_; |
| 894 | |
| 895 | // Read and decode a method from a class_data_item stream into method |
| 896 | void ReadClassDataMethod(); |
| 897 | |
| 898 | const DexFile& dex_file_; |
| 899 | size_t pos_; // integral number of items passed |
| 900 | const byte* ptr_pos_; // pointer into stream of class_data_item |
| 901 | uint32_t last_idx_; // last read field or method index to apply delta to |
| 902 | DISALLOW_IMPLICIT_CONSTRUCTORS(ClassDataItemIterator); |
| 903 | }; |
| 904 | |
| 905 | class ClassLinker; |
| 906 | class DexCache; |
| 907 | class Field; |
| 908 | |
| 909 | class EncodedStaticFieldValueIterator { |
| 910 | public: |
| 911 | EncodedStaticFieldValueIterator(const DexFile& dex_file, DexCache* dex_cache, |
| 912 | ClassLinker* linker, const DexFile::ClassDef& class_def); |
| 913 | |
| 914 | void ReadValueToField(Field* field) const; |
| 915 | |
| 916 | bool HasNext() { return pos_ < array_size_; } |
| 917 | |
| 918 | void Next(); |
| 919 | private: |
| 920 | enum ValueType { |
| 921 | kByte = 0x00, |
| 922 | kShort = 0x02, |
| 923 | kChar = 0x03, |
| 924 | kInt = 0x04, |
| 925 | kLong = 0x06, |
| 926 | kFloat = 0x10, |
| 927 | kDouble = 0x11, |
| 928 | kString = 0x17, |
| 929 | kType = 0x18, |
| 930 | kField = 0x19, |
| 931 | kMethod = 0x1a, |
| 932 | kEnum = 0x1b, |
| 933 | kArray = 0x1c, |
| 934 | kAnnotation = 0x1d, |
| 935 | kNull = 0x1e, |
| 936 | kBoolean = 0x1f |
| 937 | }; |
| 938 | |
| 939 | static const byte kEncodedValueTypeMask = 0x1f; // 0b11111 |
| 940 | static const byte kEncodedValueArgShift = 5; |
| 941 | |
| 942 | const DexFile& dex_file_; |
| 943 | DexCache* dex_cache_; // dex cache to resolve literal objects |
| 944 | ClassLinker* linker_; // linker to resolve literal objects |
| 945 | size_t array_size_; // size of array |
| 946 | size_t pos_; // current position |
| 947 | const byte* ptr_; // pointer into encoded data array |
| 948 | byte type_; // type of current encoded value |
| 949 | jvalue jval_; // value of current encoded value |
| 950 | DISALLOW_IMPLICIT_CONSTRUCTORS(EncodedStaticFieldValueIterator); |
| 951 | }; |
| 952 | |
| 953 | class CatchHandlerIterator { |
| 954 | public: |
| 955 | CatchHandlerIterator(const DexFile::CodeItem& code_item, uint32_t address); |
| 956 | explicit CatchHandlerIterator(const byte* handler_data) { |
| 957 | Init(handler_data); |
| 958 | } |
| 959 | |
| 960 | uint16_t GetHandlerTypeIndex() const { |
| 961 | return handler_.type_idx_; |
| 962 | } |
| 963 | uint32_t GetHandlerAddress() const { |
| 964 | return handler_.address_; |
| 965 | } |
| 966 | void Next(); |
| 967 | bool HasNext() const { |
| 968 | return remaining_count_ != -1 || catch_all_; |
| 969 | } |
| 970 | // End of this set of catch blocks, convenience method to locate next set of catch blocks |
| 971 | const byte* EndDataPointer() const { |
| 972 | CHECK(!HasNext()); |
| 973 | return current_data_; |
| 974 | } |
| 975 | private: |
| 976 | void Init(const byte* handler_data); |
| 977 | |
| 978 | struct CatchHandlerItem { |
| 979 | uint16_t type_idx_; // type index of the caught exception type |
| 980 | uint32_t address_; // handler address |
| 981 | } handler_; |
| 982 | const byte *current_data_; // the current handler in dex file. |
| 983 | int32_t remaining_count_; // number of handlers not read. |
| 984 | bool catch_all_; // is there a handler that will catch all exceptions in case |
| 985 | // that all typed handler does not match. |
| 986 | }; |
| 987 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 988 | } // namespace art |
| 989 | |
| 990 | #endif // ART_SRC_DEX_FILE_H_ |