5.8.3 Disassembly functions

Describes the following functions:

disassembler_disassembleOpcode()

Retrieves the disassembly for an individual opcode.

Arguments

address

Type: NumberU64

Context for the disassembly. Address of the opcode, for example for addresses of relative branches. If unknown, specify 0.

context

Type: Object

Optional. More context information for the disassembly. The contents of this object depend on the instance and the selected mode. When this is missing, reasonable defaults are to be used.

instId

Type: NumberU64

Opaque number uniquely identifying the target instance.

mode

Type: String

Mode name to use for disassembling. This must either be one of the modes returned by disassembler_getModes() or the special mode Current which selects the mode currently returned by disassembler_getCurrentMode().

opcode

Type: NumberU64[]

Opcode to disassemble, in 64-bit units in little-endian format.

Return value

DisassemblyLine

DisassemblyLine object containing the disassembly.

Errors

  • E_unknown_instance_id.
  • E_unknown_disassembly_mode.

disassembler_getCurrentMode()

Gets a hint from the target about which disassembly mode is best suited to disassemble the memory around the current PC location of the target. It has similar semantics to resource_read(). Debuggers can use this function to implement an auto mode which always displays disassembly in the current mode.

Arguments

instId

Type: NumberU64

Opaque number uniquely identifying the target instance.

Return value

String

Name of the current mode. This is the mode that is best suited to disassemble the current PC location. If the target does not support disassembly, this is an empty string.

Errors

  • E_unknown_instance_id.

disassembler_getDisassembly()

Disassembles a chunk of memory.

Arguments

instId

Type: NumberU64

Opaque number uniquely identifying the target instance.

address

Type: NumberU64

Start disassembling at this address. Must be within minAddr and maxAddr in the memory space. If the set of implemented architectures has strong per-instruction alignment requirements which are not met by address, E_unaligned_access must be returned.

attrib

Type: Object

Optional. Transaction attributes for the memory read access. The attributes are represented as key/value pairs as members in the object. See memory_read() for details.

count

Type: NumberU64

Maximum number of lines to disassemble. Must be > 0.

maxAddr

Type: NumberU64

Optional. Stop disassembling at or shortly after maxAddr. One element is returned that is >= maxAddr. In any case, no more than count+1 elements are returned.

mode

Type: String

Mode name to use for disassembling. This must either be one of the modes returned by disassembler_getModes() or the special mode Current which selects the mode returned by disassembler_getCurrentMode().

spaceId

Type: NumberU64

Opaque number uniquely identifying the memory space.

Return value

DisassemblyLine[]

List of DisassemblyLine Objects containing the disassembly. The length of this array is one element more than the number of returned disassembly lines ([0 to count] + 1). A trailing DisassemblyLine element is appended which only has a valid address member containing the next address to start disassembling from. The opcode and disass members are invalid, and might be missing, for this last element.

Errors

  • E_unknown_instance_id.
  • E_unknown_memory_space_id.
  • E_data_size_error.
  • E_unknown_disassembly_mode.
  • E_address_out_of_range.
  • E_unaligned_access.
  • E_unsupported_attribute_name.
  • E_unsupported_attribute_value.
  • E_unsupported_attribute_combination.

disassembler_getModes()

Retrieves a list of supported disassembly modes. The mode name string is used to identify the disassembly mode.

Arguments

instId

Type: NumberU64

Opaque number uniquely identifying the target instance.

Return value

DisassemblyMode[]

List of supported disassembly modes. Empty if the target does not support disassembly. If the target supports disassembly, this must contain at least one element. See DisassemblyMode.

Errors

  • E_unknown_instance_id.
Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.