20.13 .set

The .set command allows you to inspect and set the value of global settings. The following invocations are valid:

.set

Prints all settings along with their values.

.set setting

Prints the value of the given setting.

.set setting value

Sets the value of setting to value.

The following settings can be handled with .set:

pretty-print

This setting determines whether poke should use pretty-printers while printing out the written representation of struct values.

Pretty-printers are defined as methods named ‘_print’.

auto-map

This setting determines whether to automatically load map files when opening IO spaces.

The decision of what maps to load is driven by the contents of the array ‘auto_map’. Each entry in the array is an array whose first element is a regular expression, and the second element is the name of a map.

Example:

auto_map = [["\.o", "elf"], ["\.o", "dwarf"]];

The entry above makes poke to automatically load the maps ‘elf.map’ and ‘dwarf.map’ when opening any file whose name ends in ‘.o’, provided ‘auto-map’ is set to ‘yes’.

prompt-commented

This setting determines whether the prompt is a shebang-comment, allowing for easy copy-paste of full terminal lines because the prompt will be a syntactic no-op.

Example of a prompt with prompt-commented enabled:

#!!# 1+2; 3

Example of a prompt with prompt-commented, map information, and ‘prompt-maps’ set to ‘yes’:

#!!# .file foo.o #![dwarf,elf]!# 1+2; 3 #![dwarf,elf]!#

prompt-maps

This setting determines whether a list of open maps is displayed before the poke prompt.

Example of a prompt with map information and ‘prompt-maps’ set to ‘yes’:

(poke) .file foo.o [dwarf,elf](poke)

Which indicates that the opening of the IO space ‘foo.o’ resulted in the ‘elf.map’ and ‘dwarf.map’ maps to be automatically loaded.

omaps

This sort of misnamed setting determines whether to show the mapped offsets and element/field offsets of composite values like arrays and structs.

Example:

(poke) .set omaps yes (poke) [1,2,3] [0x1 @ 0x0UL#b,0x2 @ 0x20UL#b,0x3 @ 0x40UL#b] @ 0x0UL#b

This setting defaults to ‘no’.

obase

This setting determines the output numerical base to use when printing integral values like integers, offset magnitudes, and the like. The supported bases are 2 for binary, 8 for octal, 10 for decimal and 16 for hexadecimal.

oacutoff

This setting determines the maximum number of elements to output when printing out array values. Once the maximum number of elements is reached, an ellipsis ‘...’ is printed to represent the rest of the elements.

Example:

(poke) [1,2,3,4,5] [1,2,3,4,5] (poke) .set oacutoff 3 [1,2,3,...]

The default value is 0, which means no limit.

odepth

This setting determines the maximum number of nested structs to output when printing struct and union values. Once the maximum number of nested values is reached, a collapsed form ‘Type {...}’ is printed.

Example:

(poke) type Foo = struct { struct { int i; } bar; } (poke) Foo {} Foo { bar=struct {...} }

The default value for ‘odepth’ is 0, which means infinite depth.

oindent

This setting determines the width (in blank characters) of each indentation level when printing out struct values in ‘tree’ mode.

Example:

(poke) .set oindent 4 (poke) Foo {} Foo { i=0x0, l=0x0L }

This setting defaults to 2. See also ".help omode".

omode

This setting determines the way binary struct data is displayed.

In ‘flat’ mode data is not formatted in any special way. Each value, be it simple or composite, is printed on one line.

In ‘tree’ mode composite values like structs and arrays are displayed in an hierarchical way, using newlines and indentation.

Examples:

(poke) .set omode flat (poke) Foo {} Foo {i=0x0,l=0x0L}

(poke) .set omode tree (poke) Foo {} Foo { i=0x0, l=0x0L }

The default value of ‘omode’ is ‘flat’.

endian

This setting determines the byte endianness used when accessing IO spaces. Valid values are ‘big’, ‘little’, ‘host’ and ‘network’.

The meaning of ‘big’ and ‘little’ is the obvious one: the endianness is set to big-endian and little-endian respectively.

The ‘host’ endianness is the endianness used by the computer and operating system that is running poke in order to handle it’s own memory and files.

The ‘network’ endianness is the endianness used by the host machine in order to communicate with the network.

doc-viewer

This setting determines what mechanism to use to open the online user manual.

If ‘info’ is selected, the GNU info standalone program is launched to show the info version of the user manual.

If ‘less’ is selected, the less utility is launched to show a plain text version of the user manual.

See also ".help .doc".

pager

This setting determines whether the output of poke commands will be paged or not. Each page will have the height of the terminal.

This setting is ‘no’ by default.

tracer

This setting determines whether the Poke compiler and runtime will generate tracing events or not. This is mainly useful for debugging purposes.

Beware that enabling tracer will undoubtly have an impact in performance, and that every type compiled when tracing is enabled will contain instrumentalization. This means you will most likely want to re-compile the types with tracing disabled once the debugging is done.

This setting is ‘no’ by default.

autoremap

This setting determines whether poke will remap mapped values automatically when they are referred to. This assures that the values are always up to date with respect the contents of the IO space.

Turning auto-remap off may be useful in situations where it is very slow to keep all the data structures up to date. In these case, you can ‘.set autoremap off’ and then use the ‘remap’ Poke operator to force the re-mapping of any given value, explicitly.

This setting is ‘yes’ by default.