-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathf_explore.s
More file actions
47 lines (41 loc) · 1.13 KB
/
f_explore.s
File metadata and controls
47 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# PURPOSE: This program will explore how change stack when calling function
#
# NOTE:
# (gdb) b before - set breakpoint at "before" label
# (gdb) b func - set breakpoint at "func" function
# (gdp) r - run program
#
# Note: gdb stops at "before" label
#
# (gdb) i r esp - get address esp register
# (gdb) x /8xg address_of_esp - show stack
# (gdb) print after - get address of "after" label
# (gdb) c - continue program
#
# Note: gdb stops at "func" label
#
# (gdb) i r esp - get address esp register
# (gdb) x /8xg address_of_esp - show stack
#
# Note: address of "after" label must be in stack
#
.text
_start:
pushl $80
pushl $96
pushl $54
before:
call func
after:
end:
movl $1, %eax
int $0x80
.type func, @function
func:
# func_start:
pushl %ebp
movl %esp, %ebp
# func_end:
movl %ebp, %esp
popl %ebp
ret