the list
10040b0
1
rcx
1004090
4
rax
1004070
9
rdi
1004050
16
1004030
25
1004010
36
list.c
lines 1 to 42 of 42
1
// A linked list on the heap: built, reversed, summed. `list_done`
2
// finished list, the place for a tracer to look at it.
3
#include
<stdio.h>
4
#include
<stdlib.h>
5
6
struct
node
{
7
long
value
;
8
struct
node
*
next
;
9
}
;
10
11
__attribute__
(
(
noinline
)
)
static
struct
node
*
push
(
struct
node
*
he
…
12
struct
node
*
n
=
malloc
(
sizeof
*
n
)
;
13
n
-
>
value
=
value
;
14
n
-
>
next
=
head
;
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
;
27
}
28
29
__attribute__
(
(
noinline
)
)
long
list_done
(
struct
node
*
head
)
{
30
long
sum
=
0
;
31
for
(
;
head
;
head
=
head
-
>
next
)
sum
+
=
head
-
>
value
;
32
return
sum
;
33
}
34
35
int
main
(
int
argc
,
char
*
*
argv
)
{
36
int
n
=
argc
>
1
?
atoi
(
argv
[
1
]
)
:
6
;
37
struct
node
*
head
=
NULL
;
38
for
(
int
i
=
n
;
i
>
=
1
;
i
-
-
)
head
=
push
(
head
,
i
*
i
)
;
39
head
=
reverse
(
head
)
;
40
printf
(
"sum = %ld\n"
,
list_done
(
head
)
)
;
41
return
0
;
42
}
backtrace
newest at the bottom
#0
reverse+22
list.c:21
#1
main+80
list.c:40
#2
libc+27781
#3
__libc_start_main+137
#4
_start+37
the map
targets/list · moment 3 of 4
every panel whole; the working frame's windows outlined
current
struck
read
held
window
disassembly
reverse
1001
8a8
39
mov
rdi, rax
main
1001
8ab
call
1001910
1001
8b0
40
mov
rdi, rax
1001
8b3
call
1001830
1001
8b8
lea
rdi, [rip - 0x12cb]
1001
8bf
mov
rsi, rax
1001
8c2
xor
eax, eax
1001
8c4
call
1001990
printf
1001
8c9
41
xor
eax, eax
1001
8cb
add
rsp, 8
1001
8cf
pop
rbx
1001
8d0
pop
rbp
1001
8d1
ret
1001
8d2
nop
cs:[rax + rax]
1001
8e0
11
push
rbp
push
1001
8e1
mov
rbp, rsp
1001
8e4
push
r14
1001
8e6
push
rbx
1001
8e7
mov
rbx, rsi
1001
8ea
mov
r14, rdi
1001
8ed
12
mov
edi, 0x10
1001
8f2
call
10019a0
malloc
1001
8f7
13
mov
[rax], rbx
1001
8fa
14
mov
[rax + 8], r14
1001
8fe
15
pop
rbx
1001
8ff
pop
r14
1001
901
pop
rbp
1001
902
ret
1001
903
nop
cs:[rax + rax]
1001
910
20
test
rdi, rdi
1001
913
je
1001935
1001
915
push
rbp
1001
916
mov
rbp, rsp
1001
919
xor
eax, eax
1001
91b
nop
[rax + rax]
1001
920
mov
rcx, rax
1001
923
mov
rax, rdi
1001
926
21
mov
rdi, [rdi + 8]
1004098
1004070
9
1001
92a
22
mov
[rax + 8], rcx
1001
92e
20
test
rdi, rdi
1001
931
jne
1001920
1001
933
pop
rbp
1001
934
26
ret
1001
935
xor
eax, eax
1001
937
ret
1001
938
endbr64
_init
1001
93c
sub
rsp, 8
1001
940
mov
rax, [rip + 0x1231]
1001
947
test
rax, rax
1001
94a
je
100194e
1001
94c
call
rax
1001
94e
add
rsp, 8
1001
952
ret
1001
954
endbr64
_fini
1001
958
sub
rsp, 8
1001
95c
add
rsp, 8
1001
960
ret
1001
970
push
[rip + 0x1222]
strtol@plt-0x10
1001
976
jmp
[rip + 0x1224]
1001
97c
nop
[rax]
1001
980
jmp
[rip + 0x1222]
strtol@plt
1001
986
push
0
1001
98b
jmp
1001970
1001
990
jmp
[rip + 0x121a]
printf@plt
1001
996
push
1
1001
99b
jmp
1001970
1001
9a0
jmp
[rip + 0x1212]
malloc@plt
1001
9a6
push
2
1001
9ab
jmp
1001970
memory
the heap, round what the step reads
10040
00
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
10
24
00
00
00
00
00
00
00
36
00
00
00
00
00
00
00
00
NULL
10040
20
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
30
19
00
00
00
00
00
00
00
25
10
40
00
01
00
00
00
00
1004010
10040
40
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
50
10
00
00
00
00
00
00
00
16
30
40
00
01
00
00
00
00
1004030
10040
60
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
70
09
00
00
00
00
00
00
00
9
50
40
00
01
00
00
00
00
1004050
10040
80
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
90
04
00
00
00
00
00
00
00
4
70
40
00
01
00
00
00
00
1004070
10040
a0
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
b0
01
00
00
00
00
00
00
00
1
00
00
00
00
00
00
00
00
NULL
10040
c0
00
00
00
00
00
00
00
00
41
0f
02
00
00
00
00
00
malloc's: the top chunk
19 rows
registers
stack
heap
code
data
rwx
read-only
rax
1004090
4
rbx
0
rcx
10040b0
1
rdx
0
rsi
10040c0
0
rdi
1004070
9
rbp
7fffffffece0
7fffffffed00
7fffffffedb0
7fffffffee10
0
rsp
7fffffffece0
7fffffffed00
7fffffffedb0
7fffffffee10
0
r8
7ffff7e19ac0
r9
0x20
32
r10
0x10
16
r11
7ffff7e19ac8
r12
7fffffffee38
7fffffffefea
"./list"
r13
1
r14
7ffff7ffd000
7ffff7ffe3c0
0
r15
10029c0
1
rip
1001926
reverse+22
cf
PF
af
zf
sf
IF
df
of
rdi
→
1004070
heap · struct node, 16 bytes
10040
30
19
00
00
00
00
00
00
00
25
10
40
00
01
00
00
00
00
1004010
10040
40
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
50
10
00
00
00
00
00
00
00
16
30
40
00
01
00
00
00
00
1004030
10040
60
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
70
09
00
00
00
00
00
00
00
9
50
40
00
01
00
00
00
00
1004050
10040
80
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
90
04
00
00
00
00
00
00
00
4
70
40
00
01
00
00
00
00
1004070
10040
a0
00
00
00
00
00
00
00
00
21
00
00
00
00
00
00
00
malloc's: a chunk of 32
10040
b0
01
00
00
00
00
00
00
00
1
00
00
00
00
00
00
00
00
NULL
stack
from rsp-80 · the frames they belong to
-80
7fffffffec60
0
-78
7fffffffec68
10
-70
7fffffffec70
10
-68
7fffffffec78
7fffffffee38
-60
7fffffffec80
1004090
-58
7fffffffec88
10029c0
-50
7fffffffec90
7fffffffecc0
-48
7fffffffec98
7ffff7ca7a4f
-40
7fffffffeca0
0
-38
7fffffffeca8
0
-30
7fffffffecb0
1
-28
7fffffffecb8
0
-20
7fffffffecc0
7fffffffece0
-18
7fffffffecc8
10018f7
-10
7fffffffecd0
1
-8
7fffffffecd8
7ffff7ffd000
rbp rsp
+0
saved rbp
7fffffffe
ce0
7fffffffed00
+8
7fffffffe
ce8
10018b0
main+80
+10
7fffffffe
cf0
7ffff7e20de8
+18
saved rbx
7fffffffe
cf8
0
+20
saved rbp
7fffffffe
d00
7fffffffedb0
+28
7fffffffe
d08
7ffff7c27781
libc+27781
+30
7fffffffe
d10
7ffff7fe0c60
ld.so+22c60
+38
7fffffffe
d18
7fffffffee38
7fffffffefea
".…
+40
7fffffffe
d20
0x1f7fbe000
+48
7fffffffe
d28
1001860
main+0
+50
7fffffffe
d30
7fffffffed70
+58
7fffffffe
d38
+60
7fffffffe
d40
0
+68
7fffffffe
d48
0x1fe335fc95a5781c
+70
7fffffffe
d50
7fffffffee38
7fffffffefea
".…
+78
7fffffffe
d58
1
+80
7fffffffe
d60
7ffff7ffd000
+88
7fffffffe
d68
10029c0
+90
7fffffffe
d70
0x1fe335fc94e5781c
+98
7fffffffe
d78
0x1fe32587a0af781c
+a0
7fffffffe
d80
0x7fff00000000
+a8
7fffffffe
d88
0
+b0
7fffffffe
d90
0
+b8
7fffffffe
d98
0
+c0
7fffffffe
da0
7fffffffee38
7fffffffefea
".…
+c8
7fffffffe
da8
0x15f6f7c6b8dafb00
+d0
saved rbp
7fffffffe
db0
7fffffffee10
0
+d8
7fffffffe
db8
+e0
7fffffffe
dc0
7fffffffee48
0
+e8
7fffffffe
dc8
10029c0
+f0
7fffffffe
dd0
1001860
main+0
+f8
7fffffffe
dd8
7fffffffee48
0
+100
7fffffffe
de0
0
+108
7fffffffe
de8
0
+110
7fffffffe
df0
1001730
_start+0
+118
7fffffffe
df8
7fffffffee30
1
+120
7fffffffe
e00
0
+128
7fffffffe
e08
0
+130
saved rbp
7fffffffe
e10
0
+138
7fffffffe
e18
1001755
_start+37
+140
7fffffffe
e20
7fffffffee28
0x38
56
+148
7fffffffe
e28
0x38
56
+150
argc
7fffffffe
e30
1
+158
argv[0]
7fffffffe
e38
7fffffffefea
"./list"
+160
argv end
7fffffffe
e40
0
+168
envp end
7fffffffe
e48
0
+170
auxv
7fffffffe
e50
0x21
33
+178
7fffffffe
e58
7ffff7fbc000
vdso+0
+180
7fffffffe
e60
0x33
51
+188
7fffffffe
e68
0xe30
3632
+190
7fffffffe
e70
0x10
16
+198
7fffffffe
e78
0xbfebfbff
+1a0
7fffffffe
e80
6
reverse
main
libc+27781
__libc_start_main
_start
stack
continued · the frames they belong to
+1a8
7fffffffe
e88
0x1000
4096
+1b0
7fffffffe
e90
0x11
17
+1b8
7fffffffe
e98
0x64
100
+1c0
7fffffffe
ea0
3
+1c8
7fffffffe
ea8
1000040
+1d0
7fffffffe
eb0
4
+1d8
7fffffffe
eb8
0x38
56
+1e0
7fffffffe
ec0
5
+1e8
7fffffffe
ec8
0xb
11
+1f0
7fffffffe
ed0
7
+1f8
7fffffffe
ed8
0x7ffff7fbe000
+200
7fffffffe
ee0
8
+208
7fffffffe
ee8
0
+210
7fffffffe
ef0
9
+218
7fffffffe
ef8
1001730
_start+0
+220
7fffffffe
f00
0xb
11
+228
7fffffffe
f08
0x3e8
1000
+230
7fffffffe
f10
0xc
12
+238
7fffffffe
f18
0x3e8
1000
+240
7fffffffe
f20
0xd
13
+248
7fffffffe
f28
0x3e8
1000
+250
7fffffffe
f30
0xe
14
_start
25 words, to the stack's top
moment 3 of 4
The map: this moment of targets/list, every panel whole.
The working frame's windows are outlined; a scene comes in from here.