Doubt debugging a program

Asked

Viewed 45 times

1

I was debugging a program and I came up with the following question, had architecture is 32 Bits Intel and had the following instruction MOV EAX, DWORD PTR SS[0X401049], and below that instruction had the following command MOV EDX, DWORD PTR SS[0X40104A]. My doubt is that in the first instruction the EAX record received 4 byte of data , and in the second only one byte of data.

Why of this being that each memory address on a 32-bit architecture has 32 bits.

Would not have to transfer 4 bytes also to the second instruction?

  • Two things. Put more descriptive titles of your real problem. Nor start with doubt, because everyone who puts a question here is in doubt. It is redundant and does not describe the problem. Put tags that has to do with the problem. Do not use"C" in all your questions. Just use this tag when it’s about C. And always give as much detail as possible. Show how you came to the conclusion posted in the question, who knows your statement is that you are wrong.

  • From what I can see moved 2x 4 bytes. DWORD is 4 bytes I can’t see the problem.

  • You’re one short ; on line 42 ... or why C?

1 answer

1


It doesn’t necessarily have to be 4 bytes. For example, when we are working with several types sizes we can use either 4 bytes or 8 bytes or 2 bytes. It doesn’t matter what size because the computer architecture corrects this failure by jumping to the next value after the word.

For example, if you use a char, it will be occupying only 256 bits of the word, which refers to 2 8. We know that if the architecture of a computer is 32bits then each word will have 2 32, but it is not a determining factor. Each type has a certain size in the architecture, independent of it.

Take a look at climits and look at what I’m talking about, there you find all the bit limits of the C types. It will be evident that it is not always necessary to occupy the 4 bytes of a word!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.