Compiler Implementations: Locations and Names in Programming Languages
Delve into the semantic distinction between locations and names in programming languages and how compilers implement and map them to memory. Explore the process under static scoping, discussing global and local variables along with the use of stack memory for functions in various processor architectures.
Uploaded on Apr 08, 2025 | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
The Runtime Environment CSE 340 Principles of Programming Languages Fall 2016 Adam Doup Arizona State University http://adamdoupe.com
Locations and Names What is the semantic distinction between locations and names? How does the compiler actually implement locations and names? How does the compiler map names to memory locations? We are going to look into this process Assuming static scoping 2 Adam Doup , Principles of Programming Languages
Global Variables Where can the compiler put variables? Memory Registers Disk "Cloud" What are the constraints on those variables? Who can access them? Who can't? 3 Adam Doup , Principles of Programming Languages
int a; int b; float c; int main() { a = 10; b = 100; c = 10.45; a = a + b; return 0; } a @ A b @ B c @ C a @ 0x8049634 b @ 0x8049638 c @ 0x804963c mem[A] = 10 mem[B] = 100 mem[C] = 10.45 mem[A] = mem[A] + mem[B] movl $0xa,0x8049634 movl $0x64,0x8049638 mov $0x41273333,%eax mov %eax,0x804963c mov 0x8049634,%edx mov 0x8049638,%eax lea (%edx,%eax,1),%eax mov %eax,0x8049634 4 Adam Doup , Principles of Programming Languages
Local Variables What are the constraints on local variables? Where can the compiler place local variables? Global Memory (one for each function) 5 Adam Doup , Principles of Programming Languages
int fact(int n) { if (n == 0) { return 1; } else { return fact(n-1) * n; } } 6 Adam Doup , Principles of Programming Languages
Local Variables What are the constraints on local variables? Where can the compiler place local variables? Global Memory (one for each function) "Scratch memory" for each function 7 Adam Doup , Principles of Programming Languages
The Stack Stack is essentially scratch memory for functions Used in MIPS, ARM, x86, and x86-64 processors Starts at high memory addresses, and grows down Functions are free to push registers or values onto the stack, or pop values from the stack into registers The assembly language supports this on x86 %esp holds the address of the top of the stack push %eax decrements the stack pointer (%esp) then stores the value in %eax to the location pointed to by the stack pointer pop %eax stores the value at the location pointed to by the stack pointer into %eax, then increments the stack pointer (%esp) 8 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 Garbage 0x00000000 %eax 0xa %ebx 0x0 %esp 0x10000 10 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 Garbage 0x00000000 %eax 0xa %ebx 0x0 %esp 0x10000 11 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 0xa Garbage 0x00000000 %eax 0xa %ebx 0x0 %esp 0xFFFC 12 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 0xa Garbage 0x00000000 %eax 0xa %ebx 0x0 %esp 0xFFFC 13 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 0xa Garbage 0x00000000 %eax 0xa %ebx 0xa %esp 0xFFFC 14 Adam Doup , Principles of Programming Languages
Stack Example 0xFFFFFFFF push %eax pop %ebx 0x10000 0xa Garbage 0x00000000 %eax 0xa %ebx 0xa %esp 0x10000 15 Adam Doup , Principles of Programming Languages
Function Frame Functions would like to use the stack to allocate space for their local variables Can we use the stack pointer for this? Yes, however stack pointer can change throughout program execution Frame pointer points to the start of the function's frame on the stack Each local variable will be (different) offsets of the frame pointer In x86, frame pointer is called the base pointer, and is stored in %ebp 16 Adam Doup , Principles of Programming Languages
int main() { int a; int b; float c; a = 10; b = 100; c = 10.45; a = a + b; return 0; } a @ %ebp + A b @ %ebp + B c @ %ebp + C a @ %ebp 0xc b @ %ebp 0x8 c @ %ebp 0x4 mem[%ebp+A] = 10 mem[%ebp+B] = 100 mem[%ebp+C] = 10.45 mem[%ebp+A] = mem[%ebp+A] + mem[%ebp+B] mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 17 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0x00000000 %eax %esp 0x10000 %ebp 0x10000 18 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0x00000000 %eax %esp 0x10000 %ebp 0x10000 19 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 20 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0xFFF8 0xFFF4 0xFFF0 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 21 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 22 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 23 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0x64 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 24 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0x64 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax %esp 0xFFF0 %ebp 0x10000 25 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0x64 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x41273333 %esp 0xFFF0 %ebp 0x10000 26 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0x64 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x41273333 %esp 0xFFF0 %ebp 0x10000 27 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC 0x41273333 0x64 0xFFF8 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x41273333 %esp 0xFFF0 %ebp 0x10000 28 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC c 0x41273333 b 0x64 0xFFF8 a 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x41273333 %esp 0xFFF0 %ebp 0x10000 29 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC c 0x41273333 b 0x64 0xFFF8 a 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x64 %esp 0xFFF0 %ebp 0x10000 30 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC c 0x41273333 b 0x64 0xFFF8 a 0xa 0xFFF4 0xFFF0 0x00000000 %eax 0x64 %esp 0xFFF0 %ebp 0x10000 31 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC c 0x41273333 b 0x64 0xFFF8 a 0x6E 0xFFF4 0xFFF0 0x00000000 %eax 0x64 %esp 0xFFF0 %ebp 0x10000 32 Adam Doup , Principles of Programming Languages
Function Frame 0xFFFFFFFF mov %esp,%ebp sub $0x10,%esp movl $0xa,-0xc(%ebp) movl $0x64,-0x8(%ebp) mov $0x41273333,%eax mov %eax,-0x4(%ebp) mov -0x8(%ebp),%eax add %eax,-0xc(%ebp) 0x10000 0xFFFC c 0x41273333 b 0x64 0xFFF8 a 0x6E 0xFFF4 0xFFF0 0x00000000 %eax 0x64 %esp 0xFFF0 %ebp 0x10000 33 Adam Doup , Principles of Programming Languages
Functions Declarations Function name Formal parameters (names and types) Return type Invocation f(x1,x2, ,xk) x1,x2,...,xkare expressions x1,x2,...xkare called the actual parameters Invoking function must create the frame on the stack with enough space to hold the actual parameters 34 Adam Doup , Principles of Programming Languages
Function Frames Allows us to allocate memory for the function's local variables However, when considering calling a function, what other information do we need? Return value Parameters Our frame pointer Return address (where to start program execution when function returns) Local variables Temporary variables 35 Adam Doup , Principles of Programming Languages
Calling Convention All of the previous information must be stored on the stack in order to call the function Who should store that information? Caller? Callee? Thus, we need to define a convention of who pushes/stores what values on the stack to call a function Varies based on processor, operating system, compiler, or type of call 36 Adam Doup , Principles of Programming Languages
x86 Linux Calling Convention (cdecl) Caller (in this order) Pushes arguments onto the stack (in right to left order) Pushes address of instruction after call Callee Pushes previous frame pointer onto stack Creates space on stack for local variables Ensures that stack is consistent on return Return value in %eax register 37 Adam Doup , Principles of Programming Languages
callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call callee mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret int callee(int a, int b) { return a + b + 1; } prologue int main() { int a; a = callee(10, 40); return a; } epilogue prologue epilogue 38 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d4 %ebp 0xfd2c0 %eip 0x80483a5 39 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2c0 %eip 0x80483a5 40 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2c0 %eip 0x80483a5 41 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2c0 %eip 0x80483a5 42 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2c0 %eip 0x80483a6 43 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2d0 %eip 0x80483a6 44 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2d0 %ebp 0xfd2d0 %eip 0x80483a8 45 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483a8 46 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0xfd2bc 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483ab 47 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0x28 0xfd2bc 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483ab 48 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0x28 0xfd2bc 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483b3 49 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0x28 0xfd2bc 0xa 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483b3 50 Adam Doup , Principles of Programming Languages
0xFFFFFFFF 0xfd2d4 callee: push %ebp mov %esp,%ebp mov 0xc(%ebp),%eax mov 0x8(%ebp),%edx lea (%edx,%eax,1),%eax add $0x1,%eax pop %ebp ret main: push %ebp mov %esp,%ebp sub $0x18,%esp movl $0x28,0x4(%esp) movl $0xa,(%esp) call 0x8048394 mov %eax,-0x4(%ebp) mov -0x4(%ebp),%eax leave ret 0xfd2c0 0x8048394 0x8048395 0x8048397 0x804839a 0x804839d 0x80483a0 0x80483a3 0x80483a4 0xfd2d0 0x28 0xfd2bc 0xa 0xfd2b8 0x80483a5 0x80483a6 0x80483a8 0x80483ab 0x80483b3 0x80483ba 0x80483bf 0x80483c2 0x80483c5 0x80483c6 0x00000000 %eax %edx %esp 0xfd2b8 %ebp 0xfd2d0 %eip 0x80483ba 51 Adam Doup , Principles of Programming Languages