the list
each node, and under it the heap words that are that node
1
28b4
10b0
rcx
4
28b4
1090
rax
rdi
9
28b4
1070
16
28b4
1050
25
28b4
1030
36
28b4
1010
address
value
next
the heap, sixteen bytes a node
28b4
1010
0x24
36
0
NULL
28b4
1030
0x19
25
28b4
1010
28b4
1050
0x10
16
28b4
1030
28b4
1070
9
28b4
1050
rax
rdi
28b4
1090
4
28b4
1070
rcx
28b4
10b0
1
0
NULL
list.c
lines 15 to 26 of 42
15
return
n
;
16
}
17
18
__attribute__
(
(
noinline
)
)
static
struct
node
*
reverse
(
struct
node
…
19
struct
node
*
prev
=
NULL
;
20
while
(
head
)
{
21
struct
node
*
next
=
head
-
>
next
;
22
head
-
>
next
=
prev
;
23
prev
=
head
;
24
head
=
next
;
25
}
26
return
prev
;
disassembly
reverse
100
1920
+16
mov
rcx, rax
100
1923
+19
mov
rax, rdi
100
1926
+22
mov
rdi, qword ptr [rdi + 8]
rdi + 8 =
28b4
1098
28b4
1070
9
100
192a
+26
mov
qword ptr [rax + 8], rcx
100
192e
+30
test
rdi, rdi
registers
stack
heap
code
data
rwx
read-only
rax
28b4
1090
4
rbx
0
rcx
28b4
10b0
1
rdx
0
rsi
28b4
10c0
0
rdi
28b4
1090
4
rbp
7ffe
970f
17b0
7ffe
970f
17d0
7ffe
970f
1880
7ffe
970f
18e0
0
rsp
7ffe
970f
17b0
7ffe
970f
17d0
7ffe
970f
1880
7ffe
970f
18e0
0
r8
7f2b
a301
9ac0
0
r9
0x20
32
r10
0x10
16
r11
7f2b
a301
9ac8
28b4
10c0
0
r12
7ffe
970f
1908
7ffe
970f
2fce
"zig-out/targets/list"
r13
1
r14
7f2b
a32a
c000
7f2b
a32a
d3c0
0
r15
100
29c0
1
rip
100
1926
reverse+22
flags
0x206
cf
PF
af
zf
sf
IF
df
of
stack
eight words from rsp · low addresses on top
rsp
rbp
7ffe
970f
17b0
7ffe
970f
17d0
7ffe
970f
1880
7ffe
970f
18e0
0
7ffe
970f
17b8
100
18b0
main+80
return address
7ffe
970f
17c0
7f2b
a302
0de8
7ffe
970f
1918
7ffe
970f
17c8
0
7ffe
970f
17d0
7ffe
970f
1880
7ffe
970f
18e0
0
main's saved rbp
7ffe
970f
17d8
7f2b
a2e2
7781
libc+27781
return address
7ffe
970f
17e0
7f2b
a328
fc60
ld.so+22c60
7ffe
970f
17e8
7ffe
970f
1908
7ffe
970f
2fce
"zig-out/targets…
backtrace
newest on top
#0
reverse+22
list.c:21
#1
main+80
list.c:39
#2
libc+27781
libc.so.6
moment 71 of 95
Stopped in reverse, about to load head->next.
rdi holds a node's address; the word after its value is the next node.