Tool: mp_bin2objdump

Overview

The mp_bin2objdump tool provides an interface to disassemble raw binary files. Some of the back-ends for Microprobe generate *.bin files that contain the generated codified instructions. In order to debug and check what it is generated, one can use this tool and get the corresponding assembly. This differs from mp_bin2asm tool in that it generates an output similar to the one used by GNU objdump in binutils.

Basic usage

> mp_bin2objdump -T TARGET -i INPUT_BIN_FILE > OBJDUMP_FILE

where:

Flag/Argument

Description

-T TARGET, --target TARGET

Target definition string. Check: Command line target definition scheme.

-i INPUT_BIN_FILE, --input-bin-file INPUT_BIN_FILE

Input binary file.

Full usage

usage: mp_bin2objdump.py [-h] [-P SEARCH_PATH [SEARCH_PATH ...]] [-V] [-v]
                         [-d] [-c CONFIG_FILE [CONFIG_FILE ...]]
                         [-C FORCE_CONFIG_FILE]
                         [--dump-configuration-file OUTPUT_CONFIG_FILE]
                         [--dump-full-configuration-file OUTPUT_CONFIG_FILE]
                         [-A ARCHITECTURE_PATHS] [-M MICROARCHITECTURE_PATHS]
                         [-E ENVIRONMENT_PATHS] -T TARGET
                         [--list-architectures] [--list-microarchitectures]
                         [--list-environments] [--traceback]
                         [--profile PROFILE_OUTPUT] -i INPUT_BIN_FILE
                         [-ob OD_BIN] [-X START_ADDRESS] [-S]

Microprobe Binary to Objdump tool

optional arguments:
  -h, --help            show this help message and exit
  -P SEARCH_PATH [SEARCH_PATH ...], --default_paths SEARCH_PATH [SEARCH_PATH ...]
                        Default search paths for microprobe target definitions
  -V, --version         Show Microprobe version and exit
  -v, --verbosity       Verbosity level (Values: [0,1,2,3,4]). Each time this
                        argument is specified the verbosity level is
                        increased. By default, no logging messages are shown.
                        These are the four levels available:
                        
                          -v (1): critical messages
                          -v -v (2): critical and error messages
                          -v -v -v (3): critical, error and warning messages
                          -v -v -v -v (4): critical, error, warning and info messages
                        
                        Specifying more than four verbosity flags, will
                        default to the maximum of four. If you need extra
                        information, enable the debug mode (--debug or -d
                        flags).
  -d, --debug           Enable debug mode in Microprobe framework. Lots of
                        output messages will be generated

Configuration arguments:

  Command arguments related to configuration file handling

  -c CONFIG_FILE [CONFIG_FILE ...], --configuration CONFIG_FILE [CONFIG_FILE ...]
                        Configuration file. The configuration files will be
                        readed in order of appearance. Values are reset by the
                        last configuration file in case of non-list values.
                        List values will be appended (not reset)
  -C FORCE_CONFIG_FILE, --force-configuration FORCE_CONFIG_FILE
                        Force configuration file. Use this configuration file
                        as the default start configuration. This disables any
                        system-wide, or user-provided configuration.
  --dump-configuration-file OUTPUT_CONFIG_FILE
                        Dump a configuration file with the actual
                        configuration used
  --dump-full-configuration-file OUTPUT_CONFIG_FILE
                        Dump a configuration file with the actual
                        configuration used plus all the configuration options
                        not set

Target path arguments:

  Command arguments related to target paths

  -A ARCHITECTURE_PATHS, --architecture-paths ARCHITECTURE_PATHS
                        Search path for architecture definitions. Microprobe
                        will search in these paths for architecture
                        definitions
  -M MICROARCHITECTURE_PATHS, --microarchitecture-paths MICROARCHITECTURE_PATHS
                        Search path for microarchitecture definitions.
                        Microprobe will search in these paths for
                        microarchitecture definitions
  -E ENVIRONMENT_PATHS, --environment-paths ENVIRONMENT_PATHS
                        Search path for environment definitions. Microprobe
                        will search in these paths for environment definitions

Target arguments:

  Command arguments related to target specification and queries

  -T TARGET, --target TARGET
                        Target tuple. Microprobe follows a GCC-like target
                        definition scheme, where a target is defined by a
                        tuple as following:
                        
                          <arch-name>-<uarch-name>-<env-name>
                        
                        where:
                        
                          <arch-name>: is the name of the architecture
                          <uarch-name>: is the name of the microarchitecture
                          <env-name>: is the name of the environment
                        
                        One can use --list-* options to get the list of
                        definitions available in the default search paths or
                        the paths specified by the different --*-paths options
  --list-architectures  Generate a list of architectures available in the
                        defined search paths and exit
  --list-microarchitectures
                        Generate a list of microarchitectures available in the
                        defined search paths and exit
  --list-environments   Generate a list of environments available in the
                        defined search paths and exit

Debug arguments:

  Command arguments related to debugging facilities

  --traceback           show a traceback and starts a python debugger (pdb)
                        when an error occurs. 'pdb' is an interactive python
                        shell that facilitates the debugging of errors
  --profile PROFILE_OUTPUT
                        dump profiling information into given file (see
                        'pstats' module)

Binary to Objdump arguments:

  Command arguments related to Binary to Objdump tool

  -i INPUT_BIN_FILE, --input-bin-file INPUT_BIN_FILE
                        Binary file to process
  -ob OD_BIN, --od-bin OD_BIN
                        'od' dump utility. Default: /bin/od
  -X START_ADDRESS, --start-address START_ADDRESS
                        Start address. Default: 0x0
  -S, --strict          Check relative branches correctness and all
                        instructions valid.

Environment variables:

  MICROPROBETEMPLATES    Default path for microprobe templates
  MICROPROBEDEBUG        If set, enable debug
  MICROPROBEDEBUGPASSES  If set, enable debug during passes
  MICROPROBEASMHEXFMT    Assembly hexadecimal format. Options:
                         'all' -> All immediates in hex format
                         'address' -> Address immediates in hex format (default)
                         'none' -> All immediate in integer format

Example outputs

Example 1:

Command:

> mp_bin2objdump -T z13-z13-z64_mesa_st -i input.bin

Output:

usage: mp_bin2objdump.py [-h] [-P SEARCH_PATH [SEARCH_PATH ...]] [-V] [-v]
                         [-d] [-c CONFIG_FILE [CONFIG_FILE ...]]
                         [-C FORCE_CONFIG_FILE]
                         [--dump-configuration-file OUTPUT_CONFIG_FILE]
                         [--dump-full-configuration-file OUTPUT_CONFIG_FILE]
                         [-A ARCHITECTURE_PATHS] [-M MICROARCHITECTURE_PATHS]
                         [-E ENVIRONMENT_PATHS] -T TARGET
                         [--list-architectures] [--list-microarchitectures]
                         [--list-environments] [--traceback]
                         [--profile PROFILE_OUTPUT] -i INPUT_BIN_FILE
                         [-ob OD_BIN] [-X START_ADDRESS] [-S]
mp_bin2objdump.py: error: argument -i/--input-bin-file: '../../targets/z/tests/tools/bin2objdump_test001.bin' file does not exist