Howto debug fasm programs.

strace
gdb

Disadvantage is GDB showing instructions in reverse order (other syntax).

-------------------------------------------------------------------------------

Intro.

Launch GDB by:
gdb

Then write some commands:
help
help q
help break
help r
help c
help ni
help n
help jump
help breakpoints
help data
help running
help x

Usefull commands are:
q quit
r run
c continue run
n step
ni single step
x /8i $pc display 8 instructions at current instruction pointer

-------------------------------------------------------------------------------

Practical:

For ELF like a00 the fist step is to execute this command from shell line:
gdb ./a00

You must stop program in gdb. You have 2 choices:
- put breakpoint (db 0cch) in program before compile ELF
- know address, e.g. default ELF is loaded on 400000h, ELF header may have
  B0h bytes so put breakpoint at 4000B0h (break *0x4000B0)
break *0x4000B0

Then run program by command r.
r

Now you can step program by commands n, ni, or use other commands to explore
or modify program. If you put file .gdbinit in program directory, you can use
command n defined in macro.
n

-------------------------------------------------------------------------------

Summarizing.

gdb ./a00
break *0x4000B0
r
ni
ni
ni
n
n
q

strace ./a00
