From f0180748b19eac5fe99124142aea60eac78cf4bd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 22:43:41 -0300 Subject: design: the dense stage is a map; the frame keeps its layout and gains a minimap From the user, on the 4K mocks: the space was not well used, and the dense view is better as where a scene starts or as a minimap than as the frame it works in. The map is the same moment with every panel at full length on 3840 by 2160, packed by content. The working frame is the 1920 stage again, each panel a window on its column of the map, with the map at a twentieth in the caption band: windows outlined, marks no window shows flashing there. dive and surface carry a scene between the two, each window travelling to its panel's place. The loupe hangs from its pointer in the working frame. Mocks 16 to 18 are withdrawn; 19 is the map, 20 the dive in four instants, 21 a loupe with the minimap. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/09-context-480.png | Bin 36505 -> 36225 bytes design/mock/09-context.png | Bin 242320 -> 234918 bytes design/mock/09-context.svg | 1959 ++++++++++++++++++++++++---- design/mock/10-context-step-480.png | Bin 38234 -> 37263 bytes design/mock/10-context-step.png | Bin 246875 -> 239058 bytes design/mock/10-context-step.svg | 1966 ++++++++++++++++++++++++---- design/mock/11-context-lens-480.png | Bin 38599 -> 36483 bytes design/mock/11-context-lens.png | Bin 235747 -> 227267 bytes design/mock/11-context-lens.svg | 1992 +++++++++++++++++++++++++---- design/mock/12-calls-subject-480.png | Bin 32952 -> 32985 bytes design/mock/12-calls-subject.png | Bin 197829 -> 201791 bytes design/mock/12-calls-subject.svg | 88 +- design/mock/13-sqlite-row-480.png | Bin 33001 -> 32655 bytes design/mock/13-sqlite-row.png | Bin 229299 -> 227685 bytes design/mock/13-sqlite-row.svg | 133 +- design/mock/14-sqlite-page-480.png | Bin 37787 -> 37579 bytes design/mock/14-sqlite-page.png | Bin 235073 -> 236736 bytes design/mock/14-sqlite-page.svg | 109 +- design/mock/16-none-480.png | Bin 33091 -> 0 bytes design/mock/16-none.png | Bin 750420 -> 0 bytes design/mock/16-none.svg | 1641 ------------------------ design/mock/17-subject-480.png | Bin 35404 -> 0 bytes design/mock/17-subject.png | Bin 714590 -> 0 bytes design/mock/17-subject.svg | 1562 ----------------------- design/mock/18-loupes-480.png | Bin 37782 -> 0 bytes design/mock/18-loupes.png | Bin 780782 -> 0 bytes design/mock/18-loupes.svg | 2110 ------------------------------- design/mock/19-map-1080.png | Bin 0 -> 1018023 bytes design/mock/19-map-480.png | Bin 0 -> 45132 bytes design/mock/19-map.png | Bin 0 -> 905335 bytes design/mock/19-map.svg | 2028 +++++++++++++++++++++++++++++ design/mock/21-loupe-480.png | Bin 0 -> 38289 bytes design/mock/21-loupe.png | Bin 0 -> 245970 bytes design/mock/21-loupe.svg | 2319 ++++++++++++++++++++++++++++++++++ design/mock/context.py | 29 +- design/mock/dense.py | 85 +- design/mock/list-dbg.txt | 10 + design/mock/map.py | 393 ++++++ 38 files changed, 10078 insertions(+), 6346 deletions(-) delete mode 100644 design/mock/16-none-480.png delete mode 100644 design/mock/16-none.png delete mode 100644 design/mock/16-none.svg delete mode 100644 design/mock/17-subject-480.png delete mode 100644 design/mock/17-subject.png delete mode 100644 design/mock/17-subject.svg delete mode 100644 design/mock/18-loupes-480.png delete mode 100644 design/mock/18-loupes.png delete mode 100644 design/mock/18-loupes.svg create mode 100644 design/mock/19-map-1080.png create mode 100644 design/mock/19-map-480.png create mode 100644 design/mock/19-map.png create mode 100644 design/mock/19-map.svg create mode 100644 design/mock/21-loupe-480.png create mode 100644 design/mock/21-loupe.png create mode 100644 design/mock/21-loupe.svg create mode 100644 design/mock/map.py (limited to 'design/mock') diff --git a/design/mock/09-context-480.png b/design/mock/09-context-480.png index 099116b..2a2f016 100644 Binary files a/design/mock/09-context-480.png and b/design/mock/09-context-480.png differ diff --git a/design/mock/09-context.png b/design/mock/09-context.png index b1f6003..f18173a 100644 Binary files a/design/mock/09-context.png and b/design/mock/09-context.png differ diff --git a/design/mock/09-context.svg b/design/mock/09-context.svg index 828a9ce..3e0a7c5 100644 --- a/design/mock/09-context.svg +++ b/design/mock/09-context.svg @@ -14,7 +14,6 @@ = NULL ; - 20 while ( @@ -34,7 +33,6 @@ > next ; - 22 head - @@ -89,26 +87,14 @@ 1b nop dword ptr [rax + rax] - 10019 20 mov rcx, rax -rcx -28b410b0 - - -1 - 10019 23 mov rax, rdi -rax -28b41090 - - -4 @@ -117,13 +103,13 @@ 21 mov rdi, qword ptr [rdi + 8] -28b41098 - - -28b41070 - - -9 +1004098 + + +1004070 + + +9 10019 2a 22 @@ -134,12 +120,10 @@ 20 test rdi, rdi - 10019 31 jne 1001920 -taken 10019 33 pop @@ -156,18 +140,10 @@ 37 ret -1001938 -endbr64 -_init - - - - - - - - - +10019 +38 +endbr64 +_init @@ -181,64 +157,61 @@ read-only rax -28b41090 - - -4 +1004090 + + +4 rbx 0 rcx -28b410b0 - - -1 +10040b0 + + +1 rdx 0 rsi -28b410c0 - - -0 +10040c0 + + +0 rdi -28b41090 - - -4 +1004090 + + +4 rbp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 rsp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 r8 -7f2ba3019ac0 - - -0 +7ffff7e19ac0 r9 0x20 32 @@ -246,28 +219,22 @@ 0x10 16 r11 -7f2ba3019ac8 - - -28b410c0 - - -0 +7ffff7e19ac8 r12 -7ffe970f1908 +7fffffffee38 -7ffe970f2fce +7fffffffefea -"zig-out/targets/list" +"./list" r13 1 r14 -7f2ba32ac000 +7ffff7ffd000 -7f2ba32ad3c0 +7ffff7ffe3c0 0 @@ -285,7 +252,6 @@ PF af - zf sf @@ -297,79 +263,78 @@ stack eight words from rsp · the frames they belong to -rsp rbp +rbp rsp -7ffe970f17 -b0 - - -7ffe970f17d0 - - -7ffe970f1880 - - - - - -7ffe970f17 -b8 - - -10018b0 -main+80 -7ffe970f17 -c0 - - -7f2ba3020de8 - - -7ffe970f1918 - - - - - -7ffe970f17 -c8 - - -0 -7ffe970f17 -d0 - - -7ffe970f1880 - - -7ffe970f18e0 - - -0 -7ffe970f17 -d8 - - -7f2ba2e27781 -libc+27781 -7ffe970f17 -e0 - - -7f2ba328fc60 -ld.so+22c60 -7ffe970f17 -e8 - - -7ffe970f1908 - - -7ffe970f2fce - - -"zig-ou… ++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 + + +".… @@ -381,21 +346,16 @@ libc+27781 - - - -the list its bytes -value -next -malloc's -never read -the heap, 28b41070 to 28b410bf -28b410 -70 +the heap, 1004070 to 10040bf + + + +10040 +70 09 00 @@ -405,51 +365,46 @@ 00 00 00 +9 50 -10 -b4 -28 +40 +00 +01 00 00 00 00 -9 - - -28b41050 - - - -28b410 -80 - - - - - - - - - - - - - - - - + + +1004050 + + + +10040 +80 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -90 + + + +10040 +90 04 00 @@ -459,51 +414,46 @@ 00 00 00 +4 70 -10 -b4 -28 +40 +00 +01 00 00 00 00 -4 - - -28b41070 - - - -28b410 -a0 - - - - - - - - - - - - - - - - + + +1004070 + + + +10040 +a0 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -b0 + + + +10040 +b0 01 00 @@ -513,22 +463,29 @@ 00 00 00 +1 - -00 -00 -00 -00 -00 -00 -00 -00 -1 -NULL - - - -28b410b0 +00 +00 +00 +00 +00 +00 +00 +00 +NULL + + + + + + + + + + +the list +10040b0 1 @@ -537,7 +494,7 @@ rcx -28b41090 +1004090 4 @@ -548,35 +505,1527 @@ rax rdi -28b41070 +1004070 9 -28b41050 +1004050 16 -28b41030 +1004030 25 -28b41010 +1004010 36 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -moment 71 of 95 + +moment 2 of 4 Stopped in reverse, about to load head->next. rdi points at a node; the word after its value is the next node. diff --git a/design/mock/10-context-step-480.png b/design/mock/10-context-step-480.png index 4a9c7e1..c3eb3b9 100644 Binary files a/design/mock/10-context-step-480.png and b/design/mock/10-context-step-480.png differ diff --git a/design/mock/10-context-step.png b/design/mock/10-context-step.png index 244c65b..41ecdc4 100644 Binary files a/design/mock/10-context-step.png and b/design/mock/10-context-step.png differ diff --git a/design/mock/10-context-step.svg b/design/mock/10-context-step.svg index 09baba3..1b9db57 100644 --- a/design/mock/10-context-step.svg +++ b/design/mock/10-context-step.svg @@ -14,7 +14,6 @@ = NULL ; - 20 while ( @@ -34,7 +33,6 @@ > next ; - 22 head - @@ -89,26 +87,14 @@ 1b nop dword ptr [rax + rax] - 10019 20 mov rcx, rax -rcx -28b410b0 - - -1 - 10019 23 mov rax, rdi -rax -28b41090 - - -4 @@ -117,14 +103,14 @@ 21 mov rdi, qword ptr [rdi + 8] - -28b41098 - - -28b41070 - - -9 + +1004098 + + +1004070 + + +9 10019 2a 22 @@ -135,12 +121,10 @@ 20 test rdi, rdi - 10019 31 jne 1001920 -taken 10019 33 pop @@ -157,18 +141,10 @@ 37 ret -1001938 -endbr64 -_init - - - - - - - - - +10019 +38 +endbr64 +_init @@ -182,64 +158,61 @@ read-only rax -28b41090 - - -4 +1004090 + + +4 rbx 0 rcx -28b410b0 - - -1 +10040b0 + + +1 rdx 0 rsi -28b410c0 - - -0 +10040c0 + + +0 rdi - -28b41070 - - -9 + +1004070 + + +9 rbp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 rsp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 r8 -7f2ba3019ac0 - - -0 +7ffff7e19ac0 r9 0x20 32 @@ -247,28 +220,22 @@ 0x10 16 r11 -7f2ba3019ac8 - - -28b410c0 - - -0 +7ffff7e19ac8 r12 -7ffe970f1908 +7fffffffee38 -7ffe970f2fce +7fffffffefea -"zig-out/targets/list" +"./list" r13 1 r14 -7f2ba32ac000 +7ffff7ffd000 -7f2ba32ad3c0 +7ffff7ffe3c0 0 @@ -286,7 +253,6 @@ PF af - zf sf @@ -298,79 +264,78 @@ stack eight words from rsp · the frames they belong to -rsp rbp +rbp rsp -7ffe970f17 -b0 - - -7ffe970f17d0 - - -7ffe970f1880 - - - - - -7ffe970f17 -b8 - - -10018b0 -main+80 -7ffe970f17 -c0 - - -7f2ba3020de8 - - -7ffe970f1918 - - - - - -7ffe970f17 -c8 - - -0 -7ffe970f17 -d0 - - -7ffe970f1880 - - -7ffe970f18e0 - - -0 -7ffe970f17 -d8 - - -7f2ba2e27781 -libc+27781 -7ffe970f17 -e0 - - -7f2ba328fc60 -ld.so+22c60 -7ffe970f17 -e8 - - -7ffe970f1908 - - -7ffe970f2fce - - -"zig-ou… ++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 + + +".… @@ -382,21 +347,16 @@ libc+27781 - - - -the list its bytes -value -next -malloc's -never read -the heap, 28b41070 to 28b410bf -28b410 -70 +the heap, 1004070 to 10040bf + + + +10040 +70 09 00 @@ -406,51 +366,46 @@ 00 00 00 +9 50 -10 -b4 -28 +40 +00 +01 00 00 00 00 -9 - - -28b41050 - - - -28b410 -80 - - - - - - - - - - - - - - - - + + +1004050 + + + +10040 +80 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -90 + + + +10040 +90 04 00 @@ -460,49 +415,47 @@ 00 00 00 +4 70 -10 -b4 -28 +40 +00 +01 00 00 00 00 -4 - - -28b41070 -28b410 -a0 - - - - - - - - - - - - - - - - + + +1004070 + + + +10040 +a0 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -b0 + + + +10040 +b0 01 00 @@ -512,22 +465,29 @@ 00 00 00 +1 - -00 -00 -00 -00 -00 -00 -00 -00 -1 -NULL - - - -28b410b0 +00 +00 +00 +00 +00 +00 +00 +00 +NULL + + + + + + + + + + +the list +10040b0 1 @@ -536,7 +496,7 @@ rcx -28b41090 +1004090 4 @@ -547,7 +507,7 @@ rax -28b41070 +1004070 9 @@ -557,21 +517,21 @@ rdi -28b41050 +1004050 16 -28b41030 +1004030 25 -28b41010 +1004010 36 @@ -583,9 +543,1505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -moment 71 of 95 -The load read the word at 28b41098: the address of the next node. + +moment 3 of 4 +The load read the word at 1004098: the address of the next node. rdi holds it now, and points at the node whose value is 9. diff --git a/design/mock/11-context-lens-480.png b/design/mock/11-context-lens-480.png index 9e76b53..4c4a0f5 100644 Binary files a/design/mock/11-context-lens-480.png and b/design/mock/11-context-lens-480.png differ diff --git a/design/mock/11-context-lens.png b/design/mock/11-context-lens.png index 6e5e6fe..e0b9122 100644 Binary files a/design/mock/11-context-lens.png and b/design/mock/11-context-lens.png differ diff --git a/design/mock/11-context-lens.svg b/design/mock/11-context-lens.svg index a7dcea0..d0d3bf3 100644 --- a/design/mock/11-context-lens.svg +++ b/design/mock/11-context-lens.svg @@ -30,7 +30,6 @@ = NULL ; - 20 while ( @@ -50,7 +49,6 @@ > next ; - 22 head - @@ -91,26 +89,14 @@ 1b nop dword ptr [rax + rax] - 10019 20 mov rcx, rax -rcx -28b410b0 - - -1 - 10019 23 mov rax, rdi -rax -28b41090 - - -4 @@ -119,14 +105,14 @@ 21 mov rdi, qword ptr [rdi + 8] - -28b41098 - - -28b41070 - - -9 + +1004098 + + +1004070 + + +9 10019 2a 22 @@ -137,25 +123,14 @@ 20 test rdi, rdi - 10019 31 jne 1001920 -taken 10019 33 pop rbp - - - - - - - - - @@ -169,64 +144,61 @@ read-only rax -28b41090 - - -4 +1004090 + + +4 rbx 0 rcx -28b410b0 - - -1 +10040b0 + + +1 rdx 0 rsi -28b410c0 - - -0 +10040c0 + + +0 rdi - -28b41070 - - -9 + +1004070 + + +9 rbp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 rsp -7ffe970f17b0 +7fffffffece0 -7ffe970f17d0 +7fffffffed00 -7ffe970f1880 +7fffffffedb0 -7ffe970f18e0 +7fffffffee10 0 r8 -7f2ba3019ac0 - - -0 +7ffff7e19ac0 r9 0x20 32 @@ -234,28 +206,22 @@ 0x10 16 r11 -7f2ba3019ac8 - - -28b410c0 - - -0 +7ffff7e19ac8 r12 -7ffe970f1908 +7fffffffee38 -7ffe970f2fce +7fffffffefea -"zig-out/targets/list" +"./list" r13 1 r14 -7f2ba32ac000 +7ffff7ffd000 -7f2ba32ad3c0 +7ffff7ffe3c0 0 @@ -273,7 +239,6 @@ PF af - zf sf @@ -285,62 +250,59 @@ stack six words from rsp · the frames they belong to -rsp rbp +rbp rsp -7ffe970f17 -b0 - - -7ffe970f17d0 - - -7ffe970f1880 - - - - - -7ffe970f17 -b8 - - -10018b0 -main+80 -7ffe970f17 -c0 - - -7f2ba3020de8 - - -7ffe970f1918 - - - - - -7ffe970f17 -c8 - - -0 -7ffe970f17 -d0 - - -7ffe970f1880 - - -7ffe970f18e0 - - -0 -7ffe970f17 -d8 - - -7f2ba2e27781 -libc+27781 ++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 @@ -349,21 +311,16 @@ main - - - -the list its bytes -value -next -malloc's -never read -the heap, 28b41050 to 28b410bf -28b410 -50 +the heap, 1004050 to 10040bf + + + +10040 +50 10 00 @@ -373,51 +330,46 @@ 00 00 00 +16 30 -10 -b4 -28 +40 +00 +01 00 00 00 00 -16 - - -28b41030 - - - -28b410 -60 - - - - - - - - - - - - - - - - + + +1004030 + + + +10040 +60 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -70 + + + +10040 +70 09 00 @@ -427,51 +379,46 @@ 00 00 00 +9 50 -10 -b4 -28 +40 +00 +01 00 00 00 00 -9 - - -28b41050 - - - -28b410 -80 - - - - - - - - - - - - - - - - + + +1004050 + + + +10040 +80 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -90 + + + +10040 +90 04 00 @@ -481,49 +428,47 @@ 00 00 00 +4 70 -10 -b4 -28 +40 +00 +01 00 00 00 00 -4 - - -28b41070 -28b410 -a0 - - - - - - - - - - - - - - - - + + +1004070 + + + +10040 +a0 +00 +00 +00 +00 +00 +00 +00 +00 21 -00 -00 -00 -00 -00 -00 -00 +00 +00 +00 +00 +00 +00 +00 malloc's: a chunk of 32 -28b410 -b0 + + + +10040 +b0 01 00 @@ -533,22 +478,29 @@ 00 00 00 +1 - -00 -00 -00 -00 -00 -00 -00 -00 -1 -NULL - - - -28b410b0 +00 +00 +00 +00 +00 +00 +00 +00 +NULL + + + + + + + + + + +the list +10040b0 1 @@ -557,7 +509,7 @@ rcx -28b41090 +1004090 4 @@ -568,7 +520,7 @@ rax -28b41070 +1004070 9 @@ -578,21 +530,21 @@ rdi -28b41050 +1004050 16 -28b41030 +1004030 25 -28b41010 +1004010 36 @@ -604,9 +556,1505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -moment 71 of 95 -The load read the word at 28b41098: the address of the next node. + +moment 3 of 4 +The load read the word at 1004098: the address of the next node. rdi holds it now, and points at the node whose value is 9. diff --git a/design/mock/12-calls-subject-480.png b/design/mock/12-calls-subject-480.png index 0cde337..935056a 100644 Binary files a/design/mock/12-calls-subject-480.png and b/design/mock/12-calls-subject-480.png differ diff --git a/design/mock/12-calls-subject.png b/design/mock/12-calls-subject.png index 7ab5d52..9583bf8 100644 Binary files a/design/mock/12-calls-subject.png and b/design/mock/12-calls-subject.png differ diff --git a/design/mock/12-calls-subject.svg b/design/mock/12-calls-subject.svg index 6dd15d6..32d6452 100644 --- a/design/mock/12-calls-subject.svg +++ b/design/mock/12-calls-subject.svg @@ -244,50 +244,54 @@ six words from rsp · the frames they belong to rsp -7fffffffed -78 - - - -10133ab -fib+59 -7fffffffed -80 - - -0 -7fffffffed -88 - - - -2 -7fffffffed -90 - - -4 -7fffffffed -98 - - -7ffff7ffd000 -vdso+0 ++0 +7fffffffed +78 + + + +10133ab +fib+59 ++8 +7fffffffed +80 + + +0 ++10 +7fffffffed +88 + + + +2 ++18 +7fffffffed +90 + + +4 ++20 +7fffffffed +98 + + +7ffff7ffd000 +vdso+0 rbp -7fffffffed -a0 - - -7fffffffedd0 - - -7fffffffedf0 - - - - - ++28 +saved rbp +7fffffffed +a0 + + +7fffffffedd0 + + + + + diff --git a/design/mock/13-sqlite-row-480.png b/design/mock/13-sqlite-row-480.png index db957cc..3674630 100644 Binary files a/design/mock/13-sqlite-row-480.png and b/design/mock/13-sqlite-row-480.png differ diff --git a/design/mock/13-sqlite-row.png b/design/mock/13-sqlite-row.png index e372f2f..fe4dc79 100644 Binary files a/design/mock/13-sqlite-row.png and b/design/mock/13-sqlite-row.png differ diff --git a/design/mock/13-sqlite-row.svg b/design/mock/13-sqlite-row.svg index 92d1ec0..585a686 100644 --- a/design/mock/13-sqlite-row.svg +++ b/design/mock/13-sqlite-row.svg @@ -235,73 +235,72 @@ six words from rsp · the frames they belong to rbp rsp -7fffffffe9 -80 - - -7fffffffeb90 - - -7fffffffec60 - - - - - -7fffffffe9 -88 - - -43e029 -sqlite3VdbeExec+18905 -7fffffffe9 -90 - - -7ffff7c0ed60 - - -0xd001200000f05 -7fffffffe9 -98 - - -7fffffffea18 - - -517378 - - -513010 - - - - - -7fffffffe9 -a0 - - -521ed0 - - -0 -7fffffffe9 -a8 - - -7fffffffea18 - - -517378 - - -513010 - - - - - ++0 +saved rbp +7fffffffe9 +80 + + +7fffffffeb90 + + + + + ++8 +7fffffffe9 +88 + + + + + ++10 +7fffffffe9 +90 + + +7ffff7c0ed60 + + +0xd001200000f05 ++18 +7fffffffe9 +98 + + +7fffffffea18 + + +517378 + + + + + ++20 +7fffffffe9 +a0 + + +521ed0 + + +0 ++28 +7fffffffe9 +a8 + + +7fffffffea18 + + +517378 + + + + + diff --git a/design/mock/14-sqlite-page-480.png b/design/mock/14-sqlite-page-480.png index 35a7d2f..6d2f4f6 100644 Binary files a/design/mock/14-sqlite-page-480.png and b/design/mock/14-sqlite-page-480.png differ diff --git a/design/mock/14-sqlite-page.png b/design/mock/14-sqlite-page.png index 695138d..fb70150 100644 Binary files a/design/mock/14-sqlite-page.png and b/design/mock/14-sqlite-page.png differ diff --git a/design/mock/14-sqlite-page.svg b/design/mock/14-sqlite-page.svg index d67cbac..6c81055 100644 --- a/design/mock/14-sqlite-page.svg +++ b/design/mock/14-sqlite-page.svg @@ -262,60 +262,65 @@ stack rsp+20 to rsp+48 · the frames they belong to -7fffffffe7 -c0 - - - -0 -7fffffffe7 -c8 - - - -538b28 - - -0xe60f030000000d -7fffffffe7 -d0 - - - -517e38 - - -513010 - - -0x7800000003 -7fffffffe7 -d8 - - - -2 ++20 +7fffffffe7 +c0 + + + +0 ++28 +7fffffffe7 +c8 + + + +538b28 + + +0xe60f030000000d ++30 +7fffffffe7 +d0 + + + +517e38 + + +513010 + + +0x7800000003 ++38 +7fffffffe7 +d8 + + + +2 rbp -7fffffffe7 -e0 - - -7fffffffe820 - - -7fffffffe860 - - - - - -7fffffffe7 -e8 - - -42fa75 -pager_write_pagelist+245 ++40 +saved rbp +7fffffffe7 +e0 + + +7fffffffe820 + + + + + ++48 +7fffffffe7 +e8 + + + + + unixWrite diff --git a/design/mock/16-none-480.png b/design/mock/16-none-480.png deleted file mode 100644 index e85cc62..0000000 Binary files a/design/mock/16-none-480.png and /dev/null differ diff --git a/design/mock/16-none.png b/design/mock/16-none.png deleted file mode 100644 index 68b7049..0000000 Binary files a/design/mock/16-none.png and /dev/null differ diff --git a/design/mock/16-none.svg b/design/mock/16-none.svg deleted file mode 100644 index 4b89733..0000000 --- a/design/mock/16-none.svg +++ /dev/null @@ -1,1641 +0,0 @@ - - - - - - -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 -} -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 - - - -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 -word ptr 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 -qword ptr [rax], rbx -1001 -8fa -14 -mov -qword ptr [rax + 8], r14 -1001 -8fe -15 -pop -rbx -1001 -8ff -pop -r14 -1001 -901 -pop -rbp -1001 -902 -ret -1001 -903 -nop -word ptr 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 -dword ptr [rax + rax] -1001 -920 -mov -rcx, rax -1001 -923 -mov -rax, rdi - - - -1001 -926 -21 -mov -rdi, qword ptr [rdi + 8] -1004098 - - -1004070 - - -9 -1001 -92a -22 -mov -qword ptr [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, qword ptr [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 -qword ptr [rip + 0x1222] -strtol@plt-0x10 -1001 -976 -jmp -qword ptr [rip + 0x1224] -1001 -97c -nop -dword ptr [rax] - -1001 -980 -jmp -qword ptr [rip + 0x1222] -strtol@plt -1001 -986 -push -0 -1001 -98b -jmp -1001970 - -1001 -990 -jmp -qword ptr [rip + 0x121a] -printf@plt -1001 -996 -push -1 -1001 -99b -jmp -1001970 - -1001 -9a0 -jmp -qword ptr [rip + 0x1212] -malloc@plt -1001 -9a6 -push -2 -1001 -9ab -jmp -1001970 - - - - - - - - - - - - -registers -stack -heap -code -data -rwx - -read-only -rax - -1004090 - - -4 -rbx -0 -rcx - -10040b0 - - -1 -rdx -0 -rsi -10040c0 - - -0 -rdi - -1004090 - - -4 -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 - - - -backtrace -newest on top - - -#0 -reverse+22 -list.c:21 -#1 -main+80 -list.c:40 -#2 -libc+27781 -#3 -__libc_start_main+137 -#4 -_start+37 - - - -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 - - - -stack -69 words from rsp · the frames they belong to -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 -+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 - - - -reverse - - - -main - - - -libc+27781 - - - -__libc_start_main - - -_start - - -moment 2 of 4 -Stopped in reverse, about to load head->next. -rdi points at a node; the word after its value is the next node. - diff --git a/design/mock/17-subject-480.png b/design/mock/17-subject-480.png deleted file mode 100644 index daca488..0000000 Binary files a/design/mock/17-subject-480.png and /dev/null differ diff --git a/design/mock/17-subject.png b/design/mock/17-subject.png deleted file mode 100644 index d1bb0cc..0000000 Binary files a/design/mock/17-subject.png and /dev/null differ diff --git a/design/mock/17-subject.svg b/design/mock/17-subject.svg deleted file mode 100644 index fd9459e..0000000 --- a/design/mock/17-subject.svg +++ /dev/null @@ -1,1562 +0,0 @@ - - - - - - -its bytes -the heap, 1004000 to 10041ff - - - -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 - - - -backtrace -newest on top - - -#0 -reverse+22 -list.c:21 -#1 -main+80 -list.c:40 -#2 -libc+27781 -#3 -__libc_start_main+137 -#4 -_start+37 - - - -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 -} -43 - - - -disassembly -reverse - -1001 -8e4 -11 -push -r14 -push -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 -qword ptr [rax], rbx -1001 -8fa -14 -mov -qword ptr [rax + 8], r14 -1001 -8fe -15 -pop -rbx -1001 -8ff -pop -r14 -1001 -901 -pop -rbp -1001 -902 -ret -1001 -903 -nop -word ptr 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 -dword ptr [rax + rax] -1001 -920 -mov -rcx, rax -1001 -923 -mov -rax, rdi - - - -1001 -926 -21 -mov -rdi, qword ptr [rdi + 8] - -1004098 - - -1004070 - - -9 -1001 -92a -22 -mov -qword ptr [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, qword ptr [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 -qword ptr [rip + 0x1222] -strtol@plt-0x10 -1001 -976 -jmp -qword ptr [rip + 0x1224] - - - - - - - - - - - - -stack -69 words from rsp · the frames they belong to -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 -+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 - - - -reverse - - - -main - - - -libc+27781 - - - -__libc_start_main - - -_start - - -moment 2 of 4 -The load read the word at 1004098: the address of the next node. -rdi holds it now, and points at the node whose value is 9. - diff --git a/design/mock/18-loupes-480.png b/design/mock/18-loupes-480.png deleted file mode 100644 index c7b8332..0000000 Binary files a/design/mock/18-loupes-480.png and /dev/null differ diff --git a/design/mock/18-loupes.png b/design/mock/18-loupes.png deleted file mode 100644 index cafd759..0000000 Binary files a/design/mock/18-loupes.png and /dev/null differ diff --git a/design/mock/18-loupes.svg b/design/mock/18-loupes.svg deleted file mode 100644 index 02bff4f..0000000 --- a/design/mock/18-loupes.svg +++ /dev/null @@ -1,2110 +0,0 @@ - - - - - - -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 -} -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 - - - -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 -word ptr 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 -qword ptr [rax], rbx -1001 -8fa -14 -mov -qword ptr [rax + 8], r14 -1001 -8fe -15 -pop -rbx -1001 -8ff -pop -r14 -1001 -901 -pop -rbp -1001 -902 -ret -1001 -903 -nop -word ptr 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 -dword ptr [rax + rax] -1001 -920 -mov -rcx, rax -1001 -923 -mov -rax, rdi - - - -1001 -926 -21 -mov -rdi, qword ptr [rdi + 8] - -1004098 - - -1004070 - - -9 -1001 -92a -22 -mov -qword ptr [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, qword ptr [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 -qword ptr [rip + 0x1222] -strtol@plt-0x10 -1001 -976 -jmp -qword ptr [rip + 0x1224] -1001 -97c -nop -dword ptr [rax] - -1001 -980 -jmp -qword ptr [rip + 0x1222] -strtol@plt -1001 -986 -push -0 -1001 -98b -jmp -1001970 - -1001 -990 -jmp -qword ptr [rip + 0x121a] -printf@plt -1001 -996 -push -1 -1001 -99b -jmp -1001970 - -1001 -9a0 -jmp -qword ptr [rip + 0x1212] -malloc@plt -1001 -9a6 -push -2 -1001 -9ab -jmp -1001970 - - - - - - - - - - - - -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 - - - -backtrace -newest on top - - -#0 -reverse+22 -list.c:21 -#1 -main+80 -list.c:40 -#2 -libc+27781 -#3 -__libc_start_main+137 -#4 -_start+37 - - - -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 - - - -stack -69 words from rsp · the frames they belong to -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 -+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 - - - -reverse - - - -main - - - -libc+27781 - - - -__libc_start_main - - -_start - - - - -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 - - - - - - - -1004078 - → -1004050 -heap · struct node, 16 bytes - - - -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 - - - - -moment 3 of 4 -The load is done: rdi holds 1004070, and beside it the heap round it opens. -Its next word opens the node after it, one deeper. - diff --git a/design/mock/19-map-1080.png b/design/mock/19-map-1080.png new file mode 100644 index 0000000..e6e6d0e Binary files /dev/null and b/design/mock/19-map-1080.png differ diff --git a/design/mock/19-map-480.png b/design/mock/19-map-480.png new file mode 100644 index 0000000..7ba1436 Binary files /dev/null and b/design/mock/19-map-480.png differ diff --git a/design/mock/19-map.png b/design/mock/19-map.png new file mode 100644 index 0000000..f4c5dc3 Binary files /dev/null and b/design/mock/19-map.png differ diff --git a/design/mock/19-map.svg b/design/mock/19-map.svg new file mode 100644 index 0000000..81216ee --- /dev/null +++ b/design/mock/19-map.svg @@ -0,0 +1,2028 @@ + + + + + + +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 on top + + +#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 +word ptr 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 +qword ptr [rax], rbx +1001 +8fa +14 +mov +qword ptr [rax + 8], r14 +1001 +8fe +15 +pop +rbx +1001 +8ff +pop +r14 +1001 +901 +pop +rbp +1001 +902 +ret +1001 +903 +nop +word ptr 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 +dword ptr [rax + rax] +1001 +920 +mov +rcx, rax +1001 +923 +mov +rax, rdi + + + +1001 +926 +21 +mov +rdi, qword ptr [rdi + 8] + +1004098 + + +1004070 + + +9 +1001 +92a +22 +mov +qword ptr [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, qword ptr [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 +qword ptr [rip + 0x1222] +strtol@plt-0x10 +1001 +976 +jmp +qword ptr [rip + 0x1224] +1001 +97c +nop +dword ptr [rax] + +1001 +980 +jmp +qword ptr [rip + 0x1222] +strtol@plt +1001 +986 +push +0 +1001 +98b +jmp +1001970 + +1001 +990 +jmp +qword ptr [rip + 0x121a] +printf@plt +1001 +996 +push +1 +1001 +99b +jmp +1001970 + +1001 +9a0 +jmp +qword ptr [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. + diff --git a/design/mock/21-loupe-480.png b/design/mock/21-loupe-480.png new file mode 100644 index 0000000..7c109c3 Binary files /dev/null and b/design/mock/21-loupe-480.png differ diff --git a/design/mock/21-loupe.png b/design/mock/21-loupe.png new file mode 100644 index 0000000..d22fe69 Binary files /dev/null and b/design/mock/21-loupe.png differ diff --git a/design/mock/21-loupe.svg b/design/mock/21-loupe.svg new file mode 100644 index 0000000..9e5f457 --- /dev/null +++ b/design/mock/21-loupe.svg @@ -0,0 +1,2319 @@ + + + + + + +list.c +lines 19 to 26 of 42 +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 +10019 +10 +20 +test +rdi, rdi +10019 +13 +je +1001935 +10019 +15 +push +rbp +10019 +16 +mov +rbp, rsp +10019 +19 +xor +eax, eax +10019 +1b +nop +dword ptr [rax + rax] +10019 +20 +mov +rcx, rax +10019 +23 +mov +rax, rdi + + + +10019 +26 +21 +mov +rdi, qword ptr [rdi + 8] + +1004098 + + +1004070 + + +9 +10019 +2a +22 +mov +qword ptr [rax + 8], rcx +10019 +2e +20 +test +rdi, rdi +10019 +31 +jne +1001920 +10019 +33 +pop +rbp +10019 +34 +26 +ret +10019 +35 +xor +eax, eax +10019 +37 +ret + +10019 +38 +endbr64 +_init + + + +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 + + + +stack +eight words from rsp · the frames they belong to +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 + + +".… + + + +reverse + + + +main + + +libc+27781 + + + +its bytes +the heap, 1004070 to 10040bf + + + +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 + + + + + + + + + + +the list +10040b0 + +1 + + + + + +rcx +1004090 + +4 + + + + + + + +rax +1004070 + +9 + + + + + + +rdi +1004050 + +16 + + + + +1004030 + +25 + + + + +1004010 + +36 + + + + + + +rdi + → +1004070 +heap · struct node, 16 bytes + + + +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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +moment 3 of 4 +rdi holds 1004070; under it opens the heap round that node. +The minimap shows the same loupe at its place on the map. + diff --git a/design/mock/context.py b/design/mock/context.py index 303c7c1..069e894 100644 --- a/design/mock/context.py +++ b/design/mock/context.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """The frame: the machine's whole context, pwndbg's way, a lens over it, and the ties between them. - python3 -B context.py # writes 09-context.svg, 10-context-step.svg, 11-context-lens.svg, 12-calls-subject.svg + python3 -B context.py # writes 12-calls-subject.svg, 13-sqlite-row.svg, 14-sqlite-page.svg (9 to 11: map.py) Every function here is a block of design/README.md, under the block's name. @@ -333,6 +333,10 @@ def stack(g, y, rows, frames, note=None, rsp=None, roles=None): off = slot - rsp g.t(RX + 172, b(yy), ("+%x" % off) if off >= 0 else ("-%x" % -off), S, FAINT, MONO, "end") end_x = room.get(i, RX + CW - 136) + if marks and marks[0].get("free"): # above rsp: not the stack's yet; its word faint, no chain + g.t(first, b(yy), "%x" % slot, S, mix(STACK, PAGE, 0.6), MONO) + g.t(first + 13 * A, b(yy), "%x" % end[1], S, FAINT, MONO) + continue if i in roles: text, ink = roles[i] g.t(end_x, b(yy), text, S, ink, MONO, "end") @@ -464,7 +468,7 @@ def thread(g, ys, spans): # ---- the lens: a list, and beside it the bytes it is drawn from ------------------------- def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=(), title="its bytes", x=None, - framed=(), bare=False, rows_shown=None): + framed=(), bare=False, rows_shown=None, more_rows=True): """`hexdump` by `fields`: the region a scene names, read by the fields it gives it, in the band's view. flist: (at, len, reads, big, mark) with reads in number | pointer | text | bytes. mem: {address: byte} of what the stop shown saw (or the kernel took); a byte not in it is unread. marks: the field marks framed as read. @@ -555,7 +559,7 @@ def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=() g.t(x, b(yy), s_, S, sink, MONO) x += (len(s_) + 1) * A yy += ROW - if shown and shown[-1] < total - 1: # the rows after the last field: one row, and how many + if more_rows and shown and shown[-1] < total - 1: # the rows after the last field: one row, and how many more(g, X + 18 - 6, yy) g.t(X + 18 + 30 + 36, b(yy), "%d rows" % (total - 1 - shown[-1]), S, FAINT, MONO) return ys @@ -631,7 +635,8 @@ def dump_row(g, y, a, runs, lead, mark=None, node=False): g.t(x + 3 * A + 8 + 30, b(y), "NULL", S, DIM, MONO) -def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False, dw=None, k=1, view_rows=None): +def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False, dw=None, k=1, view_rows=None, + ties=True): """The band: the list drawn, over the program column, and the heap bytes it is drawn from, over the state column; two panels, h and hv high, the gutter between them the ties'. nodes: (address, value, next address or 0), in the list's order. pins: {address: [registers]}. @@ -704,8 +709,8 @@ def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject= (x + NW / 2, lane_bot)] pin_up(g, x + NW / 2, ny + NH, names, HEAP, LS, via, sw=tie_w[0]) - # the projection: the bytes a step read, and the part of the drawing that is those bytes - if marks.get("read"): + # the projection: the bytes a step read, and the part of the drawing that is those bytes (the map draws none) + if marks.get("read") and ties: a = marks["read"] & ~15 yy, x = rows[a], xs[a] bracket(g, RX + 7, yy + 2, yy + ROW - 2, READ, 3, 6) @@ -1008,7 +1013,7 @@ def frame_calls(name): yr = TOP + sp["view"] + 12 registers(g, yr, FIB_REGS, FIB_FLAGS, {"rsp": {0: "strike"}, "rdi": {0: "tick"}}) - rows = stack(g, yr + ph(17) + 12, FIB_STACK, FIB_FRAMES) + rows = stack(g, yr + ph(17) + 12, FIB_STACK, FIB_FRAMES, rsp=0x7fffffffed78, roles={5: ("saved rbp", DIM)}) backtrace(g, TOP, sp["view"], FIB_BACKTRACE) calls(g, TOP, sp["band"], fib_calls(5), 8, "main", project_from=rows[0]) @@ -1133,7 +1138,8 @@ def frame_sqlite(name, late): ys = y + TAG + PAD + 5 * ROW changed = {r: {0: "tick"} for r, _, _ in SQ_REGS_120 if r not in ("r12", "rip")} registers(g, yr, SQ_REGS_120, SQ_FLAGS_120, changed) - stack(g, yr + ph(17) + 12, SQ_STACK_120, [("sqlite3BtreeInsert", 0, 1), ("sqlite3VdbeExec", 2, 9)]) + stack(g, yr + ph(17) + 12, SQ_STACK_120, [("sqlite3BtreeInsert", 0, 1), ("sqlite3VdbeExec", 2, 9)], + rsp=0x7fffffffe980, roles={0: ("saved rbp", DIM)}) backtrace(g, TOP, sp["band"], SQ_BT_120, x=LX, note="newest on top", focus=True) base = 0x7fffffffea60 fields(g, TOP, sp["view"], "pX, the row: a BtreePayload, at rsi", base, 48, PAYLOAD, @@ -1147,7 +1153,8 @@ def frame_sqlite(name, late): ys = y + TAG + PAD + 4 * ROW changed = {r: {0: "tick"} for r, _, _ in SQ_REGS_169 if r not in ("r9", "rip")} registers(g, yr, SQ_REGS_169, SQ_FLAGS_169, changed) - stack(g, yr + ph(17) + 12, SQ_STACK_169, [("unixWrite", -1, 5)], note="rsp+20 to rsp+48") + stack(g, yr + ph(17) + 12, SQ_STACK_169, [("unixWrite", -1, 5)], note="rsp+20 to rsp+48", rsp=0x7fffffffe7a0, + roles={4: ("saved rbp", DIM)}) page = bytes(4096 - len(PAGE_END) - len(PAGE0)) # the middle of the page is not drawn: `more` page = PAGE0 + page + PAGE_END kernel(g, TOP, sp["band"], [("pwrite64", 4096), ("pwrite64", 4096), ("fsync", 0), ("pwrite64", 12), @@ -1173,9 +1180,7 @@ if __name__ == "__main__": assert ph(17) + 12 + ph(6) == BOTTOM - TOP - 200 - 12 and ph(7) == 200 # its view, and the stack under it assert ph(5) == 152 assert shared([0x1001910, 0x1001937]) == 5 and shared([0x28b41070]) == 6 - frame("09-context", False) - frame("10-context-step", True) - frame("11-context-lens", True, subject=True) + # 9 to 11 are map.py's: the working frame from the fresh recording, with its minimap frame_calls("12-calls-subject") frame_sqlite("13-sqlite-row", False) frame_sqlite("14-sqlite-page", True) diff --git a/design/mock/dense.py b/design/mock/dense.py index cb047ac..4017d69 100644 --- a/design/mock/dense.py +++ b/design/mock/dense.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """The frame on the 4K stage: four columns of 880, the context at mono 20, four times what 1080 held. - python3 -B dense.py # writes 15-marks.svg, 16-none.svg, 17-subject.svg, 18-loupes.svg + python3 -B dense.py # writes 15-marks.svg; and is the data and the map's columns for map.py The blocks are context.py's, placed on the 4K stage's columns; what is new here is the stage, the thread across the gutter, the `loupe`, and the marks sheet. The moment is real: a fresh recording of the same `targets/list`, @@ -254,13 +254,14 @@ def caption4(g, lines): y += 108 -def loupe(g, x, y, title, note, base, flist, framed, depth): +def loupe(g, x, y, title, note, base, flist, framed, depth, rows=9): """`loupe`: the memory round a pointer's target, floating over the context, tied to the pointer it opens from. Nine rows, the target's in the middle; the target framed bright. Lifted: its own surface, a shadow under it, deeper for a loupe opened from another. Returns its rows' y.""" - h = ph(9) + h = ph(rows) sx, sy = (12, 16) if depth == 1 else (20, 26) - g.rect(x + sx, y + sy, CW, h, SHADE) + if depth: # on the map a loupe is a panel of its own: lifted, but no shadow + g.rect(x + sx, y + sy, CW, h, SHADE) g.rect(x, y, CW, h, LIFT) g.rect(x, y, CW, TAG, LIFT_TAG) g.frame(x, y, CW, h, DIM, 2) @@ -269,7 +270,8 @@ def loupe(g, x, y, title, note, base, flist, framed, depth): g.t(xx, y + 18, s_, S, ink, MONO) xx += len(s_) * A g.t(x + CW - 10, y + 18, note, 18, DIM, "sans", "end") - return C.fields(g, y, h, "", base, 144, flist, MEM, HEAP, region, framed=framed, bare=True, x=x) + return C.fields(g, y, h, "", base, 16 * rows, flist, MEM, HEAP, region, framed=framed, bare=True, x=x, + more_rows=False) def stem(g, pts): @@ -278,76 +280,6 @@ def stem(g, pts): # ---- the frames ---------------------------------------------------------------------------------------- -def frame_none(name, step, loupes=False): - """`none` on the 4K stage: source | disassembly | registers, backtrace, memory | stack.""" - g = Svg() - put(COL[0]) - ys = C.source(g, TOP4, 69, SRC, 1, 21, [], "list.c", 42) - put(COL[1]) - at = C.disasm(g, TOP4, window(69, step), "reverse", 21) - thread_across(g, ys, [(at[0x1001926], at[0x1001926] + ROW)]) - put(COL[2]) - marks = {"rax": {0: "tick"}, "rcx": {0: "tick"}, "rdi": {0: "strike" if step else "tick"}} - where = C.registers(g, TOP4, regs(step), FLAGS, marks) - C.backtrace(g, 548, 416, BT, x=COL[2], note="newest on top") - C.fields(g, 976, 808, "the heap, round what the step reads", 0x1004000, 512, - heap_fields(0x1004000, 512, 0x1004098), MEM, HEAP, region, marks=(9,) if step else (), title="memory") - put(COL[3]) - C.stack(g, TOP4, stack_rows(69), FRAMES, note="69 words from rsp", rsp=RSP, roles=roles(69)) - if loupes: - ry = where["rdi"] - x1, y1 = 2728, ry - r1 = loupe(g, x1, y1, [("rdi", DIM), (" → ", FAINT), ("1004070", HEAP)], "heap · struct node, 16 bytes", - 0x1004030, heap_fields(0x1004030, 144), [(0x1004070 - 0x1004030, 16)], 1) - stem(g, [(COL[2] + 72 + 7 * A + 30 + A + 16, ry + 12), (x1, ry + 12)]) # from the end of rdi's chain - # the next word in it opens the next: the field's bytes bracketed, a stem down into the deeper loupe - fy = r1[0x1004070] - bx0 = x1 + 132 + 8 * 30 + 12 - 4 - bx1 = x1 + 132 + 15 * 30 + 12 + 28 - g.rect(bx0, fy + ROW + 1, bx1 - bx0, 3, HEAP) - x2, y2 = x1 + 120, fy + ROW + 34 - loupe(g, x2, y2, [("1004078", HEAP), (" → ", FAINT), ("1004050", HEAP)], "heap · struct node, 16 bytes", - 0x1004010, heap_fields(0x1004010, 144), [(0x1004050 - 0x1004010, 16)], 2) - stem(g, [((bx0 + bx1) / 2, fy + ROW + 4), ((bx0 + bx1) / 2, y2)]) - clock4(g, 3 if step else 2, 4) - if loupes: - caption4(g, [[("The load is done: ",), ("rdi", "mono"), (" holds ",), ("1004070", "mono"), - (", and beside it the heap round it opens.",)], - [("Its ",), ("next", "mono"), (" word opens the node after it, one deeper.",)]]) - else: - caption4(g, [[("Stopped in ",), ("reverse", "mono"), (", about to load ",), ("head->next", "mono"), (".",)], - [("rdi", "mono"), (" points at a node; the word after its value is the next node.",)]]) - g.save(name) - - -def frame_subject(name): - """`subject` on the 4K stage, mid-step: the list drawn twice the size over the program's two columns, its - bytes over the third, the context under and beside them.""" - g = Svg() - band = 604 - put(COL[2]) - view = C.fields(g, TOP4, 800, "the heap, 1004000 to 10041ff", 0x1004000, 512, - heap_fields(0x1004000, 512, 0x1004098), MEM, HEAP, region, marks=(9,)) - where = C.registers(g, 908, regs(True), FLAGS, {"rax": {0: "tick"}, "rcx": {0: "tick"}, "rdi": {0: "strike"}}) - C.backtrace(g, 1360, 424, BT, x=COL[2], note="newest on top") - put(COL[0]) - pins = {0x10040b0: ["rcx"], 0x1004090: ["rax"], 0x1004070: ["rdi"]} - C.RX = COL[2] # the link leaves the registers, the projection the view - C.lens(g, TOP4, band, 800, NODES, pins, {"tick": [0x10040b8], "read": 0x1004098}, 0x1004000, 32, - link_from=(where["rdi"], "rdi"), subject=True, dw=2 * CW + 32, k=2, view_rows=view) - put(COL[0]) - ys = C.source(g, TOP4 + band + 12, 43, SRC, 1, 21, [], "list.c", 42) - put(COL[1]) - at = C.disasm(g, TOP4 + band + 12, window(43, True), "reverse", 21) - thread_across(g, ys, [(at[0x1001926], at[0x1001926] + ROW)]) - put(COL[3]) - C.stack(g, TOP4, stack_rows(69), FRAMES, note="69 words from rsp", rsp=RSP, roles=roles(69)) - clock4(g, 2, 4) - caption4(g, [[("The load read the word at ",), ("1004098", "mono"), (": the address of the next node.",)], - [("rdi", "mono"), (" holds it now, and points at the node whose value is 9.",)]]) - g.save(name) - - def frame_marks(name): """Mock 15: current, struck and held, as the first videos drew them (A), as the catalogue now does (B), and the other reading of "white, with less opacity" (C), on real rows of the same moment and the one after.""" @@ -436,6 +368,3 @@ def frame_marks(name): if __name__ == "__main__": frame_marks("15-marks") - frame_none("16-none", False) - frame_subject("17-subject") - frame_none("18-loupes", True, loupes=True) diff --git a/design/mock/list-dbg.txt b/design/mock/list-dbg.txt index 14e8196..dcc8a8f 100644 --- a/design/mock/list-dbg.txt +++ b/design/mock/list-dbg.txt @@ -176,3 +176,13 @@ thread 1131036 targets/list.c:21:35 0000010041f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ (ztrace) q list3.ztrace: 4 moments +# and the 128 bytes under rsp at the same stop (a third run, the same addresses): +(ztrace) x 0x7fffffffec60 128 +7fffffffec60 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ................ +7fffffffec70 10 00 00 00 00 00 00 00 38 ee ff ff ff 7f 00 00 ........8....... +7fffffffec80 90 40 00 01 00 00 00 00 c0 29 00 01 00 00 00 00 .@.......)...... +7fffffffec90 c0 ec ff ff ff 7f 00 00 4f 7a ca f7 ff 7f 00 00 ........Oz...... +7fffffffeca0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +7fffffffecb0 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +7fffffffecc0 e0 ec ff ff ff 7f 00 00 f7 18 00 01 00 00 00 00 ................ +7fffffffecd0 01 00 00 00 00 00 00 00 00 d0 ff f7 ff 7f 00 00 ................ diff --git a/design/mock/map.py b/design/mock/map.py new file mode 100644 index 0000000..84e42fa --- /dev/null +++ b/design/mock/map.py @@ -0,0 +1,393 @@ +#!/usr/bin/env python3 +"""The map, the minimap, and the working frame they belong to, from one fresh recording of targets/list. + + python3 -B map.py # 09, 10, 11 (the working frame), 19 (the map), 20 (the dive), 21 (a loupe open) + +The working frame is the 1920 stage (context.py's blocks, as mocks 9 to 14 always drew them). The map is the same +moment unfolded on 3840 by 2160: every panel at its full length, packed into four columns by content. The minimap +is the map at a twentieth, drawn from the map itself: every run of text a stroke, the marks, the windows. The data +is `list-dbg.txt` (registers, the stack from 128 bytes under rsp, the heap) and `list.dis`, as dense.py reads them. +""" +import subprocess + +from PIL import Image, ImageDraw, ImageFont + +import gen +import dense as D +import context as C +from context import (PAGE, RAISED, RULE, VELLUM, BRIGHT, DIM, FAINT, GOLD, VERM, READ, HEAP, STACK, A, S, ROW, TAG, + PAD, MONO, b, ph, tw, mix, Svg, H_) + +MINI = (1664, 912, 192, 108) # the minimap's place in the working frame: x, y, w, h +K = 1 / 20 # map units to the minimap's +RSP, UNDER = D.RSP, 16 # the map's stack starts 16 words above rsp +ROLES = {0: "saved rbp", 3: "saved rbx", 4: "saved rbp", 26: "saved rbp", 38: "saved rbp", 42: "argc", + 43: "argv[0]", 44: "argv end", 45: "envp end", 46: "auxv"} +FRAMES = [("reverse", 0, 1), ("main", 2, 5), ("libc+27781", 6, 27), ("__libc_start_main", 28, 39), ("_start", 40, 999)] + + +def stage(map_): + """Set the blocks' globals for the map (3840) or the working frame (1920).""" + gen.W, gen.H = (3840, 2160) if map_ else (1920, 1080) + C.W = gen.W + C.TOP, C.BOTTOM = (96, 1784) if map_ else (48, 888) + C.LANE_LINK, C.LANE_VIEW = (1912, 1924) if map_ else (950, 962) + + +class Rec(Svg): + """An Svg that keeps what it drew, so the minimap can be drawn from it.""" + def __init__(self): + super().__init__() + self.log = [] + + def t(self, x, y, s, size=30, fill=VELLUM, font="mono", anchor="start"): + super().t(x, y, s, size, fill, font, anchor) + w = len(s) * 0.6 * size if font.startswith("mono") else tw(s, size, font) + x0 = x - w if anchor == "end" else x - w / 2 if anchor == "middle" else x + self.log.append(("t", x0, y, w, size, fill)) + + def rect(self, x, y, w, h, fill="none", stroke=None, sw=2, dash=None): + super().rect(x, y, w, h, fill, stroke, sw, dash) + self.log.append(("r", x, y, w, h, fill, stroke)) + + +# ---- the map -------------------------------------------------------------------------------------------- +def slot_rows(first, n, step_free=True): + """Stack rows from slot `first` (0 is 16 words above rsp): the free ones above rsp, then the stack.""" + rows = [] + for i in range(first, first + n): + a = RSP + 8 * (i - UNDER) + w = D.word(a) + if i < UNDER: + rows.append((a, [], [], ("int", w), {"free": True})) + continue + links, end = D.value(w) + rows.append((a, ["rbp", "rsp"] if a == RSP else [], links, end)) + return rows + + +def roles_from(first, n): + return {i - first: (t, DIM) for j, t in ROLES.items() for i in [j + UNDER] if first <= i < first + n} + + +def frames_from(first, n): + out = [] + for name, a, z in FRAMES: + a, z = a + UNDER - first, z + UNDER - first + if z >= 0 and a < n: + out.append((name, a if a >= 0 else -1, z)) + return out + + +def node_marks(step): + return {"tick": [0x10040b8]} | ({"read": 0x1004098} if step else {}) + + +def pins(step): + return {0x10040b0: ["rcx"], 0x1004090: ["rax"] + ([] if step else ["rdi"]), 0x1004070: ["rdi"] if step else []} + + +def draw_map(g, step, loupe, subject=False): + """The map at one moment. Returns the outlines of the working frame's windows, in map units.""" + stage(True) + sp = C.SUBJECT if subject else C.BESIDE + col = D.COL + win = {} + # A: the lens's drawing at its subject size, the file whole, the backtrace whole, the key + D.put(col[0]) + C.RX = col[2] + C.lens(g, 96, 296, 0, D.NODES, pins(step), node_marks(step), 0x1004000, 0, subject=True, view_rows={}, ties=False) + win["drawing"] = (col[0], 96, D.CW, 296) + ys = C.source(g, 404, 42, D.SRC, 1, 21, [], "list.c", 42) + first = 18 if subject else 19 + win["source"] = (col[0], 404 + TAG + PAD + (first - 1) * ROW, D.CW, sp["src"] * ROW) + D.put(col[0]) + C.backtrace(g, 1456, ph(5), D.BT, x=col[0], note="newest on top") + key(g, col[0], 1620, step) + # B: 69 instructions, the function and its neighbours + D.put(col[1]) + rows = D.window(69, step) + at = C.disasm(g, 96, rows, "reverse", 21) + D.thread_across(g, ys, [(at[0x1001926], at[0x1001926] + ROW)]) + wn = [r[0] for r in D.window(sp["dis"], step)] + win["disasm"] = (col[1], at[wn[0]], D.CW, sp["dis"] * ROW) + # C: memory, the registers, a loupe, the stack continued + D.put(col[2]) + mem = C.fields(g, 96, ph(14), "the heap, round what the step reads", 0x1004000, 512, + D.heap_fields(0x1004000, 512, 0x1004098), D.MEM, HEAP, D.region, marks=(9,) if step else (), + title="memory") + win["view"] = (col[2], mem[0x1004050 if subject else 0x1004070], D.CW, (7 if subject else 5) * ROW) + C.registers(g, 476, D.regs(step), D.FLAGS, {"rax": {0: "tick"}, "rcx": {0: "tick"}, + "rdi": {0: "strike" if step else "tick"}}) + win["registers"] = (col[2], 476, D.CW, ph(17)) + y = 476 + ph(17) + 12 + if loupe: + lys = D.loupe(g, col[2], y, [("rdi", DIM), (" → ", FAINT), ("1004070", HEAP)], "heap · struct node, 16 bytes", + 0x1004030, D.heap_fields(0x1004030, 144), [(0x1004070 - 0x1004030, 16)], 0) + win["loupe"] = (col[2], lys[0x1004050], D.CW, 5 * ROW) + y += ph(9) + 12 + n_c = (1784 - y - TAG - 2 * PAD) // ROW + # D: the stack, 16 words above rsp and on; what does not fit continues at C's foot, then `more` + D.put(col[3]) + C.stack(g, 96, slot_rows(0, 69), frames_from(0, 69), note="from rsp-80", rsp=RSP, roles=roles_from(0, 69)) + win["stack"] = (col[3], 96 + TAG + PAD + UNDER * ROW, D.CW, sp["words"] * ROW) + D.put(col[2]) + C.stack(g, y, slot_rows(69, n_c - 1), frames_from(69, n_c - 1), note="continued", rsp=RSP, + roles=roles_from(69, n_c - 1)) + left = (0x7ffffffff000 - (RSP + 8 * (69 + n_c - 1 - UNDER))) // 8 + g.rect(col[2] + 2, y + ph(n_c - 1) - 2, D.CW - 4, 2, PAGE) # one row longer: the `more` row is the panel's + g.frame(col[2], y, D.CW, ph(n_c), RULE, 2) + yy = y + TAG + PAD + (n_c - 1) * ROW + C.more(g, col[2] + 184 - 6, yy) + g.t(col[2] + 184 + 66, b(yy), "%d words, to the stack's top" % left, S, FAINT, MONO) + # the windows the working frame shows: an outline round each, 4 out + for x, y0, w, h in win.values(): + g.frame(x - 4, y0 - 4, w + 8, h + 8, DIM, 2) + return win + + +def key(g, x, y, step): + """The map's key, at the foot of a column it leaves: what this is, and its marks.""" + y0 = C.panel(g, x, y, D.CW, 5, "the map", note="targets/list · moment %d of 4" % (3 if step else 2)) + g.t(x + 12, b(y0), "every panel whole; the working frame's windows outlined", 18, DIM, "sans") + items = [("current", lambda xx, yy: C.current_row(g, xx, yy, 120, 24)), ("struck", lambda xx, yy: C.struck(g, xx, yy, 60)), + ("read", lambda xx, yy: g.frame(xx, yy, 60, ROW, READ, 2)), ("held", lambda xx, yy: C.held(g, xx + 8, yy, 40)), + ("window", lambda xx, yy: g.frame(xx, yy, 60, ROW, DIM, 2))] + for i, (name, draw) in enumerate(items): + xx, yy = x + 12 + (i % 3) * 290, y0 + (1 + i // 3) * ROW + 8 + draw(xx, yy) + g.t(xx + 136, b(yy), name, 18, DIM, "sans") + + +# ---- the minimap ------------------------------------------------------------------------------------------- +INKED = {GOLD, C.SOFT, VERM, C.WASH, RAISED, D.LIFT, D.LIFT_TAG, READ} + + +def minimap(g, log, windows, x0, y0, k=K, focus="drawing"): + """The map at k: every run of text a stroke 1 high in its ink at 45% toward the page; tags, paper and the + lift as blocks; the marks over them; the working frame's windows outlined, the one in focus 2.""" + W, H = 3840 * k, 2160 * k + g.rect(x0, y0, W, H, PAGE) + marks = [] + for e in log: + if e[0] == "r": + _, x, y, w, h, fill, stroke = e + if fill in (GOLD, C.SOFT, VERM) or stroke in (READ, VERM, BRIGHT): + marks.append(e) + elif fill in INKED and w * k >= 1: + g.rect(x0 + x * k, y0 + y * k, max(w * k, 1), max(h * k, 1), mix(fill, PAGE, 0.7 if fill == RAISED else 0.6)) + elif stroke in (RULE, DIM) and w > 200: + g.frame(x0 + x * k, y0 + y * k, w * k, h * k, mix(RULE, PAGE, 0.8), 1) + elif e[2] < 2100 and e[5] not in (None, "none"): + _, x, y, w, size, fill = e + g.rect(x0 + x * k, y0 + (y - size * 0.62) * k, max(w * k, 0.8), max(size * 0.05, 0.9), mix(fill, PAGE, 0.55)) + for _, x, y, w, h, fill, stroke in marks: # the marks: gold, a strike, a read; at least a pixel and a half + ink = fill if fill in (GOLD, C.SOFT, VERM) else stroke + if ink == C.SOFT: + ink = VERM + if ink == BRIGHT: + continue + g.rect(x0 + x * k, y0 + y * k, max(w * k, 1.5), max(h * k, 1.5), ink) + for name, (x, y, w, h) in windows.items(): + g.frame(x0 + (x - 4) * k, y0 + (y - 4) * k, (w + 8) * k, (h + 8) * k, BRIGHT if name == focus else VELLUM, + 1.5 if name == focus else 1) + g.frame(x0, y0, W, H, RULE, 1) + + +def map_log(step, loupe, subject=False): + stage(True) + m = Rec() + win = draw_map(m, step, loupe, subject) + return m, win + + +# ---- the working frame ------------------------------------------------------------------------------------- +BESIDE_VIEW = [7, 8, 9, 10, 11] # the view's rows (of the heap's 32): 1004070 to 10040b0 +SUBJECT_VIEW = [5, 6, 7, 8, 9, 10, 11] + + +def clock(g, moment, total): + g.rect(64, 899, 1792, 2, RULE) + g.rect(64, 898, 1792 * moment / total, 4, GOLD) + g.t(MINI[0] - 16, 934, "moment %d of %d" % (moment, total), S, FAINT, MONO, "end") + + +def working_panels(g, step, subject, wrap=lambda name: ("", "")): + """The working frame's panels, each between the strings wrap(name) gives (a transform, for the dive).""" + stage(False) + sp = C.SUBJECT if subject else C.BESIDE + out = {} + + def open_(name): + o, c = wrap(name) + g.o.append(o) if o else None + return c + + y = 48 + sp["band"] + 12 + c = open_("source") + D.put(64) + ys = C.source(g, y, sp["src"], D.SRC, 18 if subject else 19, 21, [], "list.c", 42) + g.o.append(c) if c else None + c = open_("disasm") + at = C.disasm(g, y + ph(sp["src"]) + 12, D.window(sp["dis"], step), "reverse", 21) + g.o.append(c) if c else None + out["thread"] = (ys, at[0x1001926]) + yr = 48 + sp["view"] + 12 + c = open_("registers") + D.put(976) + out["regs"] = C.registers(g, yr, D.regs(step), D.FLAGS, {"rax": {0: "tick"}, "rcx": {0: "tick"}, + "rdi": {0: "strike" if step else "tick"}}) + g.o.append(c) if c else None + c = open_("stack") + n = sp["words"] + C.stack(g, yr + ph(17) + 12, slot_rows(UNDER, n), frames_from(UNDER, n), rsp=RSP, roles=roles_from(UNDER, n)) + g.o.append(c) if c else None + c = open_("view") + view = C.fields(g, 48, sp["view"], "the heap, %x to %x" % (0x1004000 + 16 * (SUBJECT_VIEW if subject else BESIDE_VIEW)[0], + 0x10040bf), 0x1004000, 512, D.heap_fields(0x1004000, 512, 0x1004098), D.MEM, HEAP, D.region, + marks=(9,) if step else (), rows_shown=SUBJECT_VIEW if subject else BESIDE_VIEW, more_rows=False) + g.o.append(c) if c else None + out["view"] = view + return out, sp + + +def working(name, step, subject=False, loupe=False, caption=None): + """A working frame at 1920 by 1080, with its minimap.""" + m, win = map_log(step, loupe, subject) + stage(False) + g = Svg() + out, sp = working_panels(g, step, subject) + D.put(64) + C.thread(g, out["thread"][0], [(out["thread"][1], out["thread"][1] + ROW)]) + D.put(64) + C.RX = 976 + C.lens(g, 48, sp["band"], sp["view"], D.NODES, pins(step), node_marks(step), 0x1004000, 32, + link_from=(out["regs"]["rdi"], "rdi") if step and not loupe else None, subject=subject, view_rows=out["view"], + ties=not loupe) + if loupe: # opened under its pointer, rdi's new value: the heap round 1004070 + ry = out["regs"]["rdi"] + hop = 976 + 72 + lx, ly = 956, ry + ROW - 1 # it hangs from its pointer: its tag on the row's foot, the rows under rdi covered whole + D.loupe(g, lx, ly, [("rdi", DIM), (" → ", FAINT), ("1004070", HEAP)], "heap · struct node, 16 bytes", + 0x1004050, D.heap_fields(0x1004050, 80), [(0x1004070 - 0x1004050, 16)], 1, rows=5) + g.rect(hop - 2, ry + ROW - 3, 7 * A + 4, 4, HEAP) # the stem, short: a bracket under the pointer's digits, on the tag + minimap(g, m.log, win, *MINI[:2], focus="loupe" if loupe else "drawing") + clock(g, 3 if step else 2, 4) + gen.caption(g, caption) + g.save(name) + + +# ---- the dive: the map coming in to the working frame, four instants ------------------------------------- +def glide(t): + """The glide curve (0.45, 0, 0.55, 1), solved for t.""" + lo, hi = 0.0, 1.0 + for _ in range(40): + s = (lo + hi) / 2 + x = 3 * (1 - s) ** 2 * s * 0.45 + 3 * (1 - s) * s * s * 0.55 + s ** 3 + lo, hi = (s, hi) if x < t else (lo, s) + return 3 * (1 - s) * s * s + s ** 3 + + +FRAME_RECT = {"source": (64, 212, 880, ph(8)), "disasm": (64, 448, 880, ph(17)), "registers": (976, 212, 880, ph(17)), + "stack": (976, 664, 880, ph(8)), "view": (976, 48, 880, 152), "drawing": (64, 48, 880, 152)} + + +def dive(name, e, veil, outline, fade_frame): + """One instant of `dive`: e, the move's progress (glide applied), veil on the map, the windows' outline, how + far the working frame's own tags and minimap have come in.""" + m, win = map_log(False, False) + body = m.o[1:] # the map's drawing, its page and all, without its svg head + stage(False) + g = Svg() + sm = 0.5 ** (1 - e) * K ** e # the map: from filling the frame to the minimap, on the log of its scale + tx, ty = MINI[0] * e, MINI[1] * e + g.o.append('' % (tx, ty, sm)) + g.o += body + if veil: + g.o.append('' % (PAGE, veil)) + for x, y, w, h in win.values(): + if outline: + g.o.append('' + % (x - 4, y - 4, w + 8, h + 8, BRIGHT, 2 + outline * 2)) + g.o.append("") + # each window: the working panel, from its place on the map to its own, its scale on a logarithm + map_rect = {"source": win["source"], "disasm": win["disasm"], "registers": win["registers"], "stack": win["stack"], + "view": win["view"], "drawing": win["drawing"]} + + def wrap(nm): + if nm not in FRAME_RECT: + return "", "" + fx, fy, fw, fh = FRAME_RECT[nm] + mx, my, mw, mh = map_rect[nm] + # at e = 0 the panel's first row lies on its window's first row on the map, both at half size; at e = 1 + # the panel is at its own place and size. Scale on its logarithm, the offset with the move. + row0 = fy if nm in ("registers", "drawing") else fy + TAG + PAD + sw = 0.5 ** (1 - e) + ox, oy = (mx - fx) * 0.5 * (1 - e), (my - row0) * 0.5 * (1 - e) + return '' % (ox, oy, sw), "" + + if e > 0: + working_panels(g, False, False, wrap) + o, c = wrap("drawing") + g.o.append(o) + D.put(64) + C.RX = 976 + C.lens(g, 48, 152, 152, D.NODES, pins(False), node_marks(False), 0x1004000, 32, view_rows={0x1004090: 0}, + ties=False) + g.o.append(c) + if fade_frame > 0: + g.o.append('' % fade_frame) + minimap(g, m.log, win, *MINI[:2]) + clock(g, 2, 4) + g.o.append("") + gen.caption(g, [[("Stopped in ",), ("reverse", "mono"), (", about to load ",), ("head->next", "mono"), (".",)], + [("rdi", "mono"), (" points at a node; the word after its value is the next node.",)]]) + g.save(name) + + +def sheet(names, out, labels): + """Four 1920 by 1080 instants on one 3840 by 2160 sheet, each at its own size.""" + tiles = [] + for n in names: + subprocess.run(["resvg", n + ".svg", n + ".png"], check=True) + tiles.append(Image.open(n + ".png").convert("RGB")) + s = Image.new("RGB", (3840, 2160), "#000000") + font = ImageFont.truetype("/usr/share/fonts/TTF/JetBrainsMonoNL-Medium.ttf", 28) + d = ImageDraw.Draw(s) + for i, (t, lab) in enumerate(zip(tiles, labels)): + x, y = (i % 2) * 1920, (i // 2) * 1080 + s.paste(t, (x, y)) + d.rectangle((x + 8, y + 8, x + 8 + 18 * len(lab), y + 48), fill="#000000") + d.text((x + 16, y + 12), lab, font=font, fill="#fff8e8") + s.save(out) + + +if __name__ == "__main__": + import os + stage(True) + g = Rec() + draw_map(g, True, True) + D.clock4(g, 3, 4) + D.caption4(g, [[("The map: this moment of ",), ("targets/list", "mono"), (", every panel whole.",)], + [("The working frame's windows are outlined; a scene comes in from here.",)]]) + g.save("19-map") + cap9 = [[("Stopped in ",), ("reverse", "mono"), (", about to load ",), ("head->next", "mono"), (".",)], + [("rdi", "mono"), (" points at a node; the word after its value is the next node.",)]] + cap10 = [[("The load read the word at ",), ("1004098", "mono"), (": the address of the next node.",)], + [("rdi", "mono"), (" holds it now, and points at the node whose value is 9.",)]] + working("09-context", False, caption=cap9) + working("10-context-step", True, caption=cap10) + working("11-context-lens", True, subject=True, caption=cap10) + working("21-loupe", True, loupe=True, + caption=[[("rdi", "mono"), (" holds ",), ("1004070", "mono"), ("; under it opens the heap round that node.",)], + [("The minimap shows the same loupe at its place on the map.",)]]) + names = ["20a", "20b", "20c", "20d"] + dive("20a", 0, 0, 0, 0) + dive("20b", 0, 0.5, 1, 0) + dive("20c", glide(0.5), 0.5, 1, 0) + dive("20d", 1, 0.5, 0, 1) + sheet(names, "20-dive.png", ["frame 0: the map", "frame 24: windows bright, the rest veiled", + "frame 60: halfway", "frame 96: the working frame"]) + for n in names: + os.remove(n + ".svg") + os.remove(n + ".png") -- cgit v1.3