clean doc

This commit is contained in:
Jean-Marie Mineau 2023-08-30 14:18:32 +02:00
parent b5ae8c5088
commit df2a441148
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
13 changed files with 84 additions and 80 deletions

View file

@ -4,7 +4,7 @@ use crate as androscalpel_serializer;
use crate::{Error, ReadSeek, Result, Serializable, Sleb128, Uleb128};
use std::io::Write;
/// https://source.android.com/docs/core/runtime/dex-format#code-item
/// <https://source.android.com/docs/core/runtime/dex-format#code-item>
/// alignment: 4 bytes
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CodeItem {
@ -12,7 +12,7 @@ pub struct CodeItem {
pub ins_size: u16,
pub outs_size: u16,
// pub tries_size: u16,
/// 0 if no debug info, else offset to a [`DebugInfoItem`].
/// 0 if no debug info, else offset to a [`crate::DebugInfoItem`].
pub debug_info_off: u32,
// pub insns_size: u32,
pub insns: Vec<u16>,
@ -166,7 +166,7 @@ impl Serializable for CodeItem {
}
}
/// https://source.android.com/docs/core/runtime/dex-format#type-item
/// <https://source.android.com/docs/core/runtime/dex-format#type-item>
#[derive(Serializable, Clone, Copy, Debug, PartialEq, Eq)]
pub struct TryItem {
/// Start address of the block of code covered. It's a count of 16-bit code unit to the
@ -179,7 +179,7 @@ pub struct TryItem {
pub handler_off: u16,
}
/// https://source.android.com/docs/core/runtime/dex-format#encoded-catch-handlerlist
/// <https://source.android.com/docs/core/runtime/dex-format#encoded-catch-handlerlist>
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct EncodedCatchHandlerList {
// pub size: Uleb128,
@ -191,9 +191,9 @@ impl EncodedCatchHandlerList {
Uleb128(self.list.len() as u32)
}
/// Return a reference to the [`EncodedCatchHandler`] located at `offset` bytes after
/// the begining of the [`EncodedCatchHandlerList`]. Expected to be used to lookup
/// the value refered to by [`TryItem.handler_off`].
/// Return a reference to the [`crate::EncodedCatchHandler`] located at `offset` bytes after
/// the begining of the [`crate::EncodedCatchHandlerList`]. Expected to be used to lookup
/// the value refered to by [`crate::TryItem.handler_off`].
pub fn get_handler_at_offset(&self, offset: u16) -> Result<&EncodedCatchHandler> {
let offset = offset as usize;
let mut current_offset = 0;
@ -238,7 +238,7 @@ impl Serializable for EncodedCatchHandlerList {
}
}
/// https://source.android.com/docs/core/runtime/dex-format#encoded-catch-handler
/// <https://source.android.com/docs/core/runtime/dex-format#encoded-catch-handler>
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct EncodedCatchHandler {
// pub size: Sleb128,
@ -313,10 +313,10 @@ impl Serializable for EncodedCatchHandler {
}
}
/// https://source.android.com/docs/core/runtime/dex-format#encoded-type-addr-pair
/// <https://source.android.com/docs/core/runtime/dex-format#encoded-type-addr-pair>
#[derive(Serializable, Clone, Copy, Debug, PartialEq, Eq)]
pub struct EncodedTypeAddrPair {
/// Index of the [`TypeId`] in `type_ids`
/// Index of the [`crate::TypeIdItem`] in `type_ids`
pub type_idx: Uleb128,
/// Bytecode address of the exception handler
pub addr: Uleb128,