i made a small app in C++ and then ran it in a debbuger and am seeing



0x7c901232    mov    %edi,%edi



in which segment will the address be contained and will it be the actual address when the program is running or does it change.

also does it make sense to move edi into edi  or is there something wrong with the application?

Posted on 2010-12-31 06:51:11 by ashken

i made a small app in C++ and then ran it in a debbuger and am seeing



0x7c901232     mov    %edi,%edi



in which segment will the address be contained and will it be the actual address when the program is running or does it change.


Well, if you are taking about code the segment would be CS.  Data is DS/ES.  Stack is SS.  I don't really understand your question to answer succinctly.


also does it make sense to move edi into edi  or is there something wrong with the application?


I see no reason why that particular line of code was generated.  Did you compile with debug enabled ( -g )?  I assume you did since you state you are using a debugger.  But, of course, you can debug stripped code as well.  Optimized compilation ( -O2 ) should not generate spurious code like that.  Generate assembly listings of both debug and optimized and you should see quite a difference in output.

Posted on 2010-12-31 07:08:38 by p1ranha
Could be for alignment purposes - "mov esi, esi" would be a two-byte NOP?
Posted on 2011-01-17 19:10:23 by f0dder