mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-09-22 17:20:05 +00:00
Compare commits
261
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c05ceedfcb | ||
|
|
5e093a9b4c | ||
|
|
08bc2b0a79 | ||
|
|
4ebc38d9f9 | ||
|
|
5e2c6b5107 | ||
|
|
7584890edd | ||
|
|
4bbf64de7e | ||
|
|
e10bef9d2b | ||
|
|
1229a50c68 | ||
|
|
6e2353d302 | ||
|
|
3d272a598b | ||
|
|
dbdf6e7c02 | ||
|
|
0904de74de | ||
|
|
e3077cf6f5 | ||
|
|
9ad52d25b5 | ||
|
|
c2ddffd424 | ||
|
|
7d351d03c5 | ||
|
|
2e12b1485a | ||
|
|
653eb08d43 | ||
|
|
9be3c2affc | ||
|
|
6fa8af5e1a | ||
|
|
010d5609c6 | ||
|
|
d12c5ec2e8 | ||
|
|
c10ac170a8 | ||
|
|
7a185f9560 | ||
|
|
0d581694e6 | ||
|
|
b4b8f5f0ab | ||
|
|
15d42027e7 | ||
|
|
883aa2d1de | ||
|
|
586b3e3072 | ||
|
|
2588bbcd12 | ||
|
|
0a5cc5df6f | ||
|
|
ff32449ba2 | ||
|
|
614954b7ef | ||
|
|
31c671e3f5 | ||
|
|
6d75d6b63b | ||
|
|
4d2b524400 | ||
|
|
16863b1f5a | ||
|
|
f9abb397f3 | ||
|
|
db5a7d4be2 | ||
|
|
6ac870dac0 | ||
|
|
5f23820f9d | ||
|
|
fc77844452 | ||
|
|
3b27abd5c7 | ||
|
|
ce1f54a931 | ||
|
|
c60d3aab22 | ||
|
|
b76c605eba | ||
|
|
6eef8c3e16 | ||
|
|
b5b5aca691 | ||
|
|
435877824a | ||
|
|
3327d73373 | ||
|
|
376a7c48a5 | ||
|
|
f6eec680bc | ||
|
|
41fd224956 | ||
|
|
c794d896c9 | ||
|
|
1a8b39ad9d | ||
|
|
a8891b3ca4 | ||
|
|
ada1b8dfe2 | ||
|
|
9461e79268 | ||
|
|
4fc5b61676 | ||
|
|
6cc1dfb39a | ||
|
|
d44f098e84 | ||
|
|
749821dd27 | ||
|
|
6ad94978ce | ||
|
|
bc5d0b1888 | ||
|
|
3c2c98b08a | ||
|
|
31d7be8f8a | ||
|
|
0b3e3228d1 | ||
|
|
794f212501 | ||
|
|
723c7c5d4d | ||
|
|
fb9824dc24 | ||
|
|
933b4c90de | ||
|
|
5349838633 | ||
|
|
f655758060 | ||
|
|
fa4d0bc262 | ||
|
|
3c39a88abf | ||
|
|
fb6689a74d | ||
|
|
a5e29f65f6 | ||
|
|
b6f50cc4be | ||
|
|
b47b22bdce | ||
|
|
41e99bd2f6 | ||
|
|
2c7d15de59 | ||
|
|
bf2d5640fa | ||
|
|
1880eca295 | ||
|
|
59a20a5574 | ||
|
|
852ff5f054 | ||
|
|
ac3d7be4de | ||
|
|
07b56a920c | ||
|
|
1cc829512f | ||
|
|
dafbe32e85 | ||
|
|
2419a00b11 | ||
|
|
6e9b2bd107 | ||
|
|
123232ab32 | ||
|
|
1dbc37fe1f | ||
|
|
4c10967cec | ||
|
|
e543abd478 | ||
|
|
3b94fa55fb | ||
|
|
3b6d8cb761 | ||
|
|
a73cde2864 | ||
|
|
fe12f2fdf9 | ||
|
|
c80555c49d | ||
|
|
a3f411ddd4 | ||
|
|
084cabad39 | ||
|
|
64d7bae845 | ||
|
|
93d5bab41c | ||
|
|
772bc37504 | ||
|
|
2ff0abb91e | ||
|
|
b05cfa4b24 | ||
|
|
379885421e | ||
|
|
809a888ce7 | ||
|
|
9dadd3ed3c | ||
|
|
d0d1e7d7e6 | ||
|
|
10ead2f999 | ||
|
|
550e8a0451 | ||
|
|
7495096e05 | ||
|
|
7e85335f3b | ||
|
|
3ad6197b88 | ||
|
|
81b45f1a2f | ||
|
|
44868c0e85 | ||
|
|
f7ce1b73bc | ||
|
|
a4a0452d0c | ||
|
|
45090de3fb | ||
|
|
6824ffddc0 | ||
|
|
dc34cdb59a | ||
|
|
98290ff29b | ||
|
|
5a24649a31 | ||
|
|
97a96cfdd4 | ||
|
|
e25c3044b0 | ||
|
|
af80e1bfc8 | ||
|
|
6488e2d5e2 | ||
|
|
649932cce0 | ||
|
|
dd5cc89483 | ||
|
|
8a6837c553 | ||
|
|
a009473557 | ||
|
|
c18c02a37e | ||
|
|
c61f820aef | ||
|
|
5c8c1a89e3 | ||
|
|
61630f4cf9 | ||
|
|
21b439e7e5 | ||
|
|
4888f90f7f | ||
|
|
6f92fe971a | ||
|
|
cfd2380caa | ||
|
|
07d56ee27c | ||
|
|
334bd3b06f | ||
|
|
a14a2f34f5 | ||
|
|
9dcb5a209a | ||
|
|
300b14ffb4 | ||
|
|
8c63478d9b | ||
|
|
8f03fb0cc5 | ||
|
|
b48fcea28a | ||
|
|
431884dce8 | ||
|
|
d931aed462 | ||
|
|
2c4c9e9d75 | ||
|
|
11978904e1 | ||
|
|
8d99f4859b | ||
|
|
6e84c078a8 | ||
|
|
14034c8bea | ||
|
|
0a88e08dee | ||
|
|
c04a97f991 | ||
|
|
0b35224cf8 | ||
|
|
3f50169fee | ||
|
|
ebd5cf9e47 | ||
|
|
f7e67a80c9 | ||
|
|
063975693d | ||
|
|
44fbbc24ee | ||
|
|
fcb839b788 | ||
|
|
139d00e660 | ||
|
|
41afe1af64 | ||
|
|
3927d333ae | ||
|
|
8438faca06 | ||
|
|
061abb4545 | ||
|
|
011c980646 | ||
|
|
26626c3946 | ||
|
|
281849b4e8 | ||
|
|
d3f7bef2b7 | ||
|
|
ab5259a3d3 | ||
|
|
57da328c2a | ||
|
|
ebc19ded62 | ||
|
|
aff3da8256 | ||
|
|
c1764cee07 | ||
|
|
cc58703185 | ||
|
|
6a57555882 | ||
|
|
cdf0b67354 | ||
|
|
45f69b6f98 | ||
|
|
47df50b6dc | ||
|
|
f50b54cff7 | ||
|
|
8492693df2 | ||
|
|
652a9b5cee | ||
|
|
7f87f89aa8 | ||
|
|
92b3356526 | ||
|
|
98486f0795 | ||
|
|
729a5a9392 | ||
|
|
ffa802f583 | ||
|
|
b192e38d12 | ||
|
|
3c0831ec09 | ||
|
|
02e1b8cf00 | ||
|
|
448baf68a8 | ||
|
|
82c1badcdc | ||
|
|
01a21af955 | ||
|
|
a8b02f9791 | ||
|
|
2c9a6f996d | ||
|
|
d66bbdc6a7 | ||
|
|
de56231f4a | ||
|
|
35c1c463c8 | ||
|
|
59e71eb5cc | ||
|
|
d3adfdeced | ||
|
|
ed8731c093 | ||
|
|
6d4b4b1526 | ||
|
|
9fbcd1ec36 | ||
|
|
da54fd1217 | ||
|
|
34bba95839 | ||
|
|
89fd718a8c | ||
|
|
89c8f84498 | ||
|
|
c426818364 | ||
|
|
62fa397e29 | ||
|
|
0e179f3844 | ||
|
|
f808e8ae29 | ||
|
|
8f446d1f9a | ||
|
|
e073ff3218 | ||
|
|
2512d07c72 | ||
|
|
f65cf5436e | ||
|
|
5778e75d66 | ||
|
|
08750c2318 | ||
|
|
9a5a3b9296 | ||
|
|
cab8bdaf38 | ||
|
|
afb7aba039 | ||
|
|
0750570081 | ||
|
|
86a9934016 | ||
|
|
f14686c6fb | ||
|
|
e80008cb7e | ||
|
|
68d3f17ecb | ||
|
|
e541fce2bc | ||
|
|
6a32c197fa | ||
|
|
eea3c6b53c | ||
|
|
d2f9bdeefb | ||
|
|
c767f03f32 | ||
|
|
db737941d8 | ||
|
|
8319850666 | ||
|
|
d04ee598b2 | ||
|
|
15f5894c60 | ||
|
|
05c751a61a | ||
|
|
dd7cce2c3a | ||
|
|
b1e1752229 | ||
|
|
bddc9c97d9 | ||
|
|
325474fc49 | ||
|
|
50d401e4ce | ||
|
|
1dbbd351d7 | ||
|
|
1161c4adbb | ||
|
|
320a307e90 | ||
|
|
f835158071 | ||
|
|
f214b7d5f2 | ||
|
|
d716159faf | ||
|
|
5074b7f62e | ||
|
|
fd982d38fc | ||
|
|
7e0611e7f1 | ||
|
|
fd7085b690 | ||
|
|
5f76fcfb6b | ||
|
|
9e778b30b6 | ||
|
|
15a1f81545 | ||
|
|
f7ad44a0d7 | ||
|
|
9349ac9e72 |
@@ -21,10 +21,10 @@ jobs:
|
||||
run: |
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
call build raddbg msvc debug || exit /b 1
|
||||
call build raddbgi_from_pdb msvc debug || exit /b 1
|
||||
call build raddbgi_from_dwarf msvc debug || exit /b 1
|
||||
call build raddbgi_dump msvc debug || exit /b 1
|
||||
call build rdi_from_pdb msvc debug || exit /b 1
|
||||
call build rdi_from_dwarf msvc debug || exit /b 1
|
||||
call build rdi_dump msvc debug || exit /b 1
|
||||
call build raddbg clang debug || exit /b 1
|
||||
call build raddbgi_from_pdb clang debug || exit /b 1
|
||||
call build raddbgi_from_dwarf clang debug || exit /b 1
|
||||
call build raddbgi_dump clang debug || exit /b 1
|
||||
call build rdi_from_pdb clang debug || exit /b 1
|
||||
call build rdi_from_dwarf clang debug || exit /b 1
|
||||
call build rdi_dump clang debug || exit /b 1
|
||||
|
||||
@@ -34,6 +34,7 @@ if "%release%"=="1" set debug=0 && echo [release mode]
|
||||
if "%msvc%"=="1" set clang=0 && echo [msvc compile]
|
||||
if "%clang%"=="1" set msvc=0 && echo [clang compile]
|
||||
if "%~1"=="" echo [default mode, assuming `raddbg` build] && set raddbg=1
|
||||
if "%~1"=="release" if "%~2"=="" echo [default mode, assuming `raddbg` build] && set raddbg=1
|
||||
|
||||
:: --- Unpack Command Line Build Arguments ------------------------------------
|
||||
set auto_compile_flags=
|
||||
@@ -42,8 +43,8 @@ if "%asan%"=="1" set auto_compile_flags=%auto_compile_flags% -fsanitize=add
|
||||
|
||||
:: --- Compile/Link Line Definitions ------------------------------------------
|
||||
set cl_common= /I..\src\ /I..\local\ /nologo /FC /Z7
|
||||
set clang_common= -I..\src\ -I..\local\ -gcodeview -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf
|
||||
set cl_debug= call cl /Od /DBUILD_DEBUG=1 %cl_common% %auto_compile_flags%
|
||||
set clang_common= -I..\src\ -I..\local\ -gcodeview -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf
|
||||
set cl_debug= call cl /Od /Ob1 /DBUILD_DEBUG=1 %cl_common% %auto_compile_flags%
|
||||
set cl_release= call cl /O2 /DBUILD_DEBUG=0 %cl_common% %auto_compile_flags%
|
||||
set clang_debug= call clang -g -O0 -DBUILD_DEBUG=1 %clang_common% %auto_compile_flags%
|
||||
set clang_release= call clang -g -O2 -DBUILD_DEBUG=0 %clang_common% %auto_compile_flags%
|
||||
@@ -59,9 +60,9 @@ if "%clang%"=="1" set only_compile=-c
|
||||
if "%msvc%"=="1" set EHsc=/EHsc
|
||||
if "%clang%"=="1" set EHsc=
|
||||
if "%msvc%"=="1" set no_aslr=/DYNAMICBASE:NO
|
||||
if "%clang%"=="1" set no_aslr=
|
||||
if "%msvc%"=="1" set rc=rc.exe
|
||||
if "%clang%"=="1" set rc=llvm-rc.exe
|
||||
if "%clang%"=="1" set no_aslr=-Wl,/DYNAMICBASE:NO
|
||||
if "%msvc%"=="1" set rc=call rc
|
||||
if "%clang%"=="1" set rc=call llvm-rc
|
||||
|
||||
:: --- Choose Compile/Link Lines ----------------------------------------------
|
||||
if "%msvc%"=="1" set compile_debug=%cl_debug%
|
||||
@@ -98,18 +99,19 @@ if not "%no_meta%"=="1" (
|
||||
|
||||
:: --- Build Everything (@build_targets) --------------------------------------
|
||||
pushd build
|
||||
if "%raddbg%"=="1" %compile% %gfx% ..\src\raddbg\raddbg_main.cpp %compile_link% %out%raddbg.exe || exit /b 1
|
||||
if "%rdi_from_pdb%"=="1" %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 1
|
||||
if "%rdi_from_dwarf%"=="1" %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
|
||||
if "%rdi_dump%"=="1" %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
|
||||
if "%rdi_breakpad_from_pdb%"=="1" %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
||||
if "%ryan_scratch%"=="1" %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
|
||||
if "%cpp_tests%"=="1" %compile% ..\src\scratch\i_hate_c_plus_plus.cpp %compile_link% %out%cpp_tests.exe || exit /b 1
|
||||
if "%look_at_raddbg%"=="1" %compile% ..\src\scratch\look_at_raddbg.c %compile_link% %out%look_at_raddbg.exe || exit /b 1
|
||||
if "%mule_main%"=="1" del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
||||
if "%mule_module%"=="1" %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
|
||||
if "%mule_hotload%"=="1" %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
|
||||
if "%raddbg%"=="1" set didbuild=1 && %compile% ..\src\raddbg\raddbg_main.c %compile_link% %out%raddbg.exe || exit /b 1
|
||||
if "%rdi_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_pdb\rdi_from_pdb_main.c %compile_link% %out%rdi_from_pdb.exe || exit /b 1
|
||||
if "%rdi_from_dwarf%"=="1" set didbuild=1 && %compile% ..\src\rdi_from_dwarf\rdi_from_dwarf.c %compile_link% %out%rdi_from_dwarf.exe || exit /b 1
|
||||
if "%rdi_dump%"=="1" set didbuild=1 && %compile% ..\src\rdi_dump\rdi_dump_main.c %compile_link% %out%rdi_dump.exe || exit /b 1
|
||||
if "%rdi_breakpad_from_pdb%"=="1" set didbuild=1 && %compile% ..\src\rdi_breakpad_from_pdb\rdi_breakpad_from_pdb_main.c %compile_link% %out%rdi_breakpad_from_pdb.exe || exit /b 1
|
||||
if "%ryan_scratch%"=="1" set didbuild=1 && %compile% ..\src\scratch\ryan_scratch.c %compile_link% %out%ryan_scratch.exe || exit /b 1
|
||||
if "%cpp_tests%"=="1" set didbuild=1 && %compile% ..\src\scratch\i_hate_c_plus_plus.cpp %compile_link% %out%cpp_tests.exe || exit /b 1
|
||||
if "%look_at_raddbg%"=="1" set didbuild=1 && %compile% ..\src\scratch\look_at_raddbg.c %compile_link% %out%look_at_raddbg.exe || exit /b 1
|
||||
if "%mule_main%"=="1" set didbuild=1 && del vc*.pdb mule*.pdb && %compile_release% %only_compile% ..\src\mule\mule_inline.cpp && %compile_release% %only_compile% ..\src\mule\mule_o2.cpp && %compile_debug% %EHsc% ..\src\mule\mule_main.cpp ..\src\mule\mule_c.c mule_inline.obj mule_o2.obj %compile_link% %no_aslr% %out%mule_main.exe || exit /b 1
|
||||
if "%mule_module%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
|
||||
if "%mule_hotload%"=="1" set didbuild=1 && %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
|
||||
if "%mule_peb_trample%"=="1" (
|
||||
set didbuild=1
|
||||
if exist mule_peb_trample.exe move mule_peb_trample.exe mule_peb_trample_old_%random%.exe
|
||||
if exist mule_peb_trample_new.pdb move mule_peb_trample_new.pdb mule_peb_trample_old_%random%.pdb
|
||||
if exist mule_peb_trample_new.rdi move mule_peb_trample_new.rdi mule_peb_trample_old_%random%.rdi
|
||||
@@ -126,3 +128,10 @@ set compile_link=
|
||||
set out=
|
||||
set msvc=
|
||||
set debug=
|
||||
set release=
|
||||
|
||||
:: --- Warn On No Builds ------------------------------------------------------
|
||||
if "%didbuild%"=="" (
|
||||
echo [WARNING] no valid build target specified; must use build target names as arguments to this script, like `build raddbg` or `build rdi_from_pdb`.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
+4
-3
@@ -47,6 +47,7 @@ commands =
|
||||
{
|
||||
.rjf_f1 =
|
||||
{
|
||||
//.win = "build rdi_from_pdb rdi_dump && pushd build && rdi_from_pdb --pdb:mule_main.pdb --out:mule_main.rdi && rdi_dump mule_main.rdi > mule_main.dump && popd",
|
||||
.win = "build raddbg telemetry",
|
||||
.linux = "",
|
||||
.out = "*compilation*",
|
||||
@@ -56,7 +57,7 @@ commands =
|
||||
},
|
||||
.rjf_f2 =
|
||||
{
|
||||
.win = "build mule_peb_trample",
|
||||
.win = "build rdi_from_pdb rdi_dump && pushd build && rdi_from_pdb --pdb:mule_main.pdb --out:mule_main.rdi && rdi_dump mule_main.rdi > mule_main.dump && popd",
|
||||
.linux = "",
|
||||
.out = "*compilation*",
|
||||
.footer_panel = true,
|
||||
@@ -65,7 +66,7 @@ commands =
|
||||
},
|
||||
.rjf_f3 =
|
||||
{
|
||||
.win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --profile:local_dev.raddbg_profile && popd",
|
||||
.win = "pushd build && raddbg.exe --user:local_dev.raddbg_user --project:local_dev.raddbg_project && popd",
|
||||
.linux = "",
|
||||
.out = "*compilation*",
|
||||
.footer_panel = true,
|
||||
@@ -74,7 +75,7 @@ commands =
|
||||
},
|
||||
.rjf_f4 =
|
||||
{
|
||||
.win = "build rdi_from_pdb release telemetry && pushd build && rdi_from_pdb.exe --exe:UnrealEditorFortnite.exe --pdb:UnrealEditorFortnite.pdb --out:UnrealEditorFortnite.rdi --capture && popd",
|
||||
.win = "build rdi_from_pdb release telemetry && pushd build && rdi_from_pdb.exe --pdb:UnrealEditorFortnite.pdb --out:profile.rdi --capture && popd",
|
||||
.linux = "",
|
||||
.out = "*compilation*",
|
||||
.footer_panel = true,
|
||||
|
||||
@@ -779,4 +779,9 @@ internal U64 ring_read(U8 *ring_base, U64 ring_size, U64 ring_pos, void *dst_dat
|
||||
#define ring_write_struct(ring_base, ring_size, ring_pos, ptr) ring_write((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
|
||||
#define ring_read_struct(ring_base, ring_size, ring_pos, ptr) ring_read((ring_base), (ring_size), (ring_pos), (ptr), sizeof(*(ptr)))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Sorts
|
||||
|
||||
#define quick_sort(ptr, count, element_size, cmp_function) qsort((ptr), (count), (element_size), (int (*)(const void *, const void *))(cmp_function))
|
||||
|
||||
#endif // BASE_CORE_H
|
||||
|
||||
@@ -33,6 +33,9 @@ main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **argum
|
||||
#if defined(TEXT_CACHE_H) && !defined(TXT_INIT_MANUAL)
|
||||
txt_init();
|
||||
#endif
|
||||
#if defined(MUTABLE_TEXT_H) && !defined(MTX_INIT_MANUAL)
|
||||
mtx_init();
|
||||
#endif
|
||||
#if defined(DASM_CACHE_H) && !defined(DASM_INIT_MANUAL)
|
||||
dasm_init();
|
||||
#endif
|
||||
@@ -42,9 +45,6 @@ main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **argum
|
||||
#if defined(FUZZY_SEARCH_H) && !defined(FZY_INIT_MANUAL)
|
||||
fzy_init();
|
||||
#endif
|
||||
#if defined(TXTI_H) && !defined(TXTI_INIT_MANUAL)
|
||||
txti_init();
|
||||
#endif
|
||||
#if defined(DEMON_CORE_H) && !defined(DMN_INIT_MANUAL)
|
||||
dmn_init();
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -90,7 +90,10 @@ log_scope_end(Arena *arena)
|
||||
{
|
||||
for(EachEnumVal(LogMsgKind, kind))
|
||||
{
|
||||
result.strings[kind] = str8_list_join(arena, &scope->strings[kind], 0);
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8 result_unindented = str8_list_join(scratch.arena, &scope->strings[kind], 0);
|
||||
result.strings[kind] = indented_from_string(arena, result_unindented);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
arena_pop_to(log_active->arena, scope->pos);
|
||||
|
||||
@@ -53,6 +53,9 @@ internal void log_msgf(LogMsgKind kind, char *fmt, ...);
|
||||
#define log_user_error(s) log_msg(LogMsgKind_UserError, (s))
|
||||
#define log_user_errorf(fmt, ...) log_msgf(LogMsgKind_UserError, (fmt), __VA_ARGS__)
|
||||
|
||||
#define LogInfoNamedBlock(s) DeferLoop(log_infof("%S:\n{\n", (s)), log_infof("}\n"))
|
||||
#define LogInfoNamedBlockF(fmt, ...) DeferLoop((log_infof(fmt, __VA_ARGS__), log_infof(":\n{\n")), log_infof("}\n"))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Log Scopes
|
||||
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
internal void
|
||||
thread_name(String8 string)
|
||||
set_thread_name(String8 string)
|
||||
{
|
||||
ProfThreadName("%.*s", str8_varg(string));
|
||||
os_set_thread_name(string);
|
||||
}
|
||||
|
||||
internal void
|
||||
thread_namef(char *fmt, ...)
|
||||
set_thread_namef(char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 string = push_str8fv(scratch.arena, fmt, args);
|
||||
thread_name(string);
|
||||
set_thread_name(string);
|
||||
va_end(args);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#ifndef BASE_MARKUP_H
|
||||
#define BASE_MARKUP_H
|
||||
|
||||
internal void thread_name(String8 string);
|
||||
internal void thread_namef(char *fmt, ...);
|
||||
#define ThreadNameF(...) (ProfThreadName(__VA_ARGS__), thread_namef(__VA_ARGS__))
|
||||
#define ThreadName(str) (ProfThreadName("%.*s", str8_varg(str)), thread_name(str))
|
||||
internal void set_thread_name(String8 string);
|
||||
internal void set_thread_namef(char *fmt, ...);
|
||||
#define ThreadNameF(...) (set_thread_namef(__VA_ARGS__))
|
||||
#define ThreadName(str) (set_thread_name(str))
|
||||
|
||||
#endif // BASE_MARKUP_H
|
||||
|
||||
+42
-4
@@ -946,11 +946,11 @@ str8_array_from_list(Arena *arena, String8List *list)
|
||||
{
|
||||
String8Array array;
|
||||
array.count = list->node_count;
|
||||
array.strings = push_array_no_zero(arena, String8, array.count);
|
||||
array.v = push_array_no_zero(arena, String8, array.count);
|
||||
U64 idx = 0;
|
||||
for(String8Node *n = list->first; n != 0; n = n->next, idx += 1)
|
||||
{
|
||||
array.strings[idx] = n->string;
|
||||
array.v[idx] = n->string;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@@ -960,7 +960,7 @@ str8_array_reserve(Arena *arena, U64 count)
|
||||
{
|
||||
String8Array arr;
|
||||
arr.count = 0;
|
||||
arr.strings = push_array(arena, String8, count);
|
||||
arr.v = push_array(arena, String8, count);
|
||||
return arr;
|
||||
}
|
||||
|
||||
@@ -1566,7 +1566,45 @@ string_from_elapsed_time(Arena *arena, DateTime dt){
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Textual String Wrapping
|
||||
//~ rjf: Basic Text Indentation
|
||||
|
||||
internal String8
|
||||
indented_from_string(Arena *arena, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
read_only local_persist U8 indentation_bytes[] = " ";
|
||||
String8List indented_strings = {0};
|
||||
S64 depth = 0;
|
||||
S64 next_depth = 0;
|
||||
U64 line_begin_off = 0;
|
||||
for(U64 off = 0; off <= string.size; off += 1)
|
||||
{
|
||||
U8 byte = off<string.size ? string.str[off] : 0;
|
||||
switch(byte)
|
||||
{
|
||||
default:{}break;
|
||||
case '{':case '[':case '(':{next_depth += 1; next_depth = Max(0, next_depth);}break;
|
||||
case '}':case ']':case ')':{next_depth -= 1; next_depth = Max(0, next_depth); depth = next_depth;}break;
|
||||
case '\n':
|
||||
case 0:
|
||||
{
|
||||
String8 line = str8_skip_chop_whitespace(str8_substr(string, r1u64(line_begin_off, off)));
|
||||
if(line.size != 0)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &indented_strings, "%.*s%S\n", (int)depth*2, indentation_bytes, line);
|
||||
}
|
||||
line_begin_off = off+1;
|
||||
depth = next_depth;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
String8 result = str8_list_join(arena, &indented_strings, 0);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Text Wrapping
|
||||
|
||||
internal String8List
|
||||
wrapped_lines_from_string(Arena *arena, String8 string, U64 first_line_max_width, U64 max_width, U64 wrap_indent)
|
||||
|
||||
@@ -63,7 +63,7 @@ struct String8List
|
||||
typedef struct String8Array String8Array;
|
||||
struct String8Array
|
||||
{
|
||||
String8 *strings;
|
||||
String8 *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
@@ -327,7 +327,12 @@ internal String8 push_file_name_date_time_string(Arena *arena, DateTime *date_ti
|
||||
internal String8 string_from_elapsed_time(Arena *arena, DateTime dt);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Textual String Wrapping
|
||||
//~ rjf: Basic Text Indentation
|
||||
|
||||
internal String8 indented_from_string(Arena *arena, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Text Wrapping
|
||||
|
||||
internal String8List wrapped_lines_from_string(Arena *arena, String8 string, U64 first_line_max_width, U64 max_width, U64 wrap_indent);
|
||||
|
||||
|
||||
+324
-193
@@ -7,21 +7,44 @@
|
||||
#include "generated/codeview.meta.c"
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView Common Functions
|
||||
//~ CodeView Common Decoding Helper Functions
|
||||
|
||||
internal U64
|
||||
cv_hash_from_string(String8 string)
|
||||
{
|
||||
U64 result = 5381;
|
||||
for(U64 i = 0; i < string.size; i += 1)
|
||||
{
|
||||
result = ((result << 5) + result) + string.str[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
cv_hash_from_item_id(CV_ItemId item_id)
|
||||
{
|
||||
U64 result = cv_hash_from_string(str8_struct(&item_id));
|
||||
return result;
|
||||
}
|
||||
|
||||
internal CV_NumericParsed
|
||||
cv_numeric_from_data_range(U8 *first, U8 *opl){
|
||||
cv_numeric_from_data_range(U8 *first, U8 *opl)
|
||||
{
|
||||
CV_NumericParsed result = {0};
|
||||
if (first + 2 <= opl){
|
||||
if(first + 2 <= opl)
|
||||
{
|
||||
U16 x = *(U16*)first;
|
||||
if (x < 0x8000){
|
||||
if(x < 0x8000)
|
||||
{
|
||||
result.kind = CV_NumericKind_USHORT;
|
||||
result.val = first;
|
||||
result.encoded_size = 2;
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
U64 val_size = 0;
|
||||
switch (x){
|
||||
switch(x)
|
||||
{
|
||||
case CV_NumericKind_CHAR: val_size = 1; break;
|
||||
case CV_NumericKind_SHORT:
|
||||
case CV_NumericKind_USHORT: val_size = 2; break;
|
||||
@@ -46,21 +69,23 @@ cv_numeric_from_data_range(U8 *first, U8 *opl){
|
||||
case CV_NumericKind_UTF8STRING:val_size = 0; break; // TODO: ???
|
||||
case CV_NumericKind_FLOAT16: val_size = 2; break;
|
||||
}
|
||||
|
||||
if (first + 2 + val_size <= opl){
|
||||
if(first + 2 + val_size <= opl)
|
||||
{
|
||||
result.kind = x;
|
||||
result.val = (first + 2);
|
||||
result.encoded_size = 2 + val_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal B32
|
||||
cv_numeric_fits_in_u64(CV_NumericParsed *num){
|
||||
cv_numeric_fits_in_u64(CV_NumericParsed *num)
|
||||
{
|
||||
B32 result = 0;
|
||||
switch (num->kind){
|
||||
switch(num->kind)
|
||||
{
|
||||
case CV_NumericKind_USHORT:
|
||||
case CV_NumericKind_ULONG:
|
||||
case CV_NumericKind_UQUADWORD:
|
||||
@@ -68,13 +93,15 @@ cv_numeric_fits_in_u64(CV_NumericParsed *num){
|
||||
result = 1;
|
||||
}break;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal B32
|
||||
cv_numeric_fits_in_s64(CV_NumericParsed *num){
|
||||
cv_numeric_fits_in_s64(CV_NumericParsed *num)
|
||||
{
|
||||
B32 result = 0;
|
||||
switch (num->kind){
|
||||
switch(num->kind)
|
||||
{
|
||||
case CV_NumericKind_CHAR:
|
||||
case CV_NumericKind_SHORT:
|
||||
case CV_NumericKind_LONG:
|
||||
@@ -83,111 +110,170 @@ cv_numeric_fits_in_s64(CV_NumericParsed *num){
|
||||
result = 1;
|
||||
}break;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal B32
|
||||
cv_numeric_fits_in_f64(CV_NumericParsed *num){
|
||||
cv_numeric_fits_in_f64(CV_NumericParsed *num)
|
||||
{
|
||||
B32 result = 0;
|
||||
switch (num->kind){
|
||||
switch(num->kind)
|
||||
{
|
||||
case CV_NumericKind_FLOAT32:
|
||||
case CV_NumericKind_FLOAT64:
|
||||
{
|
||||
result = 1;
|
||||
}break;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
cv_u64_from_numeric(CV_NumericParsed *num){
|
||||
cv_u64_from_numeric(CV_NumericParsed *num)
|
||||
{
|
||||
U64 result = 0;
|
||||
switch (num->kind){
|
||||
case CV_NumericKind_USHORT:
|
||||
switch(num->kind)
|
||||
{
|
||||
result = *(U16*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_ULONG:
|
||||
{
|
||||
result = *(U32*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_UQUADWORD:
|
||||
{
|
||||
result = *(U64*)num->val;
|
||||
}break;
|
||||
case CV_NumericKind_USHORT: {result = *(U16*)num->val;}break;
|
||||
case CV_NumericKind_ULONG: {result = *(U32*)num->val;}break;
|
||||
case CV_NumericKind_UQUADWORD:{result = *(U64*)num->val;}break;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal S64
|
||||
cv_s64_from_numeric(CV_NumericParsed *num){
|
||||
cv_s64_from_numeric(CV_NumericParsed *num)
|
||||
{
|
||||
S64 result = 0;
|
||||
switch (num->kind){
|
||||
case CV_NumericKind_CHAR:
|
||||
switch(num->kind)
|
||||
{
|
||||
result = *(S8*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_SHORT:
|
||||
{
|
||||
result = *(S16*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_LONG:
|
||||
{
|
||||
result = *(S32*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_QUADWORD:
|
||||
{
|
||||
result = *(S64*)num->val;
|
||||
}break;
|
||||
case CV_NumericKind_CHAR: {result = *(S8*)num->val;}break;
|
||||
case CV_NumericKind_SHORT: {result = *(S16*)num->val;}break;
|
||||
case CV_NumericKind_LONG: {result = *(S32*)num->val;}break;
|
||||
case CV_NumericKind_QUADWORD: {result = *(S64*)num->val;}break;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal F64
|
||||
cv_f64_from_numeric(CV_NumericParsed *num){
|
||||
cv_f64_from_numeric(CV_NumericParsed *num)
|
||||
{
|
||||
F64 result = 0;
|
||||
switch (num->kind){
|
||||
case CV_NumericKind_FLOAT32:
|
||||
switch(num->kind)
|
||||
{
|
||||
result = *(F32*)num->val;
|
||||
}break;
|
||||
|
||||
case CV_NumericKind_FLOAT64:
|
||||
{
|
||||
result = *(F64*)num->val;
|
||||
}break;
|
||||
case CV_NumericKind_FLOAT32:{result = *(F32*)num->val;}break;
|
||||
case CV_NumericKind_FLOAT64:{result = *(F64*)num->val;}break;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal U64
|
||||
cv_decode_inline_annot_u32(String8 data, U64 offset, U32 *out_value)
|
||||
{
|
||||
U64 cursor = offset;
|
||||
|
||||
// rjf: read header
|
||||
U8 header = 0;
|
||||
cursor += str8_deserial_read_struct(data, cursor, &header);
|
||||
|
||||
// rjf: decode value
|
||||
U32 value = 0;
|
||||
{
|
||||
// 1 byte
|
||||
if((header & 0x80) == 0)
|
||||
{
|
||||
value = header;
|
||||
}
|
||||
|
||||
// 2 bytes
|
||||
else if((header & 0xC0) == 0x80 && cursor+2 <= data.size)
|
||||
{
|
||||
U8 second_byte;
|
||||
cursor += str8_deserial_read_struct(data, cursor, &second_byte);
|
||||
value = ((header & 0x3F) << 8) | second_byte;
|
||||
}
|
||||
|
||||
// 4 bytes
|
||||
else if((header & 0xE0) == 0xC0 && cursor+3 <= data.size)
|
||||
{
|
||||
U8 second_byte, third_byte, fourth_byte;
|
||||
cursor += str8_deserial_read_struct(data, cursor, &second_byte);
|
||||
cursor += str8_deserial_read_struct(data, cursor, &third_byte);
|
||||
cursor += str8_deserial_read_struct(data, cursor, &fourth_byte);
|
||||
value = (((U32)header & 0x1F) << 24) | ((U32)second_byte << 16) | ((U32)third_byte << 8) | (U32)fourth_byte;
|
||||
}
|
||||
|
||||
// bad encode
|
||||
else if((header & 0xE0) == 0xE0)
|
||||
{
|
||||
value = max_U32;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: output results
|
||||
if(out_value)
|
||||
{
|
||||
*out_value = value;
|
||||
}
|
||||
|
||||
U64 read_size = cursor - offset;
|
||||
return read_size;
|
||||
}
|
||||
|
||||
internal U64
|
||||
cv_decode_inline_annot_s32(String8 data, U64 offset, S32 *out_value)
|
||||
{
|
||||
U32 value;
|
||||
U64 read_size = cv_decode_inline_annot_u32(data, offset, &value);
|
||||
if(value & 1)
|
||||
{
|
||||
value = -(value >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = value >> 1;
|
||||
}
|
||||
*out_value = (S32)value;
|
||||
return read_size;
|
||||
}
|
||||
|
||||
internal S32
|
||||
cv_inline_annot_signed_from_unsigned_operand(U32 value)
|
||||
{
|
||||
if(value & 1)
|
||||
{
|
||||
value = -(value >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = value >> 1;
|
||||
}
|
||||
S32 result = (S32)value;
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView Sym Parser Functions
|
||||
//~ CodeView Parsing Functions
|
||||
|
||||
//- the first pass parser
|
||||
//- rjf: record range stream parsing
|
||||
|
||||
internal CV_RecRangeStream*
|
||||
cv_rec_range_stream_from_data(Arena *arena, String8 sym_data, U64 sym_align){
|
||||
cv_rec_range_stream_from_data(Arena *arena, String8 sym_data, U64 sym_align)
|
||||
{
|
||||
Assert(1 <= sym_align && IsPow2OrZero(sym_align));
|
||||
|
||||
CV_RecRangeStream *result = push_array(arena, CV_RecRangeStream, 1);
|
||||
|
||||
U8 *data = sym_data.str;
|
||||
U64 cursor = 0;
|
||||
U64 cap = sym_data.size;
|
||||
for (;cursor + sizeof(CV_RecHeader) <= cap;){
|
||||
for(;cursor + sizeof(CV_RecHeader) <= cap;)
|
||||
{
|
||||
// setup a new chunk
|
||||
arena_push_align(arena, 64);
|
||||
CV_RecRangeChunk *cur_chunk = cv_rec_range_stream_push_chunk(arena, result);
|
||||
|
||||
CV_RecRangeChunk *cur_chunk = push_array_no_zero(arena, CV_RecRangeChunk, 1);
|
||||
SLLQueuePush(result->first_chunk, result->last_chunk, cur_chunk);
|
||||
U64 partial_count = 0;
|
||||
for (;partial_count < CV_REC_RANGE_CHUNK_SIZE && cursor + sizeof(CV_RecHeader) <= cap;
|
||||
partial_count += 1){
|
||||
for(;partial_count < CV_REC_RANGE_CHUNK_SIZE && cursor + sizeof(CV_RecHeader) <= cap; partial_count += 1)
|
||||
{
|
||||
// compute cap
|
||||
CV_RecHeader *hdr = (CV_RecHeader*)(data + cursor);
|
||||
U64 symbol_cap_unclamped = cursor + 2 + hdr->size;
|
||||
@@ -201,110 +287,110 @@ cv_rec_range_stream_from_data(Arena *arena, String8 sym_data, U64 sym_align){
|
||||
U32 next_pos = AlignPow2(symbol_cap, sym_align);
|
||||
cursor = next_pos;
|
||||
}
|
||||
|
||||
result->total_count += partial_count;
|
||||
}
|
||||
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
//- sym
|
||||
internal CV_RecRangeArray
|
||||
cv_rec_range_array_from_stream(Arena *arena, CV_RecRangeStream *stream)
|
||||
{
|
||||
U64 total_count = stream->total_count;
|
||||
CV_RecRange *ranges = push_array_no_zero(arena, CV_RecRange, total_count);
|
||||
U64 idx = 0;
|
||||
for(CV_RecRangeChunk *chunk = stream->first_chunk; chunk != 0; chunk = chunk->next)
|
||||
{
|
||||
U64 copy_count_raw = total_count - idx;
|
||||
U64 copy_count = ClampTop(copy_count_raw, CV_REC_RANGE_CHUNK_SIZE);
|
||||
MemoryCopy(ranges + idx, chunk->ranges, copy_count*sizeof(CV_RecRange));
|
||||
idx += copy_count;
|
||||
}
|
||||
CV_RecRangeArray result = {0};
|
||||
result.ranges = ranges;
|
||||
result.count = total_count;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal CV_SymParsed*
|
||||
cv_sym_from_data(Arena *arena, String8 sym_data, U64 sym_align){
|
||||
//- rjf: sym stream parsing
|
||||
|
||||
internal CV_SymParsed *
|
||||
cv_sym_from_data(Arena *arena, String8 sym_data, U64 sym_align)
|
||||
{
|
||||
Assert(1 <= sym_align && IsPow2OrZero(sym_align));
|
||||
ProfBegin("cv_sym_from_data");
|
||||
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
// gather up symbols
|
||||
//- rjf: gather symbols
|
||||
CV_RecRangeStream *stream = cv_rec_range_stream_from_data(scratch.arena, sym_data, sym_align);
|
||||
|
||||
// convert to result
|
||||
//- rjf: convert to result, fill basics
|
||||
CV_SymParsed *result = push_array(arena, CV_SymParsed, 1);
|
||||
result->data = sym_data;
|
||||
result->sym_align = sym_align;
|
||||
result->sym_ranges = cv_rec_range_array_from_stream(arena, stream);
|
||||
cv_sym_top_level_info_from_syms(arena, sym_data, &result->sym_ranges, &result->info);
|
||||
|
||||
scratch_end(scratch);
|
||||
|
||||
ProfEnd();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal void
|
||||
cv_sym_top_level_info_from_syms(Arena *arena, String8 sym_data,
|
||||
CV_RecRangeArray *ranges,
|
||||
CV_SymTopLevelInfo *info_out){
|
||||
MemoryZeroStruct(info_out);
|
||||
|
||||
CV_RecRange *range = ranges->ranges;
|
||||
CV_RecRange *opl = range + ranges->count;
|
||||
for (; range < opl; range += 1){
|
||||
//- rjf: extract top-level-info
|
||||
{
|
||||
CV_RecRange *range = result->sym_ranges.ranges;
|
||||
CV_RecRange *opl = range + result->sym_ranges.count;
|
||||
for(;range < opl; range += 1)
|
||||
{
|
||||
U8 *first = sym_data.str + range->off + 2;
|
||||
U64 cap = range->hdr.size - 2;
|
||||
|
||||
switch (range->hdr.kind){
|
||||
switch(range->hdr.kind)
|
||||
{
|
||||
case CV_SymKind_COMPILE:
|
||||
if(sizeof(CV_SymCompile) <= cap)
|
||||
{
|
||||
if (sizeof(CV_SymCompile) <= cap){
|
||||
CV_SymCompile *compile = (CV_SymCompile*)first;
|
||||
|
||||
String8 ver_str = str8_cstring_capped((char*)(compile + 1), (char *)(first + cap));
|
||||
|
||||
info_out->arch = compile->machine;
|
||||
info_out->language = CV_CompileFlags_ExtractLanguage(compile->flags);;
|
||||
info_out->compiler_name = ver_str;
|
||||
}
|
||||
result->info.arch = compile->machine;
|
||||
result->info.language = CV_CompileFlags_ExtractLanguage(compile->flags);;
|
||||
result->info.compiler_name = ver_str;
|
||||
}break;
|
||||
|
||||
case CV_SymKind_COMPILE2:
|
||||
if(sizeof(CV_SymCompile2) <= cap)
|
||||
{
|
||||
if (sizeof(CV_SymCompile2) <= cap){
|
||||
CV_SymCompile2 *compile2 = (CV_SymCompile2*)first;
|
||||
|
||||
String8 ver_str = str8_cstring_capped((char*)(compile2 + 1), (char*)(first + cap));
|
||||
String8 compiler_name = push_str8f(arena, "%.*s %u.%u.%u",
|
||||
str8_varg(ver_str),
|
||||
compile2->ver_major,
|
||||
compile2->ver_minor,
|
||||
compile2->ver_build);
|
||||
|
||||
info_out->arch = compile2->machine;
|
||||
info_out->language = CV_Compile2Flags_ExtractLanguage(compile2->flags);;
|
||||
info_out->compiler_name = compiler_name;
|
||||
}
|
||||
result->info.arch = compile2->machine;
|
||||
result->info.language = CV_Compile2Flags_ExtractLanguage(compile2->flags);;
|
||||
result->info.compiler_name = compiler_name;
|
||||
}break;
|
||||
|
||||
case CV_SymKind_COMPILE3:
|
||||
if(sizeof(CV_SymCompile3) <= cap)
|
||||
{
|
||||
if (sizeof(CV_SymCompile3) <= cap){
|
||||
CV_SymCompile3 *compile3 = (CV_SymCompile3*)first;
|
||||
|
||||
String8 ver_str = str8_cstring_capped((char*)(compile3 + 1), (char *)(first + cap));
|
||||
String8 compiler_name = push_str8f(arena, "%.*s %u.%u.%u",
|
||||
str8_varg(ver_str),
|
||||
compile3->ver_major,
|
||||
compile3->ver_minor,
|
||||
compile3->ver_build);
|
||||
|
||||
info_out->arch = compile3->machine;
|
||||
info_out->language = CV_Compile3Flags_ExtractLanguage(compile3->flags);;
|
||||
info_out->compiler_name = compiler_name;
|
||||
}
|
||||
result->info.arch = compile3->machine;
|
||||
result->info.language = CV_Compile3Flags_ExtractLanguage(compile3->flags);;
|
||||
result->info.compiler_name = compiler_name;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
//- leaf
|
||||
|
||||
internal CV_LeafParsed*
|
||||
cv_leaf_from_data(Arena *arena, String8 leaf_data, CV_TypeId itype_first){
|
||||
ProfBegin("cv_leaf_from_data");
|
||||
//- rjf: leaf stream parsing
|
||||
|
||||
internal CV_LeafParsed *
|
||||
cv_leaf_from_data(Arena *arena, String8 leaf_data, CV_TypeId itype_first)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
// gather up symbols
|
||||
@@ -318,57 +404,31 @@ cv_leaf_from_data(Arena *arena, String8 leaf_data, CV_TypeId itype_first){
|
||||
result->leaf_ranges = cv_rec_range_array_from_stream(arena, stream);
|
||||
|
||||
scratch_end(scratch);
|
||||
|
||||
ProfEnd();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
//- range streams
|
||||
|
||||
internal CV_RecRangeChunk*
|
||||
cv_rec_range_stream_push_chunk(Arena *arena, CV_RecRangeStream *stream){
|
||||
CV_RecRangeChunk *result = push_array_no_zero(arena, CV_RecRangeChunk, 1);
|
||||
SLLQueuePush(stream->first_chunk, stream->last_chunk, result);
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal CV_RecRangeArray
|
||||
cv_rec_range_array_from_stream(Arena *arena, CV_RecRangeStream *stream){
|
||||
U64 total_count = stream->total_count;
|
||||
CV_RecRange *ranges = push_array_no_zero(arena, CV_RecRange, total_count);
|
||||
U64 idx = 0;
|
||||
for (CV_RecRangeChunk *chunk = stream->first_chunk;
|
||||
chunk != 0;
|
||||
chunk = chunk->next){
|
||||
U64 copy_count_raw = total_count - idx;
|
||||
U64 copy_count = ClampTop(copy_count_raw, CV_REC_RANGE_CHUNK_SIZE);
|
||||
MemoryCopy(ranges + idx, chunk->ranges, copy_count*sizeof(CV_RecRange));
|
||||
idx += copy_count;
|
||||
}
|
||||
CV_RecRangeArray result = {0};
|
||||
result.ranges = ranges;
|
||||
result.count = total_count;
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView C13 Parser Functions
|
||||
|
||||
internal CV_C13Parsed*
|
||||
cv_c13_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSectionArray *sections){
|
||||
ProfBegin("cv_c13_from_data");
|
||||
internal CV_C13Parsed *
|
||||
cv_c13_parsed_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSectionArray *sections)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
// gather c13 data
|
||||
//////////////////////////////
|
||||
//- rjf: gather c13 sub-sections
|
||||
//
|
||||
CV_C13SubSectionNode *file_chksms = 0;
|
||||
CV_C13SubSectionNode *first = 0;
|
||||
CV_C13SubSectionNode *last = 0;
|
||||
U64 count = 0;
|
||||
{
|
||||
U32 cursor = 0;
|
||||
for (; cursor + sizeof(CV_C13_SubSectionHeader) <= c13_data.size;){
|
||||
for(; cursor + sizeof(CV_C13SubSectionHeader) <= c13_data.size;)
|
||||
{
|
||||
// read header
|
||||
CV_C13_SubSectionHeader *hdr = (CV_C13_SubSectionHeader*)(c13_data.str + cursor);
|
||||
CV_C13SubSectionHeader *hdr = (CV_C13SubSectionHeader*)(c13_data.str + cursor);
|
||||
|
||||
// get sub section info
|
||||
U32 sub_section_off = cursor + sizeof(*hdr);
|
||||
@@ -378,15 +438,16 @@ cv_c13_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSec
|
||||
U32 sub_section_size = after_sub_section_off - sub_section_off;
|
||||
|
||||
// emit sub section
|
||||
if (!(hdr->kind & CV_C13_SubSectionKind_IgnoreFlag)){
|
||||
if(!(hdr->kind & CV_C13SubSectionKind_IgnoreFlag))
|
||||
{
|
||||
CV_C13SubSectionNode *node = push_array(arena, CV_C13SubSectionNode, 1);
|
||||
SLLQueuePush(first, last, node);
|
||||
count += 1;
|
||||
node->kind = hdr->kind;
|
||||
node->off = sub_section_off;
|
||||
node->size = sub_section_size;
|
||||
|
||||
if (hdr->kind == CV_C13_SubSectionKind_FileChksms){
|
||||
if(hdr->kind == CV_C13SubSectionKind_FileChksms)
|
||||
{
|
||||
file_chksms = node;
|
||||
}
|
||||
}
|
||||
@@ -396,26 +457,36 @@ cv_c13_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSec
|
||||
}
|
||||
}
|
||||
|
||||
// parse each section
|
||||
for (CV_C13SubSectionNode *node = first;
|
||||
//////////////////////////////
|
||||
//- rjf: parse each sub-section
|
||||
//
|
||||
U64 inlinee_lines_parsed_slots_count = 4096;
|
||||
CV_C13InlineeLinesParsedNode **inlinee_lines_parsed_slots = push_array(arena, CV_C13InlineeLinesParsedNode *, inlinee_lines_parsed_slots_count);
|
||||
for(CV_C13SubSectionNode *node = first;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
node = node->next)
|
||||
{
|
||||
U8 *first = c13_data.str + node->off;
|
||||
U32 cap = node->size;
|
||||
switch(node->kind)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
switch (node->kind){
|
||||
case CV_C13_SubSectionKind_Lines:
|
||||
//////////////////////////
|
||||
//- rjf: line info sub-section
|
||||
//
|
||||
case CV_C13SubSectionKind_Lines:
|
||||
if(sizeof(CV_C13SubSecLinesHeader) <= cap)
|
||||
{
|
||||
// read header
|
||||
if (sizeof(CV_C13_SubSecLinesHeader) <= cap){
|
||||
U32 read_off = 0;
|
||||
U64 read_off_opl = node->size;
|
||||
CV_C13_SubSecLinesHeader *hdr = (CV_C13_SubSecLinesHeader*)(first + read_off);
|
||||
CV_C13SubSecLinesHeader *hdr = (CV_C13SubSecLinesHeader*)(first + read_off);
|
||||
read_off += sizeof(*hdr);
|
||||
|
||||
// extract top level info
|
||||
U32 sec_idx = hdr->sec;
|
||||
B32 has_cols = !!(hdr->flags & CV_C13_SubSecLinesFlag_HasColumns);
|
||||
B32 has_cols = !!(hdr->flags & CV_C13SubSecLinesFlag_HasColumns);
|
||||
U64 secrel_off = hdr->sec_off;
|
||||
U64 secrel_opl = secrel_off + hdr->len;
|
||||
U64 sec_base_off = sections->sections[sec_idx - 1].voff;
|
||||
@@ -427,48 +498,49 @@ cv_c13_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSec
|
||||
}
|
||||
|
||||
// read files
|
||||
for(;read_off+sizeof(CV_C13_File) <= read_off_opl;)
|
||||
for(;read_off+sizeof(CV_C13File) <= read_off_opl;)
|
||||
{
|
||||
// rjf: grab next file header
|
||||
CV_C13_File *file = (CV_C13_File*)(first + read_off);
|
||||
CV_C13File *file = (CV_C13File*)(first + read_off);
|
||||
U32 file_off = file->file_off;
|
||||
U32 line_count_unclamped = file->num_lines;
|
||||
U32 block_size = file->block_size;
|
||||
|
||||
// file_name from file_off
|
||||
String8 file_name = {0};
|
||||
if (file_off + sizeof(CV_C13_Checksum) <= file_chksms->size){
|
||||
CV_C13_Checksum *checksum = (CV_C13_Checksum*)(c13_data.str + file_chksms->off + file_off);
|
||||
if(file_off + sizeof(CV_C13Checksum) <= file_chksms->size)
|
||||
{
|
||||
CV_C13Checksum *checksum = (CV_C13Checksum*)(c13_data.str + file_chksms->off + file_off);
|
||||
U32 name_off = checksum->name_off;
|
||||
file_name = pdb_strtbl_string_from_off(strtbl, name_off);
|
||||
}
|
||||
|
||||
// array layouts
|
||||
U32 line_item_size = sizeof(CV_C13_Line);
|
||||
U32 line_item_size = sizeof(CV_C13Line);
|
||||
if (has_cols){
|
||||
line_item_size += sizeof(CV_C13_Column);
|
||||
line_item_size += sizeof(CV_C13Column);
|
||||
}
|
||||
|
||||
U32 line_array_off = read_off + sizeof(*file);
|
||||
U32 line_count_max = (read_off_opl - line_array_off) / line_item_size;
|
||||
U32 line_count = ClampTop(line_count_unclamped, line_count_max);
|
||||
|
||||
U32 col_array_off = line_array_off + line_count*sizeof(CV_C13_Line);
|
||||
U32 col_array_off = line_array_off + line_count*sizeof(CV_C13Line);
|
||||
|
||||
// parse lines
|
||||
U64 *voffs = push_array_no_zero(arena, U64, line_count + 1);
|
||||
U32 *line_nums = push_array_no_zero(arena, U32, line_count);
|
||||
|
||||
{
|
||||
CV_C13_Line *line_ptr = (CV_C13_Line*)(first + line_array_off);
|
||||
CV_C13_Line *line_opl = line_ptr + line_count;
|
||||
CV_C13Line *line_ptr = (CV_C13Line*)(first + line_array_off);
|
||||
CV_C13Line *line_opl = line_ptr + line_count;
|
||||
|
||||
// TODO(allen): check order correctness here
|
||||
|
||||
U32 i = 0;
|
||||
for (; line_ptr < line_opl; line_ptr += 1, i += 1){
|
||||
voffs[i] = line_ptr->off + secrel_off + sec_base_off;
|
||||
line_nums[i] = CV_C13_LineFlags_ExtractLineNumber(line_ptr->flags);
|
||||
line_nums[i] = CV_C13LineFlags_ExtractLineNumber(line_ptr->flags);
|
||||
}
|
||||
voffs[i] = secrel_opl + sec_base_off;
|
||||
}
|
||||
@@ -489,19 +561,78 @@ cv_c13_from_data(Arena *arena, String8 c13_data, PDB_Strtbl *strtbl, PDB_CoffSec
|
||||
read_off += sizeof(*file);
|
||||
read_off += line_item_size*line_count;
|
||||
}
|
||||
}break;
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: inlinee line info sub-section
|
||||
//
|
||||
case CV_C13SubSectionKind_InlineeLines:
|
||||
if(sizeof(CV_C13InlineeLinesSig) <= cap)
|
||||
{
|
||||
// rjf: read sig
|
||||
U32 read_off = 0;
|
||||
U64 read_off_opl = node->size;
|
||||
CV_C13InlineeLinesSig *sig = (CV_C13InlineeLinesSig *)(first + read_off);
|
||||
read_off += sizeof(*sig);
|
||||
|
||||
// rjf: read source lines
|
||||
for(;read_off + sizeof(CV_C13InlineeSourceLineHeader) <= read_off_opl;)
|
||||
{
|
||||
// rjf: read next header
|
||||
CV_C13InlineeSourceLineHeader *hdr = (CV_C13InlineeSourceLineHeader *)(first + read_off);
|
||||
read_off += sizeof(*hdr);
|
||||
|
||||
// rjf: file_off -> file_name
|
||||
String8 file_name = {0};
|
||||
if(hdr->file_off + sizeof(CV_C13Checksum) <= file_chksms->size)
|
||||
{
|
||||
CV_C13Checksum *checksum = (CV_C13Checksum*)(c13_data.str + file_chksms->off + hdr->file_off);
|
||||
U32 name_off = checksum->name_off;
|
||||
file_name = pdb_strtbl_string_from_off(strtbl, name_off);
|
||||
}
|
||||
|
||||
// rjf: parse extra files
|
||||
U32 extra_file_count = 0;
|
||||
U32 *extra_files = 0;
|
||||
if(*sig == CV_C13InlineeLinesSig_EXTRA_FILES && read_off+sizeof(U32) <= read_off_opl)
|
||||
{
|
||||
U32 *extra_file_count_ptr = (U32 *)(first + read_off);
|
||||
read_off += sizeof(*extra_file_count_ptr);
|
||||
U32 max_extra_file_count = (read_off_opl-read_off)/sizeof(U32);
|
||||
extra_file_count = Min(*extra_file_count_ptr, max_extra_file_count);
|
||||
extra_files = (U32 *)(first + read_off);
|
||||
read_off += sizeof(*extra_files)*extra_file_count;
|
||||
}
|
||||
|
||||
// rjf: push node for this inlinee lines parsed into this subsection's list
|
||||
CV_C13InlineeLinesParsedNode *n = push_array(arena, CV_C13InlineeLinesParsedNode, 1);
|
||||
SLLQueuePush(node->inlinee_lines_first, node->inlinee_lines_last, n);
|
||||
n->v.inlinee = hdr->inlinee;
|
||||
n->v.file_name = file_name;
|
||||
n->v.first_source_ln = hdr->first_source_ln;
|
||||
n->v.extra_file_count = extra_file_count;
|
||||
n->v.extra_files = extra_files;
|
||||
|
||||
// rjf: push node into inlinee parse hash table
|
||||
U64 hash = cv_hash_from_item_id(hdr->inlinee);
|
||||
U64 slot_idx = hash%inlinee_lines_parsed_slots_count;
|
||||
SLLStackPush_N(inlinee_lines_parsed_slots[slot_idx], n, hash_next);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
// convert to result
|
||||
//////////////////////////////
|
||||
//- rjf: fill output
|
||||
//
|
||||
CV_C13Parsed *result = push_array(arena, CV_C13Parsed, 1);
|
||||
result->data = c13_data;
|
||||
result->first_sub_section = first;
|
||||
result->last_sub_section = last;
|
||||
result->sub_section_count = count;
|
||||
result->file_chksms_sub_section = file_chksms;
|
||||
|
||||
result->inlinee_lines_parsed_slots = inlinee_lines_parsed_slots;
|
||||
result->inlinee_lines_parsed_slots_count = inlinee_lines_parsed_slots_count;
|
||||
ProfEnd();
|
||||
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
+166
-87
@@ -27,7 +27,7 @@ read_only global CV_TypeId cv_type_id_variadic = 0xFFFFFFFF;
|
||||
////////////////////////////////
|
||||
//~ rjf: Registers
|
||||
|
||||
// X(NAME, CODE, (RDI_RegisterCode_X86) NAME, BYTE_POS, BYTE_SIZE)
|
||||
// X(NAME, CODE, (RDI_RegCode_X86) NAME, BYTE_POS, BYTE_SIZE)
|
||||
#define CV_Reg_X86_XList(X) \
|
||||
X(NONE, 0, nil, 0, 0)\
|
||||
X(AL, 1, eax, 0, 1)\
|
||||
@@ -1152,6 +1152,7 @@ struct CV_SymFrameproc
|
||||
};
|
||||
|
||||
//- (SymKind: ANNOTATION)
|
||||
|
||||
typedef struct CV_SymAnnotation CV_SymAnnotation;
|
||||
struct CV_SymAnnotation
|
||||
{
|
||||
@@ -1761,13 +1762,53 @@ struct CV_SymBuildInfo
|
||||
|
||||
//- (SymKind: INLINESITE)
|
||||
|
||||
typedef U32 CV_InlineBinaryAnnotation;
|
||||
typedef enum CV_InlineBinaryAnnotationEnum
|
||||
{
|
||||
CV_InlineBinaryAnnotation_Null,
|
||||
CV_InlineBinaryAnnotation_CodeOffset,
|
||||
CV_InlineBinaryAnnotation_ChangeCodeOffsetBase,
|
||||
CV_InlineBinaryAnnotation_ChangeCodeOffset,
|
||||
CV_InlineBinaryAnnotation_ChangeCodeLength,
|
||||
CV_InlineBinaryAnnotation_ChangeFile,
|
||||
CV_InlineBinaryAnnotation_ChangeLineOffset,
|
||||
CV_InlineBinaryAnnotation_ChangeLineEndDelta,
|
||||
CV_InlineBinaryAnnotation_ChangeRangeKind,
|
||||
CV_InlineBinaryAnnotation_ChangeColumnStart,
|
||||
CV_InlineBinaryAnnotation_ChangeColumnEndDelta,
|
||||
CV_InlineBinaryAnnotation_ChangeCodeOffsetAndLineOffset,
|
||||
CV_InlineBinaryAnnotation_ChangeCodeLengthAndCodeOffset,
|
||||
CV_InlineBinaryAnnotation_ChangeColumnEnd
|
||||
}
|
||||
CV_InlineBinaryAnnotationEnum;
|
||||
|
||||
typedef U32 CV_InlineRangeKind;
|
||||
typedef enum CV_InlineRangeKindEnum
|
||||
{
|
||||
CV_InlineRangeKind_Expr,
|
||||
CV_InlineRangeKind_Stmt
|
||||
}
|
||||
CV_InlineRangeKindEnum;
|
||||
|
||||
typedef struct CV_SymInlineSite CV_SymInlineSite;
|
||||
struct CV_SymInlineSite
|
||||
{
|
||||
U32 parent;
|
||||
U32 end;
|
||||
CV_ItemId inlinee;
|
||||
// CV_BinaryAnnotation annotations (rest of data)
|
||||
// U8 annotations[] (rest of data)
|
||||
};
|
||||
|
||||
//- (SymKind: INLINESITE2)
|
||||
|
||||
typedef struct CV_SymInlineSite2 CV_SymInlineSite2;
|
||||
struct CV_SymInlineSite2
|
||||
{
|
||||
U32 parent_off;
|
||||
U32 end_off;
|
||||
CV_ItemId inlinee;
|
||||
U32 invocations;
|
||||
// U8 annotations[] (rest of data)
|
||||
};
|
||||
|
||||
//- (SymKind: INLINESITE_END) (empty)
|
||||
@@ -1786,7 +1827,7 @@ struct CV_SymFileStatic
|
||||
//- (SymKind: ARMSWITCHTABLE)
|
||||
|
||||
typedef U16 CV_ArmSwitchKind;
|
||||
typedef enum
|
||||
typedef enum CV_ArmSwitchKindEnum
|
||||
{
|
||||
CV_ArmSwitchKind_INT1,
|
||||
CV_ArmSwitchKind_UINT1,
|
||||
@@ -1799,7 +1840,8 @@ typedef enum
|
||||
CV_ArmSwitchKind_UINT2SHL1,
|
||||
CV_ArmSwitchKind_INT1SSHL1,
|
||||
CV_ArmSwitchKind_INT2SSHL1,
|
||||
} CV_ArmSwitchKindEnum;
|
||||
}
|
||||
CV_ArmSwitchKindEnum;
|
||||
|
||||
typedef struct CV_SymArmSwitchTable CV_SymArmSwitchTable;
|
||||
struct CV_SymArmSwitchTable
|
||||
@@ -1835,18 +1877,6 @@ struct CV_SymPogoInfo
|
||||
U32 post_inline_static_inst_count;
|
||||
};
|
||||
|
||||
//- (SymKind: INLINESITE2)
|
||||
|
||||
typedef struct CV_SymInlineSite2 CV_SymInlineSite2;
|
||||
struct CV_SymInlineSite2
|
||||
{
|
||||
U32 parent_off;
|
||||
U32 end_off;
|
||||
CV_ItemId inlinee;
|
||||
U32 invocations;
|
||||
// CV_BinaryAnnotation annotations (rest of data)
|
||||
};
|
||||
|
||||
//- (SymKind: HEAPALLOCSITE)
|
||||
|
||||
typedef struct CV_SymHeapAllocSite CV_SymHeapAllocSite;
|
||||
@@ -2621,9 +2651,9 @@ struct CV_LeafUDTModSrcLine
|
||||
////////////////////////////////
|
||||
//~ CodeView Format C13 Line Info Types
|
||||
|
||||
#define CV_C13_SubSectionKind_IgnoreFlag 0x80000000
|
||||
#define CV_C13SubSectionKind_IgnoreFlag 0x80000000
|
||||
|
||||
#define CV_C13_SubSectionKindXList(X)\
|
||||
#define CV_C13SubSectionKindXList(X)\
|
||||
X(Symbols, 0xF1)\
|
||||
X(Lines, 0xF2)\
|
||||
X(StringTable, 0xF3)\
|
||||
@@ -2636,83 +2666,87 @@ X(IlLines, 0xF9)\
|
||||
X(FuncMDTokenMap, 0xFA)\
|
||||
X(TypeMDTokenMap, 0xFB)\
|
||||
X(MergedAssemblyInput, 0xFC)\
|
||||
X(CoffSymbolRVA, 0xFD)
|
||||
X(CoffSymbolRVA, 0xFD)\
|
||||
X(XfgHashType, 0xFF)\
|
||||
X(XfgHashVirtual, 0x100)
|
||||
|
||||
typedef U32 CV_C13_SubSectionKind;
|
||||
typedef enum
|
||||
typedef U32 CV_C13SubSectionKind;
|
||||
typedef enum CV_C13SubSectionKindEnum
|
||||
{
|
||||
#define X(N,c) CV_C13_SubSectionKind_##N = c,
|
||||
CV_C13_SubSectionKindXList(X)
|
||||
#define X(N,c) CV_C13SubSectionKind_##N = c,
|
||||
CV_C13SubSectionKindXList(X)
|
||||
#undef X
|
||||
} CV_C13_SubSectionKindEnum;
|
||||
}
|
||||
CV_C13SubSectionKindEnum;
|
||||
|
||||
typedef struct CV_C13_SubSectionHeader CV_C13_SubSectionHeader;
|
||||
struct CV_C13_SubSectionHeader
|
||||
typedef struct CV_C13SubSectionHeader CV_C13SubSectionHeader;
|
||||
struct CV_C13SubSectionHeader
|
||||
{
|
||||
CV_C13_SubSectionKind kind;
|
||||
CV_C13SubSectionKind kind;
|
||||
U32 size;
|
||||
};
|
||||
|
||||
//- FileChksms sub-section
|
||||
|
||||
typedef U8 CV_C13_ChecksumKind;
|
||||
typedef enum
|
||||
typedef U8 CV_C13ChecksumKind;
|
||||
typedef enum CV_C13ChecksumKindEnum
|
||||
{
|
||||
CV_C13_ChecksumKind_Null,
|
||||
CV_C13_ChecksumKind_MD5,
|
||||
CV_C13_ChecksumKind_SHA1,
|
||||
CV_C13_ChecksumKind_SHA256,
|
||||
} CV_C13_ChecksumKindEnum;
|
||||
CV_C13ChecksumKind_Null,
|
||||
CV_C13ChecksumKind_MD5,
|
||||
CV_C13ChecksumKind_SHA1,
|
||||
CV_C13ChecksumKind_SHA256,
|
||||
}
|
||||
CV_C13ChecksumKindEnum;
|
||||
|
||||
typedef struct CV_C13_Checksum CV_C13_Checksum;
|
||||
struct CV_C13_Checksum
|
||||
typedef struct CV_C13Checksum CV_C13Checksum;
|
||||
struct CV_C13Checksum
|
||||
{
|
||||
U32 name_off;
|
||||
U8 len;
|
||||
CV_C13_ChecksumKind kind;
|
||||
CV_C13ChecksumKind kind;
|
||||
};
|
||||
|
||||
//- Lines sub-section
|
||||
|
||||
typedef U16 CV_C13_SubSecLinesFlags;
|
||||
typedef U16 CV_C13SubSecLinesFlags;
|
||||
enum
|
||||
{
|
||||
CV_C13_SubSecLinesFlag_HasColumns = (1 << 0)
|
||||
CV_C13SubSecLinesFlag_HasColumns = (1 << 0)
|
||||
};
|
||||
|
||||
typedef struct CV_C13_SubSecLinesHeader CV_C13_SubSecLinesHeader;
|
||||
struct CV_C13_SubSecLinesHeader
|
||||
typedef struct CV_C13SubSecLinesHeader CV_C13SubSecLinesHeader;
|
||||
struct CV_C13SubSecLinesHeader
|
||||
{
|
||||
U32 sec_off;
|
||||
CV_SectionIndex sec;
|
||||
CV_C13_SubSecLinesFlags flags;
|
||||
CV_C13SubSecLinesFlags flags;
|
||||
U32 len;
|
||||
};
|
||||
|
||||
typedef struct CV_C13_File CV_C13_File;
|
||||
struct CV_C13_File
|
||||
typedef struct CV_C13File CV_C13File;
|
||||
struct CV_C13File
|
||||
{
|
||||
U32 file_off;
|
||||
U32 num_lines;
|
||||
U32 block_size;
|
||||
// CV_C13_Line[num_lines] lines;
|
||||
// CV_C13_Column[num_lines] columns; (if HasColumns)
|
||||
// CV_C13Line[num_lines] lines;
|
||||
// CV_C13Column[num_lines] columns; (if HasColumns)
|
||||
};
|
||||
|
||||
typedef U32 CV_C13_LineFlags;
|
||||
#define CV_C13_LineFlags_ExtractLineNumber(f) ((f)&0xFFFFFF)
|
||||
#define CV_C13_LineFlags_ExtractDeltaToEnd(f) (((f)>>24)&0x7F)
|
||||
#define CV_C13_LineFlags_ExtractStatement(f) (((f)>>31)&0x1)
|
||||
typedef U32 CV_C13LineFlags;
|
||||
#define CV_C13LineFlags_ExtractLineNumber(f) ((f)&0xFFFFFF)
|
||||
#define CV_C13LineFlags_ExtractDeltaToEnd(f) (((f)>>24)&0x7F)
|
||||
#define CV_C13LineFlags_ExtractStatement(f) (((f)>>31)&0x1)
|
||||
|
||||
typedef struct CV_C13_Line CV_C13_Line;
|
||||
struct CV_C13_Line
|
||||
typedef struct CV_C13Line CV_C13Line;
|
||||
struct CV_C13Line
|
||||
{
|
||||
U32 off;
|
||||
CV_C13_LineFlags flags;
|
||||
CV_C13LineFlags flags;
|
||||
};
|
||||
|
||||
typedef struct CV_C13_Column CV_C13_Column;
|
||||
struct CV_C13_Column
|
||||
typedef struct CV_C13Column CV_C13Column;
|
||||
struct CV_C13Column
|
||||
{
|
||||
U16 start;
|
||||
U16 end;
|
||||
@@ -2720,16 +2754,16 @@ struct CV_C13_Column
|
||||
|
||||
//- FrameData sub-section
|
||||
|
||||
typedef U32 CV_C13_FrameDataFlags;
|
||||
typedef U32 CV_C13FrameDataFlags;
|
||||
enum
|
||||
{
|
||||
CV_C13_FrameDataFlag_HasStructuredExceptionHandling = (1 << 0),
|
||||
CV_C13_FrameDataFlag_HasExceptionHandling = (1 << 1),
|
||||
CV_C13_FrameDataFlag_HasIsFuncStart = (1 << 2),
|
||||
CV_C13FrameDataFlag_HasStructuredExceptionHandling = (1 << 0),
|
||||
CV_C13FrameDataFlag_HasExceptionHandling = (1 << 1),
|
||||
CV_C13FrameDataFlag_HasIsFuncStart = (1 << 2),
|
||||
};
|
||||
|
||||
typedef struct CV_C13_FrameData CV_C13_FrameData;
|
||||
struct CV_C13_FrameData
|
||||
typedef struct CV_C13FrameData CV_C13FrameData;
|
||||
struct CV_C13FrameData
|
||||
{
|
||||
U32 start_voff;
|
||||
U32 code_size;
|
||||
@@ -2739,7 +2773,27 @@ struct CV_C13_FrameData
|
||||
U32 frame_func;
|
||||
U16 prolog_size;
|
||||
U16 saved_reg_size;
|
||||
CV_C13_FrameDataFlags flags;
|
||||
CV_C13FrameDataFlags flags;
|
||||
};
|
||||
|
||||
//- InlineLines sub-section
|
||||
|
||||
typedef U32 CV_C13InlineeLinesSig;
|
||||
enum
|
||||
{
|
||||
CV_C13InlineeLinesSig_NORMAL,
|
||||
CV_C13InlineeLinesSig_EXTRA_FILES,
|
||||
};
|
||||
|
||||
typedef struct CV_C13InlineeSourceLineHeader CV_C13InlineeSourceLineHeader;
|
||||
struct CV_C13InlineeSourceLineHeader
|
||||
{
|
||||
CV_ItemId inlinee; // LF_FUNC_ID or LF_MFUNC_ID
|
||||
U32 file_off; // offset into FileChksms sub-section
|
||||
U32 first_source_ln; // base source line number for binary annotations
|
||||
// if sig set to CV_C13InlineeLinesSig_EXTRA_FILES
|
||||
// U32 extra_file_count;
|
||||
// U32 files[];
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
@@ -2817,7 +2871,6 @@ struct CV_SymParsed
|
||||
CV_SymTopLevelInfo info;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView Leaf Parser Types
|
||||
|
||||
@@ -2859,26 +2912,54 @@ struct CV_C13LinesParsedNode
|
||||
CV_C13LinesParsed v;
|
||||
};
|
||||
|
||||
typedef struct CV_C13InlineeLinesParsed CV_C13InlineeLinesParsed;
|
||||
struct CV_C13InlineeLinesParsed
|
||||
{
|
||||
CV_ItemId inlinee;
|
||||
String8 file_name;
|
||||
U32 first_source_ln;
|
||||
U32 extra_file_count;
|
||||
U32 *extra_files;
|
||||
};
|
||||
|
||||
typedef struct CV_C13InlineeLinesParsedNode CV_C13InlineeLinesParsedNode;
|
||||
struct CV_C13InlineeLinesParsedNode
|
||||
{
|
||||
CV_C13InlineeLinesParsedNode *next;
|
||||
CV_C13InlineeLinesParsedNode *hash_next;
|
||||
CV_C13InlineeLinesParsed v;
|
||||
};
|
||||
|
||||
typedef struct CV_C13SubSectionNode CV_C13SubSectionNode;
|
||||
struct CV_C13SubSectionNode
|
||||
{
|
||||
struct CV_C13SubSectionNode *next;
|
||||
CV_C13_SubSectionKind kind;
|
||||
CV_C13SubSectionKind kind;
|
||||
U32 off;
|
||||
U32 size;
|
||||
CV_C13LinesParsedNode *lines_first;
|
||||
CV_C13LinesParsedNode *lines_last;
|
||||
CV_C13InlineeLinesParsedNode *inlinee_lines_first;
|
||||
CV_C13InlineeLinesParsedNode *inlinee_lines_last;
|
||||
};
|
||||
|
||||
typedef struct CV_C13Parsed CV_C13Parsed;
|
||||
struct CV_C13Parsed
|
||||
{
|
||||
// rjf: source data
|
||||
String8 data;
|
||||
|
||||
// rjf: full sub-section list
|
||||
CV_C13SubSectionNode *first_sub_section;
|
||||
CV_C13SubSectionNode *last_sub_section;
|
||||
U64 sub_section_count;
|
||||
|
||||
// accelerator
|
||||
// rjf: fastpath to file checksums section
|
||||
CV_C13SubSectionNode *file_chksms_sub_section;
|
||||
|
||||
// rjf: fastpath to map inlinee CV_ItemId -> CV_InlineeLinesParsed quickly
|
||||
CV_C13InlineeLinesParsedNode **inlinee_lines_parsed_slots;
|
||||
U64 inlinee_lines_parsed_slots_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -2891,9 +2972,11 @@ struct CV_TypeIdArray
|
||||
U64 count;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView Common Functions
|
||||
//~ CodeView Common Decoding Helper Functions
|
||||
|
||||
internal U64 cv_hash_from_string(String8 string);
|
||||
internal U64 cv_hash_from_item_id(CV_ItemId item_id);
|
||||
|
||||
internal CV_NumericParsed cv_numeric_from_data_range(U8 *first, U8 *opl);
|
||||
|
||||
@@ -2905,34 +2988,30 @@ internal U64 cv_u64_from_numeric(CV_NumericParsed *num);
|
||||
internal S64 cv_s64_from_numeric(CV_NumericParsed *num);
|
||||
internal F64 cv_f64_from_numeric(CV_NumericParsed *num);
|
||||
|
||||
internal U64 cv_decode_inline_annot_u32(String8 data, U64 offset, U32 *out_value);
|
||||
internal U64 cv_decode_inline_annot_s32(String8 data, U64 offset, S32 *out_value);
|
||||
|
||||
internal S32 cv_inline_annot_signed_from_unsigned_operand(U32 value);
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView Sym/Leaf Parser Functions
|
||||
//~ CodeView Parsing Functions
|
||||
|
||||
//- the first pass parser
|
||||
internal CV_RecRangeStream* cv_rec_range_stream_from_data(Arena *arena, String8 data, U64 align);
|
||||
|
||||
//- sym
|
||||
internal CV_SymParsed* cv_sym_from_data(Arena *arena, String8 sym_data, U64 sym_align);
|
||||
|
||||
internal void cv_sym_top_level_info_from_syms(Arena *arena, String8 sym_data,
|
||||
CV_RecRangeArray *ranges,
|
||||
CV_SymTopLevelInfo *info_out);
|
||||
|
||||
//- leaf
|
||||
internal CV_LeafParsed* cv_leaf_from_data(Arena *arena, String8 leaf_data, CV_TypeId first);
|
||||
|
||||
//- range streams
|
||||
internal CV_RecRangeChunk* cv_rec_range_stream_push_chunk(Arena *arena,
|
||||
CV_RecRangeStream *stream);
|
||||
// TODO(allen): check why this isn't a pointer return -
|
||||
// leave a note if there's a good reason, otherwise switch to pointer return
|
||||
//- rjf: record range stream parsing
|
||||
internal CV_RecRangeStream *cv_rec_range_stream_from_data(Arena *arena, String8 data, U64 align);
|
||||
internal CV_RecRangeArray cv_rec_range_array_from_stream(Arena *arena, CV_RecRangeStream *stream);
|
||||
|
||||
//- rjf: sym stream parsing
|
||||
internal CV_SymParsed *cv_sym_from_data(Arena *arena, String8 sym_data, U64 sym_align);
|
||||
|
||||
//- rjf: leaf stream parsing
|
||||
internal CV_LeafParsed *cv_leaf_from_data(Arena *arena, String8 leaf_data, CV_TypeId first);
|
||||
|
||||
////////////////////////////////
|
||||
//~ CodeView C13 Parser Functions
|
||||
|
||||
typedef struct PDB_Strtbl PDB_Strtbl;
|
||||
typedef struct PDB_CoffSectionArray PDB_CoffSectionArray;
|
||||
internal CV_C13Parsed* cv_c13_from_data(Arena *arena, String8 c13_data, struct PDB_Strtbl *strtbl, struct PDB_CoffSectionArray *sections);
|
||||
internal CV_C13Parsed *cv_c13_parsed_from_data(Arena *arena, String8 c13_data, struct PDB_Strtbl *strtbl, struct PDB_CoffSectionArray *sections);
|
||||
|
||||
#endif // CODEVIEW_H
|
||||
|
||||
@@ -49,12 +49,12 @@ cv_stringize_lvar_addr_gap_list(Arena *arena, String8List *out, void *first, voi
|
||||
}
|
||||
|
||||
internal String8
|
||||
cv_string_from_c13_sub_section_kind(CV_C13_SubSectionKind kind){
|
||||
cv_string_from_c13_sub_section_kind(CV_C13SubSectionKind kind){
|
||||
String8 result = str8_lit("UNRECOGNIZED_C13_SUB_SECTION_KIND");
|
||||
switch (kind){
|
||||
case 0: str8_lit("PARSE_ERROR"); break;
|
||||
#define X(N,c) case CV_C13_SubSectionKind_##N: result = str8_lit(#N); break;
|
||||
CV_C13_SubSectionKindXList(X)
|
||||
#define X(N,c) case CV_C13SubSectionKind_##N: result = str8_lit(#N); break;
|
||||
CV_C13SubSectionKindXList(X)
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
@@ -2280,7 +2280,7 @@ cv_stringize_c13_parsed(Arena *arena, String8List *out, CV_C13Parsed *c13){
|
||||
|
||||
switch(node->kind)
|
||||
{
|
||||
case CV_C13_SubSectionKind_Lines:
|
||||
case CV_C13SubSectionKind_Lines:
|
||||
{
|
||||
if (node->lines_first == 0)
|
||||
{
|
||||
@@ -2309,12 +2309,12 @@ cv_stringize_c13_parsed(Arena *arena, String8List *out, CV_C13Parsed *c13){
|
||||
}
|
||||
}break;
|
||||
|
||||
case CV_C13_SubSectionKind_FileChksms:
|
||||
case CV_C13SubSectionKind_FileChksms:
|
||||
{
|
||||
str8_list_push(arena, out, str8_lit(" no stringizer path\n"));
|
||||
}break;
|
||||
|
||||
case CV_C13_SubSectionKind_InlineeLines:
|
||||
case CV_C13SubSectionKind_InlineeLines:
|
||||
{
|
||||
str8_list_push(arena, out, str8_lit(" no stringizer path\n"));
|
||||
}break;
|
||||
|
||||
@@ -27,7 +27,7 @@ internal void cv_stringize_lvar_addr_gap_list(Arena *arena, String8List *out,
|
||||
void *first, void *opl);
|
||||
|
||||
internal String8 cv_string_from_basic_type(CV_BasicType basic_type);
|
||||
internal String8 cv_string_from_c13_sub_section_kind(CV_C13_SubSectionKind kind);
|
||||
internal String8 cv_string_from_c13_sub_section_kind(CV_C13SubSectionKind kind);
|
||||
internal String8 cv_string_from_reg(CV_Arch arch, CV_Reg reg);
|
||||
internal String8 cv_string_from_pointer_kind(CV_PointerKind ptr_kind);
|
||||
internal String8 cv_string_from_pointer_mode(CV_PointerMode ptr_mode);
|
||||
|
||||
@@ -701,6 +701,3 @@ case CV_LeafKind_STRUCT2:{result = sizeof(CV_LeafStruct2);}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
C_LINKAGE_BEGIN
|
||||
C_LINKAGE_END
|
||||
|
||||
|
||||
@@ -517,7 +517,4 @@ internal String8 cv_type_name_from_basic_type(CV_BasicType v);
|
||||
internal String8 cv_string_from_leaf_kind(CV_LeafKind v);
|
||||
internal U64 cv_header_struct_size_from_sym_kind(CV_SymKind v);
|
||||
internal U64 cv_header_struct_size_from_leaf_kind(CV_LeafKind v);
|
||||
C_LINKAGE_BEGIN
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // CODEVIEW_META_H
|
||||
|
||||
+272
-117
@@ -43,6 +43,53 @@ ctrl_event_cause_from_dmn_event_kind(DMN_EventKind event_kind)
|
||||
return cause;
|
||||
}
|
||||
|
||||
internal String8
|
||||
ctrl_string_from_event_kind(CTRL_EventKind kind)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(kind)
|
||||
{
|
||||
default:{}break;
|
||||
case CTRL_EventKind_Null: { result = str8_lit("Null");}break;
|
||||
case CTRL_EventKind_Error: { result = str8_lit("Error");}break;
|
||||
case CTRL_EventKind_Started: { result = str8_lit("Started");}break;
|
||||
case CTRL_EventKind_Stopped: { result = str8_lit("Stopped");}break;
|
||||
case CTRL_EventKind_NewProc: { result = str8_lit("NewProc");}break;
|
||||
case CTRL_EventKind_NewThread: { result = str8_lit("NewThread");}break;
|
||||
case CTRL_EventKind_NewModule: { result = str8_lit("NewModule");}break;
|
||||
case CTRL_EventKind_EndProc: { result = str8_lit("EndProc");}break;
|
||||
case CTRL_EventKind_EndThread: { result = str8_lit("EndThread");}break;
|
||||
case CTRL_EventKind_EndModule: { result = str8_lit("EndModule");}break;
|
||||
case CTRL_EventKind_ModuleDebugInfoPathChange: { result = str8_lit("ModuleDebugInfoPathChange");}break;
|
||||
case CTRL_EventKind_DebugString: { result = str8_lit("DebugString");}break;
|
||||
case CTRL_EventKind_ThreadName: { result = str8_lit("ThreadName");}break;
|
||||
case CTRL_EventKind_MemReserve: { result = str8_lit("MemReserve");}break;
|
||||
case CTRL_EventKind_MemCommit: { result = str8_lit("MemCommit");}break;
|
||||
case CTRL_EventKind_MemDecommit: { result = str8_lit("MemDecommit");}break;
|
||||
case CTRL_EventKind_MemRelease: { result = str8_lit("MemRelease");}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
ctrl_string_from_msg_kind(CTRL_MsgKind kind)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(kind)
|
||||
{
|
||||
default:{}break;
|
||||
case CTRL_MsgKind_Launch: {result = str8_lit("Launch");}break;
|
||||
case CTRL_MsgKind_Attach: {result = str8_lit("Attach");}break;
|
||||
case CTRL_MsgKind_Kill: {result = str8_lit("Kill");}break;
|
||||
case CTRL_MsgKind_Detach: {result = str8_lit("Detach");}break;
|
||||
case CTRL_MsgKind_Run: {result = str8_lit("Run");}break;
|
||||
case CTRL_MsgKind_SingleStep: {result = str8_lit("SingleStep");}break;
|
||||
case CTRL_MsgKind_SetUserEntryPoints: {result = str8_lit("SetUserEntryPoints");}break;
|
||||
case CTRL_MsgKind_SetModuleDebugInfoPath: {result = str8_lit("SetModuleDebugInfoPath");}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Machine/Handle Pair Type Functions
|
||||
|
||||
@@ -399,11 +446,11 @@ ctrl_event_list_concat_in_place(CTRL_EventList *dst, CTRL_EventList *to_push)
|
||||
//- rjf: serialization
|
||||
|
||||
internal String8
|
||||
ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event)
|
||||
ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event, U64 max)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List srl = {0};
|
||||
str8_serial_begin(scratch.arena, &srl);;
|
||||
str8_serial_begin(scratch.arena, &srl);
|
||||
{
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->kind);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->cause);
|
||||
@@ -421,8 +468,10 @@ ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event)
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->tls_root);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->timestamp);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->exception_code);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->string.size);
|
||||
str8_serial_push_data(scratch.arena, &srl, event->string.str, event->string.size);
|
||||
String8 string = event->string;
|
||||
string.size = Min(string.size, max-srl.total_size);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &string.size);
|
||||
str8_serial_push_data(scratch.arena, &srl, string.str, string.size);
|
||||
}
|
||||
String8 string = str8_serial_end(arena, &srl);
|
||||
scratch_end(scratch);
|
||||
@@ -813,11 +862,7 @@ ctrl_entity_store_apply_events(CTRL_EntityStore *store, CTRL_EventList *list)
|
||||
CTRL_Entity *module = ctrl_entity_alloc(store, process, CTRL_EntityKind_Module, event->arch, event->machine_id, event->entity, event->vaddr_rng.min);
|
||||
ctrl_entity_equip_string(store, module, event->string);
|
||||
module->timestamp = event->timestamp;
|
||||
CTRL_Entity *debug_info_path = ctrl_entity_alloc(store, module, CTRL_EntityKind_DebugInfoPath, Architecture_Null, 0, dmn_handle_zero(), 0);
|
||||
String8 initial_debug_info_path = ctrl_initial_debug_info_path_from_module(scratch.arena, event->machine_id, event->entity);
|
||||
ctrl_entity_equip_string(store, debug_info_path, initial_debug_info_path);
|
||||
module->vaddr_range = event->vaddr_rng;
|
||||
debug_info_path->timestamp = module->timestamp;
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
case CTRL_EventKind_EndModule:
|
||||
@@ -834,6 +879,7 @@ ctrl_entity_store_apply_events(CTRL_EntityStore *store, CTRL_EventList *list)
|
||||
debug_info_path = ctrl_entity_alloc(store, module, CTRL_EntityKind_DebugInfoPath, Architecture_Null, 0, dmn_handle_zero(), 0);
|
||||
}
|
||||
ctrl_entity_equip_string(store, debug_info_path, event->string);
|
||||
debug_info_path->timestamp = event->timestamp;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -897,6 +943,7 @@ ctrl_init(void)
|
||||
ctrl_state->u2c_ring_mutex = os_mutex_alloc();
|
||||
ctrl_state->u2c_ring_cv = os_condition_variable_alloc();
|
||||
ctrl_state->c2u_ring_size = KB(64);
|
||||
ctrl_state->c2u_ring_max_string_size = ctrl_state->c2u_ring_size/2;
|
||||
ctrl_state->c2u_ring_base = push_array_no_zero(arena, U8, ctrl_state->c2u_ring_size);
|
||||
ctrl_state->c2u_ring_mutex = os_mutex_alloc();
|
||||
ctrl_state->c2u_ring_cv = os_condition_variable_alloc();
|
||||
@@ -1505,6 +1552,18 @@ ctrl_query_cached_rip_from_thread(CTRL_EntityStore *store, CTRL_MachineID machin
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
ctrl_query_cached_rsp_from_thread(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
CTRL_Entity *thread_entity = ctrl_entity_from_machine_id_handle(store, machine_id, thread);
|
||||
Architecture arch = thread_entity->arch;
|
||||
void *block = ctrl_query_cached_reg_block_from_thread(scratch.arena, store, machine_id, thread);
|
||||
U64 result = regs_rsp_from_arch_block(arch, block);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: thread register writing
|
||||
|
||||
internal B32
|
||||
@@ -2593,7 +2652,8 @@ ctrl_unwind_from_thread(Arena *arena, CTRL_EntityStore *store, CTRL_MachineID ma
|
||||
unwind.flags |= step.flags;
|
||||
if(step.flags & CTRL_UnwindFlag_Error ||
|
||||
regs_rsp_from_arch_block(arch, regs_block) == 0 ||
|
||||
regs_rip_from_arch_block(arch, regs_block) == 0)
|
||||
regs_rip_from_arch_block(arch, regs_block) == 0 ||
|
||||
regs_rip_from_arch_block(arch, regs_block) == rip)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2741,7 +2801,7 @@ ctrl_c2u_push_events(CTRL_EventList *events)
|
||||
for(CTRL_EventNode *n = events->first; n != 0; n = n ->next)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 event_srlzed = ctrl_serialized_string_from_event(scratch.arena, &n->v);
|
||||
String8 event_srlzed = ctrl_serialized_string_from_event(scratch.arena, &n->v, ctrl_state->c2u_ring_size-sizeof(U64));
|
||||
OS_MutexScope(ctrl_state->c2u_ring_mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = (ctrl_state->c2u_ring_write_pos-ctrl_state->c2u_ring_read_pos);
|
||||
@@ -2826,6 +2886,9 @@ ctrl_thread__entry_point(void *p)
|
||||
for(CTRL_MsgNode *msg_n = msgs.first; msg_n != 0 && done == 0; msg_n = msg_n->next)
|
||||
{
|
||||
CTRL_Msg *msg = &msg_n->v;
|
||||
{
|
||||
log_infof("user2ctrl_msg:{kind:\"%S\"}\n", ctrl_string_from_msg_kind(msg->kind));
|
||||
}
|
||||
MemoryCopyArray(ctrl_state->exception_code_filters, msg->exception_code_filters);
|
||||
switch(msg->kind)
|
||||
{
|
||||
@@ -2855,10 +2918,12 @@ ctrl_thread__entry_point(void *p)
|
||||
String8 path = msg->path;
|
||||
CTRL_Entity *module = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, msg->machine_id, msg->entity);
|
||||
CTRL_Entity *debug_info_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
DI_Key old_dbgi_key = {debug_info_path->string, module->timestamp};
|
||||
DI_Key old_dbgi_key = {debug_info_path->string, debug_info_path->timestamp};
|
||||
di_close(&old_dbgi_key);
|
||||
ctrl_entity_equip_string(ctrl_state->ctrl_thread_entity_store, debug_info_path, path);
|
||||
DI_Key new_dbgi_key = {debug_info_path->string, module->timestamp};
|
||||
U64 new_dbgi_timestamp = os_properties_from_file_path(path).modified;
|
||||
debug_info_path->timestamp = new_dbgi_timestamp;
|
||||
DI_Key new_dbgi_key = {debug_info_path->string, new_dbgi_timestamp};
|
||||
di_open(&new_dbgi_key);
|
||||
CTRL_EventList evts = {0};
|
||||
CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||
@@ -2866,6 +2931,7 @@ ctrl_thread__entry_point(void *p)
|
||||
evt->machine_id = msg->machine_id;
|
||||
evt->entity = msg->entity;
|
||||
evt->string = path;
|
||||
evt->timestamp = new_dbgi_timestamp;
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}break;
|
||||
}
|
||||
@@ -2924,11 +2990,11 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
|
||||
// rjf: filename -> src_id
|
||||
U32 src_id = 0;
|
||||
{
|
||||
RDI_NameMap *mapptr = rdi_name_map_from_kind(rdi, RDI_NameMapKind_NormalSourcePaths);
|
||||
RDI_NameMap *mapptr = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_NormalSourcePaths);
|
||||
if(mapptr != 0)
|
||||
{
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_name_map_parse(rdi, mapptr, &map);
|
||||
rdi_parsed_from_name_map(rdi, mapptr, &map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &map, filename_normalized.str, filename_normalized.size);
|
||||
if(node != 0)
|
||||
{
|
||||
@@ -2944,9 +3010,10 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
|
||||
|
||||
// rjf: src_id * pt -> push
|
||||
{
|
||||
RDI_SourceFile *src = rdi_element_from_idx(rdi, source_files, src_id);
|
||||
RDI_ParsedLineMap line_map = {0};
|
||||
rdi_line_map_from_source_file(rdi, src, &line_map);
|
||||
RDI_SourceFile *src = rdi_element_from_name_idx(rdi, SourceFiles, src_id);
|
||||
RDI_SourceLineMap *src_line_map = rdi_element_from_name_idx(rdi, SourceLineMaps, src->source_line_map_idx);
|
||||
RDI_ParsedSourceLineMap line_map = {0};
|
||||
rdi_parsed_from_source_line_map(rdi, src_line_map, &line_map);
|
||||
U32 voff_count = 0;
|
||||
U64 *voffs = rdi_line_voffs_from_num(&line_map, pt.line, &voff_count);
|
||||
for(U32 i = 0; i < voff_count; i += 1)
|
||||
@@ -2963,13 +3030,9 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
|
||||
{
|
||||
String8 symbol_name = bp->string;
|
||||
U64 voff = bp->u64;
|
||||
if(rdi != 0 && rdi->procedures != 0)
|
||||
{
|
||||
RDI_NameMap *mapptr = rdi_name_map_from_kind(rdi, RDI_NameMapKind_Procedures);
|
||||
if(mapptr != 0)
|
||||
{
|
||||
RDI_NameMap *mapptr = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Procedures);
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_name_map_parse(rdi, mapptr, &map);
|
||||
rdi_parsed_from_name_map(rdi, mapptr, &map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &map, symbol_name.str, symbol_name.size);
|
||||
if(node != 0)
|
||||
{
|
||||
@@ -2977,14 +3040,13 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
|
||||
U32 *ids = rdi_matches_from_map_node(rdi, node, &id_count);
|
||||
for(U32 match_i = 0; match_i < id_count; match_i += 1)
|
||||
{
|
||||
U64 proc_voff = rdi_first_voff_from_proc(rdi, ids[match_i]);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, ids[match_i]);
|
||||
U64 proc_voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
U64 proc_vaddr = proc_voff + base_vaddr;
|
||||
DMN_Trap trap = {process, proc_vaddr + voff, (U64)bp};
|
||||
dmn_trap_chunk_list_push(arena, traps_out, 256, &trap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -3009,7 +3071,7 @@ ctrl_thread__append_resolved_process_user_bp_traps(Arena *arena, CTRL_MachineID
|
||||
//- rjf: module lifetime open/close work
|
||||
|
||||
internal void
|
||||
ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path, U64 exe_timestamp)
|
||||
ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path)
|
||||
{
|
||||
//////////////////////////////
|
||||
//- rjf: parse module image info
|
||||
@@ -3231,8 +3293,8 @@ ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Hand
|
||||
String8 builtin_debug_info_path__relative = push_str8f(scratch.arena, "%S/%S", exe_folder, builtin_debug_info_path);
|
||||
String8 dbg_path_candidates[] =
|
||||
{
|
||||
/* inferred (treated as absolute): */ builtin_debug_info_path__absolute,
|
||||
/* inferred (treated as relative): */ builtin_debug_info_path__relative,
|
||||
/* inferred (treated as absolute): */ builtin_debug_info_path__absolute,
|
||||
/* "foo.exe" -> "foo.pdb" */ push_str8f(scratch.arena, "%S.pdb", str8_chop_last_dot(path)),
|
||||
/* "foo.exe" -> "foo.exe.pdb" */ push_str8f(scratch.arena, "%S.pdb", path),
|
||||
};
|
||||
@@ -3285,7 +3347,7 @@ ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Hand
|
||||
}
|
||||
|
||||
internal void
|
||||
ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8 path)
|
||||
ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module)
|
||||
{
|
||||
//////////////////////////////
|
||||
//- rjf: evict module image info from cache
|
||||
@@ -3314,19 +3376,6 @@ ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: close debug info
|
||||
//
|
||||
{
|
||||
CTRL_Entity *module_ent = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, machine_id, module);
|
||||
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
|
||||
if(debug_info_path_ent != &ctrl_entity_nil)
|
||||
{
|
||||
DI_Key dbgi_key = {debug_info_path_ent->string, debug_info_path_ent->timestamp};
|
||||
di_close(&dbgi_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: attached process running/event gathering
|
||||
@@ -3349,10 +3398,11 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
DMN_EventNode *next_event_node = ctrl_state->first_dmn_event_node;
|
||||
|
||||
// rjf: log event
|
||||
if(next_event_node != 0) CTRL_CtrlThreadLogScope
|
||||
if(next_event_node != 0)
|
||||
{
|
||||
DMN_Event *ev = &next_event_node->v;
|
||||
log_infof("--- event ---\n");
|
||||
LogInfoNamedBlockF("dmn_event")
|
||||
{
|
||||
log_infof("kind: %S\n", dmn_event_kind_string_table[ev->kind]);
|
||||
log_infof("exception_kind: %S\n", dmn_exception_kind_string_table[ev->exception_kind]);
|
||||
log_infof("process: [%I64u]\n", ev->process.u64[0]);
|
||||
@@ -3363,6 +3413,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
log_infof("string: \"%S\"\n", ev->string);
|
||||
log_infof("ip_vaddr: 0x%I64x\n", ev->instruction_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: determine if we should filter
|
||||
B32 should_filter_event = 0;
|
||||
@@ -3425,11 +3476,10 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
|
||||
RDI_NameMap *unparsed_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_GlobalVariables);
|
||||
if(rdi->global_variables != 0 && unparsed_map != 0)
|
||||
RDI_NameMap *unparsed_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_GlobalVariables);
|
||||
{
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_name_map_parse(rdi, unparsed_map, &map);
|
||||
rdi_parsed_from_name_map(rdi, unparsed_map, &map);
|
||||
String8 name = str8_lit("__asan_shadow_memory_dynamic_address");
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &map, name.str, name.size);
|
||||
if(node != 0)
|
||||
@@ -3438,7 +3488,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
U32 *ids = rdi_matches_from_map_node(rdi, node, &id_count);
|
||||
if(id_count > 0)
|
||||
{
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_idx(rdi, global_variables, ids[0]);
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, ids[0]);
|
||||
U64 global_var_voff = global_var->voff;
|
||||
U64 global_var_vaddr = global_var->voff + module->vaddr_range.min;
|
||||
Architecture arch = process->arch;
|
||||
@@ -3514,9 +3564,27 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
// rjf: run for new events
|
||||
ProfScope("run for new events")
|
||||
{
|
||||
CTRL_CtrlThreadLogScope log_infof("{dmn_ctrl_run ...");
|
||||
LogInfoNamedBlockF("dmn_ctrl_run")
|
||||
{
|
||||
log_infof("single_step_thread: [0x%I64x]\n", run_ctrls->single_step_thread);
|
||||
log_infof("ignore_previous_exception: %i\n", !!run_ctrls->ignore_previous_exception);
|
||||
log_infof("run_entities_are_unfrozen: %i\n", !!run_ctrls->run_entities_are_unfrozen);
|
||||
log_infof("run_entities_are_processes: %i\n", !!run_ctrls->run_entities_are_processes);
|
||||
log_infof("run_entity_count: %I64u\n", run_ctrls->run_entity_count);
|
||||
LogInfoNamedBlockF("run_entities") for(U64 idx = 0; idx < run_ctrls->run_entity_count; idx += 1)
|
||||
{
|
||||
log_infof("[0x%I64x]\n", run_ctrls->run_entities[idx]);
|
||||
}
|
||||
log_infof("trap_count: %I64u\n", run_ctrls->traps.trap_count);
|
||||
LogInfoNamedBlockF("traps") for(DMN_TrapChunkNode *n = run_ctrls->traps.first; n != 0; n = n->next)
|
||||
{
|
||||
for(U64 idx = 0; idx < n->count; idx += 1)
|
||||
{
|
||||
log_infof("{process:[0x%I64x], vaddr:0x%I64x, id:0x%I64x}\n", n->v[idx].process.u64[0], n->v[idx].vaddr, n->v[idx].id);
|
||||
}
|
||||
}
|
||||
}
|
||||
DMN_EventList events = dmn_ctrl_run(scratch.arena, ctrl_ctx, run_ctrls);
|
||||
CTRL_CtrlThreadLogScope log_infof("}\n");
|
||||
for(DMN_EventNode *src_n = events.first; src_n != 0; src_n = src_n->next)
|
||||
{
|
||||
DMN_EventNode *dst_n = ctrl_state->free_dmn_event_node;
|
||||
@@ -3555,7 +3623,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
if(spoof_thread_rip == spoof->new_ip_value)
|
||||
{
|
||||
regs_arch_block_write_rip(arch, regs_block, spoof_old_ip_value);
|
||||
dmn_thread_write_reg_block(spoof->thread, regs_block);
|
||||
ctrl_thread_write_reg_block(CTRL_MachineID_Local, spoof->thread, regs_block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3594,8 +3662,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
{
|
||||
CTRL_Event *out_evt1 = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 module_path = event->string;
|
||||
U64 timestamp = os_properties_from_file_path(module_path).modified;
|
||||
ctrl_thread__module_open(CTRL_MachineID_Local, event->process, event->module, r1u64(event->address, event->address+event->size), module_path, timestamp);
|
||||
U64 exe_timestamp = os_properties_from_file_path(module_path).modified;
|
||||
ctrl_thread__module_open(CTRL_MachineID_Local, event->process, event->module, r1u64(event->address, event->address+event->size), module_path);
|
||||
out_evt1->kind = CTRL_EventKind_NewModule;
|
||||
out_evt1->msg_id = msg->msg_id;
|
||||
out_evt1->machine_id = CTRL_MachineID_Local;
|
||||
@@ -3605,18 +3673,19 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
out_evt1->entity_id = event->code;
|
||||
out_evt1->vaddr_rng = r1u64(event->address, event->address+event->size);
|
||||
out_evt1->rip_vaddr = event->address;
|
||||
out_evt1->timestamp = timestamp;
|
||||
out_evt1->timestamp = exe_timestamp;
|
||||
out_evt1->string = module_path;
|
||||
CTRL_Event *out_evt2 = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 initial_debug_info_path = ctrl_initial_debug_info_path_from_module(scratch.arena, CTRL_MachineID_Local, event->module);
|
||||
U64 debug_info_timestamp = os_properties_from_file_path(initial_debug_info_path).modified;
|
||||
out_evt2->kind = CTRL_EventKind_ModuleDebugInfoPathChange;
|
||||
out_evt2->msg_id = msg->msg_id;
|
||||
out_evt2->machine_id = CTRL_MachineID_Local;
|
||||
out_evt2->entity = event->module;
|
||||
out_evt2->parent = event->process;
|
||||
out_evt2->timestamp = timestamp;
|
||||
out_evt2->timestamp = debug_info_timestamp;
|
||||
out_evt2->string = initial_debug_info_path;
|
||||
DI_Key initial_dbgi_key = {initial_debug_info_path, timestamp};
|
||||
DI_Key initial_dbgi_key = {initial_debug_info_path, debug_info_timestamp};
|
||||
di_open(&initial_dbgi_key);
|
||||
}break;
|
||||
case DMN_EventKind_ExitProcess:
|
||||
@@ -3642,14 +3711,24 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
{
|
||||
CTRL_Event *out_evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 module_path = event->string;
|
||||
ctrl_thread__module_close(CTRL_MachineID_Local, event->module, module_path);
|
||||
ctrl_thread__module_close(CTRL_MachineID_Local, event->module);
|
||||
out_evt->kind = CTRL_EventKind_EndModule;
|
||||
out_evt->msg_id = msg->msg_id;
|
||||
out_evt->machine_id = CTRL_MachineID_Local;
|
||||
out_evt->entity = event->module;
|
||||
out_evt->string = module_path;
|
||||
CTRL_Entity *module_ent = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, CTRL_MachineID_Local, event->module);
|
||||
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
|
||||
if(debug_info_path_ent != &ctrl_entity_nil)
|
||||
{
|
||||
DI_Key dbgi_key = {debug_info_path_ent->string, debug_info_path_ent->timestamp};
|
||||
di_close(&dbgi_key);
|
||||
}
|
||||
}break;
|
||||
case DMN_EventKind_DebugString:
|
||||
{
|
||||
U64 num_strings = (event->string.size + ctrl_state->c2u_ring_max_string_size-1) / ctrl_state->c2u_ring_max_string_size;
|
||||
for(U64 string_idx = 0; string_idx < num_strings; string_idx += 1)
|
||||
{
|
||||
CTRL_Event *out_evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||
out_evt->kind = CTRL_EventKind_DebugString;
|
||||
@@ -3657,7 +3736,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
out_evt->machine_id = CTRL_MachineID_Local;
|
||||
out_evt->entity = event->thread;
|
||||
out_evt->parent = event->process;
|
||||
out_evt->string = event->string;
|
||||
out_evt->string = str8_substr(event->string, r1u64(string_idx*ctrl_state->c2u_ring_max_string_size, (string_idx+1)*ctrl_state->c2u_ring_max_string_size));
|
||||
}
|
||||
}break;
|
||||
case DMN_EventKind_SetThreadName:
|
||||
{
|
||||
@@ -3926,7 +4006,9 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
CTRL_EventCause stop_cause = CTRL_EventCause_Null;
|
||||
DMN_Handle target_thread = msg->entity;
|
||||
DMN_Handle target_process = msg->parent;
|
||||
CTRL_Entity *target_process_entity = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, msg->machine_id, target_process);
|
||||
U64 spoof_ip_vaddr = 911;
|
||||
log_infof("ctrl_thread__run:\n{\n");
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: gather all initial breakpoints
|
||||
@@ -3961,6 +4043,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
// causes e.g. entrance into a function via a call instruction.
|
||||
//
|
||||
U64 sp_check_value = dmn_rsp_from_thread(target_thread);
|
||||
log_infof("sp_check_value := 0x%I64x\n", sp_check_value);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: single step "stuck threads"
|
||||
@@ -4045,11 +4128,22 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
node != 0;
|
||||
node = node->next)
|
||||
{
|
||||
DMN_RunCtrls run_ctrls = {0};
|
||||
run_ctrls.single_step_thread = node->v;
|
||||
for(B32 done = 0; done == 0;)
|
||||
DMN_Handle thread = node->v;
|
||||
U64 thread_pre_rip = dmn_rip_from_thread(thread);
|
||||
U64 thread_post_rip = thread_pre_rip;
|
||||
for(B32 done = 0; !done;)
|
||||
{
|
||||
log_infof("single_step_stuck_thread([0x%I64x])\n", thread.u64[0]);
|
||||
DMN_RunCtrls run_ctrls = {0};
|
||||
run_ctrls.run_entities_are_unfrozen = 1;
|
||||
run_ctrls.run_entities = &thread;
|
||||
run_ctrls.run_entity_count = 1;
|
||||
if(thread_post_rip == thread_pre_rip)
|
||||
{
|
||||
run_ctrls.single_step_thread = thread;
|
||||
}
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &run_ctrls, 0);
|
||||
thread_post_rip = dmn_rip_from_thread(thread);
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -4064,7 +4158,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}break;
|
||||
case DMN_EventKind_SingleStep:
|
||||
{
|
||||
done = 1;
|
||||
done = dmn_handle_match(node->v, event->thread);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -4150,9 +4244,11 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
run_ctrls.traps = *trap_list;
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: get next event
|
||||
//- rjf: get next run-related event
|
||||
//
|
||||
log_infof("get_next_event:\n{\n");
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &run_ctrls, run_spoof);
|
||||
log_infof("}\n\n");
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: determine event handling
|
||||
@@ -4161,7 +4257,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
B32 hard_stop = 0;
|
||||
CTRL_EventCause hard_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
||||
B32 use_stepping_logic = 0;
|
||||
CTRL_CtrlThreadLogScope switch(event->kind)
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case DMN_EventKind_Error:
|
||||
@@ -4170,27 +4266,29 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
case DMN_EventKind_Trap:
|
||||
{
|
||||
hard_stop = 1;
|
||||
log_infof(">>> stepping >>> hard stop\n");
|
||||
log_infof("step_rule: unexpected -> hard_stop\n");
|
||||
}break;
|
||||
case DMN_EventKind_Exception:
|
||||
case DMN_EventKind_Breakpoint:
|
||||
{
|
||||
use_stepping_logic = 1;
|
||||
log_infof(">>> stepping >>> exception or breakpoint - begin stepping logic\n");
|
||||
log_infof("step_rule: exception/breakpoint -> stepping_logic\n");
|
||||
}break;
|
||||
case DMN_EventKind_CreateProcess:
|
||||
{
|
||||
DMN_TrapChunkList new_traps = {0};
|
||||
ctrl_thread__append_resolved_process_user_bp_traps(scratch.arena, CTRL_MachineID_Local, event->process, &msg->user_bps, &new_traps);
|
||||
log_infof(">>> stepping >>> create process -> resolve new BPs\n");
|
||||
log_infof("step_rule: create_process -> resolve traps\n");
|
||||
log_infof("new_traps:\n{\n");
|
||||
for(DMN_TrapChunkNode *n = new_traps.first; n != 0; n = n->next)
|
||||
{
|
||||
for(U64 idx = 0; idx < n->count; idx += 1)
|
||||
{
|
||||
DMN_Trap *trap = &n->v[idx];
|
||||
log_infof(" trap: {process:%I64d, vaddr:0x%I64x}\n", trap->process.u64[0], trap->vaddr);
|
||||
log_infof("{process:[0x%I64x], vaddr:0x%I64x}\n", trap->process.u64[0], trap->vaddr);
|
||||
}
|
||||
}
|
||||
log_infof("}\n\n");
|
||||
dmn_trap_chunk_list_concat_shallow_copy(scratch.arena, &joined_traps, &new_traps);
|
||||
dmn_trap_chunk_list_concat_shallow_copy(scratch.arena, &user_traps, &new_traps);
|
||||
}break;
|
||||
@@ -4198,9 +4296,19 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
DMN_TrapChunkList new_traps = {0};
|
||||
ctrl_thread__append_resolved_module_user_bp_traps(scratch.arena, CTRL_MachineID_Local, event->process, event->module, &msg->user_bps, &new_traps);
|
||||
log_infof("step_rule: load_module -> resolve traps\n");
|
||||
log_infof("new_traps:\n{\n");
|
||||
for(DMN_TrapChunkNode *n = new_traps.first; n != 0; n = n->next)
|
||||
{
|
||||
for(U64 idx = 0; idx < n->count; idx += 1)
|
||||
{
|
||||
DMN_Trap *trap = &n->v[idx];
|
||||
log_infof("{process:[0x%I64x], vaddr:0x%I64x}\n", trap->process.u64[0], trap->vaddr);
|
||||
}
|
||||
}
|
||||
log_infof("}\n\n");
|
||||
dmn_trap_chunk_list_concat_shallow_copy(scratch.arena, &joined_traps, &new_traps);
|
||||
dmn_trap_chunk_list_concat_shallow_copy(scratch.arena, &user_traps, &new_traps);
|
||||
log_infof(">>> stepping >>> load module -> resolve new BPs\n");
|
||||
}break;
|
||||
}
|
||||
|
||||
@@ -4226,9 +4334,9 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
|
||||
RDI_NameMap *unparsed_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_Procedures);
|
||||
RDI_NameMap *unparsed_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Procedures);
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_name_map_parse(rdi, unparsed_map, &map);
|
||||
rdi_parsed_from_name_map(rdi, unparsed_map, &map);
|
||||
|
||||
//- rjf: add traps for user-specified entry points on this message, if specified
|
||||
B32 entries_found = 0;
|
||||
@@ -4247,7 +4355,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
U64 voff = rdi_first_voff_from_proc(rdi, procedure_id);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
entries_found = 1;
|
||||
@@ -4275,7 +4384,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
U64 voff = rdi_first_voff_from_proc(rdi, procedure_id);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
entries_found = 1;
|
||||
@@ -4302,7 +4412,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
U64 voff = rdi_first_voff_from_proc(rdi, procedure_id);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
DMN_Trap trap = {process->handle, module_base_vaddr + voff};
|
||||
@@ -4335,7 +4446,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
U64 voff = rdi_first_voff_from_proc(rdi, procedure_id);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
entries_found = 1;
|
||||
@@ -4379,7 +4491,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
U64 voff = rdi_first_voff_from_proc(rdi, procedure_id);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
entries_found = 1;
|
||||
@@ -4430,35 +4543,32 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
//{
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: handle if hitting a spoof or baked in trap
|
||||
//- rjf: handle if hitting a spoof
|
||||
//
|
||||
B32 hit_spoof = 0;
|
||||
B32 exception_stop = 0;
|
||||
if(!hard_stop && use_stepping_logic)
|
||||
B32 hit_spoof = 0;
|
||||
if(!hard_stop && use_stepping_logic && event->kind == DMN_EventKind_Exception)
|
||||
{
|
||||
if(event->kind == DMN_EventKind_Exception)
|
||||
{
|
||||
// rjf: spoof check
|
||||
if(spoof_mode &&
|
||||
dmn_handle_match(target_process, event->process) &&
|
||||
dmn_handle_match(target_thread, event->thread) &&
|
||||
spoof.new_ip_value == event->instruction_pointer)
|
||||
{
|
||||
hit_spoof = 1;
|
||||
log_infof("hit_spoof\n");
|
||||
}
|
||||
|
||||
// rjf: other exceptions cause stop
|
||||
if(!hit_spoof)
|
||||
else
|
||||
{
|
||||
exception_stop = 1;
|
||||
use_stepping_logic = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: handle spoof hit
|
||||
if(hit_spoof)
|
||||
{
|
||||
log_infof("exit_spoof_mode\n");
|
||||
|
||||
// rjf: clear spoof mode
|
||||
spoof_mode = 0;
|
||||
MemoryZeroStruct(&spoof);
|
||||
@@ -4473,9 +4583,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
B32 hit_trap_net_bp = 0;
|
||||
B32 hit_conditional_bp_but_filtered = 0;
|
||||
CTRL_TrapFlags hit_trap_flags = 0;
|
||||
if(!hard_stop && use_stepping_logic) CTRL_CtrlThreadLogScope
|
||||
{
|
||||
if(event->kind == DMN_EventKind_Breakpoint)
|
||||
if(!hard_stop && use_stepping_logic && event->kind == DMN_EventKind_Breakpoint)
|
||||
ProfScope("for breakpoint events, gather bp info")
|
||||
{
|
||||
Temp temp = temp_begin(scratch.arena);
|
||||
String8List conditions = {0};
|
||||
@@ -4516,12 +4625,13 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}
|
||||
|
||||
// rjf: evaluate hit stop conditions
|
||||
if(conditions.node_count != 0)
|
||||
if(conditions.node_count != 0) ProfScope("evaluate hit stop conditions")
|
||||
{
|
||||
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
|
||||
for(String8Node *condition_n = conditions.first; condition_n != 0; condition_n = condition_n->next)
|
||||
{
|
||||
ProfBegin("compile expression");
|
||||
String8 string = condition_n->string;
|
||||
EVAL_ParseCtx parse_ctx = zero_struct;
|
||||
{
|
||||
@@ -4554,8 +4664,9 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
bytecode = eval_bytecode_from_oplist(scratch.arena, &op_list);
|
||||
}
|
||||
ProfEnd();
|
||||
EVAL_Result eval = {0};
|
||||
if(bytecode.size != 0)
|
||||
if(bytecode.size != 0) ProfScope("evaluate expression")
|
||||
{
|
||||
U64 module_base = module->vaddr_range.min;
|
||||
U64 tls_base = dmn_tls_root_vaddr_from_thread(event->thread);
|
||||
@@ -4565,28 +4676,30 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
machine.memory_read = ctrl_eval_memory_read;
|
||||
machine.reg_size = regs_block_size_from_architecture(arch);
|
||||
machine.reg_data = push_array(scratch.arena, U8, machine.reg_size);
|
||||
dmn_thread_read_reg_block(event->thread, machine.reg_data);
|
||||
machine.module_base = &module_base;
|
||||
machine.tls_base = &tls_base;
|
||||
dmn_thread_read_reg_block(event->thread, machine.reg_data);
|
||||
eval = eval_interpret(&machine, bytecode);
|
||||
}
|
||||
if(eval.code == EVAL_ResultCode_Good && eval.value.u64 == 0)
|
||||
{
|
||||
hit_user_bp = 0;
|
||||
hit_conditional_bp_but_filtered = 1;
|
||||
log_infof(">>> stepping >>> conditional breakpoint hit, but condition eval'd to 0, and so filtered\n");
|
||||
log_infof("conditional_breakpoint_hit: 'condition eval'd to 0, and so filtered'\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
hit_user_bp = 1;
|
||||
hit_conditional_bp_but_filtered = 0;
|
||||
log_infof(">>> stepping >>> conditional breakpoint hit\n");
|
||||
log_infof("conditional_breakpoint_hit: 'conditional eval'd to nonzero, hit'\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: gather trap net hits
|
||||
ProfScope("gather trap net hits")
|
||||
{
|
||||
if(!hit_user_bp && dmn_handle_match(event->process, target_process))
|
||||
{
|
||||
for(CTRL_TrapNode *node = msg->traps.first;
|
||||
@@ -4600,23 +4713,33 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log_infof(">>> stepping >>> stepping logic - BP event -> hit_user_bp: %i\n", hit_user_bp);
|
||||
log_infof(">>> stepping >>> stepping logic - BP event -> hit_entry: %i\n", hit_entry);
|
||||
temp_end(temp);
|
||||
}
|
||||
|
||||
log_infof("user_breakpoint_hit: %i\n", hit_user_bp);
|
||||
log_infof("entry_point_hit: %i\n", hit_entry);
|
||||
temp_end(temp);
|
||||
}
|
||||
|
||||
//- rjf: hit conditional user bp but filtered -> single step
|
||||
B32 cond_bp_single_step_stop = 0;
|
||||
CTRL_EventCause cond_bp_single_step_stop_cause = CTRL_EventCause_Null;
|
||||
if(hit_conditional_bp_but_filtered)
|
||||
if(hit_conditional_bp_but_filtered) LogInfoNamedBlockF("conditional_bp_hit_single_step")
|
||||
{
|
||||
DMN_Handle thread = event->thread;
|
||||
U64 thread_pre_rip = dmn_rip_from_thread(thread);
|
||||
U64 thread_post_rip = thread_pre_rip;
|
||||
for(B32 single_step_done = 0; !single_step_done;)
|
||||
{
|
||||
DMN_RunCtrls single_step_ctrls = {0};
|
||||
single_step_ctrls.single_step_thread = event->thread;
|
||||
for(B32 single_step_done = 0; single_step_done == 0;)
|
||||
single_step_ctrls.run_entities_are_unfrozen = 1;
|
||||
single_step_ctrls.run_entities = &thread;
|
||||
single_step_ctrls.run_entity_count = 1;
|
||||
if(thread_post_rip == thread_pre_rip)
|
||||
{
|
||||
single_step_ctrls.single_step_thread = thread;
|
||||
}
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &single_step_ctrls, 0);
|
||||
thread_post_rip = dmn_rip_from_thread(thread);
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -4632,7 +4755,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}break;
|
||||
case DMN_EventKind_SingleStep:
|
||||
{
|
||||
single_step_done = 1;
|
||||
single_step_done = dmn_handle_match(event->thread, thread);
|
||||
cond_bp_single_step_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
||||
}break;
|
||||
}
|
||||
@@ -4689,13 +4812,22 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
CTRL_EventCause single_step_stop_cause = CTRL_EventCause_Null;
|
||||
if(!hard_stop && use_trap_net_logic)
|
||||
{
|
||||
if(hit_trap_flags & CTRL_TrapFlag_SingleStepAfterHit)
|
||||
if(hit_trap_flags & CTRL_TrapFlag_SingleStepAfterHit) LogInfoNamedBlockF("trap_net__single_step_after_hit")
|
||||
{
|
||||
DMN_RunCtrls single_step_ctrls = {0};
|
||||
single_step_ctrls.single_step_thread = target_thread;
|
||||
U64 thread_pre_rip = dmn_rip_from_thread(target_thread);
|
||||
U64 thread_post_rip = thread_pre_rip;
|
||||
for(B32 single_step_done = 0; single_step_done == 0;)
|
||||
{
|
||||
DMN_RunCtrls single_step_ctrls = {0};
|
||||
single_step_ctrls.run_entities_are_unfrozen = 1;
|
||||
single_step_ctrls.run_entities = &target_thread;
|
||||
single_step_ctrls.run_entity_count = 1;
|
||||
if(thread_post_rip == thread_pre_rip)
|
||||
{
|
||||
single_step_ctrls.single_step_thread = target_thread;
|
||||
}
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &single_step_ctrls, 0);
|
||||
thread_post_rip = dmn_rip_from_thread(target_thread);
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -4712,7 +4844,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}break;
|
||||
case DMN_EventKind_SingleStep:
|
||||
{
|
||||
single_step_done = 1;
|
||||
single_step_done = dmn_handle_match(event->thread, target_thread);;
|
||||
single_step_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
||||
}break;
|
||||
}
|
||||
@@ -4724,7 +4856,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
B32 begin_spoof_mode = 0;
|
||||
if(!hard_stop && use_trap_net_logic)
|
||||
{
|
||||
if(hit_trap_flags & CTRL_TrapFlag_BeginSpoofMode)
|
||||
if(hit_trap_flags & CTRL_TrapFlag_BeginSpoofMode) LogInfoNamedBlockF("trap_net__begin_spoof_mode")
|
||||
{
|
||||
// rjf: setup spoof mode
|
||||
begin_spoof_mode = 1;
|
||||
@@ -4734,6 +4866,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
spoof.thread = target_thread;
|
||||
spoof.vaddr = spoof_sp;
|
||||
spoof.new_ip_value = spoof_ip_vaddr;
|
||||
log_infof("spoof:{process:[0x%I64x], thread:[0x%I64x], vaddr:0x%I64x, new_ip_value:0x%I64x}\n", spoof.process.u64[0], spoof.thread.u64[0], spoof.vaddr, spoof.new_ip_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4743,10 +4876,11 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
if(hit_trap_flags & CTRL_TrapFlag_SaveStackPointer)
|
||||
{
|
||||
if(stack_pointer_matches)
|
||||
if(stack_pointer_matches) LogInfoNamedBlockF("trap_net__save_sp")
|
||||
{
|
||||
save_stack_pointer = 1;
|
||||
sp_check_value = dmn_rsp_from_thread(target_thread);
|
||||
log_infof("sp_check_value = 0x%I64x\n", sp_check_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4755,7 +4889,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
B32 trap_net_stop = 0;
|
||||
if(!hard_stop && use_trap_net_logic)
|
||||
{
|
||||
if(hit_trap_flags & CTRL_TrapFlag_EndStepping)
|
||||
if(hit_trap_flags & CTRL_TrapFlag_EndStepping) LogInfoNamedBlockF("trap_net__end_step")
|
||||
{
|
||||
if((hit_trap_flags & CTRL_TrapFlag_IgnoreStackPointerCheck) ||
|
||||
stack_pointer_matches)
|
||||
@@ -4774,13 +4908,23 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
//- rjf: handle step past trap net
|
||||
B32 step_past_trap_net_stop = 0;
|
||||
CTRL_EventCause step_past_trap_net_stop_cause = CTRL_EventCause_Null;
|
||||
if(step_past_trap_net)
|
||||
if(step_past_trap_net) LogInfoNamedBlockF("trap_net__single_step_past_trap_net")
|
||||
{
|
||||
DMN_RunCtrls single_step_ctrls = {0};
|
||||
single_step_ctrls.single_step_thread = event->thread;
|
||||
DMN_Handle thread = event->thread;
|
||||
U64 thread_pre_rip = dmn_rip_from_thread(thread);
|
||||
U64 thread_post_rip = thread_pre_rip;
|
||||
for(B32 single_step_done = 0; single_step_done == 0;)
|
||||
{
|
||||
DMN_RunCtrls single_step_ctrls = {0};
|
||||
single_step_ctrls.run_entities_are_unfrozen = 1;
|
||||
single_step_ctrls.run_entities = &thread;
|
||||
single_step_ctrls.run_entity_count = 1;
|
||||
if(thread_post_rip == thread_pre_rip)
|
||||
{
|
||||
single_step_ctrls.single_step_thread = thread;
|
||||
}
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &single_step_ctrls, 0);
|
||||
thread_post_rip = dmn_rip_from_thread(thread);
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -4795,7 +4939,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}break;
|
||||
case DMN_EventKind_SingleStep:
|
||||
{
|
||||
single_step_done = 1;
|
||||
single_step_done = dmn_handle_match(event->thread, thread);
|
||||
step_past_trap_net_stop_cause = ctrl_event_cause_from_dmn_event_kind(event->kind);
|
||||
}break;
|
||||
}
|
||||
@@ -4836,7 +4980,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
stage_stop_cause = CTRL_EventCause_Finished;
|
||||
}
|
||||
log_infof(">>> stepping >>> stage stop cause -> %i\n", stage_stop_cause);
|
||||
log_infof("stop_cause: %i\n", stage_stop_cause);
|
||||
if(stage_stop_cause != CTRL_EventCause_Null)
|
||||
{
|
||||
stop_event = event;
|
||||
@@ -4864,6 +5008,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
log_infof("}\n\n");
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
@@ -4887,11 +5032,21 @@ ctrl_thread__single_step(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
DMN_Event *stop_event = 0;
|
||||
CTRL_EventCause stop_cause = CTRL_EventCause_Null;
|
||||
{
|
||||
DMN_RunCtrls run_ctrls = {0};
|
||||
run_ctrls.single_step_thread = msg->entity;
|
||||
DMN_Handle thread = msg->entity;
|
||||
U64 thread_pre_rip = dmn_rip_from_thread(thread);
|
||||
U64 thread_post_rip = thread_pre_rip;
|
||||
for(B32 done = 0; done == 0;)
|
||||
{
|
||||
DMN_RunCtrls run_ctrls = {0};
|
||||
run_ctrls.run_entities_are_unfrozen = 1;
|
||||
run_ctrls.run_entities = &thread;
|
||||
run_ctrls.run_entity_count = 1;
|
||||
if(thread_post_rip == thread_pre_rip)
|
||||
{
|
||||
run_ctrls.single_step_thread = msg->entity;
|
||||
}
|
||||
DMN_Event *event = ctrl_thread__next_dmn_event(scratch.arena, ctrl_ctx, msg, &run_ctrls, 0);
|
||||
thread_post_rip = dmn_rip_from_thread(msg->entity);
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -4899,8 +5054,8 @@ ctrl_thread__single_step(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
case DMN_EventKind_Exception: {stop_cause = CTRL_EventCause_InterruptedByException;}goto end_single_step;
|
||||
case DMN_EventKind_Halt: {stop_cause = CTRL_EventCause_InterruptedByHalt;}goto end_single_step;
|
||||
case DMN_EventKind_Trap: {stop_cause = CTRL_EventCause_InterruptedByTrap;}goto end_single_step;
|
||||
case DMN_EventKind_SingleStep: {stop_cause = CTRL_EventCause_Finished;}goto end_single_step;
|
||||
case DMN_EventKind_Breakpoint: {stop_cause = CTRL_EventCause_UserBreakpoint;}goto end_single_step;
|
||||
case DMN_EventKind_SingleStep: {stop_cause = CTRL_EventCause_Finished;}goto end_single_step;
|
||||
end_single_step:
|
||||
{
|
||||
stop_event = event;
|
||||
|
||||
@@ -579,6 +579,7 @@ struct CTRL_State
|
||||
|
||||
// rjf: ctrl -> user event ring buffer
|
||||
U64 c2u_ring_size;
|
||||
U64 c2u_ring_max_string_size;
|
||||
U8 *c2u_ring_base;
|
||||
U64 c2u_ring_write_pos;
|
||||
U64 c2u_ring_read_pos;
|
||||
@@ -636,6 +637,8 @@ read_only global CTRL_Entity ctrl_entity_nil =
|
||||
internal U64 ctrl_hash_from_string(String8 string);
|
||||
internal U64 ctrl_hash_from_machine_id_handle(CTRL_MachineID machine_id, DMN_Handle handle);
|
||||
internal CTRL_EventCause ctrl_event_cause_from_dmn_event_kind(DMN_EventKind event_kind);
|
||||
internal String8 ctrl_string_from_event_kind(CTRL_EventKind kind);
|
||||
internal String8 ctrl_string_from_msg_kind(CTRL_MsgKind kind);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Machine/Handle Pair Type Functions
|
||||
@@ -676,7 +679,7 @@ internal CTRL_Event *ctrl_event_list_push(Arena *arena, CTRL_EventList *list);
|
||||
internal void ctrl_event_list_concat_in_place(CTRL_EventList *dst, CTRL_EventList *to_push);
|
||||
|
||||
//- rjf: serialization
|
||||
internal String8 ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event);
|
||||
internal String8 ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event, U64 max);
|
||||
internal CTRL_Event ctrl_event_from_serialized_string(Arena *arena, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -741,6 +744,7 @@ internal B32 ctrl_process_write(CTRL_MachineID machine_id, DMN_Handle process, R
|
||||
internal void *ctrl_query_cached_reg_block_from_thread(Arena *arena, CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread);
|
||||
internal U64 ctrl_query_cached_tls_root_vaddr_from_thread(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread);
|
||||
internal U64 ctrl_query_cached_rip_from_thread(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread);
|
||||
internal U64 ctrl_query_cached_rsp_from_thread(CTRL_EntityStore *store, CTRL_MachineID machine_id, DMN_Handle thread);
|
||||
|
||||
//- rjf: thread register writing
|
||||
internal B32 ctrl_thread_write_reg_block(CTRL_MachineID machine_id, DMN_Handle thread, void *block);
|
||||
@@ -806,8 +810,8 @@ internal void ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CT
|
||||
internal void ctrl_thread__append_resolved_process_user_bp_traps(Arena *arena, CTRL_MachineID machine_id, DMN_Handle process, CTRL_UserBreakpointList *user_bps, DMN_TrapChunkList *traps_out);
|
||||
|
||||
//- rjf: module lifetime open/close work
|
||||
internal void ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path, U64 exe_timestamp);
|
||||
internal void ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8 path);
|
||||
internal void ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path);
|
||||
internal void ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module);
|
||||
|
||||
//- rjf: attached process running/event gathering
|
||||
internal DMN_Event *ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, DMN_RunCtrls *run_ctrls, CTRL_Spoof *spoof);
|
||||
|
||||
@@ -54,6 +54,7 @@ extern U32 ctrl_exception_code_kind_code_table[38];
|
||||
extern String8 ctrl_exception_code_kind_display_string_table[38];
|
||||
extern String8 ctrl_exception_code_kind_lowercase_code_string_table[38];
|
||||
extern B8 ctrl_exception_code_kind_default_enable_table[38];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // CTRL_META_H
|
||||
|
||||
+40
-27
@@ -69,12 +69,16 @@ dasm_inst_array_idx_from_code_off__linear_scan(DASM_InstArray *array, U64 off)
|
||||
U64 result = 0;
|
||||
for(U64 idx = 0; idx < array->count; idx += 1)
|
||||
{
|
||||
if(array->v[idx].code_off == off)
|
||||
U64 next_off = (idx+1 < array->count ? array->v[idx+1].code_off : max_U64);
|
||||
if(array->v[idx].code_off <= off && off < next_off)
|
||||
{
|
||||
result = idx;
|
||||
if(!(array->v[idx].flags & DASM_InstFlag_Decorative))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -236,14 +240,16 @@ dasm_info_from_hash_params(DASM_Scope *scope, U128 hash, DASM_Params *params)
|
||||
}
|
||||
if(node == 0)
|
||||
{
|
||||
log_infof("[dasm] cache miss, creating node...\n");
|
||||
log_infof(" hash: [0x%I64x 0x%I64x]\n", hash.u64[0], hash.u64[1]);
|
||||
log_infof(" vaddr: 0x%I64x\n", params->vaddr);
|
||||
log_infof(" arch: %S\n", string_from_architecture(params->arch));
|
||||
log_infof(" style_flags: 0x%x\n", params->style_flags);
|
||||
log_infof(" syntax: %i\n", params->syntax);
|
||||
log_infof(" base_vaddr: 0x%I64x\n", params->base_vaddr);
|
||||
log_infof(" dbgi_key: [%S 0x%I64x]\n", params->dbgi_key.path, params->dbgi_key.min_timestamp);
|
||||
LogInfoNamedBlockF("dasm_new_node")
|
||||
{
|
||||
log_infof("hash: [0x%I64x 0x%I64x]\n", hash.u64[0], hash.u64[1]);
|
||||
log_infof("vaddr: 0x%I64x\n", params->vaddr);
|
||||
log_infof("arch: %S\n", string_from_architecture(params->arch));
|
||||
log_infof("style_flags: 0x%x\n", params->style_flags);
|
||||
log_infof("syntax: %i\n", params->syntax);
|
||||
log_infof("base_vaddr: 0x%I64x\n", params->base_vaddr);
|
||||
log_infof("dbgi_key: [%S 0x%I64x]\n", params->dbgi_key.path, params->dbgi_key.min_timestamp);
|
||||
}
|
||||
node = stripe->free_node;
|
||||
if(node)
|
||||
{
|
||||
@@ -355,7 +361,7 @@ dasm_u2p_dequeue_req(Arena *arena, U128 *hash_out, DASM_Params *params_out)
|
||||
}
|
||||
os_condition_variable_wait(dasm_shared->u2p_ring_cv, dasm_shared->u2p_ring_mutex, max_U64);
|
||||
}
|
||||
os_condition_variable_broadcast(dasm_shared->u2p_ring_mutex);
|
||||
os_condition_variable_broadcast(dasm_shared->u2p_ring_cv);
|
||||
}
|
||||
|
||||
internal void
|
||||
@@ -432,7 +438,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
ud_set_syntax(&udc, params.syntax == DASM_Syntax_Intel ? UD_SYN_INTEL : UD_SYN_ATT);
|
||||
|
||||
// rjf: disassemble
|
||||
RDI_SourceFile *last_file = &rdi_source_file_nil;
|
||||
RDI_SourceFile *last_file = &rdi_nil_element_union.source_file;
|
||||
RDI_Line *last_line = 0;
|
||||
for(U64 off = 0; off < data.size;)
|
||||
{
|
||||
@@ -454,15 +460,16 @@ dasm_parse_thread__entry_point(void *p)
|
||||
if(rdi != &di_rdi_parsed_nil)
|
||||
{
|
||||
U64 voff = (params.vaddr+off) - params.base_vaddr;
|
||||
U32 unit_idx = rdi_vmap_idx_from_voff(rdi->unit_vmap, rdi->unit_vmap_count, voff);
|
||||
RDI_Unit *unit = rdi_element_from_idx(rdi, units, unit_idx);
|
||||
RDI_ParsedLineInfo unit_line_info = {0};
|
||||
rdi_line_info_from_unit(rdi, unit, &unit_line_info);
|
||||
U32 unit_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_UnitVMap, voff);
|
||||
RDI_Unit *unit = rdi_element_from_name_idx(rdi, Units, unit_idx);
|
||||
RDI_LineTable *line_table = rdi_element_from_name_idx(rdi, LineTables, unit->line_table_idx);
|
||||
RDI_ParsedLineTable unit_line_info = {0};
|
||||
rdi_parsed_from_line_table(rdi, line_table, &unit_line_info);
|
||||
U64 line_info_idx = rdi_line_info_idx_from_voff(&unit_line_info, voff);
|
||||
if(line_info_idx < unit_line_info.count)
|
||||
{
|
||||
RDI_Line *line = &unit_line_info.lines[line_info_idx];
|
||||
RDI_SourceFile *file = rdi_element_from_idx(rdi, source_files, line->file_idx);
|
||||
RDI_SourceFile *file = rdi_element_from_name_idx(rdi, SourceFiles, line->file_idx);
|
||||
String8 file_normalized_full_path = {0};
|
||||
file_normalized_full_path.str = rdi_string_from_idx(rdi, file->normal_full_path_string_idx, &file_normalized_full_path.size);
|
||||
if(file != last_file)
|
||||
@@ -470,15 +477,19 @@ dasm_parse_thread__entry_point(void *p)
|
||||
if(params.style_flags & DASM_StyleFlag_SourceFilesNames &&
|
||||
file->normal_full_path_string_idx != 0 && file_normalized_full_path.size != 0)
|
||||
{
|
||||
DASM_Inst inst = {0};
|
||||
String8 inst_string = push_str8f(scratch.arena, "> %S", file_normalized_full_path);
|
||||
DASM_Inst inst = {u32_from_u64_saturate(off), DASM_InstFlag_Decorative, 0, r1u64(inst_strings.total_size + inst_strings.node_count,
|
||||
inst_strings.total_size + inst_strings.node_count + inst_string.size)};
|
||||
dasm_inst_chunk_list_push(scratch.arena, &inst_list, 1024, &inst);
|
||||
str8_list_pushf(scratch.arena, &inst_strings, "> %S", file_normalized_full_path);
|
||||
str8_list_push(scratch.arena, &inst_strings, inst_string);
|
||||
}
|
||||
if(params.style_flags & DASM_StyleFlag_SourceFilesNames && file->normal_full_path_string_idx == 0)
|
||||
{
|
||||
DASM_Inst inst = {0};
|
||||
String8 inst_string = str8_lit(">");
|
||||
DASM_Inst inst = {u32_from_u64_saturate(off), DASM_InstFlag_Decorative, 0, r1u64(inst_strings.total_size + inst_strings.node_count,
|
||||
inst_strings.total_size + inst_strings.node_count + inst_string.size)};
|
||||
dasm_inst_chunk_list_push(scratch.arena, &inst_list, 1024, &inst);
|
||||
str8_list_pushf(scratch.arena, &inst_strings, ">");
|
||||
str8_list_push(scratch.arena, &inst_strings, inst_string);
|
||||
}
|
||||
last_file = file;
|
||||
}
|
||||
@@ -510,9 +521,11 @@ dasm_parse_thread__entry_point(void *p)
|
||||
String8 line_text = str8_skip_chop_whitespace(str8_substr(data, text_info.lines_ranges[line->line_num-1]));
|
||||
if(line_text.size != 0)
|
||||
{
|
||||
DASM_Inst inst = {0};
|
||||
String8 inst_string = push_str8f(scratch.arena, "> %S", line_text);
|
||||
DASM_Inst inst = {u32_from_u64_saturate(off), DASM_InstFlag_Decorative, 0, r1u64(inst_strings.total_size + inst_strings.node_count,
|
||||
inst_strings.total_size + inst_strings.node_count + inst_string.size)};
|
||||
dasm_inst_chunk_list_push(scratch.arena, &inst_list, 1024, &inst);
|
||||
str8_list_pushf(scratch.arena, &inst_strings, "> %S", line_text);
|
||||
str8_list_push(scratch.arena, &inst_strings, inst_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -526,7 +539,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
String8 addr_part = {0};
|
||||
if(params.style_flags & DASM_StyleFlag_Addresses)
|
||||
{
|
||||
addr_part = push_str8f(scratch.arena, "%s%016I64X ", rdi != &di_rdi_parsed_nil ? " " : "", params.vaddr+off);
|
||||
addr_part = push_str8f(scratch.arena, "%s0x%016I64x ", rdi != &di_rdi_parsed_nil ? " " : "", params.vaddr+off);
|
||||
}
|
||||
String8 code_bytes_part = {0};
|
||||
if(params.style_flags & DASM_StyleFlag_CodeBytes)
|
||||
@@ -550,12 +563,12 @@ dasm_parse_thread__entry_point(void *p)
|
||||
String8 symbol_part = {0};
|
||||
if(jump_dst_vaddr != 0 && rdi != &di_rdi_parsed_nil && params.style_flags & DASM_StyleFlag_SymbolNames)
|
||||
{
|
||||
RDI_U32 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, jump_dst_vaddr-params.base_vaddr);
|
||||
RDI_U32 scope_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_ScopeVMap, jump_dst_vaddr-params.base_vaddr);
|
||||
if(scope_idx != 0)
|
||||
{
|
||||
RDI_Scope *scope = rdi_element_from_idx(rdi, scopes, scope_idx);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
RDI_U32 procedure_idx = scope->proc_idx;
|
||||
RDI_Procedure *procedure = rdi_element_from_idx(rdi, procedures, procedure_idx);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_idx);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
|
||||
if(procedure_name.size != 0)
|
||||
@@ -565,7 +578,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
}
|
||||
}
|
||||
String8 inst_string = push_str8f(scratch.arena, "%S%S%s%S", addr_part, code_bytes_part, udc.asm_buf, symbol_part);
|
||||
DASM_Inst inst = {off, rel_voff, r1u64(inst_strings.total_size + inst_strings.node_count,
|
||||
DASM_Inst inst = {u32_from_u64_saturate(off), 0, rel_voff, r1u64(inst_strings.total_size + inst_strings.node_count,
|
||||
inst_strings.total_size + inst_strings.node_count + inst_string.size)};
|
||||
dasm_inst_chunk_list_push(scratch.arena, &inst_list, 1024, &inst);
|
||||
str8_list_push(scratch.arena, &inst_strings, inst_string);
|
||||
|
||||
@@ -42,10 +42,17 @@ struct DASM_Params
|
||||
////////////////////////////////
|
||||
//~ rjf: Instruction Types
|
||||
|
||||
typedef U32 DASM_InstFlags;
|
||||
enum
|
||||
{
|
||||
DASM_InstFlag_Decorative = (1<<0),
|
||||
};
|
||||
|
||||
typedef struct DASM_Inst DASM_Inst;
|
||||
struct DASM_Inst
|
||||
{
|
||||
U64 code_off;
|
||||
U32 code_off;
|
||||
DASM_InstFlags flags;
|
||||
U64 addr;
|
||||
Rng1U64 text_range;
|
||||
};
|
||||
|
||||
+11
-51
@@ -22,6 +22,13 @@ di_hash_from_key(DI_Key *k)
|
||||
return hash;
|
||||
}
|
||||
|
||||
internal DI_Key
|
||||
di_key_zero(void)
|
||||
{
|
||||
DI_Key key = {0};
|
||||
return key;
|
||||
}
|
||||
|
||||
internal B32
|
||||
di_key_match(DI_Key *a, DI_Key *b)
|
||||
{
|
||||
@@ -294,7 +301,7 @@ di_open(DI_Key *key)
|
||||
U64 stripe_idx = slot_idx%di_shared->stripes_count;
|
||||
DI_Slot *slot = &di_shared->slots[slot_idx];
|
||||
DI_Stripe *stripe = &di_shared->stripes[stripe_idx];
|
||||
log_infof("opening debug info: %S [0x%I64x]\n", key_normalized.path, key_normalized.min_timestamp);
|
||||
log_infof("open_debug_info: {\"%S\", 0x%I64x}\n", key_normalized.path, key_normalized.min_timestamp);
|
||||
OS_MutexScopeW(stripe->rw_mutex)
|
||||
{
|
||||
//- rjf: find existing node
|
||||
@@ -350,7 +357,7 @@ di_close(DI_Key *key)
|
||||
U64 stripe_idx = slot_idx%di_shared->stripes_count;
|
||||
DI_Slot *slot = &di_shared->slots[slot_idx];
|
||||
DI_Stripe *stripe = &di_shared->stripes[stripe_idx];
|
||||
log_infof("closing debug info: %S [0x%I64x]\n", key_normalized.path, key_normalized.min_timestamp);
|
||||
log_infof("close_debug_info: {\"%S\", 0x%I64x}\n", key_normalized.path, key_normalized.min_timestamp);
|
||||
OS_MutexScopeW(stripe->rw_mutex)
|
||||
{
|
||||
//- rjf: find existing node
|
||||
@@ -840,59 +847,12 @@ di_parse_thread__entry_point(void *p)
|
||||
RDI_Parsed rdi_parsed = rdi_parsed_maybe_compressed;
|
||||
if(got_task)
|
||||
{
|
||||
U64 decompressed_size = file_props.size;
|
||||
for(U64 dsec_idx = 0; dsec_idx < rdi_parsed_maybe_compressed.dsec_count; dsec_idx += 1)
|
||||
{
|
||||
decompressed_size += (rdi_parsed_maybe_compressed.dsecs[dsec_idx].unpacked_size - rdi_parsed_maybe_compressed.dsecs[dsec_idx].encoded_size);
|
||||
}
|
||||
U64 decompressed_size = rdi_decompressed_size_from_parsed(&rdi_parsed_maybe_compressed);
|
||||
if(decompressed_size > file_props.size)
|
||||
{
|
||||
rdi_parsed_arena = arena_alloc();
|
||||
U8 *decompressed_data = push_array_no_zero(rdi_parsed_arena, U8, decompressed_size);
|
||||
|
||||
// rjf: copy header
|
||||
RDI_Header *src_header = (RDI_Header *)file_base;
|
||||
RDI_Header *dst_header = (RDI_Header *)decompressed_data;
|
||||
{
|
||||
MemoryCopy(dst_header, src_header, sizeof(RDI_Header));
|
||||
}
|
||||
|
||||
// rjf: copy & adjust sections for decompressed version
|
||||
if(rdi_parsed_maybe_compressed.dsec_count != 0)
|
||||
{
|
||||
RDI_DataSection *dsec_base = (RDI_DataSection *)(decompressed_data + dst_header->data_section_off);
|
||||
MemoryCopy(dsec_base, (U8 *)file_base + src_header->data_section_off, sizeof(RDI_DataSection) * rdi_parsed_maybe_compressed.dsec_count);
|
||||
U64 off = dst_header->data_section_off + sizeof(RDI_DataSection) * rdi_parsed_maybe_compressed.dsec_count;
|
||||
off += 7;
|
||||
off -= off%8;
|
||||
for(U64 idx = 0; idx < rdi_parsed_maybe_compressed.dsec_count; idx += 1)
|
||||
{
|
||||
dsec_base[idx].encoding = RDI_DataSectionEncoding_Unpacked;
|
||||
dsec_base[idx].off = off;
|
||||
dsec_base[idx].encoded_size = dsec_base[idx].unpacked_size;
|
||||
off += dsec_base[idx].unpacked_size;
|
||||
off += 7;
|
||||
off -= off%8;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: decompress sections into new decompressed file buffer
|
||||
if(rdi_parsed_maybe_compressed.dsec_count != 0)
|
||||
{
|
||||
RDI_DataSection *src_first = rdi_parsed_maybe_compressed.dsecs;
|
||||
RDI_DataSection *dst_first = (RDI_DataSection *)(decompressed_data + dst_header->data_section_off);
|
||||
RDI_DataSection *src_opl = src_first + rdi_parsed_maybe_compressed.dsec_count;
|
||||
RDI_DataSection *dst_opl = dst_first + rdi_parsed_maybe_compressed.dsec_count;
|
||||
for(RDI_DataSection *src = src_first, *dst = dst_first;
|
||||
src < src_opl && dst < dst_opl;
|
||||
src += 1, dst += 1)
|
||||
{
|
||||
rr_lzb_simple_decode((U8*)file_base + src->off, src->encoded_size,
|
||||
decompressed_data + dst->off, dst->unpacked_size);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: re-parse
|
||||
rdi_decompress_parsed(decompressed_data, decompressed_size, &rdi_parsed_maybe_compressed);
|
||||
RDI_ParseStatus parse_status = rdi_parse(decompressed_data, decompressed_size, &rdi_parsed);
|
||||
(void)parse_status;
|
||||
}
|
||||
|
||||
+2
-35
@@ -192,47 +192,14 @@ struct DI_Shared
|
||||
|
||||
global DI_Shared *di_shared = 0;
|
||||
thread_static DI_TCTX *di_tctx = 0;
|
||||
global RDI_Parsed di_rdi_parsed_nil =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0},
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&rdi_top_level_info_nil,
|
||||
&rdi_binary_section_nil, 1,
|
||||
&rdi_file_path_node_nil, 1,
|
||||
&rdi_source_file_nil, 1,
|
||||
&rdi_unit_nil, 1,
|
||||
&rdi_vmap_entry_nil, 1,
|
||||
&rdi_type_node_nil, 1,
|
||||
&rdi_udt_nil, 1,
|
||||
&rdi_member_nil, 1,
|
||||
&rdi_enum_member_nil, 1,
|
||||
&rdi_global_variable_nil, 1,
|
||||
&rdi_vmap_entry_nil, 1,
|
||||
&rdi_thread_variable_nil, 1,
|
||||
&rdi_procedure_nil, 1,
|
||||
&rdi_scope_nil, 1,
|
||||
&rdi_voff_nil, 1,
|
||||
&rdi_vmap_entry_nil, 1,
|
||||
&rdi_local_nil, 1,
|
||||
&rdi_location_block_nil, 1,
|
||||
0, 0,
|
||||
0, 0,
|
||||
};
|
||||
global RDI_Parsed di_rdi_parsed_nil = {0};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
internal U64 di_hash_from_string(String8 string, StringMatchFlags match_flags);
|
||||
internal U64 di_hash_from_key(DI_Key *k);
|
||||
internal DI_Key di_key_zero(void);
|
||||
internal B32 di_key_match(DI_Key *a, DI_Key *b);
|
||||
internal DI_Key di_key_copy(Arena *arena, DI_Key *src);
|
||||
internal DI_Key di_normalized_key_from_key(Arena *arena, DI_Key *src);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
typedef struct DMN_CtrlCtx DMN_CtrlCtx;
|
||||
struct DMN_CtrlCtx
|
||||
{
|
||||
U64 u64 [1];
|
||||
U64 u64[1];
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -217,6 +217,11 @@ internal void dmn_access_close(void);
|
||||
#define DMN_AccessScope DeferLoopChecked(dmn_access_open(), dmn_access_close())
|
||||
|
||||
//- rjf: processes
|
||||
internal U64 dmn_process_memory_reserve(DMN_Handle process, U64 vaddr, U64 size);
|
||||
internal void dmn_process_memory_commit(DMN_Handle process, U64 vaddr, U64 size);
|
||||
internal void dmn_process_memory_decommit(DMN_Handle process, U64 vaddr, U64 size);
|
||||
internal void dmn_process_memory_release(DMN_Handle process, U64 vaddr, U64 size);
|
||||
internal void dmn_process_memory_protect(DMN_Handle process, U64 vaddr, U64 size, OS_AccessFlags flags);
|
||||
internal U64 dmn_process_read(DMN_Handle process, Rng1U64 range, void *dst);
|
||||
internal B32 dmn_process_write(DMN_Handle process, Rng1U64 range, void *src);
|
||||
#define dmn_process_read_struct(process, vaddr, ptr) dmn_process_read((process), r1u64((vaddr), (vaddr)+(sizeof(*ptr))), ptr)
|
||||
|
||||
@@ -60,6 +60,7 @@ DMN_ExceptionKind_COUNT,
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 dmn_event_kind_string_table[17];
|
||||
extern String8 dmn_exception_kind_string_table[5];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // DEMON_META_H
|
||||
|
||||
+284
-101
@@ -580,6 +580,7 @@ internal B32
|
||||
dmn_w32_thread_read_reg_block(Architecture arch, HANDLE thread, void *reg_block)
|
||||
{
|
||||
B32 result = 0;
|
||||
ProfBeginFunction();
|
||||
switch(arch)
|
||||
{
|
||||
////////////////////////////
|
||||
@@ -817,6 +818,7 @@ dmn_w32_thread_read_reg_block(Architecture arch, HANDLE thread, void *reg_block)
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
}
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -824,6 +826,7 @@ internal B32
|
||||
dmn_w32_thread_write_reg_block(Architecture arch, HANDLE thread, void *reg_block)
|
||||
{
|
||||
B32 result = 0;
|
||||
ProfBeginFunction();
|
||||
switch(arch)
|
||||
{
|
||||
////////////////////////////
|
||||
@@ -1050,6 +1053,7 @@ dmn_w32_thread_write_reg_block(Architecture arch, HANDLE thread, void *reg_block
|
||||
}break;
|
||||
}
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->reg_gen);
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1342,7 +1346,9 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
B32 any_processes_live = dmn_w32_shared->new_process_pending;
|
||||
if(!any_processes_live)
|
||||
{
|
||||
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first; process != &dmn_w32_entity_nil; process = process->next)
|
||||
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first;
|
||||
process != &dmn_w32_entity_nil;
|
||||
process = process->next)
|
||||
{
|
||||
if(process->kind == DMN_W32_EntityKind_Process)
|
||||
{
|
||||
@@ -1379,10 +1385,38 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: get single step thread's context (x64 single-step-set fast path)
|
||||
//
|
||||
CONTEXT *single_step_thread_ctx = 0;
|
||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero()))
|
||||
{
|
||||
DMN_W32_Entity *thread = dmn_w32_entity_from_handle(ctrls->single_step_thread);
|
||||
Architecture arch = thread->arch;
|
||||
switch(arch)
|
||||
{
|
||||
default:{}break;
|
||||
case Architecture_x64:
|
||||
{
|
||||
U32 ctx_flags = DMN_W32_CTX_X64|DMN_W32_CTX_INTEL_CONTROL;
|
||||
DWORD size = 0;
|
||||
InitializeContext(0, ctx_flags, 0, &size);
|
||||
if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
void *ctx_memory = push_array(scratch.arena, U8, size);
|
||||
if(!InitializeContext(ctx_memory, ctx_flags, &single_step_thread_ctx, &size))
|
||||
{
|
||||
single_step_thread_ctx = 0;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: set single step bit
|
||||
//
|
||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero()))
|
||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero())) ProfScope("set single step bit")
|
||||
{
|
||||
DMN_W32_Entity *thread = dmn_w32_entity_from_handle(ctrls->single_step_thread);
|
||||
Architecture arch = thread->arch;
|
||||
@@ -1396,7 +1430,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
case Architecture_arm32:
|
||||
{NotImplemented;}break;
|
||||
|
||||
//- rjf: x86/64
|
||||
//- rjf: x86
|
||||
case Architecture_x86:
|
||||
{
|
||||
REGS_RegBlockX86 regs = {0};
|
||||
@@ -1404,12 +1438,22 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
regs.eflags.u32 |= 0x100;
|
||||
dmn_thread_write_reg_block(ctrls->single_step_thread, ®s);
|
||||
}break;
|
||||
|
||||
//- rjf: x64
|
||||
case Architecture_x64:
|
||||
{
|
||||
REGS_RegBlockX64 regs = {0};
|
||||
dmn_thread_read_reg_block(ctrls->single_step_thread, ®s);
|
||||
regs.rflags.u64 |= 0x100;
|
||||
dmn_thread_write_reg_block(ctrls->single_step_thread, ®s);
|
||||
if(!GetThreadContext(thread->handle, single_step_thread_ctx))
|
||||
{
|
||||
single_step_thread_ctx = 0;
|
||||
}
|
||||
if(single_step_thread_ctx != 0)
|
||||
{
|
||||
U64 rflags = single_step_thread_ctx->EFlags|0x2;
|
||||
U64 new_rflags = rflags | 0x100;
|
||||
single_step_thread_ctx->EFlags = new_rflags;
|
||||
SetThreadContext(thread->handle, single_step_thread_ctx);
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->reg_gen);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -1418,6 +1462,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//- rjf: write all traps into memory
|
||||
//
|
||||
U8 *trap_swap_bytes = push_array_no_zero(scratch.arena, U8, ctrls->traps.trap_count);
|
||||
ProfScope("write all traps into memory")
|
||||
{
|
||||
U64 trap_idx = 0;
|
||||
for(DMN_TrapChunkNode *n = ctrls->traps.first; n != 0; n = n->next)
|
||||
@@ -1438,6 +1483,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//
|
||||
DMN_W32_EntityNode *first_run_thread = 0;
|
||||
DMN_W32_EntityNode *last_run_thread = 0;
|
||||
ProfScope("produce list of threads which will run")
|
||||
{
|
||||
//- rjf: scan all processes
|
||||
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first;
|
||||
@@ -1471,10 +1517,9 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
B32 is_frozen = 0;
|
||||
{
|
||||
// rjf: single-step? freeze if not the single-step thread.
|
||||
if(!dmn_handle_match(dmn_handle_zero(), ctrls->single_step_thread) &&
|
||||
!dmn_handle_match(dmn_w32_handle_from_entity(thread), ctrls->single_step_thread))
|
||||
if(!dmn_handle_match(dmn_handle_zero(), ctrls->single_step_thread))
|
||||
{
|
||||
is_frozen = 1;
|
||||
is_frozen = !dmn_handle_match(dmn_w32_handle_from_entity(thread), ctrls->single_step_thread);
|
||||
}
|
||||
|
||||
// rjf: not single-stepping? determine based on run controls freezing info
|
||||
@@ -1519,6 +1564,8 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//////////////////////////
|
||||
//- rjf: resume threads which will run
|
||||
//
|
||||
ProfScope("resume threads which will run")
|
||||
{
|
||||
for(DMN_W32_EntityNode *n = first_run_thread; n != 0; n = n->next)
|
||||
{
|
||||
DMN_W32_Entity *thread = n->v;
|
||||
@@ -1543,50 +1590,41 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: if run threads are marked as having reported an explicit trap
|
||||
// on their last run, shift their RIPs past that trap instruction, so
|
||||
// that they may continue
|
||||
//- rjf: loop, consume win32 debug events until we produce the relevant demon events
|
||||
//
|
||||
for(DMN_W32_EntityNode *n = first_run_thread; n != 0; n = n->next)
|
||||
U64 begin_time = os_now_microseconds();
|
||||
String8List debug_strings = {0};
|
||||
DMN_Event *debug_strings_event = 0;
|
||||
for(B32 keep_going = 1; keep_going;)
|
||||
{
|
||||
DMN_W32_Entity *thread = n->v;
|
||||
if(thread->thread.last_run_reported_trap)
|
||||
{
|
||||
Temp temp = temp_begin(scratch.arena);
|
||||
U64 regs_block_size = regs_block_size_from_architecture(thread->arch);
|
||||
void *regs_block = push_array(temp.arena, U8, regs_block_size);
|
||||
B32 good = dmn_w32_thread_read_reg_block(thread->arch, thread->handle, regs_block);
|
||||
U64 pre_rip = regs_rip_from_arch_block(thread->arch, regs_block);
|
||||
if(good && pre_rip == thread->thread.last_run_reported_trap_pre_rip)
|
||||
{
|
||||
regs_arch_block_write_rip(thread->arch, regs_block, thread->thread.last_run_reported_trap_post_rip);
|
||||
dmn_w32_thread_write_reg_block(thread->arch, thread->handle, regs_block);
|
||||
}
|
||||
temp_end(temp);
|
||||
thread->thread.last_run_reported_trap = 0;
|
||||
thread->thread.last_run_reported_trap_post_rip = 0;
|
||||
}
|
||||
}
|
||||
keep_going = 0;
|
||||
|
||||
//////////////////////////
|
||||
////////////////////////
|
||||
//- rjf: choose win32 resume code
|
||||
//
|
||||
DWORD resume_code = DBG_CONTINUE;
|
||||
{
|
||||
if(dmn_w32_shared->exception_not_handled && !ctrls->ignore_previous_exception)
|
||||
{
|
||||
dmn_w32_shared->exception_not_handled = 0;
|
||||
log_infof("using DBG_EXCEPTION_NOT_HANDLED\n");
|
||||
resume_code = DBG_EXCEPTION_NOT_HANDLED;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_infof("using DBG_CONTINUE\n");
|
||||
}
|
||||
dmn_w32_shared->exception_not_handled = 0;
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
////////////////////////
|
||||
//- rjf: inform windows that we're resuming, run, & obtain next debug event
|
||||
//
|
||||
DEBUG_EVENT evt = {0};
|
||||
B32 evt_good = 0;
|
||||
ProfScope("inform windows that we're resuming, run, & obtain next debug event")
|
||||
{
|
||||
B32 resume_good = 1;
|
||||
if(dmn_w32_shared->resume_needed)
|
||||
@@ -1599,56 +1637,27 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
}
|
||||
if(resume_good)
|
||||
{
|
||||
evt_good = !!WaitForDebugEvent(&evt, INFINITE);
|
||||
evt_good = !!WaitForDebugEvent(&evt, 100);
|
||||
if(evt_good)
|
||||
{
|
||||
dmn_w32_shared->resume_needed = 1;
|
||||
dmn_w32_shared->resume_pid = evt.dwProcessId;
|
||||
dmn_w32_shared->resume_tid = evt.dwThreadId;
|
||||
}
|
||||
else
|
||||
{
|
||||
keep_going = 1;
|
||||
}
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->run_gen);
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->mem_gen);
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->reg_gen);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: suspend threads which ran
|
||||
//
|
||||
if(evt_good) for(DMN_W32_EntityNode *n = first_run_thread; n != 0; n = n->next)
|
||||
{
|
||||
DMN_W32_Entity *thread = n->v;
|
||||
DWORD suspend_result = SuspendThread(thread->handle);
|
||||
switch(suspend_result)
|
||||
{
|
||||
case 0xffffffffu:
|
||||
{
|
||||
// TODO(rjf): error - unknown cause. need to do do GetLastError, FormatMessage
|
||||
//
|
||||
// NOTE(rjf): this can happen when the event is EXIT_THREAD_DEBUG_EVENT
|
||||
// or EXIT_PROCESS_DEBUG_EVENT. after such an event, SuspendThread
|
||||
// gives error code 5 (access denied). this has no adverse effects, but
|
||||
// if we want to start reporting errors we should take care to avoid
|
||||
// calling SuspendThread in that case.
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
DWORD desired_counter = 1;
|
||||
DWORD current_counter = suspend_result + 1;
|
||||
if(current_counter != desired_counter)
|
||||
{
|
||||
// NOTE(rjf): Warning. We've suspended to something higher than 1.
|
||||
// In this case, it means the user probably created the thread in
|
||||
// a suspended state, or they called SuspendThread.
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
////////////////////////
|
||||
//- rjf: process the new event
|
||||
//
|
||||
if(evt_good)
|
||||
if(evt_good) ProfScope("process the new event")
|
||||
{
|
||||
switch(evt.dwDebugEventCode)
|
||||
{
|
||||
@@ -1926,7 +1935,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//
|
||||
case EXCEPTION_DEBUG_EVENT:
|
||||
{
|
||||
// NOTE(rjf): Notes on multithreaded breakpoint events
|
||||
//- NOTE(rjf): Notes on multithreaded breakpoint events
|
||||
// (2021/11/1):
|
||||
//
|
||||
// When many threads are simultaneously running, multiple threads
|
||||
@@ -1954,7 +1963,17 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
// #B. If the actual unmodified instruction is an int 3, then this
|
||||
// becomes a trap event and we do not reset RIP.
|
||||
|
||||
// NOTE(rjf): The exception record struct has a 32-bit version and a
|
||||
//- NOTE(rjf): Further notes on MULTITHREADED STEPPING ACCESS VIOLATION
|
||||
// EVENTS! @rjf @rjf @rjf
|
||||
// (2024/05/29):
|
||||
//
|
||||
// Just adding another comment here to document that the above long
|
||||
// comment went completely unnoticed by me during a pass over demon,
|
||||
// and I had removed the proper rollback stuff here without reading
|
||||
// the above comment. So this comment just serves to make that
|
||||
// original comment even heftier.
|
||||
|
||||
//- NOTE(rjf): The exception record struct has a 32-bit version and a
|
||||
// 64-bit version. We only currently handle the 64-bit version.
|
||||
|
||||
//- rjf: unpack
|
||||
@@ -2007,22 +2026,56 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
}
|
||||
|
||||
//- rjf: determine whether to roll back instruction pointer
|
||||
B32 should_do_rollback = (is_trap);
|
||||
B32 should_do_rollback = (hit_user_trap || (is_trap && !hit_explicit_trap));
|
||||
|
||||
//- rjf: roll back thread's instruction pointer
|
||||
U64 post_trap_rip = 0;
|
||||
if(should_do_rollback)
|
||||
if(should_do_rollback) ProfScope("roll back thread's instruction pointer")
|
||||
{
|
||||
switch(thread->arch)
|
||||
{
|
||||
//- rjf: default, general path
|
||||
default:
|
||||
{
|
||||
Temp temp = temp_begin(scratch.arena);
|
||||
U64 regs_block_size = regs_block_size_from_architecture(thread->arch);
|
||||
void *regs_block = push_array(scratch.arena, U8, regs_block_size);
|
||||
if(dmn_w32_thread_read_reg_block(thread->arch, thread->handle, regs_block))
|
||||
{
|
||||
post_trap_rip = regs_rip_from_arch_block(thread->arch, regs_block);
|
||||
regs_arch_block_write_rip(thread->arch, regs_block, instruction_pointer);
|
||||
dmn_w32_thread_write_reg_block(thread->arch, thread->handle, regs_block);
|
||||
}
|
||||
temp_end(temp);
|
||||
}break;
|
||||
|
||||
//- rjf: x64 (fastpath)
|
||||
case Architecture_x64:
|
||||
{
|
||||
CONTEXT *ctx = 0;
|
||||
U32 ctx_flags = DMN_W32_CTX_X64|DMN_W32_CTX_INTEL_CONTROL;
|
||||
DWORD size = 0;
|
||||
InitializeContext(0, ctx_flags, 0, &size);
|
||||
if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
void *ctx_memory = push_array(scratch.arena, U8, size);
|
||||
if(!InitializeContext(ctx_memory, ctx_flags, &ctx, &size))
|
||||
{
|
||||
ctx = 0;
|
||||
}
|
||||
}
|
||||
if(!GetThreadContext(thread->handle, ctx))
|
||||
{
|
||||
ctx = 0;
|
||||
}
|
||||
if(ctx != 0)
|
||||
{
|
||||
U64 rip = ctx->Rip;
|
||||
U64 new_rip = instruction_pointer;
|
||||
ctx->Rip = new_rip;
|
||||
SetThreadContext(thread->handle, ctx);
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->reg_gen);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: not a user trap, not an explicit trap, then it's a trap that
|
||||
@@ -2044,14 +2097,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
e->flags = exception->ExceptionFlags;
|
||||
e->instruction_pointer = (U64)exception->ExceptionAddress;
|
||||
|
||||
// rjf: explicit trap -> mark this thread as having reported this trap
|
||||
if(hit_explicit_trap)
|
||||
{
|
||||
thread->thread.last_run_reported_trap = 1;
|
||||
thread->thread.last_run_reported_trap_pre_rip = instruction_pointer;
|
||||
thread->thread.last_run_reported_trap_post_rip = post_trap_rip;
|
||||
}
|
||||
|
||||
//- rjf: fill according to exception code
|
||||
switch(exception->ExceptionCode)
|
||||
{
|
||||
@@ -2190,21 +2235,29 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
U64 string_size = (U64)evt.u.DebugString.nDebugStringLength;
|
||||
|
||||
// rjf: read memory
|
||||
U8 *buffer = push_array_no_zero(arena, U8, string_size + 1);
|
||||
U8 *buffer = push_array_no_zero(scratch.arena, U8, string_size + 1);
|
||||
dmn_w32_process_read(process->handle, r1u64(string_address, string_address+string_size), buffer);
|
||||
buffer[string_size] = 0;
|
||||
|
||||
// rjf: generate event
|
||||
// rjf: extract into string
|
||||
String8 debug_string = str8(buffer, string_size);
|
||||
if(debug_string.size != 0 && buffer[string_size-1] == 0)
|
||||
{
|
||||
DMN_Event *e = dmn_event_list_push(arena, &events);
|
||||
e->kind = DMN_EventKind_DebugString;
|
||||
e->process = dmn_w32_handle_from_entity(process);
|
||||
e->thread = dmn_w32_handle_from_entity(thread);
|
||||
e->string = str8(buffer, string_size);
|
||||
if(string_size != 0 && buffer[string_size-1] == 0)
|
||||
{
|
||||
e->string.size -= 1;
|
||||
debug_string.size -= 1;
|
||||
}
|
||||
|
||||
// rjf: make debug string event
|
||||
debug_strings_event = dmn_event_list_push(arena, &events);
|
||||
debug_strings_event->kind = DMN_EventKind_DebugString;
|
||||
|
||||
// rjf: push into debug strings
|
||||
str8_list_push(scratch.arena, &debug_strings, debug_string);
|
||||
keep_going = 1;
|
||||
|
||||
// rjf: exit loop, given sufficient amount of text
|
||||
if(debug_strings.total_size >= KB(4))
|
||||
{
|
||||
keep_going = 0;
|
||||
}
|
||||
}break;
|
||||
|
||||
@@ -2231,8 +2284,62 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
//- rjf: exit loop after a little while, so we keep pumping e.g. debug strings
|
||||
//
|
||||
if(os_now_microseconds() >= begin_time+100000)
|
||||
{
|
||||
keep_going = 0;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
//- rjf: send out event for any remaining debug strings
|
||||
//
|
||||
if(debug_strings.total_size != 0 && debug_strings_event != 0)
|
||||
{
|
||||
String8 debug_strings_joined = str8_list_join(arena, &debug_strings, 0);
|
||||
debug_strings_event->string = debug_strings_joined;
|
||||
}
|
||||
|
||||
////////////////////////
|
||||
//- rjf: suspend threads which ran
|
||||
//
|
||||
ProfScope("suspend threads which ran")
|
||||
{
|
||||
for(DMN_W32_EntityNode *n = first_run_thread; n != 0; n = n->next)
|
||||
{
|
||||
DMN_W32_Entity *thread = n->v;
|
||||
DWORD suspend_result = SuspendThread(thread->handle);
|
||||
switch(suspend_result)
|
||||
{
|
||||
case 0xffffffffu:
|
||||
{
|
||||
// TODO(rjf): error - unknown cause. need to do do GetLastError, FormatMessage
|
||||
//
|
||||
// NOTE(rjf): this can happen when the event is EXIT_THREAD_DEBUG_EVENT
|
||||
// or EXIT_PROCESS_DEBUG_EVENT. after such an event, SuspendThread
|
||||
// gives error code 5 (access denied). this has no adverse effects, but
|
||||
// if we want to start reporting errors we should take care to avoid
|
||||
// calling SuspendThread in that case.
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
DWORD desired_counter = 1;
|
||||
DWORD current_counter = suspend_result + 1;
|
||||
if(current_counter != desired_counter)
|
||||
{
|
||||
// NOTE(rjf): Warning. We've suspended to something higher than 1.
|
||||
// In this case, it means the user probably created the thread in
|
||||
// a suspended state, or they called SuspendThread.
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: gather new thread-names
|
||||
if(dmn_w32_GetThreadDescription != 0)
|
||||
ProfScope("gather new thread names") if(dmn_w32_GetThreadDescription != 0)
|
||||
{
|
||||
for(DMN_W32_Entity *process = dmn_w32_shared->entities_base->first;
|
||||
process != &dmn_w32_entity_nil;
|
||||
@@ -2276,6 +2383,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//////////////////////////
|
||||
//- rjf: restore original memory at trap locations
|
||||
//
|
||||
ProfScope("restore original memory at trap locations")
|
||||
{
|
||||
U64 trap_idx = 0;
|
||||
for(DMN_TrapChunkNode *n = ctrls->traps.first; n != 0; n = n->next)
|
||||
@@ -2295,7 +2403,7 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
//////////////////////////
|
||||
//- rjf: unset single step bit
|
||||
//
|
||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero()))
|
||||
if(!dmn_handle_match(ctrls->single_step_thread, dmn_handle_zero())) ProfScope("unset single step bit")
|
||||
{
|
||||
DMN_W32_Entity *thread = dmn_w32_entity_from_handle(ctrls->single_step_thread);
|
||||
Architecture arch = thread->arch;
|
||||
@@ -2319,10 +2427,18 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls)
|
||||
}break;
|
||||
case Architecture_x64:
|
||||
{
|
||||
REGS_RegBlockX64 regs = {0};
|
||||
dmn_thread_read_reg_block(ctrls->single_step_thread, ®s);
|
||||
regs.rflags.u64 &= ~0x100;
|
||||
dmn_thread_write_reg_block(ctrls->single_step_thread, ®s);
|
||||
if(!GetThreadContext(thread->handle, single_step_thread_ctx))
|
||||
{
|
||||
single_step_thread_ctx = 0;
|
||||
}
|
||||
if(ctx != 0)
|
||||
{
|
||||
U64 rflags = single_step_thread_ctx->EFlags|0x2;
|
||||
U64 new_rflags = rflags & ~0x100;
|
||||
single_step_thread_ctx->EFlags = new_rflags;
|
||||
SetThreadContext(thread->handle, single_step_thread_ctx);
|
||||
ins_atomic_u64_inc_eval(&dmn_w32_shared->reg_gen);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -2470,6 +2586,73 @@ dmn_access_close(void)
|
||||
|
||||
//- rjf: processes
|
||||
|
||||
internal U64
|
||||
dmn_process_memory_reserve(DMN_Handle process, U64 vaddr, U64 size)
|
||||
{
|
||||
U64 result = 0;
|
||||
DMN_AccessScope
|
||||
{
|
||||
DMN_W32_Entity *process_entity = dmn_w32_entity_from_handle(process);
|
||||
result = (U64)VirtualAllocEx(process_entity->handle, (void *)vaddr, size, MEM_RESERVE, PAGE_READWRITE);
|
||||
if(result == 0)
|
||||
{
|
||||
result = (U64)VirtualAllocEx(process_entity->handle, 0, size, MEM_RESERVE, PAGE_READWRITE);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
dmn_process_memory_commit(DMN_Handle process, U64 vaddr, U64 size)
|
||||
{
|
||||
DMN_AccessScope
|
||||
{
|
||||
DMN_W32_Entity *process_entity = dmn_w32_entity_from_handle(process);
|
||||
(U64)VirtualAllocEx(process_entity->handle, (void *)vaddr, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
dmn_process_memory_decommit(DMN_Handle process, U64 vaddr, U64 size)
|
||||
{
|
||||
DMN_AccessScope
|
||||
{
|
||||
DMN_W32_Entity *process_entity = dmn_w32_entity_from_handle(process);
|
||||
VirtualFreeEx(process_entity->handle, (void *)vaddr, size, MEM_DECOMMIT);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
dmn_process_memory_release(DMN_Handle process, U64 vaddr, U64 size)
|
||||
{
|
||||
DMN_AccessScope
|
||||
{
|
||||
DMN_W32_Entity *process_entity = dmn_w32_entity_from_handle(process);
|
||||
VirtualFreeEx(process_entity->handle, (void *)vaddr, 0, MEM_RELEASE);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
dmn_process_memory_protect(DMN_Handle process, U64 vaddr, U64 size, OS_AccessFlags flags)
|
||||
{
|
||||
DMN_AccessScope
|
||||
{
|
||||
DMN_W32_Entity *process_entity = dmn_w32_entity_from_handle(process);
|
||||
DWORD old_flags = 0;
|
||||
DWORD new_flags = PAGE_NOACCESS;
|
||||
switch(flags)
|
||||
{
|
||||
default:{}break;
|
||||
case OS_AccessFlag_Execute:{new_flags = PAGE_EXECUTE;}break;
|
||||
case OS_AccessFlag_Execute|OS_AccessFlag_Read:{new_flags = PAGE_EXECUTE_READ;}break;
|
||||
case OS_AccessFlag_Execute|OS_AccessFlag_Read|OS_AccessFlag_Write:{new_flags = PAGE_EXECUTE_READWRITE;}break;
|
||||
case OS_AccessFlag_Read:{new_flags = PAGE_READONLY;}break;
|
||||
case OS_AccessFlag_Read|OS_AccessFlag_Write:{new_flags = PAGE_READWRITE;}break;
|
||||
}
|
||||
VirtualProtectEx(process_entity->handle, (void *)vaddr, size, new_flags, &old_flags);
|
||||
}
|
||||
}
|
||||
|
||||
internal U64
|
||||
dmn_process_read(DMN_Handle process, Rng1U64 range, void *dst)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
#define DMN_W32_EXCEPTION_NO_MEMORY 0xC0000017u
|
||||
#define DMN_W32_EXCEPTION_THROW 0xE06D7363u
|
||||
#define DMN_W32_EXCEPTION_SET_THREAD_NAME 0x406d1388u
|
||||
#define DMN_w32_EXCEPTION_CLRDBG_NOTIFICATION 0x04242420u
|
||||
#define DMN_w32_EXCEPTION_CLR 0xE0434352u
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Win32 Register Codes
|
||||
@@ -61,11 +63,11 @@
|
||||
#define DMN_W32_CTX_X86 0x00010000
|
||||
#define DMN_W32_CTX_X64 0x00100000
|
||||
|
||||
#define DMN_W32_CTX_INTEL_CONTROL 0x0001
|
||||
#define DMN_W32_CTX_INTEL_INTEGER 0x0002
|
||||
#define DMN_W32_CTX_INTEL_SEGMENTS 0x0004
|
||||
#define DMN_W32_CTX_INTEL_FLOATS 0x0008
|
||||
#define DMN_W32_CTX_INTEL_DEBUG 0x0010
|
||||
#define DMN_W32_CTX_INTEL_CONTROL 0x0001 // segss, rsp, segcs, rip, and rflags
|
||||
#define DMN_W32_CTX_INTEL_INTEGER 0x0002 // rax, rcx, rdx, rbx, rbp, rsi, rdi, and r8-r15
|
||||
#define DMN_W32_CTX_INTEL_SEGMENTS 0x0004 // segds, seges, segfs, and seggs
|
||||
#define DMN_W32_CTX_INTEL_FLOATS 0x0008 // xmm0-xmm15
|
||||
#define DMN_W32_CTX_INTEL_DEBUG 0x0010 // dr0-dr3 and dr6-dr7
|
||||
#define DMN_W32_CTX_INTEL_EXTENDED 0x0020
|
||||
#define DMN_W32_CTX_INTEL_XSTATE 0x0040
|
||||
|
||||
@@ -118,9 +120,6 @@ struct DMN_W32_Entity
|
||||
U64 thread_local_base;
|
||||
U64 last_name_hash;
|
||||
U64 name_gather_time_us;
|
||||
B32 last_run_reported_trap;
|
||||
U64 last_run_reported_trap_pre_rip;
|
||||
U64 last_run_reported_trap_post_rip;
|
||||
}
|
||||
thread;
|
||||
struct
|
||||
|
||||
+926
-375
File diff suppressed because it is too large
Load Diff
+154
-24
@@ -77,6 +77,7 @@ struct DF_CtrlCtx
|
||||
{
|
||||
DF_Handle thread;
|
||||
U64 unwind_count;
|
||||
U64 inline_unwind_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -87,8 +88,8 @@ enum
|
||||
{
|
||||
DF_EntityKindFlag_LeafMutationUserConfig = (1<<0),
|
||||
DF_EntityKindFlag_TreeMutationUserConfig = (1<<1),
|
||||
DF_EntityKindFlag_LeafMutationProfileConfig= (1<<2),
|
||||
DF_EntityKindFlag_TreeMutationProfileConfig= (1<<3),
|
||||
DF_EntityKindFlag_LeafMutationProjectConfig= (1<<2),
|
||||
DF_EntityKindFlag_TreeMutationProjectConfig= (1<<3),
|
||||
DF_EntityKindFlag_LeafMutationSoftHalt = (1<<4),
|
||||
DF_EntityKindFlag_TreeMutationSoftHalt = (1<<5),
|
||||
DF_EntityKindFlag_LeafMutationDebugInfoMap = (1<<6),
|
||||
@@ -222,7 +223,7 @@ typedef struct DF_CtrlFlowPointNode DF_CtrlFlowPointNode;
|
||||
struct DF_CtrlFlowPointNode
|
||||
{
|
||||
DF_CtrlFlowPointNode *next;
|
||||
DF_CtrlFlowPoint point;
|
||||
DF_CtrlFlowPoint v;
|
||||
};
|
||||
|
||||
typedef struct DF_CtrlFlowPointList DF_CtrlFlowPointList;
|
||||
@@ -265,10 +266,15 @@ struct DF_Eval
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Hook Types
|
||||
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) DF_Eval name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, struct DF_CfgVal *val)
|
||||
typedef struct DF_CfgNode DF_CfgNode;
|
||||
typedef struct DF_CfgVal DF_CfgVal;
|
||||
typedef struct DF_CfgTable DF_CfgTable;
|
||||
typedef struct DF_EvalView DF_EvalView;
|
||||
typedef struct DF_EvalVizBlockList DF_EvalVizBlockList;
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) DF_Eval name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgVal *val)
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_eval_resolution__##name
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name))
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_EvalView *eval_view, DF_Eval eval, String8 string, struct DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, struct DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, DF_Eval eval, String8 string, DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name) df_core_view_rule_viz_block_prod__##name
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name))
|
||||
typedef DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleEvalResolutionHookFunctionType);
|
||||
@@ -378,8 +384,6 @@ struct DF_CoreViewRuleSpec
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity Types
|
||||
|
||||
typedef U32 DF_EntitySubKind;
|
||||
|
||||
typedef U32 DF_EntityFlags;
|
||||
enum
|
||||
{
|
||||
@@ -427,7 +431,6 @@ struct DF_Entity
|
||||
|
||||
// rjf: metadata
|
||||
DF_EntityKind kind;
|
||||
DF_EntitySubKind subkind;
|
||||
DF_EntityFlags flags;
|
||||
DF_EntityID id;
|
||||
U64 generation;
|
||||
@@ -511,6 +514,83 @@ struct DF_EntityFuzzyItemArray
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Rich (Including Inline) Unwind Types
|
||||
|
||||
typedef struct DF_UnwindFrame DF_UnwindFrame;
|
||||
struct DF_UnwindFrame
|
||||
{
|
||||
void *regs;
|
||||
RDI_Parsed *rdi;
|
||||
RDI_Procedure *procedure;
|
||||
RDI_InlineSite *inline_site;
|
||||
U64 base_unwind_idx;
|
||||
U64 inline_unwind_idx;
|
||||
};
|
||||
|
||||
typedef struct DF_UnwindFrameNode DF_UnwindFrameNode;
|
||||
struct DF_UnwindFrameNode
|
||||
{
|
||||
DF_UnwindFrameNode *next;
|
||||
DF_UnwindFrame v;
|
||||
};
|
||||
|
||||
typedef struct DF_UnwindFrameList DF_UnwindFrameList;
|
||||
struct DF_UnwindFrameList
|
||||
{
|
||||
DF_UnwindFrameNode *first;
|
||||
DF_UnwindFrameNode *last;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct DF_UnwindFrameArray DF_UnwindFrameArray;
|
||||
struct DF_UnwindFrameArray
|
||||
{
|
||||
DF_UnwindFrame *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct DF_Unwind DF_Unwind;
|
||||
struct DF_Unwind
|
||||
{
|
||||
DF_UnwindFrameArray frames;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Line Info Types
|
||||
|
||||
typedef struct DF_Line DF_Line;
|
||||
struct DF_Line
|
||||
{
|
||||
DF_Handle file;
|
||||
TxtPt pt;
|
||||
Rng1U64 voff_range;
|
||||
DI_Key dbgi_key;
|
||||
};
|
||||
|
||||
typedef struct DF_LineNode DF_LineNode;
|
||||
struct DF_LineNode
|
||||
{
|
||||
DF_LineNode *next;
|
||||
DF_Line v;
|
||||
};
|
||||
|
||||
typedef struct DF_LineList DF_LineList;
|
||||
struct DF_LineList
|
||||
{
|
||||
DF_LineNode *first;
|
||||
DF_LineNode *last;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct DF_LineListArray DF_LineListArray;
|
||||
struct DF_LineListArray
|
||||
{
|
||||
DF_LineList *v;
|
||||
U64 count;
|
||||
DI_KeyList dbgi_keys;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Source <-> Disasm Types
|
||||
|
||||
@@ -573,6 +653,38 @@ struct DF_TextLineDasm2SrcInfoList
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Interaction Context Register Types
|
||||
|
||||
typedef struct DF_InteractRegs DF_InteractRegs;
|
||||
struct DF_InteractRegs
|
||||
{
|
||||
DF_Handle module;
|
||||
DF_Handle process;
|
||||
DF_Handle thread;
|
||||
U64 unwind_count;
|
||||
U64 inline_unwind_count;
|
||||
DF_Handle window;
|
||||
DF_Handle panel;
|
||||
DF_Handle view;
|
||||
DF_Handle file;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
U128 text_key;
|
||||
TXT_LangKind lang_kind;
|
||||
Rng1U64 vaddr_range;
|
||||
Rng1U64 voff_range;
|
||||
DF_LineList lines;
|
||||
DI_Key dbgi_key;
|
||||
};
|
||||
|
||||
typedef struct DF_InteractRegsNode DF_InteractRegsNode;
|
||||
struct DF_InteractRegsNode
|
||||
{
|
||||
DF_InteractRegsNode *next;
|
||||
DF_InteractRegs v;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Visualization Types
|
||||
|
||||
@@ -1122,10 +1234,18 @@ struct DF_State
|
||||
F32 dt;
|
||||
F32 seconds_til_autosave;
|
||||
|
||||
// rjf: interaction registers
|
||||
Arena *frame_arenas[2];
|
||||
DF_InteractRegsNode base_interact_regs;
|
||||
DF_InteractRegsNode *top_interact_regs;
|
||||
|
||||
// rjf: top-level command batch
|
||||
Arena *root_cmd_arena;
|
||||
DF_CmdList root_cmds;
|
||||
|
||||
// rjf: output log key
|
||||
U128 output_log_key;
|
||||
|
||||
// rjf: history cache
|
||||
DF_StateDeltaHistory *hist;
|
||||
|
||||
@@ -1194,7 +1314,6 @@ struct DF_State
|
||||
Arena *ctrl_msg_arena;
|
||||
CTRL_MsgList ctrl_msgs;
|
||||
U64 ctrl_exception_code_filters[(CTRL_ExceptionCodeKind_COUNT+63)/64];
|
||||
B32 ctrl_solo_stepping_mode;
|
||||
|
||||
// rjf: control thread ctrl -> user reading state
|
||||
CTRL_EntityStore *ctrl_entity_store;
|
||||
@@ -1246,7 +1365,6 @@ read_only global DF_Entity df_g_nil_entity =
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
// rjf: allocationless, simple equipment
|
||||
{0},
|
||||
@@ -1270,8 +1388,7 @@ read_only global DF_Entity df_g_nil_entity =
|
||||
0,
|
||||
|
||||
// rjf: name equipment
|
||||
0,
|
||||
zero_struct,
|
||||
{0},
|
||||
0,
|
||||
|
||||
// rjf: timestamp
|
||||
@@ -1320,7 +1437,6 @@ internal B32 df_expand_key_match(DF_ExpandKey a, DF_ExpandKey b);
|
||||
|
||||
//- rjf: table
|
||||
internal void df_expand_tree_table_init(Arena *arena, DF_ExpandTreeTable *table, U64 slot_count);
|
||||
internal void df_expand_tree_table_animate(DF_ExpandTreeTable *table, F32 dt);
|
||||
internal DF_ExpandNode *df_expand_node_from_key(DF_ExpandTreeTable *table, DF_ExpandKey key);
|
||||
internal B32 df_expand_key_is_set(DF_ExpandTreeTable *table, DF_ExpandKey key);
|
||||
internal void df_expand_set_expansion(Arena *arena, DF_ExpandTreeTable *table, DF_ExpandKey parent_key, DF_ExpandKey key, B32 expanded);
|
||||
@@ -1346,6 +1462,11 @@ internal String8 df_string_from_cfg_node_key(DF_CfgNode *node, String8 key, Stri
|
||||
internal DF_Inst df_single_inst_from_machine_code__x64(Arena *arena, U64 start_voff, String8 string);
|
||||
internal DF_Inst df_single_inst_from_machine_code(Arena *arena, Architecture arch, U64 start_voff, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Extraction Type Pure Functions
|
||||
|
||||
internal DF_LineList df_line_list_copy(Arena *arena, DF_LineList *list);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Flow Analysis Pure Functions
|
||||
|
||||
@@ -1414,9 +1535,6 @@ internal DF_EntityArray df_entity_array_from_list(Arena *arena, DF_EntityList *l
|
||||
internal DF_EntityFuzzyItemArray df_entity_fuzzy_item_array_from_entity_list_needle(Arena *arena, DF_EntityList *list, String8 needle);
|
||||
internal DF_EntityFuzzyItemArray df_entity_fuzzy_item_array_from_entity_array_needle(Arena *arena, DF_EntityArray *array, String8 needle);
|
||||
|
||||
//- rjf: entity -> text info
|
||||
internal TXTI_Handle df_txti_handle_from_entity(DF_Entity *entity);
|
||||
|
||||
//- rjf: full path building, from file/folder entities
|
||||
internal String8 df_full_path_from_entity(Arena *arena, DF_Entity *entity);
|
||||
|
||||
@@ -1537,16 +1655,20 @@ internal Rng1U64 df_vaddr_range_from_voff_range(DF_Entity *module, Rng1U64 voff_
|
||||
internal String8 df_symbol_name_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, U64 voff);
|
||||
internal String8 df_symbol_name_from_process_vaddr(Arena *arena, DF_Entity *process, U64 vaddr);
|
||||
|
||||
//- rjf: src -> voff lookups
|
||||
internal DF_TextLineSrc2DasmInfoListArray df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entity *file, Rng1S64 line_num_range);
|
||||
|
||||
//- rjf: voff -> src lookups
|
||||
internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
|
||||
|
||||
//- rjf: symbol -> voff lookups
|
||||
internal U64 df_voff_from_dbgi_key_symbol_name(DI_Key *dbgi_key, String8 symbol_name);
|
||||
internal U64 df_type_num_from_dbgi_key_name(DI_Key *dbgi_key, String8 name);
|
||||
|
||||
//- rjf: voff -> line info
|
||||
internal DF_LineList df_lines_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, U64 voff);
|
||||
|
||||
//- rjf: file:line -> line info
|
||||
internal DF_LineListArray df_lines_array_from_file_line_range(Arena *arena, DF_Entity *file, Rng1S64 line_num_range);
|
||||
internal DF_LineList df_lines_from_file_line_num(Arena *arena, DF_Entity *file, S64 line_num);
|
||||
|
||||
//- rjf: src -> voff lookups
|
||||
internal DF_TextLineSrc2DasmInfoListArray df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entity *file, Rng1S64 line_num_range);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Process/Thread/Module Info Lookups
|
||||
|
||||
@@ -1558,6 +1680,8 @@ internal EVAL_String2NumMap *df_push_locals_map_from_dbgi_key_voff(Arena *arena,
|
||||
internal EVAL_String2NumMap *df_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal B32 df_set_thread_rip(DF_Entity *thread, U64 vaddr);
|
||||
internal DF_Entity *df_module_from_thread_candidates(DF_Entity *thread, DF_EntityList *candidates);
|
||||
internal DF_Unwind df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, CTRL_Unwind *base_unwind);
|
||||
internal DF_UnwindFrame *df_frame_from_unwind_idxs(DF_Unwind *unwind, U64 base_unwind_idx, U64 inline_unwind_idx);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Entity -> Log Entities
|
||||
@@ -1571,7 +1695,7 @@ internal DF_Entity *df_log_from_entity(DF_Entity *entity);
|
||||
internal void df_push_ctrl_msg(CTRL_Msg *msg);
|
||||
|
||||
//- rjf: control thread running
|
||||
internal void df_ctrl_run(DF_RunKind run, DF_Entity *target, DF_Entity *run_thread, CTRL_RunFlags flags, CTRL_TrapList *run_traps);
|
||||
internal void df_ctrl_run(DF_RunKind run, DF_Entity *run_thread, CTRL_RunFlags flags, CTRL_TrapList *run_traps);
|
||||
|
||||
//- rjf: stopped info from the control thread
|
||||
internal CTRL_Event df_ctrl_last_stop_event(void);
|
||||
@@ -1638,11 +1762,17 @@ internal DF_EvalVizRow *df_eval_viz_row_list_push_new(Arena *arena, EVAL_ParseCt
|
||||
////////////////////////////////
|
||||
//~ rjf: Main State Accessors/Mutators
|
||||
|
||||
//- rjf: frame metadata
|
||||
//- rjf: frame data
|
||||
internal F32 df_dt(void);
|
||||
internal U64 df_frame_index(void);
|
||||
internal Arena *df_frame_arena(void);
|
||||
internal F64 df_time_in_seconds(void);
|
||||
|
||||
//- rjf: interaction registers
|
||||
internal DF_InteractRegs *df_interact_regs(void);
|
||||
internal DF_InteractRegs *df_push_interact_regs(void);
|
||||
internal DF_InteractRegs *df_pop_interact_regs(void);
|
||||
|
||||
//- rjf: undo/redo history
|
||||
internal DF_StateDeltaHistory *df_state_delta_history(void);
|
||||
|
||||
|
||||
+22
-20
@@ -8,7 +8,7 @@
|
||||
DF_CfgSrcTable:
|
||||
{
|
||||
{"user" User OpenUser WriteUserData ApplyUserData }
|
||||
{"profile" Profile OpenProfile WriteProfileData ApplyProfileData }
|
||||
{"project" Project OpenProject WriteProjectData ApplyProjectData }
|
||||
{"command_line" CommandLine Null Null Null }
|
||||
{"transient" Transient Null Null Null }
|
||||
}
|
||||
@@ -30,9 +30,6 @@ DF_EntityKindTable:
|
||||
//- rjf: auto view rules
|
||||
{AutoViewRule auto_view_rule 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 "Label" Binoculars "Auto View Rule" }
|
||||
|
||||
//- rjf: text attachments
|
||||
{FlashMarker flash_marker 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Null "Flash Marker" }
|
||||
|
||||
//- rjf: watch pins
|
||||
{WatchPin watch_pin 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 1 "Expression" Pin "Watch Pin" }
|
||||
|
||||
@@ -47,6 +44,9 @@ DF_EntityKindTable:
|
||||
{ExecutionPath execution_path 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 "Execution Path" Null "Execution Path" }
|
||||
{EntryPointName entry_point_name 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 "Symbol Name" Null "Entry Point Name" }
|
||||
|
||||
//- rjf: recent projects
|
||||
{RecentProject recent_project 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 "Path" Briefcase "Recent Project" }
|
||||
|
||||
//- rjf: src -> dst mapping
|
||||
{Source source 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Path" Null "Source" }
|
||||
{Dest dest 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Path" Null "Destination" }
|
||||
@@ -93,6 +93,8 @@ DF_CmdParamSlotTable:
|
||||
{PreferDisassembly prefer_dasm `B32`}
|
||||
{ForceConfirm force_confirm `B32`}
|
||||
{Dir2 dir2 `Dir2`}
|
||||
{BaseUnwindIndex base_unwind_index `U64`}
|
||||
{InlineUnwindIndex inline_unwind_index `U64`}
|
||||
}
|
||||
|
||||
@table(name lister_omit q_slot q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon string display_name desc search_tags )
|
||||
@@ -140,18 +142,14 @@ DF_CoreCmdTable:// | | |
|
||||
{RunToCursor 0 Null Nil 0 0 0 0 0 0 Play "run_to_cursor" "Run To Cursor" "Runs the selected thread to the current cursor." "" }
|
||||
{SetNextStatement 0 Null Nil 0 0 0 0 0 0 RightArrow "set_next_statement" "Set Next Statement" "Sets the selected thread's instruction pointer to the cursor's position." "" }
|
||||
|
||||
//- rjf: solo stepping mode
|
||||
{EnableSoloSteppingMode 0 Null Nil 0 0 0 0 0 0 Thread "enable_solo_stepping_mode" "Enable Solo Stepping Mode" "Enables 'solo stepping mode', which suspends all non-selected threads before stepping." "solo,stepping,mode,suspend" }
|
||||
{DisableSoloSteppingMode 0 Null Nil 0 0 0 0 0 0 Thread "disable_solo_stepping_mode" "Disable Solo Stepping Mode" "Disables 'solo stepping mode', which suspends all non-selected threads before stepping." "solo,stepping,mode,suspend" }
|
||||
|
||||
//- rjf: debug control context management operations
|
||||
{SelectThread 0 Entity Thread 0 0 0 0 0 1 Null "select_thread" "Select Thread" "Selects a thread." "" }
|
||||
{SelectThreadWindow 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_window" "Select Thread On Window" "Selects a thread for the active window, overriding the global selected thread." "" }
|
||||
{SelectThreadView 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_view" "Select Thread On View" "Selects a thread for the active view, overriding the global and per-window selected threads." "" }
|
||||
{SelectUnwind 1 Null Nil 0 0 0 0 0 0 Null "select_unwind" "Select Unwind" "Selects an unwind frame number for the selected thread." "" }
|
||||
{UpOneFrame 0 Null Nil 0 0 0 0 0 0 UpArrow "up_one_frame" "Up One Frame" "Selects the callstack frame above the currently selected." "" }
|
||||
{DownOneFrame 0 Null Nil 0 0 0 0 0 0 DownArrow "down_one_frame" "Down One Frame" "Selects the callstack frame below the currently selected." "" }
|
||||
{FreezeThread 0 Entity Thread 0 0 0 0 0 1 Locked "freeze_thread" "Freeze Thread" "Freezes the passed thread." "" }
|
||||
{UpOneFrame 0 Null Nil 0 0 0 0 0 0 UpArrow "up_one_frame" "Up One Frame" "Selects the call stack frame above the currently selected." "" }
|
||||
{DownOneFrame 0 Null Nil 0 0 0 0 0 0 DownArrow "down_one_frame" "Down One Frame" "Selects the call stack frame below the currently selected." "callstack,unwind" }
|
||||
{FreezeThread 0 Entity Thread 0 0 0 0 0 1 Locked "freeze_thread" "Freeze Thread" "Freezes the passed thread." "callstack,unwind" }
|
||||
{ThawThread 0 Entity Thread 0 0 0 0 0 1 Unlocked "thaw_thread" "Thaw Thread" "Thaws the passed thread." "" }
|
||||
{FreezeProcess 0 Entity Process 0 0 0 0 0 1 Locked "freeze_process" "Freeze Process" "Freezes the passed process." "" }
|
||||
{ThawProcess 0 Entity Process 0 0 0 0 0 1 Unlocked "thaw_process" "Thaw Process" "Thaws the passed process." "" }
|
||||
@@ -221,11 +219,13 @@ DF_CoreCmdTable:// | | |
|
||||
//- rjf: files
|
||||
{SetCurrentPath 1 Null Nil 0 0 0 0 0 0 FileOutline "set_current_path" "Set Current Path" "Sets the debugger's current path, which is used as a starting point when browsing for files." "" }
|
||||
{Open 0 FilePath Nil 1 0 0 0 0 1 FileOutline "open" "Open" "Opens a file." "code,source,file" }
|
||||
{Reload 0 Entity File 0 0 0 0 0 1 FileOutline "reload" "Reload" "Reloads a loaded file." "code,source,file,reload" }
|
||||
{ReloadActive 0 Null Nil 0 0 0 0 0 0 FileOutline "reload_active" "Reload Active File" "Reloads the active file." "code,source,file,reload" }
|
||||
{Switch 0 Entity File 0 0 0 0 0 1 FileOutline "switch" "Switch" "Switches to a loaded file." "code,source,file" }
|
||||
{SwitchToPartnerFile 0 Null Nil 0 0 0 0 0 0 FileOutline "switch_to_partner_file" "Switch To Partner File" "Switches to the focused file's partner; or from header to implementation or vice versa." "code,source,file" }
|
||||
|
||||
//- rjf: source <-> disasm
|
||||
{GoToDisassembly 0 Null Nil 0 0 0 0 0 0 Glasses "go_to_disassembly" "Go To Disassembly" "Goes to the disassembly, if any, for a given source code line." "code,source,disassembly,disasm" }
|
||||
{GoToSource 0 Null Nil 0 0 0 0 0 0 FileOutline "go_to_source" "Go To Source" "Goes to the source code, if any, for a given disassembly line." "code,source,disassembly,disasm" }
|
||||
|
||||
//- rjf: override file links
|
||||
{SetFileOverrideLinkSrc 1 Null Nil 0 0 0 0 0 0 Null "set_file_override_link_src" "Set File Override Link Source" "Sets the source path for an override file link." "" }
|
||||
{SetFileOverrideLinkDst 1 Null Nil 0 0 0 0 0 0 Null "set_file_override_link_dst" "Set File Override Link Destination" "Sets the destination path for an override file link." "" }
|
||||
@@ -236,16 +236,17 @@ DF_CoreCmdTable:// | | |
|
||||
{SetAutoViewRuleViewRule 1 Null Nil 0 0 0 0 0 0 Null "set_auto_view_rule_view_rule""Set Auto View Rule View Rule" "Sets the view rule string for an auto view rule." "" }
|
||||
|
||||
//- rjf: setting config paths
|
||||
{OpenUser 0 FilePath Nil 1 0 0 0 0 1 Person "open_user" "Open User" "Opens a user file path, immediately loading it, and begins autosaving to it." "load,user,profile,layout" }
|
||||
{OpenProfile 0 FilePath Nil 1 0 0 0 0 1 Briefcase "open_profile" "Open Profile" "Opens a profile file path, immediately loading it, and begins autosaving to it." "profile,project,session" }
|
||||
{OpenUser 0 FilePath Nil 1 0 0 0 0 1 Person "open_user" "Open User" "Opens a user file path, immediately loading it, and begins autosaving to it." "load,user,project,layout" }
|
||||
{OpenProject 0 FilePath Nil 1 0 0 0 0 1 Briefcase "open_project" "Open Project" "Opens a project file path, immediately loading it, and begins autosaving to it." "project,project,session" }
|
||||
{OpenRecentProject 0 Entity RecentProject 0 0 0 0 0 1 Briefcase "open_recent_project" "Open Recent Project" "Opens a recently used project file." "project,project,session" }
|
||||
|
||||
//- rjf: loading/applying stateful config changes
|
||||
{ApplyUserData 1 Null Nil 0 0 0 0 0 0 Null "apply_user_data" "Apply User Data" "Applies user data from the active user file." "" }
|
||||
{ApplyProfileData 1 Null Nil 0 0 0 0 0 0 Null "apply_profile_data" "Apply Profile Data" "Applies profile data from the active profile file." "" }
|
||||
{ApplyProjectData 1 Null Nil 0 0 0 0 0 0 Null "apply_project_data" "Apply Project Data" "Applies project data from the active project file." "" }
|
||||
|
||||
//- rjf: writing config changes
|
||||
{WriteUserData 1 Null Nil 0 0 0 0 0 0 Null "write_user_data" "Write User Data" "Writes user data to the active user file." "" }
|
||||
{WriteProfileData 1 Null Nil 0 0 0 0 0 0 Null "write_profile_data" "Write Profile Data" "Writes profile data to the active profile file." "" }
|
||||
{WriteProjectData 1 Null Nil 0 0 0 0 0 0 Null "write_project_data" "Write Project Data" "Writes project data to the active project file." "" }
|
||||
|
||||
//- rjf: meta controls
|
||||
{Edit 0 Null Nil 0 0 0 0 0 0 Pencil "edit" "Edit" "Edits the current selection." "" }
|
||||
@@ -378,7 +379,7 @@ DF_CoreCmdTable:// | | |
|
||||
{FilePathMap 0 Null Nil 0 0 0 0 0 0 FileOutline "file_path_map" "File Path Map" "Opens the file path mapping editor." "" }
|
||||
{AutoViewRules 0 Null Nil 0 0 0 0 0 0 Binoculars "auto_view_rules" "Auto View Rules" "Opens the auto view rule editor." "" }
|
||||
{Scheduler 0 Null Nil 0 0 0 0 0 0 Scheduler "scheduler" "Scheduler" "Opens the scheduler view, for process and thread controls." "threads,processes,targets" }
|
||||
{CallStack 0 Null Nil 0 0 0 0 0 0 Thread "call_stack" "Call Stack" "Opens the call stack view." "callstack,thread" }
|
||||
{CallStack 0 Null Nil 0 0 0 0 0 0 Thread "call_stack" "Call Stack" "Opens the call stack view." "callstack,thread,unwind" }
|
||||
{Modules 0 Null Nil 0 0 0 0 0 0 Module "modules" "Modules" "Opens the modules view." "" }
|
||||
{PendingEntity 1 Null Nil 0 0 0 0 0 0 FileOutline "pending_entity" "Pending Entity" "Opens a view which waits for the passed entity to be completely loaded, then replaces itself with a new view." "" }
|
||||
{Code 1 Null Nil 0 0 0 0 0 0 FileOutline "code" "Code" "Opens the code view for an already-loaded file." "" }
|
||||
@@ -395,7 +396,7 @@ DF_CoreCmdTable:// | | |
|
||||
{Breakpoints 0 Null Nil 0 0 0 0 0 0 CircleFilled "breakpoints" "Breakpoints" "Opens the breakpoints view." "" }
|
||||
{WatchPins 0 Null Nil 0 0 0 0 0 0 Pin "watch_pins" "Watch Pins" "Opens the watch pins view." "" }
|
||||
{ExceptionFilters 0 Null Nil 0 0 0 0 0 0 Gear "exception_filters" "Exception Filters" "Opens the exception filters view." "exceptions,filters" }
|
||||
{Theme 0 Null Nil 0 0 0 0 0 0 Palette "theme" "Theme" "Opens the theme view." "theme,color,scheme,palette" }
|
||||
{Settings 0 Null Nil 0 0 0 0 0 0 Gear "settings" "Settings" "Opens the settings view." "theme,color,scheme,options" }
|
||||
{PickFile 1 FilePath Nil 1 0 0 0 0 1 FileOutline "pick_file" "Pick File" "Opens the file browser to pick a file." "" }
|
||||
{PickFolder 1 FilePath Nil 0 1 0 0 0 1 FolderOpenFilled "pick_folder" "Pick Folder" "Opens the file browser to pick a folder." "" }
|
||||
{PickFileOrFolder 1 FilePath Nil 1 1 0 0 0 1 FileOutline "pick_file_or_folder" "Pick File/Folder" "Opens the file browser to pick a file or folder." "" }
|
||||
@@ -406,6 +407,7 @@ DF_CoreCmdTable:// | | |
|
||||
|
||||
//- rjf: developer commands
|
||||
{ToggleDevMenu 0 Null Nil 0 0 0 0 0 0 Null "toggle_dev_menu" "Toggle Developer Menu" "Opens and closes the developer menu." "" }
|
||||
{LogMarker 0 Null Nil 0 0 0 0 0 0 Null "log_marker" "Log Marker" "Logs a marker in the application log, to denote specific points in time within the log." "" }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -1777,7 +1779,7 @@ DF_DevToggleTable:
|
||||
|
||||
@data(DF_EntityKindFlags) df_g_entity_kind_flags_table:
|
||||
{
|
||||
@expand(DF_EntityKindTable a) `($(a.lf_mut_user_cfg)*DF_EntityKindFlag_LeafMutationUserConfig | $(a.lf_mut_prof_cfg)*DF_EntityKindFlag_LeafMutationProfileConfig | $(a.lf_mut_halt)*DF_EntityKindFlag_LeafMutationSoftHalt | $(a.lf_mut_dbg)*DF_EntityKindFlag_LeafMutationDebugInfoMap | $(a.tr_mut_user_cfg)*DF_EntityKindFlag_TreeMutationUserConfig | $(a.tr_mut_prof_cfg)*DF_EntityKindFlag_TreeMutationProfileConfig | $(a.tr_mut_halt)*DF_EntityKindFlag_TreeMutationSoftHalt | $(a.tr_mut_dbg)*DF_EntityKindFlag_TreeMutationDebugInfoMap | $(a.name_is_code)*DF_EntityKindFlag_NameIsCode | $(a.user_lifetime)*DF_EntityKindFlag_UserDefinedLifetime)`,
|
||||
@expand(DF_EntityKindTable a) `($(a.lf_mut_user_cfg)*DF_EntityKindFlag_LeafMutationUserConfig | $(a.lf_mut_prof_cfg)*DF_EntityKindFlag_LeafMutationProjectConfig | $(a.lf_mut_halt)*DF_EntityKindFlag_LeafMutationSoftHalt | $(a.lf_mut_dbg)*DF_EntityKindFlag_LeafMutationDebugInfoMap | $(a.tr_mut_user_cfg)*DF_EntityKindFlag_TreeMutationUserConfig | $(a.tr_mut_prof_cfg)*DF_EntityKindFlag_TreeMutationProjectConfig | $(a.tr_mut_halt)*DF_EntityKindFlag_TreeMutationSoftHalt | $(a.tr_mut_dbg)*DF_EntityKindFlag_TreeMutationDebugInfoMap | $(a.name_is_code)*DF_EntityKindFlag_NameIsCode | $(a.user_lifetime)*DF_EntityKindFlag_UserDefinedLifetime)`,
|
||||
}
|
||||
|
||||
@data(DF_EntityOpFlags) df_g_entity_kind_op_flags_table:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//- GENERATED CODE
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
Rng1U64 df_g_cmd_param_slot_range_table[22] =
|
||||
Rng1U64 df_g_cmd_param_slot_range_table[24] =
|
||||
{
|
||||
{0},
|
||||
{OffsetOf(DF_CmdParams, window), OffsetOf(DF_CmdParams, window) + sizeof(DF_Handle)},
|
||||
@@ -28,6 +28,8 @@ Rng1U64 df_g_cmd_param_slot_range_table[22] =
|
||||
{OffsetOf(DF_CmdParams, prefer_dasm), OffsetOf(DF_CmdParams, prefer_dasm) + sizeof(B32)},
|
||||
{OffsetOf(DF_CmdParams, force_confirm), OffsetOf(DF_CmdParams, force_confirm) + sizeof(B32)},
|
||||
{OffsetOf(DF_CmdParams, dir2), OffsetOf(DF_CmdParams, dir2) + sizeof(Dir2)},
|
||||
{OffsetOf(DF_CmdParams, base_unwind_index), OffsetOf(DF_CmdParams, base_unwind_index) + sizeof(U64)},
|
||||
{OffsetOf(DF_CmdParams, inline_unwind_index), OffsetOf(DF_CmdParams, inline_unwind_index) + sizeof(U64)},
|
||||
};
|
||||
|
||||
DF_IconKind df_g_entity_kind_icon_kind_table[25] =
|
||||
@@ -38,7 +40,6 @@ DF_IconKind_Machine,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_FileOutline,
|
||||
DF_IconKind_Binoculars,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Pin,
|
||||
DF_IconKind_CircleFilled,
|
||||
DF_IconKind_CircleFilled,
|
||||
@@ -47,6 +48,7 @@ DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Briefcase,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Null,
|
||||
DF_IconKind_Threads,
|
||||
@@ -67,7 +69,6 @@ str8_lit_comp("Machine"),
|
||||
str8_lit_comp("File"),
|
||||
str8_lit_comp("Override File Link"),
|
||||
str8_lit_comp("Auto View Rule"),
|
||||
str8_lit_comp("Flash Marker"),
|
||||
str8_lit_comp("Watch Pin"),
|
||||
str8_lit_comp("Breakpoint"),
|
||||
str8_lit_comp("Condition"),
|
||||
@@ -76,6 +77,7 @@ str8_lit_comp("Executable"),
|
||||
str8_lit_comp("Arguments"),
|
||||
str8_lit_comp("Execution Path"),
|
||||
str8_lit_comp("Entry Point Name"),
|
||||
str8_lit_comp("Recent Project"),
|
||||
str8_lit_comp("Source"),
|
||||
str8_lit_comp("Destination"),
|
||||
str8_lit_comp("Process"),
|
||||
@@ -96,7 +98,6 @@ str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Expression"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Expression"),
|
||||
@@ -107,6 +108,7 @@ str8_lit_comp("Execution Path"),
|
||||
str8_lit_comp("Symbol Name"),
|
||||
str8_lit_comp("Path"),
|
||||
str8_lit_comp("Path"),
|
||||
str8_lit_comp("Path"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
str8_lit_comp("Label"),
|
||||
@@ -119,31 +121,31 @@ str8_lit_comp("Label"),
|
||||
|
||||
DF_EntityKindFlags df_g_entity_kind_flags_table[25] =
|
||||
{
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(1*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 1*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(1*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 1*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProjectConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(1*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 1*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProjectConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProjectConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
|
||||
};
|
||||
|
||||
DF_EntityOpFlags df_g_entity_kind_op_flags_table[25] =
|
||||
@@ -154,7 +156,6 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[25] =
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
|
||||
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (1*DF_EntityOpFlag_Enable) | (1*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
@@ -165,6 +166,7 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[25] =
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (1*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (1*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
|
||||
@@ -178,7 +180,7 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[25] =
|
||||
String8 df_g_cfg_src_string_table[4] =
|
||||
{
|
||||
str8_lit_comp("user"),
|
||||
str8_lit_comp("profile"),
|
||||
str8_lit_comp("project"),
|
||||
str8_lit_comp("command_line"),
|
||||
str8_lit_comp("transient"),
|
||||
};
|
||||
@@ -186,7 +188,7 @@ str8_lit_comp("transient"),
|
||||
DF_CoreCmdKind df_g_cfg_src_load_cmd_kind_table[4] =
|
||||
{
|
||||
DF_CoreCmdKind_OpenUser,
|
||||
DF_CoreCmdKind_OpenProfile,
|
||||
DF_CoreCmdKind_OpenProject,
|
||||
DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
@@ -194,7 +196,7 @@ DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind df_g_cfg_src_write_cmd_kind_table[4] =
|
||||
{
|
||||
DF_CoreCmdKind_WriteUserData,
|
||||
DF_CoreCmdKind_WriteProfileData,
|
||||
DF_CoreCmdKind_WriteProjectData,
|
||||
DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
@@ -202,7 +204,7 @@ DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind df_g_cfg_src_apply_cmd_kind_table[4] =
|
||||
{
|
||||
DF_CoreCmdKind_ApplyUserData,
|
||||
DF_CoreCmdKind_ApplyProfileData,
|
||||
DF_CoreCmdKind_ApplyProjectData,
|
||||
DF_CoreCmdKind_Null,
|
||||
DF_CoreCmdKind_Null,
|
||||
};
|
||||
@@ -236,15 +238,13 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
|
||||
{ str8_lit_comp("step_over"), str8_lit_comp("Steps once, always over function calls, for either line or instructions."), str8_lit_comp(""), str8_lit_comp("Step Over"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_StepOver},
|
||||
{ str8_lit_comp("run_to_cursor"), str8_lit_comp("Runs the selected thread to the current cursor."), str8_lit_comp(""), str8_lit_comp("Run To Cursor"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Play},
|
||||
{ str8_lit_comp("set_next_statement"), str8_lit_comp("Sets the selected thread's instruction pointer to the cursor's position."), str8_lit_comp(""), str8_lit_comp("Set Next Statement"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_RightArrow},
|
||||
{ str8_lit_comp("enable_solo_stepping_mode"), str8_lit_comp("Enables 'solo stepping mode', which suspends all non-selected threads before stepping."), str8_lit_comp("solo,stepping,mode,suspend"), str8_lit_comp("Enable Solo Stepping Mode"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thread},
|
||||
{ str8_lit_comp("disable_solo_stepping_mode"), str8_lit_comp("Disables 'solo stepping mode', which suspends all non-selected threads before stepping."), str8_lit_comp("solo,stepping,mode,suspend"), str8_lit_comp("Disable Solo Stepping Mode"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thread},
|
||||
{ str8_lit_comp("select_thread"), str8_lit_comp("Selects a thread."), str8_lit_comp(""), str8_lit_comp("Select Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_thread_window"), str8_lit_comp("Selects a thread for the active window, overriding the global selected thread."), str8_lit_comp(""), str8_lit_comp("Select Thread On Window"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_thread_view"), str8_lit_comp("Selects a thread for the active view, overriding the global and per-window selected threads."), str8_lit_comp(""), str8_lit_comp("Select Thread On View"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("select_unwind"), str8_lit_comp("Selects an unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp("Select Unwind"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("up_one_frame"), str8_lit_comp("Selects the callstack frame above the currently selected."), str8_lit_comp(""), str8_lit_comp("Up One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_UpArrow},
|
||||
{ str8_lit_comp("down_one_frame"), str8_lit_comp("Selects the callstack frame below the currently selected."), str8_lit_comp(""), str8_lit_comp("Down One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_DownArrow},
|
||||
{ str8_lit_comp("freeze_thread"), str8_lit_comp("Freezes the passed thread."), str8_lit_comp(""), str8_lit_comp("Freeze Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Locked},
|
||||
{ str8_lit_comp("up_one_frame"), str8_lit_comp("Selects the call stack frame above the currently selected."), str8_lit_comp(""), str8_lit_comp("Up One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_UpArrow},
|
||||
{ str8_lit_comp("down_one_frame"), str8_lit_comp("Selects the call stack frame below the currently selected."), str8_lit_comp("callstack,unwind"), str8_lit_comp("Down One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_DownArrow},
|
||||
{ str8_lit_comp("freeze_thread"), str8_lit_comp("Freezes the passed thread."), str8_lit_comp("callstack,unwind"), str8_lit_comp("Freeze Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Locked},
|
||||
{ str8_lit_comp("thaw_thread"), str8_lit_comp("Thaws the passed thread."), str8_lit_comp(""), str8_lit_comp("Thaw Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Unlocked},
|
||||
{ str8_lit_comp("freeze_process"), str8_lit_comp("Freezes the passed process."), str8_lit_comp(""), str8_lit_comp("Freeze Process"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Process, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Locked},
|
||||
{ str8_lit_comp("thaw_process"), str8_lit_comp("Thaws the passed process."), str8_lit_comp(""), str8_lit_comp("Thaw Process"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Process, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Unlocked},
|
||||
@@ -292,21 +292,22 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
|
||||
{ str8_lit_comp("tab_bar_bottom"), str8_lit_comp("Anchors a panel's tab bar to the bottom of the panel."), str8_lit_comp(""), str8_lit_comp("Anchor Tab Bar To Bottom"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_DownArrow},
|
||||
{ str8_lit_comp("set_current_path"), str8_lit_comp("Sets the debugger's current path, which is used as a starting point when browsing for files."), str8_lit_comp(""), str8_lit_comp("Set Current Path"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("open"), str8_lit_comp("Opens a file."), str8_lit_comp("code,source,file"), str8_lit_comp("Open"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("reload"), str8_lit_comp("Reloads a loaded file."), str8_lit_comp("code,source,file,reload"), str8_lit_comp("Reload"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_File, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("reload_active"), str8_lit_comp("Reloads the active file."), str8_lit_comp("code,source,file,reload"), str8_lit_comp("Reload Active File"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("switch"), str8_lit_comp("Switches to a loaded file."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_File, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("switch_to_partner_file"), str8_lit_comp("Switches to the focused file's partner; or from header to implementation or vice versa."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch To Partner File"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("go_to_disassembly"), str8_lit_comp("Goes to the disassembly, if any, for a given source code line."), str8_lit_comp("code,source,disassembly,disasm"), str8_lit_comp("Go To Disassembly"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Glasses},
|
||||
{ str8_lit_comp("go_to_source"), str8_lit_comp("Goes to the source code, if any, for a given disassembly line."), str8_lit_comp("code,source,disassembly,disasm"), str8_lit_comp("Go To Source"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("set_file_override_link_src"), str8_lit_comp("Sets the source path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Source"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_file_override_link_dst"), str8_lit_comp("Sets the destination path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Destination"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_file_replacement_path"), str8_lit_comp("Sets the path which should be used as the replacement for the passed file."), str8_lit_comp(""), str8_lit_comp("Set File Replacement Path"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_auto_view_rule_type"), str8_lit_comp("Sets the type for an auto view rule."), str8_lit_comp(""), str8_lit_comp("Set Auto View Rule Type"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("set_auto_view_rule_view_rule"), str8_lit_comp("Sets the view rule string for an auto view rule."), str8_lit_comp(""), str8_lit_comp("Set Auto View Rule View Rule"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("open_user"), str8_lit_comp("Opens a user file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("load,user,profile,layout"), str8_lit_comp("Open User"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Person},
|
||||
{ str8_lit_comp("open_profile"), str8_lit_comp("Opens a profile file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("profile,project,session"), str8_lit_comp("Open Profile"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Briefcase},
|
||||
{ str8_lit_comp("open_user"), str8_lit_comp("Opens a user file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("load,user,project,layout"), str8_lit_comp("Open User"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Person},
|
||||
{ str8_lit_comp("open_project"), str8_lit_comp("Opens a project file path, immediately loading it, and begins autosaving to it."), str8_lit_comp("project,project,session"), str8_lit_comp("Open Project"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Briefcase},
|
||||
{ str8_lit_comp("open_recent_project"), str8_lit_comp("Opens a recently used project file."), str8_lit_comp("project,project,session"), str8_lit_comp("Open Recent Project"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_RecentProject, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Briefcase},
|
||||
{ str8_lit_comp("apply_user_data"), str8_lit_comp("Applies user data from the active user file."), str8_lit_comp(""), str8_lit_comp("Apply User Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("apply_profile_data"), str8_lit_comp("Applies profile data from the active profile file."), str8_lit_comp(""), str8_lit_comp("Apply Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("apply_project_data"), str8_lit_comp("Applies project data from the active project file."), str8_lit_comp(""), str8_lit_comp("Apply Project Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("write_user_data"), str8_lit_comp("Writes user data to the active user file."), str8_lit_comp(""), str8_lit_comp("Write User Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("write_profile_data"), str8_lit_comp("Writes profile data to the active profile file."), str8_lit_comp(""), str8_lit_comp("Write Profile Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("write_project_data"), str8_lit_comp("Writes project data to the active project file."), str8_lit_comp(""), str8_lit_comp("Write Project Data"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("edit"), str8_lit_comp("Edits the current selection."), str8_lit_comp(""), str8_lit_comp("Edit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Pencil},
|
||||
{ str8_lit_comp("accept"), str8_lit_comp("Accepts current changes, or answers prompts in the affirmative."), str8_lit_comp(""), str8_lit_comp("Accept"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_CheckFilled},
|
||||
{ str8_lit_comp("cancel"), str8_lit_comp("Rejects current changes, exits temporary menus, or answers prompts in the negative."), str8_lit_comp(""), str8_lit_comp("Cancel"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X},
|
||||
@@ -405,7 +406,7 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
|
||||
{ str8_lit_comp("file_path_map"), str8_lit_comp("Opens the file path mapping editor."), str8_lit_comp(""), str8_lit_comp("File Path Map"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("auto_view_rules"), str8_lit_comp("Opens the auto view rule editor."), str8_lit_comp(""), str8_lit_comp("Auto View Rules"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Binoculars},
|
||||
{ str8_lit_comp("scheduler"), str8_lit_comp("Opens the scheduler view, for process and thread controls."), str8_lit_comp("threads,processes,targets"), str8_lit_comp("Scheduler"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Scheduler},
|
||||
{ str8_lit_comp("call_stack"), str8_lit_comp("Opens the call stack view."), str8_lit_comp("callstack,thread"), str8_lit_comp("Call Stack"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thread},
|
||||
{ str8_lit_comp("call_stack"), str8_lit_comp("Opens the call stack view."), str8_lit_comp("callstack,thread,unwind"), str8_lit_comp("Call Stack"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Thread},
|
||||
{ str8_lit_comp("modules"), str8_lit_comp("Opens the modules view."), str8_lit_comp(""), str8_lit_comp("Modules"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Module},
|
||||
{ str8_lit_comp("pending_entity"), str8_lit_comp("Opens a view which waits for the passed entity to be completely loaded, then replaces itself with a new view."), str8_lit_comp(""), str8_lit_comp("Pending Entity"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("code"), str8_lit_comp("Opens the code view for an already-loaded file."), str8_lit_comp(""), str8_lit_comp("Code"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_FileOutline},
|
||||
@@ -422,13 +423,14 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[220] =
|
||||
{ str8_lit_comp("breakpoints"), str8_lit_comp("Opens the breakpoints view."), str8_lit_comp(""), str8_lit_comp("Breakpoints"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_CircleFilled},
|
||||
{ str8_lit_comp("watch_pins"), str8_lit_comp("Opens the watch pins view."), str8_lit_comp(""), str8_lit_comp("Watch Pins"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Pin},
|
||||
{ str8_lit_comp("exception_filters"), str8_lit_comp("Opens the exception filters view."), str8_lit_comp("exceptions,filters"), str8_lit_comp("Exception Filters"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Gear},
|
||||
{ str8_lit_comp("theme"), str8_lit_comp("Opens the theme view."), str8_lit_comp("theme,color,scheme,palette"), str8_lit_comp("Theme"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Palette},
|
||||
{ str8_lit_comp("settings"), str8_lit_comp("Opens the settings view."), str8_lit_comp("theme,color,scheme,options"), str8_lit_comp("Settings"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Gear},
|
||||
{ str8_lit_comp("pick_file"), str8_lit_comp("Opens the file browser to pick a file."), str8_lit_comp(""), str8_lit_comp("Pick File"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("pick_folder"), str8_lit_comp("Opens the file browser to pick a folder."), str8_lit_comp(""), str8_lit_comp("Pick Folder"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*1)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FolderOpenFilled},
|
||||
{ str8_lit_comp("pick_file_or_folder"), str8_lit_comp("Opens the file browser to pick a file or folder."), str8_lit_comp(""), str8_lit_comp("Pick File/Folder"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_FilePath, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*1)|(DF_CmdQueryFlag_AllowFolders*1)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_FileOutline},
|
||||
{ str8_lit_comp("complete_query"), str8_lit_comp("Completes a query."), str8_lit_comp(""), str8_lit_comp("Complete Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("cancel_query"), str8_lit_comp("Cancels a query."), str8_lit_comp(""), str8_lit_comp("Cancel Query"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("toggle_dev_menu"), str8_lit_comp("Opens and closes the developer menu."), str8_lit_comp(""), str8_lit_comp("Toggle Developer Menu"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
{ str8_lit_comp("log_marker"), str8_lit_comp("Logs a marker in the application log, to denote specific points in time within the log."), str8_lit_comp(""), str8_lit_comp("Log Marker"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null},
|
||||
};
|
||||
|
||||
DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[17] =
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
typedef enum DF_CfgSrc
|
||||
{
|
||||
DF_CfgSrc_User,
|
||||
DF_CfgSrc_Profile,
|
||||
DF_CfgSrc_Project,
|
||||
DF_CfgSrc_CommandLine,
|
||||
DF_CfgSrc_Transient,
|
||||
DF_CfgSrc_COUNT,
|
||||
@@ -23,7 +23,6 @@ DF_EntityKind_Machine,
|
||||
DF_EntityKind_File,
|
||||
DF_EntityKind_OverrideFileLink,
|
||||
DF_EntityKind_AutoViewRule,
|
||||
DF_EntityKind_FlashMarker,
|
||||
DF_EntityKind_WatchPin,
|
||||
DF_EntityKind_Breakpoint,
|
||||
DF_EntityKind_Condition,
|
||||
@@ -32,6 +31,7 @@ DF_EntityKind_Executable,
|
||||
DF_EntityKind_Arguments,
|
||||
DF_EntityKind_ExecutionPath,
|
||||
DF_EntityKind_EntryPointName,
|
||||
DF_EntityKind_RecentProject,
|
||||
DF_EntityKind_Source,
|
||||
DF_EntityKind_Dest,
|
||||
DF_EntityKind_Process,
|
||||
@@ -74,8 +74,6 @@ DF_CoreCmdKind_StepInto,
|
||||
DF_CoreCmdKind_StepOver,
|
||||
DF_CoreCmdKind_RunToCursor,
|
||||
DF_CoreCmdKind_SetNextStatement,
|
||||
DF_CoreCmdKind_EnableSoloSteppingMode,
|
||||
DF_CoreCmdKind_DisableSoloSteppingMode,
|
||||
DF_CoreCmdKind_SelectThread,
|
||||
DF_CoreCmdKind_SelectThreadWindow,
|
||||
DF_CoreCmdKind_SelectThreadView,
|
||||
@@ -130,21 +128,22 @@ DF_CoreCmdKind_TabBarTop,
|
||||
DF_CoreCmdKind_TabBarBottom,
|
||||
DF_CoreCmdKind_SetCurrentPath,
|
||||
DF_CoreCmdKind_Open,
|
||||
DF_CoreCmdKind_Reload,
|
||||
DF_CoreCmdKind_ReloadActive,
|
||||
DF_CoreCmdKind_Switch,
|
||||
DF_CoreCmdKind_SwitchToPartnerFile,
|
||||
DF_CoreCmdKind_GoToDisassembly,
|
||||
DF_CoreCmdKind_GoToSource,
|
||||
DF_CoreCmdKind_SetFileOverrideLinkSrc,
|
||||
DF_CoreCmdKind_SetFileOverrideLinkDst,
|
||||
DF_CoreCmdKind_SetFileReplacementPath,
|
||||
DF_CoreCmdKind_SetAutoViewRuleType,
|
||||
DF_CoreCmdKind_SetAutoViewRuleViewRule,
|
||||
DF_CoreCmdKind_OpenUser,
|
||||
DF_CoreCmdKind_OpenProfile,
|
||||
DF_CoreCmdKind_OpenProject,
|
||||
DF_CoreCmdKind_OpenRecentProject,
|
||||
DF_CoreCmdKind_ApplyUserData,
|
||||
DF_CoreCmdKind_ApplyProfileData,
|
||||
DF_CoreCmdKind_ApplyProjectData,
|
||||
DF_CoreCmdKind_WriteUserData,
|
||||
DF_CoreCmdKind_WriteProfileData,
|
||||
DF_CoreCmdKind_WriteProjectData,
|
||||
DF_CoreCmdKind_Edit,
|
||||
DF_CoreCmdKind_Accept,
|
||||
DF_CoreCmdKind_Cancel,
|
||||
@@ -260,13 +259,14 @@ DF_CoreCmdKind_Disassembly,
|
||||
DF_CoreCmdKind_Breakpoints,
|
||||
DF_CoreCmdKind_WatchPins,
|
||||
DF_CoreCmdKind_ExceptionFilters,
|
||||
DF_CoreCmdKind_Theme,
|
||||
DF_CoreCmdKind_Settings,
|
||||
DF_CoreCmdKind_PickFile,
|
||||
DF_CoreCmdKind_PickFolder,
|
||||
DF_CoreCmdKind_PickFileOrFolder,
|
||||
DF_CoreCmdKind_CompleteQuery,
|
||||
DF_CoreCmdKind_CancelQuery,
|
||||
DF_CoreCmdKind_ToggleDevMenu,
|
||||
DF_CoreCmdKind_LogMarker,
|
||||
DF_CoreCmdKind_COUNT,
|
||||
} DF_CoreCmdKind;
|
||||
|
||||
@@ -390,6 +390,8 @@ DF_CmdParamSlot_ID,
|
||||
DF_CmdParamSlot_PreferDisassembly,
|
||||
DF_CmdParamSlot_ForceConfirm,
|
||||
DF_CmdParamSlot_Dir2,
|
||||
DF_CmdParamSlot_BaseUnwindIndex,
|
||||
DF_CmdParamSlot_InlineUnwindIndex,
|
||||
DF_CmdParamSlot_COUNT,
|
||||
} DF_CmdParamSlot;
|
||||
|
||||
@@ -418,6 +420,8 @@ U64 id;
|
||||
B32 prefer_dasm;
|
||||
B32 force_confirm;
|
||||
Dir2 dir2;
|
||||
U64 base_unwind_index;
|
||||
U64 inline_unwind_index;
|
||||
};
|
||||
|
||||
DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array);
|
||||
@@ -1528,7 +1532,7 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
|
||||
{&DEV_updating_indicator, str8_lit_comp("updating_indicator")},
|
||||
};
|
||||
C_LINKAGE_BEGIN
|
||||
extern Rng1U64 df_g_cmd_param_slot_range_table[22];
|
||||
extern Rng1U64 df_g_cmd_param_slot_range_table[24];
|
||||
extern DF_IconKind df_g_entity_kind_icon_kind_table[25];
|
||||
extern String8 df_g_entity_kind_display_string_table[25];
|
||||
extern String8 df_g_entity_kind_name_label_table[25];
|
||||
@@ -1539,6 +1543,7 @@ extern DF_CoreCmdKind df_g_cfg_src_load_cmd_kind_table[4];
|
||||
extern DF_CoreCmdKind df_g_cfg_src_write_cmd_kind_table[4];
|
||||
extern DF_CoreCmdKind df_g_cfg_src_apply_cmd_kind_table[4];
|
||||
extern String8 df_g_icon_kind_text_table[69];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // DF_CORE_META_H
|
||||
|
||||
+1772
-1316
File diff suppressed because it is too large
Load Diff
+110
-35
@@ -66,12 +66,22 @@ struct DF_KeyMapSlot
|
||||
DF_KeyMapNode *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Setting Types
|
||||
|
||||
typedef struct DF_SettingVal DF_SettingVal;
|
||||
struct DF_SettingVal
|
||||
{
|
||||
B32 set;
|
||||
S32 s32;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Functions
|
||||
|
||||
struct DF_View;
|
||||
struct DF_Panel;
|
||||
struct DF_Window;
|
||||
typedef struct DF_View DF_View;
|
||||
typedef struct DF_Panel DF_Panel;
|
||||
typedef struct DF_Window DF_Window;
|
||||
|
||||
#define DF_VIEW_SETUP_FUNCTION_SIG(name) void name(DF_Window *ws, struct DF_View *view, DF_CfgNode *cfg_root)
|
||||
#define DF_VIEW_SETUP_FUNCTION_NAME(name) df_view_setup_##name
|
||||
@@ -100,12 +110,13 @@ typedef U32 DF_ViewSpecFlags;
|
||||
enum
|
||||
{
|
||||
DF_ViewSpecFlag_ParameterizedByEntity = (1<<0),
|
||||
DF_ViewSpecFlag_CanSerialize = (1<<1),
|
||||
DF_ViewSpecFlag_CanSerializeEntityPath = (1<<2),
|
||||
DF_ViewSpecFlag_CanSerializeQuery = (1<<3),
|
||||
DF_ViewSpecFlag_CanFilter = (1<<4),
|
||||
DF_ViewSpecFlag_FilterIsCode = (1<<5),
|
||||
DF_ViewSpecFlag_TypingAutomaticallyFilters = (1<<6),
|
||||
DF_ViewSpecFlag_ProjectSpecific = (1<<1),
|
||||
DF_ViewSpecFlag_CanSerialize = (1<<2),
|
||||
DF_ViewSpecFlag_CanSerializeEntityPath = (1<<3),
|
||||
DF_ViewSpecFlag_CanSerializeQuery = (1<<4),
|
||||
DF_ViewSpecFlag_CanFilter = (1<<5),
|
||||
DF_ViewSpecFlag_FilterIsCode = (1<<6),
|
||||
DF_ViewSpecFlag_TypingAutomaticallyFilters = (1<<7),
|
||||
};
|
||||
|
||||
typedef enum DF_NameKind
|
||||
@@ -186,11 +197,10 @@ struct DF_View
|
||||
U64 loading_progress_v;
|
||||
U64 loading_progress_v_target;
|
||||
|
||||
// rjf: update flash animation state
|
||||
F32 flash_t;
|
||||
|
||||
// rjf: view state
|
||||
UI_ScrollPt2 scroll_pos;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
|
||||
// rjf: ctrl context overrides
|
||||
DF_CtrlCtx ctrl_ctx_overrides;
|
||||
@@ -204,6 +214,7 @@ struct DF_View
|
||||
// rjf: view kind info
|
||||
DF_ViewSpec *spec;
|
||||
DF_Handle entity;
|
||||
DF_Handle project;
|
||||
|
||||
// rjf: filter mode
|
||||
B32 is_filtering;
|
||||
@@ -243,7 +254,7 @@ struct DF_Panel
|
||||
// rjf: tab params
|
||||
Side tab_side;
|
||||
|
||||
// rjf: stable view stacks (tabs)
|
||||
// rjf: stable views (tabs)
|
||||
DF_View *first_tab_view;
|
||||
DF_View *last_tab_view;
|
||||
U64 tab_view_count;
|
||||
@@ -280,6 +291,19 @@ struct DF_DragDropPayload
|
||||
TxtPt text_point;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Rich Hover Types
|
||||
|
||||
typedef struct DF_RichHoverInfo DF_RichHoverInfo;
|
||||
struct DF_RichHoverInfo
|
||||
{
|
||||
DF_Handle process;
|
||||
Rng1U64 vaddr_range;
|
||||
DF_Handle module;
|
||||
Rng1U64 voff_range;
|
||||
DI_Key dbgi_key;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Spec Types
|
||||
|
||||
@@ -362,6 +386,24 @@ typedef enum DF_FontSlot
|
||||
}
|
||||
DF_FontSlot;
|
||||
|
||||
typedef enum DF_PaletteCode
|
||||
{
|
||||
DF_PaletteCode_Base,
|
||||
DF_PaletteCode_MenuBar,
|
||||
DF_PaletteCode_Floating,
|
||||
DF_PaletteCode_ImplicitButton,
|
||||
DF_PaletteCode_PlainButton,
|
||||
DF_PaletteCode_PositivePopButton,
|
||||
DF_PaletteCode_NegativePopButton,
|
||||
DF_PaletteCode_NeutralPopButton,
|
||||
DF_PaletteCode_ScrollBarButton,
|
||||
DF_PaletteCode_Tab,
|
||||
DF_PaletteCode_TabInactive,
|
||||
DF_PaletteCode_DropSiteOverlay,
|
||||
DF_PaletteCode_COUNT
|
||||
}
|
||||
DF_PaletteCode;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Helper & Widget Types
|
||||
|
||||
@@ -387,8 +429,9 @@ typedef U32 DF_CodeSliceFlags;
|
||||
enum
|
||||
{
|
||||
DF_CodeSliceFlag_Clickable = (1<<0),
|
||||
DF_CodeSliceFlag_Margin = (1<<1),
|
||||
DF_CodeSliceFlag_LineNums = (1<<2),
|
||||
DF_CodeSliceFlag_PriorityMargin = (1<<1),
|
||||
DF_CodeSliceFlag_CatchallMargin = (1<<2),
|
||||
DF_CodeSliceFlag_LineNums = (1<<3),
|
||||
};
|
||||
|
||||
typedef struct DF_CodeSliceParams DF_CodeSliceParams;
|
||||
@@ -403,19 +446,20 @@ struct DF_CodeSliceParams
|
||||
DF_EntityList *line_bps;
|
||||
DF_EntityList *line_ips;
|
||||
DF_EntityList *line_pins;
|
||||
DF_TextLineDasm2SrcInfoList *line_dasm2src;
|
||||
DF_TextLineSrc2DasmInfoList *line_src2dasm;
|
||||
U64 *line_vaddrs;
|
||||
DF_LineList *line_infos;
|
||||
DI_KeyList relevant_dbgi_keys;
|
||||
|
||||
// rjf: visual parameters
|
||||
F_Tag font;
|
||||
F32 font_size;
|
||||
F32 tab_size;
|
||||
String8 search_query;
|
||||
F32 line_height_px;
|
||||
F32 margin_width_px;
|
||||
F32 priority_margin_width_px;
|
||||
F32 catchall_margin_width_px;
|
||||
F32 line_num_width_px;
|
||||
F32 line_text_max_width_px;
|
||||
DF_EntityList flash_ranges;
|
||||
F32 margin_float_off_px;
|
||||
};
|
||||
|
||||
@@ -518,21 +562,34 @@ struct DF_Window
|
||||
// rjf: view state delta history
|
||||
DF_StateDeltaHistory *view_state_hist;
|
||||
|
||||
// rjf: context menu info
|
||||
// rjf: dev interface state
|
||||
B32 dev_menu_is_open;
|
||||
|
||||
// rjf: menu bar state
|
||||
B32 menu_bar_focused;
|
||||
B32 menu_bar_focused_on_press;
|
||||
B32 menu_bar_key_held;
|
||||
B32 menu_bar_focus_press_started;
|
||||
UI_Key drop_completion_ctx_menu_key;
|
||||
DF_Handle drop_completion_entity;
|
||||
DF_Handle drop_completion_panel;
|
||||
|
||||
// rjf: code context menu state
|
||||
Arena *code_ctx_menu_arena;
|
||||
UI_Key code_ctx_menu_key;
|
||||
DF_Handle code_ctx_menu_file;
|
||||
U128 code_ctx_menu_text_key;
|
||||
TXT_LangKind code_ctx_menu_lang_kind;
|
||||
TxtRng code_ctx_menu_range;
|
||||
U64 code_ctx_menu_vaddr;
|
||||
DF_LineList code_ctx_menu_lines;
|
||||
|
||||
// rjf: entity context menu state
|
||||
UI_Key entity_ctx_menu_key;
|
||||
DF_Handle entity_ctx_menu_entity;
|
||||
U8 entity_ctx_menu_input_buffer[1024];
|
||||
U64 entity_ctx_menu_input_size;
|
||||
TxtPt entity_ctx_menu_input_cursor;
|
||||
TxtPt entity_ctx_menu_input_mark;
|
||||
|
||||
// rjf: tab context menu state
|
||||
UI_Key tab_ctx_menu_key;
|
||||
DF_Handle tab_ctx_menu_view;
|
||||
|
||||
@@ -569,6 +626,7 @@ struct DF_Window
|
||||
Vec2F32 hover_eval_spawn_pos;
|
||||
String8 hover_eval_string;
|
||||
|
||||
|
||||
// rjf: hover eval timer
|
||||
U64 hover_eval_first_frame_idx;
|
||||
U64 hover_eval_last_frame_idx;
|
||||
@@ -714,11 +772,11 @@ struct DF_GfxState
|
||||
// rjf: drag/drop state machine
|
||||
DF_DragDropState drag_drop_state;
|
||||
|
||||
// rjf: hover line info correllation state
|
||||
Arena *hover_line_arena;
|
||||
DI_Key hover_line_dbgi_key;
|
||||
U64 hover_line_voff;
|
||||
B32 hover_line_set_this_frame;
|
||||
// rjf: rich hover info
|
||||
Arena *rich_hover_info_next_arena;
|
||||
Arena *rich_hover_info_current_arena;
|
||||
DF_RichHoverInfo rich_hover_info_next;
|
||||
DF_RichHoverInfo rich_hover_info_current;
|
||||
|
||||
// rjf: running theme state
|
||||
DF_Theme cfg_theme_target;
|
||||
@@ -727,7 +785,11 @@ struct DF_GfxState
|
||||
Arena *cfg_code_font_path_arena;
|
||||
String8 cfg_main_font_path;
|
||||
String8 cfg_code_font_path;
|
||||
F_Tag cfg_font_tags[DF_FontSlot_COUNT];
|
||||
F_Tag cfg_font_tags[DF_FontSlot_COUNT]; // derivative from font paths
|
||||
UI_Palette cfg_palettes[DF_PaletteCode_COUNT]; // derivative from theme
|
||||
|
||||
// rjf: settings
|
||||
DF_SettingVal cfg_setting_vals[DF_CfgSrc_COUNT][DF_SettingCode_COUNT];
|
||||
|
||||
// rjf: icon texture
|
||||
R_Handle icon_texture;
|
||||
@@ -766,7 +828,8 @@ read_only global DF_View df_g_nil_view =
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
{0},
|
||||
0,
|
||||
@@ -801,6 +864,7 @@ internal DF_PathQuery df_path_query_from_string(String8 string);
|
||||
//~ rjf: View Type Functions
|
||||
|
||||
internal B32 df_view_is_nil(DF_View *view);
|
||||
internal B32 df_view_is_project_filtered(DF_View *view);
|
||||
internal DF_Handle df_handle_from_view(DF_View *view);
|
||||
internal DF_View *df_view_from_handle(DF_Handle handle);
|
||||
|
||||
@@ -837,6 +901,7 @@ internal Rng2F32 df_target_rect_from_panel(Rng2F32 root_rect, DF_Panel *root, DF
|
||||
//- rjf: view ownership insertion/removal
|
||||
internal void df_panel_insert_tab_view(DF_Panel *panel, DF_View *prev_view, DF_View *view);
|
||||
internal void df_panel_remove_tab_view(DF_Panel *panel, DF_View *view);
|
||||
internal DF_View *df_selected_tab_from_panel(DF_Panel *panel);
|
||||
|
||||
//- rjf: icons & display strings
|
||||
internal String8 df_display_string_from_view(Arena *arena, DF_CtrlCtx ctrl_ctx, DF_View *view);
|
||||
@@ -873,9 +938,8 @@ internal B32 df_drag_drop(DF_DragDropPayload *out_payload);
|
||||
internal void df_drag_kill(void);
|
||||
internal void df_queue_drag_drop(void);
|
||||
|
||||
internal void df_set_hovered_line_info(DI_Key *dbgi_key, U64 voff);
|
||||
internal DI_Key df_get_hovered_line_info_dbgi_key(void);
|
||||
internal U64 df_get_hovered_line_info_voff(void);
|
||||
internal void df_set_rich_hover_info(DF_RichHoverInfo *info);
|
||||
internal DF_RichHoverInfo df_get_rich_hover_info(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: View Spec State Functions
|
||||
@@ -973,11 +1037,18 @@ internal DF_CmdSpecList df_cmd_spec_list_from_event_flags(Arena *arena, OS_Event
|
||||
internal Vec4F32 df_rgba_from_theme_color(DF_ThemeColor color);
|
||||
internal DF_ThemeColor df_theme_color_from_txt_token_kind(TXT_TokenKind kind);
|
||||
|
||||
//- rjf: code -> palette
|
||||
internal UI_Palette *df_palette_from_code(DF_PaletteCode code);
|
||||
|
||||
//- rjf: fonts/sizes
|
||||
internal F_Tag df_font_from_slot(DF_FontSlot slot);
|
||||
internal F32 df_font_size_from_slot(DF_Window *ws, DF_FontSlot slot);
|
||||
|
||||
//- rjf: settings
|
||||
internal DF_SettingVal df_setting_val_from_code(DF_SettingCode code);
|
||||
|
||||
//- rjf: config serialization
|
||||
internal int df_qsort_compare__cfg_string_bindings(DF_StringBindingPair *a, DF_StringBindingPair *b);
|
||||
internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF_CfgSrc source);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -986,6 +1057,11 @@ internal String8List df_cfg_strings_from_gfx(Arena *arena, String8 root_path, DF
|
||||
internal String8 df_string_from_exception_code(U32 code);
|
||||
internal String8 df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event, DF_IconKind *icon_out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Building Helpers
|
||||
|
||||
#define DF_Palette(code) UI_Palette(df_palette_from_code(code))
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Widgets: Fancy Buttons
|
||||
|
||||
@@ -996,7 +1072,7 @@ internal void df_cmd_list_menu_buttons(DF_Window *ws, U64 count, DF_CoreCmdKind
|
||||
internal UI_Signal df_icon_button(DF_IconKind kind, FuzzyMatchRangeList *matches, String8 string);
|
||||
internal UI_Signal df_icon_buttonf(DF_IconKind kind, FuzzyMatchRangeList *matches, char *fmt, ...);
|
||||
internal void df_entity_tooltips(DF_Entity *entity);
|
||||
internal void df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches, String8 fuzzy_query);
|
||||
internal UI_Signal df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches, String8 fuzzy_query, B32 is_implicit);
|
||||
internal void df_entity_src_loc_button(DF_Window *ws, DF_Entity *entity, TxtPt point);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -1008,7 +1084,6 @@ internal DF_CodeSliceSignal df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, E
|
||||
internal DF_CodeSliceSignal df_code_slicef(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *preferred_column, char *fmt, ...);
|
||||
|
||||
internal B32 df_do_txt_controls(TXT_TextInfo *info, String8 data, U64 line_count_per_page, TxtPt *cursor, TxtPt *mark, S64 *preferred_column);
|
||||
internal B32 df_do_txti_controls(TXTI_Handle handle, U64 line_count_per_page, TxtPt *cursor, TxtPt *mark, S64 *preferred_column);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Widgets: Fancy Labels
|
||||
|
||||
+325
-331
@@ -87,8 +87,8 @@ DF_DefaultBindingTable:
|
||||
{ "switch_to_partner_file" O 0 0 alt }
|
||||
|
||||
//- rjf: setting config paths
|
||||
{ "load_user" O ctrl shift alt }
|
||||
{ "load_profile" O ctrl 0 alt }
|
||||
{ "open_user" O ctrl shift alt }
|
||||
{ "open_project" O ctrl 0 alt }
|
||||
|
||||
//- rjf: meta controls
|
||||
{ "edit" F2 0 0 0 }
|
||||
@@ -171,6 +171,14 @@ DF_DefaultBindingTable:
|
||||
|
||||
//- rjf: command lister
|
||||
{ "run_command" F1 0 0 0 }
|
||||
|
||||
//- rjf: developer commands
|
||||
{ "log_marker" M ctrl shift alt }
|
||||
}
|
||||
|
||||
@data(DF_StringBindingPair) df_g_default_binding_table:
|
||||
{
|
||||
@expand(DF_DefaultBindingTable a) ```{str8_lit_comp("$(a.name)"), {OS_Key_$(a.key), 0 $(a.ctrl != 0 -> `|OS_EventFlag_Ctrl`) $(a.shift != 0 -> `|OS_EventFlag_Shift`) $(a.alt != 0 -> `|OS_EventFlag_Alt`)}}```;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -182,45 +190,76 @@ DF_BindingVersionRemapTable:
|
||||
{"commands" "run_command"}
|
||||
{"load_user" "open_user"}
|
||||
{"load_profile" "open_profile"}
|
||||
{"load_project" "open_project"}
|
||||
{"open_profile" "open_project"}
|
||||
}
|
||||
|
||||
@data(String8) df_g_binding_version_remap_old_name_table:
|
||||
{
|
||||
@expand(DF_BindingVersionRemapTable a) `str8_lit_comp("$(a.old_name)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_binding_version_remap_new_name_table:
|
||||
{
|
||||
@expand(DF_BindingVersionRemapTable a) `str8_lit_comp("$(a.new_name)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Gfx Layer View Kinds
|
||||
|
||||
@table(name, name_lower, display_string, name_kind, icon, parameterized_by_entity, can_serialize, can_serialize_entity_path, can_filter, filter_is_code, typing_automatically_filters, inc_in_docs, docs_desc)
|
||||
@table(name, name_lower, display_string, name_kind, icon, parameterized_by_entity, project_specific, can_serialize, can_serialize_entity_path, can_filter, filter_is_code, typing_automatically_filters, inc_in_docs, docs_desc)
|
||||
DF_GfxViewTable:
|
||||
{
|
||||
{ Null "null" "" Null Null 0 0 0 0 0 0 0 "" }
|
||||
{ Empty "empty" "" Null Null 0 0 0 0 0 0 0 "" }
|
||||
{ GettingStarted "getting_started" "Getting Started" Null QuestionMark 0 1 0 0 0 0 0 "" }
|
||||
{ Commands "commands" "Commands" Null List 0 0 0 0 0 0 0 "" }
|
||||
{ FileSystem "file_system" "File System" Null FileOutline 0 0 0 0 0 0 0 "" }
|
||||
{ SystemProcesses "system_processes" "System Processes" Null Null 0 0 0 0 0 0 0 "" }
|
||||
{ EntityLister "entity_lister" "Entity List" Null Null 0 0 0 0 0 0 0 "" }
|
||||
{ SymbolLister "symbol_lister" "Symbols" Null Null 0 0 0 0 0 0 0 "" }
|
||||
{ Target "target" "Target" EntityName Target 1 0 0 0 0 0 0 "" }
|
||||
{ Targets "targets" "Targets" Null Target 0 1 0 1 0 1 1 "Displays a list of all targets, as well as controls for enabling, disabling, launching, editing, or deleting each target. For more information on targets, read the `Targets` section." }
|
||||
{ FilePathMap "file_path_map" "File Path Map" Null FileOutline 0 1 0 0 0 0 1 "Displays a table of *path maps*. Each path map is a pair of file or folder paths, one being a 'source' path, and one being a 'destination' path. These pairs are used by the debugger when automatically searching for specific files - for instance, when attempting to snap to a source code location specified by debug info. If debug info refers to a path on the machine on which a target executable was originally built, but that path is not valid on the debugger machine, but some alternative path exists, then path maps may be used to redirect the debugger from the debug info's specified paths to the associated appropriate debugger machine file paths." }
|
||||
{ AutoViewRules "auto_view_rules" "Auto View Rules" Null Binoculars 0 1 0 0 0 0 1 "Displays a table of *auto view rules*. Each *auto view rule* is a pair, with one element being a type, and the other being a view rule, which should be automatically applied to expressions of that type, when possible." }
|
||||
{ Scheduler "scheduler" "Scheduler" Null Scheduler 0 1 0 1 1 1 1 "Displays all processes and threads to which the debugger is currently attached, and contains controls for selecting and freezing threads." }
|
||||
{ CallStack "call_stack" "Call Stack" Null Thread 0 1 0 0 0 0 1 "Displays the call stack of the currently selected thread. Each frame in the call stack contains the associated module, function name, and return address. Allows selection of a particular call stack frame other than the top." }
|
||||
{ Modules "modules" "Modules" Null Module 0 1 0 1 0 1 1 "Displays a table of all modules currently loaded by any process to which the debugger is attached. This table displays each module's name, virtual address range in the containing process' address space, and which debug info file is being used by the debugger for the associated module." }
|
||||
{ PendingEntity "pending_entity" "Pending Entity" EntityName FileOutline 1 0 0 0 0 0 0 "" }
|
||||
{ Code "code" "Code" EntityName FileOutline 1 1 1 0 0 0 0 "" }
|
||||
{ Disassembly "disassembly" "Disassembly" Null Glasses 0 1 0 0 0 0 1 "Displays disassembled instructions in a textual form from the selected thread's containing process virtual address space." }
|
||||
{ Watch "watch" "Watch" Null Binoculars 0 1 0 1 1 1 1 "The familiar 'watch window' debugger interface. Allows the inputting of a number of expressions. Each expression in the table is evaluated within the context of the selected thread's selected call stack frame. If applicable (depending on visualization rules and the expression's type), these expressions may be hierarchically expanded, which displays children as more rows in the table. The values of these expressions may also be edited, and if possible, can be used to write to registers or memory in attached processes. Also contains a new *view rule* column, not found in other major debuggers, which allows per-row specification of various visualization rules. These view rules may be used to visualize and inspect the evaluation of expressions in a variety of ways. To learn more, read the 'View Rules' section." }
|
||||
{ Locals "locals" "Locals" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with local variables found within the selected call stack frame of the selected thread, according to the associated debug info. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Registers "registers" "Registers" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all register names according to the selected thread's architecture. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Globals "globals" "Globals" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all global variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ ThreadLocals "thread_locals" "Thread Locals" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all thread local variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Types "types" "Types" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all types within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Procedures "procedures" "Procedures" Null Binoculars 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all procedures within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Output "output" "Output" Null List 0 1 0 0 0 0 1 "Displays textual output from the selected thread's containing process." }
|
||||
{ Memory "memory" "Memory" Null Grid 0 1 1 0 0 0 1 "A familiar hex-editor-like interface for viewing memory of attached processes." }
|
||||
{ Breakpoints "breakpoints" "Breakpoints" Null CircleFilled 0 1 0 1 0 1 1 "Displays a table of all breakpoints, containing information about each breakpoint's name, location, and hit count. Also contains per-breakpoint controls for enabling, deleting, or editing each breakpoint. For more information on breakpoints and their features, read the 'Breakpoints' section." }
|
||||
{ WatchPins "watch_pins" "Watch Pins" Null Pin 0 1 0 1 1 1 1 "Displays a table of all watch pins (watched expressions, like those found in `Watch`, but instead of being within a table, being pinned to some source code location, like breakpoints). This table contains each pin's name, location, and controls for editing or deleting each pin." }
|
||||
{ ExceptionFilters "exception_filters" "Exception Filters" Null Gear 0 1 0 1 0 1 1 "An interface which controls whether or not the debugger will halt attached processes upon encountering specific exception codes for the first time." }
|
||||
{ Theme "theme" "Theme" Null Palette 0 1 0 0 0 0 1 "An interface for modifying the colors used in the debugger's UI. Allows selecting a theme preset, loading a theme from a file, and modifying individual colors within a theme." }
|
||||
{ Null "null" "" Null Null 0 0 0 0 0 0 0 0 "" }
|
||||
{ Empty "empty" "" Null Null 0 0 0 0 0 0 0 0 "" }
|
||||
{ GettingStarted "getting_started" "Getting Started" Null QuestionMark 0 0 1 0 0 0 0 0 "" }
|
||||
{ Commands "commands" "Commands" Null List 0 0 0 0 0 0 0 0 "" }
|
||||
{ FileSystem "file_system" "File System" Null FileOutline 0 0 0 0 0 0 0 0 "" }
|
||||
{ SystemProcesses "system_processes" "System Processes" Null Null 0 0 0 0 0 0 0 0 "" }
|
||||
{ EntityLister "entity_lister" "Entity List" Null Null 0 0 0 0 0 0 0 0 "" }
|
||||
{ SymbolLister "symbol_lister" "Symbols" Null Null 0 0 0 0 0 0 0 0 "" }
|
||||
{ Target "target" "Target" EntityName Target 1 0 0 0 0 0 0 0 "" }
|
||||
{ Targets "targets" "Targets" Null Target 0 0 1 0 1 0 1 1 "Displays a list of all targets, as well as controls for enabling, disabling, launching, editing, or deleting each target. For more information on targets, read the `Targets` section." }
|
||||
{ FilePathMap "file_path_map" "File Path Map" Null FileOutline 0 0 1 0 0 0 0 1 "Displays a table of *path maps*. Each path map is a pair of file or folder paths, one being a 'source' path, and one being a 'destination' path. These pairs are used by the debugger when automatically searching for specific files - for instance, when attempting to snap to a source code location specified by debug info. If debug info refers to a path on the machine on which a target executable was originally built, but that path is not valid on the debugger machine, but some alternative path exists, then path maps may be used to redirect the debugger from the debug info's specified paths to the associated appropriate debugger machine file paths." }
|
||||
{ AutoViewRules "auto_view_rules" "Auto View Rules" Null Binoculars 0 0 1 0 0 0 0 1 "Displays a table of *auto view rules*. Each *auto view rule* is a pair, with one element being a type, and the other being a view rule, which should be automatically applied to expressions of that type, when possible." }
|
||||
{ Scheduler "scheduler" "Scheduler" Null Scheduler 0 0 1 0 1 1 1 1 "Displays all processes and threads to which the debugger is currently attached, and contains controls for selecting and freezing threads." }
|
||||
{ CallStack "call_stack" "Call Stack" Null Thread 0 0 1 0 0 0 0 1 "Displays the call stack of the currently selected thread. Each frame in the call stack contains the associated module, function name, and return address. Allows selection of a particular call stack frame other than the top." }
|
||||
{ Modules "modules" "Modules" Null Module 0 0 1 0 1 0 1 1 "Displays a table of all modules currently loaded by any process to which the debugger is attached. This table displays each module's name, virtual address range in the containing process' address space, and which debug info file is being used by the debugger for the associated module." }
|
||||
{ PendingEntity "pending_entity" "Pending Entity" EntityName FileOutline 1 0 0 0 0 0 0 0 "" }
|
||||
{ Code "code" "Code" EntityName FileOutline 1 1 1 1 0 0 0 0 "" }
|
||||
{ Disassembly "disassembly" "Disassembly" Null Glasses 0 0 1 0 0 0 0 1 "Displays disassembled instructions in a textual form from the selected thread's containing process virtual address space." }
|
||||
{ Watch "watch" "Watch" Null Binoculars 0 0 1 0 1 1 1 1 "The familiar 'watch window' debugger interface. Allows the inputting of a number of expressions. Each expression in the table is evaluated within the context of the selected thread's selected call stack frame. If applicable (depending on visualization rules and the expression's type), these expressions may be hierarchically expanded, which displays children as more rows in the table. The values of these expressions may also be edited, and if possible, can be used to write to registers or memory in attached processes. Also contains a new *view rule* column, not found in other major debuggers, which allows per-row specification of various visualization rules. These view rules may be used to visualize and inspect the evaluation of expressions in a variety of ways. To learn more, read the 'View Rules' section." }
|
||||
{ Locals "locals" "Locals" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with local variables found within the selected call stack frame of the selected thread, according to the associated debug info. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Registers "registers" "Registers" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all register names according to the selected thread's architecture. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Globals "globals" "Globals" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all global variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ ThreadLocals "thread_locals" "Thread Locals" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all thread local variables within the selected thread's module. View rules and evaluation values can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Types "types" "Types" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all types within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Procedures "procedures" "Procedures" Null Binoculars 0 0 1 0 1 1 1 1 "Nearly identical to `Watch`, but automatically filled with all procedures within the selected thread's module. View rules can be edited, like in `Watch`, but unlike `Watch`, expressions cannot be edited or added to the table." }
|
||||
{ Output "output" "Output" Null List 0 0 1 0 0 0 0 1 "Displays textual output from the selected thread's containing process." }
|
||||
{ Memory "memory" "Memory" Null Grid 0 0 1 0 0 0 0 1 "A familiar hex-editor-like interface for viewing memory of attached processes." }
|
||||
{ Breakpoints "breakpoints" "Breakpoints" Null CircleFilled 0 0 1 0 1 0 1 1 "Displays a table of all breakpoints, containing information about each breakpoint's name, location, and hit count. Also contains per-breakpoint controls for enabling, deleting, or editing each breakpoint. For more information on breakpoints and their features, read the 'Breakpoints' section." }
|
||||
{ WatchPins "watch_pins" "Watch Pins" Null Pin 0 0 1 0 1 1 1 1 "Displays a table of all watch pins (watched expressions, like those found in `Watch`, but instead of being within a table, being pinned to some source code location, like breakpoints). This table contains each pin's name, location, and controls for editing or deleting each pin." }
|
||||
{ ExceptionFilters "exception_filters" "Exception Filters" Null Gear 0 0 1 0 1 0 1 1 "An interface which controls whether or not the debugger will halt attached processes upon encountering specific exception codes for the first time." }
|
||||
{ Settings "settings" "Settings" Null Gear 0 0 1 0 1 0 1 1 "An interface to modify general settings for the debugger's appearance and behavior." }
|
||||
}
|
||||
|
||||
@enum DF_GfxViewKind:
|
||||
{
|
||||
@expand(DF_GfxViewTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@gen
|
||||
{
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_SETUP_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_CMD_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_UI_FUNCTION_DEF($(a.name));`;
|
||||
}
|
||||
|
||||
@data(DF_ViewSpecInfo) df_g_gfx_view_kind_spec_info_table:
|
||||
{
|
||||
@expand(DF_GfxViewTable a) ```{(0|$(a.parameterized_by_entity)*DF_ViewSpecFlag_ParameterizedByEntity|$(a.project_specific)*DF_ViewSpecFlag_ProjectSpecific|$(a.can_serialize)*DF_ViewSpecFlag_CanSerialize|$(a.can_serialize_entity_path)*DF_ViewSpecFlag_CanSerializeEntityPath|$(a.can_filter)*DF_ViewSpecFlag_CanFilter|$(a.filter_is_code)*DF_ViewSpecFlag_FilterIsCode|$(a.typing_automatically_filters)*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("$(a.name_lower)"), str8_lit_comp("$(a.display_string)"), DF_NameKind_$(a.name_kind), DF_IconKind_$(a.icon), DF_VIEW_SETUP_FUNCTION_NAME($(a.name)), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME($(a.name)), DF_VIEW_CMD_FUNCTION_NAME($(a.name)), DF_VIEW_UI_FUNCTION_NAME($(a.name))}```;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -238,6 +277,21 @@ DF_CmdParamSlot2ViewSpecMap:
|
||||
{String "symbol_lister" "function_breakpoint" }
|
||||
}
|
||||
|
||||
@data(DF_CmdParamSlot) df_g_cmd_param_slot_2_view_spec_src_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `DF_CmdParamSlot_$(a.slot)`
|
||||
}
|
||||
|
||||
@data(String8) df_g_cmd_param_slot_2_view_spec_dst_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `str8_lit_comp("$(a.view_spec)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_cmd_param_slot_2_view_spec_cmd_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `str8_lit_comp("$(a.opt_cmd_spec)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Built-In Graphical View Rule Extensions
|
||||
//
|
||||
@@ -262,286 +316,6 @@ DF_GfxViewRuleTable:
|
||||
{"geo" - - x x x "Geometry" }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Theme Color Codes
|
||||
|
||||
@table(name display_name name_lower)
|
||||
DF_ThemeTable:
|
||||
{
|
||||
{Null "Null" null }
|
||||
{PlainText "Plain Text" plain_text }
|
||||
{PlainBackground "Plain Background" plain_background }
|
||||
{PlainBorder "Plain Border" plain_border }
|
||||
{PlainOverlay "Plain Overlay" plain_overlay }
|
||||
{CodeDefault "Code (Default)" code_default }
|
||||
{CodeFunction "Code (Function)" code_function }
|
||||
{CodeType "Code (Type)" code_type }
|
||||
{CodeLocal "Code (Local)" code_local }
|
||||
{CodeRegister "Code (Register)" code_register }
|
||||
{CodeKeyword "Code (Keyword)" code_keyword }
|
||||
{CodeSymbol "Code (Symbol)" code_symbol }
|
||||
{CodeNumeric "Code (Numeric)" code_numeric }
|
||||
{CodeString "Code (String)" code_string }
|
||||
{CodeMeta "Code (Meta)" code_meta }
|
||||
{CodeComment "Code (Comment)" code_comment }
|
||||
{LineInfo0 "Line Info (0)" line_info_0 }
|
||||
{LineInfo1 "Line Info (1)" line_info_1 }
|
||||
{LineInfo2 "Line Info (2)" line_info_2 }
|
||||
{LineInfo3 "Line Info (3)" line_info_3 }
|
||||
{AltText "Alt Text" alt_text }
|
||||
{AltBackground "Alt Background" alt_background }
|
||||
{AltBorder "Alt Border" alt_border }
|
||||
{AltOverlay "Alt Overlay" alt_overlay }
|
||||
{TabInactive "Inactive Tab" tab_inactive }
|
||||
{TabActive "Active Tab" tab_active }
|
||||
{EntityBackground "Entity Background" entity_background }
|
||||
{QueryBar "Query Bar" query_bar }
|
||||
{WeakText "Weak Text" weak_text }
|
||||
{TextSelection "Text Selection" text_selection }
|
||||
{Cursor "Cursor" cursor }
|
||||
{Highlight0 "Highlight (0)" highlight_0 }
|
||||
{Highlight1 "Highlight (1)" highlight_1 }
|
||||
{SuccessText "Success Text" success_text }
|
||||
{SuccessBackground "Success Background" success_background }
|
||||
{SuccessBorder "Success Border" success_border }
|
||||
{FailureText "Failure Text" failure_text }
|
||||
{FailureBackground "Failure Background" failure_background }
|
||||
{FailureBorder "Failure Border" failure_border }
|
||||
{ActionText "Action Text" action_text }
|
||||
{ActionBackground "Action Background" action_background }
|
||||
{ActionBorder "Action Border" action_border }
|
||||
{DropSiteOverlay "Drop Site Overlay" drop_site_overlay }
|
||||
{Thread0 "Thread (0)" thread_0 }
|
||||
{Thread1 "Thread (1)" thread_1 }
|
||||
{Thread2 "Thread (2)" thread_2 }
|
||||
{Thread3 "Thread (3)" thread_3 }
|
||||
{Thread4 "Thread (4)" thread_4 }
|
||||
{Thread5 "Thread (5)" thread_5 }
|
||||
{Thread6 "Thread (6)" thread_6 }
|
||||
{Thread7 "Thread (7)" thread_7 }
|
||||
{ThreadUnwound "Thread (Unwound)" thread_unwound }
|
||||
{InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay }
|
||||
{DropShadow "Drop Shadow" drop_shadow }
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Theme Color Version Remap Table
|
||||
|
||||
@table(old_name new_name)
|
||||
DF_ThemeColorVersionRemapTable:
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Theme Presets
|
||||
|
||||
@table(name_upper name_lower display_string)
|
||||
DF_ThemePresetTable:
|
||||
{
|
||||
{ DefaultDark default_dark "Default (Dark)" }
|
||||
{ DefaultLight default_light "Default (Light)" }
|
||||
{ VSDark vs_dark "VS (Dark)" }
|
||||
{ VSLight vs_light "VS (Light)" }
|
||||
{ SolarizedDark solarized_dark "Solarized (Dark)" }
|
||||
{ SolarizedLight solarized_light "Solarized (Light)" }
|
||||
{ HandmadeHero handmade_hero "Handmade Hero" }
|
||||
{ FourCoder four_coder "4coder" }
|
||||
{ FarManager far_manager "Far Manager" }
|
||||
}
|
||||
|
||||
@table(name default_dark default_light vs_dark vs_light solarized_dark solarized_light handmade_hero four_coder far_manager)
|
||||
DF_ThemePresetColorTable:
|
||||
{
|
||||
(null 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff )
|
||||
(plain_text 0xe5e5e5ff 0x383838ff 0xe5e5e5ff 0x1e1e1eff 0xe5e5e5ff 0x1e1e1eff 0xa08563ff 0x90b080ff 0x00ffffff )
|
||||
(plain_background 0x3333337f 0xedededfe 0x1e1e1eff 0xffffffff 0x002b36ff 0xfcf6e2ff 0x0c0c0cff 0x0c0c0cff 0x000082ff )
|
||||
(plain_border 0xffffff19 0x0000001d 0xffffff19 0xcccedb1d 0xffffff19 0xcccedb1d 0xffffff19 0x181818a0 0xffffff19 )
|
||||
(plain_overlay 0xffffff33 0x00000033 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 )
|
||||
(code_default 0xe5e5e5ff 0x282828ff 0xd4d4d4ff 0x000000ff 0x839496ff 0x74878cff 0xa08563ff 0x90b080ff 0x00ffffff )
|
||||
(code_function 0x7fcc99ff 0x2a7a45ff 0xdcdcaaff 0x74531fff 0x1c7dd1ff 0xc39d36ff 0xcc5735ff 0x7fcc99ff 0x49b2ffff )
|
||||
(code_type 0x66b2e5ff 0x2c688fff 0x4ec9b0ff 0x2b91afff 0x1c7dd1ff 0x66b2e5ff 0xd8a51dff 0x66b2e5ff 0x49b2ffff )
|
||||
(code_local 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff 0xfe9548ff )
|
||||
(code_register 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff 0xd45d90ff )
|
||||
(code_keyword 0xf7bf5eff 0xa47729ff 0x569cd6ff 0x0000ffff 0x63980fff 0xc39d36ff 0xac7b0bff 0xd08f20ff 0xff0000ff )
|
||||
(code_symbol 0x994c32ff 0x6c2d18ff 0xb4b4b4ff 0x000000ff 0x839496ff 0x2e5256ff 0x994c32ff 0x994c32ff 0xffffffff )
|
||||
(code_numeric 0x4ce54cff 0x2c7d2cff 0xb5cea8ff 0x000000ff 0xcb4b20ff 0x657b83ff 0x6b8e23ff 0x50ff30ff 0x2cff50ff )
|
||||
(code_string 0xe5cc66ff 0xcc5a0fff 0xd69d85ff 0xc11515ff 0x2aa198ff 0x5ab4a9ff 0x6b8e23ff 0x50ff30ff 0xe5cc66ff )
|
||||
(code_meta 0xe54c4cff 0x8a0c0cff 0x9b9b9bff 0x808080ff 0xe54c4cff 0xe54c4cff 0xdab98fff 0x50ff30ff 0xffff00ff )
|
||||
(code_comment 0x7f7f7fff 0x7f7f7fff 0x6a9955ff 0x008000ff 0x7f7f7fff 0xadafb2ff 0x686868ff 0x2090f0ff 0x7f7f7fff )
|
||||
(line_info_0 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f )
|
||||
(line_info_1 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f )
|
||||
(line_info_2 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f )
|
||||
(line_info_3 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f )
|
||||
(alt_text 0xe5e5e5ff 0x535353ff 0xf1f1f1ff 0x535353ff 0xe5e5e5ff 0x535353ff 0xa08563ff 0x90b080ff 0x000000ff )
|
||||
(alt_background 0x42474c7f 0xfefefebc 0x1b1b1cff 0xfefefebc 0x002b36ff 0xfcf6e2ff 0x0c0c0cff 0x0c0c0cff 0x008184ff )
|
||||
(alt_border 0xffffff19 0xffffff19 0x333337ff 0xffffff19 0xffffff19 0xffffff19 0xffffff19 0xffffff19 0xffffff19 )
|
||||
(alt_overlay 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 )
|
||||
(tab_inactive 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f 0x42474c7f )
|
||||
(tab_active 0xa87a4c99 0xc7a27dff 0x007accff 0x007accff 0x28515eff 0xa87a4c99 0xa87a4c99 0xa87a4c99 0xa87a4c99 )
|
||||
(entity_background 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 0x4293cc99 )
|
||||
(query_bar 0x8e2d4ccc 0xd76489cc 0x8e2d4ccc 0x8e2d4ccc 0x8e2d4ccc 0x8e2d4ccc 0x8e2d4ccc 0x8e2d4ccc 0x8e2d4ccc )
|
||||
(weak_text 0xffffff7f 0x0000007f 0xffffff7f 0x0000007f 0xffffff7f 0x0000007f 0xa08563af 0x90b080af 0xffffff7f )
|
||||
(text_selection 0x99ccff4c 0x7d98b34c 0x99ccff4c 0x7d98b34c 0x99ccff4c 0x7d98b34c 0x99ccff4c 0x99ccff4c 0x99ccff4c )
|
||||
(cursor 0x66e566e5 0x101010ff 0x66e566e5 0x101010ff 0x66e566e5 0x101010ff 0x66e566e5 0x66e566e5 0x66e566e5 )
|
||||
(highlight_0 0xb27219ff 0xb272189b 0xb27219ff 0xb27219ff 0xb27219ff 0xb27219ff 0xb27219ff 0xb27219ff 0xb27219ff )
|
||||
(highlight_1 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff 0x327f19ff )
|
||||
(success_text 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff )
|
||||
(success_background 0x32b219ff 0x75db61ff 0x32b219ff 0x32b219ff 0x32b219ff 0x32b219ff 0x32b219ff 0x32b219ff 0x32b219ff )
|
||||
(success_border 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 )
|
||||
(failure_text 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff 0xe5e5e5ff )
|
||||
(failure_background 0xb23219ff 0xf27961ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff )
|
||||
(failure_border 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 )
|
||||
(action_text 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff 0xffffffff )
|
||||
(action_background 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff 0x327fb2ff )
|
||||
(action_border 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 0xffffff33 )
|
||||
(drop_site_overlay 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c )
|
||||
(thread_0 0xffcb7fff 0xad7c34ff 0xffcb7fff 0xad7c34ff 0xffcb7fff 0xad7c34ff 0xffcb7fff 0xffcb7fff 0xffcb7fff )
|
||||
(thread_1 0xb2ff65ff 0x639b2aff 0xb2ff65ff 0x639b2aff 0xb2ff65ff 0x639b2aff 0xb2ff65ff 0xb2ff65ff 0xb2ff65ff )
|
||||
(thread_2 0xff99e5ff 0xa94c91ff 0xff99e5ff 0xa94c91ff 0xff99e5ff 0xa94c91ff 0xff99e5ff 0xff99e5ff 0xff99e5ff )
|
||||
(thread_3 0x6598ffff 0x305398ff 0x6598ffff 0x305398ff 0x6598ffff 0x305398ff 0x6598ffff 0x6598ffff 0x6598ffff )
|
||||
(thread_4 0x65ffcbff 0x339574ff 0x65ffcbff 0x339574ff 0x65ffcbff 0x339574ff 0x65ffcbff 0x65ffcbff 0x65ffcbff )
|
||||
(thread_5 0xff9819ff 0xbf7416ff 0xff9819ff 0xbf7416ff 0xff9819ff 0xbf7416ff 0xff9819ff 0xff9819ff 0xff9819ff )
|
||||
(thread_6 0x9932ffff 0x57238bff 0x9932ffff 0x57238bff 0x9932ffff 0x57238bff 0x9932ffff 0x9932ffff 0x9932ffff )
|
||||
(thread_7 0x65ff4cff 0x2a7e1cff 0x65ff4cff 0x2a7e1cff 0x65ff4cff 0x2a7e1cff 0x65ff4cff 0x65ff4cff 0x65ff4cff )
|
||||
(thread_unwound 0xb2ccd8ff 0x236481ff 0xb2ccd8ff 0x236481ff 0xb2ccd8ff 0x236481ff 0xb2ccd8ff 0xb2ccd8ff 0xb2ccd8ff )
|
||||
(inactive_panel_overlay 0x0000003f 0x0000000d 0x0000003f 0x0000000d 0x0000003f 0x0000000d 0x0000003f 0x0000003f 0x0000003f )
|
||||
(drop_shadow 0x0000007f 0x0000003b 0x0000007f 0x0000003b 0x0000007f 0x0000003b 0x0000007f 0x0000007f 0x0000007f )
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generators
|
||||
|
||||
//- rjf: enums
|
||||
|
||||
@enum DF_GfxViewKind:
|
||||
{
|
||||
@expand(DF_GfxViewTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@enum DF_ThemeColor:
|
||||
{
|
||||
@expand(DF_ThemeTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@enum DF_ThemePreset:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
//- rjf: theme preset color tables
|
||||
|
||||
@data(String8) df_g_theme_preset_display_string_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `str8_lit_comp("$(a.display_string)")`,
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_preset_code_string_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `str8_lit_comp("$(a.name_lower)")`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__default_dark:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.default_dark))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__default_light:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.default_light))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__vs_dark:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.vs_dark))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__vs_light:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.vs_light))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__solarized_dark:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.solarized_dark))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__solarized_light:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.solarized_light))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__handmade_hero:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.handmade_hero))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__four_coder:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.four_coder))`,
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__far_manager:
|
||||
{
|
||||
@expand(DF_ThemePresetColorTable a) `rgba_from_u32_lit_comp($(a.far_manager))`;
|
||||
}
|
||||
|
||||
@data(`Vec4F32*`) df_g_theme_preset_colors_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `df_g_theme_preset_colors__$(a.name_lower)`,
|
||||
}
|
||||
|
||||
//- rjf: cmd param slot -> view spec tables
|
||||
|
||||
@data(DF_CmdParamSlot) df_g_cmd_param_slot_2_view_spec_src_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `DF_CmdParamSlot_$(a.slot)`
|
||||
}
|
||||
|
||||
@data(String8) df_g_cmd_param_slot_2_view_spec_dst_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `str8_lit_comp("$(a.view_spec)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_cmd_param_slot_2_view_spec_cmd_map:
|
||||
{
|
||||
@expand(DF_CmdParamSlot2ViewSpecMap a) `str8_lit_comp("$(a.opt_cmd_spec)")`
|
||||
}
|
||||
|
||||
//- rjf: default bindings table
|
||||
|
||||
@data(DF_StringBindingPair) df_g_default_binding_table:
|
||||
{
|
||||
@expand(DF_DefaultBindingTable a) ```{str8_lit_comp("$(a.name)"), {OS_Key_$(a.key), 0 $(a.ctrl != 0 -> `|OS_EventFlag_Ctrl`) $(a.shift != 0 -> `|OS_EventFlag_Shift`) $(a.alt != 0 -> `|OS_EventFlag_Alt`)}}```;
|
||||
}
|
||||
|
||||
//- rjf: binding version remap tables
|
||||
|
||||
@data(String8) df_g_binding_version_remap_old_name_table:
|
||||
{
|
||||
@expand(DF_BindingVersionRemapTable a) `str8_lit_comp("$(a.old_name)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_binding_version_remap_new_name_table:
|
||||
{
|
||||
@expand(DF_BindingVersionRemapTable a) `str8_lit_comp("$(a.new_name)")`
|
||||
}
|
||||
|
||||
//- rjf: view hook forward declares
|
||||
|
||||
@gen
|
||||
{
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_SETUP_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_CMD_FUNCTION_DEF($(a.name));`;
|
||||
@expand(DF_GfxViewTable a) `DF_VIEW_UI_FUNCTION_DEF($(a.name));`;
|
||||
}
|
||||
|
||||
//- rjf: gfx view rule function forward declares
|
||||
|
||||
@gen
|
||||
{
|
||||
``;
|
||||
@@ -563,7 +337,11 @@ DF_ThemePresetColorTable:
|
||||
`$(a.tu == "x" -> "DF_VIEW_UI_FUNCTION_DEF(" .. a.name_lower .. ");")`;
|
||||
}
|
||||
|
||||
//- rjf: gfx view rule tables
|
||||
@data(DF_ViewSpecInfo) @c_file df_g_gfx_view_rule_tab_view_spec_info_table:
|
||||
{
|
||||
@expand(DF_GfxViewRuleTable a)
|
||||
```$(a.tu == "x" -> '{ DF_ViewSpecFlag_CanSerialize|DF_ViewSpecFlag_CanSerializeQuery, str8_lit_comp("' .. a.string .. '_view_rule"), str8_lit_comp("' .. a.tab_display_string .. '"), DF_NameKind_Null, DF_IconKind_Binoculars, ' .. 'DF_VIEW_SETUP_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_CMD_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_UI_FUNCTION_NAME(' .. a.string .. ') }')```;
|
||||
}
|
||||
|
||||
@data(DF_GfxViewRuleSpecInfo) @c_file df_g_gfx_view_rule_spec_info_table:
|
||||
{
|
||||
@@ -571,29 +349,245 @@ DF_ThemePresetColorTable:
|
||||
```{ str8_lit_comp("$(a.string)"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*$(a.vr == "x"))|(DF_GfxViewRuleSpecInfoFlag_LineStringize*$(a.ls == "x"))|(DF_GfxViewRuleSpecInfoFlag_RowUI*$(a.ru == "x"))|(DF_GfxViewRuleSpecInfoFlag_BlockUI*$(a.bu == "x")), $(a.vr == "x" -> "DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_NAME("..a.name_lower..")") $(a.vr != "x" -> 0), $(a.ls == "x" -> "DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME("..a.name_lower..")") $(a.ls != "x" -> 0), $(a.ru == "x" -> "DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME("..a.name_lower..")") $(a.ru != "x" -> 0), $(a.bu == "x" -> "DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME("..a.name_lower..")") $(a.bu != "x" -> 0), str8_lit_comp("$(a.tu == 'x' -> a.string..'_view_rule')") }```;
|
||||
}
|
||||
|
||||
@data(DF_ViewSpecInfo) @c_file df_g_gfx_view_rule_tab_view_spec_info_table:
|
||||
////////////////////////////////
|
||||
//~ rjf: Theme Tables
|
||||
|
||||
@table(name_upper name_lower display_string)
|
||||
DF_ThemePresetTable:
|
||||
{
|
||||
@expand(DF_GfxViewRuleTable a)
|
||||
```$(a.tu == "x" -> '{ DF_ViewSpecFlag_CanSerialize|DF_ViewSpecFlag_CanSerializeQuery, str8_lit_comp("' .. a.string .. '_view_rule"), str8_lit_comp("' .. a.tab_display_string .. '"), DF_NameKind_Null, DF_IconKind_Binoculars, ' .. 'DF_VIEW_SETUP_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_CMD_FUNCTION_NAME(' .. a.string .. '), DF_VIEW_UI_FUNCTION_NAME(' .. a.string .. ') }')```;
|
||||
{ DefaultDark default_dark "Default (Dark)" }
|
||||
{ DefaultLight default_light "Default (Light)" }
|
||||
{ VSDark vs_dark "VS (Dark)" }
|
||||
{ VSLight vs_light "VS (Light)" }
|
||||
{ SolarizedDark solarized_dark "Solarized (Dark)" }
|
||||
{ SolarizedLight solarized_light "Solarized (Light)" }
|
||||
{ HandmadeHero handmade_hero "Handmade Hero" }
|
||||
{ FourCoder four_coder "4coder" }
|
||||
{ FarManager far_manager "Far Manager" }
|
||||
}
|
||||
|
||||
//- rjf: default view spec info table
|
||||
|
||||
@data(DF_ViewSpecInfo) df_g_gfx_view_kind_spec_info_table:
|
||||
@table(name display_name name_lower default_dark default_light vs_dark vs_light solarized_dark solarized_light handmade_hero four_coder far_manager desc)
|
||||
DF_ThemeColorTable:
|
||||
{
|
||||
@expand(DF_GfxViewTable a) ```{(0|$(a.parameterized_by_entity)*DF_ViewSpecFlag_ParameterizedByEntity|$(a.can_serialize)*DF_ViewSpecFlag_CanSerialize|$(a.can_serialize_entity_path)*DF_ViewSpecFlag_CanSerializeEntityPath|$(a.can_filter)*DF_ViewSpecFlag_CanFilter|$(a.filter_is_code)*DF_ViewSpecFlag_FilterIsCode|$(a.typing_automatically_filters)*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("$(a.name_lower)"), str8_lit_comp("$(a.display_string)"), DF_NameKind_$(a.name_kind), DF_IconKind_$(a.icon), DF_VIEW_SETUP_FUNCTION_NAME($(a.name)), DF_VIEW_STRING_FROM_STATE_FUNCTION_NAME($(a.name)), DF_VIEW_CMD_FUNCTION_NAME($(a.name)), DF_VIEW_UI_FUNCTION_NAME($(a.name))}```;
|
||||
{Null "Null" null 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff 0xff00ffff ""}
|
||||
|
||||
//- rjf: global ui colors
|
||||
{Text "Text" text 0xe5e5e5ff 0x4c4c4cff 0xe5e5e5ff 0x000000ff 0x999999ff 0x333333ff 0xa08462ff 0x90b080ff 0x00fefeff ""}
|
||||
{TextPositive "Text (Positive)" text_positive 0x4dc221ff 0x4d9e2eff 0x4dc221ff 0x4dc221ff 0x4dc221ff 0x4dc221ff 0x4dc221ff 0x4dc221ff 0x4dc221ff ""}
|
||||
{TextNegative "Text (Negative)" text_negative 0xc56452ff 0xbd371eff 0xc56452ff 0xc46451ff 0xc56452ff 0xc56452ff 0xc56452ff 0xc56452ff 0xc56452ff ""}
|
||||
{TextNeutral "Text (Neutral)" text_neutral 0x307eb2ff 0x0064a7ff 0x307eb2ff 0x307eb2ff 0x307eb2ff 0x307eb2ff 0x307eb2ff 0x307eb2ff 0x307eb2ff ""}
|
||||
{TextWeak "Text (Weak)" text_weak 0xa4a4a4fe 0x4c4c4cff 0xa4a4a4fe 0x0000007f 0x9999998a 0x818181ff 0x6e512eff 0x566e4bff 0x00a9a9ff ""}
|
||||
{Cursor "Cursor" cursor 0x8aff00ff 0x699830ff 0x8aff00ff 0x000000ff 0x8aff00ff 0x586e75ff 0x8aff00ff 0x8aff00ff 0x8aff00ff ""}
|
||||
{CursorInactive "Cursor (Inactive)" cursor_inactive 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff 0xb23217ff ""}
|
||||
{Focus "Focus" focus 0xfda200ff 0x9c5900ff 0xfda200ff 0x002affff 0xfda200ff 0x92743dff 0xfda200ff 0xfda200ff 0x00fefeff ""}
|
||||
{Hover "Hover" hover 0xffffffff 0xffffffff 0xffffffff 0x000000ff 0xffffffff 0x747474ff 0xffffffff 0xffffffff 0xffffffff ""}
|
||||
{DropShadow "Drop Shadow" drop_shadow 0x0000007f 0x0000004c 0x0000007f 0xa3a3a37e 0x0000007f 0xc9bfa394 0x0000007f 0x0000007f 0x0000007f ""}
|
||||
{DisabledOverlay "Disabled Overlay" disabled_overlay 0x0000003f 0xa6a6a63f 0x0000003f 0x0000003f 0x0000003f 0xe4dac090 0x0000003f 0x0000003f 0x0000003f ""}
|
||||
{DropSiteOverlay "Drop Site Overlay" drop_site_overlay 0xffffff0c 0x4848480c 0xffffff0c 0x0000000c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c 0xffffff0c ""}
|
||||
{InactivePanelOverlay "Inactive Panel Overlay" inactive_panel_overlay 0x0000003f 0xa4a4a43f 0x0000003f 0xfefefe53 0x0000003f 0x0000001c 0x0000003f 0x0000003f 0x0000003f ""}
|
||||
{SelectionOverlay "Selection Overlay" selection_overlay 0x99ccff4c 0x003d7a48 0x99ccff4c 0x3d74ab4b 0x99ccff4c 0x678cb24c 0x99ccff4c 0x99ccff4c 0x99ccff4c ""}
|
||||
{HighlightOverlay "Highlight Overlay" highlight_overlay 0xffffff1e 0xffffff1e 0xffffff1e 0x0000001e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e 0xffffff1e ""}
|
||||
{HighlightOverlayError "Error Highlight Overlay" error_highlight_overlay 0x5f12005f 0xff30005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f 0x5f12005f ""}
|
||||
|
||||
//- rjf: base ui container colors
|
||||
{BaseBackground "Base Background" base_background 0x1b1b1bfe 0xccccccfe 0x1b1b1bfe 0xfefefefe 0x002a35fe 0xfcf5e2fe 0x0c0c0cfe 0x0c0c0cfe 0x000081fe ""}
|
||||
{BaseBackgroundAlt "Base Background (Alternate)" base_background_alt 0x2b2b2bfe 0x2b2b2bfe 0x1b1b1bfe 0xe7e7e7fe 0x2b2b2bfe 0x2b2b2bfe 0x2b2b2bfe 0x2b2b2bfe 0x2b2b2bfe ""}
|
||||
{BaseBorder "Base Border" base_border 0x3f3f3ffe 0xa4a4a4fe 0x3f3f3ffe 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0x423525fe 0x3f3f3ffe 0x0000fffe ""}
|
||||
|
||||
//- rjf: menu bar ui container colors
|
||||
{MenuBarBackground "Menu Bar Background" menu_bar_background 0x3e4c577f 0xeaeaea7f 0x1b1b1bfd 0xffffff7f 0x00202bff 0xeee8d5ff 0x0c0c0cfe 0x0c0c0cfe 0x007d7dff ""}
|
||||
{MenuBarBackgroundAlt "Menu Bar Background (Alternate)" menu_bar_background_alt 0x3e4c577f 0x3e4c577f 0x1b1b1bfd 0xffffff7f 0x3e4c577f 0x3e4c577f 0x3e4c577f 0x3e4c577f 0x007d7dff ""}
|
||||
{MenuBarBorder "Menu Bar Border" menu_bar_border 0xffffff19 0xa4a4a4fe 0x3f3f3ffe 0xb6b6b6ff 0xffffff19 0xbebaabfe 0xffffff19 0xffffff19 0xfefefe00 ""}
|
||||
|
||||
//- rjf: floating ui container colors
|
||||
{FloatingBackground "Floating Background" floating_background 0x33333333 0xccccccc0 0x33333333 0xfefefec7 0x007fa14e 0xffffff7c 0x0c0c0c32 0x0c0c0c3e 0x007c7c55 ""}
|
||||
{FloatingBackgroundAlt "Floating Background (Alternate)" floating_background_alt 0x33333333 0x33333333 0x33333333 0x33333333 0x33333333 0x33333333 0x33333333 0x33333333 0x33333333 ""}
|
||||
{FloatingBorder "Floating Border" floating_border 0x3f3f3ffd 0xa4a4a4fe 0x3f3f3ffd 0xb6b6b6ff 0xfdfdfd3a 0xbebaabfe 0x423425fe 0x3f3f3ffd 0x00ffff55 ""}
|
||||
|
||||
//- rjf: ui element colors
|
||||
{ImplicitButtonBackground "Implicit Button Background" implicit_button_background 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 ""}
|
||||
{ImplicitButtonBorder "Implicit Button Border" implicit_button_border 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 0xbdb9aa00 0x00000000 0x00000000 0x00000000 ""}
|
||||
{PlainButtonBackground "Plain Button Background" plain_button_background 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe 0x1b1b1bfe ""}
|
||||
{PlainButtonBorder "Plain Button Border" plain_button_border 0x3f3f3ffe 0x3f3f3ffe 0x3f3f3ffe 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0x3f3f3ffe 0x3f3f3ffe 0x3f3f3ffe ""}
|
||||
{PositivePopButtonBackground "Positive Pop Button Background" positive_pop_button_background 0x2c5b36ff 0x65f534ff 0x2c5b36ff 0x84ce93ff 0x2c5b36ff 0xb6ddbeff 0x132e19ff 0x152f1bff 0x2c5b36ff ""}
|
||||
{PositivePopButtonBorder "Positive Pop Button Border" positive_pop_button_border 0x3f3f3ffd 0x3f3f3ffd 0x3f3f3ffd 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0x3f3f3ffd 0x3f3f3ffd 0x3f3f3ffd ""}
|
||||
{NegativePopButtonBackground "Negative Pop Button Background" negative_pop_button_background 0x803425ff 0xff694cff 0x803425ff 0xbd3e24ff 0x803425ff 0xf8b0a1ff 0x803425ff 0x43150cff 0x803425ff ""}
|
||||
{NegativePopButtonBorder "Negative Pop Button Border" negative_pop_button_border 0x3f3f3ffd 0x3f3f3ffd 0x3f3f3ffd 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0x3f3f3ffd 0x3f3f3ffd 0x3f3f3ffd ""}
|
||||
{NeutralPopButtonBackground "Neutral Pop Button Background" neutral_pop_button_background 0x355b6eff 0xa6becaff 0x355b6eff 0x6e9db5ff 0x355b6eff 0xb2d3e3ff 0x15445cff 0x1b323eff 0x933100ff ""}
|
||||
{NeutralPopButtonBorder "Neutral Pop Button Border" neutral_pop_button_border 0x3f3f3ffd 0xa6a6a6fd 0x3f3f3ffd 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0x3f3f3ffd 0x3f3f3ffd 0x3f3f3ffd ""}
|
||||
{ScrollBarButtonBackground "Scroll Bar Button Background" scroll_bar_button_background 0x2b2b2bfe 0xa9a9a9fe 0x2b2b2bfe 0xe8e8e8fe 0x005e77fe 0xe3dbc7fe 0x1f1f27fe 0x212721fe 0x007d7dff ""}
|
||||
{ScrollBarButtonBorder "Scroll Bar Button Border" scroll_bar_button_border 0x3f3f3ffe 0xc0c0c0fe 0x3f3f3ffe 0xb6b6b6ff 0xfefefe3a 0xbebaabfe 0xfefefe4d 0x3f3f3ffe 0x3f3f3ffe ""}
|
||||
{TabBackground "Tab Background" tab_background 0x6f5135fe 0xa98b6fff 0x0079ccff 0xfffffffe 0x005e77fe 0xfdf6e3ff 0x1f1f27fe 0x212721fe 0x007d7dff ""}
|
||||
{TabBorder "Tab Border" tab_border 0xfefefe4d 0xffffff4d 0xfefefe4d 0xb6b6b6ff 0xfefefe4d 0xbebaabfe 0xfefefe4d 0xfefefe4d 0xfefefe4d ""}
|
||||
{TabBackgroundInactive "Tab Background (Inactive)" tab_background_inactive 0x3e4c577f 0x8282827f 0xfefefe14 0xcdd4dc7f 0x3e4c577f 0xd4cfc0fe 0x131315ee 0x3a3a3a7f 0x3e4c577f ""}
|
||||
{TabBorderInactive "Tab Border (Inactive)" tab_border_inactive 0xffffff19 0xffffff19 0xffffff00 0xb6b6b6ff 0xffffff19 0xbebaabfe 0xffffff19 0x00000019 0xfefefe19 ""}
|
||||
|
||||
//- rjf: code colors
|
||||
{CodeDefault "Code (Default)" code_default 0xcbcbcbff 0x4d4d4dff 0xcbcbcbff 0x000000ff 0xcbcbcbff 0x657b83ff 0xa08462ff 0x90b080ff 0x00fefeff ""}
|
||||
{CodeSymbol "Code (Symbol)" code_symbol 0x42a2cffe 0x205670fe 0xdcdcaaff 0x000000ff 0xcb4a15ff 0xcb4a15ff 0xcc5634ff 0x42a2cffe 0x65b1ffff ""}
|
||||
{CodeType "Code (Type)" code_type 0xfec746ff 0x996b00ff 0x4ec9afff 0xa33700ff 0xcb4a15ff 0xcb4a15ff 0xd8a51bff 0xfd7c52ff 0xfec746ff ""}
|
||||
{CodeLocal "Code (Local)" code_local 0x98bc80ff 0x446a2bff 0x9cdbfeff 0x007666ff 0x98bc80ff 0x258ad2ff 0xc04047ff 0x98bc80ff 0x00ff00ff ""}
|
||||
{CodeRegister "Code (Register)" code_register 0xb7afd5ff 0x4c35a1ff 0xb7afd5ff 0xb7afd5ff 0xb7afd5ff 0x373345ff 0xb7afd5ff 0xb7afd5ff 0xb7afd5ff ""}
|
||||
{CodeKeyword "Code (Keyword)" code_keyword 0xb38d4cff 0x573700ff 0x569cd6ff 0x0000ffff 0x849803ff 0x586e75ff 0xac7a09ff 0xd08f1eff 0x00ffffff ""}
|
||||
{CodeDelimiterOperator "Code (Delimiters/Operators)" code_delimiter_operator 0x767676ff 0x767676ff 0x767676ff 0x767676ff 0x767676ff 0x767676ff 0xa08462ff 0x90b080ff 0xffffffff ""}
|
||||
{CodeNumeric "Code (Numeric)" code_numeric 0x98abb1ff 0x3f6e7dff 0xb5cea8ff 0x088658ff 0xd33582ff 0xd33482ef 0x698e21ff 0x4fff2eff 0x00ff00ff ""}
|
||||
{CodeNumericAltDigitGroup "Code (Numeric, Alt. Digit Group)" code_numeric_alt_digit_group 0x738287ff 0x1f4450ff 0x729360ff 0x0c3828ff 0x902559ff 0x8e2659ff 0x3a4e11ff 0x3ccd21ff 0x738287ff ""}
|
||||
{CodeString "Code (String)" code_string 0x98abb1ff 0x3c606bff 0xd59b85ff 0xa31414ff 0x1f9d91ff 0x29a198ff 0x6a8e22ff 0x4fff2eff 0x98abb1ff ""}
|
||||
{CodeMeta "Code (Meta)" code_meta 0xd96759ff 0xad3627ff 0xd59c85ff 0x0000ffff 0x839802ff 0xd96759ff 0xdab98fff 0xa0b8a0ff 0xff0000ff ""}
|
||||
{CodeComment "Code (Comment)" code_comment 0x717171ff 0x4b4b4bff 0x57a54aff 0x008000ff 0x556a6fff 0x93a1a1ff 0x686868ff 0x1e8fefff 0xffffffff ""}
|
||||
{CodeLineNumbers "Code Line Numbers" code_line_numbers 0x7f7f7fff 0x4b4b4bff 0x2a91afff 0x227893ff 0x566c73ff 0x227893ef 0xa08462ff 0x7e7e7ffe 0x007d7dff ""}
|
||||
{CodeLineNumbersSelected "Code Line Numbers (Selected)" code_line_numbers_selected 0xbebebeff 0x000000ff 0x9ddaecff 0x123d4bfe 0xa2aaacff 0x111e22ef 0xc8b399ff 0xbebebeff 0x00fefeff ""}
|
||||
|
||||
//- rjf: debugging colors
|
||||
{LineInfoBackground0 "Line Info Background 0" line_info_background_0 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f ""}
|
||||
{LineInfoBackground1 "Line Info Background 1" line_info_background_1 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f ""}
|
||||
{LineInfoBackground2 "Line Info Background 2" line_info_background_2 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f ""}
|
||||
{LineInfoBackground3 "Line Info Background 3" line_info_background_3 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f ""}
|
||||
{LineInfoBackground4 "Line Info Background 4" line_info_background_4 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f 0x99503d3f ""}
|
||||
{LineInfoBackground5 "Line Info Background 5" line_info_background_5 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f 0xfe82493f ""}
|
||||
{LineInfoBackground6 "Line Info Background 6" line_info_background_6 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f 0xffba173f ""}
|
||||
{LineInfoBackground7 "Line Info Background 7" line_info_background_7 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f 0xcefd693f ""}
|
||||
{Thread0 "Thread 0" thread_0 0xffcb7fff 0x945800ff 0xffcb7fff 0x945800ff 0xffcb7fff 0x945800ff 0xffcb7fff 0xffcb7fff 0xffcb7fff ""}
|
||||
{Thread1 "Thread 1" thread_1 0xb2ff65ff 0x3f5b23ff 0xb2ff65ff 0x3f5b23ff 0xb2ff65ff 0x3f5b23ff 0xb2ff65ff 0xb2ff65ff 0xb2ff65ff ""}
|
||||
{Thread2 "Thread 2" thread_2 0xff99e5ff 0x642a55ff 0xff99e5ff 0x642a55ff 0xff99e5ff 0x642a55ff 0xff99e5ff 0xff99e5ff 0xff99e5ff ""}
|
||||
{Thread3 "Thread 3" thread_3 0x6598ffff 0x30456fff 0x6598ffff 0x30456fff 0x6598ffff 0x30456fff 0x6598ffff 0x6598ffff 0x6598ffff ""}
|
||||
{Thread4 "Thread 4" thread_4 0x65ffcbff 0x264f41ff 0x65ffcbff 0x264f41ff 0x65ffcbff 0x264f41ff 0x65ffcbff 0x65ffcbff 0x65ffcbff ""}
|
||||
{Thread5 "Thread 5" thread_5 0xff9819ff 0x736a5fff 0xff9819ff 0x736a5fff 0xff9819ff 0x736a5fff 0xff9819ff 0xff9819ff 0xff9819ff ""}
|
||||
{Thread6 "Thread 6" thread_6 0x9932ffff 0x472f5eff 0x9932ffff 0x472f5eff 0x9932ffff 0x472f5eff 0x9932ffff 0x9932ffff 0x9932ffff ""}
|
||||
{Thread7 "Thread 7" thread_7 0x65ff4cff 0x405d3bff 0x65ff4cff 0x405d3bff 0x65ff4cff 0x405d3bff 0x65ff4cff 0x65ff4cff 0x65ff4cff ""}
|
||||
{ThreadUnwound "Thread (Unwound)" thread_unwound 0xb2ccd8ff 0x49606aff 0xb2ccd8ff 0x49606aff 0xb2ccd8ff 0x49606aff 0xb2ccd8ff 0xb2ccd8ff 0xb2ccd8ff ""}
|
||||
{ThreadError "Thread (Error)" thread_error 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23219ff 0xb23218ff 0xb23219ff 0xb23219ff 0xb23219ff ""}
|
||||
{Breakpoint "Breakpoint" breakpoint 0xa72911ff 0xff2800ff 0xa72911ff 0xa72911ff 0xa72911ff 0xff684bff 0xa72911ff 0xa72911ff 0xff2800ff ""}
|
||||
}
|
||||
|
||||
//- rjf: theme color tables
|
||||
@table(old_name new_name)
|
||||
DF_ThemeColorVersionRemapTable:
|
||||
{
|
||||
{plain_text text}
|
||||
{plain_background base_background}
|
||||
{plain_border base_border}
|
||||
{plain_overlay drop_site_overlay}
|
||||
{code_function code_symbol}
|
||||
{code_symbol code_delimiter_operator}
|
||||
{code_numeric code_numeric_alt_digit_group}
|
||||
{line_info_0 line_info_background_0}
|
||||
{line_info_1 line_info_background_1}
|
||||
{line_info_2 line_info_background_2}
|
||||
{line_info_3 line_info_background_3}
|
||||
{alt_background menu_bar_background}
|
||||
{alt_border menu_bar_border}
|
||||
{tab_inactive tab_background_inactive}
|
||||
{tab_active tab_background}
|
||||
{weak_text text_weak}
|
||||
{text_selection selection}
|
||||
{cursor cursor}
|
||||
{highlight_0 focus}
|
||||
{success_background positive_pop_button_background}
|
||||
{failure_background negative_pop_button_background}
|
||||
{action_background neutral_pop_button_background}
|
||||
}
|
||||
|
||||
@enum DF_ThemeColor:
|
||||
{
|
||||
@expand(DF_ThemeColorTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@enum DF_ThemePreset:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_preset_display_string_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `str8_lit_comp("$(a.display_string)")`,
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_preset_code_string_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `str8_lit_comp("$(a.name_lower)")`,
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_color_version_remap_old_name_table:
|
||||
{
|
||||
@expand(DF_ThemeColorVersionRemapTable a) `str8_lit_comp("$(a.old_name)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_color_version_remap_new_name_table:
|
||||
{
|
||||
@expand(DF_ThemeColorVersionRemapTable a) `str8_lit_comp("$(a.new_name)")`
|
||||
}
|
||||
|
||||
@data(Vec4F32) df_g_theme_preset_colors__default_dark: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.default_dark))`}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__default_light: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.default_light))`}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__vs_dark: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.vs_dark))`}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__vs_light: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.vs_light))`}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__solarized_dark: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.solarized_dark))`,}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__solarized_light:{@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.solarized_light))`,}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__handmade_hero: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.handmade_hero))`,}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__four_coder: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.four_coder))`,}
|
||||
@data(Vec4F32) df_g_theme_preset_colors__far_manager: {@expand(DF_ThemeColorTable a) `rgba_from_u32_lit_comp($(a.far_manager))`;}
|
||||
@data(`Vec4F32*`) df_g_theme_preset_colors_table:
|
||||
{
|
||||
@expand(DF_ThemePresetTable a) `df_g_theme_preset_colors__$(a.name_lower)`,
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_color_display_string_table:
|
||||
{
|
||||
@expand(DF_ThemeTable a) `str8_lit_comp("$(a.display_name)")`
|
||||
@expand(DF_ThemeColorTable a) `str8_lit_comp("$(a.display_name)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_theme_color_cfg_string_table:
|
||||
{
|
||||
@expand(DF_ThemeTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
@expand(DF_ThemeColorTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings
|
||||
|
||||
@table(name name_lower display_string default_s32 s32_min s32_max)
|
||||
DF_SettingTable:
|
||||
{
|
||||
{HoverAnimations hover_animations "Hover Animations" 1 0 1 }
|
||||
{PressAnimations press_animations "Press Animations" 1 0 1 }
|
||||
{FocusAnimations focus_animations "Focus Animations" 1 0 1 }
|
||||
{TooltipAnimations tooltip_animations "Tooltip Animations" 1 0 1 }
|
||||
{MenuAnimations menu_animations "Menu Animations" 1 0 1 }
|
||||
{ScrollingAnimations scrolling_animations "Scrolling Animations" 1 0 1 }
|
||||
{BackgroundBlur background_blur "Background Blur" 1 0 1 }
|
||||
{ThreadLines thread_lines "Thread Lines" 1 0 1 }
|
||||
{BreakpointLines breakpoint_lines "Breakpoint Lines" 1 0 1 }
|
||||
{ThreadGlow thread_glow "Thread Glow" 1 0 1 }
|
||||
{BreakpointGlow breakpoint_glow "Breakpoint Glow" 1 0 1 }
|
||||
{OpaqueBackgrounds opaque_backgrounds "Opaque Backgrounds" 0 0 1 }
|
||||
{TabWidth tab_width "Tab Width" 4 1 32 }
|
||||
}
|
||||
|
||||
@enum DF_SettingCode:
|
||||
{
|
||||
@expand(DF_SettingTable a) `$(a.name)`,
|
||||
COUNT
|
||||
}
|
||||
|
||||
@data(String8) df_g_setting_code_display_string_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `str8_lit_comp("$(a.display_string)")`
|
||||
}
|
||||
|
||||
@data(String8) df_g_setting_code_lower_string_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `str8_lit_comp("$(a.name_lower)")`
|
||||
}
|
||||
|
||||
@data(DF_SettingVal) df_g_setting_code_default_val_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `{1, $(a.default_s32)}`
|
||||
}
|
||||
|
||||
@data(Rng1S32) df_g_setting_code_s32_range_table:
|
||||
{
|
||||
@expand(DF_SettingTable a) `{$(a.s32_min), $(a.s32_max)}`
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -654,7 +648,7 @@ raddbg_readme:
|
||||
{
|
||||
@p "`--help` Displays a help menu which documents the possible command line options.";
|
||||
@p "`--user:<path>` Specifies a path to the user file which the debugger should use instead of the default. The default user file is stored at `%appdata%/raddbg/default.raddbg_user`. For more information on user files, read the 'User & Profile Files' section.";
|
||||
@p "`--profile:<path>` Specifies a path to the profile file which the debugger should use instead of the default. The default profile file is stored at `%appdata%/raddbg/default.raddbg_profile`. For more information on profile files, read the 'User & Profile Files' section.";
|
||||
@p "`--project:<path>` Specifies a path to the project file which the debugger should use instead of the default. The default project file is stored at `%appdata%/raddbg/default.raddbg_project`. For more information on project files, read the 'User & Project Files' section.";
|
||||
@p "`--auto_run` Specifies that the debugger should immediately run its selected targets upon launching.";
|
||||
@p "`--auto_step` Specifies that the debugger should immediately step into its selected targets upon launching.";
|
||||
//@p "`--ipc` Specifies that the launched debugger instance is for communicating a command to another instance of the debugger. In this mode, any non-argument command line contents will be used to express a command. For more information on commands, read the 'Commands' section. For more information on driving another debugger instance with this argument, read the 'Driving Another Debugger Instance' section."
|
||||
@@ -693,7 +687,7 @@ raddbg_readme:
|
||||
@subtitle "Targets";
|
||||
@p "A *target* is one executable and configuration for launching that executable, including command line arguments and working directory (the directory from which the executable is launched). Each target may also have a custom label (replaces the executable path when visualizing the target), and the name of a custom entry point function (when the default entry points - `main`, `WinMain`, etc. - are not desired when stepping into the program upon launch). The debugger can have several targets at once. Each target can also be enabled or disabled. Some operations work on all enabled targets - for instance, the `Run` or `Kill All` commands (standardly bound as F5 or Shift + F5). Enabling and disabling targets allows one to filter which targets are currently being worked with.";
|
||||
@p "To add a target, you can run the `Add Target` command. A target is also created automatically from command line arguments - the rules for how this happens can be found in the `Command-Line Usage` section.";
|
||||
@p "Targets created through command line usage are temporary, meaning they are not persistently saved across runs of the debugger. To change this, you can right click the command-line-created target in the `Targets` view, and click `Save To Profile`. After doing so, the target will be restored across runs, and will no longer need to be specified on the command-line.";
|
||||
@p "Targets created through command line usage are temporary, meaning they are not persistently saved across runs of the debugger. To change this, you can right click the command-line-created target in the `Targets` view, and click `Save To Project`. After doing so, the target will be restored across runs, and will no longer need to be specified on the command-line.";
|
||||
|
||||
@subtitle "View Rules";
|
||||
@p "*View Rules* are used to transform the way that evaluations in the debugger are visualized. An evaluation is produced by taking an expression string - for instance, the name of a variable - and using debug info and information from an attached process' live runtime (memory, registers, and so on) to interpret it.";
|
||||
@@ -712,11 +706,11 @@ raddbg_readme:
|
||||
@p "Each breakpoint has a hit count. Every time a breakpoint causes execution to stop, this counter is increased.";
|
||||
@p "Processor breakpoints are not currently supported, but planned to be in the future.";
|
||||
|
||||
@subtitle "User & Profile Files";
|
||||
@p "Applicable state controlling the debugger's appearance, behavior, targets, breakpoints, and other configurations is saved and reloaded across runs of the debugger through both *user files* and *profile files*. These files are auto-saved. These files are written in a textual format which can be hand-edited as necessary, but they're also continuously re-read and re-written by the debugger. By default, the debugger uses `%appdata%/raddbg/default.raddbg_user` for its user file path, and `%appdata%/raddbg/default.raddbg_profile` for its profile file path. These paths can be overridden on the command line (see the 'Command-Line Usage' section).";
|
||||
@subtitle "User & Project Files";
|
||||
@p "Applicable state controlling the debugger's appearance, behavior, targets, breakpoints, and other configurations is saved and reloaded across runs of the debugger through both *user files* and *project files*. These files are auto-saved. These files are written in a textual format which can be hand-edited as necessary, but they're also continuously re-read and re-written by the debugger. By default, the debugger uses `%appdata%/raddbg/default.raddbg_user` for its user file path, and `%appdata%/raddbg/default.raddbg_project` for its project file path. These paths can be overridden on the command line (see the 'Command-Line Usage' section).";
|
||||
@p "The *user file* defaultly stores file path maps, windows (including their preferred monitor, placement, and size), each window's panel layout and tabs, keybindings, theme colors, and fonts.";
|
||||
@p "The *profile file* defaultly stores targets, breakpoints, watch pins, and exception code filters.";
|
||||
@p "Because both can be hand-edited, however, if you want to store something normally stored in a user file in a profile file, or vice versa, this can be done by hand transferring the textual data from one file to another. There is no path in the debugger's UI to support this transfer, currently, although this is planned.";
|
||||
@p "The *project file* defaultly stores targets, breakpoints, watch pins, and exception code filters.";
|
||||
@p "Because both can be hand-edited, however, if you want to store something normally stored in a user file in a project file, or vice versa, this can be done by hand transferring the textual data from one file to another. There is no path in the debugger's UI to support this transfer, currently, although this is planned.";
|
||||
|
||||
//@subtitle "Driving Another Debugger Instance";
|
||||
//@p "When the debugger is launched with the `--ipc` command-line argument, it does not launch another instance of the graphical debugger. Instead, it launches, sends a string encoding a command to a running instance of the graphical debugger, and then terminates. The set of commands which can be sent are identical to those which can be run from the debugger's UI itself, but these commands must be encoded textually (through the other command-line arguments). These commands are described in the 'Commands' section.";
|
||||
|
||||
+89
-26
@@ -340,13 +340,13 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
|
||||
text_box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
D_FancyStringList fancy_strings = {0};
|
||||
{
|
||||
D_FancyString open_paren = {ui_top_font(), str8_lit("("), ui_top_text_color(), ui_top_font_size(), 0, 0};
|
||||
D_FancyString comma = {ui_top_font(), str8_lit(", "), ui_top_text_color(), ui_top_font_size(), 0, 0};
|
||||
D_FancyString open_paren = {ui_top_font(), str8_lit("("), ui_top_palette()->text, ui_top_font_size(), 0, 0};
|
||||
D_FancyString comma = {ui_top_font(), str8_lit(", "), ui_top_palette()->text, ui_top_font_size(), 0, 0};
|
||||
D_FancyString r_fstr = {ui_top_font(), push_str8f(scratch.arena, "%.2f", rgba.x), v4f32(1.f, 0.25f, 0.25f, 1.f), ui_top_font_size(), 4.f, 0};
|
||||
D_FancyString g_fstr = {ui_top_font(), push_str8f(scratch.arena, "%.2f", rgba.y), v4f32(0.25f, 1.f, 0.25f, 1.f), ui_top_font_size(), 4.f, 0};
|
||||
D_FancyString b_fstr = {ui_top_font(), push_str8f(scratch.arena, "%.2f", rgba.z), v4f32(0.25f, 0.25f, 1.f, 1.f), ui_top_font_size(), 4.f, 0};
|
||||
D_FancyString a_fstr = {ui_top_font(), push_str8f(scratch.arena, "%.2f", rgba.w), v4f32(1.f, 1.f, 1.f, 1.f), ui_top_font_size(), 4.f, 0};
|
||||
D_FancyString clse_paren = {ui_top_font(), str8_lit(")"), ui_top_text_color(), ui_top_font_size(), 0, 0};
|
||||
D_FancyString clse_paren = {ui_top_font(), str8_lit(")"), ui_top_palette()->text, ui_top_font_size(), 0, 0};
|
||||
d_fancy_string_list_push(scratch.arena, &fancy_strings, &open_paren);
|
||||
d_fancy_string_list_push(scratch.arena, &fancy_strings, &r_fstr);
|
||||
d_fancy_string_list_push(scratch.arena, &fancy_strings, &comma);
|
||||
@@ -367,7 +367,7 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
|
||||
color_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable, "color_box");
|
||||
UI_Parent(color_box) UI_PrefHeight(ui_em(1.875f, 1.f)) UI_Padding(ui_pct(1, 0))
|
||||
{
|
||||
UI_BackgroundColor(rgba) UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
UI_Palette(ui_build_palette(ui_top_palette(), .background = rgba)) UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
ui_build_box_from_key(UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawBorder, ui_key_zero());
|
||||
}
|
||||
}
|
||||
@@ -425,7 +425,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
UI_Signal h_sig = ui_hue_pickerf(&hsva.x, hsva.y, hsva.z, "hue_picker");
|
||||
commit = commit || ui_released(h_sig);
|
||||
}
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Column UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Column UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
{
|
||||
ui_labelf("Hex");
|
||||
ui_labelf("R");
|
||||
@@ -537,9 +537,10 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
String8 data = {0};
|
||||
TXT_TextInfo info = {0};
|
||||
TXT_LineTokensSlice line_tokens_slice = {0};
|
||||
U128 text_key = {0};
|
||||
{
|
||||
U128 text_hash = {0};
|
||||
U128 text_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 1);
|
||||
text_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 1);
|
||||
info = txt_text_info_from_key_lang(txt_scope, text_key, top.lang, &text_hash);
|
||||
data = hs_data_from_hash(hs_scope, text_hash);
|
||||
line_tokens_slice = txt_line_tokens_slice_from_info_data_line_range(scratch.arena, &info, data, r1s64(1, info.lines_count));
|
||||
@@ -558,8 +559,8 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
code_slice_params.line_bps = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_ips = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_pins = push_array(scratch.arena, DF_EntityList, info.lines_count);
|
||||
code_slice_params.line_dasm2src = push_array(scratch.arena, DF_TextLineDasm2SrcInfoList, info.lines_count);
|
||||
code_slice_params.line_src2dasm = push_array(scratch.arena, DF_TextLineSrc2DasmInfoList, info.lines_count);
|
||||
code_slice_params.line_vaddrs = push_array(scratch.arena, U64, info.lines_count);
|
||||
code_slice_params.line_infos = push_array(scratch.arena, DF_LineList, info.lines_count);
|
||||
for(U64 line_idx = 0; line_idx < info.lines_count; line_idx += 1)
|
||||
{
|
||||
code_slice_params.line_text[line_idx] = str8_substr(data, info.lines_ranges[line_idx]);
|
||||
@@ -568,8 +569,10 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.margin_width_px = 0;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
code_slice_params.line_num_width_px = ui_top_font_size()*5.f;
|
||||
code_slice_params.line_text_max_width_px = ui_top_font_size()*2.f*info.lines_max_size;
|
||||
}
|
||||
@@ -695,11 +698,12 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &data_hash);
|
||||
String8 dasm_text_data = {0};
|
||||
TXT_TextInfo dasm_text_info = {0};
|
||||
TXT_LangKind lang_kind = TXT_LangKind_DisasmX64Intel;
|
||||
for(U64 rewind_idx = 0; rewind_idx < 2; rewind_idx += 1)
|
||||
{
|
||||
U128 dasm_text_hash = hs_hash_from_key(dasm_info.text_key, rewind_idx);
|
||||
dasm_text_data = hs_data_from_hash(hs_scope, dasm_text_hash);
|
||||
dasm_text_info = txt_text_info_from_hash_lang(txt_scope, dasm_text_hash, TXT_LangKind_DisasmX64Intel);
|
||||
dasm_text_info = txt_text_info_from_hash_lang(txt_scope, dasm_text_hash, lang_kind);
|
||||
if(dasm_text_info.lines_count != 0)
|
||||
{
|
||||
break;
|
||||
@@ -718,8 +722,8 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
code_slice_params.line_bps = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_ips = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_pins = push_array(scratch.arena, DF_EntityList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_dasm2src = push_array(scratch.arena, DF_TextLineDasm2SrcInfoList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_src2dasm = push_array(scratch.arena, DF_TextLineSrc2DasmInfoList, dasm_text_info.lines_count);
|
||||
code_slice_params.line_vaddrs = push_array(scratch.arena, U64, dasm_text_info.lines_count);
|
||||
code_slice_params.line_infos = push_array(scratch.arena, DF_LineList, dasm_text_info.lines_count);
|
||||
for(U64 line_idx = 0; line_idx < dasm_text_info.lines_count; line_idx += 1)
|
||||
{
|
||||
code_slice_params.line_text[line_idx] = str8_substr(dasm_text_data, dasm_info.insts.v[line_idx].text_range);
|
||||
@@ -728,8 +732,10 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
}
|
||||
code_slice_params.font = df_font_from_slot(DF_FontSlot_Code);
|
||||
code_slice_params.font_size = ui_top_font_size();
|
||||
code_slice_params.tab_size = f_column_size_from_tag_size(code_slice_params.font, code_slice_params.font_size)*df_setting_val_from_code(DF_SettingCode_TabWidth).s32;
|
||||
code_slice_params.line_height_px = ui_top_font_size()*1.5f;
|
||||
code_slice_params.margin_width_px = 0;
|
||||
code_slice_params.priority_margin_width_px = 0;
|
||||
code_slice_params.catchall_margin_width_px = 0;
|
||||
code_slice_params.line_num_width_px = ui_top_font_size()*5.f;
|
||||
code_slice_params.line_text_max_width_px = ui_top_font_size()*2.f*dasm_text_info.lines_max_size;
|
||||
}
|
||||
@@ -868,7 +874,7 @@ df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_
|
||||
internal UI_BOX_CUSTOM_DRAW(df_vr_bitmap_box_draw)
|
||||
{
|
||||
DF_VR_BitmapBoxDrawData *draw_data = (DF_VR_BitmapBoxDrawData *)user_data;
|
||||
Vec4F32 bg_color = box->background_color;
|
||||
Vec4F32 bg_color = box->palette->background;
|
||||
d_img(box->rect, draw_data->src, draw_data->texture, v4f32(1, 1, 1, 1), 0, 0, 0);
|
||||
if(draw_data->loaded_t < 0.98f)
|
||||
{
|
||||
@@ -889,8 +895,7 @@ internal UI_BOX_CUSTOM_DRAW(df_vr_bitmap_box_draw)
|
||||
d_rect(box->rect, v4f32(bg_color.x*bg_color.w, bg_color.y*bg_color.w, bg_color.z*bg_color.w, 1.f-draw_data->loaded_t), 0, 0, 0);
|
||||
if(draw_data->hovered)
|
||||
{
|
||||
Vec4F32 indicator_color = df_rgba_from_theme_color(DF_ThemeColor_PlainBorder);
|
||||
indicator_color.w = 1.f;
|
||||
Vec4F32 indicator_color = v4f32(1, 1, 1, 1);
|
||||
d_rect(pad_2f32(r2f32p(box->rect.x0 + draw_data->mouse_px.x*draw_data->ui_per_bmp_px,
|
||||
box->rect.y0 + draw_data->mouse_px.y*draw_data->ui_per_bmp_px,
|
||||
box->rect.x0 + draw_data->mouse_px.x*draw_data->ui_per_bmp_px + draw_data->ui_per_bmp_px,
|
||||
@@ -917,7 +922,7 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(bitmap)
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
DF_BitmapTopologyInfo topology = df_vr_bitmap_topology_info_from_cfg(scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
U64 expected_size = topology.width*topology.height*r_tex2d_format_bytes_per_pixel_table[topology.fmt];
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_labelf("0x%I64x -> Bitmap (%I64u x %I64u)", base_vaddr, topology.width, topology.height);
|
||||
}
|
||||
|
||||
@@ -953,7 +958,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
//
|
||||
U128 texture_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0);
|
||||
TEX_Topology topology = tex_topology_make(v2s32((S32)topology_info.width, (S32)topology_info.height), topology_info.fmt);
|
||||
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology);
|
||||
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology, 0);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: animate
|
||||
@@ -1043,7 +1048,7 @@ internal UI_BOX_CUSTOM_DRAW(df_bitmap_view_canvas_box_draw)
|
||||
Rng2F32 rect_cvs = df_bitmap_view_state__canvas_from_screen_rect(bvs, rect_scrn, rect_scrn);
|
||||
F32 grid_cell_size_cvs = box->font_size*10.f;
|
||||
F32 grid_line_thickness_px = Max(2.f, box->font_size*0.1f);
|
||||
Vec4F32 grid_line_color = df_rgba_from_theme_color(DF_ThemeColor_WeakText);
|
||||
Vec4F32 grid_line_color = df_rgba_from_theme_color(DF_ThemeColor_TextWeak);
|
||||
for(EachEnumVal(Axis2, axis))
|
||||
{
|
||||
for(F32 v = rect_cvs.p0.v[axis] - mod_f32(rect_cvs.p0.v[axis], grid_cell_size_cvs);
|
||||
@@ -1095,7 +1100,9 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
//
|
||||
U128 texture_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0);
|
||||
TEX_Topology topology = tex_topology_make(v2s32((S32)bvs->top.width, (S32)bvs->top.height), bvs->top.fmt);
|
||||
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology);
|
||||
U128 data_hash = {0};
|
||||
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology, &data_hash);
|
||||
String8 data = hs_data_from_hash(hs_scope, data_hash);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build canvas box
|
||||
@@ -1110,10 +1117,10 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: canvas box interaction
|
||||
//- rjf: canvas dragging
|
||||
//
|
||||
{
|
||||
UI_Signal canvas_sig = ui_signal_from_box(canvas_box);
|
||||
{
|
||||
if(ui_dragging(canvas_sig))
|
||||
{
|
||||
if(ui_pressed(canvas_sig))
|
||||
@@ -1147,13 +1154,70 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: calculate image coordinates
|
||||
//
|
||||
Rng2F32 img_rect_cvs = r2f32p(-topology.dim.x/2, -topology.dim.y/2, +topology.dim.x/2, +topology.dim.y/2);
|
||||
Rng2F32 img_rect_scr = df_bitmap_view_state__screen_from_canvas_rect(bvs, canvas_rect, img_rect_cvs);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: image-region canvas interaction
|
||||
//
|
||||
Vec2S32 mouse_bmp = {-1, -1};
|
||||
if(ui_hovering(canvas_sig) && !ui_dragging(canvas_sig))
|
||||
{
|
||||
Vec2F32 mouse_scr = sub_2f32(ui_mouse(), rect.p0);
|
||||
Vec2F32 mouse_cvs = df_bitmap_view_state__canvas_from_screen_pos(bvs, canvas_rect, mouse_scr);
|
||||
if(contains_2f32(img_rect_cvs, mouse_cvs))
|
||||
{
|
||||
mouse_bmp = v2s32((S32)(mouse_cvs.x-img_rect_cvs.x0), (S32)(mouse_cvs.y-img_rect_cvs.y0));
|
||||
S64 off_px = mouse_bmp.y*topology.dim.x + mouse_bmp.x;
|
||||
S64 off_bytes = off_px*r_tex2d_format_bytes_per_pixel_table[topology.fmt];
|
||||
if(0 <= off_bytes && off_bytes+r_tex2d_format_bytes_per_pixel_table[topology.fmt] <= data.size &&
|
||||
r_tex2d_format_bytes_per_pixel_table[topology.fmt] != 0)
|
||||
{
|
||||
B32 color_is_good = 1;
|
||||
Vec4F32 color = {0};
|
||||
switch(topology.fmt)
|
||||
{
|
||||
default:{color_is_good = 0;}break;
|
||||
case R_Tex2DFormat_R8: {color = v4f32(((U8 *)(data.str+off_bytes))[0]/255.f, 0, 0, 1);}break;
|
||||
case R_Tex2DFormat_RG8: {color = v4f32(((U8 *)(data.str+off_bytes))[0]/255.f, ((U8 *)(data.str+off_bytes))[1]/255.f, 0, 1);}break;
|
||||
case R_Tex2DFormat_RGBA8: {color = v4f32(((U8 *)(data.str+off_bytes))[0]/255.f, ((U8 *)(data.str+off_bytes))[1]/255.f, ((U8 *)(data.str+off_bytes))[2]/255.f, ((U8 *)(data.str+off_bytes))[3]/255.f);}break;
|
||||
case R_Tex2DFormat_BGRA8: {color = v4f32(((U8 *)(data.str+off_bytes))[3]/255.f, ((U8 *)(data.str+off_bytes))[2]/255.f, ((U8 *)(data.str+off_bytes))[1]/255.f, ((U8 *)(data.str+off_bytes))[0]/255.f);}break;
|
||||
case R_Tex2DFormat_R16: {color = v4f32(((U16 *)(data.str+off_bytes))[0]/(F32)max_U16, 0, 0, 1);}break;
|
||||
case R_Tex2DFormat_RGBA16: {color = v4f32(((U16 *)(data.str+off_bytes))[0]/(F32)max_U16, ((U16 *)(data.str+off_bytes))[1]/(F32)max_U16, ((U16 *)(data.str+off_bytes))[2]/(F32)max_U16, ((U16 *)(data.str+off_bytes))[3]/(F32)max_U16);}break;
|
||||
case R_Tex2DFormat_R32: {color = v4f32(((F32 *)(data.str+off_bytes))[0], 0, 0, 1);}break;
|
||||
case R_Tex2DFormat_RG32: {color = v4f32(((F32 *)(data.str+off_bytes))[0], ((F32 *)(data.str+off_bytes))[1], 0, 1);}break;
|
||||
case R_Tex2DFormat_RGBA32: {color = v4f32(((F32 *)(data.str+off_bytes))[0], ((F32 *)(data.str+off_bytes))[1], ((F32 *)(data.str+off_bytes))[2], ((F32 *)(data.str+off_bytes))[3]);}break;
|
||||
}
|
||||
if(color_is_good)
|
||||
{
|
||||
Vec4F32 hsva = hsva_from_rgba(color);
|
||||
ui_do_color_tooltip_hsva(hsva);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: build image
|
||||
//
|
||||
UI_Parent(canvas_box)
|
||||
{
|
||||
Rng2F32 img_rect_cvs = r2f32p(-topology.dim.x/2, -topology.dim.y/2, +topology.dim.x/2, +topology.dim.y/2);
|
||||
Rng2F32 img_rect_scr = df_bitmap_view_state__screen_from_canvas_rect(bvs, canvas_rect, img_rect_cvs);
|
||||
if(0 <= mouse_bmp.x && mouse_bmp.x < bvs->top.width &&
|
||||
0 <= mouse_bmp.x && mouse_bmp.x < bvs->top.height)
|
||||
{
|
||||
F32 pixel_size_scr = 1.f*bvs->zoom;
|
||||
Rng2F32 indicator_rect_scr = r2f32p(img_rect_scr.x0 + mouse_bmp.x*pixel_size_scr,
|
||||
img_rect_scr.y0 + mouse_bmp.y*pixel_size_scr,
|
||||
img_rect_scr.x0 + (mouse_bmp.x+1)*pixel_size_scr,
|
||||
img_rect_scr.y0 + (mouse_bmp.y+1)*pixel_size_scr);
|
||||
UI_Rect(indicator_rect_scr)
|
||||
{
|
||||
ui_build_box_from_key(UI_BoxFlag_DrawBorder|UI_BoxFlag_Floating, ui_key_zero());
|
||||
}
|
||||
}
|
||||
UI_Rect(img_rect_scr) UI_Flags(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawDropShadow|UI_BoxFlag_Floating)
|
||||
{
|
||||
ui_image(texture, R_Tex2DSampleKind_Nearest, r2f32p(0, 0, (F32)bvs->top.width, (F32)bvs->top.height), v4f32(1, 1, 1, 1), 0, str8_lit("bmp_image"));
|
||||
@@ -1216,7 +1280,6 @@ internal UI_BOX_CUSTOM_DRAW(df_vr_geo_box_draw)
|
||||
{
|
||||
DF_VR_GeoBoxDrawData *draw_data = (DF_VR_GeoBoxDrawData *)user_data;
|
||||
DF_VR_GeoState *state = df_view_rule_block_user_state(draw_data->key, DF_VR_GeoState);
|
||||
Vec4F32 bg_color = box->background_color;
|
||||
|
||||
// rjf: get clip
|
||||
Rng2F32 clip = box->rect;
|
||||
@@ -1264,7 +1327,7 @@ DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(geo)
|
||||
{
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText))
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
ui_labelf("0x%I64x -> Geometry", base_vaddr);
|
||||
}
|
||||
|
||||
|
||||
+1957
-2498
File diff suppressed because it is too large
Load Diff
+74
-16
@@ -359,18 +359,30 @@ struct DF_WatchViewState
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Code @view_types
|
||||
//~ rjf: Code, Output @view_types
|
||||
|
||||
typedef U32 DF_CodeViewFlags;
|
||||
enum
|
||||
{
|
||||
DF_CodeViewFlag_StickToBottom = (1<<0),
|
||||
};
|
||||
|
||||
typedef U32 DF_CodeViewBuildFlags;
|
||||
enum
|
||||
{
|
||||
DF_CodeViewBuildFlag_Margins = (1<<0),
|
||||
DF_CodeViewBuildFlag_All = 0xffffffff,
|
||||
};
|
||||
|
||||
typedef struct DF_CodeViewState DF_CodeViewState;
|
||||
struct DF_CodeViewState
|
||||
{
|
||||
// rjf: stable state
|
||||
B32 initialized;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
S64 preferred_column;
|
||||
B32 drifted_for_search;
|
||||
DF_Handle pick_file_override_target;
|
||||
DF_CodeViewFlags flags;
|
||||
|
||||
// rjf: per-frame command info
|
||||
S64 goto_line_num;
|
||||
@@ -387,24 +399,12 @@ struct DF_CodeViewState
|
||||
typedef struct DF_DisasmViewState DF_DisasmViewState;
|
||||
struct DF_DisasmViewState
|
||||
{
|
||||
// rjf: stable state
|
||||
B32 initialized;
|
||||
DF_Handle process;
|
||||
U64 base_vaddr;
|
||||
TxtPt cursor;
|
||||
TxtPt mark;
|
||||
S64 preferred_column;
|
||||
B32 drifted_for_search;
|
||||
DASM_StyleFlags style_flags;
|
||||
|
||||
// rjf: per-frame command info
|
||||
S64 goto_line_num;
|
||||
U64 goto_vaddr;
|
||||
B32 center_cursor;
|
||||
B32 contain_cursor;
|
||||
Arena *find_text_arena;
|
||||
String8 find_text_fwd;
|
||||
String8 find_text_bwd;
|
||||
DF_CodeViewState cv;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -434,6 +434,56 @@ struct DF_MemoryViewState
|
||||
B32 contain_cursor;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Settings @view_types
|
||||
|
||||
typedef enum DF_SettingsItemKind
|
||||
{
|
||||
DF_SettingsItemKind_CategoryHeader,
|
||||
DF_SettingsItemKind_Setting,
|
||||
DF_SettingsItemKind_ThemeColor,
|
||||
DF_SettingsItemKind_ThemePreset,
|
||||
DF_SettingsItemKind_COUNT
|
||||
}
|
||||
DF_SettingsItemKind;
|
||||
|
||||
typedef struct DF_SettingsItem DF_SettingsItem;
|
||||
struct DF_SettingsItem
|
||||
{
|
||||
DF_SettingsItemKind kind;
|
||||
String8 kind_string;
|
||||
String8 string;
|
||||
FuzzyMatchRangeList kind_string_matches;
|
||||
FuzzyMatchRangeList string_matches;
|
||||
DF_IconKind icon_kind;
|
||||
DF_SettingCode code;
|
||||
DF_ThemeColor color;
|
||||
DF_ThemePreset preset;
|
||||
DF_SettingsItemKind category;
|
||||
};
|
||||
|
||||
typedef struct DF_SettingsItemNode DF_SettingsItemNode;
|
||||
struct DF_SettingsItemNode
|
||||
{
|
||||
DF_SettingsItemNode *next;
|
||||
DF_SettingsItem v;
|
||||
};
|
||||
|
||||
typedef struct DF_SettingsItemList DF_SettingsItemList;
|
||||
struct DF_SettingsItemList
|
||||
{
|
||||
DF_SettingsItemNode *first;
|
||||
DF_SettingsItemNode *last;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct DF_SettingsItemArray DF_SettingsItemArray;
|
||||
struct DF_SettingsItemArray
|
||||
{
|
||||
DF_SettingsItem *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Quick Sort Comparisons
|
||||
|
||||
@@ -445,6 +495,7 @@ internal int df_qsort_compare_file_info__size(DF_FileInfo *a, DF_FileInfo *b);
|
||||
internal int df_qsort_compare_process_info(DF_ProcessInfo *a, DF_ProcessInfo *b);
|
||||
internal int df_qsort_compare_cmd_lister__strength(DF_CmdListerItem *a, DF_CmdListerItem *b);
|
||||
internal int df_qsort_compare_entity_lister__strength(DF_EntityListerItem *a, DF_EntityListerItem *b);
|
||||
internal int df_qsort_compare_settings_item(DF_SettingsItem *a, DF_SettingsItem *b);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Command Lister
|
||||
@@ -467,6 +518,13 @@ internal DF_EntityListerItemList df_entity_lister_item_list_from_needle(Arena *a
|
||||
internal DF_EntityListerItemArray df_entity_lister_item_array_from_list(Arena *arena, DF_EntityListerItemList list);
|
||||
internal void df_entity_lister_item_array_sort_by_strength__in_place(DF_EntityListerItemArray array);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Code Views
|
||||
|
||||
internal void df_code_view_init(DF_CodeViewState *cv, DF_View *view);
|
||||
internal void df_code_view_cmds(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_CodeViewState *cv, DF_CmdList *cmds, String8 text_data, TXT_TextInfo *text_info, DASM_InstArray *dasm_insts, Rng1U64 dasm_vaddr_range, DI_Key dasm_dbgi_key);
|
||||
internal void df_code_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_CodeViewState *cv, DF_CodeViewBuildFlags flags, Rng2F32 rect, String8 text_data, TXT_TextInfo *text_info, DASM_InstArray *dasm_insts, Rng1U64 dasm_vaddr_range, DI_Key dasm_dbgi_key);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Watch Views
|
||||
|
||||
|
||||
+1073
-717
File diff suppressed because it is too large
Load Diff
@@ -38,55 +38,76 @@ DF_GfxViewKind_Memory,
|
||||
DF_GfxViewKind_Breakpoints,
|
||||
DF_GfxViewKind_WatchPins,
|
||||
DF_GfxViewKind_ExceptionFilters,
|
||||
DF_GfxViewKind_Theme,
|
||||
DF_GfxViewKind_Settings,
|
||||
DF_GfxViewKind_COUNT,
|
||||
} DF_GfxViewKind;
|
||||
|
||||
typedef enum DF_ThemeColor
|
||||
{
|
||||
DF_ThemeColor_Null,
|
||||
DF_ThemeColor_PlainText,
|
||||
DF_ThemeColor_PlainBackground,
|
||||
DF_ThemeColor_PlainBorder,
|
||||
DF_ThemeColor_PlainOverlay,
|
||||
DF_ThemeColor_Text,
|
||||
DF_ThemeColor_TextPositive,
|
||||
DF_ThemeColor_TextNegative,
|
||||
DF_ThemeColor_TextNeutral,
|
||||
DF_ThemeColor_TextWeak,
|
||||
DF_ThemeColor_Cursor,
|
||||
DF_ThemeColor_CursorInactive,
|
||||
DF_ThemeColor_Focus,
|
||||
DF_ThemeColor_Hover,
|
||||
DF_ThemeColor_DropShadow,
|
||||
DF_ThemeColor_DisabledOverlay,
|
||||
DF_ThemeColor_DropSiteOverlay,
|
||||
DF_ThemeColor_InactivePanelOverlay,
|
||||
DF_ThemeColor_SelectionOverlay,
|
||||
DF_ThemeColor_HighlightOverlay,
|
||||
DF_ThemeColor_HighlightOverlayError,
|
||||
DF_ThemeColor_BaseBackground,
|
||||
DF_ThemeColor_BaseBackgroundAlt,
|
||||
DF_ThemeColor_BaseBorder,
|
||||
DF_ThemeColor_MenuBarBackground,
|
||||
DF_ThemeColor_MenuBarBackgroundAlt,
|
||||
DF_ThemeColor_MenuBarBorder,
|
||||
DF_ThemeColor_FloatingBackground,
|
||||
DF_ThemeColor_FloatingBackgroundAlt,
|
||||
DF_ThemeColor_FloatingBorder,
|
||||
DF_ThemeColor_ImplicitButtonBackground,
|
||||
DF_ThemeColor_ImplicitButtonBorder,
|
||||
DF_ThemeColor_PlainButtonBackground,
|
||||
DF_ThemeColor_PlainButtonBorder,
|
||||
DF_ThemeColor_PositivePopButtonBackground,
|
||||
DF_ThemeColor_PositivePopButtonBorder,
|
||||
DF_ThemeColor_NegativePopButtonBackground,
|
||||
DF_ThemeColor_NegativePopButtonBorder,
|
||||
DF_ThemeColor_NeutralPopButtonBackground,
|
||||
DF_ThemeColor_NeutralPopButtonBorder,
|
||||
DF_ThemeColor_ScrollBarButtonBackground,
|
||||
DF_ThemeColor_ScrollBarButtonBorder,
|
||||
DF_ThemeColor_TabBackground,
|
||||
DF_ThemeColor_TabBorder,
|
||||
DF_ThemeColor_TabBackgroundInactive,
|
||||
DF_ThemeColor_TabBorderInactive,
|
||||
DF_ThemeColor_CodeDefault,
|
||||
DF_ThemeColor_CodeFunction,
|
||||
DF_ThemeColor_CodeSymbol,
|
||||
DF_ThemeColor_CodeType,
|
||||
DF_ThemeColor_CodeLocal,
|
||||
DF_ThemeColor_CodeRegister,
|
||||
DF_ThemeColor_CodeKeyword,
|
||||
DF_ThemeColor_CodeSymbol,
|
||||
DF_ThemeColor_CodeDelimiterOperator,
|
||||
DF_ThemeColor_CodeNumeric,
|
||||
DF_ThemeColor_CodeNumericAltDigitGroup,
|
||||
DF_ThemeColor_CodeString,
|
||||
DF_ThemeColor_CodeMeta,
|
||||
DF_ThemeColor_CodeComment,
|
||||
DF_ThemeColor_LineInfo0,
|
||||
DF_ThemeColor_LineInfo1,
|
||||
DF_ThemeColor_LineInfo2,
|
||||
DF_ThemeColor_LineInfo3,
|
||||
DF_ThemeColor_AltText,
|
||||
DF_ThemeColor_AltBackground,
|
||||
DF_ThemeColor_AltBorder,
|
||||
DF_ThemeColor_AltOverlay,
|
||||
DF_ThemeColor_TabInactive,
|
||||
DF_ThemeColor_TabActive,
|
||||
DF_ThemeColor_EntityBackground,
|
||||
DF_ThemeColor_QueryBar,
|
||||
DF_ThemeColor_WeakText,
|
||||
DF_ThemeColor_TextSelection,
|
||||
DF_ThemeColor_Cursor,
|
||||
DF_ThemeColor_Highlight0,
|
||||
DF_ThemeColor_Highlight1,
|
||||
DF_ThemeColor_SuccessText,
|
||||
DF_ThemeColor_SuccessBackground,
|
||||
DF_ThemeColor_SuccessBorder,
|
||||
DF_ThemeColor_FailureText,
|
||||
DF_ThemeColor_FailureBackground,
|
||||
DF_ThemeColor_FailureBorder,
|
||||
DF_ThemeColor_ActionText,
|
||||
DF_ThemeColor_ActionBackground,
|
||||
DF_ThemeColor_ActionBorder,
|
||||
DF_ThemeColor_DropSiteOverlay,
|
||||
DF_ThemeColor_CodeLineNumbers,
|
||||
DF_ThemeColor_CodeLineNumbersSelected,
|
||||
DF_ThemeColor_LineInfoBackground0,
|
||||
DF_ThemeColor_LineInfoBackground1,
|
||||
DF_ThemeColor_LineInfoBackground2,
|
||||
DF_ThemeColor_LineInfoBackground3,
|
||||
DF_ThemeColor_LineInfoBackground4,
|
||||
DF_ThemeColor_LineInfoBackground5,
|
||||
DF_ThemeColor_LineInfoBackground6,
|
||||
DF_ThemeColor_LineInfoBackground7,
|
||||
DF_ThemeColor_Thread0,
|
||||
DF_ThemeColor_Thread1,
|
||||
DF_ThemeColor_Thread2,
|
||||
@@ -96,8 +117,8 @@ DF_ThemeColor_Thread5,
|
||||
DF_ThemeColor_Thread6,
|
||||
DF_ThemeColor_Thread7,
|
||||
DF_ThemeColor_ThreadUnwound,
|
||||
DF_ThemeColor_InactivePanelOverlay,
|
||||
DF_ThemeColor_DropShadow,
|
||||
DF_ThemeColor_ThreadError,
|
||||
DF_ThemeColor_Breakpoint,
|
||||
DF_ThemeColor_COUNT,
|
||||
} DF_ThemeColor;
|
||||
|
||||
@@ -115,6 +136,24 @@ DF_ThemePreset_FarManager,
|
||||
DF_ThemePreset_COUNT,
|
||||
} DF_ThemePreset;
|
||||
|
||||
typedef enum DF_SettingCode
|
||||
{
|
||||
DF_SettingCode_HoverAnimations,
|
||||
DF_SettingCode_PressAnimations,
|
||||
DF_SettingCode_FocusAnimations,
|
||||
DF_SettingCode_TooltipAnimations,
|
||||
DF_SettingCode_MenuAnimations,
|
||||
DF_SettingCode_ScrollingAnimations,
|
||||
DF_SettingCode_BackgroundBlur,
|
||||
DF_SettingCode_ThreadLines,
|
||||
DF_SettingCode_BreakpointLines,
|
||||
DF_SettingCode_ThreadGlow,
|
||||
DF_SettingCode_BreakpointGlow,
|
||||
DF_SettingCode_OpaqueBackgrounds,
|
||||
DF_SettingCode_TabWidth,
|
||||
DF_SettingCode_COUNT,
|
||||
} DF_SettingCode;
|
||||
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Null);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Empty);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(GettingStarted);
|
||||
@@ -145,7 +184,7 @@ DF_VIEW_SETUP_FUNCTION_DEF(Memory);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Breakpoints);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(WatchPins);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(ExceptionFilters);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Theme);
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(Settings);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Null);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Empty);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(GettingStarted);
|
||||
@@ -176,7 +215,7 @@ DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Memory);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Breakpoints);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(WatchPins);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(ExceptionFilters);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Theme);
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(Settings);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Null);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Empty);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(GettingStarted);
|
||||
@@ -207,7 +246,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Memory);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Breakpoints);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(WatchPins);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(ExceptionFilters);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Theme);
|
||||
DF_VIEW_CMD_FUNCTION_DEF(Settings);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Null);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Empty);
|
||||
DF_VIEW_UI_FUNCTION_DEF(GettingStarted);
|
||||
@@ -238,7 +277,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Breakpoints);
|
||||
DF_VIEW_UI_FUNCTION_DEF(WatchPins);
|
||||
DF_VIEW_UI_FUNCTION_DEF(ExceptionFilters);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Theme);
|
||||
DF_VIEW_UI_FUNCTION_DEF(Settings);
|
||||
|
||||
DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(list);
|
||||
DF_GFX_VIEW_RULE_VIZ_ROW_PROD_FUNCTION_DEF(only);
|
||||
@@ -275,27 +314,33 @@ DF_VIEW_UI_FUNCTION_DEF(disasm);
|
||||
DF_VIEW_UI_FUNCTION_DEF(bitmap);
|
||||
DF_VIEW_UI_FUNCTION_DEF(geo);
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 df_g_theme_preset_display_string_table[9];
|
||||
extern String8 df_g_theme_preset_code_string_table[9];
|
||||
extern Vec4F32 df_g_theme_preset_colors__default_dark[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__default_light[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__vs_dark[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__vs_light[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__solarized_dark[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__solarized_light[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__handmade_hero[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__four_coder[54];
|
||||
extern Vec4F32 df_g_theme_preset_colors__far_manager[54];
|
||||
extern Vec4F32* df_g_theme_preset_colors_table[9];
|
||||
extern DF_StringBindingPair df_g_default_binding_table[105];
|
||||
extern String8 df_g_binding_version_remap_old_name_table[5];
|
||||
extern String8 df_g_binding_version_remap_new_name_table[5];
|
||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
||||
extern DF_CmdParamSlot df_g_cmd_param_slot_2_view_spec_src_map[7];
|
||||
extern String8 df_g_cmd_param_slot_2_view_spec_dst_map[7];
|
||||
extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
|
||||
extern DF_StringBindingPair df_g_default_binding_table[104];
|
||||
extern String8 df_g_binding_version_remap_old_name_table[3];
|
||||
extern String8 df_g_binding_version_remap_new_name_table[3];
|
||||
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[31];
|
||||
extern String8 df_g_theme_color_display_string_table[54];
|
||||
extern String8 df_g_theme_color_cfg_string_table[54];
|
||||
extern String8 df_g_theme_preset_display_string_table[9];
|
||||
extern String8 df_g_theme_preset_code_string_table[9];
|
||||
extern String8 df_g_theme_color_version_remap_old_name_table[22];
|
||||
extern String8 df_g_theme_color_version_remap_new_name_table[22];
|
||||
extern Vec4F32 df_g_theme_preset_colors__default_dark[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__default_light[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__vs_dark[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__vs_light[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__solarized_dark[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__solarized_light[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__handmade_hero[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__four_coder[75];
|
||||
extern Vec4F32 df_g_theme_preset_colors__far_manager[75];
|
||||
extern Vec4F32* df_g_theme_preset_colors_table[9];
|
||||
extern String8 df_g_theme_color_display_string_table[75];
|
||||
extern String8 df_g_theme_color_cfg_string_table[75];
|
||||
extern String8 df_g_setting_code_display_string_table[13];
|
||||
extern String8 df_g_setting_code_lower_string_table[13];
|
||||
extern DF_SettingVal df_g_setting_code_default_val_table[13];
|
||||
extern Rng1S32 df_g_setting_code_s32_range_table[13];
|
||||
read_only global U8 df_g_icon_font_bytes__data[] =
|
||||
{
|
||||
0x00,0x01,0x00,0x00,0x00,0x0f,0x00,0x80,0x00,0x03,0x00,0x70,0x47,0x53,0x55,0x42,0x20,0x8b,0x25,0x7a,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x54,0x4f,0x53,0x2f,0x32,0x56,0x44,0x49,0xa0,0x00,0x00,0x01,0x50,0x00,0x00,0x00,0x60,0x63,0x6d,0x61,0x70,0x2a,0x09,0xe2,0xc2,0x00,0x00,0x01,0xb0,0x00,0x00,0x05,0xec,0x63,0x76,0x74,0x20,
|
||||
@@ -5002,6 +5047,7 @@ read_only global U8 df_g_icon_file_bytes__data[] =
|
||||
};
|
||||
|
||||
read_only global String8 df_g_icon_file_bytes = {df_g_icon_file_bytes__data, sizeof(df_g_icon_file_bytes__data)};
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // DF_GFX_META_H
|
||||
|
||||
+48
-14
@@ -54,6 +54,23 @@ d_fancy_string_list_push(Arena *arena, D_FancyStringList *list, D_FancyString *s
|
||||
list->total_size += str->string.size;
|
||||
}
|
||||
|
||||
internal void
|
||||
d_fancy_string_list_concat_in_place(D_FancyStringList *dst, D_FancyStringList *to_push)
|
||||
{
|
||||
if(dst->last != 0 && to_push->first != 0)
|
||||
{
|
||||
dst->last->next = to_push->first;
|
||||
dst->last = to_push->last;
|
||||
dst->node_count += to_push->node_count;
|
||||
dst->total_size += to_push->total_size;
|
||||
}
|
||||
else if(to_push->first != 0)
|
||||
{
|
||||
MemoryCopyStruct(dst, to_push);
|
||||
}
|
||||
MemoryZeroStruct(to_push);
|
||||
}
|
||||
|
||||
internal String8
|
||||
d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list)
|
||||
{
|
||||
@@ -70,14 +87,15 @@ d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list)
|
||||
}
|
||||
|
||||
internal D_FancyRunList
|
||||
d_fancy_run_list_from_fancy_string_list(Arena *arena, D_FancyStringList *strs)
|
||||
d_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, F_RunFlags flags, D_FancyStringList *strs)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
D_FancyRunList run_list = {0};
|
||||
F32 base_align_px = 0;
|
||||
for(D_FancyStringNode *n = strs->first; n != 0; n = n->next)
|
||||
{
|
||||
D_FancyRunNode *dst_n = push_array(arena, D_FancyRunNode, 1);
|
||||
dst_n->v.run = f_push_run_from_string(arena, n->v.font, n->v.size, 0, n->v.string);
|
||||
dst_n->v.run = f_push_run_from_string(arena, n->v.font, n->v.size, base_align_px, tab_size_px, flags, n->v.string);
|
||||
dst_n->v.color = n->v.color;
|
||||
dst_n->v.underline_thickness = n->v.underline_thickness;
|
||||
dst_n->v.strikethrough_thickness = n->v.strikethrough_thickness;
|
||||
@@ -85,6 +103,12 @@ d_fancy_run_list_from_fancy_string_list(Arena *arena, D_FancyStringList *strs)
|
||||
run_list.node_count += 1;
|
||||
run_list.dim.x += dst_n->v.run.dim.x;
|
||||
run_list.dim.y = Max(run_list.dim.y, dst_n->v.run.dim.y);
|
||||
base_align_px += dst_n->v.run.dim.x;
|
||||
if(n->next != 0)
|
||||
{
|
||||
run_list.dim.x -= dst_n->v.run.end_pad;
|
||||
base_align_px -= dst_n->v.run.end_pad;
|
||||
}
|
||||
}
|
||||
ProfEnd();
|
||||
return run_list;
|
||||
@@ -288,6 +312,7 @@ d_blur(Rng2F32 rect, F32 blur_size, F32 corner_radius)
|
||||
R_Pass *pass = r_pass_from_kind(arena, &bucket->passes, R_PassKind_Blur);
|
||||
R_PassParams_Blur *params = pass->params_blur;
|
||||
params->rect = rect;
|
||||
params->clip = d_top_clip();
|
||||
params->blur_size = blur_size;
|
||||
params->corner_radii[Corner_00] = corner_radius;
|
||||
params->corner_radii[Corner_01] = corner_radius;
|
||||
@@ -450,9 +475,15 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, F_Run tra
|
||||
for(D_FancyRunNode *n = list->first; n != 0; n = n->next)
|
||||
{
|
||||
D_FancyRun *fr = &n->v;
|
||||
Rng1F32 pixel_range = {0};
|
||||
{
|
||||
pixel_range.min = 100000;
|
||||
pixel_range.max = 0;
|
||||
}
|
||||
F_Piece *piece_first = fr->run.pieces.v;
|
||||
F_Piece *piece_opl = piece_first + fr->run.pieces.count;
|
||||
F32 pre_advance = advance;
|
||||
F32 last_piece_end_pad = 0;
|
||||
last_color = fr->color;
|
||||
for(F_Piece *piece = piece_first;
|
||||
piece < piece_opl;
|
||||
@@ -480,14 +511,17 @@ d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 max_x, F_Run tra
|
||||
//d_rect(dst, v4f32(1, 0, 0, 1), 0, 1.f, 0.f);
|
||||
}
|
||||
advance += piece->advance;
|
||||
last_piece_end_pad = ((F32)piece->offset.x+(F32)dim_2s16(piece->subrect).x) - piece->advance;
|
||||
pixel_range.min = Min(pre_advance, pixel_range.min);
|
||||
pixel_range.max = Max(advance, pixel_range.max);
|
||||
}
|
||||
if(fr->underline_thickness > 0)
|
||||
{
|
||||
d_rect(r2f32p(p.x+pre_advance,
|
||||
d_rect(r2f32p(p.x + pixel_range.min + 1.f,
|
||||
p.y+fr->run.descent+fr->run.descent/8,
|
||||
p.x+advance + (advance-pre_advance)/8,
|
||||
p.x + pixel_range.max + last_piece_end_pad/2,
|
||||
p.y+fr->run.descent+fr->run.descent/8+fr->underline_thickness),
|
||||
fr->color, 0, 0, 1.f);
|
||||
fr->color, 0, 0, 0.8f);
|
||||
}
|
||||
if(fr->strikethrough_thickness > 0)
|
||||
{
|
||||
@@ -703,44 +737,44 @@ d_truncated_text_run(Vec2F32 p, Vec4F32 color, F32 max_x, F_Run text_run, F_Run
|
||||
}
|
||||
|
||||
internal void
|
||||
d_text(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, String8 string)
|
||||
d_text(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, 0, string);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, base_align_px, tab_size_px, flags, string);
|
||||
d_text_run(p, color, run);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
d_textf(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, char *fmt, ...)
|
||||
d_textf(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 string = push_str8fv(scratch.arena, fmt, args);
|
||||
va_end(args);
|
||||
d_text(font, size, p, color, string);
|
||||
d_text(font, size, base_align_px, tab_size_px, flags, p, color, string);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
d_truncated_text(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, F32 max_x, String8 string)
|
||||
d_truncated_text(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, F32 max_x, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, 0, string);
|
||||
F_Run ellipses_run = f_push_run_from_string(scratch.arena, font, size, 0, str8_lit("..."));
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, base_align_px, tab_size_px, flags, string);
|
||||
F_Run ellipses_run = f_push_run_from_string(scratch.arena, font, size, base_align_px, tab_size_px, 0, str8_lit("..."));
|
||||
d_truncated_text_run(p, color, max_x, run, ellipses_run);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
internal void
|
||||
d_truncated_textf(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, F32 max_x, char *fmt, ...)
|
||||
d_truncated_textf(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, F32 max_x, char *fmt, ...)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
String8 string = push_str8f(scratch.arena, fmt, args);
|
||||
d_truncated_text(font, size, p, color, max_x, string);
|
||||
d_truncated_text(font, size, base_align_px, tab_size_px, flags, p, color, max_x, string);
|
||||
va_end(args);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
+6
-5
@@ -109,8 +109,9 @@ internal U64 d_hash_from_string(String8 string);
|
||||
//~ rjf: Fancy String Type Functions
|
||||
|
||||
internal void d_fancy_string_list_push(Arena *arena, D_FancyStringList *list, D_FancyString *str);
|
||||
internal void d_fancy_string_list_concat_in_place(D_FancyStringList *dst, D_FancyStringList *to_push);
|
||||
internal String8 d_string_from_fancy_string_list(Arena *arena, D_FancyStringList *list);
|
||||
internal D_FancyRunList d_fancy_run_list_from_fancy_string_list(Arena *arena, D_FancyStringList *strs);
|
||||
internal D_FancyRunList d_fancy_run_list_from_fancy_string_list(Arena *arena, F32 tab_size_px, F_RunFlags flags, D_FancyStringList *strs);
|
||||
internal D_FancyRunList d_fancy_run_list_copy(Arena *arena, D_FancyRunList *src);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -186,9 +187,9 @@ internal void d_truncated_fancy_run_list(Vec2F32 p, D_FancyRunList *list, F32 ma
|
||||
internal void d_truncated_fancy_run_fuzzy_matches(Vec2F32 p, D_FancyRunList *list, F32 max_x, FuzzyMatchRangeList *ranges, Vec4F32 color);
|
||||
internal void d_text_run(Vec2F32 p, Vec4F32 color, F_Run run);
|
||||
internal void d_truncated_text_run(Vec2F32 p, Vec4F32 color, F32 max_x, F_Run text_run, F_Run trailer_run);
|
||||
internal void d_text(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, String8 string);
|
||||
internal void d_textf(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, char *fmt, ...);
|
||||
internal void d_truncated_text(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, F32 max_x, String8 string);
|
||||
internal void d_truncated_textf(F_Tag font, F32 size, Vec2F32 p, Vec4F32 color, F32 max_x, char *fmt, ...);
|
||||
internal void d_text(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, String8 string);
|
||||
internal void d_textf(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, char *fmt, ...);
|
||||
internal void d_truncated_text(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, F32 max_x, String8 string);
|
||||
internal void d_truncated_textf(F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, Vec2F32 p, Vec4F32 color, F32 max_x, char *fmt, ...);
|
||||
|
||||
#endif // DRAW_H
|
||||
|
||||
@@ -15,6 +15,3 @@ internal R_Tex2DSampleKind d_top_tex2d_sample_kind(void) {D_StackTopImp
|
||||
internal Mat3x3F32 d_top_xform2d(void) {D_StackTopImpl(XForm2D, xform2d, Mat3x3F32);}
|
||||
internal Rng2F32 d_top_clip(void) {D_StackTopImpl(Clip, clip, Rng2F32);}
|
||||
internal F32 d_top_transparency(void) {D_StackTopImpl(Transparency, transparency, F32);}
|
||||
C_LINKAGE_BEGIN
|
||||
C_LINKAGE_END
|
||||
|
||||
|
||||
@@ -46,7 +46,4 @@ internal F32 d_top_transparency(void);
|
||||
#define D_ClipScope(v) DeferLoop(d_push_clip(v), d_pop_clip())
|
||||
#define D_TransparencyScope(v) DeferLoop(d_push_transparency(v), d_pop_transparency())
|
||||
#endif
|
||||
C_LINKAGE_BEGIN
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // DRAW_META_H
|
||||
|
||||
@@ -23,7 +23,7 @@ eval_bytecode_from_oplist(Arena *arena, EVAL_OpList *list){
|
||||
default:
|
||||
{
|
||||
// compute bytecode advance
|
||||
U8 ctrlbits = rdi_eval_opcode_ctrlbits[opcode];
|
||||
U8 ctrlbits = rdi_eval_op_ctrlbits_table[opcode];
|
||||
U64 extra_byte_count = RDI_DECODEN_FROM_CTRLBITS(ctrlbits);
|
||||
|
||||
U8 *next_ptr = ptr + 1 + extra_byte_count;
|
||||
@@ -63,7 +63,7 @@ eval_bytecode_from_oplist(Arena *arena, EVAL_OpList *list){
|
||||
|
||||
internal void
|
||||
eval_oplist_push_op(Arena *arena, EVAL_OpList *list, RDI_EvalOp opcode, U64 p){
|
||||
U8 ctrlbits = rdi_eval_opcode_ctrlbits[opcode];
|
||||
U8 ctrlbits = rdi_eval_op_ctrlbits_table[opcode];
|
||||
U32 p_size = RDI_DECODEN_FROM_CTRLBITS(ctrlbits);
|
||||
|
||||
EVAL_Op *node = push_array_no_zero(arena, EVAL_Op, 1);
|
||||
@@ -336,7 +336,7 @@ eval_type_unwrap_enum(TG_Graph *graph, RDI_Parsed *rdi, TG_Key key)
|
||||
TG_Key result = key;
|
||||
for(B32 good = 1; good;)
|
||||
{
|
||||
TG_Kind kind = tg_kind_from_key(key);
|
||||
TG_Kind kind = tg_kind_from_key(result);
|
||||
if(kind == TG_Kind_Enum)
|
||||
{
|
||||
result = tg_direct_from_graph_rdi_key(graph, rdi, result);
|
||||
@@ -654,7 +654,7 @@ eval_irtree_convert_hi(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, EVAL_IRTr
|
||||
TG_Kind out_kind = tg_kind_from_key(out);
|
||||
U8 in_group = eval_type_group_from_kind(in_kind);
|
||||
U8 out_group = eval_type_group_from_kind(out_kind);
|
||||
U32 conversion_rule = rdi_eval_conversion_rule(in_group, out_group);
|
||||
U32 conversion_rule = rdi_eval_conversion_kind_from_typegroups(in_group, out_group);
|
||||
if(conversion_rule == RDI_EvalConversionKind_Legal)
|
||||
{
|
||||
result = eval_irtree_convert_lo(arena, result, out_group, in_group);
|
||||
@@ -785,6 +785,11 @@ eval_irtree_and_type_from_expr(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, E
|
||||
TG_Key r_restype = tg_unwrapped_from_graph_rdi_key(graph, rdi, r.type_key);
|
||||
TG_Kind l_restype_kind = tg_kind_from_key(l_restype);
|
||||
TG_Kind r_restype_kind = tg_kind_from_key(r_restype);
|
||||
if(eval_kind_is_basic_or_enum(r_restype_kind))
|
||||
{
|
||||
r_restype = eval_type_unwrap_enum(graph, rdi, r_restype);
|
||||
r_restype_kind = tg_kind_from_key(r_restype);
|
||||
}
|
||||
|
||||
// analyze situation
|
||||
B32 can_generate = 0;
|
||||
@@ -1080,7 +1085,7 @@ eval_irtree_and_type_from_expr(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, E
|
||||
// analyze situation
|
||||
U8 in_group = eval_type_group_from_kind(c_restype_kind);
|
||||
U8 out_group = eval_type_group_from_kind(cast_type_kind);
|
||||
RDI_EvalConversionKind conversion_rule = rdi_eval_conversion_rule(in_group, out_group);
|
||||
RDI_EvalConversionKind conversion_rule = rdi_eval_conversion_kind_from_typegroups(in_group, out_group);
|
||||
|
||||
// generate tree
|
||||
switch(conversion_rule)
|
||||
@@ -1107,7 +1112,7 @@ eval_irtree_and_type_from_expr(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, E
|
||||
{
|
||||
String8 text = str8_lit("(internal) unknown conversion rule");
|
||||
if (conversion_rule < RDI_EvalConversionKind_COUNT){
|
||||
text.str = rdi_eval_conversion_message(conversion_rule, &text.size);
|
||||
text.str = rdi_explanation_string_from_eval_conversion_kind(conversion_rule, &text.size);
|
||||
}
|
||||
eval_error(arena, eout, EVAL_ErrorKind_MalformedInput, expr->location, text);
|
||||
}break;
|
||||
@@ -1172,7 +1177,7 @@ eval_irtree_and_type_from_expr(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, E
|
||||
B32 can_generate = 0;
|
||||
RDI_EvalOp op = eval_opcode_from_expr_kind(kind);
|
||||
U8 c_group = eval_type_group_from_kind(c_restype_kind);
|
||||
if (!rdi_eval_opcode_type_compatible(op, c_group)){
|
||||
if (!rdi_eval_op_typegroup_are_compatible(op, c_group)){
|
||||
eval_errorf(arena, eout, EVAL_ErrorKind_MalformedInput, expr->location, "Cannot use this operator on this type.");
|
||||
}
|
||||
else{
|
||||
@@ -1301,7 +1306,7 @@ eval_irtree_and_type_from_expr(Arena *arena, TG_Graph *graph, RDI_Parsed *rdi, E
|
||||
U8 cv_group = eval_type_group_from_kind(cv_type_kind);
|
||||
|
||||
B32 can_generate = 0;
|
||||
if (rdi_eval_opcode_type_compatible(op, cv_group)){
|
||||
if (rdi_eval_op_typegroup_are_compatible(op, cv_group)){
|
||||
can_generate = 1;
|
||||
}
|
||||
else{
|
||||
@@ -1620,7 +1625,7 @@ eval_oplist_from_irtree(Arena *arena, EVAL_IRTree *tree, EVAL_OpList *out){
|
||||
}
|
||||
else{
|
||||
// handle all children
|
||||
U8 ctrlbits = rdi_eval_opcode_ctrlbits[op];
|
||||
U8 ctrlbits = rdi_eval_op_ctrlbits_table[op];
|
||||
U64 child_count = RDI_POPN_FROM_CTRLBITS(ctrlbits);
|
||||
EVAL_IRTree**child = tree->children;
|
||||
for (U64 i = 0; i < child_count; i += 1, child += 1){
|
||||
|
||||
@@ -93,6 +93,7 @@ eval_string2num_map_insert(Arena *arena, EVAL_String2NumMap *map, String8 string
|
||||
SLLQueuePush_N(map->first, map->last, node, order_next);
|
||||
node->string = push_str8_copy(arena, string);
|
||||
node->num = num;
|
||||
map->node_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +122,41 @@ eval_num_from_string(EVAL_String2NumMap *map, String8 string)
|
||||
return num;
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMapNodeArray
|
||||
eval_string2num_map_node_array_from_map(Arena *arena, EVAL_String2NumMap *map)
|
||||
{
|
||||
EVAL_String2NumMapNodeArray result = {0};
|
||||
result.count = map->node_count;
|
||||
result.v = push_array(arena, EVAL_String2NumMapNode *, result.count);
|
||||
U64 idx = 0;
|
||||
for(EVAL_String2NumMapNode *n = map->first; n != 0; n = n->order_next, idx += 1)
|
||||
{
|
||||
result.v[idx] = n;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal int
|
||||
eval_string2num_map_node_qsort_compare__num_ascending(EVAL_String2NumMapNode **a, EVAL_String2NumMapNode **b)
|
||||
{
|
||||
int result = 0;
|
||||
if(a[0]->num < b[0]->num)
|
||||
{
|
||||
result = -1;
|
||||
}
|
||||
else if(a[0]->num > b[0]->num)
|
||||
{
|
||||
result = +1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
eval_string2num_map_node_array_sort__in_place(EVAL_String2NumMapNodeArray *array)
|
||||
{
|
||||
quick_sort(array->v, array->count, sizeof(array->v[0]), eval_string2num_map_node_qsort_compare__num_ascending);
|
||||
}
|
||||
|
||||
//- rjf: string -> expr
|
||||
|
||||
internal EVAL_String2ExprMap
|
||||
|
||||
@@ -144,6 +144,13 @@ struct EVAL_String2NumMapNode
|
||||
U64 num;
|
||||
};
|
||||
|
||||
typedef struct EVAL_String2NumMapNodeArray EVAL_String2NumMapNodeArray;
|
||||
struct EVAL_String2NumMapNodeArray
|
||||
{
|
||||
EVAL_String2NumMapNode **v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct EVAL_String2NumMapSlot EVAL_String2NumMapSlot;
|
||||
struct EVAL_String2NumMapSlot
|
||||
{
|
||||
@@ -155,6 +162,7 @@ typedef struct EVAL_String2NumMap EVAL_String2NumMap;
|
||||
struct EVAL_String2NumMap
|
||||
{
|
||||
U64 slots_count;
|
||||
U64 node_count;
|
||||
EVAL_String2NumMapSlot *slots;
|
||||
EVAL_String2NumMapNode *first;
|
||||
EVAL_String2NumMapNode *last;
|
||||
@@ -210,6 +218,9 @@ internal void eval_error_list_concat_in_place(EVAL_ErrorList *dst, EVAL_ErrorLis
|
||||
internal EVAL_String2NumMap eval_string2num_map_make(Arena *arena, U64 slot_count);
|
||||
internal void eval_string2num_map_insert(Arena *arena, EVAL_String2NumMap *map, String8 string, U64 num);
|
||||
internal U64 eval_num_from_string(EVAL_String2NumMap *map, String8 string);
|
||||
internal EVAL_String2NumMapNodeArray eval_string2num_map_node_array_from_map(Arena *arena, EVAL_String2NumMap *map);
|
||||
internal int eval_string2num_map_node_qsort_compare__num_ascending(EVAL_String2NumMapNode **a, EVAL_String2NumMapNode **b);
|
||||
internal void eval_string2num_map_node_array_sort__in_place(EVAL_String2NumMapNodeArray *array);
|
||||
|
||||
//- rjf: string -> expr
|
||||
internal EVAL_String2ExprMap eval_string2expr_map_make(Arena *arena, U64 slot_count);
|
||||
|
||||
@@ -27,7 +27,7 @@ eval_interpret(EVAL_Machine *machine, String8 bytecode)
|
||||
result.code = EVAL_ResultCode_BadOp;
|
||||
goto done;
|
||||
}
|
||||
U8 ctrlbits = rdi_eval_opcode_ctrlbits[op];
|
||||
U8 ctrlbits = rdi_eval_op_ctrlbits_table[op];
|
||||
ptr += 1;
|
||||
|
||||
// decode
|
||||
|
||||
+70
-108
@@ -73,10 +73,9 @@ eval_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
|
||||
//- rjf: voff -> tightest scope
|
||||
RDI_Scope *tightest_scope = 0;
|
||||
if(rdi->scope_vmap != 0 && rdi->scopes != 0)
|
||||
{
|
||||
U64 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, voff);
|
||||
RDI_Scope *scope = &rdi->scopes[scope_idx];
|
||||
U64 scope_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_ScopeVMap, voff);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
task->scope = scope;
|
||||
SLLQueuePush(first_task, last_task, task);
|
||||
@@ -84,10 +83,10 @@ eval_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
}
|
||||
|
||||
//- rjf: voff-1 -> scope
|
||||
if(voff > 0 && rdi->scope_vmap != 0 && rdi->scopes != 0)
|
||||
if(voff > 0)
|
||||
{
|
||||
U64 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, voff-1);
|
||||
RDI_Scope *scope = &rdi->scopes[scope_idx];
|
||||
U64 scope_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_ScopeVMap, voff-1);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
if(scope != tightest_scope)
|
||||
{
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
@@ -99,9 +98,10 @@ eval_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
//- rjf: tightest scope -> walk up the tree & build tasks for each parent scope
|
||||
if(tightest_scope != 0)
|
||||
{
|
||||
for(RDI_Scope *scope = &rdi->scopes[tightest_scope->parent_scope_idx];
|
||||
scope != 0 && scope != &rdi->scopes[0];
|
||||
scope = &rdi->scopes[scope->parent_scope_idx])
|
||||
RDI_Scope *nil_scope = rdi_element_from_name_idx(rdi, Scopes, 0);
|
||||
for(RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, tightest_scope->parent_scope_idx);
|
||||
scope != 0 && scope != nil_scope;
|
||||
scope = rdi_element_from_name_idx(rdi, Scopes, scope->parent_scope_idx))
|
||||
{
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
task->scope = scope;
|
||||
@@ -122,7 +122,7 @@ eval_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
U32 local_opl_idx = scope->local_first + scope->local_count;
|
||||
for(U32 local_idx = scope->local_first; local_idx < local_opl_idx; local_idx += 1)
|
||||
{
|
||||
RDI_Local *local_var = &rdi->locals[local_idx];
|
||||
RDI_Local *local_var = rdi_element_from_name_idx(rdi, Locals, local_idx);
|
||||
U64 local_name_size = 0;
|
||||
U8 *local_name_str = rdi_string_from_idx(rdi, local_var->name_string_idx, &local_name_size);
|
||||
String8 name = push_str8_copy(arena, str8(local_name_str, local_name_size));
|
||||
@@ -139,52 +139,30 @@ internal EVAL_String2NumMap *
|
||||
eval_push_member_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
{
|
||||
//- rjf: voff -> tightest scope
|
||||
RDI_Scope *tightest_scope = 0;
|
||||
if(rdi->scope_vmap != 0 && rdi->scopes != 0)
|
||||
{
|
||||
U64 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, voff);
|
||||
tightest_scope = &rdi->scopes[scope_idx];
|
||||
}
|
||||
U64 scope_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_ScopeVMap, voff);
|
||||
RDI_Scope *tightest_scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
|
||||
//- rjf: tightest scope -> procedure
|
||||
RDI_Procedure *procedure = 0;
|
||||
if(tightest_scope != 0 && rdi->procedures != 0)
|
||||
{
|
||||
U32 proc_idx = tightest_scope->proc_idx;
|
||||
if(0 < proc_idx && proc_idx < rdi->procedures_count)
|
||||
{
|
||||
procedure = &rdi->procedures[proc_idx];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, proc_idx);
|
||||
|
||||
//- rjf: procedure -> udt
|
||||
RDI_UDT *udt = 0;
|
||||
if(procedure != 0 && rdi->udts != 0 && procedure->link_flags & RDI_LinkFlag_TypeScoped)
|
||||
{
|
||||
U32 udt_idx = procedure->container_idx;
|
||||
if(0 < udt_idx && udt_idx < rdi->udts_count)
|
||||
{
|
||||
udt = &rdi->udts[udt_idx];
|
||||
}
|
||||
}
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, udt_idx);
|
||||
|
||||
//- rjf: build blank map
|
||||
EVAL_String2NumMap *map = push_array(arena, EVAL_String2NumMap, 1);
|
||||
*map = eval_string2num_map_make(arena, 64);
|
||||
|
||||
//- rjf: udt -> fill member map
|
||||
if(udt != 0 && !(udt->flags & RDI_UserDefinedTypeFlag_EnumMembers) && rdi->members != 0)
|
||||
if(!(udt->flags & RDI_UDTFlag_EnumMembers))
|
||||
{
|
||||
U64 data_member_num = 1;
|
||||
for(U32 member_idx = udt->member_first;
|
||||
member_idx < udt->member_first+udt->member_count;
|
||||
member_idx += 1)
|
||||
{
|
||||
if(member_idx < 1 || rdi->members_count <= member_idx)
|
||||
{
|
||||
break;
|
||||
}
|
||||
RDI_Member *m = &rdi->members[member_idx];
|
||||
RDI_Member *m = rdi_element_from_name_idx(rdi, Members, member_idx);
|
||||
if(m->kind == RDI_MemberKind_DataField)
|
||||
{
|
||||
String8 name = {0};
|
||||
@@ -476,11 +454,10 @@ eval_leaf_type_from_name(RDI_Parsed *rdi, String8 name)
|
||||
{
|
||||
TG_Key key = zero_struct;
|
||||
B32 found = 0;
|
||||
if(rdi->type_nodes != 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_Types);
|
||||
RDI_NameMap *name_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Types);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_name_map_parse(rdi, name_map, &parsed_name_map);
|
||||
rdi_parsed_from_name_map(rdi, name_map, &parsed_name_map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(rdi, &parsed_name_map, name.str, name.size);
|
||||
if(node != 0)
|
||||
{
|
||||
@@ -488,7 +465,7 @@ eval_leaf_type_from_name(RDI_Parsed *rdi, String8 name)
|
||||
U32 *matches = rdi_matches_from_map_node(rdi, node, &match_count);
|
||||
if(match_count != 0)
|
||||
{
|
||||
RDI_TypeNode *type_node = rdi_element_from_idx(rdi, type_nodes, matches[0]);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, matches[0]);
|
||||
found = type_node->kind != RDI_TypeKind_NULL;
|
||||
key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), (U64)matches[0]);
|
||||
}
|
||||
@@ -618,7 +595,7 @@ eval_parse_type_from_text_tokens(Arena *arena, EVAL_ParseCtx *ctx, String8 text,
|
||||
if(str8_match(token_string, str8_lit("*"), 0))
|
||||
{
|
||||
token_it += 1;
|
||||
parse.expr = eval_expr(arena, EVAL_ExprKind_Ptr, token_string.str, parse.expr, 0, 0);
|
||||
parse.expr = eval_expr(arena, EVAL_ExprKind_Ptr, token_string.str, parse.expr, &eval_expr_nil, &eval_expr_nil);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -797,8 +774,8 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
it = nested_parse.last_token;
|
||||
|
||||
// rjf: build cast-to-U64*, and dereference operators
|
||||
atom = eval_expr(arena, EVAL_ExprKind_Cast, token_string.str, eval_expr_leaf_type(arena, token_string.str, tg_cons_type_make(ctx->type_graph, TG_Kind_Ptr, tg_key_basic(TG_Kind_U64), 0)), atom, 0);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_Deref, token_string.str, atom, 0, 0);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_Cast, token_string.str, eval_expr_leaf_type(arena, token_string.str, tg_cons_type_make(ctx->type_graph, TG_Kind_Ptr, tg_key_basic(TG_Kind_U64), 0)), atom, &eval_expr_nil);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_Deref, token_string.str, atom, &eval_expr_nil, &eval_expr_nil);
|
||||
|
||||
// rjf: expect ]
|
||||
EVAL_Token close_paren_maybe = eval_token_at_it(it, tokens);
|
||||
@@ -828,8 +805,8 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
B32 identifier_type_is_possibly_dynamically_overridden = 0;
|
||||
B32 identifier_looks_like_type_expr = 0;
|
||||
RDI_LocationKind loc_kind = RDI_LocationKind_NULL;
|
||||
RDI_LocationRegister loc_reg = {0};
|
||||
RDI_LocationRegisterPlusU16 loc_reg_u16 = {0};
|
||||
RDI_LocationReg loc_reg = {0};
|
||||
RDI_LocationRegPlusU16 loc_reg_u16 = {0};
|
||||
String8 loc_bytecode = {0};
|
||||
REGS_RegCode reg_code = 0;
|
||||
REGS_AliasCode alias_code = 0;
|
||||
@@ -838,12 +815,11 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
|
||||
//- rjf: form namespaceified fallback versions of this lookup string
|
||||
String8List namespaceified_token_strings = {0};
|
||||
if(ctx->rdi->procedures != 0 && ctx->rdi->scopes != 0 && ctx->rdi->scope_vmap != 0)
|
||||
{
|
||||
U64 scope_idx = rdi_vmap_idx_from_voff(ctx->rdi->scope_vmap, ctx->rdi->scope_vmap_count, ctx->ip_voff);
|
||||
RDI_Scope *scope = &ctx->rdi->scopes[scope_idx];
|
||||
U64 scope_idx = rdi_vmap_idx_from_section_kind_voff(ctx->rdi, RDI_SectionKind_ScopeVMap, ctx->ip_voff);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(ctx->rdi, Scopes, scope_idx);
|
||||
U64 proc_idx = scope->proc_idx;
|
||||
RDI_Procedure *procedure = &ctx->rdi->procedures[proc_idx];
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(ctx->rdi, Procedures, proc_idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_ptr = rdi_string_from_idx(ctx->rdi, procedure->name_string_idx, &name_size);
|
||||
String8 containing_procedure_name = str8(name_ptr, name_size);
|
||||
@@ -883,8 +859,8 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
{
|
||||
mapped_identifier = 1;
|
||||
identifier_type_is_possibly_dynamically_overridden = 1;
|
||||
RDI_Local *local_var = rdi_element_from_idx(ctx->rdi, locals, local_num-1);
|
||||
RDI_TypeNode *type_node = rdi_element_from_idx(ctx->rdi, type_nodes, local_var->type_idx);
|
||||
RDI_Local *local_var = rdi_element_from_name_idx(ctx->rdi, Locals, local_num-1);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(ctx->rdi, TypeNodes, local_var->type_idx);
|
||||
type_key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), (U64)local_var->type_idx);
|
||||
|
||||
// rjf: grab location info
|
||||
@@ -892,39 +868,41 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
loc_block_idx < local_var->location_opl;
|
||||
loc_block_idx += 1)
|
||||
{
|
||||
RDI_LocationBlock *block = &ctx->rdi->location_blocks[loc_block_idx];
|
||||
RDI_LocationBlock *block = rdi_element_from_name_idx(ctx->rdi, LocationBlocks, loc_block_idx);
|
||||
if(block->scope_off_first <= ctx->ip_voff && ctx->ip_voff < block->scope_off_opl)
|
||||
{
|
||||
loc_kind = *((RDI_LocationKind *)(ctx->rdi->location_data + block->location_data_off));
|
||||
U64 all_location_data_size = 0;
|
||||
U8 *all_location_data = rdi_table_from_name(ctx->rdi, LocationData, &all_location_data_size);
|
||||
loc_kind = *((RDI_LocationKind *)(all_location_data + block->location_data_off));
|
||||
switch(loc_kind)
|
||||
{
|
||||
default:{mapped_identifier = 0;}break;
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
U8 *bytecode_base = ctx->rdi->location_data + block->location_data_off + sizeof(RDI_LocationKind);
|
||||
U8 *bytecode_base = all_location_data + block->location_data_off + sizeof(RDI_LocationKind);
|
||||
U64 bytecode_size = 0;
|
||||
for(U64 idx = 0; idx < ctx->rdi->location_data_size; idx += 1)
|
||||
for(U64 idx = 0; idx < all_location_data_size; idx += 1)
|
||||
{
|
||||
U8 op = bytecode_base[idx];
|
||||
if(op == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
U8 ctrlbits = rdi_eval_opcode_ctrlbits[op];
|
||||
U8 ctrlbits = rdi_eval_op_ctrlbits_table[op];
|
||||
U32 p_size = RDI_DECODEN_FROM_CTRLBITS(ctrlbits);
|
||||
bytecode_size += 1+p_size;
|
||||
}
|
||||
loc_bytecode = str8(bytecode_base, bytecode_size);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
MemoryCopy(&loc_reg_u16, (ctx->rdi->location_data + block->location_data_off), sizeof(loc_reg_u16));
|
||||
MemoryCopy(&loc_reg_u16, (all_location_data + block->location_data_off), sizeof(loc_reg_u16));
|
||||
}break;
|
||||
case RDI_LocationKind_ValRegister:
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
MemoryCopy(&loc_reg, (ctx->rdi->location_data + block->location_data_off), sizeof(loc_reg));
|
||||
MemoryCopy(&loc_reg, (all_location_data + block->location_data_off), sizeof(loc_reg));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -959,11 +937,9 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
//- rjf: try global variables
|
||||
if(mapped_identifier == 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_name_map_from_kind(ctx->rdi, RDI_NameMapKind_GlobalVariables);
|
||||
if(name_map != 0 && ctx->rdi->global_variables != 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_element_from_name_idx(ctx->rdi, NameMaps, RDI_NameMapKind_GlobalVariables);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_name_map_parse(ctx->rdi, name_map, &parsed_name_map);
|
||||
rdi_parsed_from_name_map(ctx->rdi, name_map, &parsed_name_map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(ctx->rdi, &parsed_name_map, token_string.str, token_string.size);
|
||||
U32 matches_count = 0;
|
||||
U32 *matches = rdi_matches_from_map_node(ctx->rdi, node, &matches_count);
|
||||
@@ -982,30 +958,24 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
// don't know of a magic hash table fixup path in PDBs, so
|
||||
// in this case, I'm going to prefer the latest-added global.
|
||||
U32 match_idx = matches[matches_count-1];
|
||||
RDI_GlobalVariable *global_var = &ctx->rdi->global_variables[match_idx];
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(ctx->rdi, GlobalVariables, match_idx);
|
||||
EVAL_OpList oplist = {0};
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, global_var->voff);
|
||||
loc_kind = RDI_LocationKind_AddrBytecodeStream;
|
||||
loc_bytecode = eval_bytecode_from_oplist(arena, &oplist);
|
||||
U32 type_idx = global_var->type_idx;
|
||||
if(type_idx < ctx->rdi->type_nodes_count)
|
||||
{
|
||||
RDI_TypeNode *type_node = &ctx->rdi->type_nodes[type_idx];
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(ctx->rdi, TypeNodes, type_idx);
|
||||
type_key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), (U64)type_idx);
|
||||
}
|
||||
mapped_identifier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try thread variables
|
||||
if(mapped_identifier == 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_name_map_from_kind(ctx->rdi, RDI_NameMapKind_ThreadVariables);
|
||||
if(name_map != 0 && ctx->rdi->global_variables != 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_element_from_name_idx(ctx->rdi, NameMaps, RDI_NameMapKind_ThreadVariables);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_name_map_parse(ctx->rdi, name_map, &parsed_name_map);
|
||||
rdi_parsed_from_name_map(ctx->rdi, name_map, &parsed_name_map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(ctx->rdi, &parsed_name_map, token_string.str, token_string.size);
|
||||
U32 matches_count = 0;
|
||||
U32 *matches = rdi_matches_from_map_node(ctx->rdi, node, &matches_count);
|
||||
@@ -1020,30 +990,24 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
if(matches_count != 0)
|
||||
{
|
||||
U32 match_idx = matches[0];
|
||||
RDI_ThreadVariable *thread_var = &ctx->rdi->thread_variables[match_idx];
|
||||
RDI_ThreadVariable *thread_var = rdi_element_from_name_idx(ctx->rdi, ThreadVariables, match_idx);
|
||||
EVAL_OpList oplist = {0};
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_TLSOff, thread_var->tls_off);
|
||||
loc_kind = RDI_LocationKind_AddrBytecodeStream;
|
||||
loc_bytecode = eval_bytecode_from_oplist(arena, &oplist);
|
||||
U32 type_idx = thread_var->type_idx;
|
||||
if(type_idx < ctx->rdi->type_nodes_count)
|
||||
{
|
||||
RDI_TypeNode *type_node = &ctx->rdi->type_nodes[type_idx];
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(ctx->rdi, TypeNodes, type_idx);
|
||||
type_key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), (U64)type_idx);
|
||||
}
|
||||
mapped_identifier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try procedures
|
||||
if(mapped_identifier == 0)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_name_map_from_kind(ctx->rdi, RDI_NameMapKind_Procedures);
|
||||
if(name_map != 0 && ctx->rdi->procedures != 0 && ctx->rdi->scopes != 0 && ctx->rdi->scope_voffs)
|
||||
{
|
||||
RDI_NameMap *name_map = rdi_element_from_name_idx(ctx->rdi, NameMaps, RDI_NameMapKind_Procedures);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_name_map_parse(ctx->rdi, name_map, &parsed_name_map);
|
||||
rdi_parsed_from_name_map(ctx->rdi, name_map, &parsed_name_map);
|
||||
RDI_NameMapNode *node = rdi_name_map_lookup(ctx->rdi, &parsed_name_map, token_string.str, token_string.size);
|
||||
U32 matches_count = 0;
|
||||
U32 *matches = rdi_matches_from_map_node(ctx->rdi, node, &matches_count);
|
||||
@@ -1058,23 +1022,19 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
if(matches_count != 0)
|
||||
{
|
||||
U32 match_idx = matches[0];
|
||||
RDI_Procedure *procedure = &ctx->rdi->procedures[match_idx];
|
||||
RDI_Scope *scope = &ctx->rdi->scopes[procedure->root_scope_idx];
|
||||
U64 voff = ctx->rdi->scope_voffs[scope->voff_range_first];
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(ctx->rdi, Procedures, match_idx);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(ctx->rdi, Scopes, procedure->root_scope_idx);
|
||||
U64 voff = *rdi_element_from_name_idx(ctx->rdi, ScopeVOffData, scope->voff_range_first);
|
||||
EVAL_OpList oplist = {0};
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_ModuleOff, voff);
|
||||
loc_kind = RDI_LocationKind_ValBytecodeStream;
|
||||
loc_bytecode = eval_bytecode_from_oplist(arena, &oplist);
|
||||
U32 type_idx = procedure->type_idx;
|
||||
if(type_idx < ctx->rdi->type_nodes_count)
|
||||
{
|
||||
RDI_TypeNode *type_node = &ctx->rdi->type_nodes[type_idx];
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(ctx->rdi, TypeNodes, type_idx);
|
||||
type_key = tg_key_ext(tg_kind_from_rdi_type_kind(type_node->kind), (U64)type_idx);
|
||||
}
|
||||
mapped_identifier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: try types
|
||||
if(mapped_identifier == 0)
|
||||
@@ -1134,35 +1094,35 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
{
|
||||
atom = eval_expr_leaf_bytecode(arena, token_string.str, type_key, loc_bytecode, EVAL_EvalMode_Value);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
{
|
||||
EVAL_OpList oplist = {0};
|
||||
U64 byte_size = bit_size_from_arch(ctx->arch)/8;
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg_u16.register_code, byte_size, 0);
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg_u16.reg_code, byte_size, 0);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_RegRead, regread_param);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU16, loc_reg_u16.offset);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_Add, 0);
|
||||
atom = eval_expr_leaf_op_list(arena, token_string.str, type_key, &oplist, EVAL_EvalMode_Addr);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrAddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
EVAL_OpList oplist = {0};
|
||||
U64 byte_size = bit_size_from_arch(ctx->arch)/8;
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg_u16.register_code, byte_size, 0);
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg_u16.reg_code, byte_size, 0);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_RegRead, regread_param);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU16, loc_reg_u16.offset);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_Add, 0);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_MemRead, bit_size_from_arch(ctx->arch)/8);
|
||||
atom = eval_expr_leaf_op_list(arena, token_string.str, type_key, &oplist, EVAL_EvalMode_Addr);
|
||||
}break;
|
||||
case RDI_LocationKind_ValRegister:
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
REGS_RegCode regs_reg_code = regs_reg_code_from_arch_rdi_code(ctx->arch, loc_reg.register_code);
|
||||
REGS_RegCode regs_reg_code = regs_reg_code_from_arch_rdi_code(ctx->arch, loc_reg.reg_code);
|
||||
REGS_Rng reg_rng = regs_reg_code_rng_table_from_architecture(ctx->arch)[regs_reg_code];
|
||||
EVAL_OpList oplist = {0};
|
||||
U64 byte_size = (U64)reg_rng.byte_size;
|
||||
U64 byte_pos = 0;
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg.register_code, byte_size, byte_pos);
|
||||
U64 regread_param = RDI_EncodeRegReadParam(loc_reg.reg_code, byte_size, byte_pos);
|
||||
eval_oplist_push_op(arena, &oplist, RDI_EvalOp_RegRead, regread_param);
|
||||
atom = eval_expr_leaf_op_list(arena, token_string.str, type_key, &oplist, EVAL_EvalMode_Value);
|
||||
}break;
|
||||
@@ -1172,7 +1132,7 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
if(atom_implicit_member_name.size != 0)
|
||||
{
|
||||
EVAL_Expr *member_expr = eval_expr_leaf_member(arena, atom_implicit_member_name.str, atom_implicit_member_name);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_MemberAccess, atom_implicit_member_name.str, atom, member_expr, 0);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_MemberAccess, atom_implicit_member_name.str, atom, member_expr, &eval_expr_nil);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1283,7 +1243,7 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
if(good_member_name)
|
||||
{
|
||||
EVAL_Expr *member_expr = eval_expr_leaf_member(arena, member_name.str, member_name);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_MemberAccess, token_string.str, atom, member_expr, 0);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_MemberAccess, token_string.str, atom, member_expr, &eval_expr_nil);
|
||||
}
|
||||
|
||||
// rjf: increment past good member names
|
||||
@@ -1311,7 +1271,7 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
// rjf: valid indexing expression => produce index expr
|
||||
if(idx_expr_parse.expr != &eval_expr_nil)
|
||||
{
|
||||
atom = eval_expr(arena, EVAL_ExprKind_ArrayIndex, token_string.str, atom, idx_expr_parse.expr, 0);
|
||||
atom = eval_expr(arena, EVAL_ExprKind_ArrayIndex, token_string.str, atom, idx_expr_parse.expr, &eval_expr_nil);
|
||||
}
|
||||
|
||||
// rjf: expect ]
|
||||
@@ -1346,7 +1306,8 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
{
|
||||
atom = eval_expr(arena, prefix_unary->kind, prefix_unary->location,
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? prefix_unary->cast_expr : atom,
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? atom : 0, 0);
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? atom : &eval_expr_nil,
|
||||
&eval_expr_nil);
|
||||
}
|
||||
}
|
||||
else if(atom == 0 && first_prefix_unary != 0)
|
||||
@@ -1359,7 +1320,8 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
{
|
||||
atom = eval_expr(arena, prefix_unary->kind, prefix_unary->location,
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? prefix_unary->cast_expr : atom,
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? atom : 0, 0);
|
||||
prefix_unary->cast_expr != &eval_expr_nil ? atom : &eval_expr_nil,
|
||||
&eval_expr_nil);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1401,7 +1363,7 @@ eval_parse_expr_from_text_tokens__prec(Arena *arena, EVAL_ParseCtx *ctx, String8
|
||||
}
|
||||
else
|
||||
{
|
||||
atom = eval_expr(arena, binary_kind, token_string.str, atom, rhs, 0);
|
||||
atom = eval_expr(arena, binary_kind, token_string.str, atom, rhs, &eval_expr_nil);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ extern U8 eval_expr_kind_child_counts[40];
|
||||
extern String8 eval_expr_kind_strings[40];
|
||||
extern String8 eval_result_code_display_strings[11];
|
||||
extern String8 eval_expr_op_strings[40];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // EVAL_META_H
|
||||
|
||||
+69
-42
@@ -516,16 +516,18 @@ f_piece_array_copy(Arena *arena, F_PieceArray *src)
|
||||
//~ rjf: Rasterization Cache
|
||||
|
||||
internal F_Hash2StyleRasterCacheNode *
|
||||
f_hash2style_from_tag_size(F_Tag tag, F32 size)
|
||||
f_hash2style_from_tag_size_flags(F_Tag tag, F32 size, F_RunFlags flags)
|
||||
{
|
||||
//- rjf: tag * size -> style hash
|
||||
U64 style_hash = {0};
|
||||
{
|
||||
F64 size_f64 = size;
|
||||
U64 buffer[] =
|
||||
{
|
||||
tag.u64[0],
|
||||
tag.u64[1],
|
||||
(U64)round_f32(size),
|
||||
*(U64 *)(&size_f64),
|
||||
(U64)flags,
|
||||
};
|
||||
style_hash = f_little_hash_from_string(str8((U8 *)buffer, sizeof(buffer)));
|
||||
}
|
||||
@@ -565,16 +567,17 @@ f_hash2style_from_tag_size(F_Tag tag, F32 size)
|
||||
}
|
||||
|
||||
internal F_Run
|
||||
f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, String8 string)
|
||||
f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, String8 string)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
//- rjf: map tag/size to style node
|
||||
F_Hash2StyleRasterCacheNode *hash2style_node = f_hash2style_from_tag_size(tag, size);
|
||||
F_Hash2StyleRasterCacheNode *hash2style_node = f_hash2style_from_tag_size_flags(tag, size, flags);
|
||||
|
||||
//- rjf: decode string & produce run pieces
|
||||
F_PieceChunkList piece_chunks = {0};
|
||||
Vec2F32 dim = {0};
|
||||
F32 last_piece_end_pad = 0;
|
||||
B32 font_handle_mapped_on_miss = 0;
|
||||
FP_Handle font_handle = {0};
|
||||
U64 piece_substring_start_idx = 0;
|
||||
@@ -682,7 +685,11 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
}
|
||||
|
||||
// rjf: call into font provider to rasterize this substring
|
||||
FP_RasterResult raster = fp_raster(scratch.arena, font_handle, round_f32(size), FP_RasterMode_Sharp, piece_substring);
|
||||
FP_RasterResult raster = {0};
|
||||
if(size > 0)
|
||||
{
|
||||
raster = fp_raster(scratch.arena, font_handle, floor_f32(size), (flags & F_RunFlag_Smooth) ? FP_RasterMode_Smooth : FP_RasterMode_Sharp, piece_substring);
|
||||
}
|
||||
|
||||
// rjf: allocate portion of an atlas to upload the rasterization
|
||||
S16 chosen_atlas_num = 0;
|
||||
@@ -704,7 +711,7 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
atlas->root->max_free_size[Corner_01] =
|
||||
atlas->root->max_free_size[Corner_10] =
|
||||
atlas->root->max_free_size[Corner_11] = v2s16(atlas->root_dim.x/2, atlas->root_dim.y/2);
|
||||
atlas->texture = r_tex2d_alloc(R_Tex2DKind_Dynamic, v2s32((S32)atlas->root_dim.x, (S32)atlas->root_dim.y), R_Tex2DFormat_RGBA8, 0);
|
||||
atlas->texture = r_tex2d_alloc(R_ResourceKind_Dynamic, v2s32((S32)atlas->root_dim.x, (S32)atlas->root_dim.y), R_Tex2DFormat_RGBA8, 0);
|
||||
}
|
||||
|
||||
// rjf: allocate from atlas
|
||||
@@ -758,6 +765,7 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
if(info != 0)
|
||||
{
|
||||
info->subrect = chosen_atlas_region;
|
||||
info->bounding_box = raster.bounding_box;
|
||||
info->atlas_num = chosen_atlas_num;
|
||||
info->raster_dim = raster.atlas_dim;
|
||||
info->advance = raster.advance;
|
||||
@@ -788,6 +796,13 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: on tabs -> expand advance
|
||||
F32 advance = info->advance;
|
||||
if(is_tab)
|
||||
{
|
||||
advance = floor_f32(tab_size_px) - mod_f32(floor_f32(base_align_px), floor_f32(tab_size_px));
|
||||
}
|
||||
|
||||
// rjf: push piece
|
||||
{
|
||||
F_Piece *piece = f_piece_chunk_list_push_new(arena, &piece_chunks, string.size);
|
||||
@@ -797,12 +812,15 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
info->subrect.y0,
|
||||
info->subrect.x0 + info->raster_dim.x,
|
||||
info->subrect.y0 + info->raster_dim.y);
|
||||
piece->advance = info->advance;
|
||||
piece->advance = advance;
|
||||
piece->decode_size = piece_substring.size;
|
||||
piece->offset = v2s16(0, -hash2style_node->ascent - 4);
|
||||
}
|
||||
base_align_px += advance;
|
||||
dim.x += piece->advance;
|
||||
dim.y = Max(dim.y, dim_2s16(piece->subrect).y);
|
||||
dim.y = Max(dim.y, info->raster_dim.y);
|
||||
last_piece_end_pad = ((F32)piece->offset.x+(F32)dim_2s16(info->bounding_box).x) - piece->advance;
|
||||
last_piece_end_pad = ClampBot(0, last_piece_end_pad);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -820,6 +838,8 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
run.pieces = f_piece_array_from_chunk_list(arena, &piece_chunks);
|
||||
}
|
||||
run.dim = dim;
|
||||
run.dim.x += last_piece_end_pad;
|
||||
run.end_pad = last_piece_end_pad;
|
||||
run.ascent = hash2style_node->ascent;
|
||||
run.descent = hash2style_node->descent;
|
||||
}
|
||||
@@ -829,12 +849,12 @@ f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, Stri
|
||||
}
|
||||
|
||||
internal String8List
|
||||
f_wrapped_string_lines_from_font_size_string_max(Arena *arena, F_Tag font, F32 size, String8 string, F32 max)
|
||||
f_wrapped_string_lines_from_font_size_string_max(Arena *arena, F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, String8 string, F32 max)
|
||||
{
|
||||
String8List list = {0};
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, 0, string);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, font, size, base_align_px, tab_size_px, 0, string);
|
||||
F32 off_px = 0;
|
||||
U64 off_bytes = 0;
|
||||
U64 line_start_off_bytes = 0;
|
||||
@@ -942,12 +962,12 @@ f_wrapped_string_lines_from_font_size_string_max(Arena *arena, F_Tag font, F32 s
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
f_dim_from_tag_size_string(F_Tag tag, F32 size, String8 string)
|
||||
f_dim_from_tag_size_string(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8 string)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
Vec2F32 result = {0};
|
||||
F_Run run = f_push_run_from_string(scratch.arena, tag, size, 0, string);
|
||||
F_Run run = f_push_run_from_string(scratch.arena, tag, size, base_align_px, tab_size_px, 0, string);
|
||||
result = run.dim;
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
@@ -955,13 +975,13 @@ f_dim_from_tag_size_string(F_Tag tag, F32 size, String8 string)
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
f_dim_from_tag_size_string_list(F_Tag tag, F32 size, String8List list)
|
||||
f_dim_from_tag_size_string_list(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8List list)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Vec2F32 sum = {0};
|
||||
for(String8Node *n = list.first; n != 0; n = n->next)
|
||||
{
|
||||
Vec2F32 str_dim = f_dim_from_tag_size_string(tag, size, n->string);
|
||||
Vec2F32 str_dim = f_dim_from_tag_size_string(tag, size, base_align_px, tab_size_px, n->string);
|
||||
sum.x += str_dim.x;
|
||||
sum.y = Max(sum.y, str_dim.y);
|
||||
}
|
||||
@@ -969,34 +989,41 @@ f_dim_from_tag_size_string_list(F_Tag tag, F32 size, String8List list)
|
||||
return sum;
|
||||
}
|
||||
|
||||
internal U64
|
||||
f_char_pos_from_tag_size_string_p(F_Tag tag, F32 size, String8 string, F32 p)
|
||||
internal F32
|
||||
f_column_size_from_tag_size(F_Tag tag, F32 size)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 result = 0;
|
||||
U64 best_offset = 0;
|
||||
F32 best_distance = -1.f;
|
||||
F32 x = 0;
|
||||
for(U64 char_idx = 0; char_idx <= string.size; char_idx += 1)
|
||||
{
|
||||
F32 this_char_distance = fabsf(p - x);
|
||||
if(this_char_distance < best_distance || best_distance < 0.f)
|
||||
{
|
||||
best_offset = char_idx;
|
||||
best_distance = this_char_distance;
|
||||
}
|
||||
if(char_idx < string.size)
|
||||
{
|
||||
x += f_dim_from_tag_size_string(tag, size, str8_substr(string, r1u64(char_idx, char_idx+1))).x;
|
||||
}
|
||||
}
|
||||
result = best_offset;
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
F32 result = f_dim_from_tag_size_string(tag, size, 0, 0, str8_lit("H")).x;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
f_char_pos_from_tag_size_string_p(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8 string, F32 p)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 best_offset_bytes = 0;
|
||||
F32 best_offset_px = inf32();
|
||||
U64 offset_bytes = 0;
|
||||
F32 offset_px = 0.f;
|
||||
F_Run run = f_push_run_from_string(scratch.arena, tag, size, base_align_px, tab_size_px, 0, string);
|
||||
for(U64 idx = 0; idx <= run.pieces.count; idx += 1)
|
||||
{
|
||||
F32 this_piece_offset_px = abs_f32(offset_px - p);
|
||||
if(this_piece_offset_px < best_offset_px)
|
||||
{
|
||||
best_offset_bytes = offset_bytes;
|
||||
best_offset_px = this_piece_offset_px;
|
||||
}
|
||||
if(idx < run.pieces.count)
|
||||
{
|
||||
F_Piece *piece = &run.pieces.v[idx];
|
||||
offset_px += piece->advance;
|
||||
offset_bytes += piece->decode_size;
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return best_offset_bytes;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Metrics
|
||||
|
||||
@@ -1007,10 +1034,10 @@ f_metrics_from_tag_size(F_Tag tag, F32 size)
|
||||
FP_Metrics metrics = f_fp_metrics_from_tag(tag);
|
||||
F_Metrics result = {0};
|
||||
{
|
||||
result.ascent = size * metrics.ascent / metrics.design_units_per_em;
|
||||
result.descent = size * metrics.descent / metrics.design_units_per_em;
|
||||
result.line_gap = size * metrics.line_gap / metrics.design_units_per_em;
|
||||
result.capital_height = size * metrics.capital_height / metrics.design_units_per_em;
|
||||
result.ascent = floor_f32(size) * metrics.ascent / metrics.design_units_per_em;
|
||||
result.descent = floor_f32(size) * metrics.descent / metrics.design_units_per_em;
|
||||
result.line_gap = floor_f32(size) * metrics.line_gap / metrics.design_units_per_em;
|
||||
result.capital_height = floor_f32(size) * metrics.capital_height / metrics.design_units_per_em;
|
||||
}
|
||||
ProfEnd();
|
||||
return result;
|
||||
|
||||
@@ -71,6 +71,7 @@ struct F_Run
|
||||
{
|
||||
F_PieceArray pieces;
|
||||
Vec2F32 dim;
|
||||
F32 end_pad;
|
||||
F32 ascent;
|
||||
F32 descent;
|
||||
};
|
||||
@@ -102,6 +103,7 @@ typedef struct F_RasterCacheInfo F_RasterCacheInfo;
|
||||
struct F_RasterCacheInfo
|
||||
{
|
||||
Rng2S16 subrect;
|
||||
Rng2S16 bounding_box;
|
||||
Vec2S16 raster_dim;
|
||||
S16 atlas_num;
|
||||
F32 advance;
|
||||
@@ -131,6 +133,7 @@ struct F_Hash2StyleRasterCacheNode
|
||||
U64 style_hash;
|
||||
F32 ascent;
|
||||
F32 descent;
|
||||
F32 column_width;
|
||||
F_RasterCacheInfo *utf8_class1_direct_map;
|
||||
U64 utf8_class1_direct_map_mask[4];
|
||||
U64 hash2info_slots_count;
|
||||
@@ -246,12 +249,13 @@ internal F_PieceArray f_piece_array_copy(Arena *arena, F_PieceArray *src);
|
||||
////////////////////////////////
|
||||
//~ rjf: Rasterization Cache
|
||||
|
||||
internal F_Hash2StyleRasterCacheNode *f_hash2style_from_tag_size(F_Tag tag, F32 size);
|
||||
internal F_Run f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F_RunFlags flags, String8 string);
|
||||
internal String8List f_wrapped_string_lines_from_font_size_string_max(Arena *arena, F_Tag font, F32 size, String8 string, F32 max);
|
||||
internal Vec2F32 f_dim_from_tag_size_string(F_Tag tag, F32 size, String8 string);
|
||||
internal Vec2F32 f_dim_from_tag_size_string_list(F_Tag tag, F32 size, String8List list);
|
||||
internal U64 f_char_pos_from_tag_size_string_p(F_Tag tag, F32 size, String8 string, F32 p);
|
||||
internal F_Hash2StyleRasterCacheNode *f_hash2style_from_tag_size_flags(F_Tag tag, F32 size, F_RunFlags flags);
|
||||
internal F_Run f_push_run_from_string(Arena *arena, F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, F_RunFlags flags, String8 string);
|
||||
internal String8List f_wrapped_string_lines_from_font_size_string_max(Arena *arena, F_Tag font, F32 size, F32 base_align_px, F32 tab_size_px, String8 string, F32 max);
|
||||
internal Vec2F32 f_dim_from_tag_size_string(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8 string);
|
||||
internal Vec2F32 f_dim_from_tag_size_string_list(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8List list);
|
||||
internal F32 f_column_size_from_tag_size(F_Tag tag, F32 size);
|
||||
internal U64 f_char_pos_from_tag_size_string_p(F_Tag tag, F32 size, F32 base_align_px, F32 tab_size_px, String8 string, F32 p);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Metrics
|
||||
|
||||
+73
-32
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
@@ -169,47 +172,85 @@ fp_init(void)
|
||||
}
|
||||
|
||||
//- rjf: make dwrite factory
|
||||
error = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), (IUnknown **)&fp_dwrite_state->factory);
|
||||
error = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, &IID_IDWriteFactory2, (void **)&fp_dwrite_state->factory);
|
||||
if(error == S_OK)
|
||||
{
|
||||
fp_dwrite_state->dwrite2_is_supported = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, &IID_IDWriteFactory, (void **)&fp_dwrite_state->factory);
|
||||
}
|
||||
|
||||
//- rjf: register static data font "loader" interface
|
||||
error = fp_dwrite_state->factory->RegisterFontFileLoader((IDWriteFontFileLoader *)&fp_dwrite_static_data_font_file_loader);
|
||||
error = IDWriteFactory_RegisterFontFileLoader(fp_dwrite_state->factory, (IDWriteFontFileLoader *)&fp_dwrite_static_data_font_file_loader);
|
||||
|
||||
//- rjf: make base rendering params
|
||||
error = fp_dwrite_state->factory->CreateRenderingParams(&fp_dwrite_state->base_rendering_params);
|
||||
error = IDWriteFactory_CreateRenderingParams(fp_dwrite_state->factory, &fp_dwrite_state->base_rendering_params);
|
||||
|
||||
//- rjf: make sharp rendering params
|
||||
{
|
||||
FLOAT gamma = 1.f;
|
||||
FLOAT enhanced_contrast = fp_dwrite_state->base_rendering_params->GetEnhancedContrast();
|
||||
// FLOAT clear_type_level = fp_dwrite_state->base_rendering_params->GetClearTypeLevel();
|
||||
error = fp_dwrite_state->factory->CreateCustomRenderingParams(gamma,
|
||||
FLOAT gamma = IDWriteRenderingParams_GetGamma(fp_dwrite_state->base_rendering_params);
|
||||
FLOAT enhanced_contrast = IDWriteRenderingParams_GetEnhancedContrast(fp_dwrite_state->base_rendering_params);
|
||||
if(fp_dwrite_state->dwrite2_is_supported)
|
||||
{
|
||||
error = IDWriteFactory2_CreateCustomRenderingParams2((IDWriteFactory2 *)fp_dwrite_state->factory,
|
||||
gamma,
|
||||
enhanced_contrast,
|
||||
2.f,
|
||||
enhanced_contrast,
|
||||
0.f,
|
||||
DWRITE_PIXEL_GEOMETRY_FLAT,
|
||||
DWRITE_RENDERING_MODE_GDI_NATURAL,
|
||||
DWRITE_GRID_FIT_MODE_ENABLED,
|
||||
(IDWriteRenderingParams2 **)&fp_dwrite_state->rendering_params[FP_RasterMode_Sharp]);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = IDWriteFactory_CreateCustomRenderingParams(fp_dwrite_state->factory,
|
||||
gamma,
|
||||
enhanced_contrast,
|
||||
0.f,
|
||||
DWRITE_PIXEL_GEOMETRY_FLAT,
|
||||
DWRITE_RENDERING_MODE_GDI_NATURAL,
|
||||
&fp_dwrite_state->rendering_params[FP_RasterMode_Sharp]);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: make smooth rendering params
|
||||
{
|
||||
FLOAT gamma = 1.f;
|
||||
FLOAT enhanced_contrast = fp_dwrite_state->base_rendering_params->GetEnhancedContrast();
|
||||
// FLOAT clear_type_level = fp_dwrite_state->base_rendering_params->GetClearTypeLevel();
|
||||
error = fp_dwrite_state->factory->CreateCustomRenderingParams(gamma,
|
||||
FLOAT enhanced_contrast = 0.f;
|
||||
if(fp_dwrite_state->dwrite2_is_supported)
|
||||
{
|
||||
error = IDWriteFactory2_CreateCustomRenderingParams2((IDWriteFactory2 *)fp_dwrite_state->factory,
|
||||
gamma,
|
||||
enhanced_contrast,
|
||||
2.f,
|
||||
enhanced_contrast,
|
||||
0.f,
|
||||
DWRITE_PIXEL_GEOMETRY_FLAT,
|
||||
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
|
||||
DWRITE_GRID_FIT_MODE_DISABLED,
|
||||
(IDWriteRenderingParams2 **)&fp_dwrite_state->rendering_params[FP_RasterMode_Smooth]);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = IDWriteFactory_CreateCustomRenderingParams(fp_dwrite_state->factory,
|
||||
gamma,
|
||||
enhanced_contrast,
|
||||
0.f,
|
||||
DWRITE_PIXEL_GEOMETRY_FLAT,
|
||||
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC,
|
||||
&fp_dwrite_state->rendering_params[FP_RasterMode_Smooth]);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: make dwrite gdi interop
|
||||
error = fp_dwrite_state->factory->GetGdiInterop(&fp_dwrite_state->gdi_interop);
|
||||
error = IDWriteFactory_GetGdiInterop(fp_dwrite_state->factory, &fp_dwrite_state->gdi_interop);
|
||||
|
||||
//- rjf: build render target for rasterization
|
||||
fp_dwrite_state->bitmap_render_target_dim = v2s32(2048, 256);
|
||||
error = fp_dwrite_state->gdi_interop->CreateBitmapRenderTarget(0, fp_dwrite_state->bitmap_render_target_dim.x, fp_dwrite_state->bitmap_render_target_dim.y, &fp_dwrite_state->bitmap_render_target);
|
||||
fp_dwrite_state->bitmap_render_target->SetPixelsPerDip(1.0);
|
||||
error = IDWriteGdiInterop_CreateBitmapRenderTarget(fp_dwrite_state->gdi_interop, 0, fp_dwrite_state->bitmap_render_target_dim.x, fp_dwrite_state->bitmap_render_target_dim.y, &fp_dwrite_state->bitmap_render_target);
|
||||
IDWriteBitmapRenderTarget_SetPixelsPerDip(fp_dwrite_state->bitmap_render_target, 1.0);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
@@ -223,10 +264,10 @@ fp_font_open(String8 path)
|
||||
HRESULT error = 0;
|
||||
|
||||
//- rjf: open font file reference
|
||||
error = fp_dwrite_state->factory->CreateFontFileReference((WCHAR *)path16.str, 0, &font.file);
|
||||
error = IDWriteFactory_CreateFontFileReference(fp_dwrite_state->factory, (WCHAR *)path16.str, 0, &font.file);
|
||||
|
||||
//- rjf: open font face
|
||||
error = fp_dwrite_state->factory->CreateFontFace(DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &font.file, 0, DWRITE_FONT_SIMULATIONS_NONE, &font.face);
|
||||
error = IDWriteFactory_CreateFontFace(fp_dwrite_state->factory, DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &font.file, 0, DWRITE_FONT_SIMULATIONS_NONE, &font.face);
|
||||
|
||||
//- rjf: handlify & return
|
||||
FP_Handle handle = fp_dwrite_handle_from_font(font);
|
||||
@@ -244,10 +285,10 @@ fp_font_open_from_static_data_string(String8 *data_ptr)
|
||||
HRESULT error = 0;
|
||||
|
||||
//- rjf: open font file reference
|
||||
error = fp_dwrite_state->factory->CreateCustomFontFileReference(&data_ptr, sizeof(String8 *), (IDWriteFontFileLoader *)&fp_dwrite_static_data_font_file_loader, &font.file);
|
||||
error = IDWriteFactory_CreateCustomFontFileReference(fp_dwrite_state->factory, &data_ptr, sizeof(String8 *), (IDWriteFontFileLoader *)&fp_dwrite_static_data_font_file_loader, &font.file);
|
||||
|
||||
//- rjf: open font face
|
||||
error = fp_dwrite_state->factory->CreateFontFace(DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &font.file, 0, DWRITE_FONT_SIMULATIONS_NONE, &font.face);
|
||||
error = IDWriteFactory_CreateFontFace(fp_dwrite_state->factory, DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &font.file, 0, DWRITE_FONT_SIMULATIONS_NONE, &font.face);
|
||||
|
||||
//- rjf: handlify & return
|
||||
FP_Handle handle = fp_dwrite_handle_from_font(font);
|
||||
@@ -263,11 +304,11 @@ fp_font_close(FP_Handle handle)
|
||||
FP_DWrite_Font font = fp_dwrite_font_from_handle(handle);
|
||||
if(font.face != 0)
|
||||
{
|
||||
font.face->Release();
|
||||
IDWriteFontFace_Release(font.face);
|
||||
}
|
||||
if(font.file != 0)
|
||||
{
|
||||
font.file->Release();
|
||||
IDWriteFontFile_Release(font.file);
|
||||
}
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -280,7 +321,7 @@ fp_metrics_from_font(FP_Handle handle)
|
||||
DWRITE_FONT_METRICS metrics = {0};
|
||||
if(font.face != 0)
|
||||
{
|
||||
font.face->GetMetrics(&metrics);
|
||||
IDWriteFontFace_GetMetrics(font.face, &metrics);
|
||||
}
|
||||
FP_Metrics result = {0};
|
||||
{
|
||||
@@ -309,7 +350,7 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
DWRITE_FONT_METRICS font_metrics = {0};
|
||||
if(font.face != 0)
|
||||
{
|
||||
font.face->GetMetrics(&font_metrics);
|
||||
IDWriteFontFace_GetMetrics(font.face, &font_metrics);
|
||||
}
|
||||
F32 design_units_per_em = (F32)font_metrics.designUnitsPerEm;
|
||||
|
||||
@@ -317,7 +358,7 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
U16 *glyph_indices = push_array_no_zero(scratch.arena, U16, string32.size);
|
||||
if(font.face != 0)
|
||||
{
|
||||
error = font.face->GetGlyphIndices(string32.str, string32.size, glyph_indices);
|
||||
error = IDWriteFontFace_GetGlyphIndices(font.face, string32.str, string32.size, glyph_indices);
|
||||
}
|
||||
|
||||
//- rjf: get metrics info
|
||||
@@ -325,7 +366,7 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
DWRITE_GLYPH_METRICS *glyphs_metrics = push_array_no_zero(scratch.arena, DWRITE_GLYPH_METRICS, glyphs_count);
|
||||
if(font.face != 0)
|
||||
{
|
||||
error = font.face->GetGdiCompatibleGlyphMetrics((96.f/72.f)*size, 1.f, 0, 1, glyph_indices, glyphs_count, glyphs_metrics, 0);
|
||||
error = IDWriteFontFace_GetGdiCompatibleGlyphMetrics(font.face, (96.f/72.f)*size, 1.f, 0, 1, glyph_indices, glyphs_count, glyphs_metrics, 0);
|
||||
}
|
||||
|
||||
//- rjf: derive info from metrics
|
||||
@@ -352,15 +393,15 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
IDWriteBitmapRenderTarget *render_target = 0;
|
||||
if(font.face != 0)
|
||||
{
|
||||
error = fp_dwrite_state->gdi_interop->CreateBitmapRenderTarget(0, atlas_dim.x, atlas_dim.y, &render_target);
|
||||
render_target->SetPixelsPerDip(1.0);
|
||||
error = IDWriteGdiInterop_CreateBitmapRenderTarget(fp_dwrite_state->gdi_interop, 0, atlas_dim.x, atlas_dim.y, &render_target);
|
||||
IDWriteBitmapRenderTarget_SetPixelsPerDip(render_target, 1.f);
|
||||
}
|
||||
|
||||
//- rjf: get bitmap & clear
|
||||
HDC dc = 0;
|
||||
if(font.face != 0)
|
||||
{
|
||||
dc = render_target->GetMemoryDC();
|
||||
dc = IDWriteBitmapRenderTarget_GetMemoryDC(render_target);
|
||||
HGDIOBJ original = SelectObject(dc, GetStockObject(DC_PEN));
|
||||
SetDCPenColor(dc, bg_color);
|
||||
SelectObject(dc, GetStockObject(DC_BRUSH));
|
||||
@@ -388,7 +429,7 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
RECT bounding_box = {0};
|
||||
if(font.face != 0)
|
||||
{
|
||||
error = render_target->DrawGlyphRun(draw_p.x, draw_p.y,
|
||||
error = IDWriteBitmapRenderTarget_DrawGlyphRun(render_target, draw_p.x, draw_p.y,
|
||||
DWRITE_MEASURING_MODE_NATURAL,
|
||||
&glyph_run,
|
||||
fp_dwrite_state->rendering_params[mode],
|
||||
@@ -411,8 +452,8 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
// rjf: fill basics
|
||||
result.atlas_dim = atlas_dim;
|
||||
result.atlas = push_array_no_zero(arena, U8, atlas_dim.x*atlas_dim.y*4);
|
||||
result.advance = advance;
|
||||
result.height = bounding_box.bottom + 1.f;
|
||||
result.advance = floor_f32(advance);
|
||||
result.bounding_box = r2s16p(bounding_box.left, bounding_box.top, bounding_box.right, bounding_box.bottom);
|
||||
|
||||
// rjf: fill atlas
|
||||
{
|
||||
@@ -446,7 +487,7 @@ fp_raster(Arena *arena, FP_Handle font_handle, F32 size, FP_RasterMode mode, Str
|
||||
result.atlas_dim = v2s16(0, 0);
|
||||
}
|
||||
}
|
||||
render_target->Release();
|
||||
IDWriteBitmapRenderTarget_Release(render_target);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
@@ -1,21 +1,214 @@
|
||||
/* date = November 2nd 2022 11:31 am */
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef FONT_PROVIDER_DWRITE_H
|
||||
#define FONT_PROVIDER_DWRITE_H
|
||||
|
||||
#include <dwrite.h>
|
||||
|
||||
#pragma comment(lib, "gdi32.lib")
|
||||
#pragma comment(lib, "dwrite.lib")
|
||||
|
||||
// #include <dwrite.h>
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: (C) DirectWrite Definitions
|
||||
//
|
||||
// (courtesy of mmozeiko, Martins Mozeiko, https://github.com/mmozeiko/c_d2d_dwrite)
|
||||
//
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
//
|
||||
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
// distribute this software, either in source code form or as a compiled
|
||||
// binary, for any purpose, commercial or non-commercial, and by any
|
||||
// means.
|
||||
//
|
||||
// In jurisdictions that recognize copyright laws, the author or authors
|
||||
// of this software dedicate any and all copyright interest in the
|
||||
// software to the public domain. We make this dedication for the benefit
|
||||
// of the public at large and to the detriment of our heirs and
|
||||
// successors. We intend this dedication to be an overt act of
|
||||
// relinquishment in perpetuity of all present and future rights to this
|
||||
// software under copyright law.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// For more information, please refer to <https://unlicense.org>
|
||||
|
||||
#include <combaseapi.h>
|
||||
#include <dcommon.h>
|
||||
#include <initguid.h>
|
||||
|
||||
//- rjf: enums
|
||||
|
||||
typedef enum DWRITE_FACTORY_TYPE {
|
||||
DWRITE_FACTORY_TYPE_SHARED = 0,
|
||||
DWRITE_FACTORY_TYPE_ISOLATED = 1,
|
||||
} DWRITE_FACTORY_TYPE;
|
||||
|
||||
typedef enum DWRITE_PIXEL_GEOMETRY {
|
||||
DWRITE_PIXEL_GEOMETRY_FLAT = 0,
|
||||
DWRITE_PIXEL_GEOMETRY_RGB = 1,
|
||||
DWRITE_PIXEL_GEOMETRY_BGR = 2,
|
||||
} DWRITE_PIXEL_GEOMETRY;
|
||||
|
||||
typedef enum DWRITE_RENDERING_MODE {
|
||||
DWRITE_RENDERING_MODE_DEFAULT = 0,
|
||||
DWRITE_RENDERING_MODE_ALIASED = 1,
|
||||
DWRITE_RENDERING_MODE_GDI_CLASSIC = 2,
|
||||
DWRITE_RENDERING_MODE_GDI_NATURAL = 3,
|
||||
DWRITE_RENDERING_MODE_NATURAL = 4,
|
||||
DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC = 5,
|
||||
DWRITE_RENDERING_MODE_OUTLINE = 6,
|
||||
DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = 2,
|
||||
DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = 3,
|
||||
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = 4,
|
||||
DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = 5,
|
||||
} DWRITE_RENDERING_MODE;
|
||||
|
||||
typedef enum DWRITE_FONT_SIMULATIONS {
|
||||
DWRITE_FONT_SIMULATIONS_NONE = 0,
|
||||
DWRITE_FONT_SIMULATIONS_BOLD = 1,
|
||||
DWRITE_FONT_SIMULATIONS_OBLIQUE = 2,
|
||||
} DWRITE_FONT_SIMULATIONS;
|
||||
|
||||
typedef enum DWRITE_FONT_FACE_TYPE {
|
||||
DWRITE_FONT_FACE_TYPE_CFF = 0,
|
||||
DWRITE_FONT_FACE_TYPE_TRUETYPE = 1,
|
||||
DWRITE_FONT_FACE_TYPE_OPENTYPE_COLLECTION = 2,
|
||||
DWRITE_FONT_FACE_TYPE_TYPE1 = 3,
|
||||
DWRITE_FONT_FACE_TYPE_VECTOR = 4,
|
||||
DWRITE_FONT_FACE_TYPE_BITMAP = 5,
|
||||
DWRITE_FONT_FACE_TYPE_UNKNOWN = 6,
|
||||
DWRITE_FONT_FACE_TYPE_RAW_CFF = 7,
|
||||
DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION = 2,
|
||||
} DWRITE_FONT_FACE_TYPE;
|
||||
|
||||
typedef enum DWRITE_GRID_FIT_MODE {
|
||||
DWRITE_GRID_FIT_MODE_DEFAULT = 0,
|
||||
DWRITE_GRID_FIT_MODE_DISABLED = 1,
|
||||
DWRITE_GRID_FIT_MODE_ENABLED = 2,
|
||||
} DWRITE_GRID_FIT_MODE;
|
||||
|
||||
//- rjf: interfaces
|
||||
|
||||
typedef struct IDWriteFactory { struct { void* tbl[]; }* v; } IDWriteFactory;
|
||||
typedef struct IDWriteFactory1 { struct { void* tbl[]; }* v; } IDWriteFactory1;
|
||||
typedef struct IDWriteFactory2 { struct { void* tbl[]; }* v; } IDWriteFactory2;
|
||||
typedef struct IDWriteRenderingParams { struct { void* tbl[]; }* v; } IDWriteRenderingParams;
|
||||
typedef struct IDWriteRenderingParams1 { struct { void* tbl[]; }* v; } IDWriteRenderingParams1;
|
||||
typedef struct IDWriteRenderingParams2 { struct { void* tbl[]; }* v; } IDWriteRenderingParams2;
|
||||
typedef struct IDWriteFontFileLoader { struct { void* tbl[]; }* v; } IDWriteFontFileLoader;
|
||||
typedef struct IDWriteFontFileStream { struct { void* tbl[]; }* v; } IDWriteFontFileStream;
|
||||
typedef struct IDWriteFontFile { struct { void* tbl[]; }* v; } IDWriteFontFile;
|
||||
typedef struct IDWriteFontFace { struct { void* tbl[]; }* v; } IDWriteFontFace;
|
||||
typedef struct IDWriteFontFace1 { struct { void* tbl[]; }* v; } IDWriteFontFace1;
|
||||
typedef struct IDWriteFontFace2 { struct { void* tbl[]; }* v; } IDWriteFontFace2;
|
||||
typedef struct IDWriteGdiInterop { struct { void* tbl[]; }* v; } IDWriteGdiInterop;
|
||||
typedef struct IDWriteBitmapRenderTarget { struct { void* tbl[]; }* v; } IDWriteBitmapRenderTarget;
|
||||
typedef struct IDWriteBitmapRenderTarget1 { struct { void* tbl[]; }* v; } IDWriteBitmapRenderTarget1;
|
||||
|
||||
//- rjf: structs
|
||||
|
||||
typedef struct DWRITE_GLYPH_METRICS {
|
||||
INT32 leftSideBearing;
|
||||
UINT32 advanceWidth;
|
||||
INT32 rightSideBearing;
|
||||
INT32 topSideBearing;
|
||||
UINT32 advanceHeight;
|
||||
INT32 bottomSideBearing;
|
||||
INT32 verticalOriginY;
|
||||
} DWRITE_GLYPH_METRICS;
|
||||
|
||||
typedef struct DWRITE_GLYPH_OFFSET {
|
||||
FLOAT advanceOffset;
|
||||
FLOAT ascenderOffset;
|
||||
} DWRITE_GLYPH_OFFSET;
|
||||
|
||||
typedef struct DWRITE_GLYPH_RUN {
|
||||
IDWriteFontFace* fontFace;
|
||||
FLOAT fontEmSize;
|
||||
UINT32 glyphCount;
|
||||
UINT16* glyphIndices;
|
||||
FLOAT* glyphAdvances;
|
||||
DWRITE_GLYPH_OFFSET* glyphOffsets;
|
||||
BOOL isSideways;
|
||||
UINT32 bidiLevel;
|
||||
} DWRITE_GLYPH_RUN;
|
||||
|
||||
typedef struct DWRITE_FONT_METRICS {
|
||||
UINT16 designUnitsPerEm;
|
||||
UINT16 ascent;
|
||||
UINT16 descent;
|
||||
INT16 lineGap;
|
||||
UINT16 capHeight;
|
||||
UINT16 xHeight;
|
||||
INT16 underlinePosition;
|
||||
UINT16 underlineThickness;
|
||||
INT16 strikethroughPosition;
|
||||
UINT16 strikethroughThickness;
|
||||
} DWRITE_FONT_METRICS;
|
||||
|
||||
typedef struct DWRITE_MATRIX {
|
||||
FLOAT m11;
|
||||
FLOAT m12;
|
||||
FLOAT m21;
|
||||
FLOAT m22;
|
||||
FLOAT dx;
|
||||
FLOAT dy;
|
||||
} DWRITE_MATRIX;
|
||||
|
||||
//- rjf: GUIDs
|
||||
|
||||
DEFINE_GUID(IID_IDWriteFactory, 0xb859ee5a, 0xd838, 0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48);
|
||||
DEFINE_GUID(IID_IDWriteFactory1, 0x30572f99, 0xdac6, 0x41db, 0xa1, 0x6e, 0x04, 0x86, 0x30, 0x7e, 0x60, 0x6a);
|
||||
DEFINE_GUID(IID_IDWriteFactory2, 0x0439fc60, 0xca44, 0x4994, 0x8d, 0xee, 0x3a, 0x9a, 0xf7, 0xb7, 0x32, 0xec);
|
||||
|
||||
//- rjf: functions
|
||||
|
||||
EXTERN_C HRESULT DECLSPEC_IMPORT WINAPI DWriteCreateFactory (DWRITE_FACTORY_TYPE factoryType, const GUID* iid, void** factory);
|
||||
|
||||
//- rjf: methods
|
||||
|
||||
static inline HRESULT IDWriteFactory_RegisterFontFileLoader (IDWriteFactory* this_, IDWriteFontFileLoader* fontFileLoader) { return ((HRESULT (WINAPI*)(IDWriteFactory*, IDWriteFontFileLoader*))this_->v->tbl[13])(this_, fontFileLoader); }
|
||||
static inline HRESULT IDWriteFactory_CreateRenderingParams (IDWriteFactory* this_, IDWriteRenderingParams** renderingParams) { return ((HRESULT (WINAPI*)(IDWriteFactory*, IDWriteRenderingParams**))this_->v->tbl[10])(this_, renderingParams); }
|
||||
static inline HRESULT IDWriteFactory_CreateCustomRenderingParams (IDWriteFactory* this_, FLOAT gamma, FLOAT enhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, DWRITE_RENDERING_MODE renderingMode, IDWriteRenderingParams** renderingParams) { return ((HRESULT (WINAPI*)(IDWriteFactory*, FLOAT, FLOAT, FLOAT, DWRITE_PIXEL_GEOMETRY, DWRITE_RENDERING_MODE, IDWriteRenderingParams**))this_->v->tbl[12])(this_, gamma, enhancedContrast, clearTypeLevel, pixelGeometry, renderingMode, renderingParams); }
|
||||
static inline HRESULT IDWriteFactory_GetGdiInterop (IDWriteFactory* this_, IDWriteGdiInterop** gdiInterop) { return ((HRESULT (WINAPI*)(IDWriteFactory*, IDWriteGdiInterop**))this_->v->tbl[17])(this_, gdiInterop); }
|
||||
static inline HRESULT IDWriteFactory_CreateCustomFontFileReference (IDWriteFactory* this_, const void* fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileLoader* fontFileLoader, IDWriteFontFile** fontFile) { return ((HRESULT (WINAPI*)(IDWriteFactory*, const void*, UINT32, IDWriteFontFileLoader*, IDWriteFontFile**))this_->v->tbl[8])(this_, fontFileReferenceKey, fontFileReferenceKeySize, fontFileLoader, fontFile); }
|
||||
static inline HRESULT IDWriteFactory_CreateFontFileReference (IDWriteFactory* this_, const WCHAR* filePath, const FILETIME* lastWriteTime, IDWriteFontFile** fontFile) { return ((HRESULT (WINAPI*)(IDWriteFactory*, const WCHAR*, const FILETIME*, IDWriteFontFile**))this_->v->tbl[7])(this_, filePath, lastWriteTime, fontFile); }
|
||||
static inline HRESULT IDWriteFactory_CreateFontFace (IDWriteFactory* this_, DWRITE_FONT_FACE_TYPE fontFaceType, UINT32 numberOfFiles, IDWriteFontFile** fontFiles, UINT32 faceIndex, DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, IDWriteFontFace** fontFace) { return ((HRESULT (WINAPI*)(IDWriteFactory*, DWRITE_FONT_FACE_TYPE, UINT32, IDWriteFontFile**, UINT32, DWRITE_FONT_SIMULATIONS, IDWriteFontFace**))this_->v->tbl[9])(this_, fontFaceType, numberOfFiles, fontFiles, faceIndex, fontFaceSimulationFlags, fontFace); }
|
||||
static inline HRESULT IDWriteFactory2_CreateCustomRenderingParams2 (IDWriteFactory2* this, FLOAT gamma, FLOAT enhancedContrast, FLOAT grayscaleEnhancedContrast, FLOAT clearTypeLevel, DWRITE_PIXEL_GEOMETRY pixelGeometry, DWRITE_RENDERING_MODE renderingMode, DWRITE_GRID_FIT_MODE gridFitMode, IDWriteRenderingParams2** renderingParams) { return ((HRESULT (WINAPI*)(IDWriteFactory2*, FLOAT, FLOAT, FLOAT, FLOAT, DWRITE_PIXEL_GEOMETRY, DWRITE_RENDERING_MODE, DWRITE_GRID_FIT_MODE, IDWriteRenderingParams2**))this->v->tbl[29])(this, gamma, enhancedContrast, grayscaleEnhancedContrast, clearTypeLevel, pixelGeometry, renderingMode, gridFitMode, renderingParams); }
|
||||
static inline FLOAT IDWriteRenderingParams_GetEnhancedContrast (IDWriteRenderingParams* this_) { return ((FLOAT (WINAPI*)(IDWriteRenderingParams*))this_->v->tbl[4])(this_); }
|
||||
static inline FLOAT IDWriteRenderingParams_GetGamma (IDWriteRenderingParams* this_) { return ((FLOAT (WINAPI*)(IDWriteRenderingParams*))this_->v->tbl[3])(this_); }
|
||||
static inline HRESULT IDWriteGdiInterop_CreateBitmapRenderTarget (IDWriteGdiInterop* this_, HDC hdc, UINT32 width, UINT32 height, IDWriteBitmapRenderTarget** renderTarget) { return ((HRESULT (WINAPI*)(IDWriteGdiInterop*, HDC, UINT32, UINT32, IDWriteBitmapRenderTarget**))this_->v->tbl[7])(this_, hdc, width, height, renderTarget); }
|
||||
static inline HRESULT IDWriteBitmapRenderTarget_SetPixelsPerDip (IDWriteBitmapRenderTarget* this_, FLOAT pixelsPerDip) { return ((HRESULT (WINAPI*)(IDWriteBitmapRenderTarget*, FLOAT))this_->v->tbl[6])(this_, pixelsPerDip); }
|
||||
static inline HDC IDWriteBitmapRenderTarget_GetMemoryDC (IDWriteBitmapRenderTarget* this_) { return ((HDC (WINAPI*)(IDWriteBitmapRenderTarget*))this_->v->tbl[4])(this_); }
|
||||
static inline HRESULT IDWriteBitmapRenderTarget_DrawGlyphRun (IDWriteBitmapRenderTarget* this_, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE measuringMode, const DWRITE_GLYPH_RUN* glyphRun, IDWriteRenderingParams* renderingParams, COLORREF textColor, RECT* blackBoxRect) { return ((HRESULT (WINAPI*)(IDWriteBitmapRenderTarget*, FLOAT, FLOAT, DWRITE_MEASURING_MODE, const DWRITE_GLYPH_RUN*, IDWriteRenderingParams*, COLORREF, RECT*))this_->v->tbl[3])(this_, baselineOriginX, baselineOriginY, measuringMode, glyphRun, renderingParams, textColor, blackBoxRect); }
|
||||
static inline UINT32 IDWriteFontFace_Release (IDWriteFontFace* this_) { return ((UINT32 (WINAPI*)(IDWriteFontFace*))this_->v->tbl[2])(this_); }
|
||||
static inline void IDWriteFontFace_GetMetrics (IDWriteFontFace* this_, DWRITE_FONT_METRICS* fontFaceMetrics) { ((void (WINAPI*)(IDWriteFontFace*, DWRITE_FONT_METRICS*))this_->v->tbl[8])(this_, fontFaceMetrics); }
|
||||
static inline UINT32 IDWriteFontFile_Release (IDWriteFontFile* this_) { return ((UINT32 (WINAPI*)(IDWriteFontFile*))this_->v->tbl[2])(this_); }
|
||||
static inline HRESULT IDWriteFontFace_GetGlyphIndices (IDWriteFontFace* this_, const UINT32* codePoints, UINT32 codePointCount, UINT16* glyphIndices) { return ((HRESULT (WINAPI*)(IDWriteFontFace*, const UINT32*, UINT32, UINT16*))this_->v->tbl[11])(this_, codePoints, codePointCount, glyphIndices); }
|
||||
static inline HRESULT IDWriteFontFace_GetGdiCompatibleGlyphMetrics (IDWriteFontFace* this_, FLOAT emSize, FLOAT pixelsPerDip, const DWRITE_MATRIX* transform, BOOL useGdiNatural, const UINT16* glyphIndices, UINT32 glyphCount, DWRITE_GLYPH_METRICS* glyphMetrics, BOOL isSideways) { return ((HRESULT (WINAPI*)(IDWriteFontFace*, FLOAT, FLOAT, const DWRITE_MATRIX*, BOOL, const UINT16*, UINT32, DWRITE_GLYPH_METRICS*, BOOL))this_->v->tbl[17])(this_, emSize, pixelsPerDip, transform, useGdiNatural, glyphIndices, glyphCount, glyphMetrics, isSideways); }
|
||||
static inline UINT32 IDWriteBitmapRenderTarget_Release (IDWriteBitmapRenderTarget* this_) { return ((UINT32 (WINAPI*)(IDWriteBitmapRenderTarget*))this_->v->tbl[2])(this_); }
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Font Provider Implementation Types
|
||||
|
||||
//- rjf: font file loader interface types
|
||||
|
||||
typedef struct FP_DWrite_FontFileLoader FP_DWrite_FontFileLoader;
|
||||
typedef struct FP_DWrite_FontFileLoaderVTable FP_DWrite_FontFileLoaderVTable;
|
||||
|
||||
struct FP_DWrite_FontFileLoaderVTable
|
||||
{
|
||||
HRESULT (*QueryInterface)(void *obj, REFIID riid, void *ptr_to_object);
|
||||
ULONG (*AddRef)(void *obj);
|
||||
ULONG (*Release)(void *obj);
|
||||
HRESULT (*CreateStreamFromKey)(struct FP_DWrite_FontFileLoader *loader, void const *font_file_ref_key, UINT32 font_file_ref_key_size, IDWriteFontFileStream **stream_out);
|
||||
HRESULT (*CreateStreamFromKey)(FP_DWrite_FontFileLoader *loader, void const *font_file_ref_key, UINT32 font_file_ref_key_size, IDWriteFontFileStream **stream_out);
|
||||
};
|
||||
|
||||
struct FP_DWrite_FontFileLoader
|
||||
@@ -25,15 +218,19 @@ struct FP_DWrite_FontFileLoader
|
||||
|
||||
//- rjf: font file stream interface types
|
||||
|
||||
typedef struct FP_DWrite_FontFileStream FP_DWrite_FontFileStream;
|
||||
typedef struct FP_DWrite_FontFileStreamVTable FP_DWrite_FontFileStreamVTable;
|
||||
typedef struct FP_DWrite_FontFileStreamNode FP_DWrite_FontFileStreamNode;
|
||||
|
||||
struct FP_DWrite_FontFileStreamVTable
|
||||
{
|
||||
HRESULT (*QueryInterface)(void *obj, REFIID riid, void *ptr_to_object);
|
||||
ULONG (*AddRef)(void *obj);
|
||||
ULONG (*Release)(void *obj);
|
||||
HRESULT (*ReadFileFragment)(struct FP_DWrite_FontFileStream *obj, void const **fragment_start, UINT64 file_offset, UINT64 fragment_size, void **fragment_context);
|
||||
HRESULT (*ReleaseFileFragment)(struct FP_DWrite_FontFileStream *obj, void *fragment_context);
|
||||
HRESULT (*GetFileSize)(struct FP_DWrite_FontFileStream *obj, UINT64 *size_out);
|
||||
HRESULT (*GetLastWriteTime)(struct FP_DWrite_FontFileStream *obj, UINT64 *time_out);
|
||||
HRESULT (*ReadFileFragment)(FP_DWrite_FontFileStream *obj, void const **fragment_start, UINT64 file_offset, UINT64 fragment_size, void **fragment_context);
|
||||
HRESULT (*ReleaseFileFragment)(FP_DWrite_FontFileStream *obj, void *fragment_context);
|
||||
HRESULT (*GetFileSize)(FP_DWrite_FontFileStream *obj, UINT64 *size_out);
|
||||
HRESULT (*GetLastWriteTime)(FP_DWrite_FontFileStream *obj, UINT64 *time_out);
|
||||
};
|
||||
|
||||
struct FP_DWrite_FontFileStream
|
||||
@@ -51,9 +248,11 @@ struct FP_DWrite_FontFileStreamNode
|
||||
|
||||
//- rjf: state & underlying handle types
|
||||
|
||||
typedef struct FP_DWrite_State FP_DWrite_State;
|
||||
struct FP_DWrite_State
|
||||
{
|
||||
Arena *arena;
|
||||
B32 dwrite2_is_supported;
|
||||
IDWriteFactory *factory;
|
||||
IDWriteRenderingParams *base_rendering_params;
|
||||
IDWriteRenderingParams *rendering_params[FP_RasterMode_COUNT];
|
||||
@@ -65,6 +264,7 @@ struct FP_DWrite_State
|
||||
FP_DWrite_FontFileStreamNode *free_stream_node;
|
||||
};
|
||||
|
||||
typedef struct FP_DWrite_Font FP_DWrite_Font;
|
||||
struct FP_DWrite_Font
|
||||
{
|
||||
IDWriteFontFile *file;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#define BUILD_SUPPLEMENTARY_UNIT 1
|
||||
|
||||
#include "base/base_inc.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "font_provider/font_provider.h"
|
||||
|
||||
#include "font_provider_dwrite.h"
|
||||
#include "font_provider_dwrite.cpp"
|
||||
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "font_provider/font_provider.c"
|
||||
@@ -39,7 +39,7 @@ struct FP_RasterResult
|
||||
Vec2S16 atlas_dim;
|
||||
void *atlas;
|
||||
F32 advance;
|
||||
S16 height;
|
||||
Rng2S16 bounding_box;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
|
||||
#include "font_provider.c"
|
||||
|
||||
#if LANG_CPP
|
||||
# if FP_BACKEND == FP_BACKEND_DWRITE
|
||||
# include "dwrite/font_provider_dwrite.cpp"
|
||||
# else
|
||||
#if FP_BACKEND == FP_BACKEND_DWRITE
|
||||
# include "dwrite/font_provider_dwrite.c"
|
||||
#else
|
||||
# error Font provider backend not specified.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Backend Includes
|
||||
|
||||
#if LANG_CPP
|
||||
# if FP_BACKEND == FP_BACKEND_DWRITE
|
||||
#if FP_BACKEND == FP_BACKEND_DWRITE
|
||||
# include "dwrite/font_provider_dwrite.h"
|
||||
# else
|
||||
#else
|
||||
# error Font provider backend not specified.
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // FONT_PROVIDER_INC_H
|
||||
|
||||
@@ -52,29 +52,29 @@ fzy_item_string_from_rdi_target_element_idx(RDI_Parsed *rdi, FZY_Target target,
|
||||
// NOTE(rjf): no default - warn if we miss a case
|
||||
case FZY_Target_Procedures:
|
||||
{
|
||||
RDI_Procedure *proc = rdi_element_from_idx(rdi, procedures, element_idx);
|
||||
RDI_Procedure *proc = rdi_element_from_name_idx(rdi, Procedures, element_idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_base = rdi_string_from_idx(rdi, proc->name_string_idx, &name_size);
|
||||
result = str8(name_base, name_size);
|
||||
}break;
|
||||
case FZY_Target_GlobalVariables:
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_idx(rdi, global_variables, element_idx);
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(rdi, GlobalVariables, element_idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_base = rdi_string_from_idx(rdi, gvar->name_string_idx, &name_size);
|
||||
result = str8(name_base, name_size);
|
||||
}break;
|
||||
case FZY_Target_ThreadVariables:
|
||||
{
|
||||
RDI_ThreadVariable *tvar = rdi_element_from_idx(rdi, thread_variables, element_idx);
|
||||
RDI_ThreadVariable *tvar = rdi_element_from_name_idx(rdi, ThreadVariables, element_idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_base = rdi_string_from_idx(rdi, tvar->name_string_idx, &name_size);
|
||||
result = str8(name_base, name_size);
|
||||
}break;
|
||||
case FZY_Target_UDTs:
|
||||
{
|
||||
RDI_UDT *udt = rdi_element_from_idx(rdi, udts, element_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_idx(rdi, type_nodes, udt->self_type_idx);
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, element_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_base = rdi_string_from_idx(rdi, type_node->user_defined.name_string_idx, &name_size);
|
||||
result = str8(name_base, name_size);
|
||||
@@ -407,10 +407,8 @@ fzy_search_thread__entry_point(void *p)
|
||||
////////////////////////////
|
||||
//- rjf: search target -> info about search space
|
||||
//
|
||||
U64 table_ptr_off = 0;
|
||||
U64 table_count_off = 0;
|
||||
RDI_SectionKind section_kind = RDI_SectionKind_NULL;
|
||||
U64 element_name_idx_off = 0;
|
||||
U64 element_size = 0;
|
||||
if(task_is_good)
|
||||
{
|
||||
switch(params.target)
|
||||
@@ -419,30 +417,22 @@ fzy_search_thread__entry_point(void *p)
|
||||
case FZY_Target_COUNT:{}break;
|
||||
case FZY_Target_Procedures:
|
||||
{
|
||||
table_ptr_off = OffsetOf(RDI_Parsed, procedures);
|
||||
table_count_off = OffsetOf(RDI_Parsed, procedures_count);
|
||||
section_kind = RDI_SectionKind_Procedures;
|
||||
element_name_idx_off = OffsetOf(RDI_Procedure, name_string_idx);
|
||||
element_size = sizeof(RDI_Procedure);
|
||||
}break;
|
||||
case FZY_Target_GlobalVariables:
|
||||
{
|
||||
table_ptr_off = OffsetOf(RDI_Parsed, global_variables);
|
||||
table_count_off = OffsetOf(RDI_Parsed, global_variables_count);
|
||||
section_kind = RDI_SectionKind_GlobalVariables;
|
||||
element_name_idx_off = OffsetOf(RDI_GlobalVariable, name_string_idx);
|
||||
element_size = sizeof(RDI_GlobalVariable);
|
||||
}break;
|
||||
case FZY_Target_ThreadVariables:
|
||||
{
|
||||
table_ptr_off = OffsetOf(RDI_Parsed, thread_variables);
|
||||
table_count_off = OffsetOf(RDI_Parsed, thread_variables_count);
|
||||
section_kind = RDI_SectionKind_ThreadVariables;
|
||||
element_name_idx_off = OffsetOf(RDI_ThreadVariable, name_string_idx);
|
||||
element_size = sizeof(RDI_ThreadVariable);
|
||||
}break;
|
||||
case FZY_Target_UDTs:
|
||||
{
|
||||
table_ptr_off = OffsetOf(RDI_Parsed, udts);
|
||||
table_count_off = OffsetOf(RDI_Parsed, udts_count);
|
||||
element_size = sizeof(RDI_UDT);
|
||||
section_kind = RDI_SectionKind_UDTs;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -457,16 +447,17 @@ fzy_search_thread__entry_point(void *p)
|
||||
for(U64 rdi_idx = 0; rdi_idx < rdis_count; rdi_idx += 1)
|
||||
{
|
||||
RDI_Parsed *rdi = rdis[rdi_idx];
|
||||
void *table_base = (U8*)rdi + table_ptr_off;
|
||||
U64 element_count = *MemberFromOffset(U64 *, rdi, table_count_off);
|
||||
U64 element_count = 0;
|
||||
void *table_base = rdi_section_raw_table_from_kind(rdi, section_kind, &element_count);
|
||||
U64 element_size = rdi_section_element_size_table[section_kind];
|
||||
for(U64 idx = 1; task_is_good && idx < element_count; idx += 1)
|
||||
{
|
||||
void *element = (U8 *)(*(void **)table_base) + element_size*idx;
|
||||
void *element = (U8 *)table_base + element_size*idx;
|
||||
U32 *name_idx_ptr = (U32 *)((U8 *)element + element_name_idx_off);
|
||||
if(params.target == FZY_Target_UDTs)
|
||||
{
|
||||
RDI_UDT *udt = (RDI_UDT *)element;
|
||||
RDI_TypeNode *type_node = rdi_element_from_idx(rdi, type_nodes, udt->self_type_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
||||
name_idx_ptr = &type_node->user_defined.name_string_idx;
|
||||
}
|
||||
U32 name_idx = *name_idx_ptr;
|
||||
@@ -526,7 +517,7 @@ fzy_search_thread__entry_point(void *p)
|
||||
//- rjf: sort item array
|
||||
if(items.count != 0 && query.size != 0)
|
||||
{
|
||||
qsort(items.v, items.count, sizeof(FZY_Item), (int (*)(const void *, const void *))fzy_qsort_compare_items);
|
||||
quick_sort(items.v, items.count, sizeof(FZY_Item), fzy_qsort_compare_items);
|
||||
}
|
||||
|
||||
//- rjf: commit to cache - busyloop on scope touches
|
||||
|
||||
@@ -301,7 +301,7 @@ geo_xfer_thread__entry_point(void *p)
|
||||
R_Handle buffer = {0};
|
||||
if(got_task && data.size != 0)
|
||||
{
|
||||
buffer = r_buffer_alloc(R_BufferKind_Static, data.size, data.str);
|
||||
buffer = r_buffer_alloc(R_ResourceKind_Static, data.size, data.str);
|
||||
}
|
||||
|
||||
//- rjf: commit results to cache
|
||||
|
||||
@@ -14,7 +14,10 @@ internal U128
|
||||
hs_hash_from_data(String8 data)
|
||||
{
|
||||
U128 u128 = {0};
|
||||
if(data.size != 0)
|
||||
{
|
||||
blake2b((U8 *)&u128.u64[0], sizeof(u128), data.str, data.size, 0, 0);
|
||||
}
|
||||
return u128;
|
||||
}
|
||||
|
||||
|
||||
+237
-56
@@ -1,85 +1,256 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
// Functions
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ RAD Debug Info, (R)AD(D)BG(I) Format Library
|
||||
//
|
||||
// Defines standard RDI debug information format types and
|
||||
// functions.
|
||||
|
||||
#ifndef RDI_FORMAT_C
|
||||
#define RDI_FORMAT_C
|
||||
|
||||
RDI_U16 rdi_section_element_size_table[37] =
|
||||
{
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_TopLevelInfo),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_BinarySection),
|
||||
sizeof(RDI_FilePathNode),
|
||||
sizeof(RDI_SourceFile),
|
||||
sizeof(RDI_LineTable),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_Line),
|
||||
sizeof(RDI_Column),
|
||||
sizeof(RDI_SourceLineMap),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_Unit),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_TypeNode),
|
||||
sizeof(RDI_UDT),
|
||||
sizeof(RDI_Member),
|
||||
sizeof(RDI_EnumMember),
|
||||
sizeof(RDI_GlobalVariable),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_ThreadVariable),
|
||||
sizeof(RDI_Procedure),
|
||||
sizeof(RDI_Scope),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_InlineSite),
|
||||
sizeof(RDI_Local),
|
||||
sizeof(RDI_LocationBlock),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_NameMap),
|
||||
sizeof(RDI_NameMapBucket),
|
||||
sizeof(RDI_NameMapNode),
|
||||
sizeof(RDI_U8),
|
||||
};
|
||||
|
||||
RDI_U8 rdi_section_is_required_table[37] =
|
||||
{
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
RDI_U8 rdi_eval_op_ctrlbits_table[45] =
|
||||
{
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 0),
|
||||
RDI_EVAL_CTRLBITS(1, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(4, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(0, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(4, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(4, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(1, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(2, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(4, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(8, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 2, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(2, 1, 1),
|
||||
RDI_EVAL_CTRLBITS(1, 0, 1),
|
||||
RDI_EVAL_CTRLBITS(0, 1, 0),
|
||||
RDI_EVAL_CTRLBITS(1, 0, 0),
|
||||
RDI_EVAL_CTRLBITS(0, 0, 0),
|
||||
};
|
||||
|
||||
struct {RDI_EvalConversionKind dst_typegroups[RDI_EvalTypeGroup_COUNT];} rdi_eval_typegroup_conversion_kind_matrix[6] =
|
||||
{
|
||||
{{RDI_EvalConversionKind_OtherToOther, RDI_EvalConversionKind_FromOther, RDI_EvalConversionKind_FromOther, RDI_EvalConversionKind_FromOther, RDI_EvalConversionKind_FromOther}},
|
||||
{{RDI_EvalConversionKind_ToOther, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Legal}},
|
||||
{{RDI_EvalConversionKind_ToOther, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Legal}},
|
||||
{{RDI_EvalConversionKind_ToOther, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Legal}},
|
||||
{{RDI_EvalConversionKind_ToOther, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Legal, RDI_EvalConversionKind_Noop}},
|
||||
{{RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop, RDI_EvalConversionKind_Noop}},
|
||||
};
|
||||
|
||||
struct {RDI_U8 *str; RDI_U64 size;} rdi_eval_conversion_kind_message_string_table[6] =
|
||||
{
|
||||
{(RDI_U8 *)"Other", sizeof("Other")},
|
||||
{(RDI_U8 *)"U", sizeof("U")},
|
||||
{(RDI_U8 *)"S", sizeof("S")},
|
||||
{(RDI_U8 *)"F32", sizeof("F32")},
|
||||
{(RDI_U8 *)"F64", sizeof("F64")},
|
||||
{(RDI_U8 *)"COUNT", sizeof("COUNT")},
|
||||
};
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_hash(RDI_U8 *ptr, RDI_U64 size){
|
||||
rdi_hash(RDI_U8 *ptr, RDI_U64 size)
|
||||
{
|
||||
RDI_U64 result = 5381;
|
||||
RDI_U8 *opl = ptr + size;
|
||||
for (; ptr < opl; ptr += 1){
|
||||
for(;ptr < opl; ptr += 1)
|
||||
{
|
||||
result = ((result << 5) + result) + *ptr;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U32
|
||||
rdi_size_from_basic_type_kind(RDI_TypeKind kind){
|
||||
RDI_U32 result = 0;
|
||||
switch (kind){
|
||||
#define X(N,C)
|
||||
#define XZ(N,C,Z) case C: result = Z; break;
|
||||
#define Y(A,N)
|
||||
RDI_TypeKindXList(X,XZ,Y)
|
||||
#undef X
|
||||
#undef XZ
|
||||
#undef Y
|
||||
}
|
||||
return(result);
|
||||
rdi_size_from_basic_type_kind(RDI_TypeKind kind)
|
||||
{
|
||||
RDI_U32 result = 0;
|
||||
switch(kind)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_TypeKind_Handle:{result = 0xFFFFFFFF;}break;
|
||||
case RDI_TypeKind_Char8:{result = 1;}break;
|
||||
case RDI_TypeKind_Char16:{result = 2;}break;
|
||||
case RDI_TypeKind_Char32:{result = 4;}break;
|
||||
case RDI_TypeKind_UChar8:{result = 1;}break;
|
||||
case RDI_TypeKind_UChar16:{result = 2;}break;
|
||||
case RDI_TypeKind_UChar32:{result = 4;}break;
|
||||
case RDI_TypeKind_U8:{result = 1;}break;
|
||||
case RDI_TypeKind_U16:{result = 2;}break;
|
||||
case RDI_TypeKind_U32:{result = 4;}break;
|
||||
case RDI_TypeKind_U64:{result = 8;}break;
|
||||
case RDI_TypeKind_U128:{result = 16;}break;
|
||||
case RDI_TypeKind_U256:{result = 32;}break;
|
||||
case RDI_TypeKind_U512:{result = 64;}break;
|
||||
case RDI_TypeKind_S8:{result = 1;}break;
|
||||
case RDI_TypeKind_S16:{result = 2;}break;
|
||||
case RDI_TypeKind_S32:{result = 4;}break;
|
||||
case RDI_TypeKind_S64:{result = 8;}break;
|
||||
case RDI_TypeKind_S128:{result = 16;}break;
|
||||
case RDI_TypeKind_S256:{result = 32;}break;
|
||||
case RDI_TypeKind_S512:{result = 64;}break;
|
||||
case RDI_TypeKind_Bool:{result = 1;}break;
|
||||
case RDI_TypeKind_F16:{result = 2;}break;
|
||||
case RDI_TypeKind_F32:{result = 4;}break;
|
||||
case RDI_TypeKind_F32PP:{result = 4;}break;
|
||||
case RDI_TypeKind_F48:{result = 6;}break;
|
||||
case RDI_TypeKind_F64:{result = 8;}break;
|
||||
case RDI_TypeKind_F80:{result = 10;}break;
|
||||
case RDI_TypeKind_F128:{result = 16;}break;
|
||||
case RDI_TypeKind_ComplexF32:{result = 8;}break;
|
||||
case RDI_TypeKind_ComplexF64:{result = 16;}break;
|
||||
case RDI_TypeKind_ComplexF80:{result = 20;}break;
|
||||
case RDI_TypeKind_ComplexF128:{result = 32;}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U32
|
||||
rdi_addr_size_from_arch(RDI_Arch arch){
|
||||
RDI_U32 result = 0;
|
||||
switch (arch){
|
||||
#define X(N,C,Z) case C: result = Z; break;
|
||||
RDI_ArchXList(X)
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
rdi_addr_size_from_arch(RDI_Arch arch)
|
||||
{
|
||||
RDI_U32 result = 0;
|
||||
switch(arch)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_Arch_X86:{result = 4;}break;
|
||||
case RDI_Arch_X64:{result = 8;}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- eval helpers
|
||||
|
||||
RDI_PROC RDI_EvalConversionKind
|
||||
rdi_eval_conversion_rule(RDI_EvalTypeGroup in, RDI_EvalTypeGroup out){
|
||||
RDI_EvalConversionKind result = 0;
|
||||
switch (in + (out << 8)){
|
||||
#define Y(i,o) case ((RDI_EvalTypeGroup_##i) + ((RDI_EvalTypeGroup_##o) << 8)):
|
||||
#define Xb(c)
|
||||
#define Xe(c) result = RDI_EvalConversionKind_##c; break;
|
||||
RDI_EvalConversionKindFromTypeGroupPairMap(Y,Xb,Xe)
|
||||
#undef Xe
|
||||
#undef Xb
|
||||
#undef Y
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U8*
|
||||
rdi_eval_conversion_message(RDI_EvalConversionKind conversion_kind, RDI_U64 *lenout){
|
||||
RDI_U8 *result = 0;
|
||||
switch (conversion_kind){
|
||||
#define X(N,msg) \
|
||||
case RDI_EvalConversionKind_##N: result = (RDI_U8*)msg; *lenout = sizeof(msg) - 1; break;
|
||||
RDI_EvalConversionKindXList(X)
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
rdi_eval_conversion_kind_from_typegroups(RDI_EvalTypeGroup in, RDI_EvalTypeGroup out)
|
||||
{
|
||||
RDI_EvalConversionKind k = rdi_eval_typegroup_conversion_kind_matrix[in].dst_typegroups[out];
|
||||
return k;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_S32
|
||||
rdi_eval_opcode_type_compatible(RDI_EvalOp op, RDI_EvalTypeGroup group){
|
||||
rdi_eval_op_typegroup_are_compatible(RDI_EvalOp op, RDI_EvalTypeGroup group)
|
||||
{
|
||||
RDI_S32 result = 0;
|
||||
switch (op){
|
||||
switch(op)
|
||||
{
|
||||
case RDI_EvalOp_Neg: case RDI_EvalOp_Add: case RDI_EvalOp_Sub:
|
||||
case RDI_EvalOp_Mul: case RDI_EvalOp_Div:
|
||||
case RDI_EvalOp_EqEq:case RDI_EvalOp_NtEq:
|
||||
case RDI_EvalOp_LsEq:case RDI_EvalOp_GrEq:
|
||||
case RDI_EvalOp_Less:case RDI_EvalOp_Grtr:
|
||||
{
|
||||
if (group != RDI_EvalTypeGroup_Other){
|
||||
if(group != RDI_EvalTypeGroup_Other)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
}break;
|
||||
@@ -88,10 +259,20 @@ rdi_eval_opcode_type_compatible(RDI_EvalOp op, RDI_EvalTypeGroup group){
|
||||
case RDI_EvalOp_BitOr:case RDI_EvalOp_LogNot:case RDI_EvalOp_LogAnd:
|
||||
case RDI_EvalOp_LogOr:
|
||||
{
|
||||
if (group == RDI_EvalTypeGroup_S || group == RDI_EvalTypeGroup_U){
|
||||
if(group == RDI_EvalTypeGroup_S || group == RDI_EvalTypeGroup_U)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U8 *
|
||||
rdi_explanation_string_from_eval_conversion_kind(RDI_EvalConversionKind kind, RDI_U64 *size_out)
|
||||
{
|
||||
*size_out = rdi_eval_conversion_kind_message_string_table[kind].size;
|
||||
return rdi_eval_conversion_kind_message_string_table[kind].str;
|
||||
}
|
||||
|
||||
#endif // RDI_FORMAT_C
|
||||
|
||||
+1224
-815
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,105 +1,85 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef RDI_PARSE_H
|
||||
#define RDI_PARSE_H
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ RAD Debug Info, (R)AD(D)BG(I) Format Parsing Library
|
||||
//
|
||||
// Defines helper types and functions for extracting data from
|
||||
// RDI files.
|
||||
|
||||
////////////////////////////////
|
||||
//~ RADDBG Parsing Helpers
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Usage Samples
|
||||
//
|
||||
#if 0
|
||||
// Procedure Name -> Line
|
||||
{
|
||||
RDI_Parsed *rdi = ...;
|
||||
char *name = "mule_main";
|
||||
RDI_Procedure *procedure = rdi_procedure_from_name_cstr(rdi, name); // 1. name -> procedure
|
||||
RDI_U64 procedure_first_voff = rdi_first_voff_from_procedure(rdi, procedure); // 2. procedure -> virtual offset
|
||||
RDI_Line line = rdi_line_from_voff(rdi, procedure_first_voff); // 3. virtual offset -> line
|
||||
RDI_SourceFile *file = rdi_source_file_from_line(rdi, &line); // 4. line -> source file
|
||||
RDI_U64 file_path_size = 0; // 5. source file -> path
|
||||
RDI_U8 *file_path = rdi_normal_path_from_source_file(rdi, file, &file_path_size);
|
||||
printf("%s is at %.*s:%u\n", name, (int)file_path_size, file_path, line.line_num);
|
||||
}
|
||||
|
||||
typedef struct RDI_Parsed{
|
||||
// raw data & data sections (part 1)
|
||||
RDI_U8 *raw_data;
|
||||
RDI_U64 raw_data_size;
|
||||
RDI_DataSection *dsecs;
|
||||
RDI_U64 dsec_count;
|
||||
RDI_U32 dsec_idx[RDI_DataSectionTag_PRIMARY_COUNT];
|
||||
// Line -> Procedure Name
|
||||
{
|
||||
RDI_Parsed *rdi = ...;
|
||||
char *path = "c:/devel/raddebugger/src/mule/mule_main.cpp";
|
||||
RDI_U32 line_num = 2557;
|
||||
RDI_SourceFile *file = rdi_source_file_from_normal_path_cstr(rdi, path); // 1. path -> source file
|
||||
RDI_U64 voff = rdi_first_voff_from_source_file_line_num(rdi, file, line_num); // 2. (source file, line) -> virtual offset
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff); // 3. virtual offset -> procedure
|
||||
RDI_U64 name_size = 0; // 4. procedure -> name
|
||||
RDI_U8 *name = rdi_name_from_procedure(rdi, procedure, &name_size);
|
||||
printf("%s:%u is inside %.*s\n", path, line_num, (int)name_size, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
// primary data structures (part 2)
|
||||
#ifndef RDI_FORMAT_PARSE_H
|
||||
#define RDI_FORMAT_PARSE_H
|
||||
|
||||
// handled by helper APIs
|
||||
RDI_U8* string_data;
|
||||
RDI_U64 string_data_size;
|
||||
RDI_U32* string_offs;
|
||||
RDI_U64 string_count;
|
||||
RDI_U32* idx_run_data;
|
||||
RDI_U32 idx_run_count;
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Parsed Information Types
|
||||
|
||||
// directly readable by users
|
||||
// (any of these may be empty and null even in a successful parse)
|
||||
RDI_TopLevelInfo* top_level_info;
|
||||
|
||||
RDI_BinarySection* binary_sections;
|
||||
RDI_U64 binary_sections_count;
|
||||
RDI_FilePathNode* file_paths;
|
||||
RDI_U64 file_paths_count;
|
||||
RDI_SourceFile* source_files;
|
||||
RDI_U64 source_files_count;
|
||||
RDI_Unit* units;
|
||||
RDI_U64 units_count;
|
||||
RDI_VMapEntry* unit_vmap;
|
||||
RDI_U64 unit_vmap_count;
|
||||
RDI_TypeNode* type_nodes;
|
||||
RDI_U64 type_nodes_count;
|
||||
RDI_UDT* udts;
|
||||
RDI_U64 udts_count;
|
||||
RDI_Member* members;
|
||||
RDI_U64 members_count;
|
||||
RDI_EnumMember* enum_members;
|
||||
RDI_U64 enum_members_count;
|
||||
RDI_GlobalVariable* global_variables;
|
||||
RDI_U64 global_variables_count;
|
||||
RDI_VMapEntry* global_vmap;
|
||||
RDI_U64 global_vmap_count;
|
||||
RDI_ThreadVariable* thread_variables;
|
||||
RDI_U64 thread_variables_count;
|
||||
RDI_Procedure* procedures;
|
||||
RDI_U64 procedures_count;
|
||||
RDI_Scope* scopes;
|
||||
RDI_U64 scopes_count;
|
||||
RDI_U64* scope_voffs;
|
||||
RDI_U64 scope_voffs_count;
|
||||
RDI_VMapEntry* scope_vmap;
|
||||
RDI_U64 scope_vmap_count;
|
||||
RDI_Local* locals;
|
||||
RDI_U64 locals_count;
|
||||
RDI_LocationBlock* location_blocks;
|
||||
RDI_U64 location_blocks_count;
|
||||
RDI_U8* location_data;
|
||||
RDI_U64 location_data_size;
|
||||
RDI_NameMap* name_maps;
|
||||
RDI_U64 name_maps_count;
|
||||
|
||||
// other helpers
|
||||
|
||||
RDI_NameMap* name_maps_by_kind[RDI_NameMapKind_COUNT];
|
||||
|
||||
} RDI_Parsed;
|
||||
|
||||
typedef enum{
|
||||
typedef enum RDI_ParseStatus
|
||||
{
|
||||
RDI_ParseStatus_Good = 0,
|
||||
RDI_ParseStatus_HeaderDoesNotMatch = 1,
|
||||
RDI_ParseStatus_UnsupportedVersionNumber = 2,
|
||||
RDI_ParseStatus_InvalidDataSecionLayout = 3,
|
||||
RDI_ParseStatus_MissingStringDataSection = 4,
|
||||
RDI_ParseStatus_MissingStringTableSection = 5,
|
||||
RDI_ParseStatus_MissingIndexRunSection = 6,
|
||||
} RDI_ParseStatus;
|
||||
RDI_ParseStatus_MissingRequiredSection = 4,
|
||||
}
|
||||
RDI_ParseStatus;
|
||||
|
||||
typedef struct RDI_ParsedLineInfo{
|
||||
typedef struct RDI_Parsed RDI_Parsed;
|
||||
struct RDI_Parsed
|
||||
{
|
||||
RDI_U8 *raw_data;
|
||||
RDI_U64 raw_data_size;
|
||||
RDI_Section *sections;
|
||||
RDI_U64 sections_count;
|
||||
};
|
||||
|
||||
typedef struct RDI_ParsedLineTable RDI_ParsedLineTable;
|
||||
struct RDI_ParsedLineTable
|
||||
{
|
||||
// NOTE: Mapping VOFF -> LINE_INFO
|
||||
//
|
||||
// * [ voff[i], voff[i + 1] ) forms the voff range
|
||||
// * for the line info at lines[i] (and cols[i] if i < col_count)
|
||||
|
||||
RDI_U64* voffs; // [count + 1] sorted
|
||||
RDI_Line* lines; // [count]
|
||||
RDI_Column* cols; // [col_count]
|
||||
RDI_U64 count;
|
||||
RDI_U64 col_count;
|
||||
} RDI_ParsedLineInfo;
|
||||
};
|
||||
|
||||
typedef struct RDI_ParsedLineMap{
|
||||
typedef struct RDI_ParsedSourceLineMap RDI_ParsedSourceLineMap;
|
||||
struct RDI_ParsedSourceLineMap
|
||||
{
|
||||
// NOTE: Mapping LINE_NUMBER -> VOFFs
|
||||
//
|
||||
// * nums[i] gives a line number
|
||||
@@ -108,113 +88,137 @@ typedef struct RDI_ParsedLineMap{
|
||||
// * to find all associated voffs for the line number nums[i] :
|
||||
// * let k span over the range [ ranges[i], ranges[i + 1] )
|
||||
// * voffs[k] gives the associated voffs
|
||||
|
||||
RDI_U32* nums; // [count] sorted
|
||||
RDI_U32* ranges; // [count + 1]
|
||||
RDI_U64* voffs; // [voff_count]
|
||||
RDI_U64 count;
|
||||
RDI_U64 voff_count;
|
||||
} RDI_ParsedLineMap;
|
||||
};
|
||||
|
||||
|
||||
typedef struct RDI_ParsedNameMap{
|
||||
typedef struct RDI_ParsedNameMap RDI_ParsedNameMap;
|
||||
struct RDI_ParsedNameMap
|
||||
{
|
||||
RDI_NameMapBucket *buckets;
|
||||
RDI_NameMapNode *nodes;
|
||||
RDI_U64 bucket_count;
|
||||
RDI_U64 node_count;
|
||||
} RDI_ParsedNameMap;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ Global Nils
|
||||
|
||||
#if !defined(RDI_DISABLE_NILS)
|
||||
static RDI_TopLevelInfo rdi_top_level_info_nil = {0};
|
||||
static RDI_BinarySection rdi_binary_section_nil = {0};
|
||||
static RDI_FilePathNode rdi_file_path_node_nil = {0};
|
||||
static RDI_SourceFile rdi_source_file_nil = {0};
|
||||
static RDI_Unit rdi_unit_nil = {0};
|
||||
static RDI_VMapEntry rdi_vmap_entry_nil = {0};
|
||||
static RDI_TypeNode rdi_type_node_nil = {0};
|
||||
static RDI_UDT rdi_udt_nil = {0};
|
||||
static RDI_Member rdi_member_nil = {0};
|
||||
static RDI_EnumMember rdi_enum_member_nil = {0};
|
||||
static RDI_GlobalVariable rdi_global_variable_nil = {0};
|
||||
static RDI_ThreadVariable rdi_thread_variable_nil = {0};
|
||||
static RDI_Procedure rdi_procedure_nil = {0};
|
||||
static RDI_Scope rdi_scope_nil = {0};
|
||||
static RDI_U64 rdi_voff_nil = 0;
|
||||
static RDI_LocationBlock rdi_location_block_nil = {0};
|
||||
static RDI_Local rdi_local_nil = {0};
|
||||
#endif
|
||||
static union
|
||||
{
|
||||
RDI_TopLevelInfo top_level_info;
|
||||
RDI_BinarySection binary_section;
|
||||
RDI_FilePathNode file_path_node;
|
||||
RDI_SourceFile source_file;
|
||||
RDI_LineTable line_table;
|
||||
RDI_SourceLineMap source_line_map;
|
||||
RDI_Line line;
|
||||
RDI_Column column;
|
||||
RDI_Unit unit;
|
||||
RDI_VMapEntry vmap_entry;
|
||||
RDI_TypeNode type_node;
|
||||
RDI_UDT udt;
|
||||
RDI_Member member;
|
||||
RDI_EnumMember enum_member;
|
||||
RDI_GlobalVariable global_variable;
|
||||
RDI_ThreadVariable thread_variable;
|
||||
RDI_Procedure procedure;
|
||||
RDI_Scope scope;
|
||||
RDI_U64 voff;
|
||||
RDI_LocationBlock location_block;
|
||||
RDI_Local local;
|
||||
}
|
||||
rdi_nil_element_union = {0};
|
||||
|
||||
////////////////////////////////
|
||||
//~ RADDBG Parse API
|
||||
//~ Top-Level Parsing API
|
||||
|
||||
RDI_PROC RDI_ParseStatus
|
||||
rdi_parse(RDI_U8 *data, RDI_U64 size, RDI_Parsed *out);
|
||||
RDI_PROC RDI_ParseStatus rdi_parse(RDI_U8 *data, RDI_U64 size, RDI_Parsed *out);
|
||||
|
||||
RDI_PROC RDI_U8*
|
||||
rdi_string_from_idx(RDI_Parsed *parsed, RDI_U32 idx, RDI_U64 *len_out);
|
||||
////////////////////////////////
|
||||
//~ Base Parsed Info Extraction Helpers
|
||||
|
||||
RDI_PROC RDI_U32*
|
||||
rdi_idx_run_from_first_count(RDI_Parsed *parsed, RDI_U32 first, RDI_U32 raw_count,
|
||||
RDI_U32 *n_out);
|
||||
//- section table/element raw data extraction
|
||||
RDI_PROC void *rdi_section_raw_data_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_SectionEncoding *encoding_out, RDI_U64 *size_out);
|
||||
RDI_PROC void *rdi_section_raw_table_from_kind(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 *count_out);
|
||||
RDI_PROC void *rdi_section_raw_element_from_kind_idx(RDI_Parsed *rdi, RDI_SectionKind kind, RDI_U64 idx);
|
||||
#define rdi_table_from_name(rdi, name, count_out) (RDI_SectionElementType_##name *)rdi_section_raw_table_from_kind((rdi), RDI_SectionKind_##name, (count_out))
|
||||
#define rdi_element_from_name_idx(rdi, name, idx) (RDI_SectionElementType_##name *)rdi_section_raw_element_from_kind_idx((rdi), RDI_SectionKind_##name, (idx))
|
||||
|
||||
//- table lookups
|
||||
#define rdi_element_from_idx(parsed, name, idx) ((0 <= (idx) && (idx) < (parsed)->name##_count) ? &(parsed)->name[idx] : (parsed)->name ? &(parsed)->name[0] : 0)
|
||||
//- info about whole parse
|
||||
RDI_PROC RDI_U64 rdi_decompressed_size_from_parsed(RDI_Parsed *rdi);
|
||||
|
||||
//- strings
|
||||
RDI_PROC RDI_U8 *rdi_string_from_idx(RDI_Parsed *rdi, RDI_U32 idx, RDI_U64 *len_out);
|
||||
|
||||
//- index runs
|
||||
RDI_PROC RDI_U32 *rdi_idx_run_from_first_count(RDI_Parsed *rdi, RDI_U32 raw_first, RDI_U32 raw_count, RDI_U32 *n_out);
|
||||
|
||||
//- line info
|
||||
RDI_PROC void
|
||||
rdi_line_info_from_unit(RDI_Parsed *p, RDI_Unit *unit, RDI_ParsedLineInfo *out);
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_line_info_idx_from_voff(RDI_ParsedLineInfo *line_info, RDI_U64 voff);
|
||||
|
||||
RDI_PROC void
|
||||
rdi_line_map_from_source_file(RDI_Parsed *p, RDI_SourceFile *srcfile,
|
||||
RDI_ParsedLineMap *out);
|
||||
|
||||
RDI_PROC RDI_U64*
|
||||
rdi_line_voffs_from_num(RDI_ParsedLineMap *map, RDI_U32 linenum, RDI_U32 *n_out);
|
||||
|
||||
|
||||
//- vmaps
|
||||
RDI_PROC RDI_U64
|
||||
rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U32 vmap_count, RDI_U64 voff);
|
||||
RDI_PROC void rdi_parsed_from_line_table(RDI_Parsed *rdi, RDI_LineTable *line_table, RDI_ParsedLineTable *out);
|
||||
RDI_PROC RDI_U64 rdi_line_info_idx_range_from_voff(RDI_ParsedLineTable *line_info, RDI_U64 voff, RDI_U64 *n_out);
|
||||
RDI_PROC RDI_U64 rdi_line_info_idx_from_voff(RDI_ParsedLineTable *line_info, RDI_U64 voff);
|
||||
RDI_PROC void rdi_parsed_from_source_line_map(RDI_Parsed *rdi, RDI_SourceLineMap *map, RDI_ParsedSourceLineMap *out);
|
||||
RDI_PROC RDI_U64 *rdi_line_voffs_from_num(RDI_ParsedSourceLineMap *map, RDI_U32 linenum, RDI_U32 *n_out);
|
||||
|
||||
//- vmap lookups
|
||||
RDI_PROC RDI_U64 rdi_vmap_idx_from_voff(RDI_VMapEntry *vmap, RDI_U64 vmap_count, RDI_U64 voff);
|
||||
|
||||
//- name maps
|
||||
RDI_PROC RDI_NameMap*
|
||||
rdi_name_map_from_kind(RDI_Parsed *p, RDI_NameMapKind kind);
|
||||
|
||||
RDI_PROC void
|
||||
rdi_name_map_parse(RDI_Parsed* p, RDI_NameMap *mapptr, RDI_ParsedNameMap *out);
|
||||
|
||||
RDI_PROC RDI_NameMapNode*
|
||||
rdi_name_map_lookup(RDI_Parsed *p, RDI_ParsedNameMap *map,
|
||||
RDI_U8 *str, RDI_U64 len);
|
||||
|
||||
RDI_PROC RDI_U32*
|
||||
rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node, RDI_U32 *n_out);
|
||||
|
||||
|
||||
//- common helpers
|
||||
RDI_PROC RDI_U64
|
||||
rdi_first_voff_from_proc(RDI_Parsed *p, RDI_U32 proc_id);
|
||||
|
||||
|
||||
RDI_PROC RDI_NameMap *rdi_name_map_from_kind(RDI_Parsed *p, RDI_NameMapKind kind);
|
||||
RDI_PROC void rdi_name_map_parse(RDI_Parsed* p, RDI_NameMap *mapptr, RDI_ParsedNameMap *out);
|
||||
RDI_PROC RDI_NameMapNode *rdi_name_map_lookup(RDI_Parsed *p, RDI_ParsedNameMap *map, RDI_U8 *str, RDI_U64 len);
|
||||
RDI_PROC RDI_U32 *rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node, RDI_U32 *n_out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ RADDBG Parsing Helpers
|
||||
//~ High-Level Composite Lookup Functions
|
||||
|
||||
#define rdi_parse__extract_primary(p,outptr,outn,pritag) \
|
||||
( (*(void**)&(outptr)) = \
|
||||
rdi_data_from_dsec((p),(p)->dsec_idx[pritag],sizeof(*(outptr)),(pritag),(outn)) )
|
||||
//- procedures
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_name(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_name_cstr(RDI_Parsed *rdi, char *cstr);
|
||||
RDI_PROC RDI_U8 *rdi_name_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure, RDI_U64 *len_out);
|
||||
RDI_PROC RDI_Scope *rdi_root_scope_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_U64 rdi_opl_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
|
||||
RDI_PROC void*
|
||||
rdi_data_from_dsec(RDI_Parsed *p, RDI_U32 idx, RDI_U32 item_size,
|
||||
RDI_DataSectionTag expected_tag, RDI_U64 *n_out);
|
||||
//- scopes
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_U64 rdi_opl_voff_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_Scope *rdi_scope_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
|
||||
//- units
|
||||
RDI_PROC RDI_Unit *rdi_unit_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_LineTable *rdi_line_table_from_unit(RDI_Parsed *rdi, RDI_Unit *unit);
|
||||
|
||||
//- line tables
|
||||
RDI_PROC RDI_Line rdi_line_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_Line rdi_line_from_line_table_voff(RDI_Parsed *rdi, RDI_LineTable *line_table, RDI_U64 voff);
|
||||
RDI_PROC RDI_SourceFile *rdi_source_file_from_line(RDI_Parsed *rdi, RDI_Line *line);
|
||||
|
||||
//- source files
|
||||
RDI_PROC RDI_SourceFile *rdi_source_file_from_normal_path(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size);
|
||||
RDI_PROC RDI_SourceFile *rdi_source_file_from_normal_path_cstr(RDI_Parsed *rdi, char *cstr);
|
||||
RDI_PROC RDI_U8 *rdi_normal_path_from_source_file(RDI_Parsed *rdi, RDI_SourceFile *src_file, RDI_U64 *len_out);
|
||||
RDI_PROC RDI_FilePathNode *rdi_file_path_node_from_source_file(RDI_Parsed *rdi, RDI_SourceFile *src_file);
|
||||
RDI_PROC RDI_SourceLineMap *rdi_source_line_map_from_source_file(RDI_Parsed *rdi, RDI_SourceFile *src_file);
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_source_file_line_num(RDI_Parsed *rdi, RDI_SourceFile *src_file, RDI_U32 line_num);
|
||||
|
||||
//- source line maps
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_source_line_map_num(RDI_Parsed *rdi, RDI_SourceLineMap *map, RDI_U32 line_num);
|
||||
|
||||
//- file path nodes
|
||||
RDI_PROC RDI_FilePathNode *rdi_parent_from_file_path_node(RDI_Parsed *rdi, RDI_FilePathNode *node);
|
||||
RDI_PROC RDI_U8 *rdi_name_from_file_path_node(RDI_Parsed *rdi, RDI_FilePathNode *node, RDI_U64 *len_out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ Parser Helpers
|
||||
|
||||
#define rdi_parse__min(a,b) (((a)<(b))?(a):(b))
|
||||
RDI_PROC RDI_U64 rdi_cstring_length(char *cstr);
|
||||
|
||||
#endif // RDI_PARSE_H
|
||||
#endif // RDI_FORMAT_PARSE_H
|
||||
|
||||
+811
-744
File diff suppressed because it is too large
Load Diff
+336
-72
@@ -417,6 +417,7 @@ struct RDIM_TopLevelInfo
|
||||
RDIM_String8 exe_name;
|
||||
RDI_U64 exe_hash;
|
||||
RDI_U64 voff_max;
|
||||
RDIM_String8 producer_name;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -484,10 +485,12 @@ struct RDIM_SrcFileChunkList
|
||||
RDIM_SrcFileChunkNode *last;
|
||||
RDI_U64 chunk_count;
|
||||
RDI_U64 total_count;
|
||||
RDI_U64 source_line_map_count;
|
||||
RDI_U64 total_line_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Per-Compilation-Unit Info Types
|
||||
//~ rjf: Line Info Types
|
||||
|
||||
typedef struct RDIM_LineSequence RDIM_LineSequence;
|
||||
struct RDIM_LineSequence
|
||||
@@ -506,14 +509,42 @@ struct RDIM_LineSequenceNode
|
||||
RDIM_LineSequence v;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LineSequenceList RDIM_LineSequenceList;
|
||||
struct RDIM_LineSequenceList
|
||||
typedef struct RDIM_LineTable RDIM_LineTable;
|
||||
struct RDIM_LineTable
|
||||
{
|
||||
RDIM_LineSequenceNode *first;
|
||||
RDIM_LineSequenceNode *last;
|
||||
RDI_U64 count;
|
||||
struct RDIM_LineTableChunkNode *chunk;
|
||||
RDIM_LineSequenceNode *first_seq;
|
||||
RDIM_LineSequenceNode *last_seq;
|
||||
RDI_U64 seq_count;
|
||||
RDI_U64 line_count;
|
||||
RDI_U64 col_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LineTableChunkNode RDIM_LineTableChunkNode;
|
||||
struct RDIM_LineTableChunkNode
|
||||
{
|
||||
RDIM_LineTableChunkNode *next;
|
||||
RDIM_LineTable *v;
|
||||
RDI_U64 count;
|
||||
RDI_U64 cap;
|
||||
RDI_U64 base_idx;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LineTableChunkList RDIM_LineTableChunkList;
|
||||
struct RDIM_LineTableChunkList
|
||||
{
|
||||
RDIM_LineTableChunkNode *first;
|
||||
RDIM_LineTableChunkNode *last;
|
||||
RDI_U64 chunk_count;
|
||||
RDI_U64 total_count;
|
||||
RDI_U64 total_seq_count;
|
||||
RDI_U64 total_line_count;
|
||||
RDI_U64 total_col_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Per-Compilation-Unit Info Types
|
||||
|
||||
typedef struct RDIM_Unit RDIM_Unit;
|
||||
struct RDIM_Unit
|
||||
{
|
||||
@@ -525,7 +556,7 @@ struct RDIM_Unit
|
||||
RDIM_String8 archive_file;
|
||||
RDIM_String8 build_path;
|
||||
RDI_Language language;
|
||||
RDIM_LineSequenceList line_sequences;
|
||||
RDIM_LineTable *line_table;
|
||||
RDIM_Rng1U64List voff_ranges;
|
||||
};
|
||||
|
||||
@@ -668,7 +699,7 @@ typedef struct RDIM_Location RDIM_Location;
|
||||
struct RDIM_Location
|
||||
{
|
||||
RDI_LocationKind kind;
|
||||
RDI_U8 register_code;
|
||||
RDI_U8 reg_code;
|
||||
RDI_U16 offset;
|
||||
RDIM_EvalBytecode bytecode;
|
||||
};
|
||||
@@ -735,6 +766,38 @@ struct RDIM_SymbolChunkList
|
||||
RDI_U64 total_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Inline Site Info Types
|
||||
|
||||
typedef struct RDIM_InlineSite RDIM_InlineSite;
|
||||
struct RDIM_InlineSite
|
||||
{
|
||||
struct RDIM_InlineSiteChunkNode *chunk;
|
||||
RDIM_String8 name;
|
||||
RDIM_Type *type;
|
||||
RDIM_Type *owner;
|
||||
RDIM_LineTable *line_table;
|
||||
};
|
||||
|
||||
typedef struct RDIM_InlineSiteChunkNode RDIM_InlineSiteChunkNode;
|
||||
struct RDIM_InlineSiteChunkNode
|
||||
{
|
||||
RDIM_InlineSiteChunkNode *next;
|
||||
RDIM_InlineSite *v;
|
||||
RDI_U64 count;
|
||||
RDI_U64 cap;
|
||||
RDI_U64 base_idx;
|
||||
};
|
||||
|
||||
typedef struct RDIM_InlineSiteChunkList RDIM_InlineSiteChunkList;
|
||||
struct RDIM_InlineSiteChunkList
|
||||
{
|
||||
RDIM_InlineSiteChunkNode *first;
|
||||
RDIM_InlineSiteChunkNode *last;
|
||||
RDI_U64 chunk_count;
|
||||
RDI_U64 total_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scope Info Types
|
||||
|
||||
@@ -761,6 +824,7 @@ struct RDIM_Scope
|
||||
RDIM_Local *first_local;
|
||||
RDIM_Local *last_local;
|
||||
RDI_U32 local_count;
|
||||
RDIM_InlineSite *inline_site;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ScopeChunkNode RDIM_ScopeChunkNode;
|
||||
@@ -799,10 +863,12 @@ struct RDIM_BakeParams
|
||||
RDIM_TypeChunkList types;
|
||||
RDIM_UDTChunkList udts;
|
||||
RDIM_SrcFileChunkList src_files;
|
||||
RDIM_LineTableChunkList line_tables;
|
||||
RDIM_SymbolChunkList global_variables;
|
||||
RDIM_SymbolChunkList thread_variables;
|
||||
RDIM_SymbolChunkList procedures;
|
||||
RDIM_ScopeChunkList scopes;
|
||||
RDIM_InlineSiteChunkList inline_sites;
|
||||
};
|
||||
|
||||
//- rjf: data sections
|
||||
@@ -811,10 +877,10 @@ typedef struct RDIM_BakeSection RDIM_BakeSection;
|
||||
struct RDIM_BakeSection
|
||||
{
|
||||
void *data;
|
||||
RDI_DataSectionEncoding encoding;
|
||||
RDI_SectionEncoding encoding;
|
||||
RDI_U64 encoded_size;
|
||||
RDI_U64 unpacked_size;
|
||||
RDI_DataSectionTag tag;
|
||||
RDI_SectionKind tag;
|
||||
RDI_U64 tag_idx;
|
||||
};
|
||||
|
||||
@@ -991,6 +1057,217 @@ struct RDIM_VMapMarker
|
||||
RDI_U32 begin_range;
|
||||
};
|
||||
|
||||
//- rjf: baking results
|
||||
|
||||
typedef struct RDIM_TopLevelInfoBakeResult RDIM_TopLevelInfoBakeResult;
|
||||
struct RDIM_TopLevelInfoBakeResult
|
||||
{
|
||||
RDI_TopLevelInfo *top_level_info;
|
||||
};
|
||||
|
||||
typedef struct RDIM_BinarySectionBakeResult RDIM_BinarySectionBakeResult;
|
||||
struct RDIM_BinarySectionBakeResult
|
||||
{
|
||||
RDI_BinarySection *binary_sections;
|
||||
RDI_U64 binary_sections_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_UnitBakeResult RDIM_UnitBakeResult;
|
||||
struct RDIM_UnitBakeResult
|
||||
{
|
||||
RDI_Unit *units;
|
||||
RDI_U64 units_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_UnitVMapBakeResult RDIM_UnitVMapBakeResult;
|
||||
struct RDIM_UnitVMapBakeResult
|
||||
{
|
||||
RDIM_BakeVMap vmap;
|
||||
};
|
||||
|
||||
typedef struct RDIM_SrcFileBakeResult RDIM_SrcFileBakeResult;
|
||||
struct RDIM_SrcFileBakeResult
|
||||
{
|
||||
RDI_SourceFile *source_files;
|
||||
RDI_U64 source_files_count;
|
||||
RDI_SourceLineMap *source_line_maps;
|
||||
RDI_U64 source_line_maps_count;
|
||||
RDI_U32 *source_line_map_nums;
|
||||
RDI_U32 *source_line_map_rngs;
|
||||
RDI_U64 *source_line_map_voffs;
|
||||
RDI_U64 source_line_map_nums_count;
|
||||
RDI_U64 source_line_map_rngs_count;
|
||||
RDI_U64 source_line_map_voffs_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LineTableBakeResult RDIM_LineTableBakeResult;
|
||||
struct RDIM_LineTableBakeResult
|
||||
{
|
||||
RDI_LineTable *line_tables;
|
||||
RDI_U64 line_tables_count;
|
||||
RDI_U64 *line_table_voffs;
|
||||
RDI_U64 line_table_voffs_count;
|
||||
RDI_Line *line_table_lines;
|
||||
RDI_U64 line_table_lines_count;
|
||||
RDI_Column *line_table_columns;
|
||||
RDI_U64 line_table_columns_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_TypeNodeBakeResult RDIM_TypeNodeBakeResult;
|
||||
struct RDIM_TypeNodeBakeResult
|
||||
{
|
||||
RDI_TypeNode *type_nodes;
|
||||
RDI_U64 type_nodes_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_UDTBakeResult RDIM_UDTBakeResult;
|
||||
struct RDIM_UDTBakeResult
|
||||
{
|
||||
RDI_UDT *udts;
|
||||
RDI_U64 udts_count;
|
||||
RDI_Member *members;
|
||||
RDI_U64 members_count;
|
||||
RDI_EnumMember *enum_members;
|
||||
RDI_U64 enum_members_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_GlobalVariableBakeResult RDIM_GlobalVariableBakeResult;
|
||||
struct RDIM_GlobalVariableBakeResult
|
||||
{
|
||||
RDI_GlobalVariable *global_variables;
|
||||
RDI_U64 global_variables_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_GlobalVMapBakeResult RDIM_GlobalVMapBakeResult;
|
||||
struct RDIM_GlobalVMapBakeResult
|
||||
{
|
||||
RDIM_BakeVMap vmap;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ThreadVariableBakeResult RDIM_ThreadVariableBakeResult;
|
||||
struct RDIM_ThreadVariableBakeResult
|
||||
{
|
||||
RDI_ThreadVariable *thread_variables;
|
||||
RDI_U64 thread_variables_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ProcedureBakeResult RDIM_ProcedureBakeResult;
|
||||
struct RDIM_ProcedureBakeResult
|
||||
{
|
||||
RDI_Procedure *procedures;
|
||||
RDI_U64 procedures_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ScopeBakeResult RDIM_ScopeBakeResult;
|
||||
struct RDIM_ScopeBakeResult
|
||||
{
|
||||
RDI_Scope *scopes;
|
||||
RDI_U64 scopes_count;
|
||||
RDI_U64 *scope_voffs;
|
||||
RDI_U64 scope_voffs_count;
|
||||
RDI_Local *locals;
|
||||
RDI_U64 locals_count;
|
||||
RDI_LocationBlock *location_blocks;
|
||||
RDI_U64 location_blocks_count;
|
||||
RDI_U8 *location_data;
|
||||
RDI_U64 location_data_size;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ScopeVMapBakeResult RDIM_ScopeVMapBakeResult;
|
||||
struct RDIM_ScopeVMapBakeResult
|
||||
{
|
||||
RDIM_BakeVMap vmap;
|
||||
};
|
||||
|
||||
typedef struct RDIM_InlineSiteBakeResult RDIM_InlineSiteBakeResult;
|
||||
struct RDIM_InlineSiteBakeResult
|
||||
{
|
||||
RDI_InlineSite *inline_sites;
|
||||
RDI_U64 inline_sites_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_TopLevelNameMapBakeResult RDIM_TopLevelNameMapBakeResult;
|
||||
struct RDIM_TopLevelNameMapBakeResult
|
||||
{
|
||||
RDI_NameMap *name_maps;
|
||||
RDI_U64 name_maps_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_NameMapBakeResult RDIM_NameMapBakeResult;
|
||||
struct RDIM_NameMapBakeResult
|
||||
{
|
||||
RDI_NameMapBucket *buckets;
|
||||
RDI_U64 buckets_count;
|
||||
RDI_NameMapNode *nodes;
|
||||
RDI_U64 nodes_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_FilePathBakeResult RDIM_FilePathBakeResult;
|
||||
struct RDIM_FilePathBakeResult
|
||||
{
|
||||
RDI_FilePathNode *nodes;
|
||||
RDI_U64 nodes_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_StringBakeResult RDIM_StringBakeResult;
|
||||
struct RDIM_StringBakeResult
|
||||
{
|
||||
RDI_U32 *string_offs;
|
||||
RDI_U64 string_offs_count;
|
||||
RDI_U8 *string_data;
|
||||
RDI_U64 string_data_size;
|
||||
};
|
||||
|
||||
typedef struct RDIM_IndexRunBakeResult RDIM_IndexRunBakeResult;
|
||||
struct RDIM_IndexRunBakeResult
|
||||
{
|
||||
RDI_U32 *idx_runs;
|
||||
RDI_U64 idx_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_BakeResults RDIM_BakeResults;
|
||||
struct RDIM_BakeResults
|
||||
{
|
||||
RDIM_TopLevelInfoBakeResult top_level_info;
|
||||
RDIM_BinarySectionBakeResult binary_sections;
|
||||
RDIM_UnitBakeResult units;
|
||||
RDIM_UnitVMapBakeResult unit_vmap;
|
||||
RDIM_SrcFileBakeResult src_files;
|
||||
RDIM_LineTableBakeResult line_tables;
|
||||
RDIM_TypeNodeBakeResult type_nodes;
|
||||
RDIM_UDTBakeResult udts;
|
||||
RDIM_GlobalVariableBakeResult global_variables;
|
||||
RDIM_GlobalVMapBakeResult global_vmap;
|
||||
RDIM_ThreadVariableBakeResult thread_variables;
|
||||
RDIM_ProcedureBakeResult procedures;
|
||||
RDIM_ScopeBakeResult scopes;
|
||||
RDIM_InlineSiteBakeResult inline_sites;
|
||||
RDIM_ScopeVMapBakeResult scope_vmap;
|
||||
RDIM_TopLevelNameMapBakeResult top_level_name_maps;
|
||||
RDIM_NameMapBakeResult name_maps;
|
||||
RDIM_FilePathBakeResult file_paths;
|
||||
RDIM_StringBakeResult strings;
|
||||
RDIM_IndexRunBakeResult idx_runs;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Serialization Types
|
||||
|
||||
typedef struct RDIM_SerializedSection RDIM_SerializedSection;
|
||||
struct RDIM_SerializedSection
|
||||
{
|
||||
void *data;
|
||||
RDI_U64 encoded_size;
|
||||
RDI_U64 unpacked_size;
|
||||
RDI_SectionEncoding encoding;
|
||||
};
|
||||
|
||||
typedef struct RDIM_SerializedSectionBundle RDIM_SerializedSectionBundle;
|
||||
struct RDIM_SerializedSectionBundle
|
||||
{
|
||||
RDIM_SerializedSection sections[RDI_SectionKind_COUNT];
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
@@ -1030,6 +1307,7 @@ RDI_PROC RDIM_String8 rdim_str8fv(RDIM_Arena *arena, char *fmt, va_list args);
|
||||
RDI_PROC RDI_S32 rdim_str8_match(RDIM_String8 a, RDIM_String8 b, RDIM_StringMatchFlags flags);
|
||||
#define rdim_str8_lit(S) rdim_str8((RDI_U8*)(S), sizeof(S) - 1)
|
||||
#define rdim_str8_struct(S) rdim_str8((RDI_U8*)(S), sizeof(*(S)))
|
||||
#define rdim_str8_struct_array(S, C) rdim_str8((RDI_U8*)(S), sizeof(*(S)) * (C))
|
||||
|
||||
//- rjf: string lists
|
||||
RDI_PROC void rdim_str8_list_push(RDIM_Arena *arena, RDIM_String8List *list, RDIM_String8 string);
|
||||
@@ -1056,13 +1334,20 @@ RDI_PROC RDI_U64 rdim_idx_from_src_file(RDIM_SrcFile *src_file);
|
||||
RDI_PROC void rdim_src_file_chunk_list_concat_in_place(RDIM_SrcFileChunkList *dst, RDIM_SrcFileChunkList *to_push);
|
||||
RDI_PROC void rdim_src_file_push_line_sequence(RDIM_Arena *arena, RDIM_SrcFileChunkList *src_files, RDIM_SrcFile *src_file, RDIM_LineSequence *seq);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Line Info Building
|
||||
|
||||
RDI_PROC RDIM_LineTable *rdim_line_table_chunk_list_push(RDIM_Arena *arena, RDIM_LineTableChunkList *list, RDI_U64 cap);
|
||||
RDI_PROC RDI_U64 rdim_idx_from_line_table(RDIM_LineTable *line_table);
|
||||
RDI_PROC void rdim_line_table_chunk_list_concat_in_place(RDIM_LineTableChunkList *dst, RDIM_LineTableChunkList *to_push);
|
||||
RDI_PROC RDIM_LineSequence *rdim_line_table_push_sequence(RDIM_Arena *arena, RDIM_LineTableChunkList *line_tables, RDIM_LineTable *line_table, RDIM_SrcFile *src_file, RDI_U64 *voffs, RDI_U32 *line_nums, RDI_U16 *col_nums, RDI_U64 line_count);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Unit Info Building
|
||||
|
||||
RDI_PROC RDIM_Unit *rdim_unit_chunk_list_push(RDIM_Arena *arena, RDIM_UnitChunkList *list, RDI_U64 cap);
|
||||
RDI_PROC RDI_U64 rdim_idx_from_unit(RDIM_Unit *unit);
|
||||
RDI_PROC void rdim_unit_chunk_list_concat_in_place(RDIM_UnitChunkList *dst, RDIM_UnitChunkList *to_push);
|
||||
RDI_PROC RDIM_LineSequence *rdim_line_sequence_list_push(RDIM_Arena *arena, RDIM_LineSequenceList *list);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Type Info & UDT Building
|
||||
@@ -1083,6 +1368,13 @@ RDI_PROC RDIM_Symbol *rdim_symbol_chunk_list_push(RDIM_Arena *arena, RDIM_Symbol
|
||||
RDI_PROC RDI_U64 rdim_idx_from_symbol(RDIM_Symbol *symbol);
|
||||
RDI_PROC void rdim_symbol_chunk_list_concat_in_place(RDIM_SymbolChunkList *dst, RDIM_SymbolChunkList *to_push);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Inline Site Info Building
|
||||
|
||||
RDI_PROC RDIM_InlineSite *rdim_inline_site_chunk_list_push(RDIM_Arena *arena, RDIM_InlineSiteChunkList *list, RDI_U64 cap);
|
||||
RDI_PROC RDI_U64 rdim_idx_from_inline_site(RDIM_InlineSite *inline_site);
|
||||
RDI_PROC void rdim_inline_site_chunk_list_concat_in_place(RDIM_InlineSiteChunkList *dst, RDIM_InlineSiteChunkList *to_push);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Scope Info Building
|
||||
|
||||
@@ -1109,12 +1401,6 @@ RDI_PROC RDIM_Location *rdim_push_location_val_reg(RDIM_Arena *arena, RDI_U8 reg
|
||||
//- rjf: location sets
|
||||
RDI_PROC void rdim_location_set_push_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationSet *locset, RDIM_Rng1U64 voff_range, RDIM_Location *location);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Baking Helpers] Baked File Layout Calculations
|
||||
|
||||
RDI_PROC RDI_U64 rdim_bake_section_count_from_params(RDIM_BakeParams *params);
|
||||
RDI_PROC RDI_U64 rdim_bake_section_idx_from_params_tag_idx(RDIM_BakeParams *params, RDI_DataSectionTag tag, RDI_U64 idx);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Baking Helpers] Baked VMap Building
|
||||
|
||||
@@ -1136,7 +1422,7 @@ RDI_PROC RDIM_BakeStringMapBaseIndices rdim_bake_string_map_base_indices_from_ma
|
||||
|
||||
//- rjf: finalized bake string map
|
||||
RDI_PROC RDIM_BakeStringMapTight rdim_bake_string_map_tight_from_loose(RDIM_Arena *arena, RDIM_BakeStringMapTopology *map_topology, RDIM_BakeStringMapBaseIndices *map_base_indices, RDIM_BakeStringMapLoose *map);
|
||||
RDI_PROC RDI_U64 rdim_bake_idx_from_string(RDIM_BakeStringMapTight *map, RDIM_String8 string);
|
||||
RDI_PROC RDI_U32 rdim_bake_idx_from_string(RDIM_BakeStringMapTight *map, RDIM_String8 string);
|
||||
|
||||
//- rjf: bake idx run map reading/writing
|
||||
RDI_PROC RDI_U64 rdim_hash_from_idx_run(RDI_U32 *idx_run, RDI_U32 count);
|
||||
@@ -1155,7 +1441,7 @@ RDI_PROC void rdim_bake_name_map_push(RDIM_Arena *arena, RDIM_BakeNameMap *map,
|
||||
//~ rjf: [Baking Helpers] Data Section List Building Helpers
|
||||
|
||||
RDI_PROC RDIM_BakeSection *rdim_bake_section_list_push(RDIM_Arena *arena, RDIM_BakeSectionList *list);
|
||||
RDI_PROC RDIM_BakeSection *rdim_bake_section_list_push_new_unpacked(RDIM_Arena *arena, RDIM_BakeSectionList *list, void *data, RDI_U64 size, RDI_DataSectionTag tag, RDI_U64 tag_idx);
|
||||
RDI_PROC RDIM_BakeSection *rdim_bake_section_list_push_new_unpacked(RDIM_Arena *arena, RDIM_BakeSectionList *list, void *data, RDI_U64 size, RDI_SectionKind tag, RDI_U64 tag_idx);
|
||||
RDI_PROC void rdim_bake_section_list_concat_in_place(RDIM_BakeSectionList *dst, RDIM_BakeSectionList *to_push);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -1192,64 +1478,42 @@ RDI_PROC RDIM_BakeIdxRunMap *rdim_bake_idx_run_map_from_params(RDIM_Arena *arena
|
||||
RDI_PROC RDIM_BakePathTree *rdim_bake_path_tree_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Baking] Build Artifacts -> Data Section Lists
|
||||
//~ rjf: [Baking] Build Artifacts -> Baked Versions
|
||||
|
||||
//- rjf: top-level info
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_top_level_info_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
//- rjf: partial/joinable baking functions
|
||||
RDI_PROC RDIM_NameMapBakeResult rdim_bake_name_map(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeNameMap *src);
|
||||
|
||||
//- rjf: binary sections
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_binary_section_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
//- rjf: partial bakes -> final bake functions
|
||||
RDI_PROC RDIM_NameMapBakeResult rdim_name_map_bake_results_combine(RDIM_Arena *arena, RDIM_NameMapBakeResult *results, RDI_U64 results_count);
|
||||
|
||||
//- rjf: units
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_section_list_from_unit(RDIM_Arena *arena, RDIM_Unit *unit);
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_unit_top_level_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: unit vmap
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_unit_vmap_section_list_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: source files
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_src_file_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: type nodes
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_type_node_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: UDTs
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_udt_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: global variables
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_global_variable_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: global vmap
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_global_vmap_section_list_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: thread variables
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_thread_variable_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: procedures
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_procedure_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: scopes
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_scope_section_list_from_params(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: scope vmap
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_scope_vmap_section_list_from_params(RDIM_Arena *arena, RDIM_BakeParams *params);
|
||||
|
||||
//- rjf: name maps
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_top_level_name_map_section_list_from_params_maps(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeParams *params, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT]);
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_name_map_section_list_from_params_kind_map(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeParams *params, RDI_NameMapKind k, RDIM_BakeNameMap *map);
|
||||
|
||||
//- rjf: file paths
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_file_path_section_list_from_path_tree(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree);
|
||||
|
||||
//- rjf: strings
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_string_section_list_from_string_map(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings);
|
||||
|
||||
//- rjf: index runs
|
||||
RDI_PROC RDIM_BakeSectionList rdim_bake_idx_run_section_list_from_idx_run_map(RDIM_Arena *arena, RDIM_BakeIdxRunMap *idx_runs);
|
||||
//- rjf: independent (top-level, global) baking functions
|
||||
RDI_PROC RDIM_TopLevelInfoBakeResult rdim_bake_top_level_info(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_TopLevelInfo *src);
|
||||
RDI_PROC RDIM_BinarySectionBakeResult rdim_bake_binary_sections(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BinarySectionList *src);
|
||||
RDI_PROC RDIM_UnitBakeResult rdim_bake_units(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_UnitChunkList *src);
|
||||
RDI_PROC RDIM_UnitVMapBakeResult rdim_bake_unit_vmap(RDIM_Arena *arena, RDIM_UnitChunkList *units);
|
||||
RDI_PROC RDIM_SrcFileBakeResult rdim_bake_src_files(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree, RDIM_SrcFileChunkList *src);
|
||||
RDI_PROC RDIM_LineTableBakeResult rdim_bake_line_tables(RDIM_Arena *arena, RDIM_LineTableChunkList *src);
|
||||
RDI_PROC RDIM_TypeNodeBakeResult rdim_bake_types(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_TypeChunkList *src);
|
||||
RDI_PROC RDIM_UDTBakeResult rdim_bake_udts(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_UDTChunkList *src);
|
||||
RDI_PROC RDIM_GlobalVariableBakeResult rdim_bake_global_variables(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
|
||||
RDI_PROC RDIM_GlobalVMapBakeResult rdim_bake_global_vmap(RDIM_Arena *arena, RDIM_SymbolChunkList *src);
|
||||
RDI_PROC RDIM_ThreadVariableBakeResult rdim_bake_thread_variables(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
|
||||
RDI_PROC RDIM_ProcedureBakeResult rdim_bake_procedures(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_SymbolChunkList *src);
|
||||
RDI_PROC RDIM_ScopeBakeResult rdim_bake_scopes(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_ScopeChunkList *src);
|
||||
RDI_PROC RDIM_ScopeVMapBakeResult rdim_bake_scope_vmap(RDIM_Arena *arena, RDIM_ScopeChunkList *src);
|
||||
RDI_PROC RDIM_InlineSiteBakeResult rdim_bake_inline_sites(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_InlineSiteChunkList *src);
|
||||
RDI_PROC RDIM_TopLevelNameMapBakeResult rdim_bake_name_maps_top_level(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakeIdxRunMap *idx_runs, RDIM_BakeNameMap *name_maps[RDI_NameMapKind_COUNT]);
|
||||
RDI_PROC RDIM_FilePathBakeResult rdim_bake_file_paths(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings, RDIM_BakePathTree *path_tree);
|
||||
RDI_PROC RDIM_StringBakeResult rdim_bake_strings(RDIM_Arena *arena, RDIM_BakeStringMapTight *strings);
|
||||
RDI_PROC RDIM_IndexRunBakeResult rdim_bake_index_runs(RDIM_Arena *arena, RDIM_BakeIdxRunMap *idx_runs);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Serializing] Baked Data Section List -> Serialized Binary Strings
|
||||
//~ rjf: [Serializing] Bake Results -> String Blobs
|
||||
|
||||
RDI_PROC RDIM_String8List rdim_serialized_strings_from_params_bake_section_list(RDIM_Arena *arena, RDIM_BakeParams *params, RDIM_BakeSectionList *sections);
|
||||
RDI_PROC RDIM_SerializedSection rdim_serialized_section_make_unpacked(void *data, RDI_U64 size);
|
||||
#define rdim_serialized_section_make_unpacked_struct(ptr) rdim_serialized_section_make_unpacked((ptr), sizeof(*(ptr)))
|
||||
#define rdim_serialized_section_make_unpacked_array(ptr, count) rdim_serialized_section_make_unpacked((ptr), sizeof(*(ptr))*(count))
|
||||
RDI_PROC RDIM_SerializedSectionBundle rdim_serialized_section_bundle_from_bake_results(RDIM_BakeResults *results);
|
||||
RDI_PROC RDIM_String8List rdim_file_blobs_from_section_bundle(RDIM_Arena *arena, RDIM_SerializedSectionBundle *bundle);
|
||||
|
||||
#endif // RDI_MAKE_H
|
||||
|
||||
@@ -137,7 +137,7 @@ mg_escaped_from_str8(Arena *arena, String8 string)
|
||||
U64 start = 0;
|
||||
for(U64 idx = 0; idx <= string.size; idx += 1)
|
||||
{
|
||||
if(idx == string.size || string.str[idx] == '\\')
|
||||
if(idx == string.size || string.str[idx] == '\\' || string.str[idx] == '\r')
|
||||
{
|
||||
String8 str = str8_substr(string, r1u64(start, idx));
|
||||
if(str.size != 0)
|
||||
@@ -1026,7 +1026,12 @@ mg_string_list_from_table_gen(Arena *arena, MG_Map grid_name_map, MG_Map grid_co
|
||||
{
|
||||
String8List result = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
for(MD_EachNode(strexpr_node, gen->first))
|
||||
if(md_node_is_nil(gen->first) && gen->string.size != 0)
|
||||
{
|
||||
str8_list_push(arena, &result, gen->string);
|
||||
str8_list_push(arena, &result, str8_lit("\n"));
|
||||
}
|
||||
else for(MD_EachNode(strexpr_node, gen->first))
|
||||
{
|
||||
// rjf: build task list
|
||||
MG_TableExpandTask *first_task = 0;
|
||||
|
||||
@@ -212,14 +212,22 @@ typedef struct MG_Layer MG_Layer;
|
||||
struct MG_Layer
|
||||
{
|
||||
String8 key;
|
||||
B32 is_library;
|
||||
String8 gen_folder_name;
|
||||
String8 h_name_override;
|
||||
String8 c_name_override;
|
||||
String8List enums;
|
||||
String8List structs;
|
||||
String8List h_functions;
|
||||
String8List h_tables;
|
||||
String8List h_catchall;
|
||||
String8List h_header;
|
||||
String8List h_footer;
|
||||
String8List c_functions;
|
||||
String8List c_tables;
|
||||
String8List c_catchall;
|
||||
String8List c_header;
|
||||
String8List c_footer;
|
||||
};
|
||||
|
||||
typedef struct MG_LayerNode MG_LayerNode;
|
||||
|
||||
+176
-11
@@ -149,6 +149,74 @@ int main(int argument_count, char **arguments)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: gather layer options
|
||||
//
|
||||
for(MG_FileParseNode *n = parses.first; n != 0; n = n->next)
|
||||
{
|
||||
MD_Node *file = n->v.root;
|
||||
String8 layer_key = mg_layer_key_from_path(file->string);
|
||||
MG_Layer *layer = mg_layer_from_key(layer_key);
|
||||
for(MD_EachNode(node, file->first))
|
||||
{
|
||||
if(md_node_has_tag(node, str8_lit("option"), 0))
|
||||
{
|
||||
if(str8_match(node->string, str8_lit("library"), 0))
|
||||
{
|
||||
layer->is_library = 1;
|
||||
}
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("gen_folder"), 0))
|
||||
{
|
||||
layer->gen_folder_name = node->string;
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("h_name"), 0))
|
||||
{
|
||||
layer->h_name_override = node->string;
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("c_name"), 0))
|
||||
{
|
||||
layer->c_name_override = node->string;
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("h_header"), 0))
|
||||
{
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
str8_list_push(mg_arena, &layer->h_header, n->string);
|
||||
str8_list_push(mg_arena, &layer->h_header, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("h_footer"), 0))
|
||||
{
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
str8_list_push(mg_arena, &layer->h_footer, n->string);
|
||||
str8_list_push(mg_arena, &layer->h_footer, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("c_header"), 0))
|
||||
{
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
str8_list_push(mg_arena, &layer->c_header, n->string);
|
||||
str8_list_push(mg_arena, &layer->c_header, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
if(md_node_has_tag(node, str8_lit("c_footer"), 0))
|
||||
{
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
str8_list_push(mg_arena, &layer->c_footer, n->string);
|
||||
str8_list_push(mg_arena, &layer->c_footer, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: generate enums
|
||||
//
|
||||
@@ -160,36 +228,67 @@ int main(int argument_count, char **arguments)
|
||||
MD_Node *tag = md_tag_from_string(node, str8_lit("enum"), 0);
|
||||
if(!md_node_is_nil(tag))
|
||||
{
|
||||
String8 enum_name = node->string;
|
||||
String8 enum_member_prefix = enum_name;
|
||||
if(str8_match(str8_postfix(enum_name, 5), str8_lit("Flags"), 0))
|
||||
{
|
||||
enum_member_prefix = str8_chop(enum_name, 1);
|
||||
}
|
||||
String8 enum_base_type_name = tag->first->string;
|
||||
String8 layer_key = mg_layer_key_from_path(file->string);
|
||||
MG_Layer *layer = mg_layer_from_key(layer_key);
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
if(enum_base_type_name.size == 0)
|
||||
{
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %S\n{\n", node->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %S\n{\n", enum_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef %S %S;\n", enum_base_type_name, node->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %SEnum\n{\n", node->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef %S %S;\n", enum_base_type_name, enum_name);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "typedef enum %SEnum\n{\n", enum_name);
|
||||
}
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
String8 escaped = mg_escaped_from_str8(mg_arena, n->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "%S_%S,\n", node->string, escaped);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "%S_%S,\n", enum_member_prefix, escaped);
|
||||
}
|
||||
if(enum_base_type_name.size == 0)
|
||||
{
|
||||
str8_list_pushf(mg_arena, &layer->enums, "} %S;\n\n", node->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "} %S;\n\n", enum_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_pushf(mg_arena, &layer->enums, "} %SEnum;\n\n", node->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "} %SEnum;\n\n", enum_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: generate xlists
|
||||
//
|
||||
for(MG_FileParseNode *n = parses.first; n != 0; n = n->next)
|
||||
{
|
||||
MD_Node *file = n->v.root;
|
||||
for(MD_EachNode(node, file->first))
|
||||
{
|
||||
MD_Node *tag = md_tag_from_string(node, str8_lit("xlist"), 0);
|
||||
if(!md_node_is_nil(tag))
|
||||
{
|
||||
String8 layer_key = mg_layer_key_from_path(file->string);
|
||||
MG_Layer *layer = mg_layer_from_key(layer_key);
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "#define %S \\\n", node->string);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
String8 escaped = mg_escaped_from_str8(mg_arena, n->string);
|
||||
str8_list_pushf(mg_arena, &layer->enums, "X(%S)\\\n", escaped);
|
||||
}
|
||||
str8_list_push(mg_arena, &layer->enums, str8_lit("\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: generate structs
|
||||
//
|
||||
@@ -301,7 +400,8 @@ int main(int argument_count, char **arguments)
|
||||
String8List gen_strings = mg_string_list_from_table_gen(mg_arena, table_grid_map, table_col_map, str8_lit(""), node);
|
||||
for(String8Node *n = gen_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
String8 escaped = mg_escaped_from_str8(mg_arena, n->string);
|
||||
String8 trimmed = str8_skip_chop_whitespace(n->string);
|
||||
String8 escaped = mg_escaped_from_str8(mg_arena, trimmed);
|
||||
str8_list_push(mg_arena, out, escaped);
|
||||
str8_list_push(mg_arena, out, str8_lit("\n"));
|
||||
}
|
||||
@@ -415,7 +515,17 @@ int main(int argument_count, char **arguments)
|
||||
for(MG_LayerNode *n = slot->first; n != 0; n = n->next)
|
||||
{
|
||||
MG_Layer *layer = &n->v;
|
||||
String8 layer_generated_folder = push_str8f(mg_arena, "%S/%S/generated", code_dir_path, layer->key);
|
||||
String8 layer_generated_folder = {0};
|
||||
if(layer->gen_folder_name.size != 0)
|
||||
{
|
||||
String8 gen_folder = layer->gen_folder_name;
|
||||
layer_generated_folder = push_str8f(mg_arena, "%S/%S", code_dir_path, gen_folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
String8 gen_folder = str8_lit("generated");
|
||||
layer_generated_folder = push_str8f(mg_arena, "%S/%S/%S", code_dir_path, layer->key, gen_folder);
|
||||
}
|
||||
if(os_make_directory(layer_generated_folder))
|
||||
{
|
||||
String8List layer_key_parts = str8_split_path(mg_arena, layer->key);
|
||||
@@ -425,13 +535,28 @@ int main(int argument_count, char **arguments)
|
||||
String8 layer_key_filename_upper = upper_from_str8(mg_arena, layer_key_filename);
|
||||
String8 h_path = push_str8f(mg_arena, "%S/%S.meta.h", layer_generated_folder, layer_key_filename);
|
||||
String8 c_path = push_str8f(mg_arena, "%S/%S.meta.c", layer_generated_folder, layer_key_filename);
|
||||
if(layer->h_name_override.size != 0)
|
||||
{
|
||||
h_path = push_str8f(mg_arena, "%S/%S", layer_generated_folder, str8_skip_last_slash(layer->h_name_override));
|
||||
}
|
||||
if(layer->c_name_override.size != 0)
|
||||
{
|
||||
c_path = push_str8f(mg_arena, "%S/%S", layer_generated_folder, str8_skip_last_slash(layer->c_name_override));
|
||||
}
|
||||
{
|
||||
FILE *h = fopen((char *)h_path.str, "w");
|
||||
fprintf(h, "// Copyright (c) 2024 Epic Games Tools\n");
|
||||
fprintf(h, "// Licensed under the MIT license (https://opensource.org/license/mit/)\n\n");
|
||||
if(layer->h_header.first == 0)
|
||||
{
|
||||
fprintf(h, "//- GENERATED CODE\n\n");
|
||||
fprintf(h, "#ifndef %.*s_META_H\n", str8_varg(layer_key_filename_upper));
|
||||
fprintf(h, "#define %.*s_META_H\n\n", str8_varg(layer_key_filename_upper));
|
||||
}
|
||||
else for(String8Node *n = layer->h_header.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, h);
|
||||
}
|
||||
for(String8Node *n = layer->enums.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, h);
|
||||
@@ -448,34 +573,74 @@ int main(int argument_count, char **arguments)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, h);
|
||||
}
|
||||
if(layer->h_tables.first != 0)
|
||||
{
|
||||
if(!layer->is_library)
|
||||
{
|
||||
fprintf(h, "C_LINKAGE_BEGIN\n");
|
||||
}
|
||||
for(String8Node *n = layer->h_tables.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, h);
|
||||
}
|
||||
fprintf(h, "\n");
|
||||
if(!layer->is_library)
|
||||
{
|
||||
fprintf(h, "C_LINKAGE_END\n\n");
|
||||
}
|
||||
}
|
||||
if(layer->h_footer.first == 0)
|
||||
{
|
||||
fprintf(h, "#endif // %.*s_META_H\n", str8_varg(layer_key_filename_upper));
|
||||
}
|
||||
else for(String8Node *n = layer->h_footer.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, h);
|
||||
}
|
||||
fclose(h);
|
||||
}
|
||||
{
|
||||
FILE *c = fopen((char *)c_path.str, "w");
|
||||
fprintf(c, "// Copyright (c) 2024 Epic Games Tools\n");
|
||||
fprintf(c, "// Licensed under the MIT license (https://opensource.org/license/mit/)\n\n");
|
||||
if(layer->c_header.first == 0)
|
||||
{
|
||||
fprintf(c, "//- GENERATED CODE\n\n");
|
||||
}
|
||||
else for(String8Node *n = layer->c_header.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, c);
|
||||
}
|
||||
for(String8Node *n = layer->c_catchall.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, c);
|
||||
}
|
||||
if(layer->c_tables.first != 0)
|
||||
{
|
||||
if(!layer->is_library)
|
||||
{
|
||||
fprintf(c, "C_LINKAGE_BEGIN\n");
|
||||
}
|
||||
for(String8Node *n = layer->c_tables.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, c);
|
||||
}
|
||||
if(!layer->is_library)
|
||||
{
|
||||
fprintf(c, "C_LINKAGE_END\n\n");
|
||||
}
|
||||
}
|
||||
for(String8Node *n = layer->c_functions.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, c);
|
||||
}
|
||||
fprintf(c, "C_LINKAGE_BEGIN\n");
|
||||
for(String8Node *n = layer->c_tables.first; n != 0; n = n->next)
|
||||
if(layer->c_footer.first != 0)
|
||||
{
|
||||
for(String8Node *n = layer->c_footer.first; n != 0; n = n->next)
|
||||
{
|
||||
fwrite(n->string.str, n->string.size, 1, c);
|
||||
}
|
||||
fprintf(c, "C_LINKAGE_END\n\n");
|
||||
}
|
||||
fclose(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1514,6 +1514,34 @@ extern "C"{
|
||||
#include "mule_c.h"
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Inline Line Info Tests
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define FORCE_INLINE __forceinline
|
||||
#elif defined(__clang__)
|
||||
# define FORCE_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
# error need force inline for this compiler
|
||||
#endif
|
||||
|
||||
static FORCE_INLINE void
|
||||
basic_inlinee(int inlinee_param_x, int inlinee_param_y, int inlinee_param_z)
|
||||
{
|
||||
OutputDebugStringA("A\n");
|
||||
OutputDebugStringA("B\n");
|
||||
OutputDebugStringA("C\n");
|
||||
OutputDebugStringA("D\n");
|
||||
}
|
||||
|
||||
static void
|
||||
basic_inline_tests(void)
|
||||
{
|
||||
OutputDebugStringA("{\n");
|
||||
basic_inlinee(12, 34, 56);
|
||||
OutputDebugStringA("}\n");
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Fancy Visualization Eval Tests
|
||||
|
||||
@@ -2269,6 +2297,14 @@ debug_string_tests(void)
|
||||
{
|
||||
OutputDebugStringA("Hello, World!\n");
|
||||
}
|
||||
char message[65409+1];
|
||||
memset(&message[0], '=', sizeof(message));
|
||||
for(int i = 1; i < sizeof(message); i += 128)
|
||||
{
|
||||
message[i] = '\n';
|
||||
}
|
||||
message[sizeof(message) - 1] = 0;
|
||||
OutputDebugStringA(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2280,6 +2316,10 @@ debug_string_tests(void)
|
||||
static void
|
||||
interrupt_stepping_tests(void)
|
||||
{
|
||||
__debugbreak();
|
||||
__debugbreak();
|
||||
__debugbreak();
|
||||
__debugbreak();
|
||||
for(int i = 0; i < 1000; i += 1)
|
||||
{
|
||||
if(i == 999)
|
||||
@@ -2297,6 +2337,19 @@ interrupt_stepping_tests(void)
|
||||
int x = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: JIT Stepping Tests
|
||||
|
||||
static void
|
||||
jit_stepping_tests(void)
|
||||
{
|
||||
OutputDebugString("A\n");
|
||||
VOID *code = VirtualAlloc(0, 0x1000, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||
*((uint32_t*)code) = 0xC39090CC;
|
||||
((void (__fastcall *)()) code)();
|
||||
OutputDebugString("B\n");
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Exception Stepping
|
||||
|
||||
@@ -2578,6 +2631,8 @@ mule_main(int argc, char** argv){
|
||||
|
||||
alloca_stepping_tests();
|
||||
|
||||
basic_inline_tests();
|
||||
|
||||
inline_stepping_tests();
|
||||
|
||||
overloaded_line_stepping_tests();
|
||||
@@ -2592,6 +2647,8 @@ mule_main(int argc, char** argv){
|
||||
|
||||
debug_string_tests();
|
||||
|
||||
jit_stepping_tests();
|
||||
|
||||
interrupt_stepping_tests();
|
||||
|
||||
exception_stepping_tests();
|
||||
|
||||
@@ -39,5 +39,4 @@ dll_type_eval_tests(void)
|
||||
Basics basics2 = {4, 5, 6, 7};
|
||||
int x = 0;
|
||||
(void)x;
|
||||
*(int *)0 = 0;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
__declspec(dllexport) int
|
||||
loop_iteration(int it)
|
||||
{
|
||||
return 111;
|
||||
#if 0
|
||||
//return 111;
|
||||
#if 1
|
||||
int sum = 0;
|
||||
for(int i = 0; i < 1000; i += 1)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main Layer Initialization
|
||||
|
||||
internal void
|
||||
mtx_init(void)
|
||||
{
|
||||
Arena *arena = arena_alloc();
|
||||
mtx_shared = push_array(arena, MTX_Shared, 1);
|
||||
mtx_shared->arena = arena;
|
||||
mtx_shared->slots_count = 256;
|
||||
mtx_shared->stripes_count = Min(mtx_shared->slots_count, os_logical_core_count());
|
||||
mtx_shared->slots = push_array(arena, MTX_Slot, mtx_shared->slots_count);
|
||||
mtx_shared->stripes = push_array(arena, MTX_Stripe, mtx_shared->stripes_count);
|
||||
for(U64 idx = 0; idx < mtx_shared->stripes_count; idx += 1)
|
||||
{
|
||||
mtx_shared->stripes[idx].arena = arena_alloc();
|
||||
mtx_shared->stripes[idx].rw_mutex = os_rw_mutex_alloc();
|
||||
}
|
||||
mtx_shared->mut_threads_count = Min(os_logical_core_count(), 4);
|
||||
mtx_shared->mut_threads = push_array(arena, MTX_MutThread, mtx_shared->mut_threads_count);
|
||||
for(U64 idx = 0; idx < mtx_shared->mut_threads_count; idx += 1)
|
||||
{
|
||||
mtx_shared->mut_threads[idx].ring_size = KB(64);
|
||||
mtx_shared->mut_threads[idx].ring_base = push_array_no_zero(arena, U8, mtx_shared->mut_threads[idx].ring_size);
|
||||
mtx_shared->mut_threads[idx].cv = os_condition_variable_alloc();
|
||||
mtx_shared->mut_threads[idx].mutex = os_mutex_alloc();
|
||||
mtx_shared->mut_threads[idx].thread = os_launch_thread(mtx_mut_thread__entry_point, &mtx_shared->mut_threads[idx], 0);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Buffer Operations
|
||||
|
||||
internal void
|
||||
mtx_push_op(U128 buffer_key, MTX_Op op)
|
||||
{
|
||||
MTX_MutThread *thread = &mtx_shared->mut_threads[buffer_key.u64[1]%mtx_shared->mut_threads_count];
|
||||
mtx_enqueue_op(thread, buffer_key, op);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Mutation Threads
|
||||
|
||||
internal void
|
||||
mtx_enqueue_op(MTX_MutThread *thread, U128 buffer_key, MTX_Op op)
|
||||
{
|
||||
// TODO(rjf): if op.replace is too big, need to split into multiple edits
|
||||
OS_MutexScope(thread->mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = thread->ring_write_pos - thread->ring_read_pos;
|
||||
U64 available_size = thread->ring_size - unconsumed_size;
|
||||
if(available_size >= sizeof(buffer_key) + sizeof(op.range) + sizeof(op.replace.size) + op.replace.size)
|
||||
{
|
||||
thread->ring_write_pos += ring_write_struct(thread->ring_base, thread->ring_size, thread->ring_write_pos, &buffer_key);
|
||||
thread->ring_write_pos += ring_write_struct(thread->ring_base, thread->ring_size, thread->ring_write_pos, &op.range);
|
||||
thread->ring_write_pos += ring_write_struct(thread->ring_base, thread->ring_size, thread->ring_write_pos, &op.replace.size);
|
||||
thread->ring_write_pos += ring_write(thread->ring_base, thread->ring_size, thread->ring_write_pos, op.replace.str, op.replace.size);
|
||||
thread->ring_write_pos += 7;
|
||||
thread->ring_write_pos -= thread->ring_write_pos%8;
|
||||
break;
|
||||
}
|
||||
os_condition_variable_wait(thread->cv, thread->mutex, max_U64);
|
||||
}
|
||||
os_condition_variable_broadcast(thread->cv);
|
||||
}
|
||||
|
||||
internal void
|
||||
mtx_dequeue_op(Arena *arena, MTX_MutThread *thread, U128 *buffer_key_out, MTX_Op *op_out)
|
||||
{
|
||||
OS_MutexScope(thread->mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = thread->ring_write_pos - thread->ring_read_pos;
|
||||
if(unconsumed_size >= sizeof(*buffer_key_out) + sizeof(op_out->range) + sizeof(op_out->replace.size))
|
||||
{
|
||||
thread->ring_read_pos += ring_read_struct(thread->ring_base, thread->ring_size, thread->ring_read_pos, buffer_key_out);
|
||||
thread->ring_read_pos += ring_read_struct(thread->ring_base, thread->ring_size, thread->ring_read_pos, &op_out->range);
|
||||
thread->ring_read_pos += ring_read_struct(thread->ring_base, thread->ring_size, thread->ring_read_pos, &op_out->replace.size);
|
||||
op_out->replace.str = push_array_no_zero(arena, U8, op_out->replace.size);
|
||||
thread->ring_read_pos += ring_read(thread->ring_base, thread->ring_size, thread->ring_read_pos, op_out->replace.str, op_out->replace.size);
|
||||
thread->ring_read_pos += 7;
|
||||
thread->ring_read_pos -= thread->ring_read_pos%8;
|
||||
break;
|
||||
}
|
||||
os_condition_variable_wait(thread->cv, thread->mutex, max_U64);
|
||||
}
|
||||
os_condition_variable_broadcast(thread->cv);
|
||||
}
|
||||
|
||||
internal void
|
||||
mtx_mut_thread__entry_point(void *p)
|
||||
{
|
||||
MTX_MutThread *mut_thread = (MTX_MutThread *)p;
|
||||
ThreadNameF("[mtx] mut thread #%I64u", (U64)(mut_thread - mtx_shared->mut_threads));
|
||||
for(;;)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
|
||||
//- rjf: get next op
|
||||
U128 buffer_key = {0};
|
||||
MTX_Op op = {0};
|
||||
mtx_dequeue_op(scratch.arena, mut_thread, &buffer_key, &op);
|
||||
|
||||
//- rjf: get buffer's current data
|
||||
U128 hash = hs_hash_from_key(buffer_key, 0);
|
||||
String8 data = hs_data_from_hash(hs_scope, hash);
|
||||
|
||||
//- rjf: clamp op by data
|
||||
op.range.min = Min(op.range.min, data.size);
|
||||
op.range.max = Min(op.range.max, data.size);
|
||||
|
||||
//- rjf: construct new buffer
|
||||
if(op.range.max != op.range.min || op.replace.size != 0)
|
||||
{
|
||||
U64 new_data_size = data.size + op.replace.size - dim_1u64(op.range);
|
||||
Arena *arena = arena_alloc__sized(new_data_size + ARENA_HEADER_SIZE, new_data_size + ARENA_HEADER_SIZE);
|
||||
U8 *new_data_base = push_array_no_zero(arena, U8, new_data_size);
|
||||
String8 pre_replace_data = str8_substr(data, r1u64(0, op.range.min));
|
||||
String8 post_replace_data = str8_substr(data, r1u64(op.range.max, data.size));
|
||||
if(pre_replace_data.size != 0)
|
||||
{
|
||||
MemoryCopy(new_data_base+0, pre_replace_data.str, pre_replace_data.size);
|
||||
}
|
||||
if(op.replace.size != 0)
|
||||
{
|
||||
MemoryCopy(new_data_base+pre_replace_data.size, op.replace.str, op.replace.size);
|
||||
}
|
||||
if(post_replace_data.size != 0)
|
||||
{
|
||||
MemoryCopy(new_data_base+pre_replace_data.size+op.replace.size, post_replace_data.str, post_replace_data.size);
|
||||
}
|
||||
String8 new_data = str8(new_data_base, new_data_size);
|
||||
hs_submit_data(buffer_key, &arena, new_data);
|
||||
}
|
||||
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef MUTABLE_TEXT_H
|
||||
#define MUTABLE_TEXT_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Types
|
||||
|
||||
typedef struct MTX_Node MTX_Node;
|
||||
struct MTX_Node
|
||||
{
|
||||
MTX_Node *next;
|
||||
MTX_Node *prev;
|
||||
U128 key;
|
||||
};
|
||||
|
||||
typedef struct MTX_Slot MTX_Slot;
|
||||
struct MTX_Slot
|
||||
{
|
||||
MTX_Node *first;
|
||||
MTX_Node *last;
|
||||
};
|
||||
|
||||
typedef struct MTX_Stripe MTX_Stripe;
|
||||
struct MTX_Stripe
|
||||
{
|
||||
Arena *arena;
|
||||
MTX_Node *free_node;
|
||||
OS_Handle rw_mutex;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Mutation Thread Types
|
||||
|
||||
typedef struct MTX_Op MTX_Op;
|
||||
struct MTX_Op
|
||||
{
|
||||
Rng1U64 range;
|
||||
String8 replace;
|
||||
};
|
||||
|
||||
typedef struct MTX_MutThread MTX_MutThread;
|
||||
struct MTX_MutThread
|
||||
{
|
||||
U64 ring_size;
|
||||
U8 *ring_base;
|
||||
U64 ring_read_pos;
|
||||
U64 ring_write_pos;
|
||||
OS_Handle cv;
|
||||
OS_Handle mutex;
|
||||
OS_Handle thread;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Shared State
|
||||
|
||||
typedef struct MTX_Shared MTX_Shared;
|
||||
struct MTX_Shared
|
||||
{
|
||||
Arena *arena;
|
||||
|
||||
// rjf: buffer cache
|
||||
U64 slots_count;
|
||||
U64 stripes_count;
|
||||
MTX_Slot *slots;
|
||||
MTX_Stripe *stripes;
|
||||
|
||||
// rjf: mut threads
|
||||
U64 mut_threads_count;
|
||||
MTX_MutThread *mut_threads;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
global MTX_Shared *mtx_shared = 0;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main Layer Initialization
|
||||
|
||||
internal void mtx_init(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Buffer Operations
|
||||
|
||||
internal void mtx_push_op(U128 buffer_key, MTX_Op op);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Mutation Threads
|
||||
|
||||
internal void mtx_enqueue_op(MTX_MutThread *thread, U128 buffer_key, MTX_Op op);
|
||||
internal void mtx_dequeue_op(Arena *arena, MTX_MutThread *thread, U128 *buffer_key_out, MTX_Op *op_out);
|
||||
internal void mtx_mut_thread__entry_point(void *p);
|
||||
|
||||
#endif // MUTABLE_TEXT_H
|
||||
@@ -34,7 +34,7 @@ typedef struct OS_FileIter OS_FileIter;
|
||||
struct OS_FileIter
|
||||
{
|
||||
OS_FileIterFlags flags;
|
||||
U8 memory[600];
|
||||
U8 memory[800];
|
||||
};
|
||||
|
||||
typedef struct OS_FileInfo OS_FileInfo;
|
||||
|
||||
@@ -41,10 +41,14 @@ typedef PVOID W32_MapViewOfFile3_Type(HANDLE FileMapping,
|
||||
ULONG PageProtection,
|
||||
void* ExtendedParameters,
|
||||
ULONG ParameterCount);
|
||||
typedef HRESULT W32_SetThreadDescription_Type(HANDLE hThread,
|
||||
PCWSTR lpThreadDescription);
|
||||
|
||||
global W32_VirtualAlloc2_Type *w32_VirtualAlloc2_func = 0;
|
||||
global W32_MapViewOfFile3_Type *w32_MapViewOfFile3_func = 0;
|
||||
|
||||
global W32_SetThreadDescription_Type *w32_SetThreadDescription_func = 0;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
@@ -193,6 +197,8 @@ os_init(void)
|
||||
if (module != 0){
|
||||
w32_VirtualAlloc2_func = (W32_VirtualAlloc2_Type*)GetProcAddress(module, "VirtualAlloc2");
|
||||
w32_MapViewOfFile3_func = (W32_MapViewOfFile3_Type*)GetProcAddress(module, "MapViewOfFile3");
|
||||
w32_SetThreadDescription_func = (W32_SetThreadDescription_Type*)GetProcAddress(module, "SetThreadDescription");
|
||||
|
||||
FreeLibrary(module);
|
||||
}
|
||||
}
|
||||
@@ -597,9 +603,10 @@ os_set_thread_name(String8 name)
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
// rjf: windows 10 style
|
||||
if(w32_SetThreadDescription_func)
|
||||
{
|
||||
String16 name16 = str16_from_8(scratch.arena, name);
|
||||
HRESULT hr = SetThreadDescription(GetCurrentThread(), (WCHAR*)name16.str);
|
||||
HRESULT hr = w32_SetThreadDescription_func(GetCurrentThread(), (WCHAR*)name16.str);
|
||||
}
|
||||
|
||||
// rjf: raise-exception style
|
||||
@@ -957,7 +964,27 @@ os_file_iter_begin(Arena *arena, String8 path, OS_FileIterFlags flags)
|
||||
OS_FileIter *iter = push_array(arena, OS_FileIter, 1);
|
||||
iter->flags = flags;
|
||||
W32_FileIter *w32_iter = (W32_FileIter*)iter->memory;
|
||||
if(path.size == 0)
|
||||
{
|
||||
w32_iter->is_volume_iter = 1;
|
||||
WCHAR buffer[512] = {0};
|
||||
DWORD length = GetLogicalDriveStringsW(sizeof(buffer), buffer);
|
||||
String8List drive_strings = {0};
|
||||
for(U64 off = 0; off < (U64)length;)
|
||||
{
|
||||
String16 next_drive_string_16 = str16_cstring((U16 *)buffer+off);
|
||||
off += next_drive_string_16.size+1;
|
||||
String8 next_drive_string = str8_from_16(arena, next_drive_string_16);
|
||||
next_drive_string = str8_chop_last_slash(next_drive_string);
|
||||
str8_list_push(scratch.arena, &drive_strings, next_drive_string);
|
||||
}
|
||||
w32_iter->drive_strings = str8_array_from_list(arena, &drive_strings);
|
||||
w32_iter->drive_strings_iter_idx = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
w32_iter->handle = FindFirstFileW((WCHAR*)path16.str, &w32_iter->find_data);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return iter;
|
||||
}
|
||||
@@ -968,6 +995,12 @@ os_file_iter_next(Arena *arena, OS_FileIter *iter, OS_FileInfo *info_out)
|
||||
B32 result = 0;
|
||||
OS_FileIterFlags flags = iter->flags;
|
||||
W32_FileIter *w32_iter = (W32_FileIter*)iter->memory;
|
||||
switch(w32_iter->is_volume_iter)
|
||||
{
|
||||
//- rjf: file iteration
|
||||
default:
|
||||
case 0:
|
||||
{
|
||||
if (!(flags & OS_FileIterFlag_Done) && w32_iter->handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
do
|
||||
@@ -1013,10 +1046,25 @@ os_file_iter_next(Arena *arena, OS_FileIter *iter, OS_FileInfo *info_out)
|
||||
break;
|
||||
}
|
||||
}while(FindNextFileW(w32_iter->handle, &w32_iter->find_data));
|
||||
|
||||
if (!result){
|
||||
iter->flags |= OS_FileIterFlag_Done;
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: volume iteration
|
||||
case 1:
|
||||
{
|
||||
result = w32_iter->drive_strings_iter_idx < w32_iter->drive_strings.count;
|
||||
if(result != 0)
|
||||
{
|
||||
MemoryZeroStruct(info_out);
|
||||
info_out->name = w32_iter->drive_strings.v[w32_iter->drive_strings_iter_idx];
|
||||
info_out->props.flags |= FilePropertyFlag_IsFolder;
|
||||
w32_iter->drive_strings_iter_idx += 1;
|
||||
}
|
||||
}break;
|
||||
}
|
||||
if(!result)
|
||||
{
|
||||
iter->flags |= OS_FileIterFlag_Done;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ struct W32_FileIter
|
||||
{
|
||||
HANDLE handle;
|
||||
WIN32_FIND_DATAW find_data;
|
||||
B32 is_volume_iter;
|
||||
String8Array drive_strings;
|
||||
U64 drive_strings_iter_idx;
|
||||
};
|
||||
StaticAssert(sizeof(Member(OS_FileIter, memory)) >= sizeof(W32_FileIter), file_iter_memory_size);
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ OS_Key_COUNT,
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 os_g_key_display_string_table[143];
|
||||
extern String8 os_g_key_cfg_string_table[143];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
#endif // OS_GFX_META_H
|
||||
|
||||
+6
-1
@@ -170,8 +170,13 @@ internal F32 os_caret_blink_time(void);
|
||||
internal F32 os_default_refresh_rate(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native Messages & Panics (Implemented Per-OS)
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void os_graphical_message(B32 error, String8 title, String8 message);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void os_show_in_filesystem_ui(String8 path);
|
||||
|
||||
#endif // OS_GRAPHICAL_H
|
||||
|
||||
@@ -240,9 +240,17 @@ os_granular_sleep_enabled(void)
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native Messages & Panics (Implemented Per-OS)
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_message(B32 error, String8 title, String8 message)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void
|
||||
os_show_in_filesystem_ui(String8 path)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1421,7 +1421,7 @@ os_default_refresh_rate(void)
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native Messages & Panics (Implemented Per-OS)
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_message(B32 error, String8 title, String8 message)
|
||||
@@ -1432,3 +1432,30 @@ os_graphical_message(B32 error, String8 title, String8 message)
|
||||
MessageBoxW(0, (WCHAR *)message16.str, (WCHAR *)title16.str, MB_OK|(!!error*MB_ICONERROR));
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void
|
||||
os_show_in_filesystem_ui(String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 path_copy = push_str8_copy(scratch.arena, path);
|
||||
for(U64 idx = 0; idx < path_copy.size; idx += 1)
|
||||
{
|
||||
if(path_copy.str[idx] == '/')
|
||||
{
|
||||
path_copy.str[idx] = '\\';
|
||||
}
|
||||
}
|
||||
String16 path16 = str16_from_8(scratch.arena, path_copy);
|
||||
SFGAOF flags = 0;
|
||||
PIDLIST_ABSOLUTE list = 0;
|
||||
if(path16.size != 0 && SUCCEEDED(SHParseDisplayName(path16.str, 0, &list, 0, &flags)))
|
||||
{
|
||||
HRESULT hr = SHOpenFolderAndSelectItems(list, 0, 0, 0);
|
||||
CoTaskMemFree(list);
|
||||
(void)hr;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
+6
-13
@@ -77,14 +77,6 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
|
||||
//
|
||||
F32 dt = 1.f/target_hz;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: last frame before sleep -> disable txti change detection
|
||||
//
|
||||
if(df_gfx_state->num_frames_requested == 0)
|
||||
{
|
||||
txti_set_external_change_detection_enabled(0);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: get events from the OS
|
||||
//
|
||||
@@ -94,11 +86,6 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
|
||||
events = os_get_events(scratch.arena, df_gfx_state->num_frames_requested == 0);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: enable txti change detection
|
||||
//
|
||||
txti_set_external_change_detection_enabled(1);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: begin measuring actual per-frame work
|
||||
//
|
||||
@@ -343,7 +330,13 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
|
||||
d_begin_frame();
|
||||
for(DF_Window *w = df_gfx_state->first_window; w != 0; w = w->next)
|
||||
{
|
||||
df_push_interact_regs();
|
||||
df_window_update_and_render(scratch.arena, w, &cmds);
|
||||
DF_InteractRegs *window_regs = df_pop_interact_regs();
|
||||
if(os_window_is_focused(w->os))
|
||||
{
|
||||
MemoryCopyStruct(df_interact_regs(), window_regs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+126
-92
@@ -4,15 +4,28 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Frontend/UI Pass Tasks
|
||||
//
|
||||
// [ ] auto-scroll output window
|
||||
// [ ] inline breakpoint hit_count
|
||||
// [ ] to count hit counts, resolve all bps to addresses, check addresses
|
||||
// against stopper thread's
|
||||
// [ ] editing multiple bindings for commands
|
||||
// [ ] theme lister -> fonts & font sizes
|
||||
// [ ] "Browse..." buttons should adopt a more relevant starting search path,
|
||||
// if possible
|
||||
// [ ] move breakpoints to being a global thing, not nested to particular files
|
||||
// [ ] visualize all breakpoints everywhere - source view should show up in
|
||||
// disasm, disasm should show up in source view, function should show up in
|
||||
// both, etc.
|
||||
// [ ] ** Function breakpoints should show up in the source listing. Without
|
||||
// them being visible, it is confusing when you run and you stop there,
|
||||
// because you're like "wait why did it stop" and then you later remember
|
||||
// that's because there was a function breakpoint there.
|
||||
//
|
||||
// [ ] n-row table selection, in watch window & other UIs, multi-selection
|
||||
// ctrl+C
|
||||
//
|
||||
// [ ] theme colors -> more explicit about e.g. opaque backgrounds vs. floating
|
||||
// & scrollbars etc.
|
||||
// [ ] target/breakpoint/watch-pin reordering
|
||||
// [ ] visualize remapped files (via path map)
|
||||
// [ ] theme lister -> fonts & font sizes
|
||||
//
|
||||
// [ ] font lister
|
||||
// [ ] per-panel font size overrides
|
||||
//
|
||||
@@ -26,42 +39,40 @@
|
||||
// that you use to tag them. Just some way that would make it easier to
|
||||
// focus on your own threads.
|
||||
//
|
||||
// [ ] it would be nice to have "show in explorer" for right click on source
|
||||
// file tab (opens explorer & selects the file)
|
||||
//
|
||||
// [ ] what's up with decimal number coloring where every group of 3 are in
|
||||
// different color? can I turn it off? And why sometimes digits in number
|
||||
// start with brighter color, but sometimes with darker - shouldn't it
|
||||
// always have the same color ordering?
|
||||
// [ ] "concept key stack"; basically, any point in UI builder path has a stack
|
||||
// of active "concept keys", which can be used to e.g. build context menus
|
||||
// automatically (could just be a per-box attachment; right-click any
|
||||
// point, search up the tree and see the concept keys)
|
||||
// [ ] ui_next_event(...), built-in focus filtering, no need to manually check
|
||||
// if(ui_is_focus_active())
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hot, High Priority Tasks (Complete Unusability, Crashes, Fire-Worthy)
|
||||
//
|
||||
// [ ] PDB files distributed with the build are not found by DbgHelp!!!
|
||||
// [ ] Jai compiler debugging crash
|
||||
//
|
||||
// [ ] Jump table thunks, on code w/o /INCREMENTAL:NO
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hot, Medium Priority Tasks (Low-Hanging-Fruit Features, UI Jank, Cleanup)
|
||||
//
|
||||
// [ ] Setting the code_font/main_font values to a font name doesn't work.
|
||||
// Should probably make note that you have to set it to a path to a TTF,
|
||||
// since that's not normally how Windows fonts work.
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hot, Medium Priority Tasks (Low-Hanging-Fruit Features, UI Jank, Cleanup)
|
||||
//
|
||||
// [ ] "root" concept in hash store, which buckets keys & allows usage code to
|
||||
// jettison a collection of keys in retained mode fashion
|
||||
//
|
||||
// [ ] Jeff Notes
|
||||
// [ ] highlighted text & ctrl+f -> auto-fill search query
|
||||
// [ ] double-click any part of frame in callstack view -> snap to function
|
||||
// [ ] sort locals by appearance in source code (or maybe just debug info)
|
||||
// [ ] sum view rule
|
||||
// [ ] plot view rule
|
||||
// [ ] histogram view rule
|
||||
// [ ] max view rule
|
||||
// [ ] min view rule
|
||||
// [ ] double click on procedure in procedures tab to jump to source
|
||||
//
|
||||
// [ ] filesystem drag/drop support
|
||||
// [ ] double-click vs. single-click for folder navigation, see if we can infer
|
||||
// [ ] use backslashes on windows by default, forward slashes elsewhere
|
||||
//
|
||||
// [ ] investigate /DEBUG:FASTLINK - can we somehow alert that we do not
|
||||
// support it?
|
||||
@@ -77,6 +88,10 @@
|
||||
// sense once I use the debugger more, but I just thought I'd make a note
|
||||
// to say that I was confused about it after reading the manual, so
|
||||
// perhaps you could elaborate a little more on it in there.
|
||||
// [ ] It wasn't clear to me how you save a user or project file. I can see
|
||||
// how to load them, but not how you save them. Obviously I can just copy
|
||||
// the files myself in the shell, but it seemed weird that there was no
|
||||
// "save" option in the menus.
|
||||
//
|
||||
// [ ] Right-clicking on a thread in the Scheduler window pops up a context
|
||||
// menu, but you can't actually see it because the tooltip for the thread
|
||||
@@ -88,11 +103,6 @@
|
||||
// actual items (ie., it doesn't resize the listing based on what's
|
||||
// actually visible)
|
||||
//
|
||||
// [ ] ** Function breakpoints should show up in the source listing. Without
|
||||
// them being visible, it is confusing when you run and you stop there,
|
||||
// because you're like "wait why did it stop" and then you later remember
|
||||
// that's because there was a function breakpoint there.
|
||||
//
|
||||
// [ ] ** One very nice feature of RemedyBG that I use all the time is the
|
||||
// ability to put "$err, hr" into the watch window, which will just show
|
||||
// the value of GetLastError() as a string. This is super useful for
|
||||
@@ -102,10 +112,6 @@
|
||||
// [ ] lock icon
|
||||
// [ ] "rotation arrow" icon next to executables
|
||||
//
|
||||
// [ ] Using the word "symbol" in "Code (Symbol)" seems like a bad idea, since
|
||||
// you're referring to non-identifier characters, but in a debugger
|
||||
// "symbol" usually means something defined in the debug information.
|
||||
//
|
||||
// [ ] I LOVE ALT-W to add watch under cursor, but I would prefer to have it
|
||||
// add what's under the MOUSE cursor instead of the keyboard cursor. Can
|
||||
// we get a command for that so I can bind ALT-W to that instead?
|
||||
@@ -115,23 +121,6 @@
|
||||
// color to white (or the inverse of the background color, or whatever) so
|
||||
// that the user can see what things on the screen use that theme color.
|
||||
//
|
||||
// [ ] I couldn't figure out how to affect the "dim" color in constants that
|
||||
// have alternating bright/dim letters to show sections of a number. Is
|
||||
// this in the theme colors somewhere?
|
||||
//
|
||||
// [ ] ** Scrollbars are barely visible for me, for some reason. I could not
|
||||
// find anything in the theme that would fill them with a solid, bright
|
||||
// color. Instead they are just a thin outline and the same color as the
|
||||
// scroll bar background.
|
||||
//
|
||||
// [ ] Many of the UI elements, like the menus, would like better if they had
|
||||
// a little bit of margin. Having the text right next to the edges, and
|
||||
// with no line spacing, makes it harder to read things quickly.
|
||||
//
|
||||
// [ ] Menus take too long to show up. I would prefer it if they were instant.
|
||||
// The animation doesn't really provide any useful cues, since I know
|
||||
// where the menu came from.
|
||||
//
|
||||
// [ ] Theme window should include font scaling. I was able to find the
|
||||
// command for increasing the font scale, but I imagine most people
|
||||
// wouldn't think to look there.
|
||||
@@ -141,47 +130,13 @@
|
||||
// [ ] It'd be nice to have a "goto byte" option for source views, for jumping
|
||||
// to error messages that are byte-based instead of line-based.
|
||||
//
|
||||
// [ ] Pressing the left mouse button on the menu bar and dragging does not
|
||||
// move through the menus as expected - instead, it opens the one you
|
||||
// clicked down on, then does nothing until you release, at which point it
|
||||
// opens the menu you released on.
|
||||
// [ ] Similarly, pressing the left mouse button on a menu and dragging to an
|
||||
// item, then releasing, does not trigger that item as expected. Instead,
|
||||
// it is a nop, and it waits for you to click again on the item.
|
||||
//
|
||||
// [ ] I found the "context menu" convention to be confusing. For example, if
|
||||
// I left-click on a tab, it selects the tab. If I right-click on a tab,
|
||||
// it opens the context menu. However, if I left-click on a module, it
|
||||
// opens the context window. It seems like maybe menus should be right,
|
||||
// and left should do the default action, more consistently?
|
||||
//
|
||||
// [ ] It wasn't clear to me how you save a user or profile file. I can see
|
||||
// how to load them, but not how you save them. Obviously I can just copy
|
||||
// the files myself in the shell, but it seemed weird that there was no
|
||||
// "save" option in the menus.
|
||||
//
|
||||
// [ ] @feature debug info overrides (both path-based AND module-based)
|
||||
// [ ] configure tab size
|
||||
// [ ] auto-scroll output window
|
||||
//
|
||||
// [ ] C++ virtual inheritance member visualization in watch window
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hot, Low Priority Tasks (UI Opinions, Less-Serious Jank, Preferences, Cleanup)
|
||||
//
|
||||
// [ ] ** In the call stack, I would like to be able to click quickly and move
|
||||
// around the stack. Right now, you can do that with the first and third
|
||||
// column, but the second column drops down a context menu. Since right
|
||||
// click is already for context menus, can it not just be that double-
|
||||
// clicking any column jumps to that stack frame?
|
||||
//
|
||||
// [ ] ** I find it really hard to read the code with the heavyweight lines
|
||||
// running through it for breakpoints and stepping and things. Is there a
|
||||
// way to turn the lines off? AFAICT they are based on thread and
|
||||
// breakpoint color, so you can't really control the line drawing? I might
|
||||
// be fine with them, but they would have to be much more light (like
|
||||
// alpha 0.1 or something)
|
||||
//
|
||||
// [ ] The hex format for color values in the config file was a real
|
||||
// mindbender. It's prefixed with "0x", so I was assuming it was either
|
||||
// Windows Big Endian (0xAARRGGBB) or Mac Little Endian (0xAABBGGRR). To
|
||||
@@ -193,16 +148,6 @@
|
||||
// that is "page up" / "page down", but here it is "smooth scroll upward"
|
||||
// / "smooth scroll downward" for some reason?
|
||||
//
|
||||
// [ ] Hitting ESC during a color picker drag should abort the color picking
|
||||
// and revert to the previous color. Currently, it just accepts the last
|
||||
// drag result as the new color.
|
||||
//
|
||||
// [ ] It was not clear to me why a small "tab picker" appeared when I got to
|
||||
// a certain number of tabs. It seemed to appear even if the tabs were
|
||||
// quite large, and there was no need to a drop-down menu to pick them. It
|
||||
// feels like either it should always be there, or it should only show up
|
||||
// if at least one tab gets small enough to have its name cut off?
|
||||
//
|
||||
// [ ] can it ignore stepping into _RTC_CheckStackVars generated functions?
|
||||
// [ ] mouse back button should make view to go back after I double clicked
|
||||
// on function to open it
|
||||
@@ -213,19 +158,23 @@
|
||||
// [ ] default font size is too small for me - not only source code, but
|
||||
// menus/tab/watch names (which don't resize). Maybe you could query
|
||||
// Windows for initial font size?
|
||||
// [ ] zooming behaves very strangely - sometimes it zooms source code,
|
||||
// sometimes both source code and menu/tab/watch font size, sometimes
|
||||
// just menu/tab/watch font size not source size.
|
||||
// [ ] icon fonts glyphs sometimes disappear for specific font size, but they
|
||||
// reappear if you go +1 higher or -1 lower. Mostly red triangle in watch
|
||||
// values for "unknown identifier". But also yellow arrow in call stack
|
||||
// disappears if font size gets too large.
|
||||
// [ ] undo close tab would be nice. If not for everything, then at least
|
||||
// just for source files
|
||||
// [ ] Jump table thunks, on code w/o /INCREMENTAL:NO
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hot, Feature Tasks (Not really "low priority" but less urgent than fixes)
|
||||
//
|
||||
// [ ] @eval_upgrade
|
||||
// [ ] new eval system; support strings, many address spaces, many debug
|
||||
// infos, wide/async transforms (e.g. diff(blob1, blob2))
|
||||
// [ ] collapse frontend visualization systems - source view, disasm view,
|
||||
// callstack, modules, scheduler, should *all* be flavors of watch view
|
||||
//
|
||||
// [ ] Fancy View Rules
|
||||
// [ ] table column boundaries should be checked against *AFTER* table
|
||||
// contents, not before
|
||||
@@ -376,6 +325,91 @@
|
||||
// path - must invalidate naturally when new filetime occurs)
|
||||
// [x] rdi file regeneration too strict
|
||||
// [x] raddbg jai.exe my_file.jai -- foobar -> raddbg consumes `--` incorrectly
|
||||
// [x] mouse-driven way to complete file/folder selection, or more generally
|
||||
// query completion
|
||||
// [x] it would be nice to have "show in explorer" for right click on source
|
||||
// file tab (opens explorer & selects the file)
|
||||
// [x] asan stepping breakage
|
||||
// [x] what's up with decimal number coloring where every group of 3 are in
|
||||
// different color? can I turn it off? And why sometimes digits in number
|
||||
// start with brighter color, but sometimes with darker - shouldn't it
|
||||
// always have the same color ordering?
|
||||
// [x] fix tabs-on-bottom positioning
|
||||
// [x] colors: consistent tooltip styles (colors, font flags, etc.)
|
||||
// [x] colors: scroll bars
|
||||
// [x] colors: watch window navigation visuals
|
||||
// [x] floating source view margin background/placement
|
||||
// [x] "interaction root", or "group" ui_key, or something; used for menu bar interactions
|
||||
// [x] theme colors -> more explicit about e.g. opaque backgrounds vs. floating
|
||||
// & scrollbars etc.
|
||||
// [x] Pressing the left mouse button on the menu bar and dragging does not
|
||||
// move through the menus as expected - instead, it opens the one you
|
||||
// clicked down on, then does nothing until you release, at which point it
|
||||
// opens the menu you released on.
|
||||
// [x] Similarly, pressing the left mouse button on a menu and dragging to an
|
||||
// item, then releasing, does not trigger that item as expected. Instead,
|
||||
// it is a nop, and it waits for you to click again on the item.
|
||||
// [x] Using the word "symbol" in "Code (Symbol)" seems like a bad idea, since
|
||||
// you're referring to non-identifier characters, but in a debugger
|
||||
// "symbol" usually means something defined in the debug information.
|
||||
// [x] I couldn't figure out how to affect the "dim" color in constants that
|
||||
// have alternating bright/dim letters to show sections of a number. Is
|
||||
// this in the theme colors somewhere?
|
||||
//
|
||||
// [x] ** Scrollbars are barely visible for me, for some reason. I could not
|
||||
// find anything in the theme that would fill them with a solid, bright
|
||||
// color. Instead they are just a thin outline and the same color as the
|
||||
// scroll bar background.
|
||||
//
|
||||
// [x] Many of the UI elements, like the menus, would like better if they had
|
||||
// a little bit of margin. Having the text right next to the edges, and
|
||||
// with no line spacing, makes it harder to read things quickly.
|
||||
// [x] colors: memory view
|
||||
// [x] Hitting ESC during a color picker drag should abort the color picking
|
||||
// and revert to the previous color. Currently, it just accepts the last
|
||||
// drag result as the new color.
|
||||
// [x] It was not clear to me why a small "tab picker" appeared when I got to
|
||||
// a certain number of tabs. It seemed to appear even if the tabs were
|
||||
// quite large, and there was no need to a drop-down menu to pick them. It
|
||||
// feels like either it should always be there, or it should only show up
|
||||
// if at least one tab gets small enough to have its name cut off?
|
||||
// [x] I found the "context menu" convention to be confusing. For example, if
|
||||
// I left-click on a tab, it selects the tab. If I right-click on a tab,
|
||||
// it opens the context menu. However, if I left-click on a module, it
|
||||
// opens the context window. It seems like maybe menus should be right,
|
||||
// and left should do the default action, more consistently?
|
||||
//
|
||||
// [x] double click on procedure in procedures tab to jump to source
|
||||
// [x] highlighted text & ctrl+f -> auto-fill search query
|
||||
// [x] double-click any part of frame in callstack view -> snap to function
|
||||
// [x] Menus take too long to show up. I would prefer it if they were instant.
|
||||
// The animation doesn't really provide any useful cues, since I know
|
||||
// where the menu came from.
|
||||
// [x] user settings (ui & functionality - generally need a story for it)
|
||||
// [x] hover animations
|
||||
// [x] press animations
|
||||
// [x] focus animations
|
||||
// [x] tooltip animations
|
||||
// [x] context menu animations
|
||||
// [x] scrolling animations
|
||||
// [x] background blur
|
||||
// [x] tab width
|
||||
// [x] ** In the call stack, I would like to be able to click quickly and move
|
||||
// around the stack. Right now, you can do that with the first and third
|
||||
// column, but the second column drops down a context menu. Since right
|
||||
// click is already for context menus, can it not just be that double-
|
||||
// clicking any column jumps to that stack frame?
|
||||
//
|
||||
// [x] ** I find it really hard to read the code with the heavyweight lines
|
||||
// running through it for breakpoints and stepping and things. Is there a
|
||||
// way to turn the lines off? AFAICT they are based on thread and
|
||||
// breakpoint color, so you can't really control the line drawing? I might
|
||||
// be fine with them, but they would have to be much more light (like
|
||||
// alpha 0.1 or something)
|
||||
// [x] zooming behaves very strangely - sometimes it zooms source code,
|
||||
// sometimes both source code and menu/tab/watch font size, sometimes
|
||||
// just menu/tab/watch font size not source size.
|
||||
// [x] colors: fill out rest of theme presets for new theme setup
|
||||
|
||||
#ifndef RADDBG_H
|
||||
#define RADDBG_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#define BUILD_VERSION_MAJOR 0
|
||||
#define BUILD_VERSION_MINOR 9
|
||||
#define BUILD_VERSION_PATCH 10
|
||||
#define BUILD_VERSION_PATCH 11
|
||||
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||
#define BUILD_TITLE "The RAD Debugger"
|
||||
#define OS_FEATURE_GRAPHICAL 1
|
||||
@@ -22,10 +22,6 @@
|
||||
//~ rjf: Includes
|
||||
|
||||
//- rjf: [lib]
|
||||
#include "lib_rdi_format/rdi_format.h"
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
#include "lib_rdi_format/rdi_format_parse.h"
|
||||
#include "lib_rdi_format/rdi_format_parse.c"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
||||
|
||||
@@ -34,13 +30,14 @@
|
||||
#include "os/os_inc.h"
|
||||
#include "task_system/task_system.h"
|
||||
#include "ico/ico.h"
|
||||
#include "rdi_make_local/rdi_make_local.h"
|
||||
#include "rdi_format/rdi_format_local.h"
|
||||
#include "rdi_make/rdi_make_local.h"
|
||||
#include "mdesk/mdesk.h"
|
||||
#include "hash_store/hash_store.h"
|
||||
#include "file_stream/file_stream.h"
|
||||
#include "text_cache/text_cache.h"
|
||||
#include "mutable_text/mutable_text.h"
|
||||
#include "path/path.h"
|
||||
#include "txti/txti.h"
|
||||
#include "coff/coff.h"
|
||||
#include "pe/pe.h"
|
||||
#include "codeview/codeview.h"
|
||||
@@ -73,13 +70,14 @@
|
||||
#include "os/os_inc.c"
|
||||
#include "task_system/task_system.c"
|
||||
#include "ico/ico.c"
|
||||
#include "rdi_make_local/rdi_make_local.c"
|
||||
#include "rdi_format/rdi_format_local.c"
|
||||
#include "rdi_make/rdi_make_local.c"
|
||||
#include "mdesk/mdesk.c"
|
||||
#include "hash_store/hash_store.c"
|
||||
#include "file_stream/file_stream.c"
|
||||
#include "text_cache/text_cache.c"
|
||||
#include "mutable_text/mutable_text.c"
|
||||
#include "path/path.c"
|
||||
#include "txti/txti.c"
|
||||
#include "coff/coff.c"
|
||||
#include "pe/pe.c"
|
||||
#include "codeview/codeview.c"
|
||||
@@ -340,7 +338,7 @@ entry_point(CmdLine *cmd_line)
|
||||
}
|
||||
if(msg.size != 0)
|
||||
{
|
||||
log_infof("IPC message received: \"%S\"", msg);
|
||||
log_infof("ipc_msg: \"%S\"", msg);
|
||||
DF_Window *dst_window = df_gfx_state->first_window;
|
||||
for(DF_Window *window = dst_window; window != 0; window = window->next)
|
||||
{
|
||||
@@ -517,21 +515,30 @@ entry_point(CmdLine *cmd_line)
|
||||
bake2srlz = p2r_bake(scratch.arena, convert2bake);
|
||||
}
|
||||
|
||||
//- rjf: serialize
|
||||
P2R_Serialize2File *srlz2file = 0;
|
||||
ProfScope("serialize")
|
||||
{
|
||||
srlz2file = push_array(scratch.arena, P2R_Serialize2File, 1);
|
||||
srlz2file->bundle = rdim_serialized_section_bundle_from_bake_results(&bake2srlz->bake_results);
|
||||
}
|
||||
|
||||
//- rjf: compress
|
||||
P2R_Bake2Serialize *bake2srlz_compressed = bake2srlz;
|
||||
P2R_Serialize2File *srlz2file_compressed = srlz2file;
|
||||
if(cmd_line_has_flag(cmd_line, str8_lit("compress"))) ProfScope("compress")
|
||||
{
|
||||
bake2srlz_compressed = p2r_compress(scratch.arena, bake2srlz);
|
||||
srlz2file_compressed = push_array(scratch.arena, P2R_Serialize2File, 1);
|
||||
srlz2file_compressed = p2r_compress(scratch.arena, srlz2file);
|
||||
}
|
||||
|
||||
//- rjf: serialize
|
||||
String8List serialize_out = rdim_serialized_strings_from_params_bake_section_list(scratch.arena, &convert2bake->bake_params, &bake2srlz_compressed->sections);
|
||||
String8List blobs = rdim_file_blobs_from_section_bundle(scratch.arena, &srlz2file_compressed->bundle);
|
||||
|
||||
//- rjf: write
|
||||
if(out_file_is_good)
|
||||
{
|
||||
U64 off = 0;
|
||||
for(String8Node *n = serialize_out.first; n != 0; n = n->next)
|
||||
for(String8Node *n = blobs.first; n != 0; n = n->next)
|
||||
{
|
||||
os_file_write(out_file, r1u64(off, off+n->string.size), n->string.str);
|
||||
off += n->string.size;
|
||||
@@ -552,8 +559,8 @@ entry_point(CmdLine *cmd_line)
|
||||
str8_lit("The following options may be used when starting the RAD Debugger from the command line:\n\n"
|
||||
"--user:<path>\n"
|
||||
"Use to specify the location of a user file which should be used. User files are used to store settings for users, including window and panel setups, path mapping, and visual settings. If this file does not exist, it will be created as necessary. This file will be autosaved as user-related changes are made.\n\n"
|
||||
"--profile:<path>\n"
|
||||
"Use to specify the location of a profile file which should be used. Profile files are used to store settings for users and projects. If this file does not exist, it will be created as necessary. This file will be autosaved as profile-related changes are made.\n\n"
|
||||
"--project:<path>\n"
|
||||
"Use to specify the location of a project file which should be used. Project files are used to store settings for users and projects. If this file does not exist, it will be created as necessary. This file will be autosaved as project-related changes are made.\n\n"
|
||||
"--auto_step\n"
|
||||
"This will step into all targets after the debugger initially starts.\n\n"
|
||||
"--auto_run\n"
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Build Options
|
||||
|
||||
#define BUILD_VERSION_MAJOR 0
|
||||
#define BUILD_VERSION_MINOR 9
|
||||
#define BUILD_VERSION_PATCH 10
|
||||
#define BUILD_VERSION_PATCH 11
|
||||
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||
#define BUILD_TITLE "rdi_breakpad_from_pdb"
|
||||
#define BUILD_CONSOLE_INTERFACE 1
|
||||
@@ -13,18 +16,17 @@
|
||||
|
||||
//- rjf: [lib]
|
||||
#include "lib_rdi_format/rdi_format.h"
|
||||
#include "lib_rdi_format/rdi_format_parse.h"
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
#include "lib_rdi_format/rdi_format_parse.h"
|
||||
#include "lib_rdi_format/rdi_format_parse.c"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
||||
|
||||
|
||||
//- rjf: [h]
|
||||
#include "base/base_inc.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "task_system/task_system.h"
|
||||
#include "rdi_make_local/rdi_make_local.h"
|
||||
#include "rdi_make/rdi_make_local.h"
|
||||
#include "coff/coff.h"
|
||||
#include "codeview/codeview.h"
|
||||
#include "codeview/codeview_stringize.h"
|
||||
@@ -37,7 +39,7 @@
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "task_system/task_system.c"
|
||||
#include "rdi_make_local/rdi_make_local.c"
|
||||
#include "rdi_make/rdi_make_local.c"
|
||||
#include "coff/coff.c"
|
||||
#include "codeview/codeview.c"
|
||||
#include "codeview/codeview_stringize.c"
|
||||
@@ -54,76 +56,30 @@
|
||||
typedef struct P2B_BakeUnitVMapIn P2B_BakeUnitVMapIn;
|
||||
struct P2B_BakeUnitVMapIn
|
||||
{
|
||||
RDIM_BakeParams *params;
|
||||
};
|
||||
|
||||
typedef struct P2B_BakeUnitVMapOut P2B_BakeUnitVMapOut;
|
||||
struct P2B_BakeUnitVMapOut
|
||||
{
|
||||
RDI_VMapEntry *vmap_entries;
|
||||
RDI_U64 vmap_entries_count;
|
||||
RDIM_UnitChunkList *units;
|
||||
};
|
||||
|
||||
internal TS_TASK_FUNCTION_DEF(p2b_bake_unit_vmap_task__entry_point)
|
||||
{
|
||||
P2B_BakeUnitVMapIn *in = (P2B_BakeUnitVMapIn *)p;
|
||||
P2B_BakeUnitVMapOut *out = push_array(arena, P2B_BakeUnitVMapOut, 1);
|
||||
RDIM_BakeSectionList sections = rdim_bake_unit_vmap_section_list_from_params(arena, in->params);
|
||||
RDIM_BakeSection *vmap_section = 0;
|
||||
for(RDIM_BakeSectionNode *n = sections.first; n != 0 && vmap_section == 0; n = n->next)
|
||||
{
|
||||
switch(n->v.tag)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_DataSectionTag_UnitVmap:{vmap_section = &n->v;}break;
|
||||
}
|
||||
}
|
||||
if(vmap_section != 0)
|
||||
{
|
||||
out->vmap_entries = (RDI_VMapEntry *)vmap_section->data;
|
||||
out->vmap_entries_count = vmap_section->unpacked_size/sizeof(RDI_VMapEntry);
|
||||
}
|
||||
RDIM_UnitVMapBakeResult *out = push_array(arena, RDIM_UnitVMapBakeResult, 1);
|
||||
*out = rdim_bake_unit_vmap(arena, in->units);
|
||||
return out;
|
||||
}
|
||||
|
||||
//- rjf: per-unit baking
|
||||
//- rjf: line table baking
|
||||
|
||||
typedef struct P2B_BakeUnitIn P2B_BakeUnitIn;
|
||||
struct P2B_BakeUnitIn
|
||||
typedef struct P2B_BakeLineTablesIn P2B_BakeLineTablesIn;
|
||||
struct P2B_BakeLineTablesIn
|
||||
{
|
||||
RDIM_Unit *unit;
|
||||
RDIM_LineTableChunkList *line_tables;
|
||||
};
|
||||
|
||||
typedef struct P2B_BakeUnitOut P2B_BakeUnitOut;
|
||||
struct P2B_BakeUnitOut
|
||||
internal TS_TASK_FUNCTION_DEF(p2b_bake_line_table_task__entry_point)
|
||||
{
|
||||
U64 unit_line_count;
|
||||
U64 *unit_line_voffs;
|
||||
RDI_Line *unit_lines;
|
||||
};
|
||||
|
||||
internal TS_TASK_FUNCTION_DEF(p2b_bake_unit_task__entry_point)
|
||||
{
|
||||
P2B_BakeUnitIn *in = (P2B_BakeUnitIn *)p;
|
||||
P2B_BakeUnitOut *out = push_array(arena, P2B_BakeUnitOut, 1);
|
||||
RDIM_BakeSectionList sections = rdim_bake_section_list_from_unit(arena, in->unit);
|
||||
RDIM_BakeSection *voffs_section = 0;
|
||||
RDIM_BakeSection *lines_section = 0;
|
||||
for(RDIM_BakeSectionNode *n = sections.first; n != 0; n = n->next)
|
||||
{
|
||||
switch(n->v.tag)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_DataSectionTag_LineInfoVoffs:{voffs_section = &n->v;}break;
|
||||
case RDI_DataSectionTag_LineInfoData: {lines_section = &n->v;}break;
|
||||
}
|
||||
}
|
||||
if(voffs_section != 0 && lines_section != 0)
|
||||
{
|
||||
out->unit_line_count = lines_section->unpacked_size/sizeof(RDI_Line);
|
||||
out->unit_line_voffs = (U64 *)voffs_section->data;
|
||||
out->unit_lines = (RDI_Line *)lines_section->data;
|
||||
}
|
||||
P2B_BakeLineTablesIn *in = (P2B_BakeLineTablesIn *)p;
|
||||
RDIM_LineTableBakeResult *out = push_array(arena, RDIM_LineTableBakeResult, 1);
|
||||
*out = rdim_bake_line_tables(arena, in->line_tables);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -134,8 +90,9 @@ struct P2B_DumpProcChunkIn
|
||||
{
|
||||
RDI_VMapEntry *unit_vmap;
|
||||
U32 unit_vmap_count;
|
||||
P2B_BakeUnitOut **bake_units_out;
|
||||
U64 bake_units_out_count;
|
||||
U32 *unit_line_table_idxs;
|
||||
U64 unit_count;
|
||||
RDIM_LineTableBakeResult *line_tables_bake;
|
||||
RDIM_SymbolChunkNode *chunk;
|
||||
};
|
||||
|
||||
@@ -143,6 +100,12 @@ internal TS_TASK_FUNCTION_DEF(p2b_dump_proc_chunk_task__entry_point)
|
||||
{
|
||||
P2B_DumpProcChunkIn *in = (P2B_DumpProcChunkIn *)p;
|
||||
String8List *out = push_array(arena, String8List, 1);
|
||||
RDI_LineTable *line_tables = in->line_tables_bake->line_tables;
|
||||
RDI_U64 line_tables_count = in->line_tables_bake->line_tables_count;
|
||||
RDI_U64 *line_table_voffs = in->line_tables_bake->line_table_voffs;
|
||||
RDI_U64 line_table_voffs_count = in->line_tables_bake->line_table_voffs_count;
|
||||
RDI_Line *line_table_lines = in->line_tables_bake->line_table_lines;
|
||||
RDI_U64 line_table_lines_count = in->line_tables_bake->line_table_lines_count;
|
||||
for(U64 idx = 0; idx < in->chunk->count; idx += 1)
|
||||
{
|
||||
// NOTE(rjf): breakpad does not support multiple voff ranges per procedure.
|
||||
@@ -156,11 +119,21 @@ internal TS_TASK_FUNCTION_DEF(p2b_dump_proc_chunk_task__entry_point)
|
||||
|
||||
// rjf: dump function lines
|
||||
U64 unit_idx = rdi_vmap_idx_from_voff(in->unit_vmap, in->unit_vmap_count, voff_range.min);
|
||||
if(0 < unit_idx && unit_idx <= in->bake_units_out_count)
|
||||
if(0 < unit_idx && unit_idx <= in->unit_count)
|
||||
{
|
||||
U32 line_table_idx = in->unit_line_table_idxs[unit_idx];
|
||||
if(0 < line_table_idx && line_table_idx <= line_tables_count)
|
||||
{
|
||||
// rjf: unpack unit line info
|
||||
P2B_BakeUnitOut *bake_unit_out = in->bake_units_out[unit_idx];
|
||||
RDI_ParsedLineInfo line_info = {bake_unit_out->unit_line_voffs, bake_unit_out->unit_lines, 0, bake_unit_out->unit_line_count, 0};
|
||||
RDI_LineTable *line_table = &line_tables[line_table_idx];
|
||||
RDI_ParsedLineTable line_info =
|
||||
{
|
||||
line_table_voffs + line_table->voffs_base_idx,
|
||||
line_table_lines + line_table->lines_base_idx,
|
||||
0,
|
||||
line_table->lines_count,
|
||||
0
|
||||
};
|
||||
for(U64 voff = voff_range.min, last_voff = 0;
|
||||
voff < voff_range.max && voff > last_voff;)
|
||||
{
|
||||
@@ -189,6 +162,7 @@ internal TS_TASK_FUNCTION_DEF(p2b_dump_proc_chunk_task__entry_point)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -246,20 +220,23 @@ entry_point(CmdLine *cmdline)
|
||||
RDIM_BakeParams *params = &convert2bake->bake_params;
|
||||
|
||||
//- rjf: kick off unit vmap baking
|
||||
P2B_BakeUnitVMapIn bake_unit_vmap_in = {params};
|
||||
P2B_BakeUnitVMapIn bake_unit_vmap_in = {¶ms->units};
|
||||
TS_Ticket bake_unit_vmap_ticket = ts_kickoff(p2b_bake_unit_vmap_task__entry_point, 0, &bake_unit_vmap_in);
|
||||
|
||||
//- rjf: kick off per-unit baking
|
||||
P2B_BakeUnitIn *bake_units_in = push_array(arena, P2B_BakeUnitIn, params->units.total_count+1);
|
||||
TS_Ticket *bake_units_tickets = push_array(arena, TS_Ticket, params->units.total_count+1);
|
||||
//- rjf: kick off line-table baking
|
||||
P2B_BakeLineTablesIn bake_line_tables_in = {¶ms->line_tables};
|
||||
TS_Ticket bake_line_tables_ticket = ts_kickoff(p2b_bake_line_table_task__entry_point, 0, &bake_line_tables_in);
|
||||
|
||||
//- rjf: build unit -> line table idx array
|
||||
U64 unit_count = params->units.total_count;
|
||||
U32 *unit_line_table_idxs = push_array(arena, U32, unit_count+1);
|
||||
{
|
||||
U64 idx = 1;
|
||||
U64 dst_idx = 1;
|
||||
for(RDIM_UnitChunkNode *n = params->units.first; n != 0; n = n->next)
|
||||
{
|
||||
for(U64 chunk_idx = 0; chunk_idx < n->count; chunk_idx += 1, idx += 1)
|
||||
for(U64 n_idx = 0; n_idx < n->count; n_idx += 1, dst_idx += 1)
|
||||
{
|
||||
bake_units_in[chunk_idx].unit = &n->v[chunk_idx];
|
||||
bake_units_tickets[idx] = ts_kickoff(p2b_bake_unit_task__entry_point, 0, &bake_units_in[chunk_idx]);
|
||||
unit_line_table_idxs[dst_idx] = rdim_idx_from_line_table(n->v[n_idx].line_table);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,20 +260,15 @@ entry_point(CmdLine *cmdline)
|
||||
|
||||
//- rjf: join unit vmap
|
||||
ProfBegin("join unit vmap");
|
||||
P2B_BakeUnitVMapOut *bake_unit_vmap_out = ts_join_struct(bake_unit_vmap_ticket, max_U64, P2B_BakeUnitVMapOut);
|
||||
RDI_VMapEntry *unit_vmap = bake_unit_vmap_out->vmap_entries;
|
||||
U32 unit_vmap_count = (U32)(bake_unit_vmap_out->vmap_entries_count);
|
||||
RDIM_UnitVMapBakeResult *bake_unit_vmap_out = ts_join_struct(bake_unit_vmap_ticket, max_U64, RDIM_UnitVMapBakeResult);
|
||||
RDI_VMapEntry *unit_vmap = bake_unit_vmap_out->vmap.vmap;
|
||||
U32 unit_vmap_count = bake_unit_vmap_out->vmap.count;
|
||||
ProfEnd();
|
||||
|
||||
//- rjf: join units
|
||||
P2B_BakeUnitOut **bake_units_out = push_array(arena, P2B_BakeUnitOut*, params->units.total_count+1);
|
||||
ProfScope("join units")
|
||||
{
|
||||
for(U64 idx = 1; idx < params->units.total_count+1; idx += 1)
|
||||
{
|
||||
bake_units_out[idx] = ts_join_struct(bake_units_tickets[idx], max_U64, P2B_BakeUnitOut);
|
||||
}
|
||||
}
|
||||
//- rjf: join line tables
|
||||
ProfBegin("join line table");
|
||||
RDIM_LineTableBakeResult *bake_line_tables_out = ts_join_struct(bake_line_tables_ticket, max_U64, RDIM_LineTableBakeResult);
|
||||
ProfEnd();
|
||||
|
||||
//- rjf: kick off FUNC & line record dump tasks
|
||||
P2B_DumpProcChunkIn *dump_proc_chunk_in = push_array(arena, P2B_DumpProcChunkIn, params->procedures.chunk_count);
|
||||
@@ -308,8 +280,9 @@ entry_point(CmdLine *cmdline)
|
||||
{
|
||||
dump_proc_chunk_in[task_idx].unit_vmap = unit_vmap;
|
||||
dump_proc_chunk_in[task_idx].unit_vmap_count = unit_vmap_count;
|
||||
dump_proc_chunk_in[task_idx].bake_units_out = bake_units_out;
|
||||
dump_proc_chunk_in[task_idx].bake_units_out_count = params->units.total_count+1;
|
||||
dump_proc_chunk_in[task_idx].unit_line_table_idxs = unit_line_table_idxs;
|
||||
dump_proc_chunk_in[task_idx].unit_count = unit_count;
|
||||
dump_proc_chunk_in[task_idx].line_tables_bake = bake_line_tables_out;
|
||||
dump_proc_chunk_in[task_idx].chunk = n;
|
||||
dump_proc_chunk_tickets[task_idx] = ts_kickoff(p2b_dump_proc_chunk_task__entry_point, 0, &dump_proc_chunk_in[task_idx]);
|
||||
}
|
||||
|
||||
+279
-265
@@ -5,138 +5,127 @@
|
||||
//~ rjf: RDI Enum -> String Functions
|
||||
|
||||
internal String8
|
||||
rdi_string_from_data_section_tag(RDI_DataSectionTag tag){
|
||||
String8 result = {0};
|
||||
switch (tag){
|
||||
#define X(N,C) case C: result = str8_lit(#N); break;
|
||||
#define Y(N)
|
||||
RDI_DataSectionTagXList(X,Y)
|
||||
#undef X
|
||||
#undef Y
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_arch(RDI_Arch arch){
|
||||
String8 result = {0};
|
||||
switch (arch){
|
||||
default: result = str8_lit("<invalid-arch>"); break;
|
||||
case RDI_Arch_X86: result = str8_lit("x86"); break;
|
||||
case RDI_Arch_X64: result = str8_lit("x64"); break;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_language(RDI_Language language){
|
||||
String8 result = {0};
|
||||
switch (language){
|
||||
#define X(name,code) case code: result = str8_lit(#name); break;
|
||||
RDI_LanguageXList(X)
|
||||
rdi_string_from_data_section_kind(RDI_SectionKind v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_SectionKind>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name, lower, type) case RDI_SectionKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_SectionKind_XList
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_type_kind(RDI_TypeKind type_kind){
|
||||
String8 result = {0};
|
||||
switch (type_kind){
|
||||
default: result = str8_lit("<invalid-type-kind>"); break;
|
||||
#define X(name,code) case code: result = str8_lit(#name); break;
|
||||
#define XZ(name,code,size) X(name,code)
|
||||
#define Y(a,n)
|
||||
RDI_TypeKindXList(X,XZ,Y)
|
||||
#undef X
|
||||
#undef XZ
|
||||
#undef Y
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_member_kind(RDI_MemberKind member_kind){
|
||||
String8 result = {0};
|
||||
switch (member_kind){
|
||||
default: result = str8_lit("<invalid-member-kind>"); break;
|
||||
#define X(N,C) case C: result = str8_lit(#N); break;
|
||||
RDI_MemberKindXList(X)
|
||||
rdi_string_from_arch(RDI_Arch v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_Arch>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_Arch_##name:{result = str8_lit(#name);}break;
|
||||
RDI_Arch_XList
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_local_kind(RDI_LocalKind local_kind){
|
||||
String8 result = {0};
|
||||
switch (local_kind){
|
||||
default: result = str8_lit("<invalid-local-kind>"); break;
|
||||
case RDI_LocalKind_Parameter: result = str8_lit("Parameter"); break;
|
||||
case RDI_LocalKind_Variable: result = str8_lit("Variable"); break;
|
||||
rdi_string_from_language(RDI_Language v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_Language>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_Language_##name:{result = str8_lit(#name);}break;
|
||||
RDI_Language_XList
|
||||
#undef X
|
||||
}
|
||||
return(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_type_kind(RDI_TypeKind v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_TypeKind>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_TypeKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_TypeKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_member_kind(RDI_MemberKind v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_MemberKind>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_MemberKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_MemberKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_local_kind(RDI_LocalKind v)
|
||||
{
|
||||
String8 result = str8_lit("<invalid RDI_LocalKind>");
|
||||
switch(v)
|
||||
{
|
||||
default:{}break;
|
||||
#define X(name) case RDI_LocalKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_LocalKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Flags -> String Functions
|
||||
|
||||
internal void
|
||||
rdi_stringize_binary_section_flags(Arena *arena, String8List *out,
|
||||
RDI_BinarySectionFlags flags){
|
||||
if (flags == 0){
|
||||
str8_list_push(arena, out, str8_lit("0"));
|
||||
}
|
||||
if (flags & RDI_BinarySectionFlag_Read){
|
||||
str8_list_push(arena, out, str8_lit("Read "));
|
||||
}
|
||||
if (flags & RDI_BinarySectionFlag_Write){
|
||||
str8_list_push(arena, out, str8_lit("Write "));
|
||||
}
|
||||
if (flags & RDI_BinarySectionFlag_Execute){
|
||||
str8_list_push(arena, out, str8_lit("Execute "));
|
||||
}
|
||||
rdi_stringize_binary_section_flags(Arena *arena, String8List *out, RDI_BinarySectionFlags flags)
|
||||
{
|
||||
if(flags == 0) { str8_list_push(arena, out, str8_lit("0")); }
|
||||
#define X(name) if(flags & RDI_BinarySectionFlag_##name) { str8_list_push(arena, out, str8_lit(#name " ")); }
|
||||
RDI_BinarySectionFlags_XList;
|
||||
#undef X
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_type_modifier_flags(Arena *arena, String8List *out,
|
||||
RDI_TypeModifierFlags flags){
|
||||
if (flags == 0){
|
||||
str8_list_push(arena, out, str8_lit("0"));
|
||||
}
|
||||
if (flags & RDI_TypeModifierFlag_Const){
|
||||
str8_list_push(arena, out, str8_lit("Const "));
|
||||
}
|
||||
if (flags & RDI_TypeModifierFlag_Volatile){
|
||||
str8_list_push(arena, out, str8_lit("Volatile "));
|
||||
}
|
||||
RDI_TypeModifierFlags flags)
|
||||
{
|
||||
if(flags == 0) { str8_list_push(arena, out, str8_lit("0")); }
|
||||
#define X(name) if(flags & RDI_TypeModifierFlag_##name) { str8_list_push(arena, out, str8_lit(#name " ")); }
|
||||
RDI_TypeModifierFlags_XList;
|
||||
#undef X
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_user_defined_type_flags(Arena *arena, String8List *out,
|
||||
RDI_UserDefinedTypeFlags flags){
|
||||
if (flags == 0){
|
||||
str8_list_push(arena, out, str8_lit("0"));
|
||||
}
|
||||
if (flags & RDI_UserDefinedTypeFlag_EnumMembers){
|
||||
str8_list_push(arena, out, str8_lit("EnumMembers "));
|
||||
}
|
||||
rdi_stringize_udt_flags(Arena *arena, String8List *out, RDI_UDTFlags flags)
|
||||
{
|
||||
if(flags == 0) { str8_list_push(arena, out, str8_lit("0")); }
|
||||
#define X(name) if(flags & RDI_UDTFlag_##name) { str8_list_push(arena, out, str8_lit(#name " ")); }
|
||||
RDI_UDTFlags_XList;
|
||||
#undef X
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_link_flags(Arena *arena, String8List *out, RDI_LinkFlags flags){
|
||||
if (flags == 0){
|
||||
str8_list_push(arena, out, str8_lit("0"));
|
||||
}
|
||||
if (flags & RDI_LinkFlag_External){
|
||||
str8_list_push(arena, out, str8_lit("External "));
|
||||
}
|
||||
if (flags & RDI_LinkFlag_TypeScoped){
|
||||
str8_list_push(arena, out, str8_lit("TypeScoped "));
|
||||
}
|
||||
if (flags & RDI_LinkFlag_ProcScoped){
|
||||
str8_list_push(arena, out, str8_lit("ProcScoped "));
|
||||
}
|
||||
rdi_stringize_link_flags(Arena *arena, String8List *out, RDI_LinkFlags flags)
|
||||
{
|
||||
if(flags == 0) { str8_list_push(arena, out, str8_lit("0")); }
|
||||
#define X(name) if(flags & RDI_LinkFlag_##name) { str8_list_push(arena, out, str8_lit(#name " ")); }
|
||||
RDI_LinkFlags_XList;
|
||||
#undef X
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
@@ -145,77 +134,71 @@ rdi_stringize_link_flags(Arena *arena, String8List *out, RDI_LinkFlags flags){
|
||||
global char rdi_stringize_spaces[] = " ";
|
||||
|
||||
internal void
|
||||
rdi_stringize_data_sections(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
U32 indent_level){
|
||||
U64 data_section_count = parsed->dsec_count;
|
||||
RDI_DataSection *ptr = parsed->dsecs;
|
||||
for (U64 i = 0; i < data_section_count; i += 1, ptr += 1){
|
||||
String8 tag_str = rdi_string_from_data_section_tag(ptr->tag);
|
||||
str8_list_pushf(arena, out, "%.*sdata_section[%5u] = {0x%08llx, %7u, %7u} %.*s\n",
|
||||
rdi_stringize_data_sections(Arena *arena, String8List *out, RDI_Parsed *rdi, U32 indent_level)
|
||||
{
|
||||
for(U64 idx = 0; idx < rdi->sections_count; idx += 1)
|
||||
{
|
||||
RDI_SectionKind kind = (RDI_SectionKind)idx;
|
||||
RDI_Section *section = &rdi->sections[idx];
|
||||
String8 kind_str = rdi_string_from_data_section_kind(kind);
|
||||
str8_list_pushf(arena, out, "%.*sdata_section[%5I64u] = {0x%08llx, %7u, %7u} %S\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
i, ptr->off, ptr->encoded_size, ptr->unpacked_size, str8_varg(tag_str));
|
||||
idx, section->off, section->encoded_size, section->unpacked_size, kind_str);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_top_level_info(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_TopLevelInfo *tli, U32 indent_level){
|
||||
String8 arch_str = rdi_string_from_arch(tli->architecture);
|
||||
rdi_stringize_top_level_info(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_TopLevelInfo *tli, U32 indent_level)
|
||||
{
|
||||
String8 arch_str = rdi_string_from_arch(tli->arch);
|
||||
String8 exe_name = {0};
|
||||
exe_name.str = rdi_string_from_idx(parsed, tli->exe_name_string_idx, &exe_name.size);
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sarchitecture=%.*s\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(arch_str));
|
||||
str8_list_pushf(arena, out, "%.*sexe_name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(exe_name));
|
||||
str8_list_pushf(arena, out, "%.*svoff_max=0x%08llx\n",
|
||||
indent_level, rdi_stringize_spaces, tli->voff_max);
|
||||
exe_name.str = rdi_string_from_idx(rdi, tli->exe_name_string_idx, &exe_name.size);
|
||||
String8 producer_name = {0};
|
||||
producer_name.str = rdi_string_from_idx(rdi, tli->producer_name_string_idx, &producer_name.size);
|
||||
str8_list_pushf(arena, out, "%.*sarch=%S\n", indent_level, rdi_stringize_spaces, arch_str);
|
||||
str8_list_pushf(arena, out, "%.*sexe_name='%S'\n", indent_level, rdi_stringize_spaces, exe_name);
|
||||
str8_list_pushf(arena, out, "%.*svoff_max=0x%08llx\n", indent_level, rdi_stringize_spaces, tli->voff_max);
|
||||
str8_list_pushf(arena, out, "%.*sproducer_name='%S'\n", indent_level, rdi_stringize_spaces, producer_name);
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_binary_section(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_BinarySection *bin_section, U32 indent_level){
|
||||
rdi_stringize_binary_section(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_BinarySection *bin_section, U32 indent_level)
|
||||
{
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, bin_section->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
name.str = rdi_string_from_idx(rdi, bin_section->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%.*s'\n", indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sflags=", indent_level, rdi_stringize_spaces);
|
||||
rdi_stringize_binary_section_flags(arena, out, bin_section->flags);
|
||||
str8_list_pushf(arena, out, "\n");
|
||||
|
||||
str8_list_pushf(arena, out, "%.*svoff_first=0x%08x\n",
|
||||
indent_level, rdi_stringize_spaces, bin_section->voff_first);
|
||||
str8_list_pushf(arena, out, "%.*svoff_opl =0x%08x\n",
|
||||
indent_level, rdi_stringize_spaces, bin_section->voff_opl);
|
||||
str8_list_pushf(arena, out, "%.*sfoff_first=0x%08x\n",
|
||||
indent_level, rdi_stringize_spaces, bin_section->foff_first);
|
||||
str8_list_pushf(arena, out, "%.*sfoff_opl =0x%08x\n",
|
||||
indent_level, rdi_stringize_spaces, bin_section->foff_opl);
|
||||
str8_list_pushf(arena, out, "%.*svoff_first=0x%08x\n", indent_level, rdi_stringize_spaces, bin_section->voff_first);
|
||||
str8_list_pushf(arena, out, "%.*svoff_opl =0x%08x\n", indent_level, rdi_stringize_spaces, bin_section->voff_opl);
|
||||
str8_list_pushf(arena, out, "%.*sfoff_first=0x%08x\n", indent_level, rdi_stringize_spaces, bin_section->foff_first);
|
||||
str8_list_pushf(arena, out, "%.*sfoff_opl =0x%08x\n", indent_level, rdi_stringize_spaces, bin_section->foff_opl);
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_FilePathBundle *bundle, RDI_FilePathNode *file_path,
|
||||
U32 indent_level){
|
||||
rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_FilePathBundle *bundle, RDI_FilePathNode *file_path, U32 indent_level)
|
||||
{
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, file_path->name_string_idx, &name.size);
|
||||
|
||||
name.str = rdi_string_from_idx(rdi, file_path->name_string_idx, &name.size);
|
||||
U32 this_idx = (U32)(file_path - bundle->file_paths);
|
||||
|
||||
if (file_path->source_file_idx == 0){
|
||||
if(file_path->source_file_idx == 0)
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s[%u] '%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
this_idx, str8_varg(name));
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s[%u] '%.*s'; source_file=%u\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
this_idx, str8_varg(name), file_path->source_file_idx);
|
||||
}
|
||||
|
||||
for (U32 child = file_path->first_child;
|
||||
child != 0;){
|
||||
for(U32 child = file_path->first_child; child != 0;)
|
||||
{
|
||||
// get node for child
|
||||
RDI_FilePathNode *child_node = 0;
|
||||
if (child < bundle->file_path_count){
|
||||
@@ -226,7 +209,7 @@ rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
// stringize child
|
||||
rdi_stringize_file_path(arena, out, parsed, bundle, child_node, indent_level + 1);
|
||||
rdi_stringize_file_path(arena, out, rdi, bundle, child_node, indent_level + 1);
|
||||
|
||||
// increment iterator
|
||||
child = child_node->next_sibling;
|
||||
@@ -234,99 +217,44 @@ rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_source_file(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_SourceFile *source_file, U32 indent_level){
|
||||
// extract line map data
|
||||
RDI_ParsedLineMap line_map = {0};
|
||||
rdi_line_map_from_source_file(parsed, source_file, &line_map);
|
||||
rdi_stringize_source_file(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_SourceFile *source_file, U32 indent_level)
|
||||
{
|
||||
// normal source path
|
||||
String8 path = {0};
|
||||
path.str = rdi_string_from_idx(rdi, source_file->normal_full_path_string_idx, &path.size);
|
||||
str8_list_pushf(arena, out, "%.*spath: \"%S\"\n", indent_level, rdi_stringize_spaces, path);
|
||||
|
||||
// stringize line map data
|
||||
str8_list_pushf(arena, out, "%.*slines:\n", indent_level, rdi_stringize_spaces);
|
||||
|
||||
for (U32 i = 0; i < line_map.count; i += 1){
|
||||
U32 line_num = line_map.nums[i];
|
||||
|
||||
U32 digit_count = 1;
|
||||
if (line_num > 0){
|
||||
U32 x = line_num;
|
||||
for (;;){
|
||||
x /= 10;
|
||||
if (x == 0){
|
||||
break;
|
||||
}
|
||||
digit_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
str8_list_pushf(arena, out, "%.*s %u: ",
|
||||
indent_level, rdi_stringize_spaces, line_num);
|
||||
|
||||
U32 first = line_map.ranges[i];
|
||||
U32 opl_raw = line_map.ranges[i + 1];
|
||||
U32 opl = ClampTop(opl_raw, line_map.voff_count);
|
||||
for (U32 j = first; j < opl; j += 1){
|
||||
if (j == first){
|
||||
str8_list_pushf(arena, out, "0x%08x\n", line_map.voffs[j]);
|
||||
}
|
||||
else{
|
||||
str8_list_pushf(arena, out, "%.*s0x%08x\n",
|
||||
indent_level + digit_count + 3, rdi_stringize_spaces,
|
||||
line_map.voffs[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// rjf: source line map idx
|
||||
str8_list_pushf(arena, out, "%.*ssource_line_map: %u\n", indent_level, rdi_stringize_spaces, source_file->source_line_map_idx);
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_unit(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_Unit *unit, U32 indent_level){
|
||||
String8 unit_name = {0};
|
||||
unit_name.str = rdi_string_from_idx(parsed, unit->unit_name_string_idx, &unit_name.size);
|
||||
String8 compiler_name = {0};
|
||||
compiler_name.str = rdi_string_from_idx(parsed, unit->compiler_name_string_idx,
|
||||
&compiler_name.size);
|
||||
rdi_stringize_line_table(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_LineTable *line_table, U32 indent_level)
|
||||
{
|
||||
// rjf: parse line table
|
||||
RDI_ParsedLineTable parsed_line_table = {0};
|
||||
rdi_parsed_from_line_table(rdi, line_table, &parsed_line_table);
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sunit_name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(unit_name));
|
||||
str8_list_pushf(arena, out, "%.*scompiler_name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(compiler_name));
|
||||
|
||||
str8_list_pushf(arena, out, "%.*ssource_file_path=%u\n",
|
||||
indent_level, rdi_stringize_spaces, unit->source_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sobject_file_path=%u\n",
|
||||
indent_level, rdi_stringize_spaces, unit->object_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sarchive_file_path=%u\n",
|
||||
indent_level, rdi_stringize_spaces, unit->archive_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sbuild_path=%u\n",
|
||||
indent_level, rdi_stringize_spaces, unit->build_path_node);
|
||||
|
||||
String8 language_str = rdi_string_from_language(unit->language);
|
||||
str8_list_pushf(arena, out, "%.*slanguage=%.*s\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(language_str));
|
||||
|
||||
// extract line info data
|
||||
RDI_ParsedLineInfo line_info = {0};
|
||||
rdi_line_info_from_unit(parsed, unit, &line_info);
|
||||
|
||||
|
||||
// stringize line info
|
||||
// rjf: stringize lines
|
||||
str8_list_pushf(arena, out, "%.*slines:\n", indent_level, rdi_stringize_spaces);
|
||||
|
||||
for (U32 i = 0; i < line_info.count; i += 1){
|
||||
U64 first = line_info.voffs[i];
|
||||
U64 opl = line_info.voffs[i + 1];
|
||||
RDI_Line *line = line_info.lines + i;
|
||||
for(U32 i = 0; i < parsed_line_table.count; i += 1)
|
||||
{
|
||||
U64 first = parsed_line_table.voffs[i];
|
||||
U64 opl = parsed_line_table.voffs[i + 1];
|
||||
RDI_Line *line = parsed_line_table.lines + i;
|
||||
RDI_Column *col = 0;
|
||||
if (i < line_info.col_count){
|
||||
col = line_info.cols + i;
|
||||
if(i < parsed_line_table.col_count)
|
||||
{
|
||||
col = parsed_line_table.cols + i;
|
||||
}
|
||||
|
||||
if (col == 0){
|
||||
if(col == 0)
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s [0x%08llx,0x%08llx) file=%u; line=%u\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
first, opl, line->file_idx, line->line_num);
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s [0x%08llx,0x%08llx) file=%u; line=%u; columns=[%u,%u)\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
first, opl, line->file_idx, line->line_num,
|
||||
@@ -336,7 +264,75 @@ rdi_stringize_unit(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
rdi_stringize_source_line_map(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_SourceLineMap *map, U32 indent_level)
|
||||
{
|
||||
RDI_ParsedSourceLineMap line_map = {0};
|
||||
rdi_parsed_from_source_line_map(rdi, map, &line_map);
|
||||
str8_list_pushf(arena, out, "%.*slines:\n", indent_level, rdi_stringize_spaces);
|
||||
|
||||
for(U32 i = 0; i < line_map.count; i += 1)
|
||||
{
|
||||
U32 line_num = line_map.nums[i];
|
||||
U32 digit_count = 1;
|
||||
if(line_num > 0)
|
||||
{
|
||||
U32 x = line_num;
|
||||
for(;;)
|
||||
{
|
||||
x /= 10;
|
||||
if(x == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
digit_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
str8_list_pushf(arena, out, "%.*s %u: ", indent_level, rdi_stringize_spaces, line_num);
|
||||
|
||||
U32 first = line_map.ranges[i];
|
||||
U32 opl_raw = line_map.ranges[i + 1];
|
||||
U32 opl = ClampTop(opl_raw, line_map.voff_count);
|
||||
for(U32 j = first; j < opl; j += 1)
|
||||
{
|
||||
if(j == first)
|
||||
{
|
||||
str8_list_pushf(arena, out, "0x%08x\n", line_map.voffs[j]);
|
||||
}
|
||||
else
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s0x%08x\n",
|
||||
indent_level + digit_count + 3, rdi_stringize_spaces,
|
||||
line_map.voffs[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_unit(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_Unit *unit, U32 indent_level)
|
||||
{
|
||||
String8 unit_name = {0};
|
||||
unit_name.str = rdi_string_from_idx(rdi, unit->unit_name_string_idx, &unit_name.size);
|
||||
String8 compiler_name = {0};
|
||||
compiler_name.str = rdi_string_from_idx(rdi, unit->compiler_name_string_idx, &compiler_name.size);
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sunit_name='%.*s'\n", indent_level, rdi_stringize_spaces, str8_varg(unit_name));
|
||||
str8_list_pushf(arena, out, "%.*scompiler_name='%.*s'\n", indent_level, rdi_stringize_spaces, str8_varg(compiler_name));
|
||||
|
||||
str8_list_pushf(arena, out, "%.*ssource_file_path=%u\n", indent_level, rdi_stringize_spaces, unit->source_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sobject_file_path=%u\n", indent_level, rdi_stringize_spaces, unit->object_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sarchive_file_path=%u\n", indent_level, rdi_stringize_spaces, unit->archive_file_path_node);
|
||||
str8_list_pushf(arena, out, "%.*sbuild_path=%u\n", indent_level, rdi_stringize_spaces, unit->build_path_node);
|
||||
|
||||
String8 language_str = rdi_string_from_language(unit->language);
|
||||
str8_list_pushf(arena, out, "%.*slanguage=%.*s\n", indent_level, rdi_stringize_spaces, str8_varg(language_str));
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sline_table_idx=%u\n", indent_level, rdi_stringize_spaces, unit->line_table_idx);
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_TypeNode *type, U32 indent_level){
|
||||
RDI_TypeKind kind = type->kind;
|
||||
String8 type_kind_str = rdi_string_from_type_kind(kind);
|
||||
@@ -367,7 +363,7 @@ rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
if (RDI_TypeKind_FirstBuiltIn <= kind &&
|
||||
kind <= RDI_TypeKind_LastBuiltIn){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, type->built_in.name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, type->built_in.name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sbuilt_in.name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
}
|
||||
@@ -388,7 +384,7 @@ rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
U32 run_count_raw = type->constructed.count;
|
||||
|
||||
U32 run_count = 0;
|
||||
U32 *run = rdi_idx_run_from_first_count(parsed, run_first, run_count_raw, &run_count);
|
||||
U32 *run = rdi_idx_run_from_first_count(rdi, run_first, run_count_raw, &run_count);
|
||||
|
||||
U32 this_type_idx = 0;
|
||||
if (run_count > 0 && type->kind == RDI_TypeKind_Method){
|
||||
@@ -420,7 +416,7 @@ rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
else if (RDI_TypeKind_FirstUserDefined <= kind &&
|
||||
kind <= RDI_TypeKind_LastUserDefined){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, type->user_defined.name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, type->user_defined.name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*suser_defined.name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
str8_list_pushf(arena, out, "%.*suser_defined.direct_type=%u\n",
|
||||
@@ -440,14 +436,14 @@ rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_UDTMemberBundle *member_bundle, RDI_UDT *udt,
|
||||
U32 indent_level){
|
||||
str8_list_pushf(arena, out, "%.*sself_type=%u\n",
|
||||
indent_level, rdi_stringize_spaces, udt->self_type_idx);
|
||||
|
||||
str8_list_pushf(arena, out, "%.*sflags=", indent_level, rdi_stringize_spaces);
|
||||
rdi_stringize_user_defined_type_flags(arena, out, udt->flags);
|
||||
rdi_stringize_udt_flags(arena, out, udt->flags);
|
||||
str8_list_push(arena, out, str8_lit("\n"));
|
||||
|
||||
if (udt->file_idx != 0){
|
||||
@@ -457,7 +453,7 @@ rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
// enum members
|
||||
if (udt->flags & RDI_UserDefinedTypeFlag_EnumMembers){
|
||||
if (udt->flags & RDI_UDTFlag_EnumMembers){
|
||||
U32 first_raw = udt->member_first;
|
||||
U32 opl_raw = first_raw + udt->member_count;
|
||||
U32 opl = ClampTop(opl_raw, member_bundle->enum_member_count);
|
||||
@@ -468,7 +464,7 @@ rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_EnumMember *enum_member = member_bundle->enum_members + first;
|
||||
for (U32 i = first; i < opl; i += 1, enum_member += 1){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, enum_member->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, enum_member->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*s '%.*s' %llu\n",
|
||||
indent_level, rdi_stringize_spaces,
|
||||
str8_varg(name), enum_member->val);
|
||||
@@ -496,7 +492,7 @@ rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
|
||||
if (member->name_string_idx != 0){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, member->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, member->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*s name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
}
|
||||
@@ -514,10 +510,10 @@ rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_global_variable(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
rdi_stringize_global_variable(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_GlobalVariable *global_variable, U32 indent_level){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, global_variable->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, global_variable->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
|
||||
@@ -536,11 +532,11 @@ rdi_stringize_global_variable(Arena *arena, String8List *out, RDI_Parsed *parsed
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_thread_variable(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
rdi_stringize_thread_variable(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_ThreadVariable *thread_var,
|
||||
U32 indent_level){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, thread_var->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, thread_var->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
|
||||
@@ -559,15 +555,15 @@ rdi_stringize_thread_variable(Arena *arena, String8List *out, RDI_Parsed *parsed
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_procedure(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
rdi_stringize_procedure(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_Procedure *proc, U32 indent_level){
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, proc->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, proc->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
|
||||
String8 link_name = {0};
|
||||
link_name.str = rdi_string_from_idx(parsed, proc->link_name_string_idx, &link_name.size);
|
||||
link_name.str = rdi_string_from_idx(rdi, proc->link_name_string_idx, &link_name.size);
|
||||
str8_list_pushf(arena, out, "%.*slink_name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(link_name));
|
||||
|
||||
@@ -586,8 +582,9 @@ rdi_stringize_procedure(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
RDI_ScopeBundle *bundle, RDI_Scope *scope, U32 indent_level){
|
||||
rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *rdi,
|
||||
RDI_ScopeBundle *bundle, RDI_Scope *scope, U32 indent_level)
|
||||
{
|
||||
|
||||
U32 this_idx = (U32)(scope - bundle->scopes);
|
||||
|
||||
@@ -597,6 +594,12 @@ rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
str8_list_pushf(arena, out, "%.*s proc_idx=%u\n",
|
||||
indent_level, rdi_stringize_spaces, scope->proc_idx);
|
||||
|
||||
if(scope->inline_site_idx != 0)
|
||||
{
|
||||
str8_list_pushf(arena, out, "%.*s inline_site_idx=%u\n",
|
||||
indent_level, rdi_stringize_spaces, scope->inline_site_idx);
|
||||
}
|
||||
|
||||
// voff ranges
|
||||
{
|
||||
U32 voff_range_first_raw = scope->voff_range_first;
|
||||
@@ -645,7 +648,7 @@ rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
indent_level, rdi_stringize_spaces, str8_varg(local_kind_str));
|
||||
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(parsed, local_ptr->name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, local_ptr->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*s name='%.*s'\n",
|
||||
indent_level, rdi_stringize_spaces, str8_varg(name));
|
||||
|
||||
@@ -707,38 +710,38 @@ rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
str8_list_pushf(arena, out, "\n");
|
||||
}break;
|
||||
|
||||
case RDI_LocationKind_AddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
{
|
||||
if (loc_base_ptr + sizeof(RDI_LocationRegisterPlusU16) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "AddrRegisterPlusU16( <invalid-encoding> )\n");
|
||||
if (loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "AddrRegPlusU16( <invalid-encoding> )\n");
|
||||
}
|
||||
else{
|
||||
RDI_LocationRegisterPlusU16 *loc = (RDI_LocationRegisterPlusU16*)loc_base_ptr;
|
||||
str8_list_pushf(arena, out, "AddrRegisterPlusU16(reg: %u, off: %u)\n",
|
||||
loc->register_code, loc->offset);
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16*)loc_base_ptr;
|
||||
str8_list_pushf(arena, out, "AddrRegPlusU16(reg: %u, off: %u)\n",
|
||||
loc->reg_code, loc->offset);
|
||||
}
|
||||
}break;
|
||||
|
||||
case RDI_LocationKind_AddrAddrRegisterPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
if (loc_base_ptr + sizeof(RDI_LocationRegisterPlusU16) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "AddrAddrRegisterPlusU16( <invalid-encoding> )\n");
|
||||
if (loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "AddrAddrRegPlusU16( <invalid-encoding> )\n");
|
||||
}
|
||||
else{
|
||||
RDI_LocationRegisterPlusU16 *loc = (RDI_LocationRegisterPlusU16*)loc_base_ptr;
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16*)loc_base_ptr;
|
||||
str8_list_pushf(arena, out, "AddrAddrRegisterPlusU16(reg: %u, off: %u)\n",
|
||||
loc->register_code, loc->offset);
|
||||
loc->reg_code, loc->offset);
|
||||
}
|
||||
}break;
|
||||
|
||||
case RDI_LocationKind_ValRegister:
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
if (loc_base_ptr + sizeof(RDI_LocationRegister) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "ValRegister( <invalid-encoding> )\n");
|
||||
if (loc_base_ptr + sizeof(RDI_LocationReg) > loc_data_opl){
|
||||
str8_list_pushf(arena, out, "ValReg( <invalid-encoding> )\n");
|
||||
}
|
||||
else{
|
||||
RDI_LocationRegister *loc = (RDI_LocationRegister*)loc_base_ptr;
|
||||
str8_list_pushf(arena, out, "ValRegister(reg: %u)\n", loc->register_code);
|
||||
RDI_LocationReg *loc = (RDI_LocationReg*)loc_base_ptr;
|
||||
str8_list_pushf(arena, out, "ValReg(reg: %u)\n", loc->reg_code);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@@ -763,7 +766,7 @@ rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
}
|
||||
|
||||
// stringize child
|
||||
rdi_stringize_scope(arena, out, parsed, bundle, child_scope, indent_level + 1);
|
||||
rdi_stringize_scope(arena, out, rdi, bundle, child_scope, indent_level + 1);
|
||||
|
||||
// increment iterator
|
||||
child = child_scope->next_sibling_scope_idx;
|
||||
@@ -772,3 +775,14 @@ rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed,
|
||||
str8_list_pushf(arena, out, "%.*s[/%u]\n",
|
||||
indent_level, rdi_stringize_spaces, this_idx);
|
||||
}
|
||||
|
||||
internal void
|
||||
rdi_stringize_inline_site(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_InlineSite *inline_site, U32 indent_level)
|
||||
{
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(rdi, inline_site->name_string_idx, &name.size);
|
||||
str8_list_pushf(arena, out, "%.*sname='%S'\n", indent_level, rdi_stringize_spaces, name);
|
||||
str8_list_pushf(arena, out, "%.*stype_idx=%u\n", indent_level, rdi_stringize_spaces, inline_site->type_idx);
|
||||
str8_list_pushf(arena, out, "%.*sowner_type_idx=%u\n", indent_level, rdi_stringize_spaces, inline_site->owner_type_idx);
|
||||
str8_list_pushf(arena, out, "%.*sline_table_idx=%u\n", indent_level, rdi_stringize_spaces, inline_site->line_table_idx);
|
||||
}
|
||||
|
||||
+23
-20
@@ -11,7 +11,7 @@ typedef struct RDI_FilePathBundle RDI_FilePathBundle;
|
||||
struct RDI_FilePathBundle
|
||||
{
|
||||
RDI_FilePathNode *file_paths;
|
||||
U32 file_path_count;
|
||||
U64 file_path_count;
|
||||
};
|
||||
|
||||
typedef struct RDI_UDTMemberBundle RDI_UDTMemberBundle;
|
||||
@@ -41,35 +41,38 @@ struct RDI_ScopeBundle
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Enum -> String Functions
|
||||
|
||||
internal String8 rdi_string_from_data_section_tag(RDI_DataSectionTag tag);
|
||||
internal String8 rdi_string_from_arch(RDI_Arch arch);
|
||||
internal String8 rdi_string_from_language(RDI_Language language);
|
||||
internal String8 rdi_string_from_type_kind(RDI_TypeKind type_kind);
|
||||
internal String8 rdi_string_from_member_kind(RDI_MemberKind member_kind);
|
||||
internal String8 rdi_string_from_local_kind(RDI_LocalKind local_kind);
|
||||
internal String8 rdi_string_from_data_section_kind(RDI_SectionKind v);
|
||||
internal String8 rdi_string_from_arch(RDI_Arch v);
|
||||
internal String8 rdi_string_from_language(RDI_Language v);
|
||||
internal String8 rdi_string_from_type_kind(RDI_TypeKind v);
|
||||
internal String8 rdi_string_from_member_kind(RDI_MemberKind v);
|
||||
internal String8 rdi_string_from_local_kind(RDI_LocalKind v);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Flags -> String Functions
|
||||
|
||||
internal void rdi_stringize_binary_section_flags(Arena *arena, String8List *out, RDI_BinarySectionFlags flags);
|
||||
internal void rdi_stringize_type_modifier_flags(Arena *arena, String8List *out, RDI_TypeModifierFlags flags);
|
||||
internal void rdi_stringize_user_defined_type_flags(Arena *arena, String8List *out, RDI_UserDefinedTypeFlags flags);
|
||||
internal void rdi_stringize_udt_flags(Arena *arena, String8List *out, RDI_UDTFlags flags);
|
||||
internal void rdi_stringize_link_flags(Arena *arena, String8List *out, RDI_LinkFlags flags);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Compound Stringize Functions
|
||||
|
||||
internal void rdi_stringize_data_sections(Arena *arena, String8List *out, RDI_Parsed *parsed, U32 indent_level);
|
||||
internal void rdi_stringize_top_level_info(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_TopLevelInfo *tli, U32 indent_level);
|
||||
internal void rdi_stringize_binary_section(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_BinarySection *bin_section, U32 indent_level);
|
||||
internal void rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_FilePathBundle *bundle, RDI_FilePathNode *file_path, U32 indent_level);
|
||||
internal void rdi_stringize_source_file(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_SourceFile *source_file, U32 indent_level);
|
||||
internal void rdi_stringize_unit(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_Unit *unit, U32 indent_level);
|
||||
internal void rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_TypeNode *type, U32 indent_level);
|
||||
internal void rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_UDTMemberBundle *bundle, RDI_UDT *udt, U32 indent_level);
|
||||
internal void rdi_stringize_global_variable(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_GlobalVariable *global_variable, U32 indent_level);
|
||||
internal void rdi_stringize_thread_variable(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_ThreadVariable *thread_var, U32 indent_level);
|
||||
internal void rdi_stringize_procedure(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_Procedure *proc, U32 indent_level);
|
||||
internal void rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *parsed, RDI_ScopeBundle *bundle, RDI_Scope *scope, U32 indent_level);
|
||||
internal void rdi_stringize_data_sections(Arena *arena, String8List *out, RDI_Parsed *rdi, U32 indent_level);
|
||||
internal void rdi_stringize_top_level_info(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_TopLevelInfo *tli, U32 indent_level);
|
||||
internal void rdi_stringize_binary_section(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_BinarySection *bin_section, U32 indent_level);
|
||||
internal void rdi_stringize_file_path(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_FilePathBundle *bundle, RDI_FilePathNode *file_path, U32 indent_level);
|
||||
internal void rdi_stringize_source_file(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_SourceFile *source_file, U32 indent_level);
|
||||
internal void rdi_stringize_line_table(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_LineTable *line_table, U32 indent_level);
|
||||
internal void rdi_stringize_source_line_map(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_SourceLineMap *map, U32 indent_level);
|
||||
internal void rdi_stringize_unit(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_Unit *unit, U32 indent_level);
|
||||
internal void rdi_stringize_type_node(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_TypeNode *type, U32 indent_level);
|
||||
internal void rdi_stringize_udt(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_UDTMemberBundle *bundle, RDI_UDT *udt, U32 indent_level);
|
||||
internal void rdi_stringize_global_variable(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_GlobalVariable *global_variable, U32 indent_level);
|
||||
internal void rdi_stringize_thread_variable(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_ThreadVariable *thread_var, U32 indent_level);
|
||||
internal void rdi_stringize_procedure(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_Procedure *proc, U32 indent_level);
|
||||
internal void rdi_stringize_scope(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_ScopeBundle *bundle, RDI_Scope *scope, U32 indent_level);
|
||||
internal void rdi_stringize_inline_site(Arena *arena, String8List *out, RDI_Parsed *rdi, RDI_InlineSite *inline_site, U32 indent_level);
|
||||
|
||||
#endif // RDI_DUMP_H
|
||||
|
||||
+195
-118
@@ -6,7 +6,7 @@
|
||||
|
||||
#define BUILD_VERSION_MAJOR 0
|
||||
#define BUILD_VERSION_MINOR 9
|
||||
#define BUILD_VERSION_PATCH 10
|
||||
#define BUILD_VERSION_PATCH 11
|
||||
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||
#define BUILD_TITLE "rdi_dump"
|
||||
#define BUILD_CONSOLE_INTERFACE 1
|
||||
@@ -15,25 +15,19 @@
|
||||
//~ rjf: Includes
|
||||
|
||||
//- rjf: [lib]
|
||||
#include "lib_rdi_format/rdi_format.h"
|
||||
#include "lib_rdi_format/rdi_format_parse.h"
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
#include "lib_rdi_format/rdi_format_parse.c"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
||||
|
||||
//- rjf: [h]
|
||||
#include "base/base_inc.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "path/path.h"
|
||||
#include "dbgi/dbgi.h"
|
||||
#include "rdi_format/rdi_format_local.h"
|
||||
#include "rdi_dump.h"
|
||||
|
||||
//- rjf: [c]
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "path/path.c"
|
||||
#include "dbgi/dbgi.c"
|
||||
#include "rdi_format/rdi_format_local.c"
|
||||
#include "rdi_dump.c"
|
||||
|
||||
////////////////////////////////
|
||||
@@ -46,7 +40,6 @@ entry_point(CmdLine *cmd_line)
|
||||
//- rjf: set up
|
||||
//
|
||||
Arena *arena = arena_alloc();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
String8List errors = {0};
|
||||
|
||||
//////////////////////////////
|
||||
@@ -60,29 +53,31 @@ entry_point(CmdLine *cmd_line)
|
||||
DumpFlag_BinarySections = (1<<2),
|
||||
DumpFlag_FilePaths = (1<<3),
|
||||
DumpFlag_SourceFiles = (1<<4),
|
||||
DumpFlag_Units = (1<<5),
|
||||
DumpFlag_UnitVMap = (1<<6),
|
||||
DumpFlag_TypeNodes = (1<<7),
|
||||
DumpFlag_UDTs = (1<<8),
|
||||
DumpFlag_GlobalVariables = (1<<9),
|
||||
DumpFlag_GlobalVMap = (1<<10),
|
||||
DumpFlag_ThreadVariables = (1<<11),
|
||||
DumpFlag_Procedures = (1<<12),
|
||||
DumpFlag_Scopes = (1<<13),
|
||||
DumpFlag_ScopeVMap = (1<<14),
|
||||
DumpFlag_NameMaps = (1<<15),
|
||||
DumpFlag_Strings = (1<<16),
|
||||
DumpFlag_LineTables = (1<<5),
|
||||
DumpFlag_SourceLineMaps = (1<<6),
|
||||
DumpFlag_Units = (1<<7),
|
||||
DumpFlag_UnitVMap = (1<<8),
|
||||
DumpFlag_TypeNodes = (1<<9),
|
||||
DumpFlag_UDTs = (1<<10),
|
||||
DumpFlag_GlobalVariables = (1<<11),
|
||||
DumpFlag_GlobalVMap = (1<<12),
|
||||
DumpFlag_ThreadVariables = (1<<13),
|
||||
DumpFlag_Procedures = (1<<14),
|
||||
DumpFlag_Scopes = (1<<15),
|
||||
DumpFlag_ScopeVMap = (1<<16),
|
||||
DumpFlag_InlineSites = (1<<17),
|
||||
DumpFlag_NameMaps = (1<<18),
|
||||
DumpFlag_Strings = (1<<19),
|
||||
};
|
||||
String8 input_name = {0};
|
||||
String8 input_data = {0};
|
||||
DumpFlags dump_flags = (U32)0xffffffff;
|
||||
{
|
||||
// rjf: extract input file path
|
||||
input_name = str8_list_first(&cmd_line->inputs);
|
||||
|
||||
// rjf: extract dump options
|
||||
// rjf: extract "only" options
|
||||
{
|
||||
String8List dump_options = cmd_line_strings(cmd_line, str8_lit("dump"));
|
||||
String8List dump_options = cmd_line_strings(cmd_line, str8_lit("only"));
|
||||
if(dump_options.first != 0)
|
||||
{
|
||||
dump_flags = 0;
|
||||
@@ -94,6 +89,8 @@ entry_point(CmdLine *cmd_line)
|
||||
else if(str8_match(n->string, str8_lit("binary_sections"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_BinarySections; }
|
||||
else if(str8_match(n->string, str8_lit("file_paths"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_FilePaths; }
|
||||
else if(str8_match(n->string, str8_lit("source_files"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_SourceFiles; }
|
||||
else if(str8_match(n->string, str8_lit("line_tables"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_LineTables; }
|
||||
else if(str8_match(n->string, str8_lit("source_line_maps"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_SourceLineMaps; }
|
||||
else if(str8_match(n->string, str8_lit("units"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_Units; }
|
||||
else if(str8_match(n->string, str8_lit("unit_vmap"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_UnitVMap; }
|
||||
else if(str8_match(n->string, str8_lit("type_nodes"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_TypeNodes; }
|
||||
@@ -104,31 +101,55 @@ entry_point(CmdLine *cmd_line)
|
||||
else if(str8_match(n->string, str8_lit("procedures"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_Procedures; }
|
||||
else if(str8_match(n->string, str8_lit("scopes"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_Scopes; }
|
||||
else if(str8_match(n->string, str8_lit("scope_vmap"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_ScopeVMap; }
|
||||
else if(str8_match(n->string, str8_lit("inline_sites"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_InlineSites; }
|
||||
else if(str8_match(n->string, str8_lit("name_maps"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_NameMaps; }
|
||||
else if(str8_match(n->string, str8_lit("strings"), StringMatchFlag_CaseInsensitive)) { dump_flags |= DumpFlag_Strings; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: obtain rdi parse
|
||||
//- rjf: load file
|
||||
//
|
||||
RDI_Parsed *rdi = &di_rdi_parsed_nil;
|
||||
String8 input_data = os_data_from_file_path(arena, input_name);
|
||||
if(input_name.size == 0)
|
||||
{
|
||||
str8_list_pushf(arena, &errors, "error (input): No input RDI file specified.");
|
||||
}
|
||||
else
|
||||
{
|
||||
DI_Key key = {input_name};
|
||||
di_open(&key);
|
||||
rdi = di_rdi_from_key(di_scope, &key, max_U64);
|
||||
}
|
||||
if(rdi == &di_rdi_parsed_nil)
|
||||
else if(input_data.size == 0)
|
||||
{
|
||||
str8_list_pushf(arena, &errors, "error (input): No input RDI file successfully loaded; either the path or file contents are invalid.");
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: obtain initial rdi parse
|
||||
//
|
||||
RDI_Parsed rdi_ = {0};
|
||||
RDI_Parsed *rdi = &rdi_;
|
||||
RDI_ParseStatus status = rdi_parse(input_data.str, input_data.size, rdi);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: decompress rdi if necessary
|
||||
//
|
||||
{
|
||||
U64 decompressed_size = rdi_decompressed_size_from_parsed(rdi);
|
||||
if(decompressed_size > input_data.size)
|
||||
{
|
||||
U8 *decompressed_data = push_array_no_zero(arena, U8, decompressed_size);
|
||||
rdi_decompress_parsed(decompressed_data, decompressed_size, rdi);
|
||||
status = rdi_parse(decompressed_data, decompressed_size, rdi);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: error on bad parse status
|
||||
//
|
||||
if(status != RDI_ParseStatus_Good)
|
||||
{
|
||||
str8_list_pushf(arena, &errors, "error (input): RDI file could not be successfully decoded.");
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: output error strings to stderr
|
||||
//
|
||||
@@ -142,7 +163,7 @@ entry_point(CmdLine *cmd_line)
|
||||
//- rjf: build dump strings
|
||||
//
|
||||
String8List dump = {0};
|
||||
if(rdi != &di_rdi_parsed_nil)
|
||||
if(errors.node_count == 0)
|
||||
{
|
||||
//- rjf: DATA SECTIONS
|
||||
if(dump_flags & DumpFlag_DataSections)
|
||||
@@ -156,7 +177,8 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_TopLevelInfo)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# TOP LEVEL INFO:\n");
|
||||
rdi_stringize_top_level_info(arena, &dump, rdi, rdi->top_level_info, 1);
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
rdi_stringize_top_level_info(arena, &dump, rdi, tli, 1);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
|
||||
@@ -164,12 +186,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_BinarySections)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# BINARY SECTIONS:\n");
|
||||
RDI_BinarySection *ptr = rdi->binary_sections;
|
||||
for(U32 i = 0; i < rdi->binary_sections_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_BinarySection *v = rdi_table_from_name(rdi, BinarySections, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " section[%u]:\n", i);
|
||||
rdi_stringize_binary_section(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " section[%I64u]:\n", idx);
|
||||
rdi_stringize_binary_section(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -178,13 +200,10 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_FilePaths)
|
||||
{
|
||||
RDI_FilePathBundle file_path_bundle = {0};
|
||||
{
|
||||
file_path_bundle.file_paths = rdi->file_paths;
|
||||
file_path_bundle.file_path_count = rdi->file_paths_count;
|
||||
}
|
||||
file_path_bundle.file_paths = rdi_table_from_name(rdi, FilePathNodes, &file_path_bundle.file_path_count);
|
||||
str8_list_pushf(arena, &dump, "# FILE PATHS\n");
|
||||
RDI_FilePathNode *ptr = rdi->file_paths;
|
||||
for(U32 i = 0; i < rdi->file_paths_count; i += 1, ptr += 1)
|
||||
RDI_FilePathNode *ptr = file_path_bundle.file_paths;
|
||||
for(U32 i = 0; i < file_path_bundle.file_path_count; i += 1, ptr += 1)
|
||||
{
|
||||
if(ptr->parent_path_node == 0)
|
||||
{
|
||||
@@ -198,13 +217,41 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_SourceFiles)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# SOURCE FILES\n");
|
||||
RDI_SourceFile *ptr = rdi->source_files;
|
||||
for(U32 i = 0; i < rdi->source_files_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_SourceFile *v = rdi_table_from_name(rdi, SourceFiles, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " source_file[%u]:\n", i);
|
||||
rdi_stringize_source_file(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_pushf(arena, &dump, " source_file[%I64u]:\n", idx);
|
||||
rdi_stringize_source_file(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
|
||||
//- rjf: LINE TABLES
|
||||
if(dump_flags & DumpFlag_LineTables)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# LINE TABLES\n");
|
||||
U64 count = 0;
|
||||
RDI_LineTable *v = rdi_table_from_name(rdi, LineTables, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " line_table[%I64u]:\n", idx);
|
||||
rdi_stringize_line_table(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
|
||||
//- rjf: SOURCE LINE MAPS
|
||||
if(dump_flags & DumpFlag_SourceLineMaps)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# SOURCE LINE MAPS\n");
|
||||
U64 count = 0;
|
||||
RDI_SourceLineMap *v = rdi_table_from_name(rdi, SourceLineMaps, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " source_line_map[%I64u]:\n", idx);
|
||||
rdi_stringize_source_line_map(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
|
||||
@@ -212,12 +259,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_Units)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# UNITS\n");
|
||||
RDI_Unit *ptr = rdi->units;
|
||||
for (U32 i = 0; i < rdi->units_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_Unit *v = rdi_table_from_name(rdi, Units, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " unit[%u]:\n", i);
|
||||
rdi_stringize_unit(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " unit[%I64u]:\n", idx);
|
||||
rdi_stringize_unit(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -226,10 +273,11 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_UnitVMap)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# UNIT VMAP\n");
|
||||
RDI_VMapEntry *ptr = rdi->unit_vmap;
|
||||
for(U32 i = 0; i < rdi->unit_vmap_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_VMapEntry *v = rdi_table_from_name(rdi, UnitVMap, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", ptr->voff, ptr->idx);
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", v[idx].voff, v[idx].idx);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -238,12 +286,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_TypeNodes)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# TYPE NODES:\n");
|
||||
RDI_TypeNode *ptr = rdi->type_nodes;
|
||||
for(U32 i = 0; i < rdi->type_nodes_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_TypeNode *v = rdi_table_from_name(rdi, TypeNodes, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " type[%u]:\n", i);
|
||||
rdi_stringize_type_node(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " type[%I64u]:\n", idx);
|
||||
rdi_stringize_type_node(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -251,20 +299,24 @@ entry_point(CmdLine *cmd_line)
|
||||
//- rjf: UDT DATA
|
||||
if(dump_flags & DumpFlag_UDTs)
|
||||
{
|
||||
U64 all_members_count = 0;
|
||||
RDI_Member *all_members = rdi_table_from_name(rdi, Members, &all_members_count);
|
||||
U64 all_enum_members_count = 0;
|
||||
RDI_EnumMember *all_enum_members = rdi_table_from_name(rdi, EnumMembers, &all_enum_members_count);
|
||||
U64 all_udts_count = 0;
|
||||
RDI_UDT *all_udts = rdi_table_from_name(rdi, UDTs, &all_udts_count);
|
||||
RDI_UDTMemberBundle member_bundle = {0};
|
||||
{
|
||||
member_bundle.members = rdi->members;
|
||||
member_bundle.enum_members = rdi->enum_members;
|
||||
member_bundle.member_count = rdi->members_count;
|
||||
member_bundle.enum_member_count = rdi->enum_members_count;
|
||||
member_bundle.members = all_members;
|
||||
member_bundle.enum_members = all_enum_members;
|
||||
member_bundle.member_count = (RDI_U32)all_members_count;
|
||||
member_bundle.enum_member_count = (RDI_U32)all_enum_members_count;
|
||||
}
|
||||
str8_list_pushf(arena, &dump, "# UDTS:\n");
|
||||
RDI_UDT *ptr = rdi->udts;
|
||||
for(U32 i = 0; i < rdi->udts_count; i += 1, ptr += 1)
|
||||
for(U64 idx = 0; idx < all_udts_count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " udt[%u]:\n", i);
|
||||
rdi_stringize_udt(arena, &dump, rdi, &member_bundle, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " udt[%I64u]:\n", idx);
|
||||
rdi_stringize_udt(arena, &dump, rdi, &member_bundle, &all_udts[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -273,12 +325,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_GlobalVariables)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# GLOBAL VARIABLES:\n");
|
||||
RDI_GlobalVariable *ptr = rdi->global_variables;
|
||||
for(U32 i = 0; i < rdi->global_variables_count; i += 1, ptr += 1)
|
||||
RDI_U64 count = 0;
|
||||
RDI_GlobalVariable *v = rdi_table_from_name(rdi, GlobalVariables, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " global_variable[%u]:\n", i);
|
||||
rdi_stringize_global_variable(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " global_variable[%I64u]:\n", idx);
|
||||
rdi_stringize_global_variable(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -287,10 +339,11 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_GlobalVMap)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# GLOBAL VMAP:\n");
|
||||
RDI_VMapEntry *ptr = rdi->global_vmap;
|
||||
for(U32 i = 0; i < rdi->global_vmap_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_VMapEntry *v = rdi_table_from_name(rdi, GlobalVMap, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", ptr->voff, ptr->idx);
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", v[idx].voff, v[idx].idx);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -299,12 +352,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_ThreadVariables)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# THREAD VARIABLES:\n");
|
||||
RDI_ThreadVariable *ptr = rdi->thread_variables;
|
||||
for(U32 i = 0; i < rdi->thread_variables_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_ThreadVariable *v = rdi_table_from_name(rdi, ThreadVariables, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " thread_variable[%u]:\n", i);
|
||||
rdi_stringize_thread_variable(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " thread_variable[%I64u]:\n", idx);
|
||||
rdi_stringize_thread_variable(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -313,12 +366,12 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_Procedures)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# PROCEDURES:\n");
|
||||
RDI_Procedure *ptr = rdi->procedures;
|
||||
for(U32 i = 0; i < rdi->procedures_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_Procedure *v = rdi_table_from_name(rdi, Procedures, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " procedure[%u]:\n", i);
|
||||
rdi_stringize_procedure(arena, &dump, rdi, ptr, 2);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
str8_list_pushf(arena, &dump, " procedure[%I64u]:\n", idx);
|
||||
rdi_stringize_procedure(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -326,27 +379,35 @@ entry_point(CmdLine *cmd_line)
|
||||
//- rjf: SCOPES
|
||||
if(dump_flags & DumpFlag_Scopes)
|
||||
{
|
||||
U64 scopes_count = 0;
|
||||
RDI_Scope *scopes = rdi_table_from_name(rdi, Scopes, &scopes_count);
|
||||
U64 scopes_voffs_count = 0;
|
||||
U64 *scopes_voffs = rdi_table_from_name(rdi, ScopeVOffData, &scopes_voffs_count);
|
||||
U64 locals_count = 0;
|
||||
RDI_Local *locals = rdi_table_from_name(rdi, Locals, &locals_count);
|
||||
U64 location_block_count = 0;
|
||||
RDI_LocationBlock *location_blocks = rdi_table_from_name(rdi, LocationBlocks, &location_block_count);
|
||||
U64 location_data_size = 0;
|
||||
RDI_U8 *location_data = rdi_table_from_name(rdi, LocationData, &location_data_size);
|
||||
RDI_ScopeBundle scope_bundle = {0};
|
||||
{
|
||||
scope_bundle.scopes = rdi->scopes;
|
||||
scope_bundle.scope_count = rdi->scopes_count;
|
||||
scope_bundle.scope_voffs = rdi->scope_voffs;
|
||||
scope_bundle.scope_voff_count = rdi->scope_voffs_count;
|
||||
scope_bundle.locals = rdi->locals;
|
||||
scope_bundle.local_count = rdi->locals_count;
|
||||
scope_bundle.location_blocks = rdi->location_blocks;
|
||||
scope_bundle.location_block_count = rdi->location_blocks_count;
|
||||
scope_bundle.location_data = rdi->location_data;
|
||||
scope_bundle.location_data_size = rdi->location_data_size;
|
||||
scope_bundle.scopes = scopes;
|
||||
scope_bundle.scope_count = scopes_count;
|
||||
scope_bundle.scope_voffs = scopes_voffs;
|
||||
scope_bundle.scope_voff_count = scopes_voffs_count;
|
||||
scope_bundle.locals = locals;
|
||||
scope_bundle.local_count = locals_count;
|
||||
scope_bundle.location_blocks = location_blocks;
|
||||
scope_bundle.location_block_count = location_block_count;
|
||||
scope_bundle.location_data = location_data;
|
||||
scope_bundle.location_data_size = location_data_size;
|
||||
}
|
||||
str8_list_pushf(arena, &dump, "# SCOPES:\n");
|
||||
RDI_Scope *ptr = rdi->scopes;
|
||||
for(U32 i = 0; i < rdi->scopes_count; i += 1, ptr += 1)
|
||||
for(U64 idx = 0; idx < scopes_count; idx += 1)
|
||||
{
|
||||
if(ptr->parent_scope_idx == 0)
|
||||
if(scopes[idx].parent_scope_idx == 0)
|
||||
{
|
||||
rdi_stringize_scope(arena, &dump, rdi, &scope_bundle, ptr, 1);
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
rdi_stringize_scope(arena, &dump, rdi, &scope_bundle, &scopes[idx], 1);
|
||||
}
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
@@ -356,10 +417,25 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_ScopeVMap)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# SCOPE VMAP:\n");
|
||||
RDI_VMapEntry *ptr = rdi->scope_vmap;
|
||||
for(U32 i = 0; i < rdi->scope_vmap_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_VMapEntry *v = rdi_table_from_name(rdi, ScopeVMap, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", ptr->voff, ptr->idx);
|
||||
str8_list_pushf(arena, &dump, " 0x%08x: %llu\n", v[idx].voff, v[idx].idx);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
|
||||
//- rjf: INLINE SITES
|
||||
if(dump_flags & DumpFlag_InlineSites)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# INLINE SITES:\n");
|
||||
U64 count = 0;
|
||||
RDI_InlineSite *v = rdi_table_from_name(rdi, InlineSites, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, " inline_site[%I64u]:\n", idx);
|
||||
rdi_stringize_inline_site(arena, &dump, rdi, &v[idx], 2);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -368,12 +444,13 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_NameMaps)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# NAME MAP:\n");
|
||||
RDI_NameMap *ptr = rdi->name_maps;
|
||||
for(U32 i = 0; i < rdi->name_maps_count; i += 1, ptr += 1)
|
||||
U64 count = 0;
|
||||
RDI_NameMap *v = rdi_table_from_name(rdi, NameMaps, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
RDI_ParsedNameMap name_map = {0};
|
||||
rdi_name_map_parse(rdi, ptr, &name_map);
|
||||
str8_list_pushf(arena, &dump, " name_map[%u]:\n", i);
|
||||
rdi_parsed_from_name_map(rdi, &v[idx], &name_map);
|
||||
str8_list_pushf(arena, &dump, " name_map[%I64u]:\n", idx);
|
||||
RDI_NameMapBucket *bucket = name_map.buckets;
|
||||
for(U32 j = 0; j < name_map.bucket_count; j += 1, bucket += 1)
|
||||
{
|
||||
@@ -420,11 +497,13 @@ entry_point(CmdLine *cmd_line)
|
||||
if(dump_flags & DumpFlag_Strings)
|
||||
{
|
||||
str8_list_pushf(arena, &dump, "# STRINGS:\n");
|
||||
for(U64 string_idx = 0; string_idx < rdi->string_count; string_idx += 1)
|
||||
U64 count = 0;
|
||||
U32 *v = rdi_table_from_name(rdi, StringTable, &count);
|
||||
for(U64 idx = 0; idx < count; idx += 1)
|
||||
{
|
||||
String8 string = {0};
|
||||
string.str = rdi_string_from_idx(rdi, string_idx, &string.size);
|
||||
str8_list_pushf(arena, &dump, " string[%I64u]: \"%S\"\n", string_idx, string);
|
||||
string.str = rdi_string_from_idx(rdi, (RDI_U32)idx, &string.size);
|
||||
str8_list_pushf(arena, &dump, " string[%I64u]: \"%S\"\n", idx, string);
|
||||
}
|
||||
str8_list_push(arena, &dump, str8_lit("\n"));
|
||||
}
|
||||
@@ -437,6 +516,4 @@ entry_point(CmdLine *cmd_line)
|
||||
{
|
||||
fwrite(n->string.str, 1, n->string.size, stdout);
|
||||
}
|
||||
|
||||
di_scope_close(di_scope);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
#include "lib_rdi_format/rdi_format_parse.c"
|
||||
|
||||
internal void
|
||||
rdi_decompress_parsed(U8 *decompressed_data, U64 decompressed_size, RDI_Parsed *og_rdi)
|
||||
{
|
||||
// rjf: copy header
|
||||
RDI_Header *src_header = (RDI_Header *)og_rdi->raw_data;
|
||||
RDI_Header *dst_header = (RDI_Header *)decompressed_data;
|
||||
{
|
||||
MemoryCopy(dst_header, src_header, sizeof(RDI_Header));
|
||||
}
|
||||
|
||||
// rjf: copy & adjust sections for decompressed version
|
||||
if(og_rdi->sections_count != 0)
|
||||
{
|
||||
RDI_Section *dsec_base = (RDI_Section *)(decompressed_data + dst_header->data_section_off);
|
||||
MemoryCopy(dsec_base, (U8 *)og_rdi->raw_data + src_header->data_section_off, sizeof(RDI_Section) * og_rdi->sections_count);
|
||||
U64 off = dst_header->data_section_off + sizeof(RDI_Section) * og_rdi->sections_count;
|
||||
off += 7;
|
||||
off -= off%8;
|
||||
for(U64 idx = 0; idx < og_rdi->sections_count; idx += 1)
|
||||
{
|
||||
dsec_base[idx].encoding = RDI_SectionEncoding_Unpacked;
|
||||
dsec_base[idx].off = off;
|
||||
dsec_base[idx].encoded_size = dsec_base[idx].unpacked_size;
|
||||
off += dsec_base[idx].unpacked_size;
|
||||
off += 7;
|
||||
off -= off%8;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: decompress sections into new decompressed file buffer
|
||||
if(og_rdi->sections_count != 0)
|
||||
{
|
||||
RDI_Section *src_first = og_rdi->sections;
|
||||
RDI_Section *dst_first = (RDI_Section *)(decompressed_data + dst_header->data_section_off);
|
||||
RDI_Section *src_opl = src_first + og_rdi->sections_count;
|
||||
RDI_Section *dst_opl = dst_first + og_rdi->sections_count;
|
||||
for(RDI_Section *src = src_first, *dst = dst_first;
|
||||
src < src_opl && dst < dst_opl;
|
||||
src += 1, dst += 1)
|
||||
{
|
||||
rr_lzb_simple_decode((U8*)og_rdi->raw_data + src->off, src->encoded_size,
|
||||
decompressed_data + dst->off, dst->unpacked_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef RDI_FORMAT_LOCAL_H
|
||||
#define RDI_FORMAT_LOCAL_H
|
||||
|
||||
#include "lib_rdi_format/rdi_format.h"
|
||||
#include "lib_rdi_format/rdi_format_parse.h"
|
||||
|
||||
internal void rdi_decompress_parsed(U8 *decompressed_data, U64 decompressed_size, RDI_Parsed *og_rdi);
|
||||
|
||||
#endif // RDI_FORMAT_LOCAL_H
|
||||
@@ -387,7 +387,7 @@ static String8Array
|
||||
elf_section_name_array_from_elf(ELF_Parsed *elf){
|
||||
String8Array result = {0};
|
||||
if (elf != 0){
|
||||
result.strings = elf->section_names;
|
||||
result.v = elf->section_names;
|
||||
result.count = elf->section_count;
|
||||
}
|
||||
return(result);
|
||||
|
||||
@@ -1,26 +1,40 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Build Options
|
||||
|
||||
#define BUILD_VERSION_MAJOR 0
|
||||
#define BUILD_VERSION_MINOR 9
|
||||
#define BUILD_VERSION_PATCH 11
|
||||
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||
#define BUILD_TITLE "rdi_from_dwarf"
|
||||
#define BUILD_CONSOLE_INTERFACE 1
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Includes
|
||||
|
||||
//- rjf: [lib]
|
||||
#include "lib_rdi_format/rdi_format.h"
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.h"
|
||||
#include "third_party/rad_lzb_simple/rad_lzb_simple.c"
|
||||
|
||||
//- rjf: [h]
|
||||
#include "base/base_inc.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "rdi_make_local/rdi_make_local.h"
|
||||
|
||||
#include "rdi_make/rdi_make_local.h"
|
||||
#include "rdi_elf.h"
|
||||
#include "rdi_dwarf.h"
|
||||
|
||||
#include "rdi_dwarf_stringize.h"
|
||||
|
||||
#include "rdi_from_dwarf.h"
|
||||
|
||||
#include "lib_rdi_format/rdi_format.c"
|
||||
//- rjf: [c]
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "rdi_make_local/rdi_make_local.c"
|
||||
|
||||
#include "rdi_make/rdi_make_local.c"
|
||||
#include "rdi_elf.c"
|
||||
#include "rdi_dwarf.c"
|
||||
|
||||
#include "rdi_dwarf_stringize.c"
|
||||
|
||||
// TODO(allen):
|
||||
@@ -583,7 +597,7 @@ fprintf(stdout, "error(parsing): " fmt "\n", __VA_ARGS__); \
|
||||
"SECTIONS:\n"));
|
||||
|
||||
ELF_Shdr64 *sec = section_array.sections;
|
||||
String8 *sec_name = section_name_array.strings;
|
||||
String8 *sec_name = section_name_array.v;
|
||||
U64 count = section_array.count;
|
||||
for (U64 i = 0 ; i < count; i += 1, sec += 1, sec_name += 1){
|
||||
String8 type_string = elf_string_from_section_type(sec->sh_type);
|
||||
|
||||
+879
-355
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,13 @@ struct P2R_Convert2Bake
|
||||
typedef struct P2R_Bake2Serialize P2R_Bake2Serialize;
|
||||
struct P2R_Bake2Serialize
|
||||
{
|
||||
RDIM_BakeSectionList sections;
|
||||
RDIM_BakeResults bake_results;
|
||||
};
|
||||
|
||||
typedef struct P2R_Serialize2File P2R_Serialize2File;
|
||||
struct P2R_Serialize2File
|
||||
{
|
||||
RDIM_SerializedSectionBundle bundle;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -167,6 +173,8 @@ struct P2R_SrcFileMap
|
||||
typedef struct P2R_UnitConvertIn P2R_UnitConvertIn;
|
||||
struct P2R_UnitConvertIn
|
||||
{
|
||||
PDB_Strtbl *pdb_strtbl;
|
||||
PDB_CoffSectionArray *coff_sections;
|
||||
PDB_CompUnitArray *comp_units;
|
||||
PDB_CompUnitContributionArray *comp_unit_contributions;
|
||||
CV_SymParsed **comp_unit_syms;
|
||||
@@ -178,6 +186,8 @@ struct P2R_UnitConvertOut
|
||||
{
|
||||
RDIM_UnitChunkList units;
|
||||
RDIM_SrcFileChunkList src_files;
|
||||
RDIM_LineTableChunkList line_tables;
|
||||
RDIM_LineTable **units_first_inline_site_line_tables;
|
||||
};
|
||||
|
||||
//- rjf: link name map building tasks
|
||||
@@ -242,12 +252,14 @@ struct P2R_SymbolStreamConvertIn
|
||||
PDB_CoffSectionArray *coff_sections;
|
||||
PDB_TpiHashParsed *tpi_hash;
|
||||
CV_LeafParsed *tpi_leaf;
|
||||
CV_LeafParsed *ipi_leaf;
|
||||
CV_SymParsed *sym;
|
||||
U64 sym_ranges_first;
|
||||
U64 sym_ranges_opl;
|
||||
CV_TypeId *itype_fwd_map;
|
||||
RDIM_Type **itype_type_ptrs;
|
||||
P2R_LinkNameMap *link_name_map;
|
||||
RDIM_LineTable *first_inline_site_line_table;
|
||||
};
|
||||
|
||||
typedef struct P2R_SymbolStreamConvertOut P2R_SymbolStreamConvertOut;
|
||||
@@ -257,11 +269,20 @@ struct P2R_SymbolStreamConvertOut
|
||||
RDIM_SymbolChunkList global_variables;
|
||||
RDIM_SymbolChunkList thread_variables;
|
||||
RDIM_ScopeChunkList scopes;
|
||||
RDIM_InlineSiteChunkList inline_sites;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Baking Task Types
|
||||
|
||||
//- rjf: line table baking task types
|
||||
|
||||
typedef struct P2R_BakeLineTablesIn P2R_BakeLineTablesIn;
|
||||
struct P2R_BakeLineTablesIn
|
||||
{
|
||||
RDIM_LineTableChunkList *line_tables;
|
||||
};
|
||||
|
||||
//- rjf: string map baking task types
|
||||
|
||||
typedef struct P2R_BakeSrcFilesStringsIn P2R_BakeSrcFilesStringsIn;
|
||||
@@ -390,24 +411,18 @@ struct P2R_BuildBakeNameMapIn
|
||||
|
||||
//- rjf: debug info baking task types
|
||||
|
||||
typedef struct P2R_BakeUnitsTopLevelIn P2R_BakeUnitsTopLevelIn;
|
||||
struct P2R_BakeUnitsTopLevelIn
|
||||
typedef struct P2R_BakeUnitsIn P2R_BakeUnitsIn;
|
||||
struct P2R_BakeUnitsIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakePathTree *path_tree;
|
||||
RDIM_BakeParams *params;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeUnitIn P2R_BakeUnitIn;
|
||||
struct P2R_BakeUnitIn
|
||||
{
|
||||
RDIM_Unit *unit;
|
||||
RDIM_UnitChunkList *units;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeUnitVMapIn P2R_BakeUnitVMapIn;
|
||||
struct P2R_BakeUnitVMapIn
|
||||
{
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_UnitChunkList *units;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeSrcFilesIn P2R_BakeSrcFilesIn;
|
||||
@@ -415,54 +430,61 @@ struct P2R_BakeSrcFilesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakePathTree *path_tree;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_SrcFileChunkList *src_files;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeUDTsIn P2R_BakeUDTsIn;
|
||||
struct P2R_BakeUDTsIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_UDTChunkList *udts;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeGlobalVariablesIn P2R_BakeGlobalVariablesIn;
|
||||
struct P2R_BakeGlobalVariablesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_SymbolChunkList *global_variables;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeGlobalVMapIn P2R_BakeGlobalVMapIn;
|
||||
struct P2R_BakeGlobalVMapIn
|
||||
{
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_SymbolChunkList *global_variables;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeThreadVariablesIn P2R_BakeThreadVariablesIn;
|
||||
struct P2R_BakeThreadVariablesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_SymbolChunkList *thread_variables;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeProceduresIn P2R_BakeProceduresIn;
|
||||
struct P2R_BakeProceduresIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_SymbolChunkList *procedures;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeScopesIn P2R_BakeScopesIn;
|
||||
struct P2R_BakeScopesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_ScopeChunkList *scopes;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeScopeVMapIn P2R_BakeScopeVMapIn;
|
||||
struct P2R_BakeScopeVMapIn
|
||||
{
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_ScopeChunkList *scopes;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeInlineSitesIn P2R_BakeInlineSitesIn;
|
||||
struct P2R_BakeInlineSitesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_InlineSiteChunkList *inline_sites;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeFilePathsIn P2R_BakeFilePathsIn;
|
||||
@@ -483,7 +505,7 @@ struct P2R_BakeTypeNodesIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeIdxRunMap *idx_runs;
|
||||
RDIM_BakeParams *params;
|
||||
RDIM_TypeChunkList *types;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeNameMapIn P2R_BakeNameMapIn;
|
||||
@@ -491,9 +513,8 @@ struct P2R_BakeNameMapIn
|
||||
{
|
||||
RDIM_BakeStringMapTight *strings;
|
||||
RDIM_BakeIdxRunMap *idx_runs;
|
||||
RDIM_BakeParams *params;
|
||||
RDI_NameMapKind kind;
|
||||
RDIM_BakeNameMap *map;
|
||||
RDI_NameMapKind kind;
|
||||
};
|
||||
|
||||
typedef struct P2R_BakeIdxRunsIn P2R_BakeIdxRunsIn;
|
||||
@@ -522,16 +543,16 @@ internal RDI_BinarySectionFlags p2r_rdi_binary_section_flags_from_coff_section_f
|
||||
//~ rjf: CodeView => RDI Canonical Conversions
|
||||
|
||||
internal RDI_Arch p2r_rdi_arch_from_cv_arch(CV_Arch arch);
|
||||
internal RDI_RegisterCode p2r_rdi_reg_code_from_cv_reg_code(RDI_Arch arch, CV_Reg reg_code);
|
||||
internal RDI_RegCode p2r_rdi_reg_code_from_cv_reg_code(RDI_Arch arch, CV_Reg reg_code);
|
||||
internal RDI_Language p2r_rdi_language_from_cv_language(CV_Language language);
|
||||
internal RDI_TypeKind p2r_rdi_type_kind_from_cv_basic_type(CV_BasicType basic_type);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Location Info Building Helpers
|
||||
|
||||
internal RDIM_Location *p2r_location_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegisterCode reg_code, U32 reg_byte_size, U32 reg_byte_pos, S64 offset, B32 extra_indirection);
|
||||
internal RDIM_Location *p2r_location_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegCode reg_code, U32 reg_byte_size, U32 reg_byte_pos, S64 offset, B32 extra_indirection);
|
||||
internal CV_EncodedFramePtrReg p2r_cv_encoded_fp_reg_from_frameproc(CV_SymFrameproc *frameproc, B32 param_base);
|
||||
internal RDI_RegisterCode p2r_reg_code_from_arch_encoded_fp_reg(RDI_Arch arch, CV_EncodedFramePtrReg encoded_reg);
|
||||
internal RDI_RegCode p2r_reg_code_from_arch_encoded_fp_reg(RDI_Arch arch, CV_EncodedFramePtrReg encoded_reg);
|
||||
internal void p2r_location_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationSet *locset, RDIM_Location *location, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -586,6 +607,7 @@ internal TS_TASK_FUNCTION_DEF(p2r_bake_types_strings_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_udts_strings_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_symbols_strings_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_scopes_strings_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_line_tables_task__entry_point);
|
||||
|
||||
//- rjf: bake string map joining
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_string_map_join_task__entry_point);
|
||||
@@ -597,8 +619,7 @@ internal TS_TASK_FUNCTION_DEF(p2r_bake_string_map_sort_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_build_bake_name_map_task__entry_point);
|
||||
|
||||
//- rjf: pass 2: string-map-dependent debug info stream builds
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_units_top_level_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_unit_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_units_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_unit_vmap_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_src_files_task__entry_point);
|
||||
internal TS_TASK_FUNCTION_DEF(p2r_bake_udts_task__entry_point);
|
||||
@@ -624,6 +645,6 @@ internal P2R_Bake2Serialize *p2r_bake(Arena *arena, P2R_Convert2Bake *in);
|
||||
////////////////////////////////
|
||||
//~ rjf: Top-Level Compression Entry Point
|
||||
|
||||
internal P2R_Bake2Serialize *p2r_compress(Arena *arena, P2R_Bake2Serialize *in);
|
||||
internal P2R_Serialize2File *p2r_compress(Arena *arena, P2R_Serialize2File *in);
|
||||
|
||||
#endif // RDI_FROM_PDB_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#define BUILD_VERSION_MAJOR 0
|
||||
#define BUILD_VERSION_MINOR 9
|
||||
#define BUILD_VERSION_PATCH 10
|
||||
#define BUILD_VERSION_PATCH 11
|
||||
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||
#define BUILD_TITLE "rdi_from_pdb"
|
||||
#define BUILD_CONSOLE_INTERFACE 1
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "base/base_inc.h"
|
||||
#include "os/os_inc.h"
|
||||
#include "task_system/task_system.h"
|
||||
#include "rdi_make_local/rdi_make_local.h"
|
||||
#include "rdi_make/rdi_make_local.h"
|
||||
#include "coff/coff.h"
|
||||
#include "codeview/codeview.h"
|
||||
#include "codeview/codeview_stringize.h"
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "base/base_inc.c"
|
||||
#include "os/os_inc.c"
|
||||
#include "task_system/task_system.c"
|
||||
#include "rdi_make_local/rdi_make_local.c"
|
||||
#include "rdi_make/rdi_make_local.c"
|
||||
#include "coff/coff.c"
|
||||
#include "codeview/codeview.c"
|
||||
#include "codeview/codeview_stringize.c"
|
||||
@@ -64,7 +64,7 @@ entry_point(CmdLine *cmdline)
|
||||
{
|
||||
fprintf(stderr, "--- rdi_from_pdb --------------------------------------------------------------\n\n");
|
||||
|
||||
fprintf(stderr, "This utility converts debug information from PDBs into the RAD Debug Info.\n");
|
||||
fprintf(stderr, "This utility converts debug information from PDBs into the RAD Debug Info\n");
|
||||
fprintf(stderr, "format. The following arguments are accepted:\n\n");
|
||||
|
||||
fprintf(stderr, "--exe:<path> [optional] Specifies the path of the executable file for which the\n");
|
||||
@@ -98,22 +98,31 @@ entry_point(CmdLine *cmdline)
|
||||
bake2srlz = p2r_bake(arena, convert2bake);
|
||||
}
|
||||
|
||||
//- rjf: serialize
|
||||
P2R_Serialize2File *srlz2file = 0;
|
||||
ProfScope("serialize")
|
||||
{
|
||||
srlz2file = push_array(arena, P2R_Serialize2File, 1);
|
||||
srlz2file->bundle = rdim_serialized_section_bundle_from_bake_results(&bake2srlz->bake_results);
|
||||
}
|
||||
|
||||
//- rjf: compress
|
||||
P2R_Bake2Serialize *bake2srlz_compressed = bake2srlz;
|
||||
P2R_Serialize2File *srlz2file_compressed = srlz2file;
|
||||
if(cmd_line_has_flag(cmdline, str8_lit("compress"))) ProfScope("compress")
|
||||
{
|
||||
bake2srlz_compressed = p2r_compress(arena, bake2srlz);
|
||||
srlz2file_compressed = push_array(arena, P2R_Serialize2File, 1);
|
||||
srlz2file_compressed = p2r_compress(arena, srlz2file);
|
||||
}
|
||||
|
||||
//- rjf: serialize
|
||||
String8List serialize_out = rdim_serialized_strings_from_params_bake_section_list(arena, &convert2bake->bake_params, &bake2srlz_compressed->sections);
|
||||
String8List blobs = rdim_file_blobs_from_section_bundle(arena, &srlz2file_compressed->bundle);
|
||||
|
||||
//- rjf: write
|
||||
ProfScope("write")
|
||||
{
|
||||
OS_Handle output_file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_Write, user2convert->output_name);
|
||||
U64 off = 0;
|
||||
for(String8Node *n = serialize_out.first; n != 0; n = n->next)
|
||||
for(String8Node *n = blobs.first; n != 0; n = n->next)
|
||||
{
|
||||
os_file_write(output_file, r1u64(off, off+n->string.size), n->string.str);
|
||||
off += n->string.size;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user