Skip to content

Commit 73802b9

Browse files
authored
Merge pull request GaijinEntertainment#2121 from GaijinEntertainment/and-even-more-tutorials
debug agent and apply in context - tutorials and tests, also bugfixes
2 parents d9c8ce4 + 0d76efd commit 73802b9

83 files changed

Lines changed: 3812 additions & 25 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

doc/make_pdf.bat

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@ECHO OFF
2+
REM Build PDFs using rinohtype (no LaTeX required)
3+
REM Usage: make_pdf.bat
4+
5+
if "%SPHINXBUILD%" == "" (
6+
set SPHINXBUILD=sphinx-build
7+
)
8+
set BUILDDIR=build
9+
set PDFDIR=%BUILDDIR%\rinoh_pdf
10+
11+
echo Building Reference Manual PDF...
12+
"D:\Work\daScript\.venv\Scripts\python.exe" -c ^
13+
"import sys; sys.setrecursionlimit(10000); ^
14+
from sphinx.cmd.build import main; ^
15+
main(['-b','rinoh','-d','%BUILDDIR%/doctrees_ref','-D','master_doc=reference/index','source','%PDFDIR%/reference'])"
16+
if errorlevel 1 (
17+
echo ERROR: Reference Manual build failed
18+
exit /b 1
19+
)
20+
21+
echo.
22+
echo Building Standard Library PDF...
23+
"D:\Work\daScript\.venv\Scripts\python.exe" -c ^
24+
"import sys; sys.setrecursionlimit(10000); ^
25+
from sphinx.cmd.build import main; ^
26+
main(['-b','rinoh','-d','%BUILDDIR%/doctrees_stdlib','-D','master_doc=stdlib/index','source','%PDFDIR%/stdlib'])"
27+
if errorlevel 1 (
28+
echo ERROR: Standard Library build failed
29+
exit /b 1
30+
)
31+
32+
echo.
33+
echo Copying PDFs to site/doc...
34+
if not exist "..\site\doc" mkdir "..\site\doc"
35+
copy /Y "%PDFDIR%\reference\*.pdf" "..\site\doc\"
36+
copy /Y "%PDFDIR%\stdlib\*.pdf" "..\site\doc\"
37+
38+
echo.
39+
echo Done. PDFs are in %PDFDIR% and ..\site\doc\

doc/make_pdf.ps1

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Build PDFs using rinohtype (no LaTeX required)
2+
# Usage: .\make_pdf.ps1
3+
4+
$python = "D:\Work\daScript\.venv\Scripts\python.exe"
5+
$sphinx = "D:\Work\daScript\.venv\Scripts\sphinx-build.exe"
6+
$buildDir = "build"
7+
$pdfDir = "$buildDir\rinoh_pdf"
8+
$siteDocDir = "..\site\doc"
9+
10+
$buildScript = @"
11+
import sys
12+
import threading
13+
14+
def build_main():
15+
from sphinx.cmd.build import main
16+
raise SystemExit(main(sys.argv[1:]))
17+
18+
sys.setrecursionlimit(10000)
19+
threading.stack_size(64 * 1024 * 1024) # 64MB stack
20+
t = threading.Thread(target=build_main)
21+
t.start()
22+
t.join()
23+
"@
24+
$buildScriptFile = "$buildDir\sphinx_build_wrapper.py"
25+
Set-Content -Path $buildScriptFile -Value $buildScript
26+
27+
Write-Host "Building Reference Manual PDF..." -ForegroundColor Cyan
28+
$env:RINOH_BUILD_MODE = 'reference'
29+
& $python $buildScriptFile -b rinoh -d "$buildDir/doctrees_ref" `
30+
-D "master_doc=reference/index" source "$pdfDir/reference"
31+
$env:RINOH_BUILD_MODE = ''
32+
if ($LASTEXITCODE -ne 0) {
33+
Write-Error "Reference Manual build failed (exit $LASTEXITCODE)"
34+
exit 1
35+
}
36+
37+
Write-Host ""
38+
Write-Host "Building Standard Library PDF..." -ForegroundColor Cyan
39+
$env:RINOH_BUILD_MODE = 'stdlib'
40+
& $python $buildScriptFile -b rinoh -d "$buildDir/doctrees_stdlib" `
41+
-D "master_doc=stdlib/index" source "$pdfDir/stdlib"
42+
$env:RINOH_BUILD_MODE = ''
43+
if ($LASTEXITCODE -ne 0) {
44+
Write-Error "Standard Library build failed (exit $LASTEXITCODE)"
45+
exit 1
46+
}
47+
48+
Write-Host ""
49+
Write-Host "Copying PDFs to $siteDocDir ..." -ForegroundColor Cyan
50+
if (-not (Test-Path $siteDocDir)) { New-Item -ItemType Directory -Path $siteDocDir | Out-Null }
51+
Get-ChildItem "$pdfDir\reference", "$pdfDir\stdlib" -Filter "*.pdf" | Copy-Item -Destination $siteDocDir
52+
53+
Write-Host ""
54+
Write-Host "Done!" -ForegroundColor Green
55+
Write-Host "PDFs written to: $(Resolve-Path $pdfDir)"
56+
Write-Host "Copied to site: $(Resolve-Path $siteDocDir)"

doc/reflections/das2rst.das

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,22 @@ def document_module_network(root : string) {
191191
document("Network socket library", mod, "network.rst", groups)
192192
}
193193

194+
def document_module_debugapi(root : string) {
195+
var mod = get_module("debugapi")
196+
var groups <- array<DocGroup>(
197+
group_by_regex("Agent lifecycle", mod, %regex~(fork_debug_agent_context|install_debug_agent|install_debug_agent_thread_local|install_new_debug_agent|install_new_thread_local_debug_agent|has_debug_agent_context|get_debug_agent_context|delete_debug_agent_context|is_in_debug_agent_creation|lock_debug_agent)$%%),
198+
group_by_regex("Cross-context invocation", mod, %regex~(invoke_in_context|invoke_debug_agent_method|invoke_debug_agent_function)$%%),
199+
group_by_regex("Agent construction", mod, %regex~(make_debug_agent|make_data_walker|make_stack_walker)$%%),
200+
group_by_regex("Agent tick and state collection", mod, %regex~(tick_debug_agent|collect_debug_agent_state|on_breakpoints_reset|report_context_state|debug_agent_command|debugger_stop_requested)$%%),
201+
group_by_regex("Instrumentation", mod, %regex~(instrument_node|instrument_function|instrument_all_functions|instrument_all_functions_thread_local|instrument_context_allocations|clear_instruments|set_single_step)$%%),
202+
group_by_regex("Data and stack walking", mod, %regex~(walk_data|walk_stack|stackwalk|stack_depth)$%%),
203+
group_by_regex("Context inspection", mod, %regex~(get_context_global_variable|has_function|get_heap_stats)$%%),
204+
group_by_regex("Breakpoints", mod, %regex~(set_hw_breakpoint|clear_hw_breakpoint)$%%),
205+
group_by_regex("Memory", mod, %regex~(free_temp_string|temp_string_size|break_on_free|track_insane_pointer)$%%)
206+
)
207+
document("Debug agent API", mod, "debugapi.rst", groups)
208+
}
209+
194210
def document_module_uriparser(root : string) {
195211
var mod = get_module("uriparser")
196212
var groups <- array<DocGroup>(
@@ -1043,6 +1059,7 @@ def main {
10431059
document_module_fio(root)
10441060
document_module_network(root)
10451061
document_module_uriparser(root)
1062+
document_module_debugapi(root)
10461063
document_module_rtti(root)
10471064
document_module_ast(root)
10481065
document_module_strings(root)

doc/source/reference/tutorials.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ introduced in earlier tutorials.
7272
tutorials/42_testing_tools.rst
7373
tutorials/43_interfaces.rst
7474
tutorials/44_compile_and_run.rst
75+
tutorials/45_debug_agents.rst
76+
tutorials/46_apply_in_context.rst
7577

7678
.. _tutorials_integration_c:
7779

doc/source/reference/tutorials/44_compile_and_run.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,5 @@ Quick reference
281281
Helper file: :download:`tutorials/language/44_helper.das <../../../../tutorials/language/44_helper.das>`
282282

283283
Previous tutorial: :ref:`tutorial_interfaces`
284+
285+
Next tutorial: :ref:`tutorial_debug_agents`

0 commit comments

Comments
 (0)