এই ডকুমেন্টটি .dex
ফাইলের লেআউট এবং বিষয়বস্তু বর্ণনা করে, যেগুলি ক্লাস সংজ্ঞা এবং তাদের সংশ্লিষ্ট উপাত্তের একটি সেট রাখতে ব্যবহৃত হয়।
প্রকারের নির্দেশিকা
নাম | বর্ণনা |
---|---|
বাইট | 8-বিট স্বাক্ষরিত int |
ubyte | 8-বিট স্বাক্ষরবিহীন int |
সংক্ষিপ্ত | 16-বিট স্বাক্ষরিত int, সামান্য-এন্ডিয়ান |
ছোট | 16-বিট স্বাক্ষরবিহীন int, সামান্য-এন্ডিয়ান |
int | 32-বিট স্বাক্ষরিত int, সামান্য-এন্ডিয়ান |
uint | 32-বিট স্বাক্ষরবিহীন int, সামান্য-এন্ডিয়ান |
দীর্ঘ | 64-বিট স্বাক্ষরিত int, সামান্য-এন্ডিয়ান |
ulong | 64-বিট স্বাক্ষরবিহীন int, সামান্য-এন্ডিয়ান |
sleb128 | স্বাক্ষরিত LEB128, পরিবর্তনশীল-দৈর্ঘ্য (নীচে দেখুন) |
uleb128 | স্বাক্ষরবিহীন LEB128, পরিবর্তনশীল-দৈর্ঘ্য (নীচে দেখুন) |
uleb128p1 | স্বাক্ষরবিহীন LEB128 প্লাস 1 , পরিবর্তনশীল-দৈর্ঘ্য (নীচে দেখুন) |
LEB128
LEB128 (" L ittle- E ndian B ase 128 ") হল একটি পরিবর্তনশীল-দৈর্ঘ্যের এনকোডিং যা ইচ্ছাকৃতভাবে স্বাক্ষরিত বা স্বাক্ষরবিহীন পূর্ণসংখ্যার পরিমাণের জন্য। বিন্যাসটি DWARF3 স্পেসিফিকেশন থেকে ধার করা হয়েছে। একটি .dex
ফাইলে, LEB128 শুধুমাত্র 32-বিট পরিমাণ এনকোড করতে ব্যবহৃত হয়।
প্রতিটি LEB128 এনকোড করা মান এক থেকে পাঁচ বাইট নিয়ে গঠিত, যা একসাথে একটি একক 32-বিট মান উপস্থাপন করে। প্রতিটি বাইটের সবচেয়ে গুরুত্বপূর্ণ বিট সেট আছে সিকোয়েন্সের চূড়ান্ত বাইট ব্যতীত, যার সবচেয়ে উল্লেখযোগ্য বিট পরিষ্কার রয়েছে। প্রতিটি বাইটের অবশিষ্ট সাতটি বিট হল পেলোড, প্রথম বাইটে পরিমাণের ন্যূনতম সাতটি বিট, দ্বিতীয় বাইটে পরের সাতটি এবং আরও অনেক কিছু। একটি স্বাক্ষরিত LEB128 ( sleb128
) ক্ষেত্রে, অনুক্রমের চূড়ান্ত বাইটের সবচেয়ে উল্লেখযোগ্য পেলোড বিটটি চূড়ান্ত মান তৈরি করতে সাইন-বর্ধিত হয়। স্বাক্ষরবিহীন ক্ষেত্রে ( uleb128
), যে কোনো বিট স্পষ্টভাবে উপস্থাপিত হয় না তাকে 0
হিসাবে ব্যাখ্যা করা হয়।
একটি দুই-বাইট LEB128 মানের বিটওয়াইজ ডায়াগ্রাম | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
প্রথম বাইট | দ্বিতীয় বাইট | ||||||||||||||
1 | বিট 6 | বিট 5 | বিট 4 | বিট 3 | বিট 2 | বিট 1 | বিট 0 | 0 | বিট 13 | বিট 12 | বিট 11 | বিট 10 | বিট 9 | বিট 8 | বিট 7 |
বৈকল্পিক uleb128p1
একটি স্বাক্ষরিত মানকে উপস্থাপন করতে ব্যবহৃত হয়, যেখানে উপস্থাপনাটি মান এবং একটি uleb128
হিসাবে এনকোড করা হয়। এটি -1
-এর এনকোডিং করে (বিকল্পভাবে অস্বাক্ষরিত মান 0xffffffff
হিসাবে মনে করা হয়) — তবে অন্য কোনও ঋণাত্মক সংখ্যা নয় — একটি একক বাইট, এবং ঠিক সেই ক্ষেত্রেই কার্যকর যেখানে প্রতিনিধিত্ব করা সংখ্যাটি অবশ্যই অ-ঋণাত্মক বা -1
(অথবা) হতে হবে। 0xffffffff
), এবং যেখানে অন্য কোনও নেতিবাচক মান অনুমোদিত নয় (বা যেখানে বড় স্বাক্ষরবিহীন মানগুলির প্রয়োজন হওয়ার সম্ভাবনা নেই)।
এখানে বিন্যাসের কিছু উদাহরণ রয়েছে:
এনকোডেড সিকোয়েন্স | sleb128 হিসাবে | uleb128 হিসাবে | uleb128p1 হিসাবে |
---|---|---|---|
00 | 0 | 0 | -1 |
01 | 1 | 1 | 0 |
7f | -1 | 127 | 126 |
80 7f | -128 | 16256 | 16255 |
ফাইল লেআউট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
হেডার | হেডার_আইটেম | হেডার |
স্ট্রিং_আইডি | স্ট্রিং_আইডি_আইটেম[] | স্ট্রিং শনাক্তকারী তালিকা. এগুলি এই ফাইলের দ্বারা ব্যবহৃত সমস্ত স্ট্রিংগুলির জন্য শনাক্তকারী, হয় অভ্যন্তরীণ নামকরণের জন্য (যেমন, টাইপ বর্ণনাকারী) বা কোড দ্বারা উল্লেখিত ধ্রুবক বস্তু হিসাবে। এই তালিকাটি অবশ্যই UTF-16 কোড পয়েন্ট মান ব্যবহার করে স্ট্রিং বিষয়বস্তু দ্বারা বাছাই করা উচিত (স্থানীয়-সংবেদনশীল পদ্ধতিতে নয়), এবং এটিতে অবশ্যই কোনো ডুপ্লিকেট এন্ট্রি থাকবে না। |
type_ids | টাইপ_আইডি_আইটেম[] | টাইপ শনাক্তকারী তালিকা. ফাইলে সংজ্ঞায়িত হোক বা না হোক এই ফাইলের দ্বারা উল্লেখ করা সমস্ত প্রকারের (শ্রেণী, অ্যারে, বা আদিম প্রকার) জন্য এইগুলি শনাক্তকারী৷ এই তালিকাটি string_id সূচী অনুসারে বাছাই করা আবশ্যক, এবং এটিতে অবশ্যই কোনো ডুপ্লিকেট এন্ট্রি থাকবে না। |
proto_ids | প্রোটো_আইডি_আইটেম[] | পদ্ধতি প্রোটোটাইপ শনাক্তকারী তালিকা. এই ফাইলের দ্বারা উল্লেখ করা সমস্ত প্রোটোটাইপের জন্য এইগুলি শনাক্তকারী৷ এই তালিকাটি অবশ্যই রিটার্ন-টাইপ ( type_id সূচক অনুসারে) প্রধান ক্রম অনুসারে সাজাতে হবে এবং তারপরে আর্গুমেন্ট তালিকা (লেক্সিকোগ্রাফিক ক্রম, type_id সূচক অনুসারে পৃথক আর্গুমেন্ট) অনুসারে সাজাতে হবে। তালিকায় কোনো ডুপ্লিকেট এন্ট্রি থাকা উচিত নয়। |
field_ids | ক্ষেত্র_আইডি_আইটেম[] | ক্ষেত্র শনাক্তকারী তালিকা। ফাইলে সংজ্ঞায়িত হোক বা না হোক এই ফাইলের দ্বারা উল্লেখ করা সমস্ত ক্ষেত্রের জন্য এগুলি শনাক্তকারী৷ এই তালিকাটি অবশ্যই সাজাতে হবে, যেখানে সংজ্ঞায়িত প্রকার ( type_id সূচক দ্বারা) প্রধান ক্রম, ক্ষেত্রের নাম ( string_id সূচক দ্বারা) মধ্যবর্তী ক্রম, এবং টাইপ ( type_id সূচক দ্বারা) হল ছোট ক্রম। তালিকায় কোনো ডুপ্লিকেট এন্ট্রি থাকা উচিত নয়। |
পদ্ধতি_আইডি | পদ্ধতি_আইডি_আইটেম[] | পদ্ধতি শনাক্তকারী তালিকা। ফাইলে সংজ্ঞায়িত হোক বা না হোক এই ফাইলের দ্বারা উল্লেখ করা সমস্ত পদ্ধতির জন্য এগুলি শনাক্তকারী। এই তালিকাটি অবশ্যই সাজাতে হবে, যেখানে সংজ্ঞায়িত প্রকার ( type_id সূচক দ্বারা) প্রধান ক্রম, পদ্ধতির নাম ( string_id সূচক দ্বারা) হল মধ্যবর্তী ক্রম এবং পদ্ধতির প্রোটোটাইপ ( proto_id সূচক দ্বারা) হল ছোট ক্রম। তালিকায় কোনো ডুপ্লিকেট এন্ট্রি থাকা উচিত নয়। |
class_defs | class_def_item[] | শ্রেণীর সংজ্ঞা তালিকা। ক্লাসগুলিকে এমনভাবে অর্ডার করতে হবে যাতে প্রদত্ত ক্লাসের সুপারক্লাস এবং বাস্তবায়িত ইন্টারফেসগুলি রেফারিং ক্লাসের আগে তালিকায় উপস্থিত হয়। তদ্ব্যতীত, তালিকায় একাধিকবার উপস্থিত হওয়া একই নামের ক্লাসের জন্য একটি সংজ্ঞার জন্য এটি অবৈধ। |
কল_সাইট_আইডি | কল_সাইট_আইডি_আইটেম[] | কল সাইট শনাক্তকারী তালিকা. ফাইলে সংজ্ঞায়িত হোক বা না হোক এই ফাইলের দ্বারা উল্লেখ করা সমস্ত কল সাইটের জন্য এগুলি শনাক্তকারী৷ এই তালিকাটি অবশ্যই call_site_off ঊর্ধ্বক্রম অনুসারে সাজাতে হবে। |
পদ্ধতি_হ্যান্ডল | পদ্ধতি_হ্যান্ডেল_আইটেম[] | পদ্ধতি হ্যান্ডেল তালিকা। এই ফাইলের দ্বারা উল্লেখ করা সমস্ত পদ্ধতির হ্যান্ডেলগুলির একটি তালিকা, ফাইলে সংজ্ঞায়িত হোক বা না হোক। এই তালিকাটি সাজানো হয়নি এবং এতে ডুপ্লিকেট থাকতে পারে যা যৌক্তিকভাবে বিভিন্ন পদ্ধতি হ্যান্ডেল উদাহরণের সাথে মিলে যাবে। |
তথ্য | ubyte[] | ডেটা এলাকা, উপরে তালিকাভুক্ত টেবিলের জন্য সমস্ত সমর্থন ডেটা রয়েছে। বিভিন্ন আইটেমের বিভিন্ন প্রান্তিককরণের প্রয়োজনীয়তা রয়েছে এবং যথাযথ প্রান্তিককরণ অর্জনের জন্য প্রয়োজন হলে প্রতিটি আইটেমের আগে প্যাডিং বাইট ঢোকানো হয়। |
লিঙ্ক_ডেটা | ubyte[] | স্ট্যাটিকভাবে লিঙ্ক করা ফাইলে ব্যবহৃত ডেটা। এই বিভাগে তথ্য বিন্যাস এই নথি দ্বারা অনির্দিষ্ট রেখে গেছে. এই বিভাগটি আনলিঙ্ক করা ফাইলগুলিতে খালি, এবং রানটাইম বাস্তবায়নগুলি উপযুক্ত হিসাবে এটি ব্যবহার করতে পারে। |
বিটফিল্ড, স্ট্রিং এবং ধ্রুবক সংজ্ঞা
DEX_FILE_MAGIC
header_item এ এমবেড করা হয়েছে
ধ্রুবক অ্যারে/স্ট্রিং DEX_FILE_MAGIC
হল বাইটের তালিকা যা একটি .dex
ফাইলের শুরুতে উপস্থিত হওয়া আবশ্যক যাতে এটিকে স্বীকৃত করা যায়। মানটি ইচ্ছাকৃতভাবে একটি নতুন লাইন ( "\n"
বা 0x0a
) এবং একটি নাল বাইট ( "\0"
বা 0x00
) ধারণ করে যাতে কিছু নির্দিষ্ট ধরণের দুর্নীতি সনাক্ত করতে সহায়তা করা যায়। মানটি একটি বিন্যাস সংস্করণ নম্বরকে তিন দশমিক সংখ্যা হিসাবে এনকোড করে, যা ফর্ম্যাটটি বিকশিত হওয়ার সাথে সাথে সময়ের সাথে একঘেয়েভাবে বৃদ্ধি পাবে বলে আশা করা হচ্ছে।
ubyte[8] DEX_FILE_MAGIC = { 0x64 0x65 0x78 0x0a 0x30 0x33 0x39 0x00 } = "dex\n039\0"
দ্রষ্টব্য: Android 9.0 রিলিজে ফর্ম্যাটের 039
সংস্করণের জন্য সমর্থন যোগ করা হয়েছিল, যা দুটি নতুন বাইটকোড, const-method-handle
এবং const-method-type
চালু করেছে। (এগুলি প্রতিটি বাইটকোড সেট টেবিলের সারাংশে বর্ণিত হয়েছে।) Android 10-এ, সংস্করণ 039
লুকানো API তথ্য অন্তর্ভুক্ত করার জন্য DEX ফাইল বিন্যাসকে প্রসারিত করে যা শুধুমাত্র বুট ক্লাস পাথের DEX ফাইলগুলির জন্য প্রযোজ্য।
দ্রষ্টব্য: Android 8.0 রিলিজে ফর্ম্যাটের 038
সংস্করণের জন্য সমর্থন যোগ করা হয়েছে। সংস্করণ 038
নতুন বাইটকোড যুক্ত করেছে ( invoke-polymorphic
এবং invoke-custom
) এবং পদ্ধতি হ্যান্ডেলগুলির জন্য ডেটা।
দ্রষ্টব্য: Android 7.0 রিলিজে ফর্ম্যাটের 037
সংস্করণের জন্য সমর্থন যোগ করা হয়েছে। সংস্করণ 037
এর আগে অ্যান্ড্রয়েডের বেশিরভাগ সংস্করণ ফরম্যাটের সংস্করণ 035
ব্যবহার করেছে। সংস্করণ 035
এবং 037
এর মধ্যে একমাত্র পার্থক্য হল ডিফল্ট পদ্ধতির সংযোজন এবং invoke
সমন্বয়।
দ্রষ্টব্য: সর্বজনীন সফ্টওয়্যার প্রকাশগুলিতে বিন্যাসের অন্তত কয়েকটি পূর্ববর্তী সংস্করণ ব্যবহার করা হয়েছে। উদাহরণস্বরূপ, সংস্করণ 009
অ্যান্ড্রয়েড প্ল্যাটফর্মের M3 রিলিজের জন্য ব্যবহার করা হয়েছিল (নভেম্বর-ডিসেম্বর 2007), এবং সংস্করণ 013
ব্যবহার করা হয়েছিল অ্যান্ড্রয়েড প্ল্যাটফর্মের M5 রিলিজের জন্য (ফেব্রুয়ারি-মার্চ 2008)। বিভিন্ন দিক থেকে, বিন্যাসের এই আগের সংস্করণগুলি এই নথিতে বর্ণিত সংস্করণ থেকে উল্লেখযোগ্যভাবে পৃথক।
ENDIAN_CONSTANT এবং REVERSE_ENDIAN_CONSTANT৷
header_item এ এমবেড করা হয়েছে
ধ্রুবক ENDIAN_CONSTANT
যে ফাইলটিতে এটি পাওয়া যায় তার শেষতা নির্দেশ করতে ব্যবহৃত হয়। যদিও স্ট্যান্ডার্ড .dex
ফরম্যাট সামান্য-এন্ডিয়ান, বাস্তবায়নগুলি বাইট-অদলবদল করতে বেছে নিতে পারে। যদি একটি ইমপ্লিমেন্টেশন একটি হেডারে আসে যার endian_tag
REVERSE_ENDIAN_CONSTANT
এর পরিবর্তে ENDIAN_CONSTANT
হয়, তাহলে এটি জানা যাবে যে ফাইলটি প্রত্যাশিত ফর্ম থেকে বাইট-অদলবদল করা হয়েছে।
uint ENDIAN_CONSTANT = 0x12345678; uint REVERSE_ENDIAN_CONSTANT = 0x78563412;
NO_INDEX
class_def_item এবং debug_info_item এ এমবেড করা হয়েছে
একটি সূচক মান অনুপস্থিত তা বোঝাতে ধ্রুবক NO_INDEX
ব্যবহার করা হয়।
দ্রষ্টব্য: এই মানটিকে 0
হিসাবে সংজ্ঞায়িত করা হয় না, কারণ এটি আসলে একটি বৈধ সূচক।
NO_INDEX
এর জন্য নির্বাচিত মানটি uleb128p1
এনকোডিং-এ একক বাইট হিসাবে উপস্থাপনযোগ্য।
uint NO_INDEX = 0xffffffff; // == -1 if treated as a signed int
অ্যাক্সেস_ফ্ল্যাগ সংজ্ঞা
class_def_item, encoded_field, encoded_method এবং InnerClas এ এমবেড করা হয়েছে
এই পতাকার বিটফিল্ডগুলি ক্লাস এবং ক্লাস সদস্যদের অ্যাক্সেসযোগ্যতা এবং সামগ্রিক বৈশিষ্ট্যগুলি নির্দেশ করতে ব্যবহৃত হয়।
নাম | মান | ক্লাসের জন্য (এবং InnerClass টীকা) | ক্ষেত্রগুলির জন্য | পদ্ধতির জন্য |
---|---|---|---|---|
ACC_Public | 0x1 | public : সর্বত্র দৃশ্যমান | public : সর্বত্র দৃশ্যমান | public : সর্বত্র দৃশ্যমান |
ACC_PRIVATE | 0x2 | private : শুধুমাত্র ক্লাস সংজ্ঞায়িত করার জন্য দৃশ্যমান | private : শুধুমাত্র ক্লাস সংজ্ঞায়িত করার জন্য দৃশ্যমান | private : শুধুমাত্র ক্লাস সংজ্ঞায়িত করার জন্য দৃশ্যমান |
ACC_PROTECTED | 0x4 | protected : প্যাকেজ এবং সাবক্লাসে দৃশ্যমান | protected : প্যাকেজ এবং সাবক্লাসে দৃশ্যমান | protected : প্যাকেজ এবং সাবক্লাসে দৃশ্যমান |
ACC_STATIC | 0x8 | static : this রেফারেন্সের বাইরের দিয়ে তৈরি করা হয় না | static : গ্লোবাল থেকে ডিফাইনিং ক্লাস | static : this যুক্তি গ্রহণ করে না |
ACC_FINAL | 0x10 | final : সাবক্লাসেবল নয় | final : নির্মাণের পরে অপরিবর্তনীয় | final : ওভাররিডেবল নয় |
ACC_SYNCHRONIZED | 0x20 | synchronized : যুক্ত লক স্বয়ংক্রিয়ভাবে এই পদ্ধতিতে কলের চারপাশে অর্জিত। দ্রষ্টব্য: এটি শুধুমাত্র সেট করার জন্য বৈধ যখন | ||
ACC_VOLATILE | 0x40 | volatile : থ্রেড নিরাপত্তার জন্য সাহায্য করার জন্য বিশেষ অ্যাক্সেসের নিয়ম | ||
ACC_BRIDGE | 0x40 | সেতু পদ্ধতি, একটি টাইপ-নিরাপদ সেতু হিসাবে কম্পাইলার দ্বারা স্বয়ংক্রিয়ভাবে যোগ করা হয়েছে | ||
ACC_TRANSIENT | 0x80 | transient : ডিফল্ট সিরিয়ালাইজেশন দ্বারা সংরক্ষণ করা যাবে না | ||
ACC_VARARGS | 0x80 | শেষ যুক্তিকে কম্পাইলার দ্বারা একটি "বিশ্রাম" যুক্তি হিসাবে বিবেচনা করা উচিত | ||
ACC_NATIVE | 0x100 | native : নেটিভ কোডে প্রয়োগ করা হয়েছে | ||
ACC_INTERFACE | 0x200 | interface : গুন-বাস্তবায়নযোগ্য বিমূর্ত শ্রেণী | ||
ACC_ABSTRACT | 0x400 | abstract : সরাসরি তাত্ক্ষণিক নয় | abstract : এই শ্রেণীর দ্বারা অবাস্তব | |
ACC_STRICT | 0x800 | strictfp : ফ্লোটিং-পয়েন্ট পাটিগণিতের জন্য কঠোর নিয়ম | ||
ACC_SYNTHETIC | 0x1000 | সোর্স কোডে সরাসরি সংজ্ঞায়িত নয় | সোর্স কোডে সরাসরি সংজ্ঞায়িত নয় | সোর্স কোডে সরাসরি সংজ্ঞায়িত নয় |
ACC_ANNOTATION | 0x2000 | একটি টীকা ক্লাস হিসাবে ঘোষিত | ||
ACC_ENUM | 0x4000 | একটি গণনাকৃত প্রকার হিসাবে ঘোষিত | একটি গণনাকৃত মান হিসাবে ঘোষিত | |
(অব্যবহৃত) | 0x8000 | |||
ACC_CONSTRUCTOR | 0x10000 | কনস্ট্রাক্টর পদ্ধতি (ক্লাস বা ইনস্ট্যান্স ইনিশিয়ালাইজার) | ||
ACC_DECLARED_ সিঙ্ক্রোনাইজড | 0x20000 | synchronized ঘোষণা করা হয়েছে।দ্রষ্টব্য: এটি কার্যকর করার উপর কোন প্রভাব ফেলে না (এই পতাকার প্রতিফলন ব্যতীত, প্রতি সে)। |
InnerClass
টীকাগুলির জন্য অনুমোদিত, এবং কখনই একটি class_def_item
এ চালু করা উচিত নয়।
MUTF-8 (সংশোধিত UTF-8) এনকোডিং
সহজ উত্তরাধিকার সমর্থনের জন্য ছাড় হিসাবে, .dex
ফরম্যাট তার স্ট্রিং ডেটাকে একটি ডি ফ্যাক্টো স্ট্যান্ডার্ড পরিবর্তিত UTF-8 ফর্মে এনকোড করে, যা পরবর্তীতে MUTF-8 হিসাবে উল্লেখ করা হয়। এই ফর্মটি স্ট্যান্ডার্ড UTF-8 এর মতো, ছাড়া:
- শুধুমাত্র এক-, দুই- এবং তিন-বাইট এনকোডিং ব্যবহার করা হয়।
-
U+10000
রেঞ্জের কোড পয়েন্ট …U+10ffff
একটি সারোগেট জোড়া হিসাবে এনকোড করা হয়, যার প্রত্যেকটি একটি তিন-বাইট এনকোডেড মান হিসাবে উপস্থাপিত হয়। - কোড পয়েন্ট
U+0000
দুই-বাইট আকারে এনকোড করা হয়েছে। - একটি সাধারণ নাল বাইট (মান
0
) একটি স্ট্রিংয়ের শেষ নির্দেশ করে, যেমনটি স্ট্যান্ডার্ড সি ভাষার ব্যাখ্যা।
উপরের প্রথম দুটি আইটেম সংক্ষিপ্ত করা যেতে পারে এইভাবে: MUTF-8 হল UTF-16 এর জন্য একটি এনকোডিং বিন্যাস, ইউনিকোড অক্ষরের জন্য আরও সরাসরি এনকোডিং বিন্যাস না হয়ে।
উপরের চূড়ান্ত দুটি আইটেম একটি স্ট্রিং-এ কোড পয়েন্ট U+0000
অন্তর্ভুক্ত করা এবং এখনও এটিকে C-স্টাইলের নাল-টার্মিনেটেড স্ট্রিং হিসাবে ব্যবহার করা সম্ভব করে তোলে।
যাইহোক, U+0000
এর বিশেষ এনকোডিং এর অর্থ হল, সাধারণ UTF-8 এর বিপরীতে, MUTF-8 স্ট্রিংগুলির একটি জোড়ায় স্ট্যান্ডার্ড C ফাংশন strcmp()
কল করার ফলাফল সবসময় অসম স্ট্রিংগুলির তুলনার সঠিকভাবে স্বাক্ষরিত ফলাফল নির্দেশ করে না। . যখন অর্ডার করা (শুধু সমতা নয়) একটি উদ্বেগের বিষয়, তখন MUTF-8 স্ট্রিংগুলির তুলনা করার সবচেয়ে সহজ উপায় হল তাদের অক্ষর অনুসারে অক্ষর ডিকোড করা এবং ডিকোড করা মানগুলির তুলনা করা। (তবে, আরও চতুর বাস্তবায়নও সম্ভব।)
অক্ষর এনকোডিং সম্পর্কে আরও তথ্যের জন্য অনুগ্রহ করে ইউনিকোড স্ট্যান্ডার্ড দেখুন। MUTF-8 প্রকৃতপক্ষে (অপেক্ষাকৃত কম সুপরিচিত) এনকোডিং CESU-8- এর থেকে UTF-8 প্রতি সে-এর কাছাকাছি।
encoded_value এনকোডিং
annotation_element এবং encoded_array_item এ এমবেড করা হয়েছে
একটি encoded_value
হল (প্রায়) নির্বিচারে শ্রেণীবদ্ধভাবে কাঠামোবদ্ধ ডেটার একটি এনকোড করা অংশ। এনকোডিংটি কম্প্যাক্ট এবং পার্স করার জন্য সহজবোধ্য উভয়ই বোঝানো হয়েছে।
নাম | বিন্যাস | বর্ণনা |
---|---|---|
(মান_আর্গ << 5) | মান_প্রকার | ubyte | উচ্চ-ক্রম তিনটি বিটে একটি ঐচ্ছিক স্পষ্টীকরণ যুক্তি সহ অবিলম্বে পরবর্তী value প্রকার নির্দেশ করে বাইট। বিভিন্ন value সংজ্ঞা জন্য নীচে দেখুন. বেশীরভাগ ক্ষেত্রে, value_arg অবিলম্বে-পরবর্তী value দৈর্ঘ্যকে বাইটে এনকোড করে, যেমন (size - 1) , যেমন, 0 মানে মানের একটি বাইট প্রয়োজন এবং 7 মানে আট বাইট প্রয়োজন; যাইহোক, নীচে উল্লিখিত হিসাবে ব্যতিক্রম আছে. |
মান | ubyte[] | বাইট মানের প্রতিনিধিত্ব করে, দৈর্ঘ্যে পরিবর্তনশীল এবং বিভিন্ন value_type বাইটের জন্য ভিন্নভাবে ব্যাখ্যা করা হয়, যদিও সর্বদা সামান্য-এন্ডিয়ান। বিস্তারিত জানার জন্য নীচের বিভিন্ন মান সংজ্ঞা দেখুন. |
মান বিন্যাস
নাম টাইপ করুন | value_type | value_arg বিন্যাস | value বিন্যাস | বর্ণনা |
---|---|---|---|---|
VALUE_BYTE | 0x00 | (কোনটিই নয়; 0 হতে হবে) | ubyte[1] | স্বাক্ষরিত এক-বাইট পূর্ণসংখ্যার মান |
VALUE_SHORT | 0x02 | আকার - 1 (0…1) | ubyte[আকার] | স্বাক্ষরিত দুই-বাইট পূর্ণসংখ্যা মান, সাইন-বর্ধিত |
VALUE_CHAR | 0x03 | আকার - 1 (0…1) | ubyte[আকার] | স্বাক্ষরবিহীন দুই-বাইট পূর্ণসংখ্যা মান, শূন্য-বর্ধিত |
VALUE_INT | 0x04 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরিত চার-বাইট পূর্ণসংখ্যা মান, সাইন-বর্ধিত |
VALUE_LONG | 0x06 | আকার - 1 (0…7) | ubyte[আকার] | স্বাক্ষরিত আট-বাইট পূর্ণসংখ্যা মান, সাইন-বর্ধিত |
VALUE_FLOAT | 0x10 | আকার - 1 (0…3) | ubyte[আকার] | চার-বাইট বিট প্যাটার্ন, ডানদিকে শূন্য-প্রসারিত এবং IEEE754 32-বিট ফ্লোটিং পয়েন্ট মান হিসাবে ব্যাখ্যা করা হয়েছে |
VALUE_DOUBLE | 0x11 | আকার - 1 (0…7) | ubyte[আকার] | আট-বাইট বিট প্যাটার্ন, ডানদিকে শূন্য-প্রসারিত এবং IEEE754 64-বিট ফ্লোটিং পয়েন্ট মান হিসাবে ব্যাখ্যা করা হয়েছে |
VALUE_METHOD_TYPE | 0x15 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যার মান, proto_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয় এবং একটি পদ্ধতি প্রকারের মান উপস্থাপন করে |
VALUE_METHOD_HANDLE | 0x16 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যা মান, method_handles বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয়েছে এবং একটি পদ্ধতি হ্যান্ডেল মান উপস্থাপন করে |
VALUE_STRING | 0x17 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যা মান, string_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয় এবং একটি স্ট্রিং মান উপস্থাপন করে |
VALUE_TYPE | 0x18 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যা মান, type_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয় এবং একটি প্রতিফলিত প্রকার/শ্রেণী মান উপস্থাপন করে |
VALUE_FIELD | 0x19 | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যা মান, field_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয়েছে এবং একটি প্রতিফলিত ক্ষেত্র মান উপস্থাপন করে |
VALUE_METHOD | 0x1a | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যার মান, method_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয়েছে এবং একটি প্রতিফলিত পদ্ধতির মান উপস্থাপন করে |
VALUE_ENUM | 0x1 খ | আকার - 1 (0…3) | ubyte[আকার] | স্বাক্ষরবিহীন (শূন্য-বর্ধিত) চার-বাইট পূর্ণসংখ্যার মান, field_ids বিভাগে একটি সূচক হিসাবে ব্যাখ্যা করা হয় এবং একটি গণনাকৃত টাইপ ধ্রুবকের মান উপস্থাপন করে |
VALUE_ARRAY | 0x1c | (কোনটিই নয়; 0 হতে হবে) | encoded_array | মানগুলির একটি বিন্যাস, নীচে " encoded_array বিন্যাস" দ্বারা নির্দিষ্ট করা বিন্যাসে। value আকার এনকোডিং এর মধ্যে নিহিত। |
VALUE_ANNOTATION | 0x1d | (কোনটিই নয়; 0 হতে হবে) | এনকোডেড_টীকা | একটি উপ-টীকা, নীচের " encoded_annotation বিন্যাস" দ্বারা নির্দিষ্ট করা বিন্যাসে। value আকার এনকোডিং এর মধ্যে নিহিত। |
VALUE_NULL | 0x1e | (কোনটিই নয়; 0 হতে হবে) | (কোনও) | null রেফারেন্স মান |
VALUE_BOOLEAN | 0x1f | বুলিয়ান (0…1) | (কোনও) | এক-বিট মান; false জন্য 0 এবং true জন্য 1 । বিট value_arg উপস্থাপন করা হয়। |
encoded_array বিন্যাস
নাম | বিন্যাস | বর্ণনা |
---|---|---|
আকার | uleb128 | অ্যারের উপাদানের সংখ্যা |
মান | encoded_value[আকার] | এই বিভাগ দ্বারা নির্দিষ্ট বিন্যাসে size encoded_value বাইট ক্রমগুলির একটি সিরিজ, ক্রমানুসারে সংযুক্ত। |
এনকোডেড_টীকা বিন্যাস
নাম | বিন্যাস | বর্ণনা |
---|---|---|
type_idx | uleb128 | টীকা প্রকার। এটি অবশ্যই একটি ক্লাস (অ্যারে বা আদিম নয়) টাইপ হতে হবে। |
আকার | uleb128 | এই টীকাটিতে নাম-মানের ম্যাপিংয়ের সংখ্যা |
উপাদান | টীকা_উপাদান[আকার] | টীকাটির উপাদান, সরাসরি ইন-লাইনে প্রতিনিধিত্ব করে (অফসেট হিসাবে নয়)। উপাদানগুলিকে string_id সূচক দ্বারা ক্রমবর্ধমান ক্রমে সাজাতে হবে৷ |
টীকা_এলিমেন্ট বিন্যাস
নাম | বিন্যাস | বর্ণনা |
---|---|---|
name_idx | uleb128 | উপাদানের নাম, string_ids বিভাগে একটি সূচক হিসাবে উপস্থাপিত। স্ট্রিংটি অবশ্যই উপরে সংজ্ঞায়িত MemberName এর জন্য সিনট্যাক্সের সাথে সঙ্গতিপূর্ণ হতে হবে। |
মান | encoded_value | উপাদান মান |
স্ট্রিং সিনট্যাক্স
একটি .dex
ফাইলে বিভিন্ন ধরণের আইটেম রয়েছে যা শেষ পর্যন্ত একটি স্ট্রিংকে উল্লেখ করে। নিম্নলিখিত BNF-শৈলী সংজ্ঞাগুলি এই স্ট্রিংগুলির জন্য গ্রহণযোগ্য সিনট্যাক্স নির্দেশ করে৷
সরল নাম
একটি সরলনাম হল অন্যান্য জিনিসের নামের সিনট্যাক্সের ভিত্তি। .dex
বিন্যাস এখানে ন্যায্য পরিমাণ অক্ষাংশের অনুমতি দেয় (সবচেয়ে সাধারণ উৎস ভাষার চেয়ে অনেক বেশি)। সংক্ষেপে, একটি সাধারণ নাম যে কোনো নিম্ন-ASCII বর্ণানুক্রমিক অক্ষর বা অঙ্ক, কয়েকটি নির্দিষ্ট নিম্ন-ASCII চিহ্ন এবং বেশিরভাগ নন-ASCII কোড পয়েন্ট যা নিয়ন্ত্রণ, স্থান বা বিশেষ অক্ষর নয়। সংস্করণ 040
থেকে শুরু করে বিন্যাসটি অতিরিক্তভাবে স্থান অক্ষর (ইউনিকোড Zs
বিভাগ) অনুমোদন করে। মনে রাখবেন যে সারোগেট কোড পয়েন্টগুলি (ব্যপ্তি U+d800
… U+dfff
) হিসাবে বৈধ নামের অক্ষর হিসাবে বিবেচিত হয় না, তবে ইউনিকোড সম্পূরক অক্ষরগুলি বৈধ (যা SimpleNameChar এর নিয়মের চূড়ান্ত বিকল্প দ্বারা উপস্থাপিত হয়), এবং তারা MUTF-8 এনকোডিং-এ সারোগেট কোড পয়েন্টের জোড়া হিসাবে একটি ফাইলে উপস্থাপন করা উচিত।
সরল নাম → | ||
সরলনামচর ( সিম্পলনেমচার )* | ||
সরলনামচর → | ||
'A' … 'Z' | ||
| | 'a' … 'z' | |
| | '0' … '9' | |
| | ' ' | DEX সংস্করণ 040 থেকে |
| | '$' | |
| | '-' | |
| | '_' | |
| | U+00a0 | DEX সংস্করণ 040 থেকে |
| | U+00a1 … U+1fff | |
| | U+2000 … U+200a | DEX সংস্করণ 040 থেকে |
| | U+2010 … U+2027 | |
| | U+202f | DEX সংস্করণ 040 থেকে |
| | U+2030 … U+d7ff | |
| | U+e000 … U+ffef | |
| | U+10000 … U+10ffff |
সদস্যের নাম
field_id_item এবং method_id_item দ্বারা ব্যবহৃত
একটি সদস্য নাম হল একটি শ্রেণীর সদস্যের নাম, সদস্যরা ক্ষেত্র, পদ্ধতি এবং অভ্যন্তরীণ ক্লাস।
সদস্যের নাম → | |
সরল নাম | |
| | '<' SimpleName '>' |
ফুলক্লাস নাম
একটি FullClassName হল একটি সম্পূর্ণ-যোগ্য শ্রেণির নাম, একটি প্রয়োজনীয় নাম অনুসরণ করে একটি ঐচ্ছিক প্যাকেজ স্পেসিফায়ার সহ।
সম্পূর্ণ ক্লাসের নাম → | |
ঐচ্ছিক প্যাকেজ প্রিফিক্স সরলনাম | |
ঐচ্ছিক প্যাকেজ উপসর্গ → | |
( সরল নাম '/' )* |
TypeDescriptor
type_id_item দ্বারা ব্যবহৃত
একটি TypeDescriptor হল আদিম, শ্রেণী, অ্যারে এবং void
সহ যেকোন প্রকারের উপস্থাপনা। বিভিন্ন সংস্করণের অর্থের জন্য নীচে দেখুন।
TypeDescriptor → | |
'V' | |
| | FieldTypeDescriptor |
FieldTypeDescriptor → | |
NonArrayFieldTypeDescriptor | |
| | ( '[' * 1…255) NonArrayFieldTypeDescriptor |
NonArrayFieldTypeDescriptor → | |
'Z' | |
| | 'B' |
| | 'S' |
| | 'C' |
| | 'I' |
| | 'J' |
| | 'F' |
| | 'D' |
| | 'L' FullClassName ';' |
সংক্ষিপ্ত বর্ণনাকারী
proto_id_item দ্বারা ব্যবহৃত
একটি শর্টডিসক্রিপ্টর হল রিটার্ন এবং প্যারামিটারের ধরন সহ একটি পদ্ধতির প্রোটোটাইপের সংক্ষিপ্ত ফর্ম উপস্থাপনা, বিভিন্ন রেফারেন্স (শ্রেণী বা অ্যারে) প্রকারের মধ্যে কোন পার্থক্য নেই। পরিবর্তে, সমস্ত রেফারেন্স প্রকার একটি একক 'L'
অক্ষর দ্বারা উপস্থাপিত হয়।
সংক্ষিপ্ত বর্ণনাকারী → | |
ShortyReturnType ( ShortyFieldType )* | |
ছোট রিটার্ন টাইপ → | |
'V' | |
| | শর্টফিল্ড টাইপ |
শর্টফিল্ড টাইপ → | |
'Z' | |
| | 'B' |
| | 'S' |
| | 'C' |
| | 'I' |
| | 'J' |
| | 'F' |
| | 'D' |
| | 'L' |
TypeDescriptor শব্দার্থবিদ্যা
এটি TypeDescriptor এর প্রতিটি রূপের অর্থ।
বাক্য গঠন | অর্থ |
---|---|
ভি | void শুধুমাত্র রিটার্ন ধরনের জন্য বৈধ |
জেড | boolean |
খ | byte |
এস | short |
গ | char |
আমি | int |
জে | long |
চ | float |
ডি | double |
L সম্পূর্ণ/যোগ্য/নাম ; | ক্লাস fully.qualified.Name |
[ বর্ণনাকারী | descriptor অ্যারে, অ্যারে-অফ-অ্যারের জন্য পুনরাবৃত্তিমূলকভাবে ব্যবহারযোগ্য, যদিও এটি 255টির বেশি মাত্রা থাকা অবৈধ। |
আইটেম এবং সম্পর্কিত কাঠামো
এই বিভাগে .dex
ফাইলে প্রদর্শিত হতে পারে এমন প্রতিটি শীর্ষ-স্তরের আইটেমের সংজ্ঞা অন্তর্ভুক্ত করে।
হেডার_আইটেম
হেডার বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
জাদু | ubyte[8] = DEX_FILE_MAGIC | জাদু মান. আরো বিস্তারিত জানার জন্য " DEX_FILE_MAGIC " এর অধীনে উপরে আলোচনা দেখুন। |
চেকসাম | uint | adler32 বাকি ফাইলের চেকসাম ( magic এবং এই ক্ষেত্র ছাড়া সবকিছু); ফাইল দুর্নীতি সনাক্ত করতে ব্যবহৃত হয় |
স্বাক্ষর | ubyte[20] | বাকি ফাইলের SHA-1 স্বাক্ষর (হ্যাশ) ( magic , checksum , এবং এই ক্ষেত্র ছাড়া সবকিছু); অনন্যভাবে ফাইল সনাক্ত করতে ব্যবহৃত হয় |
ফাইলের আকার | uint | সম্পূর্ণ ফাইলের আকার (হেডার সহ), বাইটে |
হেডার_সাইজ | uint = 0x70 | হেডারের আকার (এই পুরো বিভাগটি), বাইটে। এটি বিন্যাসটি অবৈধ না করে কমপক্ষে সীমিত পরিমাণের পিছনে/ফরোয়ার্ড সামঞ্জস্যের জন্য অনুমতি দেয়। |
endian_tag | uint = ENDIAN_CONSTANT | endianness ট্যাগ। আরো বিস্তারিত জানার জন্য " ENDIAN_CONSTANT এবং REVERSE_ENDIAN_CONSTANT " এর অধীনে উপরে আলোচনা দেখুন৷ |
link_size | uint | লিঙ্ক বিভাগের আকার, অথবা 0 যদি এই ফাইলটি স্ট্যাটিকভাবে লিঙ্ক করা না হয় |
link_off | uint | ফাইলের শুরু থেকে লিঙ্ক বিভাগে অফসেট, অথবা 0 যদি link_size == 0 । অফসেট, যদি শূন্য না থাকে তবে link_data বিভাগে একটি অফসেট হওয়া উচিত। এই নথির দ্বারা নির্দেশিত ডেটার বিন্যাসটি অনির্দিষ্ট রাখা হয়েছে; এই হেডার ক্ষেত্র (এবং পূর্ববর্তী) রানটাইম বাস্তবায়ন দ্বারা ব্যবহারের জন্য হুক হিসাবে রেখে দেওয়া হয়। |
map_off | uint | ফাইলের শুরু থেকে মানচিত্র আইটেম পর্যন্ত অফসেট। অফসেট, যা অবশ্যই শূন্য নয়, data বিভাগে একটি অফসেট হওয়া উচিত এবং ডেটা নীচের " map_list " দ্বারা নির্দিষ্ট করা বিন্যাসে হওয়া উচিত৷ |
string_ids_size | uint | স্ট্রিং শনাক্তকারী তালিকায় স্ট্রিং গণনা |
string_ids_off | uint | ফাইলের শুরু থেকে স্ট্রিং শনাক্তকারীর তালিকায় অফসেট, অথবা 0 if string_ids_size == 0 (অবশ্যই একটি অদ্ভুত প্রান্তের ক্ষেত্রে)। অফসেট, যদি শূন্য না হয়, string_ids বিভাগের শুরুতে হওয়া উচিত। |
type_ids_size | uint | টাইপ শনাক্তকারী তালিকায় উপাদানের সংখ্যা, সর্বাধিক 65535 |
type_ids_off | uint | ফাইলের শুরু থেকে টাইপ আইডেন্টিফায়ার লিস্টে অফসেট, অথবা 0 if type_ids_size == 0 (স্বীকৃতভাবে একটি অদ্ভুত এজ কেস)। অফসেট, যদি শূন্য না থাকে, তাহলে type_ids বিভাগের শুরুতে হওয়া উচিত। |
proto_ids_size | uint | প্রোটোটাইপ শনাক্তকারী তালিকায় উপাদানের সংখ্যা, সর্বাধিক 65535 |
proto_ids_off | uint | ফাইলের শুরু থেকে প্রোটোটাইপ শনাক্তকারীর তালিকায় অফসেট, অথবা 0 যদি proto_ids_size == 0 (অবশ্যই একটি অদ্ভুত প্রান্তের ক্ষেত্রে)। অফসেট, যদি শূন্য না হয়, proto_ids বিভাগের শুরুতে হওয়া উচিত। |
ক্ষেত্র_আইডি_সাইজ | uint | ক্ষেত্র শনাক্তকারী তালিকায় উপাদানের গণনা |
field_ids_off | uint | ফাইলের শুরু থেকে ক্ষেত্র শনাক্তকারী তালিকায় অফসেট, অথবা 0 যদি field_ids_size == 0 । অফসেট, যদি শূন্য না হয়, field_ids বিভাগের শুরুতে হওয়া উচিত। |
পদ্ধতি_আইডি_সাইজ | uint | পদ্ধতি শনাক্তকারী তালিকায় উপাদানের গণনা |
পদ্ধতি_আইডি_অফ | uint | ফাইলের শুরু থেকে মেথড আইডেন্টিফায়ার লিস্টে অফসেট, অথবা 0 if method_ids_size == 0 । অফসেট, যদি শূন্য না থাকে তবে method_ids বিভাগের শুরুতে হওয়া উচিত। |
class_defs_size | uint | বর্গ সংজ্ঞা তালিকায় উপাদানের গণনা |
class_defs_off | uint | ফাইলের শুরু থেকে ক্লাস ডেফিনিশন লিস্টে অফসেট, অথবা 0 if class_defs_size == 0 (অবশ্যই একটি অদ্ভুত এজ কেস)। অফসেট, যদি শূন্য না হয়, class_defs বিভাগের শুরুতে হওয়া উচিত। |
ডেটা_সাইজ | uint | বাইটে data বিভাগের আকার। সাইজের (uint) এর একটি জোড় গুণিতক হতে হবে। |
ডেটা_বন্ধ | uint | ফাইলের শুরু থেকে data বিভাগের শুরু পর্যন্ত অফসেট। |
মানচিত্রের_তালিকা
ডেটা বিভাগে প্রদর্শিত হয়
header_item থেকে উল্লেখ করা হয়েছে
প্রান্তিককরণ: 4 বাইট
এটি একটি ফাইলের সম্পূর্ণ বিষয়বস্তুর একটি তালিকা, ক্রমানুসারে। এটি header_item
এর ক্ষেত্রে কিছু অপ্রয়োজনীয়তা ধারণ করে কিন্তু এটি একটি সম্পূর্ণ ফাইলের উপর পুনরাবৃত্তি করার জন্য ব্যবহার করার জন্য একটি সহজ ফর্মের উদ্দেশ্যে। একটি প্রদত্ত টাইপ একটি মানচিত্রে সর্বাধিক একবার উপস্থিত হওয়া আবশ্যক, তবে বাকি বিন্যাস দ্বারা উহ্য বিধিনিষেধগুলি ব্যতীত কোন ক্রম প্রকারগুলি উপস্থিত হতে পারে তার উপর কোন বিধিনিষেধ নেই (যেমন, একটি header
বিভাগটি অবশ্যই প্রথমে প্রদর্শিত হবে, তারপরে একটি string_ids
বিভাগ, ইত্যাদি)। উপরন্তু, মানচিত্র এন্ট্রি প্রাথমিক অফসেট দ্বারা অর্ডার করা আবশ্যক এবং ওভারল্যাপ করা উচিত নয়।
নাম | বিন্যাস | বর্ণনা |
---|---|---|
আকার | uint | তালিকার আকার, এন্ট্রিতে |
তালিকা | মানচিত্র_আইটেম [আকার] | তালিকার উপাদান |
map_item বিন্যাস
নাম | বিন্যাস | বর্ণনা |
---|---|---|
প্রকার | ছোট | আইটেম প্রকার; নীচের টেবিল দেখুন |
অব্যবহৃত | ছোট | (অব্যবহৃত) |
আকার | uint | নির্দেশিত অফসেটে পাওয়া আইটেমের সংখ্যা গণনা |
অফসেট | uint | ফাইলের শুরু থেকে প্রশ্নে থাকা আইটেমগুলিতে অফসেট |
কোড টাইপ করুন
খবর ধরন | ধ্রুবক | মান | বাইটে আইটেমের আকার |
---|---|---|---|
হেডার_আইটেম | TYPE_HEADER_ITEM | 0x0000 | 0x70 |
স্ট্রিং_আইডি_আইটেম | TYPE_STRING_ID_ITEM | 0x0001 | 0x04 |
টাইপ_আইডি_আইটেম | TYPE_TYPE_ID_ITEM | 0x0002 | 0x04 |
proto_id_item | TYPE_PROTO_ID_ITEM | 0x0003 | 0x0c |
ক্ষেত্র_আইডি_আইটেম | TYPE_FIELD_ID_ITEM | 0x0004 | 0x08 |
পদ্ধতি_আইডি_আইটেম | TYPE_METHOD_ID_ITEM | 0x0005 | 0x08 |
class_def_item | TYPE_CLASS_DEF_ITEM | 0x0006 | 0x20 |
কল_সাইট_আইডি_আইটেম | TYPE_CALL_SITE_ID_ITEM | 0x0007 | 0x04 |
পদ্ধতি_হ্যান্ডেল_আইটেম | TYPE_METHOD_HANDLE_ITEM | 0x0008 | 0x08 |
মানচিত্রের_তালিকা | TYPE_MAP_LIST | 0x1000 | 4 + (আইটেম. আকার * 12) |
type_list | TYPE_TYPE_LIST | 0x1001 | 4 + (আইটেম. আকার * 2) |
annotation_set_ref_list | TYPE_ANNOTATION_SET_REF_LIST | 0x1002 | 4 + (আইটেম. আকার * 4) |
টীকা_সেট_আইটেম | TYPE_ANNOTATION_SET_ITEM | 0x1003 | 4 + (আইটেম. আকার * 4) |
ক্লাস_ডেটা_আইটেম | TYPE_CLASS_DATA_ITEM | 0x2000 | অন্তর্নিহিত; পার্স করতে হবে |
কোড_আইটেম | TYPE_CODE_ITEM | 0x2001 | অন্তর্নিহিত; পার্স করতে হবে |
স্ট্রিং_ডেটা_আইটেম | TYPE_STRING_DATA_ITEM | 0x2002 | অন্তর্নিহিত; পার্স করতে হবে |
ডিবাগ_তথ্য_আইটেম | TYPE_DEBUG_INFO_ITEM | 0x2003 | অন্তর্নিহিত; পার্স করতে হবে |
টীকা_আইটেম | TYPE_ANNOTATION_ITEM | 0x2004 | অন্তর্নিহিত; পার্স করতে হবে |
encoded_array_item | TYPE_ENCODED_ARRAY_ITEM | 0x2005 | অন্তর্নিহিত; পার্স করতে হবে |
annotations_directory_item | TYPE_ANNOTATIONS_DIRECTORY_ITEM | 0x2006 | অন্তর্নিহিত; পার্স করতে হবে |
hiddenapi_class_data_item | TYPE_HIDDENAPI_CLASS_DATA_ITEM | 0xF000 | অন্তর্নিহিত; পার্স করতে হবে |
স্ট্রিং_আইডি_আইটেম
string_ids বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
string_data_off | uint | এই আইটেমের জন্য ফাইলের শুরু থেকে স্ট্রিং ডেটা পর্যন্ত অফসেট। অফসেটটি data বিভাগে একটি অবস্থানে হওয়া উচিত এবং ডেটা নীচের " string_data_item " দ্বারা নির্দিষ্ট করা বিন্যাসে হওয়া উচিত৷ অফসেটের জন্য কোন প্রান্তিককরণের প্রয়োজন নেই। |
স্ট্রিং_ডেটা_আইটেম
ডেটা বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: কোনোটিই নয় (বাইট-সারিবদ্ধ)
নাম | বিন্যাস | বর্ণনা |
---|---|---|
utf16_size | uleb128 | এই স্ট্রিংটির আকার, UTF-16 কোড ইউনিটে (যা অনেক সিস্টেমে "স্ট্রিং দৈর্ঘ্য")। অর্থাৎ, এটি স্ট্রিংয়ের ডিকোডেড দৈর্ঘ্য। (এনকোড করা দৈর্ঘ্য 0 বাইটের অবস্থান দ্বারা নিহিত।) |
তথ্য | ubyte[] | MUTF-8 কোড ইউনিটের একটি সিরিজ (ওরফে অক্টেটস, ওরফে বাইট) এর পরে 0 মানের একটি বাইট। তথ্য বিন্যাস সম্পর্কে বিস্তারিত এবং আলোচনার জন্য উপরে "MUTF-8 (সংশোধিত UTF-8) এনকোডিং" দেখুন। দ্রষ্টব্য: এটি একটি স্ট্রিং থাকা গ্রহণযোগ্য যাতে (এর এনকোড করা ফর্ম) UTF-16 সারোগেট কোড ইউনিট (অর্থাৎ, |
টাইপ_আইডি_আইটেম
type_ids বিভাগে প্রদর্শিত হবে
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
descriptor_idx | uint | এই ধরনের বর্ণনাকারী স্ট্রিংয়ের জন্য string_ids তালিকায় সূচী করুন। স্ট্রিংটি উপরে সংজ্ঞায়িত TypeDescriptor- এর জন্য সিনট্যাক্সের সাথে সঙ্গতিপূর্ণ হতে হবে। |
proto_id_item
proto_ids বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
shorty_idx | uint | এই প্রোটোটাইপের সংক্ষিপ্ত-ফর্ম বর্ণনাকারী স্ট্রিংয়ের জন্য string_ids তালিকায় সূচী করুন। স্ট্রিংটি অবশ্যই ShortyDescriptor- এর জন্য সিনট্যাক্সের সাথে সঙ্গতিপূর্ণ হতে হবে, উপরে সংজ্ঞায়িত করা হয়েছে, এবং এই আইটেমের রিটার্ন টাইপ এবং পরামিতির সাথে সঙ্গতিপূর্ণ হতে হবে। |
return_type_idx | uint | এই প্রোটোটাইপের রিটার্ন টাইপের জন্য type_ids তালিকায় সূচক করুন |
প্যারামিটার_বন্ধ | uint | এই প্রোটোটাইপের জন্য ফাইলের শুরু থেকে পরামিতি প্রকারের তালিকা পর্যন্ত অফসেট, অথবা 0 যদি এই প্রোটোটাইপের কোনো পরামিতি না থাকে। এই অফসেট, যদি শূন্য না থাকে তবে data বিভাগে থাকা উচিত এবং সেখানে থাকা ডেটা নীচে "type_list" দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত। অতিরিক্তভাবে, তালিকায় void প্রকারের কোন উল্লেখ থাকা উচিত নয়। |
ক্ষেত্র_আইডি_আইটেম
field_ids বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
class_idx | ছোট | এই ক্ষেত্রের সংজ্ঞাকারীর জন্য type_ids তালিকায় সূচী করুন। এটি অবশ্যই একটি শ্রেণী প্রকার হতে হবে, এবং একটি অ্যারে বা আদিম প্রকার নয়৷ |
type_idx | ছোট | এই ক্ষেত্রের প্রকারের জন্য type_ids তালিকায় সূচী করুন |
name_idx | uint | এই ক্ষেত্রের নামের জন্য string_ids তালিকায় সূচী করুন। স্ট্রিংটি অবশ্যই উপরে সংজ্ঞায়িত MemberName এর জন্য সিনট্যাক্সের সাথে সঙ্গতিপূর্ণ হতে হবে। |
পদ্ধতি_আইডি_আইটেম
পদ্ধতি_আইডি বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
class_idx | ছোট | এই পদ্ধতির সংজ্ঞাকারীর জন্য type_ids তালিকায় সূচী করুন। এটি একটি শ্রেণী বা অ্যারে টাইপ হতে হবে, এবং একটি আদিম প্রকার নয়। |
proto_idx | ছোট | এই পদ্ধতির প্রোটোটাইপের জন্য proto_ids তালিকায় সূচক করুন |
name_idx | uint | এই পদ্ধতির নামের জন্য string_ids তালিকায় সূচী করুন। স্ট্রিংটি অবশ্যই উপরে সংজ্ঞায়িত MemberName এর জন্য সিনট্যাক্সের সাথে সঙ্গতিপূর্ণ হতে হবে। |
class_def_item
class_defs বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
class_idx | uint | এই শ্রেণীর জন্য type_ids তালিকায় সূচী। এটি অবশ্যই একটি শ্রেণী প্রকার হতে হবে, এবং একটি অ্যারে বা আদিম প্রকার নয়৷ |
অ্যাক্সেস_পতাকা | uint | ক্লাসের জন্য পতাকা অ্যাক্সেস করুন ( public , final , ইত্যাদি)। বিস্তারিত জানার জন্য " access_flags সংজ্ঞা" দেখুন। |
সুপারক্লাস_আইডিএক্স | uint | সুপারক্লাসের জন্য type_ids তালিকায় সূচী বা ধ্রুবক মান NO_INDEX যদি এই শ্রেণীর কোন সুপারক্লাস না থাকে (অর্থাৎ, এটি একটি রুট ক্লাস যেমন Object )। উপস্থিত থাকলে, এটি অবশ্যই একটি শ্রেণির ধরন হতে হবে, এবং একটি অ্যারে বা আদিম প্রকার নয়। |
ইন্টারফেস_বন্ধ | uint | ফাইলের শুরু থেকে ইন্টারফেসের তালিকা পর্যন্ত অফসেট, অথবা যদি কোনটি না থাকে তাহলে 0 । এই অফসেটটি data বিভাগে থাকা উচিত এবং সেখানে থাকা ডেটা নীচের " type_list " দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত৷ তালিকার প্রতিটি উপাদান অবশ্যই একটি ক্লাস টাইপ হতে হবে (কোন অ্যারে বা আদিম টাইপ নয়), এবং কোনও সদৃশ হতে হবে না। |
source_file_idx | uint | এই শ্রেণীর (অন্তত বেশিরভাগ) মূল উৎস ধারণকারী ফাইলের নামের জন্য string_ids তালিকায় সূচী করুন, অথবা এই তথ্যের অভাবকে উপস্থাপন করতে বিশেষ মান NO_INDEX । যে কোনো প্রদত্ত পদ্ধতির debug_info_item এই সোর্স ফাইলটিকে ওভাররাইড করতে পারে, কিন্তু আশা করা যায় যে বেশিরভাগ ক্লাস শুধুমাত্র একটি সোর্স ফাইল থেকে আসবে। |
টীকা_বন্ধ | uint | অফসেট ফাইলের শুরু থেকে এই ক্লাসের জন্য টীকা কাঠামোতে, অথবা 0 যদি এই ক্লাসে কোন টীকা না থাকে। এই অফসেট, যদি শূন্য না থাকে তবে data বিভাগে থাকা উচিত এবং সেখানে থাকা ডেটা নীচের " annotations_directory_item " দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত, সমস্ত আইটেম এই শ্রেণীটিকে সংজ্ঞায়িতকারী হিসাবে উল্লেখ করে৷ |
ক্লাস_ডেটা_বন্ধ | uint | এই আইটেমটির জন্য ফাইলের শুরু থেকে সংশ্লিষ্ট ক্লাস ডেটাতে অফসেট, অথবা যদি এই ক্লাসের জন্য কোনও ক্লাস ডেটা না থাকে 0 (এটি হতে পারে, উদাহরণস্বরূপ, যদি এই ক্লাসটি একটি মার্কার ইন্টারফেস হয়।) অফসেট, যদি শূন্য না থাকে তবে data বিভাগে থাকা উচিত, এবং সেখানে থাকা ডেটা নীচে " class_data_item " দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত, সমস্ত আইটেম এই শ্রেণীর সংজ্ঞাকারী হিসাবে উল্লেখ করে। |
static_values_off | uint | অফসেট ফাইলের শুরু থেকে static ক্ষেত্রগুলির জন্য প্রাথমিক মানের তালিকায়, অথবা 0 যদি কোনটি না থাকে (এবং সমস্ত static ক্ষেত্র 0 বা null দিয়ে আরম্ভ করতে হবে)। এই অফসেটটি data বিভাগে থাকা উচিত এবং সেখানে থাকা ডেটা নীচে " encoded_array_item " দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত৷ অ্যারের আকার এই শ্রেণীর দ্বারা ঘোষিত static ক্ষেত্রগুলির সংখ্যার চেয়ে বড় হওয়া উচিত নয় এবং উপাদানগুলি সংশ্লিষ্ট field_list এ ঘোষিত একই ক্রমে static ক্ষেত্রগুলির সাথে সামঞ্জস্যপূর্ণ। প্রতিটি অ্যারের উপাদানের ধরন অবশ্যই তার সংশ্লিষ্ট ক্ষেত্রের ঘোষিত প্রকারের সাথে মেলে। যদি অ্যারেতে static ক্ষেত্রগুলির তুলনায় কম উপাদান থাকে, তবে অবশিষ্ট ক্ষেত্রগুলি টাইপ-উপযুক্ত 0 বা null দিয়ে আরম্ভ করা হয়। |
কল_সাইট_আইডি_আইটেম
call_site_ids বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: 4 বাইট
নাম | বিন্যাস | বর্ণনা |
---|---|---|
কল_সাইট_অফ | uint | অফসেট ফাইলের শুরু থেকে কল সাইট সংজ্ঞা. অফসেটটি ডেটা বিভাগে থাকা উচিত এবং সেখানে থাকা ডেটা নীচে "কল_সাইট_আইটেম" দ্বারা নির্দিষ্ট করা বিন্যাসে থাকা উচিত। |
কল_সাইট_আইটেম
ডেটা বিভাগে প্রদর্শিত হয়
প্রান্তিককরণ: কোনোটিই নয় (বাইট সারিবদ্ধ)
call_site_item হল একটি encoded_array_item যার উপাদানগুলি একটি বুটস্ট্র্যাপ লিঙ্কার পদ্ধতিতে দেওয়া আর্গুমেন্টের সাথে মিলে যায়। প্রথম তিনটি যুক্তি হল:
- বুটস্ট্র্যাপ লিঙ্কার পদ্ধতি (VALUE_METHOD_HANDLE) প্রতিনিধিত্বকারী একটি পদ্ধতি হ্যান্ডেল।
- একটি পদ্ধতির নাম যা বুটস্ট্র্যাপ লিঙ্কারের সমাধান করা উচিত (VALUE_STRING)।
- A method type corresponding to the type of the method name to be resolved (VALUE_METHOD_TYPE).
Any additional arguments are constant values passed to the bootstrap linker method. These arguments are passed in order and without any type conversions.
The method handle representing the bootstrap linker method must have return type java.lang.invoke.CallSite
. The first three parameter types are:
-
java.lang.invoke.Lookup
-
java.lang.String
-
java.lang.invoke.MethodType
The parameter types of any additional arguments are determined from their constant values.
method_handle_item
appears in the method_handles section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
method_handle_type | ushort | type of the method handle; see table below |
unused | ushort | (unused) |
field_or_method_id | ushort | Field or method id depending on whether the method handle type is an accessor or a method invoker |
unused | ushort | (unused) |
Method Handle Type Codes
Constant | Value | বর্ণনা |
---|---|---|
METHOD_HANDLE_TYPE_STATIC_PUT | 0x00 | Method handle is a static field setter (accessor) |
METHOD_HANDLE_TYPE_STATIC_GET | 0x01 | Method handle is a static field getter (accessor) |
METHOD_HANDLE_TYPE_INSTANCE_PUT | 0x02 | Method handle is an instance field setter (accessor) |
METHOD_HANDLE_TYPE_INSTANCE_GET | 0x03 | Method handle is an instance field getter (accessor) |
METHOD_HANDLE_TYPE_INVOKE_STATIC | 0x04 | Method handle is a static method invoker |
METHOD_HANDLE_TYPE_INVOKE_INSTANCE | 0x05 | Method handle is an instance method invoker |
METHOD_HANDLE_TYPE_INVOKE_CONSTRUCTOR | 0x06 | Method handle is a constructor method invoker |
METHOD_HANDLE_TYPE_INVOKE_DIRECT | 0x07 | Method handle is a direct method invoker |
METHOD_HANDLE_TYPE_INVOKE_INTERFACE | 0x08 | Method handle is an interface method invoker |
class_data_item
referenced from class_def_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | বর্ণনা |
---|---|---|
static_fields_size | uleb128 | the number of static fields defined in this item |
instance_fields_size | uleb128 | the number of instance fields defined in this item |
direct_methods_size | uleb128 | the number of direct methods defined in this item |
virtual_methods_size | uleb128 | the number of virtual methods defined in this item |
static_fields | encoded_field[static_fields_size] | the defined static fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order. |
instance_fields | encoded_field[instance_fields_size] | the defined instance fields, represented as a sequence of encoded elements. The fields must be sorted by field_idx in increasing order. |
direct_methods | encoded_method[direct_methods_size] | the defined direct (any of static , private , or constructor) methods, represented as a sequence of encoded elements. The methods must be sorted by method_idx in increasing order. |
virtual_methods | encoded_method[virtual_methods_size] | the defined virtual (none of static , private , or constructor) methods, represented as a sequence of encoded elements. This list should not include inherited methods unless overridden by the class that this item represents. The methods must be sorted by method_idx in increasing order. The method_idx of a virtual method must not be the same as any direct method. |
Note: All elements' field_id
s and method_id
s must refer to the same defining class.
encoded_field format
Name | Format | বর্ণনা |
---|---|---|
field_idx_diff | uleb128 | index into the field_ids list for the identity of this field (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly. |
access_flags | uleb128 | access flags for the field ( public , final , etc.). See " access_flags Definitions" for details. |
encoded_method format
Name | Format | বর্ণনা |
---|---|---|
method_idx_diff | uleb128 | index into the method_ids list for the identity of this method (includes the name and descriptor), represented as a difference from the index of previous element in the list. The index of the first element in a list is represented directly. |
access_flags | uleb128 | access flags for the method ( public , final , etc.). See " access_flags Definitions" for details. |
code_off | uleb128 | offset from the start of the file to the code structure for this method, or 0 if this method is either abstract or native . The offset should be to a location in the data section. The format of the data is specified by " code_item " below. |
type_list
referenced from class_def_item and proto_id_item
appears in the data section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
size | uint | size of the list, in entries |
list | type_item[size] | elements of the list |
type_item format
Name | Format | বর্ণনা |
---|---|---|
type_idx | ushort | index into the type_ids list |
code_item
referenced from encoded_method
appears in the data section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
registers_size | ushort | the number of registers used by this code |
ins_size | ushort | the number of words of incoming arguments to the method that this code is for |
outs_size | ushort | the number of words of outgoing argument space required by this code for method invocation |
tries_size | ushort | the number of try_item s for this instance. If non-zero, then these appear as the tries array just after the insns in this instance. |
debug_info_off | uint | offset from the start of the file to the debug info (line numbers + local variable info) sequence for this code, or 0 if there simply is no information. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " debug_info_item " below. |
insns_size | uint | size of the instructions list, in 16-bit code units |
insns | ushort[insns_size] | actual array of bytecode. The format of code in an insns array is specified by the companion document Dalvik bytecode . Note that though this is defined as an array of ushort , there are some internal structures that prefer four-byte alignment. Also, if this happens to be in an endian-swapped file, then the swapping is only done on individual ushort s and not on the larger internal structures. |
padding | ushort (optional) = 0 | two bytes of padding to make tries four-byte aligned. This element is only present if tries_size is non-zero and insns_size is odd. |
tries | try_item[tries_size] (optional) | array indicating where in the code exceptions are caught and how to handle them. Elements of the array must be non-overlapping in range and in order from low to high address. This element is only present if tries_size is non-zero. |
handlers | encoded_catch_handler_list (optional) | bytes representing a list of lists of catch types and associated handler addresses. Each try_item has a byte-wise offset into this structure. This element is only present if tries_size is non-zero. |
try_item format
Name | Format | বর্ণনা |
---|---|---|
start_addr | uint | start address of the block of code covered by this entry. The address is a count of 16-bit code units to the start of the first covered instruction. |
insn_count | ushort | number of 16-bit code units covered by this entry. The last code unit covered (inclusive) is start_addr + insn_count - 1 . |
handler_off | ushort | offset in bytes from the start of the associated encoded_catch_hander_list to the encoded_catch_handler for this entry. This must be an offset to the start of an encoded_catch_handler . |
encoded_catch_handler_list format
Name | Format | বর্ণনা |
---|---|---|
size | uleb128 | size of this list, in entries |
list | encoded_catch_handler[handlers_size] | actual list of handler lists, represented directly (not as offsets), and concatenated sequentially |
encoded_catch_handler format
Name | Format | বর্ণনা |
---|---|---|
size | sleb128 | number of catch types in this list. If non-positive, then this is the negative of the number of catch types, and the catches are followed by a catch-all handler. For example: A size of 0 means that there is a catch-all but no explicitly typed catches. A size of 2 means that there are two explicitly typed catches and no catch-all. And a size of -1 means that there is one typed catch along with a catch-all. |
handlers | encoded_type_addr_pair[abs(size)] | stream of abs(size) encoded items, one for each caught type, in the order that the types should be tested. |
catch_all_addr | uleb128 (optional) | bytecode address of the catch-all handler. This element is only present if size is non-positive. |
encoded_type_addr_pair format
Name | Format | বর্ণনা |
---|---|---|
type_idx | uleb128 | index into the type_ids list for the type of the exception to catch |
addr | uleb128 | bytecode address of the associated exception handler |
debug_info_item
referenced from code_item
appears in the data section
alignment: none (byte-aligned)
Each debug_info_item
defines a DWARF3-inspired byte-coded state machine that, when interpreted, emits the positions table and (potentially) the local variable information for a code_item
. The sequence begins with a variable-length header (the length of which depends on the number of method parameters), is followed by the state machine bytecodes, and ends with an DBG_END_SEQUENCE
byte.
The state machine consists of five registers. The address
register represents the instruction offset in the associated insns_item
in 16-bit code units. The address
register starts at 0
at the beginning of each debug_info
sequence and must only monotonically increase. The line
register represents what source line number should be associated with the next positions table entry emitted by the state machine. It is initialized in the sequence header, and may change in positive or negative directions but must never be less than 1
. The source_file
register represents the source file that the line number entries refer to. It is initialized to the value of source_file_idx
in class_def_item
. The other two variables, prologue_end
and epilogue_begin
, are boolean flags (initialized to false
) that indicate whether the next position emitted should be considered a method prologue or epilogue. The state machine must also track the name and type of the last local variable live in each register for the DBG_RESTART_LOCAL
code.
The header is as follows:
Name | Format | বর্ণনা |
---|---|---|
line_start | uleb128 | the initial value for the state machine's line register. Does not represent an actual positions entry. |
parameters_size | uleb128 | the number of parameter names that are encoded. There should be one per method parameter, excluding an instance method's this , if any. |
parameter_names | uleb128p1[parameters_size] | string index of the method parameter name. An encoded value of NO_INDEX indicates that no name is available for the associated parameter. The type descriptor and signature are implied from the method descriptor and signature. |
The byte code values are as follows:
Name | Value | Format | Arguments | বর্ণনা |
---|---|---|---|---|
DBG_END_SEQUENCE | 0x00 | (none) | terminates a debug info sequence for a code_item | |
DBG_ADVANCE_PC | 0x01 | uleb128 addr_diff | addr_diff : amount to add to address register | advances the address register without emitting a positions entry |
DBG_ADVANCE_LINE | 0x02 | sleb128 line_diff | line_diff : amount to change line register by | advances the line register without emitting a positions entry |
DBG_START_LOCAL | 0x03 | uleb128 register_num uleb128p1 name_idx uleb128p1 type_idx | register_num : register that will contain localname_idx : string index of the nametype_idx : type index of the type | introduces a local variable at the current address. Either name_idx or type_idx may be NO_INDEX to indicate that that value is unknown. |
DBG_START_LOCAL_EXTENDED | 0x04 | uleb128 register_num uleb128p1 name_idx uleb128p1 type_idx uleb128p1 sig_idx | register_num : register that will contain localname_idx : string index of the nametype_idx : type index of the typesig_idx : string index of the type signature | introduces a local with a type signature at the current address. Any of name_idx , type_idx , or sig_idx may be NO_INDEX to indicate that that value is unknown. (If sig_idx is -1 , though, the same data could be represented more efficiently using the opcode DBG_START_LOCAL .) Note: See the discussion under " |
DBG_END_LOCAL | 0x05 | uleb128 register_num | register_num : register that contained local | marks a currently-live local variable as out of scope at the current address |
DBG_RESTART_LOCAL | 0x06 | uleb128 register_num | register_num : register to restart | re-introduces a local variable at the current address. The name and type are the same as the last local that was live in the specified register. |
DBG_SET_PROLOGUE_END | 0x07 | (none) | sets the prologue_end state machine register, indicating that the next position entry that is added should be considered the end of a method prologue (an appropriate place for a method breakpoint). The prologue_end register is cleared by any special ( >= 0x0a ) opcode. | |
DBG_SET_EPILOGUE_BEGIN | 0x08 | (none) | sets the epilogue_begin state machine register, indicating that the next position entry that is added should be considered the beginning of a method epilogue (an appropriate place to suspend execution before method exit). The epilogue_begin register is cleared by any special ( >= 0x0a ) opcode. | |
DBG_SET_FILE | 0x09 | uleb128p1 name_idx | name_idx : string index of source file name; NO_INDEX if unknown | indicates that all subsequent line number entries make reference to this source file name, instead of the default name specified in code_item |
Special Opcodes | 0x0a…0xff | (none) | advances the line and address registers, emits a position entry, and clears prologue_end and epilogue_begin . See below for description. |
Special opcodes
Opcodes with values between 0x0a
and 0xff
(inclusive) move both the line
and address
registers by a small amount and then emit a new position table entry. The formula for the increments are as follows:
DBG_FIRST_SPECIAL = 0x0a // the smallest special opcode DBG_LINE_BASE = -4 // the smallest line number increment DBG_LINE_RANGE = 15 // the number of line increments represented adjusted_opcode = opcode - DBG_FIRST_SPECIAL line += DBG_LINE_BASE + (adjusted_opcode % DBG_LINE_RANGE) address += (adjusted_opcode / DBG_LINE_RANGE)
annotations_directory_item
referenced from class_def_item
appears in the data section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
class_annotations_off | uint | offset from the start of the file to the annotations made directly on the class, or 0 if the class has no direct annotations. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
fields_size | uint | count of fields annotated by this item |
annotated_methods_size | uint | count of methods annotated by this item |
annotated_parameters_size | uint | count of method parameter lists annotated by this item |
field_annotations | field_annotation[fields_size] (optional) | list of associated field annotations. The elements of the list must be sorted in increasing order, by field_idx . |
method_annotations | method_annotation[methods_size] (optional) | list of associated method annotations. The elements of the list must be sorted in increasing order, by method_idx . |
parameter_annotations | parameter_annotation[parameters_size] (optional) | list of associated method parameter annotations. The elements of the list must be sorted in increasing order, by method_idx . |
Note: All elements' field_id
s and method_id
s must refer to the same defining class.
field_annotation format
Name | Format | বর্ণনা |
---|---|---|
field_idx | uint | index into the field_ids list for the identity of the field being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the field. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
method_annotation format
Name | Format | বর্ণনা |
---|---|---|
method_idx | uint | index into the method_ids list for the identity of the method being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the method. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
parameter_annotation format
Name | Format | বর্ণনা |
---|---|---|
method_idx | uint | index into the method_ids list for the identity of the method whose parameters are being annotated |
annotations_off | uint | offset from the start of the file to the list of annotations for the method parameters. The offset should be to a location in the data section. The format of the data is specified by " annotation_set_ref_list " below. |
annotation_set_ref_list
referenced from parameter_annotations_item
appears in the data section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
size | uint | size of the list, in entries |
list | annotation_set_ref_item[size] | elements of the list |
annotation_set_ref_item format
Name | Format | বর্ণনা |
---|---|---|
annotations_off | uint | offset from the start of the file to the referenced annotation set or 0 if there are no annotations for this element. The offset, if non-zero, should be to a location in the data section. The format of the data is specified by " annotation_set_item " below. |
annotation_set_item
referenced from annotations_directory_item, field_annotations_item, method_annotations_item, and annotation_set_ref_item
appears in the data section
alignment: 4 bytes
Name | Format | বর্ণনা |
---|---|---|
size | uint | size of the set, in entries |
entries | annotation_off_item[size] | elements of the set. The elements must be sorted in increasing order, by type_idx . |
annotation_off_item format
Name | Format | বর্ণনা |
---|---|---|
annotation_off | uint | offset from the start of the file to an annotation. The offset should be to a location in the data section, and the format of the data at that location is specified by " annotation_item " below. |
annotation_item
referenced from annotation_set_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | বর্ণনা |
---|---|---|
visibility | ubyte | intended visibility of this annotation (see below) |
annotation | encoded_annotation | encoded annotation contents, in the format described by " encoded_annotation format" under " encoded_value encoding" above. |
Visibility values
These are the options for the visibility
field in an annotation_item
:
Name | Value | বর্ণনা |
---|---|---|
VISIBILITY_BUILD | 0x00 | intended only to be visible at build time (eg, during compilation of other code) |
VISIBILITY_RUNTIME | 0x01 | intended to visible at runtime |
VISIBILITY_SYSTEM | 0x02 | intended to visible at runtime, but only to the underlying system (and not to regular user code) |
encoded_array_item
referenced from class_def_item
appears in the data section
alignment: none (byte-aligned)
Name | Format | বর্ণনা |
---|---|---|
value | encoded_array | bytes representing the encoded array value, in the format specified by " encoded_array Format" under " encoded_value Encoding" above. |
hiddenapi_class_data_item
This section contains data on restricted interfaces used by each class.
Note: The hidden API feature was introduced in Android 10.0 and is only applicable to the DEX files of classes in the boot class path. The list of flags described below may be extended in the future releases of Android. For more information, see restrictions on non-SDK interfaces .
Name | Format | বর্ণনা |
---|---|---|
size | uint | total size of the section |
offsets | uint[] | array of offsets indexed by class_idx . A zero array entry at index class_idx means that either there is no data for this class_idx , or all hidden API flags are zero. Otherwise the array entry is non-zero and contains an offset from the beginning of the section to an array of hidden API flags for this class_idx . |
flags | uleb128[] | concatenated arrays of hidden API flags for each class. Possible flag values are described in the table below. Flags are encoded in the same order as fields and methods are encoded in class data. |
Restriction flag types:
Name | Value | বর্ণনা |
---|---|---|
whitelist | 0 | Interfaces that can be freely used and are supported as part of the officially documented Android framework Package Index . |
greylist | 1 | Non-SDK interfaces that can be used regardless of the application's target API level . |
blacklist | 2 | Non-SDK interfaces that cannot be used regardless of the application's target API level . Accessing one of these interfaces causes a runtime error . |
greylist‑max‑o | 3 | Non-SDK interfaces that can be used for Android 8.x and below unless they are restricted. |
greylist‑max‑p | 4 | Non-SDK interfaces that can be used for Android 9.x unless they are restricted. |
greylist‑max‑q | 5 | Non-SDK interfaces that can be used for Android 10.x unless they are restricted. |
greylist‑max‑r | 6 | Non-SDK interfaces that can be used for Android 11.x unless they are restricted. |
System annotations
System annotations are used to represent various pieces of reflective information about classes (and methods and fields). This information is generally only accessed indirectly by client (non-system) code.
System annotations are represented in .dex
files as annotations with visibility set to VISIBILITY_SYSTEM
.
dalvik.annotation.AnnotationDefault
appears on methods in annotation interfaces
An AnnotationDefault
annotation is attached to each annotation interface which wishes to indicate default bindings.
Name | Format | বর্ণনা |
---|---|---|
value | Annotation | the default bindings for this annotation, represented as an annotation of this type. The annotation need not include all names defined by the annotation; missing names simply do not have defaults. |
dalvik.annotation.EnclosingClass
appears on classes
An EnclosingClass
annotation is attached to each class which is either defined as a member of another class, per se, or is anonymous but not defined within a method body (eg, a synthetic inner class). Every class that has this annotation must also have an InnerClass
annotation. Additionally, a class must not have both an EnclosingClass
and an EnclosingMethod
annotation.
Name | Format | বর্ণনা |
---|---|---|
value | Class | the class which most closely lexically scopes this class |
dalvik.annotation.EnclosingMethod
appears on classes
An EnclosingMethod
annotation is attached to each class which is defined inside a method body. Every class that has this annotation must also have an InnerClass
annotation. Additionally, a class must not have both an EnclosingClass
and an EnclosingMethod
annotation.
Name | Format | বর্ণনা |
---|---|---|
value | Method | the method which most closely lexically scopes this class |
dalvik.annotation.InnerClass
appears on classes
An InnerClass
annotation is attached to each class which is defined in the lexical scope of another class's definition. Any class which has this annotation must also have either an EnclosingClass
annotation or an EnclosingMethod
annotation.
Name | Format | বর্ণনা |
---|---|---|
name | String | the originally declared simple name of this class (not including any package prefix). If this class is anonymous, then the name is null . |
accessFlags | int | the originally declared access flags of the class (which may differ from the effective flags because of a mismatch between the execution models of the source language and target virtual machine) |
dalvik.annotation.MemberClasses
appears on classes
A MemberClasses
annotation is attached to each class which declares member classes. (A member class is a direct inner class that has a name.)
Name | Format | বর্ণনা |
---|---|---|
value | Class[] | array of the member classes |
dalvik.annotation.MethodParameters
appears on methods
Note: This annotation was added after Android 7.1. Its presence on earlier Android releases will be ignored.
A MethodParameters
annotation is optional and can be used to provide parameter metadata such as parameter names and modifiers.
The annotation can be omitted from a method or constructor safely when the parameter metadata is not required at runtime. java.lang.reflect.Parameter.isNamePresent()
can be used to check whether metadata is present for a parameter, and the associated reflection methods such as java.lang.reflect.Parameter.getName()
will fall back to default behavior at runtime if the information is not present.
When including parameter metadata, compilers must include information for generated classes such as enums, since the parameter metadata includes whether or not a parameter is synthetic or mandated.
A MethodParameters
annotation describes only individual method parameters. Therefore, compilers may omit the annotation entirely for constructors and methods that have no parameters, for the sake of code-size and runtime efficiency.
The arrays documented below must be the same size as for the method_id_item
dex structure associated with the method, otherwise a java.lang.reflect.MalformedParametersException
will be thrown at runtime.
That is: method_id_item.proto_idx
-> proto_id_item.parameters_off
-> type_list.size
must be the same as names().length
and accessFlags().length
.
Because MethodParameters
describes all formal method parameters, even those not explicitly or implicitly declared in source code, the size of the arrays may differ from the Signature or other metadata information that is based only on explicit parameters declared in source code. MethodParameters
will also not include any information about type annotation receiver parameters that do not exist in the actual method signature.
Name | Format | বর্ণনা |
---|---|---|
names | String[] | The names of formal parameters for the associated method. The array must not be null but must be empty if there are no formal parameters. A value in the array must be null if the formal parameter with that index has no name. If parameter name strings are empty or contain '.', ';', '[' or '/' then a java.lang.reflect.MalformedParametersException will be thrown at runtime. |
accessFlags | int[] | The access flags of the formal parameters for the associated method. The array must not be null but must be empty if there are no formal parameters. The value is a bit mask with the following values:
java.lang.reflect.MalformedParametersException will be thrown at runtime. |
dalvik.annotation.Signature
appears on classes, fields, and methods
A Signature
annotation is attached to each class, field, or method which is defined in terms of a more complicated type than is representable by a type_id_item
. The .dex
format does not define the format for signatures; it is merely meant to be able to represent whatever signatures a source language requires for successful implementation of that language's semantics. As such, signatures are not generally parsed (or verified) by virtual machine implementations. The signatures simply get handed off to higher-level APIs and tools (such as debuggers). Any use of a signature, therefore, should be written so as not to make any assumptions about only receiving valid signatures, explicitly guarding itself against the possibility of coming across a syntactically invalid signature.
Because signature strings tend to have a lot of duplicated content, a Signature
annotation is defined as an array of strings, where duplicated elements naturally refer to the same underlying data, and the signature is taken to be the concatenation of all the strings in the array. There are no rules about how to pull apart a signature into separate strings; that is entirely up to the tools that generate .dex
files.
Name | Format | বর্ণনা |
---|---|---|
value | String[] | the signature of this class or member, as an array of strings that is to be concatenated together |
dalvik.annotation.Throws
appears on methods
A Throws
annotation is attached to each method which is declared to throw one or more exception types.
Name | Format | বর্ণনা |
---|---|---|
value | Class[] | the array of exception types thrown |