gdb: Architectures In Python

 
 23.2.2.33 Python representation of architectures
 ................................................
 
 GDB uses architecture specific parameters and artifacts in a number of
 its various computations.  An architecture is represented by an instance
 of the 'gdb.Architecture' class.
 
    A 'gdb.Architecture' class has the following methods:
 
  -- Function: Architecture.name ()
      Return the name (string value) of the architecture.
 
  -- Function: Architecture.disassemble (START_PC [, END_PC [, COUNT]])
      Return a list of disassembled instructions starting from the memory
      address START_PC.  The optional arguments END_PC and COUNT
      determine the number of instructions in the returned list.  If both
      the optional arguments END_PC and COUNT are specified, then a list
      of at most COUNT disassembled instructions whose start address
      falls in the closed memory address interval from START_PC to END_PC
      are returned.  If END_PC is not specified, but COUNT is specified,
      then COUNT number of instructions starting from the address
      START_PC are returned.  If COUNT is not specified but END_PC is
      specified, then all instructions whose start address falls in the
      closed memory address interval from START_PC to END_PC are
      returned.  If neither END_PC nor COUNT are specified, then a single
      instruction at START_PC is returned.  For all of these cases, each
      element of the returned list is a Python 'dict' with the following
      string keys:
 
      'addr'
           The value corresponding to this key is a Python long integer
           capturing the memory address of the instruction.
 
      'asm'
           The value corresponding to this key is a string value which
           represents the instruction with assembly language mnemonics.
           The assembly language flavor used is the same as that
           specified by the current CLI variable 'disassembly-flavor'.
           SeeMachine Code.
 
      'length'
           The value corresponding to this key is the length (integer
           value) of the instruction in bytes.