CompOrg Fall 2003 Homework #3 FAQ


Homework #3 FAQ

Question:

I get "permission denied" when I try to run my bomb, and gdb won't let me run it.

Answer:

The file must have execute permission. Try this:

chmod +x bomb
   
Question:

Is there a penalty if we guess wrong and the bomb explodes?

Answer:

No. I've disabled the code that sends email whenever the bomb explodes.

   
Question:

What is "al" and "ah" and how do I look at them using gdb?

Answer:

These are 8 bit registers, which are actually just names for part of register eax (these names come from the x86 instruction set which was the 16-bit Intel instruction set). There are 4 16 bit registers, named ax, bx, cx and dx. These are names for the least significant 16 bits of the corresponding 32 bit registers (the "e" registers).

Registers al and ah are actually the least significant byte of ax and ms byte of ax respectively. In short - register al is the least significant byte of register eax and ah is the second-least significant byte of eax.

gdb does not seem to let you look at these 8 bit registers, it doesn't recognize the names al and ah. You can display register eax and just look at the ls byte to see what is currently in register al.

   
Question:

How do I view memory as ASCII values?

Answer:

You can use the 'c' format to the x command, for example the following will display 20 bytes starting at the address in %edx as decimal values and the equiv. ASCII characters:

x/20x $edx

You can also use the 's' format (which means string). You will see all the ASCII chars until a null (0 byte) is found. The following will display the ASCII string found at address 0xbfbbf4f4:

x/s 0xbfbbf4f4
   
Question:

set step-mode on doesn't seem to work, I still need to use stepi instead of step. Am I doing something wrong ?

Answer:

set step-mode on doesn't seem to work right with our bombs on the BSD machines, so you should stick with the stepi command.