Skip to content

Commit

Permalink
added documentation for LM_Disassemble(Ex)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbo committed Jan 21, 2023
1 parent 11733f7 commit 2555702
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/api/c/LM_Disassemble.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# LM_Disassemble

```c
LM_API lm_bool_t
LM_Disassemble(lm_address_t code,
lm_inst_t *inst);
```
# Description
Disassembles a single instruction into an `lm_inst_t`.
# Parameters
- code: virtual address of the instruction to be disassembled.
- inst: a pointer to a variable of type `lm_inst_t` that will receive the disassembled instruction.
# Return Value
On success, it returns `LM_TRUE`. On failure, it returns `LM_FALSE`.
29 changes: 29 additions & 0 deletions docs/api/c/LM_DisassembleEx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# LM_DisassembleEx

```c
LM_API lm_size_t
LM_DisassembleEx(lm_address_t code,
lm_size_t bits,
lm_size_t size,
lm_size_t count,
lm_address_t runtime_addr,
lm_inst_t **pinsts);
```
# Description
Disassembles one or more instructions into `lm_inst_t`'s (must be deallocated with `LM_FreeInstructions`).
# Parameters
- code: virtual address of the instructions to be disassembled.
- bits: the bits of the architecture to be disassembled. It can be `32` or `64`.
- size: the maximum size in bytes for the disassembly.
- count: the amount of instructions to be disassembled (0 for as many as possible)
- runtime_addr: the runtime address to resolve the functions (for example, relative jumps will be resolved using this address).
- pinsts: a pointer to a variable of type `lm_inst_t *` that will receive the disassembled instructions (deallocate after use with `LM_FreeInstructions`).
# Return Value
On success, it returns the count of the instructions disassembled. On failure, it returns `0`.
18 changes: 18 additions & 0 deletions docs/api/python/LM_Disassemble.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# LM_Disassemble

```python
def LM_Disassemble(code : int)
```

# Description

Disassembles a single instruction into an `lm_inst_t`.

# Parameters

- code: virtual address of the instruction to be disassembled.

# Return Value

On success, it returns a valid `lm_inst_t` containing the disassembled instruction. On failure, it returns `None`.

22 changes: 22 additions & 0 deletions docs/api/python/LM_DisassembleEx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LM_DisassembleEx

```python
def LM_DisassembleEx(code : int, bits : int, size : int, count : int, runtime_addr : int)
```

# Description

Disassembles one or more instructions into `lm_inst_t`'s.

# Parameters

- code: virtual address of the instructions to be disassembled.
- bits: the bits of the architecture to be disassembled. It can be `32` or `64`.
- size: the maximum size in bytes for the disassembly.
- count: the amount of instructions to be disassembled (0 for as many as possible)
- runtime_addr: the runtime address to resolve the functions (for example, relative jumps will be resolved using this address).

# Return Value

On success, it returns a list of `lm_inst_t`'s containing the disassembled instructions. On failure, it returns `None`.

18 changes: 18 additions & 0 deletions docs/api/rust/LM_Disassemble.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# LM_Disassemble

```rust
pub fn LM_Disassemble(code : lm_address_t) -> Option<lm_inst_t>
```

# Description

Disassembles a single instruction into an `lm_inst_t`.

# Parameters

- code: virtual address of the instruction to be disassembled.

# Return Value

On success, it returns `Some(instruction)`, where `instruction` is a valid `lm_inst_t` containing the disassembled instruction. On failure, it returns `None`.

22 changes: 22 additions & 0 deletions docs/api/rust/LM_DisassembleEx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# LM_DisassembleEx

```rust
pub fn LM_DisassembleEx(code : lm_address_t, bits : lm_size_t, size : lm_size_t, count : lm_size_t, runtime_addr : lm_address_t) -> Option<Vec<lm_inst_t>>
```

# Description

Disassembles one or more instructions into `lm_inst_t`'s.

# Parameters

- code: virtual address of the instructions to be disassembled.
- bits: the bits of the architecture to be disassembled. It can be `32` or `64`.
- size: the maximum size in bytes for the disassembly.
- count: the amount of instructions to be disassembled (0 for as many as possible)
- runtime_addr: the runtime address to resolve the functions (for example, relative jumps will be resolved using this address).

# Return Value

On success, it returns `Some(instructions)`, where `instructions` is a vector of `lm_inst_t`'s containing the disassembled instructions. On failure, it returns `None`.

0 comments on commit 2555702

Please sign in to comment.