config.py¶
This module defines the default amoco configuration and loads any user-defined configuration file. It is based on the traitlets package.
-
config.
conf
¶ holds in a Config object based on Configurable traitlets, various parameters mostly related to how outputs should be formatted.
The defined configurable sections are:
‘Code’ which deals with how basic blocks are printed, with options:
- ‘helper’ will use codeblock helper functions to pretty print code if True (default)
- ‘header’ will show a dashed header line including the address of the block if True (default)
- ‘footer’ will show a dashed footer line if True
- ‘segment’ will show memory section/segment name in codeblock view if True (default)
- ‘bytecode’ will show the hex encoded bytecode string of every instruction if True (default)
- ‘padding’ will add the specified amount of blank chars to between address/bytecode/instruction (default 4).
- ‘hist’ number of instruction’s history shown in emulator view (default 3).
‘Cas’ which deals with parameters of the algebra system:
- ‘noaliasing’ will assume that mapper’s memory pointers are not aliased if True (default)
- ‘complexity’ threshold for expressions (default 100). See cas.expressions for details.
- ‘memtrace’ store memory writes as mapper items if True (default).
- ‘unicode’ will use math unicode symbols for expressions operators if True (default False).
‘DB’ which deals with database backend options:
- ‘url’ allows to define the dialect and/or location of the database (default to sqlite)
- ‘log’ indicates that database logging should be redirected to the amoco logging handlers
‘Log’ which deals with logging options:
- ‘level’ one of ‘ERROR’ (default), ‘VERBOSE’, ‘INFO’, ‘WARNING’ or ‘DEBUG’ from less to more verbose,
- ‘tempfile’ to also save DEBUG logs in a temporary file if True (default is False),
- ‘filename’ to also save DEBUG logs using this filename.
‘UI’ which deals with some user-interface pretty-printing options:
- ‘formatter’ one of ‘Null’ (default), ‘Terminal’, “Terminal256’, ‘TerminalDark’, ‘TerminalLight’, ‘Html’
- ‘graphics’ one of ‘term’ (default), ‘qt’ or ‘gtk’
- ‘console’ one of ‘python’ (default), or ‘ipython’
- ‘unicode’ will use unicode symbols for drawing lines and icons if True
‘Server’ which deals with amoco’s server parameters:
- ‘wbsz’ sets the size of the server’s internal shared memory buffer with spawned commands
- ‘timeout’ sets the servers’s internal timeout for the connection with spawned commands
‘Emu’ which deals with amoco’s emulator parameters:
- ‘hist’ defines the size of the emulator’s instructions’ history list (defaults to 100.)
- ‘stacksize’ defines the size in bytes of the emulator’s frame view that displays the stack.
‘Arch’ which allows to configure assembly format parameters:
- ‘assemble’ (unused)
- ‘format_x86’ one of ‘Intel’ (default), ‘ATT’
- ‘format_x64’ one of ‘Intel’ (default), ‘ATT’
Type: Config
-
class
config.
DB
(**kwargs)[source]¶ Configurable parameters related to the database.
-
log
¶ If True, merges database’s logs into amoco loggers.
Type: Bool
-
-
class
config.
Code
(**kwargs)[source]¶ Configurable parameters related to assembly blocks (code.block).
-
helper
¶ use block helpers if True.
Type: Bool
-
header
¶ display block header dash-line with its name if True.
Type: Bool
display block footer dash-line if True.
Type: Bool
-
segment
¶ display memory section/segment name if True.
Type: Bool
-
bytecode
¶ display instructions’ bytes.
Type: Bool
-
-
class
config.
Cas
(**kwargs)[source]¶ Configurable parameters related to the Computer Algebra System (expressions).
-
complexity
¶ limit expressions complexity to given value. Defaults to 10000, a relatively high value that keeps precision but can lead to very large expressions.
Type: int
-
unicode
¶ use unicode character for expressions’ operators if True.
Type: Bool
-
noaliasing
¶ If True (default), then assume that symbolic memory expressions (pointers) are never aliased.
Type: Bool
-
memtrace
¶ keep memory writes in mapper in addition to MemoryMap (default).
Type: Bool
-
-
class
config.
Log
(**kwargs)[source]¶ Configurable parameters related to logging.
-
tempfile
¶ log at VERBOSE level to a temporary tmp/ file if True.
Type: Bool
Note
observers for Log traits are defined in the amoco.logger module (to avoid module cyclic imports.)
-
-
class
config.
UI
(**kwargs)[source]¶ Configurable parameters related to User Interface(s).
-
class
config.
Arch
(**kwargs)[source]¶ Configurable parameters related to CPU architectures.
-
assemble
¶ unused yet.
Type: Bool
-
-
class
config.
System
(**kwargs)[source]¶ Configurable parameters related to the system sub-package.
-
aslr
¶ simulates ASLR if True. (not supported yet.)
Type: Bool
-
nx
¶ unused.
Type: Bool
-
-
class
config.
Config
(f=None)[source]¶ A Config instance takes an optional filename argument or looks for .amoco/config or .amocorc files to load a traitlets.config.PyFileConfigLoader used to adjust UI, DB, Code, Arch, Log, Cas, System, and Server parameters.
Note
The Config object supports a print() method to display the entire configuration.