RISE - Internal site

Reconfigurable and Intelligent Systems Engineering

Last Update:

January 29, 2009

Steps to compile and run a protected mode assembly program on a gdb setup



Files needed:
  1. gdbkama_prot (script)
  2. prot_test.ld
  3. prot_start.s - Fit your code into this template.


Instructions:
  1. You need "root" permission on the Linux host machine to execute this.
  2. Copy the above two files into the same directory as the assembly code
  3. Run script gdbkamap with filename as parameter (without the ".s" extension)
  4. Run gdb
  5. Give the following commands inside gdb:
    • set remotebaud 38400
    • target remote /dev/ttyS0
    • load [filename].out
    • c

Thus far,

Now, using various gdb commands, we can check the values at specific memory locations, register values etc. (An excellent tutorial on gdb is here)

An Example:

Say the assembly program is myprog.s

$ ./gdbkamap myprog
$ gdb
(gdb) set debug remote 1
(gdb) set remotebaud 38400
(gdb) target remote /dev/ttyS0
(gdb) load myprog.out
(gdb) c

NOTE: To run in real mode, follow the same procedure as above, but with the following files:
  1. gdbkama_real
  2. prot_real.ld
  3. real_start.s


Some common errors:

Click here for help to x86 Instruction Set Architecture.