# DexSQL 表与视图参考

本文说明每个内置关系的一行代表什么、连接键、字段含义和可空性。日常分析优先使用已解析的视图；检查 DEX 结构时使用基础表。

`?` 表示可空列。`Utf8`、`Utf8View` 和字符串字典在 SQL 中都作为文本使用；`Dynamic` 可以容纳不同 SQL 值类型。索引以 `file_id` 为作用域，字符串除外，其键为 `(string_pool_id, string_idx)`。序号从 0 开始。`_off` 表示字节偏移，指令地址以 16 位 code unit 计量。

文本以原始 MUTF-8 存储，在输出边界解码，详见[文本值](index.zh.md#文本值)。目录中的 `Utf8` 类型名表示 SQL 文本，不表示内部字节编码。

查看当前程序的 schema 可使用 `dexsql tables --input app.apk` 或 MCP 的 `list_tables` / `describe_table`。

## 选表指南

| 要查什么 | 用哪个关系 |
| --- | --- |
| 按 descriptor / 名字找类 | `classes` |
| 按 descriptor / 名字 / 参数找方法 | `methods` |
| 按 descriptor / 名字 / 类型找字段 | `fields` |
| 某个类**自己声明**的方法 | `class_methods` |
| 某个类**自己声明**的字段 | `class_fields` |
| 某个方法引用了哪些字符串常量 | `method_strings` |
| 谁调用了谁 | `method_calls` |
| 某个方法读写了哪些字段 | `method_field_accesses` |
| 某个方法引用了哪些类型 | `method_used_types` |
| 某个方法加载了哪些立即数 | `method_using_numbers` |
| 按字节码形状匹配方法 | `methods` |
| 谁携带了某个注解 | `annotation_elements_resolved` |
| 注解的嵌套值树 | `annotation_values` |
| 某个类实现了哪些 interface | `class_interfaces` |
| 某个原型的参数列表 | `proto_params` |
| 字符串常量池本身 | `strings` |

## 实体视图

### `types`

一行是当前 dex 引用的一个**类型**（`type_ids` 的一项）。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `type_idx` | `UInt32` | type id 索引 |
| `descriptor` | `Utf8` | 原始类型 descriptor，例如 `Ljava/lang/String;`、`I`、`[B` |
| `java_name` | `Utf8` | 更接近 Java 源码风格的类型名 |

### `protos`

一行是当前 dex 引用的一个**方法原型**（`proto_ids` 的一项）。

参数按 DEX 顺序排列。无参数时 `param_count = 0`、`param_descriptors = ''`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `proto_idx` | `UInt32` | proto id 索引 |
| `shorty_idx` | `UInt32` | shorty 字符串索引 |
| `shorty` | `Utf8` | dex shorty descriptor |
| `return_type_idx` | `UInt32` | 返回类型的 `type_idx` |
| `return_descriptor` | `Utf8` | 返回类型 descriptor |
| `parameters_off` | `UInt32` | 参数 `type_list` 偏移；0 表示没有列表 |
| `param_count` | `UInt32` | 参数数量 |
| `param_descriptors` | `Utf8` | 按 ordinal 顺序、以逗号连接的参数 descriptor |

### `fields`

一行是当前 dex 引用的一个**字段**（`field_ids` 的一项）。这是引用关系，不是定义关系——参见[引用与定义](data-model.zh.md#引用与定义)；某个类自己声明的字段用 `class_fields`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `field_idx` | `UInt32` | field id 索引 |
| `class_idx` | `UInt32` | 字段所属类的 `type_idx` |
| `class_descriptor` | `Utf8` | 字段所属类 descriptor |
| `type_idx` | `UInt32` | 字段值类型的 `type_idx` |
| `type_descriptor` | `Utf8` | 字段值类型 descriptor |
| `name` | `Utf8` | 字段名 |
| `descriptor` | `Utf8` | 完整字段 descriptor，形如 `Lpkg/Cls;->field:I` |

### `methods`

每行对应一个 DEX 引用的方法 ID，无论该 DEX 是否定义了这个方法。键为 `(file_id, method_idx)`；同一 descriptor 可以在多个 DEX 中出现。

仅引用行的 `access_flags`、`method_kind`、`opcode_count` 和 `opcode_hex` 为 `NULL`：该 DEX 并未定义这个方法，其字节码（如有）在别的文件中。已定义但没有 code item 的方法（abstract 或 native）的 `opcode_count = 0`、`opcode_hex = ''`。方法定义见 `class_methods`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | method id 索引 |
| `class_idx` | `UInt32` | 方法所属类的 `type_idx` |
| `class_descriptor` | `Utf8View` | 方法所属类 descriptor |
| `proto_idx` | `UInt32` | 方法原型索引 |
| `name` | `Utf8View` | 方法名 |
| `descriptor` | `Utf8View` | 完整方法 descriptor，形如 `Lpkg/Cls;->name(I)V` |
| `return_descriptor` | `Utf8View` | 返回类型 descriptor |
| `param_count` | `UInt32` | 参数数量 |
| `param_descriptors` | `Utf8View` | 按参数顺序、以逗号连接的参数 descriptor（与 `protos.param_descriptors` 形式相同） |
| `access_flags` | `UInt32?` | 方法访问标志；本 dex 只引用未定义该方法时为 `NULL` |
| `opcode_count` | `UInt32?` | 已解码指令数；本 dex 只引用该方法（此处没有 opcode 数据）时为 `NULL`。 |
| `opcode_hex` | `Utf8View?` | 以空格分隔的两位十六进制 opcode；本 dex 只引用该方法时为 `NULL`。 |
| `method_kind` | `Utf8?` | class data 中的方法分组，通常为 `direct` 或 `virtual`；未知时为 `NULL` |

### `classes`

每行对应一个类定义。只被引用的类型位于 `types`，不出现在此处。`superclass_descriptor` 和 `source_file` 可以为空。`interface_count` 是直接声明的接口数量，接口名称见 `class_interfaces`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_def_idx` | `UInt32` | class def section 内的顺序索引 |
| `class_idx` | `UInt32` | 当前类的 type id 索引 |
| `descriptor` | `Utf8` | 当前类 descriptor |
| `access_flags` | `UInt32` | 类访问标志 |
| `superclass_descriptor` | `Utf8?` | 父类 descriptor；无父类时为 `NULL` |
| `interface_count` | `UInt32` | 实现的 interface 数量（不实现任何 interface 时为 `0`，绝不为 `NULL`） |
| `source_file` | `Utf8?` | source file 名；无则为 `NULL` |

## 引用与成员视图

### `method_strings`

一行是一条**引用字符串的指令**：某个方法中的一处字符串常量。同一方法多次引用同一字符串会有多行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `method` | `Utf8View` | 指令所在方法的完整 descriptor。 |
| `method_class` | `Utf8View` | 指令所在类的 descriptor。 |
| `method_name` | `Utf8View` | 指令所在方法的名称。 |
| `value` | `Utf8View` | 字符串文本；输出时解码为 UTF-8。 |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | DEX 内的方法索引。 |
| `string_idx` | `UInt32` | DEX 字符串池中的字符串索引。 |

### `method_calls`

每行对应一条方法调用指令。无前缀列描述调用方，`callee*` 列描述指令引用的目标。重复调用保留为多行，不自动展开 override 或运行时分派。查询写法见[调用查询](calls.zh.md)。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `method` | `Utf8View` | 指令所在方法的完整 descriptor。 |
| `method_class` | `Utf8View` | 指令所在类的 descriptor。 |
| `method_name` | `Utf8View` | 指令所在方法的名称。 |
| `callee` | `Utf8View` | 被引用方法的完整 descriptor。 |
| `callee_class` | `Utf8View` | 被引用方法的类 descriptor。 |
| `callee_name` | `Utf8View` | 被引用方法的名称。 |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | DEX 内的方法索引。 |
| `callee_method_idx` | `UInt32` | 调用方 DEX 中被引用方法的索引。 |

### `method_field_accesses`

每行对应一条字段访问指令。`using_type` 使用小写：`get` 表示读取，`put` 表示写入。方法列标识访问方，字段列标识被引用的字段。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `method` | `Utf8View` | 指令所在方法的完整 descriptor。 |
| `method_class` | `Utf8View` | 指令所在类的 descriptor。 |
| `method_name` | `Utf8View` | 指令所在方法的名称。 |
| `field` | `Utf8View` | 被引用字段的完整 descriptor。 |
| `field_class` | `Utf8View` | 字段声明类的 descriptor。 |
| `field_name` | `Utf8View` | 字段名。 |
| `field_type` | `Utf8View` | 字段类型 descriptor。 |
| `using_type` | `Utf8?` | 字段读取为 `get`，写入为 `put`；其余为 `NULL`。 |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | DEX 内的方法索引。 |
| `field_idx` | `UInt32` | field id 索引 |

### `method_used_types`

一行是一条**引用类型的指令**（`check-cast`、`new-instance` 等）。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `method` | `Utf8View` | 指令所在方法的完整 descriptor。 |
| `method_class` | `Utf8View` | 指令所在类的 descriptor。 |
| `method_name` | `Utf8View` | 指令所在方法的名称。 |
| `type_descriptor` | `Utf8View` | 被引用类型的 descriptor。 |
| `type_name` | `Utf8View` | 被引用类型的 Java 风格名称。 |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | DEX 内的方法索引。 |
| `type_idx` | `UInt32` | DEX 内的 type 索引。 |

### `method_using_numbers`

每行对应一条加载数值立即量的指令。`long_value` 保存符号扩展的整数或浮点原始位；`double_value` 保存数值形式的浮点值，byte/short 常量对应 `NULL`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `method` | `Utf8View` | 指令所在方法的完整 descriptor。 |
| `method_class` | `Utf8View` | 指令所在类的 descriptor。 |
| `method_name` | `Utf8View` | 指令所在方法的名称。 |
| `number_type` | `Dictionary(Int8, Utf8)` | 数值类型，例如 `byte`、`short`、`int`、`long`、`float`、`double` |
| `long_value` | `Int64` | 整数值（符号扩展），或 `float`/`double` 的原始位模式 |
| `double_value` | `Float64?` | 浮点值；`byte`/`short` 为 `NULL` |
| `opcode` | `UInt32` | 原始 debug opcode 数值 |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | DEX 内的方法索引。 |

### `proto_params`

一行是某个原型的**一个参数**。与 `protos.param_descriptors` 是同一份数据的两种形态：这里一个参数一行，那里拼成一个字符串。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `proto_idx` | `UInt32` | DEX 内的方法原型索引。 |
| `ordinal` | `UInt32` | 父结构内从 0 开始的位置。 |
| `type_idx` | `UInt32` | DEX 内的 type 索引。 |
| `descriptor` | `Utf8` | 原始类型 descriptor，例如 `Ljava/lang/String;`、`I`、`[B` |

### `class_methods`

每行对应 class data 中的一个方法定义，键为 `(file_id, method_idx)`。包含 direct、virtual 方法以及 abstract/native 声明。更多原型和 opcode 字段可通过相同键在 `methods` 中读取。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 所属类索引 |
| `class_descriptor` | `Utf8` | 所属类 descriptor |
| `method_idx` | `UInt32` | method id 索引 |
| `method_name` | `Utf8` | 方法名 |
| `method_descriptor` | `Utf8` | 完整方法 descriptor |
| `kind` | `Utf8` | 方法分组，`direct` 或 `virtual` |
| `access_flags` | `UInt32` | 方法访问标志 |

### `class_interfaces`

每行对应类或接口直接声明的一个接口关系，不展开继承得到的接口。未直接声明接口的类型在此处没有行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `ordinal` | `UInt32` | 父结构内从 0 开始的位置。 |
| `interface_type_idx` | `UInt32` | 直接接口的 type 索引。 |
| `interface_descriptor` | `Utf8` | 直接接口 descriptor。 |

### `annotation_elements_resolved`

每行对应一个 owner、注解和顶层元素。没有元素的标记注解仍产生一行，元素列为 `NULL`。同一注解被多个 owner 共享时，会分别产生对应行。

`retention_policy` 将 visibility 0/1/2 映射为 `class`/`runtime`/`system`。`owner_kind` 为 `class`、`field`、`method` 或 `parameter`。嵌套元素见 `annotation_values`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `owner_kind` | `Dynamic` | `class`、`field`、`method` 或 `parameter`。 |
| `owner_idx` | `UInt32` | owner 索引，其索引域由 owner_kind 决定。 |
| `owner` | `Utf8?` | 被注解的类、字段、方法或参数 owner 的 descriptor。 |
| `parameter_idx` | `Dynamic?` | 参数 owner 的从 0 开始的位置；其他 owner 为 `NULL`。 |
| `annotation` | `Utf8` | 注解类型 descriptor。 |
| `visibility` | `UInt32` | annotation visibility 原始数值（0 = build/class，1 = runtime，2 = system） |
| `element_count` | `UInt32` | annotation element 数量 |
| `annotation_off` | `UInt32` | annotation item 偏移（连到 `annotation_elements`、以及指向它的那些 annotation set 的连接键） |
| `element_ordinal` | `UInt32?` | 顶层元素位置；标记注解为 `NULL`。 |
| `element_name` | `Utf8?` | 顶层元素名称；标记注解为 `NULL`。 |
| `value_kind` | `Utf8?` | 可读编码值类型 |
| `value_index` | `UInt32?` | 索引类值引用的 dex 索引——`string` 为 `string_idx`，`type` 与嵌套 `annotation` 自身类型为 `type_idx`，`field`/`enum` 为 `field_idx`，`method` 为 `method_idx`，`method_type` 为 `proto_idx`，`method_handle` 为 `method_handle_idx`；其余为 `NULL` |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |
| `retention_policy` | `Dynamic?` | 根据 visibility 得到 `class`、`runtime` 或 `system`。 |

### `annotation_values`

每行对应一个 owner 和任意嵌套深度的编码值节点。没有元素的标记注解不产生行。不含 owner 的值树位于 `annotation_elements`；节点字节范围和原始 `value_index` 引用也在该表。示例见[注解查询](annotations.zh.md)。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属逻辑 DEX 文件编号。 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `owner_kind` | `Dynamic` | `class` / `method` / `field` / `parameter` |
| `owner_idx` | `UInt32` | owner 索引，其索引域由 owner_kind 决定。 |
| `owner_descriptor` | `Utf8?` | 被注解的 类 / 方法 / 字段 / 参数 的 descriptor |
| `parameter_idx` | `Dynamic?` | 参数 owner 的从 0 开始的位置；其他 owner 为 `NULL`。 |
| `annotation_off` | `UInt32` | annotation item 偏移（连到 `annotation_elements`、以及指向它的那些 annotation set 的连接键） |
| `annotation_type_idx` | `UInt32` | 根注解类型索引。 |
| `annotation_descriptor` | `Utf8` | 根 annotation 类型的 descriptor |
| `depth` | `UInt32` | 相对根 annotation 的嵌套深度 |
| `ordinal` | `UInt32` | 在父 element/数组内的顺序 |
| `name_idx` | `UInt32?` | element 名称字符串索引；`array` 元素只有位置没有名字，为 `NULL` |
| `name` | `Utf8?` | 该值的 element 名称 |
| `value_kind` | `Utf8` | 可读编码值类型 |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |

## 字符串与注解

### `strings`

每行对应一个**字符串池条目**，包括常量、名称和 descriptor。`value` 保留原始 MUTF-8，可直接用 `WHERE value = '…'` 或 `WHERE value LIKE '%needle%'` 过滤。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `string_pool_id` | `UInt32` | 字符串池编号（DexSQL 分配）；从 `file_id` 出发经 `dex_files.string_pool_id` 到达 |
| `string_idx` | `UInt32` | 该池内的 string id 索引 |
| `value` | `Utf8View` | 字符串文本；输出时解码为 UTF-8 |

### `class_fields`

一行是一条**字段定义**（某个类的 class-data 成员）。这是 `fields` 的定义侧对应物，关系与 `class_methods` 之于 `methods` 相同——参见[引用与定义](data-model.zh.md#引用与定义)。列名同样带 `field_` 前缀：`field_name` / `field_descriptor` 对应 `fields` 的 `name` / `descriptor`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 所属类索引 |
| `class_descriptor` | `Utf8` | 所属类 descriptor |
| `field_idx` | `UInt32` | field id 索引 |
| `field_name` | `Utf8` | 字段名 |
| `field_descriptor` | `Utf8` | 完整字段 descriptor |
| `kind` | `Utf8` | 字段分组，通常为 `static` 或 `instance` |
| `access_flags` | `UInt32` | 字段访问标志 |

### `annotations`

每行对应一个 DEX `annotation_item`，唯一键为 `(file_id, annotation_off)`。表本身不带 owner 列，多个 owner 可以通过注解集合引用同一项。owner 关系见注解视图，值见 `annotation_elements`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_off` | `UInt32` | annotation item 偏移（连到 `annotation_elements`、以及指向它的那些 annotation set 的连接键） |
| `visibility` | `UInt32` | annotation visibility 原始数值（0 = build/class，1 = runtime，2 = system） |
| `type_idx` | `UInt32` | annotation 类型索引（`types.type_idx`） |
| `element_count` | `UInt32` | annotation element 数量 |

### `annotation_elements`

每行对应一个编码值节点，唯一键为 `(file_id, annotation_off, value_off)`。`depth = 0` 表示顶层元素。直接子节点的深度增加 1，字节范围位于父节点的 `[value_off, value_end_off)` 内。共享注解项在此只保存一份。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_off` | `UInt32` | 所属 annotation item 偏移（连到 `annotations` 的连接键） |
| `depth` | `UInt32` | 嵌套深度；`0` 为 annotation item 声明的 element |
| `ordinal` | `UInt32` | 同深度兄弟节点中的位置 |
| `name_idx` | `UInt32?` | element 名称字符串索引；`array` 元素只有位置没有名字，为 `NULL` |
| `value_off` | `UInt32` | 该值字节的起始偏移 |
| `value_end_off` | `UInt32` | 该值最后一个字节之后的偏移 |
| `value_kind` | `Utf8` | 可读值类型 |
| `value_index` | `UInt32?` | 索引类值引用的 dex 索引——`string` 为 `string_idx`，`type` 与嵌套 `annotation` 自身类型为 `type_idx`，`field`/`enum` 为 `field_idx`，`method` 为 `method_idx`，`method_type` 为 `proto_idx`，`method_handle` 为 `method_handle_idx`；其余为 `NULL` |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |

## DEX 文件布局

### `dex_files`

每个**逻辑** dex 一行。APK/ZIP 中每个 `classes*.dex` 都会成为独立行；DEX 041 容器里的每个逻辑 dex 也各占一行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | DexSQL 分配的 dex 文件编号 |
| `string_pool_id` | `UInt32` | 本 dex 解析 `string_idx` 所用的字符串池。041 以下就是本 dex 自己的池；041 容器内多个逻辑 dex 共享同一个 |
| `source_path` | `Utf8` | 输入的来源名，通常是原始路径或内存输入的标签；不一定是文件系统路径 |
| `entry_name` | `Utf8` | APK/ZIP 内的 dex entry 名；直接输入 dex 时为对应输入条目名。**041 容器例外**：同一个物理条目里的多个逻辑 dex 会被命名为 `classes.dex`、`classes.dex#2`……那些带 `#N` 的 zip 条目并不存在，是合成的 |
| `byte_len` | `UInt64` | 实际载入的 dex 字节数 |
| `dex_version` | `Utf8` | dex header 中的版本号字符串，例如 `035`、`038` |
| `checksum` | `UInt32` | dex header 的 Adler-32 checksum |
| `signature_hex` | `Utf8` | dex header 的 SHA-1 signature，十六进制文本 |
| `file_size` | `UInt32` | header 声明的 dex 文件大小 |
| `header_size` | `UInt32` | header 大小 |
| `endian_tag` | `UInt32` | dex endian tag |
| `link_size` | `UInt32` | link section 大小 |
| `link_off` | `UInt32` | link section 偏移 |
| `map_off` | `UInt32` | `map_list` 偏移 |
| `string_count` | `UInt32` | string id 数量 |
| `string_ids_off` | `UInt32` | string id section 偏移 |
| `type_count` | `UInt32` | type id 数量 |
| `type_ids_off` | `UInt32` | type id section 偏移 |
| `proto_count` | `UInt32` | proto id 数量 |
| `proto_ids_off` | `UInt32` | proto id section 偏移 |
| `field_count` | `UInt32` | field id 数量 |
| `field_ids_off` | `UInt32` | field id section 偏移 |
| `method_count` | `UInt32` | method id 数量 |
| `method_ids_off` | `UInt32` | method id section 偏移 |
| `class_count` | `UInt32` | class def 数量 |
| `class_defs_off` | `UInt32` | class def section 偏移 |
| `data_size` | `UInt32` | data section 大小 |
| `data_off` | `UInt32` | data section 偏移 |

### `map_items`

暴露 dex `map_list`。它描述当前 dex 内各 section 的类型、大小和起始偏移。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `ordinal` | `UInt32` | 当前 map item 在 `map_list` 中的顺序 |
| `type_code` | `UInt32` | dex map item 的原始 type code |
| `size` | `UInt32` | 该 section 中 item 的数量 |
| `offset` | `UInt32` | 该 section 的文件偏移 |

### `id_items`

统一暴露各类 id section 的原始 item 偏移。适合做底层布局检查。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `item_type_code` | `UInt32` | id item 所属 section 的 dex type code |
| `idx` | `UInt32` | 该 section 内的索引 |
| `item_off` | `UInt32` | id item 自身的起始偏移 |
| `item_end_off` | `UInt32` | id item 自身的结束偏移 |
| `data_off` | `UInt32?` | id item 指向 data 区结构时的目标偏移；没有目标结构时为 `NULL` |

## 索引与类数据

### `type_ids`

原始 `type_ids` 段：每个类型一行，只存其 descriptor 的 string id。可读的 [`types`](#types) 视图基于这张表。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `type_idx` | `UInt32` | type id 索引 |
| `descriptor_idx` | `UInt32` | 该类型 descriptor 的 `string_idx` |

### `type_lists`

原始 `type_list` 结构的摘要。proto 参数列表和 class interface 列表都会引用它。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `type_list_off` | `UInt32` | `type_list` 起始偏移 |
| `type_list_end_off` | `UInt32` | `type_list` 结束偏移 |
| `size` | `UInt32` | 该列表中的类型数量 |

### `type_list_entries`

把每个 `type_list` 拆成逐项行。

列表按偏移共享，方法原型参数和类接口可以引用同一份列表。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `type_list_off` | `UInt32` | 所属 `type_list` 起始偏移 |
| `ordinal` | `UInt32` | 类型在列表中的顺序 |
| `type_idx` | `UInt32` | 指向 `types.type_idx` 的类型索引 |

### `proto_ids`

原始 DEX `proto_id_item` 行。可读文本与参数聚合位于 `protos` 视图。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `proto_idx` | `UInt32` | proto id 索引 |
| `shorty_idx` | `UInt32` | shorty 字符串索引 |
| `return_type_idx` | `UInt32` | 返回类型的 `type_idx` |
| `parameters_off` | `UInt32` | 参数 `type_list` 偏移；0 表示没有列表 |

### `field_ids`

原始 `field_ids` 段：每个 field id 一行，只存 DEX 实际保存的三个索引。可读的 [`fields`](#fields) 视图基于这张表。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `field_idx` | `UInt32` | field id 索引 |
| `class_idx` | `UInt32` | 字段所属类的 `type_idx` |
| `type_idx` | `UInt32` | 字段值类型的 `type_idx` |
| `name_idx` | `UInt32` | 字段名的 `string_idx` |

### `method_ids`

原始 `method_ids` 段：每个 method id 一行，只存 DEX 实际保存的三个索引。可读的 [`methods`](#methods) 视图基于这张表。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | method id 索引（稠密，按段内顺序） |
| `class_idx` | `UInt32` | 声明类的 `type_idx` |
| `proto_idx` | `UInt32` | 原型索引（`protos.proto_idx`） |
| `name_idx` | `UInt32` | 方法名的 string id |

### `class_defs`

原始 `class_def_item` 记录——只有 DEX 索引，每个已声明的类一行，按 class-def 记录顺序排列。这些索引的
可读名称见 [`classes`](#classes) 视图；这里保留的是寻址该类其它结构所需的 offset。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_def_idx` | `UInt32` | class def section 内的顺序索引 |
| `class_idx` | `UInt32` | 当前类的 type id 索引 |
| `access_flags` | `UInt32` | 类访问标志 |
| `superclass_idx` | `UInt32?` | 父类的 type id 索引；`NO_INDEX` 时为 `NULL` |
| `interfaces_off` | `UInt32` | interface `type_list` 的 offset；不实现任何 interface 时为 `0` |
| `source_file_idx` | `UInt32?` | source file 名的 string id 索引；`NO_INDEX` 时为 `NULL` |
| `annotations_off` | `UInt32` | `annotations_directory_item` 的 offset；无则为 `0` |
| `class_data_off` | `UInt32` | `class_data_item` 的 offset；类不声明成员时为 `0` |
| `static_values_off` | `UInt32` | 静态字段初值 `encoded_array_item` 的 offset；无则为 `0` |

### `class_data_items`

类 `class_data_item` 摘要，记录字段和方法分组数量及字节范围。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 所属类索引 |
| `class_data_off` | `UInt32` | class data 起始偏移 |
| `class_data_end_off` | `UInt32` | class data 结束偏移 |
| `static_fields_size` | `UInt32` | static field 数量 |
| `instance_fields_size` | `UInt32` | instance field 数量 |
| `direct_methods_size` | `UInt32` | direct method 数量 |
| `virtual_methods_size` | `UInt32` | virtual method 数量 |

### `class_data_methods`

一行是 class-data 中的一条方法定义，带访问标志和它所属的编码列表（`direct` / `virtual`）。本 dex 只引用而未定义的 `method_id` 在这里没有行——这就是 `methods.access_flags` 与 `methods.method_kind` 可空的来源，参见[引用与定义](data-model.zh.md#引用与定义)。带类和方法名的可读形式用 `class_methods` 视图。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 声明类的 `type_idx` |
| `method_idx` | `UInt32` | method id 索引（`method_ids.method_idx`） |
| `access_flags` | `UInt32?` | 方法访问标志 |
| `kind` | `Utf8?` | 该记录所在的编码列表——`direct` 或 `virtual` |

### `class_static_values`

类静态字段初始值。它把 `static_values_off` encoded array 按顺序映射回静态字段。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 所属类索引 |
| `static_values_off` | `UInt32` | static values encoded array 偏移 |
| `ordinal` | `UInt32` | 静态初始值顺序 |
| `field_idx` | `UInt32?` | 对应 static field 的 field id 索引；无法映射时为 `NULL` |
| `value_kind` | `Utf8` | 可读值类型 |
| `value_index` | `UInt32?` | 索引类值所引用的 dex 索引，按 `value_kind` 解释——与 `encoded_array_values.value_index` 完全一致；其它情况为 `NULL` |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |

## 方法句柄与调用点

### `method_handles`

DEX 038+ 的 `method_handle_item` 表：handle 类型 + 它寻址的成员索引。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_handle_idx` | `UInt32` | method handle 索引 |
| `method_handle_type` | `UInt32` | 原始 method handle type 数值 |
| `member_idx` | `UInt32` | 目标 field id 或 method id 索引，由 `method_handle_type` 决定属于哪一侧 |

### `call_sites`

DEX 038+ 的 `call_site_id_item` 摘要，解析 invoke-custom 的 bootstrap 信息。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `call_site_idx` | `UInt32` | call site 索引 |
| `call_site_off` | `UInt32` | call site encoded array 偏移 |
| `value_count` | `UInt32` | call site encoded array 中的 encoded value 总数 |
| `method_handle_idx` | `UInt32?` | bootstrap method handle 索引；不存在或格式不匹配时为 `NULL` |
| `method_name_idx` | `UInt32?` | 调用点方法名字符串索引 |
| `proto_idx` | `UInt32?` | 调用点方法原型索引 |

### `call_site_args`

把 call site encoded array 的每个 encoded value 拆成逐项行。

这里只列顶层值。嵌套值树位于 `encoded_array_values`，其 `encoded_array_off = call_site_off`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `call_site_idx` | `UInt32` | 所属 call site 索引 |
| `call_site_off` | `UInt32` | 所属 call site encoded array 偏移 |
| `ordinal` | `UInt32` | 参数在 encoded array 中的顺序 |
| `value_kind` | `Utf8` | 可读值类型，例如 `string`、`method_type`、`int` |
| `value_index` | `UInt32?` | 该值引用的索引，按 `value_kind` 解释：`string`→`strings.string_idx`，`type`/`annotation`→`type_ids.type_idx`，`field`/`enum`→`field_idx`，`method`→`method_idx`，`method_type`→`proto_idx`，`method_handle`→`method_handle_idx` |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |

## 编码值

### `encoded_arrays`

所有已发现的 `encoded_array_item` 摘要。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `encoded_array_idx` | `UInt32` | DexSQL 给 encoded array 分配的顺序编号 |
| `encoded_array_off` | `UInt32` | encoded array 起始偏移 |
| `encoded_array_end_off` | `UInt32` | encoded array 结束偏移 |
| `value_count` | `UInt32` | 顶层 encoded value 数量 |

### `encoded_array_values`

每行对应编码数组中的一个值节点。`depth = 0` 表示顶层项；深度和字节范围包含关系描述嵌套数组及注解。引用名称按 `value_kind` 指定的索引域解析。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `encoded_array_off` | `UInt32` | 顶层 encoded array 起始偏移 |
| `depth` | `UInt32` | 嵌套深度，顶层为 0 |
| `ordinal` | `UInt32` | 当前层内的值顺序 |
| `name_idx` | `UInt32?` | annotation element 名称字符串索引；非 annotation element 时为 `NULL` |
| `value_off` | `UInt32` | encoded value 起始偏移 |
| `value_end_off` | `UInt32` | encoded value 结束偏移 |
| `value_kind` | `Utf8` | 可读值类型 |
| `value_index` | `UInt32?` | 该值引用的索引，按 `value_kind` 解释（与 `call_site_args.value_index` 相同） |
| `value_i64` | `Int64?` | 可表示为整数的标量值 |
| `value_f64` | `Float64?` | 可表示为浮点数的标量值 |

### `encoded_array_owners`

把 encoded array 偏移关联回已知 owner，例如 class static values 或 call site。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `encoded_array_off` | `UInt32` | encoded array 起始偏移 |
| `owner_kind` | `Utf8` | owner 类型，例如 `class_static_values` 或 `call_site` |
| `owner_idx` | `UInt32` | owner 的索引，例如 class idx 或 call site idx |

### `hiddenapi_flags`

Android hidden API metadata。只在 dex 携带对应 hiddenapi 数据时有行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 所属类索引 |
| `ordinal` | `UInt32` | hiddenapi flag 在该类成员展开顺序中的编号 |
| `member_kind` | `Utf8` | 成员大类，通常为 `field` 或 `method` |
| `member_idx` | `UInt32` | field id 或 method id 索引 |
| `flag` | `UInt32` | 原始 hiddenapi flag 数值 |

## 代码与异常处理

### `code_items`

方法实现的 `code_item` header 和布局信息。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `code_off` | `UInt32` | `code_item` 起始偏移 |
| `registers_size` | `UInt32` | 方法使用的寄存器总数 |
| `ins_size` | `UInt32` | 入参占用的寄存器 word 数 |
| `outs_size` | `UInt32` | out 寄存器 word 数 |
| `tries_size` | `UInt32` | try item 数量 |
| `debug_info_off` | `UInt32` | `debug_info_item` 偏移；dex 中没有时为 0 |
| `insns_size` | `UInt32` | 指令区大小，单位为 16-bit code unit |
| `insns_off` | `UInt32` | 指令数组起始字节偏移 |
| `tries_off` | `UInt32?` | try item 数组起始偏移；没有 try 时为 `NULL` |
| `handlers_off` | `UInt32?` | encoded catch handler list 起始偏移；没有 try 时为 `NULL` |

### `try_items`

方法 `code_item` 中的受保护指令范围。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `try_idx` | `UInt32` | try item 顺序 |
| `start_addr` | `UInt32` | try 范围起始指令地址，单位为 code unit |
| `insn_count` | `UInt32` | try 范围长度，单位为 code unit |
| `handler_off` | `UInt32` | catch handler 在 handler list 内的相对偏移 |

### `catch_handlers`

展开 `encoded_catch_handler_list` 中的 typed catch 和 catch-all 条目。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `handler_idx` | `UInt32` | DexSQL 分配的 handler 顺序编号 |
| `handler_off` | `UInt32` | handler 在 handler list 内的相对偏移 |
| `ordinal` | `UInt32` | 当前 handler 中 catch 条目的顺序 |
| `type_idx` | `UInt32?` | 捕获异常类型索引；catch-all 为 `NULL` |
| `addr` | `UInt32` | handler 起始指令地址，单位为 code unit |
| `is_catch_all` | `Boolean` | 是否为 catch-all 条目 |

## 调试信息

### `debug_info`

方法级 `debug_info_item` 摘要。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `debug_info_off` | `UInt32` | `debug_info_item` 起始偏移 |
| `line_start` | `UInt32` | debug 状态机初始源码行号 |
| `parameters_size` | `UInt32` | debug header 中声明的参数数量 |

### `debug_parameters`

debug header 中的方法参数名。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `debug_info_off` | `UInt32` | 所属 `debug_info_item` 偏移 |
| `ordinal` | `UInt32` | 参数顺序 |
| `name_idx` | `UInt32?` | 参数名字符串索引；匿名参数为 `NULL` |

### `debug_positions`

debug 状态机产生的源码位置映射。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `debug_info_off` | `UInt32` | 所属 `debug_info_item` 偏移 |
| `ordinal` | `UInt32` | 位置记录顺序 |
| `address` | `UInt32` | 指令地址，单位为 code unit |
| `line` | `Int32` | 源码行号 |
| `source_file_idx` | `UInt32?` | 当前 source file 字符串索引 |
| `prologue_end` | `Boolean` | 该位置是否带有 prologue end 状态 |
| `epilogue_begin` | `Boolean` | 该位置是否带有 epilogue begin 状态 |

### `debug_locals`

debug 状态机中的 local variable 事件。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `debug_info_off` | `UInt32` | 所属 `debug_info_item` 偏移 |
| `ordinal` | `UInt32` | local 事件顺序 |
| `address` | `UInt32` | 事件发生的指令地址，单位为 code unit |
| `event` | `Utf8` | local 事件类型，例如 start、end、restart |
| `register_num` | `UInt32` | local 变量所在寄存器编号 |
| `name_idx` | `UInt32?` | local 名字符串索引 |
| `type_idx` | `UInt32?` | local 类型索引 |
| `signature_idx` | `UInt32?` | local 泛型签名字符串索引 |

### `debug_opcodes`

逐条暴露 debug 状态机字节码，以及执行该 opcode 后的状态。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | 方法索引 |
| `debug_info_off` | `UInt32` | 所属 `debug_info_item` 偏移 |
| `ordinal` | `UInt32` | debug opcode 顺序 |
| `opcode_off` | `UInt32` | debug opcode 起始偏移 |
| `opcode_end_off` | `UInt32` | debug opcode 结束偏移 |
| `opcode` | `UInt32` | 原始 debug opcode 数值 |
| `address` | `UInt32` | 执行后状态机中的指令地址 |
| `line` | `Int32` | 执行后状态机中的源码行号 |
| `address_diff` | `UInt32?` | 本条 opcode 带来的地址增量 |
| `line_diff` | `Int32?` | 本条 opcode 带来的行号增量 |
| `register_num` | `UInt32?` | 本条 opcode 涉及的寄存器编号 |
| `name_idx` | `UInt32?` | 本条 opcode 涉及的名称字符串索引 |
| `type_idx` | `UInt32?` | 本条 opcode 涉及的类型索引 |
| `signature_idx` | `UInt32?` | 本条 opcode 涉及的签名字符串索引 |
| `source_file_idx` | `UInt32?` | 本条 opcode 设置的 source file 字符串索引 |
| `emits_position` | `Boolean` | 该 opcode 是否产生源码位置记录 |
| `emits_local` | `Boolean` | 该 opcode 是否产生 local variable 事件 |

## 注解结构

### `annotation_directories`

类 annotation directory 的摘要。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 声明类的类型索引 |
| `annotations_off` | `UInt32` | annotation directory 起始偏移 |
| `class_annotations_off` | `UInt32?` | 类自身 annotation set 偏移 |
| `fields_size` | `UInt32` | field annotation entry 数量 |
| `methods_size` | `UInt32` | method annotation entry 数量 |
| `parameters_size` | `UInt32` | parameter annotation entry 数量 |

### `annotation_directory_entries`

annotation directory 中 field、method、parameter 三类 entry 的统一展开。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | 声明类的类型索引 |
| `annotations_off` | `UInt32` | annotation directory 起始偏移 |
| `entry_kind` | `Utf8` | entry 类型，通常为 `field`、`method` 或 `parameter` |
| `entry_idx` | `UInt32` | 对应 field id 或 method id 索引 |
| `annotation_set_off` | `UInt32?` | field/method annotation set 偏移 |
| `annotation_set_ref_list_off` | `UInt32?` | parameter annotation set ref list 偏移 |

### `annotation_sets`

原始 `annotation_set_item` 摘要。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_set_off` | `UInt32` | annotation set 起始偏移 |
| `size` | `UInt32` | annotation set 中 annotation 数量 |

### `annotation_set_entries`

把 annotation set 拆成逐 annotation 引用行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_set_off` | `UInt32` | 所属 annotation set 偏移 |
| `ordinal` | `UInt32` | annotation 在 set 中的顺序 |
| `annotation_off` | `UInt32` | annotation item 偏移 |

### `annotation_set_ref_lists`

参数 annotation 使用的 `annotation_set_ref_list` 摘要。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_set_ref_list_off` | `UInt32` | annotation set ref list 起始偏移 |
| `size` | `UInt32` | ref list 中参数位置数量 |

### `annotation_set_refs`

把参数 annotation ref list 拆成逐参数位置行。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `annotation_set_ref_list_off` | `UInt32` | 所属 annotation set ref list 偏移 |
| `ordinal` | `UInt32` | 参数位置顺序 |
| `annotation_set_off` | `UInt32?` | 该参数位置的 annotation set 偏移；没有 annotation 时为 `NULL` |

## 字节码引用与摘要

### `method_refs`

方法字节码中的低层稀疏引用表。每行代表某个方法中一条带 dex 索引引用的指令。它保留引用类型和原始索引，不负责把目标解析成字符串、字段或方法 descriptor。普通特征查询优先使用语义视图（string 类型用 `method_strings`，method 类型用 `method_calls`，field 类型用 `method_field_accesses`，type 类型用 `method_used_types`）。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | 调用方方法索引 |
| `index_kind` | `Dictionary(Int8, Utf8)` | 引用索引类型，例如 `string`、`type`、`field`、`method`、`proto` |
| `index` | `UInt32` | 指令引用的原始 dex 索引 |
| `using_type` | `Utf8?` | 字段读取为 `get`，写入为 `put`；其余为 `NULL`。 |

### `method_numbers`

方法字节码中立即数常量的低层逐指令表——`method_using_numbers` 视图的原始来源。每行代表一条加载常量的指令；与 `method_refs` 不同，其数值是指令固有的，而非 dex 索引引用。特征查询优先使用 `method_using_numbers` 视图，它会解析出使用方方法的 descriptor。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `class_idx` | `UInt32` | DEX 内声明类的 type 索引。 |
| `method_idx` | `UInt32` | 使用方方法索引 |
| `opcode` | `UInt32` | 常量指令的 opcode 数值 |
| `number_type` | `Dictionary(Int8, Utf8)` | 数值类型，例如 `byte`、`short`、`int`、`long`、`float`、`double` |
| `long_value` | `Int64` | 整数值（符号扩展），或 `float`/`double` 的原始位模式 |
| `double_value` | `Float64?` | 浮点值；`byte`/`short` 为 `NULL` |

### `method_opcodes`

按 `(file_id, method_idx)` 标识的方法 opcode 摘要，每个 `method_ids` 行一行，为 `methods` 的 opcode 列提供数据。需要准备 opcode 数据。本 dex 只引用的方法两个 opcode 列均为 `NULL`；已定义但没有 code item 的方法为 `0` / `''`。

| 字段 | 类型 | 含义 |
| --- | --- | --- |
| `file_id` | `UInt32` | 所属 dex 文件编号 |
| `method_idx` | `UInt32` | method id 索引（`method_ids.method_idx`） |
| `opcode_count` | `UInt32?` | 解码出的 Dalvik 指令条数；仅引用方法为 `NULL` |
| `opcode_hex` | `Utf8View?` | opcode 序列的紧凑十六进制字符串；仅引用方法为 `NULL` |

---

Copyright (c) 2026 LSPosed Developers。本文档采用 [MIT 许可证](../license.md)。
