You can disassemble a code word with see
(see Debugging). You can disassemble a section of memory with
hook for the disassembler: disassemble u bytes of code at addr
By default, discode calls one of the following words (not all
of them are available on all installations):
disasm2, which calls libopcodes from the binutils. This
is usually the default disassembler, if Gforth is built as we
recommend.
disasm, a manually written disassembler (only available on some
architectures). This is often the default disassembler if
disasm2 is not available.
The Forth disassembler generally produces output that can be fed into the assembler (i.e., same syntax, etc.). It also includes additional information in comments. In particular, the address of the instruction is given in a comment before the instruction.
disasm-gdb, which calls gdb to disassemble code.
Unfortunately, this is not a very reliable disassembler, and can hang.
Use Ctrl-c if that happens. This disassembler is used by
default if neither disasm2 nor disasm is available.
dump shows the machine code as hex dump. This disassembler is
used if none of the others are available.
You can override the default by changing discode, e.g., with
See may display more or less than the actual code of a
code word, because the recognition of the end of the code is
unreliable. You can use discode if it did not display enough.
It may display more, if the code word is not immediately followed by a
named word. If you have something else there, you can follow the word
with align latest , to ensure that the end is recognized.
Disassemble code block starting at c-addr with u bytes length using libopcodes from GNU binutils. This word is only defined if Gforth was built with libopcodes support.
Change disasm2 to output Intel syntax. This word is
only defined on AMD64 and IA-32 machines and only if Gforth was
built with libopcodes support.
Change disasm2 to output AT&T syntax. This word is
only defined on AMD64 and IA-32 machines and only if Gforth was
built with libopcodes support.
Disassemble code block starting at c-addr with u bytes length using a hand-written disassembler. This word is only defined on architectures for which a hand-written disassembler exists.
Disassemble code block starting at c-addr with u bytes
length by calling gdb. This word works only if
gdb is installed, can attach to its parent, and uses
the right syntax. If it hangs, use Ctrl-c.