6.33.3 Common Disassembler

You can disassemble a code word with see (see Debugging). You can disassemble a section of memory with

discode ( addr u –  ) gforth-0.2

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):

You can override the default by changing discode, e.g., with

' disasm is discode

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.

disasm2 ( c-addr u –  ) gforth-1.0 “disasm-two”

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.

intel-syntax ( ) gforth

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.

at&t-syntax ( ) gforth “at-and-t-syntax”

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.

disasm ( c-addr u –  ) gforth-0.5

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.

disasm-gdb ( addr u –  ) gforth-0.7

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.