Problem with debugging -m32 program
U.Mutlu
um@mutluit.com
Wed Jul 11 10:24:00 GMT 2018
U.Mutlu wrote on 07/11/2018 12:10 PM:
> Mahmood Naderan via gcc-help wrote on 07/11/2018 08:57 AM:
>>> Sorry, I don't get your point.
>>> What else do you expect to happen?
>>
>>
>> I don't expect a crash. Why? because the strcpy should simply copy an item
>> to memory location. I wonder why it says "I can not access the memory
>> location where is memory location is the data value"?!!!
>> Why on earth strcpy wants to access a memory location where I didn't tell
>> him to access?
>
> Just a guess: because after strcpy has overwritten the stack, the
> (internal/hidden) register restorations now point to illegal addresses...?
To debug/understand that, you should study the assembler listing (see -S
compiler option and then the output file with the extension .s)...
S.a.
https://stackoverflow.com/questions/137038/how-do-you-get-assembler-output-from-c-c-source-in-gcc
I hope you don't write/debug a virus/trojan/ransomware... :-)
>> Moreover, as I said multiple times, why w/o specifying -m32, the program
>> finishes without error?
>
> People told you that there is a difference in 64bit/32bit stack layout...
More information about the Gcc-help
mailing list