In x86 assembly there's no strict distinction between a variable stored in memory and an array in memory. It only depends on how you access the memory region. All you have is code and data. Anyway, I'd say that ds:x
is an array as because of this code here:
mov edx, ds:x ; edx = [x] mov eax, [ebp+var_C] ; eax = something add edx, eax ; edx = [x] + something mov eax, [ebp+var_C] ; eax = something add eax, 16h ; eax = something + 0x16 mov [edx], al ; [[x] + something ] = al . Yes, ds:x is an array!
What is the value of edx
in loc_8048887
? To find it out you only need some very basic debugging skills. I assume you have gdb
at hand, if not, get it ASAP. Then compile the code with debug symbols and link it, then run gdb
with the executable, set a code breakpoint at loc_8048887
, run the program with r
, and finally check the value of edx
.
These are the commands you need:
gdb myexecutable (gdb) b loc_8048887 (gdb) r (gdb) info registers edx