map c language into assembly language

Johnson

I'm new to c language and want to establish the intuition to map c language into assembly language so that I can have a strong sense of how the stack, register, memory, code work when I see the c code. I have read several assembly language books, which is mainly focused on the assembly syntax rather than the relationship between c and assembly. Does anyone know where can I find such book about the map between c and assembly languages.

IanPudney

I don't know if such a book exists (if it does, it'll likely be a book about compilers). However, there's an easier solution: try it.

Write some C code, then compile it with debug symbols (these instructions assume linux):

gcc foo.c -o foo

Then, use a debugger:

gdb ./foo
break MyFunction
run
disass

This will set a breakpoint on MyFunction, then run the program until it reaches that breakpoint. disass will print the assembly for that function. You can use stepi to step one instruction at a time, or next to step one C line at a time.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related