views:

76

answers:

4

While debugging on Windows XP 32-bit using the immunity debugger, I see the following on the stack:

_Address_ -Value_
00ff2254 ff090045
00ff2258 00000002

My understanding is that every address location contains 8 bits.

Is this correct?

+3  A: 

If I'm understanding your question correctly, the answer is yes, every individual memory location contains 8 bits.

The debugger is showing you 4 bytes (32 bits) at a time, to make the display more compact (and because many data types take up 32 bits, so it's often useful to see 32-bit values). That's why the addresses in the left column are 4 locations apart.

If the debugger showed one byte (8 bits) at a time, the display would look like this:

_Address_ -Value_
00ff2254 45
00ff2255 00
00ff2256 09
00ff2257 ff
00ff2258 02
00ff2259 00
00ff225a 00
00ff225b 00

(assuming you're on a "little-endian" machine, which most modern desktop PCs are.)

RichieHindle
A: 

A memory location refers to a location of memory, and each consecutive memory location refers to the next byte in memory. So, you can only address memory on a one byte boundary, and everyone should know that a byte is 8 bits wide.

Alexander Rafferty
+2  A: 

I think the main problem with your question is that you ask for one thing, but I detect a different question lurking in the shadows.

First, and foremost, addressable entities in the memory of a computer is organized as bytes, which are 8 bits each, so yes, each address can be said to refer to 8 bits, or a byte.

However, you can easily group more bytes together to form bigger and more complex data structures.

If your question is really "Why am I seeing an 8-digit value as the contents at an address in my stack dump", then the reason for that is that it dumps 32-bit (4 bytes) values.

In other words, you can take the address, the address+1, the address+2, and the address+3, grab the bytes from each of those, and combine to a 32-bit value.

Is that really your question?

Lasse V. Karlsen
A: 

To complete the answer of RH, you may be surprised to have so many numbers for a given address.

You should consider

Address  Byte (8 bits)
00ff2254 45
00ff2255 00
00ff2256 09
00ff2257 ff
00ff2258 02
... 

(On a cpu architecture used by XP)

ring0
So can I further my question?Why every address contains 8 bits. Is it because of the memory chip architecture? Or is it because of 32bit CPU.Is this 8 bits true for another OS such as FreeBSD, Mac, Linux?
cperdana
8 bits, or byte, is the common and convenient data unit in computers (http://en.wikipedia.org/wiki/Byte). Convenient because, as a power of 2 (2^3 bits) it is small enough while able to store all roman characters. 8 bits is the minimum quantity of data you can get from the memory. Computers with a memory bus of 32 bits allow to retrieve 32 bits in one operation - it is faster - but the minimal data unit is still 8 bits.
ring0